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

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

Issue 2847173004: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: Created 3 years, 7 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 | chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_ 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/timer/elapsed_timer.h" 11 #include "base/timer/elapsed_timer.h"
12 #include "components/autofill/core/browser/credit_card.h" 12 #include "components/autofill/core/browser/credit_card.h"
13 #include "components/autofill/core/browser/ui/save_card_bubble_controller.h" 13 #include "components/autofill/core/browser/ui/save_card_bubble_controller.h"
14 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
15 #include "content/public/browser/web_contents_user_data.h" 15 #include "content/public/browser/web_contents_user_data.h"
16 16
17 class PrefService; 17 class PrefService;
18 18
19 namespace autofill { 19 namespace autofill {
20 20
21 // Implementation of per-tab class to control the save credit card bubble and 21 // Implementation of per-tab class to control the save credit card bubble and
22 // Omnibox icon. 22 // Omnibox icon.
23 class SaveCardBubbleControllerImpl 23 class SaveCardBubbleControllerImpl
24 : public SaveCardBubbleController, 24 : public SaveCardBubbleController,
25 public content::WebContentsObserver, 25 public content::WebContentsObserver,
26 public content::WebContentsUserData<SaveCardBubbleControllerImpl> { 26 public content::WebContentsUserData<SaveCardBubbleControllerImpl> {
27 public: 27 public:
28 ~SaveCardBubbleControllerImpl() override;
sky 2017/05/01 17:34:27 Move definition to match new position? (same comme
Avi (use Gerrit) 2017/05/02 01:31:35 Was aiming to avoid churn. Also, the order in the
29
28 // Sets up the controller for local save and shows the bubble. 30 // Sets up the controller for local save and shows the bubble.
29 // |save_card_callback| will be invoked if and when the Save button is 31 // |save_card_callback| will be invoked if and when the Save button is
30 // pressed. 32 // pressed.
31 void ShowBubbleForLocalSave(const CreditCard& card, 33 void ShowBubbleForLocalSave(const CreditCard& card,
32 const base::Closure& save_card_callback); 34 const base::Closure& save_card_callback);
33 35
34 // Sets up the controller for upload and shows the bubble. 36 // Sets up the controller for upload and shows the bubble.
35 // |save_card_callback| will be invoked if and when the Save button is 37 // |save_card_callback| will be invoked if and when the Save button is
36 // pressed. The contents of |legal_message| will be displayed in the bubble. 38 // pressed. The contents of |legal_message| will be displayed in the bubble.
37 // A field requesting CVC will appear in the bubble if 39 // A field requesting CVC will appear in the bubble if
(...skipping 27 matching lines...) Expand all
65 67
66 const LegalMessageLines& GetLegalMessageLines() const override; 68 const LegalMessageLines& GetLegalMessageLines() const override;
67 69
68 // Used to check if an entered CVC value is a valid CVC for the current card. 70 // Used to check if an entered CVC value is a valid CVC for the current card.
69 // Valid CVCs are a certain length for their card type (4 for AMEX, 3 71 // Valid CVCs are a certain length for their card type (4 for AMEX, 3
70 // otherwise) and are comprised only of numbers. 72 // otherwise) and are comprised only of numbers.
71 bool InputCvcIsValid(const base::string16& input_text) const override; 73 bool InputCvcIsValid(const base::string16& input_text) const override;
72 74
73 protected: 75 protected:
74 explicit SaveCardBubbleControllerImpl(content::WebContents* web_contents); 76 explicit SaveCardBubbleControllerImpl(content::WebContents* web_contents);
75 ~SaveCardBubbleControllerImpl() override;
76 77
77 // Returns the time elapsed since |timer_| was initialized. 78 // Returns the time elapsed since |timer_| was initialized.
78 // Exists for testing. 79 // Exists for testing.
79 virtual base::TimeDelta Elapsed() const; 80 virtual base::TimeDelta Elapsed() const;
80 81
81 // content::WebContentsObserver: 82 // content::WebContentsObserver:
82 void DidFinishNavigation( 83 void DidFinishNavigation(
83 content::NavigationHandle* navigation_handle) override; 84 content::NavigationHandle* navigation_handle) override;
84 85
85 private: 86 private:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // Used to measure the amount of time on a page; if it's less than some 125 // Used to measure the amount of time on a page; if it's less than some
125 // reasonable limit, then don't close the bubble upon navigation. 126 // reasonable limit, then don't close the bubble upon navigation.
126 std::unique_ptr<base::ElapsedTimer> timer_; 127 std::unique_ptr<base::ElapsedTimer> timer_;
127 128
128 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImpl); 129 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImpl);
129 }; 130 };
130 131
131 } // namespace autofill 132 } // namespace autofill
132 133
133 #endif // CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_ 134 #endif // CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/save_card_bubble_controller_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698