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

Side by Side Diff: components/password_manager/content/renderer/credential_manager_client.cc

Issue 1159323003: Credential Management: Rename 'notifySignedOut' to 'requireUserMediation' (2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rename-password
Patch Set: Rebase. 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #include "components/password_manager/content/renderer/credential_manager_client .h" 5 #include "components/password_manager/content/renderer/credential_manager_client .h"
6 6
7 #include "components/password_manager/content/common/credential_manager_content_ utils.h" 7 #include "components/password_manager/content/common/credential_manager_content_ utils.h"
8 #include "components/password_manager/content/common/credential_manager_messages .h" 8 #include "components/password_manager/content/common/credential_manager_messages .h"
9 #include "components/password_manager/core/common/credential_manager_types.h" 9 #include "components/password_manager/core/common/credential_manager_types.h"
10 #include "content/public/renderer/render_view.h" 10 #include "content/public/renderer/render_view.h"
(...skipping 23 matching lines...) Expand all
34 34
35 CredentialManagerClient::CredentialManagerClient( 35 CredentialManagerClient::CredentialManagerClient(
36 content::RenderView* render_view) 36 content::RenderView* render_view)
37 : content::RenderViewObserver(render_view) { 37 : content::RenderViewObserver(render_view) {
38 render_view->GetWebView()->setCredentialManagerClient(this); 38 render_view->GetWebView()->setCredentialManagerClient(this);
39 } 39 }
40 40
41 CredentialManagerClient::~CredentialManagerClient() { 41 CredentialManagerClient::~CredentialManagerClient() {
42 ClearCallbacksMapWithErrors(&failed_sign_in_callbacks_); 42 ClearCallbacksMapWithErrors(&failed_sign_in_callbacks_);
43 ClearCallbacksMapWithErrors(&signed_in_callbacks_); 43 ClearCallbacksMapWithErrors(&signed_in_callbacks_);
44 ClearCallbacksMapWithErrors(&signed_out_callbacks_); 44 ClearCallbacksMapWithErrors(&require_user_mediation_callbacks_);
45 ClearCallbacksMapWithErrors(&request_callbacks_); 45 ClearCallbacksMapWithErrors(&request_callbacks_);
46 } 46 }
47 47
48 // ----------------------------------------------------------------------------- 48 // -----------------------------------------------------------------------------
49 // Handle messages from the browser. 49 // Handle messages from the browser.
50 50
51 bool CredentialManagerClient::OnMessageReceived(const IPC::Message& message) { 51 bool CredentialManagerClient::OnMessageReceived(const IPC::Message& message) {
52 bool handled = true; 52 bool handled = true;
53 IPC_BEGIN_MESSAGE_MAP(CredentialManagerClient, message) 53 IPC_BEGIN_MESSAGE_MAP(CredentialManagerClient, message)
54 IPC_MESSAGE_HANDLER(CredentialManagerMsg_AcknowledgeFailedSignIn, 54 IPC_MESSAGE_HANDLER(CredentialManagerMsg_AcknowledgeFailedSignIn,
55 OnAcknowledgeFailedSignIn) 55 OnAcknowledgeFailedSignIn)
56 IPC_MESSAGE_HANDLER(CredentialManagerMsg_AcknowledgeSignedIn, 56 IPC_MESSAGE_HANDLER(CredentialManagerMsg_AcknowledgeSignedIn,
57 OnAcknowledgeSignedIn) 57 OnAcknowledgeSignedIn)
58 IPC_MESSAGE_HANDLER(CredentialManagerMsg_AcknowledgeSignedOut, 58 IPC_MESSAGE_HANDLER(CredentialManagerMsg_AcknowledgeRequireUserMediation,
59 OnAcknowledgeSignedOut) 59 OnAcknowledgeRequireUserMediation)
60 IPC_MESSAGE_HANDLER(CredentialManagerMsg_SendCredential, OnSendCredential) 60 IPC_MESSAGE_HANDLER(CredentialManagerMsg_SendCredential, OnSendCredential)
61 IPC_MESSAGE_HANDLER(CredentialManagerMsg_RejectCredentialRequest, 61 IPC_MESSAGE_HANDLER(CredentialManagerMsg_RejectCredentialRequest,
62 OnRejectCredentialRequest) 62 OnRejectCredentialRequest)
63 IPC_MESSAGE_UNHANDLED(handled = false) 63 IPC_MESSAGE_UNHANDLED(handled = false)
64 IPC_END_MESSAGE_MAP() 64 IPC_END_MESSAGE_MAP()
65 return handled; 65 return handled;
66 } 66 }
67 67
68 void CredentialManagerClient::OnAcknowledgeFailedSignIn(int request_id) { 68 void CredentialManagerClient::OnAcknowledgeFailedSignIn(int request_id) {
69 RespondToNotificationCallback(request_id, &failed_sign_in_callbacks_); 69 RespondToNotificationCallback(request_id, &failed_sign_in_callbacks_);
70 } 70 }
71 71
72 void CredentialManagerClient::OnAcknowledgeSignedIn(int request_id) { 72 void CredentialManagerClient::OnAcknowledgeSignedIn(int request_id) {
73 RespondToNotificationCallback(request_id, &signed_in_callbacks_); 73 RespondToNotificationCallback(request_id, &signed_in_callbacks_);
74 } 74 }
75 75
76 void CredentialManagerClient::OnAcknowledgeSignedOut(int request_id) { 76 void CredentialManagerClient::OnAcknowledgeRequireUserMediation(
77 RespondToNotificationCallback(request_id, &signed_out_callbacks_); 77 int request_id) {
78 RespondToNotificationCallback(request_id, &require_user_mediation_callbacks_);
78 } 79 }
79 80
80 void CredentialManagerClient::OnSendCredential(int request_id, 81 void CredentialManagerClient::OnSendCredential(int request_id,
81 const CredentialInfo& info) { 82 const CredentialInfo& info) {
82 RequestCallbacks* callbacks = request_callbacks_.Lookup(request_id); 83 RequestCallbacks* callbacks = request_callbacks_.Lookup(request_id);
83 DCHECK(callbacks); 84 DCHECK(callbacks);
84 scoped_ptr<blink::WebCredential> credential = nullptr; 85 scoped_ptr<blink::WebCredential> credential = nullptr;
85 switch (info.type) { 86 switch (info.type) {
86 case CredentialType::CREDENTIAL_TYPE_FEDERATED: 87 case CredentialType::CREDENTIAL_TYPE_FEDERATED:
87 credential.reset(new blink::WebFederatedCredential( 88 credential.reset(new blink::WebFederatedCredential(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 125
125 void CredentialManagerClient::dispatchSignedIn( 126 void CredentialManagerClient::dispatchSignedIn(
126 const blink::WebCredential& credential, 127 const blink::WebCredential& credential,
127 blink::WebCredentialManagerClient::NotificationCallbacks* callbacks) { 128 blink::WebCredentialManagerClient::NotificationCallbacks* callbacks) {
128 int request_id = signed_in_callbacks_.Add(callbacks); 129 int request_id = signed_in_callbacks_.Add(callbacks);
129 CredentialInfo info(WebCredentialToCredentialInfo(credential)); 130 CredentialInfo info(WebCredentialToCredentialInfo(credential));
130 Send(new CredentialManagerHostMsg_NotifySignedIn( 131 Send(new CredentialManagerHostMsg_NotifySignedIn(
131 routing_id(), request_id, info)); 132 routing_id(), request_id, info));
132 } 133 }
133 134
134 void CredentialManagerClient::dispatchSignedOut( 135 void CredentialManagerClient::dispatchRequireUserMediation(
135 NotificationCallbacks* callbacks) { 136 NotificationCallbacks* callbacks) {
136 int request_id = signed_out_callbacks_.Add(callbacks); 137 int request_id = require_user_mediation_callbacks_.Add(callbacks);
137 Send(new CredentialManagerHostMsg_NotifySignedOut(routing_id(), request_id)); 138 Send(new CredentialManagerHostMsg_RequireUserMediation(routing_id(),
139 request_id));
138 } 140 }
139 141
140 void CredentialManagerClient::dispatchRequest( 142 void CredentialManagerClient::dispatchRequest(
141 bool zeroClickOnly, 143 bool zeroClickOnly,
142 const blink::WebVector<blink::WebURL>& federations, 144 const blink::WebVector<blink::WebURL>& federations,
143 RequestCallbacks* callbacks) { 145 RequestCallbacks* callbacks) {
144 int request_id = request_callbacks_.Add(callbacks); 146 int request_id = request_callbacks_.Add(callbacks);
145 std::vector<GURL> federation_vector; 147 std::vector<GURL> federation_vector;
146 for (size_t i = 0; i < std::min(federations.size(), kMaxFederations); ++i) 148 for (size_t i = 0; i < std::min(federations.size(), kMaxFederations); ++i)
147 federation_vector.push_back(federations[i]); 149 federation_vector.push_back(federations[i]);
148 Send(new CredentialManagerHostMsg_RequestCredential( 150 Send(new CredentialManagerHostMsg_RequestCredential(
149 routing_id(), request_id, zeroClickOnly, federation_vector)); 151 routing_id(), request_id, zeroClickOnly, federation_vector));
150 } 152 }
151 153
152 void CredentialManagerClient::RespondToNotificationCallback( 154 void CredentialManagerClient::RespondToNotificationCallback(
153 int request_id, 155 int request_id,
154 CredentialManagerClient::NotificationCallbacksMap* map) { 156 CredentialManagerClient::NotificationCallbacksMap* map) {
155 blink::WebCredentialManagerClient::NotificationCallbacks* callbacks = 157 blink::WebCredentialManagerClient::NotificationCallbacks* callbacks =
156 map->Lookup(request_id); 158 map->Lookup(request_id);
157 DCHECK(callbacks); 159 DCHECK(callbacks);
158 callbacks->onSuccess(); 160 callbacks->onSuccess();
159 map->Remove(request_id); 161 map->Remove(request_id);
160 } 162 }
161 163
162 } // namespace password_manager 164 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698