refactor: ginify protocol (#22812)
This commit is contained in:
parent
b3d3ac4e0f
commit
e73d5e3db5
12 changed files with 192 additions and 112 deletions
53
shell/browser/protocol_registry.h
Normal file
53
shell/browser/protocol_registry.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
// Copyright (c) 2020 Slack Technologies, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_BROWSER_PROTOCOL_REGISTRY_H_
|
||||
#define SHELL_BROWSER_PROTOCOL_REGISTRY_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "shell/browser/net/electron_url_loader_factory.h"
|
||||
|
||||
namespace content {
|
||||
class BrowserContext;
|
||||
} // namespace content
|
||||
|
||||
namespace electron {
|
||||
|
||||
class ProtocolRegistry {
|
||||
public:
|
||||
~ProtocolRegistry();
|
||||
|
||||
static ProtocolRegistry* FromBrowserContext(content::BrowserContext*);
|
||||
|
||||
void RegisterURLLoaderFactories(
|
||||
content::ContentBrowserClient::NonNetworkURLLoaderFactoryMap* factories);
|
||||
|
||||
const HandlersMap& intercept_handlers() const { return intercept_handlers_; }
|
||||
|
||||
bool RegisterProtocol(ProtocolType type,
|
||||
const std::string& scheme,
|
||||
const ProtocolHandler& handler);
|
||||
bool UnregisterProtocol(const std::string& scheme);
|
||||
bool IsProtocolRegistered(const std::string& scheme);
|
||||
|
||||
bool InterceptProtocol(ProtocolType type,
|
||||
const std::string& scheme,
|
||||
const ProtocolHandler& handler);
|
||||
bool UninterceptProtocol(const std::string& scheme);
|
||||
bool IsProtocolIntercepted(const std::string& scheme);
|
||||
|
||||
private:
|
||||
friend class ElectronBrowserContext;
|
||||
|
||||
ProtocolRegistry();
|
||||
|
||||
HandlersMap handlers_;
|
||||
HandlersMap intercept_handlers_;
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // SHELL_BROWSER_PROTOCOL_REGISTRY_H_
|
Loading…
Add table
Add a link
Reference in a new issue