| Index: components/ntp_tiles/popular_sites_impl.h
|
| diff --git a/components/ntp_tiles/popular_sites.h b/components/ntp_tiles/popular_sites_impl.h
|
| similarity index 64%
|
| copy from components/ntp_tiles/popular_sites.h
|
| copy to components/ntp_tiles/popular_sites_impl.h
|
| index 104ae63cd313061cd37e6e7829808724c1aa4773..1707b9e3724738e09884b74a32f19f3df4bbf116 100644
|
| --- a/components/ntp_tiles/popular_sites.h
|
| +++ b/components/ntp_tiles/popular_sites_impl.h
|
| @@ -1,9 +1,9 @@
|
| -// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Copyright 2016 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 COMPONENTS_NTP_TILES_POPULAR_SITES_H_
|
| -#define COMPONENTS_NTP_TILES_POPULAR_SITES_H_
|
| +#ifndef COMPONENTS_NTP_TILES_POPULAR_SITES_IMPL_H_
|
| +#define COMPONENTS_NTP_TILES_POPULAR_SITES_IMPL_H_
|
|
|
| #include <memory>
|
| #include <string>
|
| @@ -14,6 +14,7 @@
|
| #include "base/macros.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/strings/string16.h"
|
| +#include "components/ntp_tiles/popular_sites.h"
|
| #include "net/url_request/url_fetcher_delegate.h"
|
| #include "url/gurl.h"
|
|
|
| @@ -43,55 +44,6 @@ using ParseJSONCallback = base::Callback<void(
|
| const base::Callback<void(std::unique_ptr<base::Value>)>& success_callback,
|
| const base::Callback<void(const std::string&)>& error_callback)>;
|
|
|
| -// Interface to provide a list of suggested popular sites, for display on the
|
| -// NTP when there are not enough personalized tiles.
|
| -class PopularSites {
|
| - public:
|
| - struct Site {
|
| - Site(const base::string16& title,
|
| - const GURL& url,
|
| - const GURL& favicon_url,
|
| - const GURL& large_icon_url,
|
| - const GURL& thumbnail_url);
|
| - Site(const Site& other);
|
| - ~Site();
|
| -
|
| - base::string16 title;
|
| - GURL url;
|
| - GURL favicon_url;
|
| - GURL large_icon_url;
|
| - GURL thumbnail_url;
|
| - };
|
| -
|
| - using SitesVector = std::vector<Site>;
|
| - using FinishedCallback = base::Callback<void(bool /* success */)>;
|
| -
|
| - virtual ~PopularSites() = default;
|
| -
|
| - // Starts the process of retrieving popular sites. When they are available,
|
| - // invokes |callback| with the result, on the same thread as the caller. Never
|
| - // invokes |callback| before returning control to the caller, even if the
|
| - // result is immediately known.
|
| - //
|
| - // Set |force_download| to enforce re-downloading the popular sites file, even
|
| - // if it already exists on disk.
|
| - //
|
| - // Must be called at most once on a given PopularSites object.
|
| - // TODO(mastiz): Remove this restriction?
|
| - virtual void StartFetch(bool force_download,
|
| - const FinishedCallback& callback) = 0;
|
| -
|
| - // Returns the list of available sites.
|
| - virtual const SitesVector& sites() const = 0;
|
| -
|
| - // Various internals exposed publicly for diagnostic pages only.
|
| - virtual GURL GetLastURLFetched() const = 0;
|
| - virtual const base::FilePath& local_path() const = 0;
|
| - virtual GURL GetURLToFetch() = 0;
|
| - virtual std::string GetCountryToFetch() = 0;
|
| - virtual std::string GetVersionToFetch() = 0;
|
| -};
|
| -
|
| // Actual (non-test) implementation of the PopularSites interface. Caches the
|
| // downloaded file on disk to avoid re-downloading on every startup.
|
| class PopularSitesImpl : public PopularSites, public net::URLFetcherDelegate {
|
| @@ -161,4 +113,4 @@ class PopularSitesImpl : public PopularSites, public net::URLFetcherDelegate {
|
|
|
| } // namespace ntp_tiles
|
|
|
| -#endif // COMPONENTS_NTP_TILES_POPULAR_SITES_H_
|
| +#endif // COMPONENTS_NTP_TILES_POPULAR_SITES_IMPL_H_
|
|
|