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

Side by Side Diff: content/shell/shell_browser_context.cc

Issue 10548019: Cleanup: Consolidate declarations of XDG variables. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/chrome_paths_linux.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/shell/shell_browser_context.h" 5 #include "content/shell/shell_browser_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 11 matching lines...) Expand all
22 #elif defined(OS_LINUX) 22 #elif defined(OS_LINUX)
23 #include "base/nix/xdg_util.h" 23 #include "base/nix/xdg_util.h"
24 #elif defined(OS_MACOSX) 24 #elif defined(OS_MACOSX)
25 #include "base/base_paths_mac.h" 25 #include "base/base_paths_mac.h"
26 #endif 26 #endif
27 27
28 using content::BrowserThread; 28 using content::BrowserThread;
29 29
30 namespace content { 30 namespace content {
31 31
32 namespace {
33
34 #if defined(OS_LINUX)
35 const char kDotConfigDir[] = ".config";
36 const char kXdgConfigHomeEnvVar[] = "XDG_CONFIG_HOME";
37 #endif
38
39 } // namespace
40
41 ShellBrowserContext::ShellBrowserContext() { 32 ShellBrowserContext::ShellBrowserContext() {
42 InitWhileIOAllowed(); 33 InitWhileIOAllowed();
43 } 34 }
44 35
45 ShellBrowserContext::~ShellBrowserContext() { 36 ShellBrowserContext::~ShellBrowserContext() {
46 if (resource_context_.get()) { 37 if (resource_context_.get()) {
47 BrowserThread::DeleteSoon( 38 BrowserThread::DeleteSoon(
48 BrowserThread::IO, FROM_HERE, resource_context_.release()); 39 BrowserThread::IO, FROM_HERE, resource_context_.release());
49 } 40 }
50 } 41 }
51 42
52 void ShellBrowserContext::InitWhileIOAllowed() { 43 void ShellBrowserContext::InitWhileIOAllowed() {
53 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { 44 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
54 CHECK(testing_path_.CreateUniqueTempDir()); 45 CHECK(testing_path_.CreateUniqueTempDir());
55 path_ = testing_path_.path(); 46 path_ = testing_path_.path();
56 return; 47 return;
57 } 48 }
58 #if defined(OS_WIN) 49 #if defined(OS_WIN)
59 CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_)); 50 CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_));
60 path_ = path_.Append(std::wstring(L"content_shell")); 51 path_ = path_.Append(std::wstring(L"content_shell"));
61 #elif defined(OS_LINUX) 52 #elif defined(OS_LINUX)
62 scoped_ptr<base::Environment> env(base::Environment::Create()); 53 scoped_ptr<base::Environment> env(base::Environment::Create());
63 FilePath config_dir(base::nix::GetXDGDirectory(env.get(), 54 FilePath config_dir(
64 kXdgConfigHomeEnvVar, 55 base::nix::GetXDGDirectory(env.get(),
65 kDotConfigDir)); 56 base::nix::kXdgConfigHomeEnvVar,
57 base::nix::kDotConfigDir));
66 path_ = config_dir.Append("content_shell"); 58 path_ = config_dir.Append("content_shell");
67 #elif defined(OS_MACOSX) 59 #elif defined(OS_MACOSX)
68 CHECK(PathService::Get(base::DIR_APP_DATA, &path_)); 60 CHECK(PathService::Get(base::DIR_APP_DATA, &path_));
69 path_ = path_.Append("Chromium Content Shell"); 61 path_ = path_.Append("Chromium Content Shell");
70 #elif defined(OS_ANDROID) 62 #elif defined(OS_ANDROID)
71 DCHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &path_)); 63 DCHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &path_));
72 path_ = path_.Append(FILE_PATH_LITERAL("content_shell")); 64 path_ = path_.Append(FILE_PATH_LITERAL("content_shell"));
73 #else 65 #else
74 NOTIMPLEMENTED(); 66 NOTIMPLEMENTED();
75 #endif 67 #endif
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 124
133 bool ShellBrowserContext::DidLastSessionExitCleanly() { 125 bool ShellBrowserContext::DidLastSessionExitCleanly() {
134 return true; 126 return true;
135 } 127 }
136 128
137 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { 129 quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() {
138 return NULL; 130 return NULL;
139 } 131 }
140 132
141 } // namespace content 133 } // namespace content
OLDNEW
« no previous file with comments | « chrome/common/chrome_paths_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698