Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/public/browser/browser_context.h" | 5 #include "content/public/browser/browser_context.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 #include "net/url_request/url_request_context.h" | 40 #include "net/url_request/url_request_context.h" |
| 41 #include "net/url_request/url_request_context_getter.h" | 41 #include "net/url_request/url_request_context_getter.h" |
| 42 #include "services/device/device_service.h" | 42 #include "services/device/device_service.h" |
| 43 #include "services/device/public/interfaces/constants.mojom.h" | 43 #include "services/device/public/interfaces/constants.mojom.h" |
| 44 #include "services/file/file_service.h" | 44 #include "services/file/file_service.h" |
| 45 #include "services/file/public/interfaces/constants.mojom.h" | 45 #include "services/file/public/interfaces/constants.mojom.h" |
| 46 #include "services/file/user_id_map.h" | 46 #include "services/file/user_id_map.h" |
| 47 #include "services/service_manager/public/cpp/connection.h" | 47 #include "services/service_manager/public/cpp/connection.h" |
| 48 #include "services/service_manager/public/cpp/connector.h" | 48 #include "services/service_manager/public/cpp/connector.h" |
| 49 #include "services/service_manager/public/interfaces/service.mojom.h" | 49 #include "services/service_manager/public/interfaces/service.mojom.h" |
| 50 #include "services/shape_detection/public/interfaces/constants.mojom.h" | |
| 51 #include "services/shape_detection/shape_detection_service.h" | |
| 50 #include "storage/browser/database/database_tracker.h" | 52 #include "storage/browser/database/database_tracker.h" |
| 51 #include "storage/browser/fileapi/external_mount_points.h" | 53 #include "storage/browser/fileapi/external_mount_points.h" |
| 52 | 54 |
| 53 using base::UserDataAdapter; | 55 using base::UserDataAdapter; |
| 54 | 56 |
| 55 namespace content { | 57 namespace content { |
| 56 | 58 |
| 57 namespace { | 59 namespace { |
| 58 | 60 |
| 59 base::LazyInstance<std::map<std::string, BrowserContext*>> | 61 base::LazyInstance<std::map<std::string, BrowserContext*>> |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 460 | 462 |
| 461 // New embedded service factories should be added to |connection| here. | 463 // New embedded service factories should be added to |connection| here. |
| 462 // TODO(blundell): Does this belong as a global service rather than per | 464 // TODO(blundell): Does this belong as a global service rather than per |
| 463 // BrowserContext? | 465 // BrowserContext? |
| 464 ServiceInfo info; | 466 ServiceInfo info; |
| 465 info.factory = | 467 info.factory = |
| 466 base::Bind(&device::CreateDeviceService, | 468 base::Bind(&device::CreateDeviceService, |
| 467 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); | 469 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); |
| 468 connection->AddEmbeddedService(device::mojom::kServiceName, info); | 470 connection->AddEmbeddedService(device::mojom::kServiceName, info); |
| 469 | 471 |
| 472 // Shape Detection Service is in browser process for now. Because native | |
| 473 // Mac API |CIDetector| does GPU-previliged operations, and we don't have | |
|
Ken Rockot(use gerrit already)
2016/12/05 20:56:52
nit: s/previliged/privileged/
xianglu
2016/12/05 22:13:22
Done.
| |
| 474 // full control over it, please consider moving it to a utility process if | |
| 475 // we see crashes in the future. | |
| 476 ServiceInfo shape_detection_info; | |
| 477 shape_detection_info.factory = | |
| 478 base::Bind(&shape_detection::ShapeDetectionService::Create); | |
| 479 connection->AddEmbeddedService(shape_detection::mojom::kServiceName, | |
| 480 shape_detection_info); | |
| 481 | |
| 470 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 482 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 471 switches::kMojoLocalStorage)) { | 483 switches::kMojoLocalStorage)) { |
| 472 ServiceInfo info; | 484 ServiceInfo info; |
| 473 info.factory = | 485 info.factory = |
| 474 base::Bind(&file::CreateFileService, | 486 base::Bind(&file::CreateFileService, |
| 475 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), | 487 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), |
| 476 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); | 488 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); |
| 477 connection->AddEmbeddedService(file::mojom::kServiceName, info); | 489 connection->AddEmbeddedService(file::mojom::kServiceName, info); |
| 478 } | 490 } |
| 479 } | 491 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 if (GetUserData(kDownloadManagerKeyName)) | 541 if (GetUserData(kDownloadManagerKeyName)) |
| 530 GetDownloadManager(this)->Shutdown(); | 542 GetDownloadManager(this)->Shutdown(); |
| 531 } | 543 } |
| 532 | 544 |
| 533 void BrowserContext::ShutdownStoragePartitions() { | 545 void BrowserContext::ShutdownStoragePartitions() { |
| 534 if (GetUserData(kStoragePartitionMapKeyName)) | 546 if (GetUserData(kStoragePartitionMapKeyName)) |
| 535 RemoveUserData(kStoragePartitionMapKeyName); | 547 RemoveUserData(kStoragePartitionMapKeyName); |
| 536 } | 548 } |
| 537 | 549 |
| 538 } // namespace content | 550 } // namespace content |
| OLD | NEW |