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 <set> | |
8 #include <string> | 9 #include <string> |
9 #include <utility> | 10 #include <utility> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
17 #include "base/values.h" | 18 #include "base/values.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 // to be created, and is needed so that the prerendered URLs can be sent to it | 156 // to be created, and is needed so that the prerendered URLs can be sent to it |
156 // so render-initiated navigations will swap in the prerendered page. |size| | 157 // so render-initiated navigations will swap in the prerendered page. |size| |
157 // indicates the rectangular dimensions that the prerendered page should be. | 158 // indicates the rectangular dimensions that the prerendered page should be. |
158 // |session_storage_namespace| indicates the namespace that the prerendered | 159 // |session_storage_namespace| indicates the namespace that the prerendered |
159 // page should be part of. | 160 // page should be part of. |
160 virtual void StartPrerendering( | 161 virtual void StartPrerendering( |
161 int creator_child_id, | 162 int creator_child_id, |
162 const gfx::Size& size, | 163 const gfx::Size& size, |
163 content::SessionStorageNamespace* session_storage_namespace); | 164 content::SessionStorageNamespace* session_storage_namespace); |
164 | 165 |
166 // Tell the renderer that it's not prerendering anymore. | |
167 void PrerenderingDone(); | |
mmenke
2013/12/10 20:56:41
I think this method name is ambiguous, since prere
jam
2013/12/10 21:14:17
ah, I missed that method. Switched to it.
| |
168 | |
165 // Verifies that the prerendering is not using too many resources, and kills | 169 // Verifies that the prerendering is not using too many resources, and kills |
166 // it if not. | 170 // it if not. |
167 void DestroyWhenUsingTooManyResources(); | 171 void DestroyWhenUsingTooManyResources(); |
168 | 172 |
169 content::RenderViewHost* GetRenderViewHostMutable(); | 173 content::RenderViewHost* GetRenderViewHostMutable(); |
170 const content::RenderViewHost* GetRenderViewHost() const; | 174 const content::RenderViewHost* GetRenderViewHost() const; |
171 | 175 |
172 PrerenderManager* prerender_manager() { return prerender_manager_; } | 176 PrerenderManager* prerender_manager() { return prerender_manager_; } |
173 | 177 |
174 string16 title() const { return title_; } | 178 string16 title() const { return title_; } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 | 210 |
207 base::TimeTicks load_start_time() const { return load_start_time_; } | 211 base::TimeTicks load_start_time() const { return load_start_time_; } |
208 | 212 |
209 // Indicates whether this prerendered page can be used for the provided | 213 // Indicates whether this prerendered page can be used for the provided |
210 // |url| and |session_storage_namespace|. | 214 // |url| and |session_storage_namespace|. |
211 bool Matches( | 215 bool Matches( |
212 const GURL& url, | 216 const GURL& url, |
213 const content::SessionStorageNamespace* session_storage_namespace) const; | 217 const content::SessionStorageNamespace* session_storage_namespace) const; |
214 | 218 |
215 // content::WebContentsObserver implementation. | 219 // content::WebContentsObserver implementation. |
220 virtual void RenderFrameCreated( | |
221 content::RenderFrameHost* render_frame_host) OVERRIDE; | |
222 virtual void RenderFrameDeleted( | |
223 content::RenderFrameHost* render_frame_host) OVERRIDE; | |
216 virtual void DidStopLoading( | 224 virtual void DidStopLoading( |
217 content::RenderViewHost* render_view_host) OVERRIDE; | 225 content::RenderViewHost* render_view_host) OVERRIDE; |
218 virtual void DidStartProvisionalLoadForFrame( | 226 virtual void DidStartProvisionalLoadForFrame( |
219 int64 frame_id, | 227 int64 frame_id, |
220 int64 parent_frame_id, | 228 int64 parent_frame_id, |
221 bool is_main_frame, | 229 bool is_main_frame, |
222 const GURL& validated_url, | 230 const GURL& validated_url, |
223 bool is_error_page, | 231 bool is_error_page, |
224 bool is_iframe_srcdoc, | 232 bool is_iframe_srcdoc, |
225 content::RenderViewHost* render_view_host) OVERRIDE; | 233 content::RenderViewHost* render_view_host) OVERRIDE; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 | 436 |
429 typedef std::vector<history::HistoryAddPageArgs> AddPageVector; | 437 typedef std::vector<history::HistoryAddPageArgs> AddPageVector; |
430 | 438 |
431 // Caches pages to be added to the history. | 439 // Caches pages to be added to the history. |
432 AddPageVector add_page_vector_; | 440 AddPageVector add_page_vector_; |
433 | 441 |
434 // The alias session storage namespace for this prerender. | 442 // The alias session storage namespace for this prerender. |
435 scoped_refptr<content::SessionStorageNamespace> | 443 scoped_refptr<content::SessionStorageNamespace> |
436 alias_session_storage_namespace; | 444 alias_session_storage_namespace; |
437 | 445 |
446 // The RenderFrameHosts for this webcontents. | |
mmenke
2013/12/10 20:56:41
Suggest webcontents -> WebContents (or "this webco
jam
2013/12/10 21:14:17
Done.
| |
447 std::set<content::RenderFrameHost*> render_frame_hosts_; | |
448 | |
438 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 449 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
439 }; | 450 }; |
440 | 451 |
441 } // namespace prerender | 452 } // namespace prerender |
442 | 453 |
443 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 454 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
OLD | NEW |