OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 CHROME_BROWSER_WEBAUTH_AUTHENTICATOR_WEB_CONTENTS_MANAGER_H_ |
| 6 #define CHROME_BROWSER_WEBAUTH_AUTHENTICATOR_WEB_CONTENTS_MANAGER_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "components/webauth/authenticator.mojom.h" |
| 12 #include "content/public/browser/web_contents_user_data.h" |
| 13 #include "mojo/public/cpp/bindings/interface_request.h" |
| 14 |
| 15 // This class owns the Authenticator associated with a given WebContents. |
| 16 // The Authenticator is destroyed when the WebContents goes away. |
| 17 class AuthenticatorWebContentsManager |
| 18 : public content::WebContentsUserData<AuthenticatorWebContentsManager> { |
| 19 public: |
| 20 ~AuthenticatorWebContentsManager() override; |
| 21 |
| 22 // Retrieves the instance of AuthenticatorWebContentsManager that was |
| 23 // attached to the specified WebContents. If no instance was attached, |
| 24 // creates one, and attaches it to the specified WebContents. |
| 25 static AuthenticatorWebContentsManager* GetOrCreateForWebContents( |
| 26 content::WebContents* web_contents); |
| 27 |
| 28 // Creates the Authenticator that will interact with this |web_contents|. |
| 29 void CreateAuthenticator( |
| 30 content::RenderFrameHost* render_frame_host, |
| 31 mojo::InterfaceRequest<webauth::mojom::Authenticator> authenticator); |
| 32 |
| 33 private: |
| 34 explicit AuthenticatorWebContentsManager(content::WebContents* web_contents); |
| 35 friend class content::WebContentsUserData<AuthenticatorWebContentsManager>; |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(AuthenticatorWebContentsManager); |
| 38 }; |
| 39 |
| 40 #endif // CHROME_BROWSER_WEBAUTH_AUTHENTICATOR_WEB_CONTENTS_MANAGER_H_ |
OLD | NEW |