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

Side by Side Diff: chrome/browser/sessions/session_backend.cc

Issue 8677030: base::Bind: Convert more of chrome/browser/sessions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/sessions/session_backend.h" 5 #include "chrome/browser/sessions/session_backend.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 STLDeleteElements(commands); 237 STLDeleteElements(commands);
238 delete commands; 238 delete commands;
239 } 239 }
240 240
241 void SessionBackend::ReadLastSessionCommands( 241 void SessionBackend::ReadLastSessionCommands(
242 scoped_refptr<BaseSessionService::InternalGetCommandsRequest> request) { 242 scoped_refptr<BaseSessionService::InternalGetCommandsRequest> request) {
243 if (request->canceled()) 243 if (request->canceled())
244 return; 244 return;
245 Init(); 245 Init();
246 ReadLastSessionCommandsImpl(&(request->commands)); 246 ReadLastSessionCommandsImpl(&(request->commands));
247 request->ForwardResult( 247 request->ForwardResult(request->handle(), request);
248 BaseSessionService::InternalGetCommandsRequest::TupleType(
249 request->handle(), request));
250 } 248 }
251 249
252 bool SessionBackend::ReadLastSessionCommandsImpl( 250 bool SessionBackend::ReadLastSessionCommandsImpl(
253 std::vector<SessionCommand*>* commands) { 251 std::vector<SessionCommand*>* commands) {
254 Init(); 252 Init();
255 SessionFileReader file_reader(GetLastSessionPath()); 253 SessionFileReader file_reader(GetLastSessionPath());
256 return file_reader.Read(type_, commands); 254 return file_reader.Read(type_, commands);
257 } 255 }
258 256
259 void SessionBackend::DeleteLastSession() { 257 void SessionBackend::DeleteLastSession() {
(...skipping 30 matching lines...) Expand all
290 // Create and open the file for the current session. 288 // Create and open the file for the current session.
291 ResetFile(); 289 ResetFile();
292 } 290 }
293 291
294 void SessionBackend::ReadCurrentSessionCommands( 292 void SessionBackend::ReadCurrentSessionCommands(
295 scoped_refptr<BaseSessionService::InternalGetCommandsRequest> request) { 293 scoped_refptr<BaseSessionService::InternalGetCommandsRequest> request) {
296 if (request->canceled()) 294 if (request->canceled())
297 return; 295 return;
298 Init(); 296 Init();
299 ReadCurrentSessionCommandsImpl(&(request->commands)); 297 ReadCurrentSessionCommandsImpl(&(request->commands));
300 request->ForwardResult( 298 request->ForwardResult(request->handle(), request);
301 BaseSessionService::InternalGetCommandsRequest::TupleType(
302 request->handle(), request));
303 } 299 }
304 300
305 bool SessionBackend::ReadCurrentSessionCommandsImpl( 301 bool SessionBackend::ReadCurrentSessionCommandsImpl(
306 std::vector<SessionCommand*>* commands) { 302 std::vector<SessionCommand*>* commands) {
307 Init(); 303 Init();
308 SessionFileReader file_reader(GetCurrentSessionPath()); 304 SessionFileReader file_reader(GetCurrentSessionPath());
309 return file_reader.Read(type_, commands); 305 return file_reader.Read(type_, commands);
310 } 306 }
311 307
312 bool SessionBackend::AppendCommandsToFile(net::FileStream* file, 308 bool SessionBackend::AppendCommandsToFile(net::FileStream* file,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 388 }
393 389
394 FilePath SessionBackend::GetCurrentSessionPath() { 390 FilePath SessionBackend::GetCurrentSessionPath() {
395 FilePath path = path_to_dir_; 391 FilePath path = path_to_dir_;
396 if (type_ == BaseSessionService::TAB_RESTORE) 392 if (type_ == BaseSessionService::TAB_RESTORE)
397 path = path.AppendASCII(kCurrentTabSessionFileName); 393 path = path.AppendASCII(kCurrentTabSessionFileName);
398 else 394 else
399 path = path.AppendASCII(kCurrentSessionFileName); 395 path = path.AppendASCII(kCurrentSessionFileName);
400 return path; 396 return path;
401 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698