// third_party/blink/public/mojom/service_worker/service_worker_client.mojom-blink.cc is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2013 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.

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif

#include "third_party/blink/public/mojom/service_worker/service_worker_client.mojom-blink.h"

#include <math.h>
#include <stdint.h>
#include <utility>

#include "base/hash/md5_constexpr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/common/task_annotator.h"
#include "base/trace_event/trace_conversion_helper.h"
#include "base/trace_event/traced_value.h"
#include "mojo/public/cpp/bindings/lib/generated_code_util.h"
#include "mojo/public/cpp/bindings/lib/message_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization_util.h"
#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_context.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"

#include "third_party/blink/public/mojom/service_worker/service_worker_client.mojom-params-data.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_client.mojom-shared-message-ids.h"

#include "third_party/blink/public/mojom/service_worker/service_worker_client.mojom-blink-import-headers.h"
#include "mojo/public/cpp/bindings/lib/wtf_serialization.h"


#ifndef THIRD_PARTY_BLINK_PUBLIC_MOJOM_SERVICE_WORKER_SERVICE_WORKER_CLIENT_MOJOM_BLINK_JUMBO_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_SERVICE_WORKER_SERVICE_WORKER_CLIENT_MOJOM_BLINK_JUMBO_H_
#endif
namespace blink {
namespace mojom {
namespace blink {
ServiceWorkerClientQueryOptions::ServiceWorkerClientQueryOptions()
    : include_uncontrolled(false),
      client_type(ServiceWorkerClientType::kWindow) {}

ServiceWorkerClientQueryOptions::ServiceWorkerClientQueryOptions(
    bool include_uncontrolled_in,
    ServiceWorkerClientType client_type_in)
    : include_uncontrolled(std::move(include_uncontrolled_in)),
      client_type(std::move(client_type_in)) {}

ServiceWorkerClientQueryOptions::~ServiceWorkerClientQueryOptions() = default;
size_t ServiceWorkerClientQueryOptions::Hash(size_t seed) const {
  seed = mojo::internal::WTFHash(seed, this->include_uncontrolled);
  seed = mojo::internal::WTFHash(seed, this->client_type);
  return seed;
}

void ServiceWorkerClientQueryOptions::AsValueInto(base::trace_event::TracedValue* value) const {
  value->SetBoolean("include_uncontrolled", this->include_uncontrolled);
  value->SetString("client_type", base::trace_event::ValueToString(this->client_type));
}

bool ServiceWorkerClientQueryOptions::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
ServiceWorkerClientInfo::ServiceWorkerClientInfo()
    : url(),
      frame_type(::blink::mojom::blink::RequestContextFrameType::kNone),
      client_uuid(),
      client_type(),
      page_hidden(true),
      is_focused(false),
      lifecycle_state(ServiceWorkerClientLifecycleState::kActive),
      last_focus_time(),
      creation_time() {}

ServiceWorkerClientInfo::ServiceWorkerClientInfo(
    const ::blink::KURL& url_in,
    ::blink::mojom::blink::RequestContextFrameType frame_type_in,
    const WTF::String& client_uuid_in,
    ServiceWorkerClientType client_type_in,
    bool page_hidden_in,
    bool is_focused_in,
    ServiceWorkerClientLifecycleState lifecycle_state_in,
    ::base::TimeTicks last_focus_time_in,
    ::base::TimeTicks creation_time_in)
    : url(std::move(url_in)),
      frame_type(std::move(frame_type_in)),
      client_uuid(std::move(client_uuid_in)),
      client_type(std::move(client_type_in)),
      page_hidden(std::move(page_hidden_in)),
      is_focused(std::move(is_focused_in)),
      lifecycle_state(std::move(lifecycle_state_in)),
      last_focus_time(std::move(last_focus_time_in)),
      creation_time(std::move(creation_time_in)) {}

ServiceWorkerClientInfo::~ServiceWorkerClientInfo() = default;

void ServiceWorkerClientInfo::AsValueInto(base::trace_event::TracedValue* value) const {
  value->SetString("url", base::trace_event::ValueToString(this->url, "<value of type const ::blink::KURL&>"));
  value->SetString("frame_type", base::trace_event::ValueToString(this->frame_type));
  value->SetString("client_uuid", this->client_uuid.Utf8());
  value->SetString("client_type", base::trace_event::ValueToString(this->client_type));
  value->SetBoolean("page_hidden", this->page_hidden);
  value->SetBoolean("is_focused", this->is_focused);
  value->SetString("lifecycle_state", base::trace_event::ValueToString(this->lifecycle_state));
  value->SetString("last_focus_time", base::trace_event::ValueToString(this->last_focus_time, "<value of type ::base::TimeTicks>"));
  value->SetString("creation_time", base::trace_event::ValueToString(this->creation_time, "<value of type ::base::TimeTicks>"));
}

bool ServiceWorkerClientInfo::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
}  // namespace blink
}  // namespace mojom
}  // namespace blink

namespace mojo {


// static
bool StructTraits<::blink::mojom::blink::ServiceWorkerClientQueryOptions::DataView, ::blink::mojom::blink::ServiceWorkerClientQueryOptionsPtr>::Read(
    ::blink::mojom::blink::ServiceWorkerClientQueryOptions::DataView input,
    ::blink::mojom::blink::ServiceWorkerClientQueryOptionsPtr* output) {
  bool success = true;
  ::blink::mojom::blink::ServiceWorkerClientQueryOptionsPtr result(::blink::mojom::blink::ServiceWorkerClientQueryOptions::New());
  
      if (success)
        result->include_uncontrolled = input.include_uncontrolled();
      if (success && !input.ReadClientType(&result->client_type))
        success = false;
  *output = std::move(result);
  return success;
}


// static
bool StructTraits<::blink::mojom::blink::ServiceWorkerClientInfo::DataView, ::blink::mojom::blink::ServiceWorkerClientInfoPtr>::Read(
    ::blink::mojom::blink::ServiceWorkerClientInfo::DataView input,
    ::blink::mojom::blink::ServiceWorkerClientInfoPtr* output) {
  bool success = true;
  ::blink::mojom::blink::ServiceWorkerClientInfoPtr result(::blink::mojom::blink::ServiceWorkerClientInfo::New());
  
      if (success && !input.ReadUrl(&result->url))
        success = false;
      if (success && !input.ReadFrameType(&result->frame_type))
        success = false;
      if (success && !input.ReadClientUuid(&result->client_uuid))
        success = false;
      if (success && !input.ReadClientType(&result->client_type))
        success = false;
      if (success)
        result->page_hidden = input.page_hidden();
      if (success)
        result->is_focused = input.is_focused();
      if (success && !input.ReadLifecycleState(&result->lifecycle_state))
        success = false;
      if (success && !input.ReadLastFocusTime(&result->last_focus_time))
        success = false;
      if (success && !input.ReadCreationTime(&result->creation_time))
        success = false;
  *output = std::move(result);
  return success;
}

}  // namespace mojo

#if defined(__clang__)
#pragma clang diagnostic pop
#endif