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 9484bba743879792e8540b1e5f1c0127f3df324e..d43b892ab87dde0e26c5cc4af3f3fa9be0f78a1b 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 |
@@ -44,6 +44,7 @@ |
#import "chrome/browser/ui/cocoa/location_bar/plus_decoration.h" |
#import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h" |
#import "chrome/browser/ui/cocoa/location_bar/star_decoration.h" |
+#import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" |
#import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
#include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
#include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
@@ -100,6 +101,7 @@ LocationBarViewMac::LocationBarViewMac( |
plus_decoration_(NULL), |
star_decoration_(new StarDecoration(command_updater)), |
chrome_to_mobile_decoration_(NULL), |
+ zoom_decoration_(new ZoomDecoration(toolbar_model)), |
keyword_hint_decoration_( |
new KeywordHintDecoration(OmniboxViewMac::GetFieldFont())), |
profile_(profile), |
@@ -247,6 +249,7 @@ void LocationBarViewMac::Update(const WebContents* contents, |
command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); |
star_decoration_->SetVisible(star_enabled); |
UpdateChromeToMobileEnabled(); |
+ UpdateZoomDecoration(); |
RefreshPageActionDecorations(); |
RefreshContentSettingsDecorations(); |
// OmniboxView restores state if the tab is non-NULL. |
@@ -459,6 +462,7 @@ void LocationBarViewMac::SetEditable(bool editable) { |
[field_ setEditable:editable ? YES : NO]; |
star_decoration_->SetVisible(IsStarEnabled()); |
UpdateChromeToMobileEnabled(); |
+ UpdateZoomDecoration(); |
UpdatePageActions(); |
Layout(); |
} |
@@ -467,9 +471,7 @@ bool LocationBarViewMac::IsEditable() { |
return [field_ isEditable] ? true : false; |
} |
-void LocationBarViewMac::SetStarred(bool starred) { |
- star_decoration_->SetStarred(starred); |
- |
+void LocationBarViewMac::OnImageDecorationsChanged() { |
Scott Hess - ex-Googler
2012/08/16 04:52:58
Suggest OnDecorationsChanged(), I think the fact t
Dan Beam
2012/08/16 08:55:03
Done.
|
// TODO(shess): The field-editor frame and cursor rects should not |
// change, here. |
[field_ updateCursorAndToolTipRects]; |
@@ -477,14 +479,22 @@ void LocationBarViewMac::SetStarred(bool starred) { |
[field_ setNeedsDisplay:YES]; |
} |
+void LocationBarViewMac::SetStarred(bool starred) { |
+ star_decoration_->SetStarred(starred); |
+ OnImageDecorationsChanged(); |
+} |
+ |
void LocationBarViewMac::SetChromeToMobileDecorationLit(bool lit) { |
chrome_to_mobile_decoration_->SetLit(lit); |
+ OnImageDecorationsChanged(); |
+} |
- // TODO(shess): The field-editor frame and cursor rects should not |
- // change, here. |
- [field_ updateCursorAndToolTipRects]; |
- [field_ resetFieldEditorFrameIfNeeded]; |
- [field_ setNeedsDisplay:YES]; |
+void LocationBarViewMac::ZoomChangedForActiveTab(bool can_show_bubble) { |
+ UpdateZoomDecoration(); |
+ OnImageDecorationsChanged(); |
+ |
+ // TODO(dbeam): show a zoom bubble when |can_show_bubble| is true, the zoom |
+ // decoration is showing and the wrench menu isn't showing. |
} |
NSPoint LocationBarViewMac::GetBookmarkBubblePoint() const { |
@@ -650,6 +660,7 @@ void LocationBarViewMac::Layout() { |
if (plus_decoration_.get()) |
[cell addRightDecoration:plus_decoration_.get()]; |
[cell addRightDecoration:star_decoration_.get()]; |
+ [cell addRightDecoration:zoom_decoration_.get()]; |
if (chrome_to_mobile_decoration_.get()) |
[cell addRightDecoration:chrome_to_mobile_decoration_.get()]; |
@@ -734,3 +745,11 @@ void LocationBarViewMac::UpdateChromeToMobileEnabled() { |
chrome_to_mobile_decoration_->SetVisible(enabled); |
command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); |
} |
+ |
+void LocationBarViewMac::UpdateZoomDecoration() { |
+ TabContents* tab_contents = GetTabContents(); |
+ if (!zoom_decoration_.get() || !tab_contents) |
Scott Hess - ex-Googler
2012/08/16 04:52:58
zoom_decoration_ can't be NULL, AFAICT.
I'm neutr
Dan Beam
2012/08/16 08:55:03
Done.
Scott Hess - ex-Googler
2012/08/16 20:09:31
Seems reasonable. This class is a mess.
|
+ return; |
+ |
+ zoom_decoration_->Update(tab_contents->zoom_controller()); |
+} |