• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that can
3 // be found in the LICENSE file.
4 
5 #include "include/cef_scheme.h"
6 #include "libcef/browser/context.h"
7 
8 #include "base/logging.h"
9 
CefRegisterSchemeHandlerFactory(const CefString & scheme_name,const CefString & domain_name,CefRefPtr<CefSchemeHandlerFactory> factory)10 bool CefRegisterSchemeHandlerFactory(
11     const CefString& scheme_name,
12     const CefString& domain_name,
13     CefRefPtr<CefSchemeHandlerFactory> factory) {
14   // Verify that the context is in a valid state.
15   if (!CONTEXT_STATE_VALID()) {
16     NOTREACHED() << "context not valid";
17     return false;
18   }
19 
20   return CefRequestContext::GetGlobalContext()->RegisterSchemeHandlerFactory(
21       scheme_name, domain_name, factory);
22 }
23 
CefClearSchemeHandlerFactories()24 bool CefClearSchemeHandlerFactories() {
25   // Verify that the context is in a valid state.
26   if (!CONTEXT_STATE_VALID()) {
27     NOTREACHED() << "context not valid";
28     return false;
29   }
30 
31   return CefRequestContext::GetGlobalContext()->ClearSchemeHandlerFactories();
32 }
33