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" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 return true; | 84 return true; |
85 } | 85 } |
86 | 86 |
87 // Cancel button is labelled "load anyways". It triggers Cancel(), but really | 87 // Cancel button is labelled "load anyways". It triggers Cancel(), but really |
88 // means become insecure, so do the work of reloading the page. | 88 // means become insecure, so do the work of reloading the page. |
89 bool InsecureContentInfoBarDelegate::Cancel() { | 89 bool InsecureContentInfoBarDelegate::Cancel() { |
90 UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", | 90 UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", |
91 (type_ == DISPLAY) ? DISPLAY_USER_OVERRIDE : RUN_USER_OVERRIDE, | 91 (type_ == DISPLAY) ? DISPLAY_USER_OVERRIDE : RUN_USER_OVERRIDE, |
92 NUM_EVENTS); | 92 NUM_EVENTS); |
93 | 93 |
94 web_contents()->SendToAllFrames((type_ == DISPLAY) ? | 94 content::WebContents* web_contents = |
| 95 InfoBarService::WebContentsFromInfoBar(infobar()); |
| 96 web_contents->SendToAllFrames((type_ == DISPLAY) ? |
95 static_cast<IPC::Message*>( | 97 static_cast<IPC::Message*>( |
96 new ChromeViewMsg_SetAllowDisplayingInsecureContent(MSG_ROUTING_NONE, | 98 new ChromeViewMsg_SetAllowDisplayingInsecureContent(MSG_ROUTING_NONE, |
97 true)) : | 99 true)) : |
98 new ChromeViewMsg_SetAllowRunningInsecureContent(MSG_ROUTING_NONE, true)); | 100 new ChromeViewMsg_SetAllowRunningInsecureContent(MSG_ROUTING_NONE, true)); |
99 web_contents()->GetMainFrame()->Send(new ChromeViewMsg_ReloadFrame( | 101 web_contents->GetMainFrame()->Send(new ChromeViewMsg_ReloadFrame( |
100 web_contents()->GetMainFrame()->GetRoutingID())); | 102 web_contents->GetMainFrame()->GetRoutingID())); |
101 return true; | 103 return true; |
102 } | 104 } |
103 | 105 |
104 base::string16 InsecureContentInfoBarDelegate::GetLinkText() const { | 106 base::string16 InsecureContentInfoBarDelegate::GetLinkText() const { |
105 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 107 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
106 } | 108 } |
107 | 109 |
108 bool InsecureContentInfoBarDelegate::LinkClicked( | 110 bool InsecureContentInfoBarDelegate::LinkClicked( |
109 WindowOpenDisposition disposition) { | 111 WindowOpenDisposition disposition) { |
110 web_contents()->OpenURL(content::OpenURLParams( | 112 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( |
111 google_util::AppendGoogleLocaleParam(GURL("https://www.google.com/" | 113 content::OpenURLParams( |
112 "support/chrome/bin/answer.py?answer=1342714")), | 114 google_util::AppendGoogleLocaleParam(GURL( |
113 content::Referrer(), | 115 "https://www.google.com/" |
114 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 116 "support/chrome/bin/answer.py?answer=1342714")), |
115 content::PAGE_TRANSITION_LINK, false)); | 117 content::Referrer(), |
| 118 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 119 content::PAGE_TRANSITION_LINK, false)); |
116 return false; | 120 return false; |
117 } | 121 } |
OLD | NEW |