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

Unified Diff: Source/modules/credentialmanager/CredentialManagerClient.cpp

Issue 573663002: Credential Manager: Wire up the client. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Oops. Created 6 years, 3 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: Source/modules/credentialmanager/CredentialManagerClient.cpp
diff --git a/Source/modules/credentialmanager/CredentialManagerClient.cpp b/Source/modules/credentialmanager/CredentialManagerClient.cpp
index 76a99b08eb16ebb9ea47b126f88634ba6dae4bab..fbf260c581c667e02833a3cb4027baba403b8879 100644
--- a/Source/modules/credentialmanager/CredentialManagerClient.cpp
+++ b/Source/modules/credentialmanager/CredentialManagerClient.cpp
@@ -5,6 +5,9 @@
#include "config.h"
#include "modules/credentialmanager/CredentialManagerClient.h"
+#include "bindings/core/v8/ScriptState.h"
+#include "core/dom/Document.h"
+#include "core/dom/ExecutionContext.h"
#include "core/page/Page.h"
namespace blink {
@@ -25,6 +28,14 @@ const char* CredentialManagerClient::supplementName()
}
// static
+CredentialManagerClient* CredentialManagerClient::from(ScriptState* scriptState)
+{
+ if (!scriptState->executionContext()->isDocument())
+ return 0;
+ return from(toDocument(scriptState->executionContext())->page());
sof 2014/09/15 07:57:17 If the document has become detached, page() will b
Mike West 2014/09/16 07:53:20 That's taken care of in `Supplementable::from()`:
sof 2014/09/16 12:36:11 It does (but a bit tight); I won't insist.
+}
+
+// static
CredentialManagerClient* CredentialManagerClient::from(Page* page)
{
return static_cast<CredentialManagerClient*>(WillBeHeapSupplement<Page>::from(page, supplementName()));

Powered by Google App Engine
This is Rietveld 408576698