cef/libcef/common/scheme_registrar_impl.cc
Marshall Greenblatt 6c8f4644aa - Update to Chromium revision 133430.
- Move custom scheme registration to CefApp::OnRegisterCustomSchemes(). This is required by the introduction of ContentClient::AddAdditionalSchemes() and fixes a race condition when registering standard schemes in different processes.
- Execute V8 functions using V8Proxy. This is required for inspector instrumentation to work correctly and fixes an assertion in WebCore related to V8RecursionScope.
- Enable verbose V8 TryCatch logging.
- Mac: Expose UnderlayOpenGLHostingWindow interface that should be used for all CEF windows.
- Add CefSettings.remote_debugging_port option.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@602 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2012-04-24 18:01:48 +00:00

68 lines
1.7 KiB
C++

// Copyright (c) 2012 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.
#include "libcef/common/scheme_registrar_impl.h"
#include <string>
#include "libcef/renderer/content_renderer_client.h"
#include "base/bind.h"
#include "base/logging.h"
CefSchemeRegistrarImpl::CefSchemeRegistrarImpl()
: supported_thread_id_(base::PlatformThread::CurrentId()) {
}
bool CefSchemeRegistrarImpl::AddCustomScheme(
const CefString& scheme_name,
bool is_standard,
bool is_local,
bool is_display_isolated) {
if (!VerifyContext())
return false;
if (is_standard)
standard_schemes_.push_back(scheme_name);
if (CefContentRendererClient::Get()) {
// Register the custom scheme with WebKit.
CefContentRendererClient::Get()->AddCustomScheme(scheme_name, is_local,
is_display_isolated);
}
return true;
}
void CefSchemeRegistrarImpl::GetStandardSchemes(
std::vector<std::string>* standard_schemes) {
if (!VerifyContext())
return;
if (standard_schemes_.empty())
return;
standard_schemes->insert(standard_schemes->end(), standard_schemes_.begin(),
standard_schemes_.end());
}
bool CefSchemeRegistrarImpl::VerifyRefCount() {
return (GetRefCt() == 1);
}
void CefSchemeRegistrarImpl::Detach() {
if (VerifyContext())
supported_thread_id_ = base::kInvalidThreadId;
}
bool CefSchemeRegistrarImpl::VerifyContext() {
if (base::PlatformThread::CurrentId() != supported_thread_id_) {
// This object should only be accessed from the thread that created it.
NOTREACHED();
return false;
}
return true;
}