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/browser/aw_browser_main_parts.h" | 5 #include "android_webview/browser/aw_browser_main_parts.h" |
6 | 6 |
7 #include "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
| 8 #include "android_webview/browser/aw_content_browser_client.h" |
8 #include "android_webview/browser/aw_dev_tools_discovery_provider.h" | 9 #include "android_webview/browser/aw_dev_tools_discovery_provider.h" |
9 #include "android_webview/browser/aw_result_codes.h" | 10 #include "android_webview/browser/aw_result_codes.h" |
10 #include "android_webview/browser/deferred_gpu_command_service.h" | 11 #include "android_webview/browser/deferred_gpu_command_service.h" |
11 #include "android_webview/browser/net/aw_network_change_notifier_factory.h" | 12 #include "android_webview/browser/net/aw_network_change_notifier_factory.h" |
12 #include "android_webview/common/aw_resource.h" | 13 #include "android_webview/common/aw_resource.h" |
13 #include "android_webview/common/aw_switches.h" | 14 #include "android_webview/common/aw_switches.h" |
14 #include "base/android/apk_assets.h" | 15 #include "base/android/apk_assets.h" |
15 #include "base/android/build_info.h" | 16 #include "base/android/build_info.h" |
16 #include "base/android/locale_utils.h" | 17 #include "base/android/locale_utils.h" |
17 #include "base/android/memory_pressure_listener_android.h" | 18 #include "base/android/memory_pressure_listener_android.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 scoped_refptr<device::AccessTokenStore> CreateAccessTokenStore() final { | 70 scoped_refptr<device::AccessTokenStore> CreateAccessTokenStore() final { |
70 return new AwAccessTokenStore(); | 71 return new AwAccessTokenStore(); |
71 } | 72 } |
72 | 73 |
73 private: | 74 private: |
74 DISALLOW_COPY_AND_ASSIGN(AwGeolocationDelegate); | 75 DISALLOW_COPY_AND_ASSIGN(AwGeolocationDelegate); |
75 }; | 76 }; |
76 | 77 |
77 } // anonymous namespace | 78 } // anonymous namespace |
78 | 79 |
79 AwBrowserMainParts::AwBrowserMainParts(AwBrowserContext* browser_context) | 80 AwBrowserMainParts::AwBrowserMainParts(AwContentBrowserClient* browser_client) |
80 : browser_context_(browser_context) { | 81 : browser_client_(browser_client) { |
81 } | 82 } |
82 | 83 |
83 AwBrowserMainParts::~AwBrowserMainParts() { | 84 AwBrowserMainParts::~AwBrowserMainParts() { |
84 } | 85 } |
85 | 86 |
86 void AwBrowserMainParts::PreEarlyInitialization() { | 87 void AwBrowserMainParts::PreEarlyInitialization() { |
87 net::NetworkChangeNotifier::SetFactory(new AwNetworkChangeNotifierFactory()); | 88 net::NetworkChangeNotifier::SetFactory(new AwNetworkChangeNotifierFactory()); |
88 | 89 |
89 // Android WebView does not use default MessageLoop. It has its own | 90 // Android WebView does not use default MessageLoop. It has its own |
90 // Android specific MessageLoop. Also see MainMessageLoopRun. | 91 // Android specific MessageLoop. Also see MainMessageLoopRun. |
(...skipping 27 matching lines...) Expand all Loading... |
118 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 119 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
119 switches::kSingleProcess)) { | 120 switches::kSingleProcess)) { |
120 // Create the renderers crash manager on the UI thread. | 121 // Create the renderers crash manager on the UI thread. |
121 breakpad::CrashMicroDumpManager::GetInstance(); | 122 breakpad::CrashMicroDumpManager::GetInstance(); |
122 } | 123 } |
123 | 124 |
124 return content::RESULT_CODE_NORMAL_EXIT; | 125 return content::RESULT_CODE_NORMAL_EXIT; |
125 } | 126 } |
126 | 127 |
127 void AwBrowserMainParts::PreMainMessageLoopRun() { | 128 void AwBrowserMainParts::PreMainMessageLoopRun() { |
128 browser_context_->PreMainMessageLoopRun(); | 129 browser_client_->InitBrowserContext()->PreMainMessageLoopRun(); |
129 | 130 |
130 device::GeolocationProvider::SetGeolocationDelegate( | 131 device::GeolocationProvider::SetGeolocationDelegate( |
131 new AwGeolocationDelegate()); | 132 new AwGeolocationDelegate()); |
132 | 133 |
133 AwDevToolsDiscoveryProvider::Install(); | 134 AwDevToolsDiscoveryProvider::Install(); |
134 | 135 |
135 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); | 136 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); |
136 } | 137 } |
137 | 138 |
138 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { | 139 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { |
139 // Android WebView does not use default MessageLoop. It has its own | 140 // Android WebView does not use default MessageLoop. It has its own |
140 // Android specific MessageLoop. | 141 // Android specific MessageLoop. |
141 return true; | 142 return true; |
142 } | 143 } |
143 | 144 |
144 } // namespace android_webview | 145 } // namespace android_webview |
OLD | NEW |