OLD | NEW |
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 29 matching lines...) Expand all Loading... |
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::NativeWindow window, | 47 void ShowConfirmBubble(gfx::NativeWindow window, |
48 gfx::NativeView anchor_view, | 48 gfx::NativeView anchor_view, |
49 const gfx::Point& origin, | 49 const gfx::Point& origin, |
50 ConfirmBubbleModel* model) { | 50 scoped_ptr<ConfirmBubbleModel> model) { |
51 // 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 |
52 // a child to the specified |anchor_view|. This controller will be | 52 // a child to the specified |anchor_view|. This controller will be |
53 // automatically deleted when it loses first-responder status. | 53 // automatically deleted when it loses first-responder status. |
54 ConfirmBubbleController* controller = | 54 ConfirmBubbleController* controller = |
55 [[ConfirmBubbleController alloc] initWithParent:anchor_view | 55 [[ConfirmBubbleController alloc] initWithParent:anchor_view |
56 origin:origin.ToCGPoint() | 56 origin:origin.ToCGPoint() |
57 model:model]; | 57 model:model.Pass()]; |
58 [anchor_view addSubview:[controller view] | 58 [anchor_view addSubview:[controller view] |
59 positioned:NSWindowAbove | 59 positioned:NSWindowAbove |
60 relativeTo:nil]; | 60 relativeTo:nil]; |
61 [[anchor_view window] makeFirstResponder:[controller view]]; | 61 [[anchor_view window] makeFirstResponder:[controller view]]; |
62 } | 62 } |
63 | 63 |
64 } // namespace chrome | 64 } // namespace chrome |
65 | 65 |
66 // An interface that is derived from NSTextView and does not accept | 66 // An interface that is derived from NSTextView and does not accept |
67 // 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 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 - (void)clickCancel { | 289 - (void)clickCancel { |
290 [self cancel:self]; | 290 [self cancel:self]; |
291 } | 291 } |
292 | 292 |
293 - (void)clickLink { | 293 - (void)clickLink { |
294 [self textView:messageLabel_.get() clickedOnLink:nil atIndex:0]; | 294 [self textView:messageLabel_.get() clickedOnLink:nil atIndex:0]; |
295 } | 295 } |
296 | 296 |
297 @end | 297 @end |
OLD | NEW |