From 931557826809453ca0dd96096b4bed5e233525c5 Mon Sep 17 00:00:00 2001 From: Jim Evans Date: Mon, 15 Dec 2014 11:34:03 -0500 Subject: [PATCH] Internal IE driver API change GetWindowHandle to GetContentWindowHandle Changing the base DocumentHost class to use GetContentWindowHandle as the method name for the method to get the content window handle. --- cpp/iedriver/Browser.cpp | 6 +++--- cpp/iedriver/Browser.h | 2 +- .../CommandHandlers/ScreenshotCommandHandler.h | 2 +- .../CommandHandlers/SendKeysCommandHandler.h | 2 +- cpp/iedriver/DocumentHost.h | 2 +- cpp/iedriver/ElementRepository.cpp | 2 +- cpp/iedriver/HtmlDialog.cpp | 4 ++-- cpp/iedriver/HtmlDialog.h | 2 +- cpp/iedriver/InputManager.cpp | 14 +++++++------- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cpp/iedriver/Browser.cpp b/cpp/iedriver/Browser.cpp index 72fc3d1f1fcbf..7f7fa3a933f5a 100644 --- a/cpp/iedriver/Browser.cpp +++ b/cpp/iedriver/Browser.cpp @@ -188,8 +188,8 @@ std::string Browser::GetBrowserUrl() { return current_url; } -HWND Browser::GetWindowHandle() { - LOG(TRACE) << "Entering Browser::GetWindowHandle"; +HWND Browser::GetContentWindowHandle() { + LOG(TRACE) << "Entering Browser::GetContentWindowHandle"; // If, for some reason, the window handle is no longer valid, // set the member variable to NULL so that we can reacquire @@ -650,7 +650,7 @@ HWND Browser::GetActiveDialogWindowHandle() { HWND active_dialog_handle = NULL; DWORD process_id; - ::GetWindowThreadProcessId(this->GetWindowHandle(), &process_id); + ::GetWindowThreadProcessId(this->GetContentWindowHandle(), &process_id); ProcessWindowInfo process_win_info; process_win_info.dwProcessId = process_id; diff --git a/cpp/iedriver/Browser.h b/cpp/iedriver/Browser.h index d7c6f7c184cea..22387c44799d3 100644 --- a/cpp/iedriver/Browser.h +++ b/cpp/iedriver/Browser.h @@ -91,7 +91,7 @@ class Browser : public DocumentHost, public IDispEventSimpleImpl<1, Browser, &DI std::string GetWindowName(void); std::string GetTitle(void); std::string GetBrowserUrl(void); - HWND GetWindowHandle(void); + HWND GetContentWindowHandle(void); HWND GetTopLevelWindowHandle(void); HWND GetActiveDialogWindowHandle(void); diff --git a/cpp/iedriver/CommandHandlers/ScreenshotCommandHandler.h b/cpp/iedriver/CommandHandlers/ScreenshotCommandHandler.h index f4f8a73a0da03..f9219bcbe0ebb 100644 --- a/cpp/iedriver/CommandHandlers/ScreenshotCommandHandler.h +++ b/cpp/iedriver/CommandHandlers/ScreenshotCommandHandler.h @@ -109,7 +109,7 @@ class ScreenshotCommandHandler : public IECommandHandler { LOG(TRACE) << "Entering ScreenshotCommandHandler::CaptureBrowser"; ie_window_handle = browser->GetTopLevelWindowHandle(); - HWND content_window_handle = browser->GetWindowHandle(); + HWND content_window_handle = browser->GetContentWindowHandle(); CComPtr document; browser->GetDocument(&document); diff --git a/cpp/iedriver/CommandHandlers/SendKeysCommandHandler.h b/cpp/iedriver/CommandHandlers/SendKeysCommandHandler.h index 942926f3c8a5c..daa7065fbbdff 100644 --- a/cpp/iedriver/CommandHandlers/SendKeysCommandHandler.h +++ b/cpp/iedriver/CommandHandlers/SendKeysCommandHandler.h @@ -70,7 +70,7 @@ class SendKeysCommandHandler : public IECommandHandler { response->SetErrorResponse(status_code, "Unable to get browser"); return; } - HWND window_handle = browser_wrapper->GetWindowHandle(); + HWND window_handle = browser_wrapper->GetContentWindowHandle(); HWND top_level_window_handle = browser_wrapper->GetTopLevelWindowHandle(); ElementHandle element_wrapper; diff --git a/cpp/iedriver/DocumentHost.h b/cpp/iedriver/DocumentHost.h index 748eae74de09c..33496638662dd 100644 --- a/cpp/iedriver/DocumentHost.h +++ b/cpp/iedriver/DocumentHost.h @@ -33,7 +33,7 @@ class DocumentHost { virtual void Close(void) = 0; virtual bool Wait(void) = 0; virtual bool IsBusy(void) = 0; - virtual HWND GetWindowHandle(void) = 0; + virtual HWND GetContentWindowHandle(void) = 0; virtual std::string GetWindowName(void) = 0; virtual std::string GetTitle(void) = 0; virtual std::string GetBrowserUrl(void) = 0; diff --git a/cpp/iedriver/ElementRepository.cpp b/cpp/iedriver/ElementRepository.cpp index 1a6beced79f43..b78c08400143b 100644 --- a/cpp/iedriver/ElementRepository.cpp +++ b/cpp/iedriver/ElementRepository.cpp @@ -62,7 +62,7 @@ void ElementRepository::AddManagedElement(BrowserHandle current_browser, if (!element_already_managed) { LOG(DEBUG) << "Element is not yet managed"; ElementHandle new_wrapper(new Element(element, - current_browser->GetWindowHandle())); + current_browser->GetContentWindowHandle())); this->managed_elements_[new_wrapper->element_id()] = new_wrapper; *element_wrapper = new_wrapper; } else { diff --git a/cpp/iedriver/HtmlDialog.cpp b/cpp/iedriver/HtmlDialog.cpp index 6d0d09577d6c3..49f275b19e00a 100644 --- a/cpp/iedriver/HtmlDialog.cpp +++ b/cpp/iedriver/HtmlDialog.cpp @@ -127,8 +127,8 @@ bool HtmlDialog::Wait() { return !this->is_navigating_; } -HWND HtmlDialog::GetWindowHandle() { - LOG(TRACE) << "Entering HtmlDialog::GetWindowHandle"; +HWND HtmlDialog::GetContentWindowHandle() { + LOG(TRACE) << "Entering HtmlDialog::GetContentWindowHandle"; return this->window_handle(); } diff --git a/cpp/iedriver/HtmlDialog.h b/cpp/iedriver/HtmlDialog.h index 8910ac0c4dc83..c2ee2d434bce1 100644 --- a/cpp/iedriver/HtmlDialog.h +++ b/cpp/iedriver/HtmlDialog.h @@ -50,7 +50,7 @@ class HtmlDialog : public DocumentHost, public IDispEventSimpleImpl<1, HtmlDialo void Close(void); bool Wait(void); bool IsBusy(void); - HWND GetWindowHandle(void); + HWND GetContentWindowHandle(void); std::string GetWindowName(void); std::string GetTitle(void); std::string GetBrowserUrl(void); diff --git a/cpp/iedriver/InputManager.cpp b/cpp/iedriver/InputManager.cpp index bf1acc3691151..87de867daf578 100644 --- a/cpp/iedriver/InputManager.cpp +++ b/cpp/iedriver/InputManager.cpp @@ -235,7 +235,7 @@ bool InputManager::SetFocusToBrowser(BrowserHandle browser_wrapper) { LOG(TRACE) << "Entering InputManager::SetFocusToBrowser"; DWORD lock_timeout = 0; DWORD process_id = 0; - DWORD thread_id = ::GetWindowThreadProcessId(browser_wrapper->GetWindowHandle(), &process_id); + DWORD thread_id = ::GetWindowThreadProcessId(browser_wrapper->GetContentWindowHandle(), &process_id); DWORD current_thread_id = ::GetCurrentThreadId(); HWND current_foreground_window = ::GetForegroundWindow(); if (current_foreground_window != browser_wrapper->GetTopLevelWindowHandle()) { @@ -257,7 +257,7 @@ bool InputManager::SetFocusToBrowser(BrowserHandle browser_wrapper) { int InputManager::MouseClick(BrowserHandle browser_wrapper, int button) { LOG(TRACE) << "Entering InputManager::MouseClick"; if (this->use_native_events_) { - HWND browser_window_handle = browser_wrapper->GetWindowHandle(); + HWND browser_window_handle = browser_wrapper->GetContentWindowHandle(); if (this->require_window_focus_) { LOG(DEBUG) << "Queueing SendInput structure for mouse click"; int down_flag = MOUSEEVENTF_LEFTDOWN; @@ -325,7 +325,7 @@ int InputManager::MouseClick(BrowserHandle browser_wrapper, int button) { int InputManager::MouseButtonDown(BrowserHandle browser_wrapper) { LOG(TRACE) << "Entering InputManager::MouseButtonDown"; if (this->use_native_events_) { - HWND browser_window_handle = browser_wrapper->GetWindowHandle(); + HWND browser_window_handle = browser_wrapper->GetContentWindowHandle(); if (this->require_window_focus_) { LOG(DEBUG) << "Queuing SendInput structure for mouse button down"; this->AddMouseInput(browser_window_handle, MOUSEEVENTF_LEFTDOWN, this->last_known_mouse_x_, this->last_known_mouse_y_); @@ -362,7 +362,7 @@ int InputManager::MouseButtonDown(BrowserHandle browser_wrapper) { int InputManager::MouseButtonUp(BrowserHandle browser_wrapper) { LOG(TRACE) << "Entering InputManager::MouseButtonUp"; if (this->use_native_events_) { - HWND browser_window_handle = browser_wrapper->GetWindowHandle(); + HWND browser_window_handle = browser_wrapper->GetContentWindowHandle(); if (this->require_window_focus_) { LOG(DEBUG) << "Queuing SendInput structure for mouse button up"; this->AddMouseInput(browser_window_handle, MOUSEEVENTF_LEFTUP, this->last_known_mouse_x_, this->last_known_mouse_y_); @@ -399,7 +399,7 @@ int InputManager::MouseButtonUp(BrowserHandle browser_wrapper) { int InputManager::MouseDoubleClick(BrowserHandle browser_wrapper) { LOG(TRACE) << "Entering InputManager::MouseDoubleClick"; if (this->use_native_events_) { - HWND browser_window_handle = browser_wrapper->GetWindowHandle(); + HWND browser_window_handle = browser_wrapper->GetContentWindowHandle(); if (this->require_window_focus_) { LOG(DEBUG) << "Queueing SendInput structure for mouse double click"; this->AddMouseInput(browser_window_handle, MOUSEEVENTF_LEFTDOWN, this->last_known_mouse_x_, this->last_known_mouse_y_); @@ -492,7 +492,7 @@ int InputManager::MouseMoveTo(BrowserHandle browser_wrapper, std::string element end_y += y_offset; } - HWND browser_window_handle = browser_wrapper->GetWindowHandle(); + HWND browser_window_handle = browser_wrapper->GetContentWindowHandle(); if (this->require_window_focus_) { if (end_x == this->last_known_mouse_x_ && end_y == this->last_known_mouse_y_) { LOG(DEBUG) << "Omitting SendInput structure for mouse move; no movement required"; @@ -556,7 +556,7 @@ int InputManager::SendKeystrokes(BrowserHandle browser_wrapper, Json::Value keys keys.append(StringUtilities::ToWString(key)); } if (this->enable_native_events()) { - HWND window_handle = browser_wrapper->GetWindowHandle(); + HWND window_handle = browser_wrapper->GetContentWindowHandle(); if (this->require_window_focus_) { LOG(DEBUG) << "Queueing Sendinput structures for sending keys"; for (unsigned int char_index = 0; char_index < keys.size(); ++char_index) {