mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-23 15:37:51 +01:00
Support override of client id for file scanning (fixes issue #2368).
This commit is contained in:
parent
8b400331c7
commit
3827f817c7
@ -34,7 +34,7 @@
|
|||||||
// implementations. See the translator.README.txt file in the tools directory
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
// for more information.
|
// for more information.
|
||||||
//
|
//
|
||||||
// $hash=dd6129d832b33b4da283d86722ba5a7b743a15a5$
|
// $hash=e9ff73cc80e162b173ecd1a62b0cb48f9e46de99$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_API_HASH_H_
|
#ifndef CEF_INCLUDE_API_HASH_H_
|
||||||
@ -47,13 +47,13 @@
|
|||||||
// way that may cause binary incompatibility with other builds. The universal
|
// way that may cause binary incompatibility with other builds. The universal
|
||||||
// hash value will change if any platform is affected whereas the platform hash
|
// hash value will change if any platform is affected whereas the platform hash
|
||||||
// values will change only if that particular platform is affected.
|
// values will change only if that particular platform is affected.
|
||||||
#define CEF_API_HASH_UNIVERSAL "91bb58af264779076e95dfd1a63033bc7da296cd"
|
#define CEF_API_HASH_UNIVERSAL "fa535acbd95d3d7a25e43b015dfea09700d7bf72"
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#define CEF_API_HASH_PLATFORM "7cacaf3f958d22f84e4ee6b5216dc5ccc4c18e31"
|
#define CEF_API_HASH_PLATFORM "a729d5a21d1f3655db514d47093abe59794f5f26"
|
||||||
#elif defined(OS_MACOSX)
|
#elif defined(OS_MACOSX)
|
||||||
#define CEF_API_HASH_PLATFORM "b471cf826966f5917fd3855996c8998898df2334"
|
#define CEF_API_HASH_PLATFORM "6b77f0976c19ba6b15a8a054fe35bde0ba2cf89d"
|
||||||
#elif defined(OS_LINUX)
|
#elif defined(OS_LINUX)
|
||||||
#define CEF_API_HASH_PLATFORM "1b0a73214b4f50b23e2dab96d7a1d6def2c195dc"
|
#define CEF_API_HASH_PLATFORM "c21503860303873c2148e3740d6c407ae6ece32b"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -412,6 +412,14 @@ typedef struct _cef_settings_t {
|
|||||||
// CefRequestContextSettings.accept_language_list value.
|
// CefRequestContextSettings.accept_language_list value.
|
||||||
///
|
///
|
||||||
cef_string_t accept_language_list;
|
cef_string_t accept_language_list;
|
||||||
|
|
||||||
|
///
|
||||||
|
// GUID string used for identifying the application. This is passed to the
|
||||||
|
// system AV function for scanning downloaded files. By default, the GUID
|
||||||
|
// will be an empty string and the file will be treated as an untrusted
|
||||||
|
// file when the GUID is empty.
|
||||||
|
///
|
||||||
|
cef_string_t application_client_id_for_file_scanning;
|
||||||
} cef_settings_t;
|
} cef_settings_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -553,6 +553,7 @@ struct CefSettingsTraits {
|
|||||||
cef_string_clear(&s->resources_dir_path);
|
cef_string_clear(&s->resources_dir_path);
|
||||||
cef_string_clear(&s->locales_dir_path);
|
cef_string_clear(&s->locales_dir_path);
|
||||||
cef_string_clear(&s->accept_language_list);
|
cef_string_clear(&s->accept_language_list);
|
||||||
|
cef_string_clear(&s->application_client_id_for_file_scanning);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void set(const struct_type* src,
|
static inline void set(const struct_type* src,
|
||||||
@ -603,6 +604,9 @@ struct CefSettingsTraits {
|
|||||||
cef_string_set(src->accept_language_list.str,
|
cef_string_set(src->accept_language_list.str,
|
||||||
src->accept_language_list.length,
|
src->accept_language_list.length,
|
||||||
&target->accept_language_list, copy);
|
&target->accept_language_list, copy);
|
||||||
|
cef_string_set(src->application_client_id_for_file_scanning.str,
|
||||||
|
src->application_client_id_for_file_scanning.length,
|
||||||
|
&target->application_client_id_for_file_scanning, copy);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "libcef/browser/download_manager_delegate.h"
|
#include "libcef/browser/download_manager_delegate.h"
|
||||||
|
|
||||||
#include "include/cef_download_handler.h"
|
#include "include/cef_download_handler.h"
|
||||||
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/browser/download_item_impl.h"
|
#include "libcef/browser/download_item_impl.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
|
||||||
@ -14,6 +15,7 @@
|
|||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "chrome/common/chrome_constants.h"
|
||||||
#include "content/public/browser/browser_context.h"
|
#include "content/public/browser/browser_context.h"
|
||||||
#include "content/public/browser/download_item_utils.h"
|
#include "content/public/browser/download_item_utils.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
@ -387,6 +389,16 @@ void CefDownloadManagerDelegate::GetNextId(
|
|||||||
callback.Run(next_id++);
|
callback.Run(next_id++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CefDownloadManagerDelegate::ApplicationClientIdForFileScanning()
|
||||||
|
const {
|
||||||
|
const CefSettings& settings = CefContext::Get()->settings();
|
||||||
|
if (settings.application_client_id_for_file_scanning.length > 0) {
|
||||||
|
return CefString(&settings.application_client_id_for_file_scanning)
|
||||||
|
.ToString();
|
||||||
|
}
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
void CefDownloadManagerDelegate::OnBrowserDestroyed(
|
void CefDownloadManagerDelegate::OnBrowserDestroyed(
|
||||||
CefBrowserHostImpl* browser) {
|
CefBrowserHostImpl* browser) {
|
||||||
ItemBrowserMap::iterator it = item_browser_map_.begin();
|
ItemBrowserMap::iterator it = item_browser_map_.begin();
|
||||||
|
@ -39,6 +39,7 @@ class CefDownloadManagerDelegate : public download::DownloadItem::Observer,
|
|||||||
download::DownloadItem* item,
|
download::DownloadItem* item,
|
||||||
const content::DownloadTargetCallback& callback) override;
|
const content::DownloadTargetCallback& callback) override;
|
||||||
void GetNextId(const content::DownloadIdCallback& callback) override;
|
void GetNextId(const content::DownloadIdCallback& callback) override;
|
||||||
|
std::string ApplicationClientIdForFileScanning() const override;
|
||||||
|
|
||||||
// CefBrowserHostImpl::Observer methods.
|
// CefBrowserHostImpl::Observer methods.
|
||||||
void OnBrowserDestroyed(CefBrowserHostImpl* browser) override;
|
void OnBrowserDestroyed(CefBrowserHostImpl* browser) override;
|
||||||
|
@ -76,6 +76,10 @@ int RunMain(HINSTANCE hInstance, int nCmdShow) {
|
|||||||
settings.no_sandbox = true;
|
settings.no_sandbox = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Applications should specify a unique GUID here to enable trusted downloads.
|
||||||
|
CefString(&settings.application_client_id_for_file_scanning)
|
||||||
|
.FromString("9A8DE24D-B822-4C6C-8259-5A848FEA1E68");
|
||||||
|
|
||||||
// Populate the settings based on command line arguments.
|
// Populate the settings based on command line arguments.
|
||||||
context->PopulateSettings(&settings);
|
context->PopulateSettings(&settings);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user