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

Side by Side Diff: components/password_manager/content/browser/content_credential_manager_dispatcher.cc

Issue 615483002: Credential Manager: Extract browser-side IPC to a stand-alone dispatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 6 years, 2 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 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 #include "components/password_manager/content/browser/content_credential_manager _dispatcher.h"
6
7 #include "base/strings/string16.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "components/autofill/core/common/password_form.h"
10 #include "components/password_manager/content/common/credential_manager_messages .h"
11 #include "components/password_manager/content/common/credential_manager_types.h"
12 #include "components/password_manager/core/browser/password_manager_client.h"
13 #include "content/public/browser/render_view_host.h"
14 #include "content/public/browser/web_contents.h"
15 #include "ipc/ipc_message_macros.h"
16
17 namespace password_manager {
18
19 ContentCredentialManagerDispatcher::ContentCredentialManagerDispatcher(
20 content::WebContents* web_contents,
21 PasswordManagerClient* client)
22 : WebContentsObserver(web_contents),
23 client_(client) {
24 DCHECK(web_contents);
25 }
26
27 ContentCredentialManagerDispatcher::~ContentCredentialManagerDispatcher() {}
28
29 bool ContentCredentialManagerDispatcher::OnMessageReceived(
30 const IPC::Message& message) {
31 bool handled = true;
32 IPC_BEGIN_MESSAGE_MAP(ContentCredentialManagerDispatcher, message)
33 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_NotifyFailedSignIn,
34 OnNotifyFailedSignIn);
35 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_NotifySignedIn,
36 OnNotifySignedIn);
37 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_NotifySignedOut,
38 OnNotifySignedOut);
39 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_RequestCredential,
40 OnRequestCredential);
41 IPC_MESSAGE_UNHANDLED(handled = false)
42 IPC_END_MESSAGE_MAP()
43 return handled;
44 }
45
46 void ContentCredentialManagerDispatcher::OnNotifyFailedSignIn(
47 int request_id,
48 const password_manager::CredentialInfo&) {
49 // TODO(mkwst): This is a stub.
50 web_contents()->GetRenderViewHost()->Send(
51 new CredentialManagerMsg_AcknowledgeFailedSignIn(
52 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id));
53 }
54
55 void ContentCredentialManagerDispatcher::OnNotifySignedIn(
56 int request_id,
57 const password_manager::CredentialInfo&) {
58 // TODO(mkwst): This is a stub.
59 web_contents()->GetRenderViewHost()->Send(
60 new CredentialManagerMsg_AcknowledgeSignedIn(
61 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id));
62 }
63
64 void ContentCredentialManagerDispatcher::OnNotifySignedOut(int request_id) {
65 // TODO(mkwst): This is a stub.
66 web_contents()->GetRenderViewHost()->Send(
67 new CredentialManagerMsg_AcknowledgeSignedOut(
68 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id));
69 }
70
71 void ContentCredentialManagerDispatcher::OnRequestCredential(
72 int request_id,
73 bool zero_click_only,
74 const std::vector<GURL>& federations) {
75 // TODO(mkwst): This is a stub.
76 password_manager::CredentialInfo info(base::ASCIIToUTF16("id"),
77 base::ASCIIToUTF16("name"),
78 GURL("https://example.com/image.png"));
79 web_contents()->GetRenderViewHost()->Send(
80 new CredentialManagerMsg_SendCredential(
81 web_contents()->GetRenderViewHost()->GetRoutingID(),
82 request_id,
83 info));
84 }
85
86 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698