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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 // the browser process has started. | 400 // the browser process has started. |
401 AddOrReloadEnterpriseWebStore(); | 401 AddOrReloadEnterpriseWebStore(); |
402 | 402 |
403 #if defined(USE_ASH) | 403 #if defined(USE_ASH) |
404 AddChromeApp(); | 404 AddChromeApp(); |
405 #endif | 405 #endif |
406 | 406 |
407 AddScriptBubble(); | 407 AddScriptBubble(); |
408 } | 408 } |
409 | 409 |
410 void ComponentLoader::Observe( | 410 void ComponentLoader::OnPreferenceChanged(PrefServiceBase* service, |
411 int type, | 411 const std::string& pref_name) { |
412 const content::NotificationSource& source, | 412 if (pref_name == prefs::kEnterpriseWebStoreURL) |
413 const content::NotificationDetails& details) { | 413 AddOrReloadEnterpriseWebStore(); |
414 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 414 else |
415 const std::string* name = | |
416 content::Details<const std::string>(details).ptr(); | |
417 if (*name == prefs::kEnterpriseWebStoreURL) | |
418 AddOrReloadEnterpriseWebStore(); | |
419 else | |
420 NOTREACHED(); | |
421 } else { | |
422 NOTREACHED(); | 415 NOTREACHED(); |
423 } | |
424 } | 416 } |
425 | 417 |
426 // static | 418 // static |
427 void ComponentLoader::RegisterUserPrefs(PrefService* prefs) { | 419 void ComponentLoader::RegisterUserPrefs(PrefService* prefs) { |
428 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL, | 420 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL, |
429 std::string() /* default_value */, | 421 std::string() /* default_value */, |
430 PrefService::UNSYNCABLE_PREF); | 422 PrefService::UNSYNCABLE_PREF); |
431 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName, | 423 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName, |
432 std::string() /* default_value */, | 424 std::string() /* default_value */, |
433 PrefService::UNSYNCABLE_PREF); | 425 PrefService::UNSYNCABLE_PREF); |
434 } | 426 } |
435 | 427 |
436 } // namespace extensions | 428 } // namespace extensions |
OLD | NEW |