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

Side by Side Diff: components/copresence/public/copresence_client.h

Issue 453793002: Add audible support to the copresence API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 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 COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CLIENT_H_ 5 #ifndef COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CLIENT_H_
6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CLIENT_H_ 6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h"
14 #include "components/copresence/proto/rpcs.pb.h" 15 #include "components/copresence/proto/rpcs.pb.h"
15 #include "components/copresence/public/copresence_client_delegate.h" 16 #include "components/copresence/public/copresence_client_delegate.h"
16 17
17 namespace net { 18 namespace net {
18 class URLContextGetter; 19 class URLContextGetter;
19 } 20 }
20 21
21 namespace copresence { 22 namespace copresence {
22 23
23 class CopresenceClientDelegate; 24 class CopresenceClientDelegate;
24 class RpcHandler; 25 class RpcHandler;
25 26
26 struct PendingRequest { 27 struct PendingRequest {
27 PendingRequest(const copresence::ReportRequest& report, 28 PendingRequest(const copresence::ReportRequest& report,
28 const std::string app_id, 29 const std::string app_id,
29 const StatusCallback& callback); 30 const StatusCallback& callback);
30 ~PendingRequest(); 31 ~PendingRequest();
31 32
32 copresence::ReportRequest report; 33 copresence::ReportRequest report;
33 std::string app_id; 34 std::string app_id;
34 StatusCallback callback; 35 StatusCallback callback;
35 }; 36 };
36 37
37 // The CopresenceClient class is the central interface for Copresence 38 // The CopresenceClient class is the central interface for Copresence
38 // functionality. This class handles all the initialization and delegation of 39 // functionality. This class handles all the initialization and delegation of
39 // copresence tasks. Any user of copresence only needs to interact with this 40 // copresence tasks. Any user of copresence only needs to interact with this
40 // client. 41 // client.
41 class CopresenceClient { 42 class CopresenceClient : public base::SupportsWeakPtr<CopresenceClient> {
42 public: 43 public:
43 // The delegate must outlive us. 44 // The delegate must outlive us.
44 explicit CopresenceClient(CopresenceClientDelegate* delegate); 45 explicit CopresenceClient(CopresenceClientDelegate* delegate);
45 virtual ~CopresenceClient(); 46 virtual ~CopresenceClient();
46 47
47 // This method will execute a report request. Each report request can have 48 // This method will execute a report request. Each report request can have
48 // multiple (un)publishes, (un)subscribes. This will ensure that once the 49 // multiple (un)publishes, (un)subscribes. This will ensure that once the
49 // client is initialized, it sends all request to the server and handles 50 // client is initialized, it sends all request to the server and handles
50 // the response. If an error is encountered, the status callback is used 51 // the response. If an error is encountered, the status callback is used
51 // to relay it to the requester. 52 // to relay it to the requester.
(...skipping 16 matching lines...) Expand all
68 size_t pending_init_operations_; 69 size_t pending_init_operations_;
69 70
70 scoped_ptr<RpcHandler> rpc_handler_; 71 scoped_ptr<RpcHandler> rpc_handler_;
71 72
72 DISALLOW_COPY_AND_ASSIGN(CopresenceClient); 73 DISALLOW_COPY_AND_ASSIGN(CopresenceClient);
73 }; 74 };
74 75
75 } // namespace copresence 76 } // namespace copresence
76 77
77 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CLIENT_H_ 78 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698