Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/browser/android/tab_android.h" | 5 #include "chrome/browser/android/tab_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.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/android/webapps/single_tab_mode_tab_helper.h" | 10 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 } | 222 } |
| 223 | 223 |
| 224 void TabAndroid::SetSyncId(int sync_id) { | 224 void TabAndroid::SetSyncId(int sync_id) { |
| 225 JNIEnv* env = base::android::AttachCurrentThread(); | 225 JNIEnv* env = base::android::AttachCurrentThread(); |
| 226 ScopedJavaLocalRef<jobject> obj = weak_java_tab_.get(env); | 226 ScopedJavaLocalRef<jobject> obj = weak_java_tab_.get(env); |
| 227 if (obj.is_null()) | 227 if (obj.is_null()) |
| 228 return; | 228 return; |
| 229 Java_TabBase_setSyncId(env, obj.obj(), sync_id); | 229 Java_TabBase_setSyncId(env, obj.obj(), sync_id); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void TabAndroid::HandlePopupNavigation(chrome::NavigateParams* params) { | |
| 233 NOTIMPLEMENTED(); | |
| 234 } | |
| 235 | |
| 236 void TabAndroid::OnReceivedHttpAuthRequest(jobject auth_handler, | |
| 237 const base::string16& host, | |
| 238 const base::string16& realm) { | |
| 239 NOTIMPLEMENTED(); | |
| 240 } | |
| 241 | |
| 242 void TabAndroid::AddShortcutToBookmark(const GURL& url, | |
| 243 const base::string16& title, | |
| 244 const SkBitmap& skbitmap, | |
| 245 int r_value, | |
| 246 int g_value, | |
| 247 int b_value) { | |
| 248 NOTREACHED(); | |
| 249 } | |
| 250 | |
| 251 void TabAndroid::EditBookmark(int64 node_id, | |
| 252 const base::string16& node_title, | |
| 253 bool is_folder, | |
| 254 bool is_partner_bookmark) { | |
| 255 NOTREACHED(); | |
| 256 } | |
| 257 | |
| 258 void TabAndroid::OnNewTabPageReady() { | |
| 259 NOTREACHED(); | |
| 260 } | |
| 261 | |
| 262 bool TabAndroid::ShouldWelcomePageLinkToTermsOfService() { | |
| 263 NOTREACHED(); | |
| 264 return false; | |
| 265 } | |
| 266 | |
| 232 void TabAndroid::SwapTabContents(content::WebContents* old_contents, | 267 void TabAndroid::SwapTabContents(content::WebContents* old_contents, |
| 233 content::WebContents* new_contents) { | 268 content::WebContents* new_contents) { |
| 234 JNIEnv* env = base::android::AttachCurrentThread(); | 269 JNIEnv* env = base::android::AttachCurrentThread(); |
| 235 | 270 |
| 236 // We need to notify the native InfobarContainer so infobars can be swapped. | 271 // We need to notify the native InfobarContainer so infobars can be swapped. |
| 237 InfoBarContainerAndroid* infobar_container = | 272 InfoBarContainerAndroid* infobar_container = |
| 238 reinterpret_cast<InfoBarContainerAndroid*>( | 273 reinterpret_cast<InfoBarContainerAndroid*>( |
| 239 Java_TabBase_getNativeInfoBarContainer( | 274 Java_TabBase_getNativeInfoBarContainer( |
| 240 env, | 275 env, |
| 241 weak_java_tab_.get(env).obj())); | 276 weak_java_tab_.get(env).obj())); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 } | 314 } |
| 280 case chrome::NOTIFICATION_FAVICON_UPDATED: | 315 case chrome::NOTIFICATION_FAVICON_UPDATED: |
| 281 Java_TabBase_onFaviconUpdated(env, weak_java_tab_.get(env).obj()); | 316 Java_TabBase_onFaviconUpdated(env, weak_java_tab_.get(env).obj()); |
| 282 break; | 317 break; |
| 283 default: | 318 default: |
| 284 NOTREACHED() << "Unexpected notification " << type; | 319 NOTREACHED() << "Unexpected notification " << type; |
| 285 break; | 320 break; |
| 286 } | 321 } |
| 287 } | 322 } |
| 288 | 323 |
| 324 void TabAndroid::Destroy(JNIEnv* env, jobject obj) { | |
| 325 delete this; | |
| 326 } | |
| 327 | |
| 289 void TabAndroid::InitWebContents(JNIEnv* env, | 328 void TabAndroid::InitWebContents(JNIEnv* env, |
| 290 jobject obj, | 329 jobject obj, |
| 291 jboolean incognito, | 330 jboolean incognito, |
| 292 jobject jcontent_view_core, | 331 jobject jcontent_view_core, |
| 293 jobject jweb_contents_delegate, | 332 jobject jweb_contents_delegate, |
| 294 jobject jcontext_menu_populator) { | 333 jobject jcontext_menu_populator) { |
| 295 content::ContentViewCore* content_view_core = | 334 content::ContentViewCore* content_view_core = |
| 296 content::ContentViewCore::GetNativeContentViewCore(env, | 335 content::ContentViewCore::GetNativeContentViewCore(env, |
| 297 jcontent_view_core); | 336 jcontent_view_core); |
| 298 DCHECK(content_view_core); | 337 DCHECK(content_view_core); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 printing::PrintViewManagerBasic::CreateForWebContents(web_contents()); | 450 printing::PrintViewManagerBasic::CreateForWebContents(web_contents()); |
| 412 printing::PrintViewManagerBasic* print_view_manager = | 451 printing::PrintViewManagerBasic* print_view_manager = |
| 413 printing::PrintViewManagerBasic::FromWebContents(web_contents()); | 452 printing::PrintViewManagerBasic::FromWebContents(web_contents()); |
| 414 if (print_view_manager == NULL) | 453 if (print_view_manager == NULL) |
| 415 return false; | 454 return false; |
| 416 | 455 |
| 417 print_view_manager->PrintNow(); | 456 print_view_manager->PrintNow(); |
| 418 return true; | 457 return true; |
| 419 } | 458 } |
| 420 | 459 |
| 460 static void Init(JNIEnv* env, jobject obj) { | |
| 461 TRACE_EVENT0("native", "TabAndroid::Init"); | |
| 462 scoped_ptr<TabAndroid> tab(new TabAndroid(env, obj)); | |
|
Yaron
2013/12/18 02:15:55
Why bother with the scoped_ptr at all? Just do: ne
David Trainor- moved to gerrit
2013/12/18 21:29:47
This felt cleaner and a little more safe (if thing
| |
| 463 // This will automatically bind to the Java object and pass ownership there. | |
| 464 ignore_result(tab.release()); | |
| 465 } | |
| 466 | |
| 421 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 467 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
| 422 return RegisterNativesImpl(env); | 468 return RegisterNativesImpl(env); |
| 423 } | 469 } |
| OLD | NEW |