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

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: Applied review comments. 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..60a6b127e0f8ac5d5ca82f6e8571318893ef3690 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,13 @@ 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.
+ bool visible = IsStarEnabled();
+ if (!star_decoration_->starred() && action_box_enabled)
+ visible = false;
+ star_decoration_->SetVisible(visible);
+}
« 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