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.
|
2016-02-02 22:32:44 +01:00
|
|
|
bool HandleExternalProtocol(
|
|
|
|
const GURL& url,
|
|
|
|
int child_id,
|
|
|
|
const content::ResourceRequestInfo::WebContentsGetter&
|
|
|
|
web_contents_getter,
|
|
|
|
bool is_main_frame,
|
|
|
|
ui::PageTransition page_transition,
|
2016-06-21 00:59:23 +02:00
|
|
|
bool has_user_gesture,
|
|
|
|
content::ResourceContext* resource_context) override;
|
2015-07-16 23:40:01 +02:00
|
|
|
bool ShouldInterceptResourceAsStream(net::URLRequest* request,
|
2015-08-14 16:41:08 +02:00
|
|
|
const base::FilePath& plugin_path,
|
2015-07-16 23:40:01 +02:00
|
|
|
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;
|
2014-11-12 20:25:15 +01:00
|
|
|
void OnRequestRedirected(
|
2013-04-18 19:58:23 +02:00
|
|
|
const GURL& redirect_url,
|
|
|
|
net::URLRequest* request,
|
|
|
|
content::ResourceContext* resource_context,
|
2014-11-12 20:25:15 +01:00
|
|
|
content::ResourceResponse* response) override;
|
2012-06-25 23:21:27 +02:00
|
|
|
|
|
|
|
private:
|
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_
|