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

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

Issue 7259019: Move base/values.h into the base namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 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" 13 #include "base/compiler_specific.h"
14 14
15 class AutomationProvider; 15 class AutomationProvider;
16 class Browser; 16 class Browser;
17 class TabContents;
18
19 namespace base {
17 class DictionaryValue; 20 class DictionaryValue;
18 class TabContents;
19 class Value; 21 class Value;
22 }
20 23
21 namespace IPC { 24 namespace IPC {
22 class Message; 25 class Message;
23 } 26 }
24 27
25 // Helper to ensure we always send a reply message for JSON automation requests. 28 // Helper to ensure we always send a reply message for JSON automation requests.
26 class AutomationJSONReply { 29 class AutomationJSONReply {
27 public: 30 public:
28 // Creates a new reply object for the IPC message |reply_message| for 31 // Creates a new reply object for the IPC message |reply_message| for
29 // |provider|. The caller is expected to call SendSuccess() or SendError() 32 // |provider|. The caller is expected to call SendSuccess() or SendError()
30 // before destroying this object. 33 // before destroying this object.
31 AutomationJSONReply(AutomationProvider* provider, 34 AutomationJSONReply(AutomationProvider* provider,
32 IPC::Message* reply_message); 35 IPC::Message* reply_message);
33 36
34 ~AutomationJSONReply(); 37 ~AutomationJSONReply();
35 38
36 // Send a success reply along with data contained in |value|. 39 // Send a success reply along with data contained in |value|.
37 // An empty message will be sent if |value| is NULL. 40 // An empty message will be sent if |value| is NULL.
38 void SendSuccess(const Value* value); 41 void SendSuccess(const base::Value* value);
39 42
40 // Send an error reply along with error message |error_message|. 43 // Send an error reply along with error message |error_message|.
41 void SendError(const std::string& error_message); 44 void SendError(const std::string& error_message);
42 45
43 private: 46 private:
44 AutomationProvider* provider_; 47 AutomationProvider* provider_;
45 IPC::Message* message_; 48 IPC::Message* message_;
46 }; 49 };
47 50
48 // Gets the browser specified by the given dictionary |args|. |args| should 51 // 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 52 // 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. 53 // true on success and sets |browser|. Otherwise, |error| will be set.
51 bool GetBrowserFromJSONArgs(DictionaryValue* args, 54 bool GetBrowserFromJSONArgs(base::DictionaryValue* args,
52 Browser** browser, 55 Browser** browser,
53 std::string* error) WARN_UNUSED_RESULT; 56 std::string* error) WARN_UNUSED_RESULT;
54 57
55 // Gets the tab specified by the given dictionary |args|. |args| should 58 // 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, 59 // 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. 60 // 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. 61 // Returns true on success and sets |tab|. Otherwise, |error| will be set.
59 bool GetTabFromJSONArgs(DictionaryValue* args, 62 bool GetTabFromJSONArgs(base::DictionaryValue* args,
60 TabContents** tab, 63 TabContents** tab,
61 std::string* error) WARN_UNUSED_RESULT; 64 std::string* error) WARN_UNUSED_RESULT;
62 65
63 // Gets the browser and tab specified by the given dictionary |args|. |args| 66 // 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 67 // 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. 68 // 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| 69 // Returns true on success and sets |browser| and |tab|. Otherwise, |error|
67 // will be set. 70 // will be set.
68 bool GetBrowserAndTabFromJSONArgs(DictionaryValue* args, 71 bool GetBrowserAndTabFromJSONArgs(base::DictionaryValue* args,
69 Browser** browser, 72 Browser** browser,
70 TabContents** tab, 73 TabContents** tab,
71 std::string* error) WARN_UNUSED_RESULT; 74 std::string* error) WARN_UNUSED_RESULT;
72 75
73 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ 76 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider.h ('k') | chrome/browser/automation/automation_provider_observers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698