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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1019 public: | 1021 public: |
1020 ContentSettingMixedScriptBubbleModel(Delegate* delegate, | 1022 ContentSettingMixedScriptBubbleModel(Delegate* delegate, |
1021 WebContents* web_contents, | 1023 WebContents* web_contents, |
1022 Profile* profile); | 1024 Profile* profile); |
1023 | 1025 |
1024 ~ContentSettingMixedScriptBubbleModel() override {} | 1026 ~ContentSettingMixedScriptBubbleModel() override {} |
1025 | 1027 |
1026 private: | 1028 private: |
1027 void OnCustomLinkClicked() override; | 1029 void OnCustomLinkClicked() override; |
1028 | 1030 |
1031 static void SetAllowRunningInsecureContent( | |
Sam McNally
2017/02/03 17:36:58
Make this a function in the anonymous namespace.
nigeltao1
2017/02/04 06:29:09
Done.
| |
1032 content::RenderFrameHost* main_frame, | |
1033 content::RenderFrameHost* frame); | |
1034 | |
1029 DISALLOW_COPY_AND_ASSIGN(ContentSettingMixedScriptBubbleModel); | 1035 DISALLOW_COPY_AND_ASSIGN(ContentSettingMixedScriptBubbleModel); |
1030 }; | 1036 }; |
1031 | 1037 |
1032 ContentSettingMixedScriptBubbleModel::ContentSettingMixedScriptBubbleModel( | 1038 ContentSettingMixedScriptBubbleModel::ContentSettingMixedScriptBubbleModel( |
1033 Delegate* delegate, | 1039 Delegate* delegate, |
1034 WebContents* web_contents, | 1040 WebContents* web_contents, |
1035 Profile* profile) | 1041 Profile* profile) |
1036 : ContentSettingSimpleBubbleModel( | 1042 : ContentSettingSimpleBubbleModel( |
1037 delegate, | 1043 delegate, |
1038 web_contents, | 1044 web_contents, |
1039 profile, | 1045 profile, |
1040 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) { | 1046 CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) { |
1041 content_settings::RecordMixedScriptAction( | 1047 content_settings::RecordMixedScriptAction( |
1042 content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_BUBBLE); | 1048 content_settings::MIXED_SCRIPT_ACTION_DISPLAYED_BUBBLE); |
1043 set_custom_link_enabled(true); | 1049 set_custom_link_enabled(true); |
1044 } | 1050 } |
1045 | 1051 |
1046 void ContentSettingMixedScriptBubbleModel::OnCustomLinkClicked() { | 1052 void ContentSettingMixedScriptBubbleModel::OnCustomLinkClicked() { |
1047 DCHECK(rappor_service()); | 1053 DCHECK(rappor_service()); |
1048 if (!web_contents()) | 1054 if (!web_contents()) |
1049 return; | 1055 return; |
1050 | 1056 |
1051 web_contents()->SendToAllFrames( | 1057 web_contents()->ForEachFrame( |
1052 new ChromeViewMsg_SetAllowRunningInsecureContent(MSG_ROUTING_NONE, true)); | 1058 base::Bind(&SetAllowRunningInsecureContent, |
1053 web_contents()->GetMainFrame()->Send(new ChromeViewMsg_ReloadFrame( | 1059 base::Unretained(web_contents()->GetMainFrame()))); |
1054 web_contents()->GetMainFrame()->GetRoutingID())); | |
1055 | 1060 |
1056 content_settings::RecordMixedScriptAction( | 1061 content_settings::RecordMixedScriptAction( |
1057 content_settings::MIXED_SCRIPT_ACTION_CLICKED_ALLOW); | 1062 content_settings::MIXED_SCRIPT_ACTION_CLICKED_ALLOW); |
1058 | 1063 |
1059 rappor::SampleDomainAndRegistryFromGURL( | 1064 rappor::SampleDomainAndRegistryFromGURL( |
1060 rappor_service(), "ContentSettings.MixedScript.UserClickedAllow", | 1065 rappor_service(), "ContentSettings.MixedScript.UserClickedAllow", |
1061 web_contents()->GetLastCommittedURL()); | 1066 web_contents()->GetLastCommittedURL()); |
1062 } | 1067 } |
1063 | 1068 |
1069 // static | |
1070 void ContentSettingMixedScriptBubbleModel::SetAllowRunningInsecureContent( | |
1071 content::RenderFrameHost* main_frame, | |
1072 content::RenderFrameHost* frame) { | |
1073 chrome::mojom::InsecureContentRendererPtr renderer; | |
1074 frame->GetRemoteInterfaces()->GetInterface(&renderer); | |
1075 renderer->SetAllowRunningInsecureContent(true, main_frame == frame); | |
1076 } | |
1077 | |
1064 // ContentSettingRPHBubbleModel ------------------------------------------------ | 1078 // ContentSettingRPHBubbleModel ------------------------------------------------ |
1065 | 1079 |
1066 ContentSettingRPHBubbleModel::ContentSettingRPHBubbleModel( | 1080 ContentSettingRPHBubbleModel::ContentSettingRPHBubbleModel( |
1067 Delegate* delegate, | 1081 Delegate* delegate, |
1068 WebContents* web_contents, | 1082 WebContents* web_contents, |
1069 Profile* profile, | 1083 Profile* profile, |
1070 ProtocolHandlerRegistry* registry) | 1084 ProtocolHandlerRegistry* registry) |
1071 : ContentSettingSimpleBubbleModel(delegate, | 1085 : ContentSettingSimpleBubbleModel(delegate, |
1072 web_contents, | 1086 web_contents, |
1073 profile, | 1087 profile, |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1455 ContentSettingMediaStreamBubbleModel* | 1469 ContentSettingMediaStreamBubbleModel* |
1456 ContentSettingBubbleModel::AsMediaStreamBubbleModel() { | 1470 ContentSettingBubbleModel::AsMediaStreamBubbleModel() { |
1457 // In general, bubble models might not inherit from the media bubble model. | 1471 // In general, bubble models might not inherit from the media bubble model. |
1458 return nullptr; | 1472 return nullptr; |
1459 } | 1473 } |
1460 | 1474 |
1461 ContentSettingSubresourceFilterBubbleModel* | 1475 ContentSettingSubresourceFilterBubbleModel* |
1462 ContentSettingBubbleModel::AsSubresourceFilterBubbleModel() { | 1476 ContentSettingBubbleModel::AsSubresourceFilterBubbleModel() { |
1463 return nullptr; | 1477 return nullptr; |
1464 } | 1478 } |
OLD | NEW |