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_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 | 75 |
76 // OK button is labelled "don't load". It triggers Accept(), but really | 76 // OK button is labelled "don't load". It triggers Accept(), but really |
77 // means stay secure, so do nothing but count the event and dismiss. | 77 // means stay secure, so do nothing but count the event and dismiss. |
78 bool InsecureContentInfoBarDelegate::Accept() { | 78 bool InsecureContentInfoBarDelegate::Accept() { |
79 UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", | 79 UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", |
80 (type_ == DISPLAY) ? DISPLAY_USER_DID_NOT_LOAD : RUN_USER_DID_NOT_LOAD, | 80 (type_ == DISPLAY) ? DISPLAY_USER_DID_NOT_LOAD : RUN_USER_DID_NOT_LOAD, |
81 NUM_EVENTS); | 81 NUM_EVENTS); |
82 return true; | 82 return true; |
83 } | 83 } |
84 | 84 |
85 | |
86 // Cancel button is labelled "load anyways". It triggers Cancel(), but really | 85 // Cancel button is labelled "load anyways". It triggers Cancel(), but really |
87 // means become insecure, so do the work of reloading the page. | 86 // means become insecure, so do the work of reloading the page. |
88 bool InsecureContentInfoBarDelegate::Cancel() { | 87 bool InsecureContentInfoBarDelegate::Cancel() { |
89 UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", | 88 UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", |
90 (type_ == DISPLAY) ? DISPLAY_USER_OVERRIDE : RUN_USER_OVERRIDE, | 89 (type_ == DISPLAY) ? DISPLAY_USER_OVERRIDE : RUN_USER_OVERRIDE, |
91 NUM_EVENTS); | 90 NUM_EVENTS); |
92 | 91 |
93 if (web_contents()) { | 92 int32 routing_id = web_contents()->GetRoutingID(); |
94 int32 routing_id = web_contents()->GetRoutingID(); | 93 web_contents()->Send( |
Peter Kasting
2013/11/04 22:14:19
Nit: The old wrapping (for this whole block) was c
Miguel Garcia
2013/11/05 14:17:56
Done.
| |
95 web_contents()->Send((type_ == DISPLAY) ? | 94 (type_ == DISPLAY) |
96 static_cast<IPC::Message*>( | 95 ? static_cast<IPC::Message*>( |
97 new ChromeViewMsg_SetAllowDisplayingInsecureContent(routing_id, | 96 new ChromeViewMsg_SetAllowDisplayingInsecureContent(routing_id, |
98 true)) : | 97 true)) |
99 new ChromeViewMsg_SetAllowRunningInsecureContent(routing_id, true)); | 98 : new ChromeViewMsg_SetAllowRunningInsecureContent(routing_id, true)); |
100 } | |
101 return true; | 99 return true; |
102 } | 100 } |
103 | 101 |
104 string16 InsecureContentInfoBarDelegate::GetLinkText() const { | 102 string16 InsecureContentInfoBarDelegate::GetLinkText() const { |
105 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 103 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
106 } | 104 } |
107 | 105 |
108 bool InsecureContentInfoBarDelegate::LinkClicked( | 106 bool InsecureContentInfoBarDelegate::LinkClicked( |
109 WindowOpenDisposition disposition) { | 107 WindowOpenDisposition disposition) { |
110 web_contents()->OpenURL(content::OpenURLParams( | 108 web_contents()->OpenURL(content::OpenURLParams( |
111 google_util::AppendGoogleLocaleParam(GURL("https://www.google.com/" | 109 google_util::AppendGoogleLocaleParam(GURL("https://www.google.com/" |
112 "support/chrome/bin/answer.py?answer=1342714")), | 110 "support/chrome/bin/answer.py?answer=1342714")), |
113 content::Referrer(), | 111 content::Referrer(), |
114 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 112 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
115 content::PAGE_TRANSITION_LINK, false)); | 113 content::PAGE_TRANSITION_LINK, false)); |
116 return false; | 114 return false; |
117 } | 115 } |
OLD | NEW |