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

Side by Side Diff: chrome/android/testshell/testshell_tab.cc

Issue 23020009: TabBase: Add ContentView/NativePage ownership (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase! 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
« no previous file with comments | « chrome/android/testshell/testshell_tab.h ('k') | chrome/browser/android/shortcut_helper.cc » ('j') | 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 "chrome/android/testshell/testshell_tab.h" 5 #include "chrome/android/testshell/testshell_tab.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" 9 #include "chrome/browser/android/chrome_web_contents_delegate_android.h"
10 #include "chrome/browser/ui/android/window_android_helper.h" 10 #include "chrome/browser/ui/android/window_android_helper.h"
11 #include "chrome/browser/ui/browser_navigator.h" 11 #include "chrome/browser/ui/browser_navigator.h"
12 #include "chrome/common/net/url_fixer_upper.h" 12 #include "chrome/common/net/url_fixer_upper.h"
13 #include "content/public/browser/android/content_view_core.h" 13 #include "content/public/browser/android/content_view_core.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "jni/TestShellTab_jni.h" 15 #include "jni/TestShellTab_jni.h"
16 #include "ui/android/window_android.h" 16 #include "ui/android/window_android.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 using base::android::ConvertJavaStringToUTF8; 19 using base::android::ConvertJavaStringToUTF8;
20 using base::android::ConvertUTF8ToJavaString; 20 using base::android::ConvertUTF8ToJavaString;
21 using base::android::ScopedJavaLocalRef; 21 using base::android::ScopedJavaLocalRef;
22 using chrome::android::ChromeWebContentsDelegateAndroid; 22 using chrome::android::ChromeWebContentsDelegateAndroid;
23 using content::WebContents; 23 using content::WebContents;
24 using ui::WindowAndroid; 24 using ui::WindowAndroid;
25 25
26 TestShellTab::TestShellTab(JNIEnv* env, 26 TestShellTab::TestShellTab(JNIEnv* env,
27 jobject obj, 27 jobject obj)
28 WebContents* web_contents, 28 : TabAndroid(env, obj) {
29 WindowAndroid* window_android)
30 : TabAndroid(env, obj),
31 web_contents_(web_contents) {
32 InitTabHelpers(web_contents);
33 WindowAndroidHelper::FromWebContents(web_contents)->
34 SetWindowAndroid(window_android);
35 } 29 }
36 30
37 TestShellTab::~TestShellTab() { 31 TestShellTab::~TestShellTab() {
38 } 32 }
39 33
40 void TestShellTab::Destroy(JNIEnv* env, jobject obj) { 34 void TestShellTab::Destroy(JNIEnv* env, jobject obj) {
41 delete this; 35 delete this;
42 } 36 }
43 37
44 WebContents* TestShellTab::GetWebContents() {
45 return web_contents_.get();
46 }
47
48 browser_sync::SyncedTabDelegate* TestShellTab::GetSyncedTabDelegate() { 38 browser_sync::SyncedTabDelegate* TestShellTab::GetSyncedTabDelegate() {
49 NOTIMPLEMENTED(); 39 NOTIMPLEMENTED();
50 return NULL; 40 return NULL;
51 } 41 }
52 42
53 void TestShellTab::OnReceivedHttpAuthRequest(jobject auth_handler, 43 void TestShellTab::OnReceivedHttpAuthRequest(jobject auth_handler,
54 const string16& host, 44 const string16& host,
55 const string16& realm) { 45 const string16& realm) {
56 NOTIMPLEMENTED(); 46 NOTIMPLEMENTED();
57 } 47 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 89 }
100 90
101 void TestShellTab::HandlePopupNavigation(chrome::NavigateParams* params) { 91 void TestShellTab::HandlePopupNavigation(chrome::NavigateParams* params) {
102 NOTIMPLEMENTED(); 92 NOTIMPLEMENTED();
103 } 93 }
104 94
105 bool TestShellTab::RegisterTestShellTab(JNIEnv* env) { 95 bool TestShellTab::RegisterTestShellTab(JNIEnv* env) {
106 return RegisterNativesImpl(env); 96 return RegisterNativesImpl(env);
107 } 97 }
108 98
109 void TestShellTab::InitWebContentsDelegate(
110 JNIEnv* env,
111 jobject obj,
112 jobject web_contents_delegate) {
113 web_contents_delegate_.reset(
114 new ChromeWebContentsDelegateAndroid(env, web_contents_delegate));
115 web_contents_->SetDelegate(web_contents_delegate_.get());
116 }
117
118 ScopedJavaLocalRef<jstring> TestShellTab::FixupUrl(JNIEnv* env, 99 ScopedJavaLocalRef<jstring> TestShellTab::FixupUrl(JNIEnv* env,
119 jobject obj, 100 jobject obj,
120 jstring url) { 101 jstring url) {
121 GURL fixed_url(URLFixerUpper::FixupURL(ConvertJavaStringToUTF8(env, url), 102 GURL fixed_url(URLFixerUpper::FixupURL(ConvertJavaStringToUTF8(env, url),
122 std::string())); 103 std::string()));
123 104
124 std::string fixed_spec; 105 std::string fixed_spec;
125 if (fixed_url.is_valid()) 106 if (fixed_url.is_valid())
126 fixed_spec = fixed_url.spec(); 107 fixed_spec = fixed_url.spec();
127 108
128 return ConvertUTF8ToJavaString(env, fixed_spec); 109 return ConvertUTF8ToJavaString(env, fixed_spec);
129 } 110 }
130 111
131 static jint Init(JNIEnv* env, 112 static jint Init(JNIEnv* env, jobject obj) {
132 jobject obj, 113 return reinterpret_cast<jint>(new TestShellTab(env, obj));
133 jint web_contents_ptr,
134 jint window_android_ptr) {
135 TestShellTab* tab = new TestShellTab(
136 env,
137 obj,
138 reinterpret_cast<WebContents*>(web_contents_ptr),
139 reinterpret_cast<WindowAndroid*>(window_android_ptr));
140 return reinterpret_cast<jint>(tab);
141 } 114 }
142 115
143 int TestShellTab::GetSyncId() const { 116 int TestShellTab::GetSyncId() const {
144 NOTIMPLEMENTED(); 117 NOTIMPLEMENTED();
145 return 0; 118 return 0;
146 } 119 }
147 120
148 void TestShellTab::SetSyncId(int sync_id) { NOTIMPLEMENTED(); } 121 void TestShellTab::SetSyncId(int sync_id) { NOTIMPLEMENTED(); }
OLDNEW
« no previous file with comments | « chrome/android/testshell/testshell_tab.h ('k') | chrome/browser/android/shortcut_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698