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

Side by Side Diff: chrome/browser/ssl/ssl_policy.cc

Issue 31008: Coalesce more hardcoded schemes to using predefined constants. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/ssl/ssl_policy.h" 5 #include "chrome/browser/ssl/ssl_policy.h"
6 6
7 #include "base/singleton.h" 7 #include "base/singleton.h"
8 #include "base/string_piece.h" 8 #include "base/string_piece.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/cert_store.h" 10 #include "chrome/browser/cert_store.h"
11 #include "chrome/browser/renderer_host/render_view_host.h" 11 #include "chrome/browser/renderer_host/render_view_host.h"
12 #include "chrome/browser/ssl/ssl_error_info.h" 12 #include "chrome/browser/ssl/ssl_error_info.h"
13 #include "chrome/browser/tab_contents/navigation_entry.h" 13 #include "chrome/browser/tab_contents/navigation_entry.h"
14 #include "chrome/browser/tab_contents/web_contents.h" 14 #include "chrome/browser/tab_contents/web_contents.h"
15 #include "chrome/common/jstemplate_builder.h" 15 #include "chrome/common/jstemplate_builder.h"
16 #include "chrome/common/l10n_util.h" 16 #include "chrome/common/l10n_util.h"
17 #include "chrome/common/notification_service.h" 17 #include "chrome/common/notification_service.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "chrome/common/pref_service.h" 19 #include "chrome/common/pref_service.h"
20 #include "chrome/common/resource_bundle.h" 20 #include "chrome/common/resource_bundle.h"
21 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/time_format.h" 22 #include "chrome/common/time_format.h"
23 #include "chrome/common/url_constants.h"
23 #include "grit/browser_resources.h" 24 #include "grit/browser_resources.h"
24 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
25 #include "net/base/cert_status_flags.h" 26 #include "net/base/cert_status_flags.h"
26 #include "net/base/ssl_info.h" 27 #include "net/base/ssl_info.h"
27 #include "webkit/glue/console_message_level.h" 28 #include "webkit/glue/console_message_level.h"
28 #include "webkit/glue/resource_type.h" 29 #include "webkit/glue/resource_type.h"
29 30
30 #if defined(OS_WIN) 31 #if defined(OS_WIN)
31 // TODO(port): port these files. 32 // TODO(port): port these files.
32 #include "chrome/browser/tab_contents/tab_contents.h" 33 #include "chrome/browser/tab_contents/tab_contents.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 void SSLPolicy::OnCertError(const GURL& main_frame_url, 370 void SSLPolicy::OnCertError(const GURL& main_frame_url,
370 SSLManager::CertError* error) { 371 SSLManager::CertError* error) {
371 // Default to secure behavior. 372 // Default to secure behavior.
372 error->CancelRequest(); 373 error->CancelRequest();
373 } 374 }
374 375
375 void SSLPolicy::OnRequestStarted(SSLManager* manager, const GURL& url, 376 void SSLPolicy::OnRequestStarted(SSLManager* manager, const GURL& url,
376 ResourceType::Type resource_type, 377 ResourceType::Type resource_type,
377 int ssl_cert_id, int ssl_cert_status) { 378 int ssl_cert_id, int ssl_cert_status) {
378 // These schemes never leave the browser and don't require a warning. 379 // These schemes never leave the browser and don't require a warning.
379 if (url.SchemeIs("data") || url.SchemeIs("javascript") || 380 if (url.SchemeIs(chrome::kDataScheme) ||
380 url.SchemeIs("about")) 381 url.SchemeIs(chrome::kJavaScriptScheme) ||
382 url.SchemeIs(chrome::kAboutScheme))
381 return; 383 return;
382 384
383 NavigationEntry* entry = manager->controller()->GetActiveEntry(); 385 NavigationEntry* entry = manager->controller()->GetActiveEntry();
384 if (!entry) { 386 if (!entry) {
385 // We may not have an entry for cases such as the inspector. 387 // We may not have an entry for cases such as the inspector.
386 return; 388 return;
387 } 389 }
388 390
389 NavigationEntry::SSLStatus& ssl = entry->ssl(); 391 NavigationEntry::SSLStatus& ssl = entry->ssl();
390 bool changed = false; 392 bool changed = false;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 void SSLPolicy::OnFatalCertError(const GURL& main_frame_url, 484 void SSLPolicy::OnFatalCertError(const GURL& main_frame_url,
483 SSLManager::CertError* error) { 485 SSLManager::CertError* error) {
484 if (error->resource_type() != ResourceType::MAIN_FRAME) { 486 if (error->resource_type() != ResourceType::MAIN_FRAME) {
485 error->DenyRequest(); 487 error->DenyRequest();
486 return; 488 return;
487 } 489 }
488 error->CancelRequest(); 490 error->CancelRequest();
489 ShowErrorPage(this, error); 491 ShowErrorPage(this, error);
490 // No need to degrade our security indicators because we didn't continue. 492 // No need to degrade our security indicators because we didn't continue.
491 } 493 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698