OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ | 5 #ifndef CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
6 #define CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ | 6 #define CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
11 #include <windows.h> | 11 #include <windows.h> |
12 #endif | 12 #endif |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 | 15 |
| 16 #include "chrome/browser/browser.h" |
16 #include "chrome/test/automation/automation_handle_tracker.h" | 17 #include "chrome/test/automation/automation_handle_tracker.h" |
17 | 18 |
18 class GURL; | 19 class GURL; |
19 class TabProxy; | 20 class TabProxy; |
20 class WindowProxy; | 21 class WindowProxy; |
21 class AutocompleteEditProxy; | 22 class AutocompleteEditProxy; |
22 | 23 |
23 namespace gfx { | 24 namespace gfx { |
24 class Point; | 25 class Point; |
25 class Rect; | 26 class Rect; |
26 } | 27 } |
27 | 28 |
28 // This class presents the interface to actions that can be performed on | 29 // This class presents the interface to actions that can be performed on |
29 // a given browser window. Note that this object can be invalidated at any | 30 // a given browser window. Note that this object can be invalidated at any |
30 // time if the corresponding browser window in the app is closed. In that case, | 31 // time if the corresponding browser window in the app is closed. In that case, |
31 // any subsequent calls will return false immediately. | 32 // any subsequent calls will return false immediately. |
32 class BrowserProxy : public AutomationResourceProxy { | 33 class BrowserProxy : public AutomationResourceProxy { |
33 public: | 34 public: |
34 enum Type { | |
35 TYPE_NORMAL = 0, | |
36 TYPE_POPUP = 1, | |
37 TYPE_APP = 2, | |
38 TYPE_APP_POPUP = TYPE_APP | TYPE_POPUP, | |
39 }; | |
40 | |
41 BrowserProxy(AutomationMessageSender* sender, | 35 BrowserProxy(AutomationMessageSender* sender, |
42 AutomationHandleTracker* tracker, | 36 AutomationHandleTracker* tracker, |
43 int handle) | 37 int handle) |
44 : AutomationResourceProxy(tracker, sender, handle) {} | 38 : AutomationResourceProxy(tracker, sender, handle) {} |
45 | 39 |
46 // Activates the tab corresponding to (zero-based) tab_index. Returns true if | 40 // Activates the tab corresponding to (zero-based) tab_index. Returns true if |
47 // successful. | 41 // successful. |
48 bool ActivateTab(int tab_index); | 42 bool ActivateTab(int tab_index); |
49 | 43 |
50 // Like ActivateTab, but returns false if response is not received before | 44 // Like ActivateTab, but returns false if response is not received before |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // the call was successful. | 80 // the call was successful. |
87 bool GetTabCount(int* num_tabs) const; | 81 bool GetTabCount(int* num_tabs) const; |
88 | 82 |
89 // Like GetTabCount, but returns false if tab count is not received within the | 83 // Like GetTabCount, but returns false if tab count is not received within the |
90 // before timeout. | 84 // before timeout. |
91 bool GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms, | 85 bool GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms, |
92 bool* is_timeout) const; | 86 bool* is_timeout) const; |
93 | 87 |
94 // Returns the type of the given window. Returns true if the call was | 88 // Returns the type of the given window. Returns true if the call was |
95 // successful. | 89 // successful. |
96 bool GetType(Type* type) const; | 90 bool GetType(Browser::Type* type) const; |
97 | 91 |
98 // Returns the TabProxy for the tab at the given index, transferring | 92 // Returns the TabProxy for the tab at the given index, transferring |
99 // ownership of the pointer to the caller. On failure, returns NULL. | 93 // ownership of the pointer to the caller. On failure, returns NULL. |
100 // | 94 // |
101 // Use GetTabCount to see how many windows you can ask for. Tab numbers | 95 // Use GetTabCount to see how many windows you can ask for. Tab numbers |
102 // are 0-based. | 96 // are 0-based. |
103 scoped_refptr<TabProxy> GetTab(int tab_index) const; | 97 scoped_refptr<TabProxy> GetTab(int tab_index) const; |
104 | 98 |
105 // Returns the TabProxy for the currently active tab, transferring | 99 // Returns the TabProxy for the currently active tab, transferring |
106 // ownership of the pointer to the caller. On failure, returns NULL. | 100 // ownership of the pointer to the caller. On failure, returns NULL. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // mahine). | 204 // mahine). |
211 bool TerminateSession(); | 205 bool TerminateSession(); |
212 | 206 |
213 protected: | 207 protected: |
214 virtual ~BrowserProxy() {} | 208 virtual ~BrowserProxy() {} |
215 private: | 209 private: |
216 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); | 210 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); |
217 }; | 211 }; |
218 | 212 |
219 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ | 213 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
OLD | NEW |