Convert defined(OS_XXX) to BUILDFLAG(IS_XXX) in libcef

See https://crbug.com/1234043 for background.
This commit is contained in:
Marshall Greenblatt
2022-01-24 12:58:02 -05:00
parent 7b0bb931b1
commit ebde595370
68 changed files with 280 additions and 282 deletions

View File

@ -666,7 +666,7 @@ void AlloyBrowserHostImpl::SendCaptureLostEvent() {
} }
void AlloyBrowserHostImpl::NotifyMoveOrResizeStarted() { void AlloyBrowserHostImpl::NotifyMoveOrResizeStarted() {
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
if (!CEF_CURRENTLY_ON_UIT()) { if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK( CEF_POST_TASK(
CEF_UIT, CEF_UIT,
@ -1350,7 +1350,7 @@ bool AlloyBrowserHostImpl::HandleContextMenu(
void AlloyBrowserHostImpl::UpdatePreferredSize(content::WebContents* source, void AlloyBrowserHostImpl::UpdatePreferredSize(content::WebContents* source,
const gfx::Size& pref_size) { const gfx::Size& pref_size) {
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (platform_delegate_) if (platform_delegate_)
platform_delegate_->SizeTo(pref_size.width(), pref_size.height()); platform_delegate_->SizeTo(pref_size.width(), pref_size.height());

View File

@ -41,7 +41,7 @@
#include "third_party/widevine/cdm/buildflags.h" #include "third_party/widevine/cdm/buildflags.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
#include "ui/ozone/buildflags.h" #include "ui/ozone/buildflags.h"
#if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11) #if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11)
#include "ui/events/devices/x11/touch_factory_x11.h" #include "ui/events/devices/x11/touch_factory_x11.h"
@ -54,7 +54,7 @@
#include "ui/views/widget/desktop_aura/desktop_screen.h" #include "ui/views/widget/desktop_aura/desktop_screen.h"
#include "ui/wm/core/wm_state.h" #include "ui/wm/core/wm_state.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "chrome/browser/chrome_browser_main_win.h" #include "chrome/browser/chrome_browser_main_win.h"
#include "chrome/browser/win/parental_controls.h" #include "chrome/browser/win/parental_controls.h"
#include "components/os_crypt/os_crypt.h" #include "components/os_crypt/os_crypt.h"
@ -62,7 +62,7 @@
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_views_delegate.h" #include "chrome/browser/ui/views/chrome_views_delegate.h"
#else #else
@ -70,11 +70,11 @@
#endif #endif
#endif // defined(TOOLKIT_VIEWS) #endif // defined(TOOLKIT_VIEWS)
#if defined(USE_AURA) && defined(OS_LINUX) #if defined(USE_AURA) && BUILDFLAG(IS_LINUX)
#include "ui/base/ime/init/input_method_initializer.h" #include "ui/base/ime/init/input_method_initializer.h"
#endif #endif
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
#include "libcef/browser/printing/print_dialog_linux.h" #include "libcef/browser/printing/print_dialog_linux.h"
#endif #endif
@ -95,7 +95,7 @@ AlloyBrowserMainParts::~AlloyBrowserMainParts() {
} }
int AlloyBrowserMainParts::PreEarlyInitialization() { int AlloyBrowserMainParts::PreEarlyInitialization() {
#if defined(USE_AURA) && defined(OS_LINUX) #if defined(USE_AURA) && BUILDFLAG(IS_LINUX)
// TODO(linux): Consider using a real input method or // TODO(linux): Consider using a real input method or
// views::LinuxUI::SetInstance. // views::LinuxUI::SetInstance.
ui::InitializeInputMethodForTesting(); ui::InitializeInputMethodForTesting();
@ -113,7 +113,7 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
views_delegate_ = std::make_unique<ChromeViewsDelegate>(); views_delegate_ = std::make_unique<ChromeViewsDelegate>();
layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider(); layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider();
#else #else
@ -123,13 +123,13 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
} }
void AlloyBrowserMainParts::PreCreateMainMessageLoop() { void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
#if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11) #if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11)
ui::TouchFactory::SetTouchDeviceListFromCommandLine(); ui::TouchFactory::SetTouchDeviceListFromCommandLine();
#endif #endif
#endif #endif
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Initialize the OSCrypt. // Initialize the OSCrypt.
PrefService* local_state = g_browser_process->local_state(); PrefService* local_state = g_browser_process->local_state();
DCHECK(local_state); DCHECK(local_state);
@ -139,13 +139,13 @@ void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
// installer_util references strings that are normally compiled into // installer_util references strings that are normally compiled into
// setup.exe. In Chrome, these strings are in the locale files. // setup.exe. In Chrome, these strings are in the locale files.
ChromeBrowserMainPartsWin::SetupInstallerUtilStrings(); ChromeBrowserMainPartsWin::SetupInstallerUtilStrings();
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
media_router::ChromeMediaRouterFactory::DoPlatformInit(); media_router::ChromeMediaRouterFactory::DoPlatformInit();
} }
void AlloyBrowserMainParts::PostCreateMainMessageLoop() { void AlloyBrowserMainParts::PostCreateMainMessageLoop() {
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
printing::PrintingContextLinux::SetCreatePrintDialogFunction( printing::PrintingContextLinux::SetCreatePrintDialogFunction(
&CefPrintDialogLinux::CreatePrintDialog); &CefPrintDialogLinux::CreatePrintDialog);
printing::PrintingContextLinux::SetPdfPaperSizeFunction( printing::PrintingContextLinux::SetPdfPaperSizeFunction(
@ -154,7 +154,7 @@ void AlloyBrowserMainParts::PostCreateMainMessageLoop() {
} }
int AlloyBrowserMainParts::PreCreateThreads() { int AlloyBrowserMainParts::PreCreateThreads() {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
PlatformInitialize(); PlatformInitialize();
#endif #endif
@ -211,7 +211,7 @@ int AlloyBrowserMainParts::PreMainMessageLoopRun() {
CefDevToolsManagerDelegate::StartHttpHandler(browser_context); CefDevToolsManagerDelegate::StartHttpHandler(browser_context);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Windows parental controls calls can be slow, so we do an early init here // Windows parental controls calls can be slow, so we do an early init here
// that calculates this value off of the UI thread. // that calculates this value off of the UI thread.
InitializeWinParentalControls(); InitializeWinParentalControls();
@ -260,7 +260,7 @@ void AlloyBrowserMainParts::PostDestroyThreads() {
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
views_delegate_.reset(); views_delegate_.reset();
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
layout_provider_.reset(); layout_provider_.reset();
#endif #endif
#endif // defined(TOOLKIT_VIEWS) #endif // defined(TOOLKIT_VIEWS)

View File

@ -32,7 +32,7 @@ class WMState;
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
namespace views { namespace views {
class ViewsDelegate; class ViewsDelegate;
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
class LayoutProvider; class LayoutProvider;
#endif #endif
} // namespace views } // namespace views
@ -75,9 +75,9 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
} }
private: private:
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
void PlatformInitialize(); void PlatformInitialize();
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
content::MainFunctionParams parameters_; content::MainFunctionParams parameters_;
@ -103,7 +103,7 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
std::unique_ptr<views::ViewsDelegate> views_delegate_; std::unique_ptr<views::ViewsDelegate> views_delegate_;
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
std::unique_ptr<views::LayoutProvider> layout_provider_; std::unique_ptr<views::LayoutProvider> layout_provider_;
#endif #endif
#endif // defined(TOOLKIT_VIEWS) #endif // defined(TOOLKIT_VIEWS)

View File

@ -142,7 +142,7 @@
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#include "url/gurl.h" #include "url/gurl.h"
#if defined(OS_POSIX) && !defined(OS_MAC) #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
#include "base/debug/leak_annotations.h" #include "base/debug/leak_annotations.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "components/crash/content/browser/crash_handler_host_linux.h" #include "components/crash/content/browser/crash_handler_host_linux.h"
@ -150,12 +150,12 @@
#include "content/public/common/content_descriptors.h" #include "content/public/common/content_descriptors.h"
#endif #endif
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "net/ssl/client_cert_store_mac.h" #include "net/ssl/client_cert_store_mac.h"
#include "services/video_capture/public/mojom/constants.mojom.h" #include "services/video_capture/public/mojom/constants.mojom.h"
#endif #endif
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "net/ssl/client_cert_store_win.h" #include "net/ssl/client_cert_store_win.h"
#include "sandbox/win/src/sandbox_policy.h" #include "sandbox/win/src/sandbox_policy.h"
#endif #endif
@ -407,7 +407,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
~CefQuotaPermissionContext() override = default; ~CefQuotaPermissionContext() override = default;
}; };
#if defined(OS_POSIX) && !defined(OS_MAC) #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
const std::string& process_type) { const std::string& process_type) {
base::FilePath dumps_path; base::FilePath dumps_path;
@ -462,7 +462,7 @@ int GetCrashSignalFD(const base::CommandLine& command_line) {
return -1; return -1;
} }
#endif // defined(OS_POSIX) && !defined(OS_MAC) #endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
// From chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc. // From chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc.
void BindPluginInfoHost( void BindPluginInfoHost(
@ -740,7 +740,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
// associated values) if present in the browser command line. // associated values) if present in the browser command line.
static const char* const kSwitchNames[] = { static const char* const kSwitchNames[] = {
switches::kDisablePackLoading, switches::kDisablePackLoading,
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
switches::kFrameworkDirPath, switches::kFrameworkDirPath,
switches::kMainBundlePath, switches::kMainBundlePath,
#endif #endif
@ -776,13 +776,13 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
if (extensions::ExtensionsEnabled()) { if (extensions::ExtensionsEnabled()) {
content::RenderProcessHost* process = content::RenderProcessHost* process =
content::RenderProcessHost::FromID(child_process_id); content::RenderProcessHost::FromID(child_process_id);
#if !defined(OS_WIN) #if !BUILDFLAG(IS_WIN)
// kPdfRenderer will be set for Windows in // kPdfRenderer will be set for Windows in
// RenderProcessHostImpl::AppendRendererCommandLine. // RenderProcessHostImpl::AppendRendererCommandLine.
if (process && process->IsPdf()) { if (process && process->IsPdf()) {
command_line->AppendSwitch(switches::kPdfRenderer); command_line->AppendSwitch(switches::kPdfRenderer);
} }
#endif // !defined(OS_WIN) #endif // !BUILDFLAG(IS_WIN)
auto browser_context = process->GetBrowserContext(); auto browser_context = process->GetBrowserContext();
CefBrowserContext* cef_browser_context = CefBrowserContext* cef_browser_context =
@ -818,7 +818,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
} }
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
if (process_type == switches::kZygoteProcess) { if (process_type == switches::kZygoteProcess) {
if (browser_cmd->HasSwitch(switches::kBrowserSubprocessPath)) { if (browser_cmd->HasSwitch(switches::kBrowserSubprocessPath)) {
// Force use of the sub-process executable path for the zygote process. // Force use of the sub-process executable path for the zygote process.
@ -836,7 +836,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames, command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames)); base::size(kSwitchNames));
} }
#endif // defined(OS_LINUX) #endif // BUILDFLAG(IS_LINUX)
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication(); CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
if (app.get()) { if (app.get()) {
@ -1151,7 +1151,7 @@ AlloyContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
return interceptors; return interceptors;
} }
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess( void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line, const base::CommandLine& command_line,
int child_process_id, int child_process_id,
@ -1161,7 +1161,7 @@ void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
mappings->Share(kCrashDumpSignal, crash_signal_fd); mappings->Share(kCrashDumpSignal, crash_signal_fd);
} }
} }
#endif // defined(OS_LINUX) #endif // BUILDFLAG(IS_LINUX)
void AlloyContentBrowserClient::ExposeInterfacesToRenderer( void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry, service_manager::BinderRegistry* registry,
@ -1187,9 +1187,9 @@ AlloyContentBrowserClient::CreateClientCertStore(
// TODO: Add support for client implementation of crypto password dialog. // TODO: Add support for client implementation of crypto password dialog.
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(
net::ClientCertStoreNSS::PasswordDelegateFactory())); net::ClientCertStoreNSS::PasswordDelegateFactory()));
#elif defined(OS_WIN) #elif BUILDFLAG(IS_WIN)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin());
#elif defined(OS_MAC) #elif BUILDFLAG(IS_MAC)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac());
#else #else
#error Unknown platform. #error Unknown platform.

View File

@ -140,7 +140,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
const scoped_refptr<network::SharedURLLoaderFactory>& const scoped_refptr<network::SharedURLLoaderFactory>&
network_loader_factory) override; network_loader_factory) override;
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
void GetAdditionalMappedFilesForChildProcess( void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line, const base::CommandLine& command_line,
int child_process_id, int child_process_id,

View File

@ -31,9 +31,9 @@ void RunFileChooser(content::WebContents* web_contents,
// Based on net/base/filename_util_internal.cc FilePathToString16(). // Based on net/base/filename_util_internal.cc FilePathToString16().
std::u16string FilePathTypeToString16(const base::FilePath::StringType& str) { std::u16string FilePathTypeToString16(const base::FilePath::StringType& str) {
std::u16string result; std::u16string result;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
result.assign(str.begin(), str.end()); result.assign(str.begin(), str.end());
#elif defined(OS_POSIX) || defined(OS_FUCHSIA) #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
if (!str.empty()) { if (!str.empty()) {
base::UTF8ToUTF16(str.c_str(), str.size(), &result); base::UTF8ToUTF16(str.c_str(), str.size(), &result);
} }

View File

@ -257,7 +257,7 @@ void CefBrowserPlatformDelegateAlloy::SendCaptureLostEvent() {
widget->LostCapture(); widget->LostCapture();
} }
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() { void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() {
if (!browser_) if (!browser_)
return; return;

View File

@ -43,7 +43,7 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
extensions::ExtensionHost* GetExtensionHost() const override; extensions::ExtensionHost* GetExtensionHost() const override;
void BrowserDestroyed(CefBrowserHostBase* browser) override; void BrowserDestroyed(CefBrowserHostBase* browser) override;
void SendCaptureLostEvent() override; void SendCaptureLostEvent() override;
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
void NotifyMoveOrResizeStarted() override; void NotifyMoveOrResizeStarted() override;
#endif #endif
bool PreHandleGestureEvent(content::WebContents* source, bool PreHandleGestureEvent(content::WebContents* source,

View File

@ -322,7 +322,7 @@ StartupData* ChromeBrowserProcessAlloy::startup_data() {
return nullptr; return nullptr;
} }
#if defined(OS_WIN) || defined(OS_LINUX) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
void ChromeBrowserProcessAlloy::StartAutoupdateTimer() {} void ChromeBrowserProcessAlloy::StartAutoupdateTimer() {}
#endif #endif

View File

@ -90,7 +90,7 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
floc_sorting_lsh_clusters_service() override; floc_sorting_lsh_clusters_service() override;
StartupData* startup_data() override; StartupData* startup_data() override;
#if defined(OS_WIN) || defined(OS_LINUX) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
void StartAutoupdateTimer() override; void StartAutoupdateTimer() override;
#endif #endif

View File

@ -25,7 +25,7 @@
#include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_entry.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "components/spellcheck/browser/spellcheck_platform.h" #include "components/spellcheck/browser/spellcheck_platform.h"
#endif #endif
@ -408,7 +408,7 @@ void CefBrowserHostBase::AddWordToDictionary(const CefString& word) {
if (spellcheck) if (spellcheck)
spellcheck->GetCustomDictionary()->AddWord(word); spellcheck->GetCustomDictionary()->AddWord(word);
} }
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
if (spellcheck && spellcheck::UseBrowserSpellChecker()) { if (spellcheck && spellcheck::UseBrowserSpellChecker()) {
spellcheck_platform::AddWord(spellcheck->platform_spell_checker(), word); spellcheck_platform::AddWord(spellcheck->platform_spell_checker(), word);
} }

View File

@ -131,7 +131,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
std::unique_ptr<CefWindowInfo> window_info(new CefWindowInfo); std::unique_ptr<CefWindowInfo> window_info(new CefWindowInfo);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
window_info->SetAsPopup(nullptr, CefString()); window_info->SetAsPopup(nullptr, CefString());
#endif #endif
@ -154,7 +154,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
CefPopupFeatures cef_features; CefPopupFeatures cef_features;
TranslatePopupFeatures(features, cef_features); TranslatePopupFeatures(features, cef_features);
#if (defined(OS_WIN) || defined(OS_MAC)) #if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC))
// Default to the size from the popup features. // Default to the size from the popup features.
if (cef_features.xSet) if (cef_features.xSet)
window_info->bounds.x = cef_features.x; window_info->bounds.x = cef_features.x;

View File

@ -9,7 +9,7 @@
#include "base/message_loop/message_pump.h" #include "base/message_loop/message_pump.h"
#include "base/message_loop/message_pump_for_ui.h" #include "base/message_loop/message_pump_for_ui.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "base/mac/scoped_nsautorelease_pool.h" #include "base/mac/scoped_nsautorelease_pool.h"
#include "base/message_loop/message_pump_mac.h" #include "base/message_loop/message_pump_mac.h"
#endif #endif
@ -29,7 +29,7 @@ class MessagePumpExternal : public base::MessagePumpForUI {
void Run(Delegate* delegate) override { void Run(Delegate* delegate) override {
base::TimeTicks start = base::TimeTicks::Now(); base::TimeTicks start = base::TimeTicks::Now();
while (true) { while (true) {
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
base::mac::ScopedNSAutoreleasePool autorelease_pool; base::mac::ScopedNSAutoreleasePool autorelease_pool;
#endif #endif
@ -108,7 +108,7 @@ std::unique_ptr<base::MessagePump> MessagePumpFactoryForUI() {
return std::make_unique<MessagePumpExternal>(0.01f, handler); return std::make_unique<MessagePumpExternal>(0.01f, handler);
} }
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
return base::MessagePumpMac::Create(); return base::MessagePumpMac::Create();
#else #else
return std::make_unique<base::MessagePumpForUI>(); return std::make_unique<base::MessagePumpForUI>();

View File

@ -180,7 +180,7 @@ void CefBrowserPlatformDelegate::SendCaptureLostEvent() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
void CefBrowserPlatformDelegate::NotifyMoveOrResizeStarted() {} void CefBrowserPlatformDelegate::NotifyMoveOrResizeStarted() {}
void CefBrowserPlatformDelegate::SizeTo(int width, int height) {} void CefBrowserPlatformDelegate::SizeTo(int width, int height) {}

View File

@ -234,7 +234,7 @@ class CefBrowserPlatformDelegate {
// Send capture lost event. // Send capture lost event.
virtual void SendCaptureLostEvent(); virtual void SendCaptureLostEvent();
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
// The window hosting the browser is about to be moved or resized. Only used // The window hosting the browser is about to be moved or resized. Only used
// on Windows and Linux. // on Windows and Linux.
virtual void NotifyMoveOrResizeStarted(); virtual void NotifyMoveOrResizeStarted();

View File

@ -16,13 +16,13 @@
#include "libcef/browser/extensions/browser_platform_delegate_background.h" #include "libcef/browser/extensions/browser_platform_delegate_background.h"
#include "libcef/features/runtime_checks.h" #include "libcef/features/runtime_checks.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "libcef/browser/native/browser_platform_delegate_native_win.h" #include "libcef/browser/native/browser_platform_delegate_native_win.h"
#include "libcef/browser/osr/browser_platform_delegate_osr_win.h" #include "libcef/browser/osr/browser_platform_delegate_osr_win.h"
#elif defined(OS_MAC) #elif BUILDFLAG(IS_MAC)
#include "libcef/browser/native/browser_platform_delegate_native_mac.h" #include "libcef/browser/native/browser_platform_delegate_native_mac.h"
#include "libcef/browser/osr/browser_platform_delegate_osr_mac.h" #include "libcef/browser/osr/browser_platform_delegate_osr_mac.h"
#elif defined(OS_LINUX) #elif BUILDFLAG(IS_LINUX)
#include "libcef/browser/native/browser_platform_delegate_native_linux.h" #include "libcef/browser/native/browser_platform_delegate_native_linux.h"
#include "libcef/browser/osr/browser_platform_delegate_osr_linux.h" #include "libcef/browser/osr/browser_platform_delegate_osr_linux.h"
#else #else
@ -39,13 +39,13 @@ namespace {
std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate( std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
const CefWindowInfo& window_info, const CefWindowInfo& window_info,
SkColor background_color) { SkColor background_color) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
return std::make_unique<CefBrowserPlatformDelegateNativeWin>( return std::make_unique<CefBrowserPlatformDelegateNativeWin>(
window_info, background_color); window_info, background_color);
#elif defined(OS_MAC) #elif BUILDFLAG(IS_MAC)
return std::make_unique<CefBrowserPlatformDelegateNativeMac>( return std::make_unique<CefBrowserPlatformDelegateNativeMac>(
window_info, background_color); window_info, background_color);
#elif defined(OS_LINUX) #elif BUILDFLAG(IS_LINUX)
return std::make_unique<CefBrowserPlatformDelegateNativeLinux>( return std::make_unique<CefBrowserPlatformDelegateNativeLinux>(
window_info, background_color); window_info, background_color);
#endif #endif
@ -55,13 +55,13 @@ std::unique_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate(
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate, std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate,
bool use_shared_texture, bool use_shared_texture,
bool use_external_begin_frame) { bool use_external_begin_frame) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
return std::make_unique<CefBrowserPlatformDelegateOsrWin>( return std::make_unique<CefBrowserPlatformDelegateOsrWin>(
std::move(native_delegate), use_shared_texture, use_external_begin_frame); std::move(native_delegate), use_shared_texture, use_external_begin_frame);
#elif defined(OS_MAC) #elif BUILDFLAG(IS_MAC)
return std::make_unique<CefBrowserPlatformDelegateOsrMac>( return std::make_unique<CefBrowserPlatformDelegateOsrMac>(
std::move(native_delegate)); std::move(native_delegate));
#elif defined(OS_LINUX) #elif BUILDFLAG(IS_LINUX)
return std::make_unique<CefBrowserPlatformDelegateOsrLinux>( return std::make_unique<CefBrowserPlatformDelegateOsrLinux>(
std::move(native_delegate), use_external_begin_frame); std::move(native_delegate), use_external_begin_frame);
#endif #endif

View File

@ -118,7 +118,7 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames, command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames)); base::size(kSwitchNames));
#if !defined(OS_WIN) #if !BUILDFLAG(IS_WIN)
// kPdfRenderer will be set for Windows in // kPdfRenderer will be set for Windows in
// RenderProcessHostImpl::AppendRendererCommandLine. // RenderProcessHostImpl::AppendRendererCommandLine.
content::RenderProcessHost* process = content::RenderProcessHost* process =
@ -126,7 +126,7 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
if (process && process->IsPdf()) { if (process && process->IsPdf()) {
command_line->AppendSwitch(switches::kPdfRenderer); command_line->AppendSwitch(switches::kPdfRenderer);
} }
#endif // !defined(OS_WIN) #endif // !BUILDFLAG(IS_WIN)
} }
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication(); CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();

View File

@ -5,11 +5,11 @@
#include "build/build_config.h" #include "build/build_config.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "chrome/app/chrome_crash_reporter_client.h" #include "chrome/app/chrome_crash_reporter_client.h"
// Required due to https://crrev.com/1c9f89a06f // Required due to https://crrev.com/1c9f89a06f
void ChromeCrashReporterClient::Create() {} void ChromeCrashReporterClient::Create() {}
#endif // defined(OS_MAC) #endif // BUILDFLAG(IS_MAC)

View File

@ -20,7 +20,7 @@
#include "content/public/browser/notification_types.h" #include "content/public/browser/notification_types.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/chrome_elf/chrome_elf_main.h" #include "chrome/chrome_elf/chrome_elf_main.h"
#include "chrome/install_static/initialize_from_primary_module.h" #include "chrome/install_static/initialize_from_primary_module.h"
@ -38,7 +38,7 @@ class CefShutdownChecker {
} g_shutdown_checker; } g_shutdown_checker;
#endif // DCHECK_IS_ON() #endif // DCHECK_IS_ON()
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(ARCH_CPU_X86_64) #if defined(ARCH_CPU_X86_64)
// VS2013 only checks the existence of FMA3 instructions, not the enabled-ness // VS2013 only checks the existence of FMA3 instructions, not the enabled-ness
// of them at the OS level (this is fixed in VS2015). We force off usage of // of them at the OS level (this is fixed in VS2015). We force off usage of
@ -72,7 +72,7 @@ void InitCrashReporter() {
initialized = true; initialized = true;
SignalInitializeCrashReporting(); SignalInitializeCrashReporting();
} }
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
bool GetColor(const cef_color_t cef_in, bool is_windowless, SkColor* sk_out) { bool GetColor(const cef_color_t cef_in, bool is_windowless, SkColor* sk_out) {
// Windowed browser colors must be fully opaque. // Windowed browser colors must be fully opaque.
@ -117,7 +117,7 @@ base::FilePath NormalizePath(const cef_string_t& path_str,
} }
void SetPath(cef_string_t& path_str, const base::FilePath& path) { void SetPath(cef_string_t& path_str, const base::FilePath& path) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
CefString(&path_str).FromWString(path.value()); CefString(&path_str).FromWString(path.value());
#else #else
CefString(&path_str).FromString(path.value()); CefString(&path_str).FromString(path.value());
@ -175,7 +175,7 @@ base::FilePath NormalizeCachePathAndSet(cef_string_t& path_str,
int CefExecuteProcess(const CefMainArgs& args, int CefExecuteProcess(const CefMainArgs& args,
CefRefPtr<CefApp> application, CefRefPtr<CefApp> application,
void* windows_sandbox_info) { void* windows_sandbox_info) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(ARCH_CPU_X86_64) #if defined(ARCH_CPU_X86_64)
DisableFMA3(); DisableFMA3();
#endif #endif
@ -191,7 +191,7 @@ bool CefInitialize(const CefMainArgs& args,
const CefSettings& settings, const CefSettings& settings,
CefRefPtr<CefApp> application, CefRefPtr<CefApp> application,
void* windows_sandbox_info) { void* windows_sandbox_info) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(ARCH_CPU_X86_64) #if defined(ARCH_CPU_X86_64)
DisableFMA3(); DisableFMA3();
#endif #endif
@ -287,7 +287,7 @@ void CefQuitMessageLoop() {
} }
void CefSetOSModalLoop(bool osModalLoop) { void CefSetOSModalLoop(bool osModalLoop) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Verify that the context is in a valid state. // Verify that the context is in a valid state.
if (!CONTEXT_STATE_VALID()) { if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid"; NOTREACHED() << "context not valid";
@ -300,7 +300,7 @@ void CefSetOSModalLoop(bool osModalLoop) {
} }
base::CurrentThread::Get()->set_os_modal_loop(osModalLoop); base::CurrentThread::Get()->set_os_modal_loop(osModalLoop);
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
} }
// CefContext // CefContext
@ -323,14 +323,14 @@ bool CefContext::Initialize(const CefMainArgs& args,
settings_ = settings; settings_ = settings;
application_ = application; application_ = application;
#if !(defined(OS_WIN) || defined(OS_LINUX)) #if !(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX))
if (settings.multi_threaded_message_loop) { if (settings.multi_threaded_message_loop) {
NOTIMPLEMENTED() << "multi_threaded_message_loop is not supported."; NOTIMPLEMENTED() << "multi_threaded_message_loop is not supported.";
return false; return false;
} }
#endif #endif
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Signal Chrome Elf that Chrome has begun to start. // Signal Chrome Elf that Chrome has begun to start.
SignalChromeElf(); SignalChromeElf();
#endif #endif

View File

@ -57,9 +57,9 @@
#include "services/network/public/mojom/url_response_head.mojom.h" #include "services/network/public/mojom/url_response_head.mojom.h"
#include "storage/browser/file_system/native_file_util.h" #include "storage/browser/file_system/native_file_util.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include <windows.h> #include <windows.h>
#elif defined(OS_POSIX) #elif BUILDFLAG(IS_POSIX)
#include <time.h> #include <time.h>
#endif #endif
@ -106,7 +106,7 @@ base::DictionaryValue BuildObjectForResponse(const net::HttpResponseHeaders* rh,
} }
void WriteTimestamp(std::stringstream& stream) { void WriteTimestamp(std::stringstream& stream) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
SYSTEMTIME local_time; SYSTEMTIME local_time;
GetLocalTime(&local_time); GetLocalTime(&local_time);
stream << std::setfill('0') << std::setw(2) << local_time.wMonth stream << std::setfill('0') << std::setw(2) << local_time.wMonth
@ -114,7 +114,7 @@ void WriteTimestamp(std::stringstream& stream) {
<< local_time.wHour << std::setw(2) << local_time.wMinute << local_time.wHour << std::setw(2) << local_time.wMinute
<< std::setw(2) << local_time.wSecond << '.' << std::setw(3) << std::setw(2) << local_time.wSecond << '.' << std::setw(3)
<< local_time.wMilliseconds; << local_time.wMilliseconds;
#elif defined(OS_POSIX) #elif BUILDFLAG(IS_POSIX)
timeval tv; timeval tv;
gettimeofday(&tv, nullptr); gettimeofday(&tv, nullptr);
time_t t = tv.tv_sec; time_t t = tv.tv_sec;

View File

@ -361,7 +361,7 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab(
create_params.request_context = request_context; create_params.request_context = request_context;
create_params.window_info.reset(new CefWindowInfo); create_params.window_info.reset(new CefWindowInfo);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
create_params.window_info->SetAsPopup(nullptr, CefString()); create_params.window_info->SetAsPopup(nullptr, CefString());
#endif #endif

View File

@ -2,18 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "libcef/browser/extensions/chrome_api_registration.h"
#include "libcef/browser/extensions/extensions_browser_api_provider.h" #include "libcef/browser/extensions/extensions_browser_api_provider.h"
#include "libcef/browser/extensions/chrome_api_registration.h"
//#include "cef/libcef/browser/extensions/api/generated_api_registration.h" //#include "cef/libcef/browser/extensions/api/generated_api_registration.h"
#include "extensions/browser/api/generated_api_registration.h" #include "extensions/browser/api/generated_api_registration.h"
namespace extensions { namespace extensions {
CefExtensionsBrowserAPIProvider::CefExtensionsBrowserAPIProvider() = CefExtensionsBrowserAPIProvider::CefExtensionsBrowserAPIProvider() = default;
default; CefExtensionsBrowserAPIProvider::~CefExtensionsBrowserAPIProvider() = default;
CefExtensionsBrowserAPIProvider::~CefExtensionsBrowserAPIProvider() =
default;
void CefExtensionsBrowserAPIProvider::RegisterExtensionFunctions( void CefExtensionsBrowserAPIProvider::RegisterExtensionFunctions(
ExtensionFunctionRegistry* registry) { ExtensionFunctionRegistry* registry) {

View File

@ -38,7 +38,7 @@ template <typename Interface>
class FrameServiceBase : public Interface, public WebContentsObserver { class FrameServiceBase : public Interface, public WebContentsObserver {
public: public:
FrameServiceBase(RenderFrameHost* render_frame_host, FrameServiceBase(RenderFrameHost* render_frame_host,
mojo::PendingReceiver<Interface> pending_receiver) mojo::PendingReceiver<Interface> pending_receiver)
: WebContentsObserver( : WebContentsObserver(
WebContents::FromRenderFrameHost(render_frame_host)), WebContents::FromRenderFrameHost(render_frame_host)),
render_frame_host_(render_frame_host), render_frame_host_(render_frame_host),

View File

@ -13,7 +13,7 @@
#include "ui/gl/gl_surface_egl.h" #include "ui/gl/gl_surface_egl.h"
#include "ui/gl/init/gl_factory.h" #include "ui/gl/init/gl_factory.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include <d3d11_1.h> #include <d3d11_1.h>
#include "ui/gl/gl_angle_util_win.h" #include "ui/gl/gl_angle_util_win.h"
#include "ui/gl/gl_image_dxgi.h" #include "ui/gl/gl_image_dxgi.h"
@ -29,7 +29,7 @@ namespace gles2 {
namespace { namespace {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
class GLImageDXGISharedHandle : public gl::GLImageDXGI { class GLImageDXGISharedHandle : public gl::GLImageDXGI {
public: public:
@ -134,7 +134,7 @@ class GLImageDXGISharedHandle : public gl::GLImageDXGI {
GLuint texture_id_; GLuint texture_id_;
}; };
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
} // namespace } // namespace
@ -148,7 +148,7 @@ void* ExternalTextureManager::CreateTexture(GLuint texture_id,
TextureManager* tex_man) { TextureManager* tex_man) {
void* share_handle = nullptr; void* share_handle = nullptr;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay();
if (egl_display == EGL_NO_DISPLAY) { if (egl_display == EGL_NO_DISPLAY) {
return nullptr; return nullptr;
@ -259,36 +259,36 @@ void* ExternalTextureManager::CreateTexture(GLuint texture_id,
eglMakeCurrent(egl_display, drawSurface, readSurface, curContext); eglMakeCurrent(egl_display, drawSurface, readSurface, curContext);
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
return share_handle; return share_handle;
} }
void ExternalTextureManager::LockTexture(void* handle) { void ExternalTextureManager::LockTexture(void* handle) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
auto const img = surfaceMap_.find(handle); auto const img = surfaceMap_.find(handle);
if (img != surfaceMap_.end()) { if (img != surfaceMap_.end()) {
GLImageDXGISharedHandle* dxgi_image = GLImageDXGISharedHandle* dxgi_image =
reinterpret_cast<GLImageDXGISharedHandle*>(img->second.get()); reinterpret_cast<GLImageDXGISharedHandle*>(img->second.get());
dxgi_image->Lock(); dxgi_image->Lock();
} }
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
} }
void ExternalTextureManager::UnlockTexture(void* handle) { void ExternalTextureManager::UnlockTexture(void* handle) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
auto const img = surfaceMap_.find(handle); auto const img = surfaceMap_.find(handle);
if (img != surfaceMap_.end()) { if (img != surfaceMap_.end()) {
GLImageDXGISharedHandle* dxgi_image = GLImageDXGISharedHandle* dxgi_image =
reinterpret_cast<GLImageDXGISharedHandle*>(img->second.get()); reinterpret_cast<GLImageDXGISharedHandle*>(img->second.get());
dxgi_image->Unlock(); dxgi_image->Unlock();
} }
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
} }
void ExternalTextureManager::DeleteTexture(void* handle, void ExternalTextureManager::DeleteTexture(void* handle,
TextureManager* tex_man) { TextureManager* tex_man) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay();
if (egl_display == EGL_NO_DISPLAY) { if (egl_display == EGL_NO_DISPLAY) {
return; return;
@ -334,7 +334,7 @@ void ExternalTextureManager::DeleteTexture(void* handle,
} }
} }
surfaceMap_.erase(img); surfaceMap_.erase(img);
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
} }
} // namespace gles2 } // namespace gles2

View File

@ -28,14 +28,14 @@
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include <Objbase.h> #include <Objbase.h>
#include <windows.h> #include <windows.h>
#include "content/public/app/sandbox_helper_win.h" #include "content/public/app/sandbox_helper_win.h"
#include "sandbox/win/src/sandbox_types.h" #include "sandbox/win/src/sandbox_types.h"
#endif #endif
#if defined(OS_MAC) || defined(OS_WIN) #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
#include "components/crash/core/app/crash_switches.h" #include "components/crash/core/app/crash_switches.h"
#include "third_party/crashpad/crashpad/handler/handler_main.h" #include "third_party/crashpad/crashpad/handler/handler_main.h"
#endif #endif
@ -65,7 +65,7 @@ std::unique_ptr<CefMainRunnerDelegate> MakeDelegate(
} }
} }
#if defined(OS_MAC) || defined(OS_WIN) #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
// Based on components/crash/core/app/run_as_crashpad_handler_win.cc // Based on components/crash/core/app/run_as_crashpad_handler_win.cc
// Remove the "--type=crashpad-handler" command-line flag that will otherwise // Remove the "--type=crashpad-handler" command-line flag that will otherwise
@ -88,7 +88,7 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) {
}), }),
argv.end()); argv.end());
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
// HandlerMain on macOS uses the system version of getopt_long which expects // HandlerMain on macOS uses the system version of getopt_long which expects
// the first argument to be the program name. // the first argument to be the program name.
argv.insert(argv.begin(), command_line.GetProgram().value()); argv.insert(argv.begin(), command_line.GetProgram().value());
@ -98,7 +98,7 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) {
std::vector<std::string> storage; std::vector<std::string> storage;
storage.reserve(argv.size()); storage.reserve(argv.size());
for (size_t i = 0; i < argv.size(); ++i) { for (size_t i = 0; i < argv.size(); ++i) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
storage.push_back(base::WideToUTF8(argv[i])); storage.push_back(base::WideToUTF8(argv[i]));
#else #else
storage.push_back(argv[i]); storage.push_back(argv[i]);
@ -111,7 +111,7 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) {
argv_as_utf8.get(), nullptr); argv_as_utf8.get(), nullptr);
} }
#endif // defined(OS_MAC) || defined(OS_WIN) #endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
} // namespace } // namespace
@ -171,7 +171,7 @@ class CefUIThread : public base::PlatformThread::Delegate {
void ThreadMain() override { void ThreadMain() override {
base::PlatformThread::SetName("CefUIThread"); base::PlatformThread::SetName("CefUIThread");
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Initializes the COM library on the current thread. // Initializes the COM library on the current thread.
CoInitialize(nullptr); CoInitialize(nullptr);
#endif #endif
@ -190,7 +190,7 @@ class CefUIThread : public base::PlatformThread::Delegate {
// Run exit callbacks on the UI thread to avoid sequence check failures. // Run exit callbacks on the UI thread to avoid sequence check failures.
base::AtExitManager::ProcessCallbacksNow(); base::AtExitManager::ProcessCallbacksNow();
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Closes the COM library on the current thread. CoInitialize must // Closes the COM library on the current thread. CoInitialize must
// be balanced by a corresponding call to CoUninitialize. // be balanced by a corresponding call to CoUninitialize.
CoUninitialize(); CoUninitialize();
@ -301,7 +301,7 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
CefRefPtr<CefApp> application, CefRefPtr<CefApp> application,
void* windows_sandbox_info) { void* windows_sandbox_info) {
base::CommandLine command_line(base::CommandLine::NO_PROGRAM); base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
command_line.ParseFromString(::GetCommandLineW()); command_line.ParseFromString(::GetCommandLineW());
#else #else
command_line.InitFromArgv(args.argc, args.argv); command_line.InitFromArgv(args.argc, args.argv);
@ -327,7 +327,7 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
int result; int result;
#if defined(OS_MAC) || defined(OS_WIN) #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
if (process_type == crash_reporter::switches::kCrashpadHandler) { if (process_type == crash_reporter::switches::kCrashpadHandler) {
result = RunAsCrashpadHandler(command_line); result = RunAsCrashpadHandler(command_line);
main_delegate->AfterExecuteProcess(); main_delegate->AfterExecuteProcess();
@ -338,7 +338,7 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
// Execute the secondary process. // Execute the secondary process.
content::ContentMainParams main_params( content::ContentMainParams main_params(
main_delegate->GetContentMainDelegate()); main_delegate->GetContentMainDelegate());
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
sandbox::SandboxInterfaceInfo sandbox_info = {nullptr}; sandbox::SandboxInterfaceInfo sandbox_info = {nullptr};
if (windows_sandbox_info == nullptr) { if (windows_sandbox_info == nullptr) {
content::InitializeSandboxInfo(&sandbox_info); content::InitializeSandboxInfo(&sandbox_info);
@ -369,7 +369,7 @@ int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
content::ContentMainParams main_params( content::ContentMainParams main_params(
main_delegate_->GetContentMainDelegate()); main_delegate_->GetContentMainDelegate());
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
sandbox::SandboxInterfaceInfo sandbox_info = {nullptr}; sandbox::SandboxInterfaceInfo sandbox_info = {nullptr};
if (windows_sandbox_info == nullptr) { if (windows_sandbox_info == nullptr) {
windows_sandbox_info = &sandbox_info; windows_sandbox_info = &sandbox_info;

View File

@ -49,7 +49,7 @@ bool OnCursorChange(CefBrowserHostBase* browser, const ui::Cursor& ui_cursor) {
handled = handler->OnCursorChange(browser, platform_cursor, cursor_type, handled = handler->OnCursorChange(browser, platform_cursor, cursor_type,
custom_cursor_info); custom_cursor_info);
#elif defined(OS_MAC) #elif BUILDFLAG(IS_MAC)
// |web_cursor| owns the resulting |native_cursor|. // |web_cursor| owns the resulting |native_cursor|.
content::WebCursor web_cursor(ui_cursor); content::WebCursor web_cursor(ui_cursor);
CefCursorHandle native_cursor = web_cursor.GetNativeCursor(); CefCursorHandle native_cursor = web_cursor.GetNativeCursor();

View File

@ -92,7 +92,7 @@ const char* kAllowedWebUIHosts[] = {
chrome::kChromeUIPrintHost, chrome::kChromeUIPrintHost,
content::kChromeUIProcessInternalsHost, content::kChromeUIProcessInternalsHost,
content::kChromeUIResourcesHost, content::kChromeUIResourcesHost,
#if defined(OS_WIN) || defined(OS_LINUX) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
chrome::kChromeUISandboxHost, chrome::kChromeUISandboxHost,
#endif #endif
content::kChromeUIServiceWorkerInternalsHost, content::kChromeUIServiceWorkerInternalsHost,
@ -197,11 +197,11 @@ void GetDebugURLs(std::vector<std::string>* urls) {
} }
std::string GetOSType() { std::string GetOSType() {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
return "Windows"; return "Windows";
#elif defined(OS_MAC) #elif BUILDFLAG(IS_MAC)
return "Mac OS X"; return "Mac OS X";
#elif defined(OS_LINUX) #elif BUILDFLAG(IS_LINUX)
return "Linux"; return "Linux";
#else #else
return "Unknown"; return "Unknown";
@ -209,10 +209,10 @@ std::string GetOSType() {
} }
std::string GetCommandLine() { std::string GetCommandLine() {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
return base::WideToUTF8( return base::WideToUTF8(
base::CommandLine::ForCurrentProcess()->GetCommandLineString()); base::CommandLine::ForCurrentProcess()->GetCommandLineString());
#elif defined(OS_POSIX) #elif BUILDFLAG(IS_POSIX)
std::string command_line = ""; std::string command_line = "";
using ArgvList = std::vector<std::string>; using ArgvList = std::vector<std::string>;
const ArgvList& argv = base::CommandLine::ForCurrentProcess()->argv(); const ArgvList& argv = base::CommandLine::ForCurrentProcess()->argv();

View File

@ -22,7 +22,7 @@ namespace scheme {
namespace { namespace {
base::FilePath FilePathFromASCII(const std::string& str) { base::FilePath FilePathFromASCII(const std::string& str) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
return base::FilePath(base::ASCIIToWide(str)); return base::FilePath(base::ASCIIToWide(str));
#else #else
return base::FilePath(str); return base::FilePath(str);

View File

@ -19,7 +19,7 @@
#include "third_party/skia/src/core/SkDevice.h" #include "third_party/skia/src/core/SkDevice.h"
#include "ui/gfx/skia_util.h" #include "ui/gfx/skia_util.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "skia/ext/skia_utils_win.h" #include "skia/ext/skia_utils_win.h"
#endif #endif
@ -136,7 +136,7 @@ void CefHostDisplayClientOSR::CreateLayeredWindowUpdater(
layered_window_updater_->SetActive(active_); layered_window_updater_->SetActive(active_);
} }
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
void CefHostDisplayClientOSR::DidCompleteSwapWithNewSize( void CefHostDisplayClientOSR::DidCompleteSwapWithNewSize(
const gfx::Size& size) {} const gfx::Size& size) {}
#endif #endif

View File

@ -37,7 +37,7 @@ class CefHostDisplayClientOSR : public viz::HostDisplayClient {
mojo::PendingReceiver<viz::mojom::LayeredWindowUpdater> receiver) mojo::PendingReceiver<viz::mojom::LayeredWindowUpdater> receiver)
override; override;
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
void DidCompleteSwapWithNewSize(const gfx::Size& size) override; void DidCompleteSwapWithNewSize(const gfx::Size& size) override;
#endif #endif

View File

@ -729,7 +729,7 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
return GetViewBounds(); return GetViewBounds();
} }
#if !defined(OS_MAC) #if !BUILDFLAG(IS_MAC)
viz::ScopedSurfaceIdAllocator viz::ScopedSurfaceIdAllocator
CefRenderWidgetHostViewOSR::DidUpdateVisualProperties( CefRenderWidgetHostViewOSR::DidUpdateVisualProperties(
const cc::RenderFrameMetadata& metadata) { const cc::RenderFrameMetadata& metadata) {
@ -1418,7 +1418,7 @@ gfx::Size CefRenderWidgetHostViewOSR::SizeInPixels() {
return gfx::ScaleToCeiledSize(GetViewBounds().size(), GetDeviceScaleFactor()); return gfx::ScaleToCeiledSize(GetViewBounds().size(), GetDeviceScaleFactor());
} }
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
void CefRenderWidgetHostViewOSR::SetActive(bool active) {} void CefRenderWidgetHostViewOSR::SetActive(bool active) {}
void CefRenderWidgetHostViewOSR::ShowDefinitionForSelection() {} void CefRenderWidgetHostViewOSR::ShowDefinitionForSelection() {}
@ -1436,7 +1436,7 @@ void CefRenderWidgetHostViewOSR::ShowSharePicker(
blink::mojom::ShareService::ShareCallback callback) { blink::mojom::ShareService::ShareCallback callback) {
std::move(callback).Run(blink::mojom::ShareError::INTERNAL_ERROR); std::move(callback).Run(blink::mojom::ShareError::INTERNAL_ERROR);
} }
#endif // defined(OS_MAC) #endif // BUILDFLAG(IS_MAC)
void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect, void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
const gfx::Size& pixel_size, const gfx::Size& pixel_size,

View File

@ -39,11 +39,11 @@
#include "ui/events/gesture_detection/motion_event_generic.h" #include "ui/events/gesture_detection/motion_event_generic.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "content/browser/renderer_host/browser_compositor_view_mac.h" #include "content/browser/renderer_host/browser_compositor_view_mac.h"
#endif #endif
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "ui/gfx/win/window_impl.h" #include "ui/gfx/win/window_impl.h"
#endif #endif
@ -80,7 +80,7 @@ class CefWebContentsViewOSR;
// RenderWidgetHostView class hierarchy described in render_widget_host_view.h. // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
class MacHelper; class MacHelper;
#endif #endif
@ -132,7 +132,7 @@ class CefRenderWidgetHostViewOSR
void UnlockMouse() override; void UnlockMouse() override;
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override; void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
void SetActive(bool active) override; void SetActive(bool active) override;
void ShowDefinitionForSelection() override; void ShowDefinitionForSelection() override;
void SpeakSelection() override; void SpeakSelection() override;
@ -143,7 +143,7 @@ class CefRenderWidgetHostViewOSR
const std::string& url, const std::string& url,
const std::vector<std::string>& file_paths, const std::vector<std::string>& file_paths,
blink::mojom::ShareService::ShareCallback callback) override; blink::mojom::ShareService::ShareCallback callback) override;
#endif // defined(OS_MAC) #endif // BUILDFLAG(IS_MAC)
// RenderWidgetHostViewBase implementation. // RenderWidgetHostViewBase implementation.
void ResetFallbackToFirstNavigationSurface() override; void ResetFallbackToFirstNavigationSurface() override;
@ -165,7 +165,7 @@ class CefRenderWidgetHostViewOSR
void TransformPointToRootSurface(gfx::PointF* point) override; void TransformPointToRootSurface(gfx::PointF* point) override;
gfx::Rect GetBoundsInRootWindow() override; gfx::Rect GetBoundsInRootWindow() override;
#if !defined(OS_MAC) #if !BUILDFLAG(IS_MAC)
viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties( viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(
const cc::RenderFrameMetadata& metadata) override; const cc::RenderFrameMetadata& metadata) override;
#endif #endif

View File

@ -12,7 +12,7 @@
#include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkCanvas.h"
#include "ui/gfx/skia_util.h" #include "ui/gfx/skia_util.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include <windows.h> #include <windows.h>
#include "skia/ext/skia_utils_win.h" #include "skia/ext/skia_utils_win.h"
#include "ui/gfx/gdi_util.h" #include "ui/gfx/gdi_util.h"
@ -72,7 +72,7 @@ void SoftwareOutputDeviceProxy::Resize(const gfx::Size& viewport_pixel_size,
return; return;
} }
#if !defined(OS_WIN) #if !BUILDFLAG(IS_WIN)
auto shm = base::ReadOnlySharedMemoryRegion::Create(required_bytes); auto shm = base::ReadOnlySharedMemoryRegion::Create(required_bytes);
if (!shm.IsValid()) { if (!shm.IsValid()) {
DLOG(ERROR) << "Failed to allocate " << required_bytes << " bytes"; DLOG(ERROR) << "Failed to allocate " << required_bytes << " bytes";

View File

@ -142,11 +142,11 @@ void CefWebContentsViewOSR::SetOverscrollControllerEnabled(bool enabled) {}
void CefWebContentsViewOSR::OnCapturerCountChanged() {} void CefWebContentsViewOSR::OnCapturerCountChanged() {}
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
bool CefWebContentsViewOSR::CloseTabAfterEventTrackingIfNeeded() { bool CefWebContentsViewOSR::CloseTabAfterEventTrackingIfNeeded() {
return false; return false;
} }
#endif // defined(OS_MAC) #endif // BUILDFLAG(IS_MAC)
void CefWebContentsViewOSR::StartDragging( void CefWebContentsViewOSR::StartDragging(
const content::DropData& drop_data, const content::DropData& drop_data,

View File

@ -61,7 +61,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
void SetOverscrollControllerEnabled(bool enabled) override; void SetOverscrollControllerEnabled(bool enabled) override;
void OnCapturerCountChanged() override; void OnCapturerCountChanged() override;
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
bool CloseTabAfterEventTrackingIfNeeded() override; bool CloseTabAfterEventTrackingIfNeeded() override;
#endif #endif

View File

@ -31,7 +31,7 @@ bool CefGetPath(PathKey key, CefString& path) {
case PK_FILE_MODULE: case PK_FILE_MODULE:
pref_key = base::FILE_MODULE; pref_key = base::FILE_MODULE;
break; break;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
case PK_LOCAL_APP_DATA: case PK_LOCAL_APP_DATA:
pref_key = base::DIR_LOCAL_APP_DATA; pref_key = base::DIR_LOCAL_APP_DATA;
break; break;

View File

@ -65,7 +65,7 @@
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "components/os_crypt/os_crypt.h" #include "components/os_crypt/os_crypt.h"
#endif #endif
@ -233,7 +233,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
if (!profile) { if (!profile) {
component_updater::RegisterComponentUpdateServicePrefs(registry.get()); component_updater::RegisterComponentUpdateServicePrefs(registry.get());
SystemNetworkContextManager::RegisterPrefs(registry.get()); SystemNetworkContextManager::RegisterPrefs(registry.get());
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
OSCrypt::RegisterLocalPrefs(registry.get()); OSCrypt::RegisterLocalPrefs(registry.get());
#endif #endif
} }

View File

@ -349,7 +349,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
blink::kWebRTCIPHandlingDefault); blink::kWebRTCIPHandlingDefault);
registry->RegisterStringPref(prefs::kWebRTCUDPPortRange, std::string()); registry->RegisterStringPref(prefs::kWebRTCUDPPortRange, std::string());
#if !defined(OS_MAC) #if !BUILDFLAG(IS_MAC)
registry->RegisterBooleanPref(prefs::kFullscreenAllowed, true); registry->RegisterBooleanPref(prefs::kFullscreenAllowed, true);
#endif #endif

View File

@ -40,7 +40,7 @@
#include "printing/metafile_skia.h" #include "printing/metafile_skia.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
#include "libcef/browser/printing/print_dialog_linux.h" #include "libcef/browser/printing/print_dialog_linux.h"
#endif #endif
@ -231,7 +231,7 @@ bool CefPrintViewManager::PrintToPDF(content::RenderFrameHost* rfh,
void CefPrintViewManager::GetDefaultPrintSettings( void CefPrintViewManager::GetDefaultPrintSettings(
GetDefaultPrintSettingsCallback callback) { GetDefaultPrintSettingsCallback callback) {
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
// Send notification to the client. // Send notification to the client.
auto browser = CefBrowserHostBase::GetBrowserForContents(web_contents()); auto browser = CefBrowserHostBase::GetBrowserForContents(web_contents());
if (browser) { if (browser) {

View File

@ -84,7 +84,7 @@ size_t CefFileReader::Read(void* ptr, size_t size, size_t n) {
int CefFileReader::Seek(int64 offset, int whence) { int CefFileReader::Seek(int64 offset, int whence) {
base::AutoLock lock_scope(lock_); base::AutoLock lock_scope(lock_);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
return _fseeki64(file_, offset, whence); return _fseeki64(file_, offset, whence);
#else #else
return fseek(file_, offset, whence); return fseek(file_, offset, whence);
@ -93,7 +93,7 @@ int CefFileReader::Seek(int64 offset, int whence) {
int64 CefFileReader::Tell() { int64 CefFileReader::Tell() {
base::AutoLock lock_scope(lock_); base::AutoLock lock_scope(lock_);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
return _ftelli64(file_); return _ftelli64(file_);
#else #else
return ftell(file_); return ftell(file_);

View File

@ -16,7 +16,7 @@
#include "ui/views/widget/widget_delegate.h" #include "ui/views/widget/widget_delegate.h"
#include "ui/views/window/non_client_view.h" #include "ui/views/window/non_client_view.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "ui/display/win/screen_win.h" #include "ui/display/win/screen_win.h"
#endif #endif
@ -196,7 +196,7 @@ CefRefPtr<CefWindow> GetWindowFor(views::Widget* widget) {
display::Display GetDisplayNearestPoint(const gfx::Point& point, display::Display GetDisplayNearestPoint(const gfx::Point& point,
bool input_pixel_coords) { bool input_pixel_coords) {
gfx::Point find_point = point; gfx::Point find_point = point;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
if (input_pixel_coords) { if (input_pixel_coords) {
find_point = gfx::ToFlooredPoint( find_point = gfx::ToFlooredPoint(
display::win::ScreenWin::ScreenToDIPPoint(gfx::PointF(point))); display::win::ScreenWin::ScreenToDIPPoint(gfx::PointF(point)));
@ -208,7 +208,7 @@ display::Display GetDisplayNearestPoint(const gfx::Point& point,
display::Display GetDisplayMatchingBounds(const gfx::Rect& bounds, display::Display GetDisplayMatchingBounds(const gfx::Rect& bounds,
bool input_pixel_coords) { bool input_pixel_coords) {
gfx::Rect find_bounds = bounds; gfx::Rect find_bounds = bounds;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
if (input_pixel_coords) { if (input_pixel_coords) {
find_bounds = find_bounds =
display::win::ScreenWin::ScreenToDIPRect(nullptr, find_bounds); display::win::ScreenWin::ScreenToDIPRect(nullptr, find_bounds);

View File

@ -29,7 +29,7 @@
#endif #endif
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "ui/display/win/screen_win.h" #include "ui/display/win/screen_win.h"
#endif #endif
@ -54,7 +54,7 @@ void InitializeUITesting() {
ui_controls::EnableUIControls(); ui_controls::EnableUIControls();
#if defined(USE_AURA) #if defined(USE_AURA)
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
ui_controls::InstallUIControlsAura( ui_controls::InstallUIControlsAura(
aura::test::CreateUIControlsAura(nullptr)); aura::test::CreateUIControlsAura(nullptr));
#elif defined(USE_OZONE) #elif defined(USE_OZONE)
@ -552,7 +552,7 @@ void CefWindowImpl::SendMouseMove(int screen_x, int screen_y) {
InitializeUITesting(); InitializeUITesting();
gfx::Point point(screen_x, screen_y); gfx::Point point(screen_x, screen_y);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Windows expects pixel coordinates. // Windows expects pixel coordinates.
point = display::win::ScreenWin::DIPToScreenPoint(point); point = display::win::ScreenWin::DIPToScreenPoint(point);
#endif #endif

View File

@ -13,14 +13,14 @@
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "ui/views/window/native_frame_view.h" #include "ui/views/window/native_frame_view.h"
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
#include "ui/ozone/buildflags.h" #include "ui/ozone/buildflags.h"
#if BUILDFLAG(OZONE_PLATFORM_X11) #if BUILDFLAG(OZONE_PLATFORM_X11)
#include "ui/base/x/x11_util.h" #include "ui/base/x/x11_util.h"
#endif #endif
#endif #endif
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/views/win/hwnd_util.h" #include "ui/views/win/hwnd_util.h"
#endif #endif
@ -66,7 +66,7 @@ class NativeFrameViewEx : public views::NativeFrameView {
gfx::Rect GetWindowBoundsForClientBounds( gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const override { const gfx::Rect& client_bounds) const override {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// views::GetWindowBoundsForClientBounds() expects the input Rect to be in // views::GetWindowBoundsForClientBounds() expects the input Rect to be in
// pixel coordinates. NativeFrameView does not implement this correctly so // pixel coordinates. NativeFrameView does not implement this correctly so
// we need to provide our own implementation. See http://crbug.com/602692. // we need to provide our own implementation. See http://crbug.com/602692.
@ -235,7 +235,7 @@ class CaptionlessFrameView : public views::NonClientFrameView {
bool IsWindowBorderHit(int code) { bool IsWindowBorderHit(int code) {
// On Windows HTLEFT = 10 and HTBORDER = 18. Values are not ordered the same // On Windows HTLEFT = 10 and HTBORDER = 18. Values are not ordered the same
// in base/hit_test.h for non-Windows platforms. // in base/hit_test.h for non-Windows platforms.
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
return code >= HTLEFT && code <= HTBORDER; return code >= HTLEFT && code <= HTBORDER;
#else #else
return code == HTLEFT || code == HTRIGHT || code == HTTOP || return code == HTLEFT || code == HTRIGHT || code == HTTOP ||
@ -325,7 +325,7 @@ void CefWindowView::CreateWidget() {
params.bounds = gfx::Rect(CalculatePreferredSize()); params.bounds = gfx::Rect(CalculatePreferredSize());
} }
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
if (is_frameless_) { if (is_frameless_) {
// Don't show the native window caption. Setting this value on Linux will // Don't show the native window caption. Setting this value on Linux will
// result in window resize artifacts. // result in window resize artifacts.
@ -346,7 +346,7 @@ void CefWindowView::CreateWidget() {
DCHECK(widget->widget_delegate()->CanActivate()); DCHECK(widget->widget_delegate()->CanActivate());
} }
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
#if BUILDFLAG(OZONE_PLATFORM_X11) #if BUILDFLAG(OZONE_PLATFORM_X11)
if (is_frameless_) { if (is_frameless_) {
auto window = view_util::GetWindowHandle(widget); auto window = view_util::GetWindowHandle(widget);
@ -455,7 +455,7 @@ bool CefWindowView::ShouldDescendIntoChildForEventHandling(
} }
bool CefWindowView::MaybeGetMinimumSize(gfx::Size* size) const { bool CefWindowView::MaybeGetMinimumSize(gfx::Size* size) const {
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
// Resize is disabled on Linux by returning the preferred size as the min/max // Resize is disabled on Linux by returning the preferred size as the min/max
// size. // size.
if (!CanResize()) { if (!CanResize()) {
@ -467,7 +467,7 @@ bool CefWindowView::MaybeGetMinimumSize(gfx::Size* size) const {
} }
bool CefWindowView::MaybeGetMaximumSize(gfx::Size* size) const { bool CefWindowView::MaybeGetMaximumSize(gfx::Size* size) const {
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
// Resize is disabled on Linux by returning the preferred size as the min/max // Resize is disabled on Linux by returning the preferred size as the min/max
// size. // size.
if (!CanResize()) { if (!CanResize()) {

View File

@ -48,11 +48,11 @@
#include "ui/base/ui_base_paths.h" #include "ui/base/ui_base_paths.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "libcef/common/util_mac.h" #include "libcef/common/util_mac.h"
#endif #endif
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "ui/base/resource/resource_bundle_win.h" #include "ui/base/resource/resource_bundle_win.h"
#endif #endif
@ -74,7 +74,7 @@ AlloyMainDelegate::AlloyMainDelegate(CefMainRunnerHandler* runner,
extern void base_impl_stub(); extern void base_impl_stub();
base_impl_stub(); base_impl_stub();
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
resource_util::OverrideAssetPath(); resource_util::OverrideAssetPath();
#endif #endif
} }
@ -90,7 +90,7 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
std::string process_type = std::string process_type =
command_line->GetSwitchValueASCII(switches::kProcessType); command_line->GetSwitchValueASCII(switches::kProcessType);
#if defined(OS_POSIX) #if BUILDFLAG(IS_POSIX)
// Read the crash configuration file. Platforms using Breakpad also add a // Read the crash configuration file. Platforms using Breakpad also add a
// command-line switch. On Windows this is done from chrome_elf. // command-line switch. On Windows this is done from chrome_elf.
crash_reporting::BasicStartupComplete(command_line); crash_reporting::BasicStartupComplete(command_line);
@ -117,7 +117,7 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, command_line->AppendSwitchPath(switches::kBrowserSubprocessPath,
file_path); file_path);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// The sandbox is not supported when using a separate subprocess // The sandbox is not supported when using a separate subprocess
// executable on Windows. // executable on Windows.
no_sandbox = true; no_sandbox = true;
@ -125,7 +125,7 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
} }
} }
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
if (settings_->framework_dir_path.length > 0) { if (settings_->framework_dir_path.length > 0) {
base::FilePath file_path = base::FilePath file_path =
base::FilePath(CefString(&settings_->framework_dir_path)); base::FilePath(CefString(&settings_->framework_dir_path));
@ -243,7 +243,7 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
base::NumberToString(settings_->uncaught_exception_stack_size)); base::NumberToString(settings_->uncaught_exception_stack_size));
} }
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
std::vector<std::string> disable_features; std::vector<std::string> disable_features;
if (features::kCalculateNativeWinOcclusion.default_state == if (features::kCalculateNativeWinOcclusion.default_state ==
@ -271,7 +271,7 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
command_line->AppendSwitchASCII(switches::kDisableFeatures, command_line->AppendSwitchASCII(switches::kDisableFeatures,
disable_features_str); disable_features_str);
} }
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
} }
if (application_) { if (application_) {
@ -335,7 +335,7 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
content::SetContentClient(&content_client_); content::SetContentClient(&content_client_);
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
util_mac::BasicStartupComplete(); util_mac::BasicStartupComplete();
#endif #endif
@ -350,7 +350,7 @@ void AlloyMainDelegate::PreSandboxStartup() {
if (process_type.empty()) { if (process_type.empty()) {
// Only override these paths when executing the main process. // Only override these paths when executing the main process.
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
util_mac::PreSandboxStartup(); util_mac::PreSandboxStartup();
#endif #endif
@ -395,7 +395,7 @@ void AlloyMainDelegate::ProcessExiting(const std::string& process_type) {
ui::ResourceBundle::CleanupSharedInstance(); ui::ResourceBundle::CleanupSharedInstance();
} }
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
void AlloyMainDelegate::ZygoteForked() { void AlloyMainDelegate::ZygoteForked() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
const std::string& process_type = const std::string& process_type =
@ -505,7 +505,7 @@ void AlloyMainDelegate::InitializeResourceBundle() {
base::PathService::Override(ui::DIR_LOCALES, locales_dir); base::PathService::Override(ui::DIR_LOCALES, locales_dir);
} }
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// From chrome/app/chrome_main_delegate.cc // From chrome/app/chrome_main_delegate.cc
// Throbber icons and cursors are still stored in chrome.dll, // Throbber icons and cursors are still stored in chrome.dll,
// this can be killed once those are merged into resources.pak. See // this can be killed once those are merged into resources.pak. See

View File

@ -51,7 +51,7 @@ class AlloyMainDelegate : public content::ContentMainDelegate,
const std::string& process_type, const std::string& process_type,
content::MainFunctionParams main_function_params) override; content::MainFunctionParams main_function_params) override;
void ProcessExiting(const std::string& process_type) override; void ProcessExiting(const std::string& process_type) override;
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
void ZygoteForked() override; void ZygoteForked() override;
#endif #endif
content::ContentBrowserClient* CreateContentBrowserClient() override; content::ContentBrowserClient* CreateContentBrowserClient() override;

View File

@ -13,7 +13,7 @@
#include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/child_process_security_policy.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include <windows.h> #include <windows.h>
#include "base/path_service.h" #include "base/path_service.h"
#endif #endif
@ -90,7 +90,7 @@ void CefAppManager::AddAdditionalSchemes(
scheme_info_list_locked_ = true; scheme_info_list_locked_ = true;
} }
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
const wchar_t* CefAppManager::GetResourceDllName() { const wchar_t* CefAppManager::GetResourceDllName() {
static wchar_t file_path[MAX_PATH + 1] = {0}; static wchar_t file_path[MAX_PATH + 1] = {0};
@ -106,4 +106,4 @@ const wchar_t* CefAppManager::GetResourceDllName() {
return file_path; return file_path;
} }
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)

View File

@ -54,7 +54,7 @@ class CefAppManager {
const CefRequestContextSettings& settings, const CefRequestContextSettings& settings,
base::OnceClosure initialized_cb) = 0; base::OnceClosure initialized_cb) = 0;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Returns the module name (usually libcef.dll). // Returns the module name (usually libcef.dll).
const wchar_t* GetResourceDllName(); const wchar_t* GetResourceDllName();
#endif #endif

View File

@ -12,7 +12,7 @@
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "base/win/win_util.h" #include "base/win/win_util.h"
#endif #endif
@ -341,7 +341,7 @@ CEF_EXPORT cef_platform_thread_id_t cef_get_current_platform_thread_id() {
CEF_EXPORT cef_platform_thread_handle_t CEF_EXPORT cef_platform_thread_handle_t
cef_get_current_platform_thread_handle() { cef_get_current_platform_thread_handle() {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
return base::PlatformThread::CurrentId(); return base::PlatformThread::CurrentId();
#else #else
return base::PlatformThread::CurrentHandle().platform_handle(); return base::PlatformThread::CurrentHandle().platform_handle();
@ -349,7 +349,7 @@ cef_get_current_platform_thread_handle() {
} }
void CefEnableHighDPISupport() { void CefEnableHighDPISupport() {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
base::win::EnableHighDPISupport(); base::win::EnableHighDPISupport();
#endif #endif
} }

View File

@ -131,13 +131,13 @@ const char kUserAgentProductAndVersion[] = "user-agent-product";
const char kDisableRequestHandlingForTesting[] = const char kDisableRequestHandlingForTesting[] =
"disable-request-handling-for-testing"; "disable-request-handling-for-testing";
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
// Path to the framework directory. // Path to the framework directory.
const char kFrameworkDirPath[] = "framework-dir-path"; const char kFrameworkDirPath[] = "framework-dir-path";
const char kMainBundlePath[] = "main-bundle-path"; const char kMainBundlePath[] = "main-bundle-path";
#endif #endif
#if !defined(OS_WIN) #if !BUILDFLAG(IS_WIN)
// Renderer process that runs the non-PPAPI PDF plugin. // Renderer process that runs the non-PPAPI PDF plugin.
// This is defined in content/public/common/content_switches.h for Windows. // This is defined in content/public/common/content_switches.h for Windows.
const char kPdfRenderer[] = "pdf-renderer"; const char kPdfRenderer[] = "pdf-renderer";

View File

@ -57,12 +57,12 @@ extern const char kDisableChromeLoginPrompt[];
extern const char kUserAgentProductAndVersion[]; extern const char kUserAgentProductAndVersion[];
extern const char kDisableRequestHandlingForTesting[]; extern const char kDisableRequestHandlingForTesting[];
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
extern const char kFrameworkDirPath[]; extern const char kFrameworkDirPath[];
extern const char kMainBundlePath[]; extern const char kMainBundlePath[];
#endif #endif
#if !defined(OS_WIN) #if !BUILDFLAG(IS_WIN)
extern const char kPdfRenderer[]; extern const char kPdfRenderer[];
#endif #endif

View File

@ -23,7 +23,7 @@
#include "third_party/blink/public/common/switches.h" #include "third_party/blink/public/common/switches.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "libcef/common/util_mac.h" #include "libcef/common/util_mac.h"
#endif #endif
@ -41,7 +41,7 @@ ChromeMainDelegateCef::ChromeMainDelegateCef(CefMainRunnerHandler* runner,
runner_(runner), runner_(runner),
settings_(settings), settings_(settings),
application_(application) { application_(application) {
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
resource_util::OverrideAssetPath(); resource_util::OverrideAssetPath();
#endif #endif
} }
@ -56,7 +56,7 @@ bool ChromeMainDelegateCef::BasicStartupComplete(int* exit_code) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
#if defined(OS_POSIX) #if BUILDFLAG(IS_POSIX)
// Read the crash configuration file. Platforms using Breakpad also add a // Read the crash configuration file. Platforms using Breakpad also add a
// command-line switch. On Windows this is done from chrome_elf. // command-line switch. On Windows this is done from chrome_elf.
crash_reporting::BasicStartupComplete(command_line); crash_reporting::BasicStartupComplete(command_line);
@ -129,7 +129,7 @@ bool ChromeMainDelegateCef::BasicStartupComplete(int* exit_code) {
ignore_result(commandLinePtr->Detach(nullptr)); ignore_result(commandLinePtr->Detach(nullptr));
} }
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
util_mac::BasicStartupComplete(); util_mac::BasicStartupComplete();
#endif #endif
@ -142,11 +142,11 @@ void ChromeMainDelegateCef::PreSandboxStartup() {
const std::string& process_type = const std::string& process_type =
command_line->GetSwitchValueASCII(switches::kProcessType); command_line->GetSwitchValueASCII(switches::kProcessType);
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
if (process_type.empty()) { if (process_type.empty()) {
util_mac::PreSandboxStartup(); util_mac::PreSandboxStartup();
} }
#endif // defined(OS_MAC) #endif // BUILDFLAG(IS_MAC)
// Since this may be configured via CefSettings we override the value on // Since this may be configured via CefSettings we override the value on
// all platforms. We can't use the default implementation on macOS because // all platforms. We can't use the default implementation on macOS because
@ -180,7 +180,7 @@ ChromeMainDelegateCef::RunProcess(
std::move(main_function_params)); std::move(main_function_params));
} }
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
void ChromeMainDelegateCef::ZygoteForked() { void ChromeMainDelegateCef::ZygoteForked() {
ChromeMainDelegate::ZygoteForked(); ChromeMainDelegate::ZygoteForked();
@ -191,7 +191,7 @@ void ChromeMainDelegateCef::ZygoteForked() {
// Initialize crash reporting state for the newly forked process. // Initialize crash reporting state for the newly forked process.
crash_reporting::ZygoteForked(command_line, process_type); crash_reporting::ZygoteForked(command_line, process_type);
} }
#endif // defined(OS_LINUX) #endif // BUILDFLAG(IS_LINUX)
content::ContentClient* ChromeMainDelegateCef::CreateContentClient() { content::ContentClient* ChromeMainDelegateCef::CreateContentClient() {
return &chrome_content_client_cef_; return &chrome_content_client_cef_;

View File

@ -42,7 +42,7 @@ class ChromeMainDelegateCef : public ChromeMainDelegate,
absl::variant<int, content::MainFunctionParams> RunProcess( absl::variant<int, content::MainFunctionParams> RunProcess(
const std::string& process_type, const std::string& process_type,
content::MainFunctionParams main_function_params) override; content::MainFunctionParams main_function_params) override;
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
void ZygoteForked() override; void ZygoteForked() override;
#endif #endif
content::ContentClient* CreateContentClient() override; content::ContentClient* CreateContentClient() override;

View File

@ -33,7 +33,7 @@ ChromeMainRunnerDelegate::GetContentMainDelegate() {
void ChromeMainRunnerDelegate::BeforeMainThreadInitialize( void ChromeMainRunnerDelegate::BeforeMainThreadInitialize(
const CefMainArgs& args) { const CefMainArgs& args) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
base::CommandLine::Init(0, nullptr); base::CommandLine::Init(0, nullptr);
#else #else
base::CommandLine::Init(args.argc, args.argv); base::CommandLine::Init(args.argc, args.argv);

View File

@ -33,7 +33,7 @@ CefRefPtr<CefCommandLine> CefCommandLineImpl::Copy() {
} }
void CefCommandLineImpl::InitFromArgv(int argc, const char* const* argv) { void CefCommandLineImpl::InitFromArgv(int argc, const char* const* argv) {
#if !defined(OS_WIN) #if !BUILDFLAG(IS_WIN)
CEF_VALUE_VERIFY_RETURN_VOID(true); CEF_VALUE_VERIFY_RETURN_VOID(true);
mutable_value()->InitFromArgv(argc, argv); mutable_value()->InitFromArgv(argc, argv);
#else #else
@ -42,7 +42,7 @@ void CefCommandLineImpl::InitFromArgv(int argc, const char* const* argv) {
} }
void CefCommandLineImpl::InitFromString(const CefString& command_line) { void CefCommandLineImpl::InitFromString(const CefString& command_line) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
CEF_VALUE_VERIFY_RETURN_VOID(true); CEF_VALUE_VERIFY_RETURN_VOID(true);
const std::wstring& str16 = command_line; const std::wstring& str16 = command_line;
mutable_value()->ParseFromString(str16); mutable_value()->ParseFromString(str16);
@ -116,7 +116,7 @@ void CefCommandLineImpl::AppendSwitch(const CefString& name) {
void CefCommandLineImpl::AppendSwitchWithValue(const CefString& name, void CefCommandLineImpl::AppendSwitchWithValue(const CefString& name,
const CefString& value) { const CefString& value) {
CEF_VALUE_VERIFY_RETURN_VOID(true); CEF_VALUE_VERIFY_RETURN_VOID(true);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
mutable_value()->AppendSwitchNative(name.ToString(), value.ToWString()); mutable_value()->AppendSwitchNative(name.ToString(), value.ToWString());
#else #else
mutable_value()->AppendSwitchNative(name.ToString(), value.ToString()); mutable_value()->AppendSwitchNative(name.ToString(), value.ToString());
@ -138,7 +138,7 @@ void CefCommandLineImpl::GetArguments(ArgumentList& arguments) {
void CefCommandLineImpl::AppendArgument(const CefString& argument) { void CefCommandLineImpl::AppendArgument(const CefString& argument) {
CEF_VALUE_VERIFY_RETURN_VOID(true); CEF_VALUE_VERIFY_RETURN_VOID(true);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
mutable_value()->AppendArgNative(argument.ToWString()); mutable_value()->AppendArgNative(argument.ToWString());
#else #else
mutable_value()->AppendArgNative(argument.ToString()); mutable_value()->AppendArgNative(argument.ToString());
@ -147,7 +147,7 @@ void CefCommandLineImpl::AppendArgument(const CefString& argument) {
void CefCommandLineImpl::PrependWrapper(const CefString& wrapper) { void CefCommandLineImpl::PrependWrapper(const CefString& wrapper) {
CEF_VALUE_VERIFY_RETURN_VOID(true); CEF_VALUE_VERIFY_RETURN_VOID(true);
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
mutable_value()->PrependWrapper(wrapper.ToWString()); mutable_value()->PrependWrapper(wrapper.ToWString());
#else #else
mutable_value()->PrependWrapper(wrapper.ToString()); mutable_value()->PrependWrapper(wrapper.ToString());

View File

@ -6,7 +6,7 @@
#include <utility> #include <utility>
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include <windows.h> #include <windows.h>
#endif #endif
@ -22,11 +22,11 @@
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "third_party/crashpad/crashpad/client/annotation.h" #include "third_party/crashpad/crashpad/client/annotation.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "libcef/common/util_mac.h" #include "libcef/common/util_mac.h"
#endif #endif
#if defined(OS_POSIX) #if BUILDFLAG(IS_POSIX)
// Don't use CommandLine, FilePath or PathService on Windows. FilePath has // Don't use CommandLine, FilePath or PathService on Windows. FilePath has
// dependencies outside of kernel32, which is disallowed by chrome_elf. // dependencies outside of kernel32, which is disallowed by chrome_elf.
// CommandLine and PathService depend on global state that will not be // CommandLine and PathService depend on global state that will not be
@ -38,12 +38,12 @@
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#endif #endif
#if defined(OS_POSIX) && !defined(OS_MAC) #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "libcef/common/cef_crash_report_utils.h" #include "libcef/common/cef_crash_report_utils.h"
#endif #endif
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "base/debug/leak_annotations.h" #include "base/debug/leak_annotations.h"
#include "chrome/install_static/install_util.h" #include "chrome/install_static/install_util.h"
#include "components/crash/core/app/crashpad.h" #include "components/crash/core/app/crashpad.h"
@ -51,7 +51,7 @@
namespace { namespace {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
using PathString = std::wstring; using PathString = std::wstring;
const char kPathSep = '\\'; const char kPathSep = '\\';
#else #else
@ -59,7 +59,7 @@ using PathString = std::string;
#endif #endif
PathString GetCrashConfigPath() { PathString GetCrashConfigPath() {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Start with the path to the running executable. // Start with the path to the running executable.
wchar_t module_path[MAX_PATH]; wchar_t module_path[MAX_PATH];
if (GetModuleFileName(nullptr, module_path, MAX_PATH) == 0) if (GetModuleFileName(nullptr, module_path, MAX_PATH) == 0)
@ -75,10 +75,10 @@ PathString GetCrashConfigPath() {
config_path += L"crash_reporter.cfg"; config_path += L"crash_reporter.cfg";
return config_path; return config_path;
#elif defined(OS_POSIX) #elif BUILDFLAG(IS_POSIX)
base::FilePath config_path; base::FilePath config_path;
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
// Start with the path to the main app Resources directory. May be empty if // Start with the path to the main app Resources directory. May be empty if
// not running in an app bundle. // not running in an app bundle.
config_path = util_mac::GetMainResourcesDirectory(); config_path = util_mac::GetMainResourcesDirectory();
@ -91,10 +91,10 @@ PathString GetCrashConfigPath() {
} }
return config_path.Append(FILE_PATH_LITERAL("crash_reporter.cfg")).value(); return config_path.Append(FILE_PATH_LITERAL("crash_reporter.cfg")).value();
#endif // defined(OS_POSIX) #endif // BUILDFLAG(IS_POSIX)
} }
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// On Windows, FAT32 and NTFS both limit filenames to a maximum of 255 // On Windows, FAT32 and NTFS both limit filenames to a maximum of 255
// characters. On POSIX systems, the typical filename length limit is 255 // characters. On POSIX systems, the typical filename length limit is 255
@ -229,7 +229,7 @@ std::string joinPath(const std::string& s1, const std::string& s2) {
// This will only be non-nullptr in the chrome_elf address space. // This will only be non-nullptr in the chrome_elf address space.
CefCrashReporterClient* g_crash_reporter_client = nullptr; CefCrashReporterClient* g_crash_reporter_client = nullptr;
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
const char kKeyMapDelim = ','; const char kKeyMapDelim = ',';
@ -267,7 +267,7 @@ int ParseZeroBasedInt(const std::string& value) {
} // namespace } // namespace
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
extern "C" { extern "C" {
@ -359,7 +359,7 @@ bool CefCrashReporterClient::ReadCrashConfigFile() {
if (config_path.empty()) if (config_path.empty())
return false; return false;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
FILE* fp = _wfopen(config_path.c_str(), L"r"); FILE* fp = _wfopen(config_path.c_str(), L"r");
#else #else
FILE* fp = fopen(config_path.c_str(), "r"); FILE* fp = fopen(config_path.c_str(), "r");
@ -427,7 +427,7 @@ bool CefCrashReporterClient::ReadCrashConfigFile() {
} else if (name_str == "MaxDatabaseAgeInDays") { } else if (name_str == "MaxDatabaseAgeInDays") {
max_db_age_ = ParseZeroBasedInt(val_str); max_db_age_ = ParseZeroBasedInt(val_str);
} }
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
else if (name_str == "ExternalHandler") { else if (name_str == "ExternalHandler") {
if (!val_str.empty()) if (!val_str.empty())
external_handler_ = sanitizePath(val_str); external_handler_ = sanitizePath(val_str);
@ -438,7 +438,7 @@ bool CefCrashReporterClient::ReadCrashConfigFile() {
app_name_ = val_str; app_name_ = val_str;
} }
} }
#elif defined(OS_MAC) #elif BUILDFLAG(IS_MAC)
else if (name_str == "BrowserCrashForwardingEnabled") { else if (name_str == "BrowserCrashForwardingEnabled") {
enable_browser_crash_forwarding_ = ParseBool(val_str); enable_browser_crash_forwarding_ = ParseBool(val_str);
} }
@ -533,7 +533,7 @@ bool CefCrashReporterClient::HasCrashConfigFile() const {
return has_crash_config_file_; return has_crash_config_file_;
} }
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// static // static
void CefCrashReporterClient::InitializeCrashReportingForProcess() { void CefCrashReporterClient::InitializeCrashReportingForProcess() {
@ -600,7 +600,7 @@ bool CefCrashReporterClient::GetCrashMetricsLocation(
return GetDefaultUserDataDirectory(metrics_dir, base::UTF8ToWide(app_name_)); return GetDefaultUserDataDirectory(metrics_dir, base::UTF8ToWide(app_name_));
} }
#elif defined(OS_POSIX) #elif BUILDFLAG(IS_POSIX)
void CefCrashReporterClient::GetProductNameAndVersion(const char** product_name, void CefCrashReporterClient::GetProductNameAndVersion(const char** product_name,
const char** version) { const char** version) {
@ -615,7 +615,7 @@ void CefCrashReporterClient::GetProductNameAndVersion(std::string* product_name,
*version = product_version_; *version = product_version_;
} }
#if !defined(OS_MAC) #if !BUILDFLAG(IS_MAC)
base::FilePath CefCrashReporterClient::GetReporterLogFilename() { base::FilePath CefCrashReporterClient::GetReporterLogFilename() {
return base::FilePath(FILE_PATH_LITERAL("uploads.log")); return base::FilePath(FILE_PATH_LITERAL("uploads.log"));
@ -629,7 +629,7 @@ bool CefCrashReporterClient::EnableBreakpadForProcess(
process_type == switches::kGpuProcess; process_type == switches::kGpuProcess;
} }
#endif // !defined(OS_MAC) #endif // !BUILDFLAG(IS_MAC)
bool CefCrashReporterClient::GetCrashDumpLocation(base::FilePath* crash_dir) { bool CefCrashReporterClient::GetCrashDumpLocation(base::FilePath* crash_dir) {
// By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate
@ -644,7 +644,7 @@ bool CefCrashReporterClient::GetCrashDumpLocation(base::FilePath* crash_dir) {
return base::PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir); return base::PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir);
} }
#endif // !defined(OS_POSIX) #endif // !BUILDFLAG(IS_POSIX)
bool CefCrashReporterClient::GetCollectStatsConsent() { bool CefCrashReporterClient::GetCollectStatsConsent() {
return true; return true;
@ -654,7 +654,7 @@ bool CefCrashReporterClient::GetCollectStatsInSample() {
return true; return true;
} }
#if defined(OS_WIN) || defined(OS_MAC) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
bool CefCrashReporterClient::ReportingIsEnforcedByPolicy( bool CefCrashReporterClient::ReportingIsEnforcedByPolicy(
bool* crashpad_enabled) { bool* crashpad_enabled) {
*crashpad_enabled = true; *crashpad_enabled = true;
@ -662,7 +662,7 @@ bool CefCrashReporterClient::ReportingIsEnforcedByPolicy(
} }
#endif #endif
#if defined(OS_POSIX) && !defined(OS_MAC) #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
bool CefCrashReporterClient::IsRunningUnattended() { bool CefCrashReporterClient::IsRunningUnattended() {
// Crash upload will only be enabled with Breakpad on Linux if this method // Crash upload will only be enabled with Breakpad on Linux if this method
// returns false. // returns false.
@ -697,7 +697,7 @@ void CefCrashReporterClient::GetCrashOptionalArguments(
} }
} }
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
std::wstring CefCrashReporterClient::GetCrashExternalHandler( std::wstring CefCrashReporterClient::GetCrashExternalHandler(
const std::wstring& exe_dir) { const std::wstring& exe_dir) {
@ -713,15 +713,15 @@ bool CefCrashReporterClient::HasCrashExternalHandler() const {
return !external_handler_.empty(); return !external_handler_.empty();
} }
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
bool CefCrashReporterClient::EnableBrowserCrashForwarding() { bool CefCrashReporterClient::EnableBrowserCrashForwarding() {
return enable_browser_crash_forwarding_; return enable_browser_crash_forwarding_;
} }
#endif #endif
#if defined(OS_POSIX) && !defined(OS_MAC) #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
CefCrashReporterClient::ParameterMap CefCrashReporterClient::FilterParameters( CefCrashReporterClient::ParameterMap CefCrashReporterClient::FilterParameters(
const ParameterMap& parameters) { const ParameterMap& parameters) {
return crash_report_utils::FilterParameters(parameters); return crash_report_utils::FilterParameters(parameters);

View File

@ -37,7 +37,7 @@ class CefCrashReporterClient : public crash_reporter::CrashReporterClient {
bool ReadCrashConfigFile(); bool ReadCrashConfigFile();
bool HasCrashConfigFile() const; bool HasCrashConfigFile() const;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
// Called from chrome_elf (chrome_elf/crash/crash_helper.cc) to instantiate // Called from chrome_elf (chrome_elf/crash/crash_helper.cc) to instantiate
// a process wide instance of CefCrashReporterClient and initialize crash // a process wide instance of CefCrashReporterClient and initialize crash
// reporting for the process. The instance is leaked. // reporting for the process. The instance is leaked.
@ -54,43 +54,43 @@ class CefCrashReporterClient : public crash_reporter::CrashReporterClient {
std::wstring* channel_name) override; std::wstring* channel_name) override;
bool GetCrashDumpLocation(std::wstring* crash_dir) override; bool GetCrashDumpLocation(std::wstring* crash_dir) override;
bool GetCrashMetricsLocation(std::wstring* metrics_dir) override; bool GetCrashMetricsLocation(std::wstring* metrics_dir) override;
#elif defined(OS_POSIX) #elif BUILDFLAG(IS_POSIX)
void GetProductNameAndVersion(const char** product_name, void GetProductNameAndVersion(const char** product_name,
const char** version) override; const char** version) override;
void GetProductNameAndVersion(std::string* product_name, void GetProductNameAndVersion(std::string* product_name,
std::string* version, std::string* version,
std::string* channel) override; std::string* channel) override;
#if !defined(OS_MAC) #if !BUILDFLAG(IS_MAC)
base::FilePath GetReporterLogFilename() override; base::FilePath GetReporterLogFilename() override;
bool EnableBreakpadForProcess(const std::string& process_type) override; bool EnableBreakpadForProcess(const std::string& process_type) override;
#endif #endif
bool GetCrashDumpLocation(base::FilePath* crash_dir) override; bool GetCrashDumpLocation(base::FilePath* crash_dir) override;
#endif // defined(OS_POSIX) #endif // BUILDFLAG(IS_POSIX)
// All of these methods must return true to enable crash report upload. // All of these methods must return true to enable crash report upload.
bool GetCollectStatsConsent() override; bool GetCollectStatsConsent() override;
bool GetCollectStatsInSample() override; bool GetCollectStatsInSample() override;
#if defined(OS_WIN) || defined(OS_MAC) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
bool ReportingIsEnforcedByPolicy(bool* crashpad_enabled) override; bool ReportingIsEnforcedByPolicy(bool* crashpad_enabled) override;
#endif #endif
#if defined(OS_POSIX) && !defined(OS_MAC) #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
bool IsRunningUnattended() override; bool IsRunningUnattended() override;
#endif #endif
std::string GetUploadUrl() override; std::string GetUploadUrl() override;
void GetCrashOptionalArguments(std::vector<std::string>* arguments) override; void GetCrashOptionalArguments(std::vector<std::string>* arguments) override;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
std::wstring GetCrashExternalHandler(const std::wstring& exe_dir) override; std::wstring GetCrashExternalHandler(const std::wstring& exe_dir) override;
bool HasCrashExternalHandler() const; bool HasCrashExternalHandler() const;
#endif #endif
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
bool EnableBrowserCrashForwarding() override; bool EnableBrowserCrashForwarding() override;
#endif #endif
#if defined(OS_POSIX) && !defined(OS_MAC) #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
ParameterMap FilterParameters(const ParameterMap& parameters) override; ParameterMap FilterParameters(const ParameterMap& parameters) override;
#endif #endif
@ -120,12 +120,12 @@ class CefCrashReporterClient : public crash_reporter::CrashReporterClient {
std::string product_name_ = "cef"; std::string product_name_ = "cef";
std::string product_version_ = CEF_VERSION; std::string product_version_ = CEF_VERSION;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
std::string app_name_ = "CEF"; std::string app_name_ = "CEF";
std::string external_handler_; std::string external_handler_;
#endif #endif
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
bool enable_browser_crash_forwarding_ = false; bool enable_browser_crash_forwarding_ = false;
#endif #endif
}; };

View File

@ -20,19 +20,19 @@
#include "components/crash/core/common/crash_keys.h" #include "components/crash/core/common/crash_keys.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#include "components/crash/core/app/crashpad.h" #include "components/crash/core/app/crashpad.h"
#include "components/crash/core/common/crash_keys.h" #include "components/crash/core/common/crash_keys.h"
#include "content/public/common/content_paths.h" #include "content/public/common/content_paths.h"
#endif #endif
#if defined(OS_POSIX) #if BUILDFLAG(IS_POSIX)
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "libcef/common/crash_reporter_client.h" #include "libcef/common/crash_reporter_client.h"
#endif #endif
#if defined(OS_POSIX) && !defined(OS_MAC) #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
#include "components/crash/core/app/breakpad_linux.h" #include "components/crash/core/app/breakpad_linux.h"
#include "v8/include/v8-wasm-trap-handler-posix.h" #include "v8/include/v8-wasm-trap-handler-posix.h"
#endif #endif
@ -41,7 +41,7 @@ namespace crash_reporting {
namespace { namespace {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
const base::FilePath::CharType kChromeElfDllName[] = const base::FilePath::CharType kChromeElfDllName[] =
FILE_PATH_LITERAL("chrome_elf.dll"); FILE_PATH_LITERAL("chrome_elf.dll");
@ -84,11 +84,11 @@ bool IsCrashReportingEnabledTrampoline() {
return false; return false;
} }
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
bool g_crash_reporting_enabled = false; bool g_crash_reporting_enabled = false;
#if defined(OS_POSIX) #if BUILDFLAG(IS_POSIX)
base::LazyInstance<CefCrashReporterClient>::Leaky g_crash_reporter_client = base::LazyInstance<CefCrashReporterClient>::Leaky g_crash_reporter_client =
LAZY_INSTANCE_INITIALIZER; LAZY_INSTANCE_INITIALIZER;
@ -100,7 +100,7 @@ void InitCrashReporter(const base::CommandLine& command_line,
crash_reporter::SetCrashReporterClient(crash_client); crash_reporter::SetCrashReporterClient(crash_client);
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
// TODO(mark): Right now, InitializeCrashpad() needs to be called after // TODO(mark): Right now, InitializeCrashpad() needs to be called after
// CommandLine::Init() and configuration of chrome::DIR_CRASH_DUMPS. Ideally, // CommandLine::Init() and configuration of chrome::DIR_CRASH_DUMPS. Ideally,
// Crashpad initialization could occur sooner, preferably even before the // Crashpad initialization could occur sooner, preferably even before the
@ -130,7 +130,7 @@ void InitCrashReporter(const base::CommandLine& command_line,
} }
g_crash_reporting_enabled = true; g_crash_reporting_enabled = true;
#else // !defined(OS_MAC) #else // !BUILDFLAG(IS_MAC)
if (process_type != switches::kZygoteProcess) { if (process_type != switches::kZygoteProcess) {
// Crash reporting for subprocesses created using the zygote will be // Crash reporting for subprocesses created using the zygote will be
@ -139,9 +139,9 @@ void InitCrashReporter(const base::CommandLine& command_line,
g_crash_reporting_enabled = true; g_crash_reporting_enabled = true;
} }
#endif // !defined(OS_MAC) #endif // !BUILDFLAG(IS_MAC)
} }
#endif // defined(OS_POSIX) #endif // BUILDFLAG(IS_POSIX)
// Used to exclude command-line flags from crash reporting. // Used to exclude command-line flags from crash reporting.
bool IsBoringCEFSwitch(const std::string& flag) { bool IsBoringCEFSwitch(const std::string& flag) {
@ -183,19 +183,19 @@ bool SetCrashKeyValue(const base::StringPiece& key,
if (!g_crash_reporting_enabled) if (!g_crash_reporting_enabled)
return false; return false;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
return SetCrashKeyValueTrampoline(key, value); return SetCrashKeyValueTrampoline(key, value);
#else #else
return g_crash_reporter_client.Pointer()->SetCrashKeyValue(key, value); return g_crash_reporter_client.Pointer()->SetCrashKeyValue(key, value);
#endif #endif
} }
#if defined(OS_POSIX) #if BUILDFLAG(IS_POSIX)
// Be aware that logging is not initialized at the time this method is called. // Be aware that logging is not initialized at the time this method is called.
void BasicStartupComplete(base::CommandLine* command_line) { void BasicStartupComplete(base::CommandLine* command_line) {
CefCrashReporterClient* crash_client = g_crash_reporter_client.Pointer(); CefCrashReporterClient* crash_client = g_crash_reporter_client.Pointer();
if (crash_client->ReadCrashConfigFile()) { if (crash_client->ReadCrashConfigFile()) {
#if !defined(OS_MAC) #if !BUILDFLAG(IS_MAC)
// Breakpad requires this switch. // Breakpad requires this switch.
command_line->AppendSwitch(switches::kEnableCrashReporter); command_line->AppendSwitch(switches::kEnableCrashReporter);
@ -207,11 +207,11 @@ void BasicStartupComplete(base::CommandLine* command_line) {
void PreSandboxStartup(const base::CommandLine& command_line, void PreSandboxStartup(const base::CommandLine& command_line,
const std::string& process_type) { const std::string& process_type) {
#if defined(OS_POSIX) #if BUILDFLAG(IS_POSIX)
// Initialize crash reporting here on macOS and Linux. Crash reporting on // Initialize crash reporting here on macOS and Linux. Crash reporting on
// Windows is initialized from context.cc. // Windows is initialized from context.cc.
InitCrashReporter(command_line, process_type); InitCrashReporter(command_line, process_type);
#elif defined(OS_WIN) #elif BUILDFLAG(IS_WIN)
g_crash_reporting_enabled = IsCrashReportingEnabledTrampoline(); g_crash_reporting_enabled = IsCrashReportingEnabledTrampoline();
#endif #endif
@ -227,7 +227,7 @@ void PreSandboxStartup(const base::CommandLine& command_line,
crash_keys::SetSwitchesFromCommandLine(command_line, &IsBoringCEFSwitch); crash_keys::SetSwitchesFromCommandLine(command_line, &IsBoringCEFSwitch);
} }
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MAC) #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_MAC)
void ZygoteForked(base::CommandLine* command_line, void ZygoteForked(base::CommandLine* command_line,
const std::string& process_type) { const std::string& process_type) {
CefCrashReporterClient* crash_client = g_crash_reporter_client.Pointer(); CefCrashReporterClient* crash_client = g_crash_reporter_client.Pointer();

View File

@ -22,14 +22,14 @@ bool SetCrashKeyValue(const base::StringPiece& key,
// Functions are called from similarly named methods in AlloyMainDelegate. // Functions are called from similarly named methods in AlloyMainDelegate.
#if defined(OS_POSIX) #if BUILDFLAG(IS_POSIX)
void BasicStartupComplete(base::CommandLine* command_line); void BasicStartupComplete(base::CommandLine* command_line);
#endif #endif
void PreSandboxStartup(const base::CommandLine& command_line, void PreSandboxStartup(const base::CommandLine& command_line,
const std::string& process_type); const std::string& process_type);
#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MAC) #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_MAC)
void ZygoteForked(base::CommandLine* command_line, void ZygoteForked(base::CommandLine* command_line,
const std::string& process_type); const std::string& process_type);
#endif #endif

View File

@ -25,7 +25,7 @@ bool PdfExtensionEnabled() {
} }
bool PrintPreviewEnabled() { bool PrintPreviewEnabled() {
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
// Not currently supported on macOS. // Not currently supported on macOS.
return false; return false;
#else #else

View File

@ -4,7 +4,7 @@
#include "libcef/common/resource_util.h" #include "libcef/common/resource_util.h"
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
@ -21,17 +21,17 @@
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "ui/base/layout.h" #include "ui/base/layout.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#include "libcef/common/util_mac.h" #include "libcef/common/util_mac.h"
#endif #endif
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
#include "base/environment.h" #include "base/environment.h"
#include "base/nix/xdg_util.h" #include "base/nix/xdg_util.h"
#endif #endif
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include "base/win/registry.h" #include "base/win/registry.h"
#endif #endif
@ -39,7 +39,7 @@ namespace resource_util {
namespace { namespace {
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
// Based on chrome/common/chrome_paths_linux.cc. // Based on chrome/common/chrome_paths_linux.cc.
// See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html // See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
@ -53,7 +53,7 @@ bool GetDefaultUserDataDirectory(base::FilePath* result) {
return true; return true;
} }
#elif defined(OS_MAC) #elif BUILDFLAG(IS_MAC)
// Based on chrome/common/chrome_paths_mac.mm. // Based on chrome/common/chrome_paths_mac.mm.
bool GetDefaultUserDataDirectory(base::FilePath* result) { bool GetDefaultUserDataDirectory(base::FilePath* result) {
@ -64,7 +64,7 @@ bool GetDefaultUserDataDirectory(base::FilePath* result) {
return true; return true;
} }
#elif defined(OS_WIN) #elif BUILDFLAG(IS_WIN)
// Based on chrome/common/chrome_paths_win.cc. // Based on chrome/common/chrome_paths_win.cc.
bool GetDefaultUserDataDirectory(base::FilePath* result) { bool GetDefaultUserDataDirectory(base::FilePath* result) {
@ -116,7 +116,7 @@ base::FilePath GetUserDataPath(CefSettings* settings,
// to the desktop on any platform. // to the desktop on any platform.
// From chrome/browser/download/download_prefs.cc. // From chrome/browser/download/download_prefs.cc.
bool DownloadPathIsDangerous(const base::FilePath& download_path) { bool DownloadPathIsDangerous(const base::FilePath& download_path) {
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
base::FilePath home_dir = base::GetHomeDir(); base::FilePath home_dir = base::GetHomeDir();
if (download_path == home_dir) { if (download_path == home_dir) {
return true; return true;
@ -142,7 +142,7 @@ bool GetDefaultDownloadSafeDirectory(base::FilePath* result) {
return false; return false;
if (DownloadPathIsDangerous(*result)) { if (DownloadPathIsDangerous(*result)) {
#if defined(OS_WIN) || defined(OS_LINUX) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
// Explicitly switch to the safe download directory. // Explicitly switch to the safe download directory.
return chrome::GetUserDownloadsDirectorySafe(result); return chrome::GetUserDownloadsDirectorySafe(result);
#else #else
@ -156,7 +156,7 @@ bool GetDefaultDownloadSafeDirectory(base::FilePath* result) {
} // namespace } // namespace
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
base::FilePath GetResourcesDir() { base::FilePath GetResourcesDir() {
return util_mac::GetFrameworkResourcesDirectory(); return util_mac::GetFrameworkResourcesDirectory();
@ -171,7 +171,7 @@ base::FilePath GetDefaultLogFilePath() {
.Append(FILE_PATH_LITERAL(exe_name + "_debug.log")); .Append(FILE_PATH_LITERAL(exe_name + "_debug.log"));
} }
#else // !defined(OS_MAC) #else // !BUILDFLAG(IS_MAC)
base::FilePath GetResourcesDir() { base::FilePath GetResourcesDir() {
base::FilePath pak_dir; base::FilePath pak_dir;
@ -186,7 +186,7 @@ base::FilePath GetDefaultLogFilePath() {
return log_path.Append(FILE_PATH_LITERAL("debug.log")); return log_path.Append(FILE_PATH_LITERAL("debug.log"));
} }
#endif // !defined(OS_MAC) #endif // !BUILDFLAG(IS_MAC)
void OverrideDefaultDownloadDir() { void OverrideDefaultDownloadDir() {
base::FilePath dir_default_download; base::FilePath dir_default_download;
@ -226,7 +226,7 @@ bool IsScaleFactorSupported(ui::ResourceScaleFactor scale_factor) {
scale_factor) != supported_scale_factors.end(); scale_factor) != supported_scale_factors.end();
} }
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
void OverrideAssetPath() { void OverrideAssetPath() {
Dl_info dl_info; Dl_info dl_info;
if (dladdr(reinterpret_cast<const void*>(&OverrideAssetPath), &dl_info)) { if (dladdr(reinterpret_cast<const void*>(&OverrideAssetPath), &dl_info)) {

View File

@ -32,7 +32,7 @@ void OverrideUserDataDir(CefSettings* settings,
// Returns true if |scale_factor| is supported by this platform. // Returns true if |scale_factor| is supported by this platform.
bool IsScaleFactorSupported(ui::ResourceScaleFactor scale_factor); bool IsScaleFactorSupported(ui::ResourceScaleFactor scale_factor);
#if defined(OS_LINUX) #if BUILDFLAG(IS_LINUX)
// Look for binary files (*.bin, *.dat, *.pak, chrome-sandbox, libGLESv2.so, // Look for binary files (*.bin, *.dat, *.pak, chrome-sandbox, libGLESv2.so,
// libEGL.so, locales/*.pak, swiftshader/*.so) next to libcef instead of the exe // libEGL.so, locales/*.pak, swiftshader/*.so) next to libcef instead of the exe
// on Linux. This is already the default on Windows. // on Linux. This is already the default on Windows.

View File

@ -97,7 +97,7 @@ bool CefThreadImpl::Create(const CefString& display_name,
options.joinable = stoppable; options.joinable = stoppable;
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
if (com_init_mode != COM_INIT_MODE_NONE) { if (com_init_mode != COM_INIT_MODE_NONE) {
if (com_init_mode == COM_INIT_MODE_STA) if (com_init_mode == COM_INIT_MODE_STA)
options.message_pump_type = base::MessagePumpType::UI; options.message_pump_type = base::MessagePumpType::UI;

View File

@ -6,7 +6,7 @@
#include "base/ignore_result.h" #include "base/ignore_result.h"
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#include <limits> #include <limits>
namespace { namespace {
@ -21,7 +21,7 @@ bool CanConvertToFileTime(int64_t us) {
} }
} // namespace } // namespace
#endif // defined(OS_WIN) #endif // BUILDFLAG(IS_WIN)
void cef_time_to_basetime(const cef_time_t& cef_time, base::Time& time) { void cef_time_to_basetime(const cef_time_t& cef_time, base::Time& time) {
base::Time::Exploded exploded; base::Time::Exploded exploded;
@ -37,7 +37,7 @@ void cef_time_to_basetime(const cef_time_t& cef_time, base::Time& time) {
} }
void cef_time_from_basetime(const base::Time& time, cef_time_t& cef_time) { void cef_time_from_basetime(const base::Time& time, cef_time_t& cef_time) {
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
int64_t t = time.ToDeltaSinceWindowsEpoch().InMicroseconds(); int64_t t = time.ToDeltaSinceWindowsEpoch().InMicroseconds();
if (!CanConvertToFileTime(t)) if (!CanConvertToFileTime(t))
return; return;

View File

@ -10,7 +10,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
// Enable deprecation warnings on Windows. See http://crbug.com/585142. // Enable deprecation warnings on Windows. See http://crbug.com/585142.
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(__clang__) #if defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wdeprecated-declarations" #pragma GCC diagnostic error "-Wdeprecated-declarations"
@ -104,7 +104,7 @@
#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
#include "base/mac/mac_util.h" #include "base/mac/mac_util.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#endif #endif
@ -215,7 +215,7 @@ void AlloyContentRendererClient::RenderThreadStarted() {
base::CurrentThread::Get()->AddDestructionObserver(this); base::CurrentThread::Get()->AddDestructionObserver(this);
} }
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
{ {
base::ScopedCFTypeRef<CFStringRef> key( base::ScopedCFTypeRef<CFStringRef> key(
base::SysUTF8ToCFStringRef("NSScrollViewRubberbanding")); base::SysUTF8ToCFStringRef("NSScrollViewRubberbanding"));
@ -230,7 +230,7 @@ void AlloyContentRendererClient::RenderThreadStarted() {
CFPreferencesSetAppValue(key, value, kCFPreferencesCurrentApplication); CFPreferencesSetAppValue(key, value, kCFPreferencesCurrentApplication);
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
} }
#endif // defined(OS_MAC) #endif // BUILDFLAG(IS_MAC)
if (extensions::PdfExtensionEnabled()) { if (extensions::PdfExtensionEnabled()) {
pdf_print_client_.reset(new ChromePDFPrintClient()); pdf_print_client_.reset(new ChromePDFPrintClient());
@ -507,7 +507,7 @@ void AlloyContentRendererClient::WillDestroyCurrentMessageLoop() {
void AlloyContentRendererClient::OnBrowserCreated( void AlloyContentRendererClient::OnBrowserCreated(
content::RenderView* render_view, content::RenderView* render_view,
absl::optional<bool> is_windowless) { absl::optional<bool> is_windowless) {
#if defined(OS_MAC) #if BUILDFLAG(IS_MAC)
const bool windowless = is_windowless.has_value() && *is_windowless; const bool windowless = is_windowless.has_value() && *is_windowless;
// FIXME: It would be better if this API would be a callback from the // FIXME: It would be better if this API would be a callback from the
@ -548,7 +548,7 @@ void AlloyContentRendererClient::RunSingleProcessCleanupOnUIThread() {
} }
// Enable deprecation warnings on Windows. See http://crbug.com/585142. // Enable deprecation warnings on Windows. See http://crbug.com/585142.
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(__clang__) #if defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#else #else

View File

@ -7,7 +7,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
// Enable deprecation warnings on Windows. See http://crbug.com/585142. // Enable deprecation warnings on Windows. See http://crbug.com/585142.
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(__clang__) #if defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wdeprecated-declarations" #pragma GCC diagnostic error "-Wdeprecated-declarations"
@ -529,7 +529,7 @@ void CefFrameImpl::MoveOrResizeStarted() {
} }
// Enable deprecation warnings on Windows. See http://crbug.com/585142. // Enable deprecation warnings on Windows. See http://crbug.com/585142.
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(__clang__) #if defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#else #else

View File

@ -5,7 +5,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
// Enable deprecation warnings on Windows. See http://crbug.com/585142. // Enable deprecation warnings on Windows. See http://crbug.com/585142.
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(__clang__) #if defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wdeprecated-declarations" #pragma GCC diagnostic error "-Wdeprecated-declarations"
@ -241,7 +241,7 @@ void CefRenderFrameObserver::OnLoadError() {
} }
// Enable deprecation warnings on Windows. See http://crbug.com/585142. // Enable deprecation warnings on Windows. See http://crbug.com/585142.
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(__clang__) #if defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#else #else

View File

@ -7,7 +7,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
// Enable deprecation warnings on Windows. See http://crbug.com/585142. // Enable deprecation warnings on Windows. See http://crbug.com/585142.
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(__clang__) #if defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wdeprecated-declarations" #pragma GCC diagnostic error "-Wdeprecated-declarations"
@ -399,7 +399,7 @@ void CefRenderManager::OnGuestViewDestroyed(CefGuestView* guest_view) {
} }
// Enable deprecation warnings on Windows. See http://crbug.com/585142. // Enable deprecation warnings on Windows. See http://crbug.com/585142.
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(__clang__) #if defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#else #else

View File

@ -13,7 +13,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
// Enable deprecation warnings for MSVC and Clang. See http://crbug.com/585142. // Enable deprecation warnings for MSVC and Clang. See http://crbug.com/585142.
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(__clang__) #if defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wdeprecated-declarations" #pragma GCC diagnostic error "-Wdeprecated-declarations"
@ -2555,7 +2555,7 @@ bool CefV8StackFrameImpl::IsConstructor() {
} }
// Enable deprecation warnings on Windows. See http://crbug.com/585142. // Enable deprecation warnings on Windows. See http://crbug.com/585142.
#if defined(OS_WIN) #if BUILDFLAG(IS_WIN)
#if defined(__clang__) #if defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#else #else