| 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 "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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 std::string()); | 444 std::string()); |
| 445 PostLoadUrl(url); | 445 PostLoadUrl(url); |
| 446 } | 446 } |
| 447 | 447 |
| 448 void ContentViewCoreImpl::LoadUrlWithUserAgentOverride( | 448 void ContentViewCoreImpl::LoadUrlWithUserAgentOverride( |
| 449 const GURL& url, | 449 const GURL& url, |
| 450 int page_transition, | 450 int page_transition, |
| 451 const std::string& user_agent_override) { | 451 const std::string& user_agent_override) { |
| 452 web_contents()->SetUserAgentOverride(user_agent_override); | 452 web_contents()->SetUserAgentOverride(user_agent_override); |
| 453 bool is_overriding_user_agent(!user_agent_override.empty()); | 453 bool is_overriding_user_agent(!user_agent_override.empty()); |
| 454 content::Referrer referer; | 454 |
| 455 web_contents()->GetController().LoadURLWithUserAgentOverride( | 455 content::NavigationController::LoadURLParams load_url_params(url); |
| 456 url, referer, content::PageTransitionFromInt(page_transition), | 456 load_url_params.transition_type = |
| 457 false, std::string(), is_overriding_user_agent); | 457 content::PageTransitionFromInt(page_transition); |
| 458 load_url_params.override_user_agent = is_overriding_user_agent ? |
| 459 content::NavigationController::UA_OVERRIDE_TRUE : |
| 460 content::NavigationController::UA_OVERRIDE_FALSE; |
| 461 |
| 462 web_contents()->GetController().LoadURLWithParams(load_url_params); |
| 463 |
| 458 PostLoadUrl(url); | 464 PostLoadUrl(url); |
| 459 } | 465 } |
| 460 | 466 |
| 461 void ContentViewCoreImpl::PostLoadUrl(const GURL& url) { | 467 void ContentViewCoreImpl::PostLoadUrl(const GURL& url) { |
| 462 tab_crashed_ = false; | 468 tab_crashed_ = false; |
| 463 // TODO(tedchoc): Update the content view client of the page load request. | 469 // TODO(tedchoc): Update the content view client of the page load request. |
| 464 } | 470 } |
| 465 | 471 |
| 466 // ---------------------------------------------------------------------------- | 472 // ---------------------------------------------------------------------------- |
| 467 // Native JNI methods | 473 // Native JNI methods |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 623 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
| 618 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 624 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
| 619 return false; | 625 return false; |
| 620 } | 626 } |
| 621 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 627 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
| 622 | 628 |
| 623 return RegisterNativesImpl(env) >= 0; | 629 return RegisterNativesImpl(env) >= 0; |
| 624 } | 630 } |
| 625 | 631 |
| 626 } // namespace content | 632 } // namespace content |
| OLD | NEW |