Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: chrome/browser/extensions/api/sessions/session_id.h

Issue 21022018: Sessions API - previously Session Restore API. Supports restoring currently open foreign windows an… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete test. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSION_ID_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSION_ID_H__
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12
13 namespace extensions {
14
15 class SessionId {
16 public:
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.
19 // |session_string| should be in the format that ToString() would produce.
20 static scoped_ptr<SessionId> Parse(const std::string& session_string);
21
22 // Constructs a SessionId object for the given session information.
23 // |session_tag| is the string used to uniquely identify a synced foreign
24 // session from the SessionModelAssociator. In the case that SessionId
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
27 // |session_tag| session.
28 SessionId(const std::string& session_tag, int id);
29
30 // Returns true if the SessionId represents a foreign session.
31 bool IsForeign() const;
32
33 // Returns the compressed std::string representation of a SessionId in the
34 // same format that Parse() accepts as its |session_string| parameter.
35 std::string ToString() const;
36
37 const std::string& session_tag() const { return session_tag_; }
38 int id() const { return id_; }
39
40 private:
41 // The unique identifier for a foreign session, given by the
42 // SessionModelAssociator.
43 std::string session_tag_;
44
45 // ID corresponding to a window or tab object.
46 int id_;
47
48 DISALLOW_COPY_AND_ASSIGN(SessionId);
49 };
50
51 } // namespace extensions
52
53 #endif // CHROME_BROWSER_EXTENSIONS_API_SESSIONS_SESSION_ID_H__
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/sessions/OWNERS ('k') | chrome/browser/extensions/api/sessions/session_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698