| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 // TODO(ajwong): Remove the temporary map once prerendering is aware of | 448 // TODO(ajwong): Remove the temporary map once prerendering is aware of |
| 449 // multiple session storage namespaces per tab. | 449 // multiple session storage namespaces per tab. |
| 450 content::SessionStorageNamespaceMap session_storage_namespace_map; | 450 content::SessionStorageNamespaceMap session_storage_namespace_map; |
| 451 session_storage_namespace_map[std::string()] = session_storage_namespace; | 451 session_storage_namespace_map[std::string()] = session_storage_namespace; |
| 452 return WebContents::CreateWithSessionStorage( | 452 return WebContents::CreateWithSessionStorage( |
| 453 WebContents::CreateParams(profile_), session_storage_namespace_map); | 453 WebContents::CreateParams(profile_), session_storage_namespace_map); |
| 454 } | 454 } |
| 455 | 455 |
| 456 void PrerenderContents::NotifyPrerenderStart() { | 456 void PrerenderContents::NotifyPrerenderStart() { |
| 457 DCHECK_EQ(FINAL_STATUS_MAX, final_status_); | 457 DCHECK_EQ(FINAL_STATUS_MAX, final_status_); |
| 458 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStart(this)); | 458 for (Observer& observer : observer_list_) |
| 459 observer.OnPrerenderStart(this); |
| 459 } | 460 } |
| 460 | 461 |
| 461 void PrerenderContents::NotifyPrerenderStopLoading() { | 462 void PrerenderContents::NotifyPrerenderStopLoading() { |
| 462 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStopLoading(this)); | 463 for (Observer& observer : observer_list_) |
| 464 observer.OnPrerenderStopLoading(this); |
| 463 } | 465 } |
| 464 | 466 |
| 465 void PrerenderContents::NotifyPrerenderDomContentLoaded() { | 467 void PrerenderContents::NotifyPrerenderDomContentLoaded() { |
| 466 FOR_EACH_OBSERVER(Observer, observer_list_, | 468 for (Observer& observer : observer_list_) |
| 467 OnPrerenderDomContentLoaded(this)); | 469 observer.OnPrerenderDomContentLoaded(this); |
| 468 } | 470 } |
| 469 | 471 |
| 470 void PrerenderContents::NotifyPrerenderStop() { | 472 void PrerenderContents::NotifyPrerenderStop() { |
| 471 DCHECK_NE(FINAL_STATUS_MAX, final_status_); | 473 DCHECK_NE(FINAL_STATUS_MAX, final_status_); |
| 472 FOR_EACH_OBSERVER(Observer, observer_list_, OnPrerenderStop(this)); | 474 for (Observer& observer : observer_list_) |
| 475 observer.OnPrerenderStop(this); |
| 473 observer_list_.Clear(); | 476 observer_list_.Clear(); |
| 474 } | 477 } |
| 475 | 478 |
| 476 bool PrerenderContents::OnMessageReceived(const IPC::Message& message) { | 479 bool PrerenderContents::OnMessageReceived(const IPC::Message& message) { |
| 477 bool handled = true; | 480 bool handled = true; |
| 478 // The following messages we do want to consume. | 481 // The following messages we do want to consume. |
| 479 IPC_BEGIN_MESSAGE_MAP(PrerenderContents, message) | 482 IPC_BEGIN_MESSAGE_MAP(PrerenderContents, message) |
| 480 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CancelPrerenderForPrinting, | 483 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CancelPrerenderForPrinting, |
| 481 OnCancelPrerenderForPrinting) | 484 OnCancelPrerenderForPrinting) |
| 482 IPC_MESSAGE_UNHANDLED(handled = false) | 485 IPC_MESSAGE_UNHANDLED(handled = false) |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 void PrerenderContents::AddResourceThrottle( | 748 void PrerenderContents::AddResourceThrottle( |
| 746 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { | 749 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { |
| 747 resource_throttles_.push_back(throttle); | 750 resource_throttles_.push_back(throttle); |
| 748 } | 751 } |
| 749 | 752 |
| 750 void PrerenderContents::AddNetworkBytes(int64_t bytes) { | 753 void PrerenderContents::AddNetworkBytes(int64_t bytes) { |
| 751 network_bytes_ += bytes; | 754 network_bytes_ += bytes; |
| 752 } | 755 } |
| 753 | 756 |
| 754 } // namespace prerender | 757 } // namespace prerender |
| OLD | NEW |