OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/navigation_controller_android.h" | 5 #include "content/browser/frame_host/navigation_controller_android.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
12 #include "content/browser/frame_host/navigation_entry_impl.h" | 12 #include "content/browser/frame_host/navigation_entry_impl.h" |
13 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
14 #include "content/public/browser/navigation_controller.h" | 14 #include "content/public/browser/navigation_controller.h" |
| 15 #include "content/public/browser/render_view_host.h" |
15 #include "content/public/browser/ssl_host_state_delegate.h" | 16 #include "content/public/browser/ssl_host_state_delegate.h" |
16 #include "jni/NavigationControllerImpl_jni.h" | 17 #include "jni/NavigationControllerImpl_jni.h" |
17 #include "net/base/data_url.h" | 18 #include "net/base/data_url.h" |
18 #include "ui/gfx/android/java_bitmap.h" | 19 #include "ui/gfx/android/java_bitmap.h" |
19 | 20 |
20 using base::android::AttachCurrentThread; | 21 using base::android::AttachCurrentThread; |
21 using base::android::ConvertJavaStringToUTF16; | 22 using base::android::ConvertJavaStringToUTF16; |
22 using base::android::ConvertJavaStringToUTF8; | 23 using base::android::ConvertJavaStringToUTF8; |
23 using base::android::ConvertUTF16ToJavaString; | 24 using base::android::ConvertUTF16ToJavaString; |
24 using base::android::ConvertUTF8ToJavaString; | 25 using base::android::ConvertUTF8ToJavaString; |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 if (GetUseDesktopUserAgent(env, obj) == enabled) | 349 if (GetUseDesktopUserAgent(env, obj) == enabled) |
349 return; | 350 return; |
350 | 351 |
351 // Make sure the navigation entry actually exists. | 352 // Make sure the navigation entry actually exists. |
352 NavigationEntry* entry = navigation_controller_->GetVisibleEntry(); | 353 NavigationEntry* entry = navigation_controller_->GetVisibleEntry(); |
353 if (!entry) | 354 if (!entry) |
354 return; | 355 return; |
355 | 356 |
356 // Set the flag in the NavigationEntry. | 357 // Set the flag in the NavigationEntry. |
357 entry->SetIsOverridingUserAgent(enabled); | 358 entry->SetIsOverridingUserAgent(enabled); |
| 359 navigation_controller_->UpdateOverridingUserAgent(); |
358 | 360 |
359 // Send the override to the renderer. | 361 // Send the override to the renderer. |
360 if (reload_on_state_change) { | 362 if (reload_on_state_change) { |
361 // Reloading the page will send the override down as part of the | 363 // Reloading the page will send the override down as part of the |
362 // navigation IPC message. | 364 // navigation IPC message. |
363 navigation_controller_->ReloadOriginalRequestURL(false); | 365 navigation_controller_->ReloadOriginalRequestURL(false); |
364 } | 366 } |
365 } | 367 } |
366 | 368 |
367 base::android::ScopedJavaLocalRef<jobject> | 369 base::android::ScopedJavaLocalRef<jobject> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 const JavaParamRef<jobject>& obj, | 430 const JavaParamRef<jobject>& obj, |
429 jlong source_navigation_controller_android, | 431 jlong source_navigation_controller_android, |
430 jboolean replace_entry) { | 432 jboolean replace_entry) { |
431 navigation_controller_->CopyStateFromAndPrune( | 433 navigation_controller_->CopyStateFromAndPrune( |
432 reinterpret_cast<NavigationControllerAndroid*>( | 434 reinterpret_cast<NavigationControllerAndroid*>( |
433 source_navigation_controller_android)->navigation_controller_, | 435 source_navigation_controller_android)->navigation_controller_, |
434 replace_entry); | 436 replace_entry); |
435 } | 437 } |
436 | 438 |
437 } // namespace content | 439 } // namespace content |
OLD | NEW |