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

Unified Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 10874068: When using action box on Mac, hide star when page is not bookmarked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
index 532e7881ed4ace297d90530b8dc440a9615f3a69..25d4a01681394a03c80928948226053a00b27bd3 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -250,9 +250,8 @@ void LocationBarViewMac::SaveStateToContents(WebContents* contents) {
void LocationBarViewMac::Update(const WebContents* contents,
bool should_restore_state) {
- bool star_enabled = IsStarEnabled();
- command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled);
- star_decoration_->SetVisible(star_enabled);
+ command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, IsStarEnabled());
+ UpdateStarDecorationVisibility();
UpdateChromeToMobileEnabled();
UpdateZoomDecoration();
RefreshPageActionDecorations();
@@ -478,7 +477,7 @@ void LocationBarViewMac::TestPageActionPressed(size_t index) {
void LocationBarViewMac::SetEditable(bool editable) {
[field_ setEditable:editable ? YES : NO];
- star_decoration_->SetVisible(IsStarEnabled());
+ UpdateStarDecorationVisibility();
UpdateChromeToMobileEnabled();
UpdateZoomDecoration();
UpdatePageActions();
@@ -499,6 +498,7 @@ void LocationBarViewMac::OnDecorationsChanged() {
void LocationBarViewMac::SetStarred(bool starred) {
star_decoration_->SetStarred(starred);
+ UpdateStarDecorationVisibility();
OnDecorationsChanged();
}
@@ -584,7 +584,7 @@ void LocationBarViewMac::Observe(int type,
}
case chrome::NOTIFICATION_PREF_CHANGED:
- star_decoration_->SetVisible(IsStarEnabled());
+ UpdateStarDecorationVisibility();
UpdateChromeToMobileEnabled();
OnChanged();
break;
@@ -767,3 +767,11 @@ void LocationBarViewMac::UpdateZoomDecoration() {
zoom_decoration_->Update(tab_contents->zoom_controller());
}
+
+void LocationBarViewMac::UpdateStarDecorationVisibility() {
+ bool action_box_enabled =
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableActionBox);
+ // If the action box is enabled, only show the star if it's lit.
+ star_decoration_->SetVisible(IsStarEnabled() &&
+ (star_decoration_->starred() || !action_box_enabled));
Scott Hess - ex-Googler 2012/08/27 19:47:31 I think this condition is needlessly complicated.
beaudoin 2012/08/27 21:25:48 Good job on that truth table! This indeed simplifi
+}
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h ('k') | chrome/browser/ui/cocoa/location_bar/star_decoration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698