OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 WebSerializedOrigin_h | 5 #ifndef WebSerializedOrigin_h |
6 #define WebSerializedOrigin_h | 6 #define WebSerializedOrigin_h |
7 | 7 |
8 #include "WebString.h" | 8 #include "WebString.h" |
9 | 9 |
10 #if !INSIDE_BLINK | 10 #if !INSIDE_BLINK |
11 #include <url/origin.h> | 11 #include <url/origin.h> |
12 #endif | 12 #endif |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class SecurityOrigin; | 16 class SecurityOrigin; |
17 class WebSecurityOrigin; | |
18 | 17 |
19 // WebSerializedOrigin represents a serialized Web Origin specified in RFC6454. | 18 // WebSerializedOrigin represents a serialized Web Origin specified in RFC6454. |
20 class WebSerializedOrigin { | 19 class WebSerializedOrigin { |
21 public: | 20 public: |
22 WebSerializedOrigin() : m_string("null") { } | 21 WebSerializedOrigin() : m_string("null") { } |
23 BLINK_PLATFORM_EXPORT WebSerializedOrigin(const WebSecurityOrigin&); | |
24 | |
25 #if INSIDE_BLINK | 22 #if INSIDE_BLINK |
26 BLINK_PLATFORM_EXPORT WebSerializedOrigin(const SecurityOrigin&); | 23 BLINK_PLATFORM_EXPORT WebSerializedOrigin(const SecurityOrigin&); |
27 #else | 24 #else |
28 WebSerializedOrigin(const url::Origin& origin) : m_string(WebString::fromUTF
8(origin.string())) { } | 25 WebSerializedOrigin(const url::Origin& origin) : m_string(WebString::fromUTF
8(origin.string())) { } |
29 operator url::Origin() const { return url::Origin(m_string.utf8()); } | 26 operator url::Origin() const { return url::Origin(m_string.utf8()); } |
30 #endif | 27 #endif |
31 | 28 |
32 const WebString& string() const | 29 const WebString& string() const |
33 { | 30 { |
34 return m_string; | 31 return m_string; |
35 } | 32 } |
36 | 33 |
37 private: | 34 private: |
38 const WebString m_string; | 35 const WebString m_string; |
39 }; | 36 }; |
40 | 37 |
41 } // namespace blink | 38 } // namespace blink |
42 | 39 |
43 #endif // #ifndef SerializedOrigin_h | 40 #endif // #ifndef SerializedOrigin_h |
OLD | NEW |