| Index: chrome/browser/sessions/session_service.h
|
| diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h
|
| index 44a2ff5c6b06fbf5eb8fb9fb1a8afe386f9e41aa..cdd10ea68227971cb12c4a617742e6ca00c046ef 100644
|
| --- a/chrome/browser/sessions/session_service.h
|
| +++ b/chrome/browser/sessions/session_service.h
|
| @@ -15,7 +15,7 @@
|
| #include "base/task/cancelable_task_tracker.h"
|
| #include "base/time/time.h"
|
| #include "chrome/browser/defaults.h"
|
| -#include "chrome/browser/sessions/base_session_service.h"
|
| +#include "chrome/browser/sessions/base_session_service_delegate_impl.h"
|
| #include "chrome/browser/sessions/session_service_commands.h"
|
| #include "chrome/browser/sessions/session_service_utils.h"
|
| #include "chrome/browser/ui/browser.h"
|
| @@ -56,7 +56,7 @@ class WebContents;
|
| // flushed to |SessionBackend| and written to a file. Every so often
|
| // |SessionService| rebuilds the contents of the file from the open state of the
|
| // browser.
|
| -class SessionService : public BaseSessionService,
|
| +class SessionService : public BaseSessionServiceDelegateImpl,
|
| public KeyedService,
|
| public content::NotificationObserver,
|
| public chrome::BrowserListObserver {
|
| @@ -100,6 +100,9 @@ class SessionService : public BaseSessionService,
|
| // browsers are running.
|
| void MoveCurrentSessionToLastSession();
|
|
|
| + // Deletes the last session.
|
| + void DeleteLastSession();
|
| +
|
| // Associates a tab with a window.
|
| void SetTabWindow(const SessionID& window_id,
|
| const SessionID& tab_id);
|
| @@ -207,12 +210,12 @@ class SessionService : public BaseSessionService,
|
| const SessionCallback& callback,
|
| base::CancelableTaskTracker* tracker);
|
|
|
| - // Overridden from BaseSessionService because we want some UMA reporting on
|
| - // session update activities.
|
| - void Save() override;
|
| + // BaseSessionServiceDelegateImpl:
|
| + void OnSavedCommands() override;
|
|
|
| private:
|
| // Allow tests to access our innards for testing purposes.
|
| + FRIEND_TEST_ALL_PREFIXES(SessionServiceTest, SavedSessionNotification);
|
| FRIEND_TEST_ALL_PREFIXES(SessionServiceTest, RestoreActivation1);
|
| FRIEND_TEST_ALL_PREFIXES(SessionServiceTest, RestoreActivation2);
|
| FRIEND_TEST_ALL_PREFIXES(NoStartupWindowTest, DontInitSessionServiceForApps);
|
| @@ -229,10 +232,6 @@ class SessionService : public BaseSessionService,
|
| // Removes unrestorable windows from the previous windows list.
|
| void RemoveUnusedRestoreWindows(std::vector<SessionWindow*>* window_list);
|
|
|
| - // 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,
|
| @@ -261,7 +260,6 @@ class SessionService : public BaseSessionService,
|
| content::WebContents* tab,
|
| int index_in_window,
|
| bool is_pinned,
|
| - ScopedVector<SessionCommand>* commands,
|
| IdToRange* tab_to_available_range);
|
|
|
| // Adds commands to create the specified browser, and invokes
|
| @@ -269,7 +267,6 @@ class SessionService : public BaseSessionService,
|
| // any tabs not in the profile we were created with.
|
| void BuildCommandsForBrowser(
|
| Browser* browser,
|
| - ScopedVector<SessionCommand>* commands,
|
| IdToRange* tab_to_available_range,
|
| std::set<SessionID::id_type>* windows_to_track);
|
|
|
| @@ -278,7 +275,6 @@ class SessionService : public BaseSessionService,
|
| // returns true). All browsers that are tracked are added to windows_to_track
|
| // (as long as it is non-null).
|
| void BuildCommandsFromBrowsers(
|
| - ScopedVector<SessionCommand>* commands,
|
| IdToRange* tab_to_available_range,
|
| std::set<SessionID::id_type>* windows_to_track);
|
|
|
| @@ -287,7 +283,7 @@ class SessionService : public BaseSessionService,
|
| void ScheduleResetCommands();
|
|
|
| // Schedules the specified command.
|
| - void ScheduleCommand(scoped_ptr<SessionCommand> command) override;
|
| + void ScheduleCommand(scoped_ptr<SessionCommand> command);
|
|
|
| // Converts all pending tab/window closes to commands and schedules them.
|
| void CommitPendingCloses();
|
| @@ -327,9 +323,15 @@ class SessionService : public BaseSessionService,
|
| // Deletes session data if no windows are open for the current profile.
|
| void MaybeDeleteSessionOnlyData();
|
|
|
| + // Unit test accessors.
|
| + BaseSessionService* GetBaseSessionServiceForTest();
|
| +
|
| // The profile. This may be null during testing.
|
| Profile* profile_;
|
|
|
| + // The owned BaseSessionService.
|
| + scoped_ptr<BaseSessionService> base_session_service_;
|
| +
|
| content::NotificationRegistrar registrar_;
|
|
|
| // Maps from session tab id to the range of navigation entries that has
|
|
|