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

Side by Side Diff: components/password_manager/content/browser/visible_password_observer.h

Issue 2467773002: Notify SSLManager when all password fields on a page are gone (Closed)
Patch Set: tweak SSLManager comment Created 4 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 2016 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 COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_VISIBLE_PASSWORD_OBSERVER_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_VISIBLE_PASSWORD_OBSERVER_H_
7
8 #include <set>
9
10 #include "base/compiler_specific.h"
11 #include "base/macros.h"
12 #include "content/public/browser/web_contents_observer.h"
13 #include "content/public/browser/web_contents_user_data.h"
14
15 namespace content {
16 class RenderFrameHost;
17 } // namespace content
18
19 namespace password_manager {
20
21 // This class tracks password visibility notifications for the
22 // RenderFrameHosts in a WebContents. There is one
23 // VisiblePasswordObserver per WebContents. When a RenderFrameHost has a
24 // visible password field and the top-level URL is HTTP, the
25 // VisiblePasswordObserver notifies the WebContents, which allows the
26 // content embedder to adjust security UI. Similarly, when all
27 // RenderFrameHosts have hidden their password fields (either because
28 // the renderer sent a message reporting that all password fields are
29 // gone, or because the renderer crashed), the WebContents is notified
30 // so that security warnings can be removed by the embedder.
31 //
32 // The user of this class is responsible for listening for messages from
33 // the renderer about password visibility and notifying the
34 // VisiblePasswordObserver about them. The VisiblePasswordObserver
35 // itself observes renderer process crashes. (Note that listening for
36 // navigations explicitly is not required because on navigation the
37 // renderer will send messages as password fields are removed.)
38 class VisiblePasswordObserver
39 : public content::WebContentsObserver,
40 public content::WebContentsUserData<VisiblePasswordObserver> {
41 public:
42 ~VisiblePasswordObserver() override;
43
44 // This method should be called when there is a message notifying
45 // the browser process that the renderer has a visible password
46 // field.
47 void RenderFrameHasVisiblePasswordField(
48 content::RenderFrameHost* render_frame_host);
49
50 // This method should be called when there is a message notifying the browser
51 // process that the renderer has no visible password fields anymore.
52 void RenderFrameHasNoVisiblePasswordFields(
53 content::RenderFrameHost* render_frame_host);
54
55 // WebContentsObserver:
56 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
57
58 private:
59 explicit VisiblePasswordObserver(content::WebContents* web_contents);
60 friend class content::WebContentsUserData<VisiblePasswordObserver>;
61
62 void MaybeNotifyPasswordInputShownOnHttp();
63
64 void MaybeNotifyAllFieldsInvisible();
65
66 content::WebContents* web_contents_;
67 std::set<int> frame_tree_nodes_with_visible_password_fields_;
68
69 DISALLOW_COPY_AND_ASSIGN(VisiblePasswordObserver);
70 };
71
72 } // namespace password_manager
73
74 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_VISIBLE_PASSWORD_OBSERVER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698