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

Side by Side Diff: components/copresence/interface/copresence_delegate.h

Issue 426093003: Add the copresence component. (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
(Empty)
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_INTERFACE_COPRESENCE_DELGATE_H_
6 #define COMPONENTS_COPRESENCE_INTERFACE_COPRESENCE_DELGATE_H_
7
8 #include <string>
9
10 #include "base/callback_forward.h"
11 #include "components/copresence/proto/rpcs.pb.h"
12
13 namespace net {
14 class URLRequestContextGetter;
15 }
16
17 namespace copresence {
18
19 // This enum (and the following callback) aren't strictly a part of this
20 // interface, but they are needed by other methods in CopresenceClient to
21 // talk back to the user of Copresence, hence they seem to belong here.
22 enum CopresenceStatus { SUCCESS, FAIL };
23
24 // Callback type to send a status.
25 typedef base::Callback<void(CopresenceStatus)> StatusCallback;
26
27 // A delegate interface for the users of Copresence.
28 class CopresenceDelegate {
29 public:
30 // This method will be called when we have subscribed messages that need to
31 // be sent back their respective apps.
32 virtual void HandleMessages(
33 const std::string& app_id,
34 const std::string& subscription_id,
35 const std::vector<copresence::Message>& message) = 0;
36
37 // This is used by use to be able to send HttpPosts to the copresence server.
38 virtual net::URLRequestContextGetter* GetRequestContext() const = 0;
39
40 // Only needed for analytics and debugging on the server, can be empty.
41 virtual const std::string GetPlatformVersionString() const = 0;
42
43 // Methods to set and and get our device ID. This needs to be saved to
44 // persistent storage to avoid flooding the Copresence server with generate
45 // id requests.
46 virtual const std::string GetDeviceId() const = 0;
47 virtual void SaveDeviceId(const std::string& device_id) = 0;
48 };
49
50 } // namespace copresence
51
52 #endif // COMPONENTS_COPRESENCE_INTERFACE_COPRESENCE_DELGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698