Index: chrome/browser/webauth/authenticator_web_contents_manager.h |
diff --git a/chrome/browser/webauth/authenticator_web_contents_manager.h b/chrome/browser/webauth/authenticator_web_contents_manager.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..57e73ec5100d9c72937adfb208ff2288772c8c2f |
--- /dev/null |
+++ b/chrome/browser/webauth/authenticator_web_contents_manager.h |
@@ -0,0 +1,40 @@ |
+// Copyright 2017 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. |
+ |
+#ifndef CHROME_BROWSER_WEBAUTH_AUTHENTICATOR_WEB_CONTENTS_MANAGER_H_ |
+#define CHROME_BROWSER_WEBAUTH_AUTHENTICATOR_WEB_CONTENTS_MANAGER_H_ |
+ |
+#include <memory> |
+ |
+#include "base/macros.h" |
+#include "components/webauth/authenticator.mojom.h" |
+#include "content/public/browser/web_contents_user_data.h" |
+#include "mojo/public/cpp/bindings/interface_request.h" |
+ |
+// This class owns the Authenticator associated with a given WebContents. |
+// The Authenticator is destroyed when the WebContents goes away. |
+class AuthenticatorWebContentsManager |
+ : public content::WebContentsUserData<AuthenticatorWebContentsManager> { |
+ public: |
+ ~AuthenticatorWebContentsManager() override; |
+ |
+ // Retrieves the instance of AuthenticatorWebContentsManager that was |
+ // attached to the specified WebContents. If no instance was attached, |
+ // creates one, and attaches it to the specified WebContents. |
+ static AuthenticatorWebContentsManager* GetOrCreateForWebContents( |
+ content::WebContents* web_contents); |
+ |
+ // Creates the Authenticator that will interact with this |web_contents|. |
+ void CreateAuthenticator( |
+ content::RenderFrameHost* render_frame_host, |
+ mojo::InterfaceRequest<webauth::mojom::Authenticator> authenticator); |
+ |
+ private: |
+ explicit AuthenticatorWebContentsManager(content::WebContents* web_contents); |
+ friend class content::WebContentsUserData<AuthenticatorWebContentsManager>; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AuthenticatorWebContentsManager); |
+}; |
+ |
+#endif // CHROME_BROWSER_WEBAUTH_AUTHENTICATOR_WEB_CONTENTS_MANAGER_H_ |