Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: chrome/browser/ui/views/toolbar/app_menu_button.cc

Issue 2424853003: Remove FOR_EACH_OBSERVER macro usage in chrome/browser/ui (Closed)
Patch Set: explicit types Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/location.h" 7 #include "base/location.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); 67 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC);
68 } 68 }
69 #endif 69 #endif
70 70
71 Browser* browser = toolbar_view_->browser(); 71 Browser* browser = toolbar_view_->browser();
72 72
73 menu_.reset(new AppMenu(browser, for_drop ? AppMenu::FOR_DROP : 0)); 73 menu_.reset(new AppMenu(browser, for_drop ? AppMenu::FOR_DROP : 0));
74 menu_model_.reset(new AppMenuModel(toolbar_view_, browser)); 74 menu_model_.reset(new AppMenuModel(toolbar_view_, browser));
75 menu_->Init(menu_model_.get()); 75 menu_->Init(menu_model_.get());
76 76
77 FOR_EACH_OBSERVER(views::MenuListener, menu_listeners_, OnMenuOpened()); 77 for (views::MenuListener& observer : menu_listeners_)
78 observer.OnMenuOpened();
78 79
79 base::TimeTicks menu_open_time = base::TimeTicks::Now(); 80 base::TimeTicks menu_open_time = base::TimeTicks::Now();
80 menu_->RunMenu(this); 81 menu_->RunMenu(this);
81 82
82 if (!for_drop) { 83 if (!for_drop) {
83 // Record the time-to-action for the menu. We don't record in the case of a 84 // Record the time-to-action for the menu. We don't record in the case of a
84 // drag-and-drop command because menus opened for drag-and-drop don't block 85 // drag-and-drop command because menus opened for drag-and-drop don't block
85 // the message loop. 86 // the message loop.
86 UMA_HISTOGRAM_TIMES("Toolbar.AppMenuTimeToAction", 87 UMA_HISTOGRAM_TIMES("Toolbar.AppMenuTimeToAction",
87 base::TimeTicks::Now() - menu_open_time); 88 base::TimeTicks::Now() - menu_open_time);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 226
226 void AppMenuButton::OnDragExited() { 227 void AppMenuButton::OnDragExited() {
227 DCHECK(allow_extension_dragging_); 228 DCHECK(allow_extension_dragging_);
228 weak_factory_.InvalidateWeakPtrs(); 229 weak_factory_.InvalidateWeakPtrs();
229 } 230 }
230 231
231 int AppMenuButton::OnPerformDrop(const ui::DropTargetEvent& event) { 232 int AppMenuButton::OnPerformDrop(const ui::DropTargetEvent& event) {
232 DCHECK(allow_extension_dragging_); 233 DCHECK(allow_extension_dragging_);
233 return ui::DragDropTypes::DRAG_MOVE; 234 return ui::DragDropTypes::DRAG_MOVE;
234 } 235 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu.cc ('k') | chrome/browser/ui/views/website_settings/chosen_object_row.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698