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

Side by Side Diff: chrome/browser/ui/views/location_bar/zoom_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/zoom_view.h" 5 #include "chrome/browser/ui/views/location_bar/zoom_view.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "chrome/app/vector_icons/vector_icons.h" 8 #include "chrome/app/vector_icons/vector_icons.h"
9 #include "chrome/browser/ui/view_ids.h" 9 #include "chrome/browser/ui/view_ids.h"
10 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" 10 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h"
11 #include "chrome/grit/generated_resources.h" 11 #include "chrome/grit/generated_resources.h"
12 #include "components/toolbar/toolbar_model.h" 12 #include "components/toolbar/toolbar_model.h"
13 #include "components/zoom/zoom_controller.h" 13 #include "components/zoom/zoom_controller.h"
14 #include "ui/accessibility/ax_node_data.h" 14 #include "ui/accessibility/ax_node_data.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/events/event.h" 16 #include "ui/events/event.h"
17 #include "ui/gfx/geometry/size.h" 17 #include "ui/gfx/geometry/size.h"
18 18
19 ZoomView::ZoomView(LocationBarView::Delegate* location_bar_delegate) 19 ZoomView::ZoomView(LocationBarView::Delegate* location_bar_delegate)
20 : BubbleIconView(nullptr, 0), 20 : BubbleIconView(nullptr, 0),
21 location_bar_delegate_(location_bar_delegate), 21 location_bar_delegate_(location_bar_delegate),
22 icon_(&kZoomMinusIcon) { 22 icon_(&kZoomMinusIcon) {
23 Update(nullptr); 23 Update(nullptr);
24 } 24 }
25 25
26 ZoomView::~ZoomView() { 26 ZoomView::~ZoomView() {
27 } 27 }
28 28
29 void ZoomView::Update(zoom::ZoomController* zoom_controller) { 29 void ZoomView::Update(zoom::ZoomController* zoom_controller) {
30 if (!zoom_controller || zoom_controller->IsAtDefaultZoom() || 30 if (!zoom_controller ||
31 (!ZoomBubbleView::GetZoomBubble() &&
32 zoom_controller->IsAtDefaultZoom()) ||
31 location_bar_delegate_->GetToolbarModel()->input_in_progress()) { 33 location_bar_delegate_->GetToolbarModel()->input_in_progress()) {
32 SetVisible(false); 34 SetVisible(false);
33 ZoomBubbleView::CloseCurrentBubble(); 35 ZoomBubbleView::CloseCurrentBubble();
34 return; 36 return;
35 } 37 }
36 38
37 SetTooltipText(l10n_util::GetStringFUTF16( 39 SetTooltipText(l10n_util::GetStringFUTF16(
38 IDS_TOOLTIP_ZOOM, 40 IDS_TOOLTIP_ZOOM,
39 base::FormatPercent(zoom_controller->GetZoomPercent()))); 41 base::FormatPercent(zoom_controller->GetZoomPercent())));
40 42
(...skipping 18 matching lines...) Expand all
59 node_data->SetName(l10n_util::GetStringUTF8(IDS_ACCNAME_ZOOM)); 61 node_data->SetName(l10n_util::GetStringUTF8(IDS_ACCNAME_ZOOM));
60 } 62 }
61 63
62 views::BubbleDialogDelegateView* ZoomView::GetBubble() const { 64 views::BubbleDialogDelegateView* ZoomView::GetBubble() const {
63 return ZoomBubbleView::GetZoomBubble(); 65 return ZoomBubbleView::GetZoomBubble();
64 } 66 }
65 67
66 const gfx::VectorIcon& ZoomView::GetVectorIcon() const { 68 const gfx::VectorIcon& ZoomView::GetVectorIcon() const {
67 return *icon_; 69 return *icon_;
68 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698