From 615c5a4d240fbfa57dff755a17bf76f834fc7ee0 Mon Sep 17 00:00:00 2001 From: zbych Date: Sat, 10 Dec 2016 09:04:29 +0000 Subject: [PATCH] ChromiumBrowser: 1. Chromium 54 certificates API change 2. CEF download page updated 3. translation typo fixed git-svn-id: svn://ultimatepp.org/upp/trunk@10533 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/ChromiumBrowser/ClientHandler.cpp | 58 ++++++++----------- .../src.tpp/ChromiumBrowser$en-us.tpp | 16 ++--- .../ChromiumBrowserExample.upp | 3 +- bazaar/ChromiumBrowserExample/translation.t | 2 +- 4 files changed, 35 insertions(+), 44 deletions(-) diff --git a/bazaar/ChromiumBrowser/ClientHandler.cpp b/bazaar/ChromiumBrowser/ClientHandler.cpp index 5b363a610..03a085131 100644 --- a/bazaar/ChromiumBrowser/ClientHandler.cpp +++ b/bazaar/ChromiumBrowser/ClientHandler.cpp @@ -153,21 +153,6 @@ bool ClientHandler::OnJSDialog(CefRefPtr browser, const CefString& o } -static Upp::String GetCefTimeString(const CefTime& v) { - if (v.GetTimeT() == 0) return "Unspecified"; - - Upp::Time t; - t.year = v.year; - t.month = v.month; - t.day = v.day_of_month; - t.hour = v.hour; - t.minute= v.minute; - t.second= v.second; - - return Upp::FormatTime(t, "YYYY-MM-DD hh:mm:ss"); -} - - bool ClientHandler::OnCertificateError(CefRefPtr browser, ErrorCode cert_error, const CefString& request_url, CefRefPtr ssl_info, CefRefPtr callback) @@ -177,27 +162,32 @@ bool ClientHandler::OnCertificateError(CefRefPtr browser, ErrorCode bool cont = WhenCertificateError(request_url.ToString()); if (!cont){ - CefRefPtr subject = ssl_info->GetSubject(); - CefRefPtr issuer = ssl_info->GetIssuer(); + Upp::String valid_start; + Upp::String valid_expiry; + Upp::String subject_str = " "; + Upp::String issuer_str = " "; + + if (ssl_info){ + CefRefPtr cert = ssl_info->GetX509Certificate(); + if (cert.get()){ + valid_start = Upp::Format(Upp::TimeFromUTC(cert->GetValidStart().GetTimeT())); + valid_expiry = Upp::Format(Upp::TimeFromUTC(cert->GetValidExpiry().GetTimeT())); + CefRefPtr subject = cert->GetSubject(); + subject_str = subject.get() ? subject->GetDisplayName().ToString().c_str() : " "; + CefRefPtr issuer = cert->GetIssuer(); + issuer_str = issuer.get() ? issuer->GetDisplayName().ToString().c_str() : " "; + } + } - // Build a table showing certificate information. + // certificate information Upp::String ss; - ss << "" - "

Page certificate is not trusted

" - "
Certificate Information:" - "" - "" - "" - "" - "" - "
FieldValue
Subject" << - (subject.get() ? subject->GetDisplayName().ToString().c_str() : " ") << - "
Issuer" << - (issuer.get() ? issuer->GetDisplayName().ToString().c_str() : " ") << - "
Valid Start" << - GetCefTimeString(ssl_info->GetValidStart()) << "
Valid Expiry" << - GetCefTimeString(ssl_info->GetValidExpiry()) << "
" - ""; + ss << "

Page certificate is not trusted



X.509 Certificate Information:" + "" << + "" + "" + "" + "" + "
FieldValue
Subject" << subject_str << "
Issuer" << issuer_str << "
Valid Start" << valid_start << "
Valid Expiry" << valid_expiry << "
"; browser->GetMainFrame()->LoadString(~ss, request_url); } diff --git a/bazaar/ChromiumBrowser/src.tpp/ChromiumBrowser$en-us.tpp b/bazaar/ChromiumBrowser/src.tpp/ChromiumBrowser$en-us.tpp index d12dc89bd..8060122dd 100644 --- a/bazaar/ChromiumBrowser/src.tpp/ChromiumBrowser$en-us.tpp +++ b/bazaar/ChromiumBrowser/src.tpp/ChromiumBrowser$en-us.tpp @@ -36,8 +36,8 @@ Windows.&] [s0;* &] [ {{10000F(128)G(128)@1 [s0; [* Building CEF application on Linux]]}}&] [s0; &] -[s0;i150;O0; download CEF package for Linux from https://cefbuilds.com/. -Downloading stable release is recommended (not `"dev channel`").&] +[s0;i150;O0; download `"Standard Distribution`" CEF package for Linux +from http://opensource.spotify.com/cefbuilds/index.html&] [s0;i150;O0; unpack the archive to your `"MyApps`" directory&] [s0;i150;O0; go to CEF directory and run following commands:&] [s0; -|[C1 cmake `-G `"Unix Makefiles`" `-DCMAKE`_BUILD`_TYPE`=Release]&] @@ -58,12 +58,13 @@ to work]&] [s0;i150;O0; configure library paths in TheIDE, menu [* Setup ]/ [* Build methods]:&] [s0; -|[* INCLUDE directories] `- add CEF library directory, for example:&] -[s0; -|[C1 /home/USER`_NAME/MyApps/cef`_binary`_3.2454.1327.g0ea96ca`_linux64]&] +[s0; -|[C1 /home/`$USER/MyApps/cef`_binary`_3.2840.1518.gffd843c`_linux64]&] [s0; -|[* LIB directories] `- add CEF subdirectories containing libcef.so and libcef`_dll`_wrapper.a, for example:&] -[s0; [C1 -|/home/USER`_NAME/MyApps/cef`_binary`_3.2454.1327.g0ea96ca`_linux64/Release]&] -[s0; [C1 -|/home/USER`_NAME/MyApps/cef`_binary`_3.2454.1327.g0ea96ca`_linux64/libcef`_dl -l]&] +[s0; [C1 -|/home/`$USER/MyApps/cef`_binary`_3.2840.1518.gffd843c`_linux64/libcef`_dll]&] +[s0; [C1 -|/home/`$USER/MyApps/cef`_binary`_3.2840.1518.gffd843c`_linux64/Release]&] +[s0; [C1 -|/home/`$USER/MyApps/cef`_binary`_3.2840.1518.gffd843c`_linux64/libcef`_dll`_w +rapper]&] [s0;i150;O0; open ChromiumBrowserExample from Bazaar and try to compile it&] [s0;i150;O0; before you run compiled application, copy asset files @@ -146,7 +147,8 @@ to the output directory&] [s0; &] [s0;i150;O0; required software: Visual Studio 2015, CMake (http://www.cmake.org/downloa d/)&] -[s0;i150;O0; download CEF package for Windows from https://cefbuilds.com/&] +[s0;i150;O0; download `"Standard Distribution`" CEF package for Windows +from http://opensource.spotify.com/cefbuilds/index.html&] [s0;i150;O0; unpack the archive to your `"MyApps`" directory&] [s0;i150;O0; go to CEF directory and run following command:&] [s0; -|[C cmake `-G `"Visual Studio 14`"]&] diff --git a/bazaar/ChromiumBrowserExample/ChromiumBrowserExample.upp b/bazaar/ChromiumBrowserExample/ChromiumBrowserExample.upp index b9443d940..64783fe0c 100644 --- a/bazaar/ChromiumBrowserExample/ChromiumBrowserExample.upp +++ b/bazaar/ChromiumBrowserExample/ChromiumBrowserExample.upp @@ -26,6 +26,5 @@ file main.cpp; mainconfig - "" = "GUI MT NOGTK USEMALLOC", - "" = "GUI MT USEMALLOC"; + "" = "GUI MT NOGTK USEMALLOC"; diff --git a/bazaar/ChromiumBrowserExample/translation.t b/bazaar/ChromiumBrowserExample/translation.t index 02d18edd3..a6e927e99 100644 --- a/bazaar/ChromiumBrowserExample/translation.t +++ b/bazaar/ChromiumBrowserExample/translation.t @@ -43,7 +43,7 @@ T_("Message") plPL("Wiadomo\305\233\304\207") T_("Connection to '%s' is untrusted&Load page anyway?") -plPL("Po\305\202\304\205czenie z '%s' jest niezaufaned&Za\305\202adowa\304\207 " +plPL("Po\305\202\304\205czenie z '%s' jest niezaufane&Za\305\202adowa\304\207 " "stron\304\231 mimo to?")