2015-03-02 21:25:14 +01:00
|
|
|
// Copyright (c) 2015 The Chromium Embedded Framework 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-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
#include "include/cef_scheme.h"
|
|
|
|
#include "libcef/browser/context.h"
|
|
|
|
|
|
|
|
#include "base/logging.h"
|
|
|
|
|
|
|
|
bool CefRegisterSchemeHandlerFactory(
|
|
|
|
const CefString& scheme_name,
|
|
|
|
const CefString& domain_name,
|
|
|
|
CefRefPtr<CefSchemeHandlerFactory> factory) {
|
|
|
|
// Verify that the context is in a valid state.
|
2015-03-02 21:25:14 +01:00
|
|
|
if (!CONTEXT_STATE_VALID()) {
|
|
|
|
NOTREACHED() << "context not valid";
|
2012-04-03 03:34:16 +02:00
|
|
|
return false;
|
|
|
|
}
|
2015-03-02 21:25:14 +01:00
|
|
|
|
|
|
|
return CefRequestContext::GetGlobalContext()->
|
|
|
|
RegisterSchemeHandlerFactory(scheme_name, domain_name, factory);
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CefClearSchemeHandlerFactories() {
|
|
|
|
// Verify that the context is in a valid state.
|
2015-03-02 21:25:14 +01:00
|
|
|
if (!CONTEXT_STATE_VALID()) {
|
|
|
|
NOTREACHED() << "context not valid";
|
2012-04-03 03:34:16 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-03-02 21:25:14 +01:00
|
|
|
return CefRequestContext::GetGlobalContext()->
|
|
|
|
ClearSchemeHandlerFactories();
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|