| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ | 6 #define CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 private: | 87 private: |
| 88 friend class base::RefCounted<AddToHomescreenDataFetcher>; | 88 friend class base::RefCounted<AddToHomescreenDataFetcher>; |
| 89 | 89 |
| 90 ~AddToHomescreenDataFetcher() override; | 90 ~AddToHomescreenDataFetcher() override; |
| 91 | 91 |
| 92 // Grabs the favicon for the current URL. | 92 // Grabs the favicon for the current URL. |
| 93 void FetchFavicon(); | 93 void FetchFavicon(); |
| 94 void OnFaviconFetched( | 94 void OnFaviconFetched( |
| 95 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 95 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
| 96 | 96 |
| 97 // Creates the launcher icon from the given bitmap and page URL. The page URL | 97 // Creates the launcher icon from the given bitmap. shortcut_info_.url is |
| 98 // is used to generate an icon if there is no bitmap in |bitmap_result| or the | 98 // used to generate an icon if there is no bitmap in |bitmap_result| or the |
| 99 // bitmap is not large enough. | 99 // bitmap is not large enough. |
| 100 void CreateLauncherIconInBackground( | 100 void CreateLauncherIconFromFaviconInBackground( |
| 101 const GURL& page_url, | |
| 102 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 101 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
| 103 | 102 |
| 104 // Called when InstallableManager finishes looking for a manifest and icon. | 103 // Called when InstallableManager finishes looking for a manifest and icon. |
| 105 void OnDidPerformInstallableCheck(const InstallableData& data); | 104 void OnDidPerformInstallableCheck(const InstallableData& data); |
| 106 | 105 |
| 106 // Creates the launcher icon from the given |icon|. |
| 107 void CreateLauncherIconInBackground(const SkBitmap& raw__icon); |
| 108 |
| 107 // Notifies the observer that the shortcut data is all available. | 109 // Notifies the observer that the shortcut data is all available. |
| 108 void NotifyObserver(const GURL& icon_url, const SkBitmap& icon); | 110 void NotifyObserver(const SkBitmap& icon); |
| 109 | 111 |
| 110 Observer* weak_observer_; | 112 Observer* weak_observer_; |
| 111 | 113 |
| 112 // The icon must only be set on the UI thread for thread safety. | 114 // The icon must only be set on the UI thread for thread safety. |
| 113 SkBitmap shortcut_icon_; | 115 SkBitmap shortcut_icon_; |
| 114 ShortcutInfo shortcut_info_; | 116 ShortcutInfo shortcut_info_; |
| 115 GURL splash_screen_url_; | 117 GURL splash_screen_url_; |
| 116 | 118 |
| 117 base::CancelableTaskTracker favicon_task_tracker_; | 119 base::CancelableTaskTracker favicon_task_tracker_; |
| 118 base::Timer data_timeout_timer_; | 120 base::Timer data_timeout_timer_; |
| 119 | 121 |
| 120 const int ideal_icon_size_in_dp_; | 122 const int ideal_icon_size_in_dp_; |
| 121 const int minimum_icon_size_in_dp_; | 123 const int minimum_icon_size_in_dp_; |
| 122 const int ideal_splash_image_size_in_dp_; | 124 const int ideal_splash_image_size_in_dp_; |
| 123 const int minimum_splash_image_size_in_dp_; | 125 const int minimum_splash_image_size_in_dp_; |
| 124 bool is_waiting_for_web_application_info_; | 126 bool is_waiting_for_web_application_info_; |
| 125 bool is_icon_saved_; | 127 bool is_icon_saved_; |
| 126 bool is_ready_; | 128 bool is_ready_; |
| 127 | 129 |
| 128 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); | 130 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); |
| 129 }; | 131 }; |
| 130 | 132 |
| 131 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ | 133 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ |
| OLD | NEW |