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