diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-18 22:07:45 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-18 22:07:45 +0000 |
commit | 2410e4c01a215a487490e7bf87c4369cb8c13e53 (patch) | |
tree | 8b4c6460eca9616a9bdb5032f8253ddb7590e114 /mojo/shell/storage.cc | |
parent | 980969549b2d830274e99d8919d6bb2fa0d82b5e (diff) | |
download | chromium_src-2410e4c01a215a487490e7bf87c4369cb8c13e53.zip chromium_src-2410e4c01a215a487490e7bf87c4369cb8c13e53.tar.gz chromium_src-2410e4c01a215a487490e7bf87c4369cb8c13e53.tar.bz2 |
Teach mojo_shell how to load http URLs
After this CL, we can load content over HTTP. In order to make
that work, I needed to introduce a number of basic concepts
into the shell, including an IO thread and a directory to
store data (such as the HTTP cache).
I've tried to keep the net dependencies separated from the
bulk of the mojo_shell code because I expect we'll want to
move the net dependencies to an app that runs on top of the
Mojo platform rather than linked into the mojo_shell itself.
To that end, the mojo::loader::Loader class doesn't leak any
net headers to its clients.
The version of the loader in this CL is extremely basic. We'll
undoubtedly make it fancier as time goes on. The next step
after this CL is to store the result in a file and then load
that file as a shared object.
R=aa@chromium.org, darin@chromium.org
Review URL: https://codereview.chromium.org/27943002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229481 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/shell/storage.cc')
-rw-r--r-- | mojo/shell/storage.cc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/mojo/shell/storage.cc b/mojo/shell/storage.cc new file mode 100644 index 0000000..c753ef2 --- /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(std::wstring(L"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 |