This source file includes following definitions.
- IdForTab
- IdForWindowContainingTab
#include "chrome/browser/sessions/session_id.h"
#include "chrome/browser/sessions/session_tab_helper.h"
static SessionID::id_type next_id = 1;
SessionID::SessionID() {
id_ = next_id++;
}
SessionID::id_type SessionID::IdForTab(const content::WebContents* tab) {
const SessionTabHelper* session_tab_helper =
tab ? SessionTabHelper::FromWebContents(tab) : NULL;
return session_tab_helper ? session_tab_helper->session_id().id() : -1;
}
SessionID::id_type SessionID::IdForWindowContainingTab(
const content::WebContents* tab) {
const SessionTabHelper* session_tab_helper =
tab ? SessionTabHelper::FromWebContents(tab) : NULL;
return session_tab_helper ? session_tab_helper->window_id().id() : -1;
}