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

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

Issue 6614023: Convert ChromeDriver to use only the JSON automation interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address Pawel's additional comments Created 9 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider_json.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Support utilities for the JSON automation interface used by PyAuto. 5 // Support utilities for the JSON automation interface used by PyAuto.
6 6
7 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ 7 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_
8 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ 8 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_
9 #pragma once 9 #pragma once
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/compiler_specific.h"
14
15 class AutomationProvider;
16 class Browser;
17 class DictionaryValue;
18 class TabContents;
13 class Value; 19 class Value;
14 class AutomationProvider;
15 20
16 namespace IPC { 21 namespace IPC {
17 class Message; 22 class Message;
18 } 23 }
19 24
20 // Helper to ensure we always send a reply message for JSON automation requests. 25 // Helper to ensure we always send a reply message for JSON automation requests.
21 class AutomationJSONReply { 26 class AutomationJSONReply {
22 public: 27 public:
23 // Creates a new reply object for the IPC message |reply_message| for 28 // Creates a new reply object for the IPC message |reply_message| for
24 // |provider|. The caller is expected to call SendSuccess() or SendError() 29 // |provider|. The caller is expected to call SendSuccess() or SendError()
25 // before destroying this object. 30 // before destroying this object.
26 AutomationJSONReply(AutomationProvider* provider, 31 AutomationJSONReply(AutomationProvider* provider,
27 IPC::Message* reply_message); 32 IPC::Message* reply_message);
28 33
29 ~AutomationJSONReply(); 34 ~AutomationJSONReply();
30 35
31 // Send a success reply along with data contained in |value|. 36 // Send a success reply along with data contained in |value|.
32 // An empty message will be sent if |value| is NULL. 37 // An empty message will be sent if |value| is NULL.
33 void SendSuccess(const Value* value); 38 void SendSuccess(const Value* value);
34 39
35 // Send an error reply along with error message |error_message|. 40 // Send an error reply along with error message |error_message|.
36 void SendError(const std::string& error_message); 41 void SendError(const std::string& error_message);
37 42
38 private: 43 private:
39 AutomationProvider* provider_; 44 AutomationProvider* provider_;
40 IPC::Message* message_; 45 IPC::Message* message_;
41 }; 46 };
42 47
48 // Gets the browser specified by the given dictionary |args|. |args| should
49 // contain a key 'windex' which refers to the index of the browser. Returns
50 // true on success and sets |browser|. Otherwise, |error| will be set.
51 bool GetBrowserFromJSONArgs(DictionaryValue* args,
52 Browser** browser,
53 std::string* error) WARN_UNUSED_RESULT;
54
55 // Gets the tab specified by the given dictionary |args|. |args| should
56 // contain a key 'windex' which refers to the index of the parent browser,
57 // and a key 'tab_index' which refers to the index of the tab in that browser.
58 // Returns true on success and sets |tab|. Otherwise, |error| will be set.
59 bool GetTabFromJSONArgs(DictionaryValue* args,
60 TabContents** tab,
61 std::string* error) WARN_UNUSED_RESULT;
62
63 // Gets the browser and tab specified by the given dictionary |args|. |args|
64 // should contain a key 'windex' which refers to the index of the browser and
65 // a key 'tab_index' which refers to the index of the tab in that browser.
66 // Returns true on success and sets |browser| and |tab|. Otherwise, |error|
67 // will be set.
68 bool GetBrowserAndTabFromJSONArgs(DictionaryValue* args,
69 Browser** browser,
70 TabContents** tab,
71 std::string* error) WARN_UNUSED_RESULT;
72
43 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ 73 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698