chore: replace absl::optional<T> with std::optional<T> (#40928)

* chore: replace absl::optional<T> with std::optional<T>

* IWYU
This commit is contained in:
Milan Burda 2024-01-10 23:23:35 +01:00 committed by GitHub
parent fac964ac0d
commit 892c9d78a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
129 changed files with 419 additions and 397 deletions

View file

@ -6,6 +6,7 @@
#include <limits>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <utility>
@ -128,7 +129,6 @@
#include "shell/common/thread_restrictions.h"
#include "shell/common/v8_value_serializer.h"
#include "storage/browser/file_system/isolated_context.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/messaging/transferable_message_mojom_traits.h"
@ -496,9 +496,9 @@ void OnCapturePageDone(gin_helper::Promise<gfx::Image> promise,
capture_handle.RunAndReset();
}
absl::optional<base::TimeDelta> GetCursorBlinkInterval() {
std::optional<base::TimeDelta> GetCursorBlinkInterval() {
#if BUILDFLAG(IS_MAC)
absl::optional<base::TimeDelta> system_value(
std::optional<base::TimeDelta> system_value(
ui::TextInsertionCaretBlinkPeriodFromDefaults());
if (system_value)
return *system_value;
@ -512,7 +512,7 @@ absl::optional<base::TimeDelta> GetCursorBlinkInterval() {
: base::Milliseconds(system_msec);
}
#endif
return absl::nullopt;
return std::nullopt;
}
#if BUILDFLAG(ENABLE_PRINTING)
@ -1104,7 +1104,7 @@ void WebContents::Destroy() {
}
}
void WebContents::Close(absl::optional<gin_helper::Dictionary> options) {
void WebContents::Close(std::optional<gin_helper::Dictionary> options) {
bool dispatch_beforeunload = false;
if (options)
options->Get("waitForBeforeUnload", &dispatch_beforeunload);
@ -1675,7 +1675,7 @@ void WebContents::HandleNewRenderFrame(
}
void WebContents::OnBackgroundColorChanged() {
absl::optional<SkColor> color = web_contents()->GetBackgroundColor();
std::optional<SkColor> color = web_contents()->GetBackgroundColor();
if (color.has_value()) {
auto* const view = web_contents()->GetRenderWidgetHostView();
static_cast<content::RenderWidgetHostViewBase*>(view)
@ -2266,7 +2266,7 @@ void WebContents::SetOwnerWindow(NativeWindow* owner_window) {
SetOwnerWindow(GetWebContents(), owner_window);
}
void WebContents::SetOwnerBaseWindow(absl::optional<BaseWindow*> owner_window) {
void WebContents::SetOwnerBaseWindow(std::optional<BaseWindow*> owner_window) {
SetOwnerWindow(GetWebContents(),
owner_window ? (*owner_window)->window() : nullptr);
}
@ -3169,8 +3169,8 @@ v8::Local<v8::Promise> WebContents::PrintToPDF(const base::Value& settings) {
web_contents()->GetPrimaryMainFrame()->GetLastCommittedURL(),
landscape, display_header_footer, print_background, scale,
paper_width, paper_height, margin_top, margin_bottom, margin_left,
margin_right, absl::make_optional(header_template),
absl::make_optional(footer_template), prefer_css_page_size,
margin_right, std::make_optional(header_template),
std::make_optional(footer_template), prefer_css_page_size,
generate_tagged_pdf, generate_document_outline);
if (absl::holds_alternative<std::string>(print_pages_params)) {
@ -3780,7 +3780,7 @@ void WebContents::SetImageAnimationPolicy(const std::string& new_policy) {
web_contents()->OnWebPreferencesChanged();
}
void WebContents::SetBackgroundColor(absl::optional<SkColor> maybe_color) {
void WebContents::SetBackgroundColor(std::optional<SkColor> maybe_color) {
SkColor color = maybe_color.value_or((IsGuest() && guest_transparent_) ||
type_ == Type::kBrowserView
? SK_ColorTRANSPARENT
@ -4124,7 +4124,7 @@ void WebContents::DevToolsIndexPath(
if (devtools_indexing_jobs_.count(request_id) != 0)
return;
std::vector<std::string> excluded_folders;
absl::optional<base::Value> parsed_excluded_folders =
std::optional<base::Value> parsed_excluded_folders =
base::JSONReader::Read(excluded_folders_message);
if (parsed_excluded_folders && parsed_excluded_folders->is_list()) {
for (const base::Value& folder_path : parsed_excluded_folders->GetList()) {