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

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

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WIP, latest changes from kaiwang@ Created 8 years 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 : manifest(manifest), 62 : manifest(manifest),
63 root_directory(directory) { 63 root_directory(directory) {
64 if (!root_directory.IsAbsolute()) { 64 if (!root_directory.IsAbsolute()) {
65 CHECK(PathService::Get(chrome::DIR_RESOURCES, &root_directory)); 65 CHECK(PathService::Get(chrome::DIR_RESOURCES, &root_directory));
66 root_directory = root_directory.Append(directory); 66 root_directory = root_directory.Append(directory);
67 } 67 }
68 extension_id = GenerateId(manifest, root_directory); 68 extension_id = GenerateId(manifest, root_directory);
69 } 69 }
70 70
71 ComponentLoader::ComponentLoader(ExtensionServiceInterface* extension_service, 71 ComponentLoader::ComponentLoader(ExtensionServiceInterface* extension_service,
72 PrefService* prefs, 72 PrefServiceSyncable* prefs,
73 PrefService* local_state) 73 PrefServiceSimple* local_state)
74 : prefs_(prefs), 74 : prefs_(prefs),
75 local_state_(local_state), 75 local_state_(local_state),
76 extension_service_(extension_service) { 76 extension_service_(extension_service) {
77 pref_change_registrar_.Init(prefs); 77 pref_change_registrar_.Init(prefs);
78 78
79 // This pref is set by policy. We have to watch it for change because on 79 // This pref is set by policy. We have to watch it for change because on
80 // ChromeOS, policy isn't loaded until after the browser process is started. 80 // ChromeOS, policy isn't loaded until after the browser process is started.
81 pref_change_registrar_.Add( 81 pref_change_registrar_.Add(
82 prefs::kEnterpriseWebStoreURL, 82 prefs::kEnterpriseWebStoreURL,
83 base::Bind(&ComponentLoader::AddOrReloadEnterpriseWebStore, 83 base::Bind(&ComponentLoader::AddOrReloadEnterpriseWebStore,
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { 420 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) {
421 delete component->manifest; 421 delete component->manifest;
422 if (extension_service_->is_ready()) { 422 if (extension_service_->is_ready()) {
423 extension_service_-> 423 extension_service_->
424 UnloadExtension(component->extension_id, 424 UnloadExtension(component->extension_id,
425 extension_misc::UNLOAD_REASON_DISABLE); 425 extension_misc::UNLOAD_REASON_DISABLE);
426 } 426 }
427 } 427 }
428 428
429 // static 429 // static
430 void ComponentLoader::RegisterUserPrefs(PrefService* prefs) { 430 void ComponentLoader::RegisterUserPrefs(PrefServiceSyncable* prefs) {
431 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL, 431 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL,
432 std::string() /* default_value */, 432 std::string() /* default_value */,
433 PrefService::UNSYNCABLE_PREF); 433 PrefServiceSyncable::UNSYNCABLE_PREF);
434 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName, 434 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName,
435 std::string() /* default_value */, 435 std::string() /* default_value */,
436 PrefService::UNSYNCABLE_PREF); 436 PrefServiceSyncable::UNSYNCABLE_PREF);
437 } 437 }
438 438
439 } // namespace extensions 439 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698