diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-13 21:51:11 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-13 21:51:11 +0000 |
commit | 01286850cfec1dfb9b8c571cb2e222e6d7a5192d (patch) | |
tree | 761d6ae18e050a30eadbf1b6704cb970c3b9cfcc /chrome/browser/cocoa/preferences_window_controller.mm | |
parent | 5eb818cd70067f127e42869af508734ab956fd83 (diff) | |
download | chromium_src-01286850cfec1dfb9b8c571cb2e222e6d7a5192d.zip chromium_src-01286850cfec1dfb9b8c571cb2e222e6d7a5192d.tar.gz chromium_src-01286850cfec1dfb9b8c571cb2e222e6d7a5192d.tar.bz2 |
Draw background color (if necessary) for sync status and sync link.
Aligned left edges of sync status text and the relogin link text.
BUG=30159
TEST=manual testing
Review URL: http://codereview.chromium.org/542025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36176 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/preferences_window_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/preferences_window_controller.mm | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm index e99117f..51030b3 100644 --- a/chrome/browser/cocoa/preferences_window_controller.mm +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -471,6 +471,16 @@ class PrefObserverBridge : public NotificationObserver, // (in chrome/browser/views/options/content_page_view.cc) just does what // we do below. syncService_ = profile_->GetProfileSyncService(); + + // TODO(akalin): This color is taken from kSyncLabelErrorBgColor in + // content_page_view.cc. Either decomp that color out into a + // function/variable that is referenced by both this file and + // content_page_view.cc, or maybe pick a more suitable color. + syncErrorBackgroundColor_.reset( + [[NSColor colorWithDeviceRed:0xff/255.0 + green:0x9a/255.0 + blue:0x9a/255.0 + alpha:1.0] retain]); } return self; } @@ -1560,10 +1570,29 @@ const int kDisabledIndex = 1; [syncButton_ setTitle:buttonLabel]; string16 statusLabel, linkLabel; - sync_ui_util::GetStatusLabels(syncService_, &statusLabel, &linkLabel); + sync_ui_util::MessageType status = + sync_ui_util::GetStatusLabels(syncService_, &statusLabel, &linkLabel); [syncStatus_ setStringValue:base::SysUTF16ToNSString(statusLabel)]; [syncLink_ setHidden:linkLabel.empty()]; [syncLink_ setTitle:base::SysUTF16ToNSString(linkLabel)]; + + NSButtonCell* syncLinkCell = static_cast<NSButtonCell*>([syncLink_ cell]); + if (!syncStatusNoErrorBackgroundColor_) { + DCHECK(!syncLinkNoErrorBackgroundColor_); + // We assume that the sync controls start off in a non-error + // state. + syncStatusNoErrorBackgroundColor_.reset( + [[syncStatus_ backgroundColor] retain]); + syncLinkNoErrorBackgroundColor_.reset( + [[syncLinkCell backgroundColor] retain]); + } + if (status == sync_ui_util::SYNC_ERROR) { + [syncStatus_ setBackgroundColor:syncErrorBackgroundColor_]; + [syncLinkCell setBackgroundColor:syncErrorBackgroundColor_]; + } else { + [syncStatus_ setBackgroundColor:syncStatusNoErrorBackgroundColor_]; + [syncLinkCell setBackgroundColor:syncLinkNoErrorBackgroundColor_]; + } } // Show the preferences window. |