Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: components/gcm_driver/gcm_driver_desktop.cc

Issue 653843003: [GCM] Start GCMChannelStatusSyncer when GCM is disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix to poll interval switch Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 base::Unretained(io_worker_.get()), 634 base::Unretained(io_worker_.get()),
635 account_tokens)); 635 account_tokens));
636 } 636 }
637 637
638 GCMClient::Result GCMDriverDesktop::EnsureStarted() { 638 GCMClient::Result GCMDriverDesktop::EnsureStarted() {
639 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); 639 DCHECK(ui_thread_->RunsTasksOnCurrentThread());
640 640
641 if (gcm_started_) 641 if (gcm_started_)
642 return GCMClient::SUCCESS; 642 return GCMClient::SUCCESS;
643 643
644 if (!gcm_enabled_) 644 if (!gcm_enabled_) {
645 // Poll for channel status in order to find out when it is re-enabled when
646 // GCM is currently disabled.
647 if (GCMDriver::IsAllowedForAllUsers())
648 gcm_channel_status_syncer_->EnsureStarted();
649
645 return GCMClient::GCM_DISABLED; 650 return GCMClient::GCM_DISABLED;
651 }
646 652
647 // Have any app requested the service? 653 // Have any app requested the service?
648 if (app_handlers().empty()) 654 if (app_handlers().empty())
649 return GCMClient::UNKNOWN_ERROR; 655 return GCMClient::UNKNOWN_ERROR;
650 656
651 // TODO(jianli): To be removed when sign-in enforcement is dropped. 657 // TODO(jianli): To be removed when sign-in enforcement is dropped.
652 if (!signed_in_ && !GCMDriver::IsAllowedForAllUsers()) 658 if (!signed_in_ && !GCMDriver::IsAllowedForAllUsers())
653 return GCMClient::NOT_SIGNED_IN; 659 return GCMClient::NOT_SIGNED_IN;
654 660
655 DCHECK(!delayed_task_controller_); 661 DCHECK(!delayed_task_controller_);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 776
771 // Normally request_gcm_statistics_callback_ would not be null. 777 // Normally request_gcm_statistics_callback_ would not be null.
772 if (!request_gcm_statistics_callback_.is_null()) 778 if (!request_gcm_statistics_callback_.is_null())
773 request_gcm_statistics_callback_.Run(stats); 779 request_gcm_statistics_callback_.Run(stats);
774 else 780 else
775 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL."; 781 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL.";
776 } 782 }
777 783
778 } // namespace gcm 784 } // namespace gcm
779 785
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698