Chromium Code Reviews| 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 | |
| 106 // Create an in memory preferences store to hold metrics logs. | 108 // Create an in memory preferences store to hold metrics logs. |
|
Jess
2016/06/09 18:09:59
New line before comments that are not at the start
xyzzyz
2016/06/09 20:01:25
Done.
| |
| 107 pref_service_factory.set_user_prefs(new InMemoryPrefStore()); | 109 pref_service_factory.set_user_prefs(new InMemoryPrefStore()); |
| 108 pref_service_factory.set_read_error_callback(base::Bind(&IgnoreReadError)); | 110 pref_service_factory.set_read_error_callback(base::Bind(&IgnoreReadError)); |
| 109 | 111 |
| 110 // Create a PrefService binding the PrefRegistry to the InMemoryPrefStore. | 112 // Create a PrefService binding the PrefRegistry to the InMemoryPrefStore. |
| 111 // The PrefService ends up owning the PrefRegistry and the InMemoryPrefStore. | 113 // The PrefService ends up owning the PrefRegistry and the InMemoryPrefStore. |
| 112 pref_service_ = pref_service_factory.Create(pref_registry.get()); | 114 pref_service_ = pref_service_factory.Create(pref_registry.get()); |
| 113 DCHECK(pref_service_.get()); | 115 DCHECK(pref_service_.get()); |
| 114 } | 116 } |
| 115 | 117 |
| 116 std::unique_ptr<content::ZoomLevelDelegate> | 118 std::unique_ptr<content::ZoomLevelDelegate> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 | 203 |
| 202 net::URLRequestContextGetter* | 204 net::URLRequestContextGetter* |
| 203 BlimpBrowserContext::CreateMediaRequestContextForStoragePartition( | 205 BlimpBrowserContext::CreateMediaRequestContextForStoragePartition( |
| 204 const base::FilePath& partition_path, | 206 const base::FilePath& partition_path, |
| 205 bool in_memory) { | 207 bool in_memory) { |
| 206 return nullptr; | 208 return nullptr; |
| 207 } | 209 } |
| 208 | 210 |
| 209 } // namespace engine | 211 } // namespace engine |
| 210 } // namespace blimp | 212 } // namespace blimp |
| OLD | NEW |