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

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

Issue 160064: Push bookmarks.remove/removeAll polymorphism into c++. fix bookmarks id schema issues (Closed)
Patch Set: presubmit Created 11 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
« no previous file with comments | « no previous file | chrome/browser/automation/automation_extension_function.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // Defines AutomationExtensionFunction. 5 // Defines AutomationExtensionFunction.
6 6
7 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_FUNCTION_H_ 7 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_FUNCTION_H_
8 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_FUNCTION_H_ 8 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_FUNCTION_H_
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "chrome/browser/extensions/extension_function.h" 12 #include "chrome/browser/extensions/extension_function.h"
13 13
14 class RenderViewHost; 14 class RenderViewHost;
15 15
16 // An extension function that pipes the extension API call through the 16 // An extension function that pipes the extension API call through the
17 // automation interface, so that extensions can be tested using UITests. 17 // automation interface, so that extensions can be tested using UITests.
18 class AutomationExtensionFunction : public ExtensionFunction { 18 class AutomationExtensionFunction : public ExtensionFunction {
19 public: 19 public:
20 AutomationExtensionFunction() { } 20 AutomationExtensionFunction() { }
21 21
22 // ExtensionFunction implementation. 22 // ExtensionFunction implementation.
23 virtual void SetName(const std::string& name);
24 virtual void SetArgs(const std::string& args); 23 virtual void SetArgs(const std::string& args);
25 virtual const std::string GetResult(); 24 virtual const std::string GetResult();
26 virtual const std::string GetError(); 25 virtual const std::string GetError();
27 virtual void Run(); 26 virtual void Run();
28 27
29 static ExtensionFunction* Factory(); 28 static ExtensionFunction* Factory();
30 29
31 // If enabled, we set an instance of this function as the functor 30 // If enabled, we set an instance of this function as the functor
32 // for all function names in ExtensionFunctionFactoryRegistry. 31 // for all function names in ExtensionFunctionFactoryRegistry.
33 // If disabled, we restore the initial functions. 32 // If disabled, we restore the initial functions.
34 static void SetEnabled(bool enabled); 33 static void SetEnabled(bool enabled);
35 34
36 // Intercepts messages sent from the external host to check if they 35 // Intercepts messages sent from the external host to check if they
37 // are actually responses to extension API calls. If they are, redirects 36 // are actually responses to extension API calls. If they are, redirects
38 // the message to view_host->SendExtensionResponse and returns true, 37 // the message to view_host->SendExtensionResponse and returns true,
39 // otherwise returns false to indicate the message was not intercepted. 38 // otherwise returns false to indicate the message was not intercepted.
40 static bool InterceptMessageFromExternalHost(RenderViewHost* view_host, 39 static bool InterceptMessageFromExternalHost(RenderViewHost* view_host,
41 const std::string& message, 40 const std::string& message,
42 const std::string& origin, 41 const std::string& origin,
43 const std::string& target); 42 const std::string& target);
44 43
45 private: 44 private:
46 static bool enabled_; 45 static bool enabled_;
47 std::string name_;
48 std::string args_; 46 std::string args_;
49 DISALLOW_COPY_AND_ASSIGN(AutomationExtensionFunction); 47 DISALLOW_COPY_AND_ASSIGN(AutomationExtensionFunction);
50 }; 48 };
51 49
52 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_FUNCTION_H_ 50 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_EXTENSION_FUNCTION_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/automation_extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698