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

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

Issue 2019423005: Move //components/ui/zoom to top-level under //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 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/browser/ui/view_ids.h" 8 #include "chrome/browser/ui/view_ids.h"
9 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" 9 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
11 #include "components/toolbar/toolbar_model.h" 11 #include "components/toolbar/toolbar_model.h"
12 #include "components/ui/zoom/zoom_controller.h" 12 #include "components/zoom/zoom_controller.h"
13 #include "ui/accessibility/ax_view_state.h" 13 #include "ui/accessibility/ax_view_state.h"
14 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/events/event.h" 15 #include "ui/events/event.h"
16 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
17 #include "ui/gfx/vector_icons_public.h" 17 #include "ui/gfx/vector_icons_public.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 image_id_(gfx::VectorIconId::VECTOR_ICON_NONE) { 22 image_id_(gfx::VectorIconId::VECTOR_ICON_NONE) {
23 Update(NULL); 23 Update(NULL);
24 } 24 }
25 25
26 ZoomView::~ZoomView() { 26 ZoomView::~ZoomView() {
27 } 27 }
28 28
29 void ZoomView::Update(ui_zoom::ZoomController* zoom_controller) { 29 void ZoomView::Update(zoom::ZoomController* zoom_controller) {
30 if (!zoom_controller || zoom_controller->IsAtDefaultZoom() || 30 if (!zoom_controller || zoom_controller->IsAtDefaultZoom() ||
31 location_bar_delegate_->GetToolbarModel()->input_in_progress()) { 31 location_bar_delegate_->GetToolbarModel()->input_in_progress()) {
32 SetVisible(false); 32 SetVisible(false);
33 ZoomBubbleView::CloseCurrentBubble(); 33 ZoomBubbleView::CloseCurrentBubble();
34 return; 34 return;
35 } 35 }
36 36
37 SetTooltipText(l10n_util::GetStringFUTF16( 37 SetTooltipText(l10n_util::GetStringFUTF16(
38 IDS_TOOLTIP_ZOOM, 38 IDS_TOOLTIP_ZOOM,
39 base::FormatPercent(zoom_controller->GetZoomPercent()))); 39 base::FormatPercent(zoom_controller->GetZoomPercent())));
40 40
41 // The icon is hidden when the zoom level is default. 41 // The icon is hidden when the zoom level is default.
42 image_id_ = zoom_controller->GetZoomRelativeToDefault() == 42 image_id_ = zoom_controller->GetZoomRelativeToDefault() ==
43 ui_zoom::ZoomController::ZOOM_BELOW_DEFAULT_ZOOM 43 zoom::ZoomController::ZOOM_BELOW_DEFAULT_ZOOM
44 ? gfx::VectorIconId::ZOOM_MINUS 44 ? gfx::VectorIconId::ZOOM_MINUS
45 : gfx::VectorIconId::ZOOM_PLUS; 45 : gfx::VectorIconId::ZOOM_PLUS;
46 if (GetNativeTheme()) 46 if (GetNativeTheme())
47 UpdateIcon(); 47 UpdateIcon();
48 48
49 SetVisible(true); 49 SetVisible(true);
50 } 50 }
51 51
52 void ZoomView::OnExecuting(BubbleIconView::ExecuteSource source) { 52 void ZoomView::OnExecuting(BubbleIconView::ExecuteSource source) {
53 ZoomBubbleView::ShowBubble(location_bar_delegate_->GetWebContents(), 53 ZoomBubbleView::ShowBubble(location_bar_delegate_->GetWebContents(),
54 ZoomBubbleView::USER_GESTURE); 54 ZoomBubbleView::USER_GESTURE);
55 } 55 }
56 56
57 void ZoomView::GetAccessibleState(ui::AXViewState* state) { 57 void ZoomView::GetAccessibleState(ui::AXViewState* state) {
58 BubbleIconView::GetAccessibleState(state); 58 BubbleIconView::GetAccessibleState(state);
59 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_ZOOM); 59 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_ZOOM);
60 } 60 }
61 61
62 views::BubbleDialogDelegateView* ZoomView::GetBubble() const { 62 views::BubbleDialogDelegateView* ZoomView::GetBubble() const {
63 return ZoomBubbleView::GetZoomBubble(); 63 return ZoomBubbleView::GetZoomBubble();
64 } 64 }
65 65
66 gfx::VectorIconId ZoomView::GetVectorIcon() const { 66 gfx::VectorIconId ZoomView::GetVectorIcon() const {
67 return image_id_; 67 return image_id_;
68 } 68 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/zoom_view.h ('k') | chrome/browser/ui/views/toolbar/app_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698