| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/content_settings/content_settings_utils.h" | 8 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 9 #include "chrome/browser/content_settings/cookie_settings.h" | 9 #include "chrome/browser/content_settings/cookie_settings.h" |
| 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 11 #include "chrome/browser/favicon/favicon_tab_helper.h" | 11 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 12 #include "chrome/browser/infobars/infobar_tab_helper.h" | 12 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 15 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 16 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" | 16 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" | 18 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
| 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 20 #include "chrome/common/chrome_notification_types.h" |
| 20 #include "chrome/common/content_settings.h" | 21 #include "chrome/common/content_settings.h" |
| 21 #include "chrome/common/chrome_notification_types.h" | |
| 22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 23 #include "chrome/common/render_messages.h" | 23 #include "chrome/common/render_messages.h" |
| 24 #include "content/browser/renderer_host/render_view_host.h" | 24 #include "content/browser/renderer_host/render_view_host.h" |
| 25 #include "content/browser/tab_contents/tab_contents.h" | 25 #include "content/browser/tab_contents/tab_contents.h" |
| 26 #include "content/browser/tab_contents/tab_contents_delegate.h" | 26 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 27 #include "content/browser/user_metrics.h" | |
| 28 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 28 #include "content/public/browser/user_metrics.h" |
| 29 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
| 30 #include "net/base/net_util.h" | 30 #include "net/base/net_util.h" |
| 31 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 32 | 32 |
| 33 using content::UserMetricsAction; |
| 33 using content_settings::SettingInfo; | 34 using content_settings::SettingInfo; |
| 34 using content_settings::SettingSource; | 35 using content_settings::SettingSource; |
| 35 using content_settings::SETTING_SOURCE_USER; | 36 using content_settings::SETTING_SOURCE_USER; |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| 38 struct ContentSettingsTypeIdEntry { | 39 struct ContentSettingsTypeIdEntry { |
| 39 ContentSettingsType type; | 40 ContentSettingsType type; |
| 40 int id; | 41 int id; |
| 41 }; | 42 }; |
| 42 | 43 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 browser, tab_contents, profile, content_type) { | 371 browser, tab_contents, profile, content_type) { |
| 371 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); | 372 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); |
| 372 set_custom_link_enabled(tab_contents && tab_contents->content_settings()-> | 373 set_custom_link_enabled(tab_contents && tab_contents->content_settings()-> |
| 373 load_plugins_link_enabled()); | 374 load_plugins_link_enabled()); |
| 374 } | 375 } |
| 375 | 376 |
| 376 virtual ~ContentSettingPluginBubbleModel() {} | 377 virtual ~ContentSettingPluginBubbleModel() {} |
| 377 | 378 |
| 378 private: | 379 private: |
| 379 virtual void OnCustomLinkClicked() OVERRIDE { | 380 virtual void OnCustomLinkClicked() OVERRIDE { |
| 380 UserMetrics::RecordAction(UserMetricsAction("ClickToPlay_LoadAll_Bubble")); | 381 content::RecordAction(UserMetricsAction("ClickToPlay_LoadAll_Bubble")); |
| 381 DCHECK(tab_contents()); | 382 DCHECK(tab_contents()); |
| 382 RenderViewHost* host = tab_contents()->tab_contents()->render_view_host(); | 383 RenderViewHost* host = tab_contents()->tab_contents()->render_view_host(); |
| 383 host->Send(new ChromeViewMsg_LoadBlockedPlugins(host->routing_id())); | 384 host->Send(new ChromeViewMsg_LoadBlockedPlugins(host->routing_id())); |
| 384 set_custom_link_enabled(false); | 385 set_custom_link_enabled(false); |
| 385 tab_contents()->content_settings()->set_load_plugins_link_enabled(false); | 386 tab_contents()->content_settings()->set_load_plugins_link_enabled(false); |
| 386 } | 387 } |
| 387 }; | 388 }; |
| 388 | 389 |
| 389 class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup { | 390 class ContentSettingPopupBubbleModel : public ContentSettingSingleRadioGroup { |
| 390 public: | 391 public: |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 tab_contents_ = NULL; | 578 tab_contents_ = NULL; |
| 578 break; | 579 break; |
| 579 case chrome::NOTIFICATION_PROFILE_DESTROYED: | 580 case chrome::NOTIFICATION_PROFILE_DESTROYED: |
| 580 DCHECK(source == content::Source<Profile>(profile_)); | 581 DCHECK(source == content::Source<Profile>(profile_)); |
| 581 profile_ = NULL; | 582 profile_ = NULL; |
| 582 break; | 583 break; |
| 583 default: | 584 default: |
| 584 NOTREACHED(); | 585 NOTREACHED(); |
| 585 } | 586 } |
| 586 } | 587 } |
| OLD | NEW |