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

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

Issue 23022006: Remove GetActiveEntry usage from content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing android compile break. Created 7 years, 3 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 | Annotate | Revision Log
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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 LoadUrl(params); 811 LoadUrl(params);
812 } 812 }
813 813
814 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) { 814 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) {
815 return GetRenderProcessIdFromRenderViewHost( 815 return GetRenderProcessIdFromRenderViewHost(
816 web_contents_->GetRenderViewHost()); 816 web_contents_->GetRenderViewHost());
817 } 817 }
818 818
819 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL( 819 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL(
820 JNIEnv* env, jobject) const { 820 JNIEnv* env, jobject) const {
821 // The current users of the Java API expect to use the active entry 821 GURL url = web_contents_->GetVisibleURL();
822 // rather than the visible entry, which is exposed by WebContents::GetURL.
823 content::NavigationEntry* entry =
824 web_contents_->GetController().GetActiveEntry();
825 GURL url = entry ? entry->GetVirtualURL() : GURL::EmptyGURL();
826 return ConvertUTF8ToJavaString(env, url.spec()); 822 return ConvertUTF8ToJavaString(env, url.spec());
827 } 823 }
828 824
829 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetTitle( 825 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetTitle(
830 JNIEnv* env, jobject obj) const { 826 JNIEnv* env, jobject obj) const {
831 return ConvertUTF16ToJavaString(env, GetWebContents()->GetTitle()); 827 return ConvertUTF16ToJavaString(env, GetWebContents()->GetTitle());
832 } 828 }
833 829
834 jboolean ContentViewCoreImpl::IsIncognito(JNIEnv* env, jobject obj) { 830 jboolean ContentViewCoreImpl::IsIncognito(JNIEnv* env, jobject obj) {
835 return GetWebContents()->GetBrowserContext()->IsOffTheRecord(); 831 return GetWebContents()->GetBrowserContext()->IsOffTheRecord();
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 1420
1425 AddNavigationEntryToHistory( 1421 AddNavigationEntryToHistory(
1426 env, obj, history, controller.GetEntryAtIndex(i), i); 1422 env, obj, history, controller.GetEntryAtIndex(i), i);
1427 num_added++; 1423 num_added++;
1428 } 1424 }
1429 } 1425 }
1430 1426
1431 ScopedJavaLocalRef<jstring> 1427 ScopedJavaLocalRef<jstring>
1432 ContentViewCoreImpl::GetOriginalUrlForActiveNavigationEntry(JNIEnv* env, 1428 ContentViewCoreImpl::GetOriginalUrlForActiveNavigationEntry(JNIEnv* env,
1433 jobject obj) { 1429 jobject obj) {
1434 NavigationEntry* entry = web_contents_->GetController().GetActiveEntry(); 1430 NavigationEntry* entry = web_contents_->GetController().GetVisibleEntry();
1435 if (entry == NULL) 1431 if (entry == NULL)
1436 return ScopedJavaLocalRef<jstring>(env, NULL); 1432 return ScopedJavaLocalRef<jstring>(env, NULL);
1437 return ConvertUTF8ToJavaString(env, entry->GetOriginalRequestURL().spec()); 1433 return ConvertUTF8ToJavaString(env, entry->GetOriginalRequestURL().spec());
1438 } 1434 }
1439 1435
1440 int ContentViewCoreImpl::GetNativeImeAdapter(JNIEnv* env, jobject obj) { 1436 int ContentViewCoreImpl::GetNativeImeAdapter(JNIEnv* env, jobject obj) {
1441 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); 1437 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid();
1442 if (!rwhva) 1438 if (!rwhva)
1443 return 0; 1439 return 0;
1444 return rwhva->GetNativeImeAdapter(); 1440 return rwhva->GetNativeImeAdapter();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 base::Bind(&JavaScriptResultCallback, j_callback); 1495 base::Bind(&JavaScriptResultCallback, j_callback);
1500 1496
1501 rvh->ExecuteJavascriptInWebFrameCallbackResult( 1497 rvh->ExecuteJavascriptInWebFrameCallbackResult(
1502 string16(), // frame_xpath 1498 string16(), // frame_xpath
1503 ConvertJavaStringToUTF16(env, script), 1499 ConvertJavaStringToUTF16(env, script),
1504 c_callback); 1500 c_callback);
1505 } 1501 }
1506 1502
1507 bool ContentViewCoreImpl::GetUseDesktopUserAgent( 1503 bool ContentViewCoreImpl::GetUseDesktopUserAgent(
1508 JNIEnv* env, jobject obj) { 1504 JNIEnv* env, jobject obj) {
1509 NavigationEntry* entry = web_contents_->GetController().GetActiveEntry(); 1505 NavigationEntry* entry = web_contents_->GetController().GetVisibleEntry();
1510 return entry && entry->GetIsOverridingUserAgent(); 1506 return entry && entry->GetIsOverridingUserAgent();
1511 } 1507 }
1512 1508
1513 void ContentViewCoreImpl::UpdateImeAdapter(int native_ime_adapter, 1509 void ContentViewCoreImpl::UpdateImeAdapter(int native_ime_adapter,
1514 int text_input_type, 1510 int text_input_type,
1515 const std::string& text, 1511 const std::string& text,
1516 int selection_start, 1512 int selection_start,
1517 int selection_end, 1513 int selection_end,
1518 int composition_start, 1514 int composition_start,
1519 int composition_end, 1515 int composition_end,
(...skipping 28 matching lines...) Expand all
1548 1544
1549 void ContentViewCoreImpl::SetUseDesktopUserAgent( 1545 void ContentViewCoreImpl::SetUseDesktopUserAgent(
1550 JNIEnv* env, 1546 JNIEnv* env,
1551 jobject obj, 1547 jobject obj,
1552 jboolean enabled, 1548 jboolean enabled,
1553 jboolean reload_on_state_change) { 1549 jboolean reload_on_state_change) {
1554 if (GetUseDesktopUserAgent(env, obj) == enabled) 1550 if (GetUseDesktopUserAgent(env, obj) == enabled)
1555 return; 1551 return;
1556 1552
1557 // Make sure the navigation entry actually exists. 1553 // Make sure the navigation entry actually exists.
1558 NavigationEntry* entry = web_contents_->GetController().GetActiveEntry(); 1554 NavigationEntry* entry = web_contents_->GetController().GetVisibleEntry();
1559 if (!entry) 1555 if (!entry)
1560 return; 1556 return;
1561 1557
1562 // Set the flag in the NavigationEntry. 1558 // Set the flag in the NavigationEntry.
1563 entry->SetIsOverridingUserAgent(enabled); 1559 entry->SetIsOverridingUserAgent(enabled);
1564 1560
1565 // Send the override to the renderer. 1561 // Send the override to the renderer.
1566 if (reload_on_state_change) { 1562 if (reload_on_state_change) {
1567 // Reloading the page will send the override down as part of the 1563 // Reloading the page will send the override down as part of the
1568 // navigation IPC message. 1564 // navigation IPC message.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 reinterpret_cast<ui::ViewAndroid*>(view_android), 1598 reinterpret_cast<ui::ViewAndroid*>(view_android),
1603 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1599 reinterpret_cast<ui::WindowAndroid*>(window_android));
1604 return reinterpret_cast<jint>(view); 1600 return reinterpret_cast<jint>(view);
1605 } 1601 }
1606 1602
1607 bool RegisterContentViewCore(JNIEnv* env) { 1603 bool RegisterContentViewCore(JNIEnv* env) {
1608 return RegisterNativesImpl(env); 1604 return RegisterNativesImpl(env);
1609 } 1605 }
1610 1606
1611 } // namespace content 1607 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/accessibility_ui.cc ('k') | content/browser/devtools/devtools_http_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698