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

Side by Side Diff: chrome/browser/extensions/api/declarative/declarative_apitest.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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" 9 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h"
10 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h" 10 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h"
(...skipping 27 matching lines...) Expand all
38 38
39 // Check that unloading the page has removed all rules. 39 // Check that unloading the page has removed all rules.
40 std::string extension_id = GetSingleLoadedExtension()->id(); 40 std::string extension_id = GetSingleLoadedExtension()->id();
41 UnloadExtension(extension_id); 41 UnloadExtension(extension_id);
42 42
43 // UnloadExtension posts a task to the owner thread of the extension 43 // UnloadExtension posts a task to the owner thread of the extension
44 // to process this unloading. The next task to retrive all rules 44 // to process this unloading. The next task to retrive all rules
45 // is therefore processed after the UnloadExtension task has been executed. 45 // is therefore processed after the UnloadExtension task has been executed.
46 46
47 RulesRegistryService* rules_registry_service = 47 RulesRegistryService* rules_registry_service =
48 extensions::ExtensionSystemFactory::GetForProfile(browser()->profile())-> 48 extensions::RulesRegistryService::Get(browser()->profile());
49 rules_registry_service();
50 scoped_refptr<RulesRegistry> rules_registry = 49 scoped_refptr<RulesRegistry> rules_registry =
51 rules_registry_service->GetRulesRegistry( 50 rules_registry_service->GetRulesRegistry(
52 extensions::declarative_webrequest_constants::kOnRequest); 51 extensions::declarative_webrequest_constants::kOnRequest);
53 52
54 std::vector<linked_ptr<RulesRegistry::Rule> > known_rules; 53 std::vector<linked_ptr<RulesRegistry::Rule> > known_rules;
55 54
56 content::BrowserThread::PostTask( 55 content::BrowserThread::PostTask(
57 rules_registry->owner_thread(), 56 rules_registry->owner_thread(),
58 FROM_HERE, 57 FROM_HERE,
59 base::Bind(base::IgnoreResult(&RulesRegistry::GetAllRules), 58 base::Bind(base::IgnoreResult(&RulesRegistry::GetAllRules),
60 rules_registry, extension_id, &known_rules)); 59 rules_registry, extension_id, &known_rules));
61 60
62 content::RunAllPendingInMessageLoop(rules_registry->owner_thread()); 61 content::RunAllPendingInMessageLoop(rules_registry->owner_thread());
63 62
64 EXPECT_TRUE(known_rules.empty()); 63 EXPECT_TRUE(known_rules.empty());
65 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698