OLD | NEW |
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 "chrome/browser/ui/toolbar/toolbar_model.h" | 7 #include "chrome/browser/ui/toolbar/toolbar_model.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/browser/ui/zoom/zoom_controller.h" | 10 #include "chrome/browser/ui/zoom/zoom_controller.h" |
11 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
12 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
13 #include "ui/base/accessibility/accessible_view_state.h" | 13 #include "ui/base/accessibility/accessible_view_state.h" |
14 #include "ui/base/events/event.h" | 14 #include "ui/base/events/event.h" |
15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
18 | 18 |
19 ZoomView::ZoomView(ToolbarModel* toolbar_model, | 19 ZoomView::ZoomView(ToolbarModel* toolbar_model, |
20 LocationBarView::Delegate* location_bar_delegate) | 20 LocationBarView::Delegate* location_bar_delegate) |
21 : toolbar_model_(toolbar_model), | 21 : toolbar_model_(toolbar_model), |
22 location_bar_delegate_(location_bar_delegate) { | 22 location_bar_delegate_(location_bar_delegate) { |
23 set_accessibility_focusable(true); | 23 set_accessibility_focusable(true); |
24 Update(NULL); | 24 Update(NULL); |
25 TouchableLocationBarView::Init(this); | 25 LocationBarView::InitTouchableLocationBarView(this); |
26 } | 26 } |
27 | 27 |
28 ZoomView::~ZoomView() { | 28 ZoomView::~ZoomView() { |
29 } | 29 } |
30 | 30 |
31 void ZoomView::Update(ZoomController* zoom_controller) { | 31 void ZoomView::Update(ZoomController* zoom_controller) { |
32 if (!zoom_controller || zoom_controller->IsAtDefaultZoom() || | 32 if (!zoom_controller || zoom_controller->IsAtDefaultZoom() || |
33 toolbar_model_->GetInputInProgress()) { | 33 toolbar_model_->GetInputInProgress()) { |
34 SetVisible(false); | 34 SetVisible(false); |
35 ZoomBubbleView::CloseBubble(); | 35 ZoomBubbleView::CloseBubble(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return true; | 73 return true; |
74 } | 74 } |
75 | 75 |
76 void ZoomView::OnGestureEvent(ui::GestureEvent* event) { | 76 void ZoomView::OnGestureEvent(ui::GestureEvent* event) { |
77 if (event->type() == ui::ET_GESTURE_TAP) { | 77 if (event->type() == ui::ET_GESTURE_TAP) { |
78 ActivateBubble(); | 78 ActivateBubble(); |
79 event->SetHandled(); | 79 event->SetHandled(); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 int ZoomView::GetBuiltInHorizontalPadding() const { | |
84 return GetBuiltInHorizontalPaddingImpl(); | |
85 } | |
86 | |
87 void ZoomView::ActivateBubble() { | 83 void ZoomView::ActivateBubble() { |
88 ZoomBubbleView::ShowBubble(location_bar_delegate_->GetWebContents(), false); | 84 ZoomBubbleView::ShowBubble(location_bar_delegate_->GetWebContents(), false); |
89 } | 85 } |
OLD | NEW |