2015-02-14 00:17:08 +01:00
|
|
|
// Copyright (c) 2015 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.
|
|
|
|
|
2020-07-01 02:57:00 +02:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_IOTHREAD_STATE_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_IOTHREAD_STATE_H_
|
2015-02-14 00:17:08 +01:00
|
|
|
#pragma once
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
#include "include/cef_request_context.h"
|
2015-09-25 13:59:30 +02:00
|
|
|
#include "include/cef_request_context_handler.h"
|
2019-07-29 23:27:12 +02:00
|
|
|
#include "include/cef_scheme.h"
|
2015-09-25 13:59:30 +02:00
|
|
|
|
2019-10-01 15:55:16 +02:00
|
|
|
#include "libcef/browser/request_context_handler_map.h"
|
|
|
|
|
|
|
|
class GURL;
|
2015-02-14 00:17:08 +01:00
|
|
|
|
2020-07-01 02:57:00 +02:00
|
|
|
// Stores state that will be accessed on the IO thread. Life span is controlled
|
|
|
|
// by CefBrowserContext. Created on the UI thread but accessed and destroyed on
|
|
|
|
// the IO thread. See browser_context.h for an object relationship diagram.
|
|
|
|
class CefIOThreadState {
|
2015-02-14 00:17:08 +01:00
|
|
|
public:
|
2020-07-01 02:57:00 +02:00
|
|
|
CefIOThreadState();
|
|
|
|
virtual ~CefIOThreadState();
|
2015-02-14 00:17:08 +01:00
|
|
|
|
2019-10-01 15:55:16 +02:00
|
|
|
// See comments in CefRequestContextHandlerMap.
|
2019-03-24 00:40:32 +01:00
|
|
|
void AddHandler(int render_process_id,
|
|
|
|
int render_frame_id,
|
2019-04-24 04:50:25 +02:00
|
|
|
int frame_tree_node_id,
|
2019-03-24 00:40:32 +01:00
|
|
|
CefRefPtr<CefRequestContextHandler> handler);
|
2019-04-24 04:50:25 +02:00
|
|
|
void RemoveHandler(int render_process_id,
|
|
|
|
int render_frame_id,
|
|
|
|
int frame_tree_node_id);
|
2019-10-01 15:55:16 +02:00
|
|
|
CefRefPtr<CefRequestContextHandler> GetHandler(
|
|
|
|
int render_process_id,
|
|
|
|
int render_frame_id,
|
|
|
|
int frame_tree_node_id,
|
|
|
|
bool require_frame_match) const;
|
2016-10-17 20:14:44 +02:00
|
|
|
|
2019-04-24 04:50:25 +02:00
|
|
|
// Manage scheme handler factories associated with this context.
|
|
|
|
void RegisterSchemeHandlerFactory(const std::string& scheme_name,
|
|
|
|
const std::string& domain_name,
|
|
|
|
CefRefPtr<CefSchemeHandlerFactory> factory);
|
|
|
|
void ClearSchemeHandlerFactories();
|
|
|
|
CefRefPtr<CefSchemeHandlerFactory> GetSchemeHandlerFactory(const GURL& url);
|
|
|
|
|
2015-02-14 00:17:08 +01:00
|
|
|
private:
|
2019-04-30 22:45:13 +02:00
|
|
|
void InitOnIOThread();
|
|
|
|
|
2019-10-01 15:55:16 +02:00
|
|
|
// Map IDs to CefRequestContextHandler objects.
|
|
|
|
CefRequestContextHandlerMap handler_map_;
|
2016-10-17 20:14:44 +02:00
|
|
|
|
2019-04-24 04:50:25 +02:00
|
|
|
// Map (scheme, domain) to factories.
|
|
|
|
typedef std::map<std::pair<std::string, std::string>,
|
|
|
|
CefRefPtr<CefSchemeHandlerFactory>>
|
|
|
|
SchemeHandlerFactoryMap;
|
|
|
|
SchemeHandlerFactoryMap scheme_handler_factory_map_;
|
|
|
|
|
2020-07-01 02:57:00 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefIOThreadState);
|
2015-02-14 00:17:08 +01:00
|
|
|
};
|
|
|
|
|
2020-07-01 02:57:00 +02:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_IOTHREAD_STATE_H_
|