diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-01-29 16:35:13 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-02-01 15:33:35 +0000 |
commit | c8c2d1901aec01e934adf561a9fdf0cc776cdef8 (patch) | |
tree | 9157c3d9815e5870799e070b113813bec53e0535 /chromium/services/network | |
parent | abefd5095b41dac94ca451d784ab6e27372e981a (diff) | |
download | qtwebengine-chromium-c8c2d1901aec01e934adf561a9fdf0cc776cdef8.tar.gz |
BASELINE: Update Chromium to 64.0.3282.139
Change-Id: I1cae68fe9c94ff7608b26b8382fc19862cdb293a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/services/network')
22 files changed, 540 insertions, 1 deletions
diff --git a/chromium/services/network/public/cpp/BUILD.gn b/chromium/services/network/public/cpp/BUILD.gn index 65b5ac6377d..7dc3fa50745 100644 --- a/chromium/services/network/public/cpp/BUILD.gn +++ b/chromium/services/network/public/cpp/BUILD.gn @@ -6,8 +6,18 @@ import("//mojo/public/tools/bindings/mojom.gni") static_library("cpp") { sources = [ + "cors_error_status.cc", + "cors_error_status.h", + "mutable_network_traffic_annotation_tag_struct_traits.h", + "mutable_partial_network_traffic_annotation_tag_struct_traits.h", "net_adapters.cc", "net_adapters.h", + "url_loader_completion_status.cc", + "url_loader_completion_status.h", + ] + + public_deps = [ + "//services/network/public/interfaces", ] deps = [ @@ -30,6 +40,8 @@ source_set("tests") { testonly = true sources = [ + "mutable_network_traffic_annotation_tag_struct_traits_unittest.cc", + "mutable_partial_network_traffic_annotation_tag_struct_traits_unittest.cc", "network_struct_traits_unittest.cc", ] deps = [ diff --git a/chromium/services/network/public/cpp/DEPS b/chromium/services/network/public/cpp/DEPS new file mode 100644 index 00000000000..d3acaa01813 --- /dev/null +++ b/chromium/services/network/public/cpp/DEPS @@ -0,0 +1,4 @@ +include_rules = [ + # CORS related files will be included from Blink, and should use cors.mojom-shared.h. + "-services/network/public/interfaces/cors.mojom.h", +] diff --git a/chromium/services/network/public/cpp/cookie_manager_struct_traits.cc b/chromium/services/network/public/cpp/cookie_manager_struct_traits.cc index b5ceb4d876c..aa0d1f358e7 100644 --- a/chromium/services/network/public/cpp/cookie_manager_struct_traits.cc +++ b/chromium/services/network/public/cpp/cookie_manager_struct_traits.cc @@ -4,6 +4,8 @@ #include "services/network/public/cpp/cookie_manager_struct_traits.h" +#include "mojo/common/time_struct_traits.h" + namespace mojo { network::mojom::CookiePriority diff --git a/chromium/services/network/public/cpp/cors_error_status.cc b/chromium/services/network/public/cpp/cors_error_status.cc new file mode 100644 index 00000000000..c4c395bccb6 --- /dev/null +++ b/chromium/services/network/public/cpp/cors_error_status.cc @@ -0,0 +1,36 @@ +// Copyright 2017 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 "services/network/public/cpp/cors_error_status.h" + +#include "net/base/net_errors.h" + +namespace network { + +// Note: |cors_error| is initialized to kLast to keep the value inside the +// valid enum value range. The value is meaningless and should be overriden +// immediately by IPC desrtialization code. +CORSErrorStatus::CORSErrorStatus() + : CORSErrorStatus(network::mojom::CORSError::kLast) {} + +CORSErrorStatus::CORSErrorStatus(const CORSErrorStatus& status) = default; + +CORSErrorStatus::CORSErrorStatus(network::mojom::CORSError error) + : cors_error(error) {} + +CORSErrorStatus::CORSErrorStatus( + network::mojom::CORSError error, + scoped_refptr<net::HttpResponseHeaders> headers) + : CORSErrorStatus(error) { + related_response_headers = headers; +} + +CORSErrorStatus::~CORSErrorStatus() = default; + +bool CORSErrorStatus::operator==(const CORSErrorStatus& rhs) const { + return cors_error == rhs.cors_error && + related_response_headers == rhs.related_response_headers; +} + +} // namespace network diff --git a/chromium/services/network/public/cpp/cors_error_status.h b/chromium/services/network/public/cpp/cors_error_status.h new file mode 100644 index 00000000000..529d885eea3 --- /dev/null +++ b/chromium/services/network/public/cpp/cors_error_status.h @@ -0,0 +1,41 @@ +// Copyright 2017 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_NETWORK_PUBLIC_CPP_CORS_ERROR_STATUS_H_ +#define SERVICES_NETWORK_PUBLIC_CPP_CORS_ERROR_STATUS_H_ + +#include "base/memory/scoped_refptr.h" +#include "net/http/http_response_headers.h" +#include "services/network/public/interfaces/cors.mojom-shared.h" + +namespace network { + +struct CORSErrorStatus { + // This constructor is used by generated IPC serialization code. + // Should not use this explicitly. + // TODO(toyoshim, yhirano): Exploring a way to make this private, and allows + // only serialization code for mojo can access. + CORSErrorStatus(); + + CORSErrorStatus(const CORSErrorStatus& status); + + explicit CORSErrorStatus(network::mojom::CORSError error); + CORSErrorStatus( + network::mojom::CORSError error, + scoped_refptr<net::HttpResponseHeaders> related_response_headers); + + ~CORSErrorStatus(); + + bool operator==(const CORSErrorStatus& rhs) const; + + network::mojom::CORSError cors_error; + + // Partial HTTP response headers including status line that will be useful to + // generate a human readable error message. + scoped_refptr<net::HttpResponseHeaders> related_response_headers; +}; + +} // namespace network + +#endif // SERVICES_NETWORK_PUBLIC_CPP_CORS_ERROR_STATUS_H_ diff --git a/chromium/services/network/public/cpp/mutable_network_traffic_annotation_tag.typemap b/chromium/services/network/public/cpp/mutable_network_traffic_annotation_tag.typemap new file mode 100644 index 00000000000..3b72b6549a3 --- /dev/null +++ b/chromium/services/network/public/cpp/mutable_network_traffic_annotation_tag.typemap @@ -0,0 +1,13 @@ +# Copyright 2017 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. + +mojom = "//services/network/public/interfaces/mutable_network_traffic_annotation_tag.mojom" +public_headers = [ "//net/traffic_annotation/network_traffic_annotation.h" ] +traits_headers = [ "//services/network/public/cpp/" + + "mutable_network_traffic_annotation_tag_struct_traits.h" ] +deps = [ + "//net:traffic_annotation", +] +type_mappings = [ "network.mojom.MutableNetworkTrafficAnnotationTag=" + + "net::MutableNetworkTrafficAnnotationTag" ] diff --git a/chromium/services/network/public/cpp/mutable_network_traffic_annotation_tag_struct_traits.h b/chromium/services/network/public/cpp/mutable_network_traffic_annotation_tag_struct_traits.h new file mode 100644 index 00000000000..c6c36bb6fc7 --- /dev/null +++ b/chromium/services/network/public/cpp/mutable_network_traffic_annotation_tag_struct_traits.h @@ -0,0 +1,31 @@ +// Copyright 2017 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_NETWORK_PUBLIC_CPP_MUTABLE_NETWORK_TRAFFIC_ANNOTATION_TAG_STRUCT_TRAITS_H_ +#define SERVICES_NETWORK_PUBLIC_CPP_MUTABLE_NETWORK_TRAFFIC_ANNOTATION_TAG_STRUCT_TRAITS_H_ + +#include "mojo/common/common_custom_types_struct_traits.h" +#include "net/traffic_annotation/network_traffic_annotation.h" +#include "services/network/public/interfaces/mutable_network_traffic_annotation_tag.mojom.h" + +namespace mojo { + +template <> +struct StructTraits<network::mojom::MutableNetworkTrafficAnnotationTagDataView, + net::MutableNetworkTrafficAnnotationTag> { + static int32_t unique_id_hash_code( + const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { + return traffic_annotation.unique_id_hash_code; + } + static bool Read( + network::mojom::MutableNetworkTrafficAnnotationTagDataView data, + net::MutableNetworkTrafficAnnotationTag* out) { + out->unique_id_hash_code = data.unique_id_hash_code(); + return true; + } +}; + +} // namespace mojo + +#endif // SERVICES_NETWORK_PUBLIC_CPP_MUTABLE_NETWORK_TRAFFIC_ANNOTATION_TAG_STRUCT_TRAITS_H_ diff --git a/chromium/services/network/public/cpp/mutable_network_traffic_annotation_tag_struct_traits_unittest.cc b/chromium/services/network/public/cpp/mutable_network_traffic_annotation_tag_struct_traits_unittest.cc new file mode 100644 index 00000000000..ac5a6293919 --- /dev/null +++ b/chromium/services/network/public/cpp/mutable_network_traffic_annotation_tag_struct_traits_unittest.cc @@ -0,0 +1,30 @@ +// Copyright 2017 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 "services/network/public/cpp/mutable_network_traffic_annotation_tag_struct_traits.h" + +#include "base/macros.h" +#include "base/message_loop/message_loop.h" +#include "mojo/public/cpp/bindings/binding_set.h" +#include "services/network/public/interfaces/mutable_network_traffic_annotation_tag.mojom.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace network { + +TEST(MutableNetworkTrafficAnnottionTagsTest, BasicTest) { + net::MutableNetworkTrafficAnnotationTag original; + net::MutableNetworkTrafficAnnotationTag copy; + + original.unique_id_hash_code = 1; + EXPECT_TRUE(mojom::MutableNetworkTrafficAnnotationTag::Deserialize( + mojom::MutableNetworkTrafficAnnotationTag::Serialize(&original), ©)); + EXPECT_EQ(copy.unique_id_hash_code, 1); + + original.unique_id_hash_code = 2; + EXPECT_TRUE(mojom::MutableNetworkTrafficAnnotationTag::Deserialize( + mojom::MutableNetworkTrafficAnnotationTag::Serialize(&original), ©)); + EXPECT_EQ(copy.unique_id_hash_code, 2); +} + +} // namespace network diff --git a/chromium/services/network/public/cpp/mutable_partial_network_traffic_annotation_tag.typemap b/chromium/services/network/public/cpp/mutable_partial_network_traffic_annotation_tag.typemap new file mode 100644 index 00000000000..d1a3154f57a --- /dev/null +++ b/chromium/services/network/public/cpp/mutable_partial_network_traffic_annotation_tag.typemap @@ -0,0 +1,14 @@ +# Copyright 2017 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. + +mojom = "//services/network/public/interfaces/mutable_partial_network_traffic_annotation_tag.mojom" +public_headers = [ "//net/traffic_annotation/network_traffic_annotation.h" ] +traits_headers = + [ "//services/network/public/cpp/" + + "mutable_partial_network_traffic_annotation_tag_struct_traits.h" ] +deps = [ + "//net:traffic_annotation", +] +type_mappings = [ "network.mojom.MutablePartialNetworkTrafficAnnotationTag=" + + "net::MutablePartialNetworkTrafficAnnotationTag" ] diff --git a/chromium/services/network/public/cpp/mutable_partial_network_traffic_annotation_tag_struct_traits.h b/chromium/services/network/public/cpp/mutable_partial_network_traffic_annotation_tag_struct_traits.h new file mode 100644 index 00000000000..09a552c0b99 --- /dev/null +++ b/chromium/services/network/public/cpp/mutable_partial_network_traffic_annotation_tag_struct_traits.h @@ -0,0 +1,45 @@ +// Copyright 2017 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_NETWORK_PUBLIC_CPP_MUTABLE_PARTIAL_NETWORK_TRAFFIC_ANNOTATION_TAG_STRUCT_TRAITS_H_ +#define SERVICES_NETWORK_PUBLIC_CPP_MUTABLE_PARTIAL_NETWORK_TRAFFIC_ANNOTATION_TAG_STRUCT_TRAITS_H_ + +#include "mojo/common/common_custom_types_struct_traits.h" +#include "net/traffic_annotation/network_traffic_annotation.h" +#include "services/network/public/interfaces/mutable_partial_network_traffic_annotation_tag.mojom.h" + +namespace mojo { + +template <> +struct StructTraits< + network::mojom::MutablePartialNetworkTrafficAnnotationTagDataView, + net::MutablePartialNetworkTrafficAnnotationTag> { + static int32_t unique_id_hash_code( + const net::MutablePartialNetworkTrafficAnnotationTag& + traffic_annotation) { + return traffic_annotation.unique_id_hash_code; + } + static int32_t completing_id_hash_code( + const net::MutablePartialNetworkTrafficAnnotationTag& + traffic_annotation) { +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) + return traffic_annotation.completing_id_hash_code; +#else + return -1; +#endif + } + static bool Read( + network::mojom::MutablePartialNetworkTrafficAnnotationTagDataView data, + net::MutablePartialNetworkTrafficAnnotationTag* out) { + out->unique_id_hash_code = data.unique_id_hash_code(); +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) + out->completing_id_hash_code = data.completing_id_hash_code(); +#endif + return true; + } +}; + +} // namespace mojo + +#endif // SERVICES_NETWORK_PUBLIC_CPP_MUTABLE_PARTIAL_NETWORK_TRAFFIC_ANNOTATION_TAG_STRUCT_TRAITS_H_ diff --git a/chromium/services/network/public/cpp/mutable_partial_network_traffic_annotation_tag_struct_traits_unittest.cc b/chromium/services/network/public/cpp/mutable_partial_network_traffic_annotation_tag_struct_traits_unittest.cc new file mode 100644 index 00000000000..096ed718fc7 --- /dev/null +++ b/chromium/services/network/public/cpp/mutable_partial_network_traffic_annotation_tag_struct_traits_unittest.cc @@ -0,0 +1,33 @@ +// Copyright 2017 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 "services/network/public/cpp/mutable_partial_network_traffic_annotation_tag_struct_traits.h" + +#include "base/logging.h" +#include "base/macros.h" +#include "base/message_loop/message_loop.h" +#include "mojo/public/cpp/bindings/binding_set.h" +#include "services/network/public/interfaces/mutable_partial_network_traffic_annotation_tag.mojom.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace network { + +TEST(MutablePartialNetworkTrafficAnnottionTagsTest, BasicTest) { + net::MutablePartialNetworkTrafficAnnotationTag original; + net::MutablePartialNetworkTrafficAnnotationTag copy; + + original.unique_id_hash_code = 1; +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) + original.completing_id_hash_code = 2; +#endif + EXPECT_TRUE(mojom::MutablePartialNetworkTrafficAnnotationTag::Deserialize( + mojom::MutablePartialNetworkTrafficAnnotationTag::Serialize(&original), + ©)); + EXPECT_EQ(copy.unique_id_hash_code, 1); +#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) + EXPECT_EQ(copy.completing_id_hash_code, 2); +#endif +} + +} // namespace network diff --git a/chromium/services/network/public/cpp/typemaps.gni b/chromium/services/network/public/cpp/typemaps.gni index b17df8885e3..bde889a1f57 100644 --- a/chromium/services/network/public/cpp/typemaps.gni +++ b/chromium/services/network/public/cpp/typemaps.gni @@ -3,6 +3,8 @@ # found in the LICENSE file. typemaps = [ + "//services/network/public/cpp/mutable_network_traffic_annotation_tag.typemap", + "//services/network/public/cpp/mutable_partial_network_traffic_annotation_tag.typemap", "//services/network/public/cpp/cookie_manager.typemap", "//services/network/public/cpp/http_request_headers.typemap", ] diff --git a/chromium/services/network/public/cpp/url_loader_completion_status.cc b/chromium/services/network/public/cpp/url_loader_completion_status.cc new file mode 100644 index 00000000000..8183d5bb54d --- /dev/null +++ b/chromium/services/network/public/cpp/url_loader_completion_status.cc @@ -0,0 +1,37 @@ +// Copyright 2016 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 "services/network/public/cpp/url_loader_completion_status.h" + +#include "net/base/net_errors.h" + +namespace network { + +URLLoaderCompletionStatus::URLLoaderCompletionStatus() = default; +URLLoaderCompletionStatus::URLLoaderCompletionStatus( + const URLLoaderCompletionStatus& status) = default; + +URLLoaderCompletionStatus::URLLoaderCompletionStatus(int error_code) + : error_code(error_code), completion_time(base::TimeTicks::Now()) {} + +URLLoaderCompletionStatus::URLLoaderCompletionStatus( + const CORSErrorStatus& error) + : URLLoaderCompletionStatus(net::ERR_FAILED) { + cors_error_status = error; +} + +URLLoaderCompletionStatus::~URLLoaderCompletionStatus() = default; + +bool URLLoaderCompletionStatus::operator==( + const URLLoaderCompletionStatus& rhs) const { + return error_code == rhs.error_code && + exists_in_cache == rhs.exists_in_cache && + completion_time == rhs.completion_time && + encoded_data_length == rhs.encoded_data_length && + encoded_body_length == rhs.encoded_body_length && + decoded_body_length == rhs.decoded_body_length && + cors_error_status == rhs.cors_error_status; +} + +} // namespace network diff --git a/chromium/services/network/public/cpp/url_loader_completion_status.h b/chromium/services/network/public/cpp/url_loader_completion_status.h new file mode 100644 index 00000000000..0b804bf97a2 --- /dev/null +++ b/chromium/services/network/public/cpp/url_loader_completion_status.h @@ -0,0 +1,62 @@ +// Copyright 2016 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_NETWORK_PUBLIC_CPP_URL_LOADER_COMPLETION_STATUS_H_ +#define SERVICES_NETWORK_PUBLIC_CPP_URL_LOADER_COMPLETION_STATUS_H_ + +#include <stdint.h> + +#include "base/macros.h" +#include "base/optional.h" +#include "base/time/time.h" +#include "net/ssl/ssl_info.h" +#include "services/network/public/cpp/cors_error_status.h" +#include "services/network/public/interfaces/cors.mojom-shared.h" + +namespace network { + +struct URLLoaderCompletionStatus { + URLLoaderCompletionStatus(); + URLLoaderCompletionStatus(const URLLoaderCompletionStatus& status); + + // Sets |error_code| to |error_code| and base::TimeTicks::Now() to + // |completion_time|. + explicit URLLoaderCompletionStatus(int error_code); + + // Sets ERR_FAILED to |error_code|, |error| to |cors_error_status|, and + // base::TimeTicks::Now() to |completion_time|. + explicit URLLoaderCompletionStatus(const CORSErrorStatus& error); + + ~URLLoaderCompletionStatus(); + + bool operator==(const URLLoaderCompletionStatus& rhs) const; + + // The error code. ERR_FAILED is set for CORS errors. + int error_code = 0; + + // A copy of the data requested exists in the cache. + bool exists_in_cache = false; + + // Time the request completed. + base::TimeTicks completion_time; + + // Total amount of data received from the network. + int64_t encoded_data_length = 0; + + // The length of the response body before removing any content encodings. + int64_t encoded_body_length = 0; + + // The length of the response body after decoding. + int64_t decoded_body_length = 0; + + // Optional CORS error details. + base::Optional<CORSErrorStatus> cors_error_status; + + // Optional SSL certificate info. + base::Optional<net::SSLInfo> ssl_info; +}; + +} // namespace network + +#endif // SERVICES_NETWORK_PUBLIC_CPP_URL_LOADER_COMPLETION_STATUS_H_ diff --git a/chromium/services/network/public/interfaces/BUILD.gn b/chromium/services/network/public/interfaces/BUILD.gn index e5683e01656..e95d43d73f1 100644 --- a/chromium/services/network/public/interfaces/BUILD.gn +++ b/chromium/services/network/public/interfaces/BUILD.gn @@ -7,8 +7,13 @@ import("//mojo/public/tools/bindings/mojom.gni") mojom("interfaces") { sources = [ "cookie_manager.mojom", + "cors.mojom", + "data_pipe_getter.mojom", "fetch_api.mojom", "http_request_headers.mojom", + "mutable_network_traffic_annotation_tag.mojom", + "mutable_partial_network_traffic_annotation_tag.mojom", + "network_change_manager.mojom", "restricted_cookie_manager.mojom", ] diff --git a/chromium/services/network/public/interfaces/cookie_manager.mojom b/chromium/services/network/public/interfaces/cookie_manager.mojom index a60a8246add..cee53af22d8 100644 --- a/chromium/services/network/public/interfaces/cookie_manager.mojom +++ b/chromium/services/network/public/interfaces/cookie_manager.mojom @@ -90,6 +90,20 @@ enum CookieDeletionSessionControl { // If no filters are specified then all cookies will be deleted; this can be // thought of as there being a default "match everything" filter which is // ANDed in with all other filters. +// +// Note that whether a domain matches a cookie or not is somewhat nuanced. For +// the purposes of this filter: +// * The host/domain cookie distinction is ignored +// * A cookies effective domain is considered to be the top level registry +// (including private registries) for the domain stored in the cookie +// + the next entry down. So the effective domain for x.y.google.com +// would be google.com, and the effective domain for x.google.co.uk would +// be google.co.uk. See the function +// net::registry_controlled_domains::GetDomainAndRegistry for more +// details. +// * If a cookie does not have such a top level domain (e.g. IP address +// or private hostname), the domain specified in the cookie (the IP +// address or private hostname) is used. struct CookieDeletionFilter { // Delete cookies created after a date. mojo.common.mojom.Time? created_after_time; diff --git a/chromium/services/network/public/interfaces/cors.mojom b/chromium/services/network/public/interfaces/cors.mojom new file mode 100644 index 00000000000..2a9f393134a --- /dev/null +++ b/chromium/services/network/public/interfaces/cors.mojom @@ -0,0 +1,39 @@ +// Copyright 2017 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 network.mojom; + +// A policy to decide if CORS-preflight fetch should be performed. +enum CORSPreflightPolicy { + kConsiderPreflight, + kPreventPreflight, +}; + +// Error conditions of the CORS check. +enum CORSError { + // Access control + kDisallowedByMode, + kInvalidResponse, + kAllowOriginMismatch, + kSubOriginMismatch, + kWildcardOriginNotAllowed, + kMissingAllowOriginHeader, + kMultipleAllowOriginValues, + kInvalidAllowOriginValue, + kDisallowCredentialsNotSetToTrue, + + // Preflight + kPreflightInvalidStatus, + // "Access-Control-Allow-External:" + // ( https://wicg.github.io/cors-rfc1918/#headers ) specific error + // conditions: + kPreflightMissingAllowExternal, + kPreflightInvalidAllowExternal, + + // Redirect + kRedirectDisallowedScheme, + kRedirectContainsCredentials, + + kLast = kRedirectContainsCredentials, +}; diff --git a/chromium/services/network/public/interfaces/data_pipe_getter.mojom b/chromium/services/network/public/interfaces/data_pipe_getter.mojom new file mode 100644 index 00000000000..cfadd97e967 --- /dev/null +++ b/chromium/services/network/public/interfaces/data_pipe_getter.mojom @@ -0,0 +1,15 @@ +// Copyright 2017 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 network.mojom; + +// An interface that can vend a data pipe multiple times. You can think of it +// as backed by content like a Blob that can be read multiple times. +interface DataPipeGetter { + // Reads all the content, writing into |pipe|. Calls the callback with |size| + // once the size of the content is known. If an error occurred before the + // size was known, the callback is instead called with the net::Error + // |status|. + Read(handle<data_pipe_producer> pipe) => (int32 status, uint64 size); +}; diff --git a/chromium/services/network/public/interfaces/fetch_api.mojom b/chromium/services/network/public/interfaces/fetch_api.mojom index 2ae7b66224c..7ffda4b1112 100644 --- a/chromium/services/network/public/interfaces/fetch_api.mojom +++ b/chromium/services/network/public/interfaces/fetch_api.mojom @@ -4,10 +4,37 @@ module network.mojom; +// Corresponds to Fetch request's "mode" and "use-CORS-preflight flag": +// https://fetch.spec.whatwg.org/#concept-request-mode +// +// This enum is also used in histograms. Append-only. +// See the "FetchRequestMode" enum in enums.xml. +enum FetchRequestMode { + kSameOrigin, + kNoCORS, + kCORS, + kCORSWithForcedPreflight, + kNavigate, + // Add a new type here, then update kLast and enums.xml. + kLast = kNavigate +}; + +// Corresponds to Fetch request's "credentials mode": +// https://fetch.spec.whatwg.org/#concept-request-credentials-mode +enum FetchCredentialsMode { + kOmit, + kSameOrigin, + kInclude, + + // Update kLast if a new type is appended. + kLast = kInclude +}; + // Corresponds to response types from the Fetch spec: // https://fetch.spec.whatwg.org/#concept-response-type // -// This enum is used in histograms. Append-only. +// This enum is also used in histograms. Append-only. +// See the "FetchResponseType" enum in enums.xml. enum FetchResponseType { kBasic, kCORS, diff --git a/chromium/services/network/public/interfaces/mutable_network_traffic_annotation_tag.mojom b/chromium/services/network/public/interfaces/mutable_network_traffic_annotation_tag.mojom new file mode 100644 index 00000000000..34ab3a379ed --- /dev/null +++ b/chromium/services/network/public/interfaces/mutable_network_traffic_annotation_tag.mojom @@ -0,0 +1,13 @@ +// Copyright 2017 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. + +// This interface defines the required structure to serialize a +// net::MutableNetworkTrafficAnnotationTag. Please refer to +// '/docs/network_traffic_annotations.md' for more details. + +module network.mojom; + +struct MutableNetworkTrafficAnnotationTag { + uint32 unique_id_hash_code; +}; diff --git a/chromium/services/network/public/interfaces/mutable_partial_network_traffic_annotation_tag.mojom b/chromium/services/network/public/interfaces/mutable_partial_network_traffic_annotation_tag.mojom new file mode 100644 index 00000000000..265814c38cc --- /dev/null +++ b/chromium/services/network/public/interfaces/mutable_partial_network_traffic_annotation_tag.mojom @@ -0,0 +1,14 @@ +// Copyright 2017 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. + +// This interface defines the required structure to serialize a +// net::MutablePartialNetworkTrafficAnnotationTag. Please refer to +// '/docs/network_traffic_annotations.md' for more details. + +module network.mojom; + +struct MutablePartialNetworkTrafficAnnotationTag { + uint32 unique_id_hash_code; + uint32 completing_id_hash_code; +}; diff --git a/chromium/services/network/public/interfaces/network_change_manager.mojom b/chromium/services/network/public/interfaces/network_change_manager.mojom new file mode 100644 index 00000000000..ce157d501bf --- /dev/null +++ b/chromium/services/network/public/interfaces/network_change_manager.mojom @@ -0,0 +1,50 @@ +// Copyright 2017 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 network.mojom; + +// This needs to match the definition of net::ConnectionType. +enum ConnectionType { + CONNECTION_UNKNOWN = 0, // A connection exists, but its type is unknown. + // Also used as a default value. + CONNECTION_ETHERNET = 1, + CONNECTION_WIFI = 2, + CONNECTION_2G = 3, + CONNECTION_3G = 4, + CONNECTION_4G = 5, + CONNECTION_NONE = 6, // No connection. + CONNECTION_BLUETOOTH = 7, + CONNECTION_LAST = CONNECTION_BLUETOOTH +}; + +// A client interface that subscribes to network change events from +// NetworkChangeManager. +interface NetworkChangeManagerClient { + // Invoked when the initial connection type is ready. + OnInitialConnectionType(ConnectionType type); + + // OnNetworkChanged will be called when a change occurs to the host + // computer's hardware or software that affects the route network packets + // take to any network server. Some examples: + // 1. A network connection becoming available or going away. For example + // plugging or unplugging an Ethernet cable, WiFi or cellular modem + // connecting or disconnecting from a network, or a VPN tunnel being + // established or taken down. + // 2. An active network connection's IP address changes. + // 3. A change to the local IP routing tables. + // The signal is produced when the change is complete. For example if a new + // network connection has become available, the signal is issued after OS has + // finished establishing the connection (i.e. DHCP is done) to the point where + // the new connection is usable. |type| indicates the type of the active + // primary network connection after the change. OnNetworkChanged will always + // be called with CONNECTION_NONE immediately prior to being called with an + // online state. + OnNetworkChanged(ConnectionType type); +}; + +// An interface that broadcasts network change events. +interface NetworkChangeManager { + // Requests to receive notification when there is a network change. + RequestNotifications(NetworkChangeManagerClient client_ptr); +}; |