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

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

Issue 2496183002: Use GetDefaultLocaleListString for returning LocaleList (Closed)
Patch Set: change locales to localelist in AWContents.java Created 4 years, 1 month 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_locale_manager.h » ('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_content_browser_client.h" 5 #include "android_webview/browser/aw_content_browser_client.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_browser_main_parts.h" 10 #include "android_webview/browser/aw_browser_main_parts.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void AwContentsMessageFilter::OnSubFrameCreated(int parent_render_frame_id, 151 void AwContentsMessageFilter::OnSubFrameCreated(int parent_render_frame_id,
152 int child_render_frame_id) { 152 int child_render_frame_id) {
153 AwContentsIoThreadClient::SubFrameCreated( 153 AwContentsIoThreadClient::SubFrameCreated(
154 process_id_, parent_render_frame_id, child_render_frame_id); 154 process_id_, parent_render_frame_id, child_render_frame_id);
155 } 155 }
156 156
157 AwLocaleManager* g_locale_manager = NULL; 157 AwLocaleManager* g_locale_manager = NULL;
158 158
159 } // anonymous namespace 159 } // anonymous namespace
160 160
161 // TODO(yirui): can use similar logic as in PrependToAcceptLanguagesIfNecessary
162 // in chrome/browser/android/preferences/pref_service_bridge.cc
161 // static 163 // static
162 std::string AwContentBrowserClient::GetAcceptLangsImpl() { 164 std::string AwContentBrowserClient::GetAcceptLangsImpl() {
163 // Start with the current locale. 165 // Start with the current locale(s) in BCP47 format.
164 std::string langs = g_locale_manager->GetLocale(); 166 std::string locales_string = g_locale_manager->GetLocaleList();
165 167
166 // If we're not en-US, add in en-US which will be 168 // If accept languages do not contain en-US, add in en-US which will be
167 // used with a lower q-value. 169 // used with a lower q-value.
168 if (base::ToLowerASCII(langs) != "en-us") { 170 if (locales_string.find("en-US") == std::string::npos)
169 langs += ",en-US"; 171 locales_string += ",en-US";
170 } 172 return locales_string;
171 return langs;
172 } 173 }
173 174
174 // static 175 // static
175 AwBrowserContext* AwContentBrowserClient::GetAwBrowserContext() { 176 AwBrowserContext* AwContentBrowserClient::GetAwBrowserContext() {
176 return AwBrowserContext::GetDefault(); 177 return AwBrowserContext::GetDefault();
177 } 178 }
178 179
179 AwContentBrowserClient::AwContentBrowserClient( 180 AwContentBrowserClient::AwContentBrowserClient(
180 JniDependencyFactory* native_factory) 181 JniDependencyFactory* native_factory)
181 : native_factory_(native_factory) { 182 : native_factory_(native_factory) {
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 if (id == -1) 535 if (id == -1)
535 return nullptr; 536 return nullptr;
536 537
537 base::StringPiece manifest_contents = 538 base::StringPiece manifest_contents =
538 ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( 539 ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
539 id, ui::ScaleFactor::SCALE_FACTOR_NONE); 540 id, ui::ScaleFactor::SCALE_FACTOR_NONE);
540 return base::JSONReader::Read(manifest_contents); 541 return base::JSONReader::Read(manifest_contents);
541 } 542 }
542 543
543 } // namespace android_webview 544 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/aw_locale_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698