| 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 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace history { | 39 namespace history { |
| 40 struct HistoryAddPageArgs; | 40 struct HistoryAddPageArgs; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace prerender { | 43 namespace prerender { |
| 44 | 44 |
| 45 class PrerenderHandle; | 45 class PrerenderHandle; |
| 46 class PrerenderManager; | 46 class PrerenderManager; |
| 47 class PrerenderResourceThrottle; |
| 47 | 48 |
| 48 class PrerenderContents : public content::NotificationObserver, | 49 class PrerenderContents : public content::NotificationObserver, |
| 49 public content::WebContentsObserver { | 50 public content::WebContentsObserver { |
| 50 public: | 51 public: |
| 51 // PrerenderContents::Create uses the currently registered Factory to create | 52 // PrerenderContents::Create uses the currently registered Factory to create |
| 52 // the PrerenderContents. Factory is intended for testing. | 53 // the PrerenderContents. Factory is intended for testing. |
| 53 class Factory { | 54 class Factory { |
| 54 public: | 55 public: |
| 55 Factory() {} | 56 Factory() {} |
| 56 virtual ~Factory() {} | 57 virtual ~Factory() {} |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 309 |
| 309 // Record a cookie transaction for this prerender contents. | 310 // Record a cookie transaction for this prerender contents. |
| 310 // In the event of cookies being sent, |earliest_create_date| contains | 311 // In the event of cookies being sent, |earliest_create_date| contains |
| 311 // the time that the earliest of the cookies sent was created. | 312 // the time that the earliest of the cookies sent was created. |
| 312 void RecordCookieEvent(CookieEvent event, | 313 void RecordCookieEvent(CookieEvent event, |
| 313 bool main_frame_http_request, | 314 bool main_frame_http_request, |
| 314 base::Time earliest_create_date); | 315 base::Time earliest_create_date); |
| 315 | 316 |
| 316 static const int kNumCookieStatuses; | 317 static const int kNumCookieStatuses; |
| 317 | 318 |
| 319 // Called when a PrerenderResourceThrottle defers a request. If the prerender |
| 320 // is used it'll be resumed on the IO thread, otherwise they will get |
| 321 // cancelled automatically if prerendering is cancelled. |
| 322 void AddResourceThrottle( |
| 323 const base::WeakPtr<PrerenderResourceThrottle>& throttle); |
| 324 |
| 318 protected: | 325 protected: |
| 319 PrerenderContents(PrerenderManager* prerender_manager, | 326 PrerenderContents(PrerenderManager* prerender_manager, |
| 320 Profile* profile, | 327 Profile* profile, |
| 321 const GURL& url, | 328 const GURL& url, |
| 322 const content::Referrer& referrer, | 329 const content::Referrer& referrer, |
| 323 Origin origin, | 330 Origin origin, |
| 324 uint8 experiment_id); | 331 uint8 experiment_id); |
| 325 | 332 |
| 326 // These call out to methods on our Observers, using our observer_list_. Note | 333 // These call out to methods on our Observers, using our observer_list_. Note |
| 327 // that NotifyPrerenderStop() also clears the observer list. | 334 // that NotifyPrerenderStop() also clears the observer list. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 AddPageVector add_page_vector_; | 467 AddPageVector add_page_vector_; |
| 461 | 468 |
| 462 // The alias session storage namespace for this prerender. | 469 // The alias session storage namespace for this prerender. |
| 463 scoped_refptr<content::SessionStorageNamespace> | 470 scoped_refptr<content::SessionStorageNamespace> |
| 464 alias_session_storage_namespace; | 471 alias_session_storage_namespace; |
| 465 | 472 |
| 466 // Indicates what internal cookie events (see prerender_contents.cc) have | 473 // Indicates what internal cookie events (see prerender_contents.cc) have |
| 467 // occurred, using 1 bit for each possible InternalCookieEvent. | 474 // occurred, using 1 bit for each possible InternalCookieEvent. |
| 468 int cookie_status_; | 475 int cookie_status_; |
| 469 | 476 |
| 477 // Resources that are throttled, pending a prerender use. Can only access a |
| 478 // throttle on the IO thread. |
| 479 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_; |
| 480 |
| 470 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 481 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
| 471 }; | 482 }; |
| 472 | 483 |
| 473 } // namespace prerender | 484 } // namespace prerender |
| 474 | 485 |
| 475 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 486 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| OLD | NEW |