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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 1371793004: Provide the DeviceManager service to the renderer directly, no app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface_permission
Patch Set: Fix header inclusion in chrome_content_browser_client.cc. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 6d5115182e9414024abf4181ab20f34967156df6..54bf355b2899a53827f6236773a50f28a338611e 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -132,8 +132,6 @@
#include "content/public/common/service_registry.h"
#include "content/public/common/url_utils.h"
#include "content/public/common/web_preferences.h"
-#include "device/devices_app/public/cpp/constants.h"
-#include "device/devices_app/public/cpp/devices_app_factory.h"
#include "gin/v8_initializer.h"
#include "mojo/application/public/cpp/application_delegate.h"
#include "net/base/mime_util.h"
@@ -262,6 +260,7 @@
#if !defined(OS_ANDROID) && !defined(OS_IOS)
#include "chrome/browser/usb/web_usb_permission_provider.h"
+#include "device/devices_app/usb/device_manager_impl.h"
#endif
using base::FileDescriptor;
@@ -622,6 +621,18 @@ void GetGuestViewDefaultContentSettingRules(
}
#endif // defined(ENABLE_EXTENSIONS)
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
Ken Rockot(use gerrit already) 2015/09/28 22:23:14 nit: you could simplify slightly by removing the p
Reilly Grant (use Gerrit) 2015/09/28 23:32:00 Done.
+void CreateUsbDeviceManager(
+ RenderFrameHost* render_frame_host,
+ mojo::InterfaceRequest<device::usb::DeviceManager> request) {
+ device::usb::PermissionProviderPtr permission_provider;
+ WebUSBPermissionProvider::Create(render_frame_host,
+ mojo::GetProxy(&permission_provider));
+ device::usb::DeviceManagerImpl::Create(permission_provider.Pass(),
+ request.Pass());
+}
+#endif // !defined(OS_ANDROID) && !defined(OS_IOS)
+
} // namespace
ChromeContentBrowserClient::ChromeContentBrowserClient()
@@ -2539,18 +2550,13 @@ void ChromeContentBrowserClient::RegisterFrameMojoShellServices(
base::Bind(&chromeos::attestation::PlatformVerificationImpl::Create,
render_frame_host));
#endif
-#if !defined(OS_ANDROID) && !defined(OS_IOS)
- registry->AddService(
- base::Bind(&WebUSBPermissionProvider::Create, render_frame_host));
-#endif
}
-void ChromeContentBrowserClient::RegisterInProcessMojoApplications(
- StaticMojoApplicationMap* apps) {
+void ChromeContentBrowserClient::RegisterRenderFrameMojoServices(
+ content::ServiceRegistry* registry,
+ content::RenderFrameHost* render_frame_host) {
#if !defined(OS_ANDROID) && !defined(OS_IOS)
- apps->insert(std::make_pair(GURL(device::kDevicesMojoAppUrl),
- base::Bind(&device::DevicesAppFactory::CreateApp,
- base::ThreadTaskRunnerHandle::Get())));
+ registry->AddService(base::Bind(&CreateUsbDeviceManager, render_frame_host));
#endif
}

Powered by Google App Engine
This is Rietveld 408576698