Project

General

Profile

SO3Engine
SO3EmbeddedWebNavigatorLoadHandler.cpp
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2011 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21-----------------------------------------------------------------------------
22*/
23
28#if SO3_WEB_NAVIGATOR_BUILD == 1
29
30namespace SO3
31{
32 namespace EmbeddedWebNavigator
33 {
34
35 WebNavigatorLoadHandler::WebNavigatorLoadHandler(CefRefPtr<WebNavigatorClient>& parentWebNavigatorClientInstance, const ScolWindowHandle& scolMainWindow) : WebNavigatorHandler(parentWebNavigatorClientInstance, scolMainWindow)
36 {
37 }
38
39 WebNavigatorLoadHandler::WebNavigatorLoadHandler() : WebNavigatorHandler(CefRefPtr<WebNavigatorClient>(), 0)
40 {
41 // Forbidden ctor
42 }
43
47
48 void WebNavigatorLoadHandler::OnLoadStart(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame)
49 {
50 // Send event
52 {
53 std::unique_lock< std::shared_mutex > lock(WebNavigatorManager::GetSingletonPtr()->webMessageQueueCriticalSection);
55 }
56 }
57
58 void WebNavigatorLoadHandler::OnLoadEnd(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, int httpStatusCode)
59 {
60 // Send event
62 {
63 std::unique_lock< std::shared_mutex > lock(WebNavigatorManager::GetSingletonPtr()->webMessageQueueCriticalSection);
65 }
66 }
67
68 bool WebNavigatorLoadHandler::OnLoadError(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, ErrorCode errorCode, const CefString& failedUrl, CefString& errorText)
69 {
70 // Send event
72 {
73 std::unique_lock< std::shared_mutex > lock(WebNavigatorManager::GetSingletonPtr()->webMessageQueueCriticalSection);
75 }
76
77 // Allways return the default error message.
78 return false;
79 }
80
81 }
82}
83
84#endif
virtual bool OnLoadError(CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, ErrorCode errorCode, const CefString &failedUrl, CefString &errorText)
virtual void OnLoadEnd(CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, int httpStatusCode)
virtual void OnLoadStart(CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame)
void InvokeLoadEnd(unsigned long uniqueId, const std::string &frameName, int httpStatusCode)
void InvokeLoadError(unsigned long uniqueId, const std::string &frameName, int errorCode, const std::string &failedUrl, std::string &errorText)
void InvokeLoadStart(unsigned long uniqueId, const std::string &frameName)