| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/permissions/permission_uma_util.h" | 23 #include "chrome/browser/permissions/permission_uma_util.h" |
| 24 #include "chrome/browser/permissions/permission_util.h" | 24 #include "chrome/browser/permissions/permission_util.h" |
| 25 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 25 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 26 #include "chrome/browser/plugins/plugin_utils.h" | 26 #include "chrome/browser/plugins/plugin_utils.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 28 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
| 29 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" | 29 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
| 30 #include "chrome/browser/ui/content_settings/content_setting_bubble_model_delega
te.h" | 30 #include "chrome/browser/ui/content_settings/content_setting_bubble_model_delega
te.h" |
| 31 #include "chrome/common/chrome_features.h" | 31 #include "chrome/common/chrome_features.h" |
| 32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/insecure_content_renderer.mojom.h" |
| 33 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/common/render_messages.h" | 35 #include "chrome/common/render_messages.h" |
| 35 #include "chrome/grit/generated_resources.h" | 36 #include "chrome/grit/generated_resources.h" |
| 36 #include "chrome/grit/theme_resources.h" | 37 #include "chrome/grit/theme_resources.h" |
| 37 #include "components/content_settings/core/browser/content_settings_utils.h" | 38 #include "components/content_settings/core/browser/content_settings_utils.h" |
| 38 #include "components/content_settings/core/browser/cookie_settings.h" | 39 #include "components/content_settings/core/browser/cookie_settings.h" |
| 39 #include "components/content_settings/core/common/content_settings.h" | 40 #include "components/content_settings/core/common/content_settings.h" |
| 40 #include "components/prefs/pref_service.h" | 41 #include "components/prefs/pref_service.h" |
| 41 #include "components/rappor/public/rappor_utils.h" | 42 #include "components/rappor/public/rappor_utils.h" |
| 42 #include "components/rappor/rappor_service_impl.h" | 43 #include "components/rappor/rappor_service_impl.h" |
| 43 #include "components/strings/grit/components_strings.h" | 44 #include "components/strings/grit/components_strings.h" |
| 44 #include "components/subresource_filter/content/browser/content_subresource_filt
er_driver_factory.h" | 45 #include "components/subresource_filter/content/browser/content_subresource_filt
er_driver_factory.h" |
| 45 #include "components/url_formatter/elide_url.h" | 46 #include "components/url_formatter/elide_url.h" |
| 46 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
| 47 #include "content/public/browser/render_frame_host.h" | 48 #include "content/public/browser/render_frame_host.h" |
| 48 #include "content/public/browser/render_process_host.h" | 49 #include "content/public/browser/render_process_host.h" |
| 49 #include "content/public/browser/render_view_host.h" | 50 #include "content/public/browser/render_view_host.h" |
| 50 #include "content/public/browser/user_metrics.h" | 51 #include "content/public/browser/user_metrics.h" |
| 51 #include "content/public/browser/web_contents.h" | 52 #include "content/public/browser/web_contents.h" |
| 52 #include "content/public/browser/web_contents_delegate.h" | 53 #include "content/public/browser/web_contents_delegate.h" |
| 53 #include "content/public/common/origin_util.h" | 54 #include "content/public/common/origin_util.h" |
| 54 #include "ppapi/features/features.h" | 55 #include "ppapi/features/features.h" |
| 56 #include "services/service_manager/public/cpp/interface_provider.h" |
| 55 #include "ui/base/l10n/l10n_util.h" | 57 #include "ui/base/l10n/l10n_util.h" |
| 56 #include "ui/base/resource/resource_bundle.h" | 58 #include "ui/base/resource/resource_bundle.h" |
| 57 #include "ui/resources/grit/ui_resources.h" | 59 #include "ui/resources/grit/ui_resources.h" |
| 58 | 60 |
| 59 using base::UserMetricsAction; | 61 using base::UserMetricsAction; |
| 60 using content::WebContents; | 62 using content::WebContents; |
| 61 using content_settings::SettingInfo; | 63 using content_settings::SettingInfo; |
| 62 using content_settings::SettingSource; | 64 using content_settings::SettingSource; |
| 63 using content_settings::SETTING_SOURCE_USER; | 65 using content_settings::SETTING_SOURCE_USER; |
| 64 using content_settings::SETTING_SOURCE_NONE; | 66 using content_settings::SETTING_SOURCE_NONE; |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 profile(), map_entry.first, embedder_url, | 1009 profile(), map_entry.first, embedder_url, |
| 1008 CONTENT_SETTINGS_TYPE_GEOLOCATION, PermissionSourceUI::PAGE_ACTION); | 1010 CONTENT_SETTINGS_TYPE_GEOLOCATION, PermissionSourceUI::PAGE_ACTION); |
| 1009 map->SetContentSettingDefaultScope(map_entry.first, embedder_url, | 1011 map->SetContentSettingDefaultScope(map_entry.first, embedder_url, |
| 1010 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 1012 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
| 1011 std::string(), CONTENT_SETTING_DEFAULT); | 1013 std::string(), CONTENT_SETTING_DEFAULT); |
| 1012 } | 1014 } |
| 1013 } | 1015 } |
| 1014 | 1016 |
| 1015 // ContentSettingMixedScriptBubbleModel ---------------------------------------- | 1017 // ContentSettingMixedScriptBubbleModel ---------------------------------------- |
| 1016 | 1018 |
| 1019 namespace { |
| 1020 |
| 1021 void SetAllowRunningInsecureContent(content::RenderFrameHost* frame) { |
| 1022 chrome::mojom::InsecureContentRendererPtr renderer; |
| 1023 frame->GetRemoteInterfaces()->GetInterface(&renderer); |
| 1024 renderer->SetAllowRunningInsecureContent(); |
| 1025 } |
| 1026 |
| 1027 } // namespace |
| 1028 |
| 1017 class ContentSettingMixedScriptBubbleModel | 1029 class ContentSettingMixedScriptBubbleModel |
| 1018 : public ContentSettingSimpleBubbleModel { | 1030 : public ContentSettingSimpleBubbleModel { |
| 1019 public: | 1031 public: |
| 1020 ContentSettingMixedScriptBubbleModel(Delegate* delegate, | 1032 ContentSettingMixedScriptBubbleModel(Delegate* delegate, |
| 1021 WebContents* web_contents, | 1033 WebContents* web_contents, |
| 1022 Profile* profile); | 1034 Profile* profile); |
| 1023 | 1035 |
| 1024 ~ContentSettingMixedScriptBubbleModel() override {} | 1036 ~ContentSettingMixedScriptBubbleModel() override {} |
| 1025 | 1037 |
| 1026 private: | 1038 private: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1041 content_settings::RecordMixedScriptAction( | 1053 content_settings::RecordMixedScriptAction( |
| 1042 content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_BUBBLE); | 1054 content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_BUBBLE); |
| 1043 set_custom_link_enabled(true); | 1055 set_custom_link_enabled(true); |
| 1044 } | 1056 } |
| 1045 | 1057 |
| 1046 void ContentSettingMixedScriptBubbleModel::OnCustomLinkClicked() { | 1058 void ContentSettingMixedScriptBubbleModel::OnCustomLinkClicked() { |
| 1047 DCHECK(rappor_service()); | 1059 DCHECK(rappor_service()); |
| 1048 if (!web_contents()) | 1060 if (!web_contents()) |
| 1049 return; | 1061 return; |
| 1050 | 1062 |
| 1051 web_contents()->SendToAllFrames( | 1063 web_contents()->ForEachFrame(base::Bind(&::SetAllowRunningInsecureContent)); |
| 1052 new ChromeViewMsg_SetAllowRunningInsecureContent(MSG_ROUTING_NONE, true)); | |
| 1053 web_contents()->GetMainFrame()->Send(new ChromeViewMsg_ReloadFrame( | |
| 1054 web_contents()->GetMainFrame()->GetRoutingID())); | |
| 1055 | 1064 |
| 1056 content_settings::RecordMixedScriptAction( | 1065 content_settings::RecordMixedScriptAction( |
| 1057 content_settings::MIXED_SCRIPT_ACTION_CLICKED_ALLOW); | 1066 content_settings::MIXED_SCRIPT_ACTION_CLICKED_ALLOW); |
| 1058 | 1067 |
| 1059 rappor::SampleDomainAndRegistryFromGURL( | 1068 rappor::SampleDomainAndRegistryFromGURL( |
| 1060 rappor_service(), "ContentSettings.MixedScript.UserClickedAllow", | 1069 rappor_service(), "ContentSettings.MixedScript.UserClickedAllow", |
| 1061 web_contents()->GetLastCommittedURL()); | 1070 web_contents()->GetLastCommittedURL()); |
| 1062 } | 1071 } |
| 1063 | 1072 |
| 1064 // ContentSettingRPHBubbleModel ------------------------------------------------ | 1073 // ContentSettingRPHBubbleModel ------------------------------------------------ |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 ContentSettingMediaStreamBubbleModel* | 1464 ContentSettingMediaStreamBubbleModel* |
| 1456 ContentSettingBubbleModel::AsMediaStreamBubbleModel() { | 1465 ContentSettingBubbleModel::AsMediaStreamBubbleModel() { |
| 1457 // In general, bubble models might not inherit from the media bubble model. | 1466 // In general, bubble models might not inherit from the media bubble model. |
| 1458 return nullptr; | 1467 return nullptr; |
| 1459 } | 1468 } |
| 1460 | 1469 |
| 1461 ContentSettingSubresourceFilterBubbleModel* | 1470 ContentSettingSubresourceFilterBubbleModel* |
| 1462 ContentSettingBubbleModel::AsSubresourceFilterBubbleModel() { | 1471 ContentSettingBubbleModel::AsSubresourceFilterBubbleModel() { |
| 1463 return nullptr; | 1472 return nullptr; |
| 1464 } | 1473 } |
| OLD | NEW |