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

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

Issue 15067008: [InfoBar] Add InfoBarDelegate::GetIconID() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit fixes redux Created 7 years, 7 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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/process.h" 10 #include "base/process.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/public/browser/notification_details.h" 23 #include "content/public/browser/notification_details.h"
24 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/plugin_service.h" 25 #include "content/public/browser/plugin_service.h"
26 #include "content/public/browser/render_process_host.h" 26 #include "content/public/browser/render_process_host.h"
27 #include "content/public/common/result_codes.h" 27 #include "content/public/common/result_codes.h"
28 #include "grit/chromium_strings.h" 28 #include "grit/chromium_strings.h"
29 #include "grit/generated_resources.h" 29 #include "grit/generated_resources.h"
30 #include "grit/locale_settings.h" 30 #include "grit/locale_settings.h"
31 #include "grit/theme_resources.h" 31 #include "grit/theme_resources.h"
32 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
33 #include "ui/base/resource/resource_bundle.h"
34 33
35 #if defined(OS_WIN) 34 #if defined(OS_WIN)
36 #include "base/win/scoped_handle.h" 35 #include "base/win/scoped_handle.h"
37 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h" 36 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h"
38 #endif 37 #endif
39 38
40 39
41 namespace { 40 namespace {
42 41
43 #if defined(OS_WIN) 42 #if defined(OS_WIN)
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const string16& plugin_name); 140 const string16& plugin_name);
142 141
143 private: 142 private:
144 HungPluginInfoBarDelegate(HungPluginTabHelper* helper, 143 HungPluginInfoBarDelegate(HungPluginTabHelper* helper,
145 InfoBarService* infobar_service, 144 InfoBarService* infobar_service,
146 int plugin_child_id, 145 int plugin_child_id,
147 const string16& plugin_name); 146 const string16& plugin_name);
148 virtual ~HungPluginInfoBarDelegate(); 147 virtual ~HungPluginInfoBarDelegate();
149 148
150 // ConfirmInfoBarDelegate: 149 // ConfirmInfoBarDelegate:
151 virtual gfx::Image* GetIcon() const OVERRIDE; 150 virtual int GetIconID() const OVERRIDE;
152 virtual string16 GetMessageText() const OVERRIDE; 151 virtual string16 GetMessageText() const OVERRIDE;
153 virtual int GetButtons() const OVERRIDE; 152 virtual int GetButtons() const OVERRIDE;
154 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 153 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
155 virtual bool Accept() OVERRIDE; 154 virtual bool Accept() OVERRIDE;
156 155
157 HungPluginTabHelper* helper_; 156 HungPluginTabHelper* helper_;
158 int plugin_child_id_; 157 int plugin_child_id_;
159 158
160 string16 message_; 159 string16 message_;
161 string16 button_text_; 160 string16 button_text_;
162 gfx::Image* icon_;
163 }; 161 };
164 162
165 // static 163 // static
166 HungPluginInfoBarDelegate* HungPluginInfoBarDelegate::Create( 164 HungPluginInfoBarDelegate* HungPluginInfoBarDelegate::Create(
167 InfoBarService* infobar_service, 165 InfoBarService* infobar_service,
168 HungPluginTabHelper* helper, 166 HungPluginTabHelper* helper,
169 int plugin_child_id, 167 int plugin_child_id,
170 const string16& plugin_name) { 168 const string16& plugin_name) {
171 return static_cast<HungPluginInfoBarDelegate*>(infobar_service->AddInfoBar( 169 return static_cast<HungPluginInfoBarDelegate*>(infobar_service->AddInfoBar(
172 scoped_ptr<InfoBarDelegate>(new HungPluginInfoBarDelegate( 170 scoped_ptr<InfoBarDelegate>(new HungPluginInfoBarDelegate(
173 helper, infobar_service, plugin_child_id, plugin_name)))); 171 helper, infobar_service, plugin_child_id, plugin_name))));
174 } 172 }
175 173
176 HungPluginInfoBarDelegate::HungPluginInfoBarDelegate( 174 HungPluginInfoBarDelegate::HungPluginInfoBarDelegate(
177 HungPluginTabHelper* helper, 175 HungPluginTabHelper* helper,
178 InfoBarService* infobar_service, 176 InfoBarService* infobar_service,
179 int plugin_child_id, 177 int plugin_child_id,
180 const string16& plugin_name) 178 const string16& plugin_name)
181 : ConfirmInfoBarDelegate(infobar_service), 179 : ConfirmInfoBarDelegate(infobar_service),
182 helper_(helper), 180 helper_(helper),
183 plugin_child_id_(plugin_child_id) { 181 plugin_child_id_(plugin_child_id) {
184 message_ = l10n_util::GetStringFUTF16(IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR, 182 message_ = l10n_util::GetStringFUTF16(IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR,
185 plugin_name); 183 plugin_name);
186 button_text_ = l10n_util::GetStringUTF16( 184 button_text_ = l10n_util::GetStringUTF16(
187 IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR_KILLBUTTON); 185 IDS_BROWSER_HANGMONITOR_PLUGIN_INFOBAR_KILLBUTTON);
188 icon_ = &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
189 IDR_INFOBAR_PLUGIN_CRASHED);
190 } 186 }
191 187
192 HungPluginInfoBarDelegate::~HungPluginInfoBarDelegate() { 188 HungPluginInfoBarDelegate::~HungPluginInfoBarDelegate() {
193 } 189 }
194 190
195 gfx::Image* HungPluginInfoBarDelegate::GetIcon() const { 191 int HungPluginInfoBarDelegate::GetIconID() const {
196 return icon_; 192 return IDR_INFOBAR_PLUGIN_CRASHED;
197 } 193 }
198 194
199 string16 HungPluginInfoBarDelegate::GetMessageText() const { 195 string16 HungPluginInfoBarDelegate::GetMessageText() const {
200 return message_; 196 return message_;
201 } 197 }
202 198
203 int HungPluginInfoBarDelegate::GetButtons() const { 199 int HungPluginInfoBarDelegate::GetButtons() const {
204 return BUTTON_OK; 200 return BUTTON_OK;
205 } 201 }
206 202
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 InfoBarService* infobar_service = 435 InfoBarService* infobar_service =
440 InfoBarService::FromWebContents(web_contents()); 436 InfoBarService::FromWebContents(web_contents());
441 if (!infobar_service) 437 if (!infobar_service)
442 return; 438 return;
443 439
444 if (state->info_bar) { 440 if (state->info_bar) {
445 infobar_service->RemoveInfoBar(state->info_bar); 441 infobar_service->RemoveInfoBar(state->info_bar);
446 state->info_bar = NULL; 442 state->info_bar = NULL;
447 } 443 }
448 } 444 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/infobars/infobar_gtk.cc ('k') | chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698