diff options
author | koz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-06 06:12:56 +0000 |
---|---|---|
committer | koz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-06 06:12:56 +0000 |
commit | 51e5bdcb18a9b316761e4361fc0befa9767de0a0 (patch) | |
tree | e6b9ad24d68ff3f9083d7b6e26ef444f505eada1 /chrome/browser/sessions | |
parent | cd57d088c61b38881261c159792537e8b93eb6b8 (diff) | |
download | chromium_src-51e5bdcb18a9b316761e4361fc0befa9767de0a0.zip chromium_src-51e5bdcb18a9b316761e4361fc0befa9767de0a0.tar.gz chromium_src-51e5bdcb18a9b316761e4361fc0befa9767de0a0.tar.bz2 |
Make app windows not create or interact with SessionServices.
BUG=145192
Review URL: https://chromiumcodereview.appspot.com/11308269
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171409 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sessions')
-rw-r--r-- | chrome/browser/sessions/session_backend.h | 1 | ||||
-rw-r--r-- | chrome/browser/sessions/session_service.cc | 6 | ||||
-rw-r--r-- | chrome/browser/sessions/session_service.h | 5 |
3 files changed, 12 insertions, 0 deletions
diff --git a/chrome/browser/sessions/session_backend.h b/chrome/browser/sessions/session_backend.h index 6ae8fbe..498b43f 100644 --- a/chrome/browser/sessions/session_backend.h +++ b/chrome/browser/sessions/session_backend.h @@ -53,6 +53,7 @@ class SessionBackend : public base::RefCountedThreadSafe<SessionBackend> { // NOTE: this is invoked before every command, and does nothing if we've // already Init'ed. void Init(); + bool inited() const { return inited_; } // Appends the specified commands to the current file. If reset_first is // true the the current file is recreated. diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 11e9c53..98e7ee7 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -542,6 +542,10 @@ void SessionService::Init() { BrowserList::AddObserver(this); } +bool SessionService::processed_any_commands() { + return backend()->inited() || !pending_commands().empty(); +} + bool SessionService::ShouldNewWindowStartSession() { // ChromeOS and OSX have different ideas of application lifetime than // the other platforms. @@ -1743,6 +1747,8 @@ void SessionService::RecordUpdatedSaveTime(base::TimeDelta delta, void SessionService::TabInserted(WebContents* contents) { SessionTabHelper* session_tab_helper = SessionTabHelper::FromWebContents(contents); + if (!ShouldTrackChangesToWindow(session_tab_helper->window_id())) + return; SetTabWindow(session_tab_helper->window_id(), session_tab_helper->session_id()); extensions::TabHelper* extensions_tab_helper = diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h index 98f0fa5..6078806 100644 --- a/chrome/browser/sessions/session_service.h +++ b/chrome/browser/sessions/session_service.h @@ -208,6 +208,7 @@ class SessionService : public BaseSessionService, // Allow tests to access our innards for testing purposes. FRIEND_TEST_ALL_PREFIXES(SessionServiceTest, RestoreActivation1); FRIEND_TEST_ALL_PREFIXES(SessionServiceTest, RestoreActivation2); + FRIEND_TEST_ALL_PREFIXES(NoStartupWindowTest, DontInitSessionServiceForApps); typedef std::map<SessionID::id_type, std::pair<int, int> > IdToRange; typedef std::map<SessionID::id_type, SessionTab*> IdToSessionTab; @@ -225,6 +226,10 @@ class SessionService : public BaseSessionService, void Init(); + // Returns true if we have scheduled any commands, or any scheduled commands + // have been saved. + bool processed_any_commands(); + // Implementation of RestoreIfNecessary. If |browser| is non-null and we need // to restore, the tabs are added to it, otherwise a new browser is created. bool RestoreIfNecessary(const std::vector<GURL>& urls_to_open, |