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 "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 | 173 |
174 return true; | 174 return true; |
175 } | 175 } |
176 | 176 |
177 // NotificationDelegate override: | 177 // NotificationDelegate override: |
178 std::string HatsNotificationController::id() const { | 178 std::string HatsNotificationController::id() const { |
179 return kDelegateId; | 179 return kDelegateId; |
180 } | 180 } |
181 | 181 |
182 // message_center::NotificationDelegate override: | 182 // message_center::NotificationDelegate override: |
183 void HatsNotificationController::Click() { | |
184 ButtonClick(0 /* This argument is no-op in the function. */); | |
stevenjb
2016/08/30 15:39:16
nit: ButtonClick(0 /* unused */);
malaykeshav
2016/08/30 18:10:30
done
| |
185 } | |
186 | |
187 // message_center::NotificationDelegate override: | |
183 void HatsNotificationController::ButtonClick(int button_index) { | 188 void HatsNotificationController::ButtonClick(int button_index) { |
stevenjb
2016/08/30 15:39:16
nit: int /* button_index */
malaykeshav
2016/08/30 18:10:30
done
| |
184 UpdateLastInteractionTime(); | 189 UpdateLastInteractionTime(); |
185 | 190 |
186 // The dialog deletes itslef on close. | 191 // The dialog deletes itslef on close. |
187 HatsDialog::CreateAndShow(IsGoogleUser(profile_->GetProfileUserName())); | 192 HatsDialog::CreateAndShow(IsGoogleUser(profile_->GetProfileUserName())); |
188 | 193 |
189 // Remove the notification. | 194 // Remove the notification. |
190 g_browser_process->notification_ui_manager()->CancelById( | 195 g_browser_process->notification_ui_manager()->CancelById( |
191 id(), NotificationUIManager::GetProfileID(profile_)); | 196 id(), NotificationUIManager::GetProfileID(profile_)); |
192 } | 197 } |
193 | 198 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 GURL(kNotificationOriginUrl), kNotificationId, optional, this); | 273 GURL(kNotificationOriginUrl), kNotificationId, optional, this); |
269 } | 274 } |
270 | 275 |
271 void HatsNotificationController::UpdateLastInteractionTime() { | 276 void HatsNotificationController::UpdateLastInteractionTime() { |
272 PrefService* pref_service = profile_->GetPrefs(); | 277 PrefService* pref_service = profile_->GetPrefs(); |
273 pref_service->SetInt64(prefs::kHatsLastInteractionTimestamp, | 278 pref_service->SetInt64(prefs::kHatsLastInteractionTimestamp, |
274 base::Time::Now().ToInternalValue()); | 279 base::Time::Now().ToInternalValue()); |
275 } | 280 } |
276 | 281 |
277 } // namespace chromeos | 282 } // namespace chromeos |
OLD | NEW |