OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_SERVICE_COMMANDS_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_SERVICE_COMMANDS_H_ |
6 #define CHROME_BROWSER_SESSIONS_SESSION_SERVICE_COMMANDS_H_ | 6 #define CHROME_BROWSER_SESSIONS_SESSION_SERVICE_COMMANDS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 scoped_ptr<SessionCommand> CreateSetTabExtensionAppIDCommand( | 61 scoped_ptr<SessionCommand> CreateSetTabExtensionAppIDCommand( |
62 const SessionID& tab_id, | 62 const SessionID& tab_id, |
63 const std::string& extension_id); | 63 const std::string& extension_id); |
64 scoped_ptr<SessionCommand> CreateSetTabUserAgentOverrideCommand( | 64 scoped_ptr<SessionCommand> CreateSetTabUserAgentOverrideCommand( |
65 const SessionID& tab_id, | 65 const SessionID& tab_id, |
66 const std::string& user_agent_override); | 66 const std::string& user_agent_override); |
67 scoped_ptr<SessionCommand> CreateSetWindowAppNameCommand( | 67 scoped_ptr<SessionCommand> CreateSetWindowAppNameCommand( |
68 const SessionID& window_id, | 68 const SessionID& window_id, |
69 const std::string& app_name); | 69 const std::string& app_name); |
70 | 70 |
71 // Searches for a pending command in |pending_commands| that can be replaced | 71 // Searches for a pending command using |base_session_service| that can be |
72 // with |command|. If one is found, pending command is removed, the command | 72 // replaced with |command|. If one is found, pending command is removed, the |
73 // is added to the pending commands (taken ownership) and true is returned. | 73 // command is added to the pending commands (taken ownership) and true is |
74 bool ReplacePendingCommand( | 74 // returned. |
75 ScopedVector<SessionCommand>& pending_commands, | 75 bool ReplacePendingCommand(BaseSessionService* base_session_service, |
76 scoped_ptr<SessionCommand>* command); | 76 scoped_ptr<SessionCommand>* command); |
77 | 77 |
78 // Returns true if provided |command| either closes a window or a tab. | 78 // Returns true if provided |command| either closes a window or a tab. |
79 bool IsClosingCommand(SessionCommand* command); | 79 bool IsClosingCommand(SessionCommand* command); |
80 | 80 |
81 // Converts a list of commands into SessionWindows. On return any valid | 81 // Converts a list of commands into SessionWindows. On return any valid |
82 // windows are added to valid_windows. It is up to the caller to delete | 82 // windows are added to valid_windows. It is up to the caller to delete |
83 // the windows added to valid_windows. |active_window_id| will be set with the | 83 // the windows added to valid_windows. |active_window_id| will be set with the |
84 // id of the last active window, but it's only valid when this id corresponds | 84 // id of the last active window, but it's only valid when this id corresponds |
85 // to the id of one of the windows in valid_windows. | 85 // to the id of one of the windows in valid_windows. |
86 void RestoreSessionFromCommands(const ScopedVector<SessionCommand>& commands, | 86 void RestoreSessionFromCommands(const ScopedVector<SessionCommand>& commands, |
87 std::vector<SessionWindow*>* valid_windows, | 87 std::vector<SessionWindow*>* valid_windows, |
88 SessionID::id_type* active_window_id); | 88 SessionID::id_type* active_window_id); |
89 | 89 |
90 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_COMMANDS_H_ | 90 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_COMMANDS_H_ |
OLD | NEW |