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

Side by Side Diff: components/sessions/core/session_service_commands.h

Issue 1912843002: Convert //components/sessions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 COMPONENTS_SESSIONS_CORE_SESSION_SERVICE_COMMANDS_H_ 5 #ifndef COMPONENTS_SESSIONS_CORE_SESSION_SERVICE_COMMANDS_H_
6 #define COMPONENTS_SESSIONS_CORE_SESSION_SERVICE_COMMANDS_H_ 6 #define COMPONENTS_SESSIONS_CORE_SESSION_SERVICE_COMMANDS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/task/cancelable_task_tracker.h" 14 #include "base/task/cancelable_task_tracker.h"
15 #include "components/sessions/core/base_session_service.h" 15 #include "components/sessions/core/base_session_service.h"
16 #include "components/sessions/core/session_types.h" 16 #include "components/sessions/core/session_types.h"
17 #include "components/sessions/core/sessions_export.h" 17 #include "components/sessions/core/sessions_export.h"
18 #include "ui/base/ui_base_types.h" 18 #include "ui/base/ui_base_types.h"
19 19
20 namespace sessions { 20 namespace sessions {
21 21
22 class SessionCommand; 22 class SessionCommand;
23 23
24 // The following functions create sequentialized change commands which are 24 // The following functions create sequentialized change commands which are
25 // used to reconstruct the current/previous session state. 25 // used to reconstruct the current/previous session state.
26 // It is up to the caller to delete the returned SessionCommand* object. 26 // It is up to the caller to delete the returned SessionCommand* object.
27 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateSetSelectedTabInWindowCommand( 27 SESSIONS_EXPORT std::unique_ptr<SessionCommand>
28 const SessionID& window_id, 28 CreateSetSelectedTabInWindowCommand(const SessionID& window_id, int index);
29 int index); 29 SESSIONS_EXPORT std::unique_ptr<SessionCommand> CreateSetTabWindowCommand(
30 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateSetTabWindowCommand(
31 const SessionID& window_id, 30 const SessionID& window_id,
32 const SessionID& tab_id); 31 const SessionID& tab_id);
33 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateSetWindowBoundsCommand( 32 SESSIONS_EXPORT std::unique_ptr<SessionCommand> CreateSetWindowBoundsCommand(
34 const SessionID& window_id, 33 const SessionID& window_id,
35 const gfx::Rect& bounds, 34 const gfx::Rect& bounds,
36 ui::WindowShowState show_state); 35 ui::WindowShowState show_state);
37 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateSetTabIndexInWindowCommand( 36 SESSIONS_EXPORT std::unique_ptr<SessionCommand>
38 const SessionID& tab_id, 37 CreateSetTabIndexInWindowCommand(const SessionID& tab_id, int new_index);
39 int new_index); 38 SESSIONS_EXPORT std::unique_ptr<SessionCommand> CreateTabClosedCommand(
40 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateTabClosedCommand(
41 SessionID::id_type tab_id); 39 SessionID::id_type tab_id);
42 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateWindowClosedCommand( 40 SESSIONS_EXPORT std::unique_ptr<SessionCommand> CreateWindowClosedCommand(
43 SessionID::id_type tab_id); 41 SessionID::id_type tab_id);
44 SESSIONS_EXPORT scoped_ptr<SessionCommand> 42 SESSIONS_EXPORT std::unique_ptr<SessionCommand>
45 CreateSetSelectedNavigationIndexCommand( 43 CreateSetSelectedNavigationIndexCommand(const SessionID& tab_id, int index);
46 const SessionID& tab_id, 44 SESSIONS_EXPORT std::unique_ptr<SessionCommand> CreateSetWindowTypeCommand(
47 int index);
48 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateSetWindowTypeCommand(
49 const SessionID& window_id, 45 const SessionID& window_id,
50 SessionWindow::WindowType type); 46 SessionWindow::WindowType type);
51 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreatePinnedStateCommand( 47 SESSIONS_EXPORT std::unique_ptr<SessionCommand> CreatePinnedStateCommand(
52 const SessionID& tab_id, 48 const SessionID& tab_id,
53 bool is_pinned); 49 bool is_pinned);
54 SESSIONS_EXPORT scoped_ptr<SessionCommand> 50 SESSIONS_EXPORT std::unique_ptr<SessionCommand>
55 CreateSessionStorageAssociatedCommand( 51 CreateSessionStorageAssociatedCommand(
56 const SessionID& tab_id, 52 const SessionID& tab_id,
57 const std::string& session_storage_persistent_id); 53 const std::string& session_storage_persistent_id);
58 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateSetActiveWindowCommand( 54 SESSIONS_EXPORT std::unique_ptr<SessionCommand> CreateSetActiveWindowCommand(
59 const SessionID& window_id); 55 const SessionID& window_id);
60 SESSIONS_EXPORT scoped_ptr<SessionCommand> 56 SESSIONS_EXPORT std::unique_ptr<SessionCommand>
61 CreateTabNavigationPathPrunedFromBackCommand( 57 CreateTabNavigationPathPrunedFromBackCommand(const SessionID& tab_id,
62 const SessionID& tab_id, 58 int count);
63 int count); 59 SESSIONS_EXPORT std::unique_ptr<SessionCommand>
64 SESSIONS_EXPORT scoped_ptr<SessionCommand> 60 CreateTabNavigationPathPrunedFromFrontCommand(const SessionID& tab_id,
65 CreateTabNavigationPathPrunedFromFrontCommand( 61 int count);
66 const SessionID& tab_id, 62 SESSIONS_EXPORT std::unique_ptr<SessionCommand>
67 int count); 63 CreateUpdateTabNavigationCommand(
68 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateUpdateTabNavigationCommand(
69 const SessionID& tab_id, 64 const SessionID& tab_id,
70 const sessions::SerializedNavigationEntry& navigation); 65 const sessions::SerializedNavigationEntry& navigation);
71 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateSetTabExtensionAppIDCommand( 66 SESSIONS_EXPORT std::unique_ptr<SessionCommand>
72 const SessionID& tab_id, 67 CreateSetTabExtensionAppIDCommand(const SessionID& tab_id,
73 const std::string& extension_id); 68 const std::string& extension_id);
74 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateSetTabUserAgentOverrideCommand( 69 SESSIONS_EXPORT std::unique_ptr<SessionCommand>
75 const SessionID& tab_id, 70 CreateSetTabUserAgentOverrideCommand(const SessionID& tab_id,
76 const std::string& user_agent_override); 71 const std::string& user_agent_override);
77 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateSetWindowAppNameCommand( 72 SESSIONS_EXPORT std::unique_ptr<SessionCommand> CreateSetWindowAppNameCommand(
78 const SessionID& window_id, 73 const SessionID& window_id,
79 const std::string& app_name); 74 const std::string& app_name);
80 SESSIONS_EXPORT scoped_ptr<SessionCommand> CreateLastActiveTimeCommand( 75 SESSIONS_EXPORT std::unique_ptr<SessionCommand> CreateLastActiveTimeCommand(
81 const SessionID& tab_id, 76 const SessionID& tab_id,
82 base::TimeTicks last_active_time); 77 base::TimeTicks last_active_time);
83 78
84 // Searches for a pending command using |base_session_service| that can be 79 // Searches for a pending command using |base_session_service| that can be
85 // replaced with |command|. If one is found, pending command is removed, the 80 // replaced with |command|. If one is found, pending command is removed, the
86 // command is added to the pending commands (taken ownership) and true is 81 // command is added to the pending commands (taken ownership) and true is
87 // returned. 82 // returned.
88 SESSIONS_EXPORT bool ReplacePendingCommand( 83 SESSIONS_EXPORT bool ReplacePendingCommand(
89 BaseSessionService* base_session_service, 84 BaseSessionService* base_session_service,
90 scoped_ptr<SessionCommand>* command); 85 std::unique_ptr<SessionCommand>* command);
91 86
92 // Returns true if provided |command| either closes a window or a tab. 87 // Returns true if provided |command| either closes a window or a tab.
93 SESSIONS_EXPORT bool IsClosingCommand(SessionCommand* command); 88 SESSIONS_EXPORT bool IsClosingCommand(SessionCommand* command);
94 89
95 // Converts a list of commands into SessionWindows. On return any valid 90 // Converts a list of commands into SessionWindows. On return any valid
96 // windows are added to valid_windows. It is up to the caller to delete 91 // windows are added to valid_windows. It is up to the caller to delete
97 // the windows added to valid_windows. |active_window_id| will be set with the 92 // the windows added to valid_windows. |active_window_id| will be set with the
98 // id of the last active window, but it's only valid when this id corresponds 93 // id of the last active window, but it's only valid when this id corresponds
99 // to the id of one of the windows in valid_windows. 94 // to the id of one of the windows in valid_windows.
100 SESSIONS_EXPORT void RestoreSessionFromCommands( 95 SESSIONS_EXPORT void RestoreSessionFromCommands(
101 const ScopedVector<SessionCommand>& commands, 96 const ScopedVector<SessionCommand>& commands,
102 std::vector<SessionWindow*>* valid_windows, 97 std::vector<SessionWindow*>* valid_windows,
103 SessionID::id_type* active_window_id); 98 SessionID::id_type* active_window_id);
104 99
105 } // namespace sessions 100 } // namespace sessions
106 101
107 #endif // COMPONENTS_SESSIONS_CORE_SESSION_SERVICE_COMMANDS_H_ 102 #endif // COMPONENTS_SESSIONS_CORE_SESSION_SERVICE_COMMANDS_H_
OLDNEW
« no previous file with comments | « components/sessions/core/session_backend.cc ('k') | components/sessions/core/session_service_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698