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 #ifndef ANDROID_WEBVIEW_LIB_BROWSER_DELEGATE_IMPL_H_ | 5 #ifndef ANDROID_WEBVIEW_LIB_BROWSER_DELEGATE_IMPL_H_ |
6 #define ANDROID_WEBVIEW_LIB_BROWSER_DELEGATE_IMPL_H_ | 6 #define ANDROID_WEBVIEW_LIB_BROWSER_DELEGATE_IMPL_H_ |
7 | 7 |
8 #include "android_webview/native/aw_browser_dependency_factory.h" | 8 #include "android_webview/native/aw_browser_dependency_factory.h" |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 |
| 13 namespace net { |
| 14 class URLRequestContextGetter; |
| 15 } |
11 | 16 |
12 namespace android_webview { | 17 namespace android_webview { |
13 | 18 |
| 19 class AwNetworkDelegate; |
| 20 |
14 class AwBrowserDependencyFactoryImpl : public AwBrowserDependencyFactory { | 21 class AwBrowserDependencyFactoryImpl : public AwBrowserDependencyFactory { |
15 public: | 22 public: |
16 AwBrowserDependencyFactoryImpl(); | 23 AwBrowserDependencyFactoryImpl(); |
17 virtual ~AwBrowserDependencyFactoryImpl(); | 24 virtual ~AwBrowserDependencyFactoryImpl(); |
18 | 25 |
19 // Sets this class as the singleton instance. | 26 // Sets this class as the singleton instance. |
20 static void InstallInstance(); | 27 static void InstallInstance(); |
21 | 28 |
22 // AwBrowserDependencyFactory | 29 // AwBrowserDependencyFactory |
| 30 virtual content::BrowserContext* GetBrowserContext(bool incognito) OVERRIDE; |
23 virtual content::WebContents* CreateWebContents(bool incognito) OVERRIDE; | 31 virtual content::WebContents* CreateWebContents(bool incognito) OVERRIDE; |
24 virtual AwContentsContainer* CreateContentsContainer( | 32 virtual AwContentsContainer* CreateContentsContainer( |
25 content::WebContents* contents) OVERRIDE; | 33 content::WebContents* contents) OVERRIDE; |
26 virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator() | 34 virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator() |
27 OVERRIDE; | 35 OVERRIDE; |
28 | 36 |
29 private: | 37 private: |
| 38 void InitializeNetworkDelegateOnIOThread( |
| 39 net::URLRequestContextGetter* normal_context, |
| 40 net::URLRequestContextGetter* incognito_context); |
| 41 void EnsureNetworkDelegateInitialized(); |
| 42 |
| 43 // Constructed and assigned on the IO thread. |
| 44 scoped_ptr<AwNetworkDelegate> network_delegate_; |
| 45 // Set on the UI thread. |
| 46 bool initialized_network_delegate_; |
| 47 |
30 DISALLOW_COPY_AND_ASSIGN(AwBrowserDependencyFactoryImpl); | 48 DISALLOW_COPY_AND_ASSIGN(AwBrowserDependencyFactoryImpl); |
31 }; | 49 }; |
32 | 50 |
33 } // namespace android_webview | 51 } // namespace android_webview |
34 | 52 |
35 #endif // ANDROID_WEBVIEW_LIB_BROWSER_DELEGATE_IMPL_H_ | 53 #endif // ANDROID_WEBVIEW_LIB_BROWSER_DELEGATE_IMPL_H_ |
36 | 54 |
OLD | NEW |