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

Side by Side Diff: content/browser/frame_host/navigation_controller_android.cc

Issue 1785953002: Ignore viewport meta tags when Request Desktop Site is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change loop style Created 4 years, 8 months 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 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_controller_impl.h"
12 #include "content/browser/frame_host/navigation_entry_impl.h" 13 #include "content/browser/frame_host/navigation_entry_impl.h"
13 #include "content/public/browser/browser_context.h" 14 #include "content/public/browser/browser_context.h"
14 #include "content/public/browser/navigation_controller.h"
15 #include "content/public/browser/ssl_host_state_delegate.h" 15 #include "content/public/browser/ssl_host_state_delegate.h"
16 #include "jni/NavigationControllerImpl_jni.h" 16 #include "jni/NavigationControllerImpl_jni.h"
17 #include "net/base/data_url.h" 17 #include "net/base/data_url.h"
18 #include "ui/gfx/android/java_bitmap.h" 18 #include "ui/gfx/android/java_bitmap.h"
19 19
20 using base::android::AttachCurrentThread; 20 using base::android::AttachCurrentThread;
21 using base::android::ConvertJavaStringToUTF16; 21 using base::android::ConvertJavaStringToUTF16;
22 using base::android::ConvertJavaStringToUTF8; 22 using base::android::ConvertJavaStringToUTF8;
23 using base::android::ConvertUTF16ToJavaString; 23 using base::android::ConvertUTF16ToJavaString;
24 using base::android::ConvertUTF8ToJavaString; 24 using base::android::ConvertUTF8ToJavaString;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } // namespace 69 } // namespace
70 70
71 namespace content { 71 namespace content {
72 72
73 // static 73 // static
74 bool NavigationControllerAndroid::Register(JNIEnv* env) { 74 bool NavigationControllerAndroid::Register(JNIEnv* env) {
75 return RegisterNativesImpl(env); 75 return RegisterNativesImpl(env);
76 } 76 }
77 77
78 NavigationControllerAndroid::NavigationControllerAndroid( 78 NavigationControllerAndroid::NavigationControllerAndroid(
79 NavigationController* navigation_controller) 79 NavigationControllerImpl* navigation_controller)
80 : navigation_controller_(navigation_controller) { 80 : navigation_controller_(navigation_controller) {
81 JNIEnv* env = AttachCurrentThread(); 81 JNIEnv* env = AttachCurrentThread();
82 obj_.Reset(env, 82 obj_.Reset(env,
83 Java_NavigationControllerImpl_create( 83 Java_NavigationControllerImpl_create(
84 env, reinterpret_cast<intptr_t>(this)).obj()); 84 env, reinterpret_cast<intptr_t>(this)).obj());
85 } 85 }
86 86
87 NavigationControllerAndroid::~NavigationControllerAndroid() { 87 NavigationControllerAndroid::~NavigationControllerAndroid() {
88 Java_NavigationControllerImpl_destroy(AttachCurrentThread(), obj_.obj()); 88 Java_NavigationControllerImpl_destroy(AttachCurrentThread(), obj_.obj());
89 } 89 }
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 if (GetUseDesktopUserAgent(env, obj) == enabled) 348 if (GetUseDesktopUserAgent(env, obj) == enabled)
349 return; 349 return;
350 350
351 // Make sure the navigation entry actually exists. 351 // Make sure the navigation entry actually exists.
352 NavigationEntry* entry = navigation_controller_->GetVisibleEntry(); 352 NavigationEntry* entry = navigation_controller_->GetVisibleEntry();
353 if (!entry) 353 if (!entry)
354 return; 354 return;
355 355
356 // Set the flag in the NavigationEntry. 356 // Set the flag in the NavigationEntry.
357 entry->SetIsOverridingUserAgent(enabled); 357 entry->SetIsOverridingUserAgent(enabled);
358 navigation_controller_->delegate()->UpdateOverridingUserAgent();
358 359
359 // Send the override to the renderer. 360 // Send the override to the renderer.
360 if (reload_on_state_change) { 361 if (reload_on_state_change) {
361 // Reloading the page will send the override down as part of the 362 // Reloading the page will send the override down as part of the
362 // navigation IPC message. 363 // navigation IPC message.
363 navigation_controller_->ReloadOriginalRequestURL(false); 364 navigation_controller_->ReloadOriginalRequestURL(false);
364 } 365 }
365 } 366 }
366 367
367 base::android::ScopedJavaLocalRef<jobject> 368 base::android::ScopedJavaLocalRef<jobject>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 const JavaParamRef<jobject>& obj, 429 const JavaParamRef<jobject>& obj,
429 jlong source_navigation_controller_android, 430 jlong source_navigation_controller_android,
430 jboolean replace_entry) { 431 jboolean replace_entry) {
431 navigation_controller_->CopyStateFromAndPrune( 432 navigation_controller_->CopyStateFromAndPrune(
432 reinterpret_cast<NavigationControllerAndroid*>( 433 reinterpret_cast<NavigationControllerAndroid*>(
433 source_navigation_controller_android)->navigation_controller_, 434 source_navigation_controller_android)->navigation_controller_,
434 replace_entry); 435 replace_entry);
435 } 436 }
436 437
437 } // namespace content 438 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698