Project

General

Profile

SO3Engine
SO3EmbeddedWebNavigatorDisplayHandler.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 WebNavigatorDisplayHandler::WebNavigatorDisplayHandler(CefRefPtr<WebNavigatorClient>& parentWebNavigatorClientInstance, const ScolWindowHandle& scolMainWindow) : WebNavigatorHandler(parentWebNavigatorClientInstance, scolMainWindow)
36 {
37 }
38
39 WebNavigatorDisplayHandler::WebNavigatorDisplayHandler() : WebNavigatorHandler(CefRefPtr<WebNavigatorClient>(), 0)
40 {
41 // Forbidden ctor.
42 }
43
47
48 void WebNavigatorDisplayHandler::OnAddressChange(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& url)
49 {
50 // Send event
52 {
53 std::unique_lock< std::shared_mutex > lock(WebNavigatorManager::GetSingletonPtr()->webMessageQueueCriticalSection);
55 }
56 }
57
58 void WebNavigatorDisplayHandler::OnTitleChange(CefRefPtr<CefBrowser> browser, const CefString& title)
59 {
60 // Send event
62 {
63 std::unique_lock< std::shared_mutex > lock(WebNavigatorManager::GetSingletonPtr()->webMessageQueueCriticalSection);
65 }
66 }
67
68 bool WebNavigatorDisplayHandler::OnTooltip(CefRefPtr<CefBrowser> browser, CefString& text)
69 {
70 // Send event
72 {
73 std::unique_lock< std::shared_mutex > lock(WebNavigatorManager::GetSingletonPtr()->webMessageQueueCriticalSection);
75 }
76
77 // Allways return true, ie, it must be the scol developper that handle the tooltip drawing.
78 return true;
79 }
80
81 void WebNavigatorDisplayHandler::OnStatusMessage(CefRefPtr<CefBrowser> browser, const CefString& value)
82 {
83 // Send event
85 {
86 std::unique_lock< std::shared_mutex > lock(WebNavigatorManager::GetSingletonPtr()->webMessageQueueCriticalSection);
88 }
89 }
90
91 bool WebNavigatorDisplayHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser, cef_log_severity_t level, const CefString& message, const CefString& source, int line)
92 {
93 // Send event
95 {
96 std::unique_lock< std::shared_mutex > lock(WebNavigatorManager::GetSingletonPtr()->webMessageQueueCriticalSection);
98 }
99
100 // Allways return true, ie, it must be the scol developper that handle the console message.
101 return true;
102 }
103
104 }
105}
106
107#endif
virtual void OnAddressChange(CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, const CefString &url) OVERRIDE
virtual void OnStatusMessage(CefRefPtr< CefBrowser > browser, const CefString &value) OVERRIDE
virtual void OnTitleChange(CefRefPtr< CefBrowser > browser, const CefString &title) OVERRIDE
virtual bool OnConsoleMessage(CefRefPtr< CefBrowser > browser, cef_log_severity_t level, const CefString &message, const CefString &source, int line) OVERRIDE
virtual bool OnTooltip(CefRefPtr< CefBrowser > browser, CefString &text) OVERRIDE
void InvokeStatusMessage(unsigned long uniqueId, const std::string &value)
void InvokeTooltip(unsigned long uniqueId, std::string &text)
void InvokeConsoleMessage(unsigned long uniqueId, const std::string &message, const std::string &source, int line)
void InvokeTitleChange(unsigned long uniqueId, const std::string &title)
void InvokeAddressChange(unsigned long uniqueId, const std::string &frameName, const std::string &url)