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

Side by Side Diff: chrome/browser/themes/theme_syncable_service.cc

Issue 156843004: Remove ExtensionService::extension_prefs() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: additional cleanup Created 6 years, 10 months 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/themes/theme_syncable_service.h" 5 #include "chrome/browser/themes/theme_syncable_service.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/themes/theme_service.h" 10 #include "chrome/browser/themes/theme_service.h"
11 #include "chrome/common/extensions/manifest_url_handler.h" 11 #include "chrome/common/extensions/manifest_url_handler.h"
12 #include "chrome/common/extensions/sync_helper.h" 12 #include "chrome/common/extensions/sync_helper.h"
13 #include "extensions/browser/extension_system.h" 13 #include "extensions/browser/extension_system.h"
14 #include "extensions/common/extension.h" 14 #include "extensions/common/extension.h"
James Cook 2014/02/07 00:53:02 nit: Should include extension_prefs.h here
Ken Rockot(use gerrit already) 2014/02/10 18:53:02 Done.
15 #include "sync/protocol/sync.pb.h" 15 #include "sync/protocol/sync.pb.h"
16 #include "sync/protocol/theme_specifics.pb.h" 16 #include "sync/protocol/theme_specifics.pb.h"
17 17
18 using std::string; 18 using std::string;
19 19
20 namespace { 20 namespace {
21 21
22 bool IsTheme(const extensions::Extension* extension) { 22 bool IsTheme(const extensions::Extension* extension) {
23 return extension->is_theme(); 23 return extension->is_theme();
24 } 24 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 ExtensionService* extensions_service = 211 ExtensionService* extensions_service =
212 extensions::ExtensionSystem::Get(profile_)->extension_service(); 212 extensions::ExtensionSystem::Get(profile_)->extension_service();
213 CHECK(extensions_service); 213 CHECK(extensions_service);
214 const extensions::Extension* extension = 214 const extensions::Extension* extension =
215 extensions_service->GetExtensionById(id, true); 215 extensions_service->GetExtensionById(id, true);
216 if (extension) { 216 if (extension) {
217 if (!extension->is_theme()) { 217 if (!extension->is_theme()) {
218 DVLOG(1) << "Extension " << id << " is not a theme; aborting"; 218 DVLOG(1) << "Extension " << id << " is not a theme; aborting";
219 return; 219 return;
220 } 220 }
221 int disabled_reasons = 221 int disabled_reasons = extensions::ExtensionPrefs::Get(profile_)->
222 extensions_service->extension_prefs()->GetDisableReasons(id); 222 GetDisableReasons(id);
223 if (!extensions_service->IsExtensionEnabled(id) && 223 if (!extensions_service->IsExtensionEnabled(id) &&
224 disabled_reasons != extensions::Extension::DISABLE_USER_ACTION) { 224 disabled_reasons != extensions::Extension::DISABLE_USER_ACTION) {
225 DVLOG(1) << "Theme " << id << " is disabled with reason " 225 DVLOG(1) << "Theme " << id << " is disabled with reason "
226 << disabled_reasons << "; aborting"; 226 << disabled_reasons << "; aborting";
227 return; 227 return;
228 } 228 }
229 // An enabled theme extension with the given id was found, so 229 // An enabled theme extension with the given id was found, so
230 // just set the current theme to it. 230 // just set the current theme to it.
231 theme_service_->SetTheme(extension); 231 theme_service_->SetTheme(extension);
232 } else { 232 } else {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 syncer::SyncChange(FROM_HERE, change_type, 334 syncer::SyncChange(FROM_HERE, change_type,
335 syncer::SyncData::CreateLocalData( 335 syncer::SyncData::CreateLocalData(
336 kCurrentThemeClientTag, kCurrentThemeNodeTitle, 336 kCurrentThemeClientTag, kCurrentThemeNodeTitle,
337 entity_specifics))); 337 entity_specifics)));
338 338
339 DVLOG(1) << "Update theme specifics from current theme: " 339 DVLOG(1) << "Update theme specifics from current theme: "
340 << changes.back().ToString(); 340 << changes.back().ToString();
341 341
342 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); 342 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes);
343 } 343 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698