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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 772123002: [Android] Java Bridge: handle requests from Java Script on the background thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add the filter in more places, and make sure that the channel is present Created 6 years 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
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 "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // Currently, the only use case we have for overriding a user agent involves 241 // Currently, the only use case we have for overriding a user agent involves
242 // spoofing a desktop Linux user agent for "Request desktop site". 242 // spoofing a desktop Linux user agent for "Request desktop site".
243 // Automatically set it for all WebContents so that it is available when a 243 // Automatically set it for all WebContents so that it is available when a
244 // NavigationEntry requires the user agent to be overridden. 244 // NavigationEntry requires the user agent to be overridden.
245 const char kLinuxInfoStr[] = "X11; Linux x86_64"; 245 const char kLinuxInfoStr[] = "X11; Linux x86_64";
246 std::string product = content::GetContentClient()->GetProduct(); 246 std::string product = content::GetContentClient()->GetProduct();
247 std::string spoofed_ua = 247 std::string spoofed_ua =
248 BuildUserAgentFromOSAndProduct(kLinuxInfoStr, product); 248 BuildUserAgentFromOSAndProduct(kLinuxInfoStr, product);
249 web_contents->SetUserAgentOverride(spoofed_ua); 249 web_contents->SetUserAgentOverride(spoofed_ua);
250 250
251 java_bridge_dispatcher_host_.reset( 251 java_bridge_dispatcher_host_ =
252 new GinJavaBridgeDispatcherHost(web_contents, 252 new GinJavaBridgeDispatcherHost(web_contents,
253 java_bridge_retained_object_set)); 253 java_bridge_retained_object_set);
254 254
255 InitWebContents(); 255 InitWebContents();
256 } 256 }
257 257
258 ContentViewCoreImpl::~ContentViewCoreImpl() { 258 ContentViewCoreImpl::~ContentViewCoreImpl() {
259 JNIEnv* env = base::android::AttachCurrentThread(); 259 JNIEnv* env = base::android::AttachCurrentThread();
260 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 260 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
261 java_ref_.reset(); 261 java_ref_.reset();
262 if (!j_obj.is_null()) { 262 if (!j_obj.is_null()) {
263 Java_ContentViewCore_onNativeContentViewCoreDestroyed( 263 Java_ContentViewCore_onNativeContentViewCoreDestroyed(
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 reinterpret_cast<ui::WindowAndroid*>(window_android), 1338 reinterpret_cast<ui::WindowAndroid*>(window_android),
1339 retained_objects_set); 1339 retained_objects_set);
1340 return reinterpret_cast<intptr_t>(view); 1340 return reinterpret_cast<intptr_t>(view);
1341 } 1341 }
1342 1342
1343 bool RegisterContentViewCore(JNIEnv* env) { 1343 bool RegisterContentViewCore(JNIEnv* env) {
1344 return RegisterNativesImpl(env); 1344 return RegisterNativesImpl(env);
1345 } 1345 }
1346 1346
1347 } // namespace content 1347 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698