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_MAIN_AW_MAIN_DELEGATE_H_ | 5 #ifndef ANDROID_WEBVIEW_LIB_MAIN_AW_MAIN_DELEGATE_H_ |
6 #define ANDROID_WEBVIEW_LIB_MAIN_AW_MAIN_DELEGATE_H_ | 6 #define ANDROID_WEBVIEW_LIB_MAIN_AW_MAIN_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "android_webview/browser/jni_dependency_factory.h" | |
11 #include "android_webview/common/aw_content_client.h" | 10 #include "android_webview/common/aw_content_client.h" |
12 #include "base/macros.h" | 11 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
14 #include "content/public/app/content_main_delegate.h" | 13 #include "content/public/app/content_main_delegate.h" |
15 | 14 |
16 namespace content { | 15 namespace content { |
17 class BrowserMainRunner; | 16 class BrowserMainRunner; |
18 } | 17 } |
19 | 18 |
20 namespace safe_browsing { | 19 namespace safe_browsing { |
21 class SafeBrowsingApiHandler; | 20 class SafeBrowsingApiHandler; |
22 } | 21 } |
23 | 22 |
24 namespace android_webview { | 23 namespace android_webview { |
25 | 24 |
26 class AwContentBrowserClient; | 25 class AwContentBrowserClient; |
27 class AwContentGpuClient; | 26 class AwContentGpuClient; |
28 class AwContentRendererClient; | 27 class AwContentRendererClient; |
29 | 28 |
30 // Android WebView implementation of ContentMainDelegate. The methods in | 29 // Android WebView implementation of ContentMainDelegate. The methods in |
31 // this class runs per process, (browser and renderer) so when making changes | 30 // this class runs per process, (browser and renderer) so when making changes |
32 // make sure to properly conditionalize for browser vs. renderer wherever | 31 // make sure to properly conditionalize for browser vs. renderer wherever |
33 // needed. | 32 // needed. |
34 class AwMainDelegate : public content::ContentMainDelegate, | 33 class AwMainDelegate : public content::ContentMainDelegate { |
35 public JniDependencyFactory { | |
36 public: | 34 public: |
37 AwMainDelegate(); | 35 AwMainDelegate(); |
38 ~AwMainDelegate() override; | 36 ~AwMainDelegate() override; |
39 | 37 |
40 private: | 38 private: |
41 // content::ContentMainDelegate implementation: | 39 // content::ContentMainDelegate implementation: |
42 bool BasicStartupComplete(int* exit_code) override; | 40 bool BasicStartupComplete(int* exit_code) override; |
43 void PreSandboxStartup() override; | 41 void PreSandboxStartup() override; |
44 int RunProcess( | 42 int RunProcess( |
45 const std::string& process_type, | 43 const std::string& process_type, |
46 const content::MainFunctionParams& main_function_params) override; | 44 const content::MainFunctionParams& main_function_params) override; |
47 void ProcessExiting(const std::string& process_type) override; | 45 void ProcessExiting(const std::string& process_type) override; |
48 content::ContentBrowserClient* CreateContentBrowserClient() override; | 46 content::ContentBrowserClient* CreateContentBrowserClient() override; |
49 content::ContentGpuClient* CreateContentGpuClient() override; | 47 content::ContentGpuClient* CreateContentGpuClient() override; |
50 content::ContentRendererClient* CreateContentRendererClient() override; | 48 content::ContentRendererClient* CreateContentRendererClient() override; |
51 | 49 |
52 // JniDependencyFactory implementation. | |
53 scoped_refptr<AwQuotaManagerBridge> CreateAwQuotaManagerBridge( | |
54 AwBrowserContext* browser_context) override; | |
55 content::WebContentsViewDelegate* CreateViewDelegate( | |
56 content::WebContents* web_contents) override; | |
57 | |
58 std::unique_ptr<content::BrowserMainRunner> browser_runner_; | 50 std::unique_ptr<content::BrowserMainRunner> browser_runner_; |
59 AwContentClient content_client_; | 51 AwContentClient content_client_; |
60 std::unique_ptr<AwContentBrowserClient> content_browser_client_; | 52 std::unique_ptr<AwContentBrowserClient> content_browser_client_; |
61 std::unique_ptr<AwContentGpuClient> content_gpu_client_; | 53 std::unique_ptr<AwContentGpuClient> content_gpu_client_; |
62 std::unique_ptr<AwContentRendererClient> content_renderer_client_; | 54 std::unique_ptr<AwContentRendererClient> content_renderer_client_; |
63 std::unique_ptr<safe_browsing::SafeBrowsingApiHandler> | 55 std::unique_ptr<safe_browsing::SafeBrowsingApiHandler> |
64 safe_browsing_api_handler_; | 56 safe_browsing_api_handler_; |
65 | 57 |
66 DISALLOW_COPY_AND_ASSIGN(AwMainDelegate); | 58 DISALLOW_COPY_AND_ASSIGN(AwMainDelegate); |
67 }; | 59 }; |
68 | 60 |
69 } // namespace android_webview | 61 } // namespace android_webview |
70 | 62 |
71 #endif // ANDROID_WEBVIEW_LIB_MAIN_AW_MAIN_DELEGATE_H_ | 63 #endif // ANDROID_WEBVIEW_LIB_MAIN_AW_MAIN_DELEGATE_H_ |
OLD | NEW |