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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 // IPC message received when the initialization is finished. | 83 // IPC message received when the initialization is finished. |
84 void OnDidGetWebApplicationInfo(const WebApplicationInfo& web_app_info); | 84 void OnDidGetWebApplicationInfo(const WebApplicationInfo& web_app_info); |
85 | 85 |
86 // Accessors, etc. | 86 // Accessors, etc. |
87 void set_weak_observer(Observer* observer) { weak_observer_ = observer; } | 87 void set_weak_observer(Observer* observer) { weak_observer_ = observer; } |
88 bool is_ready() const { return is_ready_; } | 88 bool is_ready() const { return is_ready_; } |
89 ShortcutInfo& shortcut_info() { return shortcut_info_; } | 89 ShortcutInfo& shortcut_info() { return shortcut_info_; } |
90 const SkBitmap& shortcut_icon() const { return shortcut_icon_; } | 90 const SkBitmap& shortcut_icon() const { return shortcut_icon_; } |
91 | 91 |
92 // WebContentsObserver | |
93 bool OnMessageReceived(const IPC::Message& message) override; | |
94 | |
95 private: | 92 private: |
96 friend class base::RefCounted<AddToHomescreenDataFetcher>; | 93 friend class base::RefCounted<AddToHomescreenDataFetcher>; |
97 | 94 |
98 ~AddToHomescreenDataFetcher() override; | 95 ~AddToHomescreenDataFetcher() override; |
99 | 96 |
| 97 // WebContentsObserver |
| 98 bool OnMessageReceived(const IPC::Message& message) override; |
| 99 |
| 100 // Called when InstallableManager finishes looking for a manifest and icon. |
| 101 void OnDidPerformInstallableCheck(const InstallableData& data); |
| 102 |
100 // Grabs the favicon for the current URL. | 103 // Grabs the favicon for the current URL. |
101 void FetchFavicon(); | 104 void FetchFavicon(); |
102 void OnFaviconFetched( | 105 void OnFaviconFetched( |
103 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 106 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
104 | 107 |
105 // Creates the launcher icon from the given bitmap. shortcut_info_.url is | 108 // Creates the launcher icon from the given bitmap. shortcut_info_.url is |
106 // used to generate an icon if there is no bitmap in |bitmap_result| or the | 109 // used to generate an icon if there is no bitmap in |bitmap_result| or the |
107 // bitmap is not large enough. | 110 // bitmap is not large enough. |
108 void CreateLauncherIconFromFaviconInBackground( | 111 void CreateLauncherIconFromFaviconInBackground( |
109 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 112 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
110 | 113 |
111 // Called when InstallableManager finishes looking for a manifest and icon. | |
112 void OnDidPerformInstallableCheck(const InstallableData& data); | |
113 | |
114 // Creates the launcher icon from the given |icon|. | 114 // Creates the launcher icon from the given |icon|. |
115 void CreateLauncherIconInBackground(const SkBitmap& raw__icon); | 115 void CreateLauncherIconInBackground(const SkBitmap& raw__icon); |
116 | 116 |
117 // Notifies the observer that the shortcut data is all available. | 117 // Notifies the observer that the shortcut data is all available. |
118 void NotifyObserver(const SkBitmap& icon); | 118 void NotifyObserver(const SkBitmap& icon); |
119 | 119 |
120 Observer* weak_observer_; | 120 Observer* weak_observer_; |
121 | 121 |
122 // The icon must only be set on the UI thread for thread safety. | 122 // The icon must only be set on the UI thread for thread safety. |
123 SkBitmap shortcut_icon_; | 123 SkBitmap shortcut_icon_; |
(...skipping 12 matching lines...) Expand all Loading... |
136 bool check_installable_; | 136 bool check_installable_; |
137 bool is_waiting_for_installable_check_; | 137 bool is_waiting_for_installable_check_; |
138 bool is_waiting_for_web_application_info_; | 138 bool is_waiting_for_web_application_info_; |
139 bool is_icon_saved_; | 139 bool is_icon_saved_; |
140 bool is_ready_; | 140 bool is_ready_; |
141 | 141 |
142 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); | 142 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcher); |
143 }; | 143 }; |
144 | 144 |
145 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ | 145 #endif // CHROME_BROWSER_ANDROID_WEBAPPS_ADD_TO_HOMESCREEN_DATA_FETCHER_H_ |
OLD | NEW |