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

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: remove ios call sites 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // ToolbarActionsBarObserver: 134 // ToolbarActionsBarObserver:
135 void OnToolbarActionsBarDestroyed() override { 135 void OnToolbarActionsBarDestroyed() override {
136 scoped_observer_.RemoveAll(); 136 scoped_observer_.RemoveAll();
137 } 137 }
138 void OnToolbarActionsBarDidStartResize() override { 138 void OnToolbarActionsBarDidStartResize() override {
139 // No point in having multiple pending update calls. 139 // No point in having multiple pending update calls.
140 weak_ptr_factory_.InvalidateWeakPtrs(); 140 weak_ptr_factory_.InvalidateWeakPtrs();
141 // Edge case: If the resize is caused by an action being added while the 141 // Edge case: If the resize is caused by an action being added while the
142 // menu is open, we need to wait for both toolbars to be updated. This can 142 // menu is open, we need to wait for both toolbars to be updated. This can
143 // happen if a user's data is synced with the menu open. 143 // happen if a user's data is synced with the menu open.
144 base::MessageLoop::current()->PostTask( 144 base::ThreadTaskRunnerHandle::Get()->PostTask(
145 FROM_HERE, 145 FROM_HERE, base::Bind(&ToolbarActionsBarObserverHelper::UpdateSubmenu,
146 base::Bind(&ToolbarActionsBarObserverHelper::UpdateSubmenu, 146 weak_ptr_factory_.GetWeakPtr()));
147 weak_ptr_factory_.GetWeakPtr()));
148 } 147 }
149 148
150 void UpdateSubmenu() { 149 void UpdateSubmenu() {
151 [controller_ updateBrowserActionsSubmenu]; 150 [controller_ updateBrowserActionsSubmenu];
152 } 151 }
153 152
154 AppMenuController* controller_; 153 AppMenuController* controller_;
155 ScopedObserver<ToolbarActionsBar, ToolbarActionsBarObserver> scoped_observer_; 154 ScopedObserver<ToolbarActionsBar, ToolbarActionsBarObserver> scoped_observer_;
156 base::WeakPtrFactory<ToolbarActionsBarObserverHelper> weak_ptr_factory_; 155 base::WeakPtrFactory<ToolbarActionsBarObserverHelper> weak_ptr_factory_;
157 156
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 // (and thus, after all our ability to adjust it normally). Throw in the 629 // (and thus, after all our ability to adjust it normally). Throw in the
631 // towel, and simply don't let the frame move from where it's supposed to be. 630 // towel, and simply don't let the frame move from where it's supposed to be.
632 // TODO(devlin): Yet another Cocoa hack. It'd be good to find a workaround, 631 // TODO(devlin): Yet another Cocoa hack. It'd be good to find a workaround,
633 // but unlikely unless we replace the Cocoa menu implementation. 632 // but unlikely unless we replace the Cocoa menu implementation.
634 NSView* containerSuperview = [overflowActionsContainerView_ superview]; 633 NSView* containerSuperview = [overflowActionsContainerView_ superview];
635 if (NSMinX([containerSuperview frame]) != 0) 634 if (NSMinX([containerSuperview frame]) != 0)
636 [containerSuperview setFrameOrigin:NSZeroPoint]; 635 [containerSuperview setFrameOrigin:NSZeroPoint];
637 } 636 }
638 637
639 @end // @implementation AppMenuButtonViewController 638 @end // @implementation AppMenuButtonViewController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698