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