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

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model.h

Issue 2202373002: Ignore OnBubbleHidden() event when the password bubble is reopened. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete proxy Created 4 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_
6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "base/memory/weak_ptr.h"
12 #include "base/time/clock.h" 13 #include "base/time/clock.h"
13 #include "components/autofill/core/common/password_form.h" 14 #include "components/autofill/core/common/password_form.h"
14 #include "components/password_manager/core/browser/password_manager_metrics_util .h" 15 #include "components/password_manager/core/browser/password_manager_metrics_util .h"
15 #include "components/password_manager/core/browser/statistics_table.h" 16 #include "components/password_manager/core/browser/statistics_table.h"
16 #include "components/password_manager/core/common/password_manager_ui.h" 17 #include "components/password_manager/core/common/password_manager_ui.h"
17 #include "content/public/browser/web_contents_observer.h"
18 #include "ui/gfx/range/range.h" 18 #include "ui/gfx/range/range.h"
19 19
20 class Profile;
21
22 namespace content { 20 namespace content {
23 class WebContents; 21 class WebContents;
24 } 22 }
25 23
24 class PasswordsModelDelegate;
25 class Profile;
26
26 // This model provides data for the ManagePasswordsBubble and controls the 27 // This model provides data for the ManagePasswordsBubble and controls the
27 // password management actions. 28 // password management actions.
28 class ManagePasswordsBubbleModel : public content::WebContentsObserver { 29 class ManagePasswordsBubbleModel {
29 public: 30 public:
30 enum PasswordAction { REMOVE_PASSWORD, ADD_PASSWORD }; 31 enum PasswordAction { REMOVE_PASSWORD, ADD_PASSWORD };
31 enum DisplayReason { AUTOMATIC, USER_ACTION }; 32 enum DisplayReason { AUTOMATIC, USER_ACTION };
32 33
33 // Creates a ManagePasswordsBubbleModel, which holds a raw pointer to the 34 // Creates a ManagePasswordsBubbleModel, which holds a weak pointer to the
34 // WebContents in which it lives. Construction implies that the bubble 35 // delegate. Construction implies that the bubble is shown. The bubble's state
35 // is shown. The bubble's state is updated from the 36 // is updated from the ManagePasswordsUIController associated with |delegate|.
36 // ManagePasswordsUIController associated with |web_contents|. 37 ManagePasswordsBubbleModel(base::WeakPtr<PasswordsModelDelegate> delegate,
37 ManagePasswordsBubbleModel(content::WebContents* web_contents,
38 DisplayReason reason); 38 DisplayReason reason);
39 ~ManagePasswordsBubbleModel() override; 39 ~ManagePasswordsBubbleModel();
40 40
41 // Called by the view code when the "Nope" button in clicked by the user in 41 // Called by the view code when the "Nope" button in clicked by the user in
42 // update bubble. 42 // update bubble.
43 void OnNopeUpdateClicked(); 43 void OnNopeUpdateClicked();
44 44
45 // Called by the view code when the "Never for this site." button in clicked 45 // Called by the view code when the "Never for this site." button in clicked
46 // by the user. 46 // by the user.
47 void OnNeverForThisSiteClicked(); 47 void OnNeverForThisSiteClicked();
48 48
49 // Called by the view code when the save button is clicked by the user. 49 // Called by the view code when the save button is clicked by the user.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 const gfx::Range& save_confirmation_link_range() const { 98 const gfx::Range& save_confirmation_link_range() const {
99 return save_confirmation_link_range_; 99 return save_confirmation_link_range_;
100 } 100 }
101 101
102 const gfx::Range& title_brand_link_range() const { 102 const gfx::Range& title_brand_link_range() const {
103 return title_brand_link_range_; 103 return title_brand_link_range_;
104 } 104 }
105 105
106 Profile* GetProfile() const; 106 Profile* GetProfile() const;
107 content::WebContents* GetWebContents() const;
107 108
108 // Returns true iff the multiple account selection prompt for account update 109 // Returns true iff the multiple account selection prompt for account update
109 // should be presented. 110 // should be presented.
110 bool ShouldShowMultipleAccountUpdateUI() const; 111 bool ShouldShowMultipleAccountUpdateUI() const;
111 112
112 // True if the save bubble should display the warm welcome for Google Smart 113 // True if the save bubble should display the warm welcome for Google Smart
113 // Lock. 114 // Lock.
114 bool ShouldShowGoogleSmartLockWelcome() const; 115 bool ShouldShowGoogleSmartLockWelcome() const;
115 116
116 // Returns true and updates the internal state iff the Save bubble should 117 // Returns true and updates the internal state iff the Save bubble should
(...skipping 27 matching lines...) Expand all
144 autofill::PasswordForm pending_password_; 145 autofill::PasswordForm pending_password_;
145 bool password_overridden_; 146 bool password_overridden_;
146 ScopedVector<const autofill::PasswordForm> local_credentials_; 147 ScopedVector<const autofill::PasswordForm> local_credentials_;
147 base::string16 manage_link_; 148 base::string16 manage_link_;
148 base::string16 save_confirmation_text_; 149 base::string16 save_confirmation_text_;
149 gfx::Range save_confirmation_link_range_; 150 gfx::Range save_confirmation_link_range_;
150 151
151 // Responsible for recording all the interactions required. 152 // Responsible for recording all the interactions required.
152 std::unique_ptr<InteractionKeeper> interaction_keeper_; 153 std::unique_ptr<InteractionKeeper> interaction_keeper_;
153 154
155 // A bridge to ManagePasswordsUIController instance.
156 base::WeakPtr<PasswordsModelDelegate> delegate_;
157
154 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel); 158 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleModel);
155 }; 159 };
156 160
157 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_ 161 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698