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/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 Loading... |
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 Loading... |
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 } |
OLD | NEW |