OLD | NEW |
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_MANAGER_H_ | 5 #ifndef COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_MANAGER_H_ |
6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_MANAGER_H_ | 6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_MANAGER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "components/copresence/public/copresence_delegate.h" | 9 #include "components/copresence/public/copresence_delegate.h" |
10 | 10 |
11 namespace copresence { | 11 namespace copresence { |
12 | 12 |
13 class ReportRequest; | 13 class ReportRequest; |
14 | 14 |
15 // The CopresenceManager class is the central interface for Copresence | 15 // The CopresenceManager class is the central interface for Copresence |
16 // functionality. This class handles all the initialization and delegation | 16 // functionality. This class handles all the initialization and delegation |
17 // of copresence tasks. Any user of copresence only needs to interact | 17 // of copresence tasks. Any user of copresence only needs to interact |
18 // with this class. | 18 // with this class. |
19 class CopresenceManager { | 19 class CopresenceManager { |
20 public: | 20 public: |
21 CopresenceManager() {} | 21 CopresenceManager() {} |
22 virtual ~CopresenceManager() {} | 22 virtual ~CopresenceManager() {} |
23 | 23 |
24 // This method will execute a report request. Each report request can have | 24 // This method will execute a report request. Each report request can have |
25 // multiple (un)publishes, (un)subscribes. This will ensure that once the | 25 // multiple (un)publishes, (un)subscribes. This will ensure that once the |
26 // manager is initialized, it sends all request to the server and handles | 26 // manager is initialized, it sends all request to the server and handles |
27 // the response. If an error is encountered, the status callback is used | 27 // the response. If an error is encountered, the status callback is used |
28 // to relay it to the requester. | 28 // to relay it to the requester. |
29 virtual void ExecuteReportRequest(ReportRequest request, | 29 virtual void ExecuteReportRequest(const ReportRequest& request, |
30 const std::string& app_id, | 30 const std::string& app_id, |
31 const StatusCallback& callback) = 0; | 31 const StatusCallback& callback) = 0; |
32 | 32 |
33 // Factory method for CopresenceManagers. The delegate is owned | 33 // Factory method for CopresenceManagers. The delegate is owned |
34 // by the caller, and must outlive the manager. | 34 // by the caller, and must outlive the manager. |
35 static scoped_ptr<CopresenceManager> Create(CopresenceDelegate* delegate); | 35 static scoped_ptr<CopresenceManager> Create(CopresenceDelegate* delegate); |
36 | 36 |
37 private: | 37 private: |
38 | 38 |
39 DISALLOW_COPY_AND_ASSIGN(CopresenceManager); | 39 DISALLOW_COPY_AND_ASSIGN(CopresenceManager); |
40 }; | 40 }; |
41 | 41 |
42 } // namespace copresence | 42 } // namespace copresence |
43 | 43 |
44 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_MANAGER_H_ | 44 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_MANAGER_H_ |
OLD | NEW |