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

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

Issue 1142693003: Implement the chrome.passwordsPrivate API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stevenjb comment. Created 5 years, 6 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
(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_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_DELEGA TE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_DELEGA TE_H_
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 #include "base/callback.h"
13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/observer_list_threadsafe.h"
16 #include "chrome/browser/ui/passwords/password_manager_presenter.h"
17 #include "chrome/browser/ui/passwords/password_ui_view.h"
18 #include "chrome/common/extensions/api/passwords_private.h"
19 #include "components/keyed_service/core/keyed_service.h"
20 #include "extensions/browser/extension_function.h"
21
22 class Profile;
23
24 namespace base {
25 class Value;
26 }
27
28 namespace content {
29 class RenderViewHost;
30 }
31
32 namespace extensions {
33
34 // Delegate used by the chrome.passwordsPrivate API to facilitate removing saved
35 // passwords and password exceptions and to notify listeners when these values
36 // have changed.
37 class PasswordsPrivateDelegate : public KeyedService {
38 public:
39 ~PasswordsPrivateDelegate() override {}
40
41 // An interface used to notify clients (observers) of this object that
42 // saved passwords, password exceptions, and plaintext passwords are ready to
43 // be consumed by the UI. Register an observer via
44 // PasswordsPrivateDelegate::AddObserver().
45 class Observer {
46 public:
47 virtual void OnSavedPasswordsListChanged(const std::vector<linked_ptr<
48 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
66 // Removes the saved password entry corresponding to |origin_url| and
67 // |username|.
68 // |origin_url| The human-readable origin for the URL where the password is
69 // used/ should be obtained using GetHumanReadableOrigin().
70 // |username| The username used in conjunction with the saved password.
71 virtual void RemoveSavedPassword(
72 const std::string& origin_url, const std::string& username) = 0;
73
74 // Removes the saved password exception entry corresponding to
75 // |exception_url|.
76 // |exception_url| The URL corresponding to the exception to remove; should
77 // be obtained using GetHumanReadableOrigin().
78 virtual void RemovePasswordException(const std::string& exception_url) = 0;
79
80 // Requests the plain text password for entry corresponding to |origin_url|
81 // and |username|.
82 // |origin_url| The human-readable origin for the URL where the password is
83 // used; should be obtained using GetHumanReadableOrigin().
84 // |username| The username used in conjunction with the saved password.
85 // |native_window| The Chrome host window; will be used to show an OS-level
86 // authentication dialog if necessary.
87 virtual void RequestShowPassword(
88 const std::string& origin_url,
89 const std::string& username,
90 const content::RenderViewHost* render_view_host) = 0;
91 };
92
93 } // namespace extensions
94
95 #endif // CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_DEL EGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698