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

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

Issue 1396923003: Autofill: Replace "save credit card" infobar with a bubble (Views only). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: defined(TOOLKIT_VIEWS) -> defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX). Created 5 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/timer/elapsed_timer.h"
11 #include "chrome/browser/ui/autofill/save_card_bubble_controller.h"
12 #include "content/public/browser/web_contents_observer.h"
13 #include "content/public/browser/web_contents_user_data.h"
14
15 namespace autofill {
16
17 // Implementation of per-tab class to control the save credit card bubble and
18 // Omnibox icon.
19 //
20 // TODO(bondd): Add text strings so different dialog contents can be shown
21 // depending upon whether upstreaming is available.
22 class SaveCardBubbleControllerImpl
23 : public SaveCardBubbleController,
24 public content::WebContentsObserver,
25 public content::WebContentsUserData<SaveCardBubbleControllerImpl> {
26 public:
27 // |save_card_callback| will be invoked if/when the Save button is pressed.
28 void SetCallback(const base::Closure& save_card_callback);
29
30 // SetCallback() must be called first.
31 void ShowBubble();
32
33 // Returns true if Omnibox save credit card icon should be visible.
34 bool IsIconVisible() const;
35
36 // Returns true if Omnibox save credit card should be shown in its "toggled
37 // on" state.
38 bool IsIconToggled() const;
39
40 // Returns nullptr if no bubble is currently shown.
41 SaveCardBubbleView* save_card_bubble_view() const;
42
43 // SaveCardBubbleController:
44 void OnSaveButton() override;
45 void OnCancelButton() override;
46 void OnBubbleClosed() override;
47
48 private:
49 friend class content::WebContentsUserData<SaveCardBubbleControllerImpl>;
50
51 explicit SaveCardBubbleControllerImpl(content::WebContents* web_contents);
52 ~SaveCardBubbleControllerImpl() override;
53
54 // Update the visibility and toggled state of the Omnibox save card icon.
55 void UpdateIcon();
56
57 // content::WebContentsObserver:
58 void DidNavigateMainFrame(
59 const content::LoadCommittedDetails& details,
60 const content::FrameNavigateParams& params) override;
61
62 // Weak reference. Will be nullptr if no bubble is currently shown.
63 SaveCardBubbleView* save_card_bubble_view_;
64
65 // Callback to run if user presses Save button in the bubble.
66 // If save_card_callback_.is_null() is true then no bubble is available to
67 // show and the icon is not visible.
68 base::Closure save_card_callback_;
69
70 // Used to measure the amount of time on a page; if it's less than some
71 // reasonable limit, then don't close the bubble upon navigation.
72 scoped_ptr<base::ElapsedTimer> timer_;
73
74 DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImpl);
75 };
76
77 } // namespace autofill
78
79 #endif // CHROME_BROWSER_UI_AUTOFILL_SAVE_CARD_BUBBLE_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698