| 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 | 443 |
| 444 void PrerenderContents::OnDidRedirectProvisionalLoad(int32 page_id, | 444 void PrerenderContents::OnDidRedirectProvisionalLoad(int32 page_id, |
| 445 const GURL& source_url, | 445 const GURL& source_url, |
| 446 const GURL& target_url) { | 446 const GURL& target_url) { |
| 447 if (!AddAliasURL(target_url)) | 447 if (!AddAliasURL(target_url)) |
| 448 Destroy(FINAL_STATUS_HTTPS); | 448 Destroy(FINAL_STATUS_HTTPS); |
| 449 } | 449 } |
| 450 | 450 |
| 451 void PrerenderContents::OnUpdateFaviconURL(int32 page_id, | 451 void PrerenderContents::OnUpdateFaviconURL( |
| 452 const GURL& icon_url) { | 452 int32 page_id, |
| 453 icon_url_ = icon_url; | 453 const std::vector<FaviconURL>& urls) { |
| 454 LOG(INFO) << "PrerenderContents::OnUpdateFaviconURL" << icon_url_; |
| 455 for (std::vector<FaviconURL>::const_iterator i = urls.begin(); |
| 456 i != urls.end(); ++i) { |
| 457 if (i->icon_type == FAVICON) { |
| 458 icon_url_ = i->icon_url; |
| 459 LOG(INFO) << icon_url_; |
| 460 return; |
| 461 } |
| 462 } |
| 454 } | 463 } |
| 455 | 464 |
| 456 void PrerenderContents::OnMaybeCancelPrerender( | 465 void PrerenderContents::OnMaybeCancelPrerender( |
| 457 PrerenderCancellationReason reason) { | 466 PrerenderCancellationReason reason) { |
| 458 switch (reason) { | 467 switch (reason) { |
| 459 case PRERENDER_CANCELLATION_REASON_HTML5_MEDIA: | 468 case PRERENDER_CANCELLATION_REASON_HTML5_MEDIA: |
| 460 Destroy(FINAL_STATUS_HTML5_MEDIA); | 469 Destroy(FINAL_STATUS_HTML5_MEDIA); |
| 461 return; | 470 return; |
| 462 default: | 471 default: |
| 463 LOG(DFATAL) << "Invalid reason " << reason | 472 LOG(DFATAL) << "Invalid reason " << reason |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 return; | 532 return; |
| 524 | 533 |
| 525 size_t private_bytes, shared_bytes; | 534 size_t private_bytes, shared_bytes; |
| 526 if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) { | 535 if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) { |
| 527 if (private_bytes > kMaxPrerenderPrivateMB * 1024 * 1024) | 536 if (private_bytes > kMaxPrerenderPrivateMB * 1024 * 1024) |
| 528 Destroy(FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); | 537 Destroy(FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); |
| 529 } | 538 } |
| 530 } | 539 } |
| 531 | 540 |
| 532 } // namespace prerender | 541 } // namespace prerender |
| OLD | NEW |