| 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/stringprintf.h" | 7 #include "base/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" |
| 11 #include "chrome/browser/themes/theme_service.h" | 11 #include "chrome/browser/themes/theme_service.h" |
| 12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
| 13 #include "chrome/common/extensions/manifest_url_handler.h" |
| 13 #include "sync/protocol/sync.pb.h" | 14 #include "sync/protocol/sync.pb.h" |
| 14 #include "sync/protocol/theme_specifics.pb.h" | 15 #include "sync/protocol/theme_specifics.pb.h" |
| 15 | 16 |
| 16 using std::string; | 17 using std::string; |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 bool IsTheme(const extensions::Extension& extension) { | 21 bool IsTheme(const extensions::Extension& extension) { |
| 21 return extension.is_theme(); | 22 return extension.is_theme(); |
| 22 } | 23 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 theme_specifics->set_use_system_theme_by_default( | 262 theme_specifics->set_use_system_theme_by_default( |
| 262 use_system_theme_by_default_); | 263 use_system_theme_by_default_); |
| 263 } | 264 } |
| 264 | 265 |
| 265 if (use_custom_theme) { | 266 if (use_custom_theme) { |
| 266 DCHECK(current_theme); | 267 DCHECK(current_theme); |
| 267 DCHECK(current_theme->is_theme()); | 268 DCHECK(current_theme->is_theme()); |
| 268 theme_specifics->set_custom_theme_name(current_theme->name()); | 269 theme_specifics->set_custom_theme_name(current_theme->name()); |
| 269 theme_specifics->set_custom_theme_id(current_theme->id()); | 270 theme_specifics->set_custom_theme_id(current_theme->id()); |
| 270 theme_specifics->set_custom_theme_update_url( | 271 theme_specifics->set_custom_theme_update_url( |
| 271 current_theme->update_url().spec()); | 272 extensions::ManifestURL::GetUpdateURL(current_theme).spec()); |
| 272 } else { | 273 } else { |
| 273 DCHECK(!current_theme); | 274 DCHECK(!current_theme); |
| 274 theme_specifics->clear_custom_theme_name(); | 275 theme_specifics->clear_custom_theme_name(); |
| 275 theme_specifics->clear_custom_theme_id(); | 276 theme_specifics->clear_custom_theme_id(); |
| 276 theme_specifics->clear_custom_theme_update_url(); | 277 theme_specifics->clear_custom_theme_update_url(); |
| 277 } | 278 } |
| 278 } | 279 } |
| 279 | 280 |
| 280 /* static */ | 281 /* static */ |
| 281 bool ThemeSyncableService::AreThemeSpecificsEqual( | 282 bool ThemeSyncableService::AreThemeSpecificsEqual( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 312 syncer::SyncChange(FROM_HERE, change_type, | 313 syncer::SyncChange(FROM_HERE, change_type, |
| 313 syncer::SyncData::CreateLocalData( | 314 syncer::SyncData::CreateLocalData( |
| 314 kCurrentThemeClientTag, kCurrentThemeNodeTitle, | 315 kCurrentThemeClientTag, kCurrentThemeNodeTitle, |
| 315 entity_specifics))); | 316 entity_specifics))); |
| 316 | 317 |
| 317 DVLOG(1) << "Update theme specifics from current theme: " | 318 DVLOG(1) << "Update theme specifics from current theme: " |
| 318 << changes.back().ToString(); | 319 << changes.back().ToString(); |
| 319 | 320 |
| 320 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); | 321 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); |
| 321 } | 322 } |
| OLD | NEW |