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

Side by Side Diff: chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h

Issue 1857513002: Update code so 1:1 relation between delegate and router is more clear. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 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_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_DELEGA TE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_DELEGA TE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_DELEGA TE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_DELEGA TE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 20 matching lines...) Expand all
31 31
32 namespace extensions { 32 namespace extensions {
33 33
34 // Delegate used by the chrome.passwordsPrivate API to facilitate removing saved 34 // Delegate used by the chrome.passwordsPrivate API to facilitate removing saved
35 // passwords and password exceptions and to notify listeners when these values 35 // passwords and password exceptions and to notify listeners when these values
36 // have changed. 36 // have changed.
37 class PasswordsPrivateDelegate : public KeyedService { 37 class PasswordsPrivateDelegate : public KeyedService {
38 public: 38 public:
39 ~PasswordsPrivateDelegate() override {} 39 ~PasswordsPrivateDelegate() override {}
40 40
41 // An interface used to notify clients (observers) of this object that 41 virtual void SendSavedPasswordsList() = 0;
42 // saved passwords, password exceptions, and plaintext passwords are ready to 42 virtual void SendPasswordExceptionsList() = 0;
stevenjb 2016/04/06 00:17:08 These should be commented here.
hcarmona 2016/04/06 01:51:23 Done.
43 // be consumed by the UI. Register an observer via
44 // PasswordsPrivateDelegate::AddObserver().
45 class Observer {
46 public:
47 virtual void OnSavedPasswordsListChanged(
48 const std::vector<api::passwords_private::PasswordUiEntry>& entries) {}
49 virtual void OnPasswordExceptionsListChanged(
50 const std::vector<std::string>& exceptions) {}
51 virtual void OnPlaintextPasswordFetched(
52 const std::string& origin_url,
53 const std::string& username,
54 const std::string& plaintext_password) {}
55
56 protected:
57 virtual ~Observer() {}
58 };
59
60 // Adds |observer| to be notified when password data changes.
61 virtual void AddObserver(Observer* observer) = 0;
62
63 // Removes |observer| from the observer list.
64 virtual void RemoveObserver(Observer* observer) = 0;
65 43
66 // Removes the saved password entry corresponding to |origin_url| and 44 // Removes the saved password entry corresponding to |origin_url| and
67 // |username|. 45 // |username|.
68 // |origin_url| The human-readable origin for the URL where the password is 46 // |origin_url| The human-readable origin for the URL where the password is
69 // used/ should be obtained using GetHumanReadableOrigin(). 47 // used/ should be obtained using GetHumanReadableOrigin().
70 // |username| The username used in conjunction with the saved password. 48 // |username| The username used in conjunction with the saved password.
71 virtual void RemoveSavedPassword( 49 virtual void RemoveSavedPassword(
72 const std::string& origin_url, const std::string& username) = 0; 50 const std::string& origin_url, const std::string& username) = 0;
73 51
74 // Removes the saved password exception entry corresponding to 52 // Removes the saved password exception entry corresponding to
(...skipping 10 matching lines...) Expand all
85 // |native_window| The Chrome host window; will be used to show an OS-level 63 // |native_window| The Chrome host window; will be used to show an OS-level
86 // authentication dialog if necessary. 64 // authentication dialog if necessary.
87 virtual void RequestShowPassword(const std::string& origin_url, 65 virtual void RequestShowPassword(const std::string& origin_url,
88 const std::string& username, 66 const std::string& username,
89 content::WebContents* web_contents) = 0; 67 content::WebContents* web_contents) = 0;
90 }; 68 };
91 69
92 } // namespace extensions 70 } // namespace extensions
93 71
94 #endif // CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_DEL EGATE_H_ 72 #endif // CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_DEL EGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698