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

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

Issue 409883006: GCM: D-Bus methods for wake-on-packet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/default_gcm_app_handler.h" 5 #include "components/gcm_driver/default_gcm_app_handler.h"
6 6
7 #include "base/callback.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chromeos/dbus/dbus_thread_manager.h"
10 #include "chromeos/dbus/shill_manager_client.h"
8 #include "net/base/ip_endpoint.h" 11 #include "net/base/ip_endpoint.h"
9 12
10 namespace gcm { 13 namespace gcm {
11 14
12 DefaultGCMAppHandler::DefaultGCMAppHandler() { 15 DefaultGCMAppHandler::DefaultGCMAppHandler() {
13 } 16 }
14 17
15 DefaultGCMAppHandler::~DefaultGCMAppHandler() { 18 DefaultGCMAppHandler::~DefaultGCMAppHandler() {
16 } 19 }
17 20
(...skipping 12 matching lines...) Expand all
30 << app_id; 33 << app_id;
31 } 34 }
32 35
33 void DefaultGCMAppHandler::OnSendError( 36 void DefaultGCMAppHandler::OnSendError(
34 const std::string& app_id, 37 const std::string& app_id,
35 const GCMClient::SendErrorDetails& send_error_details) { 38 const GCMClient::SendErrorDetails& send_error_details) {
36 LOG(ERROR) << "No app handler is found to route send error message for " 39 LOG(ERROR) << "No app handler is found to route send error message for "
37 << app_id; 40 << app_id;
38 } 41 }
39 42
43 // static
44 void DefaultGCMAppHandler::NullCallback(const std::string& result) {
45 }
46
47 // static
48 void DefaultGCMAppHandler::ErrorCallback(
49 const std::string& error_name,
50 const std::string& error) {
51 LOG(ERROR) << "GCM D-Bus method error " << error_name << ": " << error;
52 }
53
40 void DefaultGCMAppHandler::OnConnected(const net::IPEndPoint& ip_endpoint) { 54 void DefaultGCMAppHandler::OnConnected(const net::IPEndPoint& ip_endpoint) {
41 // TODO(semenzato): update CrOS NIC state. 55 const std::string ip_endpoint_string = ip_endpoint.ToString();
42 DVLOG(1) << "GCM connected to " << ip_endpoint.ToString(); 56 LOG(ERROR) << "GCM connected to " << ip_endpoint_string;
Daniel Erat 2014/07/22 20:32:01 don't forget to change this back
57
58 chromeos::DBusThreadManager::Get()->
59 GetShillManagerClient()->
60 AddWakeOnPacketConnection(
61 ip_endpoint_string,
62 base::Bind(&base::DoNothing),
63 base::Bind(&DefaultGCMAppHandler::ErrorCallback));
43 } 64 }
44 65
45 void DefaultGCMAppHandler::OnDisconnected() { 66 void DefaultGCMAppHandler::OnDisconnected() {
46 // TODO(semenzato): update CrOS NIC state. 67 LOG(ERROR) << "GCM disconnected";
Daniel Erat 2014/07/22 20:32:01 or this
47 DVLOG(1) << "GCM disconnected";
48 } 68 }
49 69
50 } // namespace gcm 70 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698