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_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 infobar_container->ChangeInfoBarManager(new_infobar_service); | 299 infobar_container->ChangeInfoBarManager(new_infobar_service); |
300 | 300 |
301 Java_Tab_swapWebContents( | 301 Java_Tab_swapWebContents( |
302 env, | 302 env, |
303 weak_java_tab_.get(env).obj(), | 303 weak_java_tab_.get(env).obj(), |
304 reinterpret_cast<intptr_t>(new_contents), | 304 reinterpret_cast<intptr_t>(new_contents), |
305 did_start_load, | 305 did_start_load, |
306 did_finish_load); | 306 did_finish_load); |
307 } | 307 } |
308 | 308 |
| 309 void TabAndroid::OnWebContentsInstantSupportDisabled( |
| 310 const content::WebContents* contents) { |
| 311 DCHECK(contents); |
| 312 if (web_contents() != contents) |
| 313 return; |
| 314 |
| 315 JNIEnv* env = base::android::AttachCurrentThread(); |
| 316 Java_Tab_onWebContentsInstantSupportDisabled(env, |
| 317 weak_java_tab_.get(env).obj()); |
| 318 } |
| 319 |
309 void TabAndroid::Observe(int type, | 320 void TabAndroid::Observe(int type, |
310 const content::NotificationSource& source, | 321 const content::NotificationSource& source, |
311 const content::NotificationDetails& details) { | 322 const content::NotificationDetails& details) { |
312 JNIEnv* env = base::android::AttachCurrentThread(); | 323 JNIEnv* env = base::android::AttachCurrentThread(); |
313 switch (type) { | 324 switch (type) { |
314 case chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED: { | 325 case chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED: { |
315 TabSpecificContentSettings* settings = | 326 TabSpecificContentSettings* settings = |
316 TabSpecificContentSettings::FromWebContents(web_contents()); | 327 TabSpecificContentSettings::FromWebContents(web_contents()); |
317 if (!settings->IsBlockageIndicated(CONTENT_SETTINGS_TYPE_POPUPS)) { | 328 if (!settings->IsBlockageIndicated(CONTENT_SETTINGS_TYPE_POPUPS)) { |
318 // TODO(dfalcantara): Create an InfoBarDelegate to keep the | 329 // TODO(dfalcantara): Create an InfoBarDelegate to keep the |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 375 |
365 SetWindowSessionID(session_window_id_.id()); | 376 SetWindowSessionID(session_window_id_.id()); |
366 | 377 |
367 session_tab_id_.set_id( | 378 session_tab_id_.set_id( |
368 SessionTabHelper::FromWebContents(web_contents())->session_id().id()); | 379 SessionTabHelper::FromWebContents(web_contents())->session_id().id()); |
369 ContextMenuHelper::FromWebContents(web_contents())->SetPopulator( | 380 ContextMenuHelper::FromWebContents(web_contents())->SetPopulator( |
370 jcontext_menu_populator); | 381 jcontext_menu_populator); |
371 WindowAndroidHelper::FromWebContents(web_contents())-> | 382 WindowAndroidHelper::FromWebContents(web_contents())-> |
372 SetWindowAndroid(content_view_core->GetWindowAndroid()); | 383 SetWindowAndroid(content_view_core->GetWindowAndroid()); |
373 CoreTabHelper::FromWebContents(web_contents())->set_delegate(this); | 384 CoreTabHelper::FromWebContents(web_contents())->set_delegate(this); |
| 385 SearchTabHelper::FromWebContents(web_contents())->set_delegate(this); |
374 web_contents_delegate_.reset( | 386 web_contents_delegate_.reset( |
375 new chrome::android::ChromeWebContentsDelegateAndroid( | 387 new chrome::android::ChromeWebContentsDelegateAndroid( |
376 env, jweb_contents_delegate)); | 388 env, jweb_contents_delegate)); |
377 web_contents_delegate_->LoadProgressChanged(web_contents(), 0); | 389 web_contents_delegate_->LoadProgressChanged(web_contents(), 0); |
378 web_contents()->SetDelegate(web_contents_delegate_.get()); | 390 web_contents()->SetDelegate(web_contents_delegate_.get()); |
379 | 391 |
380 notification_registrar_.Add( | 392 notification_registrar_.Add( |
381 this, | 393 this, |
382 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, | 394 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, |
383 content::Source<content::WebContents>(web_contents())); | 395 content::Source<content::WebContents>(web_contents())); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 | 656 |
645 static void Init(JNIEnv* env, jobject obj) { | 657 static void Init(JNIEnv* env, jobject obj) { |
646 TRACE_EVENT0("native", "TabAndroid::Init"); | 658 TRACE_EVENT0("native", "TabAndroid::Init"); |
647 // This will automatically bind to the Java object and pass ownership there. | 659 // This will automatically bind to the Java object and pass ownership there. |
648 new TabAndroid(env, obj); | 660 new TabAndroid(env, obj); |
649 } | 661 } |
650 | 662 |
651 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { | 663 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { |
652 return RegisterNativesImpl(env); | 664 return RegisterNativesImpl(env); |
653 } | 665 } |
OLD | NEW |