Commit e284fdd7 authored by sushkov's avatar sushkov Committed by Commit bot

added a headlessresourcedispatcherhostdelegate so that we do not crash when a...

added a headlessresourcedispatcherhostdelegate so that we do not crash when a website requests a client cert store

BUG=714534

Review-Url: https://codereview.chromium.org/2852633002
Cr-Commit-Position: refs/heads/master@{#468280}
parent a7bdae0c
......@@ -231,6 +231,8 @@ static_library("headless_lib") {
"lib/browser/headless_permission_manager.h",
"lib/browser/headless_platform_event_source.cc",
"lib/browser/headless_platform_event_source.h",
"lib/browser/headless_resource_dispatcher_host_delegate.cc",
"lib/browser/headless_resource_dispatcher_host_delegate.h",
"lib/browser/headless_shell_application_mac.mm",
"lib/browser/headless_shell_application_mac.h",
"lib/browser/headless_tab_socket_impl.cc",
......
......@@ -17,6 +17,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/service_names.mojom.h"
......@@ -203,4 +204,11 @@ void HeadlessContentBrowserClient::AppendExtraCommandLineSwitches(
#endif // defined(HEADLESS_USE_BREAKPAD)
}
void HeadlessContentBrowserClient::ResourceDispatcherHostCreated() {
resource_dispatcher_host_delegate_.reset(
new HeadlessResourceDispatcherHostDelegate);
content::ResourceDispatcherHost::Get()->SetDelegate(
resource_dispatcher_host_delegate_.get());
}
} // namespace headless
......@@ -6,6 +6,7 @@
#define HEADLESS_LIB_BROWSER_HEADLESS_CONTENT_BROWSER_CLIENT_H_
#include "content/public/browser/content_browser_client.h"
#include "headless/lib/browser/headless_resource_dispatcher_host_delegate.h"
namespace headless {
......@@ -37,9 +38,14 @@ class HeadlessContentBrowserClient : public content::ContentBrowserClient {
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override;
void ResourceDispatcherHostCreated() override;
private:
HeadlessBrowserImpl* browser_; // Not owned.
std::unique_ptr<HeadlessResourceDispatcherHostDelegate>
resource_dispatcher_host_delegate_;
DISALLOW_COPY_AND_ASSIGN(HeadlessContentBrowserClient);
};
......
// 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 "headless/lib/browser/headless_resource_dispatcher_host_delegate.h"
namespace headless {
HeadlessResourceDispatcherHostDelegate::
HeadlessResourceDispatcherHostDelegate() {}
HeadlessResourceDispatcherHostDelegate::
~HeadlessResourceDispatcherHostDelegate() {}
} // namespace headless
// 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 HEADLESS_LIB_BROWSER_HEADLESS_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
#define HEADLESS_LIB_BROWSER_HEADLESS_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
#include "content/public/browser/resource_dispatcher_host_delegate.h"
namespace headless {
class HeadlessResourceDispatcherHostDelegate
: public content::ResourceDispatcherHostDelegate {
public:
HeadlessResourceDispatcherHostDelegate();
~HeadlessResourceDispatcherHostDelegate() override;
private:
DISALLOW_COPY_AND_ASSIGN(HeadlessResourceDispatcherHostDelegate);
};
} // namespace headless
#endif // HEADLESS_LIB_BROWSER_HEADLESS_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
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