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

Side by Side Diff: content/browser/browser_context.cc

Issue 2451413003: Introduce Device Service (Closed)
Patch Set: Rebase Created 4 years, 1 month 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
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/public/app/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 #include "content/public/browser/render_process_host.h" 32 #include "content/public/browser/render_process_host.h"
33 #include "content/public/browser/site_instance.h" 33 #include "content/public/browser/site_instance.h"
34 #include "content/public/common/content_switches.h" 34 #include "content/public/common/content_switches.h"
35 #include "content/public/common/service_manager_connection.h" 35 #include "content/public/common/service_manager_connection.h"
36 #include "content/public/common/service_names.h" 36 #include "content/public/common/service_names.h"
37 #include "net/cookies/cookie_store.h" 37 #include "net/cookies/cookie_store.h"
38 #include "net/ssl/channel_id_service.h" 38 #include "net/ssl/channel_id_service.h"
39 #include "net/ssl/channel_id_store.h" 39 #include "net/ssl/channel_id_store.h"
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"
43 #include "services/device/public/cpp/constants.h"
42 #include "services/file/file_service.h" 44 #include "services/file/file_service.h"
43 #include "services/file/public/cpp/constants.h" 45 #include "services/file/public/cpp/constants.h"
44 #include "services/file/user_id_map.h" 46 #include "services/file/user_id_map.h"
45 #include "services/service_manager/public/cpp/connection.h" 47 #include "services/service_manager/public/cpp/connection.h"
46 #include "services/service_manager/public/cpp/connector.h" 48 #include "services/service_manager/public/cpp/connector.h"
47 #include "services/service_manager/public/interfaces/service.mojom.h" 49 #include "services/service_manager/public/interfaces/service.mojom.h"
48 #include "storage/browser/database/database_tracker.h" 50 #include "storage/browser/database/database_tracker.h"
49 #include "storage/browser/fileapi/external_mount_points.h" 51 #include "storage/browser/fileapi/external_mount_points.h"
50 52
51 using base::UserDataAdapter; 53 using base::UserDataAdapter;
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 new BrowserContextServiceManagerConnectionHolder( 452 new BrowserContextServiceManagerConnectionHolder(
451 service_manager_connection->GetConnector()->Connect(&params), 453 service_manager_connection->GetConnector()->Connect(&params),
452 std::move(service_request)); 454 std::move(service_request));
453 browser_context->SetUserData(kServiceManagerConnection, connection_holder); 455 browser_context->SetUserData(kServiceManagerConnection, connection_holder);
454 456
455 ServiceManagerConnection* connection = 457 ServiceManagerConnection* connection =
456 connection_holder->service_manager_connection(); 458 connection_holder->service_manager_connection();
457 connection->Start(); 459 connection->Start();
458 460
459 // New embedded service factories should be added to |connection| here. 461 // New embedded service factories should be added to |connection| here.
462 // TODO(blundell): Does this belong as a global service rather than per
463 // BrowserContext?
464 ServiceInfo info;
465 info.factory =
466 base::Bind(&device::CreateDeviceService,
467 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE));
468 connection->AddEmbeddedService(device::kDeviceServiceName, info);
460 469
461 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 470 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
462 switches::kMojoLocalStorage)) { 471 switches::kMojoLocalStorage)) {
463 ServiceInfo info; 472 ServiceInfo info;
464 info.factory = 473 info.factory =
465 base::Bind(&file::CreateFileService, 474 base::Bind(&file::CreateFileService,
466 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 475 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
467 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); 476 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB));
468 connection->AddEmbeddedService(file::kFileServiceName, info); 477 connection->AddEmbeddedService(file::kFileServiceName, info);
469 } 478 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 if (GetUserData(kDownloadManagerKeyName)) 529 if (GetUserData(kDownloadManagerKeyName))
521 GetDownloadManager(this)->Shutdown(); 530 GetDownloadManager(this)->Shutdown();
522 } 531 }
523 532
524 void BrowserContext::ShutdownStoragePartitions() { 533 void BrowserContext::ShutdownStoragePartitions() {
525 if (GetUserData(kStoragePartitionMapKeyName)) 534 if (GetUserData(kStoragePartitionMapKeyName))
526 RemoveUserData(kStoragePartitionMapKeyName); 535 RemoveUserData(kStoragePartitionMapKeyName);
527 } 536 }
528 537
529 } // namespace content 538 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/public/app/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698