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

Side by Side Diff: android_webview/native/aw_contents.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 | « android_webview/native/aw_contents.h ('k') | android_webview/native/aw_locale_manager_impl.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/native/aw_contents.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "android_webview/browser/aw_browser_context.h" 10 #include "android_webview/browser/aw_browser_context.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 namespace android_webview { 100 namespace android_webview {
101 101
102 namespace { 102 namespace {
103 103
104 bool g_should_download_favicons = false; 104 bool g_should_download_favicons = false;
105 105
106 bool g_force_auxiliary_bitmap_rendering = false; 106 bool g_force_auxiliary_bitmap_rendering = false;
107 107
108 std::string g_locale; 108 std::string g_locale;
109 109
110 std::string g_locale_list;
111
110 const void* kAwContentsUserDataKey = &kAwContentsUserDataKey; 112 const void* kAwContentsUserDataKey = &kAwContentsUserDataKey;
111 113
112 class AwContentsUserData : public base::SupportsUserData::Data { 114 class AwContentsUserData : public base::SupportsUserData::Data {
113 public: 115 public:
114 explicit AwContentsUserData(AwContents* ptr) : contents_(ptr) {} 116 explicit AwContentsUserData(AwContents* ptr) : contents_(ptr) {}
115 117
116 static AwContents* GetContents(WebContents* web_contents) { 118 static AwContents* GetContents(WebContents* web_contents) {
117 if (!web_contents) 119 if (!web_contents)
118 return NULL; 120 return NULL;
119 AwContentsUserData* data = static_cast<AwContentsUserData*>( 121 AwContentsUserData* data = static_cast<AwContentsUserData*>(
(...skipping 20 matching lines...) Expand all
140 content::RenderViewHost* rvh = 142 content::RenderViewHost* rvh =
141 content::RenderViewHost::FromID(render_process_id, render_view_id); 143 content::RenderViewHost::FromID(render_process_id, render_view_id);
142 if (!rvh) return NULL; 144 if (!rvh) return NULL;
143 content::WebContents* web_contents = 145 content::WebContents* web_contents =
144 content::WebContents::FromRenderViewHost(rvh); 146 content::WebContents::FromRenderViewHost(rvh);
145 if (!web_contents) return NULL; 147 if (!web_contents) return NULL;
146 return FromWebContents(web_contents); 148 return FromWebContents(web_contents);
147 } 149 }
148 150
149 // static 151 // static
150 void SetLocale(JNIEnv* env, 152 void UpdateDefaultLocale(JNIEnv* env,
151 const JavaParamRef<jclass>&, 153 const JavaParamRef<jclass>&,
152 const JavaParamRef<jstring>& locale) { 154 const JavaParamRef<jstring>& locale,
155 const JavaParamRef<jstring>& locale_list) {
153 g_locale = ConvertJavaStringToUTF8(env, locale); 156 g_locale = ConvertJavaStringToUTF8(env, locale);
157 g_locale_list = ConvertJavaStringToUTF8(env, locale_list);
154 } 158 }
155 159
156 // static 160 // static
157 std::string AwContents::GetLocale() { 161 std::string AwContents::GetLocale() {
158 return g_locale; 162 return g_locale;
159 } 163 }
160 164
161 // static 165 // static
166 std::string AwContents::GetLocaleList() {
167 return g_locale_list;
168 }
169
170 // static
162 AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID( 171 AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID(
163 int render_process_id, int render_frame_id) { 172 int render_process_id, int render_frame_id) {
164 AwContents* aw_contents = AwContents::FromWebContents( 173 AwContents* aw_contents = AwContents::FromWebContents(
165 content::WebContents::FromRenderFrameHost( 174 content::WebContents::FromRenderFrameHost(
166 content::RenderFrameHost::FromID(render_process_id, 175 content::RenderFrameHost::FromID(render_process_id,
167 render_frame_id))); 176 render_frame_id)));
168 return aw_contents; 177 return aw_contents;
169 } 178 }
170 179
171 AwContents::AwContents(std::unique_ptr<WebContents> web_contents) 180 AwContents::AwContents(std::unique_ptr<WebContents> web_contents)
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 int routing_id = new_host->GetRoutingID(); 1270 int routing_id = new_host->GetRoutingID();
1262 // At this point, the current RVH may or may not contain a compositor. So 1271 // At this point, the current RVH may or may not contain a compositor. So
1263 // compositor_ may be nullptr, in which case 1272 // compositor_ may be nullptr, in which case
1264 // BrowserViewRenderer::DidInitializeCompositor() callback is time when the 1273 // BrowserViewRenderer::DidInitializeCompositor() callback is time when the
1265 // new compositor is constructed. 1274 // new compositor is constructed.
1266 browser_view_renderer_.SetActiveCompositorID( 1275 browser_view_renderer_.SetActiveCompositorID(
1267 CompositorID(process_id, routing_id)); 1276 CompositorID(process_id, routing_id));
1268 } 1277 }
1269 1278
1270 } // namespace android_webview 1279 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | android_webview/native/aw_locale_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698