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 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h" | 5 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 shortcut_info_.manifest_url = data.manifest_url; | 165 shortcut_info_.manifest_url = data.manifest_url; |
166 } | 166 } |
167 | 167 |
168 // Save the splash screen URL for the later download. | 168 // Save the splash screen URL for the later download. |
169 splash_screen_url_ = ManifestIconSelector::FindBestMatchingIcon( | 169 splash_screen_url_ = ManifestIconSelector::FindBestMatchingIcon( |
170 data.manifest.icons, ideal_splash_image_size_in_dp_, | 170 data.manifest.icons, ideal_splash_image_size_in_dp_, |
171 minimum_splash_image_size_in_dp_); | 171 minimum_splash_image_size_in_dp_); |
172 | 172 |
173 weak_observer_->OnUserTitleAvailable(shortcut_info_.user_title); | 173 weak_observer_->OnUserTitleAvailable(shortcut_info_.user_title); |
174 | 174 |
175 if (data.icon && !data.icon->drawsNothing()) { | 175 if (data.icon) { |
176 // TODO(hanxi): implement WebAPK path if shortcut_info_.url has a secure | 176 // TODO(hanxi): implement WebAPK path if shortcut_info_.url has a secure |
177 // scheme and data.is_installable is true. | 177 // scheme and data.is_installable is true. |
178 shortcut_info_.icon_url = data.icon_url; | 178 shortcut_info_.icon_url = data.icon_url; |
179 | 179 |
180 // base::Bind copies the arguments internally, so it is safe to pass it | 180 // base::Bind copies the arguments internally, so it is safe to pass it |
181 // data.icon (which is not owned by us). | 181 // data.icon (which is not owned by us). |
182 content::BrowserThread::GetBlockingPool() | 182 content::BrowserThread::GetBlockingPool() |
183 ->PostWorkerTaskWithShutdownBehavior( | 183 ->PostWorkerTaskWithShutdownBehavior( |
184 FROM_HERE, | 184 FROM_HERE, |
185 base::Bind( | 185 base::Bind( |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& icon) { | 295 void AddToHomescreenDataFetcher::NotifyObserver(const SkBitmap& icon) { |
296 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 296 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
297 if (!web_contents() || !weak_observer_ || is_icon_saved_) | 297 if (!web_contents() || !weak_observer_ || is_icon_saved_) |
298 return; | 298 return; |
299 | 299 |
300 is_icon_saved_ = true; | 300 is_icon_saved_ = true; |
301 shortcut_icon_ = icon; | 301 shortcut_icon_ = icon; |
302 is_ready_ = true; | 302 is_ready_ = true; |
303 weak_observer_->OnDataAvailable(shortcut_info_, shortcut_icon_); | 303 weak_observer_->OnDataAvailable(shortcut_info_, shortcut_icon_); |
304 } | 304 } |
OLD | NEW |