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 14178004: Move HungPluginTabHelper::PluginState declaration from .h to .cc file. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/hung_plugin_tab_helper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
9 #include "base/process.h" 10 #include "base/process.h"
10 #include "base/process_util.h" 11 #include "base/process_util.h"
11 #include "base/rand_util.h" 12 #include "base/rand_util.h"
12 #include "build/build_config.h" 13 #include "build/build_config.h"
13 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 14 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
14 #include "chrome/browser/infobars/infobar.h" 15 #include "chrome/browser/infobars/infobar.h"
15 #include "chrome/browser/infobars/infobar_service.h" 16 #include "chrome/browser/infobars/infobar_service.h"
16 #include "chrome/common/chrome_process_type.h" 17 #include "chrome/common/chrome_process_type.h"
17 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return button_text_; 201 return button_text_;
201 } 202 }
202 203
203 bool HungPluginInfoBarDelegate::Accept() { 204 bool HungPluginInfoBarDelegate::Accept() {
204 helper_->KillPlugin(plugin_child_id_); 205 helper_->KillPlugin(plugin_child_id_);
205 return true; 206 return true;
206 } 207 }
207 208
208 // ----------------------------------------------------------------------------- 209 // -----------------------------------------------------------------------------
209 210
211 // Per-plugin state (since there could be more than one plugin hung). The
212 // integer key is the child process ID of the plugin process. This maintains
213 // the state for all plugins on this page that are currently hung, whether or
214 // not we're currently showing the infobar.
215 struct HungPluginTabHelper::PluginState {
216 // Initializes the plugin state to be a hung plugin.
217 PluginState(const base::FilePath& p, const string16& n);
218 ~PluginState();
219
220 base::FilePath path;
221 string16 name;
222
223 // Possibly-null if we're not showing an infobar right now.
224 InfoBarDelegate* info_bar;
225
226 // Time to delay before re-showing the infobar for a hung plugin. This is
227 // increased each time the user cancels it.
228 base::TimeDelta next_reshow_delay;
229
230 // Handles calling the helper when the infobar should be re-shown.
231 base::Timer timer;
232
233 private:
234 // Since the scope of the timer manages our callback, this struct should
235 // not be copied.
236 DISALLOW_COPY_AND_ASSIGN(PluginState);
237 };
238
210 HungPluginTabHelper::PluginState::PluginState(const base::FilePath& p, 239 HungPluginTabHelper::PluginState::PluginState(const base::FilePath& p,
211 const string16& n) 240 const string16& n)
212 : path(p), 241 : path(p),
213 name(n), 242 name(n),
214 info_bar(NULL), 243 info_bar(NULL),
215 next_reshow_delay(base::TimeDelta::FromSeconds(kInitialReshowDelaySec)), 244 next_reshow_delay(base::TimeDelta::FromSeconds(kInitialReshowDelaySec)),
216 timer(false, false) { 245 timer(false, false) {
217 } 246 }
218 247
219 HungPluginTabHelper::PluginState::~PluginState() { 248 HungPluginTabHelper::PluginState::~PluginState() {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 InfoBarService* infobar_service = 421 InfoBarService* infobar_service =
393 InfoBarService::FromWebContents(web_contents()); 422 InfoBarService::FromWebContents(web_contents());
394 if (!infobar_service) 423 if (!infobar_service)
395 return; 424 return;
396 425
397 if (state->info_bar) { 426 if (state->info_bar) {
398 infobar_service->RemoveInfoBar(state->info_bar); 427 infobar_service->RemoveInfoBar(state->info_bar);
399 state->info_bar = NULL; 428 state->info_bar = NULL;
400 } 429 }
401 } 430 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/hung_plugin_tab_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698