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

Side by Side Diff: chrome/browser/history/history_backend.h

Issue 330603004: Rename FaviconBitmapXxx to FaviconRawBitmapXxx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_
6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ 6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool GetMostRecentRedirectsTo(const GURL& url, 209 bool GetMostRecentRedirectsTo(const GURL& url,
210 history::RedirectList* redirects); 210 history::RedirectList* redirects);
211 211
212 // Favicon ------------------------------------------------------------------- 212 // Favicon -------------------------------------------------------------------
213 213
214 void GetFavicons( 214 void GetFavicons(
215 const std::vector<GURL>& icon_urls, 215 const std::vector<GURL>& icon_urls,
216 int icon_types, 216 int icon_types,
217 int desired_size_in_dip, 217 int desired_size_in_dip,
218 const std::vector<ui::ScaleFactor>& desired_scale_factors, 218 const std::vector<ui::ScaleFactor>& desired_scale_factors,
219 std::vector<favicon_base::FaviconBitmapResult>* bitmap_results); 219 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results);
220 220
221 void GetLargestFaviconForURL( 221 void GetLargestFaviconForURL(
222 const GURL& page_url, 222 const GURL& page_url,
223 const std::vector<int>& icon_types, 223 const std::vector<int>& icon_types,
224 int minimum_size_in_pixels, 224 int minimum_size_in_pixels,
225 favicon_base::FaviconBitmapResult* bitmap_result); 225 favicon_base::FaviconRawBitmapResult* bitmap_result);
226 226
227 void GetFaviconsForURL( 227 void GetFaviconsForURL(
228 const GURL& page_url, 228 const GURL& page_url,
229 int icon_types, 229 int icon_types,
230 int desired_size_in_dip, 230 int desired_size_in_dip,
231 const std::vector<ui::ScaleFactor>& desired_scale_factors, 231 const std::vector<ui::ScaleFactor>& desired_scale_factors,
232 std::vector<favicon_base::FaviconBitmapResult>* bitmap_results); 232 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results);
233 233
234 void GetFaviconForID( 234 void GetFaviconForID(
235 favicon_base::FaviconID favicon_id, 235 favicon_base::FaviconID favicon_id,
236 int desired_size_in_dip, 236 int desired_size_in_dip,
237 ui::ScaleFactor desired_scale_factor, 237 ui::ScaleFactor desired_scale_factor,
238 std::vector<favicon_base::FaviconBitmapResult>* bitmap_results); 238 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results);
239 239
240 void UpdateFaviconMappingsAndFetch( 240 void UpdateFaviconMappingsAndFetch(
241 const GURL& page_url, 241 const GURL& page_url,
242 const std::vector<GURL>& icon_urls, 242 const std::vector<GURL>& icon_urls,
243 int icon_types, 243 int icon_types,
244 int desired_size_in_dip, 244 int desired_size_in_dip,
245 const std::vector<ui::ScaleFactor>& desired_scale_factors, 245 const std::vector<ui::ScaleFactor>& desired_scale_factors,
246 std::vector<favicon_base::FaviconBitmapResult>* bitmap_results); 246 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results);
247 247
248 void MergeFavicon(const GURL& page_url, 248 void MergeFavicon(const GURL& page_url,
249 const GURL& icon_url, 249 const GURL& icon_url,
250 favicon_base::IconType icon_type, 250 favicon_base::IconType icon_type,
251 scoped_refptr<base::RefCountedMemory> bitmap_data, 251 scoped_refptr<base::RefCountedMemory> bitmap_data,
252 const gfx::Size& pixel_size); 252 const gfx::Size& pixel_size);
253 253
254 void SetFavicons( 254 void SetFavicons(const GURL& page_url,
255 const GURL& page_url, 255 favicon_base::IconType icon_type,
256 favicon_base::IconType icon_type, 256 const std::vector<favicon_base::FaviconRawBitmapData>&
257 const std::vector<favicon_base::FaviconBitmapData>& favicon_bitmap_data); 257 favicon_bitmap_data);
258 258
259 void SetFaviconsOutOfDateForPage(const GURL& page_url); 259 void SetFaviconsOutOfDateForPage(const GURL& page_url);
260 260
261 void CloneFavicons(const GURL& old_page_url, const GURL& new_page_url); 261 void CloneFavicons(const GURL& old_page_url, const GURL& new_page_url);
262 262
263 void SetImportedFavicons( 263 void SetImportedFavicons(
264 const std::vector<ImportedFaviconUsage>& favicon_usage); 264 const std::vector<ImportedFaviconUsage>& favicon_usage);
265 265
266 // Downloads ----------------------------------------------------------------- 266 // Downloads -----------------------------------------------------------------
267 267
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 // If |page_url| is non-null, |icon_types| can be multiple icon types 645 // If |page_url| is non-null, |icon_types| can be multiple icon types
646 // only if |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON. 646 // only if |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON.
647 // If multiple icon types are specified, |page_url| will be mapped to the 647 // If multiple icon types are specified, |page_url| will be mapped to the
648 // icon URLs of the largest type available in the database. 648 // icon URLs of the largest type available in the database.
649 void UpdateFaviconMappingsAndFetchImpl( 649 void UpdateFaviconMappingsAndFetchImpl(
650 const GURL* page_url, 650 const GURL* page_url,
651 const std::vector<GURL>& icon_urls, 651 const std::vector<GURL>& icon_urls,
652 int icon_types, 652 int icon_types,
653 int desired_size_in_dip, 653 int desired_size_in_dip,
654 const std::vector<ui::ScaleFactor>& desired_scale_factors, 654 const std::vector<ui::ScaleFactor>& desired_scale_factors,
655 std::vector<favicon_base::FaviconBitmapResult>* results); 655 std::vector<favicon_base::FaviconRawBitmapResult>* results);
656 656
657 // Set the favicon bitmaps for |icon_id|. 657 // Set the favicon bitmaps for |icon_id|.
658 // For each entry in |favicon_bitmap_data|, if a favicon bitmap already 658 // For each entry in |favicon_bitmap_data|, if a favicon bitmap already
659 // exists at the entry's pixel size, replace the favicon bitmap's data with 659 // exists at the entry's pixel size, replace the favicon bitmap's data with
660 // the entry's bitmap data. Otherwise add a new favicon bitmap. 660 // the entry's bitmap data. Otherwise add a new favicon bitmap.
661 // Any favicon bitmaps already mapped to |icon_id| whose pixel sizes are not 661 // Any favicon bitmaps already mapped to |icon_id| whose pixel sizes are not
662 // in |favicon_bitmap_data| are deleted. 662 // in |favicon_bitmap_data| are deleted.
663 // If not NULL, |favicon_bitmaps_changed| is set to whether any of the bitmap 663 // If not NULL, |favicon_bitmaps_changed| is set to whether any of the bitmap
664 // data at |icon_id| is changed as a result of calling this method. 664 // data at |icon_id| is changed as a result of calling this method.
665 // Computing |favicon_bitmaps_changed| requires additional database queries 665 // Computing |favicon_bitmaps_changed| requires additional database queries
666 // so should be avoided if unnecessary. 666 // so should be avoided if unnecessary.
667 void SetFaviconBitmaps( 667 void SetFaviconBitmaps(favicon_base::FaviconID icon_id,
668 favicon_base::FaviconID icon_id, 668 const std::vector<favicon_base::FaviconRawBitmapData>&
669 const std::vector<favicon_base::FaviconBitmapData>& favicon_bitmap_data, 669 favicon_bitmap_data,
670 bool* favicon_bitmaps_changed); 670 bool* favicon_bitmaps_changed);
671 671
672 // Returns true if |favicon_bitmap_data| passed to SetFavicons() is valid. 672 // Returns true if |favicon_bitmap_data| passed to SetFavicons() is valid.
673 // Criteria: 673 // Criteria:
674 // 1) |favicon_bitmap_data| contains no more than 674 // 1) |favicon_bitmap_data| contains no more than
675 // kMaxFaviconsPerPage unique icon URLs. 675 // kMaxFaviconsPerPage unique icon URLs.
676 // kMaxFaviconBitmapsPerIconURL favicon bitmaps for each icon URL. 676 // kMaxFaviconBitmapsPerIconURL favicon bitmaps for each icon URL.
677 // 2) FaviconBitmapData::bitmap_data contains non NULL bitmap data. 677 // 2) FaviconRawBitmapData::bitmap_data contains non NULL bitmap data.
678 bool ValidateSetFaviconsParams(const std::vector< 678 bool ValidateSetFaviconsParams(const std::vector<
679 favicon_base::FaviconBitmapData>& favicon_bitmap_data) const; 679 favicon_base::FaviconRawBitmapData>& favicon_bitmap_data) const;
680 680
681 // Returns true if the bitmap data at |bitmap_id| equals |new_bitmap_data|. 681 // Returns true if the bitmap data at |bitmap_id| equals |new_bitmap_data|.
682 bool IsFaviconBitmapDataEqual( 682 bool IsFaviconBitmapDataEqual(
683 FaviconBitmapID bitmap_id, 683 FaviconBitmapID bitmap_id,
684 const scoped_refptr<base::RefCountedMemory>& new_bitmap_data); 684 const scoped_refptr<base::RefCountedMemory>& new_bitmap_data);
685 685
686 // Returns true if there are favicons for |page_url| and one of the types in 686 // Returns true if there are favicons for |page_url| and one of the types in
687 // |icon_types|. 687 // |icon_types|.
688 // |favicon_bitmap_results| is set to the favicon bitmaps which most closely 688 // |favicon_bitmap_results| is set to the favicon bitmaps which most closely
689 // match |desired_size_in_dip| and |desired_scale_factors|. If 689 // match |desired_size_in_dip| and |desired_scale_factors|. If
690 // |desired_size_in_dip| is 0, the largest favicon bitmap with one of the icon 690 // |desired_size_in_dip| is 0, the largest favicon bitmap with one of the icon
691 // types in |icon_types| is returned. If |icon_types| contains multiple icon 691 // types in |icon_types| is returned. If |icon_types| contains multiple icon
692 // types and there are several matched icon types in the database, results 692 // types and there are several matched icon types in the database, results
693 // will only be returned for a single icon type in the priority of 693 // will only be returned for a single icon type in the priority of
694 // TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and FAVICON. See the comment for 694 // TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and FAVICON. See the comment for
695 // GetFaviconResultsForBestMatch() for more details on how 695 // GetFaviconResultsForBestMatch() for more details on how
696 // |favicon_bitmap_results| is constructed. 696 // |favicon_bitmap_results| is constructed.
697 bool GetFaviconsFromDB( 697 bool GetFaviconsFromDB(
698 const GURL& page_url, 698 const GURL& page_url,
699 int icon_types, 699 int icon_types,
700 const int desired_size_in_dip, 700 const int desired_size_in_dip,
701 const std::vector<ui::ScaleFactor>& desired_scale_factors, 701 const std::vector<ui::ScaleFactor>& desired_scale_factors,
702 std::vector<favicon_base::FaviconBitmapResult>* favicon_bitmap_results); 702 std::vector<favicon_base::FaviconRawBitmapResult>*
703 favicon_bitmap_results);
703 704
704 // Returns the favicon bitmaps which most closely match |desired_size_in_dip| 705 // Returns the favicon bitmaps which most closely match |desired_size_in_dip|
705 // and |desired_scale_factors| in |favicon_bitmap_results|. If 706 // and |desired_scale_factors| in |favicon_bitmap_results|. If
706 // |desired_size_in_dip| is 0, only the largest favicon bitmap is returned. 707 // |desired_size_in_dip| is 0, only the largest favicon bitmap is returned.
707 // Goodness is computed via SelectFaviconBitmapIDs(). It is computed on a 708 // Goodness is computed via SelectFaviconBitmapIDs(). It is computed on a
708 // per favicon id basis, thus all |favicon_bitmap_results| are guaranteed to 709 // per favicon id basis, thus all |favicon_bitmap_results| are guaranteed to
709 // be for the same FaviconID. |favicon_bitmap_results| will have at most one 710 // be for the same FaviconID. |favicon_bitmap_results| will have at most one
710 // entry for each desired scale factor. There will be less entries if the same 711 // entry for each desired scale factor. There will be less entries if the same
711 // favicon bitmap is the best result for multiple scale factors. 712 // favicon bitmap is the best result for multiple scale factors.
712 // Returns true if there were no errors. 713 // Returns true if there were no errors.
713 bool GetFaviconBitmapResultsForBestMatch( 714 bool GetFaviconBitmapResultsForBestMatch(
714 const std::vector<favicon_base::FaviconID>& candidate_favicon_ids, 715 const std::vector<favicon_base::FaviconID>& candidate_favicon_ids,
715 int desired_size_in_dip, 716 int desired_size_in_dip,
716 const std::vector<ui::ScaleFactor>& desired_scale_factors, 717 const std::vector<ui::ScaleFactor>& desired_scale_factors,
717 std::vector<favicon_base::FaviconBitmapResult>* favicon_bitmap_results); 718 std::vector<favicon_base::FaviconRawBitmapResult>*
719 favicon_bitmap_results);
718 720
719 // Maps the favicon ids in |icon_ids| to |page_url| (and all redirects) 721 // Maps the favicon ids in |icon_ids| to |page_url| (and all redirects)
720 // for |icon_type|. 722 // for |icon_type|.
721 // Returns true if the mappings for the page or any of its redirects were 723 // Returns true if the mappings for the page or any of its redirects were
722 // changed. 724 // changed.
723 bool SetFaviconMappingsForPageAndRedirects( 725 bool SetFaviconMappingsForPageAndRedirects(
724 const GURL& page_url, 726 const GURL& page_url,
725 favicon_base::IconType icon_type, 727 favicon_base::IconType icon_type,
726 const std::vector<favicon_base::FaviconID>& icon_ids); 728 const std::vector<favicon_base::FaviconID>& icon_ids);
727 729
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 873
872 // Listens for the system being under memory pressure. 874 // Listens for the system being under memory pressure.
873 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; 875 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_;
874 876
875 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); 877 DISALLOW_COPY_AND_ASSIGN(HistoryBackend);
876 }; 878 };
877 879
878 } // namespace history 880 } // namespace history
879 881
880 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ 882 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/android/sqlite_cursor.cc ('k') | chrome/browser/history/history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698