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

Unified Diff: chrome/browser/history/top_sites_provider.h

Issue 815983002: Topsites become keyedService based. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/top_sites_provider.h
diff --git a/chrome/browser/history/top_sites.h b/chrome/browser/history/top_sites_provider.h
similarity index 87%
copy from chrome/browser/history/top_sites.h
copy to chrome/browser/history/top_sites_provider.h
index 3f5260f714d99199fc6d36a351ca1d538c51e888..86feeba0f4ad8f990111d5af2fe04074a1ce98f3 100644
--- a/chrome/browser/history/top_sites.h
+++ b/chrome/browser/history/top_sites_provider.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
sdefresne 2014/12/19 15:11:40 Do not change copyright notice when renaming files
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_HISTORY_TOP_SITES_H_
-#define CHROME_BROWSER_HISTORY_TOP_SITES_H_
+#ifndef CHROME_BROWSER_HISTORY_TOP_SITES_PROVIDER_H_
+#define CHROME_BROWSER_HISTORY_TOP_SITES_PROVIDER_H_
#include "base/basictypes.h"
#include "base/callback.h"
@@ -35,14 +35,14 @@ class TopSitesCache;
//
// Some methods should only be called from the UI thread (see method
// descriptions below). All others are assumed to be threadsafe.
-class TopSites
sdefresne 2014/12/19 15:11:40 This class must be the KeyedService, not TopSitesS
- : public base::RefCountedThreadSafe<TopSites>,
- public content::NotificationObserver {
+class TopSitesProvider : public base::RefCountedThreadSafe<TopSitesProvider>,
sdefresne 2014/12/19 15:11:40 Why did you rename this class from TopSites to Top
sdefresne 2014/12/19 15:11:40 Why did you rename this class from TopSites to Top
+ public content::NotificationObserver {
public:
- TopSites();
+ TopSitesProvider() {}
sdefresne 2014/12/19 15:11:40 Do not inline complex constructors.
// Initializes TopSites.
- static TopSites* Create(Profile* profile, const base::FilePath& db_name);
+ static TopSitesProvider* Create(Profile* profile,
+ const base::FilePath& db_name);
// Sets the given thumbnail for the given URL. Returns true if the thumbnail
// was updated. False means either the URL wasn't known to us, or we felt
@@ -54,10 +54,9 @@ class TopSites
// While testing the history system, we want to set the thumbnail to a piece
// of static memory.
- virtual bool SetPageThumbnailToJPEGBytes(
- const GURL& url,
- const base::RefCountedMemory* memory,
- const ThumbnailScore& score) = 0;
+ virtual bool SetPageThumbnailToJPEGBytes(const GURL& url,
+ const base::RefCountedMemory* memory,
+ const ThumbnailScore& score) = 0;
typedef base::Callback<void(const MostVisitedURLList&)>
GetMostVisitedURLsCallback;
@@ -67,9 +66,8 @@ class TopSites
// invoked on any thread. NOTE: the callback is called immediately if we have
// the data cached. If data is not available yet, callback will later be
// posted to the thread called this function.
- virtual void GetMostVisitedURLs(
- const GetMostVisitedURLsCallback& callback,
- bool include_forced_urls) = 0;
+ virtual void GetMostVisitedURLs(const GetMostVisitedURLsCallback& callback,
+ bool include_forced_urls) = 0;
// Gets a thumbnail for a given page. Returns true iff we have the thumbnail.
// This may be invoked on any thread.
@@ -178,11 +176,11 @@ class TopSites
protected:
void NotifyTopSitesLoaded();
void NotifyTopSitesChanged();
- ~TopSites() override;
+ ~TopSitesProvider() override;
private:
ObserverList<TopSitesObserver> observer_list_;
- friend class base::RefCountedThreadSafe<TopSites>;
+ friend class base::RefCountedThreadSafe<TopSitesProvider>;
};
#if defined(OS_ANDROID)
@@ -190,9 +188,9 @@ const int kPrepopulatedPagesCount = 0;
#else
const int kPrepopulatedPagesCount = 2;
#endif
-extern const TopSites::PrepopulatedPage
+extern const TopSitesProvider::PrepopulatedPage
kPrepopulatedPages[kPrepopulatedPagesCount];
} // namespace history
-#endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_
+#endif // CHROME_BROWSER_HISTORY_TOP_SITES_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698