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