| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "blimp/engine/common/blimp_browser_context.h" | 5 #include "blimp/engine/common/blimp_browser_context.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/nix/xdg_util.h" | 11 #include "base/nix/xdg_util.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "blimp/engine/app/blimp_permission_manager.h" | 13 #include "blimp/engine/app/blimp_permission_manager.h" |
| 14 #include "components/metrics/metrics_service.h" | 14 #include "components/metrics/metrics_service.h" |
| 15 #include "components/metrics/stability_metrics_helper.h" |
| 15 #include "components/pref_registry/pref_registry_syncable.h" | 16 #include "components/pref_registry/pref_registry_syncable.h" |
| 16 #include "components/prefs/in_memory_pref_store.h" | 17 #include "components/prefs/in_memory_pref_store.h" |
| 17 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
| 18 #include "components/prefs/pref_service_factory.h" | 19 #include "components/prefs/pref_service_factory.h" |
| 19 #include "content/public/browser/background_sync_controller.h" | 20 #include "content/public/browser/background_sync_controller.h" |
| 20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/storage_partition.h" | 22 #include "content/public/browser/storage_partition.h" |
| 22 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 if (!base::PathExists(path_)) | 95 if (!base::PathExists(path_)) |
| 95 base::CreateDirectory(path_); | 96 base::CreateDirectory(path_); |
| 96 BrowserContext::Initialize(this, path_); | 97 BrowserContext::Initialize(this, path_); |
| 97 } | 98 } |
| 98 | 99 |
| 99 void BlimpBrowserContext::InitPrefService() { | 100 void BlimpBrowserContext::InitPrefService() { |
| 100 // Create PrefRegistry and register metrics services preferences with it. | 101 // Create PrefRegistry and register metrics services preferences with it. |
| 101 scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry( | 102 scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry( |
| 102 new user_prefs::PrefRegistrySyncable()); | 103 new user_prefs::PrefRegistrySyncable()); |
| 103 metrics::MetricsService::RegisterPrefs(pref_registry.get()); | 104 metrics::MetricsService::RegisterPrefs(pref_registry.get()); |
| 105 metrics::StabilityMetricsHelper::RegisterPrefs(pref_registry.get()); |
| 106 |
| 104 PrefServiceFactory pref_service_factory; | 107 PrefServiceFactory pref_service_factory; |
| 105 | 108 |
| 106 // Create an in memory preferences store to hold metrics logs. | 109 // Create an in memory preferences store to hold metrics logs. |
| 107 pref_service_factory.set_user_prefs(new InMemoryPrefStore()); | 110 pref_service_factory.set_user_prefs(new InMemoryPrefStore()); |
| 108 pref_service_factory.set_read_error_callback(base::Bind(&IgnoreReadError)); | 111 pref_service_factory.set_read_error_callback(base::Bind(&IgnoreReadError)); |
| 109 | 112 |
| 110 // Create a PrefService binding the PrefRegistry to the InMemoryPrefStore. | 113 // Create a PrefService binding the PrefRegistry to the InMemoryPrefStore. |
| 111 // The PrefService ends up owning the PrefRegistry and the InMemoryPrefStore. | 114 // The PrefService ends up owning the PrefRegistry and the InMemoryPrefStore. |
| 112 pref_service_ = pref_service_factory.Create(pref_registry.get()); | 115 pref_service_ = pref_service_factory.Create(pref_registry.get()); |
| 113 DCHECK(pref_service_.get()); | 116 DCHECK(pref_service_.get()); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 204 |
| 202 net::URLRequestContextGetter* | 205 net::URLRequestContextGetter* |
| 203 BlimpBrowserContext::CreateMediaRequestContextForStoragePartition( | 206 BlimpBrowserContext::CreateMediaRequestContextForStoragePartition( |
| 204 const base::FilePath& partition_path, | 207 const base::FilePath& partition_path, |
| 205 bool in_memory) { | 208 bool in_memory) { |
| 206 return nullptr; | 209 return nullptr; |
| 207 } | 210 } |
| 208 | 211 |
| 209 } // namespace engine | 212 } // namespace engine |
| 210 } // namespace blimp | 213 } // namespace blimp |
| OLD | NEW |