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" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/metrics/histogram.h" |
14 #include "base/sequenced_task_runner.h" | 15 #include "base/sequenced_task_runner.h" |
15 #include "base/threading/sequenced_worker_pool.h" | 16 #include "base/threading/sequenced_worker_pool.h" |
16 #include "components/gcm_driver/gcm_app_handler.h" | 17 #include "components/gcm_driver/gcm_app_handler.h" |
17 #include "components/gcm_driver/gcm_channel_status_syncer.h" | 18 #include "components/gcm_driver/gcm_channel_status_syncer.h" |
18 #include "components/gcm_driver/gcm_client_factory.h" | 19 #include "components/gcm_driver/gcm_client_factory.h" |
19 #include "components/gcm_driver/gcm_delayed_task_controller.h" | 20 #include "components/gcm_driver/gcm_delayed_task_controller.h" |
20 #include "components/gcm_driver/system_encryptor.h" | 21 #include "components/gcm_driver/system_encryptor.h" |
21 #include "google_apis/gcm/engine/account_mapping.h" | 22 #include "google_apis/gcm/engine/account_mapping.h" |
22 #include "net/base/ip_endpoint.h" | 23 #include "net/base/ip_endpoint.h" |
23 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 return GCMClient::NOT_SIGNED_IN; | 643 return GCMClient::NOT_SIGNED_IN; |
643 | 644 |
644 DCHECK(!delayed_task_controller_); | 645 DCHECK(!delayed_task_controller_); |
645 delayed_task_controller_.reset(new GCMDelayedTaskController); | 646 delayed_task_controller_.reset(new GCMDelayedTaskController); |
646 | 647 |
647 // Polling for channel status is only needed when GCM is supported for all | 648 // Polling for channel status is only needed when GCM is supported for all |
648 // users. | 649 // users. |
649 if (GCMDriver::IsAllowedForAllUsers()) | 650 if (GCMDriver::IsAllowedForAllUsers()) |
650 gcm_channel_status_syncer_->EnsureStarted(); | 651 gcm_channel_status_syncer_->EnsureStarted(); |
651 | 652 |
| 653 UMA_HISTOGRAM_BOOLEAN("GCM.UserSignedIn", signed_in_); |
| 654 |
652 // Note that we need to pass weak pointer again since the existing weak | 655 // Note that we need to pass weak pointer again since the existing weak |
653 // pointer in IOWorker might have been invalidated when check-out occurs. | 656 // pointer in IOWorker might have been invalidated when check-out occurs. |
654 io_thread_->PostTask( | 657 io_thread_->PostTask( |
655 FROM_HERE, | 658 FROM_HERE, |
656 base::Bind(&GCMDriverDesktop::IOWorker::Start, | 659 base::Bind(&GCMDriverDesktop::IOWorker::Start, |
657 base::Unretained(io_worker_.get()), | 660 base::Unretained(io_worker_.get()), |
658 weak_ptr_factory_.GetWeakPtr())); | 661 weak_ptr_factory_.GetWeakPtr())); |
659 | 662 |
660 gcm_started_ = true; | 663 gcm_started_ = true; |
661 return GCMClient::SUCCESS; | 664 return GCMClient::SUCCESS; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 | 760 |
758 // Normally request_gcm_statistics_callback_ would not be null. | 761 // Normally request_gcm_statistics_callback_ would not be null. |
759 if (!request_gcm_statistics_callback_.is_null()) | 762 if (!request_gcm_statistics_callback_.is_null()) |
760 request_gcm_statistics_callback_.Run(stats); | 763 request_gcm_statistics_callback_.Run(stats); |
761 else | 764 else |
762 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL."; | 765 LOG(WARNING) << "request_gcm_statistics_callback_ is NULL."; |
763 } | 766 } |
764 | 767 |
765 } // namespace gcm | 768 } // namespace gcm |
766 | 769 |
OLD | NEW |