Vectorize website settings icons in omnibox
[chromium-blink-merge.git] / components / copresence / public / copresence_delegate.h
blobfff786b4aa2d933696b65339cc9a2f0d51b35589
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_PUBLIC_COPRESENCE_DELEGATE_H_
6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_
8 #include <string>
9 #include <vector>
11 #include "base/callback_forward.h"
13 namespace gcm {
14 class GCMDriver;
17 namespace net {
18 class URLRequestContextGetter;
21 namespace audio_modem {
22 class WhispernetClient;
25 namespace copresence {
27 class Message;
29 // AUDIO_FAIL indicates that we weren't able to hear the audio token that
30 // we were playing.
31 enum CopresenceStatus { SUCCESS, FAIL, AUDIO_FAIL };
33 // Callback type to send a status.
34 using StatusCallback = base::Callback<void(CopresenceStatus)>;
36 // A delegate interface for users of Copresence.
37 class CopresenceDelegate {
38 public:
39 // This method will be called when we have subscribed messages
40 // that need to be sent to their respective apps.
41 virtual void HandleMessages(
42 const std::string& app_id,
43 const std::string& subscription_id,
44 const std::vector<Message>& messages) = 0;
46 virtual void HandleStatusUpdate(CopresenceStatus status) = 0;
48 // Thw URLRequestContextGetter must outlive the CopresenceManager.
49 virtual net::URLRequestContextGetter* GetRequestContext() const = 0;
51 virtual const std::string GetPlatformVersionString() const = 0;
53 virtual const std::string GetAPIKey(const std::string& app_id) const = 0;
55 // The WhispernetClient must outlive the CopresenceManager.
56 virtual audio_modem::WhispernetClient* GetWhispernetClient() = 0;
58 // Clients may optionally provide a GCMDriver to receive messages from.
59 // If no driver is available, this can return null.
60 virtual gcm::GCMDriver* GetGCMDriver() = 0;
62 // Get the copresence device ID for authenticated or anonymous calls,
63 // as specified. If none exists, return the empty string.
64 virtual const std::string GetDeviceId(bool authenticated) = 0;
66 // Save a copresence device ID for authenticated or anonymous calls.
67 // If the device ID is empty, any stored ID should be deleted.
68 virtual void SaveDeviceId(bool authenticated,
69 const std::string& device_id) = 0;
71 protected:
72 virtual ~CopresenceDelegate() {}
75 } // namespace copresence
77 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_DELEGATE_H_