cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / devtools_service / devtools_service_delegate.cc
blobae96d2c72fa01d811d87768efa77fb4083962dc0
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/devtools_service/devtools_service_delegate.h"
7 #include "base/logging.h"
8 #include "components/devtools_service/devtools_registry_impl.h"
9 #include "components/devtools_service/devtools_service.h"
10 #include "mojo/application/public/cpp/application_connection.h"
11 #include "mojo/application/public/cpp/application_impl.h"
12 #include "mojo/common/url_type_converters.h"
13 #include "url/gurl.h"
15 namespace devtools_service {
17 namespace {
19 bool IsShell(const GURL& requestor_url) {
20 // TODO(yzshen): http://crbug.com/491656 "mojo://shell/" has to be used
21 // instead of "mojo:shell" because "mojo" is not treated as a standard scheme.
22 return requestor_url == GURL("mojo://shell/");
25 } // namespace
27 DevToolsServiceDelegate::DevToolsServiceDelegate() {
30 DevToolsServiceDelegate::~DevToolsServiceDelegate() {
33 void DevToolsServiceDelegate::Initialize(mojo::ApplicationImpl* app) {
34 service_.reset(new DevToolsService(app));
37 bool DevToolsServiceDelegate::ConfigureIncomingConnection(
38 mojo::ApplicationConnection* connection) {
39 connection->AddService<DevToolsRegistry>(this);
41 // DevToolsCoordinator is a privileged interface and only allowed for the
42 // shell.
43 if (IsShell(GURL(connection->GetRemoteApplicationURL())))
44 connection->AddService<DevToolsCoordinator>(this);
45 return true;
48 void DevToolsServiceDelegate::Quit() {
49 service_.reset();
52 void DevToolsServiceDelegate::Create(
53 mojo::ApplicationConnection* connection,
54 mojo::InterfaceRequest<DevToolsRegistry> request) {
55 service_->registry()->BindToRegistryRequest(request.Pass());
58 void DevToolsServiceDelegate::Create(
59 mojo::ApplicationConnection* connection,
60 mojo::InterfaceRequest<DevToolsCoordinator> request) {
61 service_->BindToCoordinatorRequest(request.Pass());
64 } // namespace devtools_service