| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 214 |
| 214 // Returns whether a pending cross-site navigation is happening. | 215 // Returns whether a pending cross-site navigation is happening. |
| 215 // This could happen with renderer-issued navigations, such as a | 216 // This could happen with renderer-issued navigations, such as a |
| 216 // MouseEvent being dispatched by a link to a website installed as an app. | 217 // MouseEvent being dispatched by a link to a website installed as an app. |
| 217 bool IsCrossSiteNavigationPending() const; | 218 bool IsCrossSiteNavigationPending() const; |
| 218 | 219 |
| 219 // Adds a pending prerender to the list. If |weak_prerender_handle| still | 220 // Adds a pending prerender to the list. If |weak_prerender_handle| still |
| 220 // exists when this page is made visible, it will be launched. | 221 // exists when this page is made visible, it will be launched. |
| 221 virtual void AddPendingPrerender( | 222 virtual void AddPendingPrerender( |
| 222 base::WeakPtr<PrerenderHandle> weak_prerender_handle, | 223 base::WeakPtr<PrerenderHandle> weak_prerender_handle, |
| 224 Origin origin, |
| 223 const GURL& url, | 225 const GURL& url, |
| 224 const content::Referrer& referrer, | 226 const content::Referrer& referrer, |
| 225 const gfx::Size& size); | 227 const gfx::Size& size); |
| 226 | 228 |
| 227 // Returns true if |url| corresponds to a pending prerender. | 229 // Returns true if |url| corresponds to a pending prerender. |
| 228 bool IsPendingEntry(const PrerenderHandle& prerender_handle) const; | 230 bool IsPendingEntry(const PrerenderHandle& prerender_handle) const; |
| 229 | 231 |
| 230 // Reissues any pending prerender requests from the prerendered page. Also | 232 // Reissues any pending prerender requests from the prerendered page. Also |
| 231 // clears the list of pending requests. | 233 // clears the list of pending requests. |
| 232 void StartPendingPrerenders(); | 234 void StartPendingPrerenders(); |
| 233 | 235 |
| 234 protected: | 236 protected: |
| 235 // Information on pages that the prerendered page has tried to prerender. | 237 // Information on pages that the prerendered page has tried to prerender. |
| 236 struct PendingPrerenderInfo { | 238 struct PendingPrerenderInfo { |
| 237 PendingPrerenderInfo( | 239 PendingPrerenderInfo( |
| 238 base::WeakPtr<PrerenderHandle> weak_prerender_handle, | 240 base::WeakPtr<PrerenderHandle> weak_prerender_handle, |
| 241 Origin origin, |
| 239 const GURL& url, | 242 const GURL& url, |
| 240 const content::Referrer& referrer, | 243 const content::Referrer& referrer, |
| 241 const gfx::Size& size); | 244 const gfx::Size& size); |
| 242 ~PendingPrerenderInfo(); | 245 ~PendingPrerenderInfo(); |
| 243 | 246 |
| 244 base::WeakPtr<PrerenderHandle> weak_prerender_handle; | 247 base::WeakPtr<PrerenderHandle> weak_prerender_handle; |
| 248 Origin origin; |
| 245 GURL url; | 249 GURL url; |
| 246 content::Referrer referrer; | 250 content::Referrer referrer; |
| 247 gfx::Size size; | 251 gfx::Size size; |
| 248 }; | 252 }; |
| 249 | 253 |
| 250 PrerenderContents(PrerenderManager* prerender_manager, | 254 PrerenderContents(PrerenderManager* prerender_manager, |
| 251 PrerenderTracker* prerender_tracker, | 255 PrerenderTracker* prerender_tracker, |
| 252 Profile* profile, | 256 Profile* profile, |
| 253 const GURL& url, | 257 const GURL& url, |
| 254 const content::Referrer& referrer, | 258 const content::Referrer& referrer, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 386 |
| 383 // The size of the WebView from the launching page. | 387 // The size of the WebView from the launching page. |
| 384 gfx::Size size_; | 388 gfx::Size size_; |
| 385 | 389 |
| 386 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 390 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
| 387 }; | 391 }; |
| 388 | 392 |
| 389 } // namespace prerender | 393 } // namespace prerender |
| 390 | 394 |
| 391 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 395 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
| OLD | NEW |