diff options
Diffstat (limited to 'src/core/content_main_delegate_qt.cpp')
-rw-r--r-- | src/core/content_main_delegate_qt.cpp | 64 |
1 files changed, 13 insertions, 51 deletions
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index 0c04fb071..bd7a23497 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -1,47 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "content_main_delegate_qt.h" #include "base/command_line.h" #include "base/i18n/rtl.h" #include "base/logging.h" +#include "base/memory/ref_counted_memory.h" #include "base/no_destructor.h" #include "base/path_service.h" #include "base/strings/string_number_conversions.h" @@ -65,11 +30,11 @@ #include "web_engine_context.h" #include "web_engine_library_info.h" -#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) +#if defined(ARCH_CPU_ARM_FAMILY) && (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)) #include "base/cpu.h" #endif -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) #include "media/audio/audio_manager.h" #include "ui/base/ui_base_switches.h" #endif @@ -77,12 +42,12 @@ // must be included before vaapi_wrapper.h #include <QtCore/qcoreapplication.h> -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) #include "media/gpu/windows/dxva_video_decode_accelerator_win.h" #include "media/gpu/windows/media_foundation_video_encode_accelerator_win.h" #endif -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) #include "base/trace_event/trace_event.h" #include "content/public/common/content_features.h" #include "media/gpu/mac/vt_video_decode_accelerator_mac.h" @@ -120,9 +85,6 @@ struct LazyDirectoryListerCacher dict.SetString("headerDateModified", l10n_util::GetStringUTF16(IDS_DIRECTORY_LISTING_DATE_MODIFIED)); dict.SetString("language", l10n_util::GetLanguage(base::i18n::GetConfiguredLocale())); - dict.SetString("listingParsingErrorBoxText", - l10n_util::GetStringFUTF16(IDS_DIRECTORY_LISTING_PARSING_ERROR_BOX_TEXT, - toString16(QCoreApplication::applicationName()))); dict.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); std::string html = webui::GetI18nTemplateHtml( @@ -172,7 +134,7 @@ static logging::LoggingDestination DetermineLogMode(const base::CommandLine& com void ContentMainDelegateQt::PreSandboxStartup() { -#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) +#if defined(ARCH_CPU_ARM_FAMILY) && (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)) // Create an instance of the CPU class to parse /proc/cpuinfo and cache // cpu_brand info. base::CPU cpu_info; @@ -205,7 +167,7 @@ void ContentMainDelegateQt::PreSandboxStartup() } } -#if defined(OS_POSIX) && !defined(OS_ANDROID) +#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID) if (parsedCommandLine->HasSwitch(switches::kSingleProcess)) setlocale(LC_NUMERIC, "C"); #endif @@ -214,12 +176,12 @@ void ContentMainDelegateQt::PreSandboxStartup() #if BUILDFLAG(USE_VAAPI) media::VaapiWrapper::PreSandboxInitialization(); #endif -#if defined(OS_WIN) +#if BUILDFLAG(IS_WIN) media::DXVAVideoDecodeAccelerator::PreSandboxInitialization(); media::MediaFoundationVideoEncodeAccelerator::PreSandboxInitialization(); #endif -#if defined(OS_MAC) +#if BUILDFLAG(IS_MAC) { TRACE_EVENT0("gpu", "Initialize VideoToolbox"); media::InitializeVideoToolbox(); @@ -230,7 +192,7 @@ void ContentMainDelegateQt::PreSandboxStartup() std::string appName = parsedCommandLine->GetSwitchValueASCII(switches::kApplicationName); appName = QByteArray::fromPercentEncoding(QByteArray::fromStdString(appName)).toStdString(); QCoreApplication::setApplicationName(QString::fromStdString(appName)); -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) media::AudioManager::SetGlobalAppName(appName); #endif } @@ -260,7 +222,7 @@ content::ContentGpuClient *ContentMainDelegateQt::CreateContentGpuClient() content::ContentRendererClient *ContentMainDelegateQt::CreateContentRendererClient() { -#if defined(OS_LINUX) +#if BUILDFLAG(IS_LINUX) base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess(); std::string process_type = parsedCommandLine->GetSwitchValueASCII(switches::kProcessType); bool no_sandbox = parsedCommandLine->HasSwitch(sandbox::policy::switches::kNoSandbox); |