| 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/chrome_plugin_service_filter.h" |
| 8 #include "chrome/browser/content_settings/content_settings_utils.h" | 9 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 9 #include "chrome/browser/content_settings/cookie_settings.h" | 10 #include "chrome/browser/content_settings/cookie_settings.h" |
| 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 11 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 11 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 12 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 12 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 13 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
| 13 #include "chrome/browser/favicon/favicon_tab_helper.h" | 14 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 14 #include "chrome/browser/infobars/infobar_tab_helper.h" | 15 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 18 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 18 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" | 19 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" |
| 19 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" | 20 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
| 20 #include "chrome/browser/ui/content_settings/content_setting_bubble_model_delega
te.h" | 21 #include "chrome/browser/ui/content_settings/content_setting_bubble_model_delega
te.h" |
| 21 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
| 22 #include "chrome/common/content_settings.h" | 23 #include "chrome/common/content_settings.h" |
| 23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 24 #include "chrome/common/render_messages.h" | 25 #include "chrome/common/render_messages.h" |
| 25 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
| 27 #include "content/public/browser/render_process_host.h" |
| 26 #include "content/public/browser/render_view_host.h" | 28 #include "content/public/browser/render_view_host.h" |
| 27 #include "content/public/browser/user_metrics.h" | 29 #include "content/public/browser/user_metrics.h" |
| 28 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/browser/web_contents_delegate.h" | 31 #include "content/public/browser/web_contents_delegate.h" |
| 30 #include "grit/generated_resources.h" | 32 #include "grit/generated_resources.h" |
| 31 #include "net/base/net_util.h" | 33 #include "net/base/net_util.h" |
| 32 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
| 33 | 35 |
| 34 using content::UserMetricsAction; | 36 using content::UserMetricsAction; |
| 35 using content::WebContents; | 37 using content::WebContents; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); | 422 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); |
| 421 set_custom_link_enabled(web_contents && | 423 set_custom_link_enabled(web_contents && |
| 422 TabSpecificContentSettings::FromWebContents( | 424 TabSpecificContentSettings::FromWebContents( |
| 423 web_contents)->load_plugins_link_enabled()); | 425 web_contents)->load_plugins_link_enabled()); |
| 424 } | 426 } |
| 425 | 427 |
| 426 void ContentSettingPluginBubbleModel::OnCustomLinkClicked() { | 428 void ContentSettingPluginBubbleModel::OnCustomLinkClicked() { |
| 427 content::RecordAction(UserMetricsAction("ClickToPlay_LoadAll_Bubble")); | 429 content::RecordAction(UserMetricsAction("ClickToPlay_LoadAll_Bubble")); |
| 428 DCHECK(web_contents()); | 430 DCHECK(web_contents()); |
| 429 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); | 431 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); |
| 432 #if defined(ENABLE_PLUGINS) |
| 433 ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins( |
| 434 host->GetProcess()->GetID()); |
| 435 #endif |
| 430 // TODO(bauerb): We should send the identifiers of blocked plug-ins here. | 436 // TODO(bauerb): We should send the identifiers of blocked plug-ins here. |
| 431 host->Send(new ChromeViewMsg_LoadBlockedPlugins(host->GetRoutingID(), | 437 host->Send(new ChromeViewMsg_LoadBlockedPlugins(host->GetRoutingID(), |
| 432 std::string())); | 438 std::string())); |
| 433 set_custom_link_enabled(false); | 439 set_custom_link_enabled(false); |
| 434 TabSpecificContentSettings::FromWebContents(web_contents())-> | 440 TabSpecificContentSettings::FromWebContents(web_contents())-> |
| 435 set_load_plugins_link_enabled(false); | 441 set_load_plugins_link_enabled(false); |
| 436 } | 442 } |
| 437 | 443 |
| 438 class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup { | 444 class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup { |
| 439 public: | 445 public: |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 824 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
| 819 DCHECK_EQ(web_contents_, | 825 DCHECK_EQ(web_contents_, |
| 820 content::Source<WebContents>(source).ptr()); | 826 content::Source<WebContents>(source).ptr()); |
| 821 web_contents_ = NULL; | 827 web_contents_ = NULL; |
| 822 } else { | 828 } else { |
| 823 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 829 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
| 824 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 830 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
| 825 profile_ = NULL; | 831 profile_ = NULL; |
| 826 } | 832 } |
| 827 } | 833 } |
| OLD | NEW |