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

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

Issue 2420253002: Rename shell namespace to service_manager (Closed)
Patch Set: . Created 4 years, 2 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 void SetDownloadManager(BrowserContext* context, 143 void SetDownloadManager(BrowserContext* context,
144 content::DownloadManager* download_manager) { 144 content::DownloadManager* download_manager) {
145 DCHECK_CURRENTLY_ON(BrowserThread::UI); 145 DCHECK_CURRENTLY_ON(BrowserThread::UI);
146 DCHECK(download_manager); 146 DCHECK(download_manager);
147 context->SetUserData(kDownloadManagerKeyName, download_manager); 147 context->SetUserData(kDownloadManagerKeyName, download_manager);
148 } 148 }
149 149
150 class BrowserContextServiceManagerConnectionHolder 150 class BrowserContextServiceManagerConnectionHolder
151 : public base::SupportsUserData::Data { 151 : public base::SupportsUserData::Data {
152 public: 152 public:
153 BrowserContextServiceManagerConnectionHolder( 153 BrowserContextServiceManagerConnectionHolder(
154 std::unique_ptr<shell::Connection> connection, 154 std::unique_ptr<service_manager::Connection> connection,
155 shell::mojom::ServiceRequest request) 155 service_manager::mojom::ServiceRequest request)
156 : root_connection_(std::move(connection)), 156 : root_connection_(std::move(connection)),
157 service_manager_connection_(ServiceManagerConnection::Create( 157 service_manager_connection_(ServiceManagerConnection::Create(
158 std::move(request), 158 std::move(request),
159 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))) {} 159 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))) {}
160 ~BrowserContextServiceManagerConnectionHolder() override {} 160 ~BrowserContextServiceManagerConnectionHolder() override {}
161 161
162 ServiceManagerConnection* service_manager_connection() { 162 ServiceManagerConnection* service_manager_connection() {
163 return service_manager_connection_.get(); 163 return service_manager_connection_.get();
164 } 164 }
165 165
166 private: 166 private:
167 std::unique_ptr<shell::Connection> root_connection_; 167 std::unique_ptr<service_manager::Connection> root_connection_;
168 std::unique_ptr<ServiceManagerConnection> service_manager_connection_; 168 std::unique_ptr<ServiceManagerConnection> service_manager_connection_;
169 169
170 DISALLOW_COPY_AND_ASSIGN(BrowserContextServiceManagerConnectionHolder); 170 DISALLOW_COPY_AND_ASSIGN(BrowserContextServiceManagerConnectionHolder);
171 }; 171 };
172 172
173 } // namespace 173 } // namespace
174 174
175 // static 175 // static
176 void BrowserContext::AsyncObliterateStoragePartition( 176 void BrowserContext::AsyncObliterateStoragePartition(
177 BrowserContext* browser_context, 177 BrowserContext* browser_context,
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 428
429 browser_context->SetUserData(kMojoWasInitialized, 429 browser_context->SetUserData(kMojoWasInitialized,
430 new base::SupportsUserData::Data); 430 new base::SupportsUserData::Data);
431 431
432 ServiceManagerConnection* service_manager_connection = 432 ServiceManagerConnection* service_manager_connection =
433 ServiceManagerConnection::GetForProcess(); 433 ServiceManagerConnection::GetForProcess();
434 if (service_manager_connection && base::ThreadTaskRunnerHandle::IsSet()) { 434 if (service_manager_connection && base::ThreadTaskRunnerHandle::IsSet()) {
435 // NOTE: Many unit tests create a TestBrowserContext without initializing 435 // NOTE: Many unit tests create a TestBrowserContext without initializing
436 // Mojo or the global service manager connection. 436 // Mojo or the global service manager connection.
437 437
438 shell::mojom::ServicePtr service; 438 service_manager::mojom::ServicePtr service;
439 shell::mojom::ServiceRequest service_request = mojo::GetProxy(&service); 439 service_manager::mojom::ServiceRequest service_request =
440 mojo::GetProxy(&service);
440 441
441 shell::mojom::PIDReceiverPtr pid_receiver; 442 service_manager::mojom::PIDReceiverPtr pid_receiver;
442 shell::Connector::ConnectParams params( 443 service_manager::Connector::ConnectParams params(
443 shell::Identity(kBrowserServiceName, new_id)); 444 service_manager::Identity(kBrowserServiceName, new_id));
444 params.set_client_process_connection(std::move(service), 445 params.set_client_process_connection(std::move(service),
445 mojo::GetProxy(&pid_receiver)); 446 mojo::GetProxy(&pid_receiver));
446 pid_receiver->SetPID(base::GetCurrentProcId()); 447 pid_receiver->SetPID(base::GetCurrentProcId());
447 448
448 BrowserContextServiceManagerConnectionHolder* connection_holder = 449 BrowserContextServiceManagerConnectionHolder* connection_holder =
449 new BrowserContextServiceManagerConnectionHolder( 450 new BrowserContextServiceManagerConnectionHolder(
450 service_manager_connection->GetConnector()->Connect(&params), 451 service_manager_connection->GetConnector()->Connect(&params),
451 std::move(service_request)); 452 std::move(service_request));
452 browser_context->SetUserData(kServiceManagerConnection, connection_holder); 453 browser_context->SetUserData(kServiceManagerConnection, connection_holder);
453 454
(...skipping 28 matching lines...) Expand all
482 } 483 }
483 484
484 // static 485 // static
485 BrowserContext* BrowserContext::GetBrowserContextForServiceUserId( 486 BrowserContext* BrowserContext::GetBrowserContextForServiceUserId(
486 const std::string& user_id) { 487 const std::string& user_id) {
487 auto it = g_user_id_to_context.Get().find(user_id); 488 auto it = g_user_id_to_context.Get().find(user_id);
488 return it != g_user_id_to_context.Get().end() ? it->second : nullptr; 489 return it != g_user_id_to_context.Get().end() ? it->second : nullptr;
489 } 490 }
490 491
491 // static 492 // static
492 shell::Connector* BrowserContext::GetConnectorFor( 493 service_manager::Connector* BrowserContext::GetConnectorFor(
493 BrowserContext* browser_context) { 494 BrowserContext* browser_context) {
494 ServiceManagerConnection* connection = 495 ServiceManagerConnection* connection =
495 GetServiceManagerConnectionFor(browser_context); 496 GetServiceManagerConnectionFor(browser_context);
496 return connection ? connection->GetConnector() : nullptr; 497 return connection ? connection->GetConnector() : nullptr;
497 } 498 }
498 499
499 // static 500 // static
500 ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor( 501 ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor(
501 BrowserContext* browser_context) { 502 BrowserContext* browser_context) {
502 BrowserContextServiceManagerConnectionHolder* connection_holder = 503 BrowserContextServiceManagerConnectionHolder* connection_holder =
(...skipping 16 matching lines...) Expand all
519 if (GetUserData(kDownloadManagerKeyName)) 520 if (GetUserData(kDownloadManagerKeyName))
520 GetDownloadManager(this)->Shutdown(); 521 GetDownloadManager(this)->Shutdown();
521 } 522 }
522 523
523 void BrowserContext::ShutdownStoragePartitions() { 524 void BrowserContext::ShutdownStoragePartitions() {
524 if (GetUserData(kStoragePartitionMapKeyName)) 525 if (GetUserData(kStoragePartitionMapKeyName))
525 RemoveUserData(kStoragePartitionMapKeyName); 526 RemoveUserData(kStoragePartitionMapKeyName);
526 } 527 }
527 528
528 } // namespace content 529 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_child_process_host_impl.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698