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

Side by Side Diff: chrome/browser/history/top_sites_impl.h

Issue 14585015: Recommit the generate profile patch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Load the browser dll manually on Windows. Created 7 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
« no previous file with comments | « chrome/browser/history/top_sites_cache.cc ('k') | chrome/browser/history/top_sites_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_HISTORY_TOP_SITES_IMPL_H_ 5 #ifndef CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_
6 #define CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_ 6 #define CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_
7 7
8 #include <list> 8 #include <list>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 class TopSitesImpl : public TopSites { 51 class TopSitesImpl : public TopSites {
52 public: 52 public:
53 explicit TopSitesImpl(Profile* profile); 53 explicit TopSitesImpl(Profile* profile);
54 54
55 // Initializes TopSitesImpl. 55 // Initializes TopSitesImpl.
56 void Init(const base::FilePath& db_name); 56 void Init(const base::FilePath& db_name);
57 57
58 virtual bool SetPageThumbnail(const GURL& url, 58 virtual bool SetPageThumbnail(const GURL& url,
59 const gfx::Image& thumbnail, 59 const gfx::Image& thumbnail,
60 const ThumbnailScore& score) OVERRIDE; 60 const ThumbnailScore& score) OVERRIDE;
61 virtual bool SetPageThumbnailToJPEGBytes(
62 const GURL& url,
63 const base::RefCountedMemory* memory,
64 const ThumbnailScore& score) OVERRIDE;
61 virtual void GetMostVisitedURLs( 65 virtual void GetMostVisitedURLs(
62 const GetMostVisitedURLsCallback& callback) OVERRIDE; 66 const GetMostVisitedURLsCallback& callback) OVERRIDE;
63 virtual bool GetPageThumbnail( 67 virtual bool GetPageThumbnail(
64 const GURL& url, scoped_refptr<base::RefCountedMemory>* bytes) OVERRIDE; 68 const GURL& url, scoped_refptr<base::RefCountedMemory>* bytes) OVERRIDE;
65 virtual bool GetPageThumbnailScore(const GURL& url, 69 virtual bool GetPageThumbnailScore(const GURL& url,
66 ThumbnailScore* score) OVERRIDE; 70 ThumbnailScore* score) OVERRIDE;
67 virtual bool GetTemporaryPageThumbnailScore(const GURL& url, 71 virtual bool GetTemporaryPageThumbnailScore(const GURL& url,
68 ThumbnailScore* score) OVERRIDE; 72 ThumbnailScore* score) OVERRIDE;
69 virtual void MigrateFromHistory() OVERRIDE; 73 virtual void MigrateFromHistory() OVERRIDE;
70 virtual void FinishHistoryMigration(const ThumbnailMigration& data) OVERRIDE; 74 virtual void FinishHistoryMigration(const ThumbnailMigration& data) OVERRIDE;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 TOP_SITES_LOADED_WAITING_FOR_HISTORY, 133 TOP_SITES_LOADED_WAITING_FOR_HISTORY,
130 134
131 // Top sites is loaded. 135 // Top sites is loaded.
132 TOP_SITES_LOADED 136 TOP_SITES_LOADED
133 }; 137 };
134 138
135 // Sets the thumbnail without writing to the database. Useful when 139 // Sets the thumbnail without writing to the database. Useful when
136 // reading last known top sites from the DB. 140 // reading last known top sites from the DB.
137 // Returns true if the thumbnail was set, false if the existing one is better. 141 // Returns true if the thumbnail was set, false if the existing one is better.
138 bool SetPageThumbnailNoDB(const GURL& url, 142 bool SetPageThumbnailNoDB(const GURL& url,
139 const base::RefCountedBytes* thumbnail_data, 143 const base::RefCountedMemory* thumbnail_data,
140 const ThumbnailScore& score); 144 const ThumbnailScore& score);
141 145
142 // A version of SetPageThumbnail that takes RefCountedBytes as 146 // A version of SetPageThumbnail that takes RefCountedBytes as
143 // returned by HistoryService. 147 // returned by HistoryService.
144 bool SetPageThumbnailEncoded(const GURL& url, 148 bool SetPageThumbnailEncoded(const GURL& url,
145 const base::RefCountedBytes* thumbnail, 149 const base::RefCountedMemory* thumbnail,
146 const ThumbnailScore& score); 150 const ThumbnailScore& score);
147 151
148 // Encodes the bitmap to bytes for storage to the db. Returns true if the 152 // Encodes the bitmap to bytes for storage to the db. Returns true if the
149 // bitmap was successfully encoded. 153 // bitmap was successfully encoded.
150 static bool EncodeBitmap(const gfx::Image& bitmap, 154 static bool EncodeBitmap(const gfx::Image& bitmap,
151 scoped_refptr<base::RefCountedBytes>* bytes); 155 scoped_refptr<base::RefCountedBytes>* bytes);
152 156
153 // Removes the cached thumbnail for url. Does nothing if |url| if not cached 157 // Removes the cached thumbnail for url. Does nothing if |url| if not cached
154 // in |temp_images_|. 158 // in |temp_images_|.
155 void RemoveTemporaryThumbnailByURL(const GURL& url); 159 void RemoveTemporaryThumbnailByURL(const GURL& url);
156 160
157 // Add a thumbnail for an unknown url. See temp_thumbnails_map_. 161 // Add a thumbnail for an unknown url. See temp_thumbnails_map_.
158 void AddTemporaryThumbnail(const GURL& url, 162 void AddTemporaryThumbnail(const GURL& url,
159 const base::RefCountedBytes* thumbnail, 163 const base::RefCountedMemory* thumbnail,
160 const ThumbnailScore& score); 164 const ThumbnailScore& score);
161 165
162 // Called by our timer. Starts the query for the most visited sites. 166 // Called by our timer. Starts the query for the most visited sites.
163 void TimerFired(); 167 void TimerFired();
164 168
165 // Finds the given URL in the redirect chain for the given TopSite, and 169 // Finds the given URL in the redirect chain for the given TopSite, and
166 // returns the distance from the destination in hops that the given URL is. 170 // returns the distance from the destination in hops that the given URL is.
167 // The URL is assumed to be in the list. The destination is 0. 171 // The URL is assumed to be in the list. The destination is 0.
168 static int GetRedirectDistanceForURL(const MostVisitedURL& most_visited, 172 static int GetRedirectDistanceForURL(const MostVisitedURL& most_visited,
169 const GURL& url); 173 const GURL& url);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 285
282 // Are we loaded? 286 // Are we loaded?
283 bool loaded_; 287 bool loaded_;
284 288
285 DISALLOW_COPY_AND_ASSIGN(TopSitesImpl); 289 DISALLOW_COPY_AND_ASSIGN(TopSitesImpl);
286 }; 290 };
287 291
288 } // namespace history 292 } // namespace history
289 293
290 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_ 294 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/top_sites_cache.cc ('k') | chrome/browser/history/top_sites_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698