diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-14 00:38:48 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-14 00:38:48 +0000 |
commit | 12b54c7e402f562081ba94d43317080f0aa6ba99 (patch) | |
tree | 5f3e686926ac15bd0939d24995e51f820177daf7 | |
parent | 31a02bc54f9bea614cd3eb5b830567c7fe46e29f (diff) | |
download | chromium_src-12b54c7e402f562081ba94d43317080f0aa6ba99.zip chromium_src-12b54c7e402f562081ba94d43317080f0aa6ba99.tar.gz chromium_src-12b54c7e402f562081ba94d43317080f0aa6ba99.tar.bz2 |
Rename
* FaviconBitmapXxx to FaviconRawBitmapXxx
* FaviconRawCallback to FaviconRawBitmapCallback
* FaviconService::GetXXXForPage to FaviconService::GetXxxcForPageURL
BUG=None
R=pkotwicz@chromium.org
TBR=sky@chromium.org
Review URL: https://codereview.chromium.org/330603004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277142 0039d316-1c4b-4281-b951-d872f2087c98
48 files changed, 384 insertions, 363 deletions
diff --git a/chrome/browser/android/favicon_helper.cc b/chrome/browser/android/favicon_helper.cc index 4ea0e89..60481bf 100644 --- a/chrome/browser/android/favicon_helper.cc +++ b/chrome/browser/android/favicon_helper.cc @@ -57,9 +57,9 @@ void OnLocalFaviconAvailable( j_icon_url.obj()); } -void OnFaviconBitmapResultAvailable( +void OnFaviconRawBitmapResultAvailable( ScopedJavaGlobalRef<jobject>* j_favicon_image_callback, - const favicon_base::FaviconBitmapResult& favicon_bitmap_result) { + const favicon_base::FaviconRawBitmapResult& favicon_bitmap_result) { JNIEnv* env = AttachCurrentThread(); // Convert favicon_image_result to java objects. @@ -116,7 +116,7 @@ jboolean FaviconHelper::GetLocalFaviconImageForURL( if (!favicon_service) return false; - FaviconService::FaviconForURLParams params( + FaviconService::FaviconForPageURLParams params( GURL(ConvertJavaStringToUTF16(env, j_page_url)), static_cast<int>(j_icon_types), static_cast<int>(j_desired_size_in_dip)); @@ -128,7 +128,7 @@ jboolean FaviconHelper::GetLocalFaviconImageForURL( favicon_base::FaviconImageCallback callback_runner = base::Bind( &OnLocalFaviconAvailable, base::Owned(j_scoped_favicon_callback)); - favicon_service->GetFaviconImageForURL( + favicon_service->GetFaviconImageForPageURL( params, callback_runner, cancelable_task_tracker_.get()); @@ -161,9 +161,10 @@ void FaviconHelper::GetLargestRawFaviconForUrl( new ScopedJavaGlobalRef<jobject>(); j_scoped_favicon_callback->Reset(env, j_favicon_image_callback); - favicon_base::FaviconRawCallback callback_runner = base::Bind( - &OnFaviconBitmapResultAvailable, base::Owned(j_scoped_favicon_callback)); - favicon_service->GetLargestRawFaviconForURL( + favicon_base::FaviconRawBitmapCallback callback_runner = + base::Bind(&OnFaviconRawBitmapResultAvailable, + base::Owned(j_scoped_favicon_callback)); + favicon_service->GetLargestRawFaviconForPageURL( profile, GURL(ConvertJavaStringToUTF16(env, j_page_url)), icon_types, diff --git a/chrome/browser/android/provider/chrome_browser_provider.cc b/chrome/browser/android/provider/chrome_browser_provider.cc index e66a4e1..e2c3f53 100644 --- a/chrome/browser/android/provider/chrome_browser_provider.cc +++ b/chrome/browser/android/provider/chrome_browser_provider.cc @@ -673,11 +673,11 @@ class BookmarkIconFetchTask : public FaviconServiceTask { cancelable_consumer, cancelable_tracker) {} - favicon_base::FaviconBitmapResult Run(const GURL& url) { + favicon_base::FaviconRawBitmapResult Run(const GURL& url) { RunAsyncRequestOnUIThreadBlocking( - base::Bind(&FaviconService::GetRawFaviconForURL, + base::Bind(&FaviconService::GetRawFaviconForPageURL, base::Unretained(service()), - FaviconService::FaviconForURLParams( + FaviconService::FaviconForPageURLParams( url, favicon_base::FAVICON | favicon_base::TOUCH_ICON, gfx::kFaviconSize), @@ -690,12 +690,12 @@ class BookmarkIconFetchTask : public FaviconServiceTask { private: void OnFaviconRetrieved( - const favicon_base::FaviconBitmapResult& bitmap_result) { + const favicon_base::FaviconRawBitmapResult& bitmap_result) { result_ = bitmap_result; RequestCompleted(); } - favicon_base::FaviconBitmapResult result_; + favicon_base::FaviconRawBitmapResult result_; DISALLOW_COPY_AND_ASSIGN(BookmarkIconFetchTask); }; @@ -1551,7 +1551,7 @@ ScopedJavaLocalRef<jbyteArray> ChromeBrowserProvider::GetFaviconOrTouchIcon( profile_, &favicon_consumer_, &cancelable_task_tracker_); - favicon_base::FaviconBitmapResult bitmap_result = favicon_task.Run(url); + favicon_base::FaviconRawBitmapResult bitmap_result = favicon_task.Run(url); if (!bitmap_result.is_valid() || !bitmap_result.bitmap_data.get()) return ScopedJavaLocalRef<jbyteArray>(); diff --git a/chrome/browser/android/shortcut_helper.cc b/chrome/browser/android/shortcut_helper.cc index 7a010b1..b236728 100644 --- a/chrome/browser/android/shortcut_helper.cc +++ b/chrome/browser/android/shortcut_helper.cc @@ -84,7 +84,7 @@ void ShortcutBuilder::OnDidRetrieveWebappInformation( // Using favicon if its size is not smaller than platform required size, // otherwise using the largest icon among all avaliable icons. int threshold_to_get_any_largest_icon = launcher_large_icon_size_ - 1; - favicon_service->GetLargestRawFaviconForURL(profile, url_, icon_types, + favicon_service->GetLargestRawFaviconForPageURL(profile, url_, icon_types, threshold_to_get_any_largest_icon, base::Bind(&ShortcutBuilder::FinishAddingShortcut, base::Unretained(this)), @@ -92,7 +92,7 @@ void ShortcutBuilder::OnDidRetrieveWebappInformation( } void ShortcutBuilder::FinishAddingShortcut( - const favicon_base::FaviconBitmapResult& bitmap_result) { + const favicon_base::FaviconRawBitmapResult& bitmap_result) { base::WorkerPool::PostTask( FROM_HERE, base::Bind(&ShortcutHelper::AddShortcutInBackground, @@ -140,7 +140,7 @@ void ShortcutHelper::AddShortcutInBackground( const GURL& url, const base::string16& title, ShortcutBuilder::ShortcutType shortcut_type, - const favicon_base::FaviconBitmapResult& bitmap_result) { + const favicon_base::FaviconRawBitmapResult& bitmap_result) { DCHECK(base::WorkerPool::RunsTasksOnCurrentThread()); // Grab the average color from the bitmap. diff --git a/chrome/browser/android/shortcut_helper.h b/chrome/browser/android/shortcut_helper.h index 9e4e13c..bf7911a 100644 --- a/chrome/browser/android/shortcut_helper.h +++ b/chrome/browser/android/shortcut_helper.h @@ -13,7 +13,7 @@ #include "content/public/browser/web_contents_observer.h" namespace favicon_base { -struct FaviconBitmapResult; +struct FaviconRawBitmapResult; } // namespace favicon_base namespace content { @@ -53,7 +53,7 @@ class ShortcutBuilder : public content::WebContentsObserver { const GURL& expected_url); void FinishAddingShortcut( - const favicon_base::FaviconBitmapResult& bitmap_result); + const favicon_base::FaviconRawBitmapResult& bitmap_result); // WebContentsObserver virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; @@ -84,7 +84,7 @@ class ShortcutHelper { const GURL& url, const base::string16& title, ShortcutBuilder::ShortcutType shortcut_type, - const favicon_base::FaviconBitmapResult& bitmap_result); + const favicon_base::FaviconRawBitmapResult& bitmap_result); // Registers JNI hooks. static bool RegisterShortcutHelper(JNIEnv* env); diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc index 1b000b2..0e16b80 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer.cc @@ -457,8 +457,8 @@ bool BookmarkFaviconFetcher::FetchNextFavicon() { if (favicons_map_->end() == iter) { FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( profile_, Profile::EXPLICIT_ACCESS); - favicon_service->GetRawFaviconForURL( - FaviconService::FaviconForURLParams( + favicon_service->GetRawFaviconForPageURL( + FaviconService::FaviconForPageURLParams( GURL(url), favicon_base::FAVICON, gfx::kFaviconSize), ui::SCALE_FACTOR_100P, base::Bind(&BookmarkFaviconFetcher::OnFaviconDataAvailable, @@ -473,7 +473,7 @@ bool BookmarkFaviconFetcher::FetchNextFavicon() { } void BookmarkFaviconFetcher::OnFaviconDataAvailable( - const favicon_base::FaviconBitmapResult& bitmap_result) { + const favicon_base::FaviconRawBitmapResult& bitmap_result) { GURL url; if (!bookmark_urls_.empty()) { url = GURL(bookmark_urls_.front()); diff --git a/chrome/browser/bookmarks/bookmark_html_writer.h b/chrome/browser/bookmarks/bookmark_html_writer.h index bdb638c..38ded31 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.h +++ b/chrome/browser/bookmarks/bookmark_html_writer.h @@ -21,7 +21,7 @@ class BookmarkNode; class Profile; namespace chrome { -struct FaviconBitmapResult; +struct FaviconRawBitmapResult; } // Observer for bookmark html output. Used only in tests. @@ -71,7 +71,7 @@ class BookmarkFaviconFetcher: public content::NotificationObserver { // Favicon fetch callback. After all favicons are fetched executes // html output on the file thread. void OnFaviconDataAvailable( - const favicon_base::FaviconBitmapResult& bitmap_result); + const favicon_base::FaviconRawBitmapResult& bitmap_result); // The Profile object used for accessing FaviconService, bookmarks model. Profile* profile_; diff --git a/chrome/browser/bookmarks/chrome_bookmark_client.cc b/chrome/browser/bookmarks/chrome_bookmark_client.cc index bd8453c..0ab0eb1 100644 --- a/chrome/browser/bookmarks/chrome_bookmark_client.cc +++ b/chrome/browser/bookmarks/chrome_bookmark_client.cc @@ -109,8 +109,8 @@ base::CancelableTaskTracker::TaskId ChromeBookmarkClient::GetFaviconImageForURL( FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); if (!favicon_service) return base::CancelableTaskTracker::kBadTaskId; - return favicon_service->GetFaviconImageForURL( - FaviconService::FaviconForURLParams( + return favicon_service->GetFaviconImageForPageURL( + FaviconService::FaviconForPageURLParams( page_url, icon_types, desired_size_in_dip), callback, tracker); diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc index 1f45eb3..58c957f 100644 --- a/chrome/browser/extensions/api/management/management_api.cc +++ b/chrome/browser/extensions/api/management/management_api.cc @@ -926,8 +926,8 @@ bool ManagementGenerateAppForLinkFunction::RunAsync() { title_ = params->title; launch_url_ = launch_url; - favicon_service->GetFaviconImageForURL( - FaviconService::FaviconForURLParams( + favicon_service->GetFaviconImageForPageURL( + FaviconService::FaviconForPageURLParams( launch_url, favicon_base::FAVICON, gfx::kFaviconSize), base::Bind(&ManagementGenerateAppForLinkFunction::OnFaviconForApp, this), &cancelable_task_tracker_); diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc index f279343..aba836d 100644 --- a/chrome/browser/extensions/extension_web_ui.cc +++ b/chrome/browser/extensions/extension_web_ui.cc @@ -90,8 +90,8 @@ void UnregisterAndReplaceOverrideForWebContents(const std::string& page, void RunFaviconCallbackAsync( const favicon_base::FaviconResultsCallback& callback, const gfx::Image& image) { - std::vector<favicon_base::FaviconBitmapResult>* favicon_bitmap_results = - new std::vector<favicon_base::FaviconBitmapResult>(); + std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results = + new std::vector<favicon_base::FaviconRawBitmapResult>(); const std::vector<gfx::ImageSkiaRep>& image_reps = image.AsImageSkia().image_reps(); @@ -102,7 +102,7 @@ void RunFaviconCallbackAsync( if (gfx::PNGCodec::EncodeBGRASkBitmap(image_rep.sk_bitmap(), false, &bitmap_data->data())) { - favicon_base::FaviconBitmapResult bitmap_result; + favicon_base::FaviconRawBitmapResult bitmap_result; bitmap_result.bitmap_data = bitmap_data; bitmap_result.pixel_size = gfx::Size(image_rep.pixel_width(), image_rep.pixel_height()); diff --git a/chrome/browser/favicon/favicon_handler.cc b/chrome/browser/favicon/favicon_handler.cc index 423b19c..f6d7160 100644 --- a/chrome/browser/favicon/favicon_handler.cc +++ b/chrome/browser/favicon/favicon_handler.cc @@ -61,7 +61,7 @@ bool DoUrlAndIconMatch(const FaviconURL& favicon_url, // Returns false if |bitmap_results| is empty. bool DoUrlsAndIconsMatch( const FaviconURL& favicon_url, - const std::vector<favicon_base::FaviconBitmapResult>& bitmap_results) { + const std::vector<favicon_base::FaviconRawBitmapResult>& bitmap_results) { if (bitmap_results.empty()) return false; @@ -87,12 +87,12 @@ bool UrlMatches(const GURL& gurl_a, const GURL& gurl_b) { } // Return true if |bitmap_result| is expired. -bool IsExpired(const favicon_base::FaviconBitmapResult& bitmap_result) { +bool IsExpired(const favicon_base::FaviconRawBitmapResult& bitmap_result) { return bitmap_result.expired; } // Return true if |bitmap_result| is valid. -bool IsValid(const favicon_base::FaviconBitmapResult& bitmap_result) { +bool IsValid(const favicon_base::FaviconRawBitmapResult& bitmap_result) { return bitmap_result.is_valid(); } @@ -101,9 +101,9 @@ bool IsValid(const favicon_base::FaviconBitmapResult& bitmap_result) { // the scale factors in FaviconUtil::GetFaviconScaleFactors(). bool HasExpiredOrIncompleteResult( int desired_size_in_dip, - const std::vector<favicon_base::FaviconBitmapResult>& bitmap_results) { + const std::vector<favicon_base::FaviconRawBitmapResult>& bitmap_results) { // Check if at least one of the bitmaps is expired. - std::vector<favicon_base::FaviconBitmapResult>::const_iterator it = + std::vector<favicon_base::FaviconRawBitmapResult>::const_iterator it = std::find_if(bitmap_results.begin(), bitmap_results.end(), IsExpired); if (it != bitmap_results.end()) return true; @@ -138,7 +138,7 @@ bool HasExpiredOrIncompleteResult( // Returns true if at least one of |bitmap_results| is valid. bool HasValidResult( - const std::vector<favicon_base::FaviconBitmapResult>& bitmap_results) { + const std::vector<favicon_base::FaviconRawBitmapResult>& bitmap_results) { return std::find_if(bitmap_results.begin(), bitmap_results.end(), IsValid) != bitmap_results.end(); } @@ -314,7 +314,7 @@ void FaviconHandler::SetFavicon(const GURL& url, } void FaviconHandler::SetFaviconOnActivePage(const std::vector< - favicon_base::FaviconBitmapResult>& favicon_bitmap_results) { + favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results) { gfx::Image resized_image = FaviconUtil::SelectFaviconFramesFromPNGs( favicon_bitmap_results, FaviconUtil::GetFaviconScaleFactors(), @@ -512,8 +512,8 @@ void FaviconHandler::GetFaviconForURLFromFaviconService( int icon_types, const favicon_base::FaviconResultsCallback& callback, base::CancelableTaskTracker* tracker) { - client_->GetFaviconService()->GetFaviconForURL( - FaviconService::FaviconForURLParams( + client_->GetFaviconService()->GetFaviconForPageURL( + FaviconService::FaviconForPageURLParams( page_url, icon_types, preferred_icon_size()), callback, tracker); @@ -540,7 +540,7 @@ void FaviconHandler::NotifyFaviconUpdated(bool icon_url_changed) { } void FaviconHandler::OnFaviconDataForInitialURLFromFaviconService( - const std::vector<favicon_base::FaviconBitmapResult>& + const std::vector<favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results) { if (PageChangedSinceFaviconWasRequested()) return; @@ -619,7 +619,7 @@ void FaviconHandler::DownloadFaviconOrAskFaviconService( } void FaviconHandler::OnFaviconData(const std::vector< - favicon_base::FaviconBitmapResult>& favicon_bitmap_results) { + favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results) { if (PageChangedSinceFaviconWasRequested()) return; diff --git a/chrome/browser/favicon/favicon_handler.h b/chrome/browser/favicon/favicon_handler.h index 68903f6..b4feadc 100644 --- a/chrome/browser/favicon/favicon_handler.h +++ b/chrome/browser/favicon/favicon_handler.h @@ -191,7 +191,7 @@ class FaviconHandler { // See description above class for details. void OnFaviconDataForInitialURLFromFaviconService(const std::vector< - favicon_base::FaviconBitmapResult>& favicon_bitmap_results); + favicon_base::FaviconRawBitmapResult>& 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 @@ -201,7 +201,7 @@ class FaviconHandler { favicon_base::IconType icon_type); // See description above class for details. - void OnFaviconData(const std::vector<favicon_base::FaviconBitmapResult>& + void OnFaviconData(const std::vector<favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results); // Schedules a download for the specified entry. This adds the request to @@ -225,7 +225,7 @@ class FaviconHandler { // Sets the favicon's data. void SetFaviconOnActivePage(const std::vector< - favicon_base::FaviconBitmapResult>& favicon_bitmap_results); + favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results); void SetFaviconOnActivePage(const GURL& icon_url, const gfx::Image& image); // Return the current candidate if any. @@ -277,8 +277,8 @@ class FaviconHandler { // The prioritized favicon candidates from the page back from the renderer. std::vector<favicon::FaviconURL> image_urls_; - // The FaviconBitmapResults from history. - std::vector<favicon_base::FaviconBitmapResult> history_results_; + // The FaviconRawBitmapResults from history. + std::vector<favicon_base::FaviconRawBitmapResult> history_results_; // The client which implements embedder-specific Favicon operations. FaviconClient* client_; // weak diff --git a/chrome/browser/favicon/favicon_handler_unittest.cc b/chrome/browser/favicon/favicon_handler_unittest.cc index 8a3c4e5..4aa61b0 100644 --- a/chrome/browser/favicon/favicon_handler_unittest.cc +++ b/chrome/browser/favicon/favicon_handler_unittest.cc @@ -42,14 +42,14 @@ void FillBitmap(int w, int h, std::vector<unsigned char>* output) { gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, output); } -void SetFaviconBitmapResult( +void SetFaviconRawBitmapResult( const GURL& icon_url, favicon_base::IconType icon_type, bool expired, - std::vector<favicon_base::FaviconBitmapResult>* favicon_bitmap_results) { + std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results) { scoped_refptr<base::RefCountedBytes> data(new base::RefCountedBytes()); FillBitmap(gfx::kFaviconSize, gfx::kFaviconSize, &data->data()); - favicon_base::FaviconBitmapResult bitmap_result; + favicon_base::FaviconRawBitmapResult 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. @@ -60,13 +60,13 @@ void SetFaviconBitmapResult( favicon_bitmap_results->push_back(bitmap_result); } -void SetFaviconBitmapResult( +void SetFaviconRawBitmapResult( const GURL& icon_url, - std::vector<favicon_base::FaviconBitmapResult>* favicon_bitmap_results) { - SetFaviconBitmapResult(icon_url, - favicon_base::FAVICON, - false /* expired */, - favicon_bitmap_results); + std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results) { + SetFaviconRawBitmapResult(icon_url, + favicon_base::FAVICON, + false /* expired */, + favicon_bitmap_results); } // This class is used to save the download request for verifying with test case. @@ -163,7 +163,7 @@ class HistoryRequestHandler { const int icon_type_; const std::vector<unsigned char> bitmap_data_; const gfx::Size size_; - std::vector<favicon_base::FaviconBitmapResult> history_results_; + std::vector<favicon_base::FaviconRawBitmapResult> history_results_; favicon_base::FaviconResultsCallback callback_; private: @@ -493,7 +493,7 @@ TEST_F(FaviconHandlerTest, GetFaviconFromHistory) { EXPECT_EQ(GURL(), history_handler->icon_url_); EXPECT_EQ(favicon_base::FAVICON, history_handler->icon_type_); - SetFaviconBitmapResult(icon_url, &history_handler->history_results_); + SetFaviconRawBitmapResult(icon_url, &history_handler->history_results_); // Send history response. history_handler->InvokeCallback(); @@ -535,10 +535,10 @@ TEST_F(FaviconHandlerTest, DownloadFavicon) { EXPECT_EQ(favicon_base::FAVICON, history_handler->icon_type_); // Set icon data expired - SetFaviconBitmapResult(icon_url, - favicon_base::FAVICON, - true /* expired */, - &history_handler->history_results_); + SetFaviconRawBitmapResult(icon_url, + favicon_base::FAVICON, + true /* expired */, + &history_handler->history_results_); // Send history response. history_handler->InvokeCallback(); // Verify FaviconHandler status @@ -604,7 +604,7 @@ TEST_F(FaviconHandlerTest, UpdateAndDownloadFavicon) { EXPECT_EQ(favicon_base::FAVICON, history_handler->icon_type_); // Set valid icon data. - SetFaviconBitmapResult(icon_url, &history_handler->history_results_); + SetFaviconRawBitmapResult(icon_url, &history_handler->history_results_); // Send history response. history_handler->InvokeCallback(); @@ -685,7 +685,7 @@ TEST_F(FaviconHandlerTest, FaviconInHistoryInvalid) { EXPECT_EQ(favicon_base::FAVICON, history_handler->icon_type_); // Set non empty but invalid data. - favicon_base::FaviconBitmapResult bitmap_result; + favicon_base::FaviconRawBitmapResult bitmap_result; bitmap_result.expired = false; // Empty bitmap data is invalid. bitmap_result.bitmap_data = new base::RefCountedBytes(); @@ -756,7 +756,7 @@ TEST_F(FaviconHandlerTest, UpdateFavicon) { EXPECT_EQ(GURL(), history_handler->icon_url_); EXPECT_EQ(favicon_base::FAVICON, history_handler->icon_type_); - SetFaviconBitmapResult(icon_url, &history_handler->history_results_); + SetFaviconRawBitmapResult(icon_url, &history_handler->history_results_); // Send history response. history_handler->InvokeCallback(); @@ -788,7 +788,7 @@ TEST_F(FaviconHandlerTest, UpdateFavicon) { EXPECT_EQ(page_url, history_handler->page_url_); // Simulate find icon. - SetFaviconBitmapResult(new_icon_url, &history_handler->history_results_); + SetFaviconRawBitmapResult(new_icon_url, &history_handler->history_results_); history_handler->InvokeCallback(); // Shouldn't request download favicon @@ -891,10 +891,10 @@ TEST_F(FaviconHandlerTest, Download2ndFaviconURLCandidate) { download_handler->Reset(); // Simulates getting a expired icon from history. - SetFaviconBitmapResult(new_icon_url, - favicon_base::TOUCH_ICON, - true /* expired */, - &history_handler->history_results_); + SetFaviconRawBitmapResult(new_icon_url, + favicon_base::TOUCH_ICON, + true /* expired */, + &history_handler->history_results_); history_handler->InvokeCallback(); // Verify the download request. @@ -1019,10 +1019,10 @@ TEST_F(FaviconHandlerTest, UpdateDuringDownloading) { scoped_ptr<HistoryRequestHandler> handler; handler.reset(new HistoryRequestHandler( page_url, latest_icon_url, favicon_base::TOUCH_ICON, callback)); - SetFaviconBitmapResult(latest_icon_url, - favicon_base::TOUCH_ICON, - false /* expired */, - &handler->history_results_); + SetFaviconRawBitmapResult(latest_icon_url, + favicon_base::TOUCH_ICON, + false /* expired */, + &handler->history_results_); handler->InvokeCallback(); // No download request. diff --git a/chrome/browser/favicon/favicon_service.cc b/chrome/browser/favicon/favicon_service.cc index b39cac7..afa0142 100644 --- a/chrome/browser/favicon/favicon_service.cc +++ b/chrome/browser/favicon/favicon_service.cc @@ -28,7 +28,7 @@ namespace { void CancelOrRunFaviconResultsCallback( const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, const favicon_base::FaviconResultsCallback& callback, - const std::vector<favicon_base::FaviconBitmapResult>& results) { + const std::vector<favicon_base::FaviconRawBitmapResult>& results) { if (is_canceled.Run()) return; callback.Run(results); @@ -42,7 +42,7 @@ base::CancelableTaskTracker::TaskId RunWithEmptyResultAsync( return tracker->PostTask( base::MessageLoopProxy::current().get(), FROM_HERE, - Bind(callback, std::vector<favicon_base::FaviconBitmapResult>())); + Bind(callback, std::vector<favicon_base::FaviconRawBitmapResult>())); } // Return the TaskId to retreive the favicon from chrome specific URL. @@ -73,7 +73,7 @@ FaviconService::FaviconService(Profile* profile) // static void FaviconService::FaviconResultsCallbackRunner( const favicon_base::FaviconResultsCallback& callback, - const std::vector<favicon_base::FaviconBitmapResult>* results) { + const std::vector<favicon_base::FaviconRawBitmapResult>* results) { callback.Run(*results); } @@ -101,12 +101,14 @@ base::CancelableTaskTracker::TaskId FaviconService::GetRawFavicon( favicon_base::IconType icon_type, int desired_size_in_dip, ui::ScaleFactor desired_scale_factor, - const favicon_base::FaviconRawCallback& callback, + const favicon_base::FaviconRawBitmapCallback& callback, base::CancelableTaskTracker* tracker) { favicon_base::FaviconResultsCallback callback_runner = - Bind(&FaviconService::RunFaviconRawCallbackWithBitmapResults, + Bind(&FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults, base::Unretained(this), - callback, desired_size_in_dip, desired_scale_factor); + callback, + desired_size_in_dip, + desired_scale_factor); if (history_service_) { std::vector<GURL> icon_urls; @@ -153,11 +155,11 @@ FaviconService::UpdateFaviconMappingsAndFetch( return RunWithEmptyResultAsync(callback, tracker); } -base::CancelableTaskTracker::TaskId FaviconService::GetFaviconImageForURL( - const FaviconForURLParams& params, +base::CancelableTaskTracker::TaskId FaviconService::GetFaviconImageForPageURL( + const FaviconForPageURLParams& params, const favicon_base::FaviconImageCallback& callback, base::CancelableTaskTracker* tracker) { - return GetFaviconForURLImpl( + return GetFaviconForPageURLImpl( params, FaviconUtil::GetFaviconScaleFactors(), Bind(&FaviconService::RunFaviconImageCallbackWithBitmapResults, @@ -167,17 +169,17 @@ base::CancelableTaskTracker::TaskId FaviconService::GetFaviconImageForURL( tracker); } -base::CancelableTaskTracker::TaskId FaviconService::GetRawFaviconForURL( - const FaviconForURLParams& params, +base::CancelableTaskTracker::TaskId FaviconService::GetRawFaviconForPageURL( + const FaviconForPageURLParams& params, ui::ScaleFactor desired_scale_factor, - const favicon_base::FaviconRawCallback& callback, + const favicon_base::FaviconRawBitmapCallback& callback, base::CancelableTaskTracker* tracker) { std::vector<ui::ScaleFactor> desired_scale_factors; desired_scale_factors.push_back(desired_scale_factor); - return GetFaviconForURLImpl( + return GetFaviconForPageURLImpl( params, desired_scale_factors, - Bind(&FaviconService::RunFaviconRawCallbackWithBitmapResults, + Bind(&FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults, base::Unretained(this), callback, params.desired_size_in_dip, @@ -185,16 +187,20 @@ base::CancelableTaskTracker::TaskId FaviconService::GetRawFaviconForURL( tracker); } -base::CancelableTaskTracker::TaskId FaviconService::GetLargestRawFaviconForURL( +base::CancelableTaskTracker::TaskId +FaviconService::GetLargestRawFaviconForPageURL( Profile* profile, const GURL& page_url, const std::vector<int>& icon_types, int minimum_size_in_pixels, - const favicon_base::FaviconRawCallback& callback, + const favicon_base::FaviconRawBitmapCallback& callback, base::CancelableTaskTracker* tracker) { favicon_base::FaviconResultsCallback favicon_results_callback = - Bind(&FaviconService::RunFaviconRawCallbackWithBitmapResults, - base::Unretained(this), callback, 0, ui::ScaleFactor()); + Bind(&FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults, + base::Unretained(this), + callback, + 0, + ui::ScaleFactor()); if (page_url.SchemeIs(content::kChromeUIScheme) || page_url.SchemeIs(extensions::kExtensionScheme)) { std::vector<ui::ScaleFactor> scale_factor; @@ -209,28 +215,28 @@ base::CancelableTaskTracker::TaskId FaviconService::GetLargestRawFaviconForURL( return RunWithEmptyResultAsync(favicon_results_callback, tracker); } -base::CancelableTaskTracker::TaskId FaviconService::GetFaviconForURL( - const FaviconForURLParams& params, +base::CancelableTaskTracker::TaskId FaviconService::GetFaviconForPageURL( + const FaviconForPageURLParams& params, const favicon_base::FaviconResultsCallback& callback, base::CancelableTaskTracker* tracker) { - return GetFaviconForURLImpl(params, - FaviconUtil::GetFaviconScaleFactors(), - callback, - tracker); + return GetFaviconForPageURLImpl( + params, FaviconUtil::GetFaviconScaleFactors(), callback, tracker); } base::CancelableTaskTracker::TaskId FaviconService::GetLargestRawFaviconForID( favicon_base::FaviconID favicon_id, - const favicon_base::FaviconRawCallback& callback, + const favicon_base::FaviconRawBitmapCallback& callback, base::CancelableTaskTracker* tracker) { // Use 0 as |desired_size_in_dip| to get the largest bitmap for |favicon_id| // without any resizing. int desired_size_in_dip = 0; ui::ScaleFactor desired_scale_factor = ui::SCALE_FACTOR_100P; favicon_base::FaviconResultsCallback callback_runner = - Bind(&FaviconService::RunFaviconRawCallbackWithBitmapResults, + Bind(&FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults, base::Unretained(this), - callback, desired_size_in_dip, desired_scale_factor); + callback, + desired_size_in_dip, + desired_scale_factor); if (history_service_) { return history_service_->GetFaviconForID( @@ -279,7 +285,7 @@ void FaviconService::SetFavicons(const GURL& page_url, gfx::ImageSkia image_skia = image.AsImageSkia(); image_skia.EnsureRepsForSupportedScales(); const std::vector<gfx::ImageSkiaRep>& image_reps = image_skia.image_reps(); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; for (size_t i = 0; i < image_reps.size(); ++i) { scoped_refptr<base::RefCountedBytes> bitmap_data( new base::RefCountedBytes()); @@ -288,7 +294,7 @@ void FaviconService::SetFavicons(const GURL& page_url, &bitmap_data->data())) { gfx::Size pixel_size(image_reps[i].pixel_width(), image_reps[i].pixel_height()); - favicon_base::FaviconBitmapData bitmap_data_element; + favicon_base::FaviconRawBitmapData bitmap_data_element; bitmap_data_element.bitmap_data = bitmap_data; bitmap_data_element.pixel_size = pixel_size; bitmap_data_element.icon_url = icon_url; @@ -316,8 +322,8 @@ void FaviconService::ClearUnableToDownloadFavicons() { FaviconService::~FaviconService() {} -base::CancelableTaskTracker::TaskId FaviconService::GetFaviconForURLImpl( - const FaviconForURLParams& params, +base::CancelableTaskTracker::TaskId FaviconService::GetFaviconForPageURLImpl( + const FaviconForPageURLParams& params, const std::vector<ui::ScaleFactor>& desired_scale_factors, const favicon_base::FaviconResultsCallback& callback, base::CancelableTaskTracker* tracker) { @@ -340,7 +346,7 @@ base::CancelableTaskTracker::TaskId FaviconService::GetFaviconForURLImpl( void FaviconService::RunFaviconImageCallbackWithBitmapResults( const favicon_base::FaviconImageCallback& callback, int desired_size_in_dip, - const std::vector<favicon_base::FaviconBitmapResult>& + const std::vector<favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results) { favicon_base::FaviconImageResult image_result; image_result.image = FaviconUtil::SelectFaviconFramesFromPNGs( @@ -354,19 +360,20 @@ void FaviconService::RunFaviconImageCallbackWithBitmapResults( callback.Run(image_result); } -void FaviconService::RunFaviconRawCallbackWithBitmapResults( - const favicon_base::FaviconRawCallback& callback, +void FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults( + const favicon_base::FaviconRawBitmapCallback& callback, int desired_size_in_dip, ui::ScaleFactor desired_scale_factor, - const std::vector<favicon_base::FaviconBitmapResult>& + const std::vector<favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results) { if (favicon_bitmap_results.empty() || !favicon_bitmap_results[0].is_valid()) { - callback.Run(favicon_base::FaviconBitmapResult()); + callback.Run(favicon_base::FaviconRawBitmapResult()); return; } DCHECK_EQ(1u, favicon_bitmap_results.size()); - favicon_base::FaviconBitmapResult bitmap_result = favicon_bitmap_results[0]; + favicon_base::FaviconRawBitmapResult 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 @@ -398,7 +405,7 @@ void FaviconService::RunFaviconRawCallbackWithBitmapResults( std::vector<unsigned char> resized_bitmap_data; if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, &resized_bitmap_data)) { - callback.Run(favicon_base::FaviconBitmapResult()); + callback.Run(favicon_base::FaviconRawBitmapResult()); return; } diff --git a/chrome/browser/favicon/favicon_service.h b/chrome/browser/favicon/favicon_service.h index dfbd1f4..8725267 100644 --- a/chrome/browser/favicon/favicon_service.h +++ b/chrome/browser/favicon/favicon_service.h @@ -30,10 +30,10 @@ class FaviconService : public KeyedService { virtual ~FaviconService(); // Auxiliary argument structure for requesting favicons for URLs. - struct FaviconForURLParams { - FaviconForURLParams(const GURL& page_url, - int icon_types, - int desired_size_in_dip) + struct FaviconForPageURLParams { + FaviconForPageURLParams(const GURL& page_url, + int icon_types, + int desired_size_in_dip) : page_url(page_url), icon_types(icon_types), desired_size_in_dip(desired_size_in_dip) {} @@ -47,7 +47,7 @@ class FaviconService : public KeyedService { // helper to run FaviconResultsCallback with pointer parameters. static void FaviconResultsCallbackRunner( const favicon_base::FaviconResultsCallback& callback, - const std::vector<favicon_base::FaviconBitmapResult>* results); + const std::vector<favicon_base::FaviconRawBitmapResult>* results); // The first argument of |callback| is a |const FaviconImageResult&|. Of which // |FaviconImageResult::image| is constructed from the bitmaps for the @@ -79,7 +79,7 @@ class FaviconService : public KeyedService { favicon_base::IconType icon_type, int desired_size_in_dip, ui::ScaleFactor desired_scale_factor, - const favicon_base::FaviconRawCallback& callback, + const favicon_base::FaviconRawBitmapCallback& callback, base::CancelableTaskTracker* tracker); // The first argument for |callback| is the set of bitmaps for the passed in @@ -132,30 +132,30 @@ class FaviconService : public KeyedService { // FAVICON. Each of the three methods below differs in the format of the // callback and the requested scale factors. All of the scale factors // supported by the current platform (eg MacOS) are requested for - // GetFaviconImageForURL(). + // GetFaviconImageForPageURL(). // Note. |callback| is always run asynchronously. - base::CancelableTaskTracker::TaskId GetFaviconImageForURL( - const FaviconForURLParams& params, + base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL( + const FaviconForPageURLParams& params, const favicon_base::FaviconImageCallback& callback, base::CancelableTaskTracker* tracker); - base::CancelableTaskTracker::TaskId GetRawFaviconForURL( - const FaviconForURLParams& params, + base::CancelableTaskTracker::TaskId GetRawFaviconForPageURL( + const FaviconForPageURLParams& params, ui::ScaleFactor desired_scale_factor, - const favicon_base::FaviconRawCallback& callback, + const favicon_base::FaviconRawBitmapCallback& callback, base::CancelableTaskTracker* tracker); - // See HistoryService::GetLargestFaviconForURL(). - base::CancelableTaskTracker::TaskId GetLargestRawFaviconForURL( + // See HistoryService::GetLargestFaviconForPageURL(). + base::CancelableTaskTracker::TaskId GetLargestRawFaviconForPageURL( Profile* profile, const GURL& page_url, const std::vector<int>& icon_types, int minimum_size_in_pixels, - const favicon_base::FaviconRawCallback& callback, + const favicon_base::FaviconRawBitmapCallback& callback, base::CancelableTaskTracker* tracker); - base::CancelableTaskTracker::TaskId GetFaviconForURL( - const FaviconForURLParams& params, + base::CancelableTaskTracker::TaskId GetFaviconForPageURL( + const FaviconForPageURLParams& params, const favicon_base::FaviconResultsCallback& callback, base::CancelableTaskTracker* tracker); @@ -165,7 +165,7 @@ class FaviconService : public KeyedService { // returned. base::CancelableTaskTracker::TaskId GetLargestRawFaviconForID( favicon_base::FaviconID favicon_id, - const favicon_base::FaviconRawCallback& callback, + const favicon_base::FaviconRawBitmapCallback& callback, base::CancelableTaskTracker* tracker); // Marks all types of favicon for the page as being out of date. @@ -221,33 +221,33 @@ class FaviconService : public KeyedService { HistoryService* history_service_; Profile* profile_; - // Helper function for GetFaviconImageForURL(), GetRawFaviconForURL() and - // GetFaviconForURL(). - base::CancelableTaskTracker::TaskId GetFaviconForURLImpl( - const FaviconForURLParams& params, + // Helper function for GetFaviconImageForPageURL(), GetRawFaviconForPageURL() + // and GetFaviconForPageURL(). + base::CancelableTaskTracker::TaskId GetFaviconForPageURLImpl( + const FaviconForPageURLParams& params, const std::vector<ui::ScaleFactor>& desired_scale_factors, const favicon_base::FaviconResultsCallback& callback, base::CancelableTaskTracker* tracker); - // Intermediate callback for GetFaviconImage() and GetFaviconImageForURL() + // Intermediate callback for GetFaviconImage() and GetFaviconImageForPageURL() // so that history service can deal solely with FaviconResultsCallback. // Builds favicon_base::FaviconImageResult from |favicon_bitmap_results| and - // runs - // |callback|. + // runs |callback|. void RunFaviconImageCallbackWithBitmapResults( - const favicon_base::FaviconImageCallback& callback, + const favicon_base::FaviconImageCallback& callback, int desired_size_in_dip, - const std::vector<favicon_base::FaviconBitmapResult>& + const std::vector<favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results); - // Intermediate callback for GetRawFavicon() and GetRawFaviconForURL() + // Intermediate callback for GetRawFavicon() and GetRawFaviconForPageURL() // so that history service can deal solely with FaviconResultsCallback. - // Resizes favicon_base::FaviconBitmapResult if necessary and runs |callback|. - void RunFaviconRawCallbackWithBitmapResults( - const favicon_base::FaviconRawCallback& callback, + // Resizes favicon_base::FaviconRawBitmapResult if necessary and runs + // |callback|. + void RunFaviconRawBitmapCallbackWithBitmapResults( + const favicon_base::FaviconRawBitmapCallback& callback, int desired_size_in_dip, ui::ScaleFactor desired_scale_factor, - const std::vector<favicon_base::FaviconBitmapResult>& + const std::vector<favicon_base::FaviconRawBitmapResult>& favicon_bitmap_results); DISALLOW_COPY_AND_ASSIGN(FaviconService); diff --git a/chrome/browser/favicon/favicon_util.cc b/chrome/browser/favicon/favicon_util.cc index 2625dc4..d903b8b 100644 --- a/chrome/browser/favicon/favicon_util.cc +++ b/chrome/browser/favicon/favicon_util.cc @@ -25,7 +25,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<favicon_base::FaviconBitmapResult>& png_data, + const std::vector<favicon_base::FaviconRawBitmapResult>& png_data, const std::vector<ui::ScaleFactor>& scale_factors, int favicon_size) { std::vector<gfx::ImagePNGRep> png_reps; @@ -173,7 +173,7 @@ void FaviconUtil::SetFaviconColorSpace(gfx::Image* image) { // static gfx::Image FaviconUtil::SelectFaviconFramesFromPNGs( - const std::vector<favicon_base::FaviconBitmapResult>& png_data, + const std::vector<favicon_base::FaviconRawBitmapResult>& 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 08c40ca..8f9c0ca 100644 --- a/chrome/browser/favicon/favicon_util.h +++ b/chrome/browser/favicon/favicon_util.h @@ -11,7 +11,7 @@ #include "ui/base/layout.h" namespace chrome { -struct FaviconBitmapResult; +struct FaviconRawBitmapResult; } namespace gfx { @@ -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<favicon_base::FaviconBitmapResult>& png_data, + const std::vector<favicon_base::FaviconRawBitmapResult>& png_data, const std::vector<ui::ScaleFactor>& scale_factors, int favicon_size); }; diff --git a/chrome/browser/history/android/android_provider_backend_unittest.cc b/chrome/browser/history/android/android_provider_backend_unittest.cc index 4eb1e61..05e39c9 100644 --- a/chrome/browser/history/android/android_provider_backend_unittest.cc +++ b/chrome/browser/history/android/android_provider_backend_unittest.cc @@ -256,11 +256,11 @@ TEST_F(AndroidProviderBackendTest, UpdateTables) { // Set favicon to url2. std::vector<unsigned char> data; data.push_back('1'); - favicon_base::FaviconBitmapData bitmap_data_element; + favicon_base::FaviconRawBitmapData bitmap_data_element; bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); bitmap_data_element.pixel_size = gfx::Size(); bitmap_data_element.icon_url = GURL(); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; favicon_bitmap_data.push_back(bitmap_data_element); history_backend->SetFavicons( @@ -409,11 +409,11 @@ TEST_F(AndroidProviderBackendTest, QueryHistoryAndBookmarks) { // Set favicon to url2. std::vector<unsigned char> data; data.push_back('1'); - favicon_base::FaviconBitmapData bitmap_data_element; + favicon_base::FaviconRawBitmapData bitmap_data_element; bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); bitmap_data_element.pixel_size = gfx::Size(); bitmap_data_element.icon_url = GURL(); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; favicon_bitmap_data.push_back(bitmap_data_element); history_backend->SetFavicons( @@ -1860,11 +1860,11 @@ TEST_F(AndroidProviderBackendTest, QueryWithoutThumbnailDB) { // Set favicon to url2. std::vector<unsigned char> data; data.push_back('1'); - favicon_base::FaviconBitmapData bitmap_data_element; + favicon_base::FaviconRawBitmapData bitmap_data_element; bitmap_data_element.bitmap_data = new base::RefCountedBytes(data); bitmap_data_element.pixel_size = gfx::Size(); bitmap_data_element.icon_url = GURL(); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; favicon_bitmap_data.push_back(bitmap_data_element); history_backend->SetFavicons( diff --git a/chrome/browser/history/android/sqlite_cursor.cc b/chrome/browser/history/android/sqlite_cursor.cc index f570c7c5..ded7dd0 100644 --- a/chrome/browser/history/android/sqlite_cursor.cc +++ b/chrome/browser/history/android/sqlite_cursor.cc @@ -203,7 +203,7 @@ bool SQLiteCursor::GetFavicon(favicon_base::FaviconID id, void SQLiteCursor::GetFaviconForIDInUIThread( favicon_base::FaviconID id, - const favicon_base::FaviconRawCallback& callback) { + const favicon_base::FaviconRawBitmapCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!tracker_.get()) tracker_.reset(new base::CancelableTaskTracker()); @@ -211,7 +211,7 @@ void SQLiteCursor::GetFaviconForIDInUIThread( } void SQLiteCursor::OnFaviconData( - const favicon_base::FaviconBitmapResult& bitmap_result) { + const favicon_base::FaviconRawBitmapResult& bitmap_result) { favicon_bitmap_result_ = bitmap_result; event_.Signal(); if (test_observer_) diff --git a/chrome/browser/history/android/sqlite_cursor.h b/chrome/browser/history/android/sqlite_cursor.h index f5c7870..b4cf8f6 100644 --- a/chrome/browser/history/android/sqlite_cursor.h +++ b/chrome/browser/history/android/sqlite_cursor.h @@ -153,10 +153,10 @@ class SQLiteCursor { void GetFaviconForIDInUIThread( favicon_base::FaviconID id, - const favicon_base::FaviconRawCallback& callback); + const favicon_base::FaviconRawBitmapCallback& callback); // The callback function of FaviconService::GetLargestRawFaviconForID(). - void OnFaviconData(const favicon_base::FaviconBitmapResult& bitmap_result); + void OnFaviconData(const favicon_base::FaviconRawBitmapResult& bitmap_result); // The callback function of MoveTo(). void OnMoved(AndroidHistoryProviderService::Handle handle, int pos); @@ -189,7 +189,7 @@ class SQLiteCursor { int count_; // The favicon image. - favicon_base::FaviconBitmapResult favicon_bitmap_result_; + favicon_base::FaviconRawBitmapResult favicon_bitmap_result_; TestObserver* test_observer_; diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index a3fb38f..c7c2bb0 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -1572,7 +1572,7 @@ void HistoryBackend::GetFavicons( int icon_types, int desired_size_in_dip, const std::vector<ui::ScaleFactor>& desired_scale_factors, - std::vector<favicon_base::FaviconBitmapResult>* bitmap_results) { + std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results) { UpdateFaviconMappingsAndFetchImpl(NULL, icon_urls, icon_types, desired_size_in_dip, desired_scale_factors, bitmap_results); @@ -1582,7 +1582,7 @@ void HistoryBackend::GetLargestFaviconForURL( const GURL& page_url, const std::vector<int>& icon_types, int minimum_size_in_pixels, - favicon_base::FaviconBitmapResult* favicon_bitmap_result) { + favicon_base::FaviconRawBitmapResult* favicon_bitmap_result) { DCHECK(favicon_bitmap_result); if (!db_ || !thumbnail_db_) @@ -1654,7 +1654,7 @@ void HistoryBackend::GetLargestFaviconForURL( } base::Time last_updated; - favicon_base::FaviconBitmapResult bitmap_result; + favicon_base::FaviconRawBitmapResult bitmap_result; bitmap_result.icon_url = icon_url; bitmap_result.icon_type = icon_type; if (!thumbnail_db_->GetFaviconBitmap(largest_icon.bitmap_id, @@ -1678,7 +1678,7 @@ void HistoryBackend::GetFaviconsForURL( int icon_types, int desired_size_in_dip, const std::vector<ui::ScaleFactor>& desired_scale_factors, - std::vector<favicon_base::FaviconBitmapResult>* bitmap_results) { + std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results) { DCHECK(bitmap_results); GetFaviconsFromDB(page_url, icon_types, desired_size_in_dip, desired_scale_factors, bitmap_results); @@ -1688,7 +1688,7 @@ void HistoryBackend::GetFaviconForID( favicon_base::FaviconID favicon_id, int desired_size_in_dip, ui::ScaleFactor desired_scale_factor, - std::vector<favicon_base::FaviconBitmapResult>* bitmap_results) { + std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results) { std::vector<favicon_base::FaviconID> favicon_ids; favicon_ids.push_back(favicon_id); std::vector<ui::ScaleFactor> desired_scale_factors; @@ -1707,7 +1707,7 @@ void HistoryBackend::UpdateFaviconMappingsAndFetch( int icon_types, int desired_size_in_dip, const std::vector<ui::ScaleFactor>& desired_scale_factors, - std::vector<favicon_base::FaviconBitmapResult>* bitmap_results) { + std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results) { UpdateFaviconMappingsAndFetchImpl(&page_url, icon_urls, icon_types, desired_size_in_dip, desired_scale_factors, bitmap_results); @@ -1857,14 +1857,15 @@ void HistoryBackend::MergeFavicon( void HistoryBackend::SetFavicons( const GURL& page_url, favicon_base::IconType icon_type, - const std::vector<favicon_base::FaviconBitmapData>& favicon_bitmap_data) { + const std::vector<favicon_base::FaviconRawBitmapData>& + favicon_bitmap_data) { if (!thumbnail_db_ || !db_) return; DCHECK(ValidateSetFaviconsParams(favicon_bitmap_data)); - // Build map of FaviconBitmapData for each icon url. - typedef std::map<GURL, std::vector<favicon_base::FaviconBitmapData> > + // Build map of FaviconRawBitmapData for each icon url. + typedef std::map<GURL, std::vector<favicon_base::FaviconRawBitmapData> > BitmapDataByIconURL; BitmapDataByIconURL grouped_by_icon_url; for (size_t i = 0; i < favicon_bitmap_data.size(); ++i) { @@ -2010,7 +2011,7 @@ void HistoryBackend::UpdateFaviconMappingsAndFetchImpl( int icon_types, int desired_size_in_dip, const std::vector<ui::ScaleFactor>& desired_scale_factors, - std::vector<favicon_base::FaviconBitmapResult>* bitmap_results) { + std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results) { // If |page_url| is specified, |icon_types| must be either a single icon // type or icon types which are equivalent. DCHECK(!page_url || icon_types == favicon_base::FAVICON || @@ -2066,7 +2067,7 @@ void HistoryBackend::UpdateFaviconMappingsAndFetchImpl( void HistoryBackend::SetFaviconBitmaps( favicon_base::FaviconID icon_id, - const std::vector<favicon_base::FaviconBitmapData>& favicon_bitmap_data, + const std::vector<favicon_base::FaviconRawBitmapData>& favicon_bitmap_data, bool* favicon_bitmaps_changed) { if (favicon_bitmaps_changed) *favicon_bitmaps_changed = false; @@ -2074,13 +2075,13 @@ void HistoryBackend::SetFaviconBitmaps( std::vector<FaviconBitmapIDSize> bitmap_id_sizes; thumbnail_db_->GetFaviconBitmapIDSizes(icon_id, &bitmap_id_sizes); - std::vector<favicon_base::FaviconBitmapData> to_add = favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> to_add = favicon_bitmap_data; for (size_t i = 0; i < bitmap_id_sizes.size(); ++i) { const gfx::Size& pixel_size = bitmap_id_sizes[i].pixel_size; - std::vector<favicon_base::FaviconBitmapData>::iterator match_it = + std::vector<favicon_base::FaviconRawBitmapData>::iterator match_it = to_add.end(); - for (std::vector<favicon_base::FaviconBitmapData>::iterator it = + for (std::vector<favicon_base::FaviconRawBitmapData>::iterator it = to_add.begin(); it != to_add.end(); ++it) { @@ -2123,7 +2124,7 @@ void HistoryBackend::SetFaviconBitmaps( } bool HistoryBackend::ValidateSetFaviconsParams(const std::vector< - favicon_base::FaviconBitmapData>& favicon_bitmap_data) const { + favicon_base::FaviconRawBitmapData>& favicon_bitmap_data) const { typedef std::map<GURL, size_t> BitmapsPerIconURL; BitmapsPerIconURL num_bitmaps_per_icon_url; for (size_t i = 0; i < favicon_bitmap_data.size(); ++i) { @@ -2167,7 +2168,7 @@ bool HistoryBackend::GetFaviconsFromDB( int icon_types, int desired_size_in_dip, const std::vector<ui::ScaleFactor>& desired_scale_factors, - std::vector<favicon_base::FaviconBitmapResult>* favicon_bitmap_results) { + std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results) { DCHECK(favicon_bitmap_results); favicon_bitmap_results->clear(); @@ -2197,7 +2198,7 @@ bool HistoryBackend::GetFaviconBitmapResultsForBestMatch( const std::vector<favicon_base::FaviconID>& candidate_favicon_ids, int desired_size_in_dip, const std::vector<ui::ScaleFactor>& desired_scale_factors, - std::vector<favicon_base::FaviconBitmapResult>* favicon_bitmap_results) { + std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results) { favicon_bitmap_results->clear(); if (candidate_favicon_ids.empty()) @@ -2239,7 +2240,7 @@ bool HistoryBackend::GetFaviconBitmapResultsForBestMatch( } } - // Construct FaviconBitmapResults from |best_favicon_id| and + // Construct FaviconRawBitmapResults from |best_favicon_id| and // |best_bitmap_ids|. GURL icon_url; favicon_base::IconType icon_type; @@ -2250,7 +2251,7 @@ bool HistoryBackend::GetFaviconBitmapResultsForBestMatch( for (size_t i = 0; i < best_bitmap_ids.size(); ++i) { base::Time last_updated; - favicon_base::FaviconBitmapResult bitmap_result; + favicon_base::FaviconRawBitmapResult bitmap_result; bitmap_result.icon_url = icon_url; bitmap_result.icon_type = icon_type; if (!thumbnail_db_->GetFaviconBitmap(best_bitmap_ids[i], diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h index d5a9fc4..57a17a2 100644 --- a/chrome/browser/history/history_backend.h +++ b/chrome/browser/history/history_backend.h @@ -216,26 +216,26 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, int icon_types, int desired_size_in_dip, const std::vector<ui::ScaleFactor>& desired_scale_factors, - std::vector<favicon_base::FaviconBitmapResult>* bitmap_results); + std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); void GetLargestFaviconForURL( const GURL& page_url, const std::vector<int>& icon_types, int minimum_size_in_pixels, - favicon_base::FaviconBitmapResult* bitmap_result); + favicon_base::FaviconRawBitmapResult* bitmap_result); void GetFaviconsForURL( const GURL& page_url, int icon_types, int desired_size_in_dip, const std::vector<ui::ScaleFactor>& desired_scale_factors, - std::vector<favicon_base::FaviconBitmapResult>* bitmap_results); + std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); void GetFaviconForID( favicon_base::FaviconID favicon_id, int desired_size_in_dip, ui::ScaleFactor desired_scale_factor, - std::vector<favicon_base::FaviconBitmapResult>* bitmap_results); + std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); void UpdateFaviconMappingsAndFetch( const GURL& page_url, @@ -243,7 +243,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, int icon_types, int desired_size_in_dip, const std::vector<ui::ScaleFactor>& desired_scale_factors, - std::vector<favicon_base::FaviconBitmapResult>* bitmap_results); + std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); void MergeFavicon(const GURL& page_url, const GURL& icon_url, @@ -251,10 +251,10 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, scoped_refptr<base::RefCountedMemory> bitmap_data, const gfx::Size& pixel_size); - void SetFavicons( - const GURL& page_url, - favicon_base::IconType icon_type, - const std::vector<favicon_base::FaviconBitmapData>& favicon_bitmap_data); + void SetFavicons(const GURL& page_url, + favicon_base::IconType icon_type, + const std::vector<favicon_base::FaviconRawBitmapData>& + favicon_bitmap_data); void SetFaviconsOutOfDateForPage(const GURL& page_url); @@ -652,7 +652,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, int icon_types, int desired_size_in_dip, const std::vector<ui::ScaleFactor>& desired_scale_factors, - std::vector<favicon_base::FaviconBitmapResult>* results); + std::vector<favicon_base::FaviconRawBitmapResult>* results); // Set the favicon bitmaps for |icon_id|. // For each entry in |favicon_bitmap_data|, if a favicon bitmap already @@ -664,19 +664,19 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, // data at |icon_id| is changed as a result of calling this method. // Computing |favicon_bitmaps_changed| requires additional database queries // so should be avoided if unnecessary. - void SetFaviconBitmaps( - favicon_base::FaviconID icon_id, - const std::vector<favicon_base::FaviconBitmapData>& favicon_bitmap_data, - bool* favicon_bitmaps_changed); + void SetFaviconBitmaps(favicon_base::FaviconID icon_id, + const std::vector<favicon_base::FaviconRawBitmapData>& + favicon_bitmap_data, + bool* favicon_bitmaps_changed); // Returns true if |favicon_bitmap_data| passed to SetFavicons() is valid. // Criteria: // 1) |favicon_bitmap_data| contains no more than // kMaxFaviconsPerPage unique icon URLs. // kMaxFaviconBitmapsPerIconURL favicon bitmaps for each icon URL. - // 2) FaviconBitmapData::bitmap_data contains non NULL bitmap data. + // 2) FaviconRawBitmapData::bitmap_data contains non NULL bitmap data. bool ValidateSetFaviconsParams(const std::vector< - favicon_base::FaviconBitmapData>& favicon_bitmap_data) const; + favicon_base::FaviconRawBitmapData>& favicon_bitmap_data) const; // Returns true if the bitmap data at |bitmap_id| equals |new_bitmap_data|. bool IsFaviconBitmapDataEqual( @@ -699,7 +699,8 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, int icon_types, const int desired_size_in_dip, const std::vector<ui::ScaleFactor>& desired_scale_factors, - std::vector<favicon_base::FaviconBitmapResult>* favicon_bitmap_results); + std::vector<favicon_base::FaviconRawBitmapResult>* + favicon_bitmap_results); // Returns the favicon bitmaps which most closely match |desired_size_in_dip| // and |desired_scale_factors| in |favicon_bitmap_results|. If @@ -714,7 +715,8 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, const std::vector<favicon_base::FaviconID>& candidate_favicon_ids, int desired_size_in_dip, const std::vector<ui::ScaleFactor>& desired_scale_factors, - std::vector<favicon_base::FaviconBitmapResult>* favicon_bitmap_results); + std::vector<favicon_base::FaviconRawBitmapResult>* + favicon_bitmap_results); // Maps the favicon ids in |icon_ids| to |page_url| (and all redirects) // for |icon_type|. diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc index 1580806..e005c20 100644 --- a/chrome/browser/history/history_backend_unittest.cc +++ b/chrome/browser/history/history_backend_unittest.cc @@ -388,7 +388,7 @@ class HistoryBackendTest : public HistoryBackendTestBase { void GenerateFaviconBitmapData( const GURL& icon_url1, const std::vector<gfx::Size>& icon_url1_sizes, - std::vector<favicon_base::FaviconBitmapData>* favicon_bitmap_data) { + std::vector<favicon_base::FaviconRawBitmapData>* favicon_bitmap_data) { GenerateFaviconBitmapData(icon_url1, icon_url1_sizes, GURL(), std::vector<gfx::Size>(), favicon_bitmap_data); } @@ -398,14 +398,14 @@ class HistoryBackendTest : public HistoryBackendTestBase { const std::vector<gfx::Size>& icon_url1_sizes, const GURL& icon_url2, const std::vector<gfx::Size>& icon_url2_sizes, - std::vector<favicon_base::FaviconBitmapData>* favicon_bitmap_data) { + std::vector<favicon_base::FaviconRawBitmapData>* favicon_bitmap_data) { favicon_bitmap_data->clear(); char bitmap_char = 'a'; for (size_t i = 0; i < icon_url1_sizes.size(); ++i) { std::vector<unsigned char> data; data.push_back(bitmap_char); - favicon_base::FaviconBitmapData bitmap_data_element; + favicon_base::FaviconRawBitmapData bitmap_data_element; bitmap_data_element.bitmap_data = base::RefCountedBytes::TakeVector(&data); bitmap_data_element.pixel_size = icon_url1_sizes[i]; @@ -418,7 +418,7 @@ class HistoryBackendTest : public HistoryBackendTestBase { for (size_t i = 0; i < icon_url2_sizes.size(); ++i) { std::vector<unsigned char> data; data.push_back(bitmap_char); - favicon_base::FaviconBitmapData bitmap_data_element; + favicon_base::FaviconRawBitmapData bitmap_data_element; bitmap_data_element.bitmap_data = base::RefCountedBytes::TakeVector(&data); bitmap_data_element.pixel_size = icon_url2_sizes[i]; @@ -1537,12 +1537,12 @@ TEST_F(HistoryBackendTest, SetFaviconMappingsForPageAndRedirects) { const GURL icon_url2("http://www.google.com/icon2"); // Generate bitmap data for a page with two favicons. - std::vector<favicon_base::FaviconBitmapData> two_favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> two_favicon_bitmap_data; GenerateFaviconBitmapData(icon_url1, GetSizesSmallAndLarge(), icon_url2, GetSizesSmallAndLarge(), &two_favicon_bitmap_data); // Generate bitmap data for a page with a single favicon. - std::vector<favicon_base::FaviconBitmapData> one_favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> one_favicon_bitmap_data; GenerateFaviconBitmapData(icon_url1, GetSizesSmallAndLarge(), &one_favicon_bitmap_data); @@ -1599,7 +1599,7 @@ TEST_F(HistoryBackendTest, SetFaviconMappingsForPageDuplicates) { const GURL url("http://www.google.com/"); const GURL icon_url("http://www.google.com/icon"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; GenerateFaviconBitmapData(icon_url, GetSizesSmallAndLarge(), &favicon_bitmap_data); @@ -1630,7 +1630,7 @@ TEST_F(HistoryBackendTest, SetFaviconsDeleteBitmaps) { const GURL page_url("http://www.google.com/"); const GURL icon_url("http://www.google.com/icon"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; GenerateFaviconBitmapData(icon_url, GetSizesSmallAndLarge(), &favicon_bitmap_data); backend_->SetFavicons(page_url, favicon_base::FAVICON, favicon_bitmap_data); @@ -1698,12 +1698,12 @@ TEST_F(HistoryBackendTest, SetFaviconsReplaceBitmapData) { std::vector<unsigned char> data_initial; data_initial.push_back('a'); - favicon_base::FaviconBitmapData bitmap_data_element; + favicon_base::FaviconRawBitmapData bitmap_data_element; bitmap_data_element.bitmap_data = base::RefCountedBytes::TakeVector(&data_initial); bitmap_data_element.pixel_size = kSmallSize; bitmap_data_element.icon_url = icon_url; - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; favicon_bitmap_data.push_back(bitmap_data_element); // Add bitmap to the database. @@ -1770,7 +1770,7 @@ TEST_F(HistoryBackendTest, SetFaviconsSameFaviconURLForTwoPages) { GURL page_url1("http://www.google.com"); GURL page_url2("http://www.google.ca"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; GenerateFaviconBitmapData(icon_url, GetSizesSmallAndLarge(), &favicon_bitmap_data); @@ -1779,7 +1779,7 @@ TEST_F(HistoryBackendTest, SetFaviconsSameFaviconURLForTwoPages) { std::vector<GURL> icon_urls; icon_urls.push_back(icon_url); - std::vector<favicon_base::FaviconBitmapResult> bitmap_results; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results; backend_->UpdateFaviconMappingsAndFetch(page_url2, icon_urls, favicon_base::FAVICON, @@ -1843,7 +1843,7 @@ TEST_F(HistoryBackendTest, SetFaviconsSameFaviconURLForTwoPages) { TEST_F(HistoryBackendTest, UpdateFaviconMappingsAndFetchNoChange) { GURL page_url("http://www.google.com"); GURL icon_url("http://www.google.com/favicon.ico"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; GenerateFaviconBitmapData(icon_url, GetSizesSmall(), &favicon_bitmap_data); backend_->SetFavicons(page_url, favicon_base::FAVICON, favicon_bitmap_data); @@ -1857,7 +1857,7 @@ TEST_F(HistoryBackendTest, UpdateFaviconMappingsAndFetchNoChange) { std::vector<GURL> icon_urls; icon_urls.push_back(icon_url); - std::vector<favicon_base::FaviconBitmapResult> bitmap_results; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results; backend_->UpdateFaviconMappingsAndFetch(page_url, icon_urls, favicon_base::FAVICON, @@ -1927,7 +1927,7 @@ TEST_F(HistoryBackendTest, MergeFaviconPageURLInDB) { GURL icon_url1("http:/www.google.com/favicon.ico"); GURL icon_url2("http://www.google.com/favicon2.ico"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; GenerateFaviconBitmapData(icon_url1, GetSizesSmall(), &favicon_bitmap_data); @@ -2054,7 +2054,7 @@ TEST_F(HistoryBackendTest, MergeFaviconIconURLMappedToDifferentPageURL) { GURL page_url3("http://maps.google.com"); GURL icon_url("http:/www.google.com/favicon.ico"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; GenerateFaviconBitmapData(icon_url, GetSizesSmall(), &favicon_bitmap_data); @@ -2175,7 +2175,7 @@ TEST_F(HistoryBackendTest, MergeFaviconShowsUpInGetFaviconsForURLResult) { GURL icon_url("http://www.google.com/favicon.ico"); GURL merged_icon_url("http://wwww.google.com/favicon2.ico"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; GenerateFaviconBitmapData(icon_url, GetSizesSmallAndLarge(), &favicon_bitmap_data); @@ -2195,7 +2195,7 @@ TEST_F(HistoryBackendTest, MergeFaviconShowsUpInGetFaviconsForURLResult) { // Request favicon bitmaps for both 1x and 2x to simulate request done by // BookmarkModel::GetFavicon(). - std::vector<favicon_base::FaviconBitmapResult> bitmap_results; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results; backend_->GetFaviconsForURL(page_url, favicon_base::FAVICON, kSmallSize.width(), @@ -2203,8 +2203,8 @@ TEST_F(HistoryBackendTest, MergeFaviconShowsUpInGetFaviconsForURLResult) { &bitmap_results); EXPECT_EQ(2u, bitmap_results.size()); - const favicon_base::FaviconBitmapResult& first_result = bitmap_results[0]; - const favicon_base::FaviconBitmapResult& result = + const favicon_base::FaviconRawBitmapResult& first_result = bitmap_results[0]; + const favicon_base::FaviconRawBitmapResult& result = (first_result.pixel_size == kSmallSize) ? first_result : bitmap_results[1]; EXPECT_TRUE(BitmapDataEqual('c', result.bitmap_data)); @@ -2216,14 +2216,14 @@ TEST_F(HistoryBackendTest, TestGetFaviconsForURLWithIconTypesPriority) { GURL icon_url("http://www.google.com/favicon.ico"); GURL touch_icon_url("http://wwww.google.com/touch_icon.ico"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; std::vector<gfx::Size> favicon_size; favicon_size.push_back(gfx::Size(16, 16)); favicon_size.push_back(gfx::Size(32, 32)); GenerateFaviconBitmapData(icon_url, favicon_size, &favicon_bitmap_data); ASSERT_EQ(2u, favicon_bitmap_data.size()); - std::vector<favicon_base::FaviconBitmapData> touch_icon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> touch_icon_bitmap_data; std::vector<gfx::Size> touch_icon_size; touch_icon_size.push_back(gfx::Size(64, 64)); GenerateFaviconBitmapData(icon_url, touch_icon_size, &touch_icon_bitmap_data); @@ -2234,7 +2234,7 @@ TEST_F(HistoryBackendTest, TestGetFaviconsForURLWithIconTypesPriority) { backend_->SetFavicons( page_url, favicon_base::TOUCH_ICON, touch_icon_bitmap_data); - favicon_base::FaviconBitmapResult result; + favicon_base::FaviconRawBitmapResult result; std::vector<int> icon_types; icon_types.push_back(favicon_base::FAVICON); icon_types.push_back(favicon_base::TOUCH_ICON); @@ -2258,14 +2258,14 @@ TEST_F(HistoryBackendTest, TestGetFaviconsForURLReturnFavicon) { GURL icon_url("http://www.google.com/favicon.ico"); GURL touch_icon_url("http://wwww.google.com/touch_icon.ico"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; std::vector<gfx::Size> favicon_size; favicon_size.push_back(gfx::Size(16, 16)); favicon_size.push_back(gfx::Size(32, 32)); GenerateFaviconBitmapData(icon_url, favicon_size, &favicon_bitmap_data); ASSERT_EQ(2u, favicon_bitmap_data.size()); - std::vector<favicon_base::FaviconBitmapData> touch_icon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> touch_icon_bitmap_data; std::vector<gfx::Size> touch_icon_size; touch_icon_size.push_back(gfx::Size(32, 32)); GenerateFaviconBitmapData(icon_url, touch_icon_size, &touch_icon_bitmap_data); @@ -2276,7 +2276,7 @@ TEST_F(HistoryBackendTest, TestGetFaviconsForURLReturnFavicon) { backend_->SetFavicons( page_url, favicon_base::TOUCH_ICON, touch_icon_bitmap_data); - favicon_base::FaviconBitmapResult result; + favicon_base::FaviconRawBitmapResult result; std::vector<int> icon_types; icon_types.push_back(favicon_base::FAVICON); icon_types.push_back(favicon_base::TOUCH_ICON); @@ -2288,7 +2288,7 @@ TEST_F(HistoryBackendTest, TestGetFaviconsForURLReturnFavicon) { EXPECT_EQ(favicon_base::FAVICON, result.icon_type); // Change minimal size to 32x32 and verify the 32x32 favicon returned. - favicon_base::FaviconBitmapResult result1; + favicon_base::FaviconRawBitmapResult result1; backend_->GetLargestFaviconForURL(page_url, icon_types, 32, &result1); EXPECT_EQ(gfx::Size(32, 32), result1.pixel_size); EXPECT_EQ(favicon_base::FAVICON, result1.icon_type); @@ -2300,7 +2300,7 @@ TEST_F(HistoryBackendTest, TestGetFaviconsForURLReturnFaviconEvenItSmaller) { GURL page_url("http://www.google.com"); GURL icon_url("http://www.google.com/favicon.ico"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; std::vector<gfx::Size> favicon_size; favicon_size.push_back(gfx::Size(16, 16)); GenerateFaviconBitmapData(icon_url, favicon_size, &favicon_bitmap_data); @@ -2309,7 +2309,7 @@ TEST_F(HistoryBackendTest, TestGetFaviconsForURLReturnFaviconEvenItSmaller) { // Set preexisting favicons for |page_url|. backend_->SetFavicons(page_url, favicon_base::FAVICON, favicon_bitmap_data); - favicon_base::FaviconBitmapResult result; + favicon_base::FaviconRawBitmapResult result; std::vector<int> icon_types; icon_types.push_back(favicon_base::FAVICON); icon_types.push_back(favicon_base::TOUCH_ICON); @@ -2331,7 +2331,7 @@ TEST_F(HistoryBackendTest, UpdateFaviconMappingsAndFetchMultipleIconTypes) { GURL icon_urlc("http://www.google.com/favicon3.ico"); // |page_url1| is mapped to |icon_urla| which if of type TOUCH_ICON. - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; GenerateFaviconBitmapData(icon_urla, GetSizesSmall(), &favicon_bitmap_data); backend_->SetFavicons( page_url1, favicon_base::TOUCH_ICON, favicon_bitmap_data); @@ -2348,7 +2348,7 @@ TEST_F(HistoryBackendTest, UpdateFaviconMappingsAndFetchMultipleIconTypes) { icon_urls.push_back(icon_urlb); icon_urls.push_back(icon_urlc); - std::vector<favicon_base::FaviconBitmapResult> bitmap_results; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results; backend_->UpdateFaviconMappingsAndFetch( page_url3, icon_urls, @@ -2389,7 +2389,7 @@ TEST_F(HistoryBackendTest, UpdateFaviconMappingsAndFetchMultipleIconTypes) { TEST_F(HistoryBackendTest, GetFaviconsFromDBEmpty) { const GURL page_url("http://www.google.com/"); - std::vector<favicon_base::FaviconBitmapResult> bitmap_results; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results; EXPECT_FALSE(backend_->GetFaviconsFromDB(page_url, favicon_base::FAVICON, kSmallSize.width(), @@ -2409,7 +2409,7 @@ TEST_F(HistoryBackendTest, GetFaviconsFromDBNoFaviconBitmaps) { EXPECT_NE(0, icon_id); EXPECT_NE(0, backend_->thumbnail_db_->AddIconMapping(page_url, icon_id)); - std::vector<favicon_base::FaviconBitmapResult> bitmap_results_out; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results_out; EXPECT_FALSE(backend_->GetFaviconsFromDB(page_url, favicon_base::FAVICON, kSmallSize.width(), @@ -2424,13 +2424,13 @@ TEST_F(HistoryBackendTest, GetFaviconsFromDBSelectClosestMatch) { const GURL page_url("http://www.google.com/"); const GURL icon_url("http://www.google.com/icon1"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; GenerateFaviconBitmapData(icon_url, GetSizesTinySmallAndLarge(), &favicon_bitmap_data); backend_->SetFavicons(page_url, favicon_base::FAVICON, favicon_bitmap_data); - std::vector<favicon_base::FaviconBitmapResult> bitmap_results_out; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results_out; EXPECT_TRUE(backend_->GetFaviconsFromDB(page_url, favicon_base::FAVICON, kSmallSize.width(), @@ -2442,7 +2442,7 @@ TEST_F(HistoryBackendTest, GetFaviconsFromDBSelectClosestMatch) { EXPECT_EQ(2u, bitmap_results_out.size()); // No required order for results. if (bitmap_results_out[0].pixel_size == kLargeSize) { - favicon_base::FaviconBitmapResult tmp_result = bitmap_results_out[0]; + favicon_base::FaviconRawBitmapResult tmp_result = bitmap_results_out[0]; bitmap_results_out[0] = bitmap_results_out[1]; bitmap_results_out[1] = tmp_result; } @@ -2468,13 +2468,13 @@ TEST_F(HistoryBackendTest, GetFaviconsFromDBSingleIconURL) { const GURL icon_url1("http://www.google.com/icon1"); const GURL icon_url2("http://www.google.com/icon2"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; GenerateFaviconBitmapData(icon_url1, GetSizesSmall(), icon_url2, GetSizesLarge(), &favicon_bitmap_data); backend_->SetFavicons(page_url, favicon_base::FAVICON, favicon_bitmap_data); - std::vector<favicon_base::FaviconBitmapResult> bitmap_results_out; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results_out; EXPECT_TRUE(backend_->GetFaviconsFromDB(page_url, favicon_base::FAVICON, kSmallSize.width(), @@ -2495,7 +2495,7 @@ TEST_F(HistoryBackendTest, GetFaviconsFromDBIconType) { const GURL icon_url1("http://www.google.com/icon1.png"); const GURL icon_url2("http://www.google.com/icon2.png"); - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; GenerateFaviconBitmapData(icon_url1, GetSizesSmall(), &favicon_bitmap_data); backend_->SetFavicons(page_url, favicon_base::FAVICON, favicon_bitmap_data); @@ -2503,7 +2503,7 @@ TEST_F(HistoryBackendTest, GetFaviconsFromDBIconType) { backend_->SetFavicons( page_url, favicon_base::TOUCH_ICON, favicon_bitmap_data); - std::vector<favicon_base::FaviconBitmapResult> bitmap_results_out; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results_out; EXPECT_TRUE(backend_->GetFaviconsFromDB(page_url, favicon_base::FAVICON, kSmallSize.width(), @@ -2542,7 +2542,7 @@ TEST_F(HistoryBackendTest, GetFaviconsFromDBExpired) { EXPECT_NE(0, icon_id); EXPECT_NE(0, backend_->thumbnail_db_->AddIconMapping(page_url, icon_id)); - std::vector<favicon_base::FaviconBitmapResult> bitmap_results_out; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results_out; EXPECT_TRUE(backend_->GetFaviconsFromDB(page_url, favicon_base::FAVICON, kSmallSize.width(), @@ -2559,7 +2559,7 @@ TEST_F(HistoryBackendTest, UpdateFaviconMappingsAndFetchNoDB) { // Make the thumbnail database invalid. backend_->thumbnail_db_.reset(); - std::vector<favicon_base::FaviconBitmapResult> bitmap_results; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results; backend_->UpdateFaviconMappingsAndFetch(GURL(), std::vector<GURL>(), @@ -2578,14 +2578,14 @@ TEST_F(HistoryBackendTest, CloneFaviconIsRestrictedToSameDomain) { const GURL icon_url("http://www.google.com/icon.png"); // Add a favicon - std::vector<favicon_base::FaviconBitmapData> favicon_bitmap_data; + std::vector<favicon_base::FaviconRawBitmapData> favicon_bitmap_data; GenerateFaviconBitmapData(icon_url, GetSizesSmall(), &favicon_bitmap_data); backend_->SetFavicons(url, favicon_base::FAVICON, favicon_bitmap_data); EXPECT_TRUE(backend_->thumbnail_db_->GetIconMappingsForPageURL( url, favicon_base::FAVICON, NULL)); // Validate starting state. - std::vector<favicon_base::FaviconBitmapResult> bitmap_results_out; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results_out; EXPECT_TRUE(backend_->GetFaviconsFromDB(url, favicon_base::FAVICON, kSmallSize.width(), diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc index 1a3ac9e..9ca4e1e 100644 --- a/chrome/browser/history/history_service.cc +++ b/chrome/browser/history/history_service.cc @@ -71,12 +71,13 @@ static const char* kHistoryThreadName = "Chrome_HistoryThread"; void RunWithFaviconResults( const favicon_base::FaviconResultsCallback& callback, - std::vector<favicon_base::FaviconBitmapResult>* bitmap_results) { + std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results) { callback.Run(*bitmap_results); } -void RunWithFaviconResult(const favicon_base::FaviconRawCallback& callback, - favicon_base::FaviconBitmapResult* bitmap_result) { +void RunWithFaviconResult( + const favicon_base::FaviconRawBitmapCallback& callback, + favicon_base::FaviconRawBitmapResult* bitmap_result) { callback.Run(*bitmap_result); } @@ -547,8 +548,8 @@ base::CancelableTaskTracker::TaskId HistoryService::GetFavicons( base::CancelableTaskTracker* tracker) { DCHECK(thread_checker_.CalledOnValidThread()); - std::vector<favicon_base::FaviconBitmapResult>* results = - new std::vector<favicon_base::FaviconBitmapResult>(); + std::vector<favicon_base::FaviconRawBitmapResult>* results = + new std::vector<favicon_base::FaviconRawBitmapResult>(); return tracker->PostTaskAndReply( thread_->message_loop_proxy().get(), FROM_HERE, @@ -571,8 +572,8 @@ base::CancelableTaskTracker::TaskId HistoryService::GetFaviconsForURL( base::CancelableTaskTracker* tracker) { DCHECK(thread_checker_.CalledOnValidThread()); - std::vector<favicon_base::FaviconBitmapResult>* results = - new std::vector<favicon_base::FaviconBitmapResult>(); + std::vector<favicon_base::FaviconRawBitmapResult>* results = + new std::vector<favicon_base::FaviconRawBitmapResult>(); return tracker->PostTaskAndReply( thread_->message_loop_proxy().get(), FROM_HERE, @@ -590,12 +591,12 @@ base::CancelableTaskTracker::TaskId HistoryService::GetLargestFaviconForURL( const GURL& page_url, const std::vector<int>& icon_types, int minimum_size_in_pixels, - const favicon_base::FaviconRawCallback& callback, + const favicon_base::FaviconRawBitmapCallback& callback, base::CancelableTaskTracker* tracker) { DCHECK(thread_checker_.CalledOnValidThread()); - favicon_base::FaviconBitmapResult* result = - new favicon_base::FaviconBitmapResult(); + favicon_base::FaviconRawBitmapResult* result = + new favicon_base::FaviconRawBitmapResult(); return tracker->PostTaskAndReply( thread_->message_loop_proxy().get(), FROM_HERE, @@ -616,8 +617,8 @@ base::CancelableTaskTracker::TaskId HistoryService::GetFaviconForID( base::CancelableTaskTracker* tracker) { DCHECK(thread_checker_.CalledOnValidThread()); - std::vector<favicon_base::FaviconBitmapResult>* results = - new std::vector<favicon_base::FaviconBitmapResult>(); + std::vector<favicon_base::FaviconRawBitmapResult>* results = + new std::vector<favicon_base::FaviconRawBitmapResult>(); return tracker->PostTaskAndReply( thread_->message_loop_proxy().get(), FROM_HERE, @@ -641,8 +642,8 @@ HistoryService::UpdateFaviconMappingsAndFetch( base::CancelableTaskTracker* tracker) { DCHECK(thread_checker_.CalledOnValidThread()); - std::vector<favicon_base::FaviconBitmapResult>* results = - new std::vector<favicon_base::FaviconBitmapResult>(); + std::vector<favicon_base::FaviconRawBitmapResult>* results = + new std::vector<favicon_base::FaviconRawBitmapResult>(); return tracker->PostTaskAndReply( thread_->message_loop_proxy().get(), FROM_HERE, @@ -674,7 +675,8 @@ void HistoryService::MergeFavicon( void HistoryService::SetFavicons( const GURL& page_url, favicon_base::IconType icon_type, - const std::vector<favicon_base::FaviconBitmapData>& favicon_bitmap_data) { + const std::vector<favicon_base::FaviconRawBitmapData>& + favicon_bitmap_data) { DCHECK(thread_checker_.CalledOnValidThread()); if (!CanAddURL(page_url)) return; diff --git a/chrome/browser/history/history_service.h b/chrome/browser/history/history_service.h index c5fd133..cd90c17 100644 --- a/chrome/browser/history/history_service.h +++ b/chrome/browser/history/history_service.h @@ -694,7 +694,7 @@ class HistoryService : public CancelableRequestProvider, const GURL& page_url, const std::vector<int>& icon_types, int minimum_size_in_pixels, - const favicon_base::FaviconRawCallback& callback, + const favicon_base::FaviconRawBitmapCallback& callback, base::CancelableTaskTracker* tracker); // Used by the FaviconService to get the favicon bitmap which most closely @@ -773,10 +773,10 @@ class HistoryService : public CancelableRequestProvider, // deleting the 2x favicon bitmap if it is present in the history backend. // See HistoryBackend::ValidateSetFaviconsParams() for more details on the // criteria for |favicon_bitmap_data| to be valid. - void SetFavicons( - const GURL& page_url, - favicon_base::IconType icon_type, - const std::vector<favicon_base::FaviconBitmapData>& favicon_bitmap_data); + void SetFavicons(const GURL& page_url, + favicon_base::IconType icon_type, + const std::vector<favicon_base::FaviconRawBitmapData>& + favicon_bitmap_data); // Used by the FaviconService to mark the favicon for the page as being out // of date. diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc index 79ed5f9d..99b5ecc 100644 --- a/chrome/browser/jumplist_win.cc +++ b/chrome/browser/jumplist_win.cc @@ -396,8 +396,8 @@ void JumpList::StartLoadingFavicon() { } FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); - task_id_ = favicon_service->GetFaviconImageForURL( - FaviconService::FaviconForURLParams( + task_id_ = favicon_service->GetFaviconImageForPageURL( + FaviconService::FaviconForPageURLParams( url, favicon_base::FAVICON, gfx::kFaviconSize), base::Bind(&JumpList::OnFaviconDataAvailable, base::Unretained(this)), &cancelable_task_tracker_); diff --git a/chrome/browser/notifications/message_center_settings_controller.cc b/chrome/browser/notifications/message_center_settings_controller.cc index 5fd5cdf..3259183 100644 --- a/chrome/browser/notifications/message_center_settings_controller.cc +++ b/chrome/browser/notifications/message_center_settings_controller.cc @@ -288,17 +288,18 @@ void MessageCenterSettingsController::GetNotifierList( name, notification_service->IsNotifierEnabled(notifier_id))); patterns_[name] = iter->primary_pattern; - FaviconService::FaviconForURLParams favicon_params( + FaviconService::FaviconForPageURLParams favicon_params( url, favicon_base::FAVICON | favicon_base::TOUCH_ICON, message_center::kSettingsIconSize); // Note that favicon service obtains the favicon from history. This means // that it will fail to obtain the image if there are no history data for // that URL. - favicon_service->GetFaviconImageForURL( + favicon_service->GetFaviconImageForPageURL( favicon_params, base::Bind(&MessageCenterSettingsController::OnFaviconLoaded, - base::Unretained(this), url), + base::Unretained(this), + url), favicon_tracker_.get()); } diff --git a/chrome/browser/sync/glue/favicon_cache.cc b/chrome/browser/sync/glue/favicon_cache.cc index e75d6a4..82b9a85 100644 --- a/chrome/browser/sync/glue/favicon_cache.cc +++ b/chrome/browser/sync/glue/favicon_cache.cc @@ -36,7 +36,7 @@ struct SyncedFaviconInfo { // The actual favicon data. // TODO(zea): don't keep around the actual data for locally sourced // favicons (UI can access those directly). - favicon_base::FaviconBitmapResult bitmap_data[NUM_SIZES]; + favicon_base::FaviconRawBitmapResult bitmap_data[NUM_SIZES]; // The URL this favicon was loaded from. const GURL favicon_url; // Is the favicon for a bookmarked page? @@ -119,22 +119,22 @@ GURL GetFaviconURLFromSpecifics(const sync_pb::EntitySpecifics& specifics) { return GURL(specifics.favicon_image().favicon_url()); } -// Convert protobuf image data into a FaviconBitmapResult. -favicon_base::FaviconBitmapResult GetImageDataFromSpecifics( +// Convert protobuf image data into a FaviconRawBitmapResult. +favicon_base::FaviconRawBitmapResult GetImageDataFromSpecifics( const sync_pb::FaviconData& favicon_data) { base::RefCountedString* temp_string = new base::RefCountedString(); temp_string->data() = favicon_data.favicon(); - favicon_base::FaviconBitmapResult bitmap_result; + favicon_base::FaviconRawBitmapResult bitmap_result; bitmap_result.bitmap_data = temp_string; bitmap_result.pixel_size.set_height(favicon_data.height()); bitmap_result.pixel_size.set_width(favicon_data.width()); return bitmap_result; } -// Convert a FaviconBitmapResult into protobuf image data. +// Convert a FaviconRawBitmapResult into protobuf image data. void FillSpecificsWithImageData( - const favicon_base::FaviconBitmapResult& bitmap_result, + const favicon_base::FaviconRawBitmapResult& bitmap_result, sync_pb::FaviconData* favicon_data) { if (!bitmap_result.bitmap_data.get()) return; @@ -170,7 +170,7 @@ void BuildTrackingSpecifics( // Updates |favicon_info| with the image data in |bitmap_result|. bool UpdateFaviconFromBitmapResult( - const favicon_base::FaviconBitmapResult& bitmap_result, + const favicon_base::FaviconRawBitmapResult& bitmap_result, SyncedFaviconInfo* favicon_info) { DCHECK_EQ(favicon_info->favicon_url, bitmap_result.icon_url); if (!bitmap_result.is_valid()) { @@ -441,13 +441,14 @@ void FaviconCache::OnPageFaviconUpdated(const GURL& page_url) { // TODO(zea): This appears to only fetch one favicon (best match based on // desired_size_in_dip). Figure out a way to fetch all favicons we support. // See crbug.com/181068. - base::CancelableTaskTracker::TaskId id = favicon_service->GetFaviconForURL( - FaviconService::FaviconForURLParams( - page_url, SupportedFaviconTypes(), kMaxFaviconResolution), - base::Bind(&FaviconCache::OnFaviconDataAvailable, - weak_ptr_factory_.GetWeakPtr(), - page_url), - &cancelable_task_tracker_); + base::CancelableTaskTracker::TaskId id = + favicon_service->GetFaviconForPageURL( + FaviconService::FaviconForPageURLParams( + page_url, SupportedFaviconTypes(), kMaxFaviconResolution), + base::Bind(&FaviconCache::OnFaviconDataAvailable, + weak_ptr_factory_.GetWeakPtr(), + page_url), + &cancelable_task_tracker_); page_task_map_[page_url] = id; } @@ -617,7 +618,7 @@ bool FaviconCache::FaviconRecencyFunctor::operator()( void FaviconCache::OnFaviconDataAvailable( const GURL& page_url, - const std::vector<favicon_base::FaviconBitmapResult>& bitmap_results) { + const std::vector<favicon_base::FaviconRawBitmapResult>& bitmap_results) { PageTaskMap::iterator page_iter = page_task_map_.find(page_url); if (page_iter == page_task_map_.end()) return; @@ -633,7 +634,8 @@ void FaviconCache::OnFaviconDataAvailable( base::Time now = base::Time::Now(); std::map<GURL, LocalFaviconUpdateInfo> favicon_updates; for (size_t i = 0; i < bitmap_results.size(); ++i) { - const favicon_base::FaviconBitmapResult& bitmap_result = bitmap_results[i]; + const favicon_base::FaviconRawBitmapResult& bitmap_result = + bitmap_results[i]; GURL favicon_url = bitmap_result.icon_url; if (!favicon_url.is_valid() || favicon_url.SchemeIs("data")) continue; // Can happen if the page is still loading. @@ -1039,7 +1041,7 @@ void FaviconCache::DropPartialFavicon(FaviconMap::iterator favicon_iter, << favicon_iter->second.get()->favicon_url; for (int i = 0; i < NUM_SIZES; ++i) { favicon_iter->second->bitmap_data[i] = - favicon_base::FaviconBitmapResult(); + favicon_base::FaviconRawBitmapResult(); } DCHECK(!FaviconInfoHasImages(*favicon_iter->second)); } else { diff --git a/chrome/browser/sync/glue/favicon_cache.h b/chrome/browser/sync/glue/favicon_cache.h index cfab7ef..8b5c2f5 100644 --- a/chrome/browser/sync/glue/favicon_cache.h +++ b/chrome/browser/sync/glue/favicon_cache.h @@ -28,7 +28,7 @@ class Profile; namespace chrome { -struct FaviconBitmapResult; +struct FaviconRawBitmapResult; } namespace browser_sync { @@ -131,7 +131,7 @@ class FaviconCache : public syncer::SyncableService, // available. Does nothing if no favicon data was available. void OnFaviconDataAvailable( const GURL& page_url, - const std::vector<favicon_base::FaviconBitmapResult>& bitmap_result); + const std::vector<favicon_base::FaviconRawBitmapResult>& bitmap_result); // Helper method to update the sync state of the favicon at |icon_url|. If // either |image_change_type| or |tracking_change_type| is ACTION_INVALID, diff --git a/chrome/browser/sync/glue/favicon_cache_unittest.cc b/chrome/browser/sync/glue/favicon_cache_unittest.cc index b0af7e30..d96efb1 100644 --- a/chrome/browser/sync/glue/favicon_cache_unittest.cc +++ b/chrome/browser/sync/glue/favicon_cache_unittest.cc @@ -411,9 +411,9 @@ scoped_ptr<syncer::SyncErrorFactory> SyncFaviconCacheTest:: void SyncFaviconCacheTest::OnCustomFaviconDataAvailable( const TestFaviconData& test_data) { - std::vector<favicon_base::FaviconBitmapResult> bitmap_results; + std::vector<favicon_base::FaviconRawBitmapResult> bitmap_results; if (!test_data.image_16.empty()) { - favicon_base::FaviconBitmapResult bitmap_result; + favicon_base::FaviconRawBitmapResult bitmap_result; bitmap_result.icon_url = test_data.icon_url; bitmap_result.pixel_size.set_width(16); bitmap_result.pixel_size.set_height(16); @@ -423,7 +423,7 @@ void SyncFaviconCacheTest::OnCustomFaviconDataAvailable( bitmap_results.push_back(bitmap_result); } if (!test_data.image_32.empty()) { - favicon_base::FaviconBitmapResult bitmap_result; + favicon_base::FaviconRawBitmapResult bitmap_result; bitmap_result.icon_url = test_data.icon_url; bitmap_result.pixel_size.set_width(32); bitmap_result.pixel_size.set_height(32); @@ -433,7 +433,7 @@ void SyncFaviconCacheTest::OnCustomFaviconDataAvailable( bitmap_results.push_back(bitmap_result); } if (!test_data.image_64.empty()) { - favicon_base::FaviconBitmapResult bitmap_result; + favicon_base::FaviconRawBitmapResult bitmap_result; bitmap_result.icon_url = test_data.icon_url; bitmap_result.pixel_size.set_width(64); bitmap_result.pixel_size.set_height(64); diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc index dee13e1..a8d3ea0 100644 --- a/chrome/browser/sync/test/integration/bookmarks_helper.cc +++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc @@ -151,7 +151,8 @@ int CountNodesWithTitlesMatching(BookmarkModel* model, // Checks if the favicon data in |bitmap_a| and |bitmap_b| are equivalent. // Returns true if they match. -bool FaviconBitmapsMatch(const SkBitmap& bitmap_a, const SkBitmap& bitmap_b) { +bool FaviconRawBitmapsMatch(const SkBitmap& bitmap_a, + const SkBitmap& bitmap_b) { if (bitmap_a.getSize() == 0U && bitmap_b.getSize() == 0U) return true; if ((bitmap_a.getSize() != bitmap_b.getSize()) || @@ -301,7 +302,7 @@ bool FaviconsMatch(BookmarkModel* model_a, 1.0f).sk_bitmap(); SkBitmap bitmap_b = image_b.AsImageSkia().GetRepresentation( 1.0f).sk_bitmap(); - return FaviconBitmapsMatch(bitmap_a, bitmap_b); + return FaviconRawBitmapsMatch(bitmap_a, bitmap_b); } // Does a deep comparison of BookmarkNode fields in |model_a| and |model_b|. diff --git a/chrome/browser/ui/android/navigation_popup.cc b/chrome/browser/ui/android/navigation_popup.cc index 7eec8a2..0be8537 100644 --- a/chrome/browser/ui/android/navigation_popup.cc +++ b/chrome/browser/ui/android/navigation_popup.cc @@ -48,8 +48,8 @@ void NavigationPopup::FetchFaviconForUrl(JNIEnv* env, GURL url(base::android::ConvertJavaStringToUTF16(env, jurl)); // TODO(tedchoc): Request higher favicons based on screen density instead of // hardcoding kFaviconSize. - favicon_service->GetFaviconImageForURL( - FaviconService::FaviconForURLParams( + favicon_service->GetFaviconImageForPageURL( + FaviconService::FaviconForPageURLParams( url, favicon_base::FAVICON, gfx::kFaviconSize), base::Bind(&NavigationPopup::OnFaviconDataAvailable, base::Unretained(this), diff --git a/chrome/browser/ui/ash/launcher/launcher_favicon_loader.cc b/chrome/browser/ui/ash/launcher/launcher_favicon_loader.cc index e6c84bb..a1ffd1c 100644 --- a/chrome/browser/ui/ash/launcher/launcher_favicon_loader.cc +++ b/chrome/browser/ui/ash/launcher/launcher_favicon_loader.cc @@ -18,22 +18,22 @@ namespace internal { const int kMaxBitmapSize = 256; //////////////////////////////////////////////////////////////////////////////// -// FaviconBitmapHandler fetchs all bitmaps with the 'icon' (or 'shortcut icon') +// FaviconRawBitmapHandler fetchs all bitmaps with the 'icon' (or 'shortcut +// icon') // link tag, storing the one that best matches ash::kShelfSize. // These icon bitmaps are not resized and are not cached beyond the lifetime // of the class. Bitmaps larger than kMaxBitmapSize are ignored. -class FaviconBitmapHandler : public content::WebContentsObserver { +class FaviconRawBitmapHandler : public content::WebContentsObserver { public: - FaviconBitmapHandler(content::WebContents* web_contents, - LauncherFaviconLoader::Delegate* delegate) + FaviconRawBitmapHandler(content::WebContents* web_contents, + LauncherFaviconLoader::Delegate* delegate) : content::WebContentsObserver(web_contents), delegate_(delegate), web_contents_(web_contents), - weak_ptr_factory_(this) { - } + weak_ptr_factory_(this) {} - virtual ~FaviconBitmapHandler() {} + virtual ~FaviconRawBitmapHandler() {} const SkBitmap& bitmap() const { return bitmap_; } @@ -66,12 +66,12 @@ class FaviconBitmapHandler : public content::WebContentsObserver { SkBitmap bitmap_; GURL bitmap_url_; - base::WeakPtrFactory<FaviconBitmapHandler> weak_ptr_factory_; + base::WeakPtrFactory<FaviconRawBitmapHandler> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(FaviconBitmapHandler); + DISALLOW_COPY_AND_ASSIGN(FaviconRawBitmapHandler); }; -void FaviconBitmapHandler::DidUpdateFaviconURL( +void FaviconRawBitmapHandler::DidUpdateFaviconURL( const std::vector<content::FaviconURL>& candidates) { // This function receives a complete list of faviocn urls for the page. // It may get called multiple times with the same list, and will also get @@ -112,16 +112,16 @@ void FaviconBitmapHandler::DidUpdateFaviconURL( *iter, true, // is a favicon 0, // no maximum size - base::Bind(&FaviconBitmapHandler::DidDownloadFavicon, + base::Bind(&FaviconRawBitmapHandler::DidDownloadFavicon, weak_ptr_factory_.GetWeakPtr())); } } -bool FaviconBitmapHandler::HasPendingDownloads() const { +bool FaviconRawBitmapHandler::HasPendingDownloads() const { return !pending_requests_.empty(); } -void FaviconBitmapHandler::DidDownloadFavicon( +void FaviconRawBitmapHandler::DidDownloadFavicon( int id, int http_status_code, const GURL& image_url, @@ -139,8 +139,8 @@ void FaviconBitmapHandler::DidDownloadFavicon( AddFavicon(image_url, bitmaps[0]); } -void FaviconBitmapHandler::AddFavicon(const GURL& image_url, - const SkBitmap& new_bitmap) { +void FaviconRawBitmapHandler::AddFavicon(const GURL& image_url, + const SkBitmap& new_bitmap) { processed_requests_.insert(image_url); if (new_bitmap.height() > kMaxBitmapSize || new_bitmap.width() > kMaxBitmapSize) @@ -165,7 +165,7 @@ LauncherFaviconLoader::LauncherFaviconLoader(Delegate* delegate, content::WebContents* web_contents) : web_contents_(web_contents) { favicon_handler_.reset( - new internal::FaviconBitmapHandler(web_contents, delegate)); + new internal::FaviconRawBitmapHandler(web_contents, delegate)); } LauncherFaviconLoader::~LauncherFaviconLoader() { diff --git a/chrome/browser/ui/ash/launcher/launcher_favicon_loader.h b/chrome/browser/ui/ash/launcher/launcher_favicon_loader.h index 6327c02..ce24292 100644 --- a/chrome/browser/ui/ash/launcher/launcher_favicon_loader.h +++ b/chrome/browser/ui/ash/launcher/launcher_favicon_loader.h @@ -15,7 +15,7 @@ class GURL; class SkBitmap; namespace internal { -class FaviconBitmapHandler; +class FaviconRawBitmapHandler; } namespace content { @@ -52,7 +52,7 @@ class LauncherFaviconLoader { private: content::WebContents* web_contents_; - scoped_ptr<internal::FaviconBitmapHandler> favicon_handler_; + scoped_ptr<internal::FaviconRawBitmapHandler> favicon_handler_; DISALLOW_COPY_AND_ASSIGN(LauncherFaviconLoader); }; diff --git a/chrome/browser/ui/cocoa/history_menu_bridge.mm b/chrome/browser/ui/cocoa/history_menu_bridge.mm index 3fd89b7..1c20e78 100644 --- a/chrome/browser/ui/cocoa/history_menu_bridge.mm +++ b/chrome/browser/ui/cocoa/history_menu_bridge.mm @@ -456,12 +456,13 @@ HistoryMenuBridge::HistoryItem* HistoryMenuBridge::HistoryItemForTab( void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) { FaviconService* service = FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); - base::CancelableTaskTracker::TaskId task_id = service->GetFaviconImageForURL( - FaviconService::FaviconForURLParams( - item->url, favicon_base::FAVICON, gfx::kFaviconSize), - base::Bind( - &HistoryMenuBridge::GotFaviconData, base::Unretained(this), item), - &cancelable_task_tracker_); + base::CancelableTaskTracker::TaskId task_id = + service->GetFaviconImageForPageURL( + FaviconService::FaviconForPageURLParams( + item->url, favicon_base::FAVICON, gfx::kFaviconSize), + base::Bind( + &HistoryMenuBridge::GotFaviconData, base::Unretained(this), item), + &cancelable_task_tracker_); item->icon_task_id = task_id; item->icon_requested = true; } diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model.cc b/chrome/browser/ui/toolbar/back_forward_menu_model.cc index 79501d3..aaef6950 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model.cc +++ b/chrome/browser/ui/toolbar/back_forward_menu_model.cc @@ -254,8 +254,8 @@ void BackForwardMenuModel::FetchFavicon(NavigationEntry* entry) { if (!favicon_service) return; - favicon_service->GetFaviconImageForURL( - FaviconService::FaviconForURLParams( + favicon_service->GetFaviconImageForPageURL( + FaviconService::FaviconForPageURLParams( entry->GetURL(), favicon_base::FAVICON, gfx::kFaviconSize), base::Bind(&BackForwardMenuModel::OnFavIconDataAvailable, base::Unretained(this), diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc index 931e44a..af2e819 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc +++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc @@ -578,7 +578,7 @@ void RecentTabsSubMenuModel::AddDeviceFavicon( case browser_sync::SyncedSession::TYPE_UNSET: favicon_id = IDR_LAPTOP_FAVICON; break; - }; + } ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); SetIcon(index_in_menu, rb.GetNativeImageNamed(favicon_id)); @@ -613,8 +613,8 @@ void RecentTabsSubMenuModel::AddTabFavicon(int command_id, const GURL& url) { if (!favicon_service) return; - favicon_service->GetFaviconImageForURL( - FaviconService::FaviconForURLParams( + favicon_service->GetFaviconImageForPageURL( + FaviconService::FaviconForPageURLParams( url, favicon_base::FAVICON, gfx::kFaviconSize), base::Bind(&RecentTabsSubMenuModel::OnFaviconDataAvailable, weak_ptr_factory_.GetWeakPtr(), @@ -653,7 +653,8 @@ void RecentTabsSubMenuModel::ClearLocalEntries() { while (last_local_model_index_ >= 0) RemoveItemAt(last_local_model_index_--); - // Cancel asynchronous FaviconService::GetFaviconImageForURL() tasks of all + // Cancel asynchronous FaviconService::GetFaviconImageForPageURL() tasks of + // all // local tabs. local_tab_cancelable_task_tracker_.TryCancelAll(); diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index abda424..d9bd629 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc @@ -526,7 +526,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui, void RunFaviconCallbackAsync( const favicon_base::FaviconResultsCallback& callback, - const std::vector<favicon_base::FaviconBitmapResult>* results) { + const std::vector<favicon_base::FaviconRawBitmapResult>* results) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, base::Bind(&FaviconService::FaviconResultsCallbackRunner, @@ -586,19 +586,19 @@ void ChromeWebUIControllerFactory::GetFaviconForURL( ExtensionWebUI::GetFaviconForURL(profile, url, callback); #else RunFaviconCallbackAsync( - callback, new std::vector<favicon_base::FaviconBitmapResult>()); + callback, new std::vector<favicon_base::FaviconRawBitmapResult>()); #endif return; } - std::vector<favicon_base::FaviconBitmapResult>* favicon_bitmap_results = - new std::vector<favicon_base::FaviconBitmapResult>(); + std::vector<favicon_base::FaviconRawBitmapResult>* favicon_bitmap_results = + new std::vector<favicon_base::FaviconRawBitmapResult>(); for (size_t i = 0; i < scale_factors.size(); ++i) { scoped_refptr<base::RefCountedMemory> bitmap(GetFaviconResourceBytes( url, scale_factors[i])); if (bitmap.get() && bitmap->size()) { - favicon_base::FaviconBitmapResult bitmap_result; + favicon_base::FaviconRawBitmapResult bitmap_result; bitmap_result.bitmap_data = bitmap; // Leave |bitmap_result|'s icon URL as the default of GURL(). bitmap_result.icon_type = favicon_base::FAVICON; diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.cc b/chrome/browser/ui/webui/extensions/extension_icon_source.cc index 4c188ba..c6ba0c6 100644 --- a/chrome/browser/ui/webui/extensions/extension_icon_source.cc +++ b/chrome/browser/ui/webui/extensions/extension_icon_source.cc @@ -219,8 +219,8 @@ void ExtensionIconSource::LoadFaviconImage(int request_id) { GURL favicon_url = AppLaunchInfo::GetFullLaunchURL(GetData(request_id)->extension); - favicon_service->GetRawFaviconForURL( - FaviconService::FaviconForURLParams( + favicon_service->GetRawFaviconForPageURL( + FaviconService::FaviconForPageURLParams( favicon_url, favicon_base::FAVICON, gfx::kFaviconSize), ui::SCALE_FACTOR_100P, base::Bind(&ExtensionIconSource::OnFaviconDataAvailable, @@ -231,7 +231,7 @@ void ExtensionIconSource::LoadFaviconImage(int request_id) { void ExtensionIconSource::OnFaviconDataAvailable( int request_id, - const favicon_base::FaviconBitmapResult& bitmap_result) { + const favicon_base::FaviconRawBitmapResult& bitmap_result) { ExtensionIconRequest* request = GetData(request_id); // Fallback to the default icon if there wasn't a favicon. diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.h b/chrome/browser/ui/webui/extensions/extension_icon_source.h index 2ec71bc..a95c823 100644 --- a/chrome/browser/ui/webui/extensions/extension_icon_source.h +++ b/chrome/browser/ui/webui/extensions/extension_icon_source.h @@ -110,7 +110,7 @@ class ExtensionIconSource : public content::URLDataSource, // FaviconService callback void OnFaviconDataAvailable( int request_id, - const favicon_base::FaviconBitmapResult& bitmap_result); + const favicon_base::FaviconRawBitmapResult& bitmap_result); // ImageLoader callback void OnImageLoaded(int request_id, const gfx::Image& image); diff --git a/chrome/browser/ui/webui/favicon_source.cc b/chrome/browser/ui/webui/favicon_source.cc index 80f0004..c56e7e1 100644 --- a/chrome/browser/ui/webui/favicon_source.cc +++ b/chrome/browser/ui/webui/favicon_source.cc @@ -107,16 +107,14 @@ void FaviconSource::StartDataRequest( } } - favicon_service->GetRawFaviconForURL( - FaviconService::FaviconForURLParams(url, icon_types_, - parsed.size_in_dip), + favicon_service->GetRawFaviconForPageURL( + FaviconService::FaviconForPageURLParams( + url, icon_types_, parsed.size_in_dip), scale_factor, - base::Bind(&FaviconSource::OnFaviconDataAvailable, - base::Unretained(this), - IconRequest(callback, - url, - parsed.size_in_dip, - scale_factor)), + base::Bind( + &FaviconSource::OnFaviconDataAvailable, + base::Unretained(this), + IconRequest(callback, url, parsed.size_in_dip, scale_factor)), &cancelable_task_tracker_); } } @@ -158,7 +156,7 @@ bool FaviconSource::HandleMissingResource(const IconRequest& request) { void FaviconSource::OnFaviconDataAvailable( const IconRequest& request, - const favicon_base::FaviconBitmapResult& bitmap_result) { + const favicon_base::FaviconRawBitmapResult& bitmap_result) { if (bitmap_result.is_valid()) { // Forward the data along to the networking system. request.callback.Run(bitmap_result.bitmap_data.get()); diff --git a/chrome/browser/ui/webui/favicon_source.h b/chrome/browser/ui/webui/favicon_source.h index 1dc7eda..a4014b7 100644 --- a/chrome/browser/ui/webui/favicon_source.h +++ b/chrome/browser/ui/webui/favicon_source.h @@ -120,7 +120,7 @@ class FaviconSource : public content::URLDataSource { // Called when favicon data is available from the history backend. void OnFaviconDataAvailable( const IconRequest& request, - const favicon_base::FaviconBitmapResult& bitmap_result); + const favicon_base::FaviconRawBitmapResult& bitmap_result); // Sends the 16x16 DIP 1x default favicon. void SendDefaultResponse( diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index 5b2951b..5f5fe6b 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -700,8 +700,8 @@ void AppLauncherHandler::HandleGenerateAppForLink(const base::ListValue* args) { install_info->app_url = launch_url; install_info->page_ordinal = page_ordinal; - favicon_service->GetFaviconImageForURL( - FaviconService::FaviconForURLParams( + favicon_service->GetFaviconImageForPageURL( + FaviconService::FaviconForPageURLParams( launch_url, favicon_base::FAVICON, gfx::kFaviconSize), base::Bind(&AppLauncherHandler::OnFaviconForApp, base::Unretained(this), diff --git a/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc b/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc index f5773df..0b3b5b2 100644 --- a/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc +++ b/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc @@ -111,8 +111,8 @@ void FaviconWebUIHandler::HandleGetFaviconDominantColor( } dom_id_map_[id_] = dom_id; - favicon_service->GetRawFaviconForURL( - FaviconService::FaviconForURLParams( + favicon_service->GetRawFaviconForPageURL( + FaviconService::FaviconForPageURLParams( url, favicon_base::FAVICON, gfx::kFaviconSize), ui::SCALE_FACTOR_100P, base::Bind(&FaviconWebUIHandler::OnFaviconDataAvailable, @@ -123,7 +123,7 @@ void FaviconWebUIHandler::HandleGetFaviconDominantColor( void FaviconWebUIHandler::OnFaviconDataAvailable( int id, - const favicon_base::FaviconBitmapResult& bitmap_result) { + const favicon_base::FaviconRawBitmapResult& bitmap_result) { scoped_ptr<base::StringValue> color_value; if (bitmap_result.is_valid()) diff --git a/chrome/browser/ui/webui/ntp/favicon_webui_handler.h b/chrome/browser/ui/webui/ntp/favicon_webui_handler.h index dd19e17..9acbaa0 100644 --- a/chrome/browser/ui/webui/ntp/favicon_webui_handler.h +++ b/chrome/browser/ui/webui/ntp/favicon_webui_handler.h @@ -43,7 +43,7 @@ class FaviconWebUIHandler : public content::WebUIMessageHandler { // Called when favicon data is available from the history backend. void OnFaviconDataAvailable( int request_handle, - const favicon_base::FaviconBitmapResult& bitmap_result); + const favicon_base::FaviconRawBitmapResult& bitmap_result); base::CancelableTaskTracker cancelable_task_tracker_; diff --git a/components/favicon_base/favicon_callback.h b/components/favicon_base/favicon_callback.h index 437c4ec..7616a11 100644 --- a/components/favicon_base/favicon_callback.h +++ b/components/favicon_base/favicon_callback.h @@ -11,7 +11,7 @@ namespace favicon_base { -struct FaviconBitmapResult; +struct FaviconRawBitmapResult; struct FaviconImageResult; // Callback for functions that can be used to return a |gfx::Image| and the @@ -19,13 +19,14 @@ struct FaviconImageResult; typedef base::Callback<void(const FaviconImageResult&)> FaviconImageCallback; // Callback for functions returning raw data for a favicon. In -// |FaviconBitmapResult|, the data is not yet converted as a |gfx::Image|. -typedef base::Callback<void(const FaviconBitmapResult&)> FaviconRawCallback; +// |FaviconRawBitmapResult|, the data is not yet converted as a |gfx::Image|. +typedef base::Callback<void(const FaviconRawBitmapResult&)> + FaviconRawBitmapCallback; // Callback for functions returning raw data for a favicon in multiple -// resolution. In |FaviconBitmapResult|, the data is not yet converted as a +// resolution. In |FaviconRawBitmapResult|, the data is not yet converted as a // |gfx::Image|. -typedef base::Callback<void(const std::vector<FaviconBitmapResult>&)> +typedef base::Callback<void(const std::vector<FaviconRawBitmapResult>&)> FaviconResultsCallback; } // namespace favicon_base diff --git a/components/favicon_base/favicon_types.cc b/components/favicon_base/favicon_types.cc index 837da69..eb0e7bc 100644 --- a/components/favicon_base/favicon_types.cc +++ b/components/favicon_base/favicon_types.cc @@ -12,11 +12,14 @@ FaviconImageResult::FaviconImageResult() {} FaviconImageResult::~FaviconImageResult() {} -// FaviconBitmapResult -------------------------------------------------------- +// FaviconRawBitmapResult +// -------------------------------------------------------- -FaviconBitmapResult::FaviconBitmapResult() - : expired(false), icon_type(INVALID_ICON) {} +FaviconRawBitmapResult::FaviconRawBitmapResult() + : expired(false), icon_type(INVALID_ICON) { +} -FaviconBitmapResult::~FaviconBitmapResult() {} +FaviconRawBitmapResult::~FaviconRawBitmapResult() { +} } // namespace chrome diff --git a/components/favicon_base/favicon_types.h b/components/favicon_base/favicon_types.h index 34fd57e..f99f038 100644 --- a/components/favicon_base/favicon_types.h +++ b/components/favicon_base/favicon_types.h @@ -45,9 +45,9 @@ struct FaviconImageResult { // Defines a favicon bitmap which best matches the desired DIP size and one of // the desired scale factors. -struct FaviconBitmapResult { - FaviconBitmapResult(); - ~FaviconBitmapResult(); +struct FaviconRawBitmapResult { + FaviconRawBitmapResult(); + ~FaviconRawBitmapResult(); // Returns true if |bitmap_data| contains a valid bitmap. bool is_valid() const { return bitmap_data.get() && bitmap_data->size(); } @@ -68,9 +68,9 @@ struct FaviconBitmapResult { IconType icon_type; }; -// Define type with same structure as FaviconBitmapResult for passing data to +// Define type with same structure as FaviconRawBitmapResult for passing data to // HistoryBackend::SetFavicons(). -typedef FaviconBitmapResult FaviconBitmapData; +typedef FaviconRawBitmapResult FaviconRawBitmapData; } // namespace favicon_base diff --git a/components/favicon_base/select_favicon_frames.h b/components/favicon_base/select_favicon_frames.h index cc57a80..597a8f1 100644 --- a/components/favicon_base/select_favicon_frames.h +++ b/components/favicon_base/select_favicon_frames.h @@ -17,7 +17,7 @@ class Size; } // Score which is smaller than the minimum score returned by -// SelectFaviconFrames() or SelectFaviconBitmapIDs(). +// SelectFaviconFrames() or SelectFaviconFrameIndices(). extern const float kSelectFaviconFramesInvalidScore; // Takes a list of all bitmaps found in a .ico file, and creates an |