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

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_bubble_model.cc

Issue 791633003: Fix a crash on closing tab while the plugin settings bubble is visible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review. Created 6 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
« no previous file with comments | « no previous file | 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/content_settings/content_setting_bubble_model.h" 5 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 ContentSettingPluginBubbleModel::~ContentSettingPluginBubbleModel() { 490 ContentSettingPluginBubbleModel::~ContentSettingPluginBubbleModel() {
491 if (settings_changed()) { 491 if (settings_changed()) {
492 // If the user elected to allow all plugins then run plugins at this time. 492 // If the user elected to allow all plugins then run plugins at this time.
493 if (selected_item() == kAllowButtonIndex) 493 if (selected_item() == kAllowButtonIndex)
494 OnCustomLinkClicked(); 494 OnCustomLinkClicked();
495 } 495 }
496 } 496 }
497 497
498 void ContentSettingPluginBubbleModel::OnCustomLinkClicked() { 498 void ContentSettingPluginBubbleModel::OnCustomLinkClicked() {
499 content::RecordAction(UserMetricsAction("ClickToPlay_LoadAll_Bubble")); 499 content::RecordAction(UserMetricsAction("ClickToPlay_LoadAll_Bubble"));
500 DCHECK(web_contents()); 500 // Web contents can be NULL if the tab was closed while the plugins
501 // settings bubble is visible.
502 if (!web_contents())
503 return;
501 #if defined(ENABLE_PLUGINS) 504 #if defined(ENABLE_PLUGINS)
502 // TODO(bauerb): We should send the identifiers of blocked plug-ins here. 505 // TODO(bauerb): We should send the identifiers of blocked plug-ins here.
503 ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins( 506 ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins(
504 web_contents(), true, std::string()); 507 web_contents(), true, std::string());
505 #endif 508 #endif
506 set_custom_link_enabled(false); 509 set_custom_link_enabled(false);
507 TabSpecificContentSettings::FromWebContents(web_contents())-> 510 TabSpecificContentSettings::FromWebContents(web_contents())->
508 set_load_plugins_link_enabled(false); 511 set_load_plugins_link_enabled(false);
509 } 512 }
510 513
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { 1297 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) {
1295 DCHECK_EQ(web_contents_, 1298 DCHECK_EQ(web_contents_,
1296 content::Source<WebContents>(source).ptr()); 1299 content::Source<WebContents>(source).ptr());
1297 web_contents_ = NULL; 1300 web_contents_ = NULL;
1298 } else { 1301 } else {
1299 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); 1302 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
1300 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); 1303 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr());
1301 profile_ = NULL; 1304 profile_ = NULL;
1302 } 1305 }
1303 } 1306 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698