| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/location_bar_decoration_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_decoration_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 7 #include "ui/base/events/event.h" | 8 #include "ui/base/events/event.h" |
| 8 | 9 |
| 9 LocationBarDecorationView::LocationBarDecorationView() | 10 LocationBarDecorationView::LocationBarDecorationView() |
| 10 : could_handle_click_(true) { | 11 : could_handle_click_(true) { |
| 11 set_accessibility_focusable(true); | 12 set_accessibility_focusable(true); |
| 12 TouchableLocationBarView::Init(this); | 13 LocationBarView::InitTouchableLocationBarView(this); |
| 13 } | 14 } |
| 14 | 15 |
| 15 LocationBarDecorationView::~LocationBarDecorationView() {} | 16 LocationBarDecorationView::~LocationBarDecorationView() {} |
| 16 | 17 |
| 17 bool LocationBarDecorationView::OnMousePressed(const ui::MouseEvent& event) { | 18 bool LocationBarDecorationView::OnMousePressed(const ui::MouseEvent& event) { |
| 18 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) { | 19 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) { |
| 19 // Do nothing until mouse is released. | 20 // Do nothing until mouse is released. |
| 20 could_handle_click_ = CanHandleClick(); | 21 could_handle_click_ = CanHandleClick(); |
| 21 return true; | 22 return true; |
| 22 } | 23 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 41 return false; | 42 return false; |
| 42 } | 43 } |
| 43 | 44 |
| 44 void LocationBarDecorationView::OnGestureEvent(ui::GestureEvent* event) { | 45 void LocationBarDecorationView::OnGestureEvent(ui::GestureEvent* event) { |
| 45 if (event->type() == ui::ET_GESTURE_TAP) { | 46 if (event->type() == ui::ET_GESTURE_TAP) { |
| 46 OnClick(); | 47 OnClick(); |
| 47 event->SetHandled(); | 48 event->SetHandled(); |
| 48 } | 49 } |
| 49 } | 50 } |
| 50 | 51 |
| 51 int LocationBarDecorationView::GetBuiltInHorizontalPadding() const { | |
| 52 return GetBuiltInHorizontalPaddingImpl(); | |
| 53 } | |
| 54 | |
| 55 bool LocationBarDecorationView::CanHandleClick() const { | 52 bool LocationBarDecorationView::CanHandleClick() const { |
| 56 return true; | 53 return true; |
| 57 } | 54 } |
| OLD | NEW |