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

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

Issue 2510033002: [Device Service] Move PowerMonitor into the Device Service (Closed)
Patch Set: Singleton service Created 3 years, 11 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
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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 new BrowserContextServiceManagerConnectionHolder( 451 new BrowserContextServiceManagerConnectionHolder(
452 service_manager_connection->GetConnector()->Connect(&params), 452 service_manager_connection->GetConnector()->Connect(&params),
453 std::move(service_request)); 453 std::move(service_request));
454 browser_context->SetUserData(kServiceManagerConnection, connection_holder); 454 browser_context->SetUserData(kServiceManagerConnection, connection_holder);
455 455
456 ServiceManagerConnection* connection = 456 ServiceManagerConnection* connection =
457 connection_holder->service_manager_connection(); 457 connection_holder->service_manager_connection();
458 connection->Start(); 458 connection->Start();
459 459
460 // New embedded service factories should be added to |connection| here. 460 // New embedded service factories should be added to |connection| here.
461 // TODO(blundell): Does this belong as a global service rather than per 461 // As we've configured service manager to treat device service as singleton,
462 // BrowserContext? 462 // only one device service instance will be created to serve multiple user
463 // ids.
463 ServiceInfo info; 464 ServiceInfo info;
464 info.factory = 465 info.factory =
465 base::Bind(&device::CreateDeviceService, 466 base::Bind(&device::CreateDeviceService,
blundell 2017/01/03 15:20:50 Does the Device Service not still need to be regis
Ken Rockot(use gerrit already) 2017/01/03 20:25:15 The answer to your question is yes, but there's an
leonhsl(Using Gerrit) 2017/01/04 07:34:11 Done and thanks a lot for the kindly explanations!
466 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); 467 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE));
467 connection->AddEmbeddedService(device::mojom::kServiceName, info); 468 connection->AddEmbeddedService(device::mojom::kServiceName, info);
468 469
469 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 470 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
470 switches::kMojoLocalStorage)) { 471 switches::kMojoLocalStorage)) {
471 ServiceInfo info; 472 ServiceInfo info;
472 info.factory = 473 info.factory =
473 base::Bind(&file::CreateFileService, 474 base::Bind(&file::CreateFileService,
474 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 475 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
475 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); 476 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 if (GetUserData(kDownloadManagerKeyName)) 529 if (GetUserData(kDownloadManagerKeyName))
529 GetDownloadManager(this)->Shutdown(); 530 GetDownloadManager(this)->Shutdown();
530 } 531 }
531 532
532 void BrowserContext::ShutdownStoragePartitions() { 533 void BrowserContext::ShutdownStoragePartitions() {
533 if (GetUserData(kStoragePartitionMapKeyName)) 534 if (GetUserData(kStoragePartitionMapKeyName))
534 RemoveUserData(kStoragePartitionMapKeyName); 535 RemoveUserData(kStoragePartitionMapKeyName);
535 } 536 }
536 537
537 } // namespace content 538 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698