OLD | NEW |
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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/process/process.h" | 12 #include "base/process/process.h" |
13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/app/vector_icons/vector_icons.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
17 #include "chrome/common/channel_info.h" | 18 #include "chrome/common/channel_info.h" |
18 #include "chrome/common/crash_keys.h" | 19 #include "chrome/common/crash_keys.h" |
19 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
20 #include "chrome/grit/theme_resources.h" | 21 #include "chrome/grit/theme_resources.h" |
21 #include "components/infobars/core/confirm_infobar_delegate.h" | 22 #include "components/infobars/core/confirm_infobar_delegate.h" |
22 #include "components/infobars/core/infobar.h" | 23 #include "components/infobars/core/infobar.h" |
23 #include "components/version_info/version_info.h" | 24 #include "components/version_info/version_info.h" |
24 #include "content/public/browser/browser_child_process_host_iterator.h" | 25 #include "content/public/browser/browser_child_process_host_iterator.h" |
25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
26 #include "content/public/browser/child_process_data.h" | 27 #include "content/public/browser/child_process_data.h" |
27 #include "content/public/browser/notification_details.h" | 28 #include "content/public/browser/notification_details.h" |
28 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/plugin_service.h" | 30 #include "content/public/browser/plugin_service.h" |
30 #include "content/public/browser/render_process_host.h" | 31 #include "content/public/browser/render_process_host.h" |
31 #include "content/public/common/process_type.h" | 32 #include "content/public/common/process_type.h" |
32 #include "content/public/common/result_codes.h" | 33 #include "content/public/common/result_codes.h" |
33 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
34 #include "ui/gfx/vector_icons_public.h" | |
35 | 35 |
36 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
37 #include "base/win/scoped_handle.h" | 37 #include "base/win/scoped_handle.h" |
38 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h" | 38 #include "chrome/browser/hang_monitor/hang_crash_dump_win.h" |
39 #endif | 39 #endif |
40 | 40 |
41 | 41 |
42 namespace { | 42 namespace { |
43 | 43 |
44 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 const base::string16& plugin_name); | 144 const base::string16& plugin_name); |
145 | 145 |
146 private: | 146 private: |
147 HungPluginInfoBarDelegate(HungPluginTabHelper* helper, | 147 HungPluginInfoBarDelegate(HungPluginTabHelper* helper, |
148 int plugin_child_id, | 148 int plugin_child_id, |
149 const base::string16& plugin_name); | 149 const base::string16& plugin_name); |
150 ~HungPluginInfoBarDelegate() override; | 150 ~HungPluginInfoBarDelegate() override; |
151 | 151 |
152 // ConfirmInfoBarDelegate: | 152 // ConfirmInfoBarDelegate: |
153 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 153 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
154 gfx::VectorIconId GetVectorIconId() const override; | 154 const gfx::VectorIcon& GetVectorIcon() const override; |
155 base::string16 GetMessageText() const override; | 155 base::string16 GetMessageText() const override; |
156 int GetButtons() const override; | 156 int GetButtons() const override; |
157 base::string16 GetButtonLabel(InfoBarButton button) const override; | 157 base::string16 GetButtonLabel(InfoBarButton button) const override; |
158 bool Accept() override; | 158 bool Accept() override; |
159 | 159 |
160 HungPluginTabHelper* helper_; | 160 HungPluginTabHelper* helper_; |
161 int plugin_child_id_; | 161 int plugin_child_id_; |
162 | 162 |
163 base::string16 message_; | 163 base::string16 message_; |
164 base::string16 button_text_; | 164 base::string16 button_text_; |
(...skipping 24 matching lines...) Expand all Loading... |
189 } | 189 } |
190 | 190 |
191 HungPluginInfoBarDelegate::~HungPluginInfoBarDelegate() { | 191 HungPluginInfoBarDelegate::~HungPluginInfoBarDelegate() { |
192 } | 192 } |
193 | 193 |
194 infobars::InfoBarDelegate::InfoBarIdentifier | 194 infobars::InfoBarDelegate::InfoBarIdentifier |
195 HungPluginInfoBarDelegate::GetIdentifier() const { | 195 HungPluginInfoBarDelegate::GetIdentifier() const { |
196 return HUNG_PLUGIN_INFOBAR_DELEGATE; | 196 return HUNG_PLUGIN_INFOBAR_DELEGATE; |
197 } | 197 } |
198 | 198 |
199 gfx::VectorIconId HungPluginInfoBarDelegate::GetVectorIconId() const { | 199 const gfx::VectorIcon& HungPluginInfoBarDelegate::GetVectorIcon() const { |
200 return gfx::VectorIconId::EXTENSION_CRASHED; | 200 return kExtensionCrashedIcon; |
201 } | 201 } |
202 | 202 |
203 base::string16 HungPluginInfoBarDelegate::GetMessageText() const { | 203 base::string16 HungPluginInfoBarDelegate::GetMessageText() const { |
204 return message_; | 204 return message_; |
205 } | 205 } |
206 | 206 |
207 int HungPluginInfoBarDelegate::GetButtons() const { | 207 int HungPluginInfoBarDelegate::GetButtons() const { |
208 return BUTTON_OK; | 208 return BUTTON_OK; |
209 } | 209 } |
210 | 210 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 } | 428 } |
429 | 429 |
430 void HungPluginTabHelper::CloseBar(PluginState* state) { | 430 void HungPluginTabHelper::CloseBar(PluginState* state) { |
431 InfoBarService* infobar_service = | 431 InfoBarService* infobar_service = |
432 InfoBarService::FromWebContents(web_contents()); | 432 InfoBarService::FromWebContents(web_contents()); |
433 if (infobar_service && state->infobar) { | 433 if (infobar_service && state->infobar) { |
434 infobar_service->RemoveInfoBar(state->infobar); | 434 infobar_service->RemoveInfoBar(state->infobar); |
435 state->infobar = NULL; | 435 state->infobar = NULL; |
436 } | 436 } |
437 } | 437 } |
OLD | NEW |