// Copyright (c) 2013 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 "tests/shared/renderer/client_app_renderer.h" #include "include/base/cef_logging.h" namespace client { ClientAppRenderer::ClientAppRenderer() { CreateDelegates(delegates_); } void ClientAppRenderer::OnRenderThreadCreated( CefRefPtr extra_info) { DelegateSet::iterator it = delegates_.begin(); for (; it != delegates_.end(); ++it) (*it)->OnRenderThreadCreated(this, extra_info); } void ClientAppRenderer::OnWebKitInitialized() { DelegateSet::iterator it = delegates_.begin(); for (; it != delegates_.end(); ++it) (*it)->OnWebKitInitialized(this); } void ClientAppRenderer::OnBrowserCreated( CefRefPtr browser, CefRefPtr extra_info) { DelegateSet::iterator it = delegates_.begin(); for (; it != delegates_.end(); ++it) (*it)->OnBrowserCreated(this, browser, extra_info); } void ClientAppRenderer::OnBrowserDestroyed(CefRefPtr browser) { DelegateSet::iterator it = delegates_.begin(); for (; it != delegates_.end(); ++it) (*it)->OnBrowserDestroyed(this, browser); } CefRefPtr ClientAppRenderer::GetLoadHandler() { CefRefPtr load_handler; DelegateSet::iterator it = delegates_.begin(); for (; it != delegates_.end() && !load_handler.get(); ++it) load_handler = (*it)->GetLoadHandler(this); return load_handler; } void ClientAppRenderer::OnContextCreated(CefRefPtr browser, CefRefPtr frame, CefRefPtr context) { DelegateSet::iterator it = delegates_.begin(); for (; it != delegates_.end(); ++it) (*it)->OnContextCreated(this, browser, frame, context); } void ClientAppRenderer::OnContextReleased(CefRefPtr browser, CefRefPtr frame, CefRefPtr context) { DelegateSet::iterator it = delegates_.begin(); for (; it != delegates_.end(); ++it) (*it)->OnContextReleased(this, browser, frame, context); } void ClientAppRenderer::OnUncaughtException( CefRefPtr browser, CefRefPtr frame, CefRefPtr context, CefRefPtr exception, CefRefPtr stackTrace) { DelegateSet::iterator it = delegates_.begin(); for (; it != delegates_.end(); ++it) { (*it)->OnUncaughtException(this, browser, frame, context, exception, stackTrace); } } void ClientAppRenderer::OnFocusedNodeChanged(CefRefPtr browser, CefRefPtr frame, CefRefPtr node) { DelegateSet::iterator it = delegates_.begin(); for (; it != delegates_.end(); ++it) (*it)->OnFocusedNodeChanged(this, browser, frame, node); } bool ClientAppRenderer::OnProcessMessageReceived( CefRefPtr browser, CefRefPtr frame, CefProcessId source_process, CefRefPtr message) { DCHECK_EQ(source_process, PID_BROWSER); bool handled = false; DelegateSet::iterator it = delegates_.begin(); for (; it != delegates_.end() && !handled; ++it) { handled = (*it)->OnProcessMessageReceived(this, browser, frame, source_process, message); } return handled; } } // namespace client