| 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/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" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 222 } |
| 223 // An enabled theme extension with the given id was found, so | 223 // An enabled theme extension with the given id was found, so |
| 224 // just set the current theme to it. | 224 // just set the current theme to it. |
| 225 theme_service_->SetTheme(extension); | 225 theme_service_->SetTheme(extension); |
| 226 } else { | 226 } else { |
| 227 // No extension with this id exists -- we must install it; we do | 227 // No extension with this id exists -- we must install it; we do |
| 228 // so by adding it as a pending extension and then triggering an | 228 // so by adding it as a pending extension and then triggering an |
| 229 // auto-update cycle. | 229 // auto-update cycle. |
| 230 const bool kInstallSilently = true; | 230 const bool kInstallSilently = true; |
| 231 const bool kRemoteInstall = false; | 231 const bool kRemoteInstall = false; |
| 232 const bool kInstalledByCustodian = false; |
| 232 if (!extensions_service->pending_extension_manager()->AddFromSync( | 233 if (!extensions_service->pending_extension_manager()->AddFromSync( |
| 233 id, update_url, &IsTheme, kInstallSilently, kRemoteInstall)) { | 234 id, |
| 235 update_url, |
| 236 &IsTheme, |
| 237 kInstallSilently, |
| 238 kRemoteInstall, |
| 239 kInstalledByCustodian)) { |
| 234 LOG(WARNING) << "Could not add pending extension for " << id; | 240 LOG(WARNING) << "Could not add pending extension for " << id; |
| 235 return; | 241 return; |
| 236 } | 242 } |
| 237 extensions_service->CheckForUpdatesSoon(); | 243 extensions_service->CheckForUpdatesSoon(); |
| 238 } | 244 } |
| 239 } else if (theme_specifics.use_system_theme_by_default()) { | 245 } else if (theme_specifics.use_system_theme_by_default()) { |
| 240 DVLOG(1) << "Switch to use system theme"; | 246 DVLOG(1) << "Switch to use system theme"; |
| 241 theme_service_->UseSystemTheme(); | 247 theme_service_->UseSystemTheme(); |
| 242 } else { | 248 } else { |
| 243 DVLOG(1) << "Switch to use default theme"; | 249 DVLOG(1) << "Switch to use default theme"; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 syncer::SyncChange(FROM_HERE, change_type, | 335 syncer::SyncChange(FROM_HERE, change_type, |
| 330 syncer::SyncData::CreateLocalData( | 336 syncer::SyncData::CreateLocalData( |
| 331 kCurrentThemeClientTag, kCurrentThemeNodeTitle, | 337 kCurrentThemeClientTag, kCurrentThemeNodeTitle, |
| 332 entity_specifics))); | 338 entity_specifics))); |
| 333 | 339 |
| 334 DVLOG(1) << "Update theme specifics from current theme: " | 340 DVLOG(1) << "Update theme specifics from current theme: " |
| 335 << changes.back().ToString(); | 341 << changes.back().ToString(); |
| 336 | 342 |
| 337 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); | 343 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); |
| 338 } | 344 } |
| OLD | NEW |