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

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

Issue 393763002: MacViews: Refactor ShowConfirmBubble to also take a gfx::NativeWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new approach: extra argument Created 6 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 | 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/confirm_bubble_cocoa.h" 5 #import "chrome/browser/ui/cocoa/confirm_bubble_cocoa.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "chrome/browser/themes/theme_service.h" 8 #include "chrome/browser/themes/theme_service.h"
9 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h" 9 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h"
10 #include "chrome/browser/ui/confirm_bubble.h" 10 #include "chrome/browser/ui/confirm_bubble.h"
(...skipping 26 matching lines...) Expand all
37 // Vertical spacing between the edge of the window and the 37 // Vertical spacing between the edge of the window and the
38 // top or bottom of a button. 38 // top or bottom of a button.
39 const int kButtonVEdgeMargin = 6; 39 const int kButtonVEdgeMargin = 6;
40 40
41 // Horizontal spacing between the edge of the window and the 41 // Horizontal spacing between the edge of the window and the
42 // left or right of a button. 42 // left or right of a button.
43 const int kButtonHEdgeMargin = 7; 43 const int kButtonHEdgeMargin = 7;
44 44
45 namespace chrome { 45 namespace chrome {
46 46
47 void ShowConfirmBubble(gfx::NativeView view, 47 void ShowConfirmBubble(gfx::NativeWindow window,
48 gfx::NativeView anchor_view,
48 const gfx::Point& origin, 49 const gfx::Point& origin,
49 ConfirmBubbleModel* model) { 50 ConfirmBubbleModel* model) {
50 // Create a custom NSViewController that manages a bubble view, and add it to 51 // Create a custom NSViewController that manages a bubble view, and add it to
51 // a child to the specified view. This controller will be automatically 52 // a child to the specified |anchor_view|. This controller will be
52 // deleted when it loses first-responder status. 53 // automatically deleted when it loses first-responder status.
53 ConfirmBubbleController* controller = 54 ConfirmBubbleController* controller =
54 [[ConfirmBubbleController alloc] initWithParent:view 55 [[ConfirmBubbleController alloc] initWithParent:anchor_view
55 origin:origin.ToCGPoint() 56 origin:origin.ToCGPoint()
56 model:model]; 57 model:model];
57 [view addSubview:[controller view] 58 [anchor_view addSubview:[controller view]
58 positioned:NSWindowAbove 59 positioned:NSWindowAbove
59 relativeTo:nil]; 60 relativeTo:nil];
60 [[view window] makeFirstResponder:[controller view]]; 61 [[anchor_view window] makeFirstResponder:[controller view]];
61 } 62 }
62 63
63 } // namespace chrome 64 } // namespace chrome
64 65
65 // An interface that is derived from NSTextView and does not accept 66 // An interface that is derived from NSTextView and does not accept
66 // first-responder status, i.e. a NSTextView-derived class that never becomes 67 // first-responder status, i.e. a NSTextView-derived class that never becomes
67 // the first responder. When we click a NSTextView object, it becomes the first 68 // the first responder. When we click a NSTextView object, it becomes the first
68 // responder. Unfortunately, we delete the ConfirmBubbleCocoa object anytime 69 // responder. Unfortunately, we delete the ConfirmBubbleCocoa object anytime
69 // when it loses first-responder status not to prevent disturbing other 70 // when it loses first-responder status not to prevent disturbing other
70 // responders. 71 // responders.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 288
288 - (void)clickCancel { 289 - (void)clickCancel {
289 [self cancel:self]; 290 [self cancel:self];
290 } 291 }
291 292
292 - (void)clickLink { 293 - (void)clickLink {
293 [self textView:messageLabel_.get() clickedOnLink:nil atIndex:0]; 294 [self textView:messageLabel_.get() clickedOnLink:nil atIndex:0];
294 } 295 }
295 296
296 @end 297 @end
OLDNEW
« no previous file with comments | « chrome/browser/renderer_context_menu/spelling_menu_observer.cc ('k') | chrome/browser/ui/confirm_bubble.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698