Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: android_webview/browser/aw_browser_main_parts.cc

Issue 628263004: [Android] Simplify logic for grabbing initial country-code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | android_webview/browser/aw_content_browser_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/android/locale_utils.h"
11 #include "base/android/memory_pressure_listener_android.h" 12 #include "base/android/memory_pressure_listener_android.h"
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
14 #include "base/path_service.h" 15 #include "base/path_service.h"
15 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
16 #include "content/public/common/content_client.h" 17 #include "content/public/common/content_client.h"
17 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
18 #include "content/public/common/result_codes.h" 19 #include "content/public/common/result_codes.h"
19 #include "content/public/common/url_utils.h" 20 #include "content/public/common/url_utils.h"
20 #include "gpu/command_buffer/service/mailbox_synchronizer.h" 21 #include "gpu/command_buffer/service/mailbox_synchronizer.h"
21 #include "net/android/network_change_notifier_factory_android.h" 22 #include "net/android/network_change_notifier_factory_android.h"
22 #include "net/base/network_change_notifier.h" 23 #include "net/base/network_change_notifier.h"
23 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/l10n/l10n_util_android.h"
25 #include "ui/base/layout.h" 25 #include "ui/base/layout.h"
26 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
27 #include "ui/base/ui_base_paths.h" 27 #include "ui/base/ui_base_paths.h"
28 28
29 namespace android_webview { 29 namespace android_webview {
30 30
31 AwBrowserMainParts::AwBrowserMainParts(AwBrowserContext* browser_context) 31 AwBrowserMainParts::AwBrowserMainParts(AwBrowserContext* browser_context)
32 : browser_context_(browser_context) { 32 : browser_context_(browser_context) {
33 } 33 }
34 34
(...skipping 15 matching lines...) Expand all
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::InitSharedInstanceWithLocale( 59 ui::ResourceBundle::InitSharedInstanceWithLocale(
60 l10n_util::GetDefaultLocale(), 60 base::android::GetDefaultLocale(),
61 NULL, 61 NULL,
62 ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); 62 ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
63 std::string locale = l10n_util::GetApplicationLocale(std::string()) + ".pak"; 63 std::string locale = l10n_util::GetApplicationLocale(std::string()) + ".pak";
64 if (AwAssets::OpenAsset(locale, &pak_fd, &pak_off, &pak_len)) { 64 if (AwAssets::OpenAsset(locale, &pak_fd, &pak_off, &pak_len)) {
65 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
66 << " len=" << pak_len; 66 << " len=" << pak_len;
67 ui::ResourceBundle::CleanupSharedInstance(); 67 ui::ResourceBundle::CleanupSharedInstance();
68 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( 68 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion(
69 base::File(pak_fd), base::MemoryMappedFile::Region(pak_off, pak_len)); 69 base::File(pak_fd), base::MemoryMappedFile::Region(pak_off, pak_len));
70 } else { 70 } else {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 content::SetMaxURLChars(20 * 1024 * 1024); 111 content::SetMaxURLChars(20 * 1024 * 1024);
112 } 112 }
113 113
114 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { 114 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) {
115 // Android WebView does not use default MessageLoop. It has its own 115 // Android WebView does not use default MessageLoop. It has its own
116 // Android specific MessageLoop. 116 // Android specific MessageLoop.
117 return true; 117 return true;
118 } 118 }
119 119
120 } // namespace android_webview 120 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/aw_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698