| 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 <utility> |
| 8 |
| 7 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 8 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
| 9 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h" | 11 #import "chrome/browser/ui/cocoa/confirm_bubble_controller.h" |
| 10 #include "chrome/browser/ui/confirm_bubble.h" | 12 #include "chrome/browser/ui/confirm_bubble.h" |
| 11 #include "chrome/browser/ui/confirm_bubble_model.h" | 13 #include "chrome/browser/ui/confirm_bubble_model.h" |
| 12 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSBezierPath+RoundRect
.h" | 14 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSBezierPath+RoundRect
.h" |
| 13 #include "ui/gfx/geometry/point.h" | 15 #include "ui/gfx/geometry/point.h" |
| 14 #include "ui/gfx/image/image.h" | 16 #include "ui/gfx/image/image.h" |
| 15 | 17 |
| 16 // The width for the message text. We break lines so the specified message fits | 18 // The width for the message text. We break lines so the specified message fits |
| (...skipping 27 matching lines...) Expand all Loading... |
| 44 void ShowConfirmBubble(gfx::NativeWindow window, | 46 void ShowConfirmBubble(gfx::NativeWindow window, |
| 45 gfx::NativeView anchor_view, | 47 gfx::NativeView anchor_view, |
| 46 const gfx::Point& origin, | 48 const gfx::Point& origin, |
| 47 scoped_ptr<ConfirmBubbleModel> model) { | 49 scoped_ptr<ConfirmBubbleModel> model) { |
| 48 // Create a custom NSViewController that manages a bubble view, and add it to | 50 // Create a custom NSViewController that manages a bubble view, and add it to |
| 49 // a child to the specified |anchor_view|. This controller will be | 51 // a child to the specified |anchor_view|. This controller will be |
| 50 // automatically deleted when it loses first-responder status. | 52 // automatically deleted when it loses first-responder status. |
| 51 ConfirmBubbleController* controller = | 53 ConfirmBubbleController* controller = |
| 52 [[ConfirmBubbleController alloc] initWithParent:anchor_view | 54 [[ConfirmBubbleController alloc] initWithParent:anchor_view |
| 53 origin:origin.ToCGPoint() | 55 origin:origin.ToCGPoint() |
| 54 model:model.Pass()]; | 56 model:std::move(model)]; |
| 55 [anchor_view addSubview:[controller view] | 57 [anchor_view addSubview:[controller view] |
| 56 positioned:NSWindowAbove | 58 positioned:NSWindowAbove |
| 57 relativeTo:nil]; | 59 relativeTo:nil]; |
| 58 [[anchor_view window] makeFirstResponder:[controller view]]; | 60 [[anchor_view window] makeFirstResponder:[controller view]]; |
| 59 } | 61 } |
| 60 | 62 |
| 61 } // namespace chrome | 63 } // namespace chrome |
| 62 | 64 |
| 63 // An interface that is derived from NSTextView and does not accept | 65 // An interface that is derived from NSTextView and does not accept |
| 64 // first-responder status, i.e. a NSTextView-derived class that never becomes | 66 // first-responder status, i.e. a NSTextView-derived class that never becomes |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 277 |
| 276 - (void)clickCancel { | 278 - (void)clickCancel { |
| 277 [self cancel:self]; | 279 [self cancel:self]; |
| 278 } | 280 } |
| 279 | 281 |
| 280 - (void)clickLink { | 282 - (void)clickLink { |
| 281 [self textView:messageLabel_.get() clickedOnLink:nil atIndex:0]; | 283 [self textView:messageLabel_.get() clickedOnLink:nil atIndex:0]; |
| 282 } | 284 } |
| 283 | 285 |
| 284 @end | 286 @end |
| OLD | NEW |