├── .gitattributes
├── .github
├── CONTRIBUTING.md
├── FUNDING.yml
└── ISSUE_TEMPLATE.md
├── .gitignore
├── README.fr.md
├── README.md
├── README.pl.md
└── src
├── .gitignore
├── AUTHORS.txt
├── DeclareDPIAware.manifest
├── RequireAdministrator.manifest
├── cef
├── README.txt
├── app.cpp
├── app.h
├── browser_window.cpp
├── browser_window.h
├── client_handler.cpp
├── client_handler.h
├── devtools.cpp
├── devtools.h
├── fullscreen.cpp
├── fullscreen.h
├── include
│ ├── base
│ │ ├── cef_atomic_flag.h
│ │ ├── cef_atomic_ref_count.h
│ │ ├── cef_auto_reset.h
│ │ ├── cef_basictypes.h
│ │ ├── cef_bind.h
│ │ ├── cef_build.h
│ │ ├── cef_callback.h
│ │ ├── cef_callback_forward.h
│ │ ├── cef_callback_helpers.h
│ │ ├── cef_callback_list.h
│ │ ├── cef_cancelable_callback.h
│ │ ├── cef_compiler_specific.h
│ │ ├── cef_cxx17_backports.h
│ │ ├── cef_lock.h
│ │ ├── cef_logging.h
│ │ ├── cef_macros.h
│ │ ├── cef_platform_thread.h
│ │ ├── cef_ptr_util.h
│ │ ├── cef_ref_counted.h
│ │ ├── cef_scoped_refptr.h
│ │ ├── cef_template_util.h
│ │ ├── cef_thread_checker.h
│ │ ├── cef_trace_event.h
│ │ ├── cef_tuple.h
│ │ ├── cef_weak_ptr.h
│ │ └── internal
│ │ │ ├── README-TRANSFER.txt
│ │ │ ├── cef_bind_internal.h
│ │ │ ├── cef_callback_internal.h
│ │ │ ├── cef_lock_impl.h
│ │ │ ├── cef_net_error_list.h
│ │ │ ├── cef_raw_scoped_refptr_mismatch_checker.h
│ │ │ ├── cef_scoped_policy.h
│ │ │ └── cef_thread_checker_impl.h
│ ├── cef_accessibility_handler.h
│ ├── cef_api_hash.h
│ ├── cef_app.h
│ ├── cef_audio_handler.h
│ ├── cef_auth_callback.h
│ ├── cef_base.h
│ ├── cef_browser.h
│ ├── cef_browser_process_handler.h
│ ├── cef_callback.h
│ ├── cef_client.h
│ ├── cef_command_line.h
│ ├── cef_config.h
│ ├── cef_context_menu_handler.h
│ ├── cef_cookie.h
│ ├── cef_crash_util.h
│ ├── cef_devtools_message_observer.h
│ ├── cef_dialog_handler.h
│ ├── cef_display_handler.h
│ ├── cef_dom.h
│ ├── cef_download_handler.h
│ ├── cef_download_item.h
│ ├── cef_drag_data.h
│ ├── cef_drag_handler.h
│ ├── cef_extension.h
│ ├── cef_extension_handler.h
│ ├── cef_file_util.h
│ ├── cef_find_handler.h
│ ├── cef_focus_handler.h
│ ├── cef_frame.h
│ ├── cef_frame_handler.h
│ ├── cef_i18n_util.h
│ ├── cef_image.h
│ ├── cef_jsdialog_handler.h
│ ├── cef_keyboard_handler.h
│ ├── cef_life_span_handler.h
│ ├── cef_load_handler.h
│ ├── cef_media_router.h
│ ├── cef_menu_model.h
│ ├── cef_menu_model_delegate.h
│ ├── cef_navigation_entry.h
│ ├── cef_origin_whitelist.h
│ ├── cef_pack_resources.h
│ ├── cef_pack_strings.h
│ ├── cef_parser.h
│ ├── cef_path_util.h
│ ├── cef_print_handler.h
│ ├── cef_print_settings.h
│ ├── cef_process_message.h
│ ├── cef_process_util.h
│ ├── cef_registration.h
│ ├── cef_render_handler.h
│ ├── cef_render_process_handler.h
│ ├── cef_request.h
│ ├── cef_request_context.h
│ ├── cef_request_context_handler.h
│ ├── cef_request_handler.h
│ ├── cef_resource_bundle.h
│ ├── cef_resource_bundle_handler.h
│ ├── cef_resource_handler.h
│ ├── cef_resource_request_handler.h
│ ├── cef_response.h
│ ├── cef_response_filter.h
│ ├── cef_sandbox_win.h
│ ├── cef_scheme.h
│ ├── cef_server.h
│ ├── cef_ssl_info.h
│ ├── cef_ssl_status.h
│ ├── cef_stream.h
│ ├── cef_string_visitor.h
│ ├── cef_task.h
│ ├── cef_thread.h
│ ├── cef_trace.h
│ ├── cef_urlrequest.h
│ ├── cef_v8.h
│ ├── cef_values.h
│ ├── cef_version.h
│ ├── cef_waitable_event.h
│ ├── cef_web_plugin.h
│ ├── cef_x509_certificate.h
│ ├── cef_xml_reader.h
│ ├── cef_zip_reader.h
│ ├── internal
│ │ ├── cef_export.h
│ │ ├── cef_logging_internal.h
│ │ ├── cef_ptr.h
│ │ ├── cef_string.h
│ │ ├── cef_string_list.h
│ │ ├── cef_string_map.h
│ │ ├── cef_string_multimap.h
│ │ ├── cef_string_types.h
│ │ ├── cef_string_wrappers.h
│ │ ├── cef_thread_internal.h
│ │ ├── cef_time.h
│ │ ├── cef_trace_event_internal.h
│ │ ├── cef_types.h
│ │ ├── cef_types_geometry.h
│ │ ├── cef_types_win.h
│ │ ├── cef_types_wrappers.h
│ │ └── cef_win.h
│ ├── test
│ │ ├── cef_test_helpers.h
│ │ └── cef_translator_test.h
│ ├── views
│ │ ├── cef_box_layout.h
│ │ ├── cef_browser_view.h
│ │ ├── cef_browser_view_delegate.h
│ │ ├── cef_button.h
│ │ ├── cef_button_delegate.h
│ │ ├── cef_display.h
│ │ ├── cef_fill_layout.h
│ │ ├── cef_label_button.h
│ │ ├── cef_layout.h
│ │ ├── cef_menu_button.h
│ │ ├── cef_menu_button_delegate.h
│ │ ├── cef_overlay_controller.h
│ │ ├── cef_panel.h
│ │ ├── cef_panel_delegate.h
│ │ ├── cef_scroll_view.h
│ │ ├── cef_textfield.h
│ │ ├── cef_textfield_delegate.h
│ │ ├── cef_view.h
│ │ ├── cef_view_delegate.h
│ │ ├── cef_window.h
│ │ └── cef_window_delegate.h
│ └── wrapper
│ │ ├── cef_byte_read_handler.h
│ │ ├── cef_closure_task.h
│ │ ├── cef_helpers.h
│ │ ├── cef_message_router.h
│ │ ├── cef_resource_manager.h
│ │ ├── cef_scoped_temp_dir.h
│ │ ├── cef_stream_resource_handler.h
│ │ ├── cef_xml_object.h
│ │ └── cef_zip_archive.h
├── javascript_api.cpp
├── javascript_api.h
└── util.h
├── debug.cpp
├── debug.h
├── defines.h
├── dpi_aware.cpp
├── dpi_aware.h
├── executable.cpp
├── executable.h
├── fatal_error.cpp
├── fatal_error.h
├── file_utils.cpp
├── file_utils.h
├── icon.ico
├── icon.png
├── json.c
├── json.h
├── lib
└── Debug
│ └── README.txt
├── license.txt
├── log.h
├── logging.cpp
├── logging.h
├── main.cpp
├── main.h
├── main_window.cpp
├── main_window.h
├── mongoose.c
├── mongoose.h
├── php
├── !README.txt
└── php.ini
├── php_server.cpp
├── php_server.h
├── phpdesktop-chrome.sln
├── phpdesktop-chrome.vcxproj
├── popup_window.cpp
├── popup_window.h
├── random.cpp
├── random.h
├── resource.h
├── resource.rc
├── settings.cpp
├── settings.h
├── settings.json
├── single_instance_application.h
├── string_utils.cpp
├── string_utils.h
├── temp_dir.cpp
├── temp_dir.h
├── version.cpp
├── version.h
├── web_server.cpp
├── web_server.h
├── window_utils.cpp
├── window_utils.h
└── www
├── _pdo.php
├── blenc_encode.php
├── blenc_myscript.php
├── cookies.php
├── download.php
├── env-variables.php
├── error-404.php
├── error-500.php
├── execute-command.php
├── forms.php
├── google.php
├── html5-video.php
├── iframe.php
├── index.php
├── javascript-api.php
├── loading-error.php
├── mouse-cursor-loading.php
├── no-cache.php
├── ob-flush.php
├── open-folder-in-explorer.php
├── php-error.php
├── phpinfo.php
├── popup.php
├── pretty-urls.php
├── request-quota.php
├── session.php
├── speech-recognition.php
├── sqlite.php
├── style.css
├── temp-dir.php
└── upload.php
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.txt text eol=crlf
2 | *.cpp text eol=crlf
3 | *.h text eol=crlf
4 | *.php text eol=crlf
5 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Questions should be asked on the forum:
2 | https://groups.google.com/d/forum/phpdesktop
3 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: ['https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JQSTPDRRM8AQ8'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Questions should be asked on the forum:
2 | https://groups.google.com/d/forum/phpdesktop
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | cef_binary_*/
2 | Release*/
3 |
--------------------------------------------------------------------------------
/src/.gitignore:
--------------------------------------------------------------------------------
1 | /Release/
2 | /Debug/
3 | ipch/
4 | *.ncb
5 | *.db
6 | *.opendb
7 | *.suo
8 | *.user
9 | *.aps
10 | *.sdf
11 | *.opensdf
12 | *.dll
13 | *.exe
14 | debug.log
15 | *.lib
16 | php/*.bat
17 | php/*.phar
18 | php/*.gif
19 | php/*.txt
20 | php/*.manifest
21 | !php/!README.txt
22 |
--------------------------------------------------------------------------------
/src/AUTHORS.txt:
--------------------------------------------------------------------------------
1 | Core developers:
2 | Czarek Tomczak
3 |
4 | Contributors (in order of first commit):
5 | -
6 |
--------------------------------------------------------------------------------
/src/DeclareDPIAware.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/RequireAdministrator.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | Description of your application
8 |
9 |
10 |
11 |
12 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/cef/app.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "../defines.h"
8 | #include "include/cef_app.h"
9 | #include
10 | #include "javascript_api.h"
11 | #include "../log.h"
12 |
13 | class App : public CefApp,
14 | public CefBrowserProcessHandler,
15 | public CefRenderProcessHandler {
16 | public:
17 | App(){}
18 |
19 | // CefApp methods:
20 | virtual void OnBeforeCommandLineProcessing(
21 | const CefString& process_type,
22 | CefRefPtr command_line) override;
23 |
24 | virtual CefRefPtr GetBrowserProcessHandler()
25 | override { return this; }
26 |
27 | virtual CefRefPtr GetRenderProcessHandler()
28 | override { return this; }
29 |
30 | // CefBrowserProcessHandler methods:
31 | virtual void OnContextInitialized() override;
32 |
33 | // CefRenderProcessHandler methods:
34 | virtual bool OnProcessMessageReceived(CefRefPtr browser,
35 | CefProcessId source_process,
36 | CefRefPtr message)
37 | ;
38 | virtual void OnContextCreated(CefRefPtr browser,
39 | CefRefPtr frame,
40 | CefRefPtr context) override;
41 | virtual void OnBrowserCreated(CefRefPtr browser);
42 | virtual void OnBrowserDestroyed(CefRefPtr browser) override;
43 |
44 | protected:
45 | // There is one instance of JavascriptApi for each browser.
46 | // Many frames may share the same JavascriptApi object.
47 | CefRefPtr GetJavascriptApi(CefRefPtr browser) {
48 | std::map >::iterator it;
49 | it = javascriptApiMap_.find(browser->GetIdentifier());
50 | if (it != javascriptApiMap_.end()) {
51 | return it->second;
52 | }
53 | PHP_DESKTOP_LOG_ERROR << "GetJavascriptApi() failed, api not found";
54 | return nullptr;
55 | }
56 | void StoreJavascriptApi(CefRefPtr browser,
57 | CefRefPtr javascriptApi) {
58 | std::map >::iterator it;
59 | it = javascriptApiMap_.find(browser->GetIdentifier());
60 | if (it == javascriptApiMap_.end()) {
61 | javascriptApiMap_[browser->GetIdentifier()] = javascriptApi;
62 | } else {
63 | PHP_DESKTOP_LOG_ERROR << "StoreJavascriptApi() failed, api already exists";
64 | }
65 | }
66 | void RemoveJavascriptApi(CefRefPtr browser) {
67 | std::map >::iterator it;
68 | it = javascriptApiMap_.find(browser->GetIdentifier());
69 | if (it != javascriptApiMap_.end()) {
70 | javascriptApiMap_.erase(it);
71 | } else {
72 | PHP_DESKTOP_LOG_ERROR << "RemoveJavascriptApi() failed, api not found";
73 | }
74 | }
75 |
76 | protected:
77 | std::map > javascriptApiMap_;
78 |
79 | private:
80 | // Include the default reference counting implementation.
81 | IMPLEMENT_REFCOUNTING(App);
82 | };
83 |
--------------------------------------------------------------------------------
/src/cef/browser_window.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "../defines.h"
8 | #include // _ASSERT macro.
9 | #include
10 | #include
11 | #include // shared_ptr
12 |
13 | #include "app.h"
14 | #include "client_handler.h"
15 |
16 | class BrowserWindow;
17 | BrowserWindow* GetBrowserWindow(HWND hwnd);
18 | void StoreBrowserWindow(HWND hwnd, BrowserWindow* browser);
19 | void RemoveBrowserWindow(HWND hwnd);
20 | int CountBrowserWindows();
21 |
22 | class BrowserWindow {
23 | private:
24 | HWND windowHandle_;
25 | bool isPopup_;
26 | CefRefPtr cefBrowser_; // may be empty, always check using .get()
27 | std::tr1::shared_ptr fullscreen_; // may be empty
28 | public:
29 | BrowserWindow(HWND inWindowHandle, bool isPopup);
30 | ~BrowserWindow();
31 | CefRefPtr GetCefBrowser();
32 | void SetCefBrowser(CefRefPtr cefBrowser);
33 | bool CreateBrowserControl(const wchar_t* navigateUrl);
34 | void CloseBrowserControl();
35 | HWND GetWindowHandle();
36 | void SetTitle(const wchar_t* title);
37 | bool IsPopup();
38 | bool IsUsingMetaTitle();
39 | void OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam);
40 | void OnSize();
41 | void SetTitleFromSettings();
42 | void SetIconFromSettings();
43 | bool SetFocus();
44 | Fullscreen* GetFullscreenObject();
45 | };
46 |
--------------------------------------------------------------------------------
/src/cef/devtools.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "devtools.h"
6 | #include "browser_window.h"
7 |
8 | #include "../log.h"
9 | #include "../string_utils.h"
10 | #include "../popup_window.h"
11 |
12 | bool ShowDevTools(CefRefPtr browser) {
13 | CefWindowInfo windowInfo;
14 | CefBrowserSettings settings;
15 |
16 | #if defined(OS_WIN)
17 | windowInfo.SetAsPopup(browser->GetHost()->GetWindowHandle(), "DevTools");
18 | #endif
19 |
20 | browser->GetHost()->ShowDevTools(windowInfo, browser->GetHost()->GetClient(),
21 | settings, CefPoint());
22 | return true;
23 | }
24 |
25 | /*
26 | bool ShowDevTools(CefRefPtr cefBrowser) {
27 | std::string devtools_url = cefBrowser->GetHost()->GetDevToolsURL(true);
28 | // Example url returned:
29 | // http://localhost:54008/devtools/devtools.html?ws=localhost:54008
30 | // /devtools/page/1538ed984a2a4a90e5ed941c7d142a12
31 | // Let's replace "localhost" with "127.0.0.1", using the ip address
32 | // is more reliable.
33 | devtools_url = ReplaceString(devtools_url, "localhost:", "127.0.0.1:");
34 | PHP_DESKTOP_LOG_INFO << "DevTools url: " << devtools_url;
35 | if (devtools_url.empty()) {
36 | PHP_DESKTOP_LOG_WARNING << "GetDevToolsURL() returned an empty string. "
37 | "Make sure you've set the remote-debugging-port switch";
38 | return false;
39 | }
40 | CefWindowInfo windowInfo;
41 | CefBrowserSettings browser_settings;
42 | BrowserWindow* phpBrowser = GetBrowserWindow(cefBrowser->GetHost()->GetWindowHandle());
43 | if (!phpBrowser) {
44 | PHP_DESKTOP_LOG_ERROR << "GetBrowserWindow() failed in ClientHandler::OnKeyEvent";
45 | return false;
46 | }
47 | HWND popupHandle = CreatePopupWindow(phpBrowser->GetWindowHandle());
48 | if (!popupHandle) {
49 | PHP_DESKTOP_LOG_ERROR << "CreatePopupWindow() failed in ClientHandler::OnKeyEvent";
50 | return false;
51 | }
52 | RECT rect;
53 | GetWindowRect(popupHandle, &rect);
54 | windowInfo.SetAsChild(popupHandle, rect);
55 | bool created = CefBrowserHost::CreateBrowser(
56 | windowInfo, cefBrowser->GetHost()->GetClient(), devtools_url,
57 | browser_settings, NULL);
58 | if (!created) {
59 | PHP_DESKTOP_LOG_ERROR << "CreateBrowser() failed in ClientHandler::OnKeyEvent";
60 | return false;
61 | }
62 | return true;
63 | }
64 | */
65 |
--------------------------------------------------------------------------------
/src/cef/devtools.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "../defines.h"
8 | #include "include/cef_app.h"
9 |
10 | bool ShowDevTools(CefRefPtr cefBrowser);
11 |
--------------------------------------------------------------------------------
/src/cef/fullscreen.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "fullscreen.h"
6 | #include
7 | #include "browser_window.h"
8 | #include "../log.h"
9 |
10 | void Fullscreen::ToggleFullscreen() {
11 | // Original code in chromium > fullscreen_handler.cc > FullscreenHandler::SetFullscreenImpl:
12 | // http://src.chromium.org/viewvc/chrome/trunk/src/ui/views/win/fullscreen_handler.cc
13 | BrowserWindow* browserWindow = GetBrowserWindow(
14 | cefBrowser_->GetHost()->GetWindowHandle());
15 | if (!browserWindow) {
16 | PHP_DESKTOP_LOG_ERROR << "GetBrowserWindow() failed in ToggleFullscreen()";
17 | return;
18 | }
19 | HWND hwnd = browserWindow->GetWindowHandle();
20 | if (!isFullscreen_) {
21 | isMaximized_ = (IsZoomed(hwnd) != 0);
22 | if (isMaximized_) {
23 | SendMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
24 | }
25 | gwlStyle_ = GetWindowLong(hwnd, GWL_STYLE);
26 | gwlExStyle_ = GetWindowLong(hwnd, GWL_EXSTYLE);
27 | RECT rect;
28 | GetWindowRect(hwnd, &rect);
29 | windowRect_ = rect;
30 | int removeStyle, removeExStyle;
31 | removeStyle = WS_CAPTION | WS_THICKFRAME;
32 | removeExStyle = (WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
33 | | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE);
34 | SetWindowLong(hwnd, GWL_STYLE, gwlStyle_ & ~(removeStyle));
35 | SetWindowLong(hwnd, GWL_EXSTYLE, gwlExStyle_ & ~(removeExStyle));
36 | HMONITOR monitor;
37 | MONITORINFO monitorInfo = {};
38 | monitorInfo.cbSize = sizeof(monitorInfo);
39 | // MONITOR_DEFAULTTONULL, MONITOR_DEFAULTTOPRIMARY,
40 | // MONITOR_DEFAULTTONEAREST
41 | monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
42 | GetMonitorInfo(monitor, &monitorInfo);
43 | int left, top, right, bottom;
44 | left = monitorInfo.rcMonitor.left;
45 | top = monitorInfo.rcMonitor.top;
46 | right = monitorInfo.rcMonitor.right;
47 | bottom = monitorInfo.rcMonitor.bottom;
48 | SetWindowPos(hwnd, NULL,
49 | left, top, right-left, bottom-top,
50 | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
51 | } else {
52 | SetWindowLong(hwnd, GWL_STYLE, gwlStyle_);
53 | SetWindowLong(hwnd, GWL_EXSTYLE, gwlExStyle_);
54 | RECT rect = windowRect_;
55 | SetWindowPos(hwnd, NULL, rect.left, rect.top,
56 | rect.right - rect.left, rect.bottom - rect.top,
57 | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
58 | if (isMaximized_) {
59 | SendMessage(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
60 | }
61 | }
62 | isFullscreen_ = !(isFullscreen_);
63 | }
64 |
65 | bool Fullscreen::IsFullscreen() {
66 | return isFullscreen_;
67 | }
68 |
--------------------------------------------------------------------------------
/src/cef/fullscreen.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 | #include "../defines.h"
7 | #include "include/cef_browser.h"
8 |
9 | class Fullscreen {
10 | public:
11 | Fullscreen(CefRefPtr cefBrowser)
12 | : cefBrowser_(cefBrowser),
13 | isFullscreen_(false),
14 | isMaximized_(false),
15 | gwlStyle_(0),
16 | gwlExStyle_(0),
17 | windowRect_(RECT())
18 | {
19 | }
20 | void ToggleFullscreen();
21 | bool IsFullscreen();
22 | protected:
23 | CefRefPtr cefBrowser_;
24 | bool isFullscreen_;
25 | bool isMaximized_;
26 | LONG gwlStyle_;
27 | LONG gwlExStyle_;
28 | RECT windowRect_;
29 | };
30 |
--------------------------------------------------------------------------------
/src/cef/include/base/cef_atomic_flag.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
2 | // Google Inc. All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the name Chromium Embedded
15 | // Framework nor the names of its contributors may be used to endorse
16 | // or promote products derived from this software without specific prior
17 | // written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | #ifndef CEF_INCLUDE_BASE_CEF_ATOMIC_FLAG_H_
32 | #define CEF_INCLUDE_BASE_CEF_ATOMIC_FLAG_H_
33 | #pragma once
34 |
35 | #if defined(USING_CHROMIUM_INCLUDES)
36 | // When building CEF include the Chromium header directly.
37 | #include "base/synchronization/atomic_flag.h"
38 |
39 | #else // !USING_CHROMIUM_INCLUDES
40 | // The following is substantially similar to the Chromium implementation.
41 | // If the Chromium implementation diverges the below implementation should be
42 | // updated to match.
43 |
44 | #include
45 |
46 | #include
47 |
48 | #include "include/base/cef_thread_checker.h"
49 |
50 | namespace base {
51 |
52 | // A flag that can safely be set from one thread and read from other threads.
53 | //
54 | // This class IS NOT intended for synchronization between threads.
55 | class AtomicFlag {
56 | public:
57 | AtomicFlag();
58 |
59 | AtomicFlag(const AtomicFlag&) = delete;
60 | AtomicFlag& operator=(const AtomicFlag&) = delete;
61 |
62 | ~AtomicFlag();
63 |
64 | // Set the flag. Must always be called from the same thread.
65 | void Set();
66 |
67 | // Returns true iff the flag was set. If this returns true, the current thread
68 | // is guaranteed to be synchronized with all memory operations on the thread
69 | // which invoked Set() up until at least the first call to Set() on it.
70 | bool IsSet() const {
71 | // Inline here: this has a measurable performance impact on base::WeakPtr.
72 | return flag_.load(std::memory_order_acquire) != 0;
73 | }
74 |
75 | // Resets the flag. Be careful when using this: callers might not expect
76 | // IsSet() to return false after returning true once.
77 | void UnsafeResetForTesting();
78 |
79 | private:
80 | std::atomic flag_{0};
81 | base::ThreadChecker set_thread_checker_;
82 | };
83 |
84 | } // namespace base
85 |
86 | #endif // !USING_CHROMIUM_INCLUDES
87 |
88 | #endif // CEF_INCLUDE_BASE_CEF_ATOMIC_FLAG_H_
89 |
--------------------------------------------------------------------------------
/src/cef/include/base/cef_basictypes.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
2 | // Google Inc. All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the name Chromium Embedded
15 | // Framework nor the names of its contributors may be used to endorse
16 | // or promote products derived from this software without specific prior
17 | // written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | #ifndef CEF_INCLUDE_BASE_CEF_BASICTYPES_H_
32 | #define CEF_INCLUDE_BASE_CEF_BASICTYPES_H_
33 | #pragma once
34 |
35 | #include // For UINT_MAX
36 | #include // For size_t
37 |
38 | #include "include/base/cef_build.h"
39 |
40 | // The NSPR system headers define 64-bit as |long| when possible, except on
41 | // Mac OS X. In order to not have typedef mismatches, we do the same on LP64.
42 | //
43 | // On Mac OS X, |long long| is used for 64-bit types for compatibility with
44 | // format macros even in the LP64 model.
45 | #if defined(__LP64__) && !defined(OS_MAC) && !defined(OS_OPENBSD)
46 | typedef long int64;
47 | typedef unsigned long uint64;
48 | #else
49 | typedef long long int64;
50 | typedef unsigned long long uint64;
51 | #endif
52 |
53 | // TODO: Remove these type guards. These are to avoid conflicts with
54 | // obsolete/protypes.h in the Gecko SDK.
55 | #ifndef _INT32
56 | #define _INT32
57 | typedef int int32;
58 | #endif
59 |
60 | // TODO: Remove these type guards. These are to avoid conflicts with
61 | // obsolete/protypes.h in the Gecko SDK.
62 | #ifndef _UINT32
63 | #define _UINT32
64 | typedef unsigned int uint32;
65 | #endif
66 |
67 | #ifndef _INT16
68 | #define _INT16
69 | typedef short int16;
70 | #endif
71 |
72 | #ifndef _UINT16
73 | #define _UINT16
74 | typedef unsigned short uint16;
75 | #endif
76 |
77 | // UTF-16 character type.
78 | #ifndef char16
79 | #if defined(WCHAR_T_IS_UTF16)
80 | typedef wchar_t char16;
81 | #elif defined(WCHAR_T_IS_UTF32)
82 | typedef unsigned short char16;
83 | #endif
84 | #endif
85 |
86 | #endif // CEF_INCLUDE_BASE_CEF_BASICTYPES_H_
87 |
--------------------------------------------------------------------------------
/src/cef/include/base/cef_callback_forward.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
2 | // Google Inc. All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the name Chromium Embedded
15 | // Framework nor the names of its contributors may be used to endorse
16 | // or promote products derived from this software without specific prior
17 | // written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | #ifndef INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
32 | #define INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
33 | #pragma once
34 |
35 | #if defined(USING_CHROMIUM_INCLUDES)
36 | // When building CEF include the Chromium header directly.
37 | #include "base/callback_forward.h"
38 | #else // !USING_CHROMIUM_INCLUDES
39 | // The following is substantially similar to the Chromium implementation.
40 | // If the Chromium implementation diverges the below implementation should be
41 | // updated to match.
42 |
43 | namespace base {
44 |
45 | template
46 | class OnceCallback;
47 |
48 | template
49 | class RepeatingCallback;
50 |
51 | // Syntactic sugar to make OnceClosure and RepeatingClosure
52 | // easier to declare since they will be used in a lot of APIs with delayed
53 | // execution.
54 | using OnceClosure = OnceCallback;
55 | using RepeatingClosure = RepeatingCallback;
56 |
57 | } // namespace base
58 |
59 | #endif // !!USING_CHROMIUM_INCLUDES
60 |
61 | #endif // INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_
62 |
--------------------------------------------------------------------------------
/src/cef/include/base/cef_macros.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
2 | // Google Inc. All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the name Chromium Embedded
15 | // Framework nor the names of its contributors may be used to endorse
16 | // or promote products derived from this software without specific prior
17 | // written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | #ifndef CEF_INCLUDE_BASE_CEF_MACROS_H_
32 | #define CEF_INCLUDE_BASE_CEF_MACROS_H_
33 | #pragma once
34 |
35 | #if !defined(USING_CHROMIUM_INCLUDES)
36 | // The following is substantially similar to the Chromium implementation.
37 | // If the Chromium implementation diverges the below implementation should be
38 | // updated to match.
39 |
40 | // ALL DISALLOW_xxx MACROS ARE DEPRECATED; DO NOT USE IN NEW CODE.
41 | // Use explicit deletions instead. See the section on copyability/movability in
42 | // //styleguide/c++/c++-dos-and-donts.md for more information.
43 |
44 | // DEPRECATED: See above. Makes a class uncopyable.
45 | #define DISALLOW_COPY(TypeName) TypeName(const TypeName&) = delete
46 |
47 | // DEPRECATED: See above. Makes a class unassignable.
48 | #define DISALLOW_ASSIGN(TypeName) TypeName& operator=(const TypeName&) = delete
49 |
50 | // DEPRECATED: See above. Makes a class uncopyable and unassignable.
51 | #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
52 | DISALLOW_COPY(TypeName); \
53 | DISALLOW_ASSIGN(TypeName)
54 |
55 | // DEPRECATED: See above. Disallow all implicit constructors, namely the
56 | // default constructor, copy constructor and operator= functions.
57 | #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
58 | TypeName() = delete; \
59 | DISALLOW_COPY_AND_ASSIGN(TypeName)
60 |
61 | #endif // !USING_CHROMIUM_INCLUDES
62 |
63 | #endif // CEF_INCLUDE_BASE_CEF_MACROS_H_
64 |
--------------------------------------------------------------------------------
/src/cef/include/base/cef_ptr_util.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Marshall A. Greenblatt. Portions copyright (c) 2015
2 | // Google Inc. All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the name Chromium Embedded
15 | // Framework nor the names of its contributors may be used to endorse
16 | // or promote products derived from this software without specific prior
17 | // written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | #ifndef INCLUDE_BASE_CEF_PTR_UTIL_H_
32 | #define INCLUDE_BASE_CEF_PTR_UTIL_H_
33 | #pragma once
34 |
35 | #if defined(USING_CHROMIUM_INCLUDES)
36 | // When building CEF include the Chromium header directly.
37 | #include "base/memory/ptr_util.h"
38 | #else // !USING_CHROMIUM_INCLUDES
39 | // The following is substantially similar to the Chromium implementation.
40 | // If the Chromium implementation diverges the below implementation should be
41 | // updated to match.
42 |
43 | #include
44 | #include
45 |
46 | namespace base {
47 |
48 | // Helper to transfer ownership of a raw pointer to a std::unique_ptr.
49 | // Note that std::unique_ptr has very different semantics from
50 | // std::unique_ptr: do not use this helper for array allocations.
51 | template
52 | std::unique_ptr WrapUnique(T* ptr) {
53 | return std::unique_ptr(ptr);
54 | }
55 |
56 | } // namespace base
57 |
58 | #endif // INCLUDE_BASE_CEF_PTR_UTIL_H_
59 |
--------------------------------------------------------------------------------
/src/cef/include/base/internal/README-TRANSFER.txt:
--------------------------------------------------------------------------------
1 | Files in this directory have been copied from other locations in the Chromium
2 | source tree. They have been modified only to the extent necessary to work in
3 | the CEF Binary Distribution directory structure. Below is a listing of the
4 | original file locations.
5 |
6 | ../net/base/net_error_list.h
7 |
--------------------------------------------------------------------------------
/src/cef/include/base/internal/cef_lock_impl.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2011 Google Inc. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | // Do not include this header file directly. Use base/cef_lock.h instead.
31 |
32 | #ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_LOCK_IMPL_H_
33 | #define CEF_INCLUDE_BASE_INTERNAL_CEF_LOCK_IMPL_H_
34 |
35 | #include "include/base/cef_build.h"
36 |
37 | #if defined(OS_WIN)
38 | #include
39 | #elif defined(OS_POSIX)
40 | #include
41 | #endif
42 |
43 | namespace base {
44 | namespace cef_internal {
45 |
46 | // This class implements the underlying platform-specific spin-lock mechanism
47 | // used for the Lock class. Most users should not use LockImpl directly, but
48 | // should instead use Lock.
49 | class LockImpl {
50 | public:
51 | #if defined(OS_WIN)
52 | typedef CRITICAL_SECTION NativeHandle;
53 | #elif defined(OS_POSIX)
54 | typedef pthread_mutex_t NativeHandle;
55 | #endif
56 |
57 | LockImpl();
58 |
59 | LockImpl(const LockImpl&) = delete;
60 | LockImpl& operator=(const LockImpl&) = delete;
61 |
62 | ~LockImpl();
63 |
64 | // If the lock is not held, take it and return true. If the lock is already
65 | // held by something else, immediately return false.
66 | bool Try();
67 |
68 | // Take the lock, blocking until it is available if necessary.
69 | void Lock();
70 |
71 | // Release the lock. This must only be called by the lock's holder: after
72 | // a successful call to Try, or a call to Lock.
73 | void Unlock();
74 |
75 | // Return the native underlying lock.
76 | // TODO(awalker): refactor lock and condition variables so that this is
77 | // unnecessary.
78 | NativeHandle* native_handle() { return &native_handle_; }
79 |
80 | private:
81 | NativeHandle native_handle_;
82 | };
83 |
84 | } // namespace cef_internal
85 | } // namespace base
86 |
87 | #endif // CEF_INCLUDE_BASE_INTERNAL_CEF_LOCK_IMPL_H_
88 |
--------------------------------------------------------------------------------
/src/cef/include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2011 Google Inc. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | // Do not include this header file directly. Use base/cef_callback.h instead.
31 |
32 | #ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
33 | #define CEF_INCLUDE_BASE_INTERNAL_CEF_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
34 |
35 | #include
36 |
37 | #include "include/base/cef_template_util.h"
38 |
39 | // It is dangerous to post a task with a T* argument where T is a subtype of
40 | // RefCounted(Base|ThreadSafeBase), since by the time the parameter is used, the
41 | // object may already have been deleted since it was not held with a
42 | // scoped_refptr. Example: http://crbug.com/27191
43 | // The following set of traits are designed to generate a compile error
44 | // whenever this antipattern is attempted.
45 |
46 | namespace base {
47 |
48 | // This is a base internal implementation file used by task.h and callback.h.
49 | // Not for public consumption, so we wrap it in namespace internal.
50 | namespace internal {
51 |
52 | template
53 | struct IsRefCountedType : std::false_type {};
54 |
55 | template
56 | struct IsRefCountedType()->AddRef()),
58 | decltype(std::declval()->Release())>>
59 | : std::true_type {};
60 |
61 | // Human readable translation: you needed to be a scoped_refptr if you are a raw
62 | // pointer type and are convertible to a RefCounted(Base|ThreadSafeBase) type.
63 | template
64 | struct NeedsScopedRefptrButGetsRawPtr
65 | : conjunction,
66 | IsRefCountedType>> {
67 | static_assert(!std::is_reference::value,
68 | "NeedsScopedRefptrButGetsRawPtr requires non-reference type.");
69 | };
70 |
71 | } // namespace internal
72 |
73 | } // namespace base
74 |
75 | #endif // CEF_INCLUDE_BASE_INTERNAL_CEF_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_
76 |
--------------------------------------------------------------------------------
/src/cef/include/base/internal/cef_scoped_policy.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012 Google Inc. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | // Do not include this header file directly. Use base/memory/scoped_policy.h
31 | // instead.
32 |
33 | #ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_SCOPED_POLICY_H_
34 | #define CEF_INCLUDE_BASE_INTERNAL_CEF_SCOPED_POLICY_H_
35 |
36 | namespace base {
37 | namespace scoped_policy {
38 |
39 | // Defines the ownership policy for a scoped object.
40 | enum OwnershipPolicy {
41 | // The scoped object takes ownership of an object by taking over an existing
42 | // ownership claim.
43 | ASSUME,
44 |
45 | // The scoped object will retain the object and any initial ownership is
46 | // not changed.
47 | RETAIN
48 | };
49 |
50 | } // namespace scoped_policy
51 | } // namespace base
52 |
53 | #endif // CEF_INCLUDE_BASE_INTERNAL_CEF_SCOPED_POLICY_H_
54 |
--------------------------------------------------------------------------------
/src/cef/include/base/internal/cef_thread_checker_impl.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2011 Google Inc. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | // Do not include this header file directly. Use base/cef_thread_checker.h
31 | // instead.
32 |
33 | #ifndef CEF_INCLUDE_BASE_INTERNAL_THREAD_CHECKER_IMPL_H_
34 | #define CEF_INCLUDE_BASE_INTERNAL_THREAD_CHECKER_IMPL_H_
35 |
36 | #include "include/base/cef_lock.h"
37 | #include "include/base/cef_platform_thread.h"
38 |
39 | namespace base {
40 | namespace cef_internal {
41 |
42 | // Real implementation of ThreadChecker, for use in debug mode, or
43 | // for temporary use in release mode (e.g. to CHECK on a threading issue
44 | // seen only in the wild).
45 | //
46 | // Note: You should almost always use the ThreadChecker class to get the
47 | // right version for your build configuration.
48 | class ThreadCheckerImpl {
49 | public:
50 | ThreadCheckerImpl();
51 | ~ThreadCheckerImpl();
52 |
53 | bool CalledOnValidThread() const;
54 |
55 | // Changes the thread that is checked for in CalledOnValidThread. This may
56 | // be useful when an object may be created on one thread and then used
57 | // exclusively on another thread.
58 | void DetachFromThread();
59 |
60 | private:
61 | void EnsureThreadIdAssigned() const;
62 |
63 | mutable base::Lock lock_;
64 | // This is mutable so that CalledOnValidThread can set it.
65 | // It's guarded by |lock_|.
66 | mutable PlatformThreadRef valid_thread_id_;
67 | };
68 |
69 | } // namespace cef_internal
70 | } // namespace base
71 |
72 | #endif // CEF_INCLUDE_BASE_INTERNAL_THREAD_CHECKER_IMPL_H_
73 |
--------------------------------------------------------------------------------
/src/cef/include/cef_accessibility_handler.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2017 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_ACCESSIBILITY_HANDLER_H_
38 | #define CEF_INCLUDE_CEF_ACCESSIBILITY_HANDLER_H_
39 | #pragma once
40 |
41 | #include "include/cef_values.h"
42 |
43 | ///
44 | // Implement this interface to receive accessibility notification when
45 | // accessibility events have been registered. The methods of this class will
46 | // be called on the UI thread.
47 | ///
48 | /*--cef(source=client)--*/
49 | class CefAccessibilityHandler : public virtual CefBaseRefCounted {
50 | public:
51 | ///
52 | // Called after renderer process sends accessibility tree changes to the
53 | // browser process.
54 | ///
55 | /*--cef()--*/
56 | virtual void OnAccessibilityTreeChange(CefRefPtr value) = 0;
57 |
58 | ///
59 | // Called after renderer process sends accessibility location changes to the
60 | // browser process.
61 | ///
62 | /*--cef()--*/
63 | virtual void OnAccessibilityLocationChange(CefRefPtr value) = 0;
64 | };
65 |
66 | #endif // CEF_INCLUDE_CEF_ACCESSIBILITY_HANDLER_H_
67 |
--------------------------------------------------------------------------------
/src/cef/include/cef_api_hash.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // This file was generated by the make_api_hash_header.py tool.
33 | //
34 |
35 | #ifndef CEF_INCLUDE_API_HASH_H_
36 | #define CEF_INCLUDE_API_HASH_H_
37 |
38 | #include "include/internal/cef_export.h"
39 |
40 | // The API hash is created by analyzing CEF header files for C API type
41 | // definitions. The hash value will change when header files are modified in a
42 | // way that may cause binary incompatibility with other builds. The universal
43 | // hash value will change if any platform is affected whereas the platform hash
44 | // values will change only if that particular platform is affected.
45 | #define CEF_API_HASH_UNIVERSAL "58a564a53597120d05cedf5bcd355064168af0a7"
46 | #if defined(OS_WIN)
47 | #define CEF_API_HASH_PLATFORM "5fa37a277dca51dee1d13058e6218dc1e2e68adb"
48 | #elif defined(OS_MAC)
49 | #define CEF_API_HASH_PLATFORM "77dc909a3d568d3b98fe32fa040801f748656ad2"
50 | #elif defined(OS_LINUX)
51 | #define CEF_API_HASH_PLATFORM "76077b5939104ed96c1378a24d4acbb1ae4e3cb5"
52 | #endif
53 |
54 | #ifdef __cplusplus
55 | extern "C" {
56 | #endif
57 |
58 | ///
59 | // Returns CEF API hashes for the libcef library. The returned string is owned
60 | // by the library and should not be freed. The |entry| parameter describes which
61 | // hash value will be returned:
62 | // 0 - CEF_API_HASH_PLATFORM
63 | // 1 - CEF_API_HASH_UNIVERSAL
64 | // 2 - CEF_COMMIT_HASH (from cef_version.h)
65 | ///
66 | CEF_EXPORT const char* cef_api_hash(int entry);
67 |
68 | #ifdef __cplusplus
69 | }
70 | #endif
71 | #endif // CEF_INCLUDE_API_HASH_H_
72 |
--------------------------------------------------------------------------------
/src/cef/include/cef_auth_callback.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2013 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_AUTH_CALLBACK_H_
38 | #define CEF_INCLUDE_CEF_AUTH_CALLBACK_H_
39 | #pragma once
40 |
41 | #include "include/cef_base.h"
42 |
43 | ///
44 | // Callback interface used for asynchronous continuation of authentication
45 | // requests.
46 | ///
47 | /*--cef(source=library)--*/
48 | class CefAuthCallback : public virtual CefBaseRefCounted {
49 | public:
50 | ///
51 | // Continue the authentication request.
52 | ///
53 | /*--cef(capi_name=cont,optional_param=username,optional_param=password)--*/
54 | virtual void Continue(const CefString& username,
55 | const CefString& password) = 0;
56 |
57 | ///
58 | // Cancel the authentication request.
59 | ///
60 | /*--cef()--*/
61 | virtual void Cancel() = 0;
62 | };
63 |
64 | #endif // CEF_INCLUDE_CEF_AUTH_CALLBACK_H_
65 |
--------------------------------------------------------------------------------
/src/cef/include/cef_callback.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_CALLBACK_H_
38 | #define CEF_INCLUDE_CEF_CALLBACK_H_
39 | #pragma once
40 |
41 | #include "include/cef_base.h"
42 |
43 | ///
44 | // Generic callback interface used for asynchronous continuation.
45 | ///
46 | /*--cef(source=library)--*/
47 | class CefCallback : public virtual CefBaseRefCounted {
48 | public:
49 | ///
50 | // Continue processing.
51 | ///
52 | /*--cef(capi_name=cont)--*/
53 | virtual void Continue() = 0;
54 |
55 | ///
56 | // Cancel processing.
57 | ///
58 | /*--cef()--*/
59 | virtual void Cancel() = 0;
60 | };
61 |
62 | ///
63 | // Generic callback interface used for asynchronous completion.
64 | ///
65 | /*--cef(source=client)--*/
66 | class CefCompletionCallback : public virtual CefBaseRefCounted {
67 | public:
68 | ///
69 | // Method that will be called once the task is complete.
70 | ///
71 | /*--cef()--*/
72 | virtual void OnComplete() = 0;
73 | };
74 |
75 | #endif // CEF_INCLUDE_CEF_CALLBACK_H_
76 |
--------------------------------------------------------------------------------
/src/cef/include/cef_config.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // This file is generated by the make_config_header.py tool.
33 | //
34 |
35 | #ifndef CEF_INCLUDE_CEF_CONFIG_H_
36 | #define CEF_INCLUDE_CEF_CONFIG_H_
37 |
38 |
39 |
40 | #endif // CEF_INCLUDE_CEF_CONFIG_H_
41 |
--------------------------------------------------------------------------------
/src/cef/include/cef_find_handler.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_FIND_HANDLER_H_
38 | #define CEF_INCLUDE_CEF_FIND_HANDLER_H_
39 | #pragma once
40 |
41 | #include "include/cef_base.h"
42 | #include "include/cef_browser.h"
43 |
44 | ///
45 | // Implement this interface to handle events related to find results. The
46 | // methods of this class will be called on the UI thread.
47 | ///
48 | /*--cef(source=client)--*/
49 | class CefFindHandler : public virtual CefBaseRefCounted {
50 | public:
51 | ///
52 | // Called to report find results returned by CefBrowserHost::Find().
53 | // |identifer| is a unique incremental identifier for the currently active
54 | // search, |count| is the number of matches currently identified,
55 | // |selectionRect| is the location of where the match was found (in window
56 | // coordinates), |activeMatchOrdinal| is the current position in the search
57 | // results, and |finalUpdate| is true if this is the last find notification.
58 | ///
59 | /*--cef()--*/
60 | virtual void OnFindResult(CefRefPtr browser,
61 | int identifier,
62 | int count,
63 | const CefRect& selectionRect,
64 | int activeMatchOrdinal,
65 | bool finalUpdate) {}
66 | };
67 |
68 | #endif // CEF_INCLUDE_CEF_FIND_HANDLER_H_
69 |
--------------------------------------------------------------------------------
/src/cef/include/cef_focus_handler.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_FOCUS_HANDLER_H_
38 | #define CEF_INCLUDE_CEF_FOCUS_HANDLER_H_
39 | #pragma once
40 |
41 | #include "include/cef_base.h"
42 | #include "include/cef_browser.h"
43 | #include "include/cef_dom.h"
44 | #include "include/cef_frame.h"
45 |
46 | ///
47 | // Implement this interface to handle events related to focus. The methods of
48 | // this class will be called on the UI thread.
49 | ///
50 | /*--cef(source=client)--*/
51 | class CefFocusHandler : public virtual CefBaseRefCounted {
52 | public:
53 | typedef cef_focus_source_t FocusSource;
54 |
55 | ///
56 | // Called when the browser component is about to loose focus. For instance, if
57 | // focus was on the last HTML element and the user pressed the TAB key. |next|
58 | // will be true if the browser is giving focus to the next component and false
59 | // if the browser is giving focus to the previous component.
60 | ///
61 | /*--cef()--*/
62 | virtual void OnTakeFocus(CefRefPtr browser, bool next) {}
63 |
64 | ///
65 | // Called when the browser component is requesting focus. |source| indicates
66 | // where the focus request is originating from. Return false to allow the
67 | // focus to be set or true to cancel setting the focus.
68 | ///
69 | /*--cef()--*/
70 | virtual bool OnSetFocus(CefRefPtr browser, FocusSource source) {
71 | return false;
72 | }
73 |
74 | ///
75 | // Called when the browser component has received focus.
76 | ///
77 | /*--cef()--*/
78 | virtual void OnGotFocus(CefRefPtr browser) {}
79 | };
80 |
81 | #endif // CEF_INCLUDE_CEF_FOCUS_HANDLER_H_
82 |
--------------------------------------------------------------------------------
/src/cef/include/cef_i18n_util.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_I18N_UTIL_H_
38 | #define CEF_INCLUDE_CEF_I18N_UTIL_H_
39 | #pragma once
40 |
41 | #include "include/cef_base.h"
42 |
43 | ///
44 | // Returns true if the application text direction is right-to-left.
45 | ///
46 | /*--cef()--*/
47 | bool CefIsRTL();
48 |
49 | #endif // CEF_INCLUDE_CEF_I18N_UTIL_H_
50 |
--------------------------------------------------------------------------------
/src/cef/include/cef_path_util.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_PATH_UTIL_H_
38 | #define CEF_INCLUDE_CEF_PATH_UTIL_H_
39 | #pragma once
40 |
41 | #include "include/cef_base.h"
42 |
43 | typedef cef_path_key_t PathKey;
44 |
45 | ///
46 | // Retrieve the path associated with the specified |key|. Returns true on
47 | // success. Can be called on any thread in the browser process.
48 | ///
49 | /*--cef()--*/
50 | bool CefGetPath(PathKey key, CefString& path);
51 |
52 | #endif // CEF_INCLUDE_CEF_PATH_UTIL_H_
53 |
--------------------------------------------------------------------------------
/src/cef/include/cef_process_message.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_MESSAGE_H_
38 | #define CEF_INCLUDE_CEF_MESSAGE_H_
39 | #pragma once
40 |
41 | #include "include/cef_base.h"
42 | #include "include/cef_values.h"
43 |
44 | typedef cef_process_id_t CefProcessId;
45 |
46 | ///
47 | // Class representing a message. Can be used on any process and thread.
48 | ///
49 | /*--cef(source=library)--*/
50 | class CefProcessMessage : public virtual CefBaseRefCounted {
51 | public:
52 | ///
53 | // Create a new CefProcessMessage object with the specified name.
54 | ///
55 | /*--cef()--*/
56 | static CefRefPtr Create(const CefString& name);
57 |
58 | ///
59 | // Returns true if this object is valid. Do not call any other methods if this
60 | // function returns false.
61 | ///
62 | /*--cef()--*/
63 | virtual bool IsValid() = 0;
64 |
65 | ///
66 | // Returns true if the values of this object are read-only. Some APIs may
67 | // expose read-only objects.
68 | ///
69 | /*--cef()--*/
70 | virtual bool IsReadOnly() = 0;
71 |
72 | ///
73 | // Returns a writable copy of this object.
74 | ///
75 | /*--cef()--*/
76 | virtual CefRefPtr Copy() = 0;
77 |
78 | ///
79 | // Returns the message name.
80 | ///
81 | /*--cef()--*/
82 | virtual CefString GetName() = 0;
83 |
84 | ///
85 | // Returns the list of arguments.
86 | ///
87 | /*--cef()--*/
88 | virtual CefRefPtr GetArgumentList() = 0;
89 | };
90 |
91 | #endif // CEF_INCLUDE_CEF_MESSAGE_H_
92 |
--------------------------------------------------------------------------------
/src/cef/include/cef_process_util.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_PROCESS_UTIL_H_
38 | #define CEF_INCLUDE_CEF_PROCESS_UTIL_H_
39 | #pragma once
40 |
41 | #include "include/cef_base.h"
42 | #include "include/cef_command_line.h"
43 |
44 | ///
45 | // Launches the process specified via |command_line|. Returns true upon
46 | // success. Must be called on the browser process TID_PROCESS_LAUNCHER thread.
47 | //
48 | // Unix-specific notes:
49 | // - All file descriptors open in the parent process will be closed in the
50 | // child process except for stdin, stdout, and stderr.
51 | // - If the first argument on the command line does not contain a slash,
52 | // PATH will be searched. (See man execvp.)
53 | ///
54 | /*--cef()--*/
55 | bool CefLaunchProcess(CefRefPtr command_line);
56 |
57 | #endif // CEF_INCLUDE_CEF_PROCESS_UTIL_H_
58 |
--------------------------------------------------------------------------------
/src/cef/include/cef_registration.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2020 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_REGISTRATION_H_
38 | #define CEF_INCLUDE_CEF_REGISTRATION_H_
39 | #pragma once
40 |
41 | #include "include/cef_base.h"
42 |
43 | ///
44 | // Generic callback interface used for managing the lifespan of a registration.
45 | ///
46 | /*--cef(source=library)--*/
47 | class CefRegistration : public virtual CefBaseRefCounted {};
48 |
49 | #endif // CEF_INCLUDE_CEF_REGISTRATION_H_
50 |
--------------------------------------------------------------------------------
/src/cef/include/cef_ssl_info.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_SSL_INFO_H_
38 | #define CEF_INCLUDE_CEF_SSL_INFO_H_
39 | #pragma once
40 |
41 | #include "include/cef_base.h"
42 | #include "include/cef_values.h"
43 |
44 | #include "include/cef_x509_certificate.h"
45 |
46 | ///
47 | // Class representing SSL information.
48 | ///
49 | /*--cef(source=library)--*/
50 | class CefSSLInfo : public virtual CefBaseRefCounted {
51 | public:
52 | ///
53 | // Returns a bitmask containing any and all problems verifying the server
54 | // certificate.
55 | ///
56 | /*--cef(default_retval=CERT_STATUS_NONE)--*/
57 | virtual cef_cert_status_t GetCertStatus() = 0;
58 |
59 | ///
60 | // Returns the X.509 certificate.
61 | ///
62 | /*--cef()--*/
63 | virtual CefRefPtr GetX509Certificate() = 0;
64 | };
65 |
66 | ///
67 | // Returns true if the certificate status represents an error.
68 | ///
69 | /*--cef()--*/
70 | bool CefIsCertStatusError(cef_cert_status_t status);
71 |
72 | #endif // CEF_INCLUDE_CEF_SSL_INFO_H_
73 |
--------------------------------------------------------------------------------
/src/cef/include/cef_ssl_status.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_SSL_STATUS_H_
38 | #define CEF_INCLUDE_CEF_SSL_STATUS_H_
39 | #pragma once
40 |
41 | #include "include/cef_base.h"
42 | #include "include/cef_values.h"
43 | #include "include/cef_x509_certificate.h"
44 |
45 | ///
46 | // Class representing the SSL information for a navigation entry.
47 | ///
48 | /*--cef(source=library)--*/
49 | class CefSSLStatus : public virtual CefBaseRefCounted {
50 | public:
51 | ///
52 | // Returns true if the status is related to a secure SSL/TLS connection.
53 | ///
54 | /*--cef()--*/
55 | virtual bool IsSecureConnection() = 0;
56 |
57 | ///
58 | // Returns a bitmask containing any and all problems verifying the server
59 | // certificate.
60 | ///
61 | /*--cef(default_retval=CERT_STATUS_NONE)--*/
62 | virtual cef_cert_status_t GetCertStatus() = 0;
63 |
64 | ///
65 | // Returns the SSL version used for the SSL connection.
66 | ///
67 | /*--cef(default_retval=SSL_CONNECTION_VERSION_UNKNOWN)--*/
68 | virtual cef_ssl_version_t GetSSLVersion() = 0;
69 |
70 | ///
71 | // Returns a bitmask containing the page security content status.
72 | ///
73 | /*--cef(default_retval=SSL_CONTENT_NORMAL_CONTENT)--*/
74 | virtual cef_ssl_content_status_t GetContentStatus() = 0;
75 |
76 | ///
77 | // Returns the X.509 certificate.
78 | ///
79 | /*--cef()--*/
80 | virtual CefRefPtr GetX509Certificate() = 0;
81 | };
82 |
83 | #endif // CEF_INCLUDE_CEF_SSL_STATUS_H_
84 |
--------------------------------------------------------------------------------
/src/cef/include/cef_string_visitor.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_CEF_STRING_VISITOR_H_
38 | #define CEF_INCLUDE_CEF_STRING_VISITOR_H_
39 |
40 | #include "include/cef_base.h"
41 |
42 | ///
43 | // Implement this interface to receive string values asynchronously.
44 | ///
45 | /*--cef(source=client)--*/
46 | class CefStringVisitor : public virtual CefBaseRefCounted {
47 | public:
48 | ///
49 | // Method that will be executed.
50 | ///
51 | /*--cef(optional_param=string)--*/
52 | virtual void Visit(const CefString& string) = 0;
53 | };
54 |
55 | #endif // CEF_INCLUDE_CEF_STRING_VISITOR_H_
56 |
--------------------------------------------------------------------------------
/src/cef/include/cef_version.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // This file was generated by the make_version_header.py tool.
33 | //
34 |
35 | #ifndef CEF_INCLUDE_CEF_VERSION_H_
36 | #define CEF_INCLUDE_CEF_VERSION_H_
37 |
38 | #define CEF_VERSION "99.2.9+gf426765+chromium-99.0.4844.51"
39 | #define CEF_VERSION_MAJOR 99
40 | #define CEF_VERSION_MINOR 2
41 | #define CEF_VERSION_PATCH 9
42 | #define CEF_COMMIT_NUMBER 2521
43 | #define CEF_COMMIT_HASH "f42676506b8062218bef80deccd403c47a409333"
44 | #define COPYRIGHT_YEAR 2022
45 |
46 | #define CHROME_VERSION_MAJOR 99
47 | #define CHROME_VERSION_MINOR 0
48 | #define CHROME_VERSION_BUILD 4844
49 | #define CHROME_VERSION_PATCH 51
50 |
51 | #define DO_MAKE_STRING(p) #p
52 | #define MAKE_STRING(p) DO_MAKE_STRING(p)
53 |
54 | #ifndef APSTUDIO_HIDDEN_SYMBOLS
55 |
56 | #include "include/internal/cef_export.h"
57 |
58 | #ifdef __cplusplus
59 | extern "C" {
60 | #endif
61 |
62 | // Returns CEF version information for the libcef library. The |entry|
63 | // parameter describes which version component will be returned:
64 | // 0 - CEF_VERSION_MAJOR
65 | // 1 - CEF_VERSION_MINOR
66 | // 2 - CEF_VERSION_PATCH
67 | // 3 - CEF_COMMIT_NUMBER
68 | // 4 - CHROME_VERSION_MAJOR
69 | // 5 - CHROME_VERSION_MINOR
70 | // 6 - CHROME_VERSION_BUILD
71 | // 7 - CHROME_VERSION_PATCH
72 | ///
73 | CEF_EXPORT int cef_version_info(int entry);
74 |
75 | #ifdef __cplusplus
76 | }
77 | #endif
78 |
79 | #endif // APSTUDIO_HIDDEN_SYMBOLS
80 |
81 | #endif // CEF_INCLUDE_CEF_VERSION_H_
82 |
--------------------------------------------------------------------------------
/src/cef/include/internal/cef_export.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
2 | // reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the name Chromium Embedded
15 | // Framework nor the names of its contributors may be used to endorse
16 | // or promote products derived from this software without specific prior
17 | // written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | #ifndef CEF_INCLUDE_INTERNAL_CEF_EXPORT_H_
32 | #define CEF_INCLUDE_INTERNAL_CEF_EXPORT_H_
33 | #pragma once
34 |
35 | #include "include/base/cef_build.h"
36 |
37 | #if defined(COMPILER_MSVC)
38 |
39 | #ifdef BUILDING_CEF_SHARED
40 | #define CEF_EXPORT __declspec(dllexport)
41 | #elif USING_CEF_SHARED
42 | #define CEF_EXPORT __declspec(dllimport)
43 | #else
44 | #define CEF_EXPORT
45 | #endif
46 |
47 | #elif defined(COMPILER_GCC)
48 |
49 | #define CEF_EXPORT __attribute__((visibility("default")))
50 |
51 | #endif // COMPILER_GCC
52 |
53 | #if defined(OS_WIN)
54 | #define CEF_CALLBACK __stdcall
55 | #else
56 | #define CEF_CALLBACK
57 | #endif
58 |
59 | #endif // CEF_INCLUDE_INTERNAL_CEF_EXPORT_H_
60 |
--------------------------------------------------------------------------------
/src/cef/include/internal/cef_logging_internal.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | #ifndef CEF_INCLUDE_INTERNAL_CEF_LOGGING_INTERNAL_H_
31 | #define CEF_INCLUDE_INTERNAL_CEF_LOGGING_INTERNAL_H_
32 | #pragma once
33 |
34 | #include
35 |
36 | #include "include/internal/cef_export.h"
37 |
38 | #ifdef __cplusplus
39 | extern "C" {
40 | #endif
41 |
42 | // See include/base/cef_logging.h for macros and intended usage.
43 |
44 | ///
45 | // Gets the current log level.
46 | ///
47 | CEF_EXPORT int cef_get_min_log_level();
48 |
49 | ///
50 | // Gets the current vlog level for the given file (usually taken from
51 | // __FILE__). Note that |N| is the size *with* the null terminator.
52 | ///
53 | CEF_EXPORT int cef_get_vlog_level(const char* file_start, size_t N);
54 |
55 | ///
56 | // Add a log message. See the LogSeverity defines for supported |severity|
57 | // values.
58 | ///
59 | CEF_EXPORT void cef_log(const char* file,
60 | int line,
61 | int severity,
62 | const char* message);
63 |
64 | #ifdef __cplusplus
65 | }
66 | #endif // __cplusplus
67 |
68 | #endif // CEF_INCLUDE_INTERNAL_CEF_LOGGING_INTERNAL_H_
69 |
--------------------------------------------------------------------------------
/src/cef/include/internal/cef_string_list.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | #ifndef CEF_INCLUDE_INTERNAL_CEF_STRING_LIST_H_
31 | #define CEF_INCLUDE_INTERNAL_CEF_STRING_LIST_H_
32 | #pragma once
33 |
34 | #include "include/internal/cef_export.h"
35 | #include "include/internal/cef_string.h"
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | ///
42 | // CEF string maps are a set of key/value string pairs.
43 | ///
44 | typedef void* cef_string_list_t;
45 |
46 | ///
47 | // Allocate a new string map.
48 | ///
49 | CEF_EXPORT cef_string_list_t cef_string_list_alloc();
50 |
51 | ///
52 | // Return the number of elements in the string list.
53 | ///
54 | CEF_EXPORT size_t cef_string_list_size(cef_string_list_t list);
55 |
56 | ///
57 | // Retrieve the value at the specified zero-based string list index. Returns
58 | // true (1) if the value was successfully retrieved.
59 | ///
60 | CEF_EXPORT int cef_string_list_value(cef_string_list_t list,
61 | size_t index,
62 | cef_string_t* value);
63 |
64 | ///
65 | // Append a new value at the end of the string list.
66 | ///
67 | CEF_EXPORT void cef_string_list_append(cef_string_list_t list,
68 | const cef_string_t* value);
69 |
70 | ///
71 | // Clear the string list.
72 | ///
73 | CEF_EXPORT void cef_string_list_clear(cef_string_list_t list);
74 |
75 | ///
76 | // Free the string list.
77 | ///
78 | CEF_EXPORT void cef_string_list_free(cef_string_list_t list);
79 |
80 | ///
81 | // Creates a copy of an existing string list.
82 | ///
83 | CEF_EXPORT cef_string_list_t cef_string_list_copy(cef_string_list_t list);
84 |
85 | #ifdef __cplusplus
86 | }
87 | #endif
88 |
89 | #endif // CEF_INCLUDE_INTERNAL_CEF_STRING_LIST_H_
90 |
--------------------------------------------------------------------------------
/src/cef/include/internal/cef_thread_internal.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | #ifndef CEF_INCLUDE_INTERNAL_CEF_THREAD_INTERNAL_H_
31 | #define CEF_INCLUDE_INTERNAL_CEF_THREAD_INTERNAL_H_
32 | #pragma once
33 |
34 | #if defined(OS_WIN)
35 | #include
36 | #elif defined(OS_POSIX)
37 | #include
38 | #include
39 | #endif
40 |
41 | #include "include/internal/cef_export.h"
42 |
43 | #ifdef __cplusplus
44 | extern "C" {
45 | #endif
46 |
47 | #if defined(OS_WIN)
48 | typedef DWORD cef_platform_thread_id_t;
49 | #define kInvalidPlatformThreadId 0U
50 | #elif defined(OS_POSIX)
51 | typedef pid_t cef_platform_thread_id_t;
52 | #define kInvalidPlatformThreadId 0
53 | #endif
54 |
55 | ///
56 | // Returns the current platform thread ID.
57 | ///
58 | CEF_EXPORT cef_platform_thread_id_t cef_get_current_platform_thread_id();
59 |
60 | #if defined(OS_WIN)
61 | typedef DWORD cef_platform_thread_handle_t;
62 | #define kInvalidPlatformThreadHandle 0U
63 | #elif defined(OS_POSIX)
64 | typedef pthread_t cef_platform_thread_handle_t;
65 | #define kInvalidPlatformThreadHandle 0
66 | #endif
67 |
68 | ///
69 | // Returns the current platform thread handle.
70 | ///
71 | CEF_EXPORT cef_platform_thread_handle_t
72 | cef_get_current_platform_thread_handle();
73 |
74 | #ifdef __cplusplus
75 | }
76 | #endif // __cplusplus
77 |
78 | #endif // CEF_INCLUDE_INTERNAL_CEF_THREAD_INTERNAL_H_
79 |
--------------------------------------------------------------------------------
/src/cef/include/internal/cef_types_geometry.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
30 | #ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_GEOMETRY_H_
31 | #define CEF_INCLUDE_INTERNAL_CEF_TYPES_GEOMETRY_H_
32 | #pragma once
33 |
34 | #ifdef __cplusplus
35 | extern "C" {
36 | #endif
37 |
38 | ///
39 | // Structure representing a point.
40 | ///
41 | typedef struct _cef_point_t {
42 | int x;
43 | int y;
44 | } cef_point_t;
45 |
46 | ///
47 | // Structure representing a rectangle.
48 | ///
49 | typedef struct _cef_rect_t {
50 | int x;
51 | int y;
52 | int width;
53 | int height;
54 | } cef_rect_t;
55 |
56 | ///
57 | // Structure representing a size.
58 | ///
59 | typedef struct _cef_size_t {
60 | int width;
61 | int height;
62 | } cef_size_t;
63 |
64 | ///
65 | // Structure representing insets.
66 | ///
67 | typedef struct _cef_insets_t {
68 | int top;
69 | int left;
70 | int bottom;
71 | int right;
72 | } cef_insets_t;
73 |
74 | #ifdef __cplusplus
75 | }
76 | #endif
77 |
78 | #endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_GEOMETRY_H_
79 |
--------------------------------------------------------------------------------
/src/cef/include/test/cef_test_helpers.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2017 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 | // THIS FILE IS FOR TESTING PURPOSES ONLY.
37 | //
38 | // The APIs defined in this file are for testing purposes only. They should only
39 | // be included from unit test targets.
40 | //
41 |
42 | #ifndef CEF_INCLUDE_TEST_CEF_TEST_HELPERS_H_
43 | #define CEF_INCLUDE_TEST_CEF_TEST_HELPERS_H_
44 | #pragma once
45 |
46 | #if !defined(BUILDING_CEF_SHARED) && !defined(WRAPPING_CEF_SHARED) && \
47 | !defined(UNIT_TEST)
48 | #error This file can be included for unit tests only
49 | #endif
50 |
51 | #include "include/cef_frame.h"
52 |
53 | ///
54 | // Execute JavaScript with a user gesture to trigger functionality like
55 | // onbeforeunload handlers that will otherwise be blocked.
56 | ///
57 | /*--cef(optional_param=javascript)--*/
58 | void CefExecuteJavaScriptWithUserGestureForTests(CefRefPtr frame,
59 | const CefString& javascript);
60 |
61 | #endif // CEF_INCLUDE_TEST_CEF_TEST_HELPERS_H_
62 |
--------------------------------------------------------------------------------
/src/cef/include/views/cef_box_layout.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_VIEWS_CEF_BOX_LAYOUT_H_
38 | #define CEF_INCLUDE_VIEWS_CEF_BOX_LAYOUT_H_
39 | #pragma once
40 |
41 | #include "include/views/cef_layout.h"
42 |
43 | class CefView;
44 |
45 | ///
46 | // A Layout manager that arranges child views vertically or horizontally in a
47 | // side-by-side fashion with spacing around and between the child views. The
48 | // child views are always sized according to their preferred size. If the
49 | // host's bounds provide insufficient space, child views will be clamped.
50 | // Excess space will not be distributed. Methods must be called on the browser
51 | // process UI thread unless otherwise indicated.
52 | ///
53 | /*--cef(source=library)--*/
54 | class CefBoxLayout : public CefLayout {
55 | public:
56 | ///
57 | // Set the flex weight for the given |view|. Using the preferred size as
58 | // the basis, free space along the main axis is distributed to views in the
59 | // ratio of their flex weights. Similarly, if the views will overflow the
60 | // parent, space is subtracted in these ratios. A flex of 0 means this view is
61 | // not resized. Flex values must not be negative.
62 | ///
63 | /*--cef()--*/
64 | virtual void SetFlexForView(CefRefPtr view, int flex) = 0;
65 |
66 | ///
67 | // Clears the flex for the given |view|, causing it to use the default flex
68 | // specified via CefBoxLayoutSettings.default_flex.
69 | ///
70 | /*--cef()--*/
71 | virtual void ClearFlexForView(CefRefPtr view) = 0;
72 | };
73 |
74 | #endif // CEF_INCLUDE_VIEWS_CEF_BOX_LAYOUT_H_
75 |
--------------------------------------------------------------------------------
/src/cef/include/views/cef_button_delegate.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_VIEWS_CEF_BUTTON_DELEGATE_H_
38 | #define CEF_INCLUDE_VIEWS_CEF_BUTTON_DELEGATE_H_
39 | #pragma once
40 |
41 | #include "include/views/cef_view_delegate.h"
42 |
43 | class CefButton;
44 |
45 | ///
46 | // Implement this interface to handle Button events. The methods of this class
47 | // will be called on the browser process UI thread unless otherwise indicated.
48 | ///
49 | /*--cef(source=client)--*/
50 | class CefButtonDelegate : public CefViewDelegate {
51 | public:
52 | ///
53 | // Called when |button| is pressed.
54 | ///
55 | /*--cef()--*/
56 | virtual void OnButtonPressed(CefRefPtr button) = 0;
57 |
58 | ///
59 | // Called when the state of |button| changes.
60 | ///
61 | /*--cef()--*/
62 | virtual void OnButtonStateChanged(CefRefPtr button) {}
63 | };
64 |
65 | #endif // CEF_INCLUDE_VIEWS_CEF_BUTTON_DELEGATE_H_
66 |
--------------------------------------------------------------------------------
/src/cef/include/views/cef_fill_layout.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_VIEWS_CEF_FILL_LAYOUT_H_
38 | #define CEF_INCLUDE_VIEWS_CEF_FILL_LAYOUT_H_
39 | #pragma once
40 |
41 | #include "include/views/cef_layout.h"
42 |
43 | ///
44 | // A simple Layout that causes the associated Panel's one child to be sized to
45 | // match the bounds of its parent. Methods must be called on the browser process
46 | // UI thread unless otherwise indicated.
47 | ///
48 | /*--cef(source=library)--*/
49 | class CefFillLayout : public CefLayout {};
50 |
51 | #endif // CEF_INCLUDE_VIEWS_CEF_FILL_LAYOUT_H_
52 |
--------------------------------------------------------------------------------
/src/cef/include/views/cef_layout.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_VIEWS_CEF_LAYOUT_H_
38 | #define CEF_INCLUDE_VIEWS_CEF_LAYOUT_H_
39 | #pragma once
40 |
41 | #include "include/cef_base.h"
42 |
43 | class CefBoxLayout;
44 | class CefFillLayout;
45 |
46 | ///
47 | // A Layout handles the sizing of the children of a Panel according to
48 | // implementation-specific heuristics. Methods must be called on the browser
49 | // process UI thread unless otherwise indicated.
50 | ///
51 | /*--cef(source=library)--*/
52 | class CefLayout : public CefBaseRefCounted {
53 | public:
54 | ///
55 | // Returns this Layout as a BoxLayout or NULL if this is not a BoxLayout.
56 | ///
57 | /*--cef()--*/
58 | virtual CefRefPtr AsBoxLayout() = 0;
59 |
60 | ///
61 | // Returns this Layout as a FillLayout or NULL if this is not a FillLayout.
62 | ///
63 | /*--cef()--*/
64 | virtual CefRefPtr AsFillLayout() = 0;
65 |
66 | ///
67 | // Returns true if this Layout is valid.
68 | ///
69 | /*--cef()--*/
70 | virtual bool IsValid() = 0;
71 | };
72 |
73 | #endif // CEF_INCLUDE_VIEWS_CEF_LAYOUT_H_
74 |
--------------------------------------------------------------------------------
/src/cef/include/views/cef_menu_button_delegate.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_VIEWS_CEF_MENU_BUTTON_DELEGATE_H_
38 | #define CEF_INCLUDE_VIEWS_CEF_MENU_BUTTON_DELEGATE_H_
39 | #pragma once
40 |
41 | #include "include/views/cef_button_delegate.h"
42 |
43 | class CefMenuButton;
44 |
45 | ///
46 | // MenuButton pressed lock is released when this object is destroyed.
47 | ///
48 | /*--cef(source=library)--*/
49 | class CefMenuButtonPressedLock : public CefBaseRefCounted {};
50 |
51 | ///
52 | // Implement this interface to handle MenuButton events. The methods of this
53 | // class will be called on the browser process UI thread unless otherwise
54 | // indicated.
55 | ///
56 | /*--cef(source=client)--*/
57 | class CefMenuButtonDelegate : public CefButtonDelegate {
58 | public:
59 | ///
60 | // Called when |button| is pressed. Call CefMenuButton::ShowMenu() to show a
61 | // popup menu at |screen_point|. When showing a custom popup such as a window
62 | // keep a reference to |button_pressed_lock| until the popup is hidden to
63 | // maintain the pressed button state.
64 | ///
65 | /*--cef()--*/
66 | virtual void OnMenuButtonPressed(
67 | CefRefPtr menu_button,
68 | const CefPoint& screen_point,
69 | CefRefPtr button_pressed_lock) = 0;
70 | };
71 |
72 | #endif // CEF_INCLUDE_VIEWS_CEF_MENU_BUTTON_DELEGATE_H_
73 |
--------------------------------------------------------------------------------
/src/cef/include/views/cef_panel_delegate.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_VIEWS_CEF_PANEL_DELEGATE_H_
38 | #define CEF_INCLUDE_VIEWS_CEF_PANEL_DELEGATE_H_
39 | #pragma once
40 |
41 | #include "include/views/cef_view_delegate.h"
42 |
43 | ///
44 | // Implement this interface to handle Panel events. The methods of this class
45 | // will be called on the browser process UI thread unless otherwise indicated.
46 | ///
47 | /*--cef(source=client)--*/
48 | class CefPanelDelegate : public CefViewDelegate {};
49 |
50 | #endif // CEF_INCLUDE_VIEWS_CEF_PANEL_DELEGATE_H_
51 |
--------------------------------------------------------------------------------
/src/cef/include/views/cef_textfield_delegate.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file must follow a specific format in order to
33 | // support the CEF translator tool. See the translator.README.txt file in the
34 | // tools directory for more information.
35 | //
36 |
37 | #ifndef CEF_INCLUDE_VIEWS_CEF_TEXTFIELD_DELEGATE_H_
38 | #define CEF_INCLUDE_VIEWS_CEF_TEXTFIELD_DELEGATE_H_
39 | #pragma once
40 |
41 | #include "include/views/cef_view_delegate.h"
42 |
43 | class CefTextfield;
44 |
45 | ///
46 | // Implement this interface to handle Textfield events. The methods of this
47 | // class will be called on the browser process UI thread unless otherwise
48 | // indicated.
49 | ///
50 | /*--cef(source=client)--*/
51 | class CefTextfieldDelegate : public CefViewDelegate {
52 | public:
53 | ///
54 | // Called when |textfield| recieves a keyboard event. |event| contains
55 | // information about the keyboard event. Return true if the keyboard event was
56 | // handled or false otherwise for default handling.
57 | ///
58 | /*--cef()--*/
59 | virtual bool OnKeyEvent(CefRefPtr textfield,
60 | const CefKeyEvent& event) {
61 | return false;
62 | }
63 |
64 | ///
65 | // Called after performing a user action that may change |textfield|.
66 | ///
67 | /*--cef()--*/
68 | virtual void OnAfterUserAction(CefRefPtr textfield) {}
69 | };
70 |
71 | #endif // CEF_INCLUDE_VIEWS_CEF_TEXTFIELD_DELEGATE_H_
72 |
--------------------------------------------------------------------------------
/src/cef/include/wrapper/cef_byte_read_handler.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
2 | //
3 | // Redistribution and use in source and binary forms, with or without
4 | // modification, are permitted provided that the following conditions are
5 | // met:
6 | //
7 | // * Redistributions of source code must retain the above copyright
8 | // notice, this list of conditions and the following disclaimer.
9 | // * Redistributions in binary form must reproduce the above
10 | // copyright notice, this list of conditions and the following disclaimer
11 | // in the documentation and/or other materials provided with the
12 | // distribution.
13 | // * Neither the name of Google Inc. nor the name Chromium Embedded
14 | // Framework nor the names of its contributors may be used to endorse
15 | // or promote products derived from this software without specific prior
16 | // written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ---------------------------------------------------------------------------
31 | //
32 | // The contents of this file are only available to applications that link
33 | // against the libcef_dll_wrapper target.
34 | //
35 |
36 | #ifndef CEF_INCLUDE_WRAPPER_CEF_BYTE_READ_HANDLER_H_
37 | #define CEF_INCLUDE_WRAPPER_CEF_BYTE_READ_HANDLER_H_
38 | #pragma once
39 |
40 | #include "include/base/cef_lock.h"
41 | #include "include/cef_base.h"
42 | #include "include/cef_stream.h"
43 |
44 | ///
45 | // Thread safe implementation of the CefReadHandler class for reading an
46 | // in-memory array of bytes.
47 | ///
48 | class CefByteReadHandler : public CefReadHandler {
49 | public:
50 | ///
51 | // Create a new object for reading an array of bytes. An optional |source|
52 | // reference can be kept to keep the underlying data source from being
53 | // released while the reader exists.
54 | ///
55 | CefByteReadHandler(const unsigned char* bytes,
56 | size_t size,
57 | CefRefPtr source);
58 |
59 | CefByteReadHandler(const CefByteReadHandler&) = delete;
60 | CefByteReadHandler& operator=(const CefByteReadHandler&) = delete;
61 |
62 | // CefReadHandler methods.
63 | virtual size_t Read(void* ptr, size_t size, size_t n) override;
64 | virtual int Seek(int64 offset, int whence) override;
65 | virtual int64 Tell() override;
66 | virtual int Eof() override;
67 | virtual bool MayBlock() override { return false; }
68 |
69 | private:
70 | const unsigned char* bytes_;
71 | int64 size_;
72 | int64 offset_;
73 | CefRefPtr source_;
74 |
75 | base::Lock lock_;
76 |
77 | IMPLEMENT_REFCOUNTING(CefByteReadHandler);
78 | };
79 |
80 | #endif // CEF_INCLUDE_WRAPPER_CEF_BYTE_READ_HANDLER_H_
81 |
--------------------------------------------------------------------------------
/src/cef/javascript_api.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "javascript_api.h"
6 | #include "../version.h"
7 |
8 | bool JavascriptApi::Execute(const CefString& name,
9 | CefRefPtr object,
10 | const CefV8ValueList& arguments,
11 | CefRefPtr& retval,
12 | CefString& exception) {
13 | if (name == "GetVersion") {
14 | retval = CefV8Value::CreateString(GetPhpDesktopVersion());
15 | return true;
16 | } else if (name == "ToggleFullscreen") {
17 | CefRefPtr message = \
18 | CefProcessMessage::Create("ToggleFullscreen");
19 | cefBrowser_->GetMainFrame()->SendProcessMessage(PID_BROWSER, message);
20 | isFullscreen_ = !(isFullscreen_);
21 | return true;
22 | } else if (name == "IsFullscreen") {
23 | retval = CefV8Value::CreateBool(isFullscreen_);
24 | return true;
25 | }
26 | // Function does not exist.
27 | return false;
28 | }
29 |
--------------------------------------------------------------------------------
/src/cef/javascript_api.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "../defines.h"
8 | #include "include/cef_v8.h"
9 | #include "fullscreen.h"
10 |
11 | class JavascriptApi : public CefV8Handler
12 | {
13 | public:
14 | JavascriptApi(CefRefPtr cefBrowser)
15 | : cefBrowser_(cefBrowser),
16 | isFullscreen_(false)
17 | {
18 | }
19 |
20 | virtual bool Execute(const CefString& name,
21 | CefRefPtr object,
22 | const CefV8ValueList& arguments,
23 | CefRefPtr& retval,
24 | CefString& exception) override;
25 |
26 | void SetIsFullscreen(bool isFullscreen) {
27 | isFullscreen_ = isFullscreen;
28 | }
29 |
30 | protected:
31 | CefRefPtr cefBrowser_;
32 | bool isFullscreen_;
33 |
34 | private:
35 | // Provide the reference counting implementation for this class.
36 | IMPLEMENT_REFCOUNTING(JavascriptApi);
37 | };
--------------------------------------------------------------------------------
/src/cef/util.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
2 | // reserved. Use of this source code is governed by a BSD-style license that
3 | // can be found in the LICENSE file.
4 |
5 | #ifndef CEF_TESTS_CEFCLIENT_UTIL_H_
6 | #define CEF_TESTS_CEFCLIENT_UTIL_H_
7 | #pragma once
8 |
9 | #include "include/cef_task.h"
10 |
11 | #if defined(OS_WIN)
12 |
13 | #include // NOLINT(build/include_order)
14 |
15 | #ifndef NDEBUG
16 | #define ASSERT(condition) if (!(condition)) { DebugBreak(); }
17 | #else
18 | #define ASSERT(condition) ((void)0)
19 | #endif
20 |
21 | #else // !OS_WIN
22 |
23 | #include // NOLINT(build/include_order)
24 |
25 | #ifndef NDEBUG
26 | #define ASSERT(condition) if (!(condition)) { assert(false); }
27 | #else
28 | #define ASSERT(condition) ((void)0)
29 | #endif
30 |
31 | #endif // !OS_WIN
32 |
33 | #define REQUIRE_UI_THREAD() ASSERT(CefCurrentlyOn(TID_UI));
34 | #define REQUIRE_IO_THREAD() ASSERT(CefCurrentlyOn(TID_IO));
35 | #define REQUIRE_FILE_THREAD() ASSERT(CefCurrentlyOn(TID_FILE));
36 |
37 | #endif // CEF_TESTS_CEFCLIENT_UTIL_H_
38 |
--------------------------------------------------------------------------------
/src/debug.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "defines.h"
6 | #include
7 | #include
8 |
9 | char* WCHAR_TO_CHAR(wchar_t* wide) {
10 | int asciisize = WideCharToMultiByte(CP_UTF8, 0, wide, -1, 0, 0, 0, 0);
11 | char* ascii = (char*)malloc(asciisize * sizeof(char));
12 | WideCharToMultiByte(CP_UTF8, 0, wide, -1, ascii, asciisize, 0, 0);
13 | return ascii;
14 | }
15 | void GUID_TO_CHAR(const GUID* guid, char* outString, size_t outStringSize)
16 | {
17 | sprintf_s(outString, outStringSize,
18 | "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
19 | guid->Data1, guid->Data2, guid->Data3,
20 | guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
21 | guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
22 | }
23 |
--------------------------------------------------------------------------------
/src/debug.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 | #include
9 |
10 | #define CONCAT_NX(s1, s2) s1 ## s2
11 | #define CONCAT(s1, s2) CONCAT_NX(s1, s2)
12 |
13 | #define STRINGIZE_NX(A) #A
14 | #define STRINGIZE(A) STRINGIZE_NX(A)
15 |
16 | #define DEBUG_INT(A)\
17 | {\
18 | char tmpstr[4096];\
19 | sprintf_s(tmpstr, 4096, "%i\n\nFile: %s\nLine: %s\nFunc: %s()",\
20 | A, __FILE__, STRINGIZE(__LINE__), __FUNCTION__);\
21 | MessageBoxA(NULL, tmpstr, "DEBUG int", MB_ICONINFORMATION);\
22 | }
23 |
24 | #define DEBUG_INT_4(A, B, C, D)\
25 | {\
26 | char tmpstr[4096];\
27 | sprintf_s(tmpstr, 4096,\
28 | "%i,%i,%i,%i\n\nFile: %s\nLine: %s\nFunc: %s()",\
29 | A, B, C, D, __FILE__, STRINGIZE(__LINE__), __FUNCTION__);\
30 | MessageBoxA(NULL, tmpstr, "DEBUG_INT_4", MB_ICONINFORMATION);\
31 | }
32 |
33 | #define DEBUG_DWORD(A)\
34 | {\
35 | char tmpstr[4096];\
36 | sprintf_s(tmpstr, 4096, "%lu\n\nFile: %s\nLine: %s\nFunc: %s()",\
37 | A, __FILE__, STRINGIZE(__LINE__), __FUNCTION__);\
38 | MessageBoxA(NULL, tmpstr, "DEBUG_DWORD", MB_ICONINFORMATION);\
39 | }
40 |
41 | #define DEBUG_CHAR(A)\
42 | {\
43 | char tmpstr[4096];\
44 | sprintf_s(tmpstr, 4096, "%s\n\nFile: %s\nLine: %s\nFunc: %s()",\
45 | A, __FILE__, STRINGIZE(__LINE__), __FUNCTION__);\
46 | MessageBoxA(NULL, tmpstr, "DEBUG", MB_ICONINFORMATION);\
47 | }
48 |
49 | #define DEBUG_CHAR_2(A, B)\
50 | {\
51 | char tmpstr[4096];\
52 | sprintf_s(tmpstr, 4096, "%s\n%s\n\nFile: %s\nLine: %s\nFunc: %s()",\
53 | A, B, __FILE__, STRINGIZE(__LINE__), __FUNCTION__);\
54 | MessageBoxA(NULL, tmpstr, "DEBUG2", MB_ICONINFORMATION);\
55 | }
56 |
57 | char* WCHAR_TO_CHAR(wchar_t* wide);
58 |
59 | #define DEBUG_WCHAR(A)\
60 | {\
61 | char tmpstr[4096];\
62 | sprintf_s(tmpstr, 4096, "%s\n\nFile: %s\nLine: %s\nFunc: %s()",\
63 | WCHAR_TO_CHAR(A), __FILE__, STRINGIZE(__LINE__),\
64 | __FUNCTION__);\
65 | MessageBoxA(NULL, tmpstr, "DEBUG", MB_ICONINFORMATION);\
66 | }
67 |
68 | #define DEBUG_WCHAR_2(A, B)\
69 | {\
70 | char tmpstr[4096];\
71 | sprintf_s(tmpstr, 4096, "%s\n%s\n\nFile: %s\nLine: %s\nFunc: %s()",\
72 | WCHAR_TO_CHAR(A), WCHAR_TO_CHAR(B), __FILE__,\
73 | STRINGIZE(__LINE__), __FUNCTION__);\
74 | MessageBoxA(NULL, tmpstr, "DEBUG", MB_ICONINFORMATION);\
75 | }
76 |
77 | void GUID_TO_CHAR(const GUID* guid, char* outString, size_t outStringSize);
78 |
--------------------------------------------------------------------------------
/src/defines.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #define WINVER 0x0500
8 | #define _WIN32_WINNT 0x0501
9 | #define _WIN32_IE _WIN32_IE_IE60SP2
10 | #define _RICHEDIT_VER 0x0200
11 |
12 | // Win messages
13 | #define WM_TRAY_MESSAGE (WM_USER + 1)
14 |
--------------------------------------------------------------------------------
/src/dpi_aware.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 | #include "include/cef_app.h"
9 | #include "cef/util.h"
10 |
11 | void SetBrowserDpiSettings(CefRefPtr cefBrowser);
12 | void GetDpiAwareWindowSize(int* width, int* height);
13 |
--------------------------------------------------------------------------------
/src/executable.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "defines.h"
6 | #include
7 | #include
8 | #include "string_utils.h"
9 |
10 | std::string GetExecutablePath() {
11 | wchar_t path[MAX_PATH];
12 | std::wstring wideString;
13 | if (GetModuleFileName(NULL, path, _countof(path))) {
14 | if (GetLongPathName(path, path, _countof(path)))
15 | wideString = path;
16 | }
17 | return WideToUtf8(wideString);
18 | }
19 | std::string GetExecutablePathQuoted() {
20 | std::string path = GetExecutablePath();
21 | return path.insert(0, "\"").append("\"");
22 | }
23 | std::string GetExecutableDirectory() {
24 | std::string path = GetExecutablePath();
25 | wchar_t drive[_MAX_DRIVE];
26 | wchar_t directory[_MAX_DIR];
27 | wchar_t filename[_MAX_FNAME];
28 | wchar_t extension[_MAX_EXT];
29 | errno_t result = _wsplitpath_s(Utf8ToWide(path).c_str(),
30 | drive, _countof(drive),
31 | directory, _countof(directory),
32 | filename, _countof(filename),
33 | extension, _countof(extension));
34 | char utf8Drive[_MAX_DRIVE * 2];
35 | WideToUtf8(drive, utf8Drive, _countof(utf8Drive));
36 | char utf8Directory[_MAX_DIR * 2];
37 | WideToUtf8(directory, utf8Directory, _countof(utf8Directory));
38 | path.assign(utf8Drive).append(utf8Directory);
39 | if (path.length()) {
40 | char lastCharacter = path[path.length() - 1];
41 | if (lastCharacter == '\\' || lastCharacter == '/')
42 | path.erase(path.length() - 1);
43 | }
44 | return path;
45 | }
46 | std::string GetExecutableFilename() {
47 | std::string path = GetExecutablePath();
48 | wchar_t drive[_MAX_DRIVE];
49 | wchar_t directory[_MAX_DIR];
50 | wchar_t filename[_MAX_FNAME];
51 | wchar_t extension[_MAX_EXT];
52 | errno_t result = _wsplitpath_s(Utf8ToWide(path).c_str(),
53 | drive, _countof(drive),
54 | directory, _countof(directory),
55 | filename, _countof(filename),
56 | extension, _countof(extension));
57 | if (result != 0)
58 | return "";
59 | char utf8Filename[_MAX_FNAME * 2];
60 | WideToUtf8(filename, utf8Filename, _countof(utf8Filename));
61 | char utf8Extension[_MAX_EXT * 2];
62 | WideToUtf8(extension, utf8Extension, _countof(utf8Extension));
63 | return path.assign(utf8Filename).append(utf8Extension);
64 | }
65 | std::string GetExecutableName() {
66 | std::string path = GetExecutablePath();
67 | wchar_t drive[_MAX_DRIVE];
68 | wchar_t directory[_MAX_DIR];
69 | wchar_t filename[_MAX_FNAME];
70 | wchar_t extension[_MAX_EXT];
71 | errno_t result = _wsplitpath_s(Utf8ToWide(path).c_str(),
72 | drive, _countof(drive),
73 | directory, _countof(directory),
74 | filename, _countof(filename),
75 | extension, _countof(extension));
76 | char utf8Filename[_MAX_FNAME * 2];
77 | WideToUtf8(filename, utf8Filename, _countof(utf8Filename));
78 | return path.assign(utf8Filename);
79 | }
80 |
--------------------------------------------------------------------------------
/src/executable.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 | #include
9 |
10 | std::string GetExecutablePath();
11 | std::string GetExecutablePathQuoted();
12 | std::string GetExecutableDirectory();
13 | std::string GetExecutableFilename();
14 | std::string GetExecutableName();
15 |
--------------------------------------------------------------------------------
/src/fatal_error.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "defines.h"
6 | #include
7 | #include
8 |
9 | #include "executable.h"
10 | #include "settings.h"
11 | #include "string_utils.h"
12 |
13 | void FatalError(HWND hwnd, std::string message) {
14 | json_value* settings = GetApplicationSettings();
15 | std::string title = (*settings)["main_window"]["title"];
16 | if (title.empty())
17 | title = GetExecutableName();
18 | MessageBox(hwnd, Utf8ToWide(message).c_str(), Utf8ToWide(title).c_str(),
19 | MB_ICONERROR);
20 | exit(-1);
21 | }
22 |
--------------------------------------------------------------------------------
/src/fatal_error.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "defines.h"
6 | #include
7 | #include
8 |
9 | void FatalError(HWND hwnd, std::string message);
10 |
--------------------------------------------------------------------------------
/src/file_utils.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "file_utils.h"
6 | #include "defines.h"
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | #include "string_utils.h"
13 | #include "executable.h"
14 | #include "random.h"
15 |
16 | std::string GetFileContents(std::string file) {
17 | std::ifstream inFile;
18 | inFile.open(Utf8ToWide(file).c_str(), std::ios::in);
19 | if (!inFile)
20 | return "";
21 | std::string contents;
22 | inFile.seekg(0, std::ios::end);
23 | contents.resize(static_cast(inFile.tellg()));
24 | inFile.seekg(0, std::ios::beg);
25 | inFile.read(&contents[0], contents.size());
26 | inFile.close();
27 | return contents;
28 | }
29 | std::string GetRealPath(std::string path) {
30 | wchar_t realPath[MAX_PATH];
31 | GetFullPathName(Utf8ToWide(path).c_str(), _countof(realPath), realPath,
32 | NULL);
33 | return WideToUtf8(realPath);
34 | }
35 | std::string GetAbsolutePath(std::string path) {
36 | if (path.length() && path.find(":") == std::string::npos) {
37 | path = GetExecutableDirectory() + "\\" + path;
38 | path = GetRealPath(path);
39 | }
40 | return path;
41 | }
42 | bool DirectoryExists(std::string directory) {
43 | DWORD dwAttrib = GetFileAttributes(Utf8ToWide(directory).c_str());
44 | return (dwAttrib != INVALID_FILE_ATTRIBUTES &&
45 | (dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
46 | }
47 | bool AnsiDirectoryExists(std::string directory) {
48 | // To check whether directory doesn't contain unicode characters.
49 | DWORD dwAttrib = GetFileAttributesA(directory.c_str());
50 | return (dwAttrib != INVALID_FILE_ATTRIBUTES &&
51 | (dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
52 | }
53 | std::string GetDirectoryPath(const std::string& path)
54 | {
55 | size_t pos = path.find_last_of("\\/");
56 | return (std::string::npos == pos) ? "" : path.substr(0, pos);
57 | }
58 | bool IsDirectoryWritable(std::string directory) {
59 | int rand = random(0, 1000000);
60 | std::string tempFile = directory.append("\\phpdesktop")\
61 | .append(IntToString(rand)).append(".tmp");
62 | HANDLE handle = CreateFile(Utf8ToWide(tempFile).c_str(),
63 | GENERIC_WRITE,
64 | (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE),
65 | NULL, OPEN_ALWAYS,
66 | (FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE),
67 | NULL);
68 | if (handle == INVALID_HANDLE_VALUE) {
69 | return false;
70 | } else {
71 | CloseHandle(handle);
72 | return true;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/file_utils.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include
8 |
9 | std::string GetFileContents(std::string file);
10 | std::string GetRealPath(std::string path);
11 | std::string GetAbsolutePath(std::string path);
12 | bool DirectoryExists(std::string directory);
13 | bool AnsiDirectoryExists(std::string directory);
14 | std::string GetDirectoryPath(const std::string& path);
15 | bool IsDirectoryWritable(std::string directory);
16 |
--------------------------------------------------------------------------------
/src/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syracine69/phpdesktop/2edcbeb2211891363567b115c858f1b9d55c03b8/src/icon.ico
--------------------------------------------------------------------------------
/src/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syracine69/phpdesktop/2edcbeb2211891363567b115c858f1b9d55c03b8/src/icon.png
--------------------------------------------------------------------------------
/src/lib/Debug/README.txt:
--------------------------------------------------------------------------------
1 | Put libcef.lib and libcef_dll_wrapper.lib here.
2 |
3 | The version of CEF to use can be found in the cef/README.txt file.
4 |
--------------------------------------------------------------------------------
/src/license.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012 Czarek Tomczak. Portions Copyright
2 | (c) 2008 Marshall A.Greenblatt, 2006 Google Inc.
3 | All rights reserved.
4 |
5 | Project website: https://github.com/cztomczak/phpdesktop
6 |
7 | Redistribution and use in source and binary forms, with
8 | or without modification, are permitted provided that the
9 | following conditions are met:
10 |
11 | * Redistributions of source code must retain the above
12 | copyright notice, this list of conditions and the
13 | following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above
16 | copyright notice, this list of conditions and the
17 | following disclaimer in the documentation and/or other
18 | materials provided with the distribution.
19 |
20 | * Neither the name of PHP Desktop, nor the name Google Inc.
21 | nor the name Chromium Embedded Framework nor the names of
22 | its contributors may be used to endorse or promote products
23 | derived from this software without specific prior written
24 | permission.
25 |
26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
27 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
28 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
29 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
31 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
33 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 |
40 | This product includes the following third party libraries:
41 | * Chromium Embedded Framework licensed under the BSD 3-clause license.
42 | See: https://bitbucket.org/chromiumembedded/cef
43 | * PHP Software licensed under the PHP License 3.0.1.
44 | See: http://www.php.net/software/
45 | * Mongoose webserver revision 04fc209 licensed under the MIT license.
46 | See: https://github.com/cesanta/mongoose/tree/04fc209644b414d915c446bb1815b55e9fe63acc
47 | * JSON parser licensed under the BSD 2-clause license.
48 | See: https://github.com/udp/json-parser
49 |
--------------------------------------------------------------------------------
/src/logging.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "logging.h"
6 | #include
7 | #include
8 | #include
9 |
10 | #include "log.h"
11 | #include "executable.h"
12 | #include "string_utils.h"
13 |
14 | HANDLE g_logFileHandle = NULL;
15 |
16 | void InitializeLogging(bool show_console, std::string log_level,
17 | std::string log_file) {
18 | if (show_console) {
19 | AllocConsole();
20 | FILE* freopen_file;
21 | freopen_s(&freopen_file, "CONIN$", "rb", stdin);
22 | freopen_s(&freopen_file, "CONOUT$", "wb", stdout);
23 | freopen_s(&freopen_file, "CONOUT$", "wb", stderr);
24 | }
25 |
26 | #ifdef DEBUG
27 | // Debugging mongoose web server.
28 | FILE* mongoose_file;
29 | freopen_s(&mongoose_file,
30 | GetExecutableDirectory().append("\\debug-mongoose.log").c_str(),
31 | "ab", stdout);
32 | #endif
33 |
34 | if (log_level.length())
35 | FILELog::ReportingLevel() = FILELog::FromString(log_level);
36 | else
37 | FILELog::ReportingLevel() = logINFO;
38 |
39 | if (log_file.length()) {
40 | // The log file needs to be opened in shared mode so that
41 | // CEF subprocesses can also append to this file.
42 | // Converting HANDLE to FILE*:
43 | // http://stackoverflow.com/a/7369662/623622
44 | // Remember to call ShutdownLogging() to close the g_logFileHandle.
45 | g_logFileHandle = CreateFile(
46 | Utf8ToWide(log_file).c_str(),
47 | GENERIC_WRITE,
48 | FILE_SHARE_WRITE,
49 | NULL,
50 | OPEN_ALWAYS,
51 | FILE_ATTRIBUTE_NORMAL,
52 | NULL);
53 | if (g_logFileHandle == INVALID_HANDLE_VALUE) {
54 | g_logFileHandle = NULL;
55 | PHP_DESKTOP_LOG_ERROR << "Opening log file for appending failed";
56 | return;
57 | }
58 | int fd = _open_osfhandle((intptr_t)g_logFileHandle, _O_APPEND | _O_RDONLY);
59 | if (fd == -1) {
60 | PHP_DESKTOP_LOG_ERROR << "Opening log file for appending failed, "
61 | << "_open_osfhandle() failed";
62 | return;
63 | }
64 | FILE* pFile = _fdopen(fd, "a+");
65 | if (pFile == 0) {
66 | _close(fd);
67 | PHP_DESKTOP_LOG_ERROR << "Opening log file for appending failed, "
68 | << "_fdopen() failed";
69 | return;
70 | }
71 | // TODO: should we call fclose(pFile) later?
72 | Output2FILE::Stream() = pFile;
73 | }
74 | }
75 | void ShutdownLogging() {
76 | if (g_logFileHandle) {
77 | CloseHandle(g_logFileHandle);
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/logging.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 | #include
9 |
10 | void InitializeLogging(bool show_console, std::string log_level,
11 | std::string log_file);
12 | void ShutdownLogging();
13 |
--------------------------------------------------------------------------------
/src/main.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "defines.h"
6 | #include
7 |
8 | LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
9 | LPARAM lParam);
10 |
--------------------------------------------------------------------------------
/src/main_window.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "main_window.h"
6 | #include "settings.h"
7 | #include "dpi_aware.h"
8 | #include "window_utils.h"
9 | #include "resource.h"
10 | #include "main.h"
11 |
12 | extern wchar_t g_windowClassName[256]; // main.cpp
13 |
14 | HWND CreateMainWindow(HINSTANCE hInstance, int nCmdShow, std::string title) {
15 | json_value* appSettings = GetApplicationSettings();
16 | int default_width = static_cast((*appSettings)["main_window"]["default_size"][0]);
17 | int default_height = static_cast((*appSettings)["main_window"]["default_size"][1]);
18 | bool disable_maximize_button =
19 | (*appSettings)["main_window"]["disable_maximize_button"];
20 | bool center_on_screen = (*appSettings)["main_window"]["center_on_screen"];
21 | bool dpi_aware = (*appSettings)["application"]["dpi_aware"];
22 | bool start_maximized = (*appSettings)["main_window"]["start_maximized"];
23 | bool always_on_top = (*appSettings)["main_window"]["always_on_top"];
24 |
25 | if (default_width && default_height) {
26 | if (dpi_aware) {
27 | GetDpiAwareWindowSize(&default_width, &default_height);
28 | }
29 | GetCorrectWindowSize(&default_width, &default_height);
30 | } else {
31 | default_width = CW_USEDEFAULT;
32 | default_height = CW_USEDEFAULT;
33 | }
34 |
35 | WNDCLASSEX wc = {0};
36 | wc.cbSize = sizeof(wc);
37 | wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
38 | wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDR_MAINWINDOW));
39 | wc.hInstance = hInstance;
40 | wc.lpfnWndProc = WindowProc;
41 | wc.lpszClassName = g_windowClassName;
42 |
43 | ATOM atom = RegisterClassEx(&wc);
44 | _ASSERT(atom);
45 |
46 | HWND hwnd = CreateWindowEx(0, g_windowClassName,
47 | Utf8ToWide(title).c_str(), WS_OVERLAPPEDWINDOW,
48 | CW_USEDEFAULT, CW_USEDEFAULT, default_width, default_height,
49 | HWND_DESKTOP, 0, hInstance, 0);
50 | _ASSERT(hwnd);
51 | if (disable_maximize_button) {
52 | int style = GetWindowLong(hwnd, GWL_STYLE);
53 | _ASSERT(style);
54 | int ret = SetWindowLong(hwnd, GWL_STYLE, style &~WS_MAXIMIZEBOX);
55 | _ASSERT(ret);
56 | }
57 | if (center_on_screen) {
58 | CenterWindow(hwnd);
59 | }
60 | if (always_on_top) {
61 | SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
62 | }
63 | if (start_maximized) {
64 | ShowWindow(hwnd, SW_MAXIMIZE);
65 | } else {
66 | ShowWindow(hwnd, nCmdShow);
67 | }
68 | UpdateWindow(hwnd);
69 | return hwnd;
70 | }
--------------------------------------------------------------------------------
/src/main_window.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 | #include
9 | #include
10 |
11 | HWND CreateMainWindow(HINSTANCE hInstance, int nCmdShow, std::string title);
12 |
--------------------------------------------------------------------------------
/src/php/!README.txt:
--------------------------------------------------------------------------------
1 | PHP binaries downloaded from windows.php.net.
2 |
--------------------------------------------------------------------------------
/src/php/php.ini:
--------------------------------------------------------------------------------
1 | ; Extensions
2 | extension_dir = "ext/"
3 | extension=php_curl.dll
4 | extension=php_gd2.dll
5 | extension=php_mysql.dll
6 | extension=php_mysqli.dll
7 | extension=php_openssl.dll
8 | extension=php_pdo_mysql.dll
9 | extension=php_pdo_pgsql.dll
10 | extension=php_pdo_sqlite.dll
11 | extension=php_pgsql.dll
12 | extension=php_sqlite3.dll
13 | extension=php_com_dotnet.dll
14 |
15 | ; Date
16 | date.timezone=Europe/Berlin
17 |
18 | ; Errors
19 | error_reporting=E_ALL
20 | display_errors=On
21 | display_startup_errors=On
22 | log_errors=Off
23 | report_memleaks=On
24 | report_zend_debug=On
25 |
26 | ; General
27 | short_open_tag=On
28 | ignore_user_abort=Off
29 | implicit_flush=Off
30 | output_buffering=0
31 | default_charset = "UTF-8"
32 |
33 | ; Execution time
34 | max_execution_time=30
35 |
36 | ; Memory
37 | memory_limit=128M
38 |
39 | ; File uploads
40 | ; "post_max_size" must be equal or bigger than "upload_max_filesize"
41 | max_file_uploads=20
42 | upload_max_filesize=2048M
43 | post_max_size=2048M
44 |
45 | ; Smtp server is not included with phpdesktop
46 | SMTP=127.0.0.1
47 | smtp_port=25
48 |
49 |
--------------------------------------------------------------------------------
/src/php_server.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "defines.h"
6 | #include
7 | #include
8 | #include "settings.h"
9 | #include "log.h"
10 | #include "executable.h"
11 | #include "file_utils.h"
12 |
13 | SHELLEXECUTEINFO g_phpShell;
14 | std::string g_webServerUrl;
15 |
16 | bool StartWebServer() {
17 | PHP_DESKTOP_LOG_INFO << "Starting PHP built-in web server";
18 | json_value* settings = GetApplicationSettings();
19 |
20 | // Web server url from settings.
21 | std::string ipAddress = (*settings)["web_server"]["listen_on"][0];
22 | std::string port = (*settings)["web_server"]["listen_on"][1];
23 | long portInt = (*settings)["web_server"]["listen_on"][1];
24 | if (portInt) {
25 | port = IntToString(portInt);
26 | }
27 | if (ipAddress.empty() || port.empty()) {
28 | ipAddress = "127.0.0.1";
29 | port = "54007";
30 | }
31 | g_webServerUrl = "http://" + ipAddress + ":" + port + "/";
32 | PHP_DESKTOP_LOG_INFO << "Web server url: " << g_webServerUrl;
33 |
34 | // WWW directory from settings.
35 | std::string wwwDirectory = (*settings)["web_server"]["www_directory"];
36 | if (wwwDirectory.empty())
37 | wwwDirectory = "www";
38 | wwwDirectory = GetExecutableDirectory().append("\\").append(wwwDirectory);
39 | // Mongoose won't accept "..\\" in a path, need a real path.
40 | wwwDirectory = GetRealPath(wwwDirectory);
41 | PHP_DESKTOP_LOG_INFO << "WWW directory: " << wwwDirectory;
42 |
43 | // PHP executable from settings.
44 | std::string phpExecutable = (*settings)["web_server"]["php_executable"];
45 | if (phpExecutable.empty())
46 | phpExecutable = "php\\php.exe";
47 | phpExecutable.insert(0, GetExecutableDirectory() + "\\");
48 | phpExecutable = GetRealPath(phpExecutable);
49 | PHP_DESKTOP_LOG_INFO << "PHP executable: " << phpExecutable;
50 |
51 | // PHP shell parameters.
52 | std::string shellParams;
53 | shellParams.append("-S ");
54 | shellParams.append(ipAddress);
55 | shellParams.append(":");
56 | shellParams.append(port);
57 | shellParams.append(" -t ");
58 | shellParams.append(wwwDirectory);
59 | PHP_DESKTOP_LOG(logDEBUG) << "PHP shell parameters: " << shellParams;
60 |
61 | memset(&g_phpShell, 0, sizeof(g_phpShell));
62 | g_phpShell.cbSize = sizeof(g_phpShell);
63 | g_phpShell.fMask = SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS;
64 | g_phpShell.hwnd = NULL;
65 | g_phpShell.lpVerb = L"open";
66 |
67 | // Lifetime of c_str() must outlast until ShellExecuteEx() is called.
68 | std::wstring phpExecutableWide = Utf8ToWide(phpExecutable);
69 | std::wstring shellParamsWide = Utf8ToWide(shellParams);
70 |
71 | g_phpShell.lpFile = phpExecutableWide.c_str();
72 | g_phpShell.lpParameters = shellParamsWide.c_str();
73 | g_phpShell.lpDirectory = NULL;
74 | g_phpShell.nShow = SW_HIDE;
75 | g_phpShell.hInstApp = NULL;
76 |
77 | if (ShellExecuteEx(&g_phpShell)) {
78 | return true;
79 | }
80 | return false;
81 | }
82 | void StopWebServer() {
83 | PHP_DESKTOP_LOG_INFO << "Stopping PHP built-in web server";
84 | TerminateProcess(g_phpShell.hProcess, EXIT_SUCCESS);
85 | }
86 |
--------------------------------------------------------------------------------
/src/php_server.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "defines.h"
6 |
7 | bool StartWebServer();
8 | void StopWebServer();
9 |
--------------------------------------------------------------------------------
/src/phpdesktop-chrome.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{743D0316-53E2-4381-B9C8-2C68DB639764}") = "phpdesktop-chrome", "phpdesktop-chrome.vcxproj", "{D6CAC1B9-0B7C-4D5F-9F8C-5D497B1B0E81}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {D6CAC1B9-0B7C-4D5F-9F8C-5D497B1B0E81}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {D6CAC1B9-0B7C-4D5F-9F8C-5D497B1B0E81}.Debug|Win32.Build.0 = Debug|Win32
14 | {D6CAC1B9-0B7C-4D5F-9F8C-5D497B1B0E81}.Release|Win32.ActiveCfg = Release|Win32
15 | {D6CAC1B9-0B7C-4D5F-9F8C-5D497B1B0E81}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/src/popup_window.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "popup_window.h"
6 | #include "settings.h"
7 | #include "window_utils.h"
8 | #include "dpi_aware.h"
9 |
10 | extern wchar_t g_windowClassName[256]; // main.cpp
11 | extern HINSTANCE g_hInstance; // main.cpp
12 |
13 | HWND CreatePopupWindow(HWND parentHandle) {
14 | json_value* appSettings = GetApplicationSettings();
15 | bool center_relative_to_parent =
16 | (*appSettings)["popup_window"]["center_relative_to_parent"];
17 | bool dpi_aware = (*appSettings)["application"]["dpi_aware"];
18 | int default_width = static_cast(\
19 | (*appSettings)["popup_window"]["default_size"][0]);
20 | int default_height = static_cast(\
21 | (*appSettings)["popup_window"]["default_size"][1]);
22 | int width = CW_USEDEFAULT;
23 | int height = CW_USEDEFAULT;
24 | if (default_width && default_height) {
25 | width = default_width;
26 | height = default_height;
27 | // If width or height is CW_USEDEFAULT then don't call the
28 | // GetDpiAwareWindowSize nor GetCorrectWindowSize, as CW_USEDEFAULT
29 | // is a virtual number.
30 | if (dpi_aware) {
31 | GetDpiAwareWindowSize(&width, &height);
32 | }
33 | GetCorrectWindowSize(&width, &height);
34 | }
35 | // Title will be set in BrowserWindow::BrowserWindow().
36 | // CW_USEDEFAULT cannot be used with WS_POPUP.
37 | HWND hwnd = CreateWindowEx(0, g_windowClassName,
38 | 0, WS_OVERLAPPEDWINDOW,
39 | CW_USEDEFAULT, CW_USEDEFAULT, width, height,
40 | parentHandle, 0, g_hInstance, 0);
41 | _ASSERT(hwnd);
42 | if (center_relative_to_parent) {
43 | CenterWindowRelativeToParent(hwnd, parentHandle);
44 | }
45 | ShowWindow(hwnd, SW_SHOWNORMAL);
46 | UpdateWindow(hwnd);
47 | return hwnd;
48 | }
--------------------------------------------------------------------------------
/src/popup_window.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 | #include
9 |
10 | HWND CreatePopupWindow(HWND parentHandle);
11 |
--------------------------------------------------------------------------------
/src/random.cpp:
--------------------------------------------------------------------------------
1 | // The srand2_mix() function is by Jonathan Wright:
2 | // http://stackoverflow.com/a/323302/623622
3 |
4 | // The random() function is by Ryan Reich:
5 | // http://stackoverflow.com/a/6852396/623622
6 | // The code was modified a bit.
7 |
8 | // The random() fallback is by Mark B:
9 | // http://stackoverflow.com/a/5009006/623622
10 |
11 | #include "random.h"
12 | #include
13 | #include
14 |
15 | unsigned long srand2_mix(unsigned long a, unsigned long b, unsigned long c)
16 | {
17 | a=a-b; a=a-c; a=a^(c >> 13);
18 | b=b-c; b=b-a; b=b^(a << 8);
19 | c=c-a; c=c-b; c=c^(b >> 13);
20 | a=a-b; a=a-c; a=a^(c >> 12);
21 | b=b-c; b=b-a; b=b^(a << 16);
22 | c=c-a; c=c-b; c=c^(b >> 5);
23 | a=a-b; a=a-c; a=a^(c >> 3);
24 | b=b-c; b=b-a; b=b^(a << 10);
25 | c=c-a; c=c-b; c=c^(b >> 15);
26 | return c;
27 | }
28 |
29 | void srand2() {
30 | unsigned long seed = srand2_mix(
31 | clock(),
32 | (unsigned long)time(NULL),
33 | GetProcessId(GetModuleHandle(NULL)));
34 | srand(seed);
35 | }
36 |
37 | int random(unsigned int min, unsigned int max, int recursion_level)
38 | {
39 | /* Returns a semi-open interval [min, max) */
40 | static bool srand_initialized = false;
41 | if (!srand_initialized) {
42 | srand_initialized = true;
43 | srand2();
44 | }
45 | if (recursion_level > 100) {
46 | // A fallback.
47 | int ret = min + (rand() % (int)(max - min));
48 | return ret;
49 | }
50 | int base_random = rand(); /* in [0, RAND_MAX] */
51 | if (RAND_MAX == base_random)
52 | return random(min, max, recursion_level + 1);
53 | /* now guaranteed to be in [0, RAND_MAX) */
54 | int range = max - min,
55 | remainder = RAND_MAX % range,
56 | bucket = RAND_MAX / range;
57 | /* There are range buckets, plus one smaller interval
58 | within remainder of RAND_MAX */
59 | if (base_random < RAND_MAX - remainder) {
60 | return min + base_random/bucket;
61 | } else {
62 | return random(min, max, recursion_level + 1);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/random.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "defines.h"
4 |
5 | void srand2();
6 | int random(unsigned int min, unsigned int max, int recursion_level=0);
7 |
--------------------------------------------------------------------------------
/src/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by resource.rc
4 | //
5 |
6 | #include
7 |
8 | #define IDR_MAINWINDOW 128
9 |
10 | // Next default values for new objects
11 | //
12 | #ifdef APSTUDIO_INVOKED
13 | #ifndef APSTUDIO_READONLY_SYMBOLS
14 | #define _APS_NEXT_RESOURCE_VALUE 201
15 | #define _APS_NEXT_COMMAND_VALUE 32775
16 | #define _APS_NEXT_CONTROL_VALUE 1000
17 | #define _APS_NEXT_SYMED_VALUE 101
18 | #endif
19 | #endif
20 |
--------------------------------------------------------------------------------
/src/resource.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 | /////////////////////////////////////////////////////////////////////////////
5 | // English (United States) resources
6 |
7 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
8 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
9 | #pragma code_page(1252)
10 |
11 | #ifdef APSTUDIO_INVOKED
12 | /////////////////////////////////////////////////////////////////////////////
13 | //
14 | // TEXTINCLUDE
15 | //
16 |
17 | 1 TEXTINCLUDE
18 | BEGIN
19 | "resource.h\0"
20 | END
21 |
22 | 2 TEXTINCLUDE
23 | BEGIN
24 | "\0"
25 | END
26 |
27 | 3 TEXTINCLUDE
28 | BEGIN
29 | "\0"
30 | END
31 |
32 | #endif // APSTUDIO_INVOKED
33 |
34 |
35 | /////////////////////////////////////////////////////////////////////////////
36 | //
37 | // Icon
38 | //
39 |
40 | // Icon with lowest ID value placed first to ensure application icon
41 | // remains consistent on all systems.
42 | IDR_MAINWINDOW ICON "icon.ico"
43 |
44 | /////////////////////////////////////////////////////////////////////////////
45 | //
46 | // Version
47 | //
48 |
49 | VS_VERSION_INFO VERSIONINFO
50 | FILEVERSION 57,0,0,0
51 | PRODUCTVERSION 57,0,0,0
52 | FILEFLAGSMASK 0x3fL
53 | #ifdef _DEBUG
54 | FILEFLAGS 0x1L
55 | #else
56 | FILEFLAGS 0x0L
57 | #endif
58 | FILEOS 0x4L
59 | FILETYPE 0x1L
60 | FILESUBTYPE 0x0L
61 | BEGIN
62 | BLOCK "StringFileInfo"
63 | BEGIN
64 | BLOCK "040904b0"
65 | BEGIN
66 | VALUE "CompanyName", "PHP Desktop"
67 | VALUE "FileDescription", "PHP Desktop Chrome"
68 | VALUE "FileVersion", "57.0.0.0"
69 | VALUE "InternalName", "phpdesktop"
70 | VALUE "LegalCopyright", "(c) Czarek Tomczak 2012"
71 | VALUE "OriginalFilename", "phpdesktop-chrome.exe"
72 | VALUE "ProductName", "PHP Desktop Chrome"
73 | VALUE "ProductVersion", "57.0.0.0"
74 | END
75 | END
76 | BLOCK "VarFileInfo"
77 | BEGIN
78 | VALUE "Translation", 0x409, 1200
79 | END
80 | END
81 |
82 |
83 | /////////////////////////////////////////////////////////////////////////////
84 | //
85 | // String Table
86 | //
87 |
88 | STRINGTABLE
89 | BEGIN
90 | IDR_MAINWINDOW "phpdesktop"
91 | END
92 |
93 | #endif // English (United States) resources
94 | /////////////////////////////////////////////////////////////////////////////
95 |
96 |
97 |
--------------------------------------------------------------------------------
/src/settings.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "defines.h"
6 | #include "executable.h"
7 | #include "file_utils.h"
8 | #include "json.h"
9 | #include "log.h"
10 |
11 | std::string g_applicationSettingsError = "";
12 |
13 | json_value* GetApplicationSettings() {
14 | static json_value* ret = new json_value();
15 | static bool settings_fetched = false;
16 | if (settings_fetched)
17 | return ret;
18 | settings_fetched = true;
19 | PHP_DESKTOP_LOG_DEBUG << "Fetching settings from settings.json file";
20 |
21 | std::string settingsFile = GetExecutableDirectory() + "\\settings.json";
22 | std::string contents = GetFileContents(settingsFile);
23 | if (contents.empty()) {
24 | PHP_DESKTOP_LOG_WARNING << "Error while opening the settings.json file";
25 | g_applicationSettingsError = "Error while opening the Settings file. ";
26 | return ret;
27 | }
28 |
29 | json_settings settings;
30 | memset(&settings, 0, sizeof(json_settings));
31 | char error[256];
32 | json_value* json_parsed = json_parse_ex(&settings, contents.c_str(),
33 | &error[0]);
34 | if (json_parsed == 0) {
35 | PHP_DESKTOP_LOG_WARNING << "Error while parsing settings.json file: " << error;
36 | g_applicationSettingsError = "Error while parsing the Settings file. ";
37 | return ret;
38 | }
39 | ret = json_parsed;
40 | return ret;
41 | }
42 |
43 | std::string GetApplicationSettingsError() {
44 | return g_applicationSettingsError;
45 | }
46 |
--------------------------------------------------------------------------------
/src/settings.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 | #include "json.h"
9 | #include
10 |
11 | json_value* GetApplicationSettings();
12 | std::string GetApplicationSettingsError();
13 |
--------------------------------------------------------------------------------
/src/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "application": {
3 | "single_instance_guid": "",
4 | "dpi_aware": true
5 | },
6 | "debugging": {
7 | "show_console": false,
8 | "subprocess_show_console": false,
9 | "log_level": "DEBUG4",
10 | "log_file": "debug.log"
11 | },
12 | "main_window": {
13 | "title": "PHP Desktop Chrome",
14 | "icon": "",
15 | "default_size": [800, 600],
16 | "minimum_size": [640, 480],
17 | "maximum_size": [0, 0],
18 | "disable_maximize_button": false,
19 | "center_on_screen": true,
20 | "start_maximized": false,
21 | "start_fullscreen": false,
22 | "always_on_top": false,
23 | "minimize_to_tray": false,
24 | "minimize_to_tray_message": "Minimized to tray"
25 | },
26 | "popup_window": {
27 | "icon": "",
28 | "fixed_title": "",
29 | "center_relative_to_parent": true,
30 | "default_size": [800, 600]
31 | },
32 | "web_server": {
33 | "listen_on": ["127.0.0.1", 0],
34 | "www_directory": "www",
35 | "index_files": ["index.html", "index.php"],
36 | "cgi_interpreter": "php/php-cgi.exe",
37 | "cgi_extensions": ["php"],
38 | "cgi_temp_dir": "",
39 | "404_handler": "/pretty-urls.php",
40 | "hide_files": []
41 | },
42 | "chrome": {
43 | "log_file": "debug.log",
44 | "log_severity": "default",
45 | "cache_path": "webcache",
46 | "external_drag": true,
47 | "external_navigation": true,
48 | "reload_page_F5": true,
49 | "devtools_F12": true,
50 | "remote_debugging_port": 0,
51 | "command_line_switches": {},
52 | "enable_downloads": true,
53 | "context_menu": {
54 | "enable_menu": true,
55 | "navigation": true,
56 | "print": true,
57 | "view_source": true,
58 | "open_in_external_browser": true,
59 | "devtools": true
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/single_instance_application.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 |
9 | class SingleInstanceApplication {
10 | protected:
11 | DWORD lastError;
12 | HANDLE mutex;
13 | public:
14 | SingleInstanceApplication() {}
15 | void Initialize(TCHAR* mutexname) {
16 | mutex = CreateMutex(NULL, FALSE, mutexname);
17 | lastError = GetLastError();
18 | }
19 | ~SingleInstanceApplication() {
20 | if (mutex) {
21 | CloseHandle(mutex);
22 | mutex = NULL;
23 | }
24 | }
25 | bool IsRunning() {
26 | return (lastError == ERROR_ALREADY_EXISTS);
27 | }
28 |
29 | };
--------------------------------------------------------------------------------
/src/string_utils.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 | #include
9 |
10 | void Utf8ToWide(const char* charString, wchar_t* wideString, int wideSize);
11 | std::wstring Utf8ToWide(const char* utf8String);
12 | std::wstring Utf8ToWide(const std::string& utf8String);
13 | void WideToUtf8(const wchar_t* wideString, char* utf8String, int utf8Size);
14 | std::string WideToUtf8(const wchar_t* wideString);
15 | std::string WideToUtf8(const std::wstring& wideString);
16 |
17 | std::string IntToString(long number);
18 | std::string BoolToString(bool value);
19 |
20 | std::string UpperString(std::string str);
21 |
22 | std::string ReplaceString(std::string subject, const std::string& search,
23 | const std::string& replace);
24 | void ReplaceStringInPlace(std::string& subject, const std::string& search,
25 | const std::string& replace);
26 | std::string TrimString(std::string s);
27 |
28 | std::string GetDataURI(const std::string& data, const std::string& mime_type);
--------------------------------------------------------------------------------
/src/temp_dir.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 | #include
9 |
10 | std::string GetAnsiTempDirectory();
11 |
--------------------------------------------------------------------------------
/src/version.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "version.h"
6 | #include
7 | #include "log.h"
8 | #include
9 | #include "string_utils.h"
10 |
11 | #pragma comment(lib, "Version")
12 |
13 | std::string GetPhpDesktopVersion() {
14 | TCHAR versionFile[MAX_PATH];
15 | if (!GetModuleFileName(NULL, versionFile, MAX_PATH))
16 | return "";
17 | DWORD versionHandle = NULL;
18 | DWORD versionSize = GetFileVersionInfoSize(versionFile, &versionHandle);
19 | if (versionSize == NULL)
20 | return "";
21 | LPSTR versionData = new char[versionSize];
22 | if (GetFileVersionInfo(versionFile, versionHandle, versionSize, versionData)) {
23 | UINT querySize = 0;
24 | LPBYTE queryBuffer = NULL;
25 | if (VerQueryValue(versionData, L"\\", (VOID**)&queryBuffer, &querySize)) {
26 | if (querySize) {
27 | VS_FIXEDFILEINFO *versionInfo = (VS_FIXEDFILEINFO*)queryBuffer;
28 | if (versionInfo->dwSignature == 0xfeef04bd)
29 | {
30 | int major = HIWORD(versionInfo->dwFileVersionMS);
31 | int minor = LOWORD(versionInfo->dwFileVersionMS);
32 | int build = versionInfo->dwFileVersionLS;
33 | delete[] versionData;
34 | return IntToString(major).append(".").append(IntToString(minor));
35 | }
36 | }
37 | }
38 | }
39 | delete[] versionData;
40 | return "";
41 | }
--------------------------------------------------------------------------------
/src/version.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 | #include
9 |
10 | std::string GetPhpDesktopVersion();
11 |
--------------------------------------------------------------------------------
/src/web_server.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 | #include
9 |
10 | bool StartWebServer();
11 | void StopWebServer();
12 | int GetWebServerPort();
13 | std::string GetWebServerIpAddress();
14 | std::string GetWebServerUrl();
15 | std::string GetWwwDirectory();
16 | std::string GetCgiInterpreter();
17 |
--------------------------------------------------------------------------------
/src/window_utils.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #include "defines.h"
6 | #include
7 | #include "log.h"
8 |
9 | void CenterWindow(HWND wnd) {
10 | RECT r,r1;
11 | GetWindowRect(wnd,&r);
12 | GetWindowRect(GetDesktopWindow(),&r1);
13 | MoveWindow(wnd,((r1.right-r1.left)-(r.right-r.left))/2,
14 | ((r1.bottom-r1.top)-(r.bottom-r.top))/2,
15 | (r.right-r.left), (r.bottom-r.top),0);
16 | }
17 |
18 | bool CenterWindowRelativeToParent(HWND window, HWND parent) {
19 | RECT rect, parentRect;
20 | int width, height;
21 | int screenWidth, screenHeight;
22 | int x, y;
23 | GetWindowRect(window, &rect);
24 | GetWindowRect(parent, &parentRect);
25 | width = rect.right - rect.left;
26 | height = rect.bottom - rect.top;
27 | x = ((parentRect.right - parentRect.left) - width) / 2 + parentRect.left;
28 | y = ((parentRect.bottom - parentRect.top) - height) / 2 + parentRect.top;
29 | screenWidth = GetSystemMetrics(SM_CXSCREEN);
30 | screenHeight = GetSystemMetrics(SM_CYSCREEN);
31 | if (x < 0) { x = 0; }
32 | if (y < 0) { y = 0; }
33 | if (x + width > screenWidth) {
34 | x = screenWidth - width;
35 | }
36 | if (y + height > screenHeight) {
37 | y = screenHeight - height;
38 | }
39 | // Move it a bit so that popup window does not overlay the parent
40 | // window completely, when it is of the same size or a bit smaller.
41 | if (x >= parentRect.left && x < parentRect.left + 48) {
42 | x = parentRect.left + 48;
43 | }
44 | if (y >= parentRect.top && y < parentRect.top + 32) {
45 | y = parentRect.top + 32;
46 | }
47 | MoveWindow(window, x, y, width, height, TRUE);
48 | return true;
49 | }
50 |
51 | void GetCorrectWindowSize(int* width, int* height) {
52 | int max_width = GetSystemMetrics(SM_CXMAXIMIZED) - 96;
53 | int max_height = GetSystemMetrics(SM_CYMAXIMIZED) - 64;
54 | PHP_DESKTOP_LOG_DEBUG << "Window max width/height = " << max_width << "/" << max_height;
55 | bool max_size_exceeded = (*width > max_width \
56 | || *height > max_height);
57 | if (*width > max_width) {
58 | *width = max_width;
59 | }
60 | if (*height > max_height) {
61 | *height = max_height;
62 | }
63 | if (max_size_exceeded) {
64 | PHP_DESKTOP_LOG_DEBUG << "Window max size exceeded, new width/height = "
65 | << *width << "/" << *height;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/window_utils.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
2 | // License: New BSD License.
3 | // Website: http://code.google.com/p/phpdesktop/
4 |
5 | #pragma once
6 |
7 | #include "defines.h"
8 |
9 | void CenterWindow(HWND hwnd);
10 | bool CenterWindowRelativeToParent(HWND window, HWND parent);
11 | void GetCorrectWindowSize(int* width, int* height);
12 |
--------------------------------------------------------------------------------
/src/www/_pdo.php:
--------------------------------------------------------------------------------
1 | setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
12 | }
13 | function PDO_FetchOne($query, $params=null)
14 | {
15 | global $PDO;
16 | if (isset($params)) {
17 | $stmt = $PDO->prepare($query);
18 | $stmt->execute($params);
19 | } else {
20 | $stmt = $PDO->query($query);
21 | }
22 | $row = $stmt->fetch(PDO::FETCH_NUM);
23 | if ($row) {
24 | return $row[0];
25 | } else {
26 | return false;
27 | }
28 | }
29 | function PDO_FetchRow($query, $params=null)
30 | {
31 | global $PDO;
32 | if (isset($params)) {
33 | $stmt = $PDO->prepare($query);
34 | $stmt->execute($params);
35 | } else {
36 | $stmt = $PDO->query($query);
37 | }
38 | return $stmt->fetch(PDO::FETCH_ASSOC);
39 | }
40 | function PDO_FetchAll($query, $params=null)
41 | {
42 | global $PDO;
43 | if (isset($params)) {
44 | $stmt = $PDO->prepare($query);
45 | $stmt->execute($params);
46 | } else {
47 | $stmt = $PDO->query($query);
48 | }
49 | return $stmt->fetchAll(PDO::FETCH_ASSOC);
50 | }
51 | function PDO_FetchAssoc($query, $params=null)
52 | {
53 | global $PDO;
54 | if (isset($params)) {
55 | $stmt = $PDO->prepare($query);
56 | $stmt->execute($params);
57 | } else {
58 | $stmt = $PDO->query($query);
59 | }
60 | $rows = $stmt->fetchAll(PDO::FETCH_NUM);
61 | $assoc = array();
62 | foreach ($rows as $row) {
63 | $assoc[$row[0]] = $row[1];
64 | }
65 | return $assoc;
66 | }
67 | function PDO_Execute($query, $params=null)
68 | {
69 | global $PDO;
70 | if (isset($params)) {
71 | $stmt = $PDO->prepare($query);
72 | $stmt->execute($params);
73 | return $stmt;
74 | } else {
75 | return $PDO->query($query);
76 | }
77 | }
78 | function PDO_LastInsertId()
79 | {
80 | global $PDO;
81 | return $PDO->lastInsertId();
82 | }
83 | function PDO_ErrorInfo()
84 | {
85 | global $PDO;
86 | return $PDO->errorInfo();
87 | }
88 |
89 | ?>
90 |
--------------------------------------------------------------------------------
/src/www/blenc_encode.php:
--------------------------------------------------------------------------------
1 | @import url("style.css");');
5 | print("Go back ");
6 | if (!extension_loaded("blenc")) {
7 | $link = "https://github.com/cztomczak/phpdesktop/wiki/" .
8 | "Source-code-protection#blenc-encoder";
9 | printf("ERROR: blenc extension not loaded.
10 | BLENC encoder is a PECL extension that permits to protect
11 | PHP source scripts.
12 | This extension is not distributed by default with
13 | phpdesktop binaries.
14 | See instructions on how to use BLENC encoder with
15 | phpdesktop on the SourceCodeProtection wiki page:
16 | %s ", $link, $link);
17 | exit();
18 | }
19 | $source_code = file_get_contents("blenc_myscript.php");
20 | // The encoded source passed to blenc_encrypt() cannot contain
21 | // any php tags. We are removing php tags at the beginning and
22 | // end of file. Also checking that there are no other php tag
23 | // openings/closings.
24 | $source_code = preg_replace('#^<'.'\?php\s+#', '', $source_code);
25 | $source_code = preg_replace('#\s+\?'.'>\s*$#', '', $source_code);
26 | if (preg_match('#<'.'\?#', $source_code)
27 | || preg_match('#\?'.'>#', $source_code)) {
28 | print("Script to be encoded can only contain PHP code.");
29 | print(" Only a single php opening tag at the beginning of file");
30 | print(" and a single php closing tag at the end of file are allowed.");
31 | print(" This is a limitation as of BENC encoder 1.1.4b.");
32 | exit();
33 | }
34 | $redist_key = blenc_encrypt($source_code, "blenc_myscript_encoded.php",
35 | BLENC_ENCRYPTION_KEY);
36 | $key_file = ini_get('blenc.key_file');
37 | file_put_contents($key_file, $redist_key);
38 | print("DONE. See");
39 | print(" blenc_myscript_encoded.php ");
40 | ?>
--------------------------------------------------------------------------------
/src/www/blenc_myscript.php:
--------------------------------------------------------------------------------
1 | @import url("style.css");');
3 | print("Go back ");
4 | print("Printing a secret string: XuXuXaaa");
5 | ?>
--------------------------------------------------------------------------------
/src/www/cookies.php:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 | Go back to index
15 | | ">Refresh
16 |
17 |
18 | Cookies
19 |
20 | Create a random cookie
21 |
22 | Total cookies:
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/www/download.php:
--------------------------------------------------------------------------------
1 |
13 |
14 |
15 | Go back to index
16 | | ">Refresh
17 |
18 |
19 | Download
20 |
21 | You can disable ability to download files by setting
22 | the "enable_downloads" option to false in settings.json.
23 |
24 |
25 | Download file:
26 | phpdesktop.txt
27 |
28 |
--------------------------------------------------------------------------------
/src/www/env-variables.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 | Environment variables
6 | Environment variables
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/www/error-404.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 | Error 404
6 | Error 404
7 |
8 |
9 | Cick the non-existing url below. If ["web_server"]["404_handler"]
10 | is set in settings.json file then clicking the link below
11 | will forward you to "/pretty-urls.php/foo.html". You can then
12 | access the "/foo.html" url using $_SERVER["PATH_INFO"] or
13 | $_SERVER["REQUEST_URI"].
14 |
15 | Try it:
16 |
20 |
21 |
--------------------------------------------------------------------------------
/src/www/error-500.php:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 | Go back to index
9 | | ">Refresh
10 |
11 | Error 500
12 | Error 500
13 |
14 |
15 | Sent header: 500 Internal Server Error.
16 | If you're seeing this then all is OK.
17 |
18 |
--------------------------------------------------------------------------------
/src/www/execute-command.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 |
6 | Execute command
7 | Execute command
8 |
9 |
10 | // Execution of commands may hang on Windows XP for some programs,
11 | // wmic.exe is one of them. The solution is to use a command like
12 | // this "echo | command...". See Issue 124:
13 | // https://code.google.com/p/phpdesktop/issues/detail?id=124
14 |
15 | $output = shell_exec("echo | {$_ENV['SYSTEMROOT']}\System32\wbem\wmic.exe path win32_computersystemproduct get uuid");
16 |
17 | if ($output) {
18 | echo "Command executed successfully.<br>";
19 | echo "Output: $output";
20 | } else {
21 | echo "Command failed.";
22 | }
23 |
24 |
25 | ";
36 | echo "Output: $output";
37 | } else {
38 | echo "Command failed.";
39 | }
40 |
41 | ?>
42 |
43 |
--------------------------------------------------------------------------------
/src/www/forms.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 | Forms
6 | Forms
7 |
8 | Input
9 |
10 | type=text:
11 | type=(empty)
12 | type=password:
13 | type=checkbox:
14 | type=submit:
15 | type=button:
16 |
17 | Textarea
18 |
19 |
20 |
21 | Select
22 |
23 |
24 | option 1
25 | option 2
26 |
--------------------------------------------------------------------------------
/src/www/google.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 | Google
6 | Google
7 |
8 | https://www.google.com/
9 |
--------------------------------------------------------------------------------
/src/www/html5-video.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 | HTML 5 Video and accelerated content
6 | HTML 5 Video and accelerated content
7 |
8 | Use the "Back" option in the right mouse context menu
9 | to go back to this page, after clicking on the links below.
10 |
11 |
12 | HTML 5 video
13 |
14 |
15 | Accelerated canvas
16 |
17 |
18 | Accelerated layers
19 |
--------------------------------------------------------------------------------
/src/www/iframe.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 | IFrame
6 |
7 | To test whether a new option "Open frame in external browser"
8 | appears when showing the mouse context menu.
9 |
10 |
12 |
--------------------------------------------------------------------------------
/src/www/index.php:
--------------------------------------------------------------------------------
1 |
2 | ">Refresh
3 |
4 | PHP Desktop Chrome
5 | PHP Desktop Chrome
6 |
7 |
8 | PHP Desktop version:
9 |
10 |
11 |
12 | Chrome version:
13 |
14 |
15 |
16 | PHP version:
17 |
18 |
19 |
20 | NOTES:
21 |
22 | To navigate back and forward use mouse context menu
23 | To disable console window, edit the settings.json file
24 | and change the "show_console" setting to false.
25 |
26 |
27 |
28 |
29 |
30 | Test scripts in the www/ directory:
31 |
32 | %s ", $file, $file);
41 | }
42 |
43 | ?>
44 |
45 |
46 | Project website:
47 |
48 | http://github.com/cztomczak/phpdesktop
49 |
50 |
--------------------------------------------------------------------------------
/src/www/javascript-api.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 | Javascript API
6 |
7 | PHP Desktop exposes its API through the javascript "phpdesktop"
8 | object that is binded to the window object.
9 |
10 |
11 | phpdesktop.GetVersion()
12 |
13 | Get the PHP Desktop version. This value is taken from the version
14 | info embedded in the phpdesktop executable.
15 |
16 |
17 | phpdesktop.ToggleFullscreen()
18 |
19 | To go into fullscreen mode or exit fullscreen mode.
20 |
21 |
22 | phpdesktop.IsFullscreen()
23 |
24 | Whether in fullscreen mode.
25 |
--------------------------------------------------------------------------------
/src/www/loading-error.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 |
6 | Loading error
7 |
8 |
9 | Try loading a non-existent url. This is an http protocol
10 | so it will be handled by the web server:
11 | non-existent.html
12 |
13 |
14 |
15 | A custom scheme loading error will be handled by Chrome:
16 | asd://non-existent.html
17 | In a popup window:
18 | asd://non-existent.html
19 |
--------------------------------------------------------------------------------
/src/www/mouse-cursor-loading.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | Go back to index
7 | | ">Refresh
8 |
9 | Mouse cursor loading
10 |
11 | Testing mouse cursor indicator during long loading of a page.
12 |
--------------------------------------------------------------------------------
/src/www/no-cache.php:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | Go back to index
13 | | ">Refresh
14 |
15 | No cache
16 | No cache
17 |
18 | This example uses PHP header() calls to set cache control.
19 |
20 | Some random number:
21 |
22 |
23 |
24 | Go back and forward using mouse context menu to see if this number changed,
25 | if so the cache was disabled successfully.
26 |
27 |
28 |
29 | To avoid caching of static resources put some random query string
30 | when including js/css files, see for example:
31 |
32 |
33 |
34 | <link href="css/style.css?r=<?php echo time(); ?>" rel="stylesheet" type="text/css" />
35 |
--------------------------------------------------------------------------------
/src/www/ob-flush.php:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 | Go back to index
31 | | ">Refresh
32 |
33 | Output buffer flush
34 | Output buffer flush
35 |
36 |
37 | This example forces flush of output buffer repeatedly.
38 |
39 |
40 | This technique works differently with Mongoose web server.
41 | Mongoose forces to always read 8192 characters (MG_BUF_LEN)
42 | before sending output. The solution is to output 8192 spaces
43 | before each ob_flush / flush calls. Spaces are ignored in html,
44 | so this output is not visible. It should really be 8192
45 | characters minus characters previously outputted for it to
46 | work always correctly. In this simple examples this is not
47 | required.
48 |
49 |
50 | ");
55 | sleep(2);
56 | fprint("Slept for 2 seconds ");
57 | sleep(3);
58 | fprint("Slept for 3 seconds ");
59 | fprint("Done.")
60 |
61 | ?>
--------------------------------------------------------------------------------
/src/www/open-folder-in-explorer.php:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 | Go back to index
14 | | ">Refresh
15 |
16 | Open folder in Explorer
17 | Open folder in Explorer
18 |
19 |
20 | $explorer = $_ENV["SYSTEMROOT"] . '\\explorer.exe';
21 | $folder_to_open = "C:\\Windows";
22 | // Using "system" function would cause a false/positive
23 | // by Bkav antivirus on virustotal.com. Using shell_exec
24 | // instead solves the issue.
25 | shell_exec("$explorer /n,/e,$folder_to_open");
26 |
27 |
--------------------------------------------------------------------------------
/src/www/php-error.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 | PHP error
6 | PHP error
7 |
8 |
9 | <?php
10 | echo $some;
11 | ?>
12 |
13 |
14 |
17 |
--------------------------------------------------------------------------------
/src/www/phpinfo.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/www/popup.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 |
7 | Popup
8 | Popup
9 |
10 |
11 | When creating a window, the ["application"]["dpi_aware"] setting is taken
12 | into account. If it's set to true, then application window will be resized
13 | automatically using the current OS DPI settings.
14 |
15 |
16 |
17 |
18 | window.open('index.php', '', 'width=800,height=600')
19 |
20 |
21 |
22 |
23 | target="_blank"
24 |
25 |
--------------------------------------------------------------------------------
/src/www/pretty-urls.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 | Pretty urls
6 | Pretty urls
7 |
8 | $_SERVER
9 |
10 | $v) {
15 | if (is_array($v)) {
16 | continue;
17 | }
18 | if (strpos($v, "pretty-urls.php") !== false
19 | || strpos($v, "company") !== false
20 | || strpos($v, "xyz") !== false
21 | || strpos($v, "foo") !== false
22 | || strpos($v, "bar") !== false
23 | || $k == "REQUEST_METHOD"
24 | || $k == "REQUEST_URI") {
25 | $url_vars[$k] = $v;
26 | }
27 | }
28 | print "";
29 | print_r($url_vars);
30 | print " ";
31 | }
32 | print_url_variables();
33 | ?>
34 |
35 |
36 | Pretty urls can be handled by setting ["web_server"]["404_handler"]
37 | option in settings.json file. This is how it works:
38 |
39 | Set 404_handler to "/pretty-urls.php"
40 | Load url like "/company/5"
41 | Mongoose web server does not find such file "/company/5",
42 | and instead makes a request to "/pretty-urls.php/company/5".
43 | To know the pretty url that was accessed check
44 | the PATH_INFO or REQUEST_URI environment variables.
45 |
46 |
47 |
48 | Test pretty urls:
49 |
55 |
56 |
57 |
58 | Test POST request to
59 |
60 | /company/5
61 | /company.html
62 |
63 | /pretty-urls.php/company/5
64 |
65 |
66 | /pretty-urls.php/company/5.html
67 |
68 |
69 |
73 |
74 |
75 |
76 | POST data
77 |
78 |
79 |
80 |
81 |
82 |
83 | Other tests (these urls do not require 404_handler to be set):
84 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/src/www/request-quota.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 | Request quota
6 | Request quota
7 |
8 | Request quota for HTML 5 persistent storage.
9 |
10 |
24 |
25 |
26 | DoRequestQuota()
27 |
--------------------------------------------------------------------------------
/src/www/session.php:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | Go back to index
13 | | ">Refresh
14 |
15 | Session
16 | Session
17 |
18 | Temp directory:
19 |
20 | The code
21 |
22 | session_start();
23 | if (!isset($_SESSION['count'])) {
24 | $_SESSION['count'] = 1;
25 | } else {
26 | $_SESSION['count']++;
27 | }
28 |
29 |
30 | $_SESSION
31 | Refresh the page to see if counter increases.
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/www/speech-recognition.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 |
6 | Speech recognition
7 |
8 | You need to set the "enable-speech-input" flag in settings.json
9 | for the speech recognition to work:
10 |
11 |
12 | "command_line_switches": {
13 | "enable-speech-input": ""
14 | },
15 |
16 |
17 | After you've done that, restart application and visit this url:
18 |
19 |
20 | http://slides.html5rocks.com/#speech-input
21 |
--------------------------------------------------------------------------------
/src/www/sqlite.php:
--------------------------------------------------------------------------------
1 |
2 | Go back to index
3 | | ">Refresh
4 |
5 | SQLite
6 |
7 | ");
14 | print("The database file: $db_file ");
15 |
16 | $queries = <<< HTML
17 | CREATE TABLE test (id int PRIMARY KEY, name varchar(50));
18 | INSERT INTO test VALUES (1, "Amelia");
19 | INSERT INTO test VALUES (2, "Beatrice");
20 | HTML;
21 |
22 | print("Create table and insert exampe data ");
23 | print("");
24 | $queries = explode(";", $queries);
25 | foreach ($queries as $query) {
26 | $query = trim($query);
27 | if (!$query) continue;
28 | $stmt = @PDO_Execute($query);
29 | if (!$stmt || ($stmt && $stmt->errorCode() != 0)) {
30 | $error = PDO_ErrorInfo();
31 | print_r($error[2]);
32 | break;
33 | }
34 | print($query."\n");
35 | }
36 | print(" ");
37 |
38 | print("Fetch data ");
39 | print("PDO_FetchAll('SELECT * FROM test')");
40 | print("");
41 | $data = PDO_FetchAll("SELECT * FROM test");
42 | print_r($data);
43 | print(" ");
44 |
45 | ?>
--------------------------------------------------------------------------------
/src/www/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: Arial;
3 | font-size: 13px;
4 | }
5 | pre {
6 | background: #eee;
7 | padding: 0.25em 0.5em;
8 | }
9 |
--------------------------------------------------------------------------------
/src/www/temp-dir.php:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 | Go back to index
12 | | ">Refresh
13 |
14 |
15 | TMP directory
16 |
17 |
18 | A few calls to putenv() overwrite the default directory,
19 | call sys_get_temp_dir() to see it if was set successfully.
20 |
21 |
22 | You can also set the temp directory using the "cgi_temp_dir"
23 | option in the settings.json file.
24 |
25 | sys_get_temp_dir()
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/www/upload.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | Go back to index
7 | | ">Refresh
8 |
9 | Upload
10 | Upload
11 |
12 | Temp directory:
13 |
14 |
19 |
20 | $_FILES
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | Check the uploaded file
30 |
31 | is_file() =
32 |
33 | is_readable() =
34 |
35 | is_writable() =
36 |
37 |
38 | Move the uploaded file
39 |
40 |
44 |
45 |
46 |
47 | The uploaded file () was moved to
48 | the www/ directory using the move_uploaded_file() function.
49 | See the listing of files by going to index.php
50 |
51 |
52 |
53 | move_uploaded_file() failed.
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------