summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/glue/theme_model_associator.cc
diff options
context:
space:
mode:
authoralbertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-20 19:46:31 +0000
committeralbertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-20 19:46:31 +0000
commit4f30f9259d990c5efc2d2417cb0898cbf3b9eec7 (patch)
treec03072e801696db5088b543c537140b70bcaebd1 /chrome/browser/sync/glue/theme_model_associator.cc
parentc137498b90a2e65281411d233a3d86533c365a74 (diff)
downloadchromium_src-4f30f9259d990c5efc2d2417cb0898cbf3b9eec7.zip
chromium_src-4f30f9259d990c5efc2d2417cb0898cbf3b9eec7.tar.gz
chromium_src-4f30f9259d990c5efc2d2417cb0898cbf3b9eec7.tar.bz2
If the default theme is synced to the server, make new sync clients with custom themes "win" at model association time.
BUG=48155 TEST=manually tested Review URL: http://codereview.chromium.org/2856040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53080 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/glue/theme_model_associator.cc')
-rw-r--r--chrome/browser/sync/glue/theme_model_associator.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/chrome/browser/sync/glue/theme_model_associator.cc b/chrome/browser/sync/glue/theme_model_associator.cc
index 9280c13..3936f62 100644
--- a/chrome/browser/sync/glue/theme_model_associator.cc
+++ b/chrome/browser/sync/glue/theme_model_associator.cc
@@ -8,7 +8,6 @@
#include "base/logging.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_theme_provider.h"
-#include "chrome/browser/profile.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/sync_backend_host.h"
#include "chrome/browser/sync/glue/theme_util.h"
@@ -19,6 +18,9 @@ namespace browser_sync {
namespace {
+static const char kThemesTag[] = "google_chrome_themes";
+static const char kCurrentThemeNodeTitle[] = "Current Theme";
+
static const char kNoThemesFolderError[] =
"Server did not create the top-level themes node. We "
"might be running against an out-of-date server.";
@@ -43,7 +45,7 @@ bool ThemeModelAssociator::AssociateModels() {
}
Profile* profile = sync_service_->profile();
- sync_api::ReadNode node(&trans);
+ sync_api::WriteNode node(&trans);
// TODO(akalin): When we have timestamps, we may want to do
// something more intelligent than preferring the sync data over our
// local data.
@@ -52,12 +54,12 @@ bool ThemeModelAssociator::AssociateModels() {
// TODO(akalin): If the sync data does not have
// use_system_theme_by_default and we do, update that flag on the
// sync data.
- SetCurrentThemeFromThemeSpecificsIfNecessary(
- node.GetThemeSpecifics(), profile);
- } else if (profile->GetTheme() || (UseSystemTheme(profile) &&
- IsSystemThemeDistinctFromDefaultTheme())) {
- // Set the sync data from the current theme, iff the current theme isn't the
- // default.
+ sync_pb::ThemeSpecifics theme_specifics = node.GetThemeSpecifics();
+ if (UpdateThemeSpecificsOrSetCurrentThemeIfNecessary(profile,
+ &theme_specifics))
+ node.SetThemeSpecifics(theme_specifics);
+ } else {
+ // Set the sync data from the current theme.
sync_api::WriteNode node(&trans);
if (!node.InitUniqueByCreation(syncable::THEMES, root,
kCurrentThemeClientTag)) {