BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / chromeos / file_system_provider / scoped_file_opener.h
blob1baba58c39e46a1ef53e9d137560e7bc33aee377
1 // Copyright 2015 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.
5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SCOPED_FILE_OPENER_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SCOPED_FILE_OPENER_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
12 namespace base {
13 class FilePath;
14 } // namespace base
16 namespace chromeos {
17 namespace file_system_provider {
19 // Opens files and guarantees that they will be closed when the object gets out
20 // of scope. Use instead of manually calling OpenFile and CloseFile, as aborting
21 // of the OpenFile operation is racey and the operation may or may not be
22 // aborted.
23 class ScopedFileOpener {
24 public:
25 ScopedFileOpener(
26 ProvidedFileSystemInterface* file_system,
27 const base::FilePath& file_path,
28 OpenFileMode mode,
29 const ProvidedFileSystemInterface::OpenFileCallback& callback);
30 ~ScopedFileOpener();
32 private:
33 class Runner;
34 scoped_refptr<Runner> runner_;
37 } // namespace file_system_provider
38 } // namespace chromeos
40 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SCOPED_FILE_OPENER_H_