OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/chromeos/hats/hats_notification_controller.h" | 5 #include "chrome/browser/chromeos/hats/hats_notification_controller.h" |
6 | 6 |
7 #include "ash/common/system/system_notifier.h" | 7 #include "ash/common/system/system_notifier.h" |
8 #include "ash/strings/grit/ash_strings.h" | 8 #include "ash/strings/grit/ash_strings.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 image_fetcher_->StartOrQueueNetworkRequest( | 235 image_fetcher_->StartOrQueueNetworkRequest( |
236 kImageFetcher1xId, GURL(kGoogleIcon1xUrl), | 236 kImageFetcher1xId, GURL(kGoogleIcon1xUrl), |
237 base::Bind(&HatsNotificationController::OnImageFetched, | 237 base::Bind(&HatsNotificationController::OnImageFetched, |
238 weak_pointer_factory_.GetWeakPtr())); | 238 weak_pointer_factory_.GetWeakPtr())); |
239 image_fetcher_->StartOrQueueNetworkRequest( | 239 image_fetcher_->StartOrQueueNetworkRequest( |
240 kImageFetcher2xId, GURL(kGoogleIcon2xUrl), | 240 kImageFetcher2xId, GURL(kGoogleIcon2xUrl), |
241 base::Bind(&HatsNotificationController::OnImageFetched, | 241 base::Bind(&HatsNotificationController::OnImageFetched, |
242 weak_pointer_factory_.GetWeakPtr())); | 242 weak_pointer_factory_.GetWeakPtr())); |
243 } | 243 } |
244 | 244 |
245 void HatsNotificationController::OnImageFetched(const std::string& id, | 245 void HatsNotificationController::OnImageFetched( |
246 const gfx::Image& image) { | 246 const std::string& id, |
| 247 const gfx::Image& image, |
| 248 const image_fetcher::RequestMetadata& metadata) { |
247 DCHECK(id == kImageFetcher1xId || id == kImageFetcher2xId); | 249 DCHECK(id == kImageFetcher1xId || id == kImageFetcher2xId); |
248 | 250 |
249 completed_requests_++; | 251 completed_requests_++; |
250 if (!image.IsEmpty()) { | 252 if (!image.IsEmpty()) { |
251 float scale = id == kImageFetcher1xId ? kScale_1x : kScale_2x; | 253 float scale = id == kImageFetcher1xId ? kScale_1x : kScale_2x; |
252 icon_.AddRepresentation(gfx::ImageSkiaRep(image.AsBitmap(), scale)); | 254 icon_.AddRepresentation(gfx::ImageSkiaRep(image.AsBitmap(), scale)); |
253 } | 255 } |
254 | 256 |
255 // Wait for both image fetcher requests to complete. | 257 // Wait for both image fetcher requests to complete. |
256 if (completed_requests_ < 2) | 258 if (completed_requests_ < 2) |
(...skipping 25 matching lines...) Expand all Loading... |
282 GURL(kNotificationOriginUrl), kNotificationId, optional, this); | 284 GURL(kNotificationOriginUrl), kNotificationId, optional, this); |
283 } | 285 } |
284 | 286 |
285 void HatsNotificationController::UpdateLastInteractionTime() { | 287 void HatsNotificationController::UpdateLastInteractionTime() { |
286 PrefService* pref_service = profile_->GetPrefs(); | 288 PrefService* pref_service = profile_->GetPrefs(); |
287 pref_service->SetInt64(prefs::kHatsLastInteractionTimestamp, | 289 pref_service->SetInt64(prefs::kHatsLastInteractionTimestamp, |
288 base::Time::Now().ToInternalValue()); | 290 base::Time::Now().ToInternalValue()); |
289 } | 291 } |
290 | 292 |
291 } // namespace chromeos | 293 } // namespace chromeos |
OLD | NEW |