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