| OLD | NEW |
| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // Checks whether navigation to the provided URL has occured in a visible | 162 // Checks whether navigation to the provided URL has occured in a visible |
| 163 // tab recently. | 163 // tab recently. |
| 164 bool HasRecentlyBeenNavigatedTo(const GURL& url); | 164 bool HasRecentlyBeenNavigatedTo(const GURL& url); |
| 165 | 165 |
| 166 // Returns true if the method given is invalid for prerendering. | 166 // Returns true if the method given is invalid for prerendering. |
| 167 static bool IsValidHttpMethod(const std::string& method); | 167 static bool IsValidHttpMethod(const std::string& method); |
| 168 | 168 |
| 169 // Returns a Value object containing the active pages being prerendered, and | 169 // Returns a Value object containing the active pages being prerendered, and |
| 170 // a history of pages which were prerendered. The caller is responsible for | 170 // a history of pages which were prerendered. The caller is responsible for |
| 171 // deleting the return value. | 171 // deleting the return value. |
| 172 Value* GetAsValue() const; | 172 base::Value* GetAsValue() const; |
| 173 | 173 |
| 174 // Clears the data indicated by which bits of clear_flags are set. | 174 // Clears the data indicated by which bits of clear_flags are set. |
| 175 // | 175 // |
| 176 // If the CLEAR_PRERENDER_CONTENTS bit is set, all active prerenders are | 176 // If the CLEAR_PRERENDER_CONTENTS bit is set, all active prerenders are |
| 177 // cancelled and then deleted, and any TabContents queued for destruction are | 177 // cancelled and then deleted, and any TabContents queued for destruction are |
| 178 // destroyed as well. | 178 // destroyed as well. |
| 179 // | 179 // |
| 180 // If the CLEAR_PRERENDER_HISTORY bit is set, the prerender history is | 180 // If the CLEAR_PRERENDER_HISTORY bit is set, the prerender history is |
| 181 // cleared, including any entries newly created by destroying them in | 181 // cleared, including any entries newly created by destroying them in |
| 182 // response to the CLEAR_PRERENDER_CONTENTS flag. | 182 // response to the CLEAR_PRERENDER_CONTENTS flag. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 301 |
| 302 // Adds to the history list. | 302 // Adds to the history list. |
| 303 void AddToHistory(PrerenderContents* contents); | 303 void AddToHistory(PrerenderContents* contents); |
| 304 | 304 |
| 305 // Records that some visible tab navigated (or was redirected) to the | 305 // Records that some visible tab navigated (or was redirected) to the |
| 306 // provided URL. | 306 // provided URL. |
| 307 void RecordNavigation(const GURL& url); | 307 void RecordNavigation(const GURL& url); |
| 308 | 308 |
| 309 // Returns a new Value representing the pages currently being prerendered. The | 309 // Returns a new Value representing the pages currently being prerendered. The |
| 310 // caller is responsible for delete'ing the return value. | 310 // caller is responsible for delete'ing the return value. |
| 311 Value* GetActivePrerendersAsValue() const; | 311 base::Value* GetActivePrerendersAsValue() const; |
| 312 | 312 |
| 313 // Destroys all pending prerenders using FinalStatus. Also deletes them as | 313 // Destroys all pending prerenders using FinalStatus. Also deletes them as |
| 314 // well as any swapped out TabContents queued for destruction. | 314 // well as any swapped out TabContents queued for destruction. |
| 315 // Used both on destruction, and when clearing the browing history. | 315 // Used both on destruction, and when clearing the browing history. |
| 316 void DestroyAllContents(FinalStatus final_status); | 316 void DestroyAllContents(FinalStatus final_status); |
| 317 | 317 |
| 318 // Records the time from when a page starts prerendering to when the user | 318 // Records the time from when a page starts prerendering to when the user |
| 319 // navigates to it. This must be called on the UI thread. | 319 // navigates to it. This must be called on the UI thread. |
| 320 void RecordTimeUntilUsed(base::TimeDelta time_until_used); | 320 void RecordTimeUntilUsed(base::TimeDelta time_until_used); |
| 321 | 321 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 ScopedVector<OnCloseTabContentsDeleter> on_close_tab_contents_deleters_; | 410 ScopedVector<OnCloseTabContentsDeleter> on_close_tab_contents_deleters_; |
| 411 | 411 |
| 412 scoped_ptr<PrerenderHistory> prerender_history_; | 412 scoped_ptr<PrerenderHistory> prerender_history_; |
| 413 | 413 |
| 414 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 414 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 415 }; | 415 }; |
| 416 | 416 |
| 417 } // namespace prerender | 417 } // namespace prerender |
| 418 | 418 |
| 419 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 419 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |