Fix build break
[chromium-blink-merge.git] / chrome / browser / sessions / session_id.h
blobf4d103b1276324f449694bc3e92807cda51280f5
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_ID_H_
6 #define CHROME_BROWSER_SESSIONS_SESSION_ID_H_
8 #include "base/basictypes.h"
10 class Browser;
12 namespace content {
13 class WebContents;
16 // Uniquely identifies a tab or window for the duration of a session.
17 class SessionID {
18 public:
19 typedef int32 id_type;
21 SessionID();
22 ~SessionID() {}
24 // If the specified WebContents has a SessionTabHelper (probably because it
25 // was used as the contents of a tab), returns a tab id. This value is
26 // immutable for a given tab. It will be unique across Chrome within the
27 // current session, but may be re-used across sessions. Returns -1
28 // for a NULL WebContents or if the WebContents has no SessionTabHelper.
29 static id_type IdForTab(const content::WebContents* tab);
31 // If the specified WebContents has a SessionTabHelper (probably because it
32 // was used as the contents of a tab), and has ever been attached to a Browser
33 // window, returns Browser::session_id().id() for that Browser. If the tab is
34 // being dragged between Browser windows, returns the old window's id value.
35 // If the WebContents has a SessionTabHelper but has never been attached to a
36 // Browser window, returns an id value that is different from that of any
37 // Browser. Returns -1 for a NULL WebContents or if the WebContents has no
38 // SessionTabHelper.
39 static id_type IdForWindowContainingTab(const content::WebContents* tab);
41 // Returns the underlying id.
42 void set_id(id_type id) { id_ = id; }
43 id_type id() const { return id_; }
45 private:
46 id_type id_;
49 #endif // CHROME_BROWSER_SESSIONS_SESSION_ID_H_