summaryrefslogtreecommitdiffstats
path: root/content/shell
diff options
context:
space:
mode:
authorjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-16 08:09:35 +0000
committerjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-16 08:09:35 +0000
commit061b2b31085552dd6aad065eb706b92804c5bf7a (patch)
treeb57baaa92b3c955b293302fdd5607d0133bb1c31 /content/shell
parent878412f29e4b9fcff06fd9102174f9e473995b93 (diff)
downloadchromium_src-061b2b31085552dd6aad065eb706b92804c5bf7a.zip
chromium_src-061b2b31085552dd6aad065eb706b92804c5bf7a.tar.gz
chromium_src-061b2b31085552dd6aad065eb706b92804c5bf7a.tar.bz2
Making it easier to hook a ContentViewCore to the SurfaceView.
This CL changes the way we deal with WebLayers, so that a ContentViewCore does not need native code anymore to hook with the surface view. The ContentViewCore now keeps track of the WebLayers as they are attached/detached. The ContentViewRenderView is used to render a specific ContentView by retrieving the ContentViewCore WebLlayer and adding it to the compositor. BUG= TEST=ContentShell and ChromiumTestShell should still work. Review URL: https://chromiumcodereview.appspot.com/11293264 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168166 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell')
-rw-r--r--content/shell/android/java/src/org/chromium/content_shell/Shell.java6
-rw-r--r--content/shell/android/java/src/org/chromium/content_shell/ShellManager.java18
-rw-r--r--content/shell/android/shell_manager.cc6
-rw-r--r--content/shell/shell.cc2
-rw-r--r--content/shell/shell.h15
-rw-r--r--content/shell/shell_android.cc14
6 files changed, 12 insertions, 49 deletions
diff --git a/content/shell/android/java/src/org/chromium/content_shell/Shell.java b/content/shell/android/java/src/org/chromium/content_shell/Shell.java
index 1eeecbfc..b7b8457 100644
--- a/content/shell/android/java/src/org/chromium/content_shell/Shell.java
+++ b/content/shell/android/java/src/org/chromium/content_shell/Shell.java
@@ -22,6 +22,7 @@ import android.widget.TextView.OnEditorActionListener;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.content.browser.ContentView;
+import org.chromium.content.browser.ContentViewRenderView;
import org.chromium.content.browser.LoadUrlParams;
import org.chromium.ui.gfx.NativeWindow;
@@ -48,7 +49,7 @@ public class Shell extends LinearLayout {
private ClipDrawable mProgressDrawable;
- private View mContentViewRenderView;
+ private ContentViewRenderView mContentViewRenderView;
private NativeWindow mWindow;
private boolean mLoading = false;
@@ -63,7 +64,7 @@ public class Shell extends LinearLayout {
/**
* Set the SurfaceView being renderered to as soon as it is available.
*/
- public void setContentViewRenderView(View contentViewRenderView) {
+ public void setContentViewRenderView(ContentViewRenderView contentViewRenderView) {
FrameLayout contentViewHolder = (FrameLayout) findViewById(R.id.contentview_holder);
if (contentViewRenderView == null) {
if (mContentViewRenderView != null) {
@@ -211,6 +212,7 @@ public class Shell extends LinearLayout {
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
mContentView.requestFocus();
+ mContentViewRenderView.setCurrentContentView(mContentView);
}
/**
diff --git a/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java b/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
index 9cfc2ea..91dc4c2 100644
--- a/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
+++ b/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
@@ -11,6 +11,7 @@ import android.widget.FrameLayout;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
+import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewRenderView;
import org.chromium.ui.gfx.NativeWindow;
@@ -80,12 +81,6 @@ public class ShellManager extends FrameLayout {
@SuppressWarnings("unused")
@CalledByNative
- private int getContentViewLayerRenderer() {
- return mContentViewRenderView.getNativeContentViewLayerRenderer();
- }
-
- @SuppressWarnings("unused")
- @CalledByNative
private Object createShell() {
LayoutInflater inflater =
(LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@@ -94,9 +89,8 @@ public class ShellManager extends FrameLayout {
removeAllViews();
if (mActiveShell != null) {
- if (mActiveShell.getContentView() != null) {
- mActiveShell.getContentView().onHide();
- }
+ ContentView contentView = mActiveShell.getContentView();
+ if (contentView != null) contentView.onHide();
mActiveShell.setContentViewRenderView(null);
}
@@ -104,7 +98,11 @@ public class ShellManager extends FrameLayout {
addView(shellView, new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
mActiveShell = shellView;
- if (mActiveShell.getContentView() != null) mActiveShell.getContentView().onShow();
+ ContentView contentView = mActiveShell.getContentView();
+ if (contentView != null) {
+ mContentViewRenderView.setCurrentContentView(contentView);
+ contentView.onShow();
+ }
return shellView;
}
diff --git a/content/shell/android/shell_manager.cc b/content/shell/android/shell_manager.cc
index 79f7803d..4b161a6 100644
--- a/content/shell/android/shell_manager.cc
+++ b/content/shell/android/shell_manager.cc
@@ -35,12 +35,6 @@ namespace content {
jobject CreateShellView(Shell* shell) {
JNIEnv* env = base::android::AttachCurrentThread();
jobject j_shell_manager = g_global_state.Get().j_shell_manager.obj();
-
- ContentViewLayerRenderer* content_view_layer_renderer =
- reinterpret_cast<ContentViewLayerRenderer*>(
- Java_ShellManager_getContentViewLayerRenderer(env, j_shell_manager));
- shell->SetContentViewLayerRenderer(content_view_layer_renderer);
-
return Java_ShellManager_createShell(env, j_shell_manager).Release();
}
diff --git a/content/shell/shell.cc b/content/shell/shell.cc
index e85d976..48f462d 100644
--- a/content/shell/shell.cc
+++ b/content/shell/shell.cc
@@ -45,8 +45,6 @@ Shell::Shell(WebContents* web_contents)
url_edit_view_(NULL)
#if defined(OS_WIN) && !defined(USE_AURA)
, default_edit_wnd_proc_(0)
-#elif defined(OS_ANDROID)
- , content_view_layer_renderer_(NULL)
#endif
{
registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
diff --git a/content/shell/shell.h b/content/shell/shell.h
index bc43553..eb7485c 100644
--- a/content/shell/shell.h
+++ b/content/shell/shell.h
@@ -25,9 +25,6 @@
typedef struct _GtkToolItem GtkToolItem;
#elif defined(OS_ANDROID)
#include "base/android/scoped_java_ref.h"
-namespace content {
-class ContentViewLayerRenderer;
-}
#elif defined(USE_AURA)
namespace views {
class Widget;
@@ -98,11 +95,6 @@ class Shell : public WebContentsDelegate,
#elif defined(OS_ANDROID)
// Registers the Android Java to native methods.
static bool Register(JNIEnv* env);
- // Called by the ShellManager to specify the object that should be notified of
- // layer changes.
- // Note that |content_view_layer_renderer| is owned by the ShellManager.
- void SetContentViewLayerRenderer(
- ContentViewLayerRenderer* content_view_layer_renderer);
#endif
// WebContentsDelegate
@@ -112,10 +104,6 @@ class Shell : public WebContentsDelegate,
#if defined(OS_ANDROID)
virtual void LoadProgressChanged(WebContents* source,
double progress) OVERRIDE;
- virtual void AttachLayer(WebContents* web_contents,
- WebKit::WebLayer* layer) OVERRIDE;
- virtual void RemoveLayer(WebContents* web_contents,
- WebKit::WebLayer* layer) OVERRIDE;
#endif
virtual void CloseContents(WebContents* source) OVERRIDE;
virtual void WebContentsCreated(WebContents* source_contents,
@@ -228,9 +216,6 @@ class Shell : public WebContentsDelegate,
int content_height_;
#elif defined(OS_ANDROID)
base::android::ScopedJavaGlobalRef<jobject> java_object_;
- // The ContentViewLayerRenderer that should be notified of compositing layer
- // changes. Global so guaranteed to outlive shell.
- ContentViewLayerRenderer* content_view_layer_renderer_;
#elif defined(USE_AURA)
static aura::client::StackingClient* stacking_client_;
static views::ViewsDelegate* views_delegate_;
diff --git a/content/shell/shell_android.cc b/content/shell/shell_android.cc
index 08e6bb0..ed191f4 100644
--- a/content/shell/shell_android.cc
+++ b/content/shell/shell_android.cc
@@ -11,7 +11,6 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/string_piece.h"
-#include "content/public/browser/android/content_view_layer_renderer.h"
#include "content/public/common/content_switches.h"
#include "content/shell/android/shell_manager.h"
#include "jni/Shell_jni.h"
@@ -72,19 +71,6 @@ void Shell::Close() {
NOTIMPLEMENTED();
}
-void Shell::AttachLayer(WebContents* web_contents, WebKit::WebLayer* layer) {
- content_view_layer_renderer_->AttachLayer(layer);
-}
-
-void Shell::RemoveLayer(WebContents* web_contents, WebKit::WebLayer* layer) {
- content_view_layer_renderer_->DetachLayer(layer);
-}
-
-void Shell::SetContentViewLayerRenderer(
- ContentViewLayerRenderer* content_view_layer_renderer) {
- content_view_layer_renderer_ = content_view_layer_renderer;
-}
-
// static
bool Shell::Register(JNIEnv* env) {
return RegisterNativesImpl(env);