summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/automation_provider.cc32
-rw-r--r--chrome/browser/automation/automation_provider.h10
-rw-r--r--chrome/browser/tab_restore_uitest.cc11
-rw-r--r--chrome/chrome.gyp2
-rw-r--r--chrome/common/platform_util.h3
-rw-r--r--chrome/common/platform_util_linux.cc4
-rw-r--r--chrome/common/platform_util_mac.mm5
-rw-r--r--chrome/common/platform_util_win.cc4
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc6
9 files changed, 61 insertions, 16 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 8a3c324..fce3a68 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -965,22 +965,26 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
GetBrowserForWindow);
#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(AutomationMsg_CreateExternalTab, CreateExternalTab)
+#endif
IPC_MESSAGE_HANDLER(AutomationMsg_NavigateInExternalTab,
NavigateInExternalTab)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_ShowInterstitialPage,
ShowInterstitialPage);
IPC_MESSAGE_HANDLER(AutomationMsg_HideInterstitialPage,
HideInterstitialPage);
+#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(AutomationMsg_SetAcceleratorsForTab,
SetAcceleratorsForTab)
IPC_MESSAGE_HANDLER(AutomationMsg_ProcessUnhandledAccelerator,
ProcessUnhandledAccelerator)
+#endif
IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForTabToBeRestored,
WaitForTabToBeRestored)
IPC_MESSAGE_HANDLER(AutomationMsg_SetInitialFocus,
SetInitialFocus)
+#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(AutomationMsg_TabReposition, OnTabReposition)
-#endif // defined(OS_WIN)
+#endif
IPC_MESSAGE_HANDLER(AutomationMsg_GetSecurityState,
GetSecurityState)
IPC_MESSAGE_HANDLER(AutomationMsg_GetPageType,
@@ -1690,12 +1694,13 @@ void AutomationProvider::SetWindowVisible(int handle, bool visible,
*result = false;
}
}
+#endif // defined(OS_WIN)
void AutomationProvider::IsWindowActive(int handle, bool* success,
bool* is_active) {
if (window_tracker_->ContainsHandle(handle)) {
- HWND hwnd = window_tracker_->GetResource(handle);
- *is_active = ::GetForegroundWindow() == hwnd;
+ *is_active =
+ platform_util::IsWindowActive(window_tracker_->GetResource(handle));
*success = true;
} else {
*success = false;
@@ -1703,12 +1708,14 @@ void AutomationProvider::IsWindowActive(int handle, bool* success,
}
}
+// TODO(port): port this.
+#if defined(OS_WIN)
void AutomationProvider::ActivateWindow(int handle) {
if (window_tracker_->ContainsHandle(handle)) {
::SetActiveWindow(window_tracker_->GetResource(handle));
}
}
-#endif // defined(OS_WIN)
+#endif
void AutomationProvider::GetTabCount(int handle, int* tab_count) {
*tab_count = -1; // -1 is the error code
@@ -2307,6 +2314,7 @@ void AutomationProvider::CreateExternalTab(HWND parent,
delete external_tab_container;
}
}
+#endif
void AutomationProvider::NavigateInExternalTab(
int handle, const GURL& url,
@@ -2320,6 +2328,8 @@ void AutomationProvider::NavigateInExternalTab(
}
}
+#if defined(OS_WIN)
+// TODO(port): remove windowisms.
void AutomationProvider::SetAcceleratorsForTab(int handle,
HACCEL accel_table,
int accel_entry_count,
@@ -2341,6 +2351,7 @@ void AutomationProvider::ProcessUnhandledAccelerator(
}
// This message expects no response.
}
+#endif
void AutomationProvider::WaitForTabToBeRestored(int tab_handle,
IPC::Message* reply_message) {
@@ -2355,13 +2366,20 @@ void AutomationProvider::WaitForTabToBeRestored(int tab_handle,
void AutomationProvider::SetInitialFocus(const IPC::Message& message,
int handle, bool reverse) {
+#if defined(OS_WIN)
ExternalTabContainer* external_tab = GetExternalTabForHandle(handle);
if (external_tab) {
external_tab->SetInitialFocus(reverse);
}
// This message expects no response.
+#elif defined(OS_POSIX)
+ // TODO(port) enable this function.
+ NOTIMPLEMENTED();
+#endif
}
+// TODO(port): enable these functions.
+#if defined(OS_WIN)
void AutomationProvider::GetSecurityState(int handle, bool* success,
SecurityStyle* security_style,
int* ssl_cert_status,
@@ -2827,7 +2845,8 @@ void AutomationProvider::SavePackageShouldPromptUser(bool should_prompt) {
SavePackage::SetShouldPromptUser(should_prompt);
}
-#ifdef OS_WIN
+#if defined(OS_WIN)
+// TODO(port): Reposition_Params is win-specific. We'll need to port it.
void AutomationProvider::OnTabReposition(
int tab_handle, const IPC::Reposition_Params& params) {
if (!tab_tracker_->ContainsHandle(tab_handle))
@@ -2856,8 +2875,7 @@ void AutomationProvider::OnTabReposition(
}
}
}
-
-#endif // defined(OS_WIN)
+#endif
void AutomationProvider::GetWindowTitle(int handle, string16* text) {
gfx::NativeWindow window = window_tracker_->GetResource(handle);
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 4e33c2d..a7cab75 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -274,25 +274,33 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
IPC::Message* reply_message);
void HideInterstitialPage(int tab_handle, bool* success);
+// TODO(port): remove windowisms.
#if defined(OS_WIN)
- // TODO(port): Re-enable.
void CreateExternalTab(HWND parent, const gfx::Rect& dimensions,
unsigned int style, bool incognito,
HWND* tab_container_window, int* tab_handle);
+#endif // defined(OS_WIN)
+
void NavigateInExternalTab(
int handle, const GURL& url,
AutomationMsg_NavigationResponseValues* status);
+
+// TODO(port): remove windowisms.
+#if defined(OS_WIN)
// The container of an externally hosted tab calls this to reflect any
// accelerator keys that it did not process. This gives the tab a chance
// to handle the keys
void ProcessUnhandledAccelerator(const IPC::Message& message, int handle,
const MSG& msg);
+#endif
void SetInitialFocus(const IPC::Message& message, int handle, bool reverse);
// See comment in AutomationMsg_WaitForTabToBeRestored.
void WaitForTabToBeRestored(int tab_handle, IPC::Message* reply_message);
+// TODO(port): remove windowisms.
+#if defined(OS_WIN)
// This sets the keyboard accelerators to be used by an externally
// hosted tab. This call is not valid on a regular tab hosted within
// Chrome.
diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc
index 506acf6..43d9436 100644
--- a/chrome/browser/tab_restore_uitest.cc
+++ b/chrome/browser/tab_restore_uitest.cc
@@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
+#if defined(OS_WIN)
#include "base/win_util.h"
+#endif
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -125,7 +128,7 @@ class TabRestoreUITest : public UITest {
GURL url2_;
private:
- DISALLOW_EVIL_CONSTRUCTORS(TabRestoreUITest);
+ DISALLOW_COPY_AND_ASSIGN(TabRestoreUITest);
};
// Close the end tab in the current window, then restore it. The tab should be
@@ -231,9 +234,11 @@ TEST_F(TabRestoreUITest, RestoreToDifferentWindow) {
// Close a tab, open a new window, close the first window, then restore the
// tab. It should be in a new window.
TEST_F(TabRestoreUITest, BasicRestoreFromClosedWindow) {
+#if defined(OS_WIN)
// This test is disabled on win2k. See bug 1215881.
if (win_util::GetWinVersion() == win_util::WINVERSION_2000)
return;
+#endif
scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
CheckActiveWindow(browser_proxy.get());
@@ -479,6 +484,9 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) {
EXPECT_EQ(http_url2, GetActiveTabURL());
}
+// TODO(estade): The browser currently ignores the CloseWindow command. We need
+// to enable that command before we can enable this test.
+#if defined(OS_WIN)
TEST_F(TabRestoreUITest, RestoreWindow) {
// Create a new window.
int window_count;
@@ -532,3 +540,4 @@ TEST_F(TabRestoreUITest, RestoreWindow) {
ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url));
EXPECT_TRUE(url == url2_);
}
+#endif // defined(OS_WIN)
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 7cdd1c5..d906037 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -2074,6 +2074,7 @@
'browser/login_prompt_uitest.cc',
'browser/metrics/metrics_service_uitest.cc',
'browser/sessions/session_restore_uitest.cc',
+ 'browser/tab_restore_uitest.cc',
'test/reliability/page_load_test.cc',
'test/ui/layout_plugin_uitest.cc',
'test/ui/omnibox_uitest.cc',
@@ -2094,7 +2095,6 @@
# TODO(port)? (Most of these include windows.h or similar.)
'browser/printing/printing_layout_uitest.cc',
'browser/ssl/ssl_uitest.cc',
- 'browser/tab_restore_uitest.cc',
'browser/unload_uitest.cc',
'browser/views/find_bar_win_uitest.cc',
'common/logging_chrome_uitest.cc',
diff --git a/chrome/common/platform_util.h b/chrome/common/platform_util.h
index 3e0edda..bb10140 100644
--- a/chrome/common/platform_util.h
+++ b/chrome/common/platform_util.h
@@ -21,6 +21,9 @@ gfx::NativeWindow GetTopLevel(gfx::NativeView view);
// Get the title of the window.
string16 GetWindowTitle(gfx::NativeWindow window);
+// Returns true if |window| is the foreground top level window.
+bool IsWindowActive(gfx::NativeWindow window);
+
}
#endif // CHROME_COMMON_PLATFORM_UTIL_H_
diff --git a/chrome/common/platform_util_linux.cc b/chrome/common/platform_util_linux.cc
index 9ef0292..3fd033f 100644
--- a/chrome/common/platform_util_linux.cc
+++ b/chrome/common/platform_util_linux.cc
@@ -37,4 +37,8 @@ string16 GetWindowTitle(gfx::NativeWindow window) {
return UTF8ToUTF16(title);
}
+bool IsWindowActive(gfx::NativeWindow window) {
+ return gtk_window_is_active(window);
+}
+
} // namespace platform_util
diff --git a/chrome/common/platform_util_mac.mm b/chrome/common/platform_util_mac.mm
index d61a50c9..62faf70 100644
--- a/chrome/common/platform_util_mac.mm
+++ b/chrome/common/platform_util_mac.mm
@@ -39,4 +39,9 @@ string16 GetWindowTitle(gfx::NativeWindow window) {
return base::SysNSStringToUTF16(title);
}
+bool IsWindowActive(gfx::NativeWindow window) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
} // namespace platform_util
diff --git a/chrome/common/platform_util_win.cc b/chrome/common/platform_util_win.cc
index 1925122..923904d 100644
--- a/chrome/common/platform_util_win.cc
+++ b/chrome/common/platform_util_win.cc
@@ -93,4 +93,8 @@ string16 GetWindowTitle(gfx::NativeWindow window_handle) {
return WideToUTF16(result);
}
+bool IsWindowActive(gfx::NativeWindow window) {
+ return ::GetForegroundWindow() == window;
+}
+
} // namespace platform_util
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index e8c76be..9aeb0cc 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -29,12 +29,6 @@ class TabContents;
void AutomationProvider::GetActiveWindow(int* handle) { NOTIMPLEMENTED(); }
-void AutomationProvider::IsWindowActive(int handle, bool* success,
- bool* is_active) {
- *success = false;
- NOTIMPLEMENTED();
-}
-
void AutomationProvider::ActivateWindow(int handle) { NOTIMPLEMENTED(); }
void AutomationProvider::SetWindowVisible(int handle, bool visible,