| 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/toolbar/app_menu_button.h" | 5 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 menu_->RunMenu(this); | 102 menu_->RunMenu(this); |
| 103 | 103 |
| 104 if (!for_drop) { | 104 if (!for_drop) { |
| 105 // Record the time-to-action for the menu. We don't record in the case of a | 105 // Record the time-to-action for the menu. We don't record in the case of a |
| 106 // drag-and-drop command because menus opened for drag-and-drop don't block | 106 // drag-and-drop command because menus opened for drag-and-drop don't block |
| 107 // the message loop. | 107 // the message loop. |
| 108 UMA_HISTOGRAM_TIMES("Toolbar.AppMenuTimeToAction", | 108 UMA_HISTOGRAM_TIMES("Toolbar.AppMenuTimeToAction", |
| 109 base::TimeTicks::Now() - menu_open_time); | 109 base::TimeTicks::Now() - menu_open_time); |
| 110 } | 110 } |
| 111 | 111 |
| 112 if (severity_ != AppMenuIconController::Severity::NONE) | 112 if (animation_ && severity_ != AppMenuIconController::Severity::NONE) |
| 113 animation_->StartAnimation(); | 113 animation_->StartAnimation(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void AppMenuButton::CloseMenu() { | 116 void AppMenuButton::CloseMenu() { |
| 117 if (menu_) | 117 if (menu_) |
| 118 menu_->CloseMenu(); | 118 menu_->CloseMenu(); |
| 119 menu_.reset(); | 119 menu_.reset(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool AppMenuButton::IsMenuShowing() const { | 122 bool AppMenuButton::IsMenuShowing() const { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 return ui::DragDropTypes::DRAG_MOVE; | 286 return ui::DragDropTypes::DRAG_MOVE; |
| 287 } | 287 } |
| 288 | 288 |
| 289 void AppMenuButton::OnDragExited() { | 289 void AppMenuButton::OnDragExited() { |
| 290 weak_factory_.InvalidateWeakPtrs(); | 290 weak_factory_.InvalidateWeakPtrs(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 int AppMenuButton::OnPerformDrop(const ui::DropTargetEvent& event) { | 293 int AppMenuButton::OnPerformDrop(const ui::DropTargetEvent& event) { |
| 294 return ui::DragDropTypes::DRAG_MOVE; | 294 return ui::DragDropTypes::DRAG_MOVE; |
| 295 } | 295 } |
| OLD | NEW |