| 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_content_browser_client.h" |
| 9 #include "android_webview/browser/aw_result_codes.h" | 9 #include "android_webview/browser/aw_result_codes.h" |
| 10 #include "android_webview/browser/deferred_gpu_command_service.h" | 10 #include "android_webview/browser/deferred_gpu_command_service.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "content/public/browser/render_frame_host.h" | 24 #include "content/public/browser/render_frame_host.h" |
| 25 #include "content/public/browser/render_process_host.h" | 25 #include "content/public/browser/render_process_host.h" |
| 26 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
| 27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "content/public/common/result_codes.h" | 28 #include "content/public/common/result_codes.h" |
| 29 #include "device/geolocation/access_token_store.h" | 29 #include "device/geolocation/access_token_store.h" |
| 30 #include "device/geolocation/geolocation_delegate.h" | 30 #include "device/geolocation/geolocation_delegate.h" |
| 31 #include "device/geolocation/geolocation_provider.h" | 31 #include "device/geolocation/geolocation_provider.h" |
| 32 #include "net/android/network_change_notifier_factory_android.h" | 32 #include "net/android/network_change_notifier_factory_android.h" |
| 33 #include "net/base/network_change_notifier.h" | 33 #include "net/base/network_change_notifier.h" |
| 34 #include "ui/android/screen_android.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
| 35 #include "ui/base/layout.h" | 36 #include "ui/base/layout.h" |
| 36 #include "ui/base/resource/resource_bundle.h" | 37 #include "ui/base/resource/resource_bundle.h" |
| 37 #include "ui/base/resource/resource_bundle_android.h" | 38 #include "ui/base/resource/resource_bundle_android.h" |
| 38 #include "ui/base/ui_base_paths.h" | 39 #include "ui/base/ui_base_paths.h" |
| 40 #include "ui/display/screen.h" |
| 39 #include "ui/gl/gl_surface.h" | 41 #include "ui/gl/gl_surface.h" |
| 40 | 42 |
| 41 namespace android_webview { | 43 namespace android_webview { |
| 42 namespace { | 44 namespace { |
| 43 | 45 |
| 44 class AwAccessTokenStore : public device::AccessTokenStore { | 46 class AwAccessTokenStore : public device::AccessTokenStore { |
| 45 public: | 47 public: |
| 46 AwAccessTokenStore() { } | 48 AwAccessTokenStore() { } |
| 47 | 49 |
| 48 // device::AccessTokenStore implementation | 50 // device::AccessTokenStore implementation |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 115 |
| 114 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback( | 116 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback( |
| 115 base::android::AttachCurrentThread()); | 117 base::android::AttachCurrentThread()); |
| 116 DeferredGpuCommandService::SetInstance(); | 118 DeferredGpuCommandService::SetInstance(); |
| 117 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 119 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 118 switches::kSingleProcess)) { | 120 switches::kSingleProcess)) { |
| 119 // Create the renderers crash manager on the UI thread. | 121 // Create the renderers crash manager on the UI thread. |
| 120 breakpad::CrashMicroDumpManager::GetInstance(); | 122 breakpad::CrashMicroDumpManager::GetInstance(); |
| 121 } | 123 } |
| 122 | 124 |
| 125 display::Screen::SetScreenInstance(ui::CreateScreenAndroid()); |
| 126 |
| 123 return content::RESULT_CODE_NORMAL_EXIT; | 127 return content::RESULT_CODE_NORMAL_EXIT; |
| 124 } | 128 } |
| 125 | 129 |
| 126 void AwBrowserMainParts::PreMainMessageLoopRun() { | 130 void AwBrowserMainParts::PreMainMessageLoopRun() { |
| 127 browser_client_->InitBrowserContext()->PreMainMessageLoopRun(); | 131 browser_client_->InitBrowserContext()->PreMainMessageLoopRun(); |
| 128 | 132 |
| 129 device::GeolocationProvider::SetGeolocationDelegate( | 133 device::GeolocationProvider::SetGeolocationDelegate( |
| 130 new AwGeolocationDelegate()); | 134 new AwGeolocationDelegate()); |
| 131 | 135 |
| 132 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); | 136 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); |
| 133 } | 137 } |
| 134 | 138 |
| 135 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { | 139 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { |
| 136 // Android WebView does not use default MessageLoop. It has its own | 140 // Android WebView does not use default MessageLoop. It has its own |
| 137 // Android specific MessageLoop. | 141 // Android specific MessageLoop. |
| 138 return true; | 142 return true; |
| 139 } | 143 } |
| 140 | 144 |
| 141 } // namespace android_webview | 145 } // namespace android_webview |
| OLD | NEW |