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

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

Issue 2740493002: Pref service: create service at browser startup (Closed)
Patch Set: Rename the capability provided by the service Created 3 years, 9 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 456
457 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 457 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
458 switches::kMojoLocalStorage)) { 458 switches::kMojoLocalStorage)) {
459 ServiceInfo info; 459 ServiceInfo info;
460 info.factory = 460 info.factory =
461 base::Bind(&file::CreateFileService, 461 base::Bind(&file::CreateFileService,
462 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 462 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
463 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); 463 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB));
464 connection->AddEmbeddedService(file::mojom::kServiceName, info); 464 connection->AddEmbeddedService(file::mojom::kServiceName, info);
465 } 465 }
466
467 ContentBrowserClient::StaticServiceMap services;
468 GetContentClient()->browser()->RegisterInProcessServices(browser_context,
469 &services);
470 for (const auto& entry : services) {
471 connection->AddEmbeddedService(entry.first, entry.second);
472 }
466 } 473 }
467 } 474 }
468 475
469 // static 476 // static
470 const std::string& BrowserContext::GetServiceUserIdFor( 477 const std::string& BrowserContext::GetServiceUserIdFor(
471 BrowserContext* browser_context) { 478 BrowserContext* browser_context) {
472 CHECK(browser_context->GetUserData(kMojoWasInitialized)) 479 CHECK(browser_context->GetUserData(kMojoWasInitialized))
473 << "Attempting to get the mojo user id for a BrowserContext that was " 480 << "Attempting to get the mojo user id for a BrowserContext that was "
474 << "never Initialize()ed."; 481 << "never Initialize()ed.";
475 482
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 if (GetUserData(kDownloadManagerKeyName)) 523 if (GetUserData(kDownloadManagerKeyName))
517 GetDownloadManager(this)->Shutdown(); 524 GetDownloadManager(this)->Shutdown();
518 } 525 }
519 526
520 void BrowserContext::ShutdownStoragePartitions() { 527 void BrowserContext::ShutdownStoragePartitions() {
521 if (GetUserData(kStoragePartitionMapKeyName)) 528 if (GetUserData(kStoragePartitionMapKeyName))
522 RemoveUserData(kStoragePartitionMapKeyName); 529 RemoveUserData(kStoragePartitionMapKeyName);
523 } 530 }
524 531
525 } // namespace content 532 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698