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

Side by Side Diff: chrome/browser/ui/cocoa/app_menu/app_menu_controller.mm

Issue 2132593002: Remove remaining calls to deprecated MessageLoop methods on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: h264_vt_encoder_unittest.cc Created 4 years, 5 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/app_menu/app_menu_controller.h" 5 #import "chrome/browser/ui/cocoa/app_menu/app_menu_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/mac/bundle_locations.h" 10 #include "base/mac/bundle_locations.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/message_loop/message_loop.h"
14 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
15 #include "base/scoped_observer.h" 14 #include "base/scoped_observer.h"
16 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
17 #include "base/strings/sys_string_conversions.h" 16 #include "base/strings/sys_string_conversions.h"
17 #include "base/threading/thread_task_runner_handle.h"
18 #include "chrome/app/chrome_command_ids.h" 18 #include "chrome/app/chrome_command_ids.h"
19 #import "chrome/browser/app_controller_mac.h" 19 #import "chrome/browser/app_controller_mac.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_window.h" 22 #include "chrome/browser/ui/browser_window.h"
23 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h" 23 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h"
24 #import "chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view.h" 24 #import "chrome/browser/ui/cocoa/app_menu/menu_tracked_root_view.h"
25 #import "chrome/browser/ui/cocoa/app_menu/recent_tabs_menu_model_delegate.h" 25 #import "chrome/browser/ui/cocoa/app_menu/recent_tabs_menu_model_delegate.h"
26 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" 26 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
27 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h" 27 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // ToolbarActionsBarObserver: 135 // ToolbarActionsBarObserver:
136 void OnToolbarActionsBarDestroyed() override { 136 void OnToolbarActionsBarDestroyed() override {
137 scoped_observer_.RemoveAll(); 137 scoped_observer_.RemoveAll();
138 } 138 }
139 void OnToolbarActionsBarDidStartResize() override { 139 void OnToolbarActionsBarDidStartResize() override {
140 // No point in having multiple pending update calls. 140 // No point in having multiple pending update calls.
141 weak_ptr_factory_.InvalidateWeakPtrs(); 141 weak_ptr_factory_.InvalidateWeakPtrs();
142 // Edge case: If the resize is caused by an action being added while the 142 // Edge case: If the resize is caused by an action being added while the
143 // menu is open, we need to wait for both toolbars to be updated. This can 143 // menu is open, we need to wait for both toolbars to be updated. This can
144 // happen if a user's data is synced with the menu open. 144 // happen if a user's data is synced with the menu open.
145 base::MessageLoop::current()->PostTask( 145 base::ThreadTaskRunnerHandle::Get()->PostTask(
146 FROM_HERE, 146 FROM_HERE, base::Bind(&ToolbarActionsBarObserverHelper::UpdateSubmenu,
147 base::Bind(&ToolbarActionsBarObserverHelper::UpdateSubmenu, 147 weak_ptr_factory_.GetWeakPtr()));
148 weak_ptr_factory_.GetWeakPtr()));
149 } 148 }
150 149
151 void UpdateSubmenu() { 150 void UpdateSubmenu() {
152 [controller_ updateBrowserActionsSubmenu]; 151 [controller_ updateBrowserActionsSubmenu];
153 } 152 }
154 153
155 AppMenuController* controller_; 154 AppMenuController* controller_;
156 ScopedObserver<ToolbarActionsBar, ToolbarActionsBarObserver> scoped_observer_; 155 ScopedObserver<ToolbarActionsBar, ToolbarActionsBarObserver> scoped_observer_;
157 base::WeakPtrFactory<ToolbarActionsBarObserverHelper> weak_ptr_factory_; 156 base::WeakPtrFactory<ToolbarActionsBarObserverHelper> weak_ptr_factory_;
158 157
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 // (and thus, after all our ability to adjust it normally). Throw in the 630 // (and thus, after all our ability to adjust it normally). Throw in the
632 // towel, and simply don't let the frame move from where it's supposed to be. 631 // towel, and simply don't let the frame move from where it's supposed to be.
633 // TODO(devlin): Yet another Cocoa hack. It'd be good to find a workaround, 632 // TODO(devlin): Yet another Cocoa hack. It'd be good to find a workaround,
634 // but unlikely unless we replace the Cocoa menu implementation. 633 // but unlikely unless we replace the Cocoa menu implementation.
635 NSView* containerSuperview = [overflowActionsContainerView_ superview]; 634 NSView* containerSuperview = [overflowActionsContainerView_ superview];
636 if (NSMinX([containerSuperview frame]) != 0) 635 if (NSMinX([containerSuperview frame]) != 0)
637 [containerSuperview setFrameOrigin:NSZeroPoint]; 636 [containerSuperview setFrameOrigin:NSZeroPoint];
638 } 637 }
639 638
640 @end // @implementation AppMenuButtonViewController 639 @end // @implementation AppMenuButtonViewController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698