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 <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/prerender/prerender_final_status.h" | 17 #include "chrome/browser/prerender/prerender_final_status.h" |
18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
20 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
21 #include "content/public/common/referrer.h" | 21 #include "content/public/common/referrer.h" |
22 #include "ui/gfx/size.h" | 22 #include "ui/gfx/size.h" |
23 | 23 |
24 class Profile; | 24 class Profile; |
25 class TabContents; | 25 class TabContents; |
26 typedef TabContents TabContentsWrapper; | |
27 struct FaviconURL; | 26 struct FaviconURL; |
28 | 27 |
29 namespace base { | 28 namespace base { |
30 class ProcessMetrics; | 29 class ProcessMetrics; |
31 } | 30 } |
32 | 31 |
33 namespace content { | 32 namespace content { |
34 class RenderViewHost; | 33 class RenderViewHost; |
35 class SessionStorageNamespace; | 34 class SessionStorageNamespace; |
36 class WebContents; | 35 class WebContents; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 180 |
182 // Adds an alias URL, for one of the many redirections. If the URL can not | 181 // Adds an alias URL, for one of the many redirections. If the URL can not |
183 // be prerendered - for example, it's an ftp URL - |this| will be destroyed | 182 // be prerendered - for example, it's an ftp URL - |this| will be destroyed |
184 // and false is returned. Otherwise, true is returned and the alias is | 183 // and false is returned. Otherwise, true is returned and the alias is |
185 // remembered. | 184 // remembered. |
186 virtual bool AddAliasURL(const GURL& url); | 185 virtual bool AddAliasURL(const GURL& url); |
187 | 186 |
188 // Adds all alias URLs from another prerender. | 187 // Adds all alias URLs from another prerender. |
189 void AddAliasURLsFromOtherPrerenderContents(PrerenderContents* other_pc); | 188 void AddAliasURLsFromOtherPrerenderContents(PrerenderContents* other_pc); |
190 | 189 |
191 // The preview TabContentsWrapper (may be null). | 190 // The preview TabContents (may be null). |
192 TabContentsWrapper* prerender_contents() const { | 191 TabContents* prerender_contents() const { |
193 return prerender_contents_.get(); | 192 return prerender_contents_.get(); |
194 } | 193 } |
195 | 194 |
196 TabContentsWrapper* ReleasePrerenderContents(); | 195 TabContents* ReleasePrerenderContents(); |
197 | 196 |
198 // Sets the final status, calls OnDestroy and adds |this| to the | 197 // Sets the final status, calls OnDestroy and adds |this| to the |
199 // PrerenderManager's pending deletes list. | 198 // PrerenderManager's pending deletes list. |
200 void Destroy(FinalStatus reason); | 199 void Destroy(FinalStatus reason); |
201 | 200 |
202 // Applies all the URL history encountered during prerendering to the | 201 // Applies all the URL history encountered during prerendering to the |
203 // new tab. | 202 // new tab. |
204 void CommitHistory(TabContentsWrapper* tab); | 203 void CommitHistory(TabContents* tab); |
205 | 204 |
206 base::Value* GetAsValue() const; | 205 base::Value* GetAsValue() const; |
207 | 206 |
208 // Returns whether a pending cross-site navigation is happening. | 207 // Returns whether a pending cross-site navigation is happening. |
209 // This could happen with renderer-issued navigations, such as a | 208 // This could happen with renderer-issued navigations, such as a |
210 // MouseEvent being dispatched by a link to a website installed as an app. | 209 // MouseEvent being dispatched by a link to a website installed as an app. |
211 bool IsCrossSiteNavigationPending() const; | 210 bool IsCrossSiteNavigationPending() const; |
212 | 211 |
213 // Adds a pending prerender to the list. | 212 // Adds a pending prerender to the list. |
214 virtual void AddPendingPrerender(const GURL& url, | 213 virtual void AddPendingPrerender(const GURL& url, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 320 |
322 // Time at which we started to load the URL. This is used to compute | 321 // Time at which we started to load the URL. This is used to compute |
323 // the time elapsed from initiating a prerender until the time the | 322 // the time elapsed from initiating a prerender until the time the |
324 // (potentially only partially) prerendered page is shown to the user. | 323 // (potentially only partially) prerendered page is shown to the user. |
325 base::TimeTicks load_start_time_; | 324 base::TimeTicks load_start_time_; |
326 | 325 |
327 // Process Metrics of the render process associated with the | 326 // Process Metrics of the render process associated with the |
328 // RenderViewHost for this object. | 327 // RenderViewHost for this object. |
329 scoped_ptr<base::ProcessMetrics> process_metrics_; | 328 scoped_ptr<base::ProcessMetrics> process_metrics_; |
330 | 329 |
331 // The prerendered TabContentsWrapper; may be null. | 330 // The prerendered TabContents; may be null. |
332 scoped_ptr<TabContentsWrapper> prerender_contents_; | 331 scoped_ptr<TabContents> prerender_contents_; |
333 | 332 |
334 scoped_ptr<PrerenderRenderViewHostObserver> render_view_host_observer_; | 333 scoped_ptr<PrerenderRenderViewHostObserver> render_view_host_observer_; |
335 | 334 |
336 scoped_ptr<TabContentsDelegateImpl> tab_contents_delegate_; | 335 scoped_ptr<TabContentsDelegateImpl> tab_contents_delegate_; |
337 | 336 |
338 // These are -1 before a RenderView is created. | 337 // These are -1 before a RenderView is created. |
339 int child_id_; | 338 int child_id_; |
340 int route_id_; | 339 int route_id_; |
341 | 340 |
342 // Origin for this prerender. | 341 // Origin for this prerender. |
(...skipping 10 matching lines...) Expand all Loading... |
353 | 352 |
354 // The size of the WebView from the launching page. | 353 // The size of the WebView from the launching page. |
355 gfx::Size size_; | 354 gfx::Size size_; |
356 | 355 |
357 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 356 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
358 }; | 357 }; |
359 | 358 |
360 } // namespace prerender | 359 } // namespace prerender |
361 | 360 |
362 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 361 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
OLD | NEW |