Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(936)

Side by Side Diff: chrome/browser/prerender/prerender_manager.h

Issue 6915019: Changes to not use the prerendered contents when window.opener needs to be set. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_MANAGER_H_ 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not 65 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not
66 // add in the middle. 66 // add in the middle.
67 enum PrerenderManagerMode { 67 enum PrerenderManagerMode {
68 PRERENDER_MODE_DISABLED, 68 PRERENDER_MODE_DISABLED,
69 PRERENDER_MODE_ENABLED, 69 PRERENDER_MODE_ENABLED,
70 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP, 70 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP,
71 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP, 71 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP,
72 PRERENDER_MODE_MAX 72 PRERENDER_MODE_MAX
73 }; 73 };
74 74
75 struct PrerenderedPageProperties {
cbentzel 2011/05/04 17:10:15 This seems like overkill right now. I'd just have
Shishir 2011/05/05 23:09:54 Then I think we might as well have a bool for now
76 PrerenderedPageProperties() : has_opener_set_(false) { }
77 // Is the page supposed to have the window.opener property set.
78 bool has_opener_set_;
79 };
80
75 // Owned by a Profile object for the lifetime of the profile. 81 // Owned by a Profile object for the lifetime of the profile.
76 explicit PrerenderManager(Profile* profile); 82 explicit PrerenderManager(Profile* profile);
77 83
78 virtual ~PrerenderManager(); 84 virtual ~PrerenderManager();
79 85
80 // Preloads |url| if valid. |child_route_id_pair| identifies the 86 // Preloads |url| if valid. |child_route_id_pair| identifies the
81 // RenderViewHost that the prerender request came from and is used to 87 // RenderViewHost that the prerender request came from and is used to
82 // set the initial window size of the RenderViewHost used for prerendering. 88 // set the initial window size of the RenderViewHost used for prerendering.
83 // Returns true if the URL was added, false if it was not. 89 // Returns true if the URL was added, false if it was not.
84 bool AddPreload( 90 bool AddPreload(
85 const std::pair<int, int>& child_route_id_pair, 91 const std::pair<int, int>& child_route_id_pair,
86 const GURL& url, 92 const GURL& url,
87 const GURL& referrer); 93 const GURL& referrer);
88 94
89 void AddPendingPreload(const std::pair<int, int>& child_route_id_pair, 95 void AddPendingPreload(const std::pair<int, int>& child_route_id_pair,
90 const GURL& url, 96 const GURL& url,
91 const GURL& referrer); 97 const GURL& referrer);
92 98
93 // Destroy all preloads for the given child route id pair and assign a final 99 // Destroy all preloads for the given child route id pair and assign a final
94 // status to them. 100 // status to them.
95 void DestroyPreloadForChildRouteIdPair( 101 void DestroyPreloadForChildRouteIdPair(
96 const std::pair<int, int>& child_route_id_pair, 102 const std::pair<int, int>& child_route_id_pair,
97 FinalStatus final_status); 103 FinalStatus final_status);
98 104
99 // For a given TabContents that wants to navigate to the URL supplied, 105 // For a given TabContents that wants to navigate to the URL supplied,
100 // determines whether a preloaded version of the URL can be used, 106 // determines whether a preloaded version of the URL can be used,
101 // and substitutes the prerendered RVH into the TabContents. Returns 107 // and substitutes the prerendered RVH into the TabContents. Returns
102 // whether or not a prerendered RVH could be used or not. 108 // whether or not a prerendered RVH could be used or not.
103 bool MaybeUsePreloadedPage(TabContents* tab_contents, const GURL& url); 109 bool MaybeUsePreloadedPage(
104 bool MaybeUsePreloadedPageOld(TabContents* tab_contents, const GURL& url); 110 TabContents* tab_contents,
111 const GURL& url,
112 const PrerenderManager::PrerenderedPageProperties& properties);
113 bool MaybeUsePreloadedPageOld(
114 TabContents* tab_contents,
115 const GURL& url,
116 const PrerenderManager::PrerenderedPageProperties& properties);
105 117
106 // Allows PrerenderContents to remove itself when prerendering should 118 // Allows PrerenderContents to remove itself when prerendering should
107 // be cancelled. 119 // be cancelled.
108 void RemoveEntry(PrerenderContents* entry); 120 void RemoveEntry(PrerenderContents* entry);
109 121
110 // Retrieves the PrerenderContents object for the specified URL, if it 122 // Retrieves the PrerenderContents object for the specified URL, if it
111 // has been prerendered. The caller will then have ownership of the 123 // has been prerendered. The caller will then have ownership of the
112 // PrerenderContents object and is responsible for freeing it. 124 // PrerenderContents object and is responsible for freeing it.
113 // Returns NULL if the specified URL has not been prerendered. 125 // Returns NULL if the specified URL has not been prerendered.
114 PrerenderContents* GetEntry(const GURL& url); 126 PrerenderContents* GetEntry(const GURL& url);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 289
278 // Track time of last prerender to limit prerender spam. 290 // Track time of last prerender to limit prerender spam.
279 base::TimeTicks last_prerender_start_time_; 291 base::TimeTicks last_prerender_start_time_;
280 292
281 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); 293 DISALLOW_COPY_AND_ASSIGN(PrerenderManager);
282 }; 294 };
283 295
284 } // namespace prerender 296 } // namespace prerender
285 297
286 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 298 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698