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 "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/google/google_util.h" | 8 #include "chrome/browser/google/google_util.h" |
9 #include "chrome/browser/infobars/infobar.h" | 9 #include "chrome/browser/infobars/infobar.h" |
10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
11 #include "chrome/common/render_messages.h" | 11 #include "chrome/common/render_messages.h" |
| 12 #include "content/public/browser/render_frame_host.h" |
12 #include "content/public/browser/render_view_host.h" | 13 #include "content/public/browser/render_view_host.h" |
13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
14 #include "content/public/common/page_transition_types.h" | 15 #include "content/public/common/page_transition_types.h" |
15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
17 | 18 |
18 | 19 |
19 // static | 20 // static |
20 void InsecureContentInfoBarDelegate::Create(InfoBarService* infobar_service, | 21 void InsecureContentInfoBarDelegate::Create(InfoBarService* infobar_service, |
21 InfoBarType type) { | 22 InfoBarType type) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return true; | 84 return true; |
84 } | 85 } |
85 | 86 |
86 // Cancel button is labelled "load anyways". It triggers Cancel(), but really | 87 // Cancel button is labelled "load anyways". It triggers Cancel(), but really |
87 // means become insecure, so do the work of reloading the page. | 88 // means become insecure, so do the work of reloading the page. |
88 bool InsecureContentInfoBarDelegate::Cancel() { | 89 bool InsecureContentInfoBarDelegate::Cancel() { |
89 UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", | 90 UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", |
90 (type_ == DISPLAY) ? DISPLAY_USER_OVERRIDE : RUN_USER_OVERRIDE, | 91 (type_ == DISPLAY) ? DISPLAY_USER_OVERRIDE : RUN_USER_OVERRIDE, |
91 NUM_EVENTS); | 92 NUM_EVENTS); |
92 | 93 |
93 int32 routing_id = web_contents()->GetRoutingID(); | 94 web_contents()->SendToAllFrames((type_ == DISPLAY) ? |
94 web_contents()->Send((type_ == DISPLAY) ? | |
95 static_cast<IPC::Message*>( | 95 static_cast<IPC::Message*>( |
96 new ChromeViewMsg_SetAllowDisplayingInsecureContent(routing_id, | 96 new ChromeViewMsg_SetAllowDisplayingInsecureContent(MSG_ROUTING_NONE, |
97 true)) : | 97 true)) : |
98 new ChromeViewMsg_SetAllowRunningInsecureContent(routing_id, true)); | 98 new ChromeViewMsg_SetAllowRunningInsecureContent(MSG_ROUTING_NONE, true)); |
| 99 web_contents()->GetMainFrame()->Send(new ChromeViewMsg_ReloadFrame( |
| 100 web_contents()->GetMainFrame()->GetRoutingID())); |
99 return true; | 101 return true; |
100 } | 102 } |
101 | 103 |
102 base::string16 InsecureContentInfoBarDelegate::GetLinkText() const { | 104 base::string16 InsecureContentInfoBarDelegate::GetLinkText() const { |
103 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 105 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
104 } | 106 } |
105 | 107 |
106 bool InsecureContentInfoBarDelegate::LinkClicked( | 108 bool InsecureContentInfoBarDelegate::LinkClicked( |
107 WindowOpenDisposition disposition) { | 109 WindowOpenDisposition disposition) { |
108 web_contents()->OpenURL(content::OpenURLParams( | 110 web_contents()->OpenURL(content::OpenURLParams( |
109 google_util::AppendGoogleLocaleParam(GURL("https://www.google.com/" | 111 google_util::AppendGoogleLocaleParam(GURL("https://www.google.com/" |
110 "support/chrome/bin/answer.py?answer=1342714")), | 112 "support/chrome/bin/answer.py?answer=1342714")), |
111 content::Referrer(), | 113 content::Referrer(), |
112 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 114 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
113 content::PAGE_TRANSITION_LINK, false)); | 115 content::PAGE_TRANSITION_LINK, false)); |
114 return false; | 116 return false; |
115 } | 117 } |
OLD | NEW |