| 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_manager.h" | 5 #include "chrome/browser/prerender/prerender_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 | 727 |
| 728 // static | 728 // static |
| 729 bool PrerenderManager::DoesURLHaveValidScheme(const GURL& url) { | 729 bool PrerenderManager::DoesURLHaveValidScheme(const GURL& url) { |
| 730 return (url.SchemeIsHTTPOrHTTPS() || | 730 return (url.SchemeIsHTTPOrHTTPS() || |
| 731 url.SchemeIs(extensions::kExtensionScheme) || | 731 url.SchemeIs(extensions::kExtensionScheme) || |
| 732 url.SchemeIs("data")); | 732 url.SchemeIs("data")); |
| 733 } | 733 } |
| 734 | 734 |
| 735 // static | 735 // static |
| 736 bool PrerenderManager::DoesSubresourceURLHaveValidScheme(const GURL& url) { | 736 bool PrerenderManager::DoesSubresourceURLHaveValidScheme(const GURL& url) { |
| 737 return DoesURLHaveValidScheme(url) || url == GURL(url::kAboutBlankURL); | 737 return DoesURLHaveValidScheme(url) || url == url::kAboutBlankURL; |
| 738 } | 738 } |
| 739 | 739 |
| 740 std::unique_ptr<base::DictionaryValue> PrerenderManager::GetAsValue() const { | 740 std::unique_ptr<base::DictionaryValue> PrerenderManager::GetAsValue() const { |
| 741 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 741 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 742 | 742 |
| 743 auto dict_value = base::MakeUnique<base::DictionaryValue>(); | 743 auto dict_value = base::MakeUnique<base::DictionaryValue>(); |
| 744 dict_value->Set("history", prerender_history_->GetEntriesAsValue()); | 744 dict_value->Set("history", prerender_history_->GetEntriesAsValue()); |
| 745 dict_value->Set("active", GetActivePrerendersAsValue()); | 745 dict_value->Set("active", GetActivePrerendersAsValue()); |
| 746 dict_value->SetBoolean("enabled", | 746 dict_value->SetBoolean("enabled", |
| 747 GetPredictionStatus() == NetworkPredictionStatus::ENABLED); | 747 GetPredictionStatus() == NetworkPredictionStatus::ENABLED); |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 DCHECK_EQ(1u, erased); | 1354 DCHECK_EQ(1u, erased); |
| 1355 } | 1355 } |
| 1356 | 1356 |
| 1357 void PrerenderManager::SetPrerenderContentsFactoryForTest( | 1357 void PrerenderManager::SetPrerenderContentsFactoryForTest( |
| 1358 PrerenderContents::Factory* prerender_contents_factory) { | 1358 PrerenderContents::Factory* prerender_contents_factory) { |
| 1359 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1359 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1360 prerender_contents_factory_.reset(prerender_contents_factory); | 1360 prerender_contents_factory_.reset(prerender_contents_factory); |
| 1361 } | 1361 } |
| 1362 | 1362 |
| 1363 } // namespace prerender | 1363 } // namespace prerender |
| OLD | NEW |