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

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

Issue 1160073004: chrome/browser/ui: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 5 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extension_toolbar_menu_view.h" 5 #include "chrome/browser/ui/views/toolbar/extension_toolbar_menu_view.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
9 #include "base/time/time.h" 11 #include "base/time/time.h"
10 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" 12 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
11 #include "chrome/browser/ui/views/frame/browser_view.h" 13 #include "chrome/browser/ui/views/frame/browser_view.h"
12 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" 14 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
13 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 15 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
14 #include "chrome/browser/ui/views/toolbar/wrench_menu.h" 16 #include "chrome/browser/ui/views/toolbar/wrench_menu.h"
15 #include "ui/views/controls/menu/menu_item_view.h" 17 #include "ui/views/controls/menu/menu_item_view.h"
16 #include "ui/views/controls/menu/submenu_view.h" 18 #include "ui/views/controls/menu/submenu_view.h"
17 19
18 ExtensionToolbarMenuView::ExtensionToolbarMenuView(Browser* browser, 20 ExtensionToolbarMenuView::ExtensionToolbarMenuView(Browser* browser,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 SetBounds(start_padding() + 1, 0, sz.width(), sz.height()); 70 SetBounds(start_padding() + 1, 0, sz.width(), sz.height());
69 container_->SetBounds(0, 0, sz.width(), sz.height()); 71 container_->SetBounds(0, 0, sz.width(), sz.height());
70 } 72 }
71 73
72 void ExtensionToolbarMenuView::OnBrowserActionDragDone() { 74 void ExtensionToolbarMenuView::OnBrowserActionDragDone() {
73 // The delay before we close the wrench menu if this was opened for a drop so 75 // The delay before we close the wrench menu if this was opened for a drop so
74 // that the user can see a browser action if one was moved. 76 // that the user can see a browser action if one was moved.
75 static const int kCloseMenuDelay = 300; 77 static const int kCloseMenuDelay = 300;
76 78
77 DCHECK(wrench_menu_->for_drop()); 79 DCHECK(wrench_menu_->for_drop());
78 base::MessageLoop::current()->PostDelayedTask( 80 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
79 FROM_HERE, 81 FROM_HERE, base::Bind(&ExtensionToolbarMenuView::CloseWrenchMenu,
80 base::Bind(&ExtensionToolbarMenuView::CloseWrenchMenu, 82 weak_factory_.GetWeakPtr()),
81 weak_factory_.GetWeakPtr()),
82 base::TimeDelta::FromMilliseconds(kCloseMenuDelay)); 83 base::TimeDelta::FromMilliseconds(kCloseMenuDelay));
83 } 84 }
84 85
85 void ExtensionToolbarMenuView::CloseWrenchMenu() { 86 void ExtensionToolbarMenuView::CloseWrenchMenu() {
86 wrench_menu_->CloseMenu(); 87 wrench_menu_->CloseMenu();
87 } 88 }
88 89
89 int ExtensionToolbarMenuView::start_padding() const { 90 int ExtensionToolbarMenuView::start_padding() const {
90 // We pad enough on the left so that the first icon starts at the same point 91 // We pad enough on the left so that the first icon starts at the same point
91 // as the labels. We need to subtract 1 because we want the pixel *before* 92 // as the labels. We need to subtract 1 because we want the pixel *before*
92 // the label, and we subtract kItemSpacing because there needs to be padding 93 // the label, and we subtract kItemSpacing because there needs to be padding
93 // so we can see the drop indicator. 94 // so we can see the drop indicator.
94 return views::MenuItemView::label_start() - 1 - 95 return views::MenuItemView::label_start() - 1 -
95 container_->toolbar_actions_bar()->platform_settings().item_spacing; 96 container_->toolbar_actions_bar()->platform_settings().item_spacing;
96 } 97 }
97 98
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/chevron_menu_button.cc ('k') | chrome/browser/ui/views/toolbar/toolbar_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698