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_result_codes.h" | 8 #include "android_webview/browser/aw_result_codes.h" |
9 #include "android_webview/native/aw_assets.h" | 9 #include "android_webview/native/aw_assets.h" |
10 #include "base/android/build_info.h" | 10 #include "base/android/build_info.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 int AwBrowserMainParts::PreCreateThreads() { | 49 int AwBrowserMainParts::PreCreateThreads() { |
50 int pak_fd = 0; | 50 int pak_fd = 0; |
51 int64 pak_off = 0; | 51 int64 pak_off = 0; |
52 int64 pak_len = 0; | 52 int64 pak_len = 0; |
53 | 53 |
54 // TODO(primiano, mkosiba): GetApplicationLocale requires a ResourceBundle | 54 // TODO(primiano, mkosiba): GetApplicationLocale requires a ResourceBundle |
55 // instance to be present to work correctly so we call this (knowing it will | 55 // instance to be present to work correctly so we call this (knowing it will |
56 // fail) just to create the ResourceBundle instance. We should refactor | 56 // fail) just to create the ResourceBundle instance. We should refactor |
57 // ResourceBundle/GetApplicationLocale to not require an instance to be | 57 // ResourceBundle/GetApplicationLocale to not require an instance to be |
58 // initialized. | 58 // initialized. |
59 ui::ResourceBundle::InitSharedInstanceLocaleOnly( | 59 ui::ResourceBundle::InitSharedInstanceWithLocale( |
60 l10n_util::GetDefaultLocale(), NULL); | 60 l10n_util::GetDefaultLocale(), |
| 61 NULL, |
| 62 ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); |
61 std::string locale = l10n_util::GetApplicationLocale(std::string()) + ".pak"; | 63 std::string locale = l10n_util::GetApplicationLocale(std::string()) + ".pak"; |
62 if (AwAssets::OpenAsset(locale, &pak_fd, &pak_off, &pak_len)) { | 64 if (AwAssets::OpenAsset(locale, &pak_fd, &pak_off, &pak_len)) { |
63 VLOG(0) << "Load from apk succesful, fd=" << pak_fd << " off=" << pak_off | 65 VLOG(0) << "Load from apk succesful, fd=" << pak_fd << " off=" << pak_off |
64 << " len=" << pak_len; | 66 << " len=" << pak_len; |
65 ui::ResourceBundle::CleanupSharedInstance(); | 67 ui::ResourceBundle::CleanupSharedInstance(); |
66 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( | 68 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( |
67 base::File(pak_fd), base::MemoryMappedFile::Region(pak_off, pak_len)); | 69 base::File(pak_fd), base::MemoryMappedFile::Region(pak_off, pak_len)); |
68 } else { | 70 } else { |
69 LOG(WARNING) << "Failed to load " << locale << ".pak from the apk too. " | 71 LOG(WARNING) << "Failed to load " << locale << ".pak from the apk too. " |
70 "Bringing up WebView without any locale"; | 72 "Bringing up WebView without any locale"; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 content::SetMaxURLChars(20 * 1024 * 1024); | 111 content::SetMaxURLChars(20 * 1024 * 1024); |
110 } | 112 } |
111 | 113 |
112 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { | 114 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { |
113 // Android WebView does not use default MessageLoop. It has its own | 115 // Android WebView does not use default MessageLoop. It has its own |
114 // Android specific MessageLoop. | 116 // Android specific MessageLoop. |
115 return true; | 117 return true; |
116 } | 118 } |
117 | 119 |
118 } // namespace android_webview | 120 } // namespace android_webview |
OLD | NEW |