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

Side by Side Diff: chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm

Issue 7712008: Refactor and clean up code now that chrome::testing::NSRunLoopRunAllPending() exists. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update gtest_exclude Created 9 years, 4 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 | Annotate | Revision Log
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/wrench_menu/wrench_menu_controller.h" 5 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h"
6 6
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #import "chrome/browser/app_controller_mac.h" 9 #import "chrome/browser/app_controller_mac.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 // The zoom buttons should not close the menu if opened sticky. 161 // The zoom buttons should not close the menu if opened sticky.
162 if ([sender respondsToSelector:@selector(isTracking)] && 162 if ([sender respondsToSelector:@selector(isTracking)] &&
163 [sender performSelector:@selector(isTracking)]) { 163 [sender performSelector:@selector(isTracking)]) {
164 [menu_ cancelTracking]; 164 [menu_ cancelTracking];
165 } 165 }
166 } else { 166 } else {
167 // The custom views within the Wrench menu are abnormal and keep the menu 167 // The custom views within the Wrench menu are abnormal and keep the menu
168 // open after a target-action. Close the menu manually. 168 // open after a target-action. Close the menu manually.
169 [menu_ cancelTracking]; 169 [menu_ cancelTracking];
170 [self dispatchCommandInternal:tag]; 170
171 // Executing certain commands from the nested run loop of the menu can lead
172 // to wonky behavior (e.g. http://crbug.com/49716). To avoid this, schedule
173 // the dispatch on the outermost run loop.
174 [self performSelector:@selector(performCommandDispatch:)
175 withObject:[NSNumber numberWithInt:tag]
176 afterDelay:0.0];
171 } 177 }
172 } 178 }
173 179
174 - (void)dispatchCommandInternal:(NSInteger)tag {
175 // Executing certain commands from the nested run loop of the menu can lead
176 // to wonky behavior (e.g. http://crbug.com/49716). To avoid this, schedule
177 // the dispatch on the outermost run loop.
178 [self performSelector:@selector(performCommandDispatch:)
179 withObject:[NSNumber numberWithInt:tag]
180 afterDelay:0.0];
181 }
182
183 // Used to perform the actual dispatch on the outermost runloop. 180 // Used to perform the actual dispatch on the outermost runloop.
184 - (void)performCommandDispatch:(NSNumber*)tag { 181 - (void)performCommandDispatch:(NSNumber*)tag {
185 [self wrenchMenuModel]->ExecuteCommand([tag intValue]); 182 [self wrenchMenuModel]->ExecuteCommand([tag intValue]);
186 } 183 }
187 184
188 - (WrenchMenuModel*)wrenchMenuModel { 185 - (WrenchMenuModel*)wrenchMenuModel {
189 return static_cast<WrenchMenuModel*>(model_); 186 return static_cast<WrenchMenuModel*>(model_);
190 } 187 }
191 188
192 // Fit the localized strings into the Cut/Copy/Paste control, then resize the 189 // Fit the localized strings into the Cut/Copy/Paste control, then resize the
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 parentFrame.size.width += delta; 227 parentFrame.size.width += delta;
231 parentFrame.origin.x -= delta; 228 parentFrame.origin.x -= delta;
232 [[editCut_ superview] setFrame:parentFrame]; 229 [[editCut_ superview] setFrame:parentFrame];
233 } 230 }
234 231
235 - (NSButton*)zoomDisplay { 232 - (NSButton*)zoomDisplay {
236 return zoomDisplay_; 233 return zoomDisplay_;
237 } 234 }
238 235
239 @end // @implementation WrenchMenuController 236 @end // @implementation WrenchMenuController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698