Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / credentialmanager / CredentialManagerClient.h
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
3 // found in the LICENSE file.
4
5 #ifndef CredentialManagerClient_h
6 #define CredentialManagerClient_h
7
8 #include "platform/Supplementable.h"
9 #include "public/platform/WebCredentialManagerClient.h"
10 #include "public/platform/WebVector.h"
11
12 namespace blink {
13
14 class ExecutionContext;
15 class Page;
16 class WebCredential;
17 class WebURL;
18
19 // CredentialManagerClient lives as a supplement to Page, and wraps the embedder-provided
20 // WebCredentialManagerClient's methods to make them visible to the bindings code.
21 class CredentialManagerClient final : public NoBaseWillBeGarbageCollectedFinalized<CredentialManagerClient>, public WillBeHeapSupplement<Page> {
22     WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(CredentialManagerClient);
23 public:
24     explicit CredentialManagerClient(WebCredentialManagerClient*);
25     virtual ~CredentialManagerClient();
26
27     static const char* supplementName();
28     static CredentialManagerClient* from(Page*);
29     static CredentialManagerClient* from(ExecutionContext*);
30
31     // Ownership of the callback is transferred to the callee for each of
32     // the following methods.
33     virtual void dispatchFailedSignIn(const WebCredential&, WebCredentialManagerClient::NotificationCallbacks*);
34     virtual void dispatchSignedIn(const WebCredential&, WebCredentialManagerClient::NotificationCallbacks*);
35     virtual void dispatchSignedOut(WebCredentialManagerClient::NotificationCallbacks*);
36     virtual void dispatchRequest(bool zeroClickOnly, const WebVector<WebURL>& federations, WebCredentialManagerClient::RequestCallbacks*);
37
38 private:
39     WebCredentialManagerClient* m_client;
40 };
41
42 void provideCredentialManagerClientTo(Page&, CredentialManagerClient*);
43
44 } // namespace blink
45
46 #endif // CredentialManagerClient_h