| Index: chrome/browser/android/tab_android.cc
|
| diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc
|
| index ab3a25c7059ce91a032b1e5667febeb75dcfae2f..cafa7c782ea736e7b3f41ae9fd447386c7ceaea4 100644
|
| --- a/chrome/browser/android/tab_android.cc
|
| +++ b/chrome/browser/android/tab_android.cc
|
| @@ -12,6 +12,7 @@
|
| #include "cc/layers/layer.h"
|
| #include "chrome/browser/android/chrome_web_contents_delegate_android.h"
|
| #include "chrome/browser/android/compositor/tab_content_manager.h"
|
| +#include "chrome/browser/android/hung_renderer_infobar_delegate.h"
|
| #include "chrome/browser/android/metrics/uma_utils.h"
|
| #include "chrome/browser/bookmarks/bookmark_model_factory.h"
|
| #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
|
| @@ -53,6 +54,7 @@
|
| #include "components/bookmarks/managed/managed_bookmark_service.h"
|
| #include "components/dom_distiller/core/url_utils.h"
|
| #include "components/favicon/content/content_favicon_driver.h"
|
| +#include "components/infobars/core/infobar.h"
|
| #include "components/infobars/core/infobar_container.h"
|
| #include "components/navigation_interception/intercept_navigation_delegate.h"
|
| #include "components/navigation_interception/navigation_params.h"
|
| @@ -124,7 +126,8 @@ TabAndroid::TabAndroid(JNIEnv* env, jobject obj)
|
| : weak_java_tab_(env, obj),
|
| content_layer_(cc::Layer::Create(content::Compositor::LayerSettings())),
|
| tab_content_manager_(NULL),
|
| - synced_tab_delegate_(new browser_sync::SyncedTabDelegateAndroid(this)) {
|
| + synced_tab_delegate_(new browser_sync::SyncedTabDelegateAndroid(this)),
|
| + hung_renderer_infobar_(nullptr) {
|
| Java_Tab_setNativePtr(env, obj, reinterpret_cast<intptr_t>(this));
|
| }
|
|
|
| @@ -391,6 +394,11 @@ void TabAndroid::OnFaviconUpdated(favicon::FaviconDriver* favicon_driver,
|
| bool icon_url_changed) {
|
| }
|
|
|
| +void TabAndroid::OnInfoBarRemoved(infobars::InfoBar* infobar, bool animate) {
|
| + if (hung_renderer_infobar_ && hung_renderer_infobar_ == infobar)
|
| + hung_renderer_infobar_ = nullptr;
|
| +}
|
| +
|
| void TabAndroid::Destroy(JNIEnv* env, jobject obj) {
|
| delete this;
|
| }
|
| @@ -453,6 +461,11 @@ void TabAndroid::InitWebContents(JNIEnv* env,
|
| if (instant_service)
|
| instant_service->AddObserver(this);
|
|
|
| + InfoBarService* infobar_service =
|
| + InfoBarService::FromWebContents(web_contents());
|
| + if (infobar_service)
|
| + infobar_service->AddObserver(this);
|
| +
|
| content_layer_->InsertChild(content_view_core->GetLayer(), 0);
|
| }
|
|
|
| @@ -486,6 +499,11 @@ void TabAndroid::DestroyWebContents(JNIEnv* env,
|
| if (instant_service)
|
| instant_service->RemoveObserver(this);
|
|
|
| + InfoBarService* infobar_service =
|
| + InfoBarService::FromWebContents(web_contents());
|
| + if (infobar_service)
|
| + infobar_service->RemoveObserver(this);
|
| +
|
| web_contents()->SetDelegate(NULL);
|
|
|
| if (delete_native) {
|
| @@ -794,6 +812,31 @@ bool TabAndroid::HasPrerenderedUrl(JNIEnv* env, jobject obj, jstring url) {
|
| return HasPrerenderedUrl(gurl);
|
| }
|
|
|
| +void TabAndroid::ShowHungRendererInfoBar(JNIEnv* env, jobject obj) {
|
| + DCHECK(!hung_renderer_infobar_);
|
| + InfoBarService* infobar_service =
|
| + InfoBarService::FromWebContents(web_contents());
|
| + if (!infobar_service)
|
| + return;
|
| +
|
| + scoped_ptr<ConfirmInfoBarDelegate> delegate(
|
| + new HungRendererInfoBarDelegate(web_contents()));
|
| + hung_renderer_infobar_ = infobar_service->AddInfoBar(
|
| + infobar_service->CreateConfirmInfoBar(delegate.Pass()));
|
| +}
|
| +
|
| +void TabAndroid::ClearHungRendererInfoBar(JNIEnv* env, jobject obj) {
|
| + if (!hung_renderer_infobar_)
|
| + return;
|
| +
|
| + InfoBarService* infobar_service =
|
| + InfoBarService::FromWebContents(web_contents());
|
| + if (!infobar_service)
|
| + return;
|
| +
|
| + infobar_service->RemoveInfoBar(hung_renderer_infobar_);
|
| +}
|
| +
|
| namespace {
|
|
|
| class ChromeInterceptNavigationDelegate : public InterceptNavigationDelegate {
|
|
|