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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 10494004: Implements a zoom icon in the Omnibox for Views. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase & nit Created 8 years, 6 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/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 0dafb088ca50769b35aaa2c4be17db9ce3ab2d04..f2bdc4e0edf8ca4a15412824f94ca223fd958b3e 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -48,6 +48,8 @@
#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/suggested_text_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/browser/ui/views/omnibox/omnibox_views.h"
#include "chrome/browser/ui/webui/instant_ui.h"
@@ -178,6 +180,7 @@ LocationBarView::LocationBarView(Profile* profile,
selected_keyword_view_(NULL),
suggested_text_view_(NULL),
keyword_hint_view_(NULL),
+ zoom_view_(NULL),
star_view_(NULL),
action_box_button_view_(NULL),
chrome_to_mobile_view_(NULL),
@@ -268,6 +271,9 @@ void LocationBarView::Init(views::View* popup_parent_view) {
content_blocked_view->SetVisible(false);
}
+ zoom_view_ = new ZoomView(model_);
+ AddChildView(zoom_view_);
+
if (extensions::switch_utils::IsActionBoxEnabled()) {
action_box_button_view_ = new ActionBoxButtonView(
ExtensionSystem::Get(profile_)->extension_service());
@@ -390,6 +396,10 @@ void LocationBarView::ModeChanged(const chrome::search::Mode& mode) {
}
void LocationBarView::Update(const WebContents* tab_for_state_restoring) {
+ RefreshContentSettingViews();
+ zoom_view_->Update();
+ RefreshPageActionViews();
+
bool star_enabled = star_view_ && !model_->input_in_progress() &&
edit_bookmarks_enabled_.GetValue();
@@ -401,8 +411,6 @@ void LocationBarView::Update(const WebContents* tab_for_state_restoring) {
ChromeToMobileServiceFactory::GetForProfile(profile_)->HasDevices();
command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled);
- RefreshContentSettingViews();
- RefreshPageActionViews();
// Don't Update in app launcher mode so that the location entry does not show
// a URL or security background.
if (mode_ != APP_LAUNCHER)
@@ -495,6 +503,19 @@ void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
browser::ShowBookmarkBubbleView(star_view_, profile_, url, newly_bookmarked);
}
+void LocationBarView::SetZoomIconTooltipPercent(int zoom_percent) {
+ zoom_view_->SetZoomIconTooltipPercent(zoom_percent);
+}
+
+void LocationBarView::SetZoomIconState(
+ ZoomController::ZoomIconState zoom_icon_state) {
+ zoom_view_->SetZoomIconState(zoom_icon_state);
+}
+
+void LocationBarView::ShowZoomBubble(int zoom_percent) {
+ ZoomBubbleView::ShowBubble(zoom_view_, zoom_percent, true);
+}
+
void LocationBarView::ShowChromeToMobileBubble() {
Browser* browser = GetBrowserFromDelegate(delegate_);
browser::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, browser);
@@ -633,9 +654,10 @@ void LocationBarView::Layout() {
if (star_view_ && star_view_->visible())
entry_width -= star_view_->GetPreferredSize().width() + GetItemPadding();
- if (chrome_to_mobile_view_ && chrome_to_mobile_view_->visible())
+ if (chrome_to_mobile_view_ && chrome_to_mobile_view_->visible()) {
entry_width -= chrome_to_mobile_view_->GetPreferredSize().width() +
GetItemPadding();
+ }
int action_box_button_width = location_height;
if (action_box_button_view_)
entry_width -= action_box_button_width + GetItemPadding();
@@ -644,6 +666,7 @@ void LocationBarView::Layout() {
if ((*i)->visible())
entry_width -= ((*i)->GetPreferredSize().width() + GetItemPadding());
}
+ entry_width -= zoom_view_->GetPreferredSize().width() + GetItemPadding();
Peter Kasting 2012/07/02 19:21:27 This should only happen if the zoom icon is visibl
Kyle Horimoto 2012/07/02 21:09:02 Done.
for (ContentSettingViews::const_iterator i(content_setting_views_.begin());
i != content_setting_views_.end(); ++i) {
if ((*i)->visible())
@@ -738,6 +761,12 @@ void LocationBarView::Layout() {
offset -= GetItemPadding() - (*i)->GetBuiltInHorizontalPadding();
}
}
+
+ int zoom_width = zoom_view_->GetPreferredSize().width();
Peter Kasting 2012/07/02 19:21:27 This block should only happen if the zoom icon is
Kyle Horimoto 2012/07/02 21:09:02 Done.
+ offset -= zoom_width;
+ zoom_view_->SetBounds(offset, location_y, zoom_width, location_height);
+ offset -= GetItemPadding();
+
// We use a reverse_iterator here because we're laying out the views from
// right to left but in the vector they're ordered left to right.
for (ContentSettingViews::const_reverse_iterator

Powered by Google App Engine
This is Rietveld 408576698