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

Unified Diff: chrome/browser/extensions/api/sessions/sessions_api.cc

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: Added assert true to test Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/sessions/sessions_api.cc
diff --git a/chrome/browser/extensions/api/sessions/sessions_api.cc b/chrome/browser/extensions/api/sessions/sessions_api.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e6d0d728010e3f242d37d62c327644e7c481930f
--- /dev/null
+++ b/chrome/browser/extensions/api/sessions/sessions_api.cc
@@ -0,0 +1,586 @@
+// Copyright (c) 2013 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 "chrome/browser/extensions/api/sessions/sessions_api.h"
+
+#include <vector>
+
+#include "base/i18n/rtl.h"
+#include "base/lazy_instance.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/extensions/extension_function_dispatcher.h"
+#include "chrome/browser/extensions/extension_function_registry.h"
+#include "chrome/browser/extensions/extension_tab_util.h"
+#include "chrome/browser/extensions/window_controller.h"
+#include "chrome/browser/extensions/window_controller_list.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sessions/session_restore.h"
+#include "chrome/browser/sessions/tab_restore_service_delegate.h"
+#include "chrome/browser/sessions/tab_restore_service_factory.h"
+#include "chrome/browser/sync/glue/session_model_associator.h"
+#include "chrome/browser/sync/glue/synced_session.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/host_desktop.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "content/public/browser/web_contents.h"
+#include "extensions/common/error_utils.h"
+#include "ui/base/layout.h"
+
+namespace {
+
+const unsigned int kMaxRecentlyClosedSessionResults = 25;
+const unsigned int kMaxSyncedSessionResults = 10;
+const char kRecentlyClosedListEmptyError[] =
+ "There are no recently closed sessions.";
+const char kInvalidSessionIdError[] = "Invalid session id.";
+const char kNoBrowserToRestoreSession[] =
+ "There are no browser windows to restore the session.";
+const char kSessionsSyncNotEnabledError[] = "Syncing sessions is not enabled.";
+const char kSyncedSessionsListEmptyError[] = "There are no foreign sessions.";
+const char kSessionNotFoundError[] = "Session is not found.";
+const char kSessionSyncError[] = "Session sync error.";
+const char kForeignIdSeparator = '.';
+
+const char kWindowNotFoundError[] = "No window with id: *.";
+const char kNoCurrentWindowError[] = "No current window.";
+const char kWindowRestoreError[] = "Error restoring foreign window.";
+
+std::string CreateForeignId(const std::string& session_tag, int id) {
+ return (session_tag + kForeignIdSeparator + base::IntToString(id));
+}
+
+// Comparator function for use with std::sort that will sort sessions by
+// descending modified_time (i.e., most recent first).
+bool SortSessionsByRecency(const browser_sync::SyncedSession* s1,
+ const browser_sync::SyncedSession* s2) {
+ return s1->modified_time > s2->modified_time;
+}
+
+bool GetWindowFromWindowID(UIThreadExtensionFunction* function,
+ int window_id,
+ extensions::WindowController** controller) {
+ if (window_id == extension_misc::kCurrentWindowId) {
+ extensions::WindowController* extension_window_controller =
+ function->dispatcher()->delegate()->GetExtensionWindowController();
+ // If there is a window controller associated with this extension, use that.
+ if (extension_window_controller) {
+ *controller = extension_window_controller;
+ } else {
+ // Otherwise get the focused or most recently added window.
+ *controller = extensions::WindowControllerList::GetInstance()->
+ CurrentWindowForFunction(function);
+ }
+ if (!(*controller)) {
+ function->SetError(kNoCurrentWindowError);
+ return false;
+ }
+ } else {
+ *controller = extensions::WindowControllerList::GetInstance()->
+ FindWindowForFunctionById(function, window_id);
+ if (!(*controller)) {
+ function->SetError(extensions::ErrorUtils::FormatErrorMessage(
+ kWindowNotFoundError, base::IntToString(window_id)));
+ return false;
+ }
+ }
+ return true;
+}
+
+bool IsLocalSession(const std::string& id) {
+ return (id.find(kForeignIdSeparator) == std::string::npos);
+}
+
+bool SplitId(const std::string& sid, std::string* session_tag, int* id) {
+ std::size_t separator_index = sid.find(kForeignIdSeparator);
+ *session_tag = sid.substr(0, separator_index);
+ if (!base::StringToInt(sid.substr(separator_index + 1), id))
+ return false;
+ return true;
+}
+
+} // namespace
+
+namespace extensions {
+
+namespace GetRecentlyClosed = api::sessions::GetRecentlyClosed;
+namespace GetDevices = api::sessions::GetDevices;
+namespace Restore = api::sessions::Restore;
+namespace tabs = api::tabs;
+namespace windows = api::windows;
+
+scoped_ptr<tabs::Tab> SessionsGetRecentlyClosedFunction::CreateTabModel(
+ const TabRestoreService::Tab& tab, const int* const session_id,
+ int selected_index) {
+ scoped_ptr<tabs::Tab> tab_struct(new tabs::Tab);
+ const sessions::SerializedNavigationEntry& current_navigation =
+ tab.navigations[tab.current_navigation_index];
+ GURL gurl = current_navigation.virtual_url();
+ std::string title = UTF16ToUTF8(current_navigation.title());
+
+ if (session_id) {
+ tab_struct->session_id.reset(
+ new std::string(base::IntToString(*session_id)));
+ } else {
+ tab_struct->session_id.reset(
+ new std::string(base::IntToString(tab.id)));
+ }
+ tab_struct->url.reset(new std::string(gurl.spec()));
+ tab_struct->title.reset(new std::string(title.empty() ? gurl.spec() : title));
+ tab_struct->index = tab.tabstrip_index;
+ tab_struct->pinned = tab.pinned;
+ tab_struct->index = tab.tabstrip_index;
+ tab_struct->pinned = tab.pinned;
+ tab_struct->selected = tab.tabstrip_index == selected_index;
+ tab_struct->active = false;
+ tab_struct->highlighted = false;
+ tab_struct->incognito = false;
+ ExtensionTabUtil::ScrubTabForExtension(GetExtension(),
+ tab_struct.get());
+ return tab_struct.Pass();
+}
+
+scoped_ptr<windows::Window>
+ SessionsGetRecentlyClosedFunction::CreateWindowModel(
+ const TabRestoreService::Window& window, int session_id) {
+ scoped_ptr<windows::Window> window_struct(new windows::Window);
+ DCHECK(!window.tabs.empty());
+
+ scoped_ptr<std::vector<linked_ptr<tabs::Tab> > > tabs(
+ new std::vector<linked_ptr<tabs::Tab> >);
+ for (size_t i = 0; i < window.tabs.size(); ++i) {
+ tabs->push_back(make_linked_ptr(CreateTabModel(window.tabs[i], NULL,
+ window.selected_tab_index).release()));
+ }
+ window_struct->session_id.reset(
+ new std::string(base::IntToString(session_id)));
+ window_struct->tabs.reset(tabs.release());
+ window_struct->incognito = false;
+ window_struct->always_on_top = false;
+ window_struct->focused = false;
+ window_struct->type = windows::Window::TYPE_NORMAL;
+ window_struct->state = windows::Window::STATE_NORMAL;
+ return window_struct.Pass();
+}
+
+scoped_ptr<api::sessions::Session>
+ SessionsGetRecentlyClosedFunction::CreateSessionModel(
+ const TabRestoreService::Entry* entry) {
+ scoped_ptr<api::sessions::Session> session_struct(new api::sessions::Session);
+ switch (entry->type) {
+ case TabRestoreService::TAB:
+ session_struct->tab.reset(CreateTabModel(
+ *static_cast<const TabRestoreService::Tab*>(entry), &entry->id, -1)
+ .release());
+ break;
+ case TabRestoreService::WINDOW:
+ session_struct->window.reset(CreateWindowModel(
+ *static_cast<const TabRestoreService::Window*>(entry), entry->id)
+ .release());
+ break;
+ default:
+ NOTREACHED();
+ }
+ session_struct->last_modified = entry->timestamp.ToTimeT();
+ return session_struct.Pass();
+}
+
+bool SessionsGetRecentlyClosedFunction::RunImpl() {
+ scoped_ptr<GetRecentlyClosed::Params> params(
+ GetRecentlyClosed::Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params.get());
+ unsigned int max_results = kMaxRecentlyClosedSessionResults;
+ if (params->options && params->options->max_results)
+ max_results = *params->options->max_results;
+ EXTENSION_FUNCTION_VALIDATE(max_results >= 0 &&
+ max_results <= kMaxRecentlyClosedSessionResults);
+
+ std::vector<linked_ptr<api::sessions::Session> > result;
+ TabRestoreService* tab_restore_service =
+ TabRestoreServiceFactory::GetForProfile(profile());
+ DCHECK(tab_restore_service);
+
+ // List of entries. They are ordered from most to least recent.
+ // We prune the list to contain max 25 entries at any time and removes
+ // uninteresting entries.
+ TabRestoreService::Entries entries = tab_restore_service->entries();
+ for (TabRestoreService::Entries::const_iterator it = entries.begin();
+ it != entries.end() && result.size() < max_results; ++it) {
+ TabRestoreService::Entry* entry = *it;
+ if (!params->options || params->options->entry_type ==
+ GetRecentlyClosed::Params::Options::ENTRY_TYPE_NONE) {
+ // Include both tabs and windows if type is not defined.
+ result.push_back(make_linked_ptr(CreateSessionModel(entry).release()));
+ } else if (
+ (params->options->entry_type ==
+ GetRecentlyClosed::Params::Options::ENTRY_TYPE_TAB &&
+ entry->type == TabRestoreService::TAB) ||
+ (params->options->entry_type ==
+ GetRecentlyClosed::Params::Options::ENTRY_TYPE_WINDOW &&
+ entry->type == TabRestoreService::WINDOW)) {
+ result.push_back(make_linked_ptr(CreateSessionModel(entry).release()));
+ }
+ }
+
+ results_ = GetRecentlyClosed::Results::Create(result);
+ return true;
+}
+
+scoped_ptr<tabs::Tab> SessionsGetDevicesFunction::CreateTabModel(
+ const SessionTab& tab, int selected_index, int tab_index,
+ const std::string& session_tag) {
+ scoped_ptr<tabs::Tab> tab_struct(new tabs::Tab);
+ const sessions::SerializedNavigationEntry& current_navigation =
+ tab.navigations[tab.current_navigation_index];
+ const GURL& gurl = current_navigation.virtual_url();
+ std::string title = UTF16ToUTF8(current_navigation.title());
+
+ tab_struct->session_id.reset(
+ new std::string(CreateForeignId(session_tag, tab.tab_id.id())));
+ tab_struct->url.reset(new std::string(gurl.spec()));
+ tab_struct->title.reset(new std::string(title.empty() ? gurl.spec() : title));
+ tab_struct->pinned = tab.pinned;
+ tab_struct->session_id.reset(
+ new std::string(CreateForeignId(session_tag, tab.tab_id.id())));
+ tab_struct->index = tab_index;
+ tab_struct->pinned = tab.pinned;
+ tab_struct->selected = tab_index == selected_index;
+ tab_struct->active = false;
+ tab_struct->highlighted = false;
+ tab_struct->incognito = false;
+ ExtensionTabUtil::ScrubTabForExtension(GetExtension(), tab_struct.get());
+ return tab_struct.Pass();
+}
+
+scoped_ptr<windows::Window> SessionsGetDevicesFunction::CreateWindowModel(
+ const SessionWindow& window, const std::string& session_tag) {
+ scoped_ptr<windows::Window> window_struct(new windows::Window);
+ DCHECK(!window.tabs.empty());
+
+ scoped_ptr<std::vector<linked_ptr<tabs::Tab> > > tabs(
+ new std::vector<linked_ptr<tabs::Tab> >);
+ for (size_t i = 0; i < window.tabs.size(); ++i) {
+ tabs->push_back(make_linked_ptr(
+ CreateTabModel(*window.tabs[i], window.selected_tab_index, i,
+ session_tag).release()));
+ }
+ window_struct->tabs = tabs.Pass();
+
+ window_struct->session_id.reset(
+ new std::string(CreateForeignId(session_tag, window.window_id.id())));
+ window_struct->left.reset(new int(window.bounds.x()));
+ window_struct->top.reset(new int(window.bounds.y()));
+ window_struct->width.reset(new int(window.bounds.width()));
+ window_struct->height.reset(new int(window.bounds.height()));
+ window_struct->incognito = false;
+ window_struct->always_on_top = false;
+ window_struct->focused = false;
+
+ switch (window.type) {
+ case Browser::TYPE_TABBED:
+ window_struct->type = windows::Window::TYPE_NORMAL;
+ break;
+ case Browser::TYPE_POPUP:
+ window_struct->type = windows::Window::TYPE_POPUP;
+ break;
+ default:
+ window_struct->type = windows::Window::TYPE_NONE;
+ }
+
+ switch (window.show_state) {
+ case ui::SHOW_STATE_NORMAL:
+ window_struct->state = windows::Window::STATE_NORMAL;
+ break;
+ case ui::SHOW_STATE_MINIMIZED:
+ window_struct->state = windows::Window::STATE_MINIMIZED;
+ break;
+ case ui::SHOW_STATE_MAXIMIZED:
+ window_struct->state = windows::Window::STATE_MAXIMIZED;
+ break;
+ case ui::SHOW_STATE_FULLSCREEN:
+ window_struct->state = windows::Window::STATE_FULLSCREEN;
+ break;
+ default:
+ window_struct->state = windows::Window::STATE_NONE;
+ }
+ return window_struct.Pass();
+}
+
+scoped_ptr<api::sessions::Session>
+ SessionsGetDevicesFunction::CreateSessionModel(
+ const SessionWindow& window, const std::string& session_tag) {
+ scoped_ptr<api::sessions::Session> session_struct(new api::sessions::Session);
+ session_struct->last_modified = window.timestamp.ToTimeT();
+ session_struct->window.reset(
+ CreateWindowModel(window, session_tag).release());
+ return session_struct.Pass();
+}
+
+scoped_ptr<api::sessions::Device> SessionsGetDevicesFunction::CreateDeviceModel(
+ const browser_sync::SyncedSession* session) {
+ scoped_ptr<api::sessions::Device> device_struct(new api::sessions::Device);
+ device_struct->info = session->session_name;
+
+ for (browser_sync::SyncedSession::SyncedWindowMap::const_iterator it =
+ session->windows.begin(); it != session->windows.end(); ++it) {
+ device_struct->sessions.push_back(make_linked_ptr(CreateSessionModel(
+ *it->second, session->session_tag).release()));
+ }
+ return device_struct.Pass();
+}
+
+bool SessionsGetDevicesFunction::RunImpl() {
+ ProfileSyncService* service =
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile());
+ if (!(service && service->GetPreferredDataTypes().Has(syncer::SESSIONS))) {
+ SetError(kSessionsSyncNotEnabledError);
+ return false;
+ }
+ unsigned int max_results = kMaxSyncedSessionResults;
+ scoped_ptr<GetDevices::Params> params(
+ GetDevices::Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params.get());
+ if (params->max_results.get())
+ max_results = *params->max_results.get();
+ EXTENSION_FUNCTION_VALIDATE(max_results >= 0 &&
+ max_results <= kMaxSyncedSessionResults);
+
+ browser_sync::SessionModelAssociator* associator =
+ service->GetSessionModelAssociator();
+ std::vector<const browser_sync::SyncedSession*> sessions;
+ if (!associator) {
+ SetError(kSessionSyncError);
+ return false;
+ }
+ if (!associator->GetAllForeignSessions(&sessions)) {
+ SetError(kSyncedSessionsListEmptyError);
+ return false;
+ }
+
+ std::vector<linked_ptr<api::sessions::Device> > result;
+ // Sort sessions from most recent to least recent.
+ std::sort(sessions.begin(), sessions.end(), SortSessionsByRecency);
+ for (size_t i = 0; i < sessions.size() && result.size() < max_results; ++i) {
+ result.push_back(make_linked_ptr(CreateDeviceModel(sessions[i]).release()));
+ }
+
+ results_ = GetDevices::Results::Create(result);
+ return true;
+}
+
+bool SessionsRestoreFunction::RestoreMostRecentlyClosed(Browser* browser) {
+ TabRestoreService* tab_restore_service =
+ TabRestoreServiceFactory::GetForProfile(profile());
+ TabRestoreServiceDelegate* delegate =
+ TabRestoreServiceDelegate::FindDelegateForWebContents(
+ browser->tab_strip_model()->GetActiveWebContents());
+ DCHECK(delegate);
+ chrome::HostDesktopType host_desktop_type = browser->host_desktop_type();
+ TabRestoreService::Entries entries = tab_restore_service->entries();
+
+ if (entries.empty()) {
+ SetError(kRecentlyClosedListEmptyError);
+ return false;
+ }
+
+ bool is_window = entries.front()->type == TabRestoreService::WINDOW;
+ // If the entry being restored is of type Window, the WebContents returned are
+ // the contents of the last successfully restored tab in the window.
+ content::WebContents* contents = tab_restore_service->RestoreMostRecentEntry(
+ delegate, host_desktop_type);
+
+ if (is_window) {
+ WindowController* controller;
+ if (!GetWindowFromWindowID(this,
+ ExtensionTabUtil::GetWindowIdOfTab(contents),
+ &controller))
+ return false;
+ SetResult(controller->CreateWindowValueWithTabs(GetExtension()));
+ } else {
+ SetResult(ExtensionTabUtil::CreateTabValue(contents, GetExtension()));
+ }
+ return true;
+}
+
+bool SessionsRestoreFunction::RestoreLocalSession(int id, Browser* browser) {
+ TabRestoreService* tab_restore_service =
+ TabRestoreServiceFactory::GetForProfile(profile());
+
+ TabRestoreServiceDelegate* delegate =
+ TabRestoreServiceDelegate::FindDelegateForWebContents(
+ browser->tab_strip_model()->GetActiveWebContents());
+ DCHECK(delegate);
+ chrome::HostDesktopType host_desktop_type = browser->host_desktop_type();
+ TabRestoreService::Entries entries = tab_restore_service->entries();
+
+ if (entries.empty()) {
+ SetError(kRecentlyClosedListEmptyError);
+ return false;
+ }
+
+ // Check if the recently closed list contains an entry with the provided id.
+ bool is_valid_id = false;
+ bool is_window = false;
+ for (TabRestoreService::Entries::iterator it = entries.begin();
+ it != entries.end(); ++it) {
+ if ((*it)->id == id) {
+ is_valid_id = true;
+ // The only time a full window is being restored is if the entry ID
+ // matches the provided ID and the entry type is Window.
+ is_window = (*it)->type == TabRestoreService::WINDOW;
+ break;
+ }
+ // For Window entries, see if the ID matches a tab. If so, report true for
+ // the window as the Entry.
+ if ((*it)->type == TabRestoreService::WINDOW) {
+ std::vector<TabRestoreService::Tab>& tabs =
+ static_cast<TabRestoreService::Window*>(*it)->tabs;
+ for (std::vector<TabRestoreService::Tab>::iterator tab_it = tabs.begin();
+ tab_it != tabs.end(); ++tab_it) {
+ if ((*tab_it).id == id) {
+ is_valid_id = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (!is_valid_id) {
+ SetError(kInvalidSessionIdError);
+ return false;
+ }
+
+ content::WebContents* contents = tab_restore_service->RestoreEntryById(
+ delegate, id, host_desktop_type, UNKNOWN);
+ if (is_window) {
+ WindowController* controller;
+ if (!GetWindowFromWindowID(this,
+ ExtensionTabUtil::GetWindowIdOfTab(contents),
+ &controller))
+ return false;
+ SetResult(controller->CreateWindowValueWithTabs(GetExtension()));
+ } else {
+ SetResult(ExtensionTabUtil::CreateTabValue(contents, GetExtension()));
+ }
+
+ return true;
+}
+
+bool SessionsRestoreFunction::RestoreForeignSession(
+ const std::string& session_tag, int id, Browser* browser) {
+ ProfileSyncService* service =
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile());
+ if (!(service && service->GetPreferredDataTypes().Has(syncer::SESSIONS))) {
+ SetError(kSessionsSyncNotEnabledError);
+ return false;
+ }
+ browser_sync::SessionModelAssociator* associator =
+ service->GetSessionModelAssociator();
+ if (!associator) {
+ SetError(kSessionSyncError);
+ return false;
+ }
+
+ const SessionTab* tab = NULL;
+ if (associator->GetForeignTab(session_tag, id, &tab)) {
+ TabStripModel* tab_strip = browser->tab_strip_model();
+ content::WebContents* contents = tab_strip->GetActiveWebContents();
+
+ content::WebContents* tab_content =
+ SessionRestore::RestoreForeignSessionTab(contents, *tab,
+ NEW_FOREGROUND_TAB);
+ SetResult(ExtensionTabUtil::CreateTabValue(tab_content, GetExtension()));
+ return true;
+ } else {
+ std::vector<const SessionWindow*> windows;
+ if (!associator->GetForeignSession(session_tag, &windows)) {
+ SetError(kSessionNotFoundError);
+ return false;
+ }
+
+ std::vector<const SessionWindow*>::const_iterator window = windows.begin();
+ while (window != windows.end() && (*window)->window_id.id() != id) {
+ ++window;
+ }
+ if (window == windows.end()) {
+ SetError(kSessionNotFoundError);
+ return false;
+ }
+
+ chrome::HostDesktopType host_desktop_type = browser->host_desktop_type();
+ // Only restore one window at a time.
+ std::vector<Browser*> browser =
+ SessionRestore::RestoreForeignSessionWindows(profile(),
+ host_desktop_type, window, (window + 1));
+ if (browser.size() != 1) {
+ SetError(kWindowRestoreError);
+ return false;
+ }
+
+ WindowController* controller;
+ if (!GetWindowFromWindowID(this,
+ ExtensionTabUtil::GetWindowId(browser[0]),
+ &controller))
+ return false;
+ SetResult(controller->CreateWindowValueWithTabs(GetExtension()));
+ }
+
+ return true;
+}
+
+bool SessionsRestoreFunction::RunImpl() {
+ scoped_ptr<Restore::Params> params(Restore::Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params.get());
+
+ Browser* browser =
+ chrome::FindBrowserWithProfile(profile(),
+ chrome::HOST_DESKTOP_TYPE_NATIVE);
+ if (!browser) {
+ SetError(kNoBrowserToRestoreSession);
+ return false;
+ }
+
+ if (!params->session_id)
+ return RestoreMostRecentlyClosed(browser);
+
+ if (IsLocalSession(*params->session_id)) {
+ int id;
+ if (!base::StringToInt(*params->session_id, &id)) {
+ SetError(kInvalidSessionIdError);
+ return false;
+ }
+ return RestoreLocalSession(id, browser);
+ } else {
+ std::string session_tag;
+ int id;
+ if (!SplitId(*params->session_id, &session_tag, &id)) {
+ SetError(kInvalidSessionIdError);
+ return false;
+ }
+ return RestoreForeignSession(session_tag, id, browser);
+ }
+
+ // Should never reach here.
+ return false;
+}
+
+SessionsAPI::SessionsAPI(Profile* profile) {
+}
+
+SessionsAPI::~SessionsAPI() {
+}
+
+static base::LazyInstance<ProfileKeyedAPIFactory<SessionsAPI> >
+ g_factory = LAZY_INSTANCE_INITIALIZER;
+
+// static
+ProfileKeyedAPIFactory<SessionsAPI>*
+ SessionsAPI::GetFactoryInstance() {
+ return &g_factory.Get();
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698