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

Side by Side Diff: chrome/browser/extensions/api/declarative/test_rules_registry.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
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_TEST_RULES_REGISTRY_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/extensions/api/declarative/rules_registry.h" 9 #include "chrome/browser/extensions/api/declarative/rules_registry.h"
10 10
(...skipping 11 matching lines...) Expand all
22 // other concrete RulesRegistries can derive. The purpose of this class 22 // other concrete RulesRegistries can derive. The purpose of this class
23 // would then be to handle just the storage of rules. 23 // would then be to handle just the storage of rules.
24 class TestRulesRegistry : public RulesRegistry { 24 class TestRulesRegistry : public RulesRegistry {
25 public: 25 public:
26 TestRulesRegistry(); 26 TestRulesRegistry();
27 virtual ~TestRulesRegistry(); 27 virtual ~TestRulesRegistry();
28 28
29 // RulesRegistry implementation: 29 // RulesRegistry implementation:
30 virtual std::string AddRules( 30 virtual std::string AddRules(
31 const std::string& extension_id, 31 const std::string& extension_id,
32 const std::vector<base::DictionaryValue*>& rules) OVERRIDE; 32 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) OVERRIDE;
33 virtual std::string RemoveRules( 33 virtual std::string RemoveRules(
34 const std::string& extension_id, 34 const std::string& extension_id,
35 const std::vector<std::string>& rule_identifiers) OVERRIDE; 35 const std::vector<std::string>& rule_identifiers) OVERRIDE;
36 virtual std::string RemoveAllRules( 36 virtual std::string RemoveAllRules(
37 const std::string& extension_id) OVERRIDE; 37 const std::string& extension_id) OVERRIDE;
38 virtual std::string GetRules( 38 virtual std::string GetRules(
39 const std::string& extension_id, 39 const std::string& extension_id,
40 const std::vector<std::string>& rule_identifiers, 40 const std::vector<std::string>& rule_identifiers,
41 std::vector<base::DictionaryValue*>* out) OVERRIDE; 41 std::vector<linked_ptr<RulesRegistry::Rule> >* out) OVERRIDE;
42 virtual std::string GetAllRules( 42 virtual std::string GetAllRules(
43 const std::string& extension_id, 43 const std::string& extension_id,
44 std::vector<base::DictionaryValue*>* out) OVERRIDE; 44 std::vector<linked_ptr<RulesRegistry::Rule> >* out) OVERRIDE;
45 virtual void OnExtensionUnloaded(const std::string& extension_id) OVERRIDE; 45 virtual void OnExtensionUnloaded(const std::string& extension_id) OVERRIDE;
46 virtual content::BrowserThread::ID GetOwnerThread() const OVERRIDE;
47
48 void SetOwnerThread(content::BrowserThread::ID owner_thread) {
49 owner_thread_ = owner_thread;
50 }
46 51
47 private: 52 private:
48 // Map of rule identifier to actual rule. 53 // Map of rule identifier to actual rule.
49 // TODO(battre): consider the extension_ids as part of the key. 54 // TODO(battre): consider the extension_ids as part of the key.
50 typedef std::map<std::string, linked_ptr<base::DictionaryValue> > 55 typedef std::map<std::string, linked_ptr<RulesRegistry::Rule> >
51 RulesDictionary; 56 RulesDictionary;
52 RulesDictionary rules_; 57 RulesDictionary rules_;
58 content::BrowserThread::ID owner_thread_;
53 }; 59 };
54 60
55 } // namespace extensions 61 } // namespace extensions
56 62
57 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__ 63 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698