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

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client.cc

Issue 496703002: Credential Manager: Stub out the browser-side IPC handlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test. 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
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 "chrome/browser/password_manager/chrome_password_manager_client.h" 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/strings/string16.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/password_manager/password_manager_util.h" 13 #include "chrome/browser/password_manager/password_manager_util.h"
13 #include "chrome/browser/password_manager/password_store_factory.h" 14 #include "chrome/browser/password_manager/password_store_factory.h"
14 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" 15 #include "chrome/browser/password_manager/save_password_infobar_delegate.h"
15 #include "chrome/browser/password_manager/sync_metrics.h" 16 #include "chrome/browser/password_manager/sync_metrics.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/sync/profile_sync_service.h" 18 #include "chrome/browser/sync/profile_sync_service.h"
18 #include "chrome/browser/sync/profile_sync_service_factory.h" 19 #include "chrome/browser/sync/profile_sync_service_factory.h"
19 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h " 20 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h "
20 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 21 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
21 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/chrome_version_info.h" 23 #include "chrome/common/chrome_version_info.h"
23 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
24 #include "components/autofill/content/common/autofill_messages.h" 25 #include "components/autofill/content/common/autofill_messages.h"
25 #include "components/autofill/core/browser/password_generator.h" 26 #include "components/autofill/core/browser/password_generator.h"
26 #include "components/autofill/core/common/password_form.h" 27 #include "components/autofill/core/common/password_form.h"
27 #include "components/password_manager/content/browser/password_manager_internals _service_factory.h" 28 #include "components/password_manager/content/browser/password_manager_internals _service_factory.h"
29 #include "components/password_manager/content/common/credential_manager_messages .h"
30 #include "components/password_manager/content/common/credential_manager_types.h"
28 #include "components/password_manager/core/browser/log_receiver.h" 31 #include "components/password_manager/core/browser/log_receiver.h"
29 #include "components/password_manager/core/browser/password_form_manager.h" 32 #include "components/password_manager/core/browser/password_form_manager.h"
30 #include "components/password_manager/core/browser/password_manager.h" 33 #include "components/password_manager/core/browser/password_manager.h"
31 #include "components/password_manager/core/browser/password_manager_internals_se rvice.h" 34 #include "components/password_manager/core/browser/password_manager_internals_se rvice.h"
32 #include "components/password_manager/core/browser/password_manager_metrics_util .h" 35 #include "components/password_manager/core/browser/password_manager_metrics_util .h"
33 #include "components/password_manager/core/common/password_manager_switches.h" 36 #include "components/password_manager/core/common/password_manager_switches.h"
34 #include "content/public/browser/navigation_entry.h" 37 #include "content/public/browser/navigation_entry.h"
35 #include "content/public/browser/render_view_host.h" 38 #include "content/public/browser/render_view_host.h"
36 #include "content/public/browser/web_contents.h" 39 #include "content/public/browser/web_contents.h"
37 #include "google_apis/gaia/gaia_urls.h" 40 #include "google_apis/gaia/gaia_urls.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 if (service) 273 if (service)
271 service->ProcessLog(text); 274 service->ProcessLog(text);
272 } 275 }
273 276
274 bool ChromePasswordManagerClient::IsLoggingActive() const { 277 bool ChromePasswordManagerClient::IsLoggingActive() const {
275 // WebUI tabs do not need to log password saving progress. In particular, the 278 // WebUI tabs do not need to log password saving progress. In particular, the
276 // internals page itself should not send any logs. 279 // internals page itself should not send any logs.
277 return can_use_log_router_ && !web_contents()->GetWebUI(); 280 return can_use_log_router_ && !web_contents()->GetWebUI();
278 } 281 }
279 282
283 void ChromePasswordManagerClient::OnNotifyFailedSignIn(
284 int request_id,
285 const password_manager::CredentialInfo&) {
286 // TODO(mkwst): This is a stub.
287 web_contents()->GetRenderViewHost()->Send(
288 new CredentialManagerMsg_AcknowledgeFailedSignIn(
289 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id));
290 }
291
292 void ChromePasswordManagerClient::OnNotifySignedIn(
293 int request_id,
294 const password_manager::CredentialInfo&) {
295 // TODO(mkwst): This is a stub.
296 web_contents()->GetRenderViewHost()->Send(
297 new CredentialManagerMsg_AcknowledgeSignedIn(
298 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id));
299 }
300
301 void ChromePasswordManagerClient::OnNotifySignedOut(int request_id) {
302 // TODO(mkwst): This is a stub.
303 web_contents()->GetRenderViewHost()->Send(
304 new CredentialManagerMsg_AcknowledgeSignedOut(
305 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id));
306 }
307
308 void ChromePasswordManagerClient::OnRequestCredential(
309 int request_id,
310 bool zero_click_only,
311 std::vector<GURL> federations) {
vabr (Chromium) 2014/08/22 14:04:32 optional: My gut feeling would be that making this
312 // TODO(mkwst): This is a stub.
313 password_manager::CredentialInfo info(base::ASCIIToUTF16("id"),
314 base::ASCIIToUTF16("name"),
315 GURL("https://example.com/image.png"));
316 web_contents()->GetRenderViewHost()->Send(
317 new CredentialManagerMsg_SendCredential(
318 web_contents()->GetRenderViewHost()->GetRoutingID(),
319 request_id,
320 info));
321 }
322
280 // static 323 // static
281 password_manager::PasswordGenerationManager* 324 password_manager::PasswordGenerationManager*
282 ChromePasswordManagerClient::GetGenerationManagerFromWebContents( 325 ChromePasswordManagerClient::GetGenerationManagerFromWebContents(
283 content::WebContents* contents) { 326 content::WebContents* contents) {
284 ChromePasswordManagerClient* client = 327 ChromePasswordManagerClient* client =
285 ChromePasswordManagerClient::FromWebContents(contents); 328 ChromePasswordManagerClient::FromWebContents(contents);
286 if (!client) 329 if (!client)
287 return NULL; 330 return NULL;
288 return client->GetDriver()->GetPasswordGenerationManager(); 331 return client->GetDriver()->GetPasswordGenerationManager();
289 } 332 }
(...skipping 11 matching lines...) Expand all
301 344
302 void ChromePasswordManagerClient::SetTestObserver( 345 void ChromePasswordManagerClient::SetTestObserver(
303 autofill::PasswordGenerationPopupObserver* observer) { 346 autofill::PasswordGenerationPopupObserver* observer) {
304 observer_ = observer; 347 observer_ = observer;
305 } 348 }
306 349
307 bool ChromePasswordManagerClient::OnMessageReceived( 350 bool ChromePasswordManagerClient::OnMessageReceived(
308 const IPC::Message& message) { 351 const IPC::Message& message) {
309 bool handled = true; 352 bool handled = true;
310 IPC_BEGIN_MESSAGE_MAP(ChromePasswordManagerClient, message) 353 IPC_BEGIN_MESSAGE_MAP(ChromePasswordManagerClient, message)
354 // Autofill messages:
311 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordGenerationPopup, 355 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordGenerationPopup,
312 ShowPasswordGenerationPopup) 356 ShowPasswordGenerationPopup)
313 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordEditingPopup, 357 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordEditingPopup,
314 ShowPasswordEditingPopup) 358 ShowPasswordEditingPopup)
315 IPC_MESSAGE_HANDLER(AutofillHostMsg_HidePasswordGenerationPopup, 359 IPC_MESSAGE_HANDLER(AutofillHostMsg_HidePasswordGenerationPopup,
316 HidePasswordGenerationPopup) 360 HidePasswordGenerationPopup)
317 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordAutofillAgentConstructed, 361 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordAutofillAgentConstructed,
318 NotifyRendererOfLoggingAvailability) 362 NotifyRendererOfLoggingAvailability)
363
364 // Credential Manager messages:
365 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_NotifyFailedSignIn,
366 OnNotifyFailedSignIn);
367 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_NotifySignedIn,
368 OnNotifySignedIn);
369 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_NotifySignedOut,
370 OnNotifySignedOut);
371 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_RequestCredential,
372 OnRequestCredential);
373
374 // Default:
319 IPC_MESSAGE_UNHANDLED(handled = false) 375 IPC_MESSAGE_UNHANDLED(handled = false)
320 IPC_END_MESSAGE_MAP() 376 IPC_END_MESSAGE_MAP()
321 return handled; 377 return handled;
322 } 378 }
323 379
324 gfx::RectF ChromePasswordManagerClient::GetBoundsInScreenSpace( 380 gfx::RectF ChromePasswordManagerClient::GetBoundsInScreenSpace(
325 const gfx::RectF& bounds) { 381 const gfx::RectF& bounds) {
326 gfx::Rect client_area = web_contents()->GetContainerBounds(); 382 gfx::Rect client_area = web_contents()->GetContainerBounds();
327 return bounds + client_area.OffsetFromOrigin(); 383 return bounds + client_area.OffsetFromOrigin();
328 } 384 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 517
462 if (group_name == "DisallowSyncCredentialsForReauth") { 518 if (group_name == "DisallowSyncCredentialsForReauth") {
463 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; 519 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH;
464 } else if (group_name == "DisallowSyncCredentials") { 520 } else if (group_name == "DisallowSyncCredentials") {
465 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; 521 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS;
466 } else { 522 } else {
467 // Allow by default. 523 // Allow by default.
468 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; 524 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS;
469 } 525 }
470 } 526 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698