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

Side by Side Diff: sync/notifier/gcm_network_channel.h

Issue 270873002: Extract GCMClient data types into separate gcm_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reupload Created 6 years, 7 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
« no previous file with comments | « google_apis/gcm/public/gcm_types.cc ('k') | sync/notifier/gcm_network_channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_H_ 5 #ifndef SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_H_
6 #define SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_H_ 6 #define SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 15 matching lines...) Expand all
26 26
27 // POD with copy of some statuses for debugging purposes. 27 // POD with copy of some statuses for debugging purposes.
28 struct GCMNetworkChannelDiagnostic { 28 struct GCMNetworkChannelDiagnostic {
29 explicit GCMNetworkChannelDiagnostic(GCMNetworkChannel* parent); 29 explicit GCMNetworkChannelDiagnostic(GCMNetworkChannel* parent);
30 30
31 // Collect all the internal variables in a single readable dictionary. 31 // Collect all the internal variables in a single readable dictionary.
32 scoped_ptr<base::DictionaryValue> CollectDebugData() const; 32 scoped_ptr<base::DictionaryValue> CollectDebugData() const;
33 33
34 // TODO(pavely): Move this toString to a more appropiate place in GCMClient. 34 // TODO(pavely): Move this toString to a more appropiate place in GCMClient.
35 std::string GCMClientResultToString( 35 std::string GCMClientResultToString(
36 const gcm::GCMClient::Result result) const; 36 const gcm::Result result) const;
37 37
38 GCMNetworkChannel* parent_; 38 GCMNetworkChannel* parent_;
39 bool last_message_empty_echo_token_; 39 bool last_message_empty_echo_token_;
40 base::Time last_message_received_time_; 40 base::Time last_message_received_time_;
41 int last_post_response_code_; 41 int last_post_response_code_;
42 std::string registration_id_; 42 std::string registration_id_;
43 gcm::GCMClient::Result registration_result_; 43 gcm::Result registration_result_;
44 int sent_messages_count_; 44 int sent_messages_count_;
45 }; 45 };
46 46
47 // GCMNetworkChannel is an implementation of SyncNetworkChannel that routes 47 // GCMNetworkChannel is an implementation of SyncNetworkChannel that routes
48 // messages through GCMService. 48 // messages through GCMService.
49 class SYNC_EXPORT_PRIVATE GCMNetworkChannel 49 class SYNC_EXPORT_PRIVATE GCMNetworkChannel
50 : public SyncNetworkChannel, 50 : public SyncNetworkChannel,
51 public net::URLFetcherDelegate, 51 public net::URLFetcherDelegate,
52 public net::NetworkChangeNotifier::NetworkChangeObserver, 52 public net::NetworkChangeNotifier::NetworkChangeObserver,
53 public base::NonThreadSafe { 53 public base::NonThreadSafe {
(...skipping 26 matching lines...) Expand all
80 protected: 80 protected:
81 void ResetRegisterBackoffEntryForTest( 81 void ResetRegisterBackoffEntryForTest(
82 const net::BackoffEntry::Policy* policy); 82 const net::BackoffEntry::Policy* policy);
83 83
84 virtual GURL BuildUrl(const std::string& registration_id); 84 virtual GURL BuildUrl(const std::string& registration_id);
85 85
86 private: 86 private:
87 friend class GCMNetworkChannelTest; 87 friend class GCMNetworkChannelTest;
88 void Register(); 88 void Register();
89 void OnRegisterComplete(const std::string& registration_id, 89 void OnRegisterComplete(const std::string& registration_id,
90 gcm::GCMClient::Result result); 90 gcm::Result result);
91 void RequestAccessToken(); 91 void RequestAccessToken();
92 void OnGetTokenComplete(const GoogleServiceAuthError& error, 92 void OnGetTokenComplete(const GoogleServiceAuthError& error,
93 const std::string& token); 93 const std::string& token);
94 void OnIncomingMessage(const std::string& message, 94 void OnIncomingMessage(const std::string& message,
95 const std::string& echo_token); 95 const std::string& echo_token);
96 96
97 // Base64 encoding/decoding with URL safe alphabet. 97 // Base64 encoding/decoding with URL safe alphabet.
98 // http://tools.ietf.org/html/rfc4648#page-7 98 // http://tools.ietf.org/html/rfc4648#page-7
99 static void Base64EncodeURLSafe(const std::string& input, 99 static void Base64EncodeURLSafe(const std::string& input,
100 std::string* output); 100 std::string* output);
(...skipping 25 matching lines...) Expand all
126 GCMNetworkChannelDiagnostic diagnostic_info_; 126 GCMNetworkChannelDiagnostic diagnostic_info_;
127 127
128 base::WeakPtrFactory<GCMNetworkChannel> weak_factory_; 128 base::WeakPtrFactory<GCMNetworkChannel> weak_factory_;
129 129
130 DISALLOW_COPY_AND_ASSIGN(GCMNetworkChannel); 130 DISALLOW_COPY_AND_ASSIGN(GCMNetworkChannel);
131 }; 131 };
132 132
133 } // namespace syncer 133 } // namespace syncer
134 134
135 #endif // SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_H_ 135 #endif // SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_H_
OLDNEW
« no previous file with comments | « google_apis/gcm/public/gcm_types.cc ('k') | sync/notifier/gcm_network_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698