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/main/aw_main_delegate.h" | 5 #include "android_webview/lib/main/aw_main_delegate.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "android_webview/browser/aw_content_browser_client.h" | 9 #include "android_webview/browser/aw_content_browser_client.h" |
10 #include "android_webview/browser/browser_view_renderer.h" | 10 #include "android_webview/browser/browser_view_renderer.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 std::string process_type = | 152 std::string process_type = |
153 command_line.GetSwitchValueASCII(switches::kProcessType); | 153 command_line.GetSwitchValueASCII(switches::kProcessType); |
154 int crash_signal_fd = -1; | 154 int crash_signal_fd = -1; |
155 if (process_type == switches::kRendererProcess) { | 155 if (process_type == switches::kRendererProcess) { |
156 auto* global_descriptors = base::GlobalDescriptors::GetInstance(); | 156 auto* global_descriptors = base::GlobalDescriptors::GetInstance(); |
157 int pak_fd = global_descriptors->Get(kAndroidWebViewLocalePakDescriptor); | 157 int pak_fd = global_descriptors->Get(kAndroidWebViewLocalePakDescriptor); |
158 base::MemoryMappedFile::Region pak_region = | 158 base::MemoryMappedFile::Region pak_region = |
159 global_descriptors->GetRegion(kAndroidWebViewLocalePakDescriptor); | 159 global_descriptors->GetRegion(kAndroidWebViewLocalePakDescriptor); |
160 ResourceBundle::InitSharedInstanceWithPakFileRegion(base::File(pak_fd), | 160 ResourceBundle::InitSharedInstanceWithPakFileRegion(base::File(pak_fd), |
161 pak_region); | 161 pak_region); |
162 pak_fd = global_descriptors->Get(kAndroidWebViewMainPakDescriptor); | 162 |
163 pak_region = | 163 std::pair<int, ui::ScaleFactor> extra_paks[] = { |
164 global_descriptors->GetRegion(kAndroidWebViewMainPakDescriptor); | 164 {kAndroidWebViewMainPakDescriptor, ui::SCALE_FACTOR_NONE}, |
165 ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( | 165 {kAndroidWebView100PercentPakDescriptor, ui::SCALE_FACTOR_100P}}; |
166 base::File(pak_fd), pak_region, ui::SCALE_FACTOR_NONE); | 166 |
| 167 for (const auto& pak_info : extra_paks) { |
| 168 pak_fd = global_descriptors->Get(pak_info.first); |
| 169 pak_region = global_descriptors->GetRegion(pak_info.first); |
| 170 ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( |
| 171 base::File(pak_fd), pak_region, pak_info.second); |
| 172 } |
| 173 |
167 crash_signal_fd = | 174 crash_signal_fd = |
168 global_descriptors->Get(kAndroidWebViewCrashSignalDescriptor); | 175 global_descriptors->Get(kAndroidWebViewCrashSignalDescriptor); |
169 } | 176 } |
170 if (process_type.empty()) { | 177 if (process_type.empty()) { |
171 if (command_line.HasSwitch(switches::kSingleProcess)) { | 178 if (command_line.HasSwitch(switches::kSingleProcess)) { |
172 process_type = breakpad::kWebViewSingleProcessType; | 179 process_type = breakpad::kWebViewSingleProcessType; |
173 } else { | 180 } else { |
174 process_type = breakpad::kBrowserProcessType; | 181 process_type = breakpad::kBrowserProcessType; |
175 } | 182 } |
176 } | 183 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 259 |
253 AwMessagePortService* AwMainDelegate::CreateAwMessagePortService() { | 260 AwMessagePortService* AwMainDelegate::CreateAwMessagePortService() { |
254 return new AwMessagePortServiceImpl(); | 261 return new AwMessagePortServiceImpl(); |
255 } | 262 } |
256 | 263 |
257 AwLocaleManager* AwMainDelegate::CreateAwLocaleManager() { | 264 AwLocaleManager* AwMainDelegate::CreateAwLocaleManager() { |
258 return new AwLocaleManagerImpl(); | 265 return new AwLocaleManagerImpl(); |
259 } | 266 } |
260 | 267 |
261 } // namespace android_webview | 268 } // namespace android_webview |
OLD | NEW |