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

Side by Side Diff: chrome/browser/toolbar_model.cc

Issue 517054: Remove all uses of EmptyString16(), EmptyWString(), and EmptyGURL(), and thei... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/toolbar_model.h" 5 #include "chrome/browser/toolbar_model.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "chrome/browser/cert_store.h" 8 #include "chrome/browser/cert_store.h"
9 #include "chrome/browser/profile.h" 9 #include "chrome/browser/profile.h"
10 #include "chrome/browser/ssl/ssl_error_info.h" 10 #include "chrome/browser/ssl/ssl_error_info.h"
11 #include "chrome/browser/tab_contents/navigation_controller.h" 11 #include "chrome/browser/tab_contents/navigation_controller.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // should never be NULL. 116 // should never be NULL.
117 DCHECK(navigation_controller); 117 DCHECK(navigation_controller);
118 NavigationEntry* entry = navigation_controller->GetActiveEntry(); 118 NavigationEntry* entry = navigation_controller->GetActiveEntry();
119 DCHECK(entry); 119 DCHECK(entry);
120 120
121 121
122 const NavigationEntry::SSLStatus& ssl = entry->ssl(); 122 const NavigationEntry::SSLStatus& ssl = entry->ssl();
123 switch (ssl.security_style()) { 123 switch (ssl.security_style()) {
124 case SECURITY_STYLE_AUTHENTICATED: { 124 case SECURITY_STYLE_AUTHENTICATED: {
125 if (ssl.has_mixed_content()) { 125 if (ssl.has_mixed_content()) {
126 SSLErrorInfo error_info = 126 SSLErrorInfo error_info = SSLErrorInfo::CreateError(
127 SSLErrorInfo::CreateError(SSLErrorInfo::MIXED_CONTENTS, 127 SSLErrorInfo::MIXED_CONTENTS, NULL, GURL());
128 NULL, GURL::EmptyGURL());
129 text->assign(error_info.short_description()); 128 text->assign(error_info.short_description());
130 } else { 129 } else {
131 DCHECK(entry->url().has_host()); 130 DCHECK(entry->url().has_host());
132 text->assign(l10n_util::GetStringF(IDS_SECURE_CONNECTION, 131 text->assign(l10n_util::GetStringF(IDS_SECURE_CONNECTION,
133 UTF8ToWide(entry->url().host()))); 132 UTF8ToWide(entry->url().host())));
134 } 133 }
135 break; 134 break;
136 } 135 }
137 case SECURITY_STYLE_AUTHENTICATION_BROKEN: { 136 case SECURITY_STYLE_AUTHENTICATION_BROKEN: {
138 CreateErrorText(entry, text); 137 CreateErrorText(entry, text);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 183
185 void ToolbarModel::CreateErrorText(NavigationEntry* entry, std::wstring* text) { 184 void ToolbarModel::CreateErrorText(NavigationEntry* entry, std::wstring* text) {
186 const NavigationEntry::SSLStatus& ssl = entry->ssl(); 185 const NavigationEntry::SSLStatus& ssl = entry->ssl();
187 std::vector<SSLErrorInfo> errors; 186 std::vector<SSLErrorInfo> errors;
188 SSLErrorInfo::GetErrorsForCertStatus(ssl.cert_id(), 187 SSLErrorInfo::GetErrorsForCertStatus(ssl.cert_id(),
189 ssl.cert_status(), 188 ssl.cert_status(),
190 entry->url(), 189 entry->url(),
191 &errors); 190 &errors);
192 if (ssl.has_mixed_content()) { 191 if (ssl.has_mixed_content()) {
193 errors.push_back(SSLErrorInfo::CreateError(SSLErrorInfo::MIXED_CONTENTS, 192 errors.push_back(SSLErrorInfo::CreateError(SSLErrorInfo::MIXED_CONTENTS,
194 NULL, GURL::EmptyGURL())); 193 NULL, GURL()));
195 } 194 }
196 if (ssl.has_unsafe_content()) { 195 if (ssl.has_unsafe_content()) {
197 errors.push_back(SSLErrorInfo::CreateError(SSLErrorInfo::UNSAFE_CONTENTS, 196 errors.push_back(SSLErrorInfo::CreateError(SSLErrorInfo::UNSAFE_CONTENTS,
198 NULL, GURL::EmptyGURL())); 197 NULL, GURL()));
199 } 198 }
200 199
201 int error_count = static_cast<int>(errors.size()); 200 int error_count = static_cast<int>(errors.size());
202 if (error_count == 0) { 201 if (error_count == 0) {
203 text->assign(L""); 202 text->assign(L"");
204 } else if (error_count == 1) { 203 } else if (error_count == 1) {
205 text->assign(errors[0].short_description()); 204 text->assign(errors[0].short_description());
206 } else { 205 } else {
207 // Multiple errors. 206 // Multiple errors.
208 text->assign(l10n_util::GetString(IDS_SEVERAL_SSL_ERRORS)); 207 text->assign(l10n_util::GetString(IDS_SEVERAL_SSL_ERRORS));
209 text->append(L"\n"); 208 text->append(L"\n");
210 for (int i = 0; i < error_count; ++i) { 209 for (int i = 0; i < error_count; ++i) {
211 text->append(errors[i].short_description()); 210 text->append(errors[i].short_description());
212 if (i != error_count - 1) 211 if (i != error_count - 1)
213 text->append(L"\n"); 212 text->append(L"\n");
214 } 213 }
215 } 214 }
216 } 215 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/web_contents_unittest.cc ('k') | chrome/browser/views/bug_report_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698