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

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: Always shows zoom icon, even when zoom is 100% (rebased) 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 // LocationBarView, private TemplateURLServiceObserver implementation: 1040 // LocationBarView, private TemplateURLServiceObserver implementation:
1042 1041
1043 void LocationBarView::OnTemplateURLServiceChanged() { 1042 void LocationBarView::OnTemplateURLServiceChanged() {
1044 template_url_service_->RemoveObserver(this); 1043 template_url_service_->RemoveObserver(this);
1045 template_url_service_ = nullptr; 1044 template_url_service_ = nullptr;
1046 // If the browser is no longer active, let's not show the info bubble, as this 1045 // 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. 1046 // would make the browser the active window again.
1048 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) 1047 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive())
1049 ShowFirstRunBubble(); 1048 ShowFirstRunBubble();
1050 } 1049 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698