Commit 731d868b authored by jam's avatar jam Committed by Commit bot

Move NavigatorHost interface to mandoline.

Also remove third_party\mojo_services\src\http_server which is unused.

BUG=479353

Review URL: https://codereview.chromium.org/1109943002

Cr-Commit-Position: refs/heads/master@{#327153}
parent 5348e920
...@@ -108,6 +108,7 @@ source_set("lib") { ...@@ -108,6 +108,7 @@ source_set("lib") {
"//components/surfaces/public/interfaces", "//components/surfaces/public/interfaces",
"//components/webcrypto", "//components/webcrypto",
"//gin", "//gin",
"//mandoline/services/navigation/public/interfaces",
"//media", "//media",
"//media/blink", "//media/blink",
"//media/mojo", "//media/mojo",
...@@ -125,7 +126,6 @@ source_set("lib") { ...@@ -125,7 +126,6 @@ source_set("lib") {
"//third_party/mojo_services/src/accessibility/public/interfaces", "//third_party/mojo_services/src/accessibility/public/interfaces",
"//third_party/mojo_services/src/content_handler/public/interfaces", "//third_party/mojo_services/src/content_handler/public/interfaces",
"//ui/mojo/events:interfaces", "//ui/mojo/events:interfaces",
"//third_party/mojo_services/src/navigation/public/interfaces",
"//ui/events", "//ui/events",
"//ui/events:gesture_detection", "//ui/events:gesture_detection",
"//ui/events/blink", "//ui/events/blink",
......
...@@ -9,6 +9,7 @@ include_rules = [ ...@@ -9,6 +9,7 @@ include_rules = [
"+components/view_manager", "+components/view_manager",
"+components/webcrypto", "+components/webcrypto",
"+gin", "+gin",
"+mandoline/services",
"+media", "+media",
"+mojo/application", "+mojo/application",
"+mojo/cc", "+mojo/cc",
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "components/view_manager/public/cpp/view_manager_client_factory.h" #include "components/view_manager/public/cpp/view_manager_client_factory.h"
#include "components/view_manager/public/cpp/view_manager_delegate.h" #include "components/view_manager/public/cpp/view_manager_delegate.h"
#include "components/view_manager/public/cpp/view_observer.h" #include "components/view_manager/public/cpp/view_observer.h"
#include "mandoline/services/navigation/public/interfaces/navigation.mojom.h"
#include "mojo/services/network/public/interfaces/url_loader.mojom.h" #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
#include "third_party/WebKit/public/web/WebFrameClient.h" #include "third_party/WebKit/public/web/WebFrameClient.h"
#include "third_party/WebKit/public/web/WebSandboxFlags.h" #include "third_party/WebKit/public/web/WebSandboxFlags.h"
...@@ -24,7 +25,6 @@ ...@@ -24,7 +25,6 @@
#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h"
#include "third_party/mojo/src/mojo/public/interfaces/application/application.mojom.h" #include "third_party/mojo/src/mojo/public/interfaces/application/application.mojom.h"
#include "third_party/mojo_services/src/content_handler/public/interfaces/content_handler.mojom.h" #include "third_party/mojo_services/src/content_handler/public/interfaces/content_handler.mojom.h"
#include "third_party/mojo_services/src/navigation/public/interfaces/navigation.mojom.h"
namespace base { namespace base {
class MessageLoopProxy; class MessageLoopProxy;
......
...@@ -23,13 +23,13 @@ mojo_native_application("window_manager") { ...@@ -23,13 +23,13 @@ mojo_native_application("window_manager") {
"//base", "//base",
"//components/view_manager/public/cpp", "//components/view_manager/public/cpp",
"//components/window_manager:lib", "//components/window_manager:lib",
"//mandoline/services/navigation/public/interfaces",
"//mojo/application", "//mojo/application",
"//mojo/common:common", "//mojo/common:common",
"//mojo/converters/geometry", "//mojo/converters/geometry",
"//third_party/mojo/src/mojo/public/cpp/bindings", "//third_party/mojo/src/mojo/public/cpp/bindings",
"//third_party/mojo/src/mojo/public/cpp/utility", "//third_party/mojo/src/mojo/public/cpp/utility",
"//third_party/mojo/src/mojo/public/interfaces/application", "//third_party/mojo/src/mojo/public/interfaces/application",
"//third_party/mojo_services/src/navigation/public/interfaces",
"//ui/gfx/geometry", "//ui/gfx/geometry",
"//ui/mojo/events:interfaces", "//ui/mojo/events:interfaces",
] ]
......
include_rules = [ include_rules = [
"+components/view_manager", "+components/view_manager",
"+components/window_manager", "+components/window_manager",
"+mandoline/services",
"+mojo/application", "+mojo/application",
"+mojo/common", "+mojo/common",
"+third_party/mojo/src/mojo/public", "+third_party/mojo/src/mojo/public",
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
#include "components/view_manager/public/cpp/view_observer.h" #include "components/view_manager/public/cpp/view_observer.h"
#include "components/window_manager/window_manager_app.h" #include "components/window_manager/window_manager_app.h"
#include "components/window_manager/window_manager_delegate.h" #include "components/window_manager/window_manager_delegate.h"
#include "mandoline/services/navigation/public/interfaces/navigation.mojom.h"
#include "third_party/mojo/src/mojo/public/cpp/application/application_delegate.h" #include "third_party/mojo/src/mojo/public/cpp/application/application_delegate.h"
#include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h" #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h"
#include "third_party/mojo/src/mojo/public/cpp/application/connect.h" #include "third_party/mojo/src/mojo/public/cpp/application/connect.h"
#include "third_party/mojo/src/mojo/public/cpp/application/service_provider_impl.h" #include "third_party/mojo/src/mojo/public/cpp/application/service_provider_impl.h"
#include "third_party/mojo_services/src/navigation/public/interfaces/navigation.mojom.h"
#include "ui/mojo/events/input_events.mojom.h" #include "ui/mojo/events/input_events.mojom.h"
namespace kiosk_wm { namespace kiosk_wm {
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#define COMPONENTS_KIOSK_WM_NAVIGATOR_HOST_IMPL_H_ #define COMPONENTS_KIOSK_WM_NAVIGATOR_HOST_IMPL_H_
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "mandoline/services/navigation/public/interfaces/navigation.mojom.h"
#include "mojo/common/weak_binding_set.h" #include "mojo/common/weak_binding_set.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
#include "third_party/mojo_services/src/navigation/public/interfaces/navigation.mojom.h"
namespace kiosk_wm { namespace kiosk_wm {
class KioskWM; class KioskWM;
......
...@@ -10,15 +10,7 @@ mojom("interfaces") { ...@@ -10,15 +10,7 @@ mojom("interfaces") {
"navigation.mojom", "navigation.mojom",
] ]
import_dirs = [ get_path_info("../../../", "abspath") ]
if (defined(mojo_network_service_root)) {
import_dirs += [ mojo_network_service_root ]
} else {
mojo_network_service_root = "../../.."
}
deps = [ deps = [
"$mojo_network_service_root/network/public/interfaces", "//mojo/services/network/public/interfaces",
] ]
} }
...@@ -11,8 +11,8 @@ group("services") { ...@@ -11,8 +11,8 @@ group("services") {
"//components/native_viewport/public/interfaces", "//components/native_viewport/public/interfaces",
"//components/surfaces/public/interfaces", "//components/surfaces/public/interfaces",
"//components/view_manager/public/interfaces", "//components/view_manager/public/interfaces",
"//mandoline/services/navigation/public/interfaces",
"//third_party/mojo_services/src/content_handler/public/interfaces", "//third_party/mojo_services/src/content_handler/public/interfaces",
"//third_party/mojo_services/src/navigation/public/interfaces",
"//ui/mojo/events:interfaces", "//ui/mojo/events:interfaces",
"//ui/mojo/geometry:interfaces", "//ui/mojo/geometry:interfaces",
] ]
......
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/module_args/mojo.gni")
import("$mojo_sdk_root/mojo/public/mojo_sdk.gni")
mojo_sdk_source_set("cpp") {
restrict_external_deps = false
public_configs = [ "../../../public/build/config:mojo_services" ]
sources = [
"http_server_util.h",
"lib/http_server_util.cc",
]
deps = [
"../interfaces",
]
mojo_sdk_deps = [
"mojo/public/cpp/environment",
"mojo/public/cpp/system",
]
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_HTTP_SERVER_PUBLIC_HTTP_SERVER_UTIL_H_
#define SERVICES_HTTP_SERVER_PUBLIC_HTTP_SERVER_UTIL_H_
#include "http_server/public/interfaces/http_response.mojom.h"
namespace http_server {
// Helper method to create an HttpResponse given the status code and body.
HttpResponsePtr CreateHttpResponse(uint32_t status_code,
const std::string& body);
} // namespace http_server
#endif // SERVICES_HTTP_SERVER_PUBLIC_HTTP_SERVER_UTIL_H_
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "http_server/public/cpp/http_server_util.h"
#include "mojo/public/cpp/environment/logging.h"
#include "mojo/public/cpp/system/data_pipe.h"
namespace http_server {
HttpResponsePtr CreateHttpResponse(uint32_t status_code,
const std::string& body) {
HttpResponsePtr response = HttpResponse::New();
mojo::ScopedDataPipeProducerHandle producer_handle;
uint32_t num_bytes = static_cast<uint32_t>(body.size());
MojoCreateDataPipeOptions options = {sizeof(MojoCreateDataPipeOptions),
MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,
1,
num_bytes};
MojoResult result =
CreateDataPipe(&options, &producer_handle, &response->body);
MOJO_DCHECK(MOJO_RESULT_OK == result);
result = WriteDataRaw(producer_handle.get(), body.c_str(), &num_bytes,
MOJO_WRITE_DATA_FLAG_ALL_OR_NONE);
MOJO_DCHECK(MOJO_RESULT_OK == result);
response->status_code = status_code;
response->content_length = num_bytes;
return response.Pass();
}
} // namespace http_server
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/module_args/mojo.gni")
import("$mojo_sdk_root/mojo/public/tools/bindings/mojom.gni")
mojom("interfaces") {
sources = [
"http_request.mojom",
"http_response.mojom",
"http_server.mojom",
"http_server_factory.mojom",
]
import_dirs = [ get_path_info("../../../", "abspath") ]
if (defined(mojo_network_service_root)) {
import_dirs += [ mojo_network_service_root ]
} else {
mojo_network_service_root = "../../.."
}
deps = [
"$mojo_network_service_root/network/public/interfaces",
]
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module http_server;
struct HttpRequest {
string relative_url; // Starts with '/'. Example: "/test?query=foo"
// The HTTP method if applicable.
string method = "GET";
// Additional HTTP request headers.
map<string, string>? headers;
// The payload for the request body. Only set for "POST" or "PUT".
handle<data_pipe_consumer>? body;
};
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module http_server;
struct HttpResponse {
// The HTTP status code.
uint32 status_code = 200;
// The payload for the response body.
handle<data_pipe_consumer>? body;
// This must be the number of bytes in |body|.
int64 content_length = 0;
// The content type.
string content_type = "text/html; charset=utf-8";
// Additional HTTP response headers.
map<string, string>? custom_headers;
};
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module http_server;
import "http_server/public/interfaces/http_request.mojom";
import "http_server/public/interfaces/http_response.mojom";
interface HttpServer {
// Sets a handler for URLs matching a regex pattern. Handlers are considered
// in the order they were registered.
//
// Returns false if there was already a handler registered for the given
// pattern.
//
// To unregister a handler, destroy the underlying pipe.
SetHandler(string pattern, HttpHandler handler) => (bool success);
// Returns the TCP port at which the server is running. This will not return
// until the server is ready, ie. listening for connections.
GetPort() => (uint16 port);
};
interface HttpHandler {
HandleRequest(HttpRequest request) => (HttpResponse response);
};
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module http_server;
import "http_server/public/interfaces/http_server.mojom";
import "network/public/interfaces/net_address.mojom";
interface HttpServerFactory {
// Creates an http server running on the specified local network address. If
// |local_address| is null, it will take the default value of 0.0.0.0 at a
// system-allocated port.
//
// Note that the port value of 0 means that the operating system will pick
// one of available ports. You can use HttpServer::GetPort() to retrieve the
// allocated port.
//
// Only one backing server will be created for each local network address. It
// will be shared among clients, if more than one client requests a server
// running on a particular network address.
//
// TODO(ppi): would it be better to create a server only for the first caller
// and require the access to it to be explicitly shared by the party that
// requests it first?
CreateHttpServer(HttpServer& server_request, mojo.NetAddress? local_address);
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment