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

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

Issue 2183703005: Renderers should obtain browser InterfaceProvider by connecting to browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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>
11 #include <memory> 11 #include <memory>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/guid.h" 16 #include "base/guid.h"
17 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/rand_util.h" 19 #include "base/rand_util.h"
20 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "content/browser/blob_storage/chrome_blob_storage_context.h" 22 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
23 #include "content/browser/download/download_manager_impl.h" 23 #include "content/browser/download/download_manager_impl.h"
24 #include "content/browser/indexed_db/indexed_db_context_impl.h" 24 #include "content/browser/indexed_db/indexed_db_context_impl.h"
25 #include "content/browser/loader/resource_dispatcher_host_impl.h" 25 #include "content/browser/loader/resource_dispatcher_host_impl.h"
26 #include "content/browser/mojo/constants.h"
27 #include "content/browser/push_messaging/push_messaging_router.h" 26 #include "content/browser/push_messaging/push_messaging_router.h"
28 #include "content/browser/storage_partition_impl_map.h" 27 #include "content/browser/storage_partition_impl_map.h"
29 #include "content/common/child_process_host_impl.h" 28 #include "content/common/child_process_host_impl.h"
29 #include "content/common/mojo/constants.h"
30 #include "content/public/browser/blob_handle.h" 30 #include "content/public/browser/blob_handle.h"
31 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/content_browser_client.h" 32 #include "content/public/browser/content_browser_client.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/mojo_shell_connection.h" 35 #include "content/public/common/mojo_shell_connection.h"
36 #include "net/cookies/cookie_store.h" 36 #include "net/cookies/cookie_store.h"
37 #include "net/ssl/channel_id_service.h" 37 #include "net/ssl/channel_id_service.h"
38 #include "net/ssl/channel_id_store.h" 38 #include "net/ssl/channel_id_store.h"
39 #include "net/url_request/url_request_context.h" 39 #include "net/url_request/url_request_context.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 // static 466 // static
467 BrowserContext* BrowserContext::GetBrowserContextForShellUserId( 467 BrowserContext* BrowserContext::GetBrowserContextForShellUserId(
468 const std::string& user_id) { 468 const std::string& user_id) {
469 auto it = g_user_id_to_context.Get().find(user_id); 469 auto it = g_user_id_to_context.Get().find(user_id);
470 return it != g_user_id_to_context.Get().end() ? it->second : nullptr; 470 return it != g_user_id_to_context.Get().end() ? it->second : nullptr;
471 } 471 }
472 472
473 // static 473 // static
474 shell::Connector* BrowserContext::GetShellConnectorFor( 474 shell::Connector* BrowserContext::GetShellConnectorFor(
475 BrowserContext* browser_context) { 475 BrowserContext* browser_context) {
476 MojoShellConnection* connection = GetMojoShellConnectionFor(browser_context);
477 return connection ? connection->GetConnector() : nullptr;
478 }
479
480 // static
481 MojoShellConnection* BrowserContext::GetMojoShellConnectionFor(
482 BrowserContext* browser_context) {
476 BrowserContextShellConnectionHolder* connection_holder = 483 BrowserContextShellConnectionHolder* connection_holder =
477 static_cast<BrowserContextShellConnectionHolder*>( 484 static_cast<BrowserContextShellConnectionHolder*>(
478 browser_context->GetUserData(kMojoShellConnection)); 485 browser_context->GetUserData(kMojoShellConnection));
479 if (!connection_holder) 486 return connection_holder ? connection_holder->shell_connection() : nullptr;
480 return nullptr;
481 return connection_holder->shell_connection()->GetConnector();
482 } 487 }
483 488
484 BrowserContext::~BrowserContext() { 489 BrowserContext::~BrowserContext() {
485 CHECK(GetUserData(kMojoWasInitialized)) 490 CHECK(GetUserData(kMojoWasInitialized))
486 << "Attempting to destroy a BrowserContext that never called " 491 << "Attempting to destroy a BrowserContext that never called "
487 << "Initialize()"; 492 << "Initialize()";
488 493
489 DCHECK(!GetUserData(kStoragePartitionMapKeyName)) 494 DCHECK(!GetUserData(kStoragePartitionMapKeyName))
490 << "StoragePartitionMap is not shut down properly"; 495 << "StoragePartitionMap is not shut down properly";
491 496
492 RemoveBrowserContextFromUserIdMap(this); 497 RemoveBrowserContextFromUserIdMap(this);
493 498
494 if (GetUserData(kDownloadManagerKeyName)) 499 if (GetUserData(kDownloadManagerKeyName))
495 GetDownloadManager(this)->Shutdown(); 500 GetDownloadManager(this)->Shutdown();
496 } 501 }
497 502
498 void BrowserContext::ShutdownStoragePartitions() { 503 void BrowserContext::ShutdownStoragePartitions() {
499 if (GetUserData(kStoragePartitionMapKeyName)) 504 if (GetUserData(kStoragePartitionMapKeyName))
500 RemoveUserData(kStoragePartitionMapKeyName); 505 RemoveUserData(kStoragePartitionMapKeyName);
501 } 506 }
502 507
503 } // namespace content 508 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/battery_status/battery_monitor_integration_browsertest.cc ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698