Commit 698fd44c authored by jif@chromium.org's avatar jif@chromium.org

Renamed FaviconHandlerDelegate to FaviconDriver.

Note:
Currently FaviconTabHelper implements both FaviconClient and FaviconDriver.
A follow up CL will create a ContentFaviconDriver class that implements
FaviconDriver. FaviconTabHelper will then own an instance of the
ContentFaviconDriver, instead of inheriting from FaviconDriver.

BUG=362074

Review URL: https://codereview.chromium.org/255843002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266551 0039d316-1c4b-4281-b951-d872f2087c98
parent 84b07fbe
......@@ -241,7 +241,7 @@ FaviconHandler::FaviconCandidate::FaviconCandidate(
////////////////////////////////////////////////////////////////////////////////
FaviconHandler::FaviconHandler(FaviconClient* client,
FaviconHandlerDelegate* delegate,
FaviconDriver* driver,
Type icon_type,
bool download_largest_icon)
: got_favicon_from_history_(false),
......@@ -252,8 +252,8 @@ FaviconHandler::FaviconHandler(FaviconClient* client,
favicon_base::TOUCH_PRECOMPOSED_ICON),
download_largest_icon_(download_largest_icon),
client_(client),
delegate_(delegate) {
DCHECK(delegate_);
driver_(driver) {
DCHECK(driver_);
}
FaviconHandler::~FaviconHandler() {
......@@ -495,7 +495,7 @@ void FaviconHandler::OnDidDownloadFavicon(
}
NavigationEntry* FaviconHandler::GetEntry() {
NavigationEntry* entry = delegate_->GetActiveEntry();
NavigationEntry* entry = driver_->GetActiveEntry();
if (entry && UrlMatches(entry->GetURL(), url_))
return entry;
......@@ -510,7 +510,7 @@ int FaviconHandler::DownloadFavicon(const GURL& image_url,
NOTREACHED();
return 0;
}
return delegate_->StartDownload(image_url, max_bitmap_size);
return driver_->StartDownload(image_url, max_bitmap_size);
}
void FaviconHandler::UpdateFaviconMappingAndFetch(
......@@ -557,7 +557,7 @@ void FaviconHandler::SetHistoryFavicons(const GURL& page_url,
}
bool FaviconHandler::ShouldSaveFavicon(const GURL& url) {
if (!delegate_->IsOffTheRecord())
if (!driver_->IsOffTheRecord())
return true;
// Otherwise store the favicon if the page is bookmarked.
......@@ -565,7 +565,7 @@ bool FaviconHandler::ShouldSaveFavicon(const GURL& url) {
}
void FaviconHandler::NotifyFaviconUpdated(bool icon_url_changed) {
delegate_->NotifyFaviconUpdated(icon_url_changed);
driver_->NotifyFaviconUpdated(icon_url_changed);
}
void FaviconHandler::OnFaviconDataForInitialURLFromFaviconService(
......@@ -633,7 +633,7 @@ void FaviconHandler::DownloadFaviconOrAskFaviconService(
// We don't know the favicon, but we may have previously downloaded the
// favicon for another page that shares the same favicon. Ask for the
// favicon given the favicon URL.
if (delegate_->IsOffTheRecord()) {
if (driver_->IsOffTheRecord()) {
GetFaviconFromFaviconService(
icon_url, icon_type,
base::Bind(&FaviconHandler::OnFaviconData, base::Unretained(this)),
......@@ -689,7 +689,7 @@ int FaviconHandler::ScheduleDownload(const GURL& url,
const GURL& image_url,
favicon_base::IconType icon_type) {
// A max bitmap size is specified to avoid receiving huge bitmaps in
// OnDidDownloadFavicon(). See FaviconHandlerDelegate::StartDownload()
// OnDidDownloadFavicon(). See FaviconDriver::StartDownload()
// for more details about the max bitmap size.
const int download_id = DownloadFavicon(image_url,
GetMaximalIconSize(icon_type));
......
......@@ -21,7 +21,7 @@
#include "url/gurl.h"
class FaviconClient;
class FaviconHandlerDelegate;
class FaviconDriver;
class SkBitmap;
namespace base {
......@@ -87,7 +87,7 @@ class FaviconHandler {
};
FaviconHandler(FaviconClient* client,
FaviconHandlerDelegate* delegate,
FaviconDriver* driver,
Type icon_type,
bool download_largest_icon);
virtual ~FaviconHandler();
......@@ -159,7 +159,7 @@ class FaviconHandler {
// Returns true if the favicon should be saved.
virtual bool ShouldSaveFavicon(const GURL& url);
// Notifies the delegate that the favicon for the active entry was updated.
// Notifies the driver that the favicon for the active entry was updated.
// |icon_url_changed| is true if a favicon with a different icon URL has been
// selected since the previous call to NotifyFaviconUpdated().
virtual void NotifyFaviconUpdated(bool icon_url_changed);
......@@ -295,8 +295,8 @@ class FaviconHandler {
// The client which implements embedder-specific Favicon operations.
FaviconClient* client_; // weak
// This handler's delegate.
FaviconHandlerDelegate* delegate_; // weak
// This handler's driver.
FaviconDriver* driver_; // weak
// Best image we've seen so far. As images are downloaded from the page they
// are stored here. When there is an exact match, or no more images are
......
......@@ -10,7 +10,7 @@
#include "base/basictypes.h"
#include "base/callback.h"
#include "components/favicon/core/browser/favicon_client.h"
#include "components/favicon/core/favicon_handler_delegate.h"
#include "components/favicon/core/favicon_driver.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "content/public/common/favicon_url.h"
......@@ -32,7 +32,7 @@ class SkBitmap;
//
class FaviconTabHelper : public content::WebContentsObserver,
public FaviconClient,
public FaviconHandlerDelegate,
public FaviconDriver,
public content::WebContentsUserData<FaviconTabHelper> {
public:
virtual ~FaviconTabHelper();
......@@ -68,7 +68,7 @@ class FaviconTabHelper : public content::WebContentsObserver,
// Saves the favicon for the current page.
void SaveFavicon();
// FaviconHandlerDelegate methods.
// FaviconDriver methods.
virtual content::NavigationEntry* GetActiveEntry() OVERRIDE;
virtual int StartDownload(const GURL& url, int max_bitmap_size) OVERRIDE;
virtual void NotifyFaviconUpdated(bool icon_url_changed) OVERRIDE;
......
......@@ -9,7 +9,7 @@
'type': 'none',
'sources': [
'favicon/core/browser/favicon_client.h',
'favicon/core/favicon_handler_delegate.h',
'favicon/core/favicon_driver.h',
],
},
],
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_DELEGATE_H_
#define COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_DELEGATE_H_
#ifndef COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_
#define COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_
class GURL;
......@@ -12,16 +12,16 @@ namespace content {
class NavigationEntry;
}
// This class provides a delegate interface for a FaviconHandler. It allows the
// FaviconHandler to ask its delegate for information or notify its delegate
// about changes.
class FaviconHandlerDelegate {
// Interface that allows Favicon core code to interact with its driver (i.e.,
// obtain information from it and give information to it). A concrete
// implementation must be provided by the driver.
class FaviconDriver {
public:
// Returns the current NavigationEntry.
// TODO(jif): Abstract the NavigationEntry (crbug.com/359598).
virtual content::NavigationEntry* GetActiveEntry() = 0;
// Starts the download for the given favicon. When finished, the delegate
// Starts the download for the given favicon. When finished, the driver
// will call OnDidDownloadFavicon() with the results.
// Returns the unique id of the download request. The id will be passed
// in OnDidDownloadFavicon().
......@@ -31,7 +31,7 @@ class FaviconHandlerDelegate {
// is the only result. A |max_bitmap_size| of 0 means unlimited.
virtual int StartDownload(const GURL& url, int max_bitmap_size) = 0;
// Notifies the delegate that the favicon for the active entry was updated.
// Notifies the driver that the favicon for the active entry was updated.
// |icon_url_changed| is true if a favicon with a different icon URL has
// been selected since the previous call to NotifyFaviconUpdated().
virtual void NotifyFaviconUpdated(bool icon_url_changed) = 0;
......@@ -40,4 +40,4 @@ class FaviconHandlerDelegate {
virtual bool IsOffTheRecord() = 0;
};
#endif // COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_DELEGATE_H_
#endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment