Skip to content

Commit

Permalink
Internal IE driver API change GetWindowHandle to GetContentWindowHandle
Browse files Browse the repository at this point in the history
Changing the base DocumentHost class to use GetContentWindowHandle as the
method name for the method to get the content window handle.
  • Loading branch information
jimevans committed Dec 15, 2014
1 parent 9e6b5f8 commit 9315578
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions cpp/iedriver/Browser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cpp/iedriver/Browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion cpp/iedriver/CommandHandlers/ScreenshotCommandHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<IHTMLDocument2> document;
browser->GetDocument(&document);
Expand Down
2 changes: 1 addition & 1 deletion cpp/iedriver/CommandHandlers/SendKeysCommandHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cpp/iedriver/DocumentHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cpp/iedriver/ElementRepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions cpp/iedriver/HtmlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/iedriver/HtmlDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions cpp/iedriver/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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;
Expand Down Expand Up @@ -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_);
Expand Down Expand Up @@ -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_);
Expand Down Expand Up @@ -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_);
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9315578

Please sign in to comment.