| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/navigation/content_client/content_browser_client.h" | 5 #include "services/navigation/content_client/content_browser_client.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/browser/storage_partition.h" |
| 11 #include "content/public/common/service_info.h" | 13 #include "content/public/common/service_info.h" |
| 12 #include "content/public/common/service_manager_connection.h" | 14 #include "content/public/common/service_manager_connection.h" |
| 13 #include "content/shell/browser/shell_browser_context.h" | 15 #include "content/shell/browser/shell_browser_context.h" |
| 14 #include "services/navigation/content_client/browser_main_parts.h" | 16 #include "services/navigation/content_client/browser_main_parts.h" |
| 15 #include "services/navigation/navigation.h" | 17 #include "services/navigation/navigation.h" |
| 18 #include "storage/browser/quota/quota_settings.h" |
| 16 | 19 |
| 17 namespace navigation { | 20 namespace navigation { |
| 18 | 21 |
| 19 ContentBrowserClient::ContentBrowserClient() {} | 22 ContentBrowserClient::ContentBrowserClient() {} |
| 20 ContentBrowserClient::~ContentBrowserClient() {} | 23 ContentBrowserClient::~ContentBrowserClient() {} |
| 21 | 24 |
| 22 content::BrowserMainParts* ContentBrowserClient::CreateBrowserMainParts( | 25 content::BrowserMainParts* ContentBrowserClient::CreateBrowserMainParts( |
| 23 const content::MainFunctionParams& parameters) { | 26 const content::MainFunctionParams& parameters) { |
| 24 browser_main_parts_ = new BrowserMainParts(parameters); | 27 browser_main_parts_ = new BrowserMainParts(parameters); |
| 25 return browser_main_parts_; | 28 return browser_main_parts_; |
| 26 } | 29 } |
| 27 | 30 |
| 28 std::string ContentBrowserClient::GetServiceUserIdForBrowserContext( | 31 std::string ContentBrowserClient::GetServiceUserIdForBrowserContext( |
| 29 content::BrowserContext* browser_context) { | 32 content::BrowserContext* browser_context) { |
| 30 // Unlike Chrome, where there are different browser contexts for each process, | 33 // Unlike Chrome, where there are different browser contexts for each process, |
| 31 // each with their own userid, here there is only one and we should reuse the | 34 // each with their own userid, here there is only one and we should reuse the |
| 32 // same userid as our own process to avoid having to create multiple shell | 35 // same userid as our own process to avoid having to create multiple shell |
| 33 // connections. | 36 // connections. |
| 34 return content::ServiceManagerConnection::GetForProcess()->GetIdentity() | 37 return content::ServiceManagerConnection::GetForProcess()->GetIdentity() |
| 35 .user_id(); | 38 .user_id(); |
| 36 } | 39 } |
| 37 | 40 |
| 38 void ContentBrowserClient::RegisterInProcessServices( | 41 void ContentBrowserClient::RegisterInProcessServices( |
| 39 StaticServiceMap* services) { | 42 StaticServiceMap* services) { |
| 40 content::ServiceManagerConnection::GetForProcess()->AddConnectionFilter( | 43 content::ServiceManagerConnection::GetForProcess()->AddConnectionFilter( |
| 41 base::MakeUnique<Navigation>()); | 44 base::MakeUnique<Navigation>()); |
| 42 } | 45 } |
| 43 | 46 |
| 47 void ContentBrowserClient::GetQuotaSettings( |
| 48 content::BrowserContext* context, |
| 49 content::StoragePartition* partition, |
| 50 const storage::OptionalQuotaSettingsCallback& callback) { |
| 51 content::BrowserThread::PostTaskAndReplyWithResult( |
| 52 content::BrowserThread::FILE, FROM_HERE, |
| 53 base::Bind(&storage::CalculateNominalDynamicSettings, |
| 54 partition->GetPath(), context->IsOffTheRecord()), |
| 55 callback); |
| 56 } |
| 57 |
| 44 } // namespace navigation | 58 } // namespace navigation |
| OLD | NEW |