summaryrefslogtreecommitdiffstats
path: root/components/sessions
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-18 12:41:59 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-18 12:43:22 +0000
commite3f90c60f713e638206f71c1189bd0d92ed07940 (patch)
treef0acb674735598e258f51faa719296ff78ed2899 /components/sessions
parent1a75d0e4c5f9dc4ad49a097e227f9b90bdddb7ad (diff)
downloadchromium_src-e3f90c60f713e638206f71c1189bd0d92ed07940.zip
chromium_src-e3f90c60f713e638206f71c1189bd0d92ed07940.tar.gz
chromium_src-e3f90c60f713e638206f71c1189bd0d92ed07940.tar.bz2
Move session_id.{cc,h} from chrome/browser/sessions to components/sessions
Move SessionID out of chrome/ to make it usable from non-Chrome embedders like app_shell and athena. Move methods IdForTab() and IdForWindowContainingTab() from SessionID to SessionTabHelper to make SessionID chrome-free. Move SessionID to components/sessions. Fix gyp, BUILD.gn and DEPS. BUG=403726 TBR=sky@chromium.org for include fix under chrome/browser Review URL: https://codereview.chromium.org/480883002 Cr-Commit-Position: refs/heads/master@{#290242} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/sessions')
-rw-r--r--components/sessions/BUILD.gn2
-rw-r--r--components/sessions/session_id.cc11
-rw-r--r--components/sessions/session_id.h27
3 files changed, 40 insertions, 0 deletions
diff --git a/components/sessions/BUILD.gn b/components/sessions/BUILD.gn
index 96c22d5..1daff6e 100644
--- a/components/sessions/BUILD.gn
+++ b/components/sessions/BUILD.gn
@@ -10,6 +10,8 @@ component("sessions") {
sources = [
"serialized_navigation_entry.cc",
"serialized_navigation_entry.h",
+ "session_id.cc",
+ "session_id.h",
]
defines = [ "SESSIONS_IMPLEMENTATION" ]
diff --git a/components/sessions/session_id.cc b/components/sessions/session_id.cc
new file mode 100644
index 0000000..6999a2a
--- /dev/null
+++ b/components/sessions/session_id.cc
@@ -0,0 +1,11 @@
+// Copyright 2014 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.
+
+#include "components/sessions/session_id.h"
+
+static SessionID::id_type next_id = 1;
+
+SessionID::SessionID() {
+ id_ = next_id++;
+}
diff --git a/components/sessions/session_id.h b/components/sessions/session_id.h
new file mode 100644
index 0000000..f23fb73
--- /dev/null
+++ b/components/sessions/session_id.h
@@ -0,0 +1,27 @@
+// Copyright 2014 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.
+
+#ifndef COMPONENTS_SESSIONS_SESSION_ID_H_
+#define COMPONENTS_SESSIONS_SESSION_ID_H_
+
+#include "base/basictypes.h"
+#include "components/sessions/sessions_export.h"
+
+// Uniquely identifies a tab or window for the duration of a session.
+class SESSIONS_EXPORT SessionID {
+ public:
+ typedef int32 id_type;
+
+ SessionID();
+ ~SessionID() {}
+
+ // Returns the underlying id.
+ void set_id(id_type id) { id_ = id; }
+ id_type id() const { return id_; }
+
+ private:
+ id_type id_;
+};
+
+#endif // COMPONENTS_SESSIONS_SESSION_ID_H_