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/infobars/insecure_content_infobar_delegate.h" | 5 #include "chrome/browser/infobars/insecure_content_infobar_delegate.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "chrome/browser/content_settings/mixed_content_settings.h" |
11 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
12 #include "chrome/common/render_messages.h" | 13 #include "chrome/common/render_messages.h" |
13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
14 #include "components/content_settings/content/common/content_settings_messages.h
" | 15 #include "components/content_settings/content/common/content_settings_messages.h
" |
15 #include "components/google/core/browser/google_util.h" | 16 #include "components/google/core/browser/google_util.h" |
16 #include "components/infobars/core/infobar.h" | 17 #include "components/infobars/core/infobar.h" |
17 #include "content/public/browser/render_frame_host.h" | 18 #include "content/public/browser/render_frame_host.h" |
18 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
20 #include "grit/components_strings.h" | 21 #include "grit/components_strings.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 88 } |
88 | 89 |
89 // Cancel button is labelled "load anyways". It triggers Cancel(), but really | 90 // Cancel button is labelled "load anyways". It triggers Cancel(), but really |
90 // means become insecure, so do the work of reloading the page. | 91 // means become insecure, so do the work of reloading the page. |
91 bool InsecureContentInfoBarDelegate::Cancel() { | 92 bool InsecureContentInfoBarDelegate::Cancel() { |
92 UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", | 93 UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", |
93 DISPLAY_USER_OVERRIDE, NUM_EVENTS); | 94 DISPLAY_USER_OVERRIDE, NUM_EVENTS); |
94 | 95 |
95 content::WebContents* web_contents = | 96 content::WebContents* web_contents = |
96 InfoBarService::WebContentsFromInfoBar(infobar()); | 97 InfoBarService::WebContentsFromInfoBar(infobar()); |
| 98 MixedContentSettings* mixed_content_settings = |
| 99 MixedContentSettings::FromWebContents(web_contents); |
| 100 mixed_content_settings->AllowDisplayingOfInsecureContent(); |
97 web_contents->SendToAllFrames( | 101 web_contents->SendToAllFrames( |
98 new ChromeViewMsg_SetAllowDisplayingInsecureContent( | 102 new ChromeViewMsg_SetAllowDisplayingInsecureContent( |
99 MSG_ROUTING_NONE, true)); | 103 MSG_ROUTING_NONE, true)); |
100 web_contents->GetMainFrame()->Send(new ChromeViewMsg_ReloadFrame( | 104 web_contents->GetMainFrame()->Send(new ChromeViewMsg_ReloadFrame( |
101 web_contents->GetMainFrame()->GetRoutingID())); | 105 web_contents->GetMainFrame()->GetRoutingID())); |
102 return true; | 106 return true; |
103 } | 107 } |
104 | 108 |
105 base::string16 InsecureContentInfoBarDelegate::GetLinkText() const { | 109 base::string16 InsecureContentInfoBarDelegate::GetLinkText() const { |
106 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 110 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
107 } | 111 } |
108 | 112 |
109 GURL InsecureContentInfoBarDelegate::GetLinkURL() const { | 113 GURL InsecureContentInfoBarDelegate::GetLinkURL() const { |
110 return GURL("https://support.google.com/chrome/answer/1342714"); | 114 return GURL("https://support.google.com/chrome/answer/1342714"); |
111 } | 115 } |
OLD | NEW |