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

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

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

Powered by Google App Engine
This is Rietveld 408576698