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

Unified Diff: mojo/shell/storage.cc

Issue 27943002: Teach mojo_shell how to load http URLs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing include Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/shell/storage.h ('k') | mojo/shell/task_runners.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/storage.cc
diff --git a/mojo/shell/storage.cc b/mojo/shell/storage.cc
new file mode 100644
index 0000000000000000000000000000000000000000..dc1b83ecdbd7a734c9e2fc858e1eba939b3e4f79
--- /dev/null
+++ b/mojo/shell/storage.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2013 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.
+
+#include "mojo/shell/storage.h"
+
+#include "base/environment.h"
+#include "base/file_util.h"
+#include "base/logging.h"
+#include "base/path_service.h"
+
+#if defined(OS_WIN)
+#include "base/base_paths_win.h"
+#elif defined(OS_LINUX)
+#include "base/nix/xdg_util.h"
+#elif defined(OS_MACOSX)
+#include "base/base_paths_mac.h"
+#endif
+
+namespace mojo {
+namespace shell {
+
+Storage::Storage() {
+#if defined(OS_WIN)
+ CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &profile_path_));
+ profile_path_ = profile_path_.Append(FILE_PATH_LITERAL("mojo_shell"));
+#elif defined(OS_LINUX)
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ base::FilePath config_dir(
+ base::nix::GetXDGDirectory(env.get(),
+ base::nix::kXdgConfigHomeEnvVar,
+ base::nix::kDotConfigDir));
+ profile_path_ = config_dir.Append("mojo_shell");
+#elif defined(OS_MACOSX)
+ CHECK(PathService::Get(base::DIR_APP_DATA, &profile_path_));
+ profile_path_ = profile_path_.Append("Chromium Mojo Shell");
+#elif defined(OS_ANDROID)
+ CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &profile_path_));
+ profile_path_ = profile_path_.Append(FILE_PATH_LITERAL("mojo_shell"));
+#else
+ NOTIMPLEMENTED();
+#endif
+
+ if (!base::PathExists(profile_path_))
+ file_util::CreateDirectory(profile_path_);
+}
+
+Storage::~Storage() {
+}
+
+} // namespace shell
+} // namespace mojo
« no previous file with comments | « mojo/shell/storage.h ('k') | mojo/shell/task_runners.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698