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

Side by Side Diff: chrome/browser/ui/cocoa/base_bubble_controller.mm

Issue 49063012: [rAC, OSX] Use bubble windows for error messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 7 years, 1 month 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/base_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/bundle_locations.h" 8 #include "base/mac/bundle_locations.h"
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 NSNotification* note = 203 NSNotification* note =
204 [NSNotification notificationWithName:NSWindowDidResignKeyNotification 204 [NSNotification notificationWithName:NSWindowDidResignKeyNotification
205 object:window]; 205 object:window];
206 206
207 // The eventTap_ catches clicks within the application that are outside the 207 // The eventTap_ catches clicks within the application that are outside the
208 // window. 208 // window.
209 eventTap_ = [NSEvent 209 eventTap_ = [NSEvent
210 addLocalMonitorForEventsMatchingMask:NSLeftMouseDownMask 210 addLocalMonitorForEventsMatchingMask:NSLeftMouseDownMask
211 handler:^NSEvent* (NSEvent* event) { 211 handler:^NSEvent* (NSEvent* event) {
212 if (event.window != window) { 212 if (event.window != window) {
213 // Ignore this event if the window isn't key - in that case, it
214 // can't resign key status in the first place.
215 if (![window isKeyWindow])
216 return event;
217
213 // Call via the runloop because this block is called in the 218 // Call via the runloop because this block is called in the
214 // middle of event dispatch. 219 // middle of event dispatch.
215 [self performSelector:@selector(windowDidResignKey:) 220 [self performSelector:@selector(windowDidResignKey:)
216 withObject:note 221 withObject:note
217 afterDelay:0]; 222 afterDelay:0];
218 } 223 }
219 return event; 224 return event;
220 }]; 225 }];
221 226
222 // The resignationObserver_ watches for when a window resigns key state, 227 // The resignationObserver_ watches for when a window resigns key state,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 289
285 - (void)activateTabWithContents:(content::WebContents*)newContents 290 - (void)activateTabWithContents:(content::WebContents*)newContents
286 previousContents:(content::WebContents*)oldContents 291 previousContents:(content::WebContents*)oldContents
287 atIndex:(NSInteger)index 292 atIndex:(NSInteger)index
288 reason:(int)reason { 293 reason:(int)reason {
289 // The user switched tabs; close. 294 // The user switched tabs; close.
290 [self close]; 295 [self close];
291 } 296 }
292 297
293 @end // BaseBubbleController 298 @end // BaseBubbleController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698