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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 2845593002: Updates Zoom bubble layout and adds +/- buttons (Closed)
Patch Set: Fix ZoomController to never show the bubble when zoom level is not changed from default Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 313 }
314 314
315 void LocationBarView::ZoomChangedForActiveTab(bool can_show_bubble) { 315 void LocationBarView::ZoomChangedForActiveTab(bool can_show_bubble) {
316 DCHECK(zoom_view_); 316 DCHECK(zoom_view_);
317 if (RefreshZoomView()) { 317 if (RefreshZoomView()) {
318 Layout(); 318 Layout();
319 SchedulePaint(); 319 SchedulePaint();
320 } 320 }
321 321
322 WebContents* web_contents = GetWebContents(); 322 WebContents* web_contents = GetWebContents();
323 if (can_show_bubble && zoom_view_->visible() && web_contents) 323 if (can_show_bubble && web_contents) {
324 ZoomBubbleView::ShowBubble(web_contents, gfx::Point(), 324 ZoomBubbleView::ShowBubble(web_contents, gfx::Point(),
325 ZoomBubbleView::AUTOMATIC); 325 ZoomBubbleView::AUTOMATIC);
326 }
326 } 327 }
327 328
328 void LocationBarView::SetStarToggled(bool on) { 329 void LocationBarView::SetStarToggled(bool on) {
329 if (star_view_) 330 if (star_view_)
330 star_view_->SetToggled(on); 331 star_view_->SetToggled(on);
331 } 332 }
332 333
333 gfx::Point LocationBarView::GetOmniboxViewOrigin() const { 334 gfx::Point LocationBarView::GetOmniboxViewOrigin() const {
334 gfx::Point origin(omnibox_view_->origin()); 335 gfx::Point origin(omnibox_view_->origin());
335 origin.set_x(GetMirroredXInView(origin.x())); 336 origin.set_x(GetMirroredXInView(origin.x()));
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 return visibility_changed; 695 return visibility_changed;
695 } 696 }
696 697
697 bool LocationBarView::RefreshZoomView() { 698 bool LocationBarView::RefreshZoomView() {
698 DCHECK(zoom_view_); 699 DCHECK(zoom_view_);
699 WebContents* web_contents = GetWebContents(); 700 WebContents* web_contents = GetWebContents();
700 if (!web_contents) 701 if (!web_contents)
701 return false; 702 return false;
702 const bool was_visible = zoom_view_->visible(); 703 const bool was_visible = zoom_view_->visible();
703 zoom_view_->Update(zoom::ZoomController::FromWebContents(web_contents)); 704 zoom_view_->Update(zoom::ZoomController::FromWebContents(web_contents));
704 if (!zoom_view_->visible())
705 ZoomBubbleView::CloseCurrentBubble();
706 return was_visible != zoom_view_->visible(); 705 return was_visible != zoom_view_->visible();
707 } 706 }
708 707
709 void LocationBarView::OnDefaultZoomLevelChanged() { 708 void LocationBarView::OnDefaultZoomLevelChanged() {
710 RefreshZoomView(); 709 RefreshZoomView();
711 } 710 }
712 711
713 void LocationBarView::ButtonPressed(views::Button* sender, 712 void LocationBarView::ButtonPressed(views::Button* sender,
714 const ui::Event& event) { 713 const ui::Event& event) {
715 DCHECK_EQ(keyword_hint_view_, sender); 714 DCHECK_EQ(keyword_hint_view_, sender);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 void LocationBarView::UpdateBookmarkStarVisibility() { 875 void LocationBarView::UpdateBookmarkStarVisibility() {
877 if (star_view_) { 876 if (star_view_) {
878 star_view_->SetVisible( 877 star_view_->SetVisible(
879 browser_defaults::bookmarks_enabled && !is_popup_mode_ && 878 browser_defaults::bookmarks_enabled && !is_popup_mode_ &&
880 !GetToolbarModel()->input_in_progress() && 879 !GetToolbarModel()->input_in_progress() &&
881 edit_bookmarks_enabled_.GetValue() && 880 edit_bookmarks_enabled_.GetValue() &&
882 !IsBookmarkStarHiddenByExtension()); 881 !IsBookmarkStarHiddenByExtension());
883 } 882 }
884 } 883 }
885 884
885 void LocationBarView::UpdateZoomViewVisibility() {
886 RefreshZoomView();
887 OnChanged();
888 }
889
886 void LocationBarView::UpdateLocationBarVisibility(bool visible, bool animate) { 890 void LocationBarView::UpdateLocationBarVisibility(bool visible, bool animate) {
887 if (!animate) { 891 if (!animate) {
888 size_animation_.Reset(visible ? 1 : 0); 892 size_animation_.Reset(visible ? 1 : 0);
889 return; 893 return;
890 } 894 }
891 895
892 if (visible) 896 if (visible)
893 size_animation_.Show(); 897 size_animation_.Show();
894 else 898 else
895 size_animation_.Hide(); 899 size_animation_.Hide();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 // LocationBarView, private TemplateURLServiceObserver implementation: 1045 // LocationBarView, private TemplateURLServiceObserver implementation:
1042 1046
1043 void LocationBarView::OnTemplateURLServiceChanged() { 1047 void LocationBarView::OnTemplateURLServiceChanged() {
1044 template_url_service_->RemoveObserver(this); 1048 template_url_service_->RemoveObserver(this);
1045 template_url_service_ = nullptr; 1049 template_url_service_ = nullptr;
1046 // If the browser is no longer active, let's not show the info bubble, as this 1050 // If the browser is no longer active, let's not show the info bubble, as this
1047 // would make the browser the active window again. 1051 // would make the browser the active window again.
1048 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) 1052 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive())
1049 ShowFirstRunBubble(); 1053 ShowFirstRunBubble();
1050 } 1054 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698