Chromium Code Reviews| 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 | 52 |
| 53 // Converts the icon into one that can be used on the Android Home screen. | 53 // Converts the icon into one that can be used on the Android Home screen. |
| 54 // |is_generated| is an out-param that indicates whether the icon was | 54 // |is_generated| is an out-param that indicates whether the icon was |
| 55 // generated by Chrome. | 55 // generated by Chrome. |
| 56 virtual SkBitmap FinalizeLauncherIconInBackground(const SkBitmap& icon, | 56 virtual SkBitmap FinalizeLauncherIconInBackground(const SkBitmap& icon, |
| 57 const GURL& url, | 57 const GURL& url, |
| 58 bool* is_generated) = 0; | 58 bool* is_generated) = 0; |
| 59 | 59 |
| 60 // Called when all the data needed to create a shortcut is available. | 60 // Called when all the data needed to create a shortcut is available. |
| 61 virtual void OnDataAvailable(const ShortcutInfo& info, | 61 virtual void OnDataAvailable(const ShortcutInfo& info, |
| 62 const SkBitmap& icon) = 0; | 62 const SkBitmap& icon, |
|
dominickn
2017/02/02 19:16:50
primary_icon?
badge_icon?
F
2017/02/02 21:05:51
Done.
| |
| 63 const SkBitmap& badge) = 0; | |
| 63 | 64 |
| 64 protected: | 65 protected: |
| 65 virtual ~Observer() {} | 66 virtual ~Observer() {} |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 // Initialize the fetcher by requesting the information about the page from | 69 // Initialize the fetcher by requesting the information about the page from |
| 69 // the renderer process. The initialization is asynchronous and | 70 // the renderer process. The initialization is asynchronous and |
| 70 // OnDidGetWebApplicationInfo is expected to be called when finished. | 71 // OnDidGetWebApplicationInfo is expected to be called when finished. |
| 71 AddToHomescreenDataFetcher(content::WebContents* web_contents, | 72 AddToHomescreenDataFetcher(content::WebContents* web_contents, |
| 72 int ideal_icon_size_in_px, | 73 int ideal_icon_size_in_px, |
| 73 int minimum_icon_size_in_px, | 74 int minimum_icon_size_in_px, |
| 74 int ideal_splash_image_size_in_px, | 75 int ideal_splash_image_size_in_px, |
| 75 int minimum_splash_image_size_in_px, | 76 int minimum_splash_image_size_in_px, |
| 77 int ideal_badge_size_in_px, | |
| 78 int minimum_badge_size_in_px, | |
| 76 bool check_webapk_compatible, | 79 bool check_webapk_compatible, |
| 77 Observer* observer); | 80 Observer* observer); |
| 78 | 81 |
| 79 // Returns a callback which fetches the splash screen image to be stored for | 82 // Returns a callback which fetches the splash screen image to be stored for |
| 80 // the webapp with the specified |id|. | 83 // the webapp with the specified |id|. |
| 81 base::Closure FetchSplashScreenImageCallback(const std::string& id); | 84 base::Closure FetchSplashScreenImageCallback(const std::string& id); |
| 82 | 85 |
| 83 // IPC message received when the initialization is finished. | 86 // IPC message received when the initialization is finished. |
| 84 void OnDidGetWebApplicationInfo(const WebApplicationInfo& web_app_info); | 87 void OnDidGetWebApplicationInfo(const WebApplicationInfo& web_app_info); |
| 85 | 88 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 // Creates the launcher icon from the given |raw_icon|. | 120 // Creates the launcher icon from the given |raw_icon|. |
| 118 void CreateLauncherIcon(const SkBitmap& raw_icon); | 121 void CreateLauncherIcon(const SkBitmap& raw_icon); |
| 119 void CreateLauncherIconInBackground(const SkBitmap& raw_icon); | 122 void CreateLauncherIconInBackground(const SkBitmap& raw_icon); |
| 120 | 123 |
| 121 // Notifies the observer that the shortcut data is all available. | 124 // Notifies the observer that the shortcut data is all available. |
| 122 void NotifyObserver(const SkBitmap& icon); | 125 void NotifyObserver(const SkBitmap& icon); |
| 123 | 126 |
| 124 Observer* weak_observer_; | 127 Observer* weak_observer_; |
| 125 | 128 |
| 126 // The icon must only be set on the UI thread for thread safety. | 129 // The icon must only be set on the UI thread for thread safety. |
| 127 SkBitmap shortcut_icon_; | 130 SkBitmap shortcut_icon_; |
|
dominickn
2017/02/02 19:16:50
primary_icon_?
badge_icon?
F
2017/02/02 21:05:51
Done.
dominickn
2017/02/02 21:17:11
I don't think we need the shortcut_ prefix here -
F
2017/02/02 22:30:42
Done.
| |
| 131 SkBitmap shortcut_badge_; | |
| 128 ShortcutInfo shortcut_info_; | 132 ShortcutInfo shortcut_info_; |
| 129 GURL splash_screen_url_; | 133 GURL splash_screen_url_; |
| 130 | 134 |
| 131 base::CancelableTaskTracker favicon_task_tracker_; | 135 base::CancelableTaskTracker favicon_task_tracker_; |
| 132 base::Timer data_timeout_timer_; | 136 base::Timer data_timeout_timer_; |
| 133 | 137 |
| 134 const int ideal_icon_size_in_px_; | 138 const int ideal_icon_size_in_px_; |
| 135 const int minimum_icon_size_in_px_; | 139 const int minimum_icon_size_in_px_; |
| 136 const int ideal_splash_image_size_in_px_; | 140 const int ideal_splash_image_size_in_px_; |
| 137 const int minimum_splash_image_size_in_px_; | 141 const int minimum_splash_image_size_in_px_; |
| 142 const int ideal_badge_size_in_px_; | |
|
dominickn
2017/02/02 19:16:50
These appear to always be set to the same value. C
F
2017/02/02 21:05:51
My understanding is that ShortcutHelper wraps the
dominickn
2017/02/02 21:17:11
If we're going to provide the same value for now,
F
2017/02/02 22:30:42
Done.
| |
| 143 const int minimum_badge_size_in_px_; | |
| 138 | 144 |
| 139 // Indicates whether to check WebAPK compatibility. | 145 // Indicates whether to check WebAPK compatibility. |
| 140 bool check_webapk_compatibility_; | 146 bool check_webapk_compatibility_; |
| 141 bool is_waiting_for_web_application_info_; | 147 bool is_waiting_for_web_application_info_; |
| 142 bool is_installable_check_complete_; | 148 bool is_installable_check_complete_; |
| 143 bool is_icon_saved_; | 149 bool is_icon_saved_; |
| 144 bool is_ready_; | 150 bool is_ready_; |
| 145 | 151 |
| 146 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); | 152 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); |
| 147 }; | 153 }; |
| 148 | 154 |
| 149 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ | 155 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ |
| OLD | NEW |