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

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 381593002: Removing ContentView dependencies for few functions which acts as WebContents wrapper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review comments. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/android/content_view_core_impl.cc
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index c91af2e030d6eca1c1c536ed0f46913fe436e4f8..4b88f2fa3a7abaa295a2fcbc65cd2bcc6be6699c 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -350,23 +350,6 @@ jint ContentViewCoreImpl::GetBackgroundColor(JNIEnv* env, jobject obj) {
return rwhva->GetCachedBackgroundColor();
}
-void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) {
- Hide();
-}
-
-void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) {
- Show();
-}
-
-void ContentViewCoreImpl::Show() {
- GetWebContents()->WasShown();
-}
-
-void ContentViewCoreImpl::Hide() {
- GetWebContents()->WasHidden();
- PauseVideo();
-}
-
void ContentViewCoreImpl::PauseVideo() {
RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
web_contents_->GetRenderViewHost());
@@ -1179,16 +1162,6 @@ void ContentViewCoreImpl::ClearHistory(JNIEnv* env, jobject obj) {
web_contents_->GetController().PruneAllButLastCommitted();
}
-void ContentViewCoreImpl::AddStyleSheetByURL(
- JNIEnv* env, jobject obj, jstring url) {
- if (!web_contents_)
- return;
-
- web_contents_->GetMainFrame()->Send(new FrameMsg_AddStyleSheetByURL(
- web_contents_->GetMainFrame()->GetRoutingID(),
- ConvertJavaStringToUTF8(env, url)));
-}
-
void ContentViewCoreImpl::SetAllowJavascriptInterfacesInspection(
JNIEnv* env,
jobject obj,
@@ -1230,68 +1203,6 @@ void ContentViewCoreImpl::WasResized(JNIEnv* env, jobject obj) {
}
}
-void ContentViewCoreImpl::ShowInterstitialPage(
- JNIEnv* env, jobject obj, jstring jurl, jlong delegate_ptr) {
- GURL url(base::android::ConvertJavaStringToUTF8(env, jurl));
- InterstitialPageDelegateAndroid* delegate =
- reinterpret_cast<InterstitialPageDelegateAndroid*>(delegate_ptr);
- InterstitialPage* interstitial = InterstitialPage::Create(
- web_contents_, false, url, delegate);
- delegate->set_interstitial_page(interstitial);
- interstitial->Show();
-}
-
-jboolean ContentViewCoreImpl::IsShowingInterstitialPage(JNIEnv* env,
- jobject obj) {
- return web_contents_->ShowingInterstitialPage();
-}
-
-jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env,
- jobject obj) {
- RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
- return view && view->HasValidFrame();
-}
-
-void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) {
- RenderViewHost* host = web_contents_->GetRenderViewHost();
- if (!host)
- return;
- host->ExitFullscreen();
-}
-
-void ContentViewCoreImpl::UpdateTopControlsState(JNIEnv* env,
- jobject obj,
- bool enable_hiding,
- bool enable_showing,
- bool animate) {
- RenderViewHost* host = web_contents_->GetRenderViewHost();
- if (!host)
- return;
- host->Send(new ViewMsg_UpdateTopControlsState(host->GetRoutingID(),
- enable_hiding,
- enable_showing,
- animate));
-}
-
-void ContentViewCoreImpl::ShowImeIfNeeded(JNIEnv* env, jobject obj) {
- RenderViewHost* host = web_contents_->GetRenderViewHost();
- host->Send(new ViewMsg_ShowImeIfNeeded(host->GetRoutingID()));
-}
-
-void ContentViewCoreImpl::ScrollFocusedEditableNodeIntoView(JNIEnv* env,
- jobject obj) {
- RenderViewHost* host = web_contents_->GetRenderViewHost();
- host->Send(new InputMsg_ScrollFocusedEditableNodeIntoRect(
- host->GetRoutingID(), gfx::Rect()));
-}
-
-void ContentViewCoreImpl::SelectWordAroundCaret(JNIEnv* env, jobject obj) {
- RenderViewHost* host = web_contents_->GetRenderViewHost();
- if (!host)
- return;
- host->SelectWordAroundCaret();
-}
-
namespace {
static void AddNavigationEntryToHistory(JNIEnv* env, jobject obj,
@@ -1356,22 +1267,6 @@ void ContentViewCoreImpl::GetDirectedNavigationHistory(JNIEnv* env,
}
}
-ScopedJavaLocalRef<jstring>
-ContentViewCoreImpl::GetOriginalUrlForActiveNavigationEntry(JNIEnv* env,
- jobject obj) {
- NavigationEntry* entry = web_contents_->GetController().GetVisibleEntry();
- if (entry == NULL)
- return ScopedJavaLocalRef<jstring>(env, NULL);
- return ConvertUTF8ToJavaString(env, entry->GetOriginalRequestURL().spec());
-}
-
-long ContentViewCoreImpl::GetNativeImeAdapter(JNIEnv* env, jobject obj) {
Yaron 2014/07/15 21:23:48 I don't think it makes sense to move this out. You
AKVT 2014/07/16 09:53:47 Thanks, IME changes I am keeping untouched time be
- RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid();
- if (!rwhva)
- return 0;
- return rwhva->GetNativeImeAdapter();
-}
-
namespace {
void JavaScriptResultCallback(const ScopedJavaGlobalRef<jobject>& callback,
const base::Value* result) {
@@ -1419,12 +1314,6 @@ void ContentViewCoreImpl::EvaluateJavaScript(JNIEnv* env,
c_callback);
}
-bool ContentViewCoreImpl::GetUseDesktopUserAgent(
- JNIEnv* env, jobject obj) {
- NavigationEntry* entry = web_contents_->GetController().GetVisibleEntry();
- return entry && entry->GetIsOverridingUserAgent();
-}
-
void ContentViewCoreImpl::UpdateImeAdapter(long native_ime_adapter,
int text_input_type,
const std::string& text,
@@ -1448,38 +1337,6 @@ void ContentViewCoreImpl::UpdateImeAdapter(long native_ime_adapter,
show_ime_if_needed, is_non_ime_change);
}
-void ContentViewCoreImpl::ClearSslPreferences(JNIEnv* env, jobject obj) {
- SSLHostState* state = SSLHostState::GetFor(
- web_contents_->GetController().GetBrowserContext());
- state->Clear();
-}
-
-void ContentViewCoreImpl::SetUseDesktopUserAgent(
- JNIEnv* env,
- jobject obj,
- jboolean enabled,
- jboolean reload_on_state_change) {
- if (GetUseDesktopUserAgent(env, obj) == enabled)
- return;
-
- // Make sure the navigation entry actually exists.
- NavigationEntry* entry = web_contents_->GetController().GetVisibleEntry();
- if (!entry)
- return;
-
- // Set the flag in the NavigationEntry.
- entry->SetIsOverridingUserAgent(enabled);
-
- // Send the override to the renderer.
- if (reload_on_state_change) {
- // Reloading the page will send the override down as part of the
- // navigation IPC message.
- NavigationControllerImpl& controller =
- static_cast<NavigationControllerImpl&>(web_contents_->GetController());
- controller.ReloadOriginalRequestURL(false);
- }
-}
-
void ContentViewCoreImpl::SetAccessibilityEnabled(JNIEnv* env, jobject obj,
bool enabled) {
SetAccessibilityEnabledInternal(enabled);
@@ -1534,23 +1391,6 @@ void ContentViewCoreImpl::SendOrientationChangeEventInternal() {
rwhv->UpdateScreenInfo(GetViewAndroid());
}
-void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env,
- jobject obj,
- jint x,
- jint y,
- jint width,
- jint height) {
- gfx::Rect rect(
- static_cast<int>(x / dpi_scale()),
- static_cast<int>(y / dpi_scale()),
- static_cast<int>((width > 0 && width < dpi_scale()) ?
- 1 : (int)(width / dpi_scale())),
- static_cast<int>((height > 0 && height < dpi_scale()) ?
- 1 : (int)(height / dpi_scale())));
- GetWebContents()->Send(new ViewMsg_ExtractSmartClipData(
- GetWebContents()->GetRoutingID(), rect));
-}
-
void ContentViewCoreImpl::ResumeResponseDeferredAtStart(JNIEnv* env,
jobject obj) {
static_cast<WebContentsImpl*>(GetWebContents())->

Powered by Google App Engine
This is Rietveld 408576698