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

Side by Side Diff: chrome/browser/ui/views/payments/payment_sheet_view_controller.cc

Issue 2921223003: [Merge M60][Payments] Link to Autofill settings from Payment Request UI (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" 5 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/i18n/message_formatter.h" 13 #include "base/i18n/message_formatter.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/ui/chrome_pages.h" 22 #include "chrome/browser/ui/chrome_pages.h"
23 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" 23 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
24 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" 24 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
25 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" 25 #include "chrome/browser/ui/views/payments/payment_request_row_view.h"
26 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" 26 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
27 #include "chrome/common/url_constants.h"
27 #include "chrome/grit/generated_resources.h" 28 #include "chrome/grit/generated_resources.h"
28 #include "components/autofill/core/browser/field_types.h" 29 #include "components/autofill/core/browser/field_types.h"
29 #include "components/autofill/core/browser/personal_data_manager.h" 30 #include "components/autofill/core/browser/personal_data_manager.h"
30 #include "components/payments/content/payment_request_spec.h" 31 #include "components/payments/content/payment_request_spec.h"
31 #include "components/payments/content/payment_request_state.h" 32 #include "components/payments/content/payment_request_state.h"
32 #include "components/payments/core/currency_formatter.h" 33 #include "components/payments/core/currency_formatter.h"
33 #include "components/payments/core/payment_instrument.h" 34 #include "components/payments/core/payment_instrument.h"
34 #include "components/payments/core/payment_prefs.h" 35 #include "components/payments/core/payment_prefs.h"
35 #include "components/payments/core/strings_util.h" 36 #include "components/payments/core/strings_util.h"
36 #include "components/prefs/pref_service.h" 37 #include "components/prefs/pref_service.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 break; 508 break;
508 } 509 }
509 } 510 }
510 511
511 void PaymentSheetViewController::StyledLabelLinkClicked( 512 void PaymentSheetViewController::StyledLabelLinkClicked(
512 views::StyledLabel* label, 513 views::StyledLabel* label,
513 const gfx::Range& range, 514 const gfx::Range& range,
514 int event_flags) { 515 int event_flags) {
515 // The only thing that can trigger this is the user clicking on the "settings" 516 // The only thing that can trigger this is the user clicking on the "settings"
516 // link in the data attribution text. 517 // link in the data attribution text.
517 chrome::ShowSettingsSubPageForProfile(dialog()->GetProfile(), ""); 518 chrome::ShowSettingsSubPageForProfile(dialog()->GetProfile(),
519 chrome::kAutofillSubPage);
518 } 520 }
519 521
520 void PaymentSheetViewController::UpdatePayButtonState(bool enabled) { 522 void PaymentSheetViewController::UpdatePayButtonState(bool enabled) {
521 primary_button()->SetEnabled(enabled); 523 primary_button()->SetEnabled(enabled);
522 } 524 }
523 525
524 // Creates the Order Summary row, which contains an "Order Summary" label, 526 // Creates the Order Summary row, which contains an "Order Summary" label,
525 // an inline list of display items, a Total Amount label, and a Chevron. 527 // an inline list of display items, a Total Amount label, and a Chevron.
526 // +----------------------------------------------+ 528 // +----------------------------------------------+
527 // | Order Summary Item 1 $ 1.34 | 529 // | Order Summary Item 1 $ 1.34 |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 data_source_label->SetDefaultStyle(default_style); 929 data_source_label->SetDefaultStyle(default_style);
928 data_source_label->AddStyleRange( 930 data_source_label->AddStyleRange(
929 gfx::Range(link_begin, link_begin + link_length), 931 gfx::Range(link_begin, link_begin + link_length),
930 views::StyledLabel::RangeStyleInfo::CreateForLink()); 932 views::StyledLabel::RangeStyleInfo::CreateForLink());
931 data_source_label->SizeToFit(0); 933 data_source_label->SizeToFit(0);
932 content_view->AddChildView(data_source_label.release()); 934 content_view->AddChildView(data_source_label.release());
933 return content_view; 935 return content_view;
934 } 936 }
935 937
936 } // namespace payments 938 } // namespace payments
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698