Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / media / router / create_session_request.h
blobe698e6ec19b2bd4f80063a2e2548239a432fb35e
1 // Copyright 2015 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 CHROME_BROWSER_MEDIA_ROUTER_CREATE_SESSION_REQUEST_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_CREATE_SESSION_REQUEST_H_
8 #include <string>
10 #include "chrome/browser/media/router/media_source.h"
11 #include "content/public/browser/presentation_service_delegate.h"
12 #include "url/gurl.h"
14 namespace content {
15 struct PresentationError;
16 struct PresentationSessionInfo;
17 } // namespace content
19 namespace media_router {
21 // Holds parameters for creating a presentation session.
22 // A request object is created by presentation_service_delegate_impl when it
23 // gets create-session request. The object is then passed to and owned by the
24 // MediaRouterUI. |success_cb| will be invoked when create-session
25 // succeeds, or |error_cb| will be invoked when create-session fails or
26 // the UI closes.
27 class CreateSessionRequest {
28 public:
29 using PresentationSessionSuccessCallback =
30 content::PresentationServiceDelegate::PresentationSessionSuccessCallback;
31 using PresentationSessionErrorCallback =
32 content::PresentationServiceDelegate::PresentationSessionErrorCallback;
34 // |presentation_url| must be valid.
35 CreateSessionRequest(const std::string& presentation_url,
36 const std::string& presentation_id,
37 const GURL& frame_url,
38 const PresentationSessionSuccessCallback& success_cb,
39 const PresentationSessionErrorCallback& error_cb);
40 ~CreateSessionRequest();
42 // Gets the MediaSource derived from this instance's presentation URL.
43 const MediaSource& GetMediaSource() const { return media_source_; }
45 const GURL& frame_url() const { return frame_url_; }
46 const content::PresentationSessionInfo& presentation_info() const {
47 return presentation_info_;
50 // Invokes |success_cb_| or |error_cb_| with the given arguments.
51 // These functions can only be invoked once per instance. Further invocations
52 // are no-op.
53 void MaybeInvokeSuccessCallback();
54 void MaybeInvokeErrorCallback(const content::PresentationError& error);
56 private:
57 content::PresentationSessionInfo presentation_info_;
58 MediaSource media_source_;
59 GURL frame_url_;
60 PresentationSessionSuccessCallback success_cb_;
61 PresentationSessionErrorCallback error_cb_;
62 bool cb_invoked_;
64 DISALLOW_COPY_AND_ASSIGN(CreateSessionRequest);
67 } // namespace media_router
69 #endif // CHROME_BROWSER_MEDIA_ROUTER_CREATE_SESSION_REQUEST_H_