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 #include "chrome/browser/webauth/authenticator_web_contents_manager.h" |
| 6 |
| 7 #include <utility> |
| 8 |
| 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" |
| 11 #include "components/webauth/authenticator_impl.h" |
| 12 #include "content/public/browser/web_contents.h" |
| 13 |
| 14 DEFINE_WEB_CONTENTS_USER_DATA_KEY(AuthenticatorWebContentsManager); |
| 15 |
| 16 AuthenticatorWebContentsManager::~AuthenticatorWebContentsManager() {} |
| 17 |
| 18 AuthenticatorWebContentsManager* |
| 19 AuthenticatorWebContentsManager::GetOrCreateForWebContents( |
| 20 content::WebContents* web_contents) { |
| 21 DCHECK(web_contents); |
| 22 // Does nothing if the manager instance already exists. |
| 23 AuthenticatorWebContentsManager* manager = FromWebContents(web_contents); |
| 24 if (!manager) { |
| 25 CreateForWebContents(web_contents); |
| 26 manager = FromWebContents(web_contents); |
| 27 } |
| 28 return manager; |
| 29 } |
| 30 |
| 31 void AuthenticatorWebContentsManager::CreateAuthenticator( |
| 32 content::RenderFrameHost* render_frame_host, |
| 33 mojo::InterfaceRequest<webauth::mojom::Authenticator> request) { |
| 34 webauth::AuthenticatorImpl::Create(render_frame_host, std::move(request)); |
| 35 } |
| 36 |
| 37 AuthenticatorWebContentsManager::AuthenticatorWebContentsManager( |
| 38 content::WebContents* web_contents) {} |
OLD | NEW |