OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/service/cloud_print/cloud_print_proxy_backend.h" | 5 #include "chrome/service/cloud_print/cloud_print_proxy_backend.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 const std::string& robot_email); | 58 const std::string& robot_email); |
59 | 59 |
60 // Called on the CloudPrintProxyBackend core_thread_ to perform | 60 // Called on the CloudPrintProxyBackend core_thread_ to perform |
61 // shutdown. | 61 // shutdown. |
62 void DoShutdown(); | 62 void DoShutdown(); |
63 void DoRegisterSelectedPrinters( | 63 void DoRegisterSelectedPrinters( |
64 const printing::PrinterList& printer_list); | 64 const printing::PrinterList& printer_list); |
65 void DoUnregisterPrinters(); | 65 void DoUnregisterPrinters(); |
66 | 66 |
67 // CloudPrintAuth::Client implementation. | 67 // CloudPrintAuth::Client implementation. |
68 virtual void OnAuthenticationComplete( | 68 void OnAuthenticationComplete(const std::string& access_token, |
69 const std::string& access_token, | 69 const std::string& robot_oauth_refresh_token, |
70 const std::string& robot_oauth_refresh_token, | 70 const std::string& robot_email, |
71 const std::string& robot_email, | 71 const std::string& user_email) override; |
72 const std::string& user_email) override; | 72 void OnInvalidCredentials() override; |
73 virtual void OnInvalidCredentials() override; | |
74 | 73 |
75 // CloudPrintConnector::Client implementation. | 74 // CloudPrintConnector::Client implementation. |
76 virtual void OnAuthFailed() override; | 75 void OnAuthFailed() override; |
77 virtual void OnXmppPingUpdated(int ping_timeout) override; | 76 void OnXmppPingUpdated(int ping_timeout) override; |
78 | 77 |
79 // notifier::PushClientObserver implementation. | 78 // notifier::PushClientObserver implementation. |
80 virtual void OnNotificationsEnabled() override; | 79 void OnNotificationsEnabled() override; |
81 virtual void OnNotificationsDisabled( | 80 void OnNotificationsDisabled( |
82 notifier::NotificationsDisabledReason reason) override; | 81 notifier::NotificationsDisabledReason reason) override; |
83 virtual void OnIncomingNotification( | 82 void OnIncomingNotification( |
84 const notifier::Notification& notification) override; | 83 const notifier::Notification& notification) override; |
85 virtual void OnPingResponse() override; | 84 void OnPingResponse() override; |
86 | 85 |
87 private: | 86 private: |
88 friend class base::RefCountedThreadSafe<Core>; | 87 friend class base::RefCountedThreadSafe<Core>; |
89 | 88 |
90 virtual ~Core() {} | 89 ~Core() override {} |
91 | 90 |
92 void CreateAuthAndConnector(); | 91 void CreateAuthAndConnector(); |
93 void DestroyAuthAndConnector(); | 92 void DestroyAuthAndConnector(); |
94 | 93 |
95 // NotifyXXX is how the Core communicates with the frontend across | 94 // NotifyXXX is how the Core communicates with the frontend across |
96 // threads. | 95 // threads. |
97 void NotifyPrinterListAvailable( | 96 void NotifyPrinterListAvailable( |
98 const printing::PrinterList& printer_list); | 97 const printing::PrinterList& printer_list); |
99 void NotifyAuthenticated( | 98 void NotifyAuthenticated( |
100 const std::string& robot_oauth_refresh_token, | 99 const std::string& robot_oauth_refresh_token, |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 HandlePrinterNotification(notification.data); | 556 HandlePrinterNotification(notification.data); |
558 } | 557 } |
559 | 558 |
560 void CloudPrintProxyBackend::Core::OnPingResponse() { | 559 void CloudPrintProxyBackend::Core::OnPingResponse() { |
561 UMA_HISTOGRAM_COUNTS_100("CloudPrint.XmppPingTry", pending_xmpp_pings_); | 560 UMA_HISTOGRAM_COUNTS_100("CloudPrint.XmppPingTry", pending_xmpp_pings_); |
562 pending_xmpp_pings_ = 0; | 561 pending_xmpp_pings_ = 0; |
563 VLOG(1) << "CP_CONNECTOR: Ping response received."; | 562 VLOG(1) << "CP_CONNECTOR: Ping response received."; |
564 } | 563 } |
565 | 564 |
566 } // namespace cloud_print | 565 } // namespace cloud_print |
OLD | NEW |