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

Side by Side Diff: gfx/gfx_paths.cc

Issue 6246027: Move src/gfx/ to src/ui/gfx... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | « gfx/gfx_paths.h ('k') | gfx/gfx_resources.grd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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.
4
5 #include "gfx/gfx_paths.h"
6
7 #include "base/command_line.h"
8 #include "base/file_path.h"
9 #include "base/file_util.h"
10 #include "base/path_service.h"
11
12 namespace gfx {
13
14 bool PathProvider(int key, FilePath* result) {
15 // Assume that we will not need to create the directory if it does not exist.
16 // This flag can be set to true for the cases where we want to create it.
17 bool create_dir = false;
18
19 FilePath cur;
20 switch (key) {
21 // The following are only valid in the development environment, and
22 // will fail if executed from an installed executable (because the
23 // generated path won't exist).
24 case DIR_TEST_DATA:
25 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur))
26 return false;
27 cur = cur.Append(FILE_PATH_LITERAL("gfx"));
28 cur = cur.Append(FILE_PATH_LITERAL("test"));
29 cur = cur.Append(FILE_PATH_LITERAL("data"));
30 if (!file_util::PathExists(cur)) // we don't want to create this
31 return false;
32 break;
33 default:
34 return false;
35 }
36
37 if (create_dir && !file_util::PathExists(cur) &&
38 !file_util::CreateDirectory(cur))
39 return false;
40
41 *result = cur;
42 return true;
43 }
44
45 // This cannot be done as a static initializer sadly since Visual Studio will
46 // eliminate this object file if there is no direct entry point into it.
47 void RegisterPathProvider() {
48 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
49 }
50
51 } // namespace gfx
OLDNEW
« no previous file with comments | « gfx/gfx_paths.h ('k') | gfx/gfx_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698