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

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

Issue 2891883002: Revert of Updates Zoom bubble layout and adds +/- buttons (Closed)
Patch Set: 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 && web_contents) { 323 if (can_show_bubble && zoom_view_->visible() && web_contents)
324 ZoomBubbleView::ShowBubble(web_contents, gfx::Point(), 324 ZoomBubbleView::ShowBubble(web_contents, gfx::Point(),
325 ZoomBubbleView::AUTOMATIC); 325 ZoomBubbleView::AUTOMATIC);
326 }
327 } 326 }
328 327
329 void LocationBarView::SetStarToggled(bool on) { 328 void LocationBarView::SetStarToggled(bool on) {
330 if (star_view_) 329 if (star_view_)
331 star_view_->SetToggled(on); 330 star_view_->SetToggled(on);
332 } 331 }
333 332
334 gfx::Point LocationBarView::GetOmniboxViewOrigin() const { 333 gfx::Point LocationBarView::GetOmniboxViewOrigin() const {
335 gfx::Point origin(omnibox_view_->origin()); 334 gfx::Point origin(omnibox_view_->origin());
336 origin.set_x(GetMirroredXInView(origin.x())); 335 origin.set_x(GetMirroredXInView(origin.x()));
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 return visibility_changed; 694 return visibility_changed;
696 } 695 }
697 696
698 bool LocationBarView::RefreshZoomView() { 697 bool LocationBarView::RefreshZoomView() {
699 DCHECK(zoom_view_); 698 DCHECK(zoom_view_);
700 WebContents* web_contents = GetWebContents(); 699 WebContents* web_contents = GetWebContents();
701 if (!web_contents) 700 if (!web_contents)
702 return false; 701 return false;
703 const bool was_visible = zoom_view_->visible(); 702 const bool was_visible = zoom_view_->visible();
704 zoom_view_->Update(zoom::ZoomController::FromWebContents(web_contents)); 703 zoom_view_->Update(zoom::ZoomController::FromWebContents(web_contents));
704 if (!zoom_view_->visible())
705 ZoomBubbleView::CloseCurrentBubble();
705 return was_visible != zoom_view_->visible(); 706 return was_visible != zoom_view_->visible();
706 } 707 }
707 708
708 void LocationBarView::OnDefaultZoomLevelChanged() { 709 void LocationBarView::OnDefaultZoomLevelChanged() {
709 RefreshZoomView(); 710 RefreshZoomView();
710 } 711 }
711 712
712 void LocationBarView::ButtonPressed(views::Button* sender, 713 void LocationBarView::ButtonPressed(views::Button* sender,
713 const ui::Event& event) { 714 const ui::Event& event) {
714 DCHECK_EQ(keyword_hint_view_, sender); 715 DCHECK_EQ(keyword_hint_view_, sender);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 void LocationBarView::UpdateBookmarkStarVisibility() { 876 void LocationBarView::UpdateBookmarkStarVisibility() {
876 if (star_view_) { 877 if (star_view_) {
877 star_view_->SetVisible( 878 star_view_->SetVisible(
878 browser_defaults::bookmarks_enabled && !is_popup_mode_ && 879 browser_defaults::bookmarks_enabled && !is_popup_mode_ &&
879 !GetToolbarModel()->input_in_progress() && 880 !GetToolbarModel()->input_in_progress() &&
880 edit_bookmarks_enabled_.GetValue() && 881 edit_bookmarks_enabled_.GetValue() &&
881 !IsBookmarkStarHiddenByExtension()); 882 !IsBookmarkStarHiddenByExtension());
882 } 883 }
883 } 884 }
884 885
885 void LocationBarView::UpdateZoomViewVisibility() {
886 RefreshZoomView();
887 OnChanged();
888 }
889
890 void LocationBarView::UpdateLocationBarVisibility(bool visible, bool animate) { 886 void LocationBarView::UpdateLocationBarVisibility(bool visible, bool animate) {
891 if (!animate) { 887 if (!animate) {
892 size_animation_.Reset(visible ? 1 : 0); 888 size_animation_.Reset(visible ? 1 : 0);
893 return; 889 return;
894 } 890 }
895 891
896 if (visible) 892 if (visible)
897 size_animation_.Show(); 893 size_animation_.Show();
898 else 894 else
899 size_animation_.Hide(); 895 size_animation_.Hide();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 // LocationBarView, private TemplateURLServiceObserver implementation: 1041 // LocationBarView, private TemplateURLServiceObserver implementation:
1046 1042
1047 void LocationBarView::OnTemplateURLServiceChanged() { 1043 void LocationBarView::OnTemplateURLServiceChanged() {
1048 template_url_service_->RemoveObserver(this); 1044 template_url_service_->RemoveObserver(this);
1049 template_url_service_ = nullptr; 1045 template_url_service_ = nullptr;
1050 // If the browser is no longer active, let's not show the info bubble, as this 1046 // If the browser is no longer active, let's not show the info bubble, as this
1051 // would make the browser the active window again. 1047 // would make the browser the active window again.
1052 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) 1048 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive())
1053 ShowFirstRunBubble(); 1049 ShowFirstRunBubble();
1054 } 1050 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/browser/ui/views/location_bar/zoom_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698