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/strings/grit/ash_strings.h" | 7 #include "ash/strings/grit/ash_strings.h" |
8 #include "ash/system/system_notifier.h" | 8 #include "ash/system/system_notifier.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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 const char HatsNotificationController::kGoogleIcon2xUrl[] = | 107 const char HatsNotificationController::kGoogleIcon2xUrl[] = |
108 "https://www.gstatic.com/images/branding/product/2x/googleg_48dp.png"; | 108 "https://www.gstatic.com/images/branding/product/2x/googleg_48dp.png"; |
109 | 109 |
110 HatsNotificationController::HatsNotificationController( | 110 HatsNotificationController::HatsNotificationController( |
111 Profile* profile, | 111 Profile* profile, |
112 image_fetcher::ImageFetcher* image_fetcher) | 112 image_fetcher::ImageFetcher* image_fetcher) |
113 : profile_(profile), | 113 : profile_(profile), |
114 image_fetcher_(image_fetcher), | 114 image_fetcher_(image_fetcher), |
115 weak_pointer_factory_(this) { | 115 weak_pointer_factory_(this) { |
116 base::PostTaskWithTraitsAndReplyWithResult( | 116 base::PostTaskWithTraitsAndReplyWithResult( |
117 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 117 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
118 base::TaskPriority::BACKGROUND), | |
119 base::Bind(&IsNewDevice, kHatsNewDeviceThresholdDays), | 118 base::Bind(&IsNewDevice, kHatsNewDeviceThresholdDays), |
120 base::Bind(&HatsNotificationController::Initialize, | 119 base::Bind(&HatsNotificationController::Initialize, |
121 weak_pointer_factory_.GetWeakPtr())); | 120 weak_pointer_factory_.GetWeakPtr())); |
122 } | 121 } |
123 | 122 |
124 HatsNotificationController::~HatsNotificationController() { | 123 HatsNotificationController::~HatsNotificationController() { |
125 if (network_portal_detector::IsInitialized()) | 124 if (network_portal_detector::IsInitialized()) |
126 network_portal_detector::GetInstance()->RemoveObserver(this); | 125 network_portal_detector::GetInstance()->RemoveObserver(this); |
127 } | 126 } |
128 | 127 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 GURL(kNotificationOriginUrl), kNotificationId, optional, this); | 283 GURL(kNotificationOriginUrl), kNotificationId, optional, this); |
285 } | 284 } |
286 | 285 |
287 void HatsNotificationController::UpdateLastInteractionTime() { | 286 void HatsNotificationController::UpdateLastInteractionTime() { |
288 PrefService* pref_service = profile_->GetPrefs(); | 287 PrefService* pref_service = profile_->GetPrefs(); |
289 pref_service->SetInt64(prefs::kHatsLastInteractionTimestamp, | 288 pref_service->SetInt64(prefs::kHatsLastInteractionTimestamp, |
290 base::Time::Now().ToInternalValue()); | 289 base::Time::Now().ToInternalValue()); |
291 } | 290 } |
292 | 291 |
293 } // namespace chromeos | 292 } // namespace chromeos |
OLD | NEW |