Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "chrome/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 #include "chrome/browser/ui/ash/ash_util.h" | 251 #include "chrome/browser/ui/ash/ash_util.h" |
| 252 #include "chrome/browser/ui/browser_commands.h" | 252 #include "chrome/browser/ui/browser_commands.h" |
| 253 #include "chrome/browser/ui/browser_dialogs.h" | 253 #include "chrome/browser/ui/browser_dialogs.h" |
| 254 #include "chrome/browser/ui/browser_finder.h" | 254 #include "chrome/browser/ui/browser_finder.h" |
| 255 #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" | 255 #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" |
| 256 #include "chromeos/chromeos_constants.h" | 256 #include "chromeos/chromeos_constants.h" |
| 257 #include "chromeos/chromeos_switches.h" | 257 #include "chromeos/chromeos_switches.h" |
| 258 #include "components/user_manager/user_manager.h" | 258 #include "components/user_manager/user_manager.h" |
| 259 #include "mash/public/interfaces/launchable.mojom.h" | 259 #include "mash/public/interfaces/launchable.mojom.h" |
| 260 #include "services/service_manager/public/interfaces/interface_provider_spec.moj om.h" | 260 #include "services/service_manager/public/interfaces/interface_provider_spec.moj om.h" |
| 261 #include "services/ui/public/interfaces/constants.mojom.h" | |
| 262 #include "services/ui/service.h" | |
| 263 #include "ui/base/cursor/image_cursors.h" | |
| 261 #elif defined(OS_LINUX) | 264 #elif defined(OS_LINUX) |
| 262 #include "chrome/browser/chrome_browser_main_linux.h" | 265 #include "chrome/browser/chrome_browser_main_linux.h" |
| 263 #elif defined(OS_ANDROID) | 266 #elif defined(OS_ANDROID) |
| 264 #include "chrome/browser/android/app_hooks.h" | 267 #include "chrome/browser/android/app_hooks.h" |
| 265 #include "chrome/browser/android/chrome_context_util.h" | 268 #include "chrome/browser/android/chrome_context_util.h" |
| 266 #include "chrome/browser/android/devtools_manager_delegate_android.h" | 269 #include "chrome/browser/android/devtools_manager_delegate_android.h" |
| 267 #include "chrome/browser/android/ntp/new_tab_page_url_handler.h" | 270 #include "chrome/browser/android/ntp/new_tab_page_url_handler.h" |
| 268 #include "chrome/browser/android/service_tab_launcher.h" | 271 #include "chrome/browser/android/service_tab_launcher.h" |
| 269 #include "chrome/browser/android/tab_android.h" | 272 #include "chrome/browser/android/tab_android.h" |
| 270 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 273 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 851 base::FieldTrialList::FindFullName("SaveDataHeader") | 854 base::FieldTrialList::FindFullName("SaveDataHeader") |
| 852 .compare("Disabled"); | 855 .compare("Disabled"); |
| 853 } | 856 } |
| 854 | 857 |
| 855 WebContents* GetWebContents(int render_process_id, int render_frame_id) { | 858 WebContents* GetWebContents(int render_process_id, int render_frame_id) { |
| 856 RenderFrameHost* rfh = | 859 RenderFrameHost* rfh = |
| 857 RenderFrameHost::FromID(render_process_id, render_frame_id); | 860 RenderFrameHost::FromID(render_process_id, render_frame_id); |
| 858 return WebContents::FromRenderFrameHost(rfh); | 861 return WebContents::FromRenderFrameHost(rfh); |
| 859 } | 862 } |
| 860 | 863 |
| 864 #if defined(OS_CHROMEOS) | |
| 865 std::unique_ptr<service_manager::Service> CreateEmbeddedUIService( | |
| 866 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | |
| 867 base::WeakPtr<ui::ImageCursors> image_cursors_weak_ptr) { | |
| 868 return base::MakeUnique<ui::Service>(task_runner, image_cursors_weak_ptr); | |
| 869 } | |
| 870 #endif // defined(OS_CHROMEOS) | |
| 871 | |
| 861 #if BUILDFLAG(ENABLE_EXTENSIONS) | 872 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 862 // Returns true if there is is an extension with the same origin as | 873 // Returns true if there is is an extension with the same origin as |
| 863 // |source_origin| in |opener_render_process_id| with | 874 // |source_origin| in |opener_render_process_id| with |
| 864 // APIPermission::kBackground. | 875 // APIPermission::kBackground. |
| 865 bool SecurityOriginHasExtensionBackgroundPermission( | 876 bool SecurityOriginHasExtensionBackgroundPermission( |
| 866 extensions::ProcessMap* process_map, | 877 extensions::ProcessMap* process_map, |
| 867 extensions::ExtensionRegistry* registry, | 878 extensions::ExtensionRegistry* registry, |
| 868 const GURL& source_origin, | 879 const GURL& source_origin, |
| 869 int opener_render_process_id) { | 880 int opener_render_process_id) { |
| 870 // Note: includes web URLs that are part of an extension's web extent. | 881 // Note: includes web URLs that are part of an extension's web extent. |
| (...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3023 content::ServiceInfo info; | 3034 content::ServiceInfo info; |
| 3024 info.factory = base::Bind([] { | 3035 info.factory = base::Bind([] { |
| 3025 return std::unique_ptr<service_manager::Service>( | 3036 return std::unique_ptr<service_manager::Service>( |
| 3026 base::MakeUnique<ActiveProfilePrefService>()); | 3037 base::MakeUnique<ActiveProfilePrefService>()); |
| 3027 }); | 3038 }); |
| 3028 info.task_runner = base::ThreadTaskRunnerHandle::Get(); | 3039 info.task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 3029 services->insert(std::make_pair(prefs::mojom::kForwarderServiceName, info)); | 3040 services->insert(std::make_pair(prefs::mojom::kForwarderServiceName, info)); |
| 3030 } | 3041 } |
| 3031 | 3042 |
| 3032 if (!ash_util::IsRunningInMash()) { | 3043 if (!ash_util::IsRunningInMash()) { |
| 3033 content::ServiceInfo info; | 3044 content::ServiceInfo info_ash; |
| 3034 info.factory = base::Bind(&ash_util::CreateEmbeddedAshService, | 3045 info_ash.factory = base::Bind(&ash_util::CreateEmbeddedAshService, |
| 3035 base::ThreadTaskRunnerHandle::Get()); | 3046 base::ThreadTaskRunnerHandle::Get()); |
| 3036 info.task_runner = base::ThreadTaskRunnerHandle::Get(); | 3047 info_ash.task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 3037 services->insert(std::make_pair(ash::mojom::kServiceName, info)); | 3048 services->insert(std::make_pair(ash::mojom::kServiceName, info_ash)); |
| 3049 | |
| 3050 if (!image_cursors_) | |
|
sky
2017/06/27 19:58:56
Is this conditional necessary?
We're starting to
mfomitchev
2017/07/11 21:46:59
Done. Moved a bunch of code into browser_process_p
| |
| 3051 image_cursors_ = base::MakeUnique<ui::ImageCursors>(); | |
| 3052 content::ServiceInfo info_ui; | |
| 3053 info_ui.factory = base::Bind(&CreateEmbeddedUIService, | |
| 3054 base::ThreadTaskRunnerHandle::Get(), | |
| 3055 image_cursors_->GetWeakPtr()); | |
| 3056 info_ui.use_own_thread = true; | |
| 3057 info_ui.message_loop_type = base::MessageLoop::TYPE_UI; | |
| 3058 info_ui.thread_priority = base::ThreadPriority::DISPLAY; | |
| 3059 services->insert(std::make_pair(ui::mojom::kServiceName, info_ui)); | |
| 3038 } | 3060 } |
| 3039 #endif // OS_CHROMEOS | 3061 #endif // OS_CHROMEOS |
| 3040 } | 3062 } |
| 3041 | 3063 |
| 3042 void ChromeContentBrowserClient::RegisterOutOfProcessServices( | 3064 void ChromeContentBrowserClient::RegisterOutOfProcessServices( |
| 3043 OutOfProcessServiceMap* services) { | 3065 OutOfProcessServiceMap* services) { |
| 3044 #if BUILDFLAG(ENABLE_PRINTING) | 3066 #if BUILDFLAG(ENABLE_PRINTING) |
| 3045 services->emplace(printing::mojom::kServiceName, | 3067 services->emplace(printing::mojom::kServiceName, |
| 3046 base::ASCIIToUTF16("PDF Compositor Service")); | 3068 base::ASCIIToUTF16("PDF Compositor Service")); |
| 3047 #endif | 3069 #endif |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3468 // displayed URL when rewriting chrome://help to chrome://settings/help. | 3490 // displayed URL when rewriting chrome://help to chrome://settings/help. |
| 3469 return url->SchemeIs(content::kChromeUIScheme) && | 3491 return url->SchemeIs(content::kChromeUIScheme) && |
| 3470 url->host() == chrome::kChromeUISettingsHost; | 3492 url->host() == chrome::kChromeUISettingsHost; |
| 3471 } | 3493 } |
| 3472 | 3494 |
| 3473 // static | 3495 // static |
| 3474 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 3496 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
| 3475 const storage::QuotaSettings* settings) { | 3497 const storage::QuotaSettings* settings) { |
| 3476 g_default_quota_settings = settings; | 3498 g_default_quota_settings = settings; |
| 3477 } | 3499 } |
| OLD | NEW |