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

Side by Side Diff: chrome/browser/extensions/api/declarative/declarative_api.h

Issue 9422003: Migrate Declarative API bindings to new JSON objects generated by JSON compiler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pacify clang Created 8 years, 10 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_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H__ 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H__
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h"
9 #include "chrome/browser/extensions/extension_function.h" 10 #include "chrome/browser/extensions/extension_function.h"
10 11
11 namespace extensions { 12 namespace extensions {
13 class RulesRegistry;
14 }
12 15
13 class AddRulesFunction : public SyncExtensionFunction { 16 namespace extensions {
17
18 class RulesFunction : public AsyncExtensionFunction {
14 public: 19 public:
20 RulesFunction();
15 virtual bool RunImpl() OVERRIDE; 21 virtual bool RunImpl() OVERRIDE;
22
23 // Concrete implementation of the RulesFunction that is being called
24 // on the thread on which the respective RulesRegistry lives.
25 virtual void RunImplOnCorrectThread() = 0;
26
27 protected:
28 RulesRegistry* rules_registry_;
29
30 private:
31 void SendResponseOnUIThread();
32 };
33
34 class AddRulesFunction : public RulesFunction {
35 public:
36 virtual void RunImplOnCorrectThread() OVERRIDE;
16 DECLARE_EXTENSION_FUNCTION_NAME("experimental.declarative.addRules"); 37 DECLARE_EXTENSION_FUNCTION_NAME("experimental.declarative.addRules");
17 }; 38 };
18 39
19 class RemoveRulesFunction : public SyncExtensionFunction { 40 class RemoveRulesFunction : public RulesFunction {
20 public: 41 public:
21 virtual bool RunImpl() OVERRIDE; 42 virtual void RunImplOnCorrectThread() OVERRIDE;
22 DECLARE_EXTENSION_FUNCTION_NAME("experimental.declarative.removeRules"); 43 DECLARE_EXTENSION_FUNCTION_NAME("experimental.declarative.removeRules");
23 }; 44 };
24 45
25 class GetRulesFunction : public SyncExtensionFunction { 46 class GetRulesFunction : public RulesFunction {
26 public: 47 public:
27 virtual bool RunImpl() OVERRIDE; 48 virtual void RunImplOnCorrectThread() OVERRIDE;
28 DECLARE_EXTENSION_FUNCTION_NAME("experimental.declarative.getRules"); 49 DECLARE_EXTENSION_FUNCTION_NAME("experimental.declarative.getRules");
29 }; 50 };
30 51
31 } // namespace extensions 52 } // namespace extensions
32 53
33 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H__ 54 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698