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

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

Issue 1229953004: [Sync] Give custom themes priority over default themes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | chrome/browser/themes/theme_syncable_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // save the unsyncable theme to sync data. 79 // save the unsyncable theme to sync data.
80 return merge_result; 80 return merge_result;
81 } 81 }
82 82
83 // Find the last SyncData that has theme data and set the current theme from 83 // Find the last SyncData that has theme data and set the current theme from
84 // it. 84 // it.
85 for (syncer::SyncDataList::const_reverse_iterator sync_data = 85 for (syncer::SyncDataList::const_reverse_iterator sync_data =
86 initial_sync_data.rbegin(); sync_data != initial_sync_data.rend(); 86 initial_sync_data.rbegin(); sync_data != initial_sync_data.rend();
87 ++sync_data) { 87 ++sync_data) {
88 if (sync_data->GetSpecifics().has_theme()) { 88 if (sync_data->GetSpecifics().has_theme()) {
89 MaybeSetTheme(current_specifics, *sync_data); 89 if (!current_specifics.use_custom_theme() ||
90 return merge_result; 90 sync_data->GetSpecifics().theme().use_custom_theme()) {
91 MaybeSetTheme(current_specifics, *sync_data);
92 return merge_result;
93 }
91 } 94 }
92 } 95 }
93 96
94 // No theme specifics are found. Create one according to current theme. 97 // No theme specifics are found. Create one according to current theme.
95 merge_result.set_error(ProcessNewTheme( 98 merge_result.set_error(ProcessNewTheme(
96 syncer::SyncChange::ACTION_ADD, current_specifics)); 99 syncer::SyncChange::ACTION_ADD, current_specifics));
97 return merge_result; 100 return merge_result;
98 } 101 }
99 102
100 void ThemeSyncableService::StopSyncing(syncer::ModelType type) { 103 void ThemeSyncableService::StopSyncing(syncer::ModelType type) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 syncer::SyncChange(FROM_HERE, change_type, 336 syncer::SyncChange(FROM_HERE, change_type,
334 syncer::SyncData::CreateLocalData( 337 syncer::SyncData::CreateLocalData(
335 kCurrentThemeClientTag, kCurrentThemeNodeTitle, 338 kCurrentThemeClientTag, kCurrentThemeNodeTitle,
336 entity_specifics))); 339 entity_specifics)));
337 340
338 DVLOG(1) << "Update theme specifics from current theme: " 341 DVLOG(1) << "Update theme specifics from current theme: "
339 << changes.back().ToString(); 342 << changes.back().ToString();
340 343
341 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); 344 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes);
342 } 345 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/themes/theme_syncable_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698