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> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_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 "chrome/browser/prerender/prerender_origin.h" |
17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
19 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
20 #include "content/public/common/referrer.h" | 21 #include "content/public/common/referrer.h" |
21 #include "ui/gfx/size.h" | 22 #include "ui/gfx/size.h" |
22 | 23 |
23 class Profile; | 24 class Profile; |
24 class TabContents; | 25 class TabContents; |
25 struct FaviconURL; | 26 struct FaviconURL; |
26 | 27 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 223 |
223 // Returns whether a pending cross-site navigation is happening. | 224 // Returns whether a pending cross-site navigation is happening. |
224 // This could happen with renderer-issued navigations, such as a | 225 // This could happen with renderer-issued navigations, such as a |
225 // MouseEvent being dispatched by a link to a website installed as an app. | 226 // MouseEvent being dispatched by a link to a website installed as an app. |
226 bool IsCrossSiteNavigationPending() const; | 227 bool IsCrossSiteNavigationPending() const; |
227 | 228 |
228 // Adds a pending prerender to the list. If |weak_prerender_handle| still | 229 // Adds a pending prerender to the list. If |weak_prerender_handle| still |
229 // exists when this page is made visible, it will be launched. | 230 // exists when this page is made visible, it will be launched. |
230 virtual void AddPendingPrerender( | 231 virtual void AddPendingPrerender( |
231 base::WeakPtr<PrerenderHandle> weak_prerender_handle, | 232 base::WeakPtr<PrerenderHandle> weak_prerender_handle, |
| 233 Origin origin, |
232 const GURL& url, | 234 const GURL& url, |
233 const content::Referrer& referrer, | 235 const content::Referrer& referrer, |
234 const gfx::Size& size); | 236 const gfx::Size& size); |
235 | 237 |
236 // Returns true if |url| corresponds to a pending prerender. | 238 // Returns true if |url| corresponds to a pending prerender. |
237 bool IsPendingEntry(const PrerenderHandle& prerender_handle) const; | 239 bool IsPendingEntry(const PrerenderHandle& prerender_handle) const; |
238 | 240 |
239 // Reissues any pending prerender requests from the prerendered page. Also | 241 // Reissues any pending prerender requests from the prerendered page. Also |
240 // clears the list of pending requests. | 242 // clears the list of pending requests. |
241 void StartPendingPrerenders(); | 243 void StartPendingPrerenders(); |
242 | 244 |
243 protected: | 245 protected: |
244 // Information on pages that the prerendered page has tried to prerender. | 246 // Information on pages that the prerendered page has tried to prerender. |
245 struct PendingPrerenderInfo { | 247 struct PendingPrerenderInfo { |
246 PendingPrerenderInfo( | 248 PendingPrerenderInfo( |
247 base::WeakPtr<PrerenderHandle> weak_prerender_handle, | 249 base::WeakPtr<PrerenderHandle> weak_prerender_handle, |
| 250 Origin origin, |
248 const GURL& url, | 251 const GURL& url, |
249 const content::Referrer& referrer, | 252 const content::Referrer& referrer, |
250 const gfx::Size& size); | 253 const gfx::Size& size); |
251 ~PendingPrerenderInfo(); | 254 ~PendingPrerenderInfo(); |
252 | 255 |
253 base::WeakPtr<PrerenderHandle> weak_prerender_handle; | 256 base::WeakPtr<PrerenderHandle> weak_prerender_handle; |
| 257 Origin origin; |
254 GURL url; | 258 GURL url; |
255 content::Referrer referrer; | 259 content::Referrer referrer; |
256 gfx::Size size; | 260 gfx::Size size; |
257 }; | 261 }; |
258 | 262 |
259 PrerenderContents(PrerenderManager* prerender_manager, | 263 PrerenderContents(PrerenderManager* prerender_manager, |
260 PrerenderTracker* prerender_tracker, | 264 PrerenderTracker* prerender_tracker, |
261 Profile* profile, | 265 Profile* profile, |
262 const GURL& url, | 266 const GURL& url, |
263 const content::Referrer& referrer, | 267 const content::Referrer& referrer, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 400 |
397 // Caches pages to be added to the history. | 401 // Caches pages to be added to the history. |
398 AddPageVector add_page_vector_; | 402 AddPageVector add_page_vector_; |
399 | 403 |
400 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 404 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
401 }; | 405 }; |
402 | 406 |
403 } // namespace prerender | 407 } // namespace prerender |
404 | 408 |
405 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 409 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
OLD | NEW |