Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/infobars/insecure_content_infobar_delegate.cc

Issue 56123010: [InfoBar] remove unnecesary checks from some delegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/geolocation/geolocation_infobar_delegate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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((type_ == DISPLAY) ?
95 web_contents()->Send((type_ == DISPLAY) ? 94 static_cast<IPC::Message*>(
96 static_cast<IPC::Message*>( 95 new ChromeViewMsg_SetAllowDisplayingInsecureContent(routing_id,
97 new ChromeViewMsg_SetAllowDisplayingInsecureContent(routing_id, 96 true)) :
98 true)) : 97 new ChromeViewMsg_SetAllowRunningInsecureContent(routing_id, true));
99 new ChromeViewMsg_SetAllowRunningInsecureContent(routing_id, true));
100 }
101 return true; 98 return true;
102 } 99 }
103 100
104 string16 InsecureContentInfoBarDelegate::GetLinkText() const { 101 string16 InsecureContentInfoBarDelegate::GetLinkText() const {
105 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); 102 return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
106 } 103 }
107 104
108 bool InsecureContentInfoBarDelegate::LinkClicked( 105 bool InsecureContentInfoBarDelegate::LinkClicked(
109 WindowOpenDisposition disposition) { 106 WindowOpenDisposition disposition) {
110 web_contents()->OpenURL(content::OpenURLParams( 107 web_contents()->OpenURL(content::OpenURLParams(
111 google_util::AppendGoogleLocaleParam(GURL("https://www.google.com/" 108 google_util::AppendGoogleLocaleParam(GURL("https://www.google.com/"
112 "support/chrome/bin/answer.py?answer=1342714")), 109 "support/chrome/bin/answer.py?answer=1342714")),
113 content::Referrer(), 110 content::Referrer(),
114 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 111 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
115 content::PAGE_TRANSITION_LINK, false)); 112 content::PAGE_TRANSITION_LINK, false));
116 return false; 113 return false;
117 } 114 }
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/geolocation_infobar_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698