summaryrefslogtreecommitdiffstats
path: root/chrome/browser/favicon
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-16 03:09:06 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-16 03:09:06 +0000
commit299e454ff6c973eb81a913179924df9b5802545a (patch)
treeddcc125cb9541f571267d10067fad3dfdeaa9520 /chrome/browser/favicon
parent264513d9881a9e5599c67a9dded5020d06872dbd (diff)
downloadchromium_src-299e454ff6c973eb81a913179924df9b5802545a.zip
chromium_src-299e454ff6c973eb81a913179924df9b5802545a.tar.gz
chromium_src-299e454ff6c973eb81a913179924df9b5802545a.tar.bz2
bookmarks: Get rid of the dependency on history_types.h
In order to do this we moved two structs (FaviconBitmapResult and FaviconImageResult) from history to favicon. BUG=144783 TBR=joi@chromium.org, sky@chromium.org Review URL: https://codereview.chromium.org/14699005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200425 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/favicon')
-rw-r--r--chrome/browser/favicon/DEPS2
-rw-r--r--chrome/browser/favicon/favicon_handler.cc80
-rw-r--r--chrome/browser/favicon/favicon_handler.h39
-rw-r--r--chrome/browser/favicon/favicon_handler_unittest.cc44
-rw-r--r--chrome/browser/favicon/favicon_service.cc42
-rw-r--r--chrome/browser/favicon/favicon_service.h43
-rw-r--r--chrome/browser/favicon/favicon_tab_helper.cc4
-rw-r--r--chrome/browser/favicon/favicon_tab_helper.h1
-rw-r--r--chrome/browser/favicon/favicon_types.cc23
-rw-r--r--chrome/browser/favicon/favicon_types.h77
-rw-r--r--chrome/browser/favicon/favicon_util.cc6
-rw-r--r--chrome/browser/favicon/favicon_util.h10
12 files changed, 236 insertions, 135 deletions
diff --git a/chrome/browser/favicon/DEPS b/chrome/browser/favicon/DEPS
index a609c84..a5fc921 100644
--- a/chrome/browser/favicon/DEPS
+++ b/chrome/browser/favicon/DEPS
@@ -20,7 +20,6 @@
"!chrome/browser/history/history_backend.h",
"!chrome/browser/history/history_service.h",
"!chrome/browser/history/history_service_factory.h",
- "!chrome/browser/history/history_types.h",
"!chrome/browser/history/select_favicon_frames.h",
"!chrome/browser/profiles/profile.h",
"!chrome/browser/profiles/profile_dependency_manager.h",
@@ -36,6 +35,7 @@ specific_include_rules = {
'favicon_util\.(h|cc)': [
"-chrome",
"-chrome/browser",
+ "+chrome/browser/favicon/favicon_types.h",
"+chrome/browser/favicon/favicon_util.h",
"+chrome/common/icon_messages.h",
"!chrome/browser/history/history_types.h",
diff --git a/chrome/browser/favicon/favicon_handler.cc b/chrome/browser/favicon/favicon_handler.cc
index c9f3af3..4771790 100644
--- a/chrome/browser/favicon/favicon_handler.cc
+++ b/chrome/browser/favicon/favicon_handler.cc
@@ -30,26 +30,26 @@ using content::NavigationEntry;
namespace {
-// Returns history::IconType the given icon_type corresponds to.
-history::IconType ToHistoryIconType(FaviconURL::IconType icon_type) {
+// Returns chrome::IconType the given icon_type corresponds to.
+chrome::IconType ToHistoryIconType(FaviconURL::IconType icon_type) {
switch (icon_type) {
case FaviconURL::FAVICON:
- return history::FAVICON;
+ return chrome::FAVICON;
case FaviconURL::TOUCH_ICON:
- return history::TOUCH_ICON;
+ return chrome::TOUCH_ICON;
case FaviconURL::TOUCH_PRECOMPOSED_ICON:
- return history::TOUCH_PRECOMPOSED_ICON;
+ return chrome::TOUCH_PRECOMPOSED_ICON;
case FaviconURL::INVALID_ICON:
- return history::INVALID_ICON;
+ return chrome::INVALID_ICON;
}
NOTREACHED();
// Shouldn't reach here, just make compiler happy.
- return history::INVALID_ICON;
+ return chrome::INVALID_ICON;
}
bool DoUrlAndIconMatch(const FaviconURL& favicon_url,
const GURL& url,
- history::IconType icon_type) {
+ chrome::IconType icon_type) {
return favicon_url.icon_url == url &&
favicon_url.icon_type == static_cast<FaviconURL::IconType>(icon_type);
}
@@ -59,11 +59,11 @@ bool DoUrlAndIconMatch(const FaviconURL& favicon_url,
// Returns false if |bitmap_results| is empty.
bool DoUrlsAndIconsMatch(
const FaviconURL& favicon_url,
- const std::vector<history::FaviconBitmapResult>& bitmap_results) {
+ const std::vector<chrome::FaviconBitmapResult>& bitmap_results) {
if (bitmap_results.empty())
return false;
- history::IconType icon_type = ToHistoryIconType(favicon_url.icon_type);
+ chrome::IconType icon_type = ToHistoryIconType(favicon_url.icon_type);
for (size_t i = 0; i < bitmap_results.size(); ++i) {
if (favicon_url.icon_url != bitmap_results[i].icon_url ||
@@ -85,12 +85,12 @@ bool UrlMatches(const GURL& gurl_a, const GURL& gurl_b) {
}
// Return true if |bitmap_result| is expired.
-bool IsExpired(const history::FaviconBitmapResult& bitmap_result) {
+bool IsExpired(const chrome::FaviconBitmapResult& bitmap_result) {
return bitmap_result.expired;
}
// Return true if |bitmap_result| is valid.
-bool IsValid(const history::FaviconBitmapResult& bitmap_result) {
+bool IsValid(const chrome::FaviconBitmapResult& bitmap_result) {
return bitmap_result.is_valid();
}
@@ -99,9 +99,9 @@ bool IsValid(const history::FaviconBitmapResult& bitmap_result) {
// the scale factors in FaviconUtil::GetFaviconScaleFactors().
bool HasExpiredOrIncompleteResult(
int desired_size_in_dip,
- const std::vector<history::FaviconBitmapResult>& bitmap_results) {
+ const std::vector<chrome::FaviconBitmapResult>& bitmap_results) {
// Check if at least one of the bitmaps is expired.
- std::vector<history::FaviconBitmapResult>::const_iterator it =
+ std::vector<chrome::FaviconBitmapResult>::const_iterator it =
std::find_if(bitmap_results.begin(), bitmap_results.end(), IsExpired);
if (it != bitmap_results.end())
return true;
@@ -136,8 +136,8 @@ bool HasExpiredOrIncompleteResult(
// Returns true if at least one of |bitmap_results| is valid.
bool HasValidResult(
- const std::vector<history::FaviconBitmapResult>& bitmap_results) {
- std::vector<history::FaviconBitmapResult>::const_iterator it =
+ const std::vector<chrome::FaviconBitmapResult>& bitmap_results) {
+ std::vector<chrome::FaviconBitmapResult>::const_iterator it =
std::find_if(bitmap_results.begin(), bitmap_results.end(), IsValid);
return it != bitmap_results.end();
}
@@ -147,7 +147,7 @@ bool HasValidResult(
////////////////////////////////////////////////////////////////////////////////
FaviconHandler::DownloadRequest::DownloadRequest()
- : icon_type(history::INVALID_ICON) {
+ : icon_type(chrome::INVALID_ICON) {
}
FaviconHandler::DownloadRequest::~DownloadRequest() {
@@ -156,7 +156,7 @@ FaviconHandler::DownloadRequest::~DownloadRequest() {
FaviconHandler::DownloadRequest::DownloadRequest(
const GURL& url,
const GURL& image_url,
- history::IconType icon_type)
+ chrome::IconType icon_type)
: url(url),
image_url(image_url),
icon_type(icon_type) {
@@ -166,7 +166,7 @@ FaviconHandler::DownloadRequest::DownloadRequest(
FaviconHandler::FaviconCandidate::FaviconCandidate()
: score(0),
- icon_type(history::INVALID_ICON) {
+ icon_type(chrome::INVALID_ICON) {
}
FaviconHandler::FaviconCandidate::~FaviconCandidate() {
@@ -177,7 +177,7 @@ FaviconHandler::FaviconCandidate::FaviconCandidate(
const GURL& image_url,
const gfx::Image& image,
float score,
- history::IconType icon_type)
+ chrome::IconType icon_type)
: url(url),
image_url(image_url),
image(image),
@@ -192,8 +192,8 @@ FaviconHandler::FaviconHandler(Profile* profile,
Type icon_type)
: got_favicon_from_history_(false),
favicon_expired_or_incomplete_(false),
- icon_types_(icon_type == FAVICON ? history::FAVICON :
- history::TOUCH_ICON | history::TOUCH_PRECOMPOSED_ICON),
+ icon_types_(icon_type == FAVICON ? chrome::FAVICON :
+ chrome::TOUCH_ICON | chrome::TOUCH_PRECOMPOSED_ICON),
profile_(profile),
delegate_(delegate) {
DCHECK(profile_);
@@ -233,14 +233,14 @@ bool FaviconHandler::UpdateFaviconCandidate(const GURL& url,
const GURL& image_url,
const gfx::Image& image,
float score,
- history::IconType icon_type) {
+ chrome::IconType icon_type) {
bool update_candidate = false;
bool exact_match = score == 1;
if (preferred_icon_size() == 0) {
// No preferred size, use this icon.
update_candidate = true;
exact_match = true;
- } else if (favicon_candidate_.icon_type == history::INVALID_ICON) {
+ } else if (favicon_candidate_.icon_type == chrome::INVALID_ICON) {
// No current candidate, use this.
update_candidate = true;
} else {
@@ -264,11 +264,11 @@ void FaviconHandler::SetFavicon(
const GURL& url,
const GURL& icon_url,
const gfx::Image& image,
- history::IconType icon_type) {
+ chrome::IconType icon_type) {
if (GetFaviconService() && ShouldSaveFavicon(url))
SetHistoryFavicons(url, icon_url, icon_type, image);
- if (UrlMatches(url, url_) && icon_type == history::FAVICON) {
+ if (UrlMatches(url, url_) && icon_type == chrome::FAVICON) {
NavigationEntry* entry = GetEntry();
if (entry)
UpdateFavicon(entry, icon_url, image);
@@ -276,7 +276,7 @@ void FaviconHandler::SetFavicon(
}
void FaviconHandler::UpdateFavicon(NavigationEntry* entry,
- const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results) {
+ const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results) {
gfx::Image resized_image = FaviconUtil::SelectFaviconFramesFromPNGs(
favicon_bitmap_results,
FaviconUtil::GetFaviconScaleFactors(),
@@ -338,7 +338,7 @@ void FaviconHandler::ProcessCurrentUrl() {
if (current_candidate()->icon_type == FaviconURL::FAVICON) {
if (!favicon_expired_or_incomplete_ && entry->GetFavicon().valid &&
DoUrlAndIconMatch(*current_candidate(), entry->GetFavicon().url,
- history::FAVICON))
+ chrome::FAVICON))
return;
} else if (!favicon_expired_or_incomplete_ && got_favicon_from_history_ &&
HasValidResult(history_results_) &&
@@ -382,7 +382,7 @@ void FaviconHandler::OnDidDownloadFavicon(
// Remove the first member of image_urls_ and process the remaining.
image_urls_.pop_front();
ProcessCurrentUrl();
- } else if (favicon_candidate_.icon_type != history::INVALID_ICON) {
+ } else if (favicon_candidate_.icon_type != chrome::INVALID_ICON) {
// No more icons to request, set the favicon from the candidate.
SetFavicon(favicon_candidate_.url,
favicon_candidate_.image_url,
@@ -418,7 +418,7 @@ int FaviconHandler::DownloadFavicon(const GURL& image_url, int image_size) {
void FaviconHandler::UpdateFaviconMappingAndFetch(
const GURL& page_url,
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
const FaviconService::FaviconResultsCallback& callback,
CancelableTaskTracker* tracker) {
// TODO(pkotwicz): pass in all of |image_urls_| to
@@ -431,7 +431,7 @@ void FaviconHandler::UpdateFaviconMappingAndFetch(
void FaviconHandler::GetFavicon(
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
const FaviconService::FaviconResultsCallback& callback,
CancelableTaskTracker* tracker) {
GetFaviconService()->GetFavicon(
@@ -452,7 +452,7 @@ void FaviconHandler::GetFaviconForURL(
void FaviconHandler::SetHistoryFavicons(const GURL& page_url,
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
const gfx::Image& image) {
GetFaviconService()->SetFavicons(page_url, icon_url, icon_type, image);
}
@@ -468,7 +468,7 @@ bool FaviconHandler::ShouldSaveFavicon(const GURL& url) {
}
void FaviconHandler::OnFaviconDataForInitialURL(
- const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results) {
+ const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results) {
NavigationEntry* entry = GetEntry();
if (!entry)
return;
@@ -480,7 +480,7 @@ void FaviconHandler::OnFaviconDataForInitialURL(
favicon_expired_or_incomplete_ = has_results && HasExpiredOrIncompleteResult(
preferred_icon_size(), favicon_bitmap_results);
- if (has_results && icon_types_ == history::FAVICON &&
+ if (has_results && icon_types_ == chrome::FAVICON &&
!entry->GetFavicon().valid &&
(!current_candidate() ||
DoUrlsAndIconsMatch(*current_candidate(), favicon_bitmap_results))) {
@@ -506,7 +506,7 @@ void FaviconHandler::OnFaviconDataForInitialURL(
// already have it.
DownloadFaviconOrAskHistory(entry->GetURL(),
current_candidate()->icon_url,
- static_cast<history::IconType>(current_candidate()->icon_type));
+ static_cast<chrome::IconType>(current_candidate()->icon_type));
}
} else if (current_candidate()) {
// We know the official url for the favicon, by either don't have the
@@ -522,7 +522,7 @@ void FaviconHandler::OnFaviconDataForInitialURL(
void FaviconHandler::DownloadFaviconOrAskHistory(
const GURL& page_url,
const GURL& icon_url,
- history::IconType icon_type) {
+ chrome::IconType icon_type) {
if (favicon_expired_or_incomplete_) {
// We have the mapping, but the favicon is out of date. Download it now.
ScheduleDownload(page_url, icon_url, preferred_icon_size(), icon_type);
@@ -551,7 +551,7 @@ void FaviconHandler::DownloadFaviconOrAskHistory(
}
void FaviconHandler::OnFaviconData(
- const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results) {
+ const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results) {
NavigationEntry* entry = GetEntry();
if (!entry)
return;
@@ -560,7 +560,7 @@ void FaviconHandler::OnFaviconData(
bool has_expired_or_incomplete_result = HasExpiredOrIncompleteResult(
preferred_icon_size(), favicon_bitmap_results);
- if (has_results && icon_types_ == history::FAVICON) {
+ if (has_results && icon_types_ == chrome::FAVICON) {
if (HasValidResult(favicon_bitmap_results)) {
// There is a favicon, set it now. If expired we'll download the current
// one again, but at least the user will get some icon instead of the
@@ -571,7 +571,7 @@ void FaviconHandler::OnFaviconData(
// The favicon is out of date. Request the current one.
ScheduleDownload(entry->GetURL(), entry->GetFavicon().url,
preferred_icon_size(),
- history::FAVICON);
+ chrome::FAVICON);
}
} else if (current_candidate() &&
(!has_results || has_expired_or_incomplete_result ||
@@ -589,7 +589,7 @@ int FaviconHandler::ScheduleDownload(
const GURL& url,
const GURL& image_url,
int image_size,
- history::IconType icon_type) {
+ chrome::IconType icon_type) {
const int download_id = DownloadFavicon(image_url, image_size);
if (download_id) {
// Download ids should be unique.
diff --git a/chrome/browser/favicon/favicon_handler.h b/chrome/browser/favicon/favicon_handler.h
index 23a92bb..8a044e2 100644
--- a/chrome/browser/favicon/favicon_handler.h
+++ b/chrome/browser/favicon/favicon_handler.h
@@ -128,13 +128,13 @@ class FaviconHandler {
virtual void UpdateFaviconMappingAndFetch(
const GURL& page_url,
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
const FaviconService::FaviconResultsCallback& callback,
CancelableTaskTracker* tracker);
virtual void GetFavicon(
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
const FaviconService::FaviconResultsCallback& callback,
CancelableTaskTracker* tracker);
@@ -144,11 +144,10 @@ class FaviconHandler {
const FaviconService::FaviconResultsCallback& callback,
CancelableTaskTracker* tracker);
- virtual void SetHistoryFavicons(
- const GURL& page_url,
- const GURL& icon_url,
- history::IconType icon_type,
- const gfx::Image& image);
+ virtual void SetHistoryFavicons(const GURL& page_url,
+ const GURL& icon_url,
+ chrome::IconType icon_type,
+ const gfx::Image& image);
virtual FaviconService* GetFaviconService();
@@ -164,11 +163,11 @@ class FaviconHandler {
DownloadRequest(const GURL& url,
const GURL& image_url,
- history::IconType icon_type);
+ chrome::IconType icon_type);
GURL url;
GURL image_url;
- history::IconType icon_type;
+ chrome::IconType icon_type;
};
struct FaviconCandidate {
@@ -179,54 +178,54 @@ class FaviconHandler {
const GURL& image_url,
const gfx::Image& image,
float score,
- history::IconType icon_type);
+ chrome::IconType icon_type);
GURL url;
GURL image_url;
gfx::Image image;
float score;
- history::IconType icon_type;
+ chrome::IconType icon_type;
};
// See description above class for details.
void OnFaviconDataForInitialURL(
- const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results);
+ const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results);
// If the favicon has expired, asks the renderer to download the favicon.
// Otherwise asks history to update the mapping between page url and icon
// url with a callback to OnFaviconData when done.
void DownloadFaviconOrAskHistory(const GURL& page_url,
const GURL& icon_url,
- history::IconType icon_type);
+ chrome::IconType icon_type);
// See description above class for details.
void OnFaviconData(
- const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results);
+ const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results);
// Schedules a download for the specified entry. This adds the request to
// download_requests_.
int ScheduleDownload(const GURL& url,
const GURL& image_url,
int image_size,
- history::IconType icon_type);
+ chrome::IconType icon_type);
// Updates |favicon_candidate_| and returns true if it is an exact match.
bool UpdateFaviconCandidate(const GURL& url,
const GURL& image_url,
const gfx::Image& image,
float score,
- history::IconType icon_type);
+ chrome::IconType icon_type);
// Sets the image data for the favicon.
void SetFavicon(const GURL& url,
const GURL& icon_url,
const gfx::Image& image,
- history::IconType icon_type);
+ chrome::IconType icon_type);
// Sets the favicon's data on the NavigationEntry.
// If the WebContents has a delegate, it is invalidated (INVALIDATE_TYPE_TAB).
void UpdateFavicon(content::NavigationEntry* entry,
- const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results);
+ const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results);
void UpdateFavicon(content::NavigationEntry* entry,
const GURL& icon_url,
const gfx::Image& image);
@@ -241,7 +240,7 @@ class FaviconHandler {
// Returns the preferred_icon_size according icon_types_, 0 means no
// preference.
int preferred_icon_size() {
- return icon_types_ == history::FAVICON ? gfx::kFaviconSize : 0;
+ return icon_types_ == chrome::FAVICON ? gfx::kFaviconSize : 0;
}
// Used for FaviconService requests.
@@ -270,7 +269,7 @@ class FaviconHandler {
std::deque<content::FaviconURL> image_urls_;
// The FaviconBitmapResults from history.
- std::vector<history::FaviconBitmapResult> history_results_;
+ std::vector<chrome::FaviconBitmapResult> history_results_;
// The Profile associated with this handler.
Profile* profile_;
diff --git a/chrome/browser/favicon/favicon_handler_unittest.cc b/chrome/browser/favicon/favicon_handler_unittest.cc
index ff4db52..191f502 100644
--- a/chrome/browser/favicon/favicon_handler_unittest.cc
+++ b/chrome/browser/favicon/favicon_handler_unittest.cc
@@ -48,12 +48,12 @@ void FillBitmap(int w, int h, std::vector<unsigned char>* output) {
void SetFaviconBitmapResult(
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
bool expired,
- std::vector<history::FaviconBitmapResult>* favicon_bitmap_results) {
+ std::vector<chrome::FaviconBitmapResult>* favicon_bitmap_results) {
scoped_refptr<base::RefCountedBytes> data(new base::RefCountedBytes());
FillBitmap(gfx::kFaviconSize, gfx::kFaviconSize, &data->data());
- history::FaviconBitmapResult bitmap_result;
+ chrome::FaviconBitmapResult bitmap_result;
bitmap_result.expired = expired;
bitmap_result.bitmap_data = data;
// Use a pixel size other than (0,0) as (0,0) has a special meaning.
@@ -66,8 +66,8 @@ void SetFaviconBitmapResult(
void SetFaviconBitmapResult(
const GURL& icon_url,
- std::vector<history::FaviconBitmapResult>* favicon_bitmap_results) {
- SetFaviconBitmapResult(icon_url, history::FAVICON, false /* expired */,
+ std::vector<chrome::FaviconBitmapResult>* favicon_bitmap_results) {
+ SetFaviconBitmapResult(icon_url, chrome::FAVICON, false /* expired */,
favicon_bitmap_results);
}
@@ -151,7 +151,7 @@ class HistoryRequestHandler {
const GURL icon_url_;
const int icon_type_;
const std::vector<unsigned char> bitmap_data_;
- std::vector<history::FaviconBitmapResult> history_results_;
+ std::vector<chrome::FaviconBitmapResult> history_results_;
FaviconService::FaviconResultsCallback callback_;
private:
@@ -245,7 +245,7 @@ class TestFaviconHandler : public FaviconHandler {
virtual void UpdateFaviconMappingAndFetch(
const GURL& page_url,
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
const FaviconService::FaviconResultsCallback& callback,
CancelableTaskTracker* tracker) OVERRIDE {
history_handler_.reset(new HistoryRequestHandler(page_url, icon_url,
@@ -254,7 +254,7 @@ class TestFaviconHandler : public FaviconHandler {
virtual void GetFavicon(
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
const FaviconService::FaviconResultsCallback& callback,
CancelableTaskTracker* tracker) OVERRIDE {
history_handler_.reset(new HistoryRequestHandler(GURL(), icon_url,
@@ -278,7 +278,7 @@ class TestFaviconHandler : public FaviconHandler {
virtual void SetHistoryFavicons(const GURL& page_url,
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
const gfx::Image& image) OVERRIDE {
scoped_refptr<base::RefCountedMemory> bytes = image.As1xPNGBytes();
std::vector<unsigned char> bitmap_data(bytes->front(),
@@ -381,7 +381,7 @@ TEST_F(FaviconHandlerTest, GetFaviconFromHistory) {
ASSERT_TRUE(history_handler);
EXPECT_EQ(page_url, history_handler->page_url_);
EXPECT_EQ(GURL(), history_handler->icon_url_);
- EXPECT_EQ(history::FAVICON, history_handler->icon_type_);
+ EXPECT_EQ(chrome::FAVICON, history_handler->icon_type_);
SetFaviconBitmapResult(icon_url, &history_handler->history_results_);
@@ -422,10 +422,10 @@ TEST_F(FaviconHandlerTest, DownloadFavicon) {
ASSERT_TRUE(history_handler);
EXPECT_EQ(page_url, history_handler->page_url_);
EXPECT_EQ(GURL(), history_handler->icon_url_);
- EXPECT_EQ(history::FAVICON, history_handler->icon_type_);
+ EXPECT_EQ(chrome::FAVICON, history_handler->icon_type_);
// Set icon data expired
- SetFaviconBitmapResult(icon_url, history::FAVICON, true /* expired */,
+ SetFaviconBitmapResult(icon_url, chrome::FAVICON, true /* expired */,
&history_handler->history_results_);
// Send history response.
history_handler->InvokeCallback();
@@ -489,7 +489,7 @@ TEST_F(FaviconHandlerTest, UpdateAndDownloadFavicon) {
ASSERT_TRUE(history_handler);
EXPECT_EQ(page_url, history_handler->page_url_);
EXPECT_EQ(GURL(), history_handler->icon_url_);
- EXPECT_EQ(history::FAVICON, history_handler->icon_type_);
+ EXPECT_EQ(chrome::FAVICON, history_handler->icon_type_);
// Set valid icon data.
SetFaviconBitmapResult(icon_url, &history_handler->history_results_);
@@ -570,15 +570,15 @@ TEST_F(FaviconHandlerTest, FaviconInHistoryInvalid) {
ASSERT_TRUE(history_handler);
EXPECT_EQ(page_url, history_handler->page_url_);
EXPECT_EQ(GURL(), history_handler->icon_url_);
- EXPECT_EQ(history::FAVICON, history_handler->icon_type_);
+ EXPECT_EQ(chrome::FAVICON, history_handler->icon_type_);
// Set non empty but invalid data.
- history::FaviconBitmapResult bitmap_result;
+ chrome::FaviconBitmapResult bitmap_result;
bitmap_result.expired = false;
// Empty bitmap data is invalid.
bitmap_result.bitmap_data = new base::RefCountedBytes();
bitmap_result.pixel_size = gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize);
- bitmap_result.icon_type = history::FAVICON;
+ bitmap_result.icon_type = chrome::FAVICON;
bitmap_result.icon_url = icon_url;
history_handler->history_results_.clear();
history_handler->history_results_.push_back(bitmap_result);
@@ -642,7 +642,7 @@ TEST_F(FaviconHandlerTest, UpdateFavicon) {
ASSERT_TRUE(history_handler);
EXPECT_EQ(page_url, history_handler->page_url_);
EXPECT_EQ(GURL(), history_handler->icon_url_);
- EXPECT_EQ(history::FAVICON, history_handler->icon_type_);
+ EXPECT_EQ(chrome::FAVICON, history_handler->icon_type_);
SetFaviconBitmapResult(icon_url, &history_handler->history_results_);
@@ -704,7 +704,7 @@ TEST_F(FaviconHandlerTest, Download2ndFaviconURLCandidate) {
ASSERT_TRUE(history_handler);
EXPECT_EQ(page_url, history_handler->page_url_);
EXPECT_EQ(GURL(), history_handler->icon_url_);
- EXPECT_EQ(history::TOUCH_PRECOMPOSED_ICON | history::TOUCH_ICON,
+ EXPECT_EQ(chrome::TOUCH_PRECOMPOSED_ICON | chrome::TOUCH_ICON,
history_handler->icon_type_);
// Icon not found.
@@ -776,7 +776,7 @@ TEST_F(FaviconHandlerTest, Download2ndFaviconURLCandidate) {
download_handler->Reset();
// Simulates getting a expired icon from history.
- SetFaviconBitmapResult(new_icon_url, history::TOUCH_ICON,
+ SetFaviconBitmapResult(new_icon_url, chrome::TOUCH_ICON,
true /* expired */, &history_handler->history_results_);
history_handler->InvokeCallback();
@@ -816,7 +816,7 @@ TEST_F(FaviconHandlerTest, UpdateDuringDownloading) {
ASSERT_TRUE(history_handler);
EXPECT_EQ(page_url, history_handler->page_url_);
EXPECT_EQ(GURL(), history_handler->icon_url_);
- EXPECT_EQ(history::TOUCH_PRECOMPOSED_ICON | history::TOUCH_ICON,
+ EXPECT_EQ(chrome::TOUCH_PRECOMPOSED_ICON | chrome::TOUCH_ICON,
history_handler->icon_type_);
// Icon not found.
@@ -899,8 +899,8 @@ TEST_F(FaviconHandlerTest, UpdateDuringDownloading) {
// Simulates getting the icon from history.
scoped_ptr<HistoryRequestHandler> handler;
handler.reset(new HistoryRequestHandler(page_url, latest_icon_url,
- history::TOUCH_ICON, callback));
- SetFaviconBitmapResult(latest_icon_url, history::TOUCH_ICON,
+ chrome::TOUCH_ICON, callback));
+ SetFaviconBitmapResult(latest_icon_url, chrome::TOUCH_ICON,
false /* expired */, &handler->history_results_);
handler->InvokeCallback();
diff --git a/chrome/browser/favicon/favicon_service.cc b/chrome/browser/favicon/favicon_service.cc
index 1c9b8ff..65facfe 100644
--- a/chrome/browser/favicon/favicon_service.cc
+++ b/chrome/browser/favicon/favicon_service.cc
@@ -6,6 +6,7 @@
#include "base/hash.h"
#include "base/message_loop/message_loop_proxy.h"
+#include "chrome/browser/favicon/favicon_types.h"
#include "chrome/browser/favicon/favicon_util.h"
#include "chrome/browser/favicon/imported_favicon_usage.h"
#include "chrome/browser/history/history_backend.h"
@@ -27,7 +28,7 @@ namespace {
void CancelOrRunFaviconResultsCallback(
const CancelableTaskTracker::IsCanceledCallback& is_canceled,
const FaviconService::FaviconResultsCallback& callback,
- const std::vector<history::FaviconBitmapResult>& results) {
+ const std::vector<chrome::FaviconBitmapResult>& results) {
if (is_canceled.Run())
return;
callback.Run(results);
@@ -41,7 +42,7 @@ CancelableTaskTracker::TaskId RunWithEmptyResultAsync(
return tracker->PostTask(
base::MessageLoopProxy::current(),
FROM_HERE,
- Bind(callback, std::vector<history::FaviconBitmapResult>()));
+ Bind(callback, std::vector<chrome::FaviconBitmapResult>()));
}
} // namespace
@@ -53,13 +54,13 @@ FaviconService::FaviconService(HistoryService* history_service)
// static
void FaviconService::FaviconResultsCallbackRunner(
const FaviconResultsCallback& callback,
- const std::vector<history::FaviconBitmapResult>* results) {
+ const std::vector<chrome::FaviconBitmapResult>* results) {
callback.Run(*results);
}
CancelableTaskTracker::TaskId FaviconService::GetFaviconImage(
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
int desired_size_in_dip,
const FaviconImageCallback& callback,
CancelableTaskTracker* tracker) {
@@ -79,7 +80,7 @@ CancelableTaskTracker::TaskId FaviconService::GetFaviconImage(
CancelableTaskTracker::TaskId FaviconService::GetRawFavicon(
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
int desired_size_in_dip,
ui::ScaleFactor desired_scale_factor,
const FaviconRawCallback& callback,
@@ -105,7 +106,7 @@ CancelableTaskTracker::TaskId FaviconService::GetRawFavicon(
CancelableTaskTracker::TaskId FaviconService::GetFavicon(
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
int desired_size_in_dip,
const FaviconResultsCallback& callback,
CancelableTaskTracker* tracker) {
@@ -179,7 +180,7 @@ CancelableTaskTracker::TaskId FaviconService::GetFaviconForURL(
}
CancelableTaskTracker::TaskId FaviconService::GetLargestRawFaviconForID(
- history::FaviconID favicon_id,
+ chrome::FaviconID favicon_id,
const FaviconRawCallback& callback,
CancelableTaskTracker* tracker) {
// Use 0 as |desired_size_in_dip| to get the largest bitmap for |favicon_id|
@@ -220,7 +221,7 @@ void FaviconService::SetImportedFavicons(
void FaviconService::MergeFavicon(
const GURL& page_url,
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
scoped_refptr<base::RefCountedMemory> bitmap_data,
const gfx::Size& pixel_size) {
if (history_service_) {
@@ -229,18 +230,17 @@ void FaviconService::MergeFavicon(
}
}
-void FaviconService::SetFavicons(
- const GURL& page_url,
- const GURL& icon_url,
- history::IconType icon_type,
- const gfx::Image& image) {
+void FaviconService::SetFavicons(const GURL& page_url,
+ const GURL& icon_url,
+ chrome::IconType icon_type,
+ const gfx::Image& image) {
if (!history_service_)
return;
gfx::ImageSkia image_skia = image.AsImageSkia();
image_skia.EnsureRepsForSupportedScaleFactors();
const std::vector<gfx::ImageSkiaRep>& image_reps = image_skia.image_reps();
- std::vector<history::FaviconBitmapData> favicon_bitmap_data;
+ std::vector<chrome::FaviconBitmapData> favicon_bitmap_data;
for (size_t i = 0; i < image_reps.size(); ++i) {
scoped_refptr<base::RefCountedBytes> bitmap_data(
new base::RefCountedBytes());
@@ -249,7 +249,7 @@ void FaviconService::SetFavicons(
&bitmap_data->data())) {
gfx::Size pixel_size(image_reps[i].pixel_width(),
image_reps[i].pixel_height());
- history::FaviconBitmapData bitmap_data_element;
+ chrome::FaviconBitmapData bitmap_data_element;
bitmap_data_element.bitmap_data = bitmap_data;
bitmap_data_element.pixel_size = pixel_size;
bitmap_data_element.icon_url = icon_url;
@@ -308,8 +308,8 @@ CancelableTaskTracker::TaskId FaviconService::GetFaviconForURLImpl(
void FaviconService::RunFaviconImageCallbackWithBitmapResults(
const FaviconImageCallback& callback,
int desired_size_in_dip,
- const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results) {
- history::FaviconImageResult image_result;
+ const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results) {
+ chrome::FaviconImageResult image_result;
image_result.image = FaviconUtil::SelectFaviconFramesFromPNGs(
favicon_bitmap_results,
FaviconUtil::GetFaviconScaleFactors(),
@@ -323,14 +323,14 @@ void FaviconService::RunFaviconRawCallbackWithBitmapResults(
const FaviconRawCallback& callback,
int desired_size_in_dip,
ui::ScaleFactor desired_scale_factor,
- const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results) {
+ const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results) {
if (favicon_bitmap_results.empty() || !favicon_bitmap_results[0].is_valid()) {
- callback.Run(history::FaviconBitmapResult());
+ callback.Run(chrome::FaviconBitmapResult());
return;
}
DCHECK_EQ(1u, favicon_bitmap_results.size());
- history::FaviconBitmapResult bitmap_result = favicon_bitmap_results[0];
+ chrome::FaviconBitmapResult bitmap_result = favicon_bitmap_results[0];
// If the desired size is 0, SelectFaviconFrames() will return the largest
// bitmap without doing any resizing. As |favicon_bitmap_results| has bitmap
@@ -361,7 +361,7 @@ void FaviconService::RunFaviconRawCallbackWithBitmapResults(
std::vector<unsigned char> resized_bitmap_data;
if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false,
&resized_bitmap_data)) {
- callback.Run(history::FaviconBitmapResult());
+ callback.Run(chrome::FaviconBitmapResult());
return;
}
diff --git a/chrome/browser/favicon/favicon_service.h b/chrome/browser/favicon/favicon_service.h
index bc49082..c95461a 100644
--- a/chrome/browser/favicon/favicon_service.h
+++ b/chrome/browser/favicon/favicon_service.h
@@ -11,7 +11,7 @@
#include "base/hash_tables.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/common/cancelable_request.h"
-#include "chrome/browser/history/history_types.h"
+#include "chrome/browser/favicon/favicon_types.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
#include "chrome/common/cancelable_task_tracker.h"
#include "chrome/common/ref_counted_util.h"
@@ -22,6 +22,10 @@ class HistoryService;
struct ImportedFaviconUsage;
class Profile;
+namespace chrome {
+struct FaviconImageResult;
+}
+
// The favicon service provides methods to access favicons. It calls the history
// backend behind the scenes.
//
@@ -60,15 +64,15 @@ class FaviconService : public CancelableRequestProvider,
// |image| originate from.
// TODO(pkotwicz): Enable constructing |image| from bitmaps from several
// icon URLs.
- typedef base::Callback<void(const history::FaviconImageResult&)>
+ typedef base::Callback<void(const chrome::FaviconImageResult&)>
FaviconImageCallback;
// Callback for GetRawFavicon() and GetRawFaviconForURL().
// FaviconBitmapResult::bitmap_data is the bitmap in the thumbnail database
// for the passed in URL and icon types whose pixel size best matches the
// passed in |desired_size_in_dip| and |desired_scale_factor|. Returns an
- // invalid history::FaviconBitmapResult if there are no matches.
- typedef base::Callback<void(const history::FaviconBitmapResult&)>
+ // invalid chrome::FaviconBitmapResult if there are no matches.
+ typedef base::Callback<void(const chrome::FaviconBitmapResult&)>
FaviconRawCallback;
// Callback for GetFavicon() and GetFaviconForURL().
@@ -79,14 +83,14 @@ class FaviconService : public CancelableRequestProvider,
// platform (eg MacOS) in addition to 1x. The vector has at most one result
// for each of the scale factors. There are less entries if a single result
// is the best bitmap to use for several scale factors.
- typedef base::Callback<void(const std::vector<history::FaviconBitmapResult>&)>
+ typedef base::Callback<void(const std::vector<chrome::FaviconBitmapResult>&)>
FaviconResultsCallback;
// We usually pass parameters with pointer to avoid copy. This function is a
// helper to run FaviconResultsCallback with pointer parameters.
static void FaviconResultsCallbackRunner(
const FaviconResultsCallback& callback,
- const std::vector<history::FaviconBitmapResult>* results);
+ const std::vector<chrome::FaviconBitmapResult>* results);
// Requests the favicon at |icon_url| of |icon_type| whose size most closely
// matches |desired_size_in_dip|. If |desired_size_in_dip| is 0, the largest
@@ -98,14 +102,14 @@ class FaviconService : public CancelableRequestProvider,
// current platform (eg MacOS) are requested for GetFaviconImage().
CancelableTaskTracker::TaskId GetFaviconImage(
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
int desired_size_in_dip,
const FaviconImageCallback& callback,
CancelableTaskTracker* tracker);
CancelableTaskTracker::TaskId GetRawFavicon(
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
int desired_size_in_dip,
ui::ScaleFactor desired_scale_factor,
const FaviconRawCallback& callback,
@@ -113,7 +117,7 @@ class FaviconService : public CancelableRequestProvider,
CancelableTaskTracker::TaskId GetFavicon(
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
int desired_size_in_dip,
const FaviconResultsCallback& callback,
CancelableTaskTracker* tracker);
@@ -178,7 +182,7 @@ class FaviconService : public CancelableRequestProvider,
// multiple favicon bitmaps for |favicon_id|, the largest favicon bitmap is
// returned.
CancelableTaskTracker::TaskId GetLargestRawFaviconForID(
- history::FaviconID favicon_id,
+ chrome::FaviconID favicon_id,
const FaviconRawCallback& callback,
CancelableTaskTracker* tracker);
@@ -205,7 +209,7 @@ class FaviconService : public CancelableRequestProvider,
// known.
void MergeFavicon(const GURL& page_url,
const GURL& icon_url,
- history::IconType icon_type,
+ chrome::IconType icon_type,
scoped_refptr<base::RefCountedMemory> bitmap_data,
const gfx::Size& pixel_size);
@@ -219,11 +223,10 @@ class FaviconService : public CancelableRequestProvider,
// TODO(pkotwicz): Save unresized favicon bitmaps to the database.
// TODO(pkotwicz): Support adding favicons for multiple icon URLs to the
// thumbnail database.
- void SetFavicons(
- const GURL& page_url,
- const GURL& icon_url,
- history::IconType icon_type,
- const gfx::Image& image);
+ void SetFavicons(const GURL& page_url,
+ const GURL& icon_url,
+ chrome::IconType icon_type,
+ const gfx::Image& image);
// Avoid repeated requests to download missing favicon.
void UnableToDownloadFavicon(const GURL& icon_url);
@@ -245,21 +248,21 @@ class FaviconService : public CancelableRequestProvider,
// Intermediate callback for GetFaviconImage() and GetFaviconImageForURL()
// so that history service can deal solely with FaviconResultsCallback.
- // Builds history::FaviconImageResult from |favicon_bitmap_results| and runs
+ // Builds chrome::FaviconImageResult from |favicon_bitmap_results| and runs
// |callback|.
void RunFaviconImageCallbackWithBitmapResults(
const FaviconImageCallback& callback,
int desired_size_in_dip,
- const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results);
+ const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results);
// Intermediate callback for GetRawFavicon() and GetRawFaviconForURL()
// so that history service can deal solely with FaviconResultsCallback.
- // Resizes history::FaviconBitmapResult if necessary and runs |callback|.
+ // Resizes chrome::FaviconBitmapResult if necessary and runs |callback|.
void RunFaviconRawCallbackWithBitmapResults(
const FaviconRawCallback& callback,
int desired_size_in_dip,
ui::ScaleFactor desired_scale_factor,
- const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results);
+ const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results);
DISALLOW_COPY_AND_ASSIGN(FaviconService);
};
diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc
index 754c6e8..7be0450 100644
--- a/chrome/browser/favicon/favicon_tab_helper.cc
+++ b/chrome/browser/favicon/favicon_tab_helper.cc
@@ -126,8 +126,8 @@ void FaviconTabHelper::SaveFavicon() {
favicon.image.IsEmpty()) {
return;
}
- service->SetFavicons(entry->GetURL(), favicon.url, history::FAVICON,
- favicon.image);
+ service->SetFavicons(
+ entry->GetURL(), favicon.url, chrome::FAVICON, favicon.image);
}
NavigationEntry* FaviconTabHelper::GetActiveEntry() {
diff --git a/chrome/browser/favicon/favicon_tab_helper.h b/chrome/browser/favicon/favicon_tab_helper.h
index b0f17a2..6f0f4ad 100644
--- a/chrome/browser/favicon/favicon_tab_helper.h
+++ b/chrome/browser/favicon/favicon_tab_helper.h
@@ -10,7 +10,6 @@
#include "base/basictypes.h"
#include "base/callback.h"
#include "chrome/browser/favicon/favicon_handler_delegate.h"
-#include "chrome/browser/history/history_types.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"
diff --git a/chrome/browser/favicon/favicon_types.cc b/chrome/browser/favicon/favicon_types.cc
new file mode 100644
index 0000000..ca49db8
--- /dev/null
+++ b/chrome/browser/favicon/favicon_types.cc
@@ -0,0 +1,23 @@
+// Copyright 2013 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.
+
+#include "chrome/browser/favicon/favicon_types.h"
+
+namespace chrome {
+
+// FaviconImageResult ---------------------------------------------------------
+
+FaviconImageResult::FaviconImageResult() {}
+
+FaviconImageResult::~FaviconImageResult() {}
+
+// FaviconBitmapResult --------------------------------------------------------
+
+FaviconBitmapResult::FaviconBitmapResult()
+ : expired(false),
+ icon_type(INVALID_ICON) {}
+
+FaviconBitmapResult::~FaviconBitmapResult() {}
+
+} // namespace chrome
diff --git a/chrome/browser/favicon/favicon_types.h b/chrome/browser/favicon/favicon_types.h
new file mode 100644
index 0000000..f48ec4b
--- /dev/null
+++ b/chrome/browser/favicon/favicon_types.h
@@ -0,0 +1,77 @@
+// Copyright 2013 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_FAVICON_FAVICON_TYPES_H_
+#define CHROME_BROWSER_FAVICON_FAVICON_TYPES_H_
+
+#include "base/memory/ref_counted_memory.h"
+#include "googleurl/src/gurl.h"
+#include "ui/gfx/image/image.h"
+#include "ui/gfx/size.h"
+
+namespace chrome {
+
+typedef int64 FaviconID;
+
+// Defines the icon types. They are also stored in icon_type field of favicons
+// table.
+// The values of the IconTypes are used to select the priority in which favicon
+// data is returned in HistoryBackend and ThumbnailDatabase. Data for the
+// largest IconType takes priority if data for multiple IconTypes is available.
+enum IconType {
+ INVALID_ICON = 0x0,
+ FAVICON = 1 << 0,
+ TOUCH_ICON = 1 << 1,
+ TOUCH_PRECOMPOSED_ICON = 1 << 2
+};
+
+// Defines a gfx::Image of size desired_size_in_dip composed of image
+// representations for each of the desired scale factors.
+struct FaviconImageResult {
+ FaviconImageResult();
+ ~FaviconImageResult();
+
+ // The resulting image.
+ gfx::Image image;
+
+ // The URL of the favicon which contains all of the image representations of
+ // |image|.
+ // TODO(pkotwicz): Return multiple |icon_urls| to allow |image| to have
+ // representations from several favicons once content::FaviconStatus supports
+ // multiple URLs.
+ GURL icon_url;
+};
+
+// Defines a favicon bitmap which best matches the desired DIP size and one of
+// the desired scale factors.
+struct FaviconBitmapResult {
+ FaviconBitmapResult();
+ ~FaviconBitmapResult();
+
+ // Returns true if |bitmap_data| contains a valid bitmap.
+ bool is_valid() const { return bitmap_data.get() && bitmap_data->size(); }
+
+ // Indicates whether |bitmap_data| is expired.
+ bool expired;
+
+ // The bits of the bitmap.
+ scoped_refptr<base::RefCountedMemory> bitmap_data;
+
+ // The pixel dimensions of |bitmap_data|.
+ gfx::Size pixel_size;
+
+ // The URL of the containing favicon.
+ GURL icon_url;
+
+ // The icon type of the containing favicon.
+ IconType icon_type;
+};
+
+// Define type with same structure as FaviconBitmapResult for passing data to
+// HistoryBackend::SetFavicons().
+typedef FaviconBitmapResult FaviconBitmapData;
+
+} // namespace chrome
+
+#endif // CHROME_BROWSER_FAVICON_FAVICON_TYPES_H_
diff --git a/chrome/browser/favicon/favicon_util.cc b/chrome/browser/favicon/favicon_util.cc
index 50ff94e..df96a47 100644
--- a/chrome/browser/favicon/favicon_util.cc
+++ b/chrome/browser/favicon/favicon_util.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/favicon/favicon_util.h"
-#include "chrome/browser/history/history_types.h"
+#include "chrome/browser/favicon/favicon_types.h"
#include "chrome/browser/history/select_favicon_frames.h"
#include "content/public/browser/render_view_host.h"
#include "googleurl/src/gurl.h"
@@ -22,7 +22,7 @@ namespace {
// |scale_factors| for which the image reps can be created without resizing
// or decoding the bitmap data.
std::vector<gfx::ImagePNGRep> SelectFaviconFramesFromPNGsWithoutResizing(
- const std::vector<history::FaviconBitmapResult>& png_data,
+ const std::vector<chrome::FaviconBitmapResult>& png_data,
const std::vector<ui::ScaleFactor>& scale_factors,
int favicon_size) {
std::vector<gfx::ImagePNGRep> png_reps;
@@ -106,7 +106,7 @@ std::vector<ui::ScaleFactor> FaviconUtil::GetFaviconScaleFactors() {
// static
gfx::Image FaviconUtil::SelectFaviconFramesFromPNGs(
- const std::vector<history::FaviconBitmapResult>& png_data,
+ const std::vector<chrome::FaviconBitmapResult>& png_data,
const std::vector<ui::ScaleFactor>& scale_factors,
int favicon_size) {
// Create image reps for as many scale factors as possible without resizing
diff --git a/chrome/browser/favicon/favicon_util.h b/chrome/browser/favicon/favicon_util.h
index cef2f7c..32dc6e0 100644
--- a/chrome/browser/favicon/favicon_util.h
+++ b/chrome/browser/favicon/favicon_util.h
@@ -11,6 +11,10 @@
class GURL;
+namespace chrome {
+struct FaviconBitmapResult;
+}
+
namespace content {
class RenderViewHost;
}
@@ -19,10 +23,6 @@ namespace gfx {
class Image;
}
-namespace history {
-struct FaviconBitmapResult;
-}
-
// Utility class for common favicon related code.
class FaviconUtil {
public:
@@ -37,7 +37,7 @@ class FaviconUtil {
// Takes a vector of png-encoded frames, decodes them, and converts them to
// a favicon of size favicon_size (in DIPs) at the desired ui scale factors.
static gfx::Image SelectFaviconFramesFromPNGs(
- const std::vector<history::FaviconBitmapResult>& png_data,
+ const std::vector<chrome::FaviconBitmapResult>& png_data,
const std::vector<ui::ScaleFactor>& scale_factors,
int favicon_size);