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

Side by Side Diff: components/password_manager/content/renderer/credential_manager_dispatcher.h

Issue 464883002: Credential Manager: Renderer-side implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style. Created 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_RENDERER_CREDENTIAL_MANAGER_DISPATCH ER_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_RENDERER_CREDENTIAL_MANAGER_DISPATCH ER_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/id_map.h"
11 #include "content/public/renderer/render_process_observer.h"
12 #include "ipc/ipc_listener.h"
13 #include "ipc/ipc_sender.h"
Ilya Sherman 2014/08/19 23:55:53 nit: Looks like this is unused.
Mike West 2014/08/20 13:17:19 Done.
14 #include "third_party/WebKit/public/platform/WebCredential.h"
15 #include "third_party/WebKit/public/platform/WebCredentialManager.h"
16 #include "third_party/WebKit/public/platform/WebString.h"
17 #include "third_party/WebKit/public/platform/WebURL.h"
18 #include "third_party/WebKit/public/platform/WebVector.h"
Ilya Sherman 2014/08/19 23:55:53 Are all of these needed in the header / can any of
Mike West 2014/08/20 13:17:20 I can drop all except WebVector and WebCredentialM
19
20 namespace content {
21 class RenderThread;
22 }
23
24 namespace password_manager {
25
26 struct CredentialInfo;
27
28 // The CredentialManagerDispatcher implements the Blink platform interface
29 // WebCredentialManager, and acts as an intermediary between Blink-side calls
30 // to 'navigator.credential.*' and the password manager internals which live
31 // in the browser process.
32 //
33 // One instance of CredentialManagerDispatcher is created per RenderThread,
34 // held in a scoped_ptr on ChromeContentRendererClient. The dispatcher holds
35 // a raw pointer to the RenderThread on which it lives, and uses that pointer
36 // to send messages to the browser process, and to route responses to itself.
37 //
38 // When the render thread is shutdown (or the dispatcher is destructed), the
Ilya Sherman 2014/08/19 23:55:53 nit: "shutdown" -> "shut down"
Mike West 2014/08/20 13:17:19 Done.
39 // routing is removed, the pointer is cleared, and any pending responses are
40 // rejected.
41 class CredentialManagerDispatcher : public blink::WebCredentialManager,
42 public content::RenderProcessObserver,
43 public IPC::Listener {
44 public:
45 typedef IDMap<blink::WebCredentialManager::RequestCallbacks, IDMapOwnPointer>
46 RequestCallbacksMap;
47 typedef IDMap<blink::WebCredentialManager::NotificationCallbacks,
48 IDMapOwnPointer> NotificationCallbacksMap;
Ilya Sherman 2014/08/19 23:55:53 nit: Why are these public? Can they be protected
Mike West 2014/08/20 13:17:20 They're public so I can use them in an anonymous-n
49
50 CredentialManagerDispatcher();
51 virtual ~CredentialManagerDispatcher();
52
53 // content::RenderProcessObserver:
54 virtual void OnRenderProcessShutdown() OVERRIDE;
55
56 // IPC::Listener:
57 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
58
59 // Message handlers for messages from the browser process:
60 virtual void OnFailedSignInResponse(int request_id);
61 virtual void OnSignedInResponse(int request_id);
62 virtual void OnSignedOutResponse(int request_id);
63 virtual void OnSendCredentials(int request_id, const CredentialInfo&);
64
65 // blink::WebCredentialManager:
66 virtual void dispatchFailedSignIn(
67 const blink::WebCredential&,
68 WebCredentialManager::NotificationCallbacks*) OVERRIDE;
Ilya Sherman 2014/08/19 23:55:53 nit: Please include variable names, throughout.
Mike West 2014/08/20 13:17:19 Huh. Ok, that's repetitive, but I guess it's Chrom
69 virtual void dispatchSignedIn(
70 const blink::WebCredential&,
71 WebCredentialManager::NotificationCallbacks*) OVERRIDE;
72 virtual void dispatchSignedOut(NotificationCallbacks*) OVERRIDE;
73 virtual void dispatchRequest(
74 bool zeroClickOnly,
Ilya Sherman 2014/08/19 23:55:53 nit: hacker_case.
Mike West 2014/08/20 13:17:19 Done.
75 const blink::WebVector<blink::WebURL>& federations,
76 RequestCallbacks*) OVERRIDE;
77
78 protected:
79 virtual int GetRoutingID();
80 virtual void ClearCallbackErrorMaps();
81
82 // Track the various blink::WebCredentialManager::*Callbacks objects generated
83 // from Blink. This class takes ownership of these objects. These properties
84 // are protected so we can expose these maps to unit tests.
85 NotificationCallbacksMap failed_sign_in_callbacks_;
86 NotificationCallbacksMap signed_in_callbacks_;
87 NotificationCallbacksMap signed_out_callbacks_;
88 RequestCallbacksMap request_callbacks_;
Ilya Sherman 2014/08/19 23:55:53 nit: Member variables should always be private. I
Mike West 2014/08/20 13:17:19 Done.
89
90 private:
91 // Nulls out the raw pointer to |render_thread_| after ensuring that any
92 // message routing is removed.
93 void DisconnectFromRenderThread();
94
95 int routing_id_;
96 content::RenderThread* render_thread_;
97
98 DISALLOW_COPY_AND_ASSIGN(CredentialManagerDispatcher);
99 };
100
101 } // namespace password_manager
102
103 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_RENDERER_CREDENTIAL_MANAGER_DISPA TCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698