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_bubble_view.h" | 5 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" |
6 | 6 |
7 #include "chrome/browser/chrome_page_zoom.h" | 7 #include "chrome/browser/chrome_page_zoom.h" |
8 #include "chrome/browser/ui/zoom/zoom_controller.h" | 8 #include "chrome/browser/ui/zoom/zoom_controller.h" |
9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 void ZoomBubbleView::OnMouseEntered(const ui::MouseEvent& event) { | 109 void ZoomBubbleView::OnMouseEntered(const ui::MouseEvent& event) { |
110 StopTimer(); | 110 StopTimer(); |
111 } | 111 } |
112 | 112 |
113 void ZoomBubbleView::OnMouseExited(const ui::MouseEvent& event) { | 113 void ZoomBubbleView::OnMouseExited(const ui::MouseEvent& event) { |
114 StartTimerIfNecessary(); | 114 StartTimerIfNecessary(); |
115 } | 115 } |
116 | 116 |
117 ui::EventResult ZoomBubbleView::OnGestureEvent(ui::GestureEvent* event) { | 117 void ZoomBubbleView::OnGestureEvent(ui::GestureEvent* event) { |
118 if (!zoom_bubble_ || !zoom_bubble_->auto_close_ || | 118 if (!zoom_bubble_ || !zoom_bubble_->auto_close_ || |
119 event->type() != ui::ET_GESTURE_TAP) { | 119 event->type() != ui::ET_GESTURE_TAP) { |
120 return ui::ER_UNHANDLED; | 120 return; |
121 } | 121 } |
122 | 122 |
123 // If an auto-closing bubble was tapped, show a non-auto-closing bubble in | 123 // If an auto-closing bubble was tapped, show a non-auto-closing bubble in |
124 // its place. | 124 // its place. |
125 ShowBubble(zoom_bubble_->anchor_view(), zoom_bubble_->web_contents_, false); | 125 ShowBubble(zoom_bubble_->anchor_view(), zoom_bubble_->web_contents_, false); |
126 return ui::ER_CONSUMED; | 126 event->SetHandled(); |
127 } | 127 } |
128 | 128 |
129 void ZoomBubbleView::ButtonPressed(views::Button* sender, | 129 void ZoomBubbleView::ButtonPressed(views::Button* sender, |
130 const ui::Event& event) { | 130 const ui::Event& event) { |
131 chrome_page_zoom::Zoom(web_contents_, content::PAGE_ZOOM_RESET); | 131 chrome_page_zoom::Zoom(web_contents_, content::PAGE_ZOOM_RESET); |
132 } | 132 } |
133 | 133 |
134 void ZoomBubbleView::Init() { | 134 void ZoomBubbleView::Init() { |
135 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, | 135 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, |
136 0, 0, views::kRelatedControlVerticalSpacing)); | 136 0, 0, views::kRelatedControlVerticalSpacing)); |
(...skipping 14 matching lines...) Expand all Loading... |
151 | 151 |
152 StartTimerIfNecessary(); | 152 StartTimerIfNecessary(); |
153 } | 153 } |
154 | 154 |
155 void ZoomBubbleView::WindowClosing() { | 155 void ZoomBubbleView::WindowClosing() { |
156 // |zoom_bubble_| can be a new bubble by this point (as Close(); doesn't | 156 // |zoom_bubble_| can be a new bubble by this point (as Close(); doesn't |
157 // call this right away). Only set to NULL when it's this bubble. | 157 // call this right away). Only set to NULL when it's this bubble. |
158 if (zoom_bubble_ == this) | 158 if (zoom_bubble_ == this) |
159 zoom_bubble_ = NULL; | 159 zoom_bubble_ = NULL; |
160 } | 160 } |
OLD | NEW |