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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 bool AppMenuButton::CanDrop(const ui::OSExchangeData& data) { | 268 bool AppMenuButton::CanDrop(const ui::OSExchangeData& data) { |
269 return BrowserActionDragData::CanDrop(data, | 269 return BrowserActionDragData::CanDrop(data, |
270 toolbar_view_->browser()->profile()); | 270 toolbar_view_->browser()->profile()); |
271 } | 271 } |
272 | 272 |
273 void AppMenuButton::OnDragEntered(const ui::DropTargetEvent& event) { | 273 void AppMenuButton::OnDragEntered(const ui::DropTargetEvent& event) { |
274 DCHECK(!weak_factory_.HasWeakPtrs()); | 274 DCHECK(!weak_factory_.HasWeakPtrs()); |
275 if (!g_open_app_immediately_for_testing) { | 275 if (!g_open_app_immediately_for_testing) { |
276 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 276 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
277 FROM_HERE, | 277 FROM_HERE, |
278 base::Bind(&AppMenuButton::ShowMenu, weak_factory_.GetWeakPtr(), true), | 278 base::BindOnce(&AppMenuButton::ShowMenu, weak_factory_.GetWeakPtr(), |
| 279 true), |
279 base::TimeDelta::FromMilliseconds(views::GetMenuShowDelay())); | 280 base::TimeDelta::FromMilliseconds(views::GetMenuShowDelay())); |
280 } else { | 281 } else { |
281 ShowMenu(true); | 282 ShowMenu(true); |
282 } | 283 } |
283 } | 284 } |
284 | 285 |
285 int AppMenuButton::OnDragUpdated(const ui::DropTargetEvent& event) { | 286 int AppMenuButton::OnDragUpdated(const ui::DropTargetEvent& event) { |
286 return ui::DragDropTypes::DRAG_MOVE; | 287 return ui::DragDropTypes::DRAG_MOVE; |
287 } | 288 } |
288 | 289 |
289 void AppMenuButton::OnDragExited() { | 290 void AppMenuButton::OnDragExited() { |
290 weak_factory_.InvalidateWeakPtrs(); | 291 weak_factory_.InvalidateWeakPtrs(); |
291 } | 292 } |
292 | 293 |
293 int AppMenuButton::OnPerformDrop(const ui::DropTargetEvent& event) { | 294 int AppMenuButton::OnPerformDrop(const ui::DropTargetEvent& event) { |
294 return ui::DragDropTypes::DRAG_MOVE; | 295 return ui::DragDropTypes::DRAG_MOVE; |
295 } | 296 } |
OLD | NEW |