| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.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 kRemoteInstall = false; | 237 const bool kRemoteInstall = false; |
| 238 const bool kInstalledByCustodian = false; | |
| 239 if (!extensions_service->pending_extension_manager()->AddFromSync( | 238 if (!extensions_service->pending_extension_manager()->AddFromSync( |
| 240 id, | 239 id, |
| 241 update_url, | 240 update_url, |
| 242 base::Version(), | 241 base::Version(), |
| 243 &IsTheme, | 242 &IsTheme, |
| 244 kRemoteInstall, | 243 kRemoteInstall)) { |
| 245 kInstalledByCustodian)) { | |
| 246 LOG(WARNING) << "Could not add pending extension for " << id; | 244 LOG(WARNING) << "Could not add pending extension for " << id; |
| 247 return; | 245 return; |
| 248 } | 246 } |
| 249 extensions_service->CheckForUpdatesSoon(); | 247 extensions_service->CheckForUpdatesSoon(); |
| 250 } | 248 } |
| 251 } else if (theme_specifics.use_system_theme_by_default()) { | 249 } else if (theme_specifics.use_system_theme_by_default()) { |
| 252 DVLOG(1) << "Switch to use system theme"; | 250 DVLOG(1) << "Switch to use system theme"; |
| 253 theme_service_->UseSystemTheme(); | 251 theme_service_->UseSystemTheme(); |
| 254 } else { | 252 } else { |
| 255 DVLOG(1) << "Switch to use default theme"; | 253 DVLOG(1) << "Switch to use default theme"; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 syncer::SyncChange(FROM_HERE, change_type, | 338 syncer::SyncChange(FROM_HERE, change_type, |
| 341 syncer::SyncData::CreateLocalData( | 339 syncer::SyncData::CreateLocalData( |
| 342 kCurrentThemeClientTag, kCurrentThemeNodeTitle, | 340 kCurrentThemeClientTag, kCurrentThemeNodeTitle, |
| 343 entity_specifics))); | 341 entity_specifics))); |
| 344 | 342 |
| 345 DVLOG(1) << "Update theme specifics from current theme: " | 343 DVLOG(1) << "Update theme specifics from current theme: " |
| 346 << changes.back().ToString(); | 344 << changes.back().ToString(); |
| 347 | 345 |
| 348 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); | 346 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); |
| 349 } | 347 } |
| OLD | NEW |