| 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/task/cancelable_task_tracker.h" | 10 #include "base/task/cancelable_task_tracker.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 void FetchFavicon(); | 89 void FetchFavicon(); |
| 90 void OnFaviconFetched( | 90 void OnFaviconFetched( |
| 91 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 91 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
| 92 | 92 |
| 93 // Creates the launcher icon from the given bitmap. | 93 // Creates the launcher icon from the given bitmap. |
| 94 void CreateLauncherIcon( | 94 void CreateLauncherIcon( |
| 95 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 95 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
| 96 | 96 |
| 97 // Callback run after an attempt to download manifest icon has been made. May | 97 // Callback run after an attempt to download manifest icon has been made. May |
| 98 // kick off the download of a favicon if it failed (i.e. the bitmap is empty). | 98 // kick off the download of a favicon if it failed (i.e. the bitmap is empty). |
| 99 void OnManifestIconFetched(const SkBitmap& icon); | 99 void OnManifestIconFetched(const GURL& icon_url, const SkBitmap& icon); |
| 100 | 100 |
| 101 // Notifies the observer that the shortcut data is all available. | 101 // Notifies the observer that the shortcut data is all available. |
| 102 void NotifyObserver(const SkBitmap& icon, bool is_generated); | 102 void NotifyObserver(const SkBitmap& icon); |
| 103 | 103 |
| 104 // Looks up the original, online URL of the site requested. The URL from the | 104 // Looks up the original, online URL of the site requested. The URL from the |
| 105 // WebContents may be an offline page or a distilled article which is not | 105 // WebContents may be an offline page or a distilled article which is not |
| 106 // appropriate for a home screen shortcut. | 106 // appropriate for a home screen shortcut. |
| 107 GURL GetShortcutUrl(const GURL& original_url); | 107 GURL GetShortcutUrl(const GURL& original_url); |
| 108 | 108 |
| 109 Observer* weak_observer_; | 109 Observer* weak_observer_; |
| 110 | 110 |
| 111 bool is_waiting_for_web_application_info_; | 111 bool is_waiting_for_web_application_info_; |
| 112 bool is_icon_saved_; | 112 bool is_icon_saved_; |
| 113 bool is_ready_; | 113 bool is_ready_; |
| 114 base::Timer icon_timeout_timer_; | 114 base::Timer icon_timeout_timer_; |
| 115 ShortcutInfo shortcut_info_; | 115 ShortcutInfo shortcut_info_; |
| 116 GURL splash_screen_url_; | 116 GURL splash_screen_url_; |
| 117 | 117 |
| 118 // The icon must only be set on the UI thread for thread safety. | 118 // The icon must only be set on the UI thread for thread safety. |
| 119 SkBitmap shortcut_icon_; | 119 SkBitmap shortcut_icon_; |
| 120 base::CancelableTaskTracker favicon_task_tracker_; | 120 base::CancelableTaskTracker favicon_task_tracker_; |
| 121 | 121 |
| 122 const int ideal_icon_size_in_dp_; | 122 const int ideal_icon_size_in_dp_; |
| 123 const int minimum_icon_size_in_dp_; | 123 const int minimum_icon_size_in_dp_; |
| 124 const int ideal_splash_image_size_in_dp_; | 124 const int ideal_splash_image_size_in_dp_; |
| 125 const int minimum_splash_image_size_in_dp_; | 125 const int minimum_splash_image_size_in_dp_; |
| 126 | 126 |
| 127 friend class base::RefCounted<AddToHomescreenDataFetcher>; | 127 friend class base::RefCounted<AddToHomescreenDataFetcher>; |
| 128 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); | 128 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ | 131 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ |
| OLD | NEW |