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

Side by Side Diff: chrome/browser/sessions/base_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, 1 month 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 unified diff | Download patch
OLDNEW
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_BASE_SESSION_SERVICE_COMMANDS_H_ 5 #ifndef CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_COMMANDS_H_
6 #define CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_COMMANDS_H_ 6 #define CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_COMMANDS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h"
10 #include "components/sessions/session_id.h" 11 #include "components/sessions/session_id.h"
11 12
12 class SessionCommand; 13 class SessionCommand;
13 14
14 namespace sessions { 15 namespace sessions {
15 class SerializedNavigationEntry; 16 class SerializedNavigationEntry;
16 } 17 }
17 18
18 // These commands create and read common base commands for SessionService and 19 // These commands create and read common base commands for SessionService and
19 // PersistentTabRestoreService. 20 // PersistentTabRestoreService.
20 // TODO(skuhne): Make ownership cleaner by using scoped_ptr's for return values.
21 21
22 // Creates a SessionCommand that represents a navigation. 22 // Creates a SessionCommand that represents a navigation.
23 SessionCommand* CreateUpdateTabNavigationCommand( 23 scoped_ptr<SessionCommand> CreateUpdateTabNavigationCommand(
24 SessionID::id_type command_id, 24 SessionID::id_type command_id,
25 SessionID::id_type tab_id, 25 SessionID::id_type tab_id,
26 const sessions::SerializedNavigationEntry& navigation); 26 const sessions::SerializedNavigationEntry& navigation);
27 27
28 // Creates a SessionCommand that represents marking a tab as an application. 28 // Creates a SessionCommand that represents marking a tab as an application.
29 SessionCommand* CreateSetTabExtensionAppIDCommand( 29 scoped_ptr<SessionCommand> CreateSetTabExtensionAppIDCommand(
30 SessionID::id_type command_id, 30 SessionID::id_type command_id,
31 SessionID::id_type tab_id, 31 SessionID::id_type tab_id,
32 const std::string& extension_id); 32 const std::string& extension_id);
33 33
34 // Creates a SessionCommand that containing user agent override used by a 34 // Creates a SessionCommand that containing user agent override used by a
35 // tab's navigations. 35 // tab's navigations.
36 SessionCommand* CreateSetTabUserAgentOverrideCommand( 36 scoped_ptr<SessionCommand> CreateSetTabUserAgentOverrideCommand(
37 SessionID::id_type command_id, 37 SessionID::id_type command_id,
38 SessionID::id_type tab_id, 38 SessionID::id_type tab_id,
39 const std::string& user_agent_override); 39 const std::string& user_agent_override);
40 40
41 // Creates a SessionCommand stores a browser window's app name. 41 // Creates a SessionCommand stores a browser window's app name.
42 SessionCommand* CreateSetWindowAppNameCommand(SessionID::id_type command_id, 42 scoped_ptr<SessionCommand> CreateSetWindowAppNameCommand(
43 SessionID::id_type window_id, 43 SessionID::id_type command_id,
44 const std::string& app_name); 44 SessionID::id_type window_id,
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 // sessions::SerializedNavigationEntry. Returns true on success. If 49 // sessions::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 bool RestoreUpdateTabNavigationCommand( 51 bool RestoreUpdateTabNavigationCommand(
51 const SessionCommand& command, 52 const SessionCommand& command,
52 sessions::SerializedNavigationEntry* navigation, 53 sessions::SerializedNavigationEntry* navigation,
53 SessionID::id_type* tab_id); 54 SessionID::id_type* tab_id);
54 55
(...skipping 10 matching lines...) Expand all
65 SessionID::id_type* tab_id, 66 SessionID::id_type* tab_id,
66 std::string* user_agent_override); 67 std::string* user_agent_override);
67 68
68 // Extracts a SessionCommand as previously created by 69 // Extracts a SessionCommand as previously created by
69 // CreateSetWindowAppNameCommand into the window id and application name. 70 // CreateSetWindowAppNameCommand into the window id and application name.
70 bool RestoreSetWindowAppNameCommand(const SessionCommand& command, 71 bool RestoreSetWindowAppNameCommand(const SessionCommand& command,
71 SessionID::id_type* window_id, 72 SessionID::id_type* window_id,
72 std::string* app_name); 73 std::string* app_name);
73 74
74 #endif // CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_COMMANDS_H_ 75 #endif // CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_COMMANDS_H_
OLDNEW
« no previous file with comments | « chrome/browser/sessions/base_session_service.cc ('k') | chrome/browser/sessions/base_session_service_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698