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