mirror of
https://github.com/Alex313031/thorium.git
synced 2025-01-10 03:47:44 -03:00
M110 stage 5
This commit is contained in:
parent
6daf7ab8fe
commit
ef918f485d
16 changed files with 1226 additions and 1489 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2023 The Chromium Authors and Alex313031.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -86,6 +86,7 @@
|
|||
#include "chrome/browser/net/profile_network_context_service.h"
|
||||
#include "chrome/browser/net/profile_network_context_service_factory.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
#include "chrome/browser/optimization_guide/chrome_browser_main_extra_parts_optimization_guide.h"
|
||||
#include "chrome/browser/payments/payment_request_display_manager_factory.h"
|
||||
#include "chrome/browser/performance_manager/public/chrome_browser_main_extra_parts_performance_manager.h"
|
||||
#include "chrome/browser/performance_manager/public/chrome_content_browser_client_performance_manager_part.h"
|
||||
|
@ -112,6 +113,7 @@
|
|||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/profiles/profile_io_data.h"
|
||||
#include "chrome/browser/profiles/profile_manager.h"
|
||||
#include "chrome/browser/profiles/profile_selections.h"
|
||||
#include "chrome/browser/profiles/renderer_updater.h"
|
||||
#include "chrome/browser/profiles/renderer_updater_factory.h"
|
||||
#include "chrome/browser/profiling_host/chrome_browser_main_extra_parts_profiling.h"
|
||||
|
@ -334,6 +336,7 @@
|
|||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/page_transition_types.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/gfx/switches.h"
|
||||
#include "ui/native_theme/native_theme.h"
|
||||
#include "url/gurl.h"
|
||||
#include "url/origin.h"
|
||||
|
@ -346,6 +349,7 @@
|
|||
#include "base/win/win_util.h"
|
||||
#include "base/win/windows_version.h"
|
||||
#include "chrome/browser/chrome_browser_main_win.h"
|
||||
#include "chrome/browser/enterprise/platform_auth/platform_auth_navigation_throttle.h"
|
||||
#include "chrome/browser/lifetime/application_lifetime_desktop.h"
|
||||
#include "chrome/install_static/install_util.h"
|
||||
#include "chrome/services/util_win/public/mojom/util_win.mojom.h"
|
||||
|
@ -356,10 +360,11 @@
|
|||
#include "chrome/browser/mac/auth_session_request.h"
|
||||
#include "chrome/browser/mac/chrome_browser_main_extra_parts_mac.h"
|
||||
#include "components/soda/constants.h"
|
||||
#include "sandbox/mac/seatbelt_exec.h"
|
||||
#include "sandbox/mac/sandbox_compiler.h"
|
||||
#include "sandbox/policy/mac/params.h"
|
||||
#include "sandbox/policy/mac/sandbox_mac.h"
|
||||
#elif BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
#include "ash/constants/ash_features.h"
|
||||
#include "ash/constants/ash_pref_names.h"
|
||||
#include "ash/constants/ash_switches.h"
|
||||
#include "ash/public/cpp/new_window_delegate.h"
|
||||
|
@ -380,6 +385,7 @@
|
|||
#include "chrome/browser/ash/login/signin/merge_session_throttling_utils.h"
|
||||
#include "chrome/browser/ash/login/signin_partition_manager.h"
|
||||
#include "chrome/browser/ash/login/startup_utils.h"
|
||||
#include "chrome/browser/ash/net/network_health/network_health_manager.h"
|
||||
#include "chrome/browser/ash/net/system_proxy_manager.h"
|
||||
#include "chrome/browser/ash/profiles/profile_helper.h"
|
||||
#include "chrome/browser/ash/smb_client/fileapi/smbfs_file_system_backend_delegate.h"
|
||||
|
@ -413,7 +419,6 @@
|
|||
#include "chrome/browser/flags/android/chrome_feature_list.h"
|
||||
#include "chrome/browser/ui/android/tab_model/tab_model_list.h"
|
||||
#include "chrome/common/chrome_descriptors.h"
|
||||
#include "components/autofill_assistant/content/common/switches.h"
|
||||
#include "components/browser_ui/accessibility/android/font_size_prefs_android.h"
|
||||
#include "components/cdm/browser/cdm_message_filter_android.h"
|
||||
#include "components/crash/content/browser/child_exit_observer_android.h"
|
||||
|
@ -446,6 +451,7 @@
|
|||
#include "chrome/browser/policy/networking/policy_cert_service.h"
|
||||
#include "chrome/browser/policy/networking/policy_cert_service_factory.h"
|
||||
#include "chrome/common/chromeos/extensions/chromeos_system_extension_info.h"
|
||||
#include "chromeos/services/network_health/public/cpp/network_health_helper.h"
|
||||
#include "components/crash/core/app/breakpad_linux.h"
|
||||
#include "third_party/cros_system_api/switches/chrome_switches.h"
|
||||
#endif
|
||||
|
@ -1133,16 +1139,22 @@ bool ShouldHonorPolicies() {
|
|||
const char kDisableSandboxExternalProtocolSwitch[] =
|
||||
"disable-sandbox-external-protocols";
|
||||
|
||||
void LaunchURL(base::WeakPtr<ChromeContentBrowserClient> client,
|
||||
const GURL& url,
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
ui::PageTransition page_transition,
|
||||
bool is_primary_main_frame,
|
||||
bool is_in_fenced_frame_tree,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
bool has_user_gesture,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
content::WeakDocumentPtr initiator_document) {
|
||||
void LaunchURL(
|
||||
base::WeakPtr<ChromeContentBrowserClient> client,
|
||||
const GURL& url,
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
ui::PageTransition page_transition,
|
||||
bool is_primary_main_frame,
|
||||
bool is_in_fenced_frame_tree,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
bool has_user_gesture,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
content::WeakDocumentPtr initiator_document
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory
|
||||
#endif
|
||||
) {
|
||||
// If there is no longer a WebContents, the request may have raced with tab
|
||||
// closing. Don't fire the external request. (It may have been a prerender.)
|
||||
content::WebContents* web_contents = web_contents_getter.Run();
|
||||
|
@ -1258,7 +1270,12 @@ void LaunchURL(base::WeakPtr<ChromeContentBrowserClient> client,
|
|||
ExternalProtocolHandler::LaunchUrl(
|
||||
url, std::move(web_contents_getter), page_transition, has_user_gesture,
|
||||
is_in_fenced_frame_tree, initiating_origin,
|
||||
std::move(initiator_document));
|
||||
std::move(initiator_document)
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
,
|
||||
out_factory
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1310,6 +1327,7 @@ void MaybeAddThrottle(
|
|||
throttles->push_back(std::move(maybe_throttle));
|
||||
}
|
||||
|
||||
#if BUILDFLAG(SAFE_BROWSING_AVAILABLE)
|
||||
void MaybeAddCondition(
|
||||
std::unique_ptr<content::CommitDeferringCondition> maybe_condition,
|
||||
std::vector<std::unique_ptr<content::CommitDeferringCondition>>*
|
||||
|
@ -1317,6 +1335,7 @@ void MaybeAddCondition(
|
|||
if (maybe_condition)
|
||||
conditions->push_back(std::move(maybe_condition));
|
||||
}
|
||||
#endif
|
||||
|
||||
void MaybeAddThrottles(
|
||||
std::vector<std::unique_ptr<content::NavigationThrottle>> additional,
|
||||
|
@ -1439,8 +1458,7 @@ void HandleExpandedPaths(
|
|||
ChromeContentBrowserClient::IsClipboardPasteContentAllowedCallback
|
||||
callback,
|
||||
const enterprise_connectors::ContentAnalysisDelegate::Data& data,
|
||||
const enterprise_connectors::ContentAnalysisDelegate::Result&
|
||||
result) {
|
||||
enterprise_connectors::ContentAnalysisDelegate::Result& result) {
|
||||
absl::optional<std::string> final_data;
|
||||
auto blocked = fsd->IndexesToBlock(result.paths_results);
|
||||
if (blocked.size() != paths.size()) {
|
||||
|
@ -1450,6 +1468,9 @@ void HandleExpandedPaths(
|
|||
for (size_t i = 0; i < paths.size(); ++i) {
|
||||
if (blocked.count(i) == 0) {
|
||||
string_paths.push_back(paths[i].AsUTF8Unsafe());
|
||||
DCHECK(result.paths_results[i]);
|
||||
} else {
|
||||
result.paths_results[i] = false;
|
||||
}
|
||||
}
|
||||
final_data = base::JoinString(string_paths, "\n");
|
||||
|
@ -1472,8 +1493,7 @@ void HandleStringData(
|
|||
[](ChromeContentBrowserClient::IsClipboardPasteContentAllowedCallback
|
||||
callback,
|
||||
const enterprise_connectors::ContentAnalysisDelegate::Data& data,
|
||||
const enterprise_connectors::ContentAnalysisDelegate::Result&
|
||||
result) {
|
||||
enterprise_connectors::ContentAnalysisDelegate::Result& result) {
|
||||
std::move(callback).Run(
|
||||
result.text_results[0]
|
||||
? absl::optional<std::string>(data.text[0])
|
||||
|
@ -1522,6 +1542,14 @@ void ChromeContentBrowserClient::RegisterLocalStatePrefs(
|
|||
registry->RegisterBooleanPref(prefs::kSitePerProcess, false);
|
||||
registry->RegisterBooleanPref(prefs::kTabFreezingEnabled, true);
|
||||
registry->RegisterIntegerPref(prefs::kSCTAuditingHashdanceReportCount, 0);
|
||||
registry->RegisterBooleanPref(
|
||||
prefs::kThrottleNonVisibleCrossOriginIframesAllowed, true);
|
||||
registry->RegisterBooleanPref(prefs::kNewBaseUrlInheritanceBehaviorAllowed,
|
||||
true);
|
||||
registry->RegisterBooleanPref(
|
||||
policy::policy_prefs::kUseMojoVideoDecoderForPepperAllowed, true);
|
||||
registry->RegisterBooleanPref(
|
||||
policy::policy_prefs::kPPAPISharedImagesSwapChainAllowed, true);
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -1553,8 +1581,6 @@ void ChromeContentBrowserClient::RegisterProfilePrefs(
|
|||
registry->RegisterListPref(prefs::kSSLErrorOverrideAllowedForOrigins);
|
||||
registry->RegisterBooleanPref(
|
||||
prefs::kSuppressDifferentOriginSubframeJSDialogs, true);
|
||||
registry->RegisterBooleanPref(
|
||||
policy::policy_prefs::kSetTimeoutWithout1MsClampEnabled, false);
|
||||
registry->RegisterBooleanPref(
|
||||
policy::policy_prefs::kUnthrottledNestedTimeoutEnabled, false);
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
|
@ -1719,6 +1745,9 @@ ChromeContentBrowserClient::CreateBrowserMainParts(bool is_integration_test) {
|
|||
main_parts->AddParts(
|
||||
std::make_unique<ChromeBrowserMainExtraPartsSegmentationPlatform>());
|
||||
|
||||
main_parts->AddParts(
|
||||
std::make_unique<ChromeBrowserMainExtraPartsOptimizationGuide>());
|
||||
|
||||
return main_parts;
|
||||
}
|
||||
|
||||
|
@ -1850,7 +1879,10 @@ void ChromeContentBrowserClient::RenderProcessWillLaunch(
|
|||
std::make_unique<CrashMemoryMetricsCollector>(host));
|
||||
#endif
|
||||
|
||||
RendererUpdaterFactory::GetForProfile(profile)->InitializeRenderer(host);
|
||||
// The RendereUpdater might be null for some irregular profiles, e.g. the
|
||||
// System Profile.
|
||||
if (RendererUpdater* service = RendererUpdaterFactory::GetForProfile(profile))
|
||||
service->InitializeRenderer(host);
|
||||
|
||||
for (size_t i = 0; i < extra_parts_.size(); ++i)
|
||||
extra_parts_[i]->RenderProcessWillLaunch(host);
|
||||
|
@ -1873,6 +1905,10 @@ GURL ChromeContentBrowserClient::GetEffectiveURL(
|
|||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
if (ChromeContentBrowserClientExtensionsPart::AreExtensionsDisabledForProfile(
|
||||
profile))
|
||||
return url;
|
||||
|
||||
return ChromeContentBrowserClientExtensionsPart::GetEffectiveURL(profile,
|
||||
url);
|
||||
#else
|
||||
|
@ -1890,6 +1926,11 @@ bool ChromeContentBrowserClient::
|
|||
DCHECK(browser_context);
|
||||
DCHECK(candidate_site_instance);
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
if (ChromeContentBrowserClientExtensionsPart::AreExtensionsDisabledForProfile(
|
||||
browser_context)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ChromeContentBrowserClientExtensionsPart::
|
||||
ShouldCompareEffectiveURLsForSiteInstanceSelection(
|
||||
browser_context, candidate_site_instance, is_outermost_main_frame,
|
||||
|
@ -2054,6 +2095,11 @@ void ChromeContentBrowserClient::OverrideURLLoaderFactoryParams(
|
|||
bool is_for_isolated_world,
|
||||
network::mojom::URLLoaderFactoryParams* factory_params) {
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
if (ChromeContentBrowserClientExtensionsPart::AreExtensionsDisabledForProfile(
|
||||
browser_context)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ChromeContentBrowserClientExtensionsPart::OverrideURLLoaderFactoryParams(
|
||||
browser_context, origin, is_for_isolated_world, factory_params);
|
||||
#endif
|
||||
|
@ -2235,7 +2281,7 @@ ChromeContentBrowserClient::GetPermissionsPolicyForIsolatedWebApp(
|
|||
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||
auto& registrar =
|
||||
web_app::WebAppProvider::GetForWebApps(profile)->registrar();
|
||||
web_app::WebAppProvider::GetForWebApps(profile)->registrar_unsafe();
|
||||
std::vector<web_app::AppId> app_ids_for_origin =
|
||||
registrar.FindAppsInScope(app_origin.GetURL());
|
||||
if (app_ids_for_origin.empty()) {
|
||||
|
@ -2409,6 +2455,11 @@ bool ChromeContentBrowserClient::IsIsolatedContextAllowedForUrl(
|
|||
content::BrowserContext* browser_context,
|
||||
const GURL& lock_url) {
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
if (ChromeContentBrowserClientExtensionsPart::AreExtensionsDisabledForProfile(
|
||||
browser_context)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Allow restricted context APIs in Chrome Apps.
|
||||
auto* extension = extensions::ExtensionRegistry::Get(browser_context)
|
||||
->enabled_extensions()
|
||||
|
@ -2419,14 +2470,6 @@ bool ChromeContentBrowserClient::IsIsolatedContextAllowedForUrl(
|
|||
#endif
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClient::IsIsolatedWebAppsDeveloperModeAllowed(
|
||||
content::BrowserContext* context) {
|
||||
Profile* profile = Profile::FromBrowserContext(context);
|
||||
return profile &&
|
||||
profile->GetPrefs()->GetBoolean(
|
||||
policy::policy_prefs::kIsolatedAppsDeveloperModeAllowed);
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClient::IsGetDisplayMediaSetSelectAllScreensAllowed(
|
||||
content::BrowserContext* context,
|
||||
const url::Origin& origin) {
|
||||
|
@ -2691,18 +2734,6 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
|
|||
command_line->AppendSwitch(switches::kDisableScrollToTextFragment);
|
||||
}
|
||||
|
||||
// Override SetTimeoutWithoutClamp feature if its Enterprise Policy
|
||||
// is specified.
|
||||
if (prefs->HasPrefPath(
|
||||
policy::policy_prefs::kSetTimeoutWithout1MsClampEnabled)) {
|
||||
command_line->AppendSwitchASCII(
|
||||
blink::switches::kSetTimeoutWithout1MsClampPolicy,
|
||||
prefs->GetBoolean(
|
||||
policy::policy_prefs::kSetTimeoutWithout1MsClampEnabled)
|
||||
? blink::switches::kSetTimeoutWithout1MsClampPolicy_ForceEnable
|
||||
: blink::switches::
|
||||
kSetTimeoutWithout1MsClampPolicy_ForceDisable);
|
||||
}
|
||||
// Override MaxUnthrottledTimeoutNestingLevel feature if its Enterprise
|
||||
// Policy is specified.
|
||||
if (prefs->HasPrefPath(
|
||||
|
@ -2914,16 +2945,21 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
|
|||
switches::kChangeStackGuardOnForkEnabled);
|
||||
}
|
||||
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
if (browser_command_line.HasSwitch(
|
||||
autofill_assistant::switches::kAutofillAssistantDebugAnnotateDom)) {
|
||||
command_line->AppendSwitchASCII(
|
||||
autofill_assistant::switches::kAutofillAssistantDebugAnnotateDom,
|
||||
browser_command_line.GetSwitchValueASCII(
|
||||
autofill_assistant::switches::kAutofillAssistantDebugAnnotateDom));
|
||||
if (process_type != switches::kZygoteProcess) {
|
||||
DCHECK(g_browser_process);
|
||||
PrefService* local_state = g_browser_process->local_state();
|
||||
DCHECK(local_state);
|
||||
if (!local_state->GetBoolean(
|
||||
policy::policy_prefs::kUseMojoVideoDecoderForPepperAllowed)) {
|
||||
command_line->AppendSwitch(
|
||||
::switches::kDisableUseMojoVideoDecoderForPepper);
|
||||
}
|
||||
if (!local_state->GetBoolean(
|
||||
policy::policy_prefs::kPPAPISharedImagesSwapChainAllowed)) {
|
||||
command_line->AppendSwitch(
|
||||
::switches::kDisablePPAPISharedImagesSwapChain);
|
||||
}
|
||||
}
|
||||
#endif // BUILDFLAG(IS_ANDROID)
|
||||
}
|
||||
|
||||
std::string
|
||||
|
@ -3239,6 +3275,11 @@ bool ChromeContentBrowserClient::IsInterestGroupAPIAllowed(
|
|||
render_frame_host, api_origin, !allowed);
|
||||
}
|
||||
|
||||
content_settings::PageSpecificContentSettings::BrowsingDataAccessed(
|
||||
render_frame_host,
|
||||
content::InterestGroupManager::InterestGroupDataKey{api_origin,
|
||||
top_frame_origin},
|
||||
BrowsingDataModel::StorageType::kInterestGroup, !allowed);
|
||||
return allowed;
|
||||
}
|
||||
|
||||
|
@ -3257,11 +3298,13 @@ bool ChromeContentBrowserClient::IsAttributionReportingOperationAllowed(
|
|||
|
||||
switch (operation) {
|
||||
case AttributionReportingOperation::kSource:
|
||||
case AttributionReportingOperation::kSourceVerboseDebugReport:
|
||||
DCHECK(source_origin);
|
||||
DCHECK(reporting_origin);
|
||||
return privacy_sandbox_settings->IsAttributionReportingAllowed(
|
||||
*source_origin, *reporting_origin);
|
||||
case AttributionReportingOperation::kTrigger:
|
||||
case AttributionReportingOperation::kTriggerVerboseDebugReport:
|
||||
DCHECK(destination_origin);
|
||||
DCHECK(reporting_origin);
|
||||
return privacy_sandbox_settings->IsAttributionReportingAllowed(
|
||||
|
@ -3279,15 +3322,21 @@ bool ChromeContentBrowserClient::IsAttributionReportingOperationAllowed(
|
|||
|
||||
bool ChromeContentBrowserClient::IsSharedStorageAllowed(
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* rfh,
|
||||
const url::Origin& top_frame_origin,
|
||||
const url::Origin& accessing_origin) {
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||
auto* privacy_sandbox_settings =
|
||||
PrivacySandboxSettingsFactory::GetForProfile(profile);
|
||||
DCHECK(privacy_sandbox_settings);
|
||||
|
||||
return privacy_sandbox_settings->IsSharedStorageAllowed(top_frame_origin,
|
||||
accessing_origin);
|
||||
bool allowed = privacy_sandbox_settings->IsSharedStorageAllowed(
|
||||
top_frame_origin, accessing_origin);
|
||||
if (rfh) {
|
||||
content_settings::PageSpecificContentSettings::BrowsingDataAccessed(
|
||||
rfh, blink::StorageKey(accessing_origin),
|
||||
BrowsingDataModel::StorageType::kSharedStorage, !allowed);
|
||||
}
|
||||
return allowed;
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClient::IsPrivateAggregationAllowed(
|
||||
|
@ -3389,7 +3438,13 @@ ChromeContentBrowserClient::GetGeneratedCodeCacheSettings(
|
|||
|
||||
cert_verifier::mojom::CertVerifierServiceParamsPtr
|
||||
ChromeContentBrowserClient::GetCertVerifierServiceParams() {
|
||||
return GetChromeCertVerifierServiceParams();
|
||||
PrefService* local_state;
|
||||
if (g_browser_process) {
|
||||
local_state = g_browser_process->local_state();
|
||||
} else {
|
||||
local_state = startup_data_.chrome_feature_list_creator()->local_state();
|
||||
}
|
||||
return GetChromeCertVerifierServiceParams(local_state);
|
||||
}
|
||||
|
||||
void ChromeContentBrowserClient::AllowCertificateError(
|
||||
|
@ -3790,24 +3845,30 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs(
|
|||
// Fill font preferences. These are not registered on Android
|
||||
// - http://crbug.com/308033, http://crbug.com/696364.
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitStandardFontFamilyMap,
|
||||
&web_prefs->standard_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitFixedFontFamilyMap,
|
||||
&web_prefs->fixed_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitSerifFontFamilyMap,
|
||||
&web_prefs->serif_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitSansSerifFontFamilyMap,
|
||||
&web_prefs->sans_serif_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitCursiveFontFamilyMap,
|
||||
&web_prefs->cursive_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitFantasyFontFamilyMap,
|
||||
&web_prefs->fantasy_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitMathFontFamilyMap,
|
||||
&web_prefs->math_font_family_map);
|
||||
// Enabling the FontFamilyCache needs some KeyedService that might not be
|
||||
// available for some irregular profiles, like the System Profile.
|
||||
if (!AreKeyedServicesDisabledForProfileByDefault(profile)) {
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitStandardFontFamilyMap,
|
||||
&web_prefs->standard_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitFixedFontFamilyMap,
|
||||
&web_prefs->fixed_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitSerifFontFamilyMap,
|
||||
&web_prefs->serif_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitSansSerifFontFamilyMap,
|
||||
&web_prefs->sans_serif_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitCursiveFontFamilyMap,
|
||||
&web_prefs->cursive_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile,
|
||||
prefs::kWebKitFantasyFontFamilyMap,
|
||||
&web_prefs->fantasy_font_family_map);
|
||||
FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitMathFontFamilyMap,
|
||||
&web_prefs->math_font_family_map);
|
||||
}
|
||||
|
||||
web_prefs->default_font_size =
|
||||
prefs->GetInteger(prefs::kWebKitDefaultFontSize);
|
||||
|
@ -3953,7 +4014,7 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs(
|
|||
web_app::WebAppProvider::GetForLocalAppsUnchecked(profile);
|
||||
const web_app::AppId& app_id = browser->app_controller()->app_id();
|
||||
const web_app::WebAppRegistrar& registrar =
|
||||
web_app_provider->registrar();
|
||||
web_app_provider->registrar_unsafe();
|
||||
if (registrar.IsLocallyInstalled(app_id))
|
||||
web_prefs->web_app_scope = registrar.GetAppScope(app_id);
|
||||
|
||||
|
@ -4111,6 +4172,9 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs(
|
|||
// Disable WebSQL support since it is being removed from the web platform
|
||||
// and does not work. See crbug.com/1317431.
|
||||
web_prefs->databases_enabled = false;
|
||||
|
||||
// TODO(crbug.com/1311019): Implement WebAuthn integration and remove.
|
||||
web_prefs->disable_webauthn = true;
|
||||
#endif
|
||||
|
||||
for (ChromeContentBrowserClientParts* parts : extra_parts_)
|
||||
|
@ -5020,6 +5084,17 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
|||
MaybeCreateNavigationThrottle(handle),
|
||||
&throttles);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Don't perform platform authentication in incognito and guest profiles.
|
||||
if (profile && !profile->IsOffTheRecord()) {
|
||||
MaybeAddThrottle(
|
||||
enterprise_auth::PlatformAuthNavigationThrottle::MaybeCreateThrottleFor(
|
||||
handle),
|
||||
&throttles);
|
||||
}
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
return throttles;
|
||||
}
|
||||
|
||||
|
@ -5069,15 +5144,15 @@ void ChromeContentBrowserClient::UpdateDevToolsBackgroundServiceExpiration(
|
|||
auto* pref_service = profile->GetPrefs();
|
||||
DCHECK(pref_service);
|
||||
|
||||
DictionaryPrefUpdate pref_update(
|
||||
ScopedDictPrefUpdate pref_update(
|
||||
pref_service, prefs::kDevToolsBackgroundServicesExpirationDict);
|
||||
base::Value* exp_dict = pref_update.Get();
|
||||
base::Value::Dict& exp_dict = pref_update.Get();
|
||||
|
||||
// Convert |expiration_time| to minutes since that is the most granular
|
||||
// option that returns an int. base::Value does not accept int64.
|
||||
int expiration_time_minutes =
|
||||
expiration_time.ToDeltaSinceWindowsEpoch().InMinutes();
|
||||
exp_dict->SetIntKey(base::NumberToString(service), expiration_time_minutes);
|
||||
exp_dict.Set(base::NumberToString(service), expiration_time_minutes);
|
||||
}
|
||||
|
||||
base::flat_map<int, base::Time>
|
||||
|
@ -5368,14 +5443,23 @@ void ChromeContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
|
|||
content::BrowserContext* browser_context = web_contents->GetBrowserContext();
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
factories->emplace(
|
||||
extensions::kExtensionScheme,
|
||||
extensions::CreateExtensionNavigationURLLoaderFactory(
|
||||
browser_context, ukm_source_id,
|
||||
!!extensions::WebViewGuest::FromWebContents(web_contents)));
|
||||
if (!ChromeContentBrowserClientExtensionsPart::
|
||||
AreExtensionsDisabledForProfile(browser_context)) {
|
||||
factories->emplace(
|
||||
extensions::kExtensionScheme,
|
||||
extensions::CreateExtensionNavigationURLLoaderFactory(
|
||||
browser_context, ukm_source_id,
|
||||
!!extensions::WebViewGuest::FromWebContents(web_contents)));
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||
// KeyedServices could be disabled based on the profile type, e.g. System
|
||||
// Profile doesn't construct services by default.
|
||||
if (AreKeyedServicesDisabledForProfileByDefault(profile))
|
||||
return;
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
factories->emplace(content::kExternalFileScheme,
|
||||
ash::ExternalFileURLLoaderFactory::Create(
|
||||
profile, content::ChildProcessHost::kInvalidUniqueID));
|
||||
|
@ -5402,6 +5486,9 @@ void ChromeContentBrowserClient::
|
|||
DCHECK(factories);
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
DCHECK(!ChromeContentBrowserClientExtensionsPart::
|
||||
AreExtensionsDisabledForProfile(browser_context));
|
||||
|
||||
factories->emplace(
|
||||
extensions::kExtensionScheme,
|
||||
extensions::CreateExtensionWorkerMainResourceURLLoaderFactory(
|
||||
|
@ -5416,7 +5503,22 @@ void ChromeContentBrowserClient::
|
|||
DCHECK(browser_context);
|
||||
DCHECK(factories);
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
if (base::FeatureList::IsEnabled(features::kIsolatedWebApps) &&
|
||||
!browser_context->ShutdownStarted()) {
|
||||
factories->emplace(
|
||||
chrome::kIsolatedAppScheme,
|
||||
web_app::IsolatedWebAppURLLoaderFactory::CreateForServiceWorker(
|
||||
browser_context));
|
||||
}
|
||||
#endif // !BUILDFLAG(IS_ANDROID)
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
if (ChromeContentBrowserClientExtensionsPart::AreExtensionsDisabledForProfile(
|
||||
browser_context)) {
|
||||
return;
|
||||
}
|
||||
|
||||
factories->emplace(
|
||||
extensions::kExtensionScheme,
|
||||
extensions::CreateExtensionServiceWorkerScriptURLLoaderFactory(
|
||||
|
@ -5561,7 +5663,10 @@ void AddChromeSchemeFactories(
|
|||
// URL is chrome-search://remote-ntp. This is to allow the use of the NTP
|
||||
// public api and to embed most-visited tiles
|
||||
// (chrome-search://most-visited/title.html).
|
||||
if (instant_service->IsInstantProcess(render_process_id)) {
|
||||
//
|
||||
// InstantService might be null for some irregular profiles, e.g. the System
|
||||
// Profile.
|
||||
if (instant_service && instant_service->IsInstantProcess(render_process_id)) {
|
||||
factories->emplace(
|
||||
chrome::kChromeSearchScheme,
|
||||
content::CreateWebUIURLLoaderFactory(
|
||||
|
@ -5635,34 +5740,50 @@ void ChromeContentBrowserClient::
|
|||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
if (base::FeatureList::IsEnabled(features::kIsolatedWebApps) &&
|
||||
web_contents) {
|
||||
if (auto* browser_context = web_contents->GetBrowserContext();
|
||||
!browser_context->ShutdownStarted()) {
|
||||
if (base::FeatureList::IsEnabled(features::kIsolatedWebApps)) {
|
||||
content::BrowserContext* browser_context =
|
||||
content::RenderProcessHost::FromID(render_process_id)
|
||||
->GetBrowserContext();
|
||||
DCHECK(browser_context);
|
||||
if (!browser_context->ShutdownStarted()) {
|
||||
// TODO(crbug.com/1365848): Only register the factory if we are already in
|
||||
// an isolated storage partition.
|
||||
factories->emplace(
|
||||
chrome::kIsolatedAppScheme,
|
||||
web_app::IsolatedWebAppURLLoaderFactory::Create(
|
||||
frame_host->GetFrameTreeNodeId(), browser_context));
|
||||
|
||||
if (frame_host != nullptr) {
|
||||
factories->emplace(
|
||||
chrome::kIsolatedAppScheme,
|
||||
web_app::IsolatedWebAppURLLoaderFactory::Create(
|
||||
frame_host->GetFrameTreeNodeId(), browser_context));
|
||||
} else {
|
||||
factories->emplace(
|
||||
chrome::kIsolatedAppScheme,
|
||||
web_app::IsolatedWebAppURLLoaderFactory::CreateForServiceWorker(
|
||||
browser_context));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
content::BrowserContext* browser_context =
|
||||
content::RenderProcessHost::FromID(render_process_id)
|
||||
->GetBrowserContext();
|
||||
if (ChromeContentBrowserClientExtensionsPart::AreExtensionsDisabledForProfile(
|
||||
browser_context))
|
||||
return;
|
||||
|
||||
factories->emplace(extensions::kExtensionScheme,
|
||||
extensions::CreateExtensionURLLoaderFactory(
|
||||
render_process_id, render_frame_id));
|
||||
|
||||
content::BrowserContext* browser_context =
|
||||
content::RenderProcessHost::FromID(render_process_id)
|
||||
->GetBrowserContext();
|
||||
const extensions::Extension* extension = nullptr;
|
||||
|
||||
if (request_initiator_origin != absl::nullopt) {
|
||||
extension = extensions::ExtensionRegistry::Get(browser_context)
|
||||
->enabled_extensions()
|
||||
.GetExtensionOrAppByURL(request_initiator_origin->GetURL());
|
||||
extensions::ExtensionRegistry* registry =
|
||||
extensions::ExtensionRegistry::Get(
|
||||
Profile::FromBrowserContext(browser_context));
|
||||
DCHECK(registry);
|
||||
extension = registry->enabled_extensions().GetExtensionOrAppByURL(
|
||||
request_initiator_origin->GetURL());
|
||||
}
|
||||
|
||||
// For service worker contexts, we only allow file access. The remainder of
|
||||
|
@ -6207,6 +6328,18 @@ bool ChromeContentBrowserClient::HandleExternalProtocol(
|
|||
? initiator_document->GetWeakDocumentPtr()
|
||||
: content::WeakDocumentPtr();
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// For Android this is always called on the UI thread.
|
||||
CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
||||
|
||||
// Called synchronously so we can populate the |out_factory| param.
|
||||
LaunchURL(weak_factory_.GetWeakPtr(), url, std::move(web_contents_getter),
|
||||
page_transition, is_primary_main_frame, is_in_fenced_frame_tree,
|
||||
sandbox_flags, has_user_gesture, initiating_origin,
|
||||
std::move(weak_initiator_document), out_factory);
|
||||
#else
|
||||
// TODO(crbug.com/1394838): Figure out why this was initially made async, and,
|
||||
// if possible, unify with the sync path above.
|
||||
content::GetUIThreadTaskRunner({})->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(&LaunchURL, weak_factory_.GetWeakPtr(), url,
|
||||
|
@ -6214,6 +6347,7 @@ bool ChromeContentBrowserClient::HandleExternalProtocol(
|
|||
is_primary_main_frame, is_in_fenced_frame_tree,
|
||||
sandbox_flags, has_user_gesture, initiating_origin,
|
||||
std::move(weak_initiator_document)));
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6233,8 +6367,8 @@ void ChromeContentBrowserClient::RegisterRendererPreferenceWatcher(
|
|||
content::BrowserContext* browser_context,
|
||||
mojo::PendingRemote<blink::mojom::RendererPreferenceWatcher> watcher) {
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||
PrefWatcher::Get(profile)->RegisterRendererPreferenceWatcher(
|
||||
std::move(watcher));
|
||||
if (PrefWatcher* pref_watcher = PrefWatcher::Get(profile))
|
||||
pref_watcher->RegisterRendererPreferenceWatcher(std::move(watcher));
|
||||
}
|
||||
|
||||
// Static; handles rewriting Web UI URLs.
|
||||
|
@ -6814,8 +6948,15 @@ bool ChromeContentBrowserClient::
|
|||
bool ChromeContentBrowserClient::ShouldAllowInsecurePrivateNetworkRequests(
|
||||
content::BrowserContext* browser_context,
|
||||
const url::Origin& origin) {
|
||||
return content_settings::ShouldAllowInsecurePrivateNetworkRequests(
|
||||
HostContentSettingsMapFactory::GetForProfile(browser_context), origin);
|
||||
// The host content settings map might no be null for some irregular profiles,
|
||||
// e.g. the System Profile.
|
||||
if (HostContentSettingsMap* service =
|
||||
HostContentSettingsMapFactory::GetForProfile(browser_context)) {
|
||||
return content_settings::ShouldAllowInsecurePrivateNetworkRequests(service,
|
||||
origin);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClient::IsJitDisabledForSite(
|
||||
|
@ -6823,9 +6964,8 @@ bool ChromeContentBrowserClient::IsJitDisabledForSite(
|
|||
const GURL& site_url) {
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||
auto* map = HostContentSettingsMapFactory::GetForProfile(profile);
|
||||
|
||||
// Special case to determine if any policy is set.
|
||||
if (site_url.is_empty()) {
|
||||
if (map && site_url.is_empty()) {
|
||||
return map->GetDefaultContentSetting(ContentSettingsType::JAVASCRIPT_JIT,
|
||||
nullptr) == CONTENT_SETTING_BLOCK;
|
||||
}
|
||||
|
@ -6834,9 +6974,9 @@ bool ChromeContentBrowserClient::IsJitDisabledForSite(
|
|||
if (!site_url.SchemeIsHTTPOrHTTPS())
|
||||
return false;
|
||||
|
||||
return (map->GetContentSetting(site_url, site_url,
|
||||
ContentSettingsType::JAVASCRIPT_JIT) ==
|
||||
CONTENT_SETTING_BLOCK);
|
||||
return (map && map->GetContentSetting(site_url, site_url,
|
||||
ContentSettingsType::JAVASCRIPT_JIT) ==
|
||||
CONTENT_SETTING_BLOCK);
|
||||
}
|
||||
|
||||
ukm::UkmService* ChromeContentBrowserClient::GetUkmService() {
|
||||
|
@ -6892,18 +7032,18 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
|
|||
#if BUILDFLAG(IS_MAC)
|
||||
bool ChromeContentBrowserClient::SetupEmbedderSandboxParameters(
|
||||
sandbox::mojom::Sandbox sandbox_type,
|
||||
sandbox::SeatbeltExecClient* client) {
|
||||
sandbox::SandboxCompiler* compiler) {
|
||||
if (sandbox_type == sandbox::mojom::Sandbox::kSpeechRecognition) {
|
||||
base::FilePath soda_component_path = speech::GetSodaDirectory();
|
||||
CHECK(!soda_component_path.empty());
|
||||
CHECK(client->SetParameter(sandbox::policy::kParamSodaComponentPath,
|
||||
soda_component_path.value()));
|
||||
CHECK(compiler->SetParameter(sandbox::policy::kParamSodaComponentPath,
|
||||
soda_component_path.value()));
|
||||
|
||||
base::FilePath soda_language_pack_path =
|
||||
speech::GetSodaLanguagePacksDirectory();
|
||||
CHECK(!soda_language_pack_path.empty());
|
||||
CHECK(client->SetParameter(sandbox::policy::kParamSodaLanguagePackPath,
|
||||
soda_language_pack_path.value()));
|
||||
CHECK(compiler->SetParameter(sandbox::policy::kParamSodaLanguagePackPath,
|
||||
soda_language_pack_path.value()));
|
||||
return true;
|
||||
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
|
||||
} else if (sandbox_type == sandbox::mojom::Sandbox::kScreenAI) {
|
||||
|
@ -6916,8 +7056,8 @@ bool ChromeContentBrowserClient::SetupEmbedderSandboxParameters(
|
|||
return false;
|
||||
}
|
||||
|
||||
CHECK(client->SetParameter(sandbox::policy::kParamScreenAiComponentPath,
|
||||
screen_ai_component_dir.value()));
|
||||
CHECK(compiler->SetParameter(sandbox::policy::kParamScreenAiComponentPath,
|
||||
screen_ai_component_dir.value()));
|
||||
|
||||
return true;
|
||||
#endif
|
||||
|
@ -7043,7 +7183,8 @@ bool ChromeContentBrowserClient::ShouldPreconnect(
|
|||
// at the start of navigation as part of the preloading holdback, so ignore
|
||||
// the Finch setting here.
|
||||
return prefetch::IsSomePreloadingEnabledIgnoringFinch(
|
||||
*Profile::FromBrowserContext(browser_context)->GetPrefs());
|
||||
*Profile::FromBrowserContext(browser_context)->GetPrefs()) ==
|
||||
content::PreloadingEligibility::kEligible;
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClient::ShouldPreconnectNavigation(
|
||||
|
@ -7078,18 +7219,40 @@ ChromeContentBrowserClient::GetAlternativeErrorPageOverrideInfo(
|
|||
content::RenderFrameHost* render_frame_host,
|
||||
content::BrowserContext* browser_context,
|
||||
int32_t error_code) {
|
||||
if (error_code != net::ERR_INTERNET_DISCONNECTED)
|
||||
return nullptr;
|
||||
if (base::FeatureList::IsEnabled(features::kPWAsDefaultOfflinePage) &&
|
||||
error_code == net::ERR_INTERNET_DISCONNECTED) {
|
||||
content::mojom::AlternativeErrorPageOverrideInfoPtr
|
||||
alternative_error_page_override_info = web_app::GetOfflinePageInfo(
|
||||
url, render_frame_host, browser_context);
|
||||
if (alternative_error_page_override_info) {
|
||||
// Use the alternative error page dictionary to override the error page.
|
||||
alternative_error_page_override_info->alternative_error_page_params.Set(
|
||||
error_page::kOverrideErrorPage, base::Value(true));
|
||||
web_app::TrackOfflinePageVisibility(render_frame_host);
|
||||
return alternative_error_page_override_info;
|
||||
}
|
||||
}
|
||||
|
||||
if (!base::FeatureList::IsEnabled(features::kPWAsDefaultOfflinePage))
|
||||
return nullptr;
|
||||
// TODO(b/247618374): Lacros implementation
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
if (ash::features::IsCaptivePortalErrorPageEnabled()) {
|
||||
auto alternative_error_page_override_info =
|
||||
content::mojom::AlternativeErrorPageOverrideInfo::New();
|
||||
// Use the alternative error page dictionary to provide additional
|
||||
// suggestions in the default error page.
|
||||
alternative_error_page_override_info->alternative_error_page_params.Set(
|
||||
error_page::kOverrideErrorPage, base::Value(false));
|
||||
bool is_portal_state =
|
||||
ash::network_health::NetworkHealthManager::GetInstance()
|
||||
->helper()
|
||||
->IsPortalState();
|
||||
alternative_error_page_override_info->alternative_error_page_params.Set(
|
||||
error_page::kIsPortalStateKey, base::Value(is_portal_state));
|
||||
return alternative_error_page_override_info;
|
||||
}
|
||||
#endif
|
||||
|
||||
content::mojom::AlternativeErrorPageOverrideInfoPtr error_page =
|
||||
web_app::GetOfflinePageInfo(url, render_frame_host, browser_context);
|
||||
if (error_page)
|
||||
web_app::TrackOfflinePageVisibility(render_frame_host);
|
||||
|
||||
return error_page;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClient::OpenExternally(
|
||||
|
|
|
@ -80,10 +80,6 @@
|
|||
#endif // BUILDFLAG(IS_LINUX)
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
{"enable-win7-webrtc-hw-h264-decoding",
|
||||
"Windows 7 WebRTC H.264 Hardware Decoding",
|
||||
"Enables H.264 hardware decode acceleration for WebRTC on Windows 7.",
|
||||
kOsWin, SINGLE_VALUE_TYPE(switches::kEnableWin7WebRtcHWH264Decoding)},
|
||||
{"disable-windows10-custom-titlebar",
|
||||
"Disable Custom Windows Titlebar",
|
||||
"Disables custom-drawing the window titlebar on Windows 10/11.",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2022 The Chromium Authors and Alex313031
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -36,6 +36,8 @@
|
|||
#include "chrome/browser/media/router/media_router_feature.h"
|
||||
#include "chrome/browser/prefs/incognito_mode_prefs.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/search/search.h"
|
||||
#include "chrome/browser/search_engines/template_url_service_factory.h"
|
||||
#include "chrome/browser/sessions/session_service.h"
|
||||
#include "chrome/browser/sessions/session_service_base.h"
|
||||
#include "chrome/browser/sessions/session_service_factory.h"
|
||||
|
@ -98,6 +100,7 @@
|
|||
#include "chrome/common/pref_names.h"
|
||||
#include "chrome/common/url_constants.h"
|
||||
#include "components/bookmarks/browser/bookmark_model.h"
|
||||
#include "components/bookmarks/browser/bookmark_node.h"
|
||||
#include "components/bookmarks/browser/bookmark_utils.h"
|
||||
#include "components/bookmarks/common/bookmark_pref_names.h"
|
||||
#include "components/browsing_data/content/browsing_data_helper.h"
|
||||
|
@ -182,6 +185,12 @@
|
|||
#include "chrome/browser/apps/intent_helper/supported_links_infobar_delegate.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
#include "chrome/browser/lens/region_search/lens_region_search_controller.h"
|
||||
#include "chrome/browser/lens/region_search/lens_region_search_helper.h"
|
||||
#include "components/lens/lens_features.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
const char kOsOverrideForTabletSite[] = "Linux; Android 9; Chrome tablet";
|
||||
|
@ -263,6 +272,31 @@ bool CanMoveWebContentsToReadLater(Browser* browser,
|
|||
model->IsUrlSupported(*url) && !browser->profile()->IsGuestSession();
|
||||
}
|
||||
|
||||
bool BookmarkCurrentTabHelper(Browser* browser,
|
||||
bookmarks::BookmarkModel* model,
|
||||
GURL* url,
|
||||
std::u16string* title) {
|
||||
if (!model || !model->loaded())
|
||||
return false; // Ignore requests until bookmarks are loaded.
|
||||
|
||||
content::WebContents* const web_contents =
|
||||
browser->tab_strip_model()->GetActiveWebContents();
|
||||
// |web_contents| can be nullptr if the last tab in the browser was closed
|
||||
// but the browser wasn't closed yet. https://crbug.com/799668
|
||||
if (!web_contents)
|
||||
return false;
|
||||
if (!chrome::GetURLAndTitleToBookmark(web_contents, url, title))
|
||||
return false;
|
||||
bool is_bookmarked_by_any = model->IsBookmarked(*url);
|
||||
if (!is_bookmarked_by_any &&
|
||||
web_contents->GetBrowserContext()->IsOffTheRecord()) {
|
||||
// If we're incognito the favicon may not have been saved. Save it now
|
||||
// so that bookmarks have an icon for the page.
|
||||
favicon::SaveFaviconEvenIfInIncognito(web_contents);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
using base::UserMetricsAction;
|
||||
|
@ -690,8 +724,8 @@ void NewWindow(Browser* browser) {
|
|||
auto launch_container = apps::LaunchContainer::kLaunchContainerWindow;
|
||||
|
||||
auto* provider = web_app::WebAppProvider::GetForWebApps(profile);
|
||||
if (provider && provider->registrar().GetAppEffectiveDisplayMode(app_id) ==
|
||||
blink::mojom::DisplayMode::kBrowser) {
|
||||
if (provider && provider->registrar_unsafe().GetAppEffectiveDisplayMode(
|
||||
app_id) == blink::mojom::DisplayMode::kBrowser) {
|
||||
launch_container = apps::LaunchContainer::kLaunchContainerTab;
|
||||
}
|
||||
apps::AppLaunchParams params = apps::AppLaunchParams(
|
||||
|
@ -960,7 +994,7 @@ WebContents* DuplicateTabAt(Browser* browser, int index) {
|
|||
|
||||
bool CanDuplicateTabAt(const Browser* browser, int index) {
|
||||
WebContents* contents = browser->tab_strip_model()->GetWebContentsAt(index);
|
||||
return contents && contents->GetController().GetLastCommittedEntry();
|
||||
return contents;
|
||||
}
|
||||
|
||||
void MoveTabsToExistingWindow(Browser* source,
|
||||
|
@ -1065,29 +1099,13 @@ void Exit() {
|
|||
}
|
||||
|
||||
void BookmarkCurrentTab(Browser* browser) {
|
||||
base::RecordAction(UserMetricsAction("Star"));
|
||||
|
||||
base::RecordAction(base::UserMetricsAction("Star"));
|
||||
BookmarkModel* model =
|
||||
BookmarkModelFactory::GetForBrowserContext(browser->profile());
|
||||
if (!model || !model->loaded())
|
||||
return; // Ignore requests until bookmarks are loaded.
|
||||
|
||||
GURL url;
|
||||
std::u16string title;
|
||||
WebContents* web_contents =
|
||||
browser->tab_strip_model()->GetActiveWebContents();
|
||||
// |web_contents| can be nullptr if the last tab in the browser was closed
|
||||
// but the browser wasn't closed yet. https://crbug.com/799668
|
||||
if (!web_contents)
|
||||
if (!BookmarkCurrentTabHelper(browser, model, &url, &title)) {
|
||||
return;
|
||||
if (!GetURLAndTitleToBookmark(web_contents, &url, &title))
|
||||
return;
|
||||
bool is_bookmarked_by_any = model->IsBookmarked(url);
|
||||
if (!is_bookmarked_by_any &&
|
||||
web_contents->GetBrowserContext()->IsOffTheRecord()) {
|
||||
// If we're incognito the favicon may not have been saved. Save it now
|
||||
// so that bookmarks have an icon for the page.
|
||||
favicon::SaveFaviconEvenIfInIncognito(web_contents);
|
||||
}
|
||||
bool was_bookmarked_by_user = bookmarks::IsBookmarkedByUser(model, url);
|
||||
bookmarks::AddIfNotBookmarked(model, url, title);
|
||||
|
@ -1104,6 +1122,25 @@ void BookmarkCurrentTab(Browser* browser) {
|
|||
RecordBookmarksAdded(browser->profile());
|
||||
}
|
||||
|
||||
void BookmarkCurrentTabInFolder(Browser* browser, int64_t folder_id) {
|
||||
BookmarkModel* const model =
|
||||
BookmarkModelFactory::GetForBrowserContext(browser->profile());
|
||||
GURL url;
|
||||
std::u16string title;
|
||||
if (!BookmarkCurrentTabHelper(browser, model, &url, &title)) {
|
||||
return;
|
||||
}
|
||||
const bookmarks::BookmarkNode* parent =
|
||||
bookmarks::GetBookmarkNodeByID(model, folder_id);
|
||||
if (parent) {
|
||||
bool was_bookmarked_by_user = bookmarks::IsBookmarkedByUser(model, url);
|
||||
model->AddNewURL(parent, 0, title, url);
|
||||
bool is_bookmarked_by_user = bookmarks::IsBookmarkedByUser(model, url);
|
||||
if (!was_bookmarked_by_user && is_bookmarked_by_user)
|
||||
RecordBookmarksAdded(browser->profile());
|
||||
}
|
||||
}
|
||||
|
||||
bool CanBookmarkCurrentTab(const Browser* browser) {
|
||||
BookmarkModel* model =
|
||||
BookmarkModelFactory::GetForBrowserContext(browser->profile());
|
||||
|
@ -1149,8 +1186,9 @@ bool MoveTabToReadLater(Browser* browser, content::WebContents* web_contents) {
|
|||
&title)) {
|
||||
return false;
|
||||
}
|
||||
model->AddEntry(url, base::UTF16ToUTF8(title),
|
||||
reading_list::EntrySource::ADDED_VIA_CURRENT_APP);
|
||||
model->AddOrReplaceEntry(url, base::UTF16ToUTF8(title),
|
||||
reading_list::EntrySource::ADDED_VIA_CURRENT_APP,
|
||||
/*estimated_read_time=*/base::TimeDelta());
|
||||
browser->window()->MaybeShowFeaturePromo(
|
||||
feature_engagement::kIPHReadingListDiscoveryFeature);
|
||||
base::UmaHistogramEnumeration(
|
||||
|
@ -1170,7 +1208,7 @@ bool MarkCurrentTabAsReadInReadLater(Browser* browser) {
|
|||
const ReadingListEntry* entry = model->GetEntryByURL(url);
|
||||
// Mark current tab as read.
|
||||
if (entry && !entry->IsRead())
|
||||
model->SetReadStatus(url, true);
|
||||
model->SetReadStatusIfExists(url, true);
|
||||
return entry != nullptr;
|
||||
}
|
||||
|
||||
|
@ -1847,4 +1885,26 @@ void RunScreenAIVisualAnnotation(Browser* browser) {
|
|||
}
|
||||
#endif // BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
|
||||
|
||||
void ExecLensRegionSearch(Browser* browser) {
|
||||
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
Profile* profile = browser->profile();
|
||||
TemplateURLService* service =
|
||||
TemplateURLServiceFactory::GetForProfile(profile);
|
||||
WebContents* contents = browser->tab_strip_model()->GetActiveWebContents();
|
||||
GURL url = contents->GetController().GetLastCommittedEntry()->GetURL();
|
||||
|
||||
if (lens::IsRegionSearchEnabled(browser, profile, service, url)) {
|
||||
auto lens_region_search_controller_data =
|
||||
std::make_unique<lens::LensRegionSearchControllerData>();
|
||||
lens_region_search_controller_data->lens_region_search_controller =
|
||||
std::make_unique<lens::LensRegionSearchController>(browser);
|
||||
lens_region_search_controller_data->lens_region_search_controller->Start(
|
||||
contents, lens::features::IsLensFullscreenSearchEnabled(),
|
||||
search::DefaultSearchProviderIsGoogle(profile));
|
||||
browser->SetUserData(lens::LensRegionSearchControllerData::kDataKey,
|
||||
std::move(lens_region_search_controller_data));
|
||||
}
|
||||
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
}
|
||||
|
||||
} // namespace chrome
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2023 The Chromium Authors and Alex313031.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
|||
#include "base/containers/contains.h"
|
||||
#include "base/containers/flat_set.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/i18n/rtl.h"
|
||||
#include "base/location.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
|
@ -27,7 +28,6 @@
|
|||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
|
@ -60,6 +60,7 @@
|
|||
#include "chrome/browser/ui/browser_command_controller.h"
|
||||
#include "chrome/browser/ui/browser_commands.h"
|
||||
#include "chrome/browser/ui/browser_dialogs.h"
|
||||
#include "chrome/browser/ui/browser_element_identifiers.h"
|
||||
#include "chrome/browser/ui/browser_finder.h"
|
||||
#include "chrome/browser/ui/browser_list.h"
|
||||
#include "chrome/browser/ui/browser_navigator.h"
|
||||
|
@ -250,6 +251,7 @@
|
|||
#include "ui/views/views_features.h"
|
||||
#include "ui/views/widget/native_widget.h"
|
||||
#include "ui/views/widget/root_view.h"
|
||||
#include "ui/views/widget/sublevel_manager.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
#include "ui/views/window/dialog_delegate.h"
|
||||
|
||||
|
@ -667,7 +669,7 @@ class BrowserView::AccessibilityModeObserver : public ui::AXModeObserver {
|
|||
// notifications are in progress, and |MaybeInitializeWebUITabStrip| can
|
||||
// destroy things synchronously.
|
||||
if (mode.has_mode(ui::AXMode::kScreenReader)) {
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&BrowserView::MaybeInitializeWebUITabStrip,
|
||||
browser_view_->GetAsWeakPtr()));
|
||||
}
|
||||
|
@ -859,6 +861,8 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
|
|||
SetCanMinimize(true);
|
||||
}
|
||||
|
||||
SetProperty(views::kElementIdentifierKey, kBrowserViewElementId);
|
||||
|
||||
// Create user education resources.
|
||||
UserEducationService* const user_education_service =
|
||||
UserEducationServiceFactory::GetForProfile(GetProfile());
|
||||
|
@ -941,7 +945,7 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
|
|||
right_aligned_side_panel_separator_ =
|
||||
AddChildView(std::make_unique<ContentsSeparator>());
|
||||
|
||||
if (base::FeatureList::IsEnabled(features::kUnifiedSidePanel) && !base::CommandLine::ForCurrentProcess()->HasSwitch("hide-sidepanel-button")) {
|
||||
if (base::FeatureList::IsEnabled(features::kUnifiedSidePanel)) {
|
||||
const bool is_right_aligned = GetProfile()->GetPrefs()->GetBoolean(
|
||||
prefs::kSidePanelHorizontalAlignment);
|
||||
unified_side_panel_ = AddChildView(std::make_unique<SidePanel>(
|
||||
|
@ -996,7 +1000,7 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
|
|||
// startup.
|
||||
if (JumpList::Enabled()) {
|
||||
content::BrowserThread::PostBestEffortTask(
|
||||
FROM_HERE, base::ThreadTaskRunnerHandle::Get(),
|
||||
FROM_HERE, base::SingleThreadTaskRunner::GetCurrentDefault(),
|
||||
base::BindOnce(&BrowserView::CreateJumpList,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
@ -1267,6 +1271,15 @@ float BrowserView::GetTopControlsSlideBehaviorShownRatio() const {
|
|||
return 1.f;
|
||||
}
|
||||
|
||||
views::Widget* BrowserView::GetWidgetForAnchoring() {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
if (UsesImmersiveFullscreenMode()) {
|
||||
return IsFullscreen() ? overlay_widget_.get() : GetWidget();
|
||||
}
|
||||
#endif
|
||||
return GetWidget();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// BrowserView, BrowserWindow implementation:
|
||||
|
||||
|
@ -1315,8 +1328,7 @@ void BrowserView::Show() {
|
|||
}
|
||||
|
||||
void BrowserView::ShowInactive() {
|
||||
if (!frame_->IsVisible())
|
||||
frame_->ShowInactive();
|
||||
frame_->ShowInactive();
|
||||
}
|
||||
|
||||
void BrowserView::Hide() {
|
||||
|
@ -1950,7 +1962,7 @@ void BrowserView::FullscreenStateChanging() {
|
|||
void BrowserView::FullscreenStateChanged() {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
if (!IsFullscreen() && restore_pre_fullscreen_bounds_callback_) {
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE, std::move(restore_pre_fullscreen_bounds_callback_));
|
||||
}
|
||||
|
||||
|
@ -2289,9 +2301,11 @@ void BrowserView::UpdateIsIsolatedWebApp() {
|
|||
web_contents->GetPrimaryMainFrame()->GetBrowserContext(), url);
|
||||
}
|
||||
|
||||
void BrowserView::ToggleWindowControlsOverlayEnabled() {
|
||||
browser()->app_controller()->ToggleWindowControlsOverlayEnabled();
|
||||
UpdateWindowControlsOverlayEnabled();
|
||||
void BrowserView::ToggleWindowControlsOverlayEnabled(base::OnceClosure done) {
|
||||
browser()->app_controller()->ToggleWindowControlsOverlayEnabled(
|
||||
base::BindOnce(&BrowserView::UpdateWindowControlsOverlayEnabled,
|
||||
weak_ptr_factory_.GetWeakPtr())
|
||||
.Then(std::move(done)));
|
||||
}
|
||||
|
||||
bool BrowserView::IsBorderlessModeEnabled() const {
|
||||
|
@ -3075,7 +3089,7 @@ bool BrowserView::CanActivate() const {
|
|||
// has to be done in a post task, otherwise if the user clicked on a window
|
||||
// that doesn't have the modal dialog the windows keep trying to get the focus
|
||||
// from each other on Windows. http://crbug.com/141650.
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&BrowserView::ActivateAppModalDialog,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
return false;
|
||||
|
@ -3500,6 +3514,15 @@ views::View* BrowserView::CreateMacOverlayView() {
|
|||
overlay_widget_->Init(std::move(params));
|
||||
overlay_widget_->SetNativeWindowProperty(kBrowserViewKey, this);
|
||||
|
||||
// Disable sublevel widget layering because in fullscreen the NSWindow of
|
||||
// `overlay_widget_` is reparented to a AppKit-owned NSWindow that does not
|
||||
// have an associated Widget. This will cause issues in sublevel manager
|
||||
// which operates at the Widget level.
|
||||
if (overlay_widget_->GetSublevelManager()) {
|
||||
overlay_widget_->parent()->GetSublevelManager()->UntrackChildWidget(
|
||||
overlay_widget_);
|
||||
}
|
||||
|
||||
// Create a new TopContainerOverlayView. The tab strip, omnibox, bookmarks
|
||||
// etc. will be contained within this view. Right clicking on the blank space
|
||||
// that is not taken up by the child views should show the context menu. Set
|
||||
|
@ -3699,7 +3722,7 @@ void BrowserView::RevealTabStripIfNeeded() {
|
|||
[](std::unique_ptr<ImmersiveRevealedLock>) {}, std::move(revealer));
|
||||
constexpr auto kDefaultDelay = base::Seconds(1);
|
||||
constexpr auto kZeroDelay = base::Seconds(0);
|
||||
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
|
||||
FROM_HERE, std::move(delete_revealer),
|
||||
g_disable_revealer_delay_for_testing ? kZeroDelay : kDefaultDelay);
|
||||
}
|
||||
|
@ -3802,6 +3825,13 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) {
|
|||
// Widget (OverlayWidget). This means that BrowserView does not need to
|
||||
// consult BrowserViewLayout::NonClientHitTest() to calculate the hit test.
|
||||
if (IsImmersiveModeEnabled()) {
|
||||
// Handle hits on the overlay widget when it is hovering overtop of the
|
||||
// content view.
|
||||
gfx::Point screen_point(point);
|
||||
View::ConvertPointToScreen(this, &screen_point);
|
||||
if (overlay_widget()->GetWindowBoundsInScreen().Contains(screen_point)) {
|
||||
return HTNOWHERE;
|
||||
}
|
||||
return views::ClientView::NonClientHitTest(point);
|
||||
}
|
||||
#endif // BUILDFLAG(IS_MAC)
|
||||
|
@ -3953,10 +3983,9 @@ void BrowserView::AddedToWidget() {
|
|||
// TODO(https://crbug.com/1036519): Remove BrowserViewLayout dependence on
|
||||
// Widget and move to the constructor.
|
||||
SetLayoutManager(std::make_unique<BrowserViewLayout>(
|
||||
std::make_unique<BrowserViewLayoutDelegateImpl>(this),
|
||||
GetWidget()->GetNativeView(), this, top_container_,
|
||||
tab_strip_region_view_, tabstrip_, toolbar_, infobar_container_,
|
||||
contents_container_, side_search_side_panel_,
|
||||
std::make_unique<BrowserViewLayoutDelegateImpl>(this), this,
|
||||
top_container_, tab_strip_region_view_, tabstrip_, toolbar_,
|
||||
infobar_container_, contents_container_, side_search_side_panel_,
|
||||
left_aligned_side_panel_separator_, unified_side_panel_,
|
||||
right_aligned_side_panel_separator_, lens_side_panel_,
|
||||
immersive_mode_controller_.get(), contents_separator_));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -284,6 +284,7 @@ void ToolbarView::Init() {
|
|||
|
||||
std::unique_ptr<SidePanelToolbarButton> side_panel_button;
|
||||
if (browser_view_->unified_side_panel()) {
|
||||
if (!base::CommandLine::ForCurrentProcess()->HasSwitch("hide-sidepanel-button"))
|
||||
side_panel_button = std::make_unique<SidePanelToolbarButton>(browser_);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2012 The Chromium Authors, Hibiki Tachibana, and Alex313031.
|
||||
// Copyright 2023 The Chromium Authors, Hibiki Tachibana, and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
@ -48,6 +48,7 @@
|
|||
#include "chrome/installer/setup/setup_constants.h"
|
||||
#include "chrome/installer/setup/setup_util.h"
|
||||
#include "chrome/installer/setup/update_active_setup_version_work_item.h"
|
||||
#include "chrome/installer/util/app_command.h"
|
||||
#include "chrome/installer/util/callback_work_item.h"
|
||||
#include "chrome/installer/util/conditional_work_item_list.h"
|
||||
#include "chrome/installer/util/create_reg_key_work_item.h"
|
||||
|
@ -379,9 +380,6 @@ void AddEnterpriseEnrollmentWorkItems(const InstallerState& installer_state,
|
|||
if (!installer_state.system_install())
|
||||
return;
|
||||
|
||||
const HKEY root_key = installer_state.root_key();
|
||||
const std::wstring cmd_key(GetCommandKey(kCmdStoreDMToken));
|
||||
|
||||
// Register a command to allow Chrome to request Google Update to run
|
||||
// setup.exe --store-dmtoken=<token>, which will store the specified token
|
||||
// in the registry.
|
||||
|
@ -397,13 +395,14 @@ void AddEnterpriseEnrollmentWorkItems(const InstallerState& installer_state,
|
|||
// safety check for unsafe insert sequences since the right thing is
|
||||
// happening. Do not blindly copy this pattern in new code. Check with a
|
||||
// member of base/win/OWNERS if in doubt.
|
||||
AppCommand cmd(cmd_line.GetCommandLineStringWithUnsafeInsertSequences());
|
||||
AppCommand cmd(kCmdStoreDMToken,
|
||||
cmd_line.GetCommandLineStringWithUnsafeInsertSequences());
|
||||
|
||||
// TODO(rogerta): For now setting this command as web accessible is required
|
||||
// by Google Update. Could revisit this should Google Update change the
|
||||
// way permissions are handled for commands.
|
||||
cmd.set_is_web_accessible(true);
|
||||
cmd.AddWorkItems(root_key, cmd_key, install_list);
|
||||
cmd.AddCreateAppCommandWorkItems(installer_state.root_key(), install_list);
|
||||
}
|
||||
|
||||
// Adds work items to add the "delete-dmtoken" command to Chrome's version key.
|
||||
|
@ -417,9 +416,6 @@ void AddEnterpriseUnenrollmentWorkItems(const InstallerState& installer_state,
|
|||
if (!installer_state.system_install())
|
||||
return;
|
||||
|
||||
const HKEY root_key = installer_state.root_key();
|
||||
const std::wstring cmd_key(GetCommandKey(kCmdDeleteDMToken));
|
||||
|
||||
// Register a command to allow Chrome to request Google Update to run
|
||||
// setup.exe --delete-dmtoken, which will delete any existing DMToken from the
|
||||
// registry.
|
||||
|
@ -429,13 +425,13 @@ void AddEnterpriseUnenrollmentWorkItems(const InstallerState& installer_state,
|
|||
cmd_line.AppendSwitch(switches::kSystemLevel);
|
||||
cmd_line.AppendSwitch(switches::kVerboseLogging);
|
||||
InstallUtil::AppendModeAndChannelSwitches(&cmd_line);
|
||||
AppCommand cmd(cmd_line.GetCommandLineString());
|
||||
AppCommand cmd(kCmdDeleteDMToken, cmd_line.GetCommandLineString());
|
||||
|
||||
// TODO(rogerta): For now setting this command as web accessible is required
|
||||
// by Google Update. Could revisit this should Google Update change the
|
||||
// way permissions are handled for commands.
|
||||
cmd.set_is_web_accessible(true);
|
||||
cmd.AddWorkItems(root_key, cmd_key, install_list);
|
||||
cmd.AddCreateAppCommandWorkItems(installer_state.root_key(), install_list);
|
||||
}
|
||||
|
||||
// Adds work items to add the "rotate-dtkey" command to Chrome's version key.
|
||||
|
@ -448,9 +444,6 @@ void AddEnterpriseDeviceTrustWorkItems(const InstallerState& installer_state,
|
|||
if (!installer_state.system_install())
|
||||
return;
|
||||
|
||||
const HKEY root_key = installer_state.root_key();
|
||||
const std::wstring cmd_key(GetCommandKey(kCmdRotateDeviceTrustKey));
|
||||
|
||||
// Register a command to allow Chrome to request Google Update to run
|
||||
// setup.exe --rotate-dtkey=<dm-token>, which will rotate the key and store
|
||||
// it in the registry.
|
||||
|
@ -468,13 +461,14 @@ void AddEnterpriseDeviceTrustWorkItems(const InstallerState& installer_state,
|
|||
// safety check for unsafe insert sequences since the right thing is
|
||||
// happening. Do not blindly copy this pattern in new code. Check with a
|
||||
// member of base/win/OWNERS if in doubt.
|
||||
AppCommand cmd(cmd_line.GetCommandLineStringWithUnsafeInsertSequences());
|
||||
AppCommand cmd(kCmdRotateDeviceTrustKey,
|
||||
cmd_line.GetCommandLineStringWithUnsafeInsertSequences());
|
||||
|
||||
// TODO(rogerta): For now setting this command as web accessible is required
|
||||
// by Google Update. Could revisit this should Google Update change the
|
||||
// way permissions are handled for commands.
|
||||
cmd.set_is_web_accessible(true);
|
||||
cmd.AddWorkItems(root_key, cmd_key, install_list);
|
||||
cmd.AddCreateAppCommandWorkItems(installer_state.root_key(), install_list);
|
||||
}
|
||||
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
|
||||
|
@ -713,7 +707,7 @@ bool AppendPostInstallTasks(const InstallParams& install_params,
|
|||
google_update::kRegCriticalVersionField);
|
||||
}
|
||||
|
||||
// Form the mode-specific rename command.
|
||||
// Form the mode-specific rename command and register it.
|
||||
base::CommandLine product_rename_cmd(installer_path);
|
||||
product_rename_cmd.AppendSwitch(switches::kRenameChromeExe);
|
||||
if (installer_state.system_install())
|
||||
|
@ -721,9 +715,25 @@ bool AppendPostInstallTasks(const InstallParams& install_params,
|
|||
if (installer_state.verbose_logging())
|
||||
product_rename_cmd.AppendSwitch(switches::kVerboseLogging);
|
||||
InstallUtil::AppendModeAndChannelSwitches(&product_rename_cmd);
|
||||
in_use_update_work_items->AddSetRegValueWorkItem(
|
||||
root, clients_key, KEY_WOW64_32KEY, google_update::kRegRenameCmdField,
|
||||
product_rename_cmd.GetCommandLineString(), true);
|
||||
AppCommand(installer::kCmdRenameChromeExe,
|
||||
product_rename_cmd.GetCommandLineString())
|
||||
.AddCreateAppCommandWorkItems(root, in_use_update_work_items.get());
|
||||
// Some clients in Chrome 110 look for an alternate rename command id. Write
|
||||
// that one as well so those can find it and be able to finish updating.
|
||||
// TODO(floresa): Remove all uses of the alternate id in Chrome 111.
|
||||
AppCommand(installer::kCmdAlternateRenameChromeExe,
|
||||
product_rename_cmd.GetCommandLineString())
|
||||
.AddCreateAppCommandWorkItems(root, in_use_update_work_items.get());
|
||||
|
||||
if (!installer_state.system_install()) {
|
||||
// Chrome versions prior to 110.0.5435.0 still look for the User rename
|
||||
// command line REG_SZ "cmd" under the path
|
||||
// "Software\Google\Update\Clients\<guid>" where "<guid>" is the current
|
||||
// install mode's appguid.
|
||||
in_use_update_work_items->AddSetRegValueWorkItem(
|
||||
root, clients_key, KEY_WOW64_32KEY, installer::kCmdRenameChromeExe,
|
||||
product_rename_cmd.GetCommandLineString(), true);
|
||||
}
|
||||
|
||||
// Delay deploying the new chrome_proxy while chrome is running.
|
||||
in_use_update_work_items->AddCopyTreeWorkItem(
|
||||
|
@ -754,8 +764,15 @@ bool AppendPostInstallTasks(const InstallParams& install_params,
|
|||
regular_update_work_items->AddDeleteRegValueWorkItem(
|
||||
root, clients_key, KEY_WOW64_32KEY,
|
||||
google_update::kRegCriticalVersionField);
|
||||
regular_update_work_items->AddDeleteRegValueWorkItem(
|
||||
root, clients_key, KEY_WOW64_32KEY, google_update::kRegRenameCmdField);
|
||||
AppCommand(installer::kCmdRenameChromeExe, {})
|
||||
.AddDeleteAppCommandWorkItems(root, regular_update_work_items.get());
|
||||
AppCommand(installer::kCmdAlternateRenameChromeExe, {})
|
||||
.AddDeleteAppCommandWorkItems(root, regular_update_work_items.get());
|
||||
|
||||
if (!installer_state.system_install()) {
|
||||
regular_update_work_items->AddDeleteRegValueWorkItem(
|
||||
root, clients_key, KEY_WOW64_32KEY, installer::kCmdRenameChromeExe);
|
||||
}
|
||||
|
||||
// Only copy chrome_proxy.exe directly when chrome.exe isn't in use to avoid
|
||||
// different versions getting mixed up between the two binaries.
|
||||
|
@ -854,14 +871,10 @@ void AddInstallWorkItems(const InstallParams& install_params,
|
|||
base::BindOnce(
|
||||
[](const base::FilePath& histogram_storage_dir,
|
||||
const CallbackWorkItem& work_item) {
|
||||
auto sid = base::win::Sid::FromKnownSid(
|
||||
base::win::WellKnownSid::kAuthenticatedUser);
|
||||
if (!sid)
|
||||
return false;
|
||||
std::vector<base::win::Sid> sids;
|
||||
sids.push_back(std::move(*sid));
|
||||
return base::win::GrantAccessToPath(
|
||||
histogram_storage_dir, sids,
|
||||
histogram_storage_dir,
|
||||
base::win::Sid::FromKnownSidVector(
|
||||
{base::win::WellKnownSid::kAuthenticatedUser}),
|
||||
FILE_GENERIC_READ | FILE_DELETE_CHILD,
|
||||
CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE);
|
||||
},
|
||||
|
@ -1105,11 +1118,10 @@ void AddOsUpgradeWorkItems(const InstallerState& installer_state,
|
|||
const base::Version& new_version,
|
||||
WorkItemList* install_list) {
|
||||
const HKEY root_key = installer_state.root_key();
|
||||
const std::wstring cmd_key(GetCommandKey(kCmdOnOsUpgrade));
|
||||
|
||||
if (installer_state.operation() == InstallerState::UNINSTALL) {
|
||||
install_list->AddDeleteRegKeyWorkItem(root_key, cmd_key, KEY_WOW64_32KEY)
|
||||
->set_log_message("Removing OS upgrade command");
|
||||
AppCommand(kCmdOnOsUpgrade, {})
|
||||
.AddDeleteAppCommandWorkItems(root_key, install_list);
|
||||
} else {
|
||||
// Register with Google Update to have setup.exe --on-os-upgrade called on
|
||||
// OS upgrade.
|
||||
|
@ -1124,9 +1136,9 @@ void AddOsUpgradeWorkItems(const InstallerState& installer_state,
|
|||
// Log everything for now.
|
||||
cmd_line.AppendSwitch(installer::switches::kVerboseLogging);
|
||||
|
||||
AppCommand cmd(cmd_line.GetCommandLineString());
|
||||
AppCommand cmd(kCmdOnOsUpgrade, cmd_line.GetCommandLineString());
|
||||
cmd.set_is_auto_run_on_os_upgrade(true);
|
||||
cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list);
|
||||
cmd.AddCreateAppCommandWorkItems(root_key, install_list);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2023 The Chromium Authors and Alex313031.
|
||||
# Copyright 2023 The Chromium Authors and Alex313031
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
@ -111,6 +111,7 @@ test("components_unittests") {
|
|||
|
||||
deps = [
|
||||
"//base",
|
||||
"//components/aggregation_service:unit_tests",
|
||||
"//components/apdu:unit_tests",
|
||||
"//components/assist_ranker:unit_tests",
|
||||
"//components/attribution_reporting:unit_tests",
|
||||
|
@ -136,6 +137,7 @@ test("components_unittests") {
|
|||
"//components/content_capture/common:unit_tests",
|
||||
"//components/content_settings/core/browser:unit_tests",
|
||||
"//components/content_settings/core/common:unit_tests",
|
||||
"//components/country_codes:unit_tests",
|
||||
"//components/crash/core/common:unit_tests",
|
||||
"//components/crx_file:unit_tests",
|
||||
"//components/device_event_log:unit_tests",
|
||||
|
@ -148,7 +150,6 @@ test("components_unittests") {
|
|||
"//components/favicon/core:unit_tests",
|
||||
"//components/favicon_base:unit_tests",
|
||||
"//components/feature_engagement:unit_tests",
|
||||
"//components/file_access:unit_tests",
|
||||
"//components/filename_generation:unit_tests",
|
||||
"//components/flags_ui:unit_tests",
|
||||
"//components/gcm_driver:unit_tests",
|
||||
|
@ -257,6 +258,10 @@ test("components_unittests") {
|
|||
"//components/webdata_services:unit_tests",
|
||||
]
|
||||
|
||||
if (!is_ios) {
|
||||
deps += [ "//components/file_access:unit_tests" ]
|
||||
}
|
||||
|
||||
if (enable_screen_ai_service) {
|
||||
deps += [ "//components/services/screen_ai:unit_tests" ]
|
||||
}
|
||||
|
@ -325,14 +330,9 @@ test("components_unittests") {
|
|||
]
|
||||
} else { #!is_ios
|
||||
deps += [
|
||||
"//components/accuracy_tips:unit_tests",
|
||||
"//components/autofill/content/browser:unit_tests",
|
||||
"//components/autofill/content/renderer:unit_tests",
|
||||
"//components/autofill/core/common/mojom:unit_tests",
|
||||
"//components/autofill_assistant/browser:unit_tests",
|
||||
"//components/autofill_assistant/browser/public:unit_tests",
|
||||
"//components/autofill_assistant/content/browser:unit_tests",
|
||||
"//components/autofill_assistant/content/renderer:unit_tests",
|
||||
"//components/background_sync:unit_tests",
|
||||
"//components/blocked_content:unit_tests",
|
||||
"//components/browsing_data/content:unit_tests",
|
||||
|
@ -475,6 +475,7 @@ test("components_unittests") {
|
|||
deps += [
|
||||
"//base:base_java_unittest_support",
|
||||
"//components/android_autofill/browser:unit_tests",
|
||||
"//components/browser_ui/accessibility/android:unit_tests",
|
||||
"//components/browser_ui/sms/android:unit_tests",
|
||||
"//components/cdm/browser:unit_tests",
|
||||
"//components/component_updater/android:embedded_component_loader_java",
|
||||
|
@ -646,6 +647,9 @@ test("components_unittests") {
|
|||
]
|
||||
} else if (safe_browsing_mode == 2) {
|
||||
deps += [ "//components/safe_browsing/android:unit_tests_mobile" ]
|
||||
|
||||
# Used by real_time_url_checks_allowlist_unittest.cc
|
||||
data += [ "//components/safe_browsing/content/resources/real_time_url_checks_allowlist.pb" ]
|
||||
}
|
||||
|
||||
if (safe_browsing_mode == 1) {
|
||||
|
@ -791,11 +795,6 @@ if (!is_ios) {
|
|||
"autofill/content/renderer/form_cache_browsertest.cc",
|
||||
"autofill/content/renderer/html_based_username_detector_browsertest.cc",
|
||||
"autofill/content/renderer/password_form_conversion_utils_browsertest.cc",
|
||||
"autofill_assistant/browser/js_flow_executor_impl_browsertest.cc",
|
||||
"autofill_assistant/browser/script_executor_browsertest.cc",
|
||||
"autofill_assistant/browser/web/batch_element_checker_browsertest.cc",
|
||||
"autofill_assistant/browser/web/semantic_element_finder_browsertest.cc",
|
||||
"autofill_assistant/browser/web/web_controller_browsertest.cc",
|
||||
"browsing_data/content/browsing_data_helper_browsertest.h",
|
||||
"browsing_data/content/cache_storage_helper_browsertest.cc",
|
||||
"browsing_data/content/database_helper_browsertest.cc",
|
||||
|
@ -835,10 +834,6 @@ if (!is_ios) {
|
|||
"//components/autofill/content/renderer",
|
||||
"//components/autofill/content/renderer:test_support",
|
||||
"//components/autofill/core/browser",
|
||||
"//components/autofill_assistant/browser",
|
||||
"//components/autofill_assistant/browser:browser_test_support",
|
||||
"//components/autofill_assistant/browser:test_support",
|
||||
"//components/autofill_assistant/content/renderer:browser_tests",
|
||||
"//components/browsing_data/content",
|
||||
"//components/content_capture/browser:browser_tests",
|
||||
"//components/content_settings/core/common",
|
||||
|
@ -1063,7 +1058,6 @@ if (is_android) {
|
|||
robolectric_binary("components_junit_tests") {
|
||||
deps = [
|
||||
"//components/android_autofill/browser/junit:components_autofill_junit_tests",
|
||||
"//components/autofill_assistant/android:junit",
|
||||
"//components/background_task_scheduler:components_background_task_scheduler_junit_tests",
|
||||
"//components/browser_ui/bottomsheet/android/internal:junit_tests",
|
||||
"//components/browser_ui/client_certificate/android:junit",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -12,8 +12,7 @@ const int64_t OfflinePageModel::kInvalidOfflineId;
|
|||
|
||||
OfflinePageModel::SavePageParams::SavePageParams()
|
||||
: proposed_offline_id(OfflinePageModel::kInvalidOfflineId),
|
||||
is_background(false),
|
||||
use_page_problem_detectors(false) {}
|
||||
is_background(false) {}
|
||||
|
||||
OfflinePageModel::SavePageParams::SavePageParams(const SavePageParams& other) =
|
||||
default;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
|||
#include "components/omnibox/browser/autocomplete_controller.h"
|
||||
#include "components/omnibox/browser/autocomplete_input.h"
|
||||
#include "components/omnibox/browser/autocomplete_match.h"
|
||||
#include "components/omnibox/browser/autocomplete_match_type.h"
|
||||
#include "components/omnibox/browser/location_bar_model.h"
|
||||
#include "components/omnibox/browser/omnibox_edit_controller.h"
|
||||
#include "components/omnibox/browser/omnibox_edit_model.h"
|
||||
|
@ -31,6 +32,7 @@
|
|||
|
||||
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
|
||||
|
||||
#include "components/omnibox/browser/vector_icons.h" // nogncheck
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
|
||||
#endif
|
||||
|
@ -176,7 +178,7 @@ void OmniboxView::OpenMatch(const AutocompleteMatch& match,
|
|||
|
||||
bool OmniboxView::IsEditingOrEmpty() const {
|
||||
return (model_.get() && model_->user_input_in_progress()) ||
|
||||
(GetOmniboxTextLength() == 0);
|
||||
(GetOmniboxTextLength() == 0);
|
||||
}
|
||||
|
||||
// TODO (manukh) OmniboxView::GetIcon is very similar to
|
||||
|
@ -186,7 +188,9 @@ bool OmniboxView::IsEditingOrEmpty() const {
|
|||
// provider icons. It's possible they have other inconsistencies as well. We may
|
||||
// want to consider reusing the same code for both the popup and omnibox icons.
|
||||
ui::ImageModel OmniboxView::GetIcon(int dip_size,
|
||||
SkColor color,
|
||||
SkColor color_current_page_icon,
|
||||
SkColor color_vectors,
|
||||
SkColor color_bright_vectors,
|
||||
IconFetchedCallback on_icon_fetched) const {
|
||||
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
|
||||
// This is used on desktop only.
|
||||
|
@ -199,21 +203,21 @@ ui::ImageModel OmniboxView::GetIcon(int dip_size,
|
|||
AutocompleteMatch fake_match;
|
||||
fake_match.type = AutocompleteMatchType::URL_WHAT_YOU_TYPED;
|
||||
const gfx::VectorIcon& vector_icon = fake_match.GetVectorIcon(false);
|
||||
return ui::ImageModel::FromVectorIcon(vector_icon, color, dip_size);
|
||||
return ui::ImageModel::FromVectorIcon(vector_icon, color_current_page_icon,
|
||||
dip_size);
|
||||
}
|
||||
|
||||
if (model_->ShouldShowCurrentPageIcon()) {
|
||||
LocationBarModel* location_bar_model = controller_->GetLocationBarModel();
|
||||
return ui::ImageModel::FromVectorIcon(location_bar_model->GetVectorIcon(),
|
||||
color, dip_size);
|
||||
color_current_page_icon, dip_size);
|
||||
}
|
||||
|
||||
gfx::Image favicon;
|
||||
AutocompleteMatch match = model_->CurrentMatch(nullptr);
|
||||
if (AutocompleteMatch::IsSearchType(match.type)) {
|
||||
// For search queries, display default search engine's favicon (Disabled by Alex313031).
|
||||
|
||||
} else {
|
||||
// For search queries, display default search engine's favicon. (Disabled by Alex313031).
|
||||
} else if (match.type != AutocompleteMatchType::HISTORY_CLUSTER) {
|
||||
// For site suggestions, display site's favicon.
|
||||
favicon = model_->client()->GetFaviconForPageUrl(
|
||||
match.destination_url, std::move(on_icon_fetched));
|
||||
|
@ -232,7 +236,9 @@ ui::ImageModel OmniboxView::GetIcon(int dip_size,
|
|||
bookmark_model && bookmark_model->IsBookmarked(match.destination_url);
|
||||
|
||||
const gfx::VectorIcon& vector_icon = match.GetVectorIcon(is_bookmarked);
|
||||
|
||||
const auto& color = match.type == AutocompleteMatchType::HISTORY_CLUSTER
|
||||
? color_bright_vectors
|
||||
: color_vectors;
|
||||
return ui::ImageModel::FromVectorIcon(vector_icon, color, dip_size);
|
||||
#endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -117,11 +117,13 @@ void RegisterContentSchemes(bool should_lock_registry) {
|
|||
url::AddPredefinedHandlerScheme(scheme.c_str(), handler.c_str());
|
||||
|
||||
// This should only be registered if the
|
||||
// kEnableServiceWorkerForChromeUntrusted feature is enabled but checking
|
||||
// it here causes a crash when --no-sandbox is enabled. See crbug.com/1313812
|
||||
// kEnableServiceWorkerForChrome or
|
||||
// kEnableServiceWorkerForChromeUntrusted feature is enabled but checking it
|
||||
// here causes a crash when --no-sandbox is enabled. See crbug.com/1313812
|
||||
// There are other render side checks and browser side checks that ensure
|
||||
// service workers don't work for chrome-untrusted:// when the flag is not
|
||||
// service workers don't work for chrome[-untrusted]:// when the flag is not
|
||||
// enabled.
|
||||
schemes.service_worker_schemes.push_back(kChromeUIScheme);
|
||||
schemes.service_worker_schemes.push_back(kChromeUIUntrustedScheme);
|
||||
|
||||
// Prevent future modification of the scheme lists. This is to prevent
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
|||
#endif // BUILDFLAG(IS_OZONE)
|
||||
#if BUILDFLAG(USE_VAAPI_X11)
|
||||
#include "media/gpu/vaapi/vaapi_picture_native_pixmap_angle.h"
|
||||
#include "media/gpu/vaapi/vaapi_picture_tfp.h"
|
||||
#endif // BUILDFLAG(USE_VAAPI_X11)
|
||||
#if defined(USE_EGL)
|
||||
#include "media/gpu/vaapi/vaapi_picture_native_pixmap_egl.h"
|
||||
|
@ -50,9 +49,6 @@ VaapiPictureFactory::VaapiPictureFactory() {
|
|||
vaapi_impl_pairs_.insert(
|
||||
std::make_pair(gl::kGLImplementationEGLANGLE,
|
||||
VaapiPictureFactory::kVaapiImplementationAngle));
|
||||
vaapi_impl_pairs_.insert(
|
||||
std::make_pair(gl::kGLImplementationDesktopGL,
|
||||
VaapiPictureFactory::kVaapiImplementationX11));
|
||||
#elif BUILDFLAG(IS_OZONE)
|
||||
vaapi_impl_pairs_.insert(
|
||||
std::make_pair(gl::kGLImplementationEGLANGLE,
|
||||
|
@ -84,7 +80,6 @@ std::unique_ptr<VaapiPicture> VaapiPictureFactory::Create(
|
|||
? picture_buffer.service_texture_ids()[0]
|
||||
: 0;
|
||||
|
||||
// Select DRM(egl) / TFP(glx) at runtime with --use-gl=egl / --use-gl=desktop
|
||||
return CreateVaapiPictureNative(vaapi_wrapper, make_context_current_cb,
|
||||
bind_image_cb, picture_buffer, visible_size,
|
||||
client_texture_id, service_texture_id);
|
||||
|
@ -124,12 +119,6 @@ void VaapiPictureFactory::DeterminePictureCreationAndDownloadingMechanism() {
|
|||
break;
|
||||
#endif // BUILDFLAG(IS_OZONE)
|
||||
#if BUILDFLAG(USE_VAAPI_X11)
|
||||
case kVaapiImplementationX11:
|
||||
create_picture_cb_ =
|
||||
base::BindRepeating(&CreateVaapiPictureNativeImpl<VaapiTFPPicture>);
|
||||
// Neither VaapiTFPPicture or VaapiPictureNativePixmapAngle needs the VPP.
|
||||
needs_vpp_for_downloading_ = false;
|
||||
break;
|
||||
case kVaapiImplementationAngle:
|
||||
create_picture_cb_ = base::BindRepeating(
|
||||
&CreateVaapiPictureNativeImpl<VaapiPictureNativePixmapAngle>);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -7,12 +7,6 @@
|
|||
#include "media/gpu/macros.h"
|
||||
#include "media/gpu/vaapi/va_surface.h"
|
||||
#include "media/gpu/vaapi/vaapi_wrapper.h"
|
||||
#include "ui/gfx/buffer_format_util.h"
|
||||
#include "ui/gfx/gpu_memory_buffer.h"
|
||||
#include "ui/gfx/linux/native_pixmap_dmabuf.h"
|
||||
#include "ui/gfx/native_pixmap.h"
|
||||
#include "ui/gl/gl_bindings.h"
|
||||
#include "ui/gl/gl_image_native_pixmap.h"
|
||||
|
||||
namespace media {
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2022 The Chromium Authors and Alex313031
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -105,10 +105,6 @@ BASE_FEATURE(kPartitionSSLSessionsByNetworkIsolationKey,
|
|||
"PartitionSSLSessionsByNetworkIsolationKey",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
BASE_FEATURE(kPartitionExpectCTStateByNetworkIsolationKey,
|
||||
"PartitionExpectCTStateByNetworkIsolationKey",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
BASE_FEATURE(kPartitionNelAndReportingByNetworkIsolationKey,
|
||||
"PartitionNelAndReportingByNetworkIsolationKey",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
@ -121,25 +117,6 @@ BASE_FEATURE(kEnableCrossSiteFlagNetworkAnonymizationKey,
|
|||
"EnableCrossSiteFlagNetworkAnonymizationKey",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
BASE_FEATURE(kExpectCTPruning,
|
||||
"ExpectCTPruning",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
NET_EXPORT extern const base::FeatureParam<int>
|
||||
kExpectCTPruneMax(&kExpectCTPruning, "ExpectCTPruneMax", 2000);
|
||||
NET_EXPORT extern const base::FeatureParam<int>
|
||||
kExpectCTPruneMin(&kExpectCTPruning, "ExpectCTPruneMin", 1800);
|
||||
NET_EXPORT extern const base::FeatureParam<int> kExpectCTSafeFromPruneDays(
|
||||
&kExpectCTPruning,
|
||||
"ExpectCTSafeFromPruneDays",
|
||||
40);
|
||||
NET_EXPORT extern const base::FeatureParam<int> kExpectCTMaxEntriesPerNik(
|
||||
&kExpectCTPruning,
|
||||
"ExpectCTMaxEntriesPerNik",
|
||||
20);
|
||||
NET_EXPORT extern const base::FeatureParam<int>
|
||||
kExpectCTPruneDelaySecs(&kExpectCTPruning, "ExpectCTPruneDelaySecs", 60);
|
||||
|
||||
BASE_FEATURE(kTLS13KeyUpdate,
|
||||
"TLS13KeyUpdate",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
@ -187,8 +164,6 @@ BASE_FEATURE(kCertDualVerificationTrialFeature,
|
|||
#if BUILDFLAG(IS_MAC)
|
||||
const base::FeatureParam<int> kCertDualVerificationTrialImpl{
|
||||
&kCertDualVerificationTrialFeature, "impl", 0};
|
||||
const base::FeatureParam<int> kCertDualVerificationTrialCacheSize{
|
||||
&kCertDualVerificationTrialFeature, "cachesize", 0};
|
||||
#endif /* BUILDFLAG(IS_MAC) */
|
||||
#endif
|
||||
|
||||
|
@ -204,8 +179,6 @@ BASE_FEATURE(kChromeRootStoreUsed,
|
|||
#if BUILDFLAG(IS_MAC)
|
||||
const base::FeatureParam<int> kChromeRootStoreSysImpl{&kChromeRootStoreUsed,
|
||||
"sysimpl", 0};
|
||||
const base::FeatureParam<int> kChromeRootStoreSysCacheSize{
|
||||
&kChromeRootStoreUsed, "syscachesize", 0};
|
||||
#endif /* BUILDFLAG(IS_MAC) */
|
||||
#endif /* BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED) */
|
||||
|
||||
|
@ -281,10 +254,6 @@ BASE_FEATURE(kNoncedPartitionedCookies,
|
|||
"NoncedPartitionedCookies",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
BASE_FEATURE(kExtraCookieValidityChecks,
|
||||
"ExtraCookieValidityChecks",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
BASE_FEATURE(kRecordRadioWakeupTrigger,
|
||||
"RecordRadioWakeupTrigger",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
@ -314,7 +283,7 @@ BASE_FEATURE(kOptimisticBlockfileWrite,
|
|||
// Read as much of the net::URLRequest as there is space in the Mojo data pipe.
|
||||
BASE_FEATURE(kOptimizeNetworkBuffers,
|
||||
"OptimizeNetworkBuffers2",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
const base::FeatureParam<int> kOptimizeNetworkBuffersBytesReadLimit{
|
||||
&kOptimizeNetworkBuffers, "bytes_read_limit", 64 * 1024};
|
||||
|
@ -335,7 +304,7 @@ const base::FeatureParam<int> kOptimizeNetworkBuffersMinInputStreamReadSize{
|
|||
const base::FeatureParam<int>
|
||||
kOptimizeNetworkBuffersMaxInputStreamBytesToReadWhenAvailableUnknown{
|
||||
&kOptimizeNetworkBuffers, "max_input_stream_bytes_available_unknown",
|
||||
32 * 1024};
|
||||
2 * 1024};
|
||||
|
||||
const base::FeatureParam<int>
|
||||
kOptimizeNetworkBuffersFilterSourceStreamBufferSize{
|
||||
|
@ -401,4 +370,10 @@ BASE_FEATURE(kBlockNewForbiddenHeaders,
|
|||
"BlockNewForbiddenHeaders",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
BASE_FEATURE(kPlatformKeyProbeSHA256,
|
||||
"PlatformKeyProbeSHA256",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
#endif
|
||||
|
||||
} // namespace net::features
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2022 The Chromium Authors and Alex313031
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
|||
#include "base/memory/ptr_util.h"
|
||||
#include "base/message_loop/message_pump_type.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "build/build_config.h"
|
||||
#include "ui/base/buildflags.h"
|
||||
#include "ui/base/cursor/cursor_factory.h"
|
||||
|
@ -33,7 +33,6 @@
|
|||
#include "ui/gfx/native_widget_types.h"
|
||||
#include "ui/ozone/common/features.h"
|
||||
#include "ui/ozone/platform/wayland/common/wayland_util.h"
|
||||
#include "ui/ozone/platform/wayland/gpu/drm_render_node_path_finder.h"
|
||||
#include "ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.h"
|
||||
#include "ui/ozone/platform/wayland/gpu/wayland_gl_egl_utility.h"
|
||||
#include "ui/ozone/platform/wayland/gpu/wayland_overlay_manager.h"
|
||||
|
@ -63,16 +62,20 @@
|
|||
#include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(USE_GTK)
|
||||
#include "ui/ozone/platform/wayland/host/linux_ui_delegate_wayland.h" // nogncheck
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
#include "ui/ozone/common/bitmap_cursor_factory.h"
|
||||
#else
|
||||
#include "ui/ozone/platform/wayland/host/wayland_cursor_factory.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
#include "ui/ozone/platform/wayland/host/linux_ui_delegate_wayland.h"
|
||||
#endif
|
||||
|
||||
#if defined(WAYLAND_GBM)
|
||||
#include "ui/ozone/platform/wayland/gpu/drm_render_node_path_finder.h"
|
||||
#endif
|
||||
|
||||
namespace ui {
|
||||
|
||||
namespace {
|
||||
|
@ -184,6 +187,7 @@ class OzonePlatformWayland : public OzonePlatform,
|
|||
|
||||
bool IsNativePixmapConfigSupported(gfx::BufferFormat format,
|
||||
gfx::BufferUsage usage) const override {
|
||||
#if defined(WAYLAND_GBM)
|
||||
// If there is no drm render node device available, native pixmaps are not
|
||||
// supported.
|
||||
if (path_finder_.GetDrmRenderNodePath().empty())
|
||||
|
@ -196,6 +200,9 @@ class OzonePlatformWayland : public OzonePlatform,
|
|||
|
||||
return gfx::ClientNativePixmapDmaBuf::IsConfigurationSupported(format,
|
||||
usage);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ShouldUseCustomFrame() override {
|
||||
|
@ -236,8 +243,8 @@ class OzonePlatformWayland : public OzonePlatform,
|
|||
|
||||
supported_buffer_formats_ =
|
||||
connection_->buffer_manager_host()->GetSupportedBufferFormats();
|
||||
#if BUILDFLAG(USE_GTK)
|
||||
gtk_ui_platform_ =
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
linux_ui_delegate_ =
|
||||
std::make_unique<LinuxUiDelegateWayland>(connection_.get());
|
||||
#endif
|
||||
|
||||
|
@ -259,7 +266,13 @@ class OzonePlatformWayland : public OzonePlatform,
|
|||
}
|
||||
|
||||
void InitializeGPU(const InitParams& args) override {
|
||||
buffer_manager_ = std::make_unique<WaylandBufferManagerGpu>();
|
||||
base::FilePath drm_node_path;
|
||||
#if defined(WAYLAND_GBM)
|
||||
drm_node_path = path_finder_.GetDrmRenderNodePath();
|
||||
if (drm_node_path.empty())
|
||||
LOG(WARNING) << "Failed to find drm render node path.";
|
||||
#endif
|
||||
buffer_manager_ = std::make_unique<WaylandBufferManagerGpu>(drm_node_path);
|
||||
surface_factory_ = std::make_unique<WaylandSurfaceFactory>(
|
||||
connection_.get(), buffer_manager_.get());
|
||||
overlay_manager_ =
|
||||
|
@ -295,7 +308,7 @@ class OzonePlatformWayland : public OzonePlatform,
|
|||
// arbitrary position.
|
||||
properties->supports_global_screen_coordinates =
|
||||
features::IsWaylandScreenCoordinatesEnabled();
|
||||
|
||||
|
||||
// Let the media know this platform supports va-api.
|
||||
properties->supports_vaapi = true;
|
||||
|
||||
|
@ -336,6 +349,11 @@ class OzonePlatformWayland : public OzonePlatform,
|
|||
properties.supports_activation =
|
||||
zaura_shell_get_version(connection_->zaura_shell()->wl_object()) >=
|
||||
ZAURA_TOPLEVEL_ACTIVATE_SINCE_VERSION;
|
||||
properties.supports_tooltip =
|
||||
(wl::get_version_of_object(
|
||||
connection_->zaura_shell()->wl_object()) >=
|
||||
ZAURA_SURFACE_SHOW_TOOLTIP_SINCE_VERSION) &&
|
||||
connection_->zaura_shell()->HasBugFix(1400226);
|
||||
}
|
||||
|
||||
if (surface_factory_) {
|
||||
|
@ -371,7 +389,7 @@ class OzonePlatformWayland : public OzonePlatform,
|
|||
// Please note this call happens on the gpu.
|
||||
auto gpu_task_runner = buffer_manager_->gpu_thread_runner();
|
||||
if (!gpu_task_runner)
|
||||
gpu_task_runner = base::ThreadTaskRunnerHandle::Get();
|
||||
gpu_task_runner = base::SingleThreadTaskRunner::GetCurrentDefault();
|
||||
|
||||
binders->Add<ozone::mojom::WaylandBufferManagerGpu>(
|
||||
base::BindRepeating(
|
||||
|
@ -425,12 +443,14 @@ class OzonePlatformWayland : public OzonePlatform,
|
|||
// framework.
|
||||
wl::BufferFormatsWithModifiersMap supported_buffer_formats_;
|
||||
|
||||
#if defined(WAYLAND_GBM)
|
||||
// This is used both in the gpu and browser processes to find out if a drm
|
||||
// render node is available.
|
||||
DrmRenderNodePathFinder path_finder_;
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(USE_GTK)
|
||||
std::unique_ptr<LinuxUiDelegateWayland> gtk_ui_platform_;
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
std::unique_ptr<LinuxUiDelegateWayland> linux_ui_delegate_;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -20,13 +20,12 @@
|
|||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/models/combobox_model.h"
|
||||
#include "ui/base/ui_base_paths.h"
|
||||
#include "ui/color/color_id.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/controls/combobox/combobox.h"
|
||||
#include "ui/views/controls/label.h"
|
||||
#include "ui/views/controls/tabbed_pane/tabbed_pane.h"
|
||||
#include "ui/views/controls/tabbed_pane/tabbed_pane_listener.h"
|
||||
#include "ui/views/examples/create_examples.h"
|
||||
#include "ui/views/examples/grit/views_examples_resources.h"
|
||||
#include "ui/views/layout/box_layout.h"
|
||||
|
@ -106,82 +105,28 @@ ExampleVector GetExamplesToShow(ExampleVector examples) {
|
|||
|
||||
} // namespace
|
||||
|
||||
// Model for the examples that are being added via AddExample().
|
||||
class ComboboxModelExampleList : public ui::ComboboxModel {
|
||||
public:
|
||||
ComboboxModelExampleList() = default;
|
||||
|
||||
ComboboxModelExampleList(const ComboboxModelExampleList&) = delete;
|
||||
ComboboxModelExampleList& operator=(const ComboboxModelExampleList&) = delete;
|
||||
|
||||
~ComboboxModelExampleList() override = default;
|
||||
|
||||
void SetExamples(ExampleVector examples) {
|
||||
example_list_ = std::move(examples);
|
||||
}
|
||||
|
||||
// ui::ComboboxModel:
|
||||
size_t GetItemCount() const override { return example_list_.size(); }
|
||||
std::u16string GetItemAt(size_t index) const override {
|
||||
return base::UTF8ToUTF16(example_list_[index]->example_title());
|
||||
}
|
||||
|
||||
View* GetItemViewAt(size_t index) {
|
||||
return example_list_[index]->example_view();
|
||||
}
|
||||
|
||||
private:
|
||||
ExampleVector example_list_;
|
||||
};
|
||||
|
||||
class ExamplesWindowContents : public WidgetDelegateView {
|
||||
class ExamplesWindowContents : public WidgetDelegateView,
|
||||
public TabbedPaneListener {
|
||||
public:
|
||||
ExamplesWindowContents(base::OnceClosure on_close, ExampleVector examples)
|
||||
: on_close_(std::move(on_close)) {
|
||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
|
||||
SetHasWindowSizeControls(true);
|
||||
SetBackground(CreateThemedSolidBackground(ui::kColorDialogBackground));
|
||||
|
||||
if (command_line->HasSwitch(kEnableSidePanel)) {
|
||||
SetLayoutManager(std::make_unique<views::BoxLayout>(
|
||||
BoxLayout::Orientation::kHorizontal, gfx::Insets(0)));
|
||||
auto* layout = SetLayoutManager(std::make_unique<views::BoxLayout>(
|
||||
BoxLayout::Orientation::kVertical, gfx::Insets(0)));
|
||||
|
||||
auto tabbed_pane =
|
||||
std::make_unique<TabbedPane>(TabbedPane::Orientation::kVertical,
|
||||
TabbedPane::TabStripStyle::kBorder);
|
||||
auto tabbed_pane =
|
||||
std::make_unique<TabbedPane>(TabbedPane::Orientation::kVertical,
|
||||
TabbedPane::TabStripStyle::kBorder, true);
|
||||
|
||||
tabbed_pane_ = AddChildView(std::move(tabbed_pane));
|
||||
CreateSidePanel(std::move(examples));
|
||||
} else {
|
||||
for (auto& example : examples)
|
||||
example->CreateExampleView(example->example_view());
|
||||
tabbed_pane_ = AddChildView(std::move(tabbed_pane));
|
||||
layout->SetFlexForView(tabbed_pane_, 1);
|
||||
CreateSidePanel(std::move(examples));
|
||||
|
||||
auto combobox_model = std::make_unique<ComboboxModelExampleList>();
|
||||
combobox_model_ = combobox_model.get();
|
||||
combobox_model_->SetExamples(std::move(examples));
|
||||
auto combobox = std::make_unique<Combobox>(std::move(combobox_model));
|
||||
|
||||
combobox->SetCallback(base::BindRepeating(
|
||||
&ExamplesWindowContents::ComboboxChanged, base::Unretained(this)));
|
||||
combobox->SetAccessibleName(
|
||||
l10n_util::GetStringUTF16(IDS_EXAMPLES_COMBOBOX_AX_LABEL));
|
||||
|
||||
auto* layout = SetLayoutManager(std::make_unique<views::BoxLayout>(
|
||||
BoxLayout::Orientation::kVertical, gfx::Insets(5)));
|
||||
|
||||
combobox_ = AddChildView(std::move(combobox));
|
||||
|
||||
auto item_count = combobox_model_->GetItemCount();
|
||||
if (item_count > 0) {
|
||||
combobox_->SetVisible(item_count > 1);
|
||||
example_shown_ = AddChildView(std::make_unique<View>());
|
||||
example_shown_->SetLayoutManager(std::make_unique<FillLayout>());
|
||||
example_shown_->AddChildView(combobox_model_->GetItemViewAt(0));
|
||||
layout->SetFlexForView(example_shown_, 1);
|
||||
}
|
||||
}
|
||||
status_label_ = AddChildView(std::make_unique<Label>());
|
||||
status_label_->SetVisible(false);
|
||||
tabbed_pane_->set_listener(this);
|
||||
instance_ = this;
|
||||
}
|
||||
|
||||
|
@ -193,8 +138,11 @@ class ExamplesWindowContents : public WidgetDelegateView {
|
|||
// Sets the status area (at the bottom of the window) to |status|.
|
||||
void SetStatus(const std::string& status) {
|
||||
status_label_->SetText(base::UTF8ToUTF16(status));
|
||||
status_label_->SetVisible(!status.empty());
|
||||
}
|
||||
|
||||
void TabSelectedAt(int index) override { status_label_->SetVisible(false); }
|
||||
|
||||
static ExamplesWindowContents* instance() { return instance_; }
|
||||
|
||||
private:
|
||||
|
@ -206,56 +154,32 @@ class ExamplesWindowContents : public WidgetDelegateView {
|
|||
std::move(on_close_).Run();
|
||||
}
|
||||
gfx::Size CalculatePreferredSize() const override {
|
||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
gfx::Size size(800, 300);
|
||||
if (command_line->HasSwitch(kEnableSidePanel)) {
|
||||
for (size_t i = 0; i < tabbed_pane_->GetTabCount(); i++) {
|
||||
size.set_height(std::max(
|
||||
size.height(),
|
||||
tabbed_pane_->GetTabAt(i)->contents()->GetHeightForWidth(800)));
|
||||
}
|
||||
} else {
|
||||
for (size_t i = 0; i < combobox_model_->GetItemCount(); i++) {
|
||||
size.set_height(std::max(
|
||||
size.height(),
|
||||
combobox_model_->GetItemViewAt(i)->GetHeightForWidth(800)));
|
||||
}
|
||||
for (size_t i = 0; i < tabbed_pane_->GetTabCount(); i++) {
|
||||
size.set_height(std::max(
|
||||
size.height(),
|
||||
tabbed_pane_->GetTabAt(i)->contents()->GetHeightForWidth(800)));
|
||||
}
|
||||
return size;
|
||||
}
|
||||
gfx::Size GetMinimumSize() const override { return gfx::Size(50, 50); }
|
||||
|
||||
void ComboboxChanged() {
|
||||
size_t index = combobox_->GetSelectedIndex().value();
|
||||
DCHECK_LT(index, combobox_model_->GetItemCount());
|
||||
example_shown_->RemoveAllChildViewsWithoutDeleting();
|
||||
example_shown_->AddChildView(combobox_model_->GetItemViewAt(index));
|
||||
example_shown_->RequestFocus();
|
||||
SetStatus(std::string());
|
||||
InvalidateLayout();
|
||||
}
|
||||
|
||||
void CreateSidePanel(ExampleVector examples) {
|
||||
for (auto& example : examples) {
|
||||
auto tab_contents = std::make_unique<View>();
|
||||
tabbed_pane_->AddTab(base::UTF8ToUTF16(example->example_title()),
|
||||
std::move(tab_contents));
|
||||
}
|
||||
// Currently only create a few examples as some will crash the application
|
||||
// on run.
|
||||
for (int i = 0; i < 11; i++) {
|
||||
examples[i]->CreateExampleView(tabbed_pane_->GetTabAt(i)->contents());
|
||||
example->CreateExampleView(tab_contents.get());
|
||||
example->SetContainer(
|
||||
tabbed_pane_->AddTab(base::UTF8ToUTF16(example->example_title()),
|
||||
std::move(tab_contents)));
|
||||
}
|
||||
examples_ = std::move(examples);
|
||||
}
|
||||
|
||||
static ExamplesWindowContents* instance_;
|
||||
raw_ptr<View> example_shown_ = nullptr;
|
||||
raw_ptr<Label> status_label_ = nullptr;
|
||||
base::OnceClosure on_close_;
|
||||
raw_ptr<TabbedPane> tabbed_pane_ = nullptr;
|
||||
raw_ptr<Combobox> combobox_ = nullptr;
|
||||
// Owned by |combobox_|.
|
||||
raw_ptr<ComboboxModelExampleList> combobox_model_ = nullptr;
|
||||
ExampleVector examples_;
|
||||
};
|
||||
|
||||
// static
|
||||
|
|
Loading…
Reference in a new issue