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 96b3072de8681bba9d7c360832ea23eee4871bf3..e4693eb46d55737bf27c4f6d0fea042e9b28da9c 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,8 @@ |
| #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_bubble_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 +150,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 +249,9 @@ void LocationBarView::Init() { |
| AddChildView(star_view_); |
| star_view_->SetVisible(true); |
| + zoom_view_ = new ZoomView(); |
|
Peter Kasting
2012/06/22 20:16:20
This should appear in the same cases as the conten
Kyle Horimoto
2012/06/26 21:55:53
Done. Moved below the code adding the Star, etc. i
|
| + 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() && |
| @@ -351,6 +357,10 @@ void LocationBarView::Update(const WebContents* tab_for_state_restoring) { |
| if (star_view_) |
| star_view_->SetVisible(star_enabled); |
| + zoom_view_->Update(); |
| + if (model_->input_in_progress()) |
| + zoom_view_->SetVisible(false); |
|
Peter Kasting
2012/06/22 20:16:20
Doesn't this need to be:
zoom_view_->SetVisible
Kyle Horimoto
2012/06/26 21:55:53
Moved this check to ZoomView::Update() :)
|
| + |
| bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() && |
| ChromeToMobileServiceFactory::GetForProfile(profile_)->HasDevices(); |
| command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); |
| @@ -451,6 +461,24 @@ void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { |
| newly_bookmarked); |
| } |
| +void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) { |
| + if (zoom_view_) |
|
Peter Kasting
2012/06/22 20:16:20
NULL-check no longer needed once this is created u
Kyle Horimoto
2012/06/26 21:55:53
Done.
|
| + zoom_view_->SetZoomIconTooltipPercent(zoom_percent); |
| +} |
| + |
| +void LocationBarView::SetZoomIconState( |
| + ZoomController::ZoomIconState zoom_icon_state) { |
| + if (zoom_view_) { |
| + zoom_view_->SetZoomIconState(zoom_icon_state); |
| + UpdateContentSettingsIcons(); |
|
Peter Kasting
2012/06/22 20:16:20
Why are we calling this?
Did you instead mean to
Kyle Horimoto
2012/06/26 21:55:53
Hmm, I think this is part of some code I ended up
|
| + } |
| +} |
| + |
| +void LocationBarView::ShowZoomBubble(int zoom_percent) { |
| + if (zoom_view_) |
| + ZoomBubbleView::ShowBubble(zoom_view_, zoom_percent, true); |
| +} |
| + |
| void LocationBarView::ShowChromeToMobileBubble() { |
| browser::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, profile_); |
| } |
| @@ -579,6 +607,8 @@ void LocationBarView::Layout() { |
| if (star_view_ && star_view_->visible()) |
| entry_width -= star_view_->GetPreferredSize().width() + GetItemPadding(); |
| + if (zoom_view_ && zoom_view_->visible()) |
|
Peter Kasting
2012/06/22 20:16:20
Nit: Remove NULL-check and move to appropriate loc
Kyle Horimoto
2012/06/26 21:55:53
Done.
|
| + 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 +693,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; |