| 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/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/task/cancelable_task_tracker.h" | 9 #include "base/task/cancelable_task_tracker.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // Grabs the favicon for the current URL. | 76 // Grabs the favicon for the current URL. |
| 77 void FetchFavicon(); | 77 void FetchFavicon(); |
| 78 void OnFaviconFetched( | 78 void OnFaviconFetched( |
| 79 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 79 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
| 80 | 80 |
| 81 // Creates the launcher icon from the given bitmap. | 81 // Creates the launcher icon from the given bitmap. |
| 82 void CreateLauncherIcon( | 82 void CreateLauncherIcon( |
| 83 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 83 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
| 84 | 84 |
| 85 // Callback run after an attempt to download manifest icon has been made. May | 85 // Callback run after an attempt to download manifest icon has been made. May |
| 86 // kick off the download of a favicon if it failed. | 86 // kick off the download of a favicon if it failed (i.e. the bitmap is empty). |
| 87 void OnManifestIconFetched(int id, | 87 void OnManifestIconFetched(const SkBitmap& icon); |
| 88 int http_status_code, | |
| 89 const GURL& url, | |
| 90 const std::vector<SkBitmap>& bitmaps, | |
| 91 const std::vector<gfx::Size>& sizes); | |
| 92 | 88 |
| 93 // Notifies the observer that the shortcut data is all available. | 89 // Notifies the observer that the shortcut data is all available. |
| 94 void NotifyObserver(const SkBitmap& icon); | 90 void NotifyObserver(const SkBitmap& icon); |
| 95 | 91 |
| 96 Observer* weak_observer_; | 92 Observer* weak_observer_; |
| 97 | 93 |
| 98 bool is_waiting_for_web_application_info_; | 94 bool is_waiting_for_web_application_info_; |
| 99 bool is_icon_saved_; | 95 bool is_icon_saved_; |
| 100 bool is_ready_; | 96 bool is_ready_; |
| 101 base::Timer icon_timeout_timer_; | 97 base::Timer icon_timeout_timer_; |
| 102 ShortcutInfo shortcut_info_; | 98 ShortcutInfo shortcut_info_; |
| 103 | 99 |
| 104 // The icon must only be set on the UI thread for thread safety. | 100 // The icon must only be set on the UI thread for thread safety. |
| 105 SkBitmap shortcut_icon_; | 101 SkBitmap shortcut_icon_; |
| 106 base::CancelableTaskTracker favicon_task_tracker_; | 102 base::CancelableTaskTracker favicon_task_tracker_; |
| 107 | 103 |
| 108 const int preferred_icon_size_in_px_; | 104 const int preferred_icon_size_in_px_; |
| 109 static const int kPreferredIconSizeInDp; | 105 static const int kPreferredIconSizeInDp; |
| 110 | 106 |
| 111 friend class base::RefCounted<AddToHomescreenDataFetcher>; | 107 friend class base::RefCounted<AddToHomescreenDataFetcher>; |
| 112 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); | 108 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); |
| 113 }; | 109 }; |
| 114 | 110 |
| 115 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ | 111 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ |
| OLD | NEW |