OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "android_webview/lib/aw_browser_dependency_factory_impl.h" | 5 #include "android_webview/lib/aw_browser_dependency_factory_impl.h" |
6 | 6 |
7 #include "android_webview/browser/aw_content_browser_client.h" | 7 #include "android_webview/browser/aw_content_browser_client.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "content/public/browser/content_browser_client.h" | 9 #include "content/public/browser/content_browser_client.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
11 #include "content/public/common/content_client.h" | 11 #include "content/public/common/content_client.h" |
12 | 12 |
13 using content::BrowserContext; | 13 using content::BrowserContext; |
14 using content::WebContents; | 14 using content::WebContents; |
15 | 15 |
16 namespace android_webview { | 16 namespace android_webview { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 base::LazyInstance<AwBrowserDependencyFactoryImpl>::Leaky g_lazy_instance; | 20 base::LazyInstance<AwBrowserDependencyFactoryImpl>::Leaky g_lazy_instance; |
21 | 21 |
22 } // namespace | 22 } // namespace |
23 | 23 |
24 AwBrowserDependencyFactoryImpl::AwBrowserDependencyFactoryImpl() { | 24 AwBrowserDependencyFactoryImpl::AwBrowserDependencyFactoryImpl() {} |
25 } | |
26 | 25 |
27 AwBrowserDependencyFactoryImpl::~AwBrowserDependencyFactoryImpl() {} | 26 AwBrowserDependencyFactoryImpl::~AwBrowserDependencyFactoryImpl() {} |
28 | 27 |
29 // static | 28 // static |
30 void AwBrowserDependencyFactoryImpl::InstallInstance() { | 29 void AwBrowserDependencyFactoryImpl::InstallInstance() { |
31 SetInstance(g_lazy_instance.Pointer()); | 30 SetInstance(g_lazy_instance.Pointer()); |
32 } | 31 } |
33 | 32 |
34 content::BrowserContext* AwBrowserDependencyFactoryImpl::GetBrowserContext( | 33 content::BrowserContext* AwBrowserDependencyFactoryImpl::GetBrowserContext() { |
35 bool incognito) { | |
36 // TODO(boliu): Remove incognito parameter. | |
37 LOG_IF(ERROR, incognito) << "Android WebView does not support incognito mode" | |
38 << " yet. Creating normal profile instead."; | |
39 return static_cast<AwContentBrowserClient*>( | 34 return static_cast<AwContentBrowserClient*>( |
40 content::GetContentClient()->browser())->GetAwBrowserContext(); | 35 content::GetContentClient()->browser())->GetAwBrowserContext(); |
41 } | 36 } |
42 | 37 |
43 WebContents* AwBrowserDependencyFactoryImpl::CreateWebContents(bool incognito) { | 38 WebContents* AwBrowserDependencyFactoryImpl::CreateWebContents() { |
44 return content::WebContents::Create( | 39 return content::WebContents::Create( |
45 content::WebContents::CreateParams(GetBrowserContext(incognito))); | 40 content::WebContents::CreateParams(GetBrowserContext())); |
46 } | 41 } |
47 | 42 |
48 } // namespace android_webview | 43 } // namespace android_webview |
OLD | NEW |