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

Side by Side Diff: chrome/browser/sessions/session_service_commands.h

Issue 672083002: Refactoring of SessionService to get componentized. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing windows compile problem 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
(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_SESSION_SERVICE_COMMANDS_H_
6 #define CHROME_BROWSER_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 "chrome/browser/sessions/base_session_service.h"
17 #include "chrome/browser/sessions/session_types.h"
18 #include "ui/base/ui_base_types.h"
19
20 class SessionCommand;
21
22 // The following functions create sequentialized change commands which are
23 // used to reconstruct the current/previous session state.
24 // It is up to the caller to delete the returned SessionCommand* object.
25 SessionCommand* CreateSetSelectedTabInWindowCommand(
26 const SessionID& window_id,
27 int index);
28 SessionCommand* CreateSetTabWindowCommand(const SessionID& window_id,
29 const SessionID& tab_id);
30 SessionCommand* CreateSetWindowBoundsCommand(const SessionID& window_id,
31 const gfx::Rect& bounds,
32 ui::WindowShowState show_state);
33 SessionCommand* CreateSetTabIndexInWindowCommand(const SessionID& tab_id,
34 int new_index);
35 SessionCommand* CreateTabClosedCommand(SessionID::id_type tab_id);
36 SessionCommand* CreateWindowClosedCommand(SessionID::id_type tab_id);
37 SessionCommand* CreateSetSelectedNavigationIndexCommand(
38 const SessionID& tab_id,
39 int index);
40 SessionCommand* CreateSetWindowTypeCommand(const SessionID& window_id,
41 SessionWindow::WindowType type);
42 SessionCommand* CreatePinnedStateCommand(const SessionID& tab_id,
43 bool is_pinned);
44 SessionCommand* CreateSessionStorageAssociatedCommand(
45 const SessionID& tab_id,
46 const std::string& session_storage_persistent_id);
47 SessionCommand* CreateSetActiveWindowCommand(const SessionID& window_id);
48 SessionCommand* CreateTabNavigationPathPrunedFromBackCommand(
49 const SessionID& tab_id,
50 int count);
51 SessionCommand* CreateTabNavigationPathPrunedFromFrontCommand(
52 const SessionID& tab_id,
53 int count);
54 SessionCommand* CreateUpdateTabNavigationCommand(
55 const SessionID& tab_id,
56 const sessions::SerializedNavigationEntry& navigation);
57 SessionCommand* CreateSetTabExtensionAppIDCommand(
58 const SessionID& tab_id,
59 const std::string& extension_id);
60 SessionCommand* CreateSetTabUserAgentOverrideCommand(
61 const SessionID& tab_id,
62 const std::string& user_agent_override);
63 SessionCommand* CreateSetWindowAppNameCommand(const SessionID& window_id,
64 const std::string& app_name);
65
66 // Searches for a pending command in |pending_commands| that can be replaced
67 // with |command|. If one is found, pending command is removed, command is
68 // added to the pending commands and true is returned.
69 bool ReplacePendingCommand(SessionCommand* command,
70 std::vector<SessionCommand*>& pending_commands);
71
72 // Returns true if provided |command| either closes a window or a tab.
73 bool IsClosingCommand(SessionCommand* command);
74
75 // Converts a list of commands into SessionWindows. On return any valid
76 // windows are added to valid_windows. It is up to the caller to delete
77 // the windows added to valid_windows. |active_window_id| will be set with the
78 // id of the last active window, but it's only valid when this id corresponds
79 // to the id of one of the windows in valid_windows.
80 void RestoreSessionFromCommands(const std::vector<SessionCommand*>& commands,
81 std::vector<SessionWindow*>* valid_windows,
82 SessionID::id_type* active_window_id);
83
84 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_COMMANDS_H_
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_service.cc ('k') | chrome/browser/sessions/session_service_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698