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

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: Fix memory leaks Created 8 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/extensions/api/declarative/declarative_api.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) 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"
10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/extensions/api/declarative/rules_registry.h"
9 #include "chrome/browser/extensions/extension_function.h" 12 #include "chrome/browser/extensions/extension_function.h"
10 13
11 namespace extensions { 14 namespace extensions {
12 15
13 class AddRulesFunction : public SyncExtensionFunction { 16 class RulesFunction : public AsyncExtensionFunction {
14 public: 17 public:
18 RulesFunction();
19 virtual ~RulesFunction();
15 virtual bool RunImpl() OVERRIDE; 20 virtual bool RunImpl() OVERRIDE;
21
22 // Concrete implementation of the RulesFunction that is being called
23 // on the thread on which the respective RulesRegistry lives.
24 // Returns false in case of errors.
25 virtual bool RunImplOnCorrectThread() = 0;
26
27 protected:
28 scoped_refptr<RulesRegistry> rules_registry_;
29
30 private:
31 void SendResponseOnUIThread();
32 };
33
34 class AddRulesFunction : public RulesFunction {
35 public:
36 virtual bool 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 bool 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 bool 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/declarative/declarative_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698