Non-SFI mode: Clean up macros of base/ and ipc/ libraries for nacl_helper_nonsfi.
[chromium-blink-merge.git] / components / copresence / copresence_manager_impl.h
blobffe690322b62628e1e898dbf512d6149e8006545
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.
5 #ifndef COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_
6 #define COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_
8 #include <string>
10 #include "base/cancelable_callback.h"
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h"
14 #include "components/copresence/public/copresence_manager.h"
16 namespace net {
17 class URLContextGetter;
20 namespace copresence {
22 class DirectiveHandler;
23 class ReportRequest;
24 class RpcHandler;
26 struct PendingRequest {
27 PendingRequest(const ReportRequest& report,
28 const std::string& app_id,
29 const std::string& auth_token,
30 const StatusCallback& callback);
31 ~PendingRequest();
33 scoped_ptr<ReportRequest> report;
34 std::string app_id;
35 std::string auth_token;
36 StatusCallback callback;
39 // The implementation for CopresenceManager. Responsible primarily for
40 // client-side initialization. The RpcHandler handles all the details
41 // of interacting with the server.
42 class CopresenceManagerImpl : public CopresenceManager {
43 public:
44 ~CopresenceManagerImpl() override;
45 void ExecuteReportRequest(const ReportRequest& request,
46 const std::string& app_id,
47 const StatusCallback& callback) override;
49 private:
50 // Create managers with the CopresenceManager::Create() method.
51 friend class CopresenceManager;
52 CopresenceManagerImpl(CopresenceDelegate* delegate);
54 void CompleteInitialization();
55 void InitStepComplete(const std::string& step, bool success);
57 // Belongs to the caller.
58 CopresenceDelegate* const delegate_;
60 int pending_init_operations_;
61 base::CancelableCallback<void(bool)> whispernet_init_callback_;
62 bool init_failed_;
64 ScopedVector<PendingRequest> pending_requests_queue_;
66 // The RpcHandler depends on the directive handler.
67 scoped_ptr<DirectiveHandler> directive_handler_;
68 scoped_ptr<RpcHandler> rpc_handler_;
70 DISALLOW_COPY_AND_ASSIGN(CopresenceManagerImpl);
73 } // namespace copresence
75 #endif // COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_