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) |
(...skipping 13 matching lines...) Expand all Loading... |
24 class Point; | 24 class Point; |
25 class Rect; | 25 class Rect; |
26 } | 26 } |
27 | 27 |
28 // This class presents the interface to actions that can be performed on | 28 // 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 | 29 // 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, | 30 // time if the corresponding browser window in the app is closed. In that case, |
31 // any subsequent calls will return false immediately. | 31 // any subsequent calls will return false immediately. |
32 class BrowserProxy : public AutomationResourceProxy { | 32 class BrowserProxy : public AutomationResourceProxy { |
33 public: | 33 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, | 34 BrowserProxy(AutomationMessageSender* sender, |
42 AutomationHandleTracker* tracker, | 35 AutomationHandleTracker* tracker, |
43 int handle) | 36 int handle) |
44 : AutomationResourceProxy(tracker, sender, handle) {} | 37 : AutomationResourceProxy(tracker, sender, handle) {} |
45 | 38 |
46 // Activates the tab corresponding to (zero-based) tab_index. Returns true if | 39 // Activates the tab corresponding to (zero-based) tab_index. Returns true if |
47 // successful. | 40 // successful. |
48 bool ActivateTab(int tab_index); | 41 bool ActivateTab(int tab_index); |
49 | 42 |
50 // Like ActivateTab, but returns false if response is not received before | 43 // Like ActivateTab, but returns false if response is not received before |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 77 |
85 // Returns the number of tabs in the given window. Returns true if | 78 // Returns the number of tabs in the given window. Returns true if |
86 // the call was successful. | 79 // the call was successful. |
87 bool GetTabCount(int* num_tabs) const; | 80 bool GetTabCount(int* num_tabs) const; |
88 | 81 |
89 // Like GetTabCount, but returns false if tab count is not received within the | 82 // Like GetTabCount, but returns false if tab count is not received within the |
90 // before timeout. | 83 // before timeout. |
91 bool GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms, | 84 bool GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms, |
92 bool* is_timeout) const; | 85 bool* is_timeout) const; |
93 | 86 |
94 // Returns the type of the given window. Returns true if the call was | |
95 // successful. | |
96 bool GetType(Type* type) const; | |
97 | |
98 // Returns the TabProxy for the tab at the given index, transferring | 87 // Returns the TabProxy for the tab at the given index, transferring |
99 // ownership of the pointer to the caller. On failure, returns NULL. | 88 // ownership of the pointer to the caller. On failure, returns NULL. |
100 // | 89 // |
101 // Use GetTabCount to see how many windows you can ask for. Tab numbers | 90 // Use GetTabCount to see how many windows you can ask for. Tab numbers |
102 // are 0-based. | 91 // are 0-based. |
103 scoped_refptr<TabProxy> GetTab(int tab_index) const; | 92 scoped_refptr<TabProxy> GetTab(int tab_index) const; |
104 | 93 |
105 // Returns the TabProxy for the currently active tab, transferring | 94 // Returns the TabProxy for the currently active tab, transferring |
106 // ownership of the pointer to the caller. On failure, returns NULL. | 95 // ownership of the pointer to the caller. On failure, returns NULL. |
107 scoped_refptr<TabProxy> GetActiveTab() const; | 96 scoped_refptr<TabProxy> GetActiveTab() const; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // mahine). | 199 // mahine). |
211 bool TerminateSession(); | 200 bool TerminateSession(); |
212 | 201 |
213 protected: | 202 protected: |
214 virtual ~BrowserProxy() {} | 203 virtual ~BrowserProxy() {} |
215 private: | 204 private: |
216 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); | 205 DISALLOW_COPY_AND_ASSIGN(BrowserProxy); |
217 }; | 206 }; |
218 | 207 |
219 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ | 208 #endif // CHROME_TEST_AUTOMATION_BROWSER_PROXY_H_ |
OLD | NEW |