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

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

Issue 7517016: Add prerender to ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add prerender_condition.h and OVERRIDE Created 9 years, 5 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 23 matching lines...) Expand all
34 std::size_t operator()(TabContents* value) const { 34 std::size_t operator()(TabContents* value) const {
35 return reinterpret_cast<std::size_t>(value); 35 return reinterpret_cast<std::size_t>(value);
36 } 36 }
37 }; 37 };
38 } 38 }
39 39
40 #endif 40 #endif
41 41
42 namespace prerender { 42 namespace prerender {
43 43
44 class PrerenderCondition;
44 class PrerenderHistory; 45 class PrerenderHistory;
45 class PrerenderTracker; 46 class PrerenderTracker;
46 47
47 // PrerenderManager is responsible for initiating and keeping prerendered 48 // PrerenderManager is responsible for initiating and keeping prerendered
48 // views of webpages. All methods must be called on the UI thread unless 49 // views of webpages. All methods must be called on the UI thread unless
49 // indicated otherwise. 50 // indicated otherwise.
50 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, 51 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
51 public base::NonThreadSafe { 52 public base::NonThreadSafe {
52 public: 53 public:
53 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not 54 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 void ClearData(int clear_flags); 189 void ClearData(int clear_flags);
189 190
190 // Record a final status of a prerendered page in a histogram. 191 // Record a final status of a prerendered page in a histogram.
191 void RecordFinalStatus(Origin origin, 192 void RecordFinalStatus(Origin origin,
192 uint8 experiment_id, 193 uint8 experiment_id,
193 FinalStatus final_status) const; 194 FinalStatus final_status) const;
194 195
195 const Config& config() const { return config_; } 196 const Config& config() const { return config_; }
196 Config& mutable_config() { return config_; } 197 Config& mutable_config() { return config_; }
197 198
199 // Adds a condition. This is owned by the PrerenderManager.
200 void AddCondition(const PrerenderCondition* condition);
201
198 protected: 202 protected:
199 // Test that needs needs access to internal functions. 203 // Test that needs needs access to internal functions.
200 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ExpireTest); 204 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ExpireTest);
201 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ExtractURLInQueryStringTest); 205 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ExtractURLInQueryStringTest);
202 206
203 struct PendingContentsData; 207 struct PendingContentsData;
204 208
205 void SetPrerenderContentsFactory( 209 void SetPrerenderContentsFactory(
206 PrerenderContents::Factory* prerender_contents_factory); 210 PrerenderContents::Factory* prerender_contents_factory);
207 211
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 411
408 std::list<TabContentsWrapper*> old_tab_contents_list_; 412 std::list<TabContentsWrapper*> old_tab_contents_list_;
409 413
410 // Cancels pending tasks on deletion. 414 // Cancels pending tasks on deletion.
411 ScopedRunnableMethodFactory<PrerenderManager> runnable_method_factory_; 415 ScopedRunnableMethodFactory<PrerenderManager> runnable_method_factory_;
412 416
413 ScopedVector<OnCloseTabContentsDeleter> on_close_tab_contents_deleters_; 417 ScopedVector<OnCloseTabContentsDeleter> on_close_tab_contents_deleters_;
414 418
415 scoped_ptr<PrerenderHistory> prerender_history_; 419 scoped_ptr<PrerenderHistory> prerender_history_;
416 420
421 std::list<const PrerenderCondition*> prerender_conditions_;
422
417 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); 423 DISALLOW_COPY_AND_ASSIGN(PrerenderManager);
418 }; 424 };
419 425
420 } // namespace prerender 426 } // namespace prerender
421 427
422 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ 428 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698