| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/background_contents_service.h" | 10 #include "chrome/browser/background_contents_service.h" |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 } | 402 } |
| 403 | 403 |
| 404 void PrerenderContents::OnDidRedirectProvisionalLoad(int32 page_id, | 404 void PrerenderContents::OnDidRedirectProvisionalLoad(int32 page_id, |
| 405 const GURL& source_url, | 405 const GURL& source_url, |
| 406 const GURL& target_url) { | 406 const GURL& target_url) { |
| 407 if (!AddAliasURL(target_url)) | 407 if (!AddAliasURL(target_url)) |
| 408 Destroy(FINAL_STATUS_HTTPS); | 408 Destroy(FINAL_STATUS_HTTPS); |
| 409 } | 409 } |
| 410 | 410 |
| 411 void PrerenderContents::OnUpdateFaviconURL(int32 page_id, | 411 void PrerenderContents::OnUpdateFaviconURL(int32 page_id, |
| 412 const GURL& icon_url) { | 412 std::vector<FaviconURL> urls) { |
| 413 icon_url_ = icon_url; | 413 for (std::vector<FaviconURL>::iterator i = urls.begin(); |
| 414 i != urls.end(); ++i) { |
| 415 if (i->icon_type == FAVICON) { |
| 416 icon_url_ = i->icon_url; |
| 417 return; |
| 418 } |
| 419 } |
| 414 } | 420 } |
| 415 | 421 |
| 416 bool PrerenderContents::AddAliasURL(const GURL& url) { | 422 bool PrerenderContents::AddAliasURL(const GURL& url) { |
| 417 if (!url.SchemeIs("http")) | 423 if (!url.SchemeIs("http")) |
| 418 return false; | 424 return false; |
| 419 alias_urls_.push_back(url); | 425 alias_urls_.push_back(url); |
| 420 return true; | 426 return true; |
| 421 } | 427 } |
| 422 | 428 |
| 423 bool PrerenderContents::MatchesURL(const GURL& url) const { | 429 bool PrerenderContents::MatchesURL(const GURL& url) const { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 return; | 474 return; |
| 469 | 475 |
| 470 size_t private_bytes, shared_bytes; | 476 size_t private_bytes, shared_bytes; |
| 471 if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) { | 477 if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) { |
| 472 if (private_bytes > kMaxPrerenderPrivateMB * 1024 * 1024) | 478 if (private_bytes > kMaxPrerenderPrivateMB * 1024 * 1024) |
| 473 Destroy(FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); | 479 Destroy(FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); |
| 474 } | 480 } |
| 475 } | 481 } |
| 476 | 482 |
| 477 } // namespace prerender | 483 } // namespace prerender |
| OLD | NEW |