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

Unified Diff: chrome/browser/sessions/session_service_commands.h

Issue 685133004: Handling |SessionCommand|s as scoped_ptr's (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Created 6 years, 2 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
« no previous file with comments | « chrome/browser/sessions/session_service.cc ('k') | chrome/browser/sessions/session_service_commands.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_service_commands.h
diff --git a/chrome/browser/sessions/session_service_commands.h b/chrome/browser/sessions/session_service_commands.h
index b91b95727303a26233dbd788556d2c79121b7da3..25d92413bcd4eb046c084da82bbdee0bb5e4b73e 100644
--- a/chrome/browser/sessions/session_service_commands.h
+++ b/chrome/browser/sessions/session_service_commands.h
@@ -22,52 +22,58 @@ class SessionCommand;
// The following functions create sequentialized change commands which are
// used to reconstruct the current/previous session state.
// It is up to the caller to delete the returned SessionCommand* object.
-SessionCommand* CreateSetSelectedTabInWindowCommand(
+scoped_ptr<SessionCommand> CreateSetSelectedTabInWindowCommand(
const SessionID& window_id,
int index);
-SessionCommand* CreateSetTabWindowCommand(const SessionID& window_id,
- const SessionID& tab_id);
-SessionCommand* CreateSetWindowBoundsCommand(const SessionID& window_id,
- const gfx::Rect& bounds,
- ui::WindowShowState show_state);
-SessionCommand* CreateSetTabIndexInWindowCommand(const SessionID& tab_id,
- int new_index);
-SessionCommand* CreateTabClosedCommand(SessionID::id_type tab_id);
-SessionCommand* CreateWindowClosedCommand(SessionID::id_type tab_id);
-SessionCommand* CreateSetSelectedNavigationIndexCommand(
+scoped_ptr<SessionCommand> CreateSetTabWindowCommand(const SessionID& window_id,
+ const SessionID& tab_id);
+scoped_ptr<SessionCommand> CreateSetWindowBoundsCommand(
+ const SessionID& window_id,
+ const gfx::Rect& bounds,
+ ui::WindowShowState show_state);
+scoped_ptr<SessionCommand> CreateSetTabIndexInWindowCommand(
+ const SessionID& tab_id,
+ int new_index);
+scoped_ptr<SessionCommand> CreateTabClosedCommand(SessionID::id_type tab_id);
+scoped_ptr<SessionCommand> CreateWindowClosedCommand(SessionID::id_type tab_id);
+scoped_ptr<SessionCommand> CreateSetSelectedNavigationIndexCommand(
const SessionID& tab_id,
int index);
-SessionCommand* CreateSetWindowTypeCommand(const SessionID& window_id,
- SessionWindow::WindowType type);
-SessionCommand* CreatePinnedStateCommand(const SessionID& tab_id,
+scoped_ptr<SessionCommand> CreateSetWindowTypeCommand(
+ const SessionID& window_id,
+ SessionWindow::WindowType type);
+scoped_ptr<SessionCommand> CreatePinnedStateCommand(const SessionID& tab_id,
bool is_pinned);
-SessionCommand* CreateSessionStorageAssociatedCommand(
+scoped_ptr<SessionCommand> CreateSessionStorageAssociatedCommand(
const SessionID& tab_id,
const std::string& session_storage_persistent_id);
-SessionCommand* CreateSetActiveWindowCommand(const SessionID& window_id);
-SessionCommand* CreateTabNavigationPathPrunedFromBackCommand(
+scoped_ptr<SessionCommand> CreateSetActiveWindowCommand(
+ const SessionID& window_id);
+scoped_ptr<SessionCommand> CreateTabNavigationPathPrunedFromBackCommand(
const SessionID& tab_id,
int count);
-SessionCommand* CreateTabNavigationPathPrunedFromFrontCommand(
+scoped_ptr<SessionCommand> CreateTabNavigationPathPrunedFromFrontCommand(
const SessionID& tab_id,
int count);
-SessionCommand* CreateUpdateTabNavigationCommand(
+scoped_ptr<SessionCommand> CreateUpdateTabNavigationCommand(
const SessionID& tab_id,
const sessions::SerializedNavigationEntry& navigation);
-SessionCommand* CreateSetTabExtensionAppIDCommand(
+scoped_ptr<SessionCommand> CreateSetTabExtensionAppIDCommand(
const SessionID& tab_id,
const std::string& extension_id);
-SessionCommand* CreateSetTabUserAgentOverrideCommand(
+scoped_ptr<SessionCommand> CreateSetTabUserAgentOverrideCommand(
const SessionID& tab_id,
const std::string& user_agent_override);
-SessionCommand* CreateSetWindowAppNameCommand(const SessionID& window_id,
- const std::string& app_name);
+scoped_ptr<SessionCommand> CreateSetWindowAppNameCommand(
+ const SessionID& window_id,
+ const std::string& app_name);
// Searches for a pending command in |pending_commands| that can be replaced
-// with |command|. If one is found, pending command is removed, command is
-// added to the pending commands and true is returned.
-bool ReplacePendingCommand(SessionCommand* command,
- std::vector<SessionCommand*>& pending_commands);
+// with |command|. If one is found, pending command is removed, the command
+// is added to the pending commands (taken ownership) and true is returned.
+bool ReplacePendingCommand(
+ ScopedVector<SessionCommand>& pending_commands,
+ scoped_ptr<SessionCommand>* command);
// Returns true if provided |command| either closes a window or a tab.
bool IsClosingCommand(SessionCommand* command);
@@ -77,7 +83,7 @@ bool IsClosingCommand(SessionCommand* command);
// the windows added to valid_windows. |active_window_id| will be set with the
// id of the last active window, but it's only valid when this id corresponds
// to the id of one of the windows in valid_windows.
-void RestoreSessionFromCommands(const std::vector<SessionCommand*>& commands,
+void RestoreSessionFromCommands(const ScopedVector<SessionCommand>& commands,
std::vector<SessionWindow*>* valid_windows,
SessionID::id_type* active_window_id);
« no previous file with comments | « chrome/browser/sessions/session_service.cc ('k') | chrome/browser/sessions/session_service_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698