| 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(); }
|
|
|