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

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

Issue 914363003: Remove OneClickSigninHelper since it is no longer used. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ocl
Patch Set: rebased Created 5 years, 9 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
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/one_click_signin_view_controller.h" 5 #import "chrome/browser/ui/cocoa/one_click_signin_view_controller.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #import "chrome/browser/ui/chrome_style.h" 10 #import "chrome/browser/ui/chrome_style.h"
11 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
12 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
13 #include "chrome/grit/chromium_strings.h" 12 #include "chrome/grit/chromium_strings.h"
14 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
15 #include "components/signin/core/browser/signin_metrics.h" 14 #include "components/signin/core/browser/signin_metrics.h"
16 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
17 #include "grit/components_strings.h" 16 #include "grit/components_strings.h"
18 #include "skia/ext/skia_utils_mac.h" 17 #include "skia/ext/skia_utils_mac.h"
19 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h" 18 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h"
20 #import "ui/base/cocoa/controls/hyperlink_text_view.h" 19 #import "ui/base/cocoa/controls/hyperlink_text_view.h"
21 #include "ui/base/l10n/l10n_util_mac.h" 20 #include "ui/base/l10n/l10n_util_mac.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // and has reset the callback. However, in the case that we are closing 70 // and has reset the callback. However, in the case that we are closing
72 // the window and nothing else has initiated the sync, we must do so here 71 // the window and nothing else has initiated the sync, we must do so here
73 if (isSyncDialog_ && !startSyncCallback_.is_null()) { 72 if (isSyncDialog_ && !startSyncCallback_.is_null()) {
74 base::ResetAndReturn(&startSyncCallback_).Run( 73 base::ResetAndReturn(&startSyncCallback_).Run(
75 OneClickSigninSyncStarter::UNDO_SYNC); 74 OneClickSigninSyncStarter::UNDO_SYNC);
76 } 75 }
77 } 76 }
78 77
79 - (IBAction)ok:(id)sender { 78 - (IBAction)ok:(id)sender {
80 if (isSyncDialog_) { 79 if (isSyncDialog_) {
81 OneClickSigninHelper::LogConfirmHistogramValue( 80 signin_metrics::LogSigninConfirmHistogramValue(
82 clickedLearnMore_ ? 81 clickedLearnMore_ ?
83 signin_metrics::HISTOGRAM_CONFIRM_LEARN_MORE_OK : 82 signin_metrics::HISTOGRAM_CONFIRM_LEARN_MORE_OK :
84 signin_metrics::HISTOGRAM_CONFIRM_OK); 83 signin_metrics::HISTOGRAM_CONFIRM_OK);
85 84
86 base::ResetAndReturn(&startSyncCallback_).Run( 85 base::ResetAndReturn(&startSyncCallback_).Run(
87 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); 86 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS);
88 } 87 }
89 [self close]; 88 [self close];
90 } 89 }
91 90
92 - (IBAction)onClickUndo:(id)sender { 91 - (IBAction)onClickUndo:(id)sender {
93 if (isSyncDialog_) { 92 if (isSyncDialog_) {
94 OneClickSigninHelper::LogConfirmHistogramValue( 93 signin_metrics::LogSigninConfirmHistogramValue(
95 clickedLearnMore_ ? 94 clickedLearnMore_ ?
96 signin_metrics::HISTOGRAM_CONFIRM_LEARN_MORE_UNDO : 95 signin_metrics::HISTOGRAM_CONFIRM_LEARN_MORE_UNDO :
97 signin_metrics::HISTOGRAM_CONFIRM_UNDO); 96 signin_metrics::HISTOGRAM_CONFIRM_UNDO);
98 97
99 base::ResetAndReturn(&startSyncCallback_).Run( 98 base::ResetAndReturn(&startSyncCallback_).Run(
100 OneClickSigninSyncStarter::UNDO_SYNC); 99 OneClickSigninSyncStarter::UNDO_SYNC);
101 } 100 }
102 [self close]; 101 [self close];
103 } 102 }
104 103
105 - (IBAction)onClickAdvancedLink:(id)sender { 104 - (IBAction)onClickAdvancedLink:(id)sender {
106 if (isSyncDialog_) { 105 if (isSyncDialog_) {
107 OneClickSigninHelper::LogConfirmHistogramValue( 106 signin_metrics::LogSigninConfirmHistogramValue(
108 clickedLearnMore_ ? 107 clickedLearnMore_ ?
109 signin_metrics::HISTOGRAM_CONFIRM_LEARN_MORE_ADVANCED : 108 signin_metrics::HISTOGRAM_CONFIRM_LEARN_MORE_ADVANCED :
110 signin_metrics::HISTOGRAM_CONFIRM_ADVANCED); 109 signin_metrics::HISTOGRAM_CONFIRM_ADVANCED);
111 110
112 base::ResetAndReturn(&startSyncCallback_).Run( 111 base::ResetAndReturn(&startSyncCallback_).Run(
113 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); 112 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST);
114 } 113 }
115 else { 114 else {
116 content::OpenURLParams params(GURL(chrome::kChromeUISettingsURL), 115 content::OpenURLParams params(GURL(chrome::kChromeUISettingsURL),
117 content::Referrer(), CURRENT_TAB, 116 content::Referrer(), CURRENT_TAB,
118 ui::PAGE_TRANSITION_LINK, false); 117 ui::PAGE_TRANSITION_LINK, false);
119 webContents_->OpenURL(params); 118 webContents_->OpenURL(params);
120 } 119 }
121 [self close]; 120 [self close];
122 } 121 }
123 122
124 - (IBAction)onClickClose:(id)sender { 123 - (IBAction)onClickClose:(id)sender {
125 if (isSyncDialog_) { 124 if (isSyncDialog_) {
126 OneClickSigninHelper::LogConfirmHistogramValue( 125 signin_metrics::LogSigninConfirmHistogramValue(
127 clickedLearnMore_ ? 126 clickedLearnMore_ ?
128 signin_metrics::HISTOGRAM_CONFIRM_LEARN_MORE_CLOSE : 127 signin_metrics::HISTOGRAM_CONFIRM_LEARN_MORE_CLOSE :
129 signin_metrics::HISTOGRAM_CONFIRM_CLOSE); 128 signin_metrics::HISTOGRAM_CONFIRM_CLOSE);
130 129
131 base::ResetAndReturn(&startSyncCallback_).Run( 130 base::ResetAndReturn(&startSyncCallback_).Run(
132 OneClickSigninSyncStarter::UNDO_SYNC); 131 OneClickSigninSyncStarter::UNDO_SYNC);
133 } 132 }
134 [self close]; 133 [self close];
135 } 134 }
136 135
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 IDS_OK)]; 203 IDS_OK)];
205 [GTMUILocalizerAndLayoutTweaker sizeToFitView:[closeButton_ superview]]; 204 [GTMUILocalizerAndLayoutTweaker sizeToFitView:[closeButton_ superview]];
206 } 205 }
207 206
208 // Resize bubble and window to hold the controls. 207 // Resize bubble and window to hold the controls.
209 [GTMUILocalizerAndLayoutTweaker 208 [GTMUILocalizerAndLayoutTweaker
210 resizeViewWithoutAutoResizingSubViews:[self view] 209 resizeViewWithoutAutoResizingSubViews:[self view]
211 delta:delta]; 210 delta:delta];
212 211
213 if (isSyncDialog_) { 212 if (isSyncDialog_) {
214 OneClickSigninHelper::LogConfirmHistogramValue( 213 signin_metrics::LogSigninConfirmHistogramValue(
215 signin_metrics::HISTOGRAM_CONFIRM_SHOWN); 214 signin_metrics::HISTOGRAM_CONFIRM_SHOWN);
216 } 215 }
217 } 216 }
218 217
219 - (CGFloat)initializeInformativeTextView { 218 - (CGFloat)initializeInformativeTextView {
220 NSRect oldFrame = [informativePlaceholderTextField_ frame]; 219 NSRect oldFrame = [informativePlaceholderTextField_ frame];
221 220
222 // Replace the placeholder NSTextField with the real label NSTextView. The 221 // Replace the placeholder NSTextField with the real label NSTextView. The
223 // former doesn't show links in a nice way, but the latter can't be added in 222 // former doesn't show links in a nice way, but the latter can't be added in
224 // a xib without a containing scroll view, so create the NSTextView 223 // a xib without a containing scroll view, so create the NSTextView
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 279
281 return NSHeight(newFrame) - NSHeight(oldFrame); 280 return NSHeight(newFrame) - NSHeight(oldFrame);
282 } 281 }
283 282
284 - (BOOL)textView:(NSTextView*)textView 283 - (BOOL)textView:(NSTextView*)textView
285 clickedOnLink:(id)link 284 clickedOnLink:(id)link
286 atIndex:(NSUInteger)charIndex { 285 atIndex:(NSUInteger)charIndex {
287 if (isSyncDialog_ && !clickedLearnMore_) { 286 if (isSyncDialog_ && !clickedLearnMore_) {
288 clickedLearnMore_ = YES; 287 clickedLearnMore_ = YES;
289 288
290 OneClickSigninHelper::LogConfirmHistogramValue( 289 signin_metrics::LogSigninConfirmHistogramValue(
291 signin_metrics::HISTOGRAM_CONFIRM_LEARN_MORE); 290 signin_metrics::HISTOGRAM_CONFIRM_LEARN_MORE);
292 } 291 }
293 WindowOpenDisposition location = isSyncDialog_ ? 292 WindowOpenDisposition location = isSyncDialog_ ?
294 NEW_WINDOW : NEW_FOREGROUND_TAB; 293 NEW_WINDOW : NEW_FOREGROUND_TAB;
295 content::OpenURLParams params(GURL(chrome::kChromeSyncLearnMoreURL), 294 content::OpenURLParams params(GURL(chrome::kChromeSyncLearnMoreURL),
296 content::Referrer(), location, 295 content::Referrer(), location,
297 ui::PAGE_TRANSITION_LINK, false); 296 ui::PAGE_TRANSITION_LINK, false);
298 webContents_->OpenURL(params); 297 webContents_->OpenURL(params);
299 return YES; 298 return YES;
300 } 299 }
301 300
302 - (void)close { 301 - (void)close {
303 base::ResetAndReturn(&closeCallback_).Run(); 302 base::ResetAndReturn(&closeCallback_).Run();
304 } 303 }
305 304
306 @end 305 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698