| OLD | NEW |
| 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 Loading... |
| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 // the browser process has started. | 399 // the browser process has started. |
| 397 AddOrReloadEnterpriseWebStore(); | 400 AddOrReloadEnterpriseWebStore(); |
| 398 | 401 |
| 399 #if defined(USE_ASH) | 402 #if defined(USE_ASH) |
| 400 AddChromeApp(); | 403 AddChromeApp(); |
| 401 #endif | 404 #endif |
| 402 | 405 |
| 403 AddScriptBubble(); | 406 AddScriptBubble(); |
| 404 } | 407 } |
| 405 | 408 |
| 406 void ComponentLoader::OnPreferenceChanged(PrefServiceBase* service, | |
| 407 const std::string& pref_name) { | |
| 408 DCHECK_EQ(std::string(prefs::kEnterpriseWebStoreURL), pref_name); | |
| 409 AddOrReloadEnterpriseWebStore(); | |
| 410 } | |
| 411 | |
| 412 // static | 409 // static |
| 413 void ComponentLoader::RegisterUserPrefs(PrefService* prefs) { | 410 void ComponentLoader::RegisterUserPrefs(PrefService* prefs) { |
| 414 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL, | 411 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL, |
| 415 std::string() /* default_value */, | 412 std::string() /* default_value */, |
| 416 PrefService::UNSYNCABLE_PREF); | 413 PrefService::UNSYNCABLE_PREF); |
| 417 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName, | 414 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName, |
| 418 std::string() /* default_value */, | 415 std::string() /* default_value */, |
| 419 PrefService::UNSYNCABLE_PREF); | 416 PrefService::UNSYNCABLE_PREF); |
| 420 } | 417 } |
| 421 | 418 |
| 422 } // namespace extensions | 419 } // namespace extensions |
| OLD | NEW |