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

Unified Diff: chrome/browser/file_system/file_system_host_context.h

Issue 3244002: (2nd try) Add a helper class that keeps per-profile information for FileSystem API (Closed)
Patch Set: Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/file_system/file_system_host_context.h
diff --git a/chrome/browser/file_system/file_system_host_context.h b/chrome/browser/file_system/file_system_host_context.h
new file mode 100644
index 0000000000000000000000000000000000000000..592ccd6126fb5fdd3fcd87469a2cfb51d273e27b
--- /dev/null
+++ b/chrome/browser/file_system/file_system_host_context.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_HOST_CONTEXT_H_
+#define CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_HOST_CONTEXT_H_
+
+#include "base/file_path.h"
+#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
+#include "googleurl/src/gurl.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h"
+
+// This is owned by profile and shared by all the FileSystemDispatcherHost
+// that shared by the same profile.
+class FileSystemHostContext
+ : public base::RefCountedThreadSafe<FileSystemHostContext> {
+ public:
+ FileSystemHostContext(const FilePath& data_path, bool is_incognito);
+ const FilePath& base_path() const { return base_path_; }
+ bool is_incognito() const { return is_incognito_; }
+
+ // Returns the root path and name for the file system specified by given
+ // |origin_url| and |type|. Returns true if the file system is available
+ // for the profile and |root_path| and |name| are filled successfully.
+ bool GetFileSystemRootPath(
+ const GURL& origin_url,
+ WebKit::WebFileSystem::Type type,
+ FilePath* root_path,
+ std::string* name) const;
+
+ // Check if the given |path| is in the FileSystem base directory.
+ bool CheckValidFileSystemPath(const FilePath& path) const;
+
+ // Returns the storage identifier string for the given |url|.
+ static std::string GetStorageIdentifierFromURL(const GURL& url);
+
+ // The FileSystem directory name.
+ static const FilePath::CharType kFileSystemDirectory[];
+
+ static const char kPersistentName[];
+ static const char kTemporaryName[];
+
+ private:
+ const FilePath base_path_;
+ const bool is_incognito_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemHostContext);
+};
+
+#endif // CHROME_BROWSER_FILE_SYSTEM_FILE_SYSTEM_HOST_CONTEXT_H_
« no previous file with comments | « chrome/browser/file_system/file_system_dispatcher_host.cc ('k') | chrome/browser/file_system/file_system_host_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698