diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-12 16:45:32 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-12 16:45:32 +0000 |
commit | 34591ebee0bdd1f1062c0f340b53641f10280f54 (patch) | |
tree | 0a083de4d2b3a152261417be386ea6f46e221673 | |
parent | 60b52141dfcaa58a09d388431f496d8adb92b79a (diff) | |
download | chromium_src-34591ebee0bdd1f1062c0f340b53641f10280f54.zip chromium_src-34591ebee0bdd1f1062c0f340b53641f10280f54.tar.gz chromium_src-34591ebee0bdd1f1062c0f340b53641f10280f54.tar.bz2 |
Add chrome/browser/ssl/ssl_manager.cc to the build.
Review URL: http://codereview.chromium.org/21275
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9656 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser.scons | 1 | ||||
-rw-r--r-- | chrome/browser/ssl/ssl_manager.cc | 29 | ||||
-rw-r--r-- | chrome/browser/tab_contents/navigation_controller.h | 3 | ||||
-rw-r--r-- | chrome/chrome.xcodeproj/project.pbxproj | 2 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.cc | 19 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.h | 93 |
6 files changed, 91 insertions, 56 deletions
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons index 94eed65..a777b0a 100644 --- a/chrome/browser/browser.scons +++ b/chrome/browser/browser.scons @@ -746,7 +746,6 @@ if not env.Bit('windows'): 'sessions/session_restore.cc', 'shell_integration.cc', 'ssl/ssl_blocking_page.cc', - 'ssl/ssl_manager.cc', 'ssl/ssl_policy.cc', 'tab_contents/infobar_delegate.cc', 'tab_contents/interstitial_page.cc', diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc index e92247b..de46783 100644 --- a/chrome/browser/ssl/ssl_manager.cc +++ b/chrome/browser/ssl/ssl_manager.cc @@ -8,17 +8,13 @@ #include "base/string_util.h" #include "chrome/app/theme/theme_resources.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/load_notification_details.h" #include "chrome/browser/load_from_memory_cache_details.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/resource_request_details.h" #include "chrome/browser/ssl/ssl_error_info.h" -#include "chrome/browser/ssl/ssl_policy.h" -#include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/provisional_load_details.h" -#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/l10n_util.h" @@ -26,14 +22,25 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/resource_bundle.h" -#include "chrome/views/decision.h" -#include "chrome/views/link.h" #include "net/base/cert_status_flags.h" #include "net/base/net_errors.h" #include "net/url_request/url_request.h" #include "webkit/glue/resource_type.h" #include "generated_resources.h" +#if defined(OS_WIN) +// TODO(port): Port these files. +#include "chrome/browser/load_notification_details.h" +#include "chrome/browser/ssl/ssl_policy.h" +#include "chrome/browser/tab_contents/infobar_delegate.h" +#include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/views/decision.h" +#include "chrome/views/link.h" +#else +#include "chrome/common/temp_scaffolding_stubs.h" +#endif + + class SSLInfoBarDelegate : public ConfirmInfoBarDelegate { public: SSLInfoBarDelegate(TabContents* contents, @@ -93,8 +100,8 @@ void SSLManager::RegisterUserPrefs(PrefService* prefs) { } SSLManager::SSLManager(NavigationController* controller, Delegate* delegate) - : controller_(controller), - delegate_(delegate) { + : delegate_(delegate), + controller_(controller) { DCHECK(controller_); // If do delegate is supplied, use the default policy. @@ -232,10 +239,10 @@ SSLManager::ErrorHandler::ErrorHandler(ResourceDispatcherHost* rdh, : ui_loop_(ui_loop), io_loop_(MessageLoop::current()), manager_(NULL), - resource_dispatcher_host_(rdh), - request_has_been_notified_(false), request_id_(0, 0), - request_url_(request->url()) { + resource_dispatcher_host_(rdh), + request_url_(request->url()), + request_has_been_notified_(false) { DCHECK(MessageLoop::current() != ui_loop); ResourceDispatcherHost::ExtraRequestInfo* info = diff --git a/chrome/browser/tab_contents/navigation_controller.h b/chrome/browser/tab_contents/navigation_controller.h index f39c595..d84e563 100644 --- a/chrome/browser/tab_contents/navigation_controller.h +++ b/chrome/browser/tab_contents/navigation_controller.h @@ -12,14 +12,13 @@ #if defined(OS_POSIX) // TODO(port): remove when dependent classes are ported #include "chrome/common/temp_scaffolding_stubs.h" -#elif defined(OS_WIN) -#include "chrome/browser/ssl/ssl_manager.h" #endif #include "base/linked_ptr.h" #include "base/ref_counted.h" #include "googleurl/src/gurl.h" #include "chrome/browser/sessions/session_id.h" +#include "chrome/browser/ssl/ssl_manager.h" #include "chrome/browser/tab_contents/tab_contents_type.h" #include "chrome/common/navigation_types.h" #include "chrome/common/page_transition_types.h" diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj index 8ffdcd4..416fce2 100644 --- a/chrome/chrome.xcodeproj/project.pbxproj +++ b/chrome/chrome.xcodeproj/project.pbxproj @@ -124,6 +124,7 @@ 406DFE278638D6132B21B2C9 /* url_pattern.cc in Sources */ = {isa = PBXBuildFile; fileRef = 6447F24FADC63E58A44DB762 /* url_pattern.cc */; }; 423A79243BC7B7C0B1E9B97A /* session_service.cc in Sources */ = {isa = PBXBuildFile; fileRef = C8D26D9EC81E03E91E270463 /* session_service.cc */; }; 475CAF858604B413561740C1 /* cache_manager_host.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF8520E9D4839009A6919 /* cache_manager_host.cc */; }; + 486456FF9CB2AA650DB9FE26 /* ssl_manager.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5D16ECC0F21451600861FAC /* ssl_manager.cc */; }; 49C8AD19AA0094034F59B6F0 /* user_script.cc in Sources */ = {isa = PBXBuildFile; fileRef = 699499C4FBA07FB2D7B298A2 /* user_script.cc */; }; 4D175916B2FC058793051209 /* chrome_paths_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = C18F2A0A6FB6BEF75406511D /* chrome_paths_mac.cc */; }; 4D1F59FE0F2A6BBB0040C1E3 /* image_diff.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D1F59FD0F2A6BBB0040C1E3 /* image_diff.cc */; }; @@ -5385,6 +5386,7 @@ 4D7BFA2D0E9D4910009A6919 /* snippet.cc in Sources */, E45075FA0F150C28003BE099 /* spellcheck_worditerator.cc in Sources */, F775995035B63E51251B0922 /* ssl_error_info.cc in Sources */, + 486456FF9CB2AA650DB9FE26 /* ssl_manager.cc in Sources */, E4F3245D0EE5CFDF002533CE /* starred_url_database.cc in Sources */, E45075EE0F150ABA003BE099 /* sync_resource_handler.cc in Sources */, E455DDBA0F3227A600DD4383 /* tab_cell.mm in Sources */, diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc index 8d6eb8a..3ca2278 100644 --- a/chrome/common/temp_scaffolding_stubs.cc +++ b/chrome/common/temp_scaffolding_stubs.cc @@ -339,20 +339,6 @@ void RunBeforeUnloadDialog(WebContents* web_contents, NOTIMPLEMENTED(); } -bool SSLManager::DeserializeSecurityInfo(const std::string&, int*, int*, int*) { - NOTIMPLEMENTED(); - return false; -} - -void SSLManager::OnSSLCertificateError( - ResourceDispatcherHost* resource_dispatcher, - URLRequest* request, - int cert_error, - net::X509Certificate* cert, - MessageLoop* ui_loop) { - NOTIMPLEMENTED(); -} - //-------------------------------------------------------------------------- void RunRepostFormWarningDialog(NavigationController*) { @@ -430,6 +416,11 @@ void DebuggerShell::ProcessCommand(const std::wstring& data) { } #endif // !CHROME_DEBUGGER_DISABLED +SSLPolicy* SSLPolicy::GetDefaultPolicy() { + NOTIMPLEMENTED(); + return NULL; +} + void HistoryURLProvider::ExecuteWithDB(history::HistoryBackend*, history::URLDatabase*, HistoryURLProviderParams*) { diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h index 1f17cc9..c6b9f28 100644 --- a/chrome/common/temp_scaffolding_stubs.h +++ b/chrome/common/temp_scaffolding_stubs.h @@ -32,6 +32,8 @@ #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/sessions/session_id.h" +#include "chrome/browser/ssl/ssl_error_info.h" +#include "chrome/browser/ssl/ssl_manager.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/page_navigator.h" #include "chrome/browser/tab_contents/tab_contents_type.h" @@ -981,34 +983,6 @@ class ConstrainedWindow { void CloseConstrainedWindow() { NOTIMPLEMENTED(); } }; -class SSLManager { - public: - class Delegate { - public: - }; - SSLManager(NavigationController* controller, Delegate* delegate) { - NOTIMPLEMENTED(); - } - ~SSLManager() { } - void NavigationStateChanged() { NOTIMPLEMENTED(); } - static bool DeserializeSecurityInfo(const std::string&, int*, int*, int*); - static void OnSSLCertificateError(ResourceDispatcherHost* rdh, - URLRequest* request, - int cert_error, - net::X509Certificate* cert, - MessageLoop* ui_loop); - static std::string SerializeSecurityInfo(int cert_id, - int cert_status, - int security_bits) { - NOTIMPLEMENTED(); - return std::string(); - } - static void OnMixedContentRequest(ResourceDispatcherHost* rdh, - URLRequest* request, - MessageLoop* ui_loop) { NOTIMPLEMENTED(); } - void OnMixedContent(MixedContentHandler* mixed_content) { NOTIMPLEMENTED(); } -}; - class ModalHtmlDialogDelegate { public: ModalHtmlDialogDelegate(const GURL&, int, int, const std::string&, @@ -1074,4 +1048,67 @@ class RepostFormWarningDialog { virtual ~RepostFormWarningDialog() { } }; +class SSLBlockingPage : public InterstitialPage { + public: + class Delegate { + public: + virtual SSLErrorInfo GetSSLErrorInfo(SSLManager::CertError* error) = 0; + virtual void OnDenyCertificate(SSLManager::CertError* error) = 0; + virtual void OnAllowCertificate(SSLManager::CertError* error) = 0; + }; + + SSLBlockingPage(SSLManager::CertError* error, Delegate* delegate); + virtual ~SSLBlockingPage(); + + static void SetExtraInfo(DictionaryValue* strings, + const std::vector<std::wstring>& extra_info); + + protected: + virtual std::string GetHTMLContents(); + virtual void CommandReceived(const std::string& command); + virtual void UpdateEntry(NavigationEntry* entry); + virtual void Proceed(); + virtual void DontProceed(); + + private: + void NotifyDenyCertificate(); + void NotifyAllowCertificate(); + + DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); +}; + +class SSLPolicy : public SSLManager::Delegate, + public SSLBlockingPage::Delegate { + public: + static SSLPolicy* GetDefaultPolicy(); + + virtual void OnCertError(const GURL& main_frame_url, + SSLManager::CertError* error); + virtual void OnMixedContent( + NavigationController* navigation_controller, + const GURL& main_frame_url, + SSLManager::MixedContentHandler* mixed_content_handler) { + } + + virtual void OnRequestStarted(SSLManager* manager, + const GURL& url, + ResourceType::Type resource_type, + int ssl_cert_id, + int ssl_cert_status); + virtual SecurityStyle GetDefaultStyle(const GURL& url); + + virtual SSLErrorInfo GetSSLErrorInfo(SSLManager::CertError* error); + virtual void OnDenyCertificate(SSLManager::CertError* error); + virtual void OnAllowCertificate(SSLManager::CertError* error); + + protected: + SSLPolicy(); + void OnOverridableCertError(const GURL& main_frame_url, + SSLManager::CertError* error); + void OnFatalCertError(const GURL& main_frame_url, + SSLManager::CertError* error); + private: + DISALLOW_EVIL_CONSTRUCTORS(SSLPolicy); +}; + #endif // CHROME_COMMON_TEMP_SCAFFOLDING_STUBS_H_ |