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

Unified Diff: content/shell/shell_android.cc

Issue 10800019: Refactor ContentShell to remove ContentViewClient dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « content/shell/shell.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/shell_android.cc
diff --git a/content/shell/shell_android.cc b/content/shell/shell_android.cc
index ec51e7c1efe3e2dd11de51508b8bb5a401bc7b9e..a8fea3763d9bfb28986e314009f8dc501ad23271 100644
--- a/content/shell/shell_android.cc
+++ b/content/shell/shell_android.cc
@@ -4,9 +4,17 @@
#include "content/shell/shell.h"
+#include <jni.h>
+
+#include "base/android/scoped_java_ref.h"
+#include "base/android/jni_string.h"
#include "base/logging.h"
#include "base/string_piece.h"
#include "content/shell/android/shell_manager.h"
+#include "jni/shell_jni.h"
+
+using base::android::AttachCurrentThread;
+using base::android::ConvertUTF8ToJavaString;
namespace content {
@@ -24,17 +32,23 @@ void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
}
void Shell::PlatformSetAddressBarURL(const GURL& url) {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jstring> j_url =
+ ConvertUTF8ToJavaString(env, url.spec());
+ Java_Shell_onUpdateUrl(env, java_object_.obj(), j_url.obj());
}
void Shell::PlatformSetIsLoading(bool loading) {
}
void Shell::PlatformCreateWindow(int width, int height) {
- shell_view_.reset(CreateShellView());
+ java_object_.Reset(AttachCurrentThread(), CreateShellView());
}
void Shell::PlatformSetContents() {
- shell_view_->InitFromTabContents(web_contents_.get());
+ JNIEnv* env = AttachCurrentThread();
+ Java_Shell_initFromNativeTabContents(
+ env, java_object_.obj(), reinterpret_cast<jint>(web_contents()));
}
void Shell::PlatformResizeSubViews() {
@@ -45,9 +59,19 @@ void Shell::PlatformSetTitle(const string16& title) {
NOTIMPLEMENTED();
}
+void Shell::LoadProgressChanged(double progress) {
+ JNIEnv* env = AttachCurrentThread();
+ Java_Shell_onLoadProgressChanged(env, java_object_.obj(), progress);
+}
+
void Shell::Close() {
// TODO(tedchoc): Implement Close method for android shell
NOTIMPLEMENTED();
}
+// static
+bool Shell::Register(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
} // namespace content
« no previous file with comments | « content/shell/shell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698