Chromium Code Reviews| 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..a4a7c487f827b630419435a41f3dd542762b23d3 |
| --- /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 get destroyed when the WebContents goes away. |
|
Mike West
2017/06/13 21:11:22
Tiny nit: s/get/is/
kpaulhamus
2017/06/15 01:27:13
Done.
|
| +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_ |