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

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: Rebasing Created 5 years 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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/process/process.h" 10 #include "base/process/process.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 int plugin_child_id, 139 int plugin_child_id,
140 const base::string16& plugin_name); 140 const base::string16& plugin_name);
141 141
142 private: 142 private:
143 HungPluginInfoBarDelegate(HungPluginTabHelper* helper, 143 HungPluginInfoBarDelegate(HungPluginTabHelper* helper,
144 int plugin_child_id, 144 int plugin_child_id,
145 const base::string16& plugin_name); 145 const base::string16& plugin_name);
146 ~HungPluginInfoBarDelegate() override; 146 ~HungPluginInfoBarDelegate() override;
147 147
148 // ConfirmInfoBarDelegate: 148 // ConfirmInfoBarDelegate:
149 std::string GetIdentifier() const override;
149 int GetIconId() const override; 150 int GetIconId() const override;
150 base::string16 GetMessageText() const override; 151 base::string16 GetMessageText() const override;
151 int GetButtons() const override; 152 int GetButtons() const override;
152 base::string16 GetButtonLabel(InfoBarButton button) const override; 153 base::string16 GetButtonLabel(InfoBarButton button) const override;
153 bool Accept() override; 154 bool Accept() override;
154 155
155 HungPluginTabHelper* helper_; 156 HungPluginTabHelper* helper_;
156 int plugin_child_id_; 157 int plugin_child_id_;
157 158
158 base::string16 message_; 159 base::string16 message_;
(...skipping 20 matching lines...) Expand all
179 plugin_child_id_(plugin_child_id), 180 plugin_child_id_(plugin_child_id),
180 message_(l10n_util::GetStringFUTF16( 181 message_(l10n_util::GetStringFUTF16(
181 IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR, plugin_name)), 182 IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR, plugin_name)),
182 button_text_(l10n_util::GetStringUTF16( 183 button_text_(l10n_util::GetStringUTF16(
183 IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR_KILLBUTTON)) { 184 IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR_KILLBUTTON)) {
184 } 185 }
185 186
186 HungPluginInfoBarDelegate::~HungPluginInfoBarDelegate() { 187 HungPluginInfoBarDelegate::~HungPluginInfoBarDelegate() {
187 } 188 }
188 189
190 std::string HungPluginInfoBarDelegate::GetIdentifier() const {
191 return "HungPluginInfoBarDelegate";
192 }
193
189 int HungPluginInfoBarDelegate::GetIconId() const { 194 int HungPluginInfoBarDelegate::GetIconId() const {
190 return IDR_INFOBAR_PLUGIN_CRASHED; 195 return IDR_INFOBAR_PLUGIN_CRASHED;
191 } 196 }
192 197
193 base::string16 HungPluginInfoBarDelegate::GetMessageText() const { 198 base::string16 HungPluginInfoBarDelegate::GetMessageText() const {
194 return message_; 199 return message_;
195 } 200 }
196 201
197 int HungPluginInfoBarDelegate::GetButtons() const { 202 int HungPluginInfoBarDelegate::GetButtons() const {
198 return BUTTON_OK; 203 return BUTTON_OK;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 422 }
418 423
419 void HungPluginTabHelper::CloseBar(PluginState* state) { 424 void HungPluginTabHelper::CloseBar(PluginState* state) {
420 InfoBarService* infobar_service = 425 InfoBarService* infobar_service =
421 InfoBarService::FromWebContents(web_contents()); 426 InfoBarService::FromWebContents(web_contents());
422 if (infobar_service && state->infobar) { 427 if (infobar_service && state->infobar) {
423 infobar_service->RemoveInfoBar(state->infobar); 428 infobar_service->RemoveInfoBar(state->infobar);
424 state->infobar = NULL; 429 state->infobar = NULL;
425 } 430 }
426 } 431 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698