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

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: 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // Parent key state sharing is only avaiable on 10.7+. 198 // Parent key state sharing is only avaiable on 10.7+.
199 if (!base::mac::IsOSLionOrLater()) 199 if (!base::mac::IsOSLionOrLater())
200 return; 200 return;
201 201
202 NSWindow* window = self.window; 202 NSWindow* window = self.window;
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. This only matters if the window is key.
Robert Sesek 2013/11/04 23:49:18 I'd put this comment closer to where this is imple
groby-ooo-7-16 2013/11/05 00:51:48 Done.
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 if (![window isKeyWindow])
Robert Sesek 2013/11/04 23:49:18 Comment please.
groby-ooo-7-16 2013/11/05 00:51:48 Done.
214 return event;
Robert Sesek 2013/11/04 23:49:18 nit: blank line after.
groby-ooo-7-16 2013/11/05 00:51:48 Done.
213 // Call via the runloop because this block is called in the 215 // Call via the runloop because this block is called in the
214 // middle of event dispatch. 216 // middle of event dispatch.
215 [self performSelector:@selector(windowDidResignKey:) 217 [self performSelector:@selector(windowDidResignKey:)
216 withObject:note 218 withObject:note
217 afterDelay:0]; 219 afterDelay:0];
218 } 220 }
219 return event; 221 return event;
220 }]; 222 }];
221 223
222 // The resignationObserver_ watches for when a window resigns key state, 224 // The resignationObserver_ watches for when a window resigns key state,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 286
285 - (void)activateTabWithContents:(content::WebContents*)newContents 287 - (void)activateTabWithContents:(content::WebContents*)newContents
286 previousContents:(content::WebContents*)oldContents 288 previousContents:(content::WebContents*)oldContents
287 atIndex:(NSInteger)index 289 atIndex:(NSInteger)index
288 reason:(int)reason { 290 reason:(int)reason {
289 // The user switched tabs; close. 291 // The user switched tabs; close.
290 [self close]; 292 [self close];
291 } 293 }
292 294
293 @end // BaseBubbleController 295 @end // BaseBubbleController
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698