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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 } | 401 } |
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( |
412 const GURL& icon_url) { | 412 int32 page_id, |
413 icon_url_ = icon_url; | 413 const std::vector<FaviconURL>& urls) { |
| 414 for (std::vector<FaviconURL>::const_iterator i = urls.begin(); |
| 415 i != urls.end(); ++i) { |
| 416 if (i->icon_type == FAVICON) { |
| 417 icon_url_ = i->icon_url; |
| 418 return; |
| 419 } |
| 420 } |
414 } | 421 } |
415 | 422 |
416 bool PrerenderContents::AddAliasURL(const GURL& url) { | 423 bool PrerenderContents::AddAliasURL(const GURL& url) { |
417 if (!url.SchemeIs("http")) | 424 if (!url.SchemeIs("http")) |
418 return false; | 425 return false; |
419 alias_urls_.push_back(url); | 426 alias_urls_.push_back(url); |
420 return true; | 427 return true; |
421 } | 428 } |
422 | 429 |
423 bool PrerenderContents::MatchesURL(const GURL& url) const { | 430 bool PrerenderContents::MatchesURL(const GURL& url) const { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 return; | 475 return; |
469 | 476 |
470 size_t private_bytes, shared_bytes; | 477 size_t private_bytes, shared_bytes; |
471 if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) { | 478 if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) { |
472 if (private_bytes > kMaxPrerenderPrivateMB * 1024 * 1024) | 479 if (private_bytes > kMaxPrerenderPrivateMB * 1024 * 1024) |
473 Destroy(FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); | 480 Destroy(FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); |
474 } | 481 } |
475 } | 482 } |
476 | 483 |
477 } // namespace prerender | 484 } // namespace prerender |
OLD | NEW |