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

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

Issue 19462009: [DRAFT] Allow a user to revert to their previous theme without closing infobar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 ExtensionServiceInterface* extensions_service = 211 ExtensionServiceInterface* 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 if (!extensions_service->IsExtensionEnabled(id)) { 221 // A theme extension with the given id was found, so just set the current
pkotwicz 2013/07/25 01:25:29 I was mostly worried about interference with exter
222 DVLOG(1) << "Theme " << id << " is not enabled; aborting"; 222 // theme to it.
223 return;
224 }
225 // An enabled theme extension with the given id was found, so
226 // just set the current theme to it.
227 theme_service_->SetTheme(extension); 223 theme_service_->SetTheme(extension);
228 } else { 224 } else {
229 // No extension with this id exists -- we must install it; we do 225 // No extension with this id exists -- we must install it; we do
230 // so by adding it as a pending extension and then triggering an 226 // so by adding it as a pending extension and then triggering an
231 // auto-update cycle. 227 // auto-update cycle.
232 const bool kInstallSilently = true; 228 const bool kInstallSilently = true;
233 if (!extensions_service->pending_extension_manager()->AddFromSync( 229 if (!extensions_service->pending_extension_manager()->AddFromSync(
234 id, update_url, &IsTheme, kInstallSilently)) { 230 id, update_url, &IsTheme, kInstallSilently)) {
235 LOG(WARNING) << "Could not add pending extension for " << id; 231 LOG(WARNING) << "Could not add pending extension for " << id;
236 return; 232 return;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 syncer::SyncChange(FROM_HERE, change_type, 326 syncer::SyncChange(FROM_HERE, change_type,
331 syncer::SyncData::CreateLocalData( 327 syncer::SyncData::CreateLocalData(
332 kCurrentThemeClientTag, kCurrentThemeNodeTitle, 328 kCurrentThemeClientTag, kCurrentThemeNodeTitle,
333 entity_specifics))); 329 entity_specifics)));
334 330
335 DVLOG(1) << "Update theme specifics from current theme: " 331 DVLOG(1) << "Update theme specifics from current theme: "
336 << changes.back().ToString(); 332 << changes.back().ToString();
337 333
338 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); 334 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes);
339 } 335 }
OLDNEW
« chrome/browser/themes/theme_service.cc ('K') | « chrome/browser/themes/theme_service_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698