| 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" | |
| 9 #include "base/macros.h" | 8 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 11 #include "base/task/cancelable_task_tracker.h" | 10 #include "base/task/cancelable_task_tracker.h" |
| 12 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 13 #include "chrome/browser/android/shortcut_info.h" | 12 #include "chrome/browser/android/shortcut_info.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
| 15 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
| 16 | 15 |
| 17 namespace base { | 16 namespace base { |
| 18 class TaskRunner; | 17 class TaskRunner; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // OnDidGetWebApplicationInfo is expected to be called when finished. | 74 // OnDidGetWebApplicationInfo is expected to be called when finished. |
| 76 AddToHomescreenDataFetcher(content::WebContents* web_contents, | 75 AddToHomescreenDataFetcher(content::WebContents* web_contents, |
| 77 int ideal_icon_size_in_px, | 76 int ideal_icon_size_in_px, |
| 78 int minimum_icon_size_in_px, | 77 int minimum_icon_size_in_px, |
| 79 int ideal_splash_image_size_in_px, | 78 int ideal_splash_image_size_in_px, |
| 80 int minimum_splash_image_size_in_px, | 79 int minimum_splash_image_size_in_px, |
| 81 int badge_size_in_px, | 80 int badge_size_in_px, |
| 82 bool check_webapk_compatible, | 81 bool check_webapk_compatible, |
| 83 Observer* observer); | 82 Observer* observer); |
| 84 | 83 |
| 85 // Returns a callback which fetches the splash screen image to be stored for | |
| 86 // the webapp with the specified |id|. | |
| 87 base::Closure FetchSplashScreenImageCallback(const std::string& id); | |
| 88 | |
| 89 // IPC message received when the initialization is finished. | 84 // IPC message received when the initialization is finished. |
| 90 void OnDidGetWebApplicationInfo(const WebApplicationInfo& web_app_info); | 85 void OnDidGetWebApplicationInfo(const WebApplicationInfo& web_app_info); |
| 91 | 86 |
| 92 // Accessors, etc. | 87 // Accessors, etc. |
| 93 void set_weak_observer(Observer* observer) { weak_observer_ = observer; } | 88 void set_weak_observer(Observer* observer) { weak_observer_ = observer; } |
| 94 bool is_ready() const { return is_ready_; } | 89 bool is_ready() const { return is_ready_; } |
| 95 const SkBitmap& badge_icon() const { return badge_icon_; } | 90 const SkBitmap& badge_icon() const { return badge_icon_; } |
| 96 const SkBitmap& primary_icon() const { return primary_icon_; } | 91 const SkBitmap& primary_icon() const { return primary_icon_; } |
| 97 ShortcutInfo& shortcut_info() { return shortcut_info_; } | 92 ShortcutInfo& shortcut_info() { return shortcut_info_; } |
| 98 | 93 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 129 void NotifyObserver(const SkBitmap& icon); | 124 void NotifyObserver(const SkBitmap& icon); |
| 130 | 125 |
| 131 scoped_refptr<base::TaskRunner> background_task_runner_; | 126 scoped_refptr<base::TaskRunner> background_task_runner_; |
| 132 | 127 |
| 133 Observer* weak_observer_; | 128 Observer* weak_observer_; |
| 134 | 129 |
| 135 // The icons must only be set on the UI thread for thread safety. | 130 // The icons must only be set on the UI thread for thread safety. |
| 136 SkBitmap badge_icon_; | 131 SkBitmap badge_icon_; |
| 137 SkBitmap primary_icon_; | 132 SkBitmap primary_icon_; |
| 138 ShortcutInfo shortcut_info_; | 133 ShortcutInfo shortcut_info_; |
| 139 GURL splash_screen_url_; | |
| 140 | 134 |
| 141 base::CancelableTaskTracker favicon_task_tracker_; | 135 base::CancelableTaskTracker favicon_task_tracker_; |
| 142 base::Timer data_timeout_timer_; | 136 base::Timer data_timeout_timer_; |
| 143 | 137 |
| 144 const int ideal_icon_size_in_px_; | 138 const int ideal_icon_size_in_px_; |
| 145 const int minimum_icon_size_in_px_; | 139 const int minimum_icon_size_in_px_; |
| 146 const int ideal_splash_image_size_in_px_; | 140 const int ideal_splash_image_size_in_px_; |
| 147 const int minimum_splash_image_size_in_px_; | 141 const int minimum_splash_image_size_in_px_; |
| 148 const int badge_size_in_px_; | 142 const int badge_size_in_px_; |
| 149 | 143 |
| 150 // Indicates whether to check WebAPK compatibility. | 144 // Indicates whether to check WebAPK compatibility. |
| 151 bool check_webapk_compatibility_; | 145 bool check_webapk_compatibility_; |
| 152 bool is_waiting_for_web_application_info_; | 146 bool is_waiting_for_web_application_info_; |
| 153 bool is_installable_check_complete_; | 147 bool is_installable_check_complete_; |
| 154 bool is_icon_saved_; | 148 bool is_icon_saved_; |
| 155 bool is_ready_; | 149 bool is_ready_; |
| 156 | 150 |
| 157 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); | 151 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); |
| 158 }; | 152 }; |
| 159 | 153 |
| 160 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ | 154 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ |
| OLD | NEW |