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

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

Issue 1467343002: Create an interface between ChromePasswordManagerClient and ManagePasswordsUIController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed a comment Created 5 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_UI_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_
7 7
8 #include <vector>
9
10 #include "base/memory/scoped_vector.h"
11 #include "base/timer/elapsed_timer.h" 8 #include "base/timer/elapsed_timer.h"
12 #include "chrome/browser/ui/passwords/manage_passwords_state.h" 9 #include "chrome/browser/ui/passwords/manage_passwords_state.h"
10 #include "chrome/browser/ui/passwords/passwords_client_ui_delegate.h"
13 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" 11 #include "chrome/browser/ui/passwords/passwords_model_delegate.h"
14 #include "components/autofill/core/common/password_form.h"
15 #include "components/password_manager/core/browser/password_store.h" 12 #include "components/password_manager/core/browser/password_store.h"
16 #include "content/public/browser/web_contents_observer.h" 13 #include "content/public/browser/web_contents_observer.h"
17 #include "content/public/browser/web_contents_user_data.h" 14 #include "content/public/browser/web_contents_user_data.h"
18 15
19 namespace content { 16 namespace content {
20 class WebContents; 17 class WebContents;
21 } 18 }
22 19
23 namespace password_manager { 20 namespace password_manager {
24 enum class CredentialType; 21 enum class CredentialType;
25 struct CredentialInfo; 22 struct CredentialInfo;
26 struct InteractionsStats; 23 struct InteractionsStats;
27 class PasswordFormManager; 24 class PasswordFormManager;
28 } 25 }
29 26
30 class ManagePasswordsIconView; 27 class ManagePasswordsIconView;
31 28
32 // Per-tab class to control the Omnibox password icon and bubble. 29 // Per-tab class to control the Omnibox password icon and bubble.
33 class ManagePasswordsUIController 30 class ManagePasswordsUIController
34 : public content::WebContentsObserver, 31 : public content::WebContentsObserver,
35 public content::WebContentsUserData<ManagePasswordsUIController>, 32 public content::WebContentsUserData<ManagePasswordsUIController>,
36 public password_manager::PasswordStore::Observer, 33 public password_manager::PasswordStore::Observer,
37 public PasswordsModelDelegate { 34 public PasswordsModelDelegate,
35 public PasswordsClientUIDelegate {
38 public: 36 public:
39 ~ManagePasswordsUIController() override; 37 ~ManagePasswordsUIController() override;
40 38
41 // Called when the user submits a form containing login information, so we 39 // PasswordsClientUIDelegate:
42 // can handle later requests to save or blacklist that login information.
43 // This stores the provided object and triggers the UI to prompt the user
44 // about whether they would like to save the password.
45 void OnPasswordSubmitted( 40 void OnPasswordSubmitted(
46 scoped_ptr<password_manager::PasswordFormManager> form_manager); 41 scoped_ptr<password_manager::PasswordFormManager> form_manager) override;
47
48 // Called when the user submits a change password form, so we can handle
49 // later requests to update stored credentials in the PasswordManager.
50 // This stores the provided object and triggers the UI to prompt the user
51 // about whether they would like to update the password.
52 void OnUpdatePasswordSubmitted( 42 void OnUpdatePasswordSubmitted(
53 scoped_ptr<password_manager::PasswordFormManager> form_manager); 43 scoped_ptr<password_manager::PasswordFormManager> form_manager) override;
54
55 // Called when the site asks user to choose from credentials. This triggers
56 // the UI to prompt the user. |local_credentials| and |federated_credentials|
57 // shouldn't both be empty.
58 bool OnChooseCredentials( 44 bool OnChooseCredentials(
59 ScopedVector<autofill::PasswordForm> local_credentials, 45 ScopedVector<autofill::PasswordForm> local_credentials,
60 ScopedVector<autofill::PasswordForm> federated_credentials, 46 ScopedVector<autofill::PasswordForm> federated_credentials,
61 const GURL& origin, 47 const GURL& origin,
62 base::Callback<void(const password_manager::CredentialInfo&)> callback); 48 base::Callback<void(const password_manager::CredentialInfo&)> callback)
49 override;
50 void OnAutoSignin(ScopedVector<autofill::PasswordForm> local_forms) override;
51 void OnAutomaticPasswordSave(
52 scoped_ptr<password_manager::PasswordFormManager> form_manager) override;
53 void OnPasswordAutofilled(const autofill::PasswordFormMap& password_form_map,
54 const GURL& origin) override;
63 55
64 // Called when user is auto signed in to the site. |local_forms[0]| contains 56 // PasswordStore::Observer:
65 // the credential returned to the site.
66 void OnAutoSignin(ScopedVector<autofill::PasswordForm> local_forms);
67
68 // Called when the password will be saved automatically, but we still wish to
69 // visually inform the user that the save has occured.
70 void OnAutomaticPasswordSave(
71 scoped_ptr<password_manager::PasswordFormManager> form_manager);
72
73 // Called when a form is autofilled with login information, so we can manage
74 // password credentials for the current site which are stored in
75 // |password_form_map|. This stores a copy of |password_form_map| and shows
76 // the manage password icon.
77 void OnPasswordAutofilled(const autofill::PasswordFormMap& password_form_map,
78 const GURL& origin);
79
80 // PasswordStore::Observer implementation.
81 void OnLoginsChanged( 57 void OnLoginsChanged(
82 const password_manager::PasswordStoreChangeList& changes) override; 58 const password_manager::PasswordStoreChangeList& changes) override;
83 59
84 #if !defined(OS_ANDROID) 60 #if !defined(OS_ANDROID)
85 // Set the state of the Omnibox icon, and possibly show the associated bubble 61 // Set the state of the Omnibox icon, and possibly show the associated bubble
86 // without user interaction. 62 // without user interaction.
87 virtual void UpdateIconAndBubbleState(ManagePasswordsIconView* icon); 63 virtual void UpdateIconAndBubbleState(ManagePasswordsIconView* icon);
88 #endif 64 #endif
89 65
90 bool IsAutomaticallyOpeningBubble() const { return should_pop_up_bubble_; } 66 bool IsAutomaticallyOpeningBubble() const { return should_pop_up_bubble_; }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 scoped_ptr<base::ElapsedTimer> timer_; 146 scoped_ptr<base::ElapsedTimer> timer_;
171 147
172 // Contains true if the bubble is to be popped up in the next call to 148 // Contains true if the bubble is to be popped up in the next call to
173 // UpdateBubbleAndIconVisibility(). 149 // UpdateBubbleAndIconVisibility().
174 bool should_pop_up_bubble_; 150 bool should_pop_up_bubble_;
175 151
176 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController); 152 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController);
177 }; 153 };
178 154
179 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ 155 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/passwords/manage_passwords_test.cc ('k') | chrome/browser/ui/passwords/manage_passwords_ui_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698