| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/process.h" | 9 #include "base/process.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 HungPluginTabHelper::HungPluginTabHelper(content::WebContents* contents) | 223 HungPluginTabHelper::HungPluginTabHelper(content::WebContents* contents) |
| 224 : content::WebContentsObserver(contents) { | 224 : content::WebContentsObserver(contents) { |
| 225 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 225 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
| 226 content::NotificationService::AllSources()); | 226 content::NotificationService::AllSources()); |
| 227 } | 227 } |
| 228 | 228 |
| 229 HungPluginTabHelper::~HungPluginTabHelper() { | 229 HungPluginTabHelper::~HungPluginTabHelper() { |
| 230 } | 230 } |
| 231 | 231 |
| 232 void HungPluginTabHelper::PluginCrashed(const FilePath& plugin_path) { | 232 void HungPluginTabHelper::PluginCrashed(const FilePath& plugin_path, |
| 233 base::ProcessId plugin_pid) { |
| 233 // TODO(brettw) ideally this would take the child process ID. When we do this | 234 // TODO(brettw) ideally this would take the child process ID. When we do this |
| 234 // for NaCl plugins, we'll want to know exactly which process it was since | 235 // for NaCl plugins, we'll want to know exactly which process it was since |
| 235 // the path won't be useful. | 236 // the path won't be useful. |
| 236 InfoBarService* infobar_service = | 237 InfoBarService* infobar_service = |
| 237 InfoBarService::FromWebContents(web_contents()); | 238 InfoBarService::FromWebContents(web_contents()); |
| 238 if (!infobar_service) | 239 if (!infobar_service) |
| 239 return; | 240 return; |
| 240 | 241 |
| 241 // For now, just do a brute-force search to see if we have this plugin. Since | 242 // For now, just do a brute-force search to see if we have this plugin. Since |
| 242 // we'll normally have 0 or 1, this is fast. | 243 // we'll normally have 0 or 1, this is fast. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 InfoBarService* infobar_service = | 390 InfoBarService* infobar_service = |
| 390 InfoBarService::FromWebContents(web_contents()); | 391 InfoBarService::FromWebContents(web_contents()); |
| 391 if (!infobar_service) | 392 if (!infobar_service) |
| 392 return; | 393 return; |
| 393 | 394 |
| 394 if (state->info_bar) { | 395 if (state->info_bar) { |
| 395 infobar_service->RemoveInfoBar(state->info_bar); | 396 infobar_service->RemoveInfoBar(state->info_bar); |
| 396 state->info_bar = NULL; | 397 state->info_bar = NULL; |
| 397 } | 398 } |
| 398 } | 399 } |
| OLD | NEW |