| 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 std::string()); | 408 std::string()); |
| 409 PostLoadUrl(url); | 409 PostLoadUrl(url); |
| 410 } | 410 } |
| 411 | 411 |
| 412 void ContentViewCoreImpl::LoadUrlWithUserAgentOverride( | 412 void ContentViewCoreImpl::LoadUrlWithUserAgentOverride( |
| 413 const GURL& url, | 413 const GURL& url, |
| 414 int page_transition, | 414 int page_transition, |
| 415 const std::string& user_agent_override) { | 415 const std::string& user_agent_override) { |
| 416 web_contents()->SetUserAgentOverride(user_agent_override); | 416 web_contents()->SetUserAgentOverride(user_agent_override); |
| 417 bool is_overriding_user_agent(!user_agent_override.empty()); | 417 bool is_overriding_user_agent(!user_agent_override.empty()); |
| 418 content::Referrer referer; | 418 |
| 419 web_contents()->GetController().LoadURLWithUserAgentOverride( | 419 content::NavigationController::LoadURLParams load_url_params(url); |
| 420 url, referer, content::PageTransitionFromInt(page_transition), | 420 load_url_params.transition_type = |
| 421 false, std::string(), is_overriding_user_agent); | 421 content::PageTransitionFromInt(page_transition); |
| 422 load_url_params.override_user_agent = is_overriding_user_agent ? |
| 423 content::NavigationController::UA_OVERRIDE_TRUE : |
| 424 content::NavigationController::UA_OVERRIDE_FALSE; |
| 425 |
| 426 web_contents()->GetController().LoadURLWithParams(load_url_params); |
| 427 |
| 422 PostLoadUrl(url); | 428 PostLoadUrl(url); |
| 423 } | 429 } |
| 424 | 430 |
| 425 void ContentViewCoreImpl::PostLoadUrl(const GURL& url) { | 431 void ContentViewCoreImpl::PostLoadUrl(const GURL& url) { |
| 426 tab_crashed_ = false; | 432 tab_crashed_ = false; |
| 427 // TODO(tedchoc): Update the content view client of the page load request. | 433 // TODO(tedchoc): Update the content view client of the page load request. |
| 428 } | 434 } |
| 429 | 435 |
| 430 // ---------------------------------------------------------------------------- | 436 // ---------------------------------------------------------------------------- |
| 431 // Native JNI methods | 437 // Native JNI methods |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 592 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
| 587 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 593 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
| 588 return false; | 594 return false; |
| 589 } | 595 } |
| 590 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 596 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
| 591 | 597 |
| 592 return RegisterNativesImpl(env) >= 0; | 598 return RegisterNativesImpl(env) >= 0; |
| 593 } | 599 } |
| 594 | 600 |
| 595 } // namespace content | 601 } // namespace content |
| OLD | NEW |