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

Side by Side Diff: google_apis/gcm/gcm_client_impl.h

Issue 202083005: Add activity recording capability to gcm internals page. User can refresh, start/stop recording, an… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address all code reviews. Created 6 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ 5 #ifndef GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_
6 #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ 6 #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "google_apis/gcm/base/mcs_message.h" 16 #include "google_apis/gcm/base/mcs_message.h"
17 #include "google_apis/gcm/engine/gcm_store.h" 17 #include "google_apis/gcm/engine/gcm_store.h"
18 #include "google_apis/gcm/engine/mcs_client.h" 18 #include "google_apis/gcm/engine/mcs_client.h"
19 #include "google_apis/gcm/engine/registration_request.h" 19 #include "google_apis/gcm/engine/registration_request.h"
20 #include "google_apis/gcm/gcm_client.h" 20 #include "google_apis/gcm/gcm_client.h"
21 #include "google_apis/gcm/gcm_stats_recorder.h"
21 #include "google_apis/gcm/protocol/android_checkin.pb.h" 22 #include "google_apis/gcm/protocol/android_checkin.pb.h"
22 #include "net/base/net_log.h" 23 #include "net/base/net_log.h"
23 #include "net/url_request/url_request_context_getter.h" 24 #include "net/url_request/url_request_context_getter.h"
24 25
25 namespace base { 26 namespace base {
26 class Clock; 27 class Clock;
27 } // namespace base 28 } // namespace base
28 29
29 namespace net { 30 namespace net {
30 class HttpNetworkSession; 31 class HttpNetworkSession;
(...skipping 26 matching lines...) Expand all
57 Delegate* delegate) OVERRIDE; 58 Delegate* delegate) OVERRIDE;
58 virtual void Load() OVERRIDE; 59 virtual void Load() OVERRIDE;
59 virtual void Stop() OVERRIDE; 60 virtual void Stop() OVERRIDE;
60 virtual void CheckOut() OVERRIDE; 61 virtual void CheckOut() OVERRIDE;
61 virtual void Register(const std::string& app_id, 62 virtual void Register(const std::string& app_id,
62 const std::vector<std::string>& sender_ids) OVERRIDE; 63 const std::vector<std::string>& sender_ids) OVERRIDE;
63 virtual void Unregister(const std::string& app_id) OVERRIDE; 64 virtual void Unregister(const std::string& app_id) OVERRIDE;
64 virtual void Send(const std::string& app_id, 65 virtual void Send(const std::string& app_id,
65 const std::string& receiver_id, 66 const std::string& receiver_id,
66 const OutgoingMessage& message) OVERRIDE; 67 const OutgoingMessage& message) OVERRIDE;
68 virtual void SetRecording(bool recording) OVERRIDE;
69 virtual void ClearActivityLogs() OVERRIDE;
67 virtual GCMStatistics GetStatistics() const OVERRIDE; 70 virtual GCMStatistics GetStatistics() const OVERRIDE;
68 71
69 private: 72 private:
70 // State representation of the GCMClient. 73 // State representation of the GCMClient.
71 // Any change made to this enum should have corresponding change in the 74 // Any change made to this enum should have corresponding change in the
72 // GetStateString(...) function. 75 // GetStateString(...) function.
73 enum State { 76 enum State {
74 // Uninitialized. 77 // Uninitialized.
75 UNINITIALIZED, 78 UNINITIALIZED,
76 // Initialized, 79 // Initialized,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 void HandleIncomingSendError( 178 void HandleIncomingSendError(
176 const mcs_proto::DataMessageStanza& data_message_stanza, 179 const mcs_proto::DataMessageStanza& data_message_stanza,
177 MessageData& message_data); 180 MessageData& message_data);
178 181
179 // For testing purpose only. 182 // For testing purpose only.
180 // Sets an |mcs_client_| for testing. Takes the ownership of |mcs_client|. 183 // Sets an |mcs_client_| for testing. Takes the ownership of |mcs_client|.
181 // TODO(fgorski): Remove this method. Create GCMEngineFactory that will create 184 // TODO(fgorski): Remove this method. Create GCMEngineFactory that will create
182 // components of the engine. 185 // components of the engine.
183 void SetMCSClientForTesting(scoped_ptr<MCSClient> mcs_client); 186 void SetMCSClientForTesting(scoped_ptr<MCSClient> mcs_client);
184 187
188 // Recorder that logs GCM activities.
189 GCMStatsRecorder recorder_;
190
185 // State of the GCM Client Implementation. 191 // State of the GCM Client Implementation.
186 State state_; 192 State state_;
187 193
188 Delegate* delegate_; 194 Delegate* delegate_;
189 195
190 // Device checkin info (android ID and security token used by device). 196 // Device checkin info (android ID and security token used by device).
191 CheckinInfo device_checkin_info_; 197 CheckinInfo device_checkin_info_;
192 198
193 // Clock used for timing of retry logic. Passed in for testing. Owned by 199 // Clock used for timing of retry logic. Passed in for testing. Owned by
194 // GCMClientImpl. 200 // GCMClientImpl.
(...skipping 30 matching lines...) Expand all
225 231
226 // Factory for creating references in callbacks. 232 // Factory for creating references in callbacks.
227 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; 233 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_;
228 234
229 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); 235 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl);
230 }; 236 };
231 237
232 } // namespace gcm 238 } // namespace gcm
233 239
234 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ 240 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698