• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_MANAGER_H_
6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_MANAGER_H_
7 
8 #include "base/memory/scoped_ptr.h"
9 #include "components/copresence/public/copresence_delegate.h"
10 
11 namespace copresence {
12 
13 class ReportRequest;
14 
15 // The CopresenceManager class is the central interface for Copresence
16 // functionality. This class handles all the initialization and delegation
17 // of copresence tasks. Any user of copresence only needs to interact
18 // with this class.
19 class CopresenceManager {
20  public:
CopresenceManager()21   CopresenceManager() {}
~CopresenceManager()22   virtual ~CopresenceManager() {}
23 
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
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
28   // to relay it to the requester.
29   virtual void ExecuteReportRequest(ReportRequest request,
30                                     const std::string& app_id,
31                                     const StatusCallback& callback) = 0;
32 
33   // Factory method for CopresenceManagers. The delegate is owned
34   // by the caller, and must outlive the manager.
35   static scoped_ptr<CopresenceManager> Create(CopresenceDelegate* delegate);
36 
37  private:
38 
39   DISALLOW_COPY_AND_ASSIGN(CopresenceManager);
40 };
41 
42 }  // namespace copresence
43 
44 #endif  // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_MANAGER_H_
45