Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/gcm_driver/gcm_driver_desktop.h" | 5 #include "components/gcm_driver/gcm_driver_desktop.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); | 362 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); |
| 363 GCMDriver::Shutdown(); | 363 GCMDriver::Shutdown(); |
| 364 io_thread_->DeleteSoon(FROM_HERE, io_worker_.release()); | 364 io_thread_->DeleteSoon(FROM_HERE, io_worker_.release()); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void GCMDriverDesktop::OnSignedIn() { | 367 void GCMDriverDesktop::OnSignedIn() { |
| 368 signed_in_ = true; | 368 signed_in_ = true; |
| 369 EnsureStarted(); | 369 EnsureStarted(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void GCMDriverDesktop::OnSignedOut() { | |
| 373 signed_in_ = false; | |
| 374 Purge(); | |
| 375 } | |
| 376 | |
| 372 void GCMDriverDesktop::Purge() { | 377 void GCMDriverDesktop::Purge() { |
| 373 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); | 378 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); |
| 374 | 379 |
| 375 // We still proceed with the check-out logic even if the check-in is not | 380 // We still proceed with the check-out logic even if the check-in is not |
| 376 // initiated in the current session. This will make sure that all the | 381 // initiated in the current session. This will make sure that all the |
| 377 // persisted data written previously will get purged. | 382 // persisted data written previously will get purged. |
| 378 signed_in_ = false; | |
| 379 RemoveCachedData(); | 383 RemoveCachedData(); |
|
fgorski
2014/09/12 20:15:53
this causes a wipe of Device ID, right?
Please lo
jianli
2014/09/12 22:13:10
Removed the confusing comment here. Also updated O
| |
| 380 | 384 |
| 381 io_thread_->PostTask(FROM_HERE, | 385 io_thread_->PostTask(FROM_HERE, |
| 382 base::Bind(&GCMDriverDesktop::IOWorker::CheckOut, | 386 base::Bind(&GCMDriverDesktop::IOWorker::CheckOut, |
| 383 base::Unretained(io_worker_.get()))); | 387 base::Unretained(io_worker_.get()))); |
| 384 } | 388 } |
| 385 | 389 |
| 386 void GCMDriverDesktop::AddAppHandler(const std::string& app_id, | 390 void GCMDriverDesktop::AddAppHandler(const std::string& app_id, |
| 387 GCMAppHandler* handler) { | 391 GCMAppHandler* handler) { |
| 388 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); | 392 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); |
| 389 GCMDriver::AddAppHandler(app_id, handler); | 393 GCMDriver::AddAppHandler(app_id, handler); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 | 734 |
| 731 // Normally request_gcm_statistics_callback_ would not be null. | 735 // Normally request_gcm_statistics_callback_ would not be null. |
| 732 if (!request_gcm_statistics_callback_.is_null()) | 736 if (!request_gcm_statistics_callback_.is_null()) |
| 733 request_gcm_statistics_callback_.Run(stats); | 737 request_gcm_statistics_callback_.Run(stats); |
| 734 else | 738 else |
| 735 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL."; | 739 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL."; |
| 736 } | 740 } |
| 737 | 741 |
| 738 } // namespace gcm | 742 } // namespace gcm |
| 739 | 743 |
| OLD | NEW |