summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-21 15:05:46 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-21 15:05:46 +0000
commitfb05865fb200994c4f861f94ca198eed522b4976 (patch)
tree672b07ad296dbdd924fe530d29a3127ce31bf45f /chrome
parent06dd877a2937a0b5ca74de4240117206df36628b (diff)
downloadchromium_src-fb05865fb200994c4f861f94ca198eed522b4976.zip
chromium_src-fb05865fb200994c4f861f94ca198eed522b4976.tar.gz
chromium_src-fb05865fb200994c4f861f94ca198eed522b4976.tar.bz2
Adding basic window control to the automation provider for the Mac.
BUG=http://crbug.com/16616 TEST=as described in bug. Review URL: http://codereview.chromium.org/216024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26681 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/automation_provider.cc2
-rw-r--r--chrome/browser/automation/automation_provider_mac.mm73
-rw-r--r--chrome/chrome.gyp1
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc40
4 files changed, 75 insertions, 41 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index b461636..263ad5b 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -737,7 +737,7 @@ void AutomationProvider::GetLastActiveBrowserWindow(int* handle) {
*handle = browser_tracker_->Add(browser);
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_MACOSX)
// TODO(estade): use this implementation for all platforms?
void AutomationProvider::GetActiveWindow(int* handle) {
gfx::NativeWindow window =
diff --git a/chrome/browser/automation/automation_provider_mac.mm b/chrome/browser/automation/automation_provider_mac.mm
new file mode 100644
index 0000000..6e8ae1b
--- /dev/null
+++ b/chrome/browser/automation/automation_provider_mac.mm
@@ -0,0 +1,73 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/automation/automation_provider.h"
+
+#import <Cocoa/Cocoa.h>
+#include "base/gfx/point.h"
+#include "base/gfx/rect.h"
+
+void AutomationProvider::SetWindowBounds(int handle, const gfx::Rect& bounds,
+ bool* success) {
+ *success = false;
+ NSWindow* window = window_tracker_->GetResource(handle);
+ if (window) {
+ NSRect new_bounds = NSRectFromCGRect(bounds.ToCGRect());
+
+ // This is likely incorrect for a multiple-monitor setup; OK because this is
+ // used only for testing purposes.
+ new_bounds.origin.y = [[window screen] frame].size.height -
+ new_bounds.origin.y - new_bounds.size.height;
+
+ [window setFrame:new_bounds display:NO];
+ *success = true;
+ }
+}
+
+void AutomationProvider::SetWindowVisible(int handle, bool visible,
+ bool* result) {
+ *result = false;
+ NSWindow* window = window_tracker_->GetResource(handle);
+ if (window) {
+ if (visible) {
+ [window orderFront:nil];
+ } else {
+ [window orderOut:nil];
+ }
+ *result = true;
+ }
+}
+
+void AutomationProvider::WindowGetViewBounds(int handle, int view_id,
+ bool screen_coordinates,
+ bool* success,
+ gfx::Rect* bounds) {
+ // AutomationProxyVisibleTest claims that this is used only by Chrome Views
+ // which we don't use on the Mac. Is this true?
+
+ *success = false;
+ NOTIMPLEMENTED();
+}
+
+void AutomationProvider::ActivateWindow(int handle) { NOTIMPLEMENTED(); }
+
+void AutomationProvider::GetFocusedViewID(int handle, int* view_id) {
+ NOTIMPLEMENTED();
+}
+
+void AutomationProvider::PrintAsync(int tab_handle) {
+ NOTIMPLEMENTED();
+}
+
+void AutomationProvider::SetInitialFocus(const IPC::Message& message,
+ int handle, bool reverse) {
+ NOTIMPLEMENTED();
+}
+
+void AutomationProvider::GetBookmarkBarVisibility(int handle, bool* visible,
+ bool* animating) {
+ *visible = false;
+ *animating = false;
+ NOTIMPLEMENTED();
+}
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 1becee5..030d2b5 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -728,6 +728,7 @@
'browser/automation/automation_profile_impl.cc',
'browser/automation/automation_profile_impl.h',
'browser/automation/automation_provider_gtk.cc',
+ 'browser/automation/automation_provider_mac.mm',
'browser/automation/automation_provider_win.cc',
'browser/automation/automation_provider.cc',
'browser/automation/automation_provider.h',
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index 23c11ed..00e79ba 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -36,16 +36,6 @@ class TabContents;
//--------------------------------------------------------------------------
#if defined(OS_MACOSX)
-void AutomationProvider::GetActiveWindow(int* handle) { NOTIMPLEMENTED(); }
-
-void AutomationProvider::SetWindowVisible(int handle, bool visible,
- bool* result) { NOTIMPLEMENTED(); }
-
-void AutomationProvider::SetWindowBounds(int handle, const gfx::Rect& bounds,
- bool* success) {
- NOTIMPLEMENTED();
-}
-
void AutomationProvider::GetAutocompleteEditForBrowser(
int browser_handle,
bool* success,
@@ -90,36 +80,6 @@ void AutomationProvider::OnMessageFromExternalHost(
NOTIMPLEMENTED();
}
-void AutomationProvider::WindowGetViewBounds(int handle, int view_id,
- bool screen_coordinates,
- bool* success,
- gfx::Rect* bounds) {
- *success = false;
- NOTIMPLEMENTED();
-}
-
-void AutomationProvider::ActivateWindow(int handle) { NOTIMPLEMENTED(); }
-
-void AutomationProvider::GetFocusedViewID(int handle, int* view_id) {
- NOTIMPLEMENTED();
-}
-
-void AutomationProvider::PrintAsync(int tab_handle) {
- NOTIMPLEMENTED();
-}
-
-void AutomationProvider::SetInitialFocus(const IPC::Message& message,
- int handle, bool reverse) {
- NOTIMPLEMENTED();
-}
-
-void AutomationProvider::GetBookmarkBarVisibility(int handle, bool* visible,
- bool* animating) {
- *visible = false;
- *animating = false;
- NOTIMPLEMENTED();
-}
-
#endif // defined(OS_MACOSX)
//--------------------------------------------------------------------------