#include "chrome/browser/sessions/base_session_service.h"
#include "chrome/browser/sessions/session_command.h"
-namespace net {
-class FileStream;
+namespace base {
+class File;
}
// SessionBackend -------------------------------------------------------------
// Appends the specified commands to the current file. If reset_first is
// true the the current file is recreated.
- //
- // NOTE: this deletes SessionCommands in commands as well as the supplied
- // vector.
- void AppendCommands(std::vector<SessionCommand*>* commands,
- bool reset_first);
+ void AppendCommands(ScopedVector<SessionCommand> commands, bool reset_first);
// Invoked from the service to read the commands that make up the last
// session, invokes ReadLastSessionCommandsImpl to do the work.
void ReadLastSessionCommands(
const base::CancelableTaskTracker::IsCanceledCallback& is_canceled,
- const BaseSessionService::InternalGetCommandsCallback& callback);
+ const BaseSessionService::GetCommandsCallback& callback);
// Reads the commands from the last file.
//
- // On success, the read commands are added to commands. It is up to the
- // caller to delete the commands.
- bool ReadLastSessionCommandsImpl(std::vector<SessionCommand*>* commands);
+ // On success, the read commands are added to commands.
+ bool ReadLastSessionCommandsImpl(ScopedVector<SessionCommand>* commands);
// Deletes the file containing the commands for the last session.
void DeleteLastSession();
//
// On success, the read commands are added to commands. It is up to the
// caller to delete the commands.
- bool ReadCurrentSessionCommandsImpl(std::vector<SessionCommand*>* commands);
+ bool ReadCurrentSessionCommandsImpl(ScopedVector<SessionCommand>* commands);
private:
friend class base::RefCountedThreadSafe<SessionBackend>;
// Opens the current file and writes the header. On success a handle to
// the file is returned.
- net::FileStream* OpenAndWriteHeader(const base::FilePath& path);
+ base::File* OpenAndWriteHeader(const base::FilePath& path);
// Appends the specified commands to the specified file.
- bool AppendCommandsToFile(net::FileStream* file,
- const std::vector<SessionCommand*>& commands);
+ bool AppendCommandsToFile(base::File* file,
+ const ScopedVector<SessionCommand>& commands);
const BaseSessionService::SessionType type_;
bool last_session_valid_;
// Handle to the target file.
- scoped_ptr<net::FileStream> current_session_file_;
+ scoped_ptr<base::File> current_session_file_;
// Whether we've inited. Remember, the constructor is run on the
// Main thread, all others on the IO thread, hence lazy initialization.