OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_COMMANDS_H_ |
| 6 #define CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_COMMANDS_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "components/sessions/session_id.h" |
| 11 |
| 12 class SessionCommand; |
| 13 |
| 14 namespace sessions { |
| 15 class SerializedNavigationEntry; |
| 16 } |
| 17 |
| 18 // These commands create and read common base commands for SessionService and |
| 19 // PersistentTabRestoreService. |
| 20 // TODO(skuhne): Make ownership cleaner by using scoped_ptr's for return values. |
| 21 |
| 22 // Creates a SessionCommand that represents a navigation. |
| 23 SessionCommand* CreateUpdateTabNavigationCommand( |
| 24 SessionID::id_type command_id, |
| 25 SessionID::id_type tab_id, |
| 26 const sessions::SerializedNavigationEntry& navigation); |
| 27 |
| 28 // Creates a SessionCommand that represents marking a tab as an application. |
| 29 SessionCommand* CreateSetTabExtensionAppIDCommand( |
| 30 SessionID::id_type command_id, |
| 31 SessionID::id_type tab_id, |
| 32 const std::string& extension_id); |
| 33 |
| 34 // Creates a SessionCommand that containing user agent override used by a |
| 35 // tab's navigations. |
| 36 SessionCommand* CreateSetTabUserAgentOverrideCommand( |
| 37 SessionID::id_type command_id, |
| 38 SessionID::id_type tab_id, |
| 39 const std::string& user_agent_override); |
| 40 |
| 41 // Creates a SessionCommand stores a browser window's app name. |
| 42 SessionCommand* CreateSetWindowAppNameCommand(SessionID::id_type command_id, |
| 43 SessionID::id_type window_id, |
| 44 const std::string& app_name); |
| 45 |
| 46 // Converts a SessionCommand previously created by |
| 47 // CreateUpdateTabNavigationCommand into a |
| 48 // sessions::SerializedNavigationEntry. Returns true on success. If |
| 49 // successful |tab_id| is set to the id of the restored tab. |
| 50 bool RestoreUpdateTabNavigationCommand( |
| 51 const SessionCommand& command, |
| 52 sessions::SerializedNavigationEntry* navigation, |
| 53 SessionID::id_type* tab_id); |
| 54 |
| 55 // Extracts a SessionCommand as previously created by |
| 56 // CreateSetTabExtensionAppIDCommand into the tab id and application |
| 57 // extension id. |
| 58 bool RestoreSetTabExtensionAppIDCommand(const SessionCommand& command, |
| 59 SessionID::id_type* tab_id, |
| 60 std::string* extension_app_id); |
| 61 |
| 62 // Extracts a SessionCommand as previously created by |
| 63 // CreateSetTabUserAgentOverrideCommand into the tab id and user agent. |
| 64 bool RestoreSetTabUserAgentOverrideCommand(const SessionCommand& command, |
| 65 SessionID::id_type* tab_id, |
| 66 std::string* user_agent_override); |
| 67 |
| 68 // Extracts a SessionCommand as previously created by |
| 69 // CreateSetWindowAppNameCommand into the window id and application name. |
| 70 bool RestoreSetWindowAppNameCommand(const SessionCommand& command, |
| 71 SessionID::id_type* window_id, |
| 72 std::string* app_name); |
| 73 |
| 74 #endif // CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_COMMANDS_H_ |
OLD | NEW |