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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/shell/shell.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/shell/shell.h" 5 #include "content/shell/shell.h"
6 6
7 #include <jni.h>
8
9 #include "base/android/scoped_java_ref.h"
10 #include "base/android/jni_string.h"
7 #include "base/logging.h" 11 #include "base/logging.h"
8 #include "base/string_piece.h" 12 #include "base/string_piece.h"
9 #include "content/shell/android/shell_manager.h" 13 #include "content/shell/android/shell_manager.h"
14 #include "jni/shell_jni.h"
15
16 using base::android::AttachCurrentThread;
17 using base::android::ConvertUTF8ToJavaString;
10 18
11 namespace content { 19 namespace content {
12 20
13 base::StringPiece Shell::PlatformResourceProvider(int key) { 21 base::StringPiece Shell::PlatformResourceProvider(int key) {
14 return base::StringPiece(); 22 return base::StringPiece();
15 } 23 }
16 24
17 void Shell::PlatformInitialize() { 25 void Shell::PlatformInitialize() {
18 } 26 }
19 27
20 void Shell::PlatformCleanUp() { 28 void Shell::PlatformCleanUp() {
21 } 29 }
22 30
23 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) { 31 void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) {
24 } 32 }
25 33
26 void Shell::PlatformSetAddressBarURL(const GURL& url) { 34 void Shell::PlatformSetAddressBarURL(const GURL& url) {
35 JNIEnv* env = AttachCurrentThread();
36 ScopedJavaLocalRef<jstring> j_url =
37 ConvertUTF8ToJavaString(env, url.spec());
38 Java_Shell_onUpdateUrl(env, java_object_.obj(), j_url.obj());
27 } 39 }
28 40
29 void Shell::PlatformSetIsLoading(bool loading) { 41 void Shell::PlatformSetIsLoading(bool loading) {
30 } 42 }
31 43
32 void Shell::PlatformCreateWindow(int width, int height) { 44 void Shell::PlatformCreateWindow(int width, int height) {
33 shell_view_.reset(CreateShellView()); 45 java_object_.Reset(AttachCurrentThread(), CreateShellView());
34 } 46 }
35 47
36 void Shell::PlatformSetContents() { 48 void Shell::PlatformSetContents() {
37 shell_view_->InitFromTabContents(web_contents_.get()); 49 JNIEnv* env = AttachCurrentThread();
50 Java_Shell_initFromNativeTabContents(
51 env, java_object_.obj(), reinterpret_cast<jint>(web_contents()));
38 } 52 }
39 53
40 void Shell::PlatformResizeSubViews() { 54 void Shell::PlatformResizeSubViews() {
41 // Not needed; subviews are bound. 55 // Not needed; subviews are bound.
42 } 56 }
43 57
44 void Shell::PlatformSetTitle(const string16& title) { 58 void Shell::PlatformSetTitle(const string16& title) {
45 NOTIMPLEMENTED(); 59 NOTIMPLEMENTED();
46 } 60 }
47 61
62 void Shell::LoadProgressChanged(double progress) {
63 JNIEnv* env = AttachCurrentThread();
64 Java_Shell_onLoadProgressChanged(env, java_object_.obj(), progress);
65 }
66
48 void Shell::Close() { 67 void Shell::Close() {
49 // TODO(tedchoc): Implement Close method for android shell 68 // TODO(tedchoc): Implement Close method for android shell
50 NOTIMPLEMENTED(); 69 NOTIMPLEMENTED();
51 } 70 }
52 71
72 // static
73 bool Shell::Register(JNIEnv* env) {
74 return RegisterNativesImpl(env);
75 }
76
53 } // namespace content 77 } // namespace content
OLDNEW
« 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