| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/passwords/signin_promo_view_controller.h" | 5 #import "chrome/browser/ui/cocoa/passwords/signin_promo_view_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "chrome/browser/ui/chrome_style.h" | 8 #include "chrome/browser/ui/chrome_style.h" |
| 9 #import "chrome/browser/ui/cocoa/hover_close_button.h" | 9 #import "chrome/browser/ui/cocoa/hover_close_button.h" |
| 10 #include "chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.h" | 10 #include "chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.h" |
| 11 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 11 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| 12 #include "content/public/browser/user_metrics.h" |
| 12 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 13 #import "ui/base/cocoa/controls/hyperlink_text_view.h" | 14 #import "ui/base/cocoa/controls/hyperlink_text_view.h" |
| 14 #include "ui/base/l10n/l10n_util_mac.h" | 15 #include "ui/base/l10n/l10n_util_mac.h" |
| 15 | 16 |
| 16 @interface SignInPromoViewController () { | 17 @interface SignInPromoViewController () { |
| 17 base::scoped_nsobject<NSButton> _signInButton; | 18 base::scoped_nsobject<NSButton> _signInButton; |
| 18 base::scoped_nsobject<NSButton> _noButton; | 19 base::scoped_nsobject<NSButton> _noButton; |
| 19 base::scoped_nsobject<NSButton> _closeButton; | 20 base::scoped_nsobject<NSButton> _closeButton; |
| 20 } | 21 } |
| 21 | 22 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 [titleView setFrameOrigin:NSMakePoint(kFramePadding, curY)]; | 93 [titleView setFrameOrigin:NSMakePoint(kFramePadding, curY)]; |
| 93 const CGFloat height = NSMaxY([titleView frame]) + kFramePadding; | 94 const CGFloat height = NSMaxY([titleView frame]) + kFramePadding; |
| 94 // The close button is in the corner. | 95 // The close button is in the corner. |
| 95 NSPoint closeButtonOrigin = NSMakePoint( | 96 NSPoint closeButtonOrigin = NSMakePoint( |
| 96 NSMaxX([titleView frame]) + chrome_style::kCloseButtonPadding, | 97 NSMaxX([titleView frame]) + chrome_style::kCloseButtonPadding, |
| 97 height - NSHeight([_closeButton frame]) - | 98 height - NSHeight([_closeButton frame]) - |
| 98 chrome_style::kCloseButtonPadding); | 99 chrome_style::kCloseButtonPadding); |
| 99 [_closeButton setFrameOrigin:closeButtonOrigin]; | 100 [_closeButton setFrameOrigin:closeButtonOrigin]; |
| 100 [view setFrame:NSMakeRect(0, 0, kDesiredBubbleWidth, height)]; | 101 [view setFrame:NSMakeRect(0, 0, kDesiredBubbleWidth, height)]; |
| 101 [self setView:view]; | 102 [self setView:view]; |
| 103 content::RecordAction( |
| 104 base::UserMetricsAction("Signin_Impression_FromPasswordBubble")); |
| 102 } | 105 } |
| 103 | 106 |
| 104 - (void)onSignInClicked:(id)sender { | 107 - (void)onSignInClicked:(id)sender { |
| 105 ManagePasswordsBubbleModel* model = [self.delegate model]; | 108 ManagePasswordsBubbleModel* model = [self.delegate model]; |
| 106 if (model) | 109 if (model) |
| 107 model->OnSignInToChromeClicked(); | 110 model->OnSignInToChromeClicked(); |
| 108 [self.delegate viewShouldDismiss]; | 111 [self.delegate viewShouldDismiss]; |
| 109 } | 112 } |
| 110 | 113 |
| 111 - (void)onNoClicked:(id)sender { | 114 - (void)onNoClicked:(id)sender { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 129 | 132 |
| 130 - (NSButton*)noButton { | 133 - (NSButton*)noButton { |
| 131 return _noButton.get(); | 134 return _noButton.get(); |
| 132 } | 135 } |
| 133 | 136 |
| 134 - (NSButton*)closeButton { | 137 - (NSButton*)closeButton { |
| 135 return _closeButton.get(); | 138 return _closeButton.get(); |
| 136 } | 139 } |
| 137 | 140 |
| 138 @end | 141 @end |
| OLD | NEW |