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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.h

Issue 10534163: First pass at refactoring pyautolib in preparation for removing proxy dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_
6 #define CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ 6 #define CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 class TestingAutomationProvider : public AutomationProvider, 57 class TestingAutomationProvider : public AutomationProvider,
58 public BrowserList::Observer, 58 public BrowserList::Observer,
59 public importer::ImporterListObserver, 59 public importer::ImporterListObserver,
60 public content::NotificationObserver { 60 public content::NotificationObserver {
61 public: 61 public:
62 explicit TestingAutomationProvider(Profile* profile); 62 explicit TestingAutomationProvider(Profile* profile);
63 63
64 virtual IPC::Channel::Mode GetChannelMode(bool use_named_interface); 64 virtual IPC::Channel::Mode GetChannelMode(bool use_named_interface);
65 65
66 // IPC::Channel::Listener: 66 // IPC::Channel::Listener:
67 //
67 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 68 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
68 virtual void OnChannelError() OVERRIDE; 69 virtual void OnChannelError() OVERRIDE;
69 70
70 private: 71 private:
71 // Storage for ImportSettings() to resume operations after a callback. 72 // Storage for ImportSettings() to resume operations after a callback.
72 struct ImportSettingsData { 73 struct ImportSettingsData {
73 string16 browser_name; 74 string16 browser_name;
74 int import_items; 75 int import_items;
75 bool first_run; 76 bool first_run;
76 Browser* browser; 77 Browser* browser;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 IPC::Message* reply_message); 241 IPC::Message* reply_message);
241 242
242 void GoForwardBlockUntilNavigationsComplete(int handle, 243 void GoForwardBlockUntilNavigationsComplete(int handle,
243 int number_of_navigations, 244 int number_of_navigations,
244 IPC::Message* reply_message); 245 IPC::Message* reply_message);
245 246
246 void SetShelfVisibility(int handle, bool visible); 247 void SetShelfVisibility(int handle, bool visible);
247 248
248 // Generic pattern for pyautolib 249 // Generic pattern for pyautolib
249 // Uses the JSON interface for input/output. 250 // Uses the JSON interface for input/output.
250 void SendJSONRequest(int handle, 251 void SendJSONRequestWithHandle(int handle,
252 const std::string& json_request,
253 IPC::Message* reply_message);
254 void SendJSONRequestWithIndex(int index,
255 const std::string& json_request,
256 IPC::Message* reply_message);
257 void SendJSONRequest(Browser* browser,
251 const std::string& json_request, 258 const std::string& json_request,
252 IPC::Message* reply_message); 259 IPC::Message* reply_message,
260 bool browser_provided);
253 261
254 // Method ptr for json handlers. 262 // Method ptr for json handlers.
255 // Uses the JSON interface for input/output. 263 // Uses the JSON interface for input/output.
256 typedef void (TestingAutomationProvider::*JsonHandler)(base::DictionaryValue*, 264 typedef void (TestingAutomationProvider::*JsonHandler)(base::DictionaryValue*,
257 IPC::Message*); 265 IPC::Message*);
258 266
259 // Method ptr for json handlers that take a browser argument. 267 // Method ptr for json handlers that take a browser argument.
260 // Uses the JSON interface for input/output. 268 // Uses the JSON interface for input/output.
261 typedef void (TestingAutomationProvider::*BrowserJsonHandler)( 269 typedef void (TestingAutomationProvider::*BrowserJsonHandler)(
262 Browser* browser, 270 Browser* browser,
263 base::DictionaryValue*, 271 base::DictionaryValue*,
264 IPC::Message*); 272 IPC::Message*);
265 273
274 // JSON interface helper functions.
275 static DictionaryValue* ParseJSONRequestCommand(
276 const std::string& json_request,
277 std::string* command,
278 std::string* error);
279 static void BuildJSONHandlerMaps(
280 std::map<std::string, JsonHandler>* handler_map,
281 std::map<std::string, BrowserJsonHandler>* browser_handler_map);
282
266 // Set window dimensions. 283 // Set window dimensions.
267 // Uses the JSON interface for input/output. 284 // Uses the JSON interface for input/output.
268 void SetWindowDimensions(Browser* browser, 285 void SetWindowDimensions(Browser* browser,
269 base::DictionaryValue* args, 286 base::DictionaryValue* args,
270 IPC::Message* reply_message); 287 IPC::Message* reply_message);
271 288
272 // Get info about infobars in the given WebContents object. 289 // Get info about infobars in the given WebContents object.
273 // This includes info about the type of infobars, the message text, 290 // This includes info about the type of infobars, the message text,
274 // buttons, etc. 291 // buttons, etc.
275 // Caller owns the returned object. 292 // Caller owns the returned object.
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 ImportSettingsData import_settings_data_; 1573 ImportSettingsData import_settings_data_;
1557 1574
1558 // The automation event observer queue. It is lazily created when an observer 1575 // The automation event observer queue. It is lazily created when an observer
1559 // is added to avoid overhead when not needed. 1576 // is added to avoid overhead when not needed.
1560 scoped_ptr<AutomationEventQueue> automation_event_queue_; 1577 scoped_ptr<AutomationEventQueue> automation_event_queue_;
1561 1578
1562 DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider); 1579 DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider);
1563 }; 1580 };
1564 1581
1565 #endif // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ 1582 #endif // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698