OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSION_ID_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSION_ID_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSION_ID_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSION_ID_H__ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 | 14 |
15 class SessionId { | 15 class SessionId { |
16 public: | 16 public: |
17 // Returns a SessionId, representing either a local or a foreign session. | 17 // Returns a SessionId, representing either a local or a foreign session. |
18 // In the case that the session is local, |session_tag_| will be empty string. | 18 // In the case that the session is local, |session_tag_| will be empty string. |
19 // |session_string| should be in the format that ToString() would produce. | 19 // |session_string| should be in the format that ToString() would produce. |
20 static scoped_ptr<SessionId> Parse(const std::string& session_string); | 20 static std::unique_ptr<SessionId> Parse(const std::string& session_string); |
21 | 21 |
22 // Constructs a SessionId object for the given session information. | 22 // Constructs a SessionId object for the given session information. |
23 // |session_tag| is the string used to uniquely identify a synced foreign | 23 // |session_tag| is the string used to uniquely identify a synced foreign |
24 // session from the SessionModelAssociator. In the case that SessionId | 24 // session from the SessionModelAssociator. In the case that SessionId |
25 // represents a local session, |session_tag_| will be the empty string. |id| | 25 // represents a local session, |session_tag_| will be the empty string. |id| |
26 // uniquely identifies either a window or tab object in the local or the | 26 // uniquely identifies either a window or tab object in the local or the |
27 // |session_tag| session. | 27 // |session_tag| session. |
28 SessionId(const std::string& session_tag, int id); | 28 SessionId(const std::string& session_tag, int id); |
29 | 29 |
30 // Returns true if the SessionId represents a foreign session. | 30 // Returns true if the SessionId represents a foreign session. |
(...skipping 13 matching lines...) Expand all Loading... |
44 | 44 |
45 // ID corresponding to a window or tab object. | 45 // ID corresponding to a window or tab object. |
46 int id_; | 46 int id_; |
47 | 47 |
48 DISALLOW_COPY_AND_ASSIGN(SessionId); | 48 DISALLOW_COPY_AND_ASSIGN(SessionId); |
49 }; | 49 }; |
50 | 50 |
51 } // namespace extensions | 51 } // namespace extensions |
52 | 52 |
53 #endif // CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSION_ID_H__ | 53 #endif // CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSION_ID_H__ |
OLD | NEW |