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 | |
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')
-rw-r--r-- | chrome/app/nibs/Preferences.xib | 9 | ||||
-rw-r--r-- | chrome/browser/cocoa/preferences_window_controller.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/preferences_window_controller.mm | 31 |
3 files changed, 39 insertions, 4 deletions
diff --git a/chrome/app/nibs/Preferences.xib b/chrome/app/nibs/Preferences.xib index 2f0408a..9bfb4a3 100644 --- a/chrome/app/nibs/Preferences.xib +++ b/chrome/app/nibs/Preferences.xib @@ -10,6 +10,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <integer value="74"/> <integer value="482"/> + <integer value="481"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -723,7 +724,7 @@ <bool key="NSSharedInstance">YES</bool> </object> <object class="NSCustomView" id="930668015"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1698,6 +1699,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> </object> </object> <string key="NSFrameSize">{530, 468}</string> + <reference key="NSSuperview"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="393583039"> @@ -2036,7 +2038,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <object class="NSTextField" id="90260648"> <reference key="NSNextResponder" ref="393583039"/> <int key="NSvFlags">266</int> - <string key="NSFrame">{{149, 319}, {364, 28}}</string> + <string key="NSFrame">{{152, 319}, {361, 28}}</string> <reference key="NSSuperview" ref="393583039"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="123936632"> @@ -2045,6 +2047,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <string key="NSContents">^IDS_SYNC_NOT_SET_UP_INFO</string> <reference key="NSSupport" ref="783256529"/> <reference key="NSControlView" ref="90260648"/> + <bool key="NSDrawsBackground">YES</bool> <reference key="NSBackgroundColor" ref="592613688"/> <reference key="NSTextColor" ref="748094473"/> </object> @@ -4136,8 +4139,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <reference ref="987908490"/> <reference ref="20640598"/> <reference ref="203729106"/> - <reference ref="1022040155"/> <reference ref="90260648"/> + <reference ref="1022040155"/> </object> <reference key="parent" ref="196155028"/> <string key="objectName">Personal Stuff View</string> diff --git a/chrome/browser/cocoa/preferences_window_controller.h b/chrome/browser/cocoa/preferences_window_controller.h index a35a544..e29047e 100644 --- a/chrome/browser/cocoa/preferences_window_controller.h +++ b/chrome/browser/cocoa/preferences_window_controller.h @@ -84,6 +84,9 @@ class ProfileSyncService; IBOutlet NSButton* syncButton_; IBOutlet NSTextField* syncStatus_; IBOutlet NSButton* syncLink_; + scoped_nsobject<NSColor> syncStatusNoErrorBackgroundColor_; + scoped_nsobject<NSColor> syncLinkNoErrorBackgroundColor_; + scoped_nsobject<NSColor> syncErrorBackgroundColor_; // Under the hood panel IBOutlet NSView* underTheHoodContentView_; 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. |