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

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

Issue 10823247: In the declarative API, check that the extension has permission for the event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove ExtensionSystem debugging Created 8 years, 4 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 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "chrome/browser/extensions/api/declarative/rules_registry.h" 10 #include "chrome/browser/extensions/api/declarative/rules_registry.h"
11 #include "chrome/browser/extensions/extension_function.h" 11 #include "chrome/browser/extensions/extension_function.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 class RulesFunction : public AsyncExtensionFunction { 15 class RulesFunction : public AsyncExtensionFunction {
16 public: 16 public:
17 RulesFunction(); 17 RulesFunction();
18 18
19 protected: 19 protected:
20 virtual ~RulesFunction(); 20 virtual ~RulesFunction();
21 21
22 // ExtensionFunction: 22 // ExtensionFunction:
23 virtual bool HasPermission() OVERRIDE;
23 virtual bool RunImpl() OVERRIDE; 24 virtual bool RunImpl() OVERRIDE;
24 25
25 // Concrete implementation of the RulesFunction that is being called 26 // Concrete implementation of the RulesFunction that is being called
26 // on the thread on which the respective RulesRegistry lives. 27 // on the thread on which the respective RulesRegistry lives.
27 // Returns false in case of errors. 28 // Returns false in case of errors.
28 virtual bool RunImplOnCorrectThread() = 0; 29 virtual bool RunImplOnCorrectThread() = 0;
29 30
30 scoped_refptr<RulesRegistry> rules_registry_; 31 scoped_refptr<RulesRegistry> rules_registry_;
32
33 private:
34 // Initializes |event_name_| from |args_| if it hasn't been already,
35 // and returns true if it was successful.
36 bool Init();
37
38 std::string event_name_;
31 }; 39 };
32 40
33 class AddRulesFunction : public RulesFunction { 41 class AddRulesFunction : public RulesFunction {
34 public: 42 public:
35 DECLARE_EXTENSION_FUNCTION_NAME("events.addRules"); 43 DECLARE_EXTENSION_FUNCTION_NAME("events.addRules");
36 44
37 protected: 45 protected:
38 virtual ~AddRulesFunction() {} 46 virtual ~AddRulesFunction() {}
39 47
40 // RulesFunction: 48 // RulesFunction:
(...skipping 18 matching lines...) Expand all
59 protected: 67 protected:
60 virtual ~GetRulesFunction() {} 68 virtual ~GetRulesFunction() {}
61 69
62 // RulesFunction: 70 // RulesFunction:
63 virtual bool RunImplOnCorrectThread() OVERRIDE; 71 virtual bool RunImplOnCorrectThread() OVERRIDE;
64 }; 72 };
65 73
66 } // namespace extensions 74 } // namespace extensions
67 75
68 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H__ 76 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_DECLARATIVE_API_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698