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

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

Issue 10050016: Removes pinning code from TopSites as we no longer need it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove printfs 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_H_ 5 #ifndef CHROME_BROWSER_HISTORY_TOP_SITES_H_
6 #define CHROME_BROWSER_HISTORY_TOP_SITES_H_ 6 #define CHROME_BROWSER_HISTORY_TOP_SITES_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <set> 10 #include <set>
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/history/history_types.h" 24 #include "chrome/browser/history/history_types.h"
25 #include "chrome/browser/history/page_usage_data.h" 25 #include "chrome/browser/history/page_usage_data.h"
26 #include "chrome/common/thumbnail_score.h" 26 #include "chrome/common/thumbnail_score.h"
27 #include "googleurl/src/gurl.h" 27 #include "googleurl/src/gurl.h"
28 #include "third_party/skia/include/core/SkColor.h" 28 #include "third_party/skia/include/core/SkColor.h"
29 #include "ui/gfx/image/image.h" 29 #include "ui/gfx/image/image.h"
30 30
31 class FilePath; 31 class FilePath;
32 class Profile; 32 class Profile;
33 33
34 namespace base {
35 class DictionaryValue;
36 }
37
38 namespace history { 34 namespace history {
39 35
40 class TopSitesCache; 36 class TopSitesCache;
41 class TopSitesBackend; 37 class TopSitesBackend;
42 class TopSitesTest; 38 class TopSitesTest;
43 39
44 // Stores the data for the top "most visited" sites. This includes a cache of 40 // Stores the data for the top "most visited" sites. This includes a cache of
45 // the most visited data from history, as well as the corresponding thumbnails 41 // the most visited data from history, as well as the corresponding thumbnails
46 // of those sites. 42 // of those sites.
47 // 43 //
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 115
120 // Removes a URL from the blacklist. 116 // Removes a URL from the blacklist.
121 void RemoveBlacklistedURL(const GURL& url); 117 void RemoveBlacklistedURL(const GURL& url);
122 118
123 // Returns true if the URL is blacklisted. 119 // Returns true if the URL is blacklisted.
124 bool IsBlacklisted(const GURL& url); 120 bool IsBlacklisted(const GURL& url);
125 121
126 // Clear the blacklist. 122 // Clear the blacklist.
127 void ClearBlacklistedURLs(); 123 void ClearBlacklistedURLs();
128 124
129 // Pinned URLs
130
131 // Pin a URL at |index|.
132 void AddPinnedURL(const GURL& url, size_t index);
133
134 // Returns true if a URL is pinned.
135 bool IsURLPinned(const GURL& url);
136
137 // Unpin a URL.
138 void RemovePinnedURL(const GURL& url);
139
140 // Return a URL pinned at |index| via |out|. Returns true if there
141 // is a URL pinned at |index|.
142 bool GetPinnedURLAtIndex(size_t index, GURL* out);
143
144 // Shuts down top sites. 125 // Shuts down top sites.
145 void Shutdown(); 126 void Shutdown();
146 127
147 // Generates the diff of things that happened between "old" and "new." 128 // Generates the diff of things that happened between "old" and "new."
148 // 129 //
149 // The URLs that are in "new" but not "old" will be have their index into 130 // The URLs that are in "new" but not "old" will be have their index into
150 // "new" put in |added_urls|. The URLs that are in "old" but not "new" will 131 // "new" put in |added_urls|. The URLs that are in "old" but not "new" will
151 // have their index into "old" put into |deleted_urls|. 132 // have their index into "old" put into |deleted_urls|.
152 // 133 //
153 // URLs appearing in both old and new lists but having different indices will 134 // URLs appearing in both old and new lists but having different indices will
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // Finds the given URL in the redirect chain for the given TopSite, and 241 // Finds the given URL in the redirect chain for the given TopSite, and
261 // returns the distance from the destination in hops that the given URL is. 242 // returns the distance from the destination in hops that the given URL is.
262 // The URL is assumed to be in the list. The destination is 0. 243 // The URL is assumed to be in the list. The destination is 0.
263 static int GetRedirectDistanceForURL(const MostVisitedURL& most_visited, 244 static int GetRedirectDistanceForURL(const MostVisitedURL& most_visited,
264 const GURL& url); 245 const GURL& url);
265 246
266 // Add prepopulated pages: 'welcome to Chrome' and themes gallery to |urls|. 247 // Add prepopulated pages: 'welcome to Chrome' and themes gallery to |urls|.
267 // Returns true if any pages were added. 248 // Returns true if any pages were added.
268 static bool AddPrepopulatedPages(MostVisitedURLList* urls); 249 static bool AddPrepopulatedPages(MostVisitedURLList* urls);
269 250
270 // Convert pinned_urls_ dictionary to the new format. Use URLs as 251 // Takes |urls|, produces it's copy in |out| after removing blacklisted URLs.
271 // dictionary keys. 252 void ApplyBlacklist(const MostVisitedURLList& urls, MostVisitedURLList* out);
272 void MigratePinnedURLs();
273
274 // Takes |urls|, produces it's copy in |out| after removing
275 // blacklisted URLs and reordering pinned URLs.
276 void ApplyBlacklistAndPinnedURLs(const MostVisitedURLList& urls,
277 MostVisitedURLList* out);
278 253
279 // Converts a url into a canonical string representation. 254 // Converts a url into a canonical string representation.
280 std::string GetURLString(const GURL& url); 255 std::string GetURLString(const GURL& url);
281 256
282 // Returns an MD5 hash of the URL. Hashing is required for blacklisted URLs. 257 // Returns an MD5 hash of the URL. Hashing is required for blacklisted URLs.
283 std::string GetURLHash(const GURL& url); 258 std::string GetURLHash(const GURL& url);
284 259
285 // Returns the delay until the next update of history is needed. 260 // Returns the delay until the next update of history is needed.
286 // Uses num_urls_changed 261 // Uses num_urls_changed
287 base::TimeDelta GetUpdateDelay(); 262 base::TimeDelta GetUpdateDelay();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // non-empty at startup. After we read the top sites from the DB, we'll 342 // non-empty at startup. After we read the top sites from the DB, we'll
368 // always have a cached list. 343 // always have a cached list.
369 PendingCallbackSet pending_callbacks_; 344 PendingCallbackSet pending_callbacks_;
370 345
371 // Stores thumbnails for unknown pages. When SetPageThumbnail is 346 // Stores thumbnails for unknown pages. When SetPageThumbnail is
372 // called, if we don't know about that URL yet and we don't have 347 // called, if we don't know about that URL yet and we don't have
373 // enough Top Sites (new profile), we store it until the next 348 // enough Top Sites (new profile), we store it until the next
374 // SetTopSites call. 349 // SetTopSites call.
375 TempImages temp_images_; 350 TempImages temp_images_;
376 351
377 // This is a dictionary for the pinned URLs for the the most visited part of
378 // the new tab page. Key is the URL, value is index where it is pinned at (may
379 // be the same as key). This is owned by the PrefService.
380 const base::DictionaryValue* pinned_urls_;
381
382 // See description above HistoryLoadState. 352 // See description above HistoryLoadState.
383 HistoryLoadState history_state_; 353 HistoryLoadState history_state_;
384 354
385 // See description above TopSitesLoadState. 355 // See description above TopSitesLoadState.
386 TopSitesLoadState top_sites_state_; 356 TopSitesLoadState top_sites_state_;
387 357
388 // Are we loaded? 358 // Are we loaded?
389 bool loaded_; 359 bool loaded_;
390 360
391 DISALLOW_COPY_AND_ASSIGN(TopSites); 361 DISALLOW_COPY_AND_ASSIGN(TopSites);
392 }; 362 };
393 363
394 extern const TopSites::PrepopulatedPage kPrepopulatedPages[2]; 364 extern const TopSites::PrepopulatedPage kPrepopulatedPages[2];
395 365
396 } // namespace history 366 } // namespace history
397 367
398 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_ 368 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/browser/history/top_sites.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698