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

Side by Side Diff: chromecast/common/cast_paths.cc

Issue 490603002: Chromecast: initial checkin of Android-based cast shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added android DEPS (git cl presubmit doesn't check Java DEPS?) Created 6 years, 3 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
« no previous file with comments | « chromecast/common/cast_paths.h ('k') | chromecast/common/global_descriptors.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromecast/common/cast_paths.h" 5 #include "chromecast/common/cast_paths.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h"
10 #include "base/path_service.h" 11 #include "base/path_service.h"
11 #include "build/build_config.h" 12 #include "build/build_config.h"
12 13
13 namespace chromecast { 14 namespace chromecast {
14 15
15 bool PathProvider(int key, base::FilePath* result) { 16 bool PathProvider(int key, base::FilePath* result) {
16 switch (key) { 17 switch (key) {
17 case DIR_CAST_HOME: { 18 case DIR_CAST_HOME: {
18 base::FilePath home = base::GetHomeDir(); 19 base::FilePath home = base::GetHomeDir();
19 #if defined(ARCH_CPU_ARMEL) 20 #if defined(ARCH_CPU_ARMEL)
20 // When running on the actual device, $HOME is set to the user's 21 // When running on the actual device, $HOME is set to the user's
21 // directory under the data partition. 22 // directory under the data partition.
22 *result = home; 23 *result = home;
23 #else 24 #else
24 // When running a development instance as a regular user, use 25 // When running a development instance as a regular user, use
25 // a data directory under $HOME (similar to Chrome). 26 // a data directory under $HOME (similar to Chrome).
26 *result = home.Append(".config/cast_shell"); 27 *result = home.Append(".config/cast_shell");
27 #endif 28 #endif
28 return true; 29 return true;
29 } 30 }
31 #if defined(OS_ANDROID)
32 case FILE_CAST_ANDROID_LOG: {
33 base::FilePath base_dir;
34 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &base_dir));
35 *result = base_dir.AppendASCII("cast_shell.log");
36 return true;
37 }
38 #endif // defined(OS_ANDROID)
30 case FILE_CAST_CONFIG: { 39 case FILE_CAST_CONFIG: {
31 base::FilePath data_dir; 40 base::FilePath data_dir;
32 #if defined(OS_ANDROID) 41 #if defined(OS_ANDROID)
33 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &data_dir); 42 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &data_dir));
34 *result = data_dir.Append("cast_shell.conf"); 43 *result = data_dir.Append("cast_shell.conf");
35 #else 44 #else
36 CHECK(PathService::Get(DIR_CAST_HOME, &data_dir)); 45 CHECK(PathService::Get(DIR_CAST_HOME, &data_dir));
37 *result = data_dir.Append(".eureka.conf"); 46 *result = data_dir.Append(".eureka.conf");
38 #endif // defined(OS_ANDROID) 47 #endif // defined(OS_ANDROID)
39 return true; 48 return true;
40 } 49 }
41 case FILE_CAST_PAK: { 50 case FILE_CAST_PAK: {
42 base::FilePath base_dir; 51 base::FilePath base_dir;
43 #if defined(OS_ANDROID) 52 #if defined(OS_ANDROID)
44 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &base_dir)); 53 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &base_dir));
45 *result = base_dir.Append("paks/cast_shell.pak"); 54 *result = base_dir.Append("paks/cast_shell.pak");
46 #else 55 #else
47 CHECK(PathService::Get(base::DIR_MODULE, &base_dir)); 56 CHECK(PathService::Get(base::DIR_MODULE, &base_dir));
48 *result = base_dir.Append("assets/cast_shell.pak"); 57 *result = base_dir.Append("assets/cast_shell.pak");
49 #endif // defined(OS_ANDROID) 58 #endif // defined(OS_ANDROID)
50 return true; 59 return true;
51 } 60 }
52 } 61 }
53 return false; 62 return false;
54 } 63 }
55 64
56 void RegisterPathProvider() { 65 void RegisterPathProvider() {
57 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); 66 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
58 } 67 }
59 68
60 } // namespace chromecast 69 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/common/cast_paths.h ('k') | chromecast/common/global_descriptors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698