Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/android/hung_renderer_infobar_delegate.h" | |
| 6 | |
| 7 #include "base/callback.h" | |
| 8 #include "chrome/grit/generated_resources.h" | |
| 9 #include "components/infobars/core/infobar.h" | |
| 10 #include "content/public/browser/render_process_host.h" | |
| 11 #include "content/public/browser/web_contents.h" | |
| 12 #include "content/public/common/result_codes.h" | |
| 13 #include "grit/theme_resources.h" | |
| 14 #include "ui/base/l10n/l10n_util.h" | |
| 15 | |
| 16 HungRendererInfoBarDelegate::HungRendererInfoBarDelegate( | |
| 17 content::WebContents* web_contents) | |
| 18 : web_contents_(web_contents) { | |
|
jdduke (slow)
2015/08/18 17:39:29
There's not much code here, I thought of just embe
gone
2015/08/18 18:21:36
Eh, the less things we shove into TabAndroid the b
| |
| 19 DCHECK(web_contents); | |
| 20 } | |
| 21 | |
| 22 HungRendererInfoBarDelegate::~HungRendererInfoBarDelegate() {} | |
| 23 | |
| 24 int HungRendererInfoBarDelegate::GetIconID() const { | |
| 25 return IDR_FROZEN_TAB_ICON; | |
| 26 } | |
| 27 | |
| 28 base::string16 HungRendererInfoBarDelegate::GetMessageText() const { | |
| 29 return l10n_util::GetPluralStringFUTF16(IDS_BROWSER_HANGMONITOR_RENDERER, 1); | |
| 30 } | |
| 31 | |
| 32 base::string16 HungRendererInfoBarDelegate::GetButtonLabel( | |
| 33 InfoBarButton button) const { | |
| 34 return l10n_util::GetStringUTF16((button == BUTTON_OK) | |
| 35 ? IDS_BROWSER_HANGMONITOR_RENDERER_END | |
| 36 : IDS_BROWSER_HANGMONITOR_RENDERER_WAIT); | |
| 37 } | |
| 38 | |
| 39 bool HungRendererInfoBarDelegate::Accept() { | |
| 40 content::RenderProcessHost* process = web_contents_->GetRenderProcessHost(); | |
| 41 process->Shutdown(content::RESULT_CODE_HUNG, false); | |
| 42 return true; | |
| 43 } | |
| OLD | NEW |