2015-07-16 23:40:01 +02:00
|
|
|
// Copyright 2015 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions 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.
|
2012-06-25 23:21:27 +02:00
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
|
|
|
|
#pragma once
|
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
#include <map>
|
|
|
|
|
2013-01-14 20:21:17 +01:00
|
|
|
#include "base/compiler_specific.h"
|
2016-01-06 20:20:54 +01:00
|
|
|
#include "base/macros.h"
|
2012-06-25 23:21:27 +02:00
|
|
|
#include "content/public/browser/resource_dispatcher_host_delegate.h"
|
|
|
|
|
|
|
|
// Implements ResourceDispatcherHostDelegate.
|
|
|
|
class CefResourceDispatcherHostDelegate
|
|
|
|
: public content::ResourceDispatcherHostDelegate {
|
|
|
|
public:
|
|
|
|
CefResourceDispatcherHostDelegate();
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefResourceDispatcherHostDelegate() override;
|
2012-06-25 23:21:27 +02:00
|
|
|
|
|
|
|
// ResourceDispatcherHostDelegate methods.
|
2015-07-16 23:40:01 +02:00
|
|
|
bool ShouldInterceptResourceAsStream(net::URLRequest* request,
|
|
|
|
const std::string& mime_type,
|
|
|
|
GURL* origin,
|
|
|
|
std::string* payload) override;
|
|
|
|
void OnStreamCreated(net::URLRequest* request,
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<content::StreamInfo> stream) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
void OnRequestRedirected(const GURL& redirect_url,
|
|
|
|
net::URLRequest* request,
|
|
|
|
content::ResourceContext* resource_context,
|
2018-02-15 01:12:09 +01:00
|
|
|
network::ResourceResponse* response) override;
|
2012-06-25 23:21:27 +02:00
|
|
|
|
|
|
|
private:
|
2016-11-23 21:54:29 +01:00
|
|
|
void HandleExternalProtocolOnUIThread(
|
|
|
|
const GURL& url,
|
|
|
|
const content::ResourceRequestInfo::WebContentsGetter&
|
2017-05-17 11:29:28 +02:00
|
|
|
web_contents_getter);
|
2016-11-23 21:54:29 +01:00
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
struct StreamTargetInfo {
|
|
|
|
std::string extension_id;
|
|
|
|
std::string view_id;
|
|
|
|
};
|
|
|
|
std::map<net::URLRequest*, StreamTargetInfo> stream_target_info_;
|
|
|
|
|
2012-06-25 23:21:27 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefResourceDispatcherHostDelegate);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
|