Chromium Code Reviews| Index: components/webauth/authenticator_web_contents_manager.h |
| diff --git a/components/webauth/authenticator_web_contents_manager.h b/components/webauth/authenticator_web_contents_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..19066fe97bba24771609929016cc5a35633dbbf7 |
| --- /dev/null |
| +++ b/components/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 COMPONENTS_WEBAUTH_AUTHENTICATOR_WEB_CONTENTS_MANAGER_H_ |
| +#define COMPONENTS_WEBAUTH_AUTHENTICATOR_WEB_CONTENTS_MANAGER_H_ |
| + |
| +#include <memory> |
| + |
| +#include "base/macros.h" |
| +#include "content/public/browser/web_contents_user_data.h" |
| +#include "mojo/public/cpp/bindings/interface_request.h" |
| +#include "public/platform/modules/webauth/authenticator.mojom.h" |
|
jam
2017/06/27 13:52:17
nit: preface include with third_party/WebKit
|
| + |
| +// 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 // COMPONENTS_WEBAUTH_AUTHENTICATOR_WEB_CONTENTS_MANAGER_H_ |