OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/prerender/prerender_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 IPC_BEGIN_MESSAGE_MAP(PrerenderContents, message) | 516 IPC_BEGIN_MESSAGE_MAP(PrerenderContents, message) |
517 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CancelPrerenderForPrinting, | 517 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CancelPrerenderForPrinting, |
518 OnCancelPrerenderForPrinting) | 518 OnCancelPrerenderForPrinting) |
519 IPC_MESSAGE_UNHANDLED(handled = false) | 519 IPC_MESSAGE_UNHANDLED(handled = false) |
520 IPC_END_MESSAGE_MAP() | 520 IPC_END_MESSAGE_MAP() |
521 | 521 |
522 return handled; | 522 return handled; |
523 } | 523 } |
524 | 524 |
525 bool PrerenderContents::CheckURL(const GURL& url) { | 525 bool PrerenderContents::CheckURL(const GURL& url) { |
526 const bool http = url.SchemeIs(content::kHttpScheme); | 526 if (!url.SchemeIsHTTPOrHTTPS()) { |
527 const bool https = url.SchemeIs(content::kHttpsScheme); | |
528 if (!http && !https) { | |
529 DCHECK_NE(MATCH_COMPLETE_REPLACEMENT_PENDING, match_complete_status_); | 527 DCHECK_NE(MATCH_COMPLETE_REPLACEMENT_PENDING, match_complete_status_); |
530 Destroy(FINAL_STATUS_UNSUPPORTED_SCHEME); | 528 Destroy(FINAL_STATUS_UNSUPPORTED_SCHEME); |
531 return false; | 529 return false; |
532 } | 530 } |
533 if (https && !prerender_manager_->config().https_allowed) { | |
534 DCHECK_NE(MATCH_COMPLETE_REPLACEMENT_PENDING, match_complete_status_); | |
535 Destroy(FINAL_STATUS_HTTPS); | |
536 return false; | |
537 } | |
538 if (match_complete_status_ != MATCH_COMPLETE_REPLACEMENT_PENDING && | 531 if (match_complete_status_ != MATCH_COMPLETE_REPLACEMENT_PENDING && |
539 prerender_manager_->HasRecentlyBeenNavigatedTo(origin(), url)) { | 532 prerender_manager_->HasRecentlyBeenNavigatedTo(origin(), url)) { |
540 Destroy(FINAL_STATUS_RECENTLY_VISITED); | 533 Destroy(FINAL_STATUS_RECENTLY_VISITED); |
541 return false; | 534 return false; |
542 } | 535 } |
543 return true; | 536 return true; |
544 } | 537 } |
545 | 538 |
546 bool PrerenderContents::AddAliasURL(const GURL& url) { | 539 bool PrerenderContents::AddAliasURL(const GURL& url) { |
547 if (!CheckURL(url)) | 540 if (!CheckURL(url)) |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 return NULL; | 779 return NULL; |
787 return prerender_contents()->GetController(). | 780 return prerender_contents()->GetController(). |
788 GetDefaultSessionStorageNamespace(); | 781 GetDefaultSessionStorageNamespace(); |
789 } | 782 } |
790 | 783 |
791 void PrerenderContents::OnCancelPrerenderForPrinting() { | 784 void PrerenderContents::OnCancelPrerenderForPrinting() { |
792 Destroy(FINAL_STATUS_WINDOW_PRINT); | 785 Destroy(FINAL_STATUS_WINDOW_PRINT); |
793 } | 786 } |
794 | 787 |
795 } // namespace prerender | 788 } // namespace prerender |
OLD | NEW |