OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CONTENT_PUBLIC_COMMON_PRESENTATION_SESSION_H_ | |
6 #define CONTENT_PUBLIC_COMMON_PRESENTATION_SESSION_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "content/common/content_export.h" | |
11 #include "url/gurl.h" | |
12 | |
13 namespace content { | |
14 | |
15 enum PresentationConnectionState { | |
16 PRESENTATION_CONNECTION_STATE_CONNECTING, | |
17 PRESENTATION_CONNECTION_STATE_CONNECTED, | |
18 PRESENTATION_CONNECTION_STATE_CLOSED, | |
19 PRESENTATION_CONNECTION_STATE_TERMINATED | |
20 }; | |
21 | |
22 // TODO(imcheng): Use WENT_AWAY for 1-UA mode when it is implemented | |
23 // (crbug.com/513859). | |
24 enum PresentationConnectionCloseReason { | |
25 PRESENTATION_CONNECTION_CLOSE_REASON_CONNECTION_ERROR, | |
26 PRESENTATION_CONNECTION_CLOSE_REASON_CLOSED, | |
27 PRESENTATION_CONNECTION_CLOSE_REASON_WENT_AWAY | |
28 }; | |
29 | |
30 // TODO(imcheng): Rename to PresentationConnectionInfo. | |
31 // Represents a presentation session that has been established via either | |
32 // browser actions or Presentation API. | |
33 struct CONTENT_EXPORT PresentationSessionInfo { | |
34 PresentationSessionInfo() = default; | |
35 PresentationSessionInfo(const GURL& presentation_url, | |
36 const std::string& presentation_id); | |
37 ~PresentationSessionInfo(); | |
38 | |
39 static constexpr size_t kMaxIdLength = 256; | |
40 | |
41 GURL presentation_url; | |
42 std::string presentation_id; | |
43 }; | |
44 | |
45 // Possible reasons why an attempt to create a presentation session failed. | |
46 enum PresentationErrorType { | |
47 PRESENTATION_ERROR_NO_AVAILABLE_SCREENS, | |
48 PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED, | |
49 PRESENTATION_ERROR_NO_PRESENTATION_FOUND, | |
50 PRESENTATION_ERROR_PREVIOUS_START_IN_PROGRESS, | |
51 PRESENTATION_ERROR_UNKNOWN, | |
52 }; | |
53 | |
54 // Struct returned when an attempt to create a presentation session failed. | |
55 struct CONTENT_EXPORT PresentationError { | |
56 PresentationError() = default; | |
57 PresentationError(PresentationErrorType error_type, | |
58 const std::string& message); | |
59 ~PresentationError(); | |
60 | |
61 static constexpr size_t kMaxMessageLength = 256; | |
62 | |
63 PresentationErrorType error_type; | |
64 std::string message; | |
65 }; | |
66 | |
67 } // namespace content | |
68 | |
69 #endif // CONTENT_PUBLIC_COMMON_PRESENTATION_SESSION_H_ | |
OLD | NEW |