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

Side by Side Diff: google_apis/gcm/engine/connection_event_tracker.h

Issue 2481873002: Added ClientEvent proto and structure for storing events in the factory. (Closed)
Patch Set: Rebase and address code review comments. Created 4 years 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef GOOGLE_APIS_GCM_ENGINE_CONNECTION_EVENT_TRACKER_H_
6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_EVENT_TRACKER_H_
7
8 #include <deque>
9
10 #include "base/macros.h"
11 #include "google_apis/gcm/base/gcm_export.h"
12 #include "google_apis/gcm/protocol/mcs.pb.h"
13 #include "net/base/net_errors.h"
14 #include "net/base/network_change_notifier.h"
Peter Beverloo 2016/12/05 16:29:34 nit: unused
harkness 2016/12/06 12:53:35 Moved to the cc file, where we still need it.
15
16 namespace mcs_proto {
17 class LoginRequest;
Peter Beverloo 2016/12/05 16:29:34 nit: unused (you include mcs.pb.h)
harkness 2016/12/06 12:53:35 Done.
18 }
19
20 namespace gcm {
21
22 class GCM_EXPORT ConnectionEventTracker {
23 public:
24 // TODO(harkness): Pass in the storage information.
25 ConnectionEventTracker();
26 ~ConnectionEventTracker();
27
28 // Start recording a new connection attempt. This should never be called if
29 // a connection attempt is already ongoing.
30 void StartConnectionAttempt();
31
32 // Ends the record for a connection attempt and moves it to the completed
33 // connections list.
34 void EndConnectionAttempt();
35
36 // Record that the existing connection attempt has succeeded. Note that this
37 // doesn't mean the connection is necessarily valid. It could still fail with
38 // an authentication error.
39 void ConnectionAttemptSucceeded();
40
41 // Records that the connection succeeded but then failed to login.
42 void ConnectionLoginFailed();
43
44 // Record that the existing connection attempt has failed.
45 void ConnectionAttemptFailed(int error);
46
47 // Write any previous connection information to the |*login_request|.
48 void WriteToLoginRequest(mcs_proto::LoginRequest* login_request);
49
50 private:
51 // Storage for all the events which have completed.
52 std::deque<mcs_proto::ClientEvent> completed_events_;
53
54 // Current connection attempt.
55 mcs_proto::ClientEvent current_event_;
56
57 DISALLOW_COPY_AND_ASSIGN(ConnectionEventTracker);
58 };
59
60 } // namespace gcm
61
62 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_EVENT_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698