| 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/star_view.h" | 5 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" |
| 7 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 9 #include "chrome/browser/command_updater.h" | 11 #include "chrome/browser/command_updater.h" |
| 10 #include "chrome/browser/ui/view_ids.h" | 12 #include "chrome/browser/ui/view_ids.h" |
| 11 #include "chrome/browser/ui/views/browser_dialogs.h" | 13 #include "chrome/browser/ui/views/browser_dialogs.h" |
| 12 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 13 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
| 14 #include "ui/base/accessibility/accessible_view_state.h" | 16 #include "ui/base/accessibility/accessible_view_state.h" |
| 15 #include "ui/base/events/event.h" | 17 #include "ui/base/events/event.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 18 | 20 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 return views::ImageView::GetTooltipText(p, tooltip); | 53 return views::ImageView::GetTooltipText(p, tooltip); |
| 52 } | 54 } |
| 53 | 55 |
| 54 bool StarView::OnMousePressed(const ui::MouseEvent& event) { | 56 bool StarView::OnMousePressed(const ui::MouseEvent& event) { |
| 55 // We want to show the bubble on mouse release; that is the standard behavior | 57 // We want to show the bubble on mouse release; that is the standard behavior |
| 56 // for buttons. | 58 // for buttons. |
| 57 return true; | 59 return true; |
| 58 } | 60 } |
| 59 | 61 |
| 60 void StarView::OnMouseReleased(const ui::MouseEvent& event) { | 62 void StarView::OnMouseReleased(const ui::MouseEvent& event) { |
| 61 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) | 63 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) { |
| 64 UMA_HISTOGRAM_ENUMERATION("Bookmarks.EntryPoint", |
| 65 bookmark_utils::ENTRY_POINT_STAR_MOUSE, |
| 66 bookmark_utils::ENTRY_POINT_LIMIT); |
| 62 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); | 67 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); |
| 68 } |
| 63 } | 69 } |
| 64 | 70 |
| 65 ui::EventResult StarView::OnGestureEvent(const ui::GestureEvent& event) { | 71 ui::EventResult StarView::OnGestureEvent(const ui::GestureEvent& event) { |
| 66 if (event.type() == ui::ET_GESTURE_TAP) { | 72 if (event.type() == ui::ET_GESTURE_TAP) { |
| 73 UMA_HISTOGRAM_ENUMERATION("Bookmarks.EntryPoint", |
| 74 bookmark_utils::ENTRY_POINT_STAR_GESTURE, |
| 75 bookmark_utils::ENTRY_POINT_LIMIT); |
| 67 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); | 76 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); |
| 68 return ui::ER_CONSUMED; | 77 return ui::ER_CONSUMED; |
| 69 } | 78 } |
| 70 return ui::ER_UNHANDLED; | 79 return ui::ER_UNHANDLED; |
| 71 } | 80 } |
| 72 | 81 |
| 73 bool StarView::OnKeyPressed(const ui::KeyEvent& event) { | 82 bool StarView::OnKeyPressed(const ui::KeyEvent& event) { |
| 74 if (event.key_code() == ui::VKEY_SPACE || | 83 if (event.key_code() == ui::VKEY_SPACE || |
| 75 event.key_code() == ui::VKEY_RETURN) { | 84 event.key_code() == ui::VKEY_RETURN) { |
| 85 UMA_HISTOGRAM_ENUMERATION("Bookmarks.EntryPoint", |
| 86 bookmark_utils::ENTRY_POINT_STAR_KEY, |
| 87 bookmark_utils::ENTRY_POINT_LIMIT); |
| 76 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); | 88 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); |
| 77 return true; | 89 return true; |
| 78 } | 90 } |
| 79 return false; | 91 return false; |
| 80 } | 92 } |
| OLD | NEW |