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

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

Issue 11377131: Removing PrefObserver usage, batch 4. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 8 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 | 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 "chrome/browser/extensions/component_loader.h" 5 #include "chrome/browser/extensions/component_loader.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 ComponentLoader::ComponentLoader(ExtensionServiceInterface* extension_service, 70 ComponentLoader::ComponentLoader(ExtensionServiceInterface* extension_service,
71 PrefService* prefs, 71 PrefService* prefs,
72 PrefService* local_state) 72 PrefService* local_state)
73 : prefs_(prefs), 73 : prefs_(prefs),
74 local_state_(local_state), 74 local_state_(local_state),
75 extension_service_(extension_service) { 75 extension_service_(extension_service) {
76 pref_change_registrar_.Init(prefs); 76 pref_change_registrar_.Init(prefs);
77 77
78 // This pref is set by policy. We have to watch it for change because on 78 // This pref is set by policy. We have to watch it for change because on
79 // ChromeOS, policy isn't loaded until after the browser process is started. 79 // ChromeOS, policy isn't loaded until after the browser process is started.
80 pref_change_registrar_.Add(prefs::kEnterpriseWebStoreURL, this); 80 pref_change_registrar_.Add(
81 prefs::kEnterpriseWebStoreURL,
82 base::Bind(&ComponentLoader::AddOrReloadEnterpriseWebStore,
83 base::Unretained(this)));
81 } 84 }
82 85
83 ComponentLoader::~ComponentLoader() { 86 ComponentLoader::~ComponentLoader() {
84 ClearAllRegistered(); 87 ClearAllRegistered();
85 } 88 }
86 89
87 const Extension* ComponentLoader::GetScriptBubble() const { 90 const Extension* ComponentLoader::GetScriptBubble() const {
88 if (script_bubble_id_.empty()) 91 if (script_bubble_id_.empty())
89 return NULL; 92 return NULL;
90 93
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // the browser process has started. 395 // the browser process has started.
393 AddOrReloadEnterpriseWebStore(); 396 AddOrReloadEnterpriseWebStore();
394 397
395 #if defined(USE_ASH) 398 #if defined(USE_ASH)
396 AddChromeApp(); 399 AddChromeApp();
397 #endif 400 #endif
398 401
399 AddScriptBubble(); 402 AddScriptBubble();
400 } 403 }
401 404
402 void ComponentLoader::OnPreferenceChanged(PrefServiceBase* service,
403 const std::string& pref_name) {
404 DCHECK_EQ(std::string(prefs::kEnterpriseWebStoreURL), pref_name);
405 AddOrReloadEnterpriseWebStore();
406 }
407
408 // static 405 // static
409 void ComponentLoader::RegisterUserPrefs(PrefService* prefs) { 406 void ComponentLoader::RegisterUserPrefs(PrefService* prefs) {
410 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL, 407 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL,
411 std::string() /* default_value */, 408 std::string() /* default_value */,
412 PrefService::UNSYNCABLE_PREF); 409 PrefService::UNSYNCABLE_PREF);
413 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName, 410 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName,
414 std::string() /* default_value */, 411 std::string() /* default_value */,
415 PrefService::UNSYNCABLE_PREF); 412 PrefService::UNSYNCABLE_PREF);
416 } 413 }
417 414
418 } // namespace extensions 415 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/component_loader.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698