| 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_AUTOMATION_PROXY_H__ | 5 #ifndef CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ |
| 6 #define CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ | 6 #define CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "base/thread.h" | 12 #include "base/thread.h" |
| 13 #include "chrome/common/ipc_channel_proxy.h" | 13 #include "chrome/common/ipc_channel_proxy.h" |
| 14 #include "chrome/common/ipc_message.h" | 14 #include "chrome/common/ipc_message.h" |
| 15 #include "chrome/test/automation/automation_handle_tracker.h" | 15 #include "chrome/test/automation/automation_handle_tracker.h" |
| 16 #include "chrome/test/automation/automation_messages.h" | 16 #include "chrome/test/automation/automation_messages.h" |
| 17 #include "chrome/views/dialog_delegate.h" | 17 #include "chrome/views/dialog_delegate.h" |
| 18 | 18 |
| 19 class AutomationRequest; | 19 class AutomationRequest; |
| 20 class BrowserProxy; | 20 class BrowserProxy; |
| 21 class TabProxy; |
| 21 class WindowProxy; | 22 class WindowProxy; |
| 22 class TabProxy; | |
| 23 class AutocompleteEditProxy; | |
| 24 | 23 |
| 25 // This is an interface that AutomationProxy-related objects can use to | 24 // This is an interface that AutomationProxy-related objects can use to |
| 26 // access the message-sending abilities of the Proxy. | 25 // access the message-sending abilities of the Proxy. |
| 27 class AutomationMessageSender : public IPC::Message::Sender { | 26 class AutomationMessageSender : public IPC::Message::Sender { |
| 28 public: | 27 public: |
| 29 // Sends a message synchronously (from the perspective of the caller's | 28 // Sends a message synchronously (from the perspective of the caller's |
| 30 // thread, at least); it doesn't return until a response has been received. | 29 // thread, at least); it doesn't return until a response has been received. |
| 31 // This method takes ownership of the request object passed in. The caller | 30 // This method takes ownership of the request object passed in. The caller |
| 32 // is responsible for deleting the response object when they're done with it. | 31 // is responsible for deleting the response object when they're done with it. |
| 33 // response_type should be set to the message type of the expected response. | 32 // response_type should be set to the message type of the expected response. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 IPC::Message** response, | 170 IPC::Message** response, |
| 172 int response_type, | 171 int response_type, |
| 173 uint32 timeout_ms, | 172 uint32 timeout_ms, |
| 174 bool* is_timeout); | 173 bool* is_timeout); |
| 175 | 174 |
| 176 // Returns the current AutomationRequest object. | 175 // Returns the current AutomationRequest object. |
| 177 AutomationRequest* current_request() { return current_request_; } | 176 AutomationRequest* current_request() { return current_request_; } |
| 178 // Clears the current AutomationRequest object. | 177 // Clears the current AutomationRequest object. |
| 179 void clear_current_request() { current_request_ = NULL; } | 178 void clear_current_request() { current_request_ = NULL; } |
| 180 | 179 |
| 181 // Wrapper over AutomationHandleTracker::InvalidateHandle. Receives the messag
e | 180 // Wrapper over AutomationHandleTracker::InvalidateHandle. Receives the |
| 182 // from AutomationProxy, unpacks the messages and routes that call to the | 181 // message from AutomationProxy, unpacks the messages and routes that call to |
| 183 // tracker. | 182 // the tracker. |
| 184 void InvalidateHandle(const IPC::Message& message); | 183 void InvalidateHandle(const IPC::Message& message); |
| 185 | 184 |
| 186 // Creates a tab that can hosted in an external process. The function | 185 // Creates a tab that can hosted in an external process. The function |
| 187 // returns a TabProxy representing the tab as well as a window handle | 186 // returns a TabProxy representing the tab as well as a window handle |
| 188 // that can be reparented in another process. | 187 // that can be reparented in another process. |
| 189 TabProxy* CreateExternalTab(HWND parent, const gfx::Rect& dimensions, | 188 TabProxy* CreateExternalTab(HWND parent, const gfx::Rect& dimensions, |
| 190 unsigned int style, HWND* external_tab_container); | 189 unsigned int style, HWND* external_tab_container); |
| 191 | 190 |
| 192 int command_execution_timeout_ms() const { | 191 int command_execution_timeout_ms() const { |
| 193 return command_execution_timeout_ms_; | 192 return command_execution_timeout_ms_; |
| 194 } | 193 } |
| 195 | 194 |
| 196 private: | 195 private: |
| 197 DISALLOW_EVIL_CONSTRUCTORS(AutomationProxy); | |
| 198 | |
| 199 void InitializeEvents(); | 196 void InitializeEvents(); |
| 200 void InitializeChannelID(); | 197 void InitializeChannelID(); |
| 201 void InitializeThread(); | 198 void InitializeThread(); |
| 202 void InitializeChannel(); | 199 void InitializeChannel(); |
| 203 void InitializeHandleTracker(); | 200 void InitializeHandleTracker(); |
| 204 | 201 |
| 205 std::wstring channel_id_; | 202 std::wstring channel_id_; |
| 206 scoped_ptr<base::Thread> thread_; | 203 scoped_ptr<base::Thread> thread_; |
| 207 scoped_ptr<IPC::ChannelProxy> channel_; | 204 scoped_ptr<IPC::ChannelProxy> channel_; |
| 208 scoped_ptr<AutomationHandleTracker> tracker_; | 205 scoped_ptr<AutomationHandleTracker> tracker_; |
| 209 | 206 |
| 210 HANDLE app_launched_; | 207 HANDLE app_launched_; |
| 211 HANDLE initial_loads_complete_; | 208 HANDLE initial_loads_complete_; |
| 212 HANDLE new_tab_ui_load_complete_; | 209 HANDLE new_tab_ui_load_complete_; |
| 213 int new_tab_ui_load_time_; | 210 int new_tab_ui_load_time_; |
| 214 | 211 |
| 215 AutomationRequest* current_request_; | 212 AutomationRequest* current_request_; |
| 216 | 213 |
| 217 // Delay to let the browser execute the command. | 214 // Delay to let the browser execute the command. |
| 218 int command_execution_timeout_ms_; | 215 int command_execution_timeout_ms_; |
| 216 |
| 217 DISALLOW_COPY_AND_ASSIGN(AutomationProxy); |
| 219 }; | 218 }; |
| 220 | 219 |
| 221 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ | 220 #endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__ |
| OLD | NEW |