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/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/strings/string16.h" |
10 #include "base/task/cancelable_task_tracker.h" | 11 #include "base/task/cancelable_task_tracker.h" |
11 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
12 #include "chrome/browser/android/shortcut_info.h" | 13 #include "chrome/browser/android/shortcut_info.h" |
13 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
14 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
15 | 16 |
16 namespace base { | |
17 class TaskRunner; | |
18 } | |
19 | |
20 namespace content { | |
21 class WebContents; | |
22 } | |
23 | |
24 namespace favicon_base { | 17 namespace favicon_base { |
25 struct FaviconRawBitmapResult; | 18 struct FaviconRawBitmapResult; |
26 } | 19 } |
27 | 20 |
28 namespace IPC { | |
29 class Message; | |
30 } | |
31 | |
32 class GURL; | 21 class GURL; |
33 struct InstallableData; | 22 struct InstallableData; |
34 struct WebApplicationInfo; | 23 struct WebApplicationInfo; |
35 | 24 |
36 // Aysnchronously fetches and processes data needed to create a shortcut for an | 25 // Aysnchronously fetches and processes data needed to create a shortcut for an |
37 // Android Home screen launcher. | 26 // Android Home screen launcher. |
38 // | 27 // |
39 // Because of the various asynchronous calls made by this class, it is | 28 // Because of the various asynchronous calls made by this class, it is |
40 // refcounted to prevent the class from being prematurely deleted. If the | 29 // refcounted to prevent the class from being prematurely deleted. If the |
41 // pointer to the ShortcutHelper becomes invalid, the pipeline should kill | 30 // pointer to the ShortcutHelper becomes invalid, the pipeline should kill |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 SkBitmap CreateLauncherIconFromFaviconInBackground( | 105 SkBitmap CreateLauncherIconFromFaviconInBackground( |
117 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 106 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
118 | 107 |
119 // Creates the launcher icon from the given |raw_icon|. | 108 // Creates the launcher icon from the given |raw_icon|. |
120 void CreateLauncherIcon(const SkBitmap& raw_icon); | 109 void CreateLauncherIcon(const SkBitmap& raw_icon); |
121 SkBitmap CreateLauncherIconInBackground(const SkBitmap& raw_icon); | 110 SkBitmap CreateLauncherIconInBackground(const SkBitmap& raw_icon); |
122 | 111 |
123 // Notifies the observer that the shortcut data is all available. | 112 // Notifies the observer that the shortcut data is all available. |
124 void NotifyObserver(const SkBitmap& icon); | 113 void NotifyObserver(const SkBitmap& icon); |
125 | 114 |
126 scoped_refptr<base::TaskRunner> background_task_runner_; | |
127 | |
128 Observer* weak_observer_; | 115 Observer* weak_observer_; |
129 | 116 |
130 // The icons must only be set on the UI thread for thread safety. | 117 // The icons must only be set on the UI thread for thread safety. |
131 SkBitmap badge_icon_; | 118 SkBitmap badge_icon_; |
132 SkBitmap primary_icon_; | 119 SkBitmap primary_icon_; |
133 ShortcutInfo shortcut_info_; | 120 ShortcutInfo shortcut_info_; |
134 | 121 |
135 base::CancelableTaskTracker favicon_task_tracker_; | 122 base::CancelableTaskTracker favicon_task_tracker_; |
136 base::OneShotTimer data_timeout_timer_; | 123 base::OneShotTimer data_timeout_timer_; |
137 | 124 |
138 const int ideal_icon_size_in_px_; | 125 const int ideal_icon_size_in_px_; |
139 const int minimum_icon_size_in_px_; | 126 const int minimum_icon_size_in_px_; |
140 const int ideal_splash_image_size_in_px_; | 127 const int ideal_splash_image_size_in_px_; |
141 const int minimum_splash_image_size_in_px_; | 128 const int minimum_splash_image_size_in_px_; |
142 const int badge_size_in_px_; | 129 const int badge_size_in_px_; |
143 | 130 |
144 // Indicates whether to check WebAPK compatibility. | 131 // Indicates whether to check WebAPK compatibility. |
145 bool check_webapk_compatibility_; | 132 bool check_webapk_compatibility_; |
146 bool is_waiting_for_web_application_info_; | 133 bool is_waiting_for_web_application_info_; |
147 bool is_installable_check_complete_; | 134 bool is_installable_check_complete_; |
148 bool is_icon_saved_; | 135 bool is_icon_saved_; |
149 | 136 |
150 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); | 137 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); |
151 }; | 138 }; |
152 | 139 |
153 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ | 140 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ |
OLD | NEW |