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

Side by Side Diff: mojo/services/profile/profile_service_impl.cc

Issue 395163002: Bundle the network service in the shell on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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 | « mojo/services/profile/profile_service_impl.h ('k') | mojo/shell/context.cc » ('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 2014 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 "mojo/services/profile/profile_service_impl.h"
6
7 #include "base/base_paths.h"
8 #include "base/files/file_path.h"
9 #include "base/path_service.h"
10
11 namespace {
12
13 int BaseKeyForMojoKey(mojo::ProfileService::PathKey key) {
14 switch(key) {
15 case mojo::ProfileService::PATH_KEY_DIR_TEMP:
16 return base::DIR_TEMP;
17 default:
18 return base::PATH_START;
19 }
20 }
21
22 } // namespace
23
24 namespace mojo {
25
26 ProfileServiceImpl::ProfileServiceImpl(ApplicationConnection* connection) {
27 }
28
29 ProfileServiceImpl::~ProfileServiceImpl() {
30 }
31
32 void ProfileServiceImpl::GetPath(
33 PathKey key,
34 const mojo::Callback<void(mojo::String)>& callback) {
35 int base_key = BaseKeyForMojoKey(key);
36 if (base_key == base::PATH_START) {
37 callback.Run(mojo::String());
38 return;
39 }
40 base::FilePath path;
41 if (!PathService::Get(base_key, &path)) {
42 callback.Run(mojo::String());
43 return;
44 }
45 #if defined(OS_POSIX)
46 callback.Run(path.value());
47 #elif defined(OS_WIN)
48 callback.Run(path.AsUTF8Unsafe());
49 #else
50 #error Not implemented
51 #endif
52 }
53
54 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/profile/profile_service_impl.h ('k') | mojo/shell/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698