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

Unified Diff: components/password_manager/content/common/credential_manager_content_utils.cc

Issue 1872133002: Revert of Reland: Switch components/password_manager code from IPC messages to Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/password_manager/content/common/credential_manager_content_utils.cc
diff --git a/components/password_manager/content/common/credential_manager_content_utils.cc b/components/password_manager/content/common/credential_manager_content_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6205abdbe007d592da84d2eac71e9ff59b815fb0
--- /dev/null
+++ b/components/password_manager/content/common/credential_manager_content_utils.cc
@@ -0,0 +1,36 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/password_manager/content/common/credential_manager_content_utils.h"
+
+#include "base/logging.h"
+#include "third_party/WebKit/public/platform/WebCredential.h"
+#include "third_party/WebKit/public/platform/WebFederatedCredential.h"
+#include "third_party/WebKit/public/platform/WebPasswordCredential.h"
+
+namespace password_manager {
+
+CredentialInfo WebCredentialToCredentialInfo(
+ const blink::WebCredential& credential) {
+ CredentialInfo credential_info;
+ credential_info.id = credential.id();
+ credential_info.name = credential.name();
+ credential_info.icon = credential.iconURL();
+ credential_info.type = credential.isPasswordCredential()
+ ? CredentialType::CREDENTIAL_TYPE_PASSWORD
+ : CredentialType::CREDENTIAL_TYPE_FEDERATED;
+ if (credential_info.type == CredentialType::CREDENTIAL_TYPE_PASSWORD) {
+ DCHECK(credential.isPasswordCredential());
+ credential_info.password =
+ static_cast<const blink::WebPasswordCredential&>(credential).password();
+ } else {
+ DCHECK(credential.isFederatedCredential());
+ credential_info.federation =
+ static_cast<const blink::WebFederatedCredential&>(credential)
+ .provider();
+ }
+ return credential_info;
+}
+
+} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698