Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: chrome/browser/automation/automation_provider_mac.mm

Issue 2843054: Implement AutomationProvider::WindowGetViewBounds() for... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/automation/automation_provider_mac.mm
===================================================================
--- chrome/browser/automation/automation_provider_mac.mm (revision 52574)
+++ chrome/browser/automation/automation_provider_mac.mm (working copy)
@@ -10,6 +10,8 @@
#include "app/l10n_util_mac.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/cocoa/tab_window_controller.h"
+#include "chrome/browser/view_ids.h"
+#import "chrome/browser/cocoa/browser_window_controller.h"
#include "chrome/test/automation/automation_messages.h"
#include "gfx/point.h"
#include "gfx/rect.h"
@@ -51,11 +53,38 @@
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;
- *success = false;
- NOTIMPLEMENTED();
+ // At the moment we hard code the view ID used by WebDriver and do
+ // not support arbitrary view IDs. suzhe is working on general view
+ // ID support for the Mac.
+ if (view_id != VIEW_ID_TAB_CONTAINER) {
+ NOTIMPLEMENTED();
+ return;
+ }
+
+ NSWindow* window = window_tracker_->GetResource(handle);
+ if (!window)
+ return;
+
+ BrowserWindowController* controller = [window windowController];
+ DCHECK([controller isKindOfClass:[BrowserWindowController class]]);
+ if (![controller isKindOfClass:[BrowserWindowController class]])
+ return;
+ NSView* tab = [controller selectedTabView];
+ if (!tab)
+ return;
+
+ NSPoint coords = NSZeroPoint;
+ if (screen_coordinates) {
+ coords = [window convertBaseToScreen:[tab convertPoint:NSZeroPoint
+ toView:nil]];
+ } else {
+ coords = [tab convertPoint:NSZeroPoint toView:[window contentView]];
+ }
+ // Flip coordinate system
+ coords.y = [[window screen] frame].size.height - coords.y;
+ *success = true;
}
void AutomationProvider::ActivateWindow(int handle) { NOTIMPLEMENTED(); }
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698