| 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 COMPONENTS_SESSIONS_CORE_BASE_SESSION_SERVICE_COMMANDS_H_ | 5 #ifndef COMPONENTS_SESSIONS_CORE_BASE_SESSION_SERVICE_COMMANDS_H_ |
| 6 #define COMPONENTS_SESSIONS_CORE_BASE_SESSION_SERVICE_COMMANDS_H_ | 6 #define COMPONENTS_SESSIONS_CORE_BASE_SESSION_SERVICE_COMMANDS_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "components/sessions/core/session_id.h" | 11 #include "components/sessions/core/session_id.h" |
| 12 #include "components/sessions/core/sessions_export.h" | 12 #include "components/sessions/core/sessions_export.h" |
| 13 | 13 |
| 14 namespace sessions { | 14 namespace sessions { |
| 15 class SessionCommand; | 15 class SessionCommand; |
| 16 class SerializedNavigationEntry; | 16 class SerializedNavigationEntry; |
| 17 | 17 |
| 18 // These commands create and read common base commands for SessionService and | 18 // These commands create and read common base commands for SessionService and |
| 19 // PersistentTabRestoreService. | 19 // PersistentTabRestoreService. |
| 20 | 20 |
| 21 // Creates a SessionCommand that represents a navigation. | 21 // Creates a SessionCommand that represents a navigation. |
| 22 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateUpdateTabNavigationCommand( | 22 SESSIONS_EXPORT std::unique_ptr<SessionCommand> |
| 23 CreateUpdateTabNavigationCommand( |
| 23 SessionID::id_type command_id, | 24 SessionID::id_type command_id, |
| 24 SessionID::id_type tab_id, | 25 SessionID::id_type tab_id, |
| 25 const sessions::SerializedNavigationEntry& navigation); | 26 const sessions::SerializedNavigationEntry& navigation); |
| 26 | 27 |
| 27 // Creates a SessionCommand that represents marking a tab as an application. | 28 // Creates a SessionCommand that represents marking a tab as an application. |
| 28 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateSetTabExtensionAppIDCommand( | 29 SESSIONS_EXPORT std::unique_ptr<SessionCommand> |
| 29 SessionID::id_type command_id, | 30 CreateSetTabExtensionAppIDCommand(SessionID::id_type command_id, |
| 30 SessionID::id_type tab_id, | 31 SessionID::id_type tab_id, |
| 31 const std::string& extension_id); | 32 const std::string& extension_id); |
| 32 | 33 |
| 33 // Creates a SessionCommand that containing user agent override used by a | 34 // Creates a SessionCommand that containing user agent override used by a |
| 34 // tab's navigations. | 35 // tab's navigations. |
| 35 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateSetTabUserAgentOverrideCommand( | 36 SESSIONS_EXPORT std::unique_ptr<SessionCommand> |
| 36 SessionID::id_type command_id, | 37 CreateSetTabUserAgentOverrideCommand(SessionID::id_type command_id, |
| 37 SessionID::id_type tab_id, | 38 SessionID::id_type tab_id, |
| 38 const std::string& user_agent_override); | 39 const std::string& user_agent_override); |
| 39 | 40 |
| 40 // Creates a SessionCommand stores a browser window's app name. | 41 // Creates a SessionCommand stores a browser window's app name. |
| 41 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateSetWindowAppNameCommand( | 42 SESSIONS_EXPORT std::unique_ptr<SessionCommand> CreateSetWindowAppNameCommand( |
| 42 SessionID::id_type command_id, | 43 SessionID::id_type command_id, |
| 43 SessionID::id_type window_id, | 44 SessionID::id_type window_id, |
| 44 const std::string& app_name); | 45 const std::string& app_name); |
| 45 | 46 |
| 46 // Converts a SessionCommand previously created by | 47 // Converts a SessionCommand previously created by |
| 47 // CreateUpdateTabNavigationCommand into a | 48 // CreateUpdateTabNavigationCommand into a |
| 48 // SerializedNavigationEntry. Returns true on success. If | 49 // SerializedNavigationEntry. Returns true on success. If |
| 49 // successful |tab_id| is set to the id of the restored tab. | 50 // successful |tab_id| is set to the id of the restored tab. |
| 50 SESSIONS_EXPORT bool RestoreUpdateTabNavigationCommand( | 51 SESSIONS_EXPORT bool RestoreUpdateTabNavigationCommand( |
| 51 const SessionCommand& command, | 52 const SessionCommand& command, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 70 // Extracts a SessionCommand as previously created by | 71 // Extracts a SessionCommand as previously created by |
| 71 // CreateSetWindowAppNameCommand into the window id and application name. | 72 // CreateSetWindowAppNameCommand into the window id and application name. |
| 72 SESSIONS_EXPORT bool RestoreSetWindowAppNameCommand( | 73 SESSIONS_EXPORT bool RestoreSetWindowAppNameCommand( |
| 73 const SessionCommand& command, | 74 const SessionCommand& command, |
| 74 SessionID::id_type* window_id, | 75 SessionID::id_type* window_id, |
| 75 std::string* app_name); | 76 std::string* app_name); |
| 76 | 77 |
| 77 } // namespace sessions | 78 } // namespace sessions |
| 78 | 79 |
| 79 #endif // COMPONENTS_SESSIONS_CORE_BASE_SESSION_SERVICE_COMMANDS_H_ | 80 #endif // COMPONENTS_SESSIONS_CORE_BASE_SESSION_SERVICE_COMMANDS_H_ |
| OLD | NEW |