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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/automation/automation_provider.h" 5 #include "chrome/browser/automation/automation_provider.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/l10n_util_mac.h" 10 #include "app/l10n_util_mac.h"
11 #include "base/sys_string_conversions.h" 11 #include "base/sys_string_conversions.h"
12 #include "chrome/browser/cocoa/tab_window_controller.h" 12 #include "chrome/browser/cocoa/tab_window_controller.h"
13 #include "chrome/browser/view_ids.h"
14 #import "chrome/browser/cocoa/browser_window_controller.h"
13 #include "chrome/test/automation/automation_messages.h" 15 #include "chrome/test/automation/automation_messages.h"
14 #include "gfx/point.h" 16 #include "gfx/point.h"
15 #include "gfx/rect.h" 17 #include "gfx/rect.h"
16 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
17 19
18 void AutomationProvider::SetWindowBounds(int handle, const gfx::Rect& bounds, 20 void AutomationProvider::SetWindowBounds(int handle, const gfx::Rect& bounds,
19 bool* success) { 21 bool* success) {
20 *success = false; 22 *success = false;
21 NSWindow* window = window_tracker_->GetResource(handle); 23 NSWindow* window = window_tracker_->GetResource(handle);
22 if (window) { 24 if (window) {
(...skipping 21 matching lines...) Expand all
44 [window orderOut:nil]; 46 [window orderOut:nil];
45 } 47 }
46 *result = true; 48 *result = true;
47 } 49 }
48 } 50 }
49 51
50 void AutomationProvider::WindowGetViewBounds(int handle, int view_id, 52 void AutomationProvider::WindowGetViewBounds(int handle, int view_id,
51 bool screen_coordinates, 53 bool screen_coordinates,
52 bool* success, 54 bool* success,
53 gfx::Rect* bounds) { 55 gfx::Rect* bounds) {
54 // AutomationProxyVisibleTest claims that this is used only by Chrome Views 56 *success = false;
55 // which we don't use on the Mac. Is this true?
56 57
57 *success = false; 58 // At the moment we hard code the view ID used by WebDriver and do
58 NOTIMPLEMENTED(); 59 // not support arbitrary view IDs. suzhe is working on general view
60 // ID support for the Mac.
61 if (view_id != VIEW_ID_TAB_CONTAINER) {
62 NOTIMPLEMENTED();
63 return;
64 }
65
66 NSWindow* window = window_tracker_->GetResource(handle);
67 if (!window)
68 return;
69
70 BrowserWindowController* controller = [window windowController];
71 DCHECK([controller isKindOfClass:[BrowserWindowController class]]);
72 if (![controller isKindOfClass:[BrowserWindowController class]])
73 return;
74 NSView* tab = [controller selectedTabView];
75 if (!tab)
76 return;
77
78 NSPoint coords = NSZeroPoint;
79 if (screen_coordinates) {
80 coords = [window convertBaseToScreen:[tab convertPoint:NSZeroPoint
81 toView:nil]];
82 } else {
83 coords = [tab convertPoint:NSZeroPoint toView:[window contentView]];
84 }
85 // Flip coordinate system
86 coords.y = [[window screen] frame].size.height - coords.y;
87 *success = true;
59 } 88 }
60 89
61 void AutomationProvider::ActivateWindow(int handle) { NOTIMPLEMENTED(); } 90 void AutomationProvider::ActivateWindow(int handle) { NOTIMPLEMENTED(); }
62 91
63 void AutomationProvider::IsWindowMaximized(int handle, bool* is_maximized, 92 void AutomationProvider::IsWindowMaximized(int handle, bool* is_maximized,
64 bool* success) { 93 bool* success) {
65 *success = false; 94 *success = false;
66 NOTIMPLEMENTED(); 95 NOTIMPLEMENTED();
67 } 96 }
68 97
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 132 }
104 // If we don't yet have a title, use "Untitled". 133 // If we don't yet have a title, use "Untitled".
105 if (![title length]) { 134 if (![title length]) {
106 text->assign(WideToUTF16(l10n_util::GetString( 135 text->assign(WideToUTF16(l10n_util::GetString(
107 IDS_BROWSER_WINDOW_MAC_TAB_UNTITLED))); 136 IDS_BROWSER_WINDOW_MAC_TAB_UNTITLED)));
108 return; 137 return;
109 } 138 }
110 139
111 text->assign(base::SysNSStringToUTF16(title)); 140 text->assign(base::SysNSStringToUTF16(title));
112 } 141 }
OLDNEW
« 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