| 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" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // Don't show tooltip if the zoom bubble is displayed. | 50 // Don't show tooltip if the zoom bubble is displayed. |
| 51 return !ZoomBubbleView::IsShowing() && ImageView::GetTooltipText(p, tooltip); | 51 return !ZoomBubbleView::IsShowing() && ImageView::GetTooltipText(p, tooltip); |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool ZoomView::OnMousePressed(const ui::MouseEvent& event) { | 54 bool ZoomView::OnMousePressed(const ui::MouseEvent& event) { |
| 55 // Do nothing until mouse is released. | 55 // Do nothing until mouse is released. |
| 56 return true; | 56 return true; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ZoomView::OnMouseReleased(const ui::MouseEvent& event) { | 59 void ZoomView::OnMouseReleased(const ui::MouseEvent& event) { |
| 60 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) | 60 if (event.IsOnlyLeftMouseButton() && |
| 61 HitTestPoint(gfx::ToFlooredPoint(event.location()))) |
| 61 ActivateBubble(); | 62 ActivateBubble(); |
| 62 } | 63 } |
| 63 | 64 |
| 64 bool ZoomView::OnKeyPressed(const ui::KeyEvent& event) { | 65 bool ZoomView::OnKeyPressed(const ui::KeyEvent& event) { |
| 65 if (event.key_code() != ui::VKEY_SPACE && | 66 if (event.key_code() != ui::VKEY_SPACE && |
| 66 event.key_code() != ui::VKEY_RETURN) { | 67 event.key_code() != ui::VKEY_RETURN) { |
| 67 return false; | 68 return false; |
| 68 } | 69 } |
| 69 | 70 |
| 70 ActivateBubble(); | 71 ActivateBubble(); |
| 71 return true; | 72 return true; |
| 72 } | 73 } |
| 73 | 74 |
| 74 void ZoomView::OnGestureEvent(ui::GestureEvent* event) { | 75 void ZoomView::OnGestureEvent(ui::GestureEvent* event) { |
| 75 if (event->type() == ui::ET_GESTURE_TAP) { | 76 if (event->type() == ui::ET_GESTURE_TAP) { |
| 76 ActivateBubble(); | 77 ActivateBubble(); |
| 77 event->SetHandled(); | 78 event->SetHandled(); |
| 78 } | 79 } |
| 79 } | 80 } |
| 80 | 81 |
| 81 void ZoomView::ActivateBubble() { | 82 void ZoomView::ActivateBubble() { |
| 82 ZoomBubbleView::ShowBubble(location_bar_delegate_->GetWebContents(), false); | 83 ZoomBubbleView::ShowBubble(location_bar_delegate_->GetWebContents(), false); |
| 83 } | 84 } |
| OLD | NEW |