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

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: Addressed comments, improved code executed when a new bubble is opened when another already exists 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 2dbec86d6c79041326f2bea37b5b63c2f9bee1f0..82ef10ef9d139a5d327f1d265f2a89f0a95f95ea 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/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/common/chrome_notification_types.h"
@@ -142,6 +144,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),
@@ -250,6 +253,9 @@ void LocationBarView::Init(views::View* popup_parent_view) {
}
}
+ zoom_view_ = new ZoomView(model_);
Peter Kasting 2012/06/26 23:23:39 Nit: Move this to just below the content settings
Kyle Horimoto 2012/06/30 00:22:50 Done.
+ AddChildView(zoom_view_);
+
registrar_.Add(this,
chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED,
content::Source<Profile>(profile_));
@@ -342,6 +348,8 @@ void LocationBarView::Update(const WebContents* tab_for_state_restoring) {
if (star_view_)
star_view_->SetVisible(star_enabled);
+ zoom_view_->Update();
Peter Kasting 2012/06/26 23:23:39 Nit: Move the RefreshXXX() calls below to the top
Kyle Horimoto 2012/06/30 00:22:50 Done.
+
bool enabled = chrome_to_mobile_view_ && !model_->input_in_progress() &&
ChromeToMobileServiceFactory::GetForProfile(profile_)->HasDevices();
command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled);
@@ -442,6 +450,19 @@ void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
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::ShowChromeToMobileBubbleView(chrome_to_mobile_view_, profile_);
}
@@ -563,9 +584,11 @@ 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();
+ }
+ entry_width -= zoom_view_->GetPreferredSize().width() + GetItemPadding();
Peter Kasting 2012/06/26 23:23:39 Nit: Move this to just above the content settings
Kyle Horimoto 2012/06/30 00:22:50 Done.
int action_box_button_width = location_height;
if (action_box_button_view_)
entry_width -= action_box_button_width + GetItemPadding();
@@ -658,6 +681,11 @@ void LocationBarView::Layout() {
chrome_to_mobile_view_->GetBuiltInHorizontalPadding();
}
+ int zoom_width = zoom_view_->GetPreferredSize().width();
Peter Kasting 2012/06/26 23:23:39 Nit: Move this to just above the content settings
Kyle Horimoto 2012/06/30 00:22:50 Done.
+ offset -= zoom_width;
+ zoom_view_->SetBounds(offset, location_y, zoom_width, location_height);
+ offset -= GetItemPadding();
+
for (PageActionViews::const_iterator i(page_action_views_.begin());
i != page_action_views_.end(); ++i) {
if ((*i)->visible()) {

Powered by Google App Engine
This is Rietveld 408576698