summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sessions/session_id.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/sessions/session_id.h')
-rw-r--r--chrome/browser/sessions/session_id.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/chrome/browser/sessions/session_id.h b/chrome/browser/sessions/session_id.h
index 031fc14..19f1dc4 100644
--- a/chrome/browser/sessions/session_id.h
+++ b/chrome/browser/sessions/session_id.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,9 @@
#include "base/basictypes.h"
+class Browser;
+class TabContents;
+
// Uniquely identifies a tab or window for the duration of a session.
class SessionID {
public:
@@ -15,6 +18,18 @@ class SessionID {
SessionID();
~SessionID() {}
+ // This value is immutable for a given tab. It will be unique across Chrome
+ // within the current session, but may be re-used across sessions. Returns -1
+ // for NULL, and will never return -1 for a valid tab.
+ static id_type IdForTab(const TabContents* tab);
+
+ // If the tab has ever been attached to a window, this is the value of
+ // Browser::session_id().id() for some Browser object. Returns -1 for NULL, or
+ // another value that's not equal to any Browser's id for a tab that has never
+ // been attached to a window. IdForWindowContainingTab() returns the old
+ // window for a tab that's currently being dragged between windows.
+ static id_type IdForWindowContainingTab(const TabContents* tab);
+
// Returns the underlying id.
void set_id(id_type id) { id_ = id; }
id_type id() const { return id_; }