Chromium Code Reviews| Index: chrome/browser/ui/views/location_bar/location_bar_view.cc |
| diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| index 0a5408f773d82ef7f2eb05268c79af69a0277146..9b55c41552f316e69784af4b6a475ff7bb6277bb 100644 |
| --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| @@ -42,6 +42,7 @@ |
| #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
| #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" |
| #include "chrome/browser/ui/views/location_bar/star_view.h" |
| +#include "chrome/browser/ui/views/location_bar/zoom_view.h" |
| #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| #include "chrome/common/chrome_notification_types.h" |
| #include "chrome/common/chrome_switches.h" |
| @@ -148,6 +149,7 @@ LocationBarView::LocationBarView(Profile* profile, |
| #endif |
| keyword_hint_view_(NULL), |
| star_view_(NULL), |
| + zoom_view_(NULL), |
| action_box_button_view_(NULL), |
| chrome_to_mobile_view_(NULL), |
| mode_(mode), |
| @@ -246,6 +248,9 @@ void LocationBarView::Init() { |
| AddChildView(star_view_); |
| star_view_->SetVisible(true); |
| + zoom_view_ = new ZoomView(); |
| + AddChildView(zoom_view_); |
| + |
| // Also disable Chrome To Mobile for off-the-record and non-synced profiles, |
| // or if the feature is disabled by a command line flag or chrome://flags. |
| if (!profile_->IsOffTheRecord() && profile_->IsSyncAccessible() && |
| @@ -451,6 +456,24 @@ void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { |
| newly_bookmarked); |
| } |
| +void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) { |
| + if (zoom_view_) |
| + zoom_view_->SetZoomIconTooltipPercent(zoom_percent); |
| +} |
| + |
| +void LocationBarView::SetZoomIconState( |
| + ZoomController::ZoomIconState zoom_icon_state) { |
| + if (zoom_view_) { |
| + zoom_view_->SetZoomIconState(zoom_icon_state); |
| + UpdateContentSettingsIcons(); |
| + } |
| +} |
| + |
| +void LocationBarView::ShowZoomBubble(int zoom_percent) { |
| + if (zoom_view_) |
| + browser::ShowZoomBubbleView(zoom_view_, zoom_percent, true); |
|
Ben Goodger (Google)
2012/06/04 15:16:49
is this function called from anywhere outside the
Kyle Horimoto
2012/06/05 05:03:59
Done.
|
| +} |
| + |
| void LocationBarView::ShowChromeToMobileBubble() { |
| browser::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, profile_); |
| } |
| @@ -579,6 +602,8 @@ void LocationBarView::Layout() { |
| if (star_view_ && star_view_->visible()) |
| entry_width -= star_view_->GetPreferredSize().width() + GetItemPadding(); |
| + if (zoom_view_ && zoom_view_->visible()) |
| + entry_width -= zoom_view_->GetPreferredSize().width() + GetItemPadding(); |
| if (chrome_to_mobile_view_ && chrome_to_mobile_view_->visible()) |
| entry_width -= chrome_to_mobile_view_->GetPreferredSize().width() + |
| GetItemPadding(); |
| @@ -663,6 +688,13 @@ void LocationBarView::Layout() { |
| offset -= GetItemPadding(); |
| } |
| + if (zoom_view_ && zoom_view_->visible()) { |
| + int zoom_width = zoom_view_->GetPreferredSize().width(); |
| + offset -= zoom_width; |
| + zoom_view_->SetBounds(offset, location_y, zoom_width, location_height); |
| + offset -= GetItemPadding(); |
| + } |
| + |
| if (chrome_to_mobile_view_ && chrome_to_mobile_view_->visible()) { |
| int icon_width = chrome_to_mobile_view_->GetPreferredSize().width(); |
| offset -= icon_width; |
| @@ -1332,18 +1364,16 @@ void LocationBarView::Observe(int type, |
| std::string* name = content::Details<std::string>(details).ptr(); |
| if (*name == prefs::kEditBookmarksEnabled) |
| Update(NULL); |
| - break; |
| } |
| - |
| + break; |
| case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { |
| // Only update if the updated action box was for the active tab contents. |
| TabContentsWrapper* target_tab = |
| content::Details<TabContentsWrapper>(details).ptr(); |
| if (target_tab == GetTabContentsWrapper()) |
| UpdatePageActions(); |
| - break; |
| } |
| - |
| + break; |
| default: |
| NOTREACHED() << "Unexpected notification."; |
| } |