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

Side by Side Diff: chrome/browser/android/chrome_main_delegate_staging_android.cc

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 years, 7 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
OLDNEW
(Empty)
1 // Copyright 2015 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 "chrome/browser/android/chrome_main_delegate_staging_android.h"
6
7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h"
9 #include "base/logging.h"
10 #include "base/path_service.h"
11 #include "components/policy/core/common/policy_provider_android.h"
12
13
14 ChromeMainDelegateStagingAndroid::ChromeMainDelegateStagingAndroid() {
15 }
16
17 ChromeMainDelegateStagingAndroid::~ChromeMainDelegateStagingAndroid() {
18 }
19
20 bool ChromeMainDelegateStagingAndroid::BasicStartupComplete(int* exit_code) {
21 #if defined(SAFE_BROWSING_SERVICE)
22 spdy_proxy_throttle_factory_ .reset(new SpdyProxyResourceThrottleFactory());
23 SafeBrowsingResourceThrottleFactory::RegisterFactory(
24 spdy_proxy_throttle_factory_.get());
25 #endif
26 policy::PolicyProviderAndroid::SetShouldWaitForPolicy(true);
27
28 return ChromeMainDelegateAndroid::BasicStartupComplete(exit_code);
29 }
30
31 int ChromeMainDelegateStagingAndroid::RunProcess(
32 const std::string& process_type,
33 const content::MainFunctionParams& main_function_params) {
34 if (process_type.empty()) {
35 // By default, Android creates the directory accessible by others.
36 // We'd like to tighten security and make it accessible only by
37 // the browser process.
38 base::FilePath data_path;
39 bool ok = PathService::Get(base::DIR_ANDROID_APP_DATA, &data_path);
40 if (ok) {
41 int permissions;
42 ok = base::GetPosixFilePermissions(data_path, &permissions);
43 if (ok)
44 permissions &= base::FILE_PERMISSION_USER_MASK;
45 else
46 permissions = base::FILE_PERMISSION_READ_BY_USER |
47 base::FILE_PERMISSION_WRITE_BY_USER |
48 base::FILE_PERMISSION_EXECUTE_BY_USER;
49
50 ok = base::SetPosixFilePermissions(data_path, permissions);
51 }
52 if (!ok)
53 LOG(ERROR) << "Failed to set permission of " << data_path.value().c_str();
54
55 }
56
57 return ChromeMainDelegateAndroid::RunProcess(
58 process_type, main_function_params);
59 }
60
61 void ChromeMainDelegateStagingAndroid::ProcessExiting(
62 const std::string& process_type) {
63 #if defined(SAFE_BROWSING_SERVICE)
64 SafeBrowsingResourceThrottleFactory::RegisterFactory(NULL);
65 #endif
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698