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

Side by Side Diff: chrome/browser/ui/hung_plugin_tab_helper.cc

Issue 1520543004: Add method for identifying different InfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit again Created 4 years, 11 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
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/browser/ui/hung_plugin_tab_helper.h" 5 #include "chrome/browser/ui/hung_plugin_tab_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 int plugin_child_id, 140 int plugin_child_id,
141 const base::string16& plugin_name); 141 const base::string16& plugin_name);
142 142
143 private: 143 private:
144 HungPluginInfoBarDelegate(HungPluginTabHelper* helper, 144 HungPluginInfoBarDelegate(HungPluginTabHelper* helper,
145 int plugin_child_id, 145 int plugin_child_id,
146 const base::string16& plugin_name); 146 const base::string16& plugin_name);
147 ~HungPluginInfoBarDelegate() override; 147 ~HungPluginInfoBarDelegate() override;
148 148
149 // ConfirmInfoBarDelegate: 149 // ConfirmInfoBarDelegate:
150 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
150 int GetIconId() const override; 151 int GetIconId() const override;
151 base::string16 GetMessageText() const override; 152 base::string16 GetMessageText() const override;
152 int GetButtons() const override; 153 int GetButtons() const override;
153 base::string16 GetButtonLabel(InfoBarButton button) const override; 154 base::string16 GetButtonLabel(InfoBarButton button) const override;
154 bool Accept() override; 155 bool Accept() override;
155 156
156 HungPluginTabHelper* helper_; 157 HungPluginTabHelper* helper_;
157 int plugin_child_id_; 158 int plugin_child_id_;
158 159
159 base::string16 message_; 160 base::string16 message_;
(...skipping 20 matching lines...) Expand all
180 plugin_child_id_(plugin_child_id), 181 plugin_child_id_(plugin_child_id),
181 message_(l10n_util::GetStringFUTF16( 182 message_(l10n_util::GetStringFUTF16(
182 IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR, plugin_name)), 183 IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR, plugin_name)),
183 button_text_(l10n_util::GetStringUTF16( 184 button_text_(l10n_util::GetStringUTF16(
184 IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR_KILLBUTTON)) { 185 IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR_KILLBUTTON)) {
185 } 186 }
186 187
187 HungPluginInfoBarDelegate::~HungPluginInfoBarDelegate() { 188 HungPluginInfoBarDelegate::~HungPluginInfoBarDelegate() {
188 } 189 }
189 190
191 infobars::InfoBarDelegate::InfoBarIdentifier
192 HungPluginInfoBarDelegate::GetIdentifier() const {
193 return HUNG_PLUGIN_INFOBAR_DELEGATE;
194 }
195
190 int HungPluginInfoBarDelegate::GetIconId() const { 196 int HungPluginInfoBarDelegate::GetIconId() const {
191 return IDR_INFOBAR_PLUGIN_CRASHED; 197 return IDR_INFOBAR_PLUGIN_CRASHED;
192 } 198 }
193 199
194 base::string16 HungPluginInfoBarDelegate::GetMessageText() const { 200 base::string16 HungPluginInfoBarDelegate::GetMessageText() const {
195 return message_; 201 return message_;
196 } 202 }
197 203
198 int HungPluginInfoBarDelegate::GetButtons() const { 204 int HungPluginInfoBarDelegate::GetButtons() const {
199 return BUTTON_OK; 205 return BUTTON_OK;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 424 }
419 425
420 void HungPluginTabHelper::CloseBar(PluginState* state) { 426 void HungPluginTabHelper::CloseBar(PluginState* state) {
421 InfoBarService* infobar_service = 427 InfoBarService* infobar_service =
422 InfoBarService::FromWebContents(web_contents()); 428 InfoBarService::FromWebContents(web_contents());
423 if (infobar_service && state->infobar) { 429 if (infobar_service && state->infobar) {
424 infobar_service->RemoveInfoBar(state->infobar); 430 infobar_service->RemoveInfoBar(state->infobar);
425 state->infobar = NULL; 431 state->infobar = NULL;
426 } 432 }
427 } 433 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698