| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/prerender/prerender_final_status.h" | 16 #include "chrome/browser/prerender/prerender_final_status.h" |
| 17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/browser/web_contents_observer.h" | 19 #include "content/public/browser/web_contents_observer.h" |
| 20 #include "content/public/common/referrer.h" | 20 #include "content/public/common/referrer.h" |
| 21 | 21 |
| 22 class Profile; | 22 class Profile; |
| 23 class RenderViewHost; | |
| 24 class TabContentsWrapper; | 23 class TabContentsWrapper; |
| 25 struct FaviconURL; | 24 struct FaviconURL; |
| 26 | 25 |
| 27 namespace base { | 26 namespace base { |
| 28 class ProcessMetrics; | 27 class ProcessMetrics; |
| 29 } | 28 } |
| 30 | 29 |
| 31 namespace content { | 30 namespace content { |
| 31 class RenderViewHost; |
| 32 class RenderViewHostDelegate; | 32 class RenderViewHostDelegate; |
| 33 class SessionStorageNamespace; | 33 class SessionStorageNamespace; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace prerender { | 36 namespace prerender { |
| 37 | 37 |
| 38 class PrerenderManager; | 38 class PrerenderManager; |
| 39 class PrerenderRenderViewHostObserver; | 39 class PrerenderRenderViewHostObserver; |
| 40 class PrerenderTracker; | 40 class PrerenderTracker; |
| 41 | 41 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 virtual ~PrerenderContents(); | 101 virtual ~PrerenderContents(); |
| 102 | 102 |
| 103 bool Init(); | 103 bool Init(); |
| 104 | 104 |
| 105 static Factory* CreateFactory(); | 105 static Factory* CreateFactory(); |
| 106 | 106 |
| 107 // |source_render_view_host| is the RenderViewHost that initiated | 107 // |source_render_view_host| is the RenderViewHost that initiated |
| 108 // prerendering. | 108 // prerendering. |
| 109 virtual void StartPrerendering( | 109 virtual void StartPrerendering( |
| 110 const RenderViewHost* source_render_view_host, | 110 const content::RenderViewHost* source_render_view_host, |
| 111 content::SessionStorageNamespace* session_storage_namespace); | 111 content::SessionStorageNamespace* session_storage_namespace); |
| 112 | 112 |
| 113 // Verifies that the prerendering is not using too many resources, and kills | 113 // Verifies that the prerendering is not using too many resources, and kills |
| 114 // it if not. | 114 // it if not. |
| 115 void DestroyWhenUsingTooManyResources(); | 115 void DestroyWhenUsingTooManyResources(); |
| 116 | 116 |
| 117 RenderViewHost* render_view_host_mutable(); | 117 content::RenderViewHost* render_view_host_mutable(); |
| 118 const RenderViewHost* render_view_host() const; | 118 const content::RenderViewHost* render_view_host() const; |
| 119 string16 title() const { return title_; } | 119 string16 title() const { return title_; } |
| 120 int32 page_id() const { return page_id_; } | 120 int32 page_id() const { return page_id_; } |
| 121 GURL icon_url() const { return icon_url_; } | 121 GURL icon_url() const { return icon_url_; } |
| 122 const GURL& prerender_url() const { return prerender_url_; } | 122 const GURL& prerender_url() const { return prerender_url_; } |
| 123 const content::Referrer& referrer() const { return referrer_; } | 123 const content::Referrer& referrer() const { return referrer_; } |
| 124 bool has_stopped_loading() const { return has_stopped_loading_; } | 124 bool has_stopped_loading() const { return has_stopped_loading_; } |
| 125 bool has_finished_loading() const { return has_finished_loading_; } | 125 bool has_finished_loading() const { return has_finished_loading_; } |
| 126 bool prerendering_has_started() const { return prerendering_has_started_; } | 126 bool prerendering_has_started() const { return prerendering_has_started_; } |
| 127 MatchCompleteStatus match_complete_status() const { | 127 MatchCompleteStatus match_complete_status() const { |
| 128 return match_complete_status_; | 128 return match_complete_status_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 158 void OnJSOutOfMemory(); | 158 void OnJSOutOfMemory(); |
| 159 bool ShouldSuppressDialogs(); | 159 bool ShouldSuppressDialogs(); |
| 160 | 160 |
| 161 // content::WebContentsObserver implementation. | 161 // content::WebContentsObserver implementation. |
| 162 virtual void DidStopLoading() OVERRIDE; | 162 virtual void DidStopLoading() OVERRIDE; |
| 163 virtual void DidStartProvisionalLoadForFrame( | 163 virtual void DidStartProvisionalLoadForFrame( |
| 164 int64 frame_id, | 164 int64 frame_id, |
| 165 bool is_main_frame, | 165 bool is_main_frame, |
| 166 const GURL& validated_url, | 166 const GURL& validated_url, |
| 167 bool is_error_page, | 167 bool is_error_page, |
| 168 RenderViewHost* render_view_host) OVERRIDE; | 168 content::RenderViewHost* render_view_host) OVERRIDE; |
| 169 virtual void DidFinishLoad(int64 frame_id, | 169 virtual void DidFinishLoad(int64 frame_id, |
| 170 const GURL& validated_url, | 170 const GURL& validated_url, |
| 171 bool is_main_frame) OVERRIDE; | 171 bool is_main_frame) OVERRIDE; |
| 172 | 172 |
| 173 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 173 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
| 174 | 174 |
| 175 // content::NotificationObserver | 175 // content::NotificationObserver |
| 176 virtual void Observe(int type, | 176 virtual void Observe(int type, |
| 177 const content::NotificationSource& source, | 177 const content::NotificationSource& source, |
| 178 const content::NotificationDetails& details) OVERRIDE; | 178 const content::NotificationDetails& details) OVERRIDE; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 PrerenderContents(PrerenderManager* prerender_manager, | 224 PrerenderContents(PrerenderManager* prerender_manager, |
| 225 PrerenderTracker* prerender_tracker, | 225 PrerenderTracker* prerender_tracker, |
| 226 Profile* profile, | 226 Profile* profile, |
| 227 const GURL& url, | 227 const GURL& url, |
| 228 const content::Referrer& referrer, | 228 const content::Referrer& referrer, |
| 229 Origin origin, | 229 Origin origin, |
| 230 uint8 experiment_id); | 230 uint8 experiment_id); |
| 231 | 231 |
| 232 // Called whenever a RenderViewHost is created for prerendering. Only called | 232 // Called whenever a RenderViewHost is created for prerendering. Only called |
| 233 // once the RenderViewHost has a RenderView and RenderWidgetHostView. | 233 // once the RenderViewHost has a RenderView and RenderWidgetHostView. |
| 234 virtual void OnRenderViewHostCreated(RenderViewHost* new_render_view_host); | 234 virtual void OnRenderViewHostCreated( |
| 235 content::RenderViewHost* new_render_view_host); |
| 235 | 236 |
| 236 content::NotificationRegistrar& notification_registrar() { | 237 content::NotificationRegistrar& notification_registrar() { |
| 237 return notification_registrar_; | 238 return notification_registrar_; |
| 238 } | 239 } |
| 239 | 240 |
| 240 const PendingPrerenderList* pending_prerender_list() const { | 241 const PendingPrerenderList* pending_prerender_list() const { |
| 241 return &pending_prerender_list_; | 242 return &pending_prerender_list_; |
| 242 } | 243 } |
| 243 | 244 |
| 244 private: | 245 private: |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 338 |
| 338 // List of all pages the prerendered page has tried to prerender. | 339 // List of all pages the prerendered page has tried to prerender. |
| 339 PendingPrerenderList pending_prerender_list_; | 340 PendingPrerenderList pending_prerender_list_; |
| 340 | 341 |
| 341 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 342 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
| 342 }; | 343 }; |
| 343 | 344 |
| 344 } // namespace prerender | 345 } // namespace prerender |
| 345 | 346 |
| 346 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 347 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| OLD | NEW |