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

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

Issue 672083002: Refactoring of SessionService to get componentized. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_H_ 5 #ifndef CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_
6 #define CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ 6 #define CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/task/cancelable_task_tracker.h" 16 #include "base/task/cancelable_task_tracker.h"
17 #include "base/threading/sequenced_worker_pool.h" 17 #include "base/threading/sequenced_worker_pool.h"
18 #include "components/sessions/session_id.h" 18 #include "components/sessions/session_id.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 class BaseSessionServiceDelegate; 21 class BaseSessionServiceDelegate;
22 class SessionBackend; 22 class SessionBackend;
23 class SessionCommand; 23 class SessionCommand;
24 class SessionCommands; // TODO(skuhne): Remove this
24 25
25 namespace sessions { 26 namespace sessions {
26 class SerializedNavigationEntry; 27 class SerializedNavigationEntry;
27 } 28 }
28 29
29 // BaseSessionService is the super class of both tab restore service and 30 // BaseSessionService is the super class of both tab restore service and
30 // session service. It contains commonality needed by both, in particular 31 // session service. It contains commonality needed by both, in particular
31 // it manages a set of SessionCommands that are periodically sent to a 32 // it manages a set of SessionCommands that are periodically sent to a
32 // SessionBackend. 33 // SessionBackend.
33 class BaseSessionService { 34 class BaseSessionService {
(...skipping 12 matching lines...) Expand all
46 const base::FilePath& path, 47 const base::FilePath& path,
47 scoped_ptr<BaseSessionServiceDelegate> delegate); 48 scoped_ptr<BaseSessionServiceDelegate> delegate);
48 49
49 // Deletes the last session. 50 // Deletes the last session.
50 void DeleteLastSession(); 51 void DeleteLastSession();
51 52
52 typedef base::Callback<void(ScopedVector<SessionCommand>)> 53 typedef base::Callback<void(ScopedVector<SessionCommand>)>
53 InternalGetCommandsCallback; 54 InternalGetCommandsCallback;
54 55
55 protected: 56 protected:
57 friend SessionCommands; // TODO(skuhne): Remove this.
56 virtual ~BaseSessionService(); 58 virtual ~BaseSessionService();
57 59
58 // Returns the backend. 60 // Returns the backend.
59 SessionBackend* backend() const { return backend_.get(); } 61 SessionBackend* backend() const { return backend_.get(); }
60 62
61 // Returns the set of commands that needed to be scheduled. The commands 63 // Returns the set of commands that needed to be scheduled. The commands
62 // in the vector are owned by BaseSessionService, until they are scheduled 64 // in the vector are owned by BaseSessionService, until they are scheduled
63 // on the backend at which point the backend owns the commands. 65 // on the backend at which point the backend owns the commands.
64 std::vector<SessionCommand*>& pending_commands() { 66 std::vector<SessionCommand*>& pending_commands() {
65 return pending_commands_; 67 return pending_commands_;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // A token to make sure that all tasks will be serialized. 181 // A token to make sure that all tasks will be serialized.
180 base::SequencedWorkerPool::SequenceToken sequence_token_; 182 base::SequencedWorkerPool::SequenceToken sequence_token_;
181 183
182 // Used to invoke Save. 184 // Used to invoke Save.
183 base::WeakPtrFactory<BaseSessionService> weak_factory_; 185 base::WeakPtrFactory<BaseSessionService> weak_factory_;
184 186
185 DISALLOW_COPY_AND_ASSIGN(BaseSessionService); 187 DISALLOW_COPY_AND_ASSIGN(BaseSessionService);
186 }; 188 };
187 189
188 #endif // CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_ 190 #endif // CHROME_BROWSER_SESSIONS_BASE_SESSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698