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

Side by Side Diff: chrome/browser/ui/autofill/save_card_bubble_controller_impl.cc

Issue 2955963002: Update Chrome Upstream flow to reflect new UI mocks (Closed)
Patch Set: Code review changes; change label; fix trybot Created 3 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" 5 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "chrome/browser/ui/autofill/save_card_bubble_view.h" 9 #include "chrome/browser/ui/autofill/save_card_bubble_view.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 card_ = card; 100 card_ = card;
101 save_card_callback_ = save_card_callback; 101 save_card_callback_ = save_card_callback;
102 ShowBubble(); 102 ShowBubble();
103 } 103 }
104 104
105 void SaveCardBubbleControllerImpl::HideBubble() { 105 void SaveCardBubbleControllerImpl::HideBubble() {
106 if (save_card_bubble_view_) { 106 if (save_card_bubble_view_) {
107 save_card_bubble_view_->Hide(); 107 save_card_bubble_view_->Hide();
108 save_card_bubble_view_ = nullptr; 108 save_card_bubble_view_ = nullptr;
109 } 109 }
110 show_upload_confirm_title_ = false;
110 } 111 }
111 112
112 void SaveCardBubbleControllerImpl::ReshowBubble() { 113 void SaveCardBubbleControllerImpl::ReshowBubble() {
113 // Don't show the bubble if it's already visible. 114 // Don't show the bubble if it's already visible.
114 if (save_card_bubble_view_) 115 if (save_card_bubble_view_)
115 return; 116 return;
116 117
117 is_reshow_ = true; 118 is_reshow_ = true;
118 AutofillMetrics::LogSaveCardPromptMetric( 119 AutofillMetrics::LogSaveCardPromptMetric(
119 AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, is_uploading_, 120 AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, is_uploading_,
120 is_reshow_, 121 is_reshow_,
121 pref_service_->GetInteger( 122 pref_service_->GetInteger(
122 prefs::kAutofillAcceptSaveCreditCardPromptState)); 123 prefs::kAutofillAcceptSaveCreditCardPromptState));
123 124
124 ShowBubble(); 125 ShowBubble();
125 } 126 }
126 127
127 bool SaveCardBubbleControllerImpl::IsIconVisible() const { 128 bool SaveCardBubbleControllerImpl::IsIconVisible() const {
128 return !save_card_callback_.is_null(); 129 return !save_card_callback_.is_null();
129 } 130 }
130 131
131 SaveCardBubbleView* SaveCardBubbleControllerImpl::save_card_bubble_view() 132 SaveCardBubbleView* SaveCardBubbleControllerImpl::save_card_bubble_view()
132 const { 133 const {
133 return save_card_bubble_view_; 134 return save_card_bubble_view_;
134 } 135 }
135 136
136 base::string16 SaveCardBubbleControllerImpl::GetWindowTitle() const { 137 base::string16 SaveCardBubbleControllerImpl::GetWindowTitle() const {
137 return l10n_util::GetStringUTF16( 138 if (is_uploading_) {
138 is_uploading_ ? IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD 139 return show_upload_confirm_title_
msw 2017/06/29 20:10:24 Can this instead calls something like save_card_bu
Jared Saul 2017/07/05 19:36:50 The problem with that is that SaveCardBubbleView [
msw 2017/07/05 20:45:30 Setting a |show_upload_confirm_title_| flag is jus
139 : IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_LOCAL); 140 ? l10n_util::GetStringFUTF16(
141 IDS_AUTOFILL_SAVE_CARD_PROMPT_ENTER_CVC_TITLE,
142 card_.NetworkAndLastFourDigits())
143 : l10n_util::GetStringUTF16(
144 IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_TO_CLOUD);
145 }
146 return l10n_util::GetStringUTF16(IDS_AUTOFILL_SAVE_CARD_PROMPT_TITLE_LOCAL);
140 } 147 }
141 148
142 base::string16 SaveCardBubbleControllerImpl::GetExplanatoryMessage() const { 149 base::string16 SaveCardBubbleControllerImpl::GetExplanatoryMessage() const {
143 return is_uploading_ ? l10n_util::GetStringUTF16( 150 return is_uploading_ ? l10n_util::GetStringUTF16(
144 IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION) 151 IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION)
145 : base::string16(); 152 : base::string16();
146 } 153 }
147 154
148 const CreditCard SaveCardBubbleControllerImpl::GetCard() const { 155 const CreditCard SaveCardBubbleControllerImpl::GetCard() const {
149 return card_; 156 return card_;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 AutofillMetrics::LogSaveCardPromptMetric( 214 AutofillMetrics::LogSaveCardPromptMetric(
208 AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEGAL_MESSAGE, 215 AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEGAL_MESSAGE,
209 is_uploading_, is_reshow_, 216 is_uploading_, is_reshow_,
210 pref_service_->GetInteger( 217 pref_service_->GetInteger(
211 prefs::kAutofillAcceptSaveCreditCardPromptState)); 218 prefs::kAutofillAcceptSaveCreditCardPromptState));
212 } 219 }
213 220
214 void SaveCardBubbleControllerImpl::OnBubbleClosed() { 221 void SaveCardBubbleControllerImpl::OnBubbleClosed() {
215 save_card_bubble_view_ = nullptr; 222 save_card_bubble_view_ = nullptr;
216 UpdateIcon(); 223 UpdateIcon();
224 show_upload_confirm_title_ = false;
217 } 225 }
218 226
219 const LegalMessageLines& SaveCardBubbleControllerImpl::GetLegalMessageLines() 227 const LegalMessageLines& SaveCardBubbleControllerImpl::GetLegalMessageLines()
220 const { 228 const {
221 return legal_message_lines_; 229 return legal_message_lines_;
222 } 230 }
223 231
232 void SaveCardBubbleControllerImpl::SetShowUploadConfirmTitle(
233 bool show_upload_confirm_title) {
234 show_upload_confirm_title_ = show_upload_confirm_title;
235 }
236
224 bool SaveCardBubbleControllerImpl::InputCvcIsValid( 237 bool SaveCardBubbleControllerImpl::InputCvcIsValid(
225 const base::string16& input_text) const { 238 const base::string16& input_text) const {
226 base::string16 trimmed_text; 239 base::string16 trimmed_text;
227 base::TrimWhitespace(input_text, base::TRIM_ALL, &trimmed_text); 240 base::TrimWhitespace(input_text, base::TRIM_ALL, &trimmed_text);
228 return IsValidCreditCardSecurityCode(trimmed_text, card_.network()); 241 return IsValidCreditCardSecurityCode(trimmed_text, card_.network());
229 } 242 }
230 243
231 base::TimeDelta SaveCardBubbleControllerImpl::Elapsed() const { 244 base::TimeDelta SaveCardBubbleControllerImpl::Elapsed() const {
232 return timer_->Elapsed(); 245 return timer_->Elapsed();
233 } 246 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 location_bar->UpdateSaveCreditCardIcon(); 318 location_bar->UpdateSaveCreditCardIcon();
306 } 319 }
307 320
308 void SaveCardBubbleControllerImpl::OpenUrl(const GURL& url) { 321 void SaveCardBubbleControllerImpl::OpenUrl(const GURL& url) {
309 web_contents()->OpenURL(content::OpenURLParams( 322 web_contents()->OpenURL(content::OpenURLParams(
310 url, content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, 323 url, content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB,
311 ui::PAGE_TRANSITION_LINK, false)); 324 ui::PAGE_TRANSITION_LINK, false));
312 } 325 }
313 326
314 } // namespace autofill 327 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698