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 "base/memory/scoped_ptr.h" | |
11 #include "components/sessions/session_id.h" | |
12 | |
13 class SessionCommand; | |
14 | |
15 namespace sessions { | |
16 class SerializedNavigationEntry; | |
17 } | |
18 | |
19 // BaseSessionServiceCommands is the super class of both tab restore service | |
20 // and session service for command creation and restoration. | |
21 namespace BaseSessionServiceCommands { | |
sky
2014/10/27 23:49:34
no namespace here.
Mr4D (OOO till 08-26)
2014/10/28 21:45:38
Done.
| |
22 | |
23 // Creates a SessionCommand that represents a navigation. | |
24 scoped_ptr<SessionCommand> CreateUpdateTabNavigationCommand( | |
25 SessionID::id_type command_id, | |
26 SessionID::id_type tab_id, | |
27 const sessions::SerializedNavigationEntry& navigation); | |
28 | |
29 // Creates a SessionCommand that represents marking a tab as an application. | |
30 scoped_ptr<SessionCommand> CreateSetTabExtensionAppIDCommand( | |
31 SessionID::id_type command_id, | |
32 SessionID::id_type tab_id, | |
33 const std::string& extension_id); | |
34 | |
35 // Creates a SessionCommand that containing user agent override used by a | |
36 // tab's navigations. | |
37 scoped_ptr<SessionCommand> CreateSetTabUserAgentOverrideCommand( | |
38 SessionID::id_type command_id, | |
39 SessionID::id_type tab_id, | |
40 const std::string& user_agent_override); | |
41 | |
42 // Creates a SessionCommand stores a browser window's app name. | |
43 scoped_ptr<SessionCommand> CreateSetWindowAppNameCommand( | |
44 SessionID::id_type command_id, | |
45 SessionID::id_type window_id, | |
46 const std::string& app_name); | |
47 | |
48 // Converts a SessionCommand previously created by | |
49 // CreateUpdateTabNavigationCommand into a | |
50 // sessions::SerializedNavigationEntry. Returns true on success. If | |
51 // successful |tab_id| is set to the id of the restored tab. | |
52 bool RestoreUpdateTabNavigationCommand( | |
53 const SessionCommand& command, | |
54 sessions::SerializedNavigationEntry* navigation, | |
55 SessionID::id_type* tab_id); | |
56 | |
57 // Extracts a SessionCommand as previously created by | |
58 // CreateSetTabExtensionAppIDCommand into the tab id and application | |
59 // extension id. | |
60 bool RestoreSetTabExtensionAppIDCommand(const SessionCommand& command, | |
61 SessionID::id_type* tab_id, | |
62 std::string* extension_app_id); | |
63 | |
64 // Extracts a SessionCommand as previously created by | |
65 // CreateSetTabUserAgentOverrideCommand into the tab id and user agent. | |
66 bool RestoreSetTabUserAgentOverrideCommand(const SessionCommand& command, | |
67 SessionID::id_type* tab_id, | |
68 std::string* user_agent_override); | |
69 | |
70 // Extracts a SessionCommand as previously created by | |
71 // CreateSetWindowAppNameCommand into the window id and application name. | |
72 bool RestoreSetWindowAppNameCommand(const SessionCommand& command, | |
73 SessionID::id_type* window_id, | |
74 std::string* app_name); | |
75 | |
76 } // namespace BaseSessionServiceCommands | |
77 | |
78 #endif // CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_COMMANDS_H_ | |
OLD | NEW |