| OLD | NEW |
| 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 "modules/credentialmanager/CredentialManagerClient.h" | 5 #include "modules/credentialmanager/CredentialManagerClient.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
| 10 #include "core/page/Page.h" | 10 #include "core/page/Page.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 CredentialManagerClient::CredentialManagerClient(WebCredentialManagerClient* cli
ent) | 14 CredentialManagerClient::CredentialManagerClient(WebCredentialManagerClient* cli
ent) |
| 15 : m_client(client) | 15 : m_client(client) |
| 16 { | 16 { |
| 17 } | 17 } |
| 18 | 18 |
| 19 CredentialManagerClient::~CredentialManagerClient() | 19 CredentialManagerClient::~CredentialManagerClient() |
| 20 { | 20 { |
| 21 } | 21 } |
| 22 | 22 |
| 23 DEFINE_TRACE(CredentialManagerClient) | 23 DEFINE_TRACE(CredentialManagerClient) |
| 24 { | 24 { |
| 25 HeapSupplement<Page>::trace(visitor); | 25 Supplement<Page>::trace(visitor); |
| 26 } | 26 } |
| 27 | 27 |
| 28 // static | 28 // static |
| 29 const char* CredentialManagerClient::supplementName() | 29 const char* CredentialManagerClient::supplementName() |
| 30 { | 30 { |
| 31 return "CredentialManagerClient"; | 31 return "CredentialManagerClient"; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // static | 34 // static |
| 35 CredentialManagerClient* CredentialManagerClient::from(ExecutionContext* executi
onContext) | 35 CredentialManagerClient* CredentialManagerClient::from(ExecutionContext* executi
onContext) |
| 36 { | 36 { |
| 37 if (!executionContext->isDocument() || !toDocument(executionContext)->page()
) | 37 if (!executionContext->isDocument() || !toDocument(executionContext)->page()
) |
| 38 return 0; | 38 return 0; |
| 39 return from(toDocument(executionContext)->page()); | 39 return from(toDocument(executionContext)->page()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // static | 42 // static |
| 43 CredentialManagerClient* CredentialManagerClient::from(Page* page) | 43 CredentialManagerClient* CredentialManagerClient::from(Page* page) |
| 44 { | 44 { |
| 45 return static_cast<CredentialManagerClient*>(HeapSupplement<Page>::from(page
, supplementName())); | 45 return static_cast<CredentialManagerClient*>(Supplement<Page>::from(page, su
pplementName())); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void provideCredentialManagerClientTo(Page& page, CredentialManagerClient* clien
t) | 48 void provideCredentialManagerClientTo(Page& page, CredentialManagerClient* clien
t) |
| 49 { | 49 { |
| 50 CredentialManagerClient::provideTo(page, CredentialManagerClient::supplement
Name(), client); | 50 CredentialManagerClient::provideTo(page, CredentialManagerClient::supplement
Name(), client); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void CredentialManagerClient::dispatchFailedSignIn(const WebCredential& credenti
al, WebCredentialManagerClient::NotificationCallbacks* callbacks) | 53 void CredentialManagerClient::dispatchFailedSignIn(const WebCredential& credenti
al, WebCredentialManagerClient::NotificationCallbacks* callbacks) |
| 54 { | 54 { |
| 55 if (!m_client) | 55 if (!m_client) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 void CredentialManagerClient::dispatchGet(bool zeroClickOnly, bool includePasswo
rds, const WebVector<WebURL>& federations, WebCredentialManagerClient::RequestCa
llbacks* callbacks) | 74 void CredentialManagerClient::dispatchGet(bool zeroClickOnly, bool includePasswo
rds, const WebVector<WebURL>& federations, WebCredentialManagerClient::RequestCa
llbacks* callbacks) |
| 75 { | 75 { |
| 76 if (!m_client) | 76 if (!m_client) |
| 77 return; | 77 return; |
| 78 m_client->dispatchGet(zeroClickOnly, includePasswords, federations, callback
s); | 78 m_client->dispatchGet(zeroClickOnly, includePasswords, federations, callback
s); |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace blink | 81 } // namespace blink |
| OLD | NEW |