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

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

Issue 10067018: Add PrerenderLocalPredictor, which will eventually perform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_
7 #pragma once
8
9 #include <vector>
10
11 #include "base/timer.h"
12 #include "chrome/browser/cancelable_request.h"
13 #include "chrome/browser/history/visit_database.h"
14 #include "googleurl/src/gurl.h"
15
16 class HistoryService;
17
18 namespace prerender {
19
20 class PrerenderManager;
21
22 // PrerenderLocalPredictor maintains local browsing history to make prerender
23 // predictions.
24 // At this point, the class is just illustrating the interface with the
25 // Chrome History.
26 // TODO(tburkard): Fill in actual prerender prediction logic.
27 class PrerenderLocalPredictor : history::VisitDatabaseObserver {
28 public:
29 // A PrerenderLocalPredictor is owned by the PrerenderManager specified
30 // in the constructor. It will be destoryed at the time its owning
31 // PrerenderManager is destroyed.
32 explicit PrerenderLocalPredictor(PrerenderManager* prerender_manager);
33 virtual ~PrerenderLocalPredictor();
34
35 // history::VisitDatabaseObserver implementation
36 virtual void OnAddVisit(const history::BriefVisitInfo& info) OVERRIDE;
37
38 void OnLookupURL(history::URLID url_id, const GURL& url);
39
40 void OnGetInitialVisitHistory(
41 scoped_ptr<std::vector<history::BriefVisitInfo> > visit_history);
42
43 private:
44 HistoryService* GetHistoryIfExists() const;
45 void Init();
46
47 PrerenderManager* prerender_manager_;
48 base::OneShotTimer<PrerenderLocalPredictor> timer_;
49
50 // Delay after which to initialize, to avoid putting to much load on the
51 // database thread early on when Chrome is starting up.
52 static const int kInitDelayMs = 5 * 1000;
53
54 CancelableRequestConsumer history_db_consumer_;
55
56 scoped_ptr<std::vector<history::BriefVisitInfo> > visit_history_;
57 bool visit_history_initialized_;
58
59 DISALLOW_COPY_AND_ASSIGN(PrerenderLocalPredictor);
60 };
61
62 } // namespace prerender
63
64 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/visit_database.cc ('k') | chrome/browser/prerender/prerender_local_predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698