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

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

Issue 16087006: Revert "Revert 202751 "Change RulesRegistryService to use ProfileKeyedAPI."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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_apitest.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 #include "chrome/browser/extensions/api/declarative/declarative_api.h" 5 #include "chrome/browser/extensions/api/declarative/declarative_api.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/task_runner_util.h" 9 #include "base/task_runner_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 19 matching lines...) Expand all
30 std::string event_name; 30 std::string event_name;
31 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &event_name)); 31 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &event_name));
32 return extension_->HasAPIPermission(event_name); 32 return extension_->HasAPIPermission(event_name);
33 } 33 }
34 34
35 bool RulesFunction::RunImpl() { 35 bool RulesFunction::RunImpl() {
36 std::string event_name; 36 std::string event_name;
37 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &event_name)); 37 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &event_name));
38 38
39 RulesRegistryService* rules_registry_service = 39 RulesRegistryService* rules_registry_service =
40 ExtensionSystemFactory::GetForProfile(profile())-> 40 RulesRegistryService::Get(profile());
41 rules_registry_service();
42 rules_registry_ = rules_registry_service->GetRulesRegistry(event_name); 41 rules_registry_ = rules_registry_service->GetRulesRegistry(event_name);
43 // Raw access to this function is not available to extensions, therefore 42 // Raw access to this function is not available to extensions, therefore
44 // there should never be a request for a nonexisting rules registry. 43 // there should never be a request for a nonexisting rules registry.
45 EXTENSION_FUNCTION_VALIDATE(rules_registry_); 44 EXTENSION_FUNCTION_VALIDATE(rules_registry_);
46 45
47 if (content::BrowserThread::CurrentlyOn(rules_registry_->owner_thread())) { 46 if (content::BrowserThread::CurrentlyOn(rules_registry_->owner_thread())) {
48 bool success = RunImplOnCorrectThread(); 47 bool success = RunImplOnCorrectThread();
49 SendResponse(success); 48 SendResponse(success);
50 } else { 49 } else {
51 scoped_refptr<base::MessageLoopProxy> message_loop_proxy = 50 scoped_refptr<base::MessageLoopProxy> message_loop_proxy =
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 error_ = rules_registry_->GetAllRules(extension_id(), &rules); 99 error_ = rules_registry_->GetAllRules(extension_id(), &rules);
101 } 100 }
102 101
103 if (error_.empty()) 102 if (error_.empty())
104 results_ = GetRules::Results::Create(rules); 103 results_ = GetRules::Results::Create(rules);
105 104
106 return error_.empty(); 105 return error_.empty();
107 } 106 }
108 107
109 } // namespace extensions 108 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/declarative/declarative_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698