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

Side by Side Diff: chrome/browser/extensions/install_tracker.cc

Issue 1419823011: app_sorting() calls should go via ExtensionSystem intsead of prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/install_tracker.h" 5 #include "chrome/browser/extensions/install_tracker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/extensions/install_tracker_factory.h" 9 #include "chrome/browser/extensions/install_tracker_factory.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
11 #include "extensions/browser/extension_prefs.h" 11 #include "extensions/browser/extension_prefs.h"
12 #include "extensions/browser/extension_registry.h" 12 #include "extensions/browser/extension_registry.h"
13 #include "extensions/browser/extension_system.h"
13 #include "extensions/browser/pref_names.h" 14 #include "extensions/browser/pref_names.h"
14 15
15 namespace extensions { 16 namespace extensions {
16 17
17 InstallTracker::InstallTracker(content::BrowserContext* browser_context, 18 InstallTracker::InstallTracker(content::BrowserContext* browser_context,
18 extensions::ExtensionPrefs* prefs) 19 extensions::ExtensionPrefs* prefs)
19 : extension_registry_observer_(this) { 20 : extension_registry_observer_(this) {
20 registrar_.Add(this, 21 registrar_.Add(this,
21 extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED, 22 extensions::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
22 content::Source<content::BrowserContext>(browser_context)); 23 content::Source<content::BrowserContext>(browser_context));
23 extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context)); 24 extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context));
24 25
25 // Prefs may be null in tests. 26 // Prefs may be null in tests.
26 if (prefs) { 27 if (prefs) {
27 AppSorting* sorting = prefs->app_sorting(); 28 AppSorting* sorting = ExtensionSystem::Get(browser_context)->app_sorting();
28 registrar_.Add(this, 29 registrar_.Add(this,
29 chrome::NOTIFICATION_APP_LAUNCHER_REORDERED, 30 chrome::NOTIFICATION_APP_LAUNCHER_REORDERED,
30 content::Source<AppSorting>(sorting)); 31 content::Source<AppSorting>(sorting));
31 pref_change_registrar_.Init(prefs->pref_service()); 32 pref_change_registrar_.Init(prefs->pref_service());
32 pref_change_registrar_.Add( 33 pref_change_registrar_.Add(
33 pref_names::kExtensions, 34 pref_names::kExtensions,
34 base::Bind(&InstallTracker::OnAppsReordered, base::Unretained(this))); 35 base::Bind(&InstallTracker::OnAppsReordered, base::Unretained(this)));
35 } 36 }
36 } 37 }
37 38
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 const Extension* extension, 153 const Extension* extension,
153 bool is_update) { 154 bool is_update) {
154 RemoveActiveInstall(extension->id()); 155 RemoveActiveInstall(extension->id());
155 } 156 }
156 157
157 void InstallTracker::OnAppsReordered() { 158 void InstallTracker::OnAppsReordered() {
158 FOR_EACH_OBSERVER(InstallObserver, observers_, OnAppsReordered()); 159 FOR_EACH_OBSERVER(InstallObserver, observers_, OnAppsReordered());
159 } 160 }
160 161
161 } // namespace extensions 162 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/sync/test/integration/sync_app_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698