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