chrome: Replace base::Optional and friends with absl counterparts
This replaces:
- base::Optional -> absl::optional
- include "base/optional.h"
->
include "third_party/abseil-cpp/absl/types/optional.h"
- base::nullopt -> absl::nullopt
- base::make_optional -> absl::make_optional
Bug: 1202909
AX-Relnotes: n/a.
Change-Id: If011b89bfb5f3561e152aeee242b0b2fe1ab4587
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897520
Auto-Submit: Anton Bikineev <[email protected]>
Commit-Queue: Peter Kasting <[email protected]>
Reviewed-by: Peter Kasting <[email protected]>
Owners-Override: Peter Kasting <[email protected]>
Cr-Commit-Position: refs/heads/master@{#883266}
diff --git a/chrome/android/features/cablev2_authenticator/native/cablev2_authenticator_android.cc b/chrome/android/features/cablev2_authenticator/native/cablev2_authenticator_android.cc
index 9664451..ae9d97a75 100644
--- a/chrome/android/features/cablev2_authenticator/native/cablev2_authenticator_android.cc
+++ b/chrome/android/features/cablev2_authenticator/native/cablev2_authenticator_android.cc
@@ -111,7 +111,7 @@
// the span is not of the correct length. Be aware that the reference for |data|
// must outlive the span.
template <size_t N>
-base::Optional<base::span<const uint8_t, N>> JavaByteArrayToFixedSpan(
+absl::optional<base::span<const uint8_t, N>> JavaByteArrayToFixedSpan(
JNIEnv* env,
const JavaParamRef<jbyteArray>& data) {
static_assert(N != 0,
@@ -119,12 +119,12 @@
"inputs will always be rejected here.");
if (data.is_null()) {
- return base::nullopt;
+ return absl::nullopt;
}
const size_t data_len = env->GetArrayLength(data);
if (data_len != N) {
- return base::nullopt;
+ return absl::nullopt;
}
const jbyte* data_bytes = env->GetByteArrayElements(data, /*iscopy=*/nullptr);
return base::as_bytes(base::make_span<N>(data_bytes, data_len));
@@ -141,7 +141,7 @@
// reserved so that functions can still return that to indicate an error.
jlong instance_num = 1;
- base::Optional<std::array<uint8_t, device::cablev2::kRootSecretSize>>
+ absl::optional<std::array<uint8_t, device::cablev2::kRootSecretSize>>
root_secret;
network::mojom::NetworkContext* network_context = nullptr;
@@ -155,18 +155,18 @@
// pending_make_credential_callback holds the callback that the
// |Authenticator| expects to be run once a makeCredential operation has
// completed.
- base::Optional<
+ absl::optional<
device::cablev2::authenticator::Platform::MakeCredentialCallback>
pending_make_credential_callback;
// pending_get_assertion_callback holds the callback that the
// |Authenticator| expects to be run once a getAssertion operation has
// completed.
- base::Optional<device::cablev2::authenticator::Platform::GetAssertionCallback>
+ absl::optional<device::cablev2::authenticator::Platform::GetAssertionCallback>
pending_get_assertion_callback;
// usb_callback holds the callback that receives data from a USB connection.
- base::Optional<
- base::RepeatingCallback<void(base::Optional<base::span<const uint8_t>>)>>
+ absl::optional<
+ base::RepeatingCallback<void(absl::optional<base::span<const uint8_t>>)>>
usb_callback;
// pending_event holds a cloud message while we are waiting for the user to
@@ -306,7 +306,7 @@
static_cast<int>(status));
}
- void OnCompleted(base::Optional<Error> maybe_error) override {
+ void OnCompleted(absl::optional<Error> maybe_error) override {
LOG(ERROR) << __func__ << " "
<< (maybe_error ? static_cast<int>(*maybe_error) : -1);
@@ -374,7 +374,7 @@
private:
JNIEnv* const env_;
ScopedJavaGlobalRef<jobject> cable_authenticator_;
- base::Optional<base::ElapsedTimer> tunnel_server_connect_time_;
+ absl::optional<base::ElapsedTimer> tunnel_server_connect_time_;
// is_usb_ is true if this object was created in order to respond to a client
// connected over USB.
@@ -400,7 +400,7 @@
// GetCallback returns callback which will be called repeatedly with data from
// the USB connection, forwarded via the Java code.
- base::RepeatingCallback<void(base::Optional<base::span<const uint8_t>>)>
+ base::RepeatingCallback<void(absl::optional<base::span<const uint8_t>>)>
GetCallback() {
return base::BindRepeating(&USBTransport::OnData,
weak_factory_.GetWeakPtr());
@@ -418,7 +418,7 @@
}
private:
- void OnData(base::Optional<base::span<const uint8_t>> data) {
+ void OnData(absl::optional<base::span<const uint8_t>> data) {
if (!data) {
callback_.Run(Disconnected::kDisconnected);
} else {
@@ -513,7 +513,7 @@
GlobalData& global_data = GetGlobalData();
const std::string& qr_string = ConvertJavaStringToUTF8(qr_url);
- base::Optional<device::cablev2::qr::Components> decoded_qr(
+ absl::optional<device::cablev2::qr::Components> decoded_qr(
device::cablev2::qr::Parse(qr_string));
if (!decoded_qr) {
FIDO_LOG(ERROR) << "Failed to decode QR: " << qr_string;
@@ -532,7 +532,7 @@
global_data.network_context, *global_data.root_secret,
ConvertJavaStringToUTF8(authenticator_name), decoded_qr->secret,
decoded_qr->peer_identity,
- link ? global_data.registration->contact_id() : base::nullopt);
+ link ? global_data.registration->contact_id() : absl::nullopt);
return ++global_data.instance_num;
}
@@ -545,7 +545,7 @@
constexpr size_t kDataSize =
device::kP256X962Length + device::cablev2::kQRSecretSize;
- const base::Optional<base::span<const uint8_t, kDataSize>> server_link_data =
+ const absl::optional<base::span<const uint8_t, kDataSize>> server_link_data =
JavaByteArrayToFixedSpan<kDataSize>(env, server_link_data_java);
// validateServerLinkData should have been called to check this already.
CHECK(server_link_data);
@@ -562,7 +562,7 @@
global_data.network_context, dummy_root_secret, dummy_authenticator_name,
server_link_data
->subspan<device::kP256X962Length, device::cablev2::kQRSecretSize>(),
- server_link_data->subspan<0, device::kP256X962Length>(), base::nullopt);
+ server_link_data->subspan<0, device::kP256X962Length>(), absl::nullopt);
return ++global_data.instance_num;
}
@@ -577,7 +577,7 @@
std::unique_ptr<device::cablev2::authenticator::Registration::Event> event =
std::move(global_data.pending_event);
- base::Optional<base::span<const uint8_t>> maybe_contact_id;
+ absl::optional<base::span<const uint8_t>> maybe_contact_id;
if (event->source ==
device::cablev2::authenticator::Registration::Type::LINKING) {
// If the event if from linking then the contact_id must be ready because
@@ -708,7 +708,7 @@
}
if (!usb_data) {
- global_data.usb_callback->Run(base::nullopt);
+ global_data.usb_callback->Run(absl::nullopt);
} else {
global_data.usb_callback->Run(JavaByteArrayToSpan(env, usb_data));
}
diff --git a/chrome/browser/about_flags_unittest.cc b/chrome/browser/about_flags_unittest.cc
index 7f7743f..bc99d18 100644
--- a/chrome/browser/about_flags_unittest.cc
+++ b/chrome/browser/about_flags_unittest.cc
@@ -179,7 +179,7 @@
};
TEST_F(AboutFlagsHistogramTest, CheckHistograms) {
- base::Optional<base::HistogramEnumEntryMap> login_custom_flags =
+ absl::optional<base::HistogramEnumEntryMap> login_custom_flags =
base::ReadEnumFromEnumsXml("LoginCustomFlags");
ASSERT_TRUE(login_custom_flags)
<< "Error reading enum 'LoginCustomFlags' from "
diff --git a/chrome/browser/accessibility/accessibility_ui.cc b/chrome/browser/accessibility/accessibility_ui.cc
index eea6e7e..8905cd7 100644
--- a/chrome/browser/accessibility/accessibility_ui.cc
+++ b/chrome/browser/accessibility/accessibility_ui.cc
@@ -13,7 +13,6 @@
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/json/json_writer.h"
-#include "base/optional.h"
#include "base/strings/pattern.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
@@ -41,6 +40,7 @@
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_ui_data_source.h"
#include "net/base/escape.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/platform/ax_platform_node.h"
#include "ui/accessibility/platform/ax_platform_node_delegate.h"
@@ -722,7 +722,7 @@
void AccessibilityUIMessageHandler::StopRecording(
content::WebContents* web_contents) {
- web_contents->RecordAccessibilityEvents(false, base::nullopt);
+ web_contents->RecordAccessibilityEvents(false, absl::nullopt);
observer_.reset(nullptr);
}
diff --git a/chrome/browser/accessibility/caption_controller.h b/chrome/browser/accessibility/caption_controller.h
index c1d4e7f9..9fc1a83f 100644
--- a/chrome/browser/accessibility/caption_controller.h
+++ b/chrome/browser/accessibility/caption_controller.h
@@ -104,7 +104,7 @@
std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
std::unique_ptr<CaptionBubbleController> caption_bubble_controller_;
- base::Optional<ui::CaptionStyle> caption_style_;
+ absl::optional<ui::CaptionStyle> caption_style_;
// Whether Live Caption is enabled.
bool enabled_ = false;
diff --git a/chrome/browser/accessibility/caption_util.cc b/chrome/browser/accessibility/caption_util.cc
index 64508bf..5fc06181 100644
--- a/chrome/browser/accessibility/caption_util.cc
+++ b/chrome/browser/accessibility/caption_util.cc
@@ -16,7 +16,7 @@
// Returns whether the style is default or not. If the user has changed any of
// the captions settings from the default value, that is an interesting metric
// to observe.
-bool IsDefaultStyle(base::Optional<ui::CaptionStyle> style) {
+bool IsDefaultStyle(absl::optional<ui::CaptionStyle> style) {
return (style.has_value() && style->text_size.empty() &&
style->font_family.empty() && style->text_color.empty() &&
style->background_color.empty() && style->text_shadow.empty());
@@ -26,11 +26,11 @@
namespace captions {
-base::Optional<ui::CaptionStyle> GetCaptionStyleFromUserSettings(
+absl::optional<ui::CaptionStyle> GetCaptionStyleFromUserSettings(
PrefService* prefs,
bool record_metrics) {
// Apply native CaptionStyle parameters.
- base::Optional<ui::CaptionStyle> style;
+ absl::optional<ui::CaptionStyle> style;
// Apply native CaptionStyle parameters.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
diff --git a/chrome/browser/accessibility/caption_util.h b/chrome/browser/accessibility/caption_util.h
index dfce8d6..1b3d6d9 100644
--- a/chrome/browser/accessibility/caption_util.h
+++ b/chrome/browser/accessibility/caption_util.h
@@ -11,7 +11,7 @@
namespace captions {
-base::Optional<ui::CaptionStyle> GetCaptionStyleFromUserSettings(
+absl::optional<ui::CaptionStyle> GetCaptionStyleFromUserSettings(
PrefService* prefs,
bool record_metrics);
diff --git a/chrome/browser/accessibility/image_annotation_browsertest.cc b/chrome/browser/accessibility/image_annotation_browsertest.cc
index 07ee0667..bec451d 100644
--- a/chrome/browser/accessibility/image_annotation_browsertest.cc
+++ b/chrome/browser/accessibility/image_annotation_browsertest.cc
@@ -167,7 +167,7 @@
static bool return_ocr_results_;
static bool return_label_results_;
static std::map<std::string, std::string> custom_label_result_mapping_;
- static base::Optional<image_annotation::mojom::AnnotateImageError>
+ static absl::optional<image_annotation::mojom::AnnotateImageError>
return_error_code_;
DISALLOW_COPY_AND_ASSIGN(FakeAnnotator);
@@ -180,7 +180,7 @@
// static
std::map<std::string, std::string> FakeAnnotator::custom_label_result_mapping_;
// static
-base::Optional<image_annotation::mojom::AnnotateImageError>
+absl::optional<image_annotation::mojom::AnnotateImageError>
FakeAnnotator::return_error_code_;
// The fake ImageAnnotationService, which handles mojo calls from the renderer
diff --git a/chrome/browser/android/autofill_assistant/client_android.cc b/chrome/browser/android/autofill_assistant/client_android.cc
index dd40e669..e4f96fee 100644
--- a/chrome/browser/android/autofill_assistant/client_android.cc
+++ b/chrome/browser/android/autofill_assistant/client_android.cc
@@ -113,7 +113,7 @@
std::unique_ptr<TriggerContext> trigger_context,
std::unique_ptr<Service> test_service_to_inject,
const base::android::JavaRef<jobject>& joverlay_coordinator,
- const base::Optional<TriggerScriptProto>& trigger_script) {
+ const absl::optional<TriggerScriptProto>& trigger_script) {
// When Start() is called, AA_START should have been measured. From now on,
// the client is responsible for keeping track of dropouts, so that for each
// AA_START there's a corresponding dropout.
@@ -207,7 +207,7 @@
const base::android::JavaParamRef<jobjectArray>& jparameter_values,
const base::android::JavaParamRef<jobject>& jcallback) {
if (!controller_)
- CreateController(nullptr, base::nullopt);
+ CreateController(nullptr, absl::nullopt);
base::android::ScopedJavaGlobalRef<jobject> scoped_jcallback(env, jcallback);
controller_->Track(
@@ -403,7 +403,7 @@
(controller_ != nullptr &&
!ui_controller_android_->IsAttachedTo(controller_.get()))) {
if (!controller_)
- CreateController(nullptr, base::nullopt);
+ CreateController(nullptr, absl::nullopt);
ui_controller_android_->Attach(web_contents_, this, controller_.get());
}
}
@@ -431,11 +431,11 @@
return account_info.email;
}
-base::Optional<std::pair<int, int>> ClientAndroid::GetWindowSize() const {
+absl::optional<std::pair<int, int>> ClientAndroid::GetWindowSize() const {
if (ui_controller_android_) {
return ui_controller_android_->GetWindowSize();
}
- return base::nullopt;
+ return absl::nullopt;
}
ClientContextProto::ScreenOrientation ClientAndroid::GetScreenOrientation()
@@ -551,13 +551,13 @@
void ClientAndroid::CreateController(
std::unique_ptr<Service> service,
- const base::Optional<TriggerScriptProto>& trigger_script) {
+ const absl::optional<TriggerScriptProto>& trigger_script) {
// Persist status message and progress bar when transitioning from trigger
// script.
std::string status_message;
- base::Optional<ShowProgressBarProto::StepProgressBarConfiguration>
+ absl::optional<ShowProgressBarProto::StepProgressBarConfiguration>
progress_bar_config;
- base::Optional<int> progress_bar_active_step;
+ absl::optional<int> progress_bar_active_step;
if (trigger_script.has_value()) {
status_message = trigger_script->user_interface()
.regular_script_loading_status_message();
diff --git a/chrome/browser/android/autofill_assistant/client_android.h b/chrome/browser/android/autofill_assistant/client_android.h
index 3574757..5fae916 100644
--- a/chrome/browser/android/autofill_assistant/client_android.h
+++ b/chrome/browser/android/autofill_assistant/client_android.h
@@ -12,7 +12,6 @@
#include "base/android/scoped_java_ref.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/android/autofill_assistant/ui_controller_android.h"
#include "components/autofill_assistant/browser/client.h"
#include "components/autofill_assistant/browser/controller.h"
@@ -23,6 +22,7 @@
#include "components/autofill_assistant/browser/website_login_manager.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace autofill_assistant {
@@ -57,7 +57,7 @@
std::unique_ptr<TriggerContext> trigger_context,
std::unique_ptr<Service> test_service_to_inject,
const base::android::JavaRef<jobject>& joverlay_coordinator,
- const base::Optional<TriggerScriptProto>& trigger_script);
+ const absl::optional<TriggerScriptProto>& trigger_script);
void OnJavaDestroyUI(JNIEnv* env,
const base::android::JavaParamRef<jobject>& jcaller);
void TransferUITo(
@@ -104,7 +104,7 @@
version_info::Channel GetChannel() const override;
std::string GetEmailAddressForAccessTokenAccount() const override;
std::string GetChromeSignedInEmailAddress() const override;
- base::Optional<std::pair<int, int>> GetWindowSize() const override;
+ absl::optional<std::pair<int, int>> GetWindowSize() const override;
ClientContextProto::ScreenOrientation GetScreenOrientation() const override;
AccessTokenFetcher* GetAccessTokenFetcher() override;
autofill::PersonalDataManager* GetPersonalDataManager() const override;
@@ -130,7 +130,7 @@
void CreateController(
std::unique_ptr<Service> service,
- const base::Optional<TriggerScriptProto>& trigger_script);
+ const absl::optional<TriggerScriptProto>& trigger_script);
void DestroyController();
void AttachUI(const base::android::JavaRef<jobject>& joverlay_coordinator);
bool NeedsUI();
diff --git a/chrome/browser/android/autofill_assistant/generic_ui_interactions_android.cc b/chrome/browser/android/autofill_assistant/generic_ui_interactions_android.cc
index 446297f8..e98bc1e 100644
--- a/chrome/browser/android/autofill_assistant/generic_ui_interactions_android.cc
+++ b/chrome/browser/android/autofill_assistant/generic_ui_interactions_android.cc
@@ -5,12 +5,12 @@
#include "chrome/browser/android/autofill_assistant/generic_ui_interactions_android.h"
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
-#include "base/optional.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantViewInteractions_jni.h"
#include "chrome/browser/android/autofill_assistant/ui_controller_android_utils.h"
#include "chrome/browser/android/autofill_assistant/view_handler_android.h"
#include "components/autofill_assistant/browser/radio_button_controller.h"
#include "components/autofill_assistant/browser/user_model.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace autofill_assistant {
namespace android_interactions {
@@ -84,7 +84,7 @@
return;
}
- base::Optional<ValueProto> item_types;
+ absl::optional<ValueProto> item_types;
if (proto.has_item_types()) {
item_types = user_model->GetValue(proto.item_types());
if (!item_types.has_value()) {
diff --git a/chrome/browser/android/autofill_assistant/interaction_handler_android.cc b/chrome/browser/android/autofill_assistant/interaction_handler_android.cc
index 19e9370..7de276f 100644
--- a/chrome/browser/android/autofill_assistant/interaction_handler_android.cc
+++ b/chrome/browser/android/autofill_assistant/interaction_handler_android.cc
@@ -8,7 +8,6 @@
#include "base/android/jni_string.h"
#include "base/callback_helpers.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/android/autofill_assistant/generic_ui_interactions_android.h"
#include "chrome/browser/android/autofill_assistant/generic_ui_nested_controller_android.h"
@@ -19,6 +18,7 @@
#include "components/autofill_assistant/browser/ui_delegate.h"
#include "components/autofill_assistant/browser/user_model.h"
#include "components/autofill_assistant/browser/value_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace autofill_assistant {
@@ -140,7 +140,7 @@
}
// Wrap callback in condition handler if necessary.
if (callback_proto.has_condition_model_identifier()) {
- callback = base::Optional<InteractionCallback>(base::BindRepeating(
+ callback = absl::optional<InteractionCallback>(base::BindRepeating(
&android_interactions::RunConditionalCallback,
basic_interactions_->GetWeakPtr(),
callback_proto.condition_model_identifier(), *callback));
@@ -178,7 +178,7 @@
}
}
-base::Optional<InteractionHandlerAndroid::InteractionCallback>
+absl::optional<InteractionHandlerAndroid::InteractionCallback>
InteractionHandlerAndroid::CreateInteractionCallbackFromProto(
const CallbackProto& proto) {
switch (proto.kind_case()) {
@@ -186,13 +186,13 @@
if (!proto.set_value().has_value()) {
VLOG(1) << "Error creating SetValue interaction: value "
"not set";
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&android_interactions::SetValue, basic_interactions_->GetWeakPtr(),
proto.set_value()));
case CallbackProto::kShowInfoPopup: {
- return base::Optional<InteractionCallback>(
+ return absl::optional<InteractionCallback>(
base::BindRepeating(&android_interactions::ShowInfoPopup,
proto.show_info_popup().info_popup(), jcontext_));
}
@@ -200,135 +200,135 @@
if (!proto.show_list_popup().has_item_names()) {
VLOG(1) << "Error creating ShowListPopup interaction: "
"item_names not set";
- return base::nullopt;
+ return absl::nullopt;
}
if (proto.show_list_popup()
.selected_item_indices_model_identifier()
.empty()) {
VLOG(1) << "Error creating ShowListPopup interaction: "
"selected_item_indices_model_identifier not set";
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&android_interactions::ShowListPopup, user_model_->GetWeakPtr(),
proto.show_list_popup(), jcontext_, jdelegate_));
case CallbackProto::kComputeValue:
if (proto.compute_value().result_model_identifier().empty()) {
VLOG(1) << "Error creating ComputeValue interaction: "
"result_model_identifier empty";
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&android_interactions::ComputeValue,
basic_interactions_->GetWeakPtr(), proto.compute_value()));
case CallbackProto::kSetUserActions:
if (!proto.set_user_actions().has_user_actions()) {
VLOG(1) << "Error creating SetUserActions interaction: "
"user_actions not set";
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&android_interactions::SetUserActions,
basic_interactions_->GetWeakPtr(), proto.set_user_actions()));
case CallbackProto::kEndAction:
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&android_interactions::EndAction, basic_interactions_->GetWeakPtr(),
proto.end_action()));
case CallbackProto::kShowCalendarPopup:
if (proto.show_calendar_popup().date_model_identifier().empty()) {
VLOG(1) << "Error creating ShowCalendarPopup interaction: "
"date_model_identifier not set";
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&android_interactions::ShowCalendarPopup, user_model_->GetWeakPtr(),
proto.show_calendar_popup(), jcontext_, jdelegate_));
case CallbackProto::kSetText:
if (!proto.set_text().has_text()) {
VLOG(1) << "Error creating SetText interaction: "
"text not set";
- return base::nullopt;
+ return absl::nullopt;
}
if (proto.set_text().view_identifier().empty()) {
VLOG(1) << "Error creating SetText interaction: "
"view_identifier not set";
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&android_interactions::SetViewText, user_model_->GetWeakPtr(),
proto.set_text(), view_handler_, jdelegate_));
case CallbackProto::kToggleUserAction:
if (proto.toggle_user_action().user_actions_model_identifier().empty()) {
VLOG(1) << "Error creating ToggleUserAction interaction: "
"user_actions_model_identifier not set";
- return base::nullopt;
+ return absl::nullopt;
}
if (proto.toggle_user_action().user_action_identifier().empty()) {
VLOG(1) << "Error creating ToggleUserAction interaction: "
"user_action_identifier not set";
- return base::nullopt;
+ return absl::nullopt;
}
if (!proto.toggle_user_action().has_enabled()) {
VLOG(1) << "Error creating ToggleUserAction interaction: "
"enabled not set";
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&android_interactions::ToggleUserAction,
basic_interactions_->GetWeakPtr(), proto.toggle_user_action()));
case CallbackProto::kSetViewVisibility:
if (proto.set_view_visibility().view_identifier().empty()) {
VLOG(1) << "Error creating SetViewVisibility interaction: "
"view_identifier not set";
- return base::nullopt;
+ return absl::nullopt;
}
if (!proto.set_view_visibility().has_visible()) {
VLOG(1) << "Error creating SetViewVisibility interaction: "
"visible not set";
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&android_interactions::SetViewVisibility, user_model_->GetWeakPtr(),
proto.set_view_visibility(), view_handler_));
case CallbackProto::kSetViewEnabled:
if (proto.set_view_enabled().view_identifier().empty()) {
VLOG(1) << "Error creating SetViewEnabled interaction: "
"view_identifier not set";
- return base::nullopt;
+ return absl::nullopt;
}
if (!proto.set_view_enabled().has_enabled()) {
VLOG(1) << "Error creating SetViewEnabled interaction: "
"enabled not set";
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&android_interactions::SetViewEnabled, user_model_->GetWeakPtr(),
proto.set_view_enabled(), view_handler_));
case CallbackProto::kShowGenericPopup:
if (proto.show_generic_popup().popup_identifier().empty()) {
VLOG(1) << "Error creating ShowGenericPopup interaction: "
"popup_identifier not set";
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&InteractionHandlerAndroid::CreateAndShowGenericPopup, GetWeakPtr(),
proto.show_generic_popup()));
case CallbackProto::kCreateNestedUi:
if (proto.create_nested_ui().generic_ui_identifier().empty()) {
VLOG(1) << "Error creating CreateNestedGenericUi interaction: "
"generic_ui_identifier not set";
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&InteractionHandlerAndroid::CreateAndAttachNestedGenericUi,
GetWeakPtr(), proto.create_nested_ui()));
case CallbackProto::kClearViewContainer:
if (proto.clear_view_container().view_identifier().empty()) {
VLOG(1) << "Error creating ClearViewContainer interaction: "
"view_identifier not set";
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<InteractionCallback>(
+ return absl::optional<InteractionCallback>(
base::BindRepeating(&android_interactions::ClearViewContainer,
proto.clear_view_container().view_identifier(),
view_handler_, jdelegate_));
@@ -336,12 +336,12 @@
if (proto.for_each().loop_counter().empty()) {
VLOG(1) << "Error creating ForEach interaction: "
"loop_counter not set";
- return base::nullopt;
+ return absl::nullopt;
}
if (proto.for_each().loop_value_model_identifier().empty()) {
VLOG(1) << "Error creating ForEach interaction: "
"loop_value_model_identifier not set";
- return base::nullopt;
+ return absl::nullopt;
}
// Parse the callbacks here to fail view inflation in case of invalid
// callbacks.
@@ -350,16 +350,16 @@
if (!callback.has_value()) {
VLOG(1) << "Error creating ForEach interaction: failed to create "
"callback";
- return base::nullopt;
+ return absl::nullopt;
}
}
- return base::Optional<InteractionCallback>(base::BindRepeating(
+ return absl::optional<InteractionCallback>(base::BindRepeating(
&RunForEachLoop, proto.for_each(), GetWeakPtr(),
user_model_->GetWeakPtr(), view_handler_->GetWeakPtr()));
}
case CallbackProto::KIND_NOT_SET:
VLOG(1) << "Error creating interaction: kind not set";
- return base::nullopt;
+ return absl::nullopt;
}
}
diff --git a/chrome/browser/android/autofill_assistant/interaction_handler_android.h b/chrome/browser/android/autofill_assistant/interaction_handler_android.h
index f7034d5..47d6f835 100644
--- a/chrome/browser/android/autofill_assistant/interaction_handler_android.h
+++ b/chrome/browser/android/autofill_assistant/interaction_handler_android.h
@@ -75,7 +75,7 @@
void RunValueChangedCallbacks();
// Creates a callback from |proto|.
- base::Optional<InteractionCallback> CreateInteractionCallbackFromProto(
+ absl::optional<InteractionCallback> CreateInteractionCallbackFromProto(
const CallbackProto& proto);
private:
diff --git a/chrome/browser/android/autofill_assistant/starter_android.cc b/chrome/browser/android/autofill_assistant/starter_android.cc
index b8f08aa..8f2dcf8c 100644
--- a/chrome/browser/android/autofill_assistant/starter_android.cc
+++ b/chrome/browser/android/autofill_assistant/starter_android.cc
@@ -257,7 +257,7 @@
void StarterAndroid::StartRegularScript(
GURL url,
std::unique_ptr<TriggerContext> trigger_context,
- const base::Optional<TriggerScriptProto>& trigger_script) {
+ const absl::optional<TriggerScriptProto>& trigger_script) {
ClientAndroid::CreateForWebContents(web_contents_);
auto* client_android = ClientAndroid::FromWebContents(web_contents_);
DCHECK(client_android);
diff --git a/chrome/browser/android/autofill_assistant/starter_android.h b/chrome/browser/android/autofill_assistant/starter_android.h
index d3f2d90..af4ddd3 100644
--- a/chrome/browser/android/autofill_assistant/starter_android.h
+++ b/chrome/browser/android/autofill_assistant/starter_android.h
@@ -11,7 +11,6 @@
#include "base/android/jni_android.h"
#include "base/android/jni_weak_ref.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "components/autofill_assistant/browser/metrics.h"
#include "components/autofill_assistant/browser/onboarding_result.h"
#include "components/autofill_assistant/browser/starter.h"
@@ -20,6 +19,7 @@
#include "components/autofill_assistant/browser/website_login_manager.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace autofill_assistant {
@@ -51,7 +51,7 @@
void StartRegularScript(
GURL url,
std::unique_ptr<TriggerContext> trigger_context,
- const base::Optional<TriggerScriptProto>& trigger_script) override;
+ const absl::optional<TriggerScriptProto>& trigger_script) override;
bool IsRegularScriptRunning() const override;
bool IsRegularScriptVisible() const override;
WebsiteLoginManager* GetWebsiteLoginManager() const override;
diff --git a/chrome/browser/android/autofill_assistant/ui_controller_android.cc b/chrome/browser/android/autofill_assistant/ui_controller_android.cc
index 9460049..ef29c42 100644
--- a/chrome/browser/android/autofill_assistant/ui_controller_android.cc
+++ b/chrome/browser/android/autofill_assistant/ui_controller_android.cc
@@ -14,7 +14,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/metrics/field_trial_params.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "base/time/time.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantCollectUserDataModel_jni.h"
@@ -60,6 +59,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "google_apis/google_api_keys.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
using base::android::AttachCurrentThread;
@@ -207,40 +207,40 @@
return jsection_list;
}
-base::Optional<int> GetPreviousFormCounterResult(
+absl::optional<int> GetPreviousFormCounterResult(
const FormProto::Result* result,
int input_index,
int counter_index) {
if (result == nullptr) {
- return base::nullopt;
+ return absl::nullopt;
}
if (input_index >= result->input_results().size()) {
- return base::nullopt;
+ return absl::nullopt;
}
auto input_result = result->input_results(input_index);
if (counter_index >= input_result.counter().values().size()) {
- return base::nullopt;
+ return absl::nullopt;
}
return input_result.counter().values(counter_index);
}
-base::Optional<bool> GetPreviousFormSelectionResult(
+absl::optional<bool> GetPreviousFormSelectionResult(
const FormProto::Result* result,
int input_index,
int selection_index) {
if (result == nullptr) {
- return base::nullopt;
+ return absl::nullopt;
}
if (input_index >= result->input_results().size()) {
- return base::nullopt;
+ return absl::nullopt;
}
auto input_result = result->input_results(input_index);
if (selection_index >= input_result.selection().selected().size()) {
- return base::nullopt;
+ return absl::nullopt;
}
return input_result.selection().selected(selection_index);
}
@@ -966,12 +966,12 @@
std::move(trigger_context), dropout_reason));
}
-base::Optional<std::pair<int, int>> UiControllerAndroid::GetWindowSize() const {
+absl::optional<std::pair<int, int>> UiControllerAndroid::GetWindowSize() const {
JNIEnv* env = AttachCurrentThread();
auto java_size_array =
Java_AutofillAssistantUiController_getWindowSize(env, java_object_);
if (!java_size_array) {
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<int> size_array;
@@ -1138,7 +1138,7 @@
void UiControllerAndroid::OnDateTimeRangeStartDateChanged(int year,
int month,
int day) {
- auto date = base::make_optional<DateProto>();
+ auto date = absl::make_optional<DateProto>();
date->set_year(year);
date->set_month(month);
date->set_day(day);
@@ -1146,21 +1146,21 @@
}
void UiControllerAndroid::OnDateTimeRangeStartDateCleared() {
- ui_delegate_->SetDateTimeRangeStartDate(base::nullopt);
+ ui_delegate_->SetDateTimeRangeStartDate(absl::nullopt);
}
void UiControllerAndroid::OnDateTimeRangeStartTimeSlotChanged(int index) {
- ui_delegate_->SetDateTimeRangeStartTimeSlot(base::make_optional<int>(index));
+ ui_delegate_->SetDateTimeRangeStartTimeSlot(absl::make_optional<int>(index));
}
void UiControllerAndroid::OnDateTimeRangeStartTimeSlotCleared() {
- ui_delegate_->SetDateTimeRangeStartTimeSlot(base::nullopt);
+ ui_delegate_->SetDateTimeRangeStartTimeSlot(absl::nullopt);
}
void UiControllerAndroid::OnDateTimeRangeEndDateChanged(int year,
int month,
int day) {
- auto date = base::make_optional<DateProto>();
+ auto date = absl::make_optional<DateProto>();
date->set_year(year);
date->set_month(month);
date->set_day(day);
@@ -1168,15 +1168,15 @@
}
void UiControllerAndroid::OnDateTimeRangeEndDateCleared() {
- ui_delegate_->SetDateTimeRangeEndDate(base::nullopt);
+ ui_delegate_->SetDateTimeRangeEndDate(absl::nullopt);
}
void UiControllerAndroid::OnDateTimeRangeEndTimeSlotChanged(int index) {
- ui_delegate_->SetDateTimeRangeEndTimeSlot(base::make_optional<int>(index));
+ ui_delegate_->SetDateTimeRangeEndTimeSlot(absl::make_optional<int>(index));
}
void UiControllerAndroid::OnDateTimeRangeEndTimeSlotCleared() {
- ui_delegate_->SetDateTimeRangeEndTimeSlot(base::nullopt);
+ ui_delegate_->SetDateTimeRangeEndTimeSlot(absl::nullopt);
}
void UiControllerAndroid::OnKeyValueChanged(const std::string& key,
diff --git a/chrome/browser/android/autofill_assistant/ui_controller_android.h b/chrome/browser/android/autofill_assistant/ui_controller_android.h
index 19eb729..0fe0d59 100644
--- a/chrome/browser/android/autofill_assistant/ui_controller_android.h
+++ b/chrome/browser/android/autofill_assistant/ui_controller_android.h
@@ -88,7 +88,7 @@
std::unique_ptr<TriggerContext> trigger_context,
Metrics::DropOutReason dropout_reason);
// Returns the size of the window.
- base::Optional<std::pair<int, int>> GetWindowSize() const;
+ absl::optional<std::pair<int, int>> GetWindowSize() const;
// Returns the screen's orientation.
ClientContextProto::ScreenOrientation GetScreenOrientation() const;
diff --git a/chrome/browser/android/autofill_assistant/ui_controller_android_utils.cc b/chrome/browser/android/autofill_assistant/ui_controller_android_utils.cc
index d6bb2d2..b459bb8a 100644
--- a/chrome/browser/android/autofill_assistant/ui_controller_android_utils.cc
+++ b/chrome/browser/android/autofill_assistant/ui_controller_android_utils.cc
@@ -103,7 +103,7 @@
}
}
-base::Optional<int> GetPixelSize(
+absl::optional<int> GetPixelSize(
JNIEnv* env,
const base::android::ScopedJavaLocalRef<jobject>& jcontext,
const ClientDimensionProto& proto) {
@@ -119,7 +119,7 @@
case ClientDimensionProto::kSizeInPixel:
return proto.size_in_pixel();
case ClientDimensionProto::SIZE_NOT_SET:
- return base::nullopt;
+ return absl::nullopt;
}
}
diff --git a/chrome/browser/android/autofill_assistant/ui_controller_android_utils.h b/chrome/browser/android/autofill_assistant/ui_controller_android_utils.h
index d1a36f0..76c33ad 100644
--- a/chrome/browser/android/autofill_assistant/ui_controller_android_utils.h
+++ b/chrome/browser/android/autofill_assistant/ui_controller_android_utils.h
@@ -10,13 +10,13 @@
#include <vector>
#include "base/android/jni_android.h"
-#include "base/optional.h"
#include "components/autofill_assistant/browser/bottom_sheet_state.h"
#include "components/autofill_assistant/browser/service.pb.h"
#include "components/autofill_assistant/browser/trigger_context.h"
#include "components/autofill_assistant/browser/user_model.h"
#include "components/autofill_assistant/browser/view_layout.pb.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace autofill_assistant {
@@ -38,7 +38,7 @@
// Returns the pixelsize of |proto| in |jcontext|, or |nullopt| if |proto| is
// invalid.
-base::Optional<int> GetPixelSize(
+absl::optional<int> GetPixelSize(
JNIEnv* env,
const base::android::ScopedJavaLocalRef<jobject>& jcontext,
const ClientDimensionProto& proto);
diff --git a/chrome/browser/android/autofill_assistant/view_handler_android.cc b/chrome/browser/android/autofill_assistant/view_handler_android.cc
index d9bfcb4..8a123c5 100644
--- a/chrome/browser/android/autofill_assistant/view_handler_android.cc
+++ b/chrome/browser/android/autofill_assistant/view_handler_android.cc
@@ -13,11 +13,11 @@
return weak_ptr_factory_.GetWeakPtr();
}
-base::Optional<base::android::ScopedJavaGlobalRef<jobject>>
+absl::optional<base::android::ScopedJavaGlobalRef<jobject>>
ViewHandlerAndroid::GetView(const std::string& view_identifier) const {
auto it = views_.find(view_identifier);
if (it == views_.end()) {
- return base::nullopt;
+ return absl::nullopt;
}
return it->second;
}
diff --git a/chrome/browser/android/autofill_assistant/view_handler_android.h b/chrome/browser/android/autofill_assistant/view_handler_android.h
index 1e67234..4edd6380 100644
--- a/chrome/browser/android/autofill_assistant/view_handler_android.h
+++ b/chrome/browser/android/autofill_assistant/view_handler_android.h
@@ -11,7 +11,7 @@
#include "base/android/jni_android.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace autofill_assistant {
@@ -25,9 +25,9 @@
base::WeakPtr<ViewHandlerAndroid> GetWeakPtr();
- // Returns the view associated with |view_identifier| or base::nullopt if
+ // Returns the view associated with |view_identifier| or absl::nullopt if
// there is no such view.
- base::Optional<base::android::ScopedJavaGlobalRef<jobject>> GetView(
+ absl::optional<base::android::ScopedJavaGlobalRef<jobject>> GetView(
const std::string& view_identifier) const;
// Adds a view to the set of managed views.
diff --git a/chrome/browser/android/instantapps/instant_apps_settings.cc b/chrome/browser/android/instantapps/instant_apps_settings.cc
index 9298891..28c1db8 100644
--- a/chrome/browser/android/instantapps/instant_apps_settings.cc
+++ b/chrome/browser/android/instantapps/instant_apps_settings.cc
@@ -86,7 +86,7 @@
content::WebContents::FromJavaWebContents(jweb_contents);
DCHECK(web_contents);
- base::Optional<base::Time> added_time =
+ absl::optional<base::Time> added_time =
webapps::AppBannerSettingsHelper::GetSingleBannerEvent(
web_contents, *url::GURLAndroid::ToNativeGURL(env, jurl),
webapps::AppBannerSettingsHelper::kInstantAppsKey,
diff --git a/chrome/browser/android/ntp/most_visited_sites_bridge.cc b/chrome/browser/android/ntp/most_visited_sites_bridge.cc
index a847083..8380cbcb 100644
--- a/chrome/browser/android/ntp/most_visited_sites_bridge.cc
+++ b/chrome/browser/android/ntp/most_visited_sites_bridge.cc
@@ -83,14 +83,14 @@
DCHECK(!title_callback.is_null());
GURL url = GetHomepageUrl();
if (url.is_empty()) {
- std::move(title_callback).Run(base::nullopt);
+ std::move(title_callback).Run(absl::nullopt);
return;
}
history::HistoryService* const history_service =
HistoryServiceFactory::GetForProfileIfExists(
profile_, ServiceAccessType::EXPLICIT_ACCESS);
if (!history_service) {
- std::move(title_callback).Run(base::nullopt);
+ std::move(title_callback).Run(absl::nullopt);
return;
}
// If the client is destroyed, the tracker will cancel this task automatically
@@ -106,7 +106,7 @@
void JavaHomepageClient::OnTitleEntryFound(TitleCallback title_callback,
history::QueryURLResult result) {
if (!result.success) {
- std::move(title_callback).Run(base::nullopt);
+ std::move(title_callback).Run(absl::nullopt);
return;
}
std::move(title_callback).Run(result.row.title());
diff --git a/chrome/browser/android/omnibox/geolocation_header.cc b/chrome/browser/android/omnibox/geolocation_header.cc
index f14bb07..896b0c5 100644
--- a/chrome/browser/android/omnibox/geolocation_header.cc
+++ b/chrome/browser/android/omnibox/geolocation_header.cc
@@ -17,7 +17,7 @@
return Java_GeolocationHeader_hasGeolocationPermission(env);
}
-base::Optional<std::string> GetGeolocationHeaderIfAllowed(const GURL& url,
+absl::optional<std::string> GetGeolocationHeaderIfAllowed(const GURL& url,
Profile* profile) {
JNIEnv* env = base::android::AttachCurrentThread();
ProfileAndroid* profile_android = ProfileAndroid::FromProfile(profile);
@@ -33,7 +33,7 @@
j_profile_android);
if (!geo_header)
- return base::nullopt;
+ return absl::nullopt;
return base::android::ConvertJavaStringToUTF8(env, geo_header);
}
diff --git a/chrome/browser/android/omnibox/geolocation_header.h b/chrome/browser/android/omnibox/geolocation_header.h
index 43997b32..40138036 100644
--- a/chrome/browser/android/omnibox/geolocation_header.h
+++ b/chrome/browser/android/omnibox/geolocation_header.h
@@ -7,7 +7,7 @@
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
class GURL;
@@ -17,7 +17,7 @@
// Gives the full string of the entire Geolocation header if it can be added for
// a request to |url|. Does not prompt for permission.
-base::Optional<std::string> GetGeolocationHeaderIfAllowed(const GURL& url,
+absl::optional<std::string> GetGeolocationHeaderIfAllowed(const GURL& url,
Profile* profile);
#endif // CHROME_BROWSER_ANDROID_OMNIBOX_GEOLOCATION_HEADER_H_
diff --git a/chrome/browser/android/oom_intervention/oom_intervention_tab_helper.h b/chrome/browser/android/oom_intervention/oom_intervention_tab_helper.h
index 631e4c6..ff3ac53 100644
--- a/chrome/browser/android/oom_intervention/oom_intervention_tab_helper.h
+++ b/chrome/browser/android/oom_intervention/oom_intervention_tab_helper.h
@@ -7,7 +7,6 @@
#include "base/memory/unsafe_shared_memory_region.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -19,6 +18,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/service_manager/public/cpp/interface_provider.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/oom_intervention/oom_intervention.mojom.h"
namespace content {
@@ -88,7 +88,7 @@
bool navigation_started_ = false;
bool load_finished_ = false;
- base::Optional<base::TimeTicks> near_oom_detected_time_;
+ absl::optional<base::TimeTicks> near_oom_detected_time_;
base::CallbackListSubscription subscription_;
base::OneShotTimer renderer_detection_timer_;
diff --git a/chrome/browser/android/signin/signin_manager_android.cc b/chrome/browser/android/signin/signin_manager_android.cc
index a7ee3a4..f654ff6 100644
--- a/chrome/browser/android/signin/signin_manager_android.cc
+++ b/chrome/browser/android/signin/signin_manager_android.cc
@@ -184,7 +184,7 @@
const CoreAccountInfo& account,
RegisterPolicyWithAccountCallback callback) {
if (!ShouldLoadPolicyForUser(account.email)) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
@@ -193,7 +193,7 @@
base::BindOnce(
[](RegisterPolicyWithAccountCallback callback,
const std::string& dm_token, const std::string& client_id) {
- base::Optional<ManagementCredentials> credentials;
+ absl::optional<ManagementCredentials> credentials;
if (!dm_token.empty()) {
credentials.emplace(dm_token, client_id);
}
@@ -220,7 +220,7 @@
void SigninManagerAndroid::OnPolicyRegisterDone(
const CoreAccountInfo& account,
base::OnceCallback<void()> policy_callback,
- const base::Optional<ManagementCredentials>& credentials) {
+ const absl::optional<ManagementCredentials>& credentials) {
if (credentials) {
FetchPolicyBeforeSignIn(account, std::move(policy_callback),
credentials.value());
@@ -256,7 +256,7 @@
account,
base::BindOnce(
[](base::android::ScopedJavaGlobalRef<jobject> callback,
- const base::Optional<ManagementCredentials>& credentials) {
+ const absl::optional<ManagementCredentials>& credentials) {
base::android::RunBooleanCallbackAndroid(callback,
credentials.has_value());
},
diff --git a/chrome/browser/android/signin/signin_manager_android.h b/chrome/browser/android/signin/signin_manager_android.h
index 45119b1..d91f7b69 100644
--- a/chrome/browser/android/signin/signin_manager_android.h
+++ b/chrome/browser/android/signin/signin_manager_android.h
@@ -91,7 +91,7 @@
};
using RegisterPolicyWithAccountCallback = base::OnceCallback<void(
- const base::Optional<ManagementCredentials>& credentials)>;
+ const absl::optional<ManagementCredentials>& credentials)>;
// If required registers for policy with given account. callback will be
// called with credentials if the account is managed.
@@ -101,7 +101,7 @@
void OnPolicyRegisterDone(
const CoreAccountInfo& account_id,
base::OnceCallback<void()> policy_callback,
- const base::Optional<ManagementCredentials>& credentials);
+ const absl::optional<ManagementCredentials>& credentials);
void FetchPolicyBeforeSignIn(const CoreAccountInfo& account_id,
base::OnceCallback<void()> policy_callback,
diff --git a/chrome/browser/android/tab_web_contents_delegate_android.cc b/chrome/browser/android/tab_web_contents_delegate_android.cc
index 0a98f8b..e173ce7 100644
--- a/chrome/browser/android/tab_web_contents_delegate_android.cc
+++ b/chrome/browser/android/tab_web_contents_delegate_android.cc
@@ -16,7 +16,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/rand_util.h"
#include "chrome/android/chrome_jni_headers/TabWebContentsDelegateAndroidImpl_jni.h"
#include "chrome/browser/android/customtabs/client_data_header_web_contents_observer.h"
@@ -73,6 +72,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/security_style_explanations.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
#include "third_party/blink/public/mojom/frame/blocked_navigation_types.mojom.h"
#include "third_party/blink/public/mojom/window_features/window_features.mojom.h"
diff --git a/chrome/browser/android/usage_stats/usage_stats_bridge.cc b/chrome/browser/android/usage_stats/usage_stats_bridge.cc
index 61bb846..0bdc309a 100644
--- a/chrome/browser/android/usage_stats/usage_stats_bridge.cc
+++ b/chrome/browser/android/usage_stats/usage_stats_bridge.cc
@@ -319,7 +319,7 @@
history::DeletionTimeRange time_range = deletion_info.time_range();
if (time_range.IsValid()) {
- const base::Optional<std::set<GURL>>& urls = deletion_info.restrict_urls();
+ const absl::optional<std::set<GURL>>& urls = deletion_info.restrict_urls();
if (urls.has_value() && urls.value().size() > 0) {
std::vector<std::string> domains;
domains.reserve(urls.value().size());
diff --git a/chrome/browser/android/vr/arcore_device/arcore_device_unittest.cc b/chrome/browser/android/vr/arcore_device/arcore_device_unittest.cc
index a9d1f14..955d628 100644
--- a/chrome/browser/android/vr/arcore_device/arcore_device_unittest.cc
+++ b/chrome/browser/android/vr/arcore_device/arcore_device_unittest.cc
@@ -187,7 +187,7 @@
void SubmitCompositorFrame(
const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
- base::Optional<viz::HitTestRegionList> hit_test_region_list,
+ absl::optional<viz::HitTestRegionList> hit_test_region_list,
uint64_t submit_time) override {}
void DidNotProduceFrame(const viz::BeginFrameAck& begin_frame_ack) override {}
void DidAllocateSharedBitmap(base::ReadOnlySharedMemoryRegion region,
@@ -196,7 +196,7 @@
void SubmitCompositorFrameSync(
const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
- base::Optional<viz::HitTestRegionList> hit_test_region_list,
+ absl::optional<viz::HitTestRegionList> hit_test_region_list,
uint64_t submit_time,
SubmitCompositorFrameSyncCallback callback) override {}
void InitializeCompositorFrameSinkType(
@@ -247,8 +247,8 @@
std::move(on_initialized).Run();
}
void SurfaceDestroyed() override {}
- base::Optional<viz::SurfaceId> GetDOMSurface() override {
- return base::nullopt;
+ absl::optional<viz::SurfaceId> GetDOMSurface() override {
+ return absl::nullopt;
}
viz::FrameSinkId FrameSinkId() override { return {}; }
diff --git a/chrome/browser/android/vr/arcore_device/fake_arcore.cc b/chrome/browser/android/vr/arcore_device/fake_arcore.cc
index 7199c5e5..9fb034a 100644
--- a/chrome/browser/android/vr/arcore_device/fake_arcore.cc
+++ b/chrome/browser/android/vr/arcore_device/fake_arcore.cc
@@ -22,14 +22,14 @@
return {30.f, 30.f};
}
-base::Optional<ArCore::InitializeResult> FakeArCore::Initialize(
+absl::optional<ArCore::InitializeResult> FakeArCore::Initialize(
base::android::ScopedJavaLocalRef<jobject> application_context,
const std::unordered_set<device::mojom::XRSessionFeature>&
required_features,
const std::unordered_set<device::mojom::XRSessionFeature>&
optional_features,
const std::vector<device::mojom::XRTrackedImagePtr>& tracked_images,
- base::Optional<ArCore::DepthSensingConfiguration> depth_sensing_config) {
+ absl::optional<ArCore::DepthSensingConfiguration> depth_sensing_config) {
DCHECK(IsOnGlThread());
std::unordered_set<device::mojom::XRSessionFeature> enabled_features;
@@ -39,7 +39,7 @@
// Fake device does not support depth for now:
if (base::Contains(required_features,
device::mojom::XRSessionFeature::DEPTH)) {
- return base::nullopt;
+ return absl::nullopt;
}
if (base::Contains(optional_features,
@@ -47,7 +47,7 @@
enabled_features.erase(device::mojom::XRSessionFeature::DEPTH);
}
- return ArCore::InitializeResult(enabled_features, base::nullopt);
+ return ArCore::InitializeResult(enabled_features, absl::nullopt);
}
void FakeArCore::SetDisplayGeometry(
@@ -246,20 +246,20 @@
return true;
}
-base::Optional<uint64_t> FakeArCore::SubscribeToHitTest(
+absl::optional<uint64_t> FakeArCore::SubscribeToHitTest(
mojom::XRNativeOriginInformationPtr nativeOriginInformation,
const std::vector<mojom::EntityTypeForHitTest>& entity_types,
mojom::XRRayPtr ray) {
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<uint64_t> FakeArCore::SubscribeToHitTestForTransientInput(
+absl::optional<uint64_t> FakeArCore::SubscribeToHitTestForTransientInput(
const std::string& profile_name,
const std::vector<mojom::EntityTypeForHitTest>& entity_types,
mojom::XRRayPtr ray) {
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
mojom::XRHitTestSubscriptionResultsDataPtr
@@ -368,7 +368,7 @@
mojom::XRTrackedImagesDataPtr FakeArCore::GetTrackedImages() {
std::vector<mojom::XRTrackedImageDataPtr> images_data;
- return mojom::XRTrackedImagesData::New(std::move(images_data), base::nullopt);
+ return mojom::XRTrackedImagesData::New(std::move(images_data), absl::nullopt);
}
void FakeArCore::Pause() {
diff --git a/chrome/browser/android/vr/arcore_device/fake_arcore.h b/chrome/browser/android/vr/arcore_device/fake_arcore.h
index 039289d..e4ce1cc 100644
--- a/chrome/browser/android/vr/arcore_device/fake_arcore.h
+++ b/chrome/browser/android/vr/arcore_device/fake_arcore.h
@@ -24,14 +24,14 @@
~FakeArCore() override;
// ArCore implementation.
- base::Optional<ArCore::InitializeResult> Initialize(
+ absl::optional<ArCore::InitializeResult> Initialize(
base::android::ScopedJavaLocalRef<jobject> application_context,
const std::unordered_set<device::mojom::XRSessionFeature>&
required_features,
const std::unordered_set<device::mojom::XRSessionFeature>&
optional_features,
const std::vector<device::mojom::XRTrackedImagePtr>& tracked_images,
- base::Optional<ArCore::DepthSensingConfiguration> depth_sensing_config)
+ absl::optional<ArCore::DepthSensingConfiguration> depth_sensing_config)
override;
MinMaxRange GetTargetFramerateRange() override;
void SetCameraTexture(uint32_t texture) override;
@@ -51,11 +51,11 @@
bool RequestHitTest(const mojom::XRRayPtr& ray,
std::vector<mojom::XRHitResultPtr>* hit_results) override;
- base::Optional<uint64_t> SubscribeToHitTest(
+ absl::optional<uint64_t> SubscribeToHitTest(
mojom::XRNativeOriginInformationPtr nativeOriginInformation,
const std::vector<mojom::EntityTypeForHitTest>& entity_types,
mojom::XRRayPtr ray) override;
- base::Optional<uint64_t> SubscribeToHitTestForTransientInput(
+ absl::optional<uint64_t> SubscribeToHitTestForTransientInput(
const std::string& profile_name,
const std::vector<mojom::EntityTypeForHitTest>& entity_types,
mojom::XRRayPtr ray) override;
diff --git a/chrome/browser/android/webapk/webapk_icon_hasher.cc b/chrome/browser/android/webapk/webapk_icon_hasher.cc
index bb594bbd..7da7b45 100644
--- a/chrome/browser/android/webapk/webapk_icon_hasher.cc
+++ b/chrome/browser/android/webapk/webapk_icon_hasher.cc
@@ -49,7 +49,7 @@
WebApkIconHasher::Murmur2HashMultipleCallback callback) {
for (const auto& icon_pair : *icons) {
if (icon_pair.second.hash.empty()) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
}
diff --git a/chrome/browser/android/webapk/webapk_icon_hasher.h b/chrome/browser/android/webapk/webapk_icon_hasher.h
index b4d7530..ddb6e36 100644
--- a/chrome/browser/android/webapk/webapk_icon_hasher.h
+++ b/chrome/browser/android/webapk/webapk_icon_hasher.h
@@ -12,8 +12,8 @@
#include "base/callback.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/timer/timer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -39,12 +39,12 @@
using Murmur2HashCallback = base::OnceCallback<void(Icon)>;
using Murmur2HashMultipleCallback =
- base::OnceCallback<void(base::Optional<std::map<std::string, Icon>>)>;
+ base::OnceCallback<void(absl::optional<std::map<std::string, Icon>>)>;
// Creates a self-owned WebApkIconHasher instance. The instance downloads all
// the |icon_urls| and calls |callback| with the Murmur2 hash of the
// downloaded images. The hash is taken over the raw image bytes (no image
- // encoding/decoding beforehand). |callback| is called with a base::nullopt if
+ // encoding/decoding beforehand). |callback| is called with a absl::nullopt if
// any image cannot not be downloaded in time (e.g. 404 HTTP error code).
static void DownloadAndComputeMurmur2Hash(
network::mojom::URLLoaderFactory* url_loader_factory,
diff --git a/chrome/browser/android/webapk/webapk_icon_hasher_browsertest.cc b/chrome/browser/android/webapk/webapk_icon_hasher_browsertest.cc
index 280185b..6089a2e 100644
--- a/chrome/browser/android/webapk/webapk_icon_hasher_browsertest.cc
+++ b/chrome/browser/android/webapk/webapk_icon_hasher_browsertest.cc
@@ -78,7 +78,7 @@
void OnGotMurmur2Hash(
base::OnceClosure callback,
- base::Optional<std::map<std::string, WebApkIconHasher::Icon>> hashes) {
+ absl::optional<std::map<std::string, WebApkIconHasher::Icon>> hashes) {
std::move(callback).Run();
}
diff --git a/chrome/browser/android/webapk/webapk_icon_hasher_unittest.cc b/chrome/browser/android/webapk/webapk_icon_hasher_unittest.cc
index b546ace..25f9a12 100644
--- a/chrome/browser/android/webapk/webapk_icon_hasher_unittest.cc
+++ b/chrome/browser/android/webapk/webapk_icon_hasher_unittest.cc
@@ -56,7 +56,7 @@
WebApkIconHasher::DownloadAndComputeMurmur2Hash(
url_loader_factory, url::Origin::Create(*icon_urls.begin()), icon_urls,
base::BindLambdaForTesting(
- [&](base::Optional<std::map<std::string, WebApkIconHasher::Icon>>
+ [&](absl::optional<std::map<std::string, WebApkIconHasher::Icon>>
hashes) {
ASSERT_TRUE(hashes);
result = std::move(*hashes);
diff --git a/chrome/browser/android/webapk/webapk_info.cc b/chrome/browser/android/webapk/webapk_info.cc
index 22998d1..b5680f6 100644
--- a/chrome/browser/android/webapk/webapk_info.cc
+++ b/chrome/browser/android/webapk/webapk_info.cc
@@ -18,8 +18,8 @@
std::string manifest_start_url,
blink::mojom::DisplayMode display,
device::mojom::ScreenOrientationLockType orientation,
- base::Optional<SkColor> theme_color,
- base::Optional<SkColor> background_color,
+ absl::optional<SkColor> theme_color,
+ absl::optional<SkColor> background_color,
base::Time last_update_check_time,
base::Time last_update_completion_time,
bool relax_updates,
diff --git a/chrome/browser/android/webapk/webapk_info.h b/chrome/browser/android/webapk/webapk_info.h
index add90a82..5c0a25a 100644
--- a/chrome/browser/android/webapk/webapk_info.h
+++ b/chrome/browser/android/webapk/webapk_info.h
@@ -32,8 +32,8 @@
std::string manifest_start_url,
blink::mojom::DisplayMode display,
device::mojom::ScreenOrientationLockType orientation,
- base::Optional<SkColor> theme_color,
- base::Optional<SkColor> background_color,
+ absl::optional<SkColor> theme_color,
+ absl::optional<SkColor> background_color,
base::Time last_update_check_time,
base::Time last_update_completion_time,
bool relax_updates,
@@ -69,8 +69,8 @@
std::string manifest_start_url;
blink::mojom::DisplayMode display;
device::mojom::ScreenOrientationLockType orientation;
- base::Optional<SkColor> theme_color;
- base::Optional<SkColor> background_color;
+ absl::optional<SkColor> theme_color;
+ absl::optional<SkColor> background_color;
base::Time last_update_check_time;
base::Time last_update_completion_time;
bool relax_updates;
diff --git a/chrome/browser/android/webapk/webapk_installer.cc b/chrome/browser/android/webapk/webapk_installer.cc
index 20e3cd18..16d55f3 100644
--- a/chrome/browser/android/webapk/webapk_installer.cc
+++ b/chrome/browser/android/webapk/webapk_installer.cc
@@ -20,7 +20,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -50,6 +49,7 @@
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "third_party/blink/public/common/manifest/manifest_util.h"
#include "ui/android/color_helpers.h"
@@ -688,7 +688,7 @@
}
void WebApkInstaller::OnGotIconMurmur2Hashes(
- base::Optional<std::map<std::string, WebApkIconHasher::Icon>> hashes) {
+ absl::optional<std::map<std::string, WebApkIconHasher::Icon>> hashes) {
if (!hashes) {
OnResult(WebApkInstallResult::FAILURE);
return;
diff --git a/chrome/browser/android/webapk/webapk_installer.h b/chrome/browser/android/webapk/webapk_installer.h
index 570a121..b14a1f4 100644
--- a/chrome/browser/android/webapk/webapk_installer.h
+++ b/chrome/browser/android/webapk/webapk_installer.h
@@ -14,11 +14,11 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/timer/timer.h"
#include "chrome/browser/android/webapk/webapk_icon_hasher.h"
#include "chrome/browser/android/webapk/webapk_install_service.h"
#include "chrome/browser/android/webapk/webapk_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "url/gurl.h"
@@ -187,7 +187,7 @@
// Called with the computed Murmur2 hash for the icons.
void OnGotIconMurmur2Hashes(
- base::Optional<std::map<std::string, WebApkIconHasher::Icon>> hashes);
+ absl::optional<std::map<std::string, WebApkIconHasher::Icon>> hashes);
// Sends a request to WebAPK server to create/update WebAPK. During a
// successful request the WebAPK server responds with a token to send to
diff --git a/chrome/browser/android/webapk/webapk_update_data_fetcher.cc b/chrome/browser/android/webapk/webapk_update_data_fetcher.cc
index 6a52401..5431c45 100644
--- a/chrome/browser/android/webapk/webapk_update_data_fetcher.cc
+++ b/chrome/browser/android/webapk/webapk_update_data_fetcher.cc
@@ -13,7 +13,6 @@
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
#include "base/bind.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/android/chrome_jni_headers/WebApkUpdateDataFetcher_jni.h"
#include "chrome/browser/profiles/profile.h"
@@ -23,6 +22,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "third_party/smhasher/src/MurmurHash2.h"
#include "ui/android/color_helpers.h"
@@ -182,7 +182,7 @@
}
void WebApkUpdateDataFetcher::OnGotIconMurmur2Hashes(
- base::Optional<std::map<std::string, WebApkIconHasher::Icon>> hashes) {
+ absl::optional<std::map<std::string, WebApkIconHasher::Icon>> hashes) {
if (!hashes)
return;
diff --git a/chrome/browser/android/webapk/webapk_update_data_fetcher.h b/chrome/browser/android/webapk/webapk_update_data_fetcher.h
index e7479ad..0846a8f 100644
--- a/chrome/browser/android/webapk/webapk_update_data_fetcher.h
+++ b/chrome/browser/android/webapk/webapk_update_data_fetcher.h
@@ -9,10 +9,10 @@
#include "base/android/jni_weak_ref.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/android/webapk/webapk_icon_hasher.h"
#include "components/webapps/browser/android/shortcut_info.h"
#include "content/public/browser/web_contents_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace content {
@@ -64,7 +64,7 @@
// Called with the computed Murmur2 hashes for the icons.
void OnGotIconMurmur2Hashes(
- base::Optional<std::map<std::string, WebApkIconHasher::Icon>> hashes);
+ absl::optional<std::map<std::string, WebApkIconHasher::Icon>> hashes);
// Called when a page has no Web Manifest or the Web Manifest is not WebAPK
// compatible.
diff --git a/chrome/browser/app_mode/app_mode_utils.cc b/chrome/browser/app_mode/app_mode_utils.cc
index a9116bc..d672a111 100644
--- a/chrome/browser/app_mode/app_mode_utils.cc
+++ b/chrome/browser/app_mode/app_mode_utils.cc
@@ -8,10 +8,10 @@
#include "base/check.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/common/chrome_switches.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chrome {
@@ -19,11 +19,11 @@
// If the device is running in forced app mode, returns the ID of the app for
// which the device is forced in app mode. Otherwise, returns nullopt.
-base::Optional<std::string> GetForcedAppModeApp() {
+absl::optional<std::string> GetForcedAppModeApp() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kForceAppMode) ||
!command_line->HasSwitch(switches::kAppId)) {
- return base::nullopt;
+ return absl::nullopt;
}
return command_line->GetSwitchValueASCII(switches::kAppId);
@@ -77,7 +77,7 @@
bool IsRunningInForcedAppModeForApp(const std::string& app_id) {
DCHECK(!app_id.empty());
- base::Optional<std::string> forced_app_mode_app = GetForcedAppModeApp();
+ absl::optional<std::string> forced_app_mode_app = GetForcedAppModeApp();
if (!forced_app_mode_app.has_value())
return false;
diff --git a/chrome/browser/apps/app_service/app_icon_factory.cc b/chrome/browser/apps/app_service/app_icon_factory.cc
index b199718..08d3f21d 100644
--- a/chrome/browser/apps/app_service/app_icon_factory.cc
+++ b/chrome/browser/apps/app_service/app_icon_factory.cc
@@ -301,7 +301,7 @@
std::move(compressed_data_callback));
}
-base::Optional<IconPurpose> GetIconPurpose(
+absl::optional<IconPurpose> GetIconPurpose(
const std::string& web_app_id,
const web_app::AppIconManager& icon_manager,
int size_hint_in_dip) {
@@ -321,16 +321,16 @@
if (base::FeatureList::IsEnabled(features::kAppServiceAdaptiveIcon) &&
icon_manager.HasSmallestIcon(web_app_id, {IconPurpose::MASKABLE},
max_icon_size_in_px)) {
- return base::make_optional(IconPurpose::MASKABLE);
+ return absl::make_optional(IconPurpose::MASKABLE);
}
#endif
if (icon_manager.HasSmallestIcon(web_app_id, {IconPurpose::ANY},
max_icon_size_in_px)) {
- return base::make_optional(IconPurpose::ANY);
+ return absl::make_optional(IconPurpose::ANY);
}
- return base::nullopt;
+ return absl::nullopt;
}
// This pipeline is meant to:
@@ -532,7 +532,7 @@
// constructor.
icon_scale_for_compressed_response_ = icon_scale_;
- base::Optional<IconPurpose> icon_purpose_to_read =
+ absl::optional<IconPurpose> icon_purpose_to_read =
GetIconPurpose(web_app_id, icon_manager, size_hint_in_dip_);
if (!icon_purpose_to_read.has_value()) {
diff --git a/chrome/browser/apps/app_service/app_launch_params.h b/chrome/browser/apps/app_service/app_launch_params.h
index 1b404e13..b2bd3cc 100644
--- a/chrome/browser/apps/app_service/app_launch_params.h
+++ b/chrome/browser/apps/app_service/app_launch_params.h
@@ -10,8 +10,8 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/window_open_disposition.h"
#include "ui/display/types/display_constants.h"
#include "ui/gfx/geometry/rect.h"
@@ -96,12 +96,12 @@
// When PWA is launched as a URL handler, the URL that we should launch the
// PWA to. Null when it's not a URL handler launch.
- base::Optional<GURL> url_handler_launch_url;
+ absl::optional<GURL> url_handler_launch_url;
// When a PWA is launched as a protocol handler, the protocol URL that we
// should translate and then launch the PWA to. Null when it's not a protocol
// handler launch.
- base::Optional<GURL> protocol_handler_launch_url;
+ absl::optional<GURL> protocol_handler_launch_url;
};
} // namespace apps
diff --git a/chrome/browser/apps/app_service/app_platform_metrics.cc b/chrome/browser/apps/app_service/app_platform_metrics.cc
index 5308d983..ae4b27a 100644
--- a/chrome/browser/apps/app_service/app_platform_metrics.cc
+++ b/chrome/browser/apps/app_service/app_platform_metrics.cc
@@ -513,13 +513,13 @@
continue;
}
- base::Optional<base::TimeDelta> unreported_duration =
+ absl::optional<base::TimeDelta> unreported_duration =
util::ValueToTimeDelta(running_duration_update->FindPath(key));
if (unreported_duration.has_value()) {
running_duration_[app_type_name] = unreported_duration.value();
}
- base::Optional<int> count = activated_count_update->FindIntPath(key);
+ absl::optional<int> count = activated_count_update->FindIntPath(key);
if (count.has_value()) {
activated_count_[app_type_name] = count.value();
}
diff --git a/chrome/browser/apps/app_service/app_platform_metrics_service_unittest.cc b/chrome/browser/apps/app_service/app_platform_metrics_service_unittest.cc
index 07b010abb..d92ee48 100644
--- a/chrome/browser/apps/app_service/app_platform_metrics_service_unittest.cc
+++ b/chrome/browser/apps/app_service/app_platform_metrics_service_unittest.cc
@@ -227,7 +227,7 @@
DictionaryPrefUpdate update(GetPrefService(), kAppRunningDuration);
std::string key = GetAppTypeHistogramName(app_type_name);
- base::Optional<base::TimeDelta> unreported_duration =
+ absl::optional<base::TimeDelta> unreported_duration =
util::ValueToTimeDelta(update->FindPath(key));
if (time_delta.is_zero()) {
EXPECT_FALSE(unreported_duration.has_value());
@@ -278,7 +278,7 @@
DictionaryPrefUpdate update(GetPrefService(), kAppActivatedCount);
std::string key = GetAppTypeHistogramName(app_type_name);
- base::Optional<int> activated_count = update->FindIntPath(key);
+ absl::optional<int> activated_count = update->FindIntPath(key);
if (count == 0) {
EXPECT_FALSE(activated_count.has_value());
return;
diff --git a/chrome/browser/apps/app_service/browser_app_launcher.cc b/chrome/browser/apps/app_service/browser_app_launcher.cc
index 6b250e16..9561208c 100644
--- a/chrome/browser/apps/app_service/browser_app_launcher.cc
+++ b/chrome/browser/apps/app_service/browser_app_launcher.cc
@@ -101,8 +101,8 @@
const std::string& app_id,
const base::CommandLine& command_line,
const base::FilePath& current_directory,
- const base::Optional<GURL>& url_handler_launch_url,
- const base::Optional<GURL>& protocol_handler_launch_url,
+ const absl::optional<GURL>& url_handler_launch_url,
+ const absl::optional<GURL>& protocol_handler_launch_url,
base::OnceCallback<void(Browser* browser,
apps::mojom::LaunchContainer container)> callback) {
// old-style app shortcuts
diff --git a/chrome/browser/apps/app_service/browser_app_launcher.h b/chrome/browser/apps/app_service/browser_app_launcher.h
index 883ff66..77395ac 100644
--- a/chrome/browser/apps/app_service/browser_app_launcher.h
+++ b/chrome/browser/apps/app_service/browser_app_launcher.h
@@ -9,10 +9,10 @@
#include <string>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/ui/web_applications/web_app_launch_manager.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Browser;
class GURL;
@@ -64,8 +64,8 @@
const std::string& app_id,
const base::CommandLine& command_line,
const base::FilePath& current_directory,
- const base::Optional<GURL>& url_handler_launch_url,
- const base::Optional<GURL>& protocol_handler_launch_url,
+ const absl::optional<GURL>& url_handler_launch_url,
+ const absl::optional<GURL>& protocol_handler_launch_url,
base::OnceCallback<void(Browser* browser,
apps::mojom::LaunchContainer container)>
callback);
diff --git a/chrome/browser/apps/app_service/media_requests.cc b/chrome/browser/apps/app_service/media_requests.cc
index bd30e50..87d0b0f7 100644
--- a/chrome/browser/apps/app_service/media_requests.cc
+++ b/chrome/browser/apps/app_service/media_requests.cc
@@ -6,12 +6,12 @@
#include <utility>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace apps {
-AccessingRequest::AccessingRequest(base::Optional<bool> camera,
- base::Optional<bool> microphone)
+AccessingRequest::AccessingRequest(absl::optional<bool> camera,
+ absl::optional<bool> microphone)
: camera(camera), microphone(microphone) {}
AccessingRequest::AccessingRequest(AccessingRequest&&) = default;
@@ -46,8 +46,8 @@
const content::MediaRequestState state) {
DCHECK(web_contents);
- base::Optional<bool> accessing_camera;
- base::Optional<bool> accessing_microphone;
+ absl::optional<bool> accessing_camera;
+ absl::optional<bool> accessing_microphone;
if (state == content::MEDIA_REQUEST_STATE_DONE) {
if (blink::IsVideoInputMediaType(stream_type)) {
accessing_camera = MaybeAddRequest(app_id, web_contents,
@@ -102,7 +102,7 @@
return false;
}
-base::Optional<bool> MediaRequests::MaybeAddRequest(
+absl::optional<bool> MediaRequests::MaybeAddRequest(
const std::string& app_id,
const content::WebContents* web_contents,
std::map<std::string, std::set<const content::WebContents*>>&
@@ -110,10 +110,10 @@
auto it = app_id_to_web_contents.find(app_id);
if (it != app_id_to_web_contents.end() &&
it->second.find(web_contents) != it->second.end()) {
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<bool> ret;
+ absl::optional<bool> ret;
if (it == app_id_to_web_contents.end()) {
ret = true;
app_id_to_web_contents[app_id].insert(web_contents);
@@ -124,7 +124,7 @@
return ret;
}
-base::Optional<bool> MediaRequests::MaybeRemoveRequest(
+absl::optional<bool> MediaRequests::MaybeRemoveRequest(
const std::string& app_id,
const content::WebContents* web_contents,
std::map<std::string, std::set<const content::WebContents*>>&
@@ -132,7 +132,7 @@
auto it = app_id_to_web_contents.find(app_id);
if (it == app_id_to_web_contents.end() ||
it->second.find(web_contents) == it->second.end()) {
- return base::nullopt;
+ return absl::nullopt;
}
it->second.erase(web_contents);
@@ -141,16 +141,16 @@
return false;
}
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<bool> MediaRequests::MaybeRemoveRequest(
+absl::optional<bool> MediaRequests::MaybeRemoveRequest(
const std::string& app_id,
std::map<std::string, std::set<const content::WebContents*>>&
app_id_to_web_contents) {
auto it = app_id_to_web_contents.find(app_id);
if (it == app_id_to_web_contents.end()) {
- return base::nullopt;
+ return absl::nullopt;
}
app_id_to_web_contents.erase(it);
diff --git a/chrome/browser/apps/app_service/media_requests.h b/chrome/browser/apps/app_service/media_requests.h
index 7ab2b788..1f061d8 100644
--- a/chrome/browser/apps/app_service/media_requests.h
+++ b/chrome/browser/apps/app_service/media_requests.h
@@ -17,16 +17,16 @@
namespace apps {
struct AccessingRequest {
- AccessingRequest(base::Optional<bool> camera,
- base::Optional<bool> microphone);
+ AccessingRequest(absl::optional<bool> camera,
+ absl::optional<bool> microphone);
AccessingRequest(const AccessingRequest&) = delete;
AccessingRequest& operator=(const AccessingRequest&) = delete;
AccessingRequest(AccessingRequest&&);
AccessingRequest& operator=(AccessingRequest&&);
~AccessingRequest();
- base::Optional<bool> camera;
- base::Optional<bool> microphone;
+ absl::optional<bool> camera;
+ absl::optional<bool> microphone;
};
// MediaRequests records the media access requests for each app, e.g. accessing
@@ -76,19 +76,19 @@
const std::map<std::string, std::set<const content::WebContents*>>&
app_id_to_web_contents);
- base::Optional<bool> MaybeAddRequest(
+ absl::optional<bool> MaybeAddRequest(
const std::string& app_id,
const content::WebContents* web_contents,
std::map<std::string, std::set<const content::WebContents*>>&
app_id_to_web_contents);
- base::Optional<bool> MaybeRemoveRequest(
+ absl::optional<bool> MaybeRemoveRequest(
const std::string& app_id,
const content::WebContents* web_contents,
std::map<std::string, std::set<const content::WebContents*>>&
app_id_to_web_contents);
- base::Optional<bool> MaybeRemoveRequest(
+ absl::optional<bool> MaybeRemoveRequest(
const std::string& app_id,
std::map<std::string, std::set<const content::WebContents*>>&
app_id_to_web_contents);
diff --git a/chrome/browser/apps/app_service/publishers/arc_apps.cc b/chrome/browser/apps/app_service/publishers/arc_apps.cc
index 3b42f92..42d837f 100644
--- a/chrome/browser/apps/app_service/publishers/arc_apps.cc
+++ b/chrome/browser/apps/app_service/publishers/arc_apps.cc
@@ -17,7 +17,6 @@
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
@@ -53,6 +52,7 @@
#include "components/services/app_service/public/cpp/intent_util.h"
#include "extensions/grit/extensions_browser_resources.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/gfx/geometry/size.h"
@@ -164,13 +164,13 @@
}
}
-base::Optional<arc::UserInteractionType> GetUserInterationType(
+absl::optional<arc::UserInteractionType> GetUserInterationType(
apps::mojom::LaunchSource launch_source) {
auto user_interaction_type = arc::UserInteractionType::NOT_USER_INITIATED;
switch (launch_source) {
// kUnknown is not set anywhere, this case is not valid.
case apps::mojom::LaunchSource::kUnknown:
- return base::nullopt;
+ return absl::nullopt;
case apps::mojom::LaunchSource::kFromChromeInternal:
user_interaction_type = arc::UserInteractionType::NOT_USER_INITIATED;
break;
@@ -226,7 +226,7 @@
break;
default:
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
return user_interaction_type;
}
@@ -1102,7 +1102,7 @@
}
void ArcApps::OnIntentFiltersUpdated(
- const base::Optional<std::string>& package_name) {
+ const absl::optional<std::string>& package_name) {
ArcAppListPrefs* prefs = ArcAppListPrefs::Get(profile_);
if (!prefs) {
return;
@@ -1122,7 +1122,7 @@
// Note: Cannot combine the two for-loops because the return type of
// GetAppIds() is std::vector<std::string> and the return type of
// GetAppsForPackage() is std::unordered_set<std::string>.
- if (package_name == base::nullopt) {
+ if (package_name == absl::nullopt) {
for (const auto& app_id : prefs->GetAppIds()) {
GetAppInfoAndPublish(app_id);
}
diff --git a/chrome/browser/apps/app_service/publishers/arc_apps.h b/chrome/browser/apps/app_service/publishers/arc_apps.h
index 11348e69..6384cb1 100644
--- a/chrome/browser/apps/app_service/publishers/arc_apps.h
+++ b/chrome/browser/apps/app_service/publishers/arc_apps.h
@@ -15,7 +15,6 @@
#include "ash/public/cpp/message_center/arc_notifications_host_initializer.h"
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/apps/app_service/app_icon_factory.h"
#include "chrome/browser/apps/app_service/app_notifications.h"
@@ -35,6 +34,7 @@
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote_set.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -147,7 +147,7 @@
// arc::ArcIntentHelperObserver overrides.
void OnIntentFiltersUpdated(
- const base::Optional<std::string>& package_name) override;
+ const absl::optional<std::string>& package_name) override;
void OnPreferredAppsChanged() override;
// ash::ArcNotificationsHostInitializer::Observer overrides.
diff --git a/chrome/browser/apps/app_service/publishers/crostini_apps.cc b/chrome/browser/apps/app_service/publishers/crostini_apps.cc
index 0944153a..d77d3cc9 100644
--- a/chrome/browser/apps/app_service/publishers/crostini_apps.cc
+++ b/chrome/browser/apps/app_service/publishers/crostini_apps.cc
@@ -191,7 +191,7 @@
// to match the system display density, but others are density-unaware and
// look better when scaled to match the display density.
if (ShouldShowDisplayDensityMenuItem(app_id, menu_type, display_id)) {
- base::Optional<guest_os::GuestOsRegistryService::Registration>
+ absl::optional<guest_os::GuestOsRegistryService::Registration>
registration = registry_->GetRegistration(app_id);
if (registration) {
if (registration->IsScaled()) {
diff --git a/chrome/browser/apps/app_service/publishers/extension_apps_base.cc b/chrome/browser/apps/app_service/publishers/extension_apps_base.cc
index 68bc1573..716fa054 100644
--- a/chrome/browser/apps/app_service/publishers/extension_apps_base.cc
+++ b/chrome/browser/apps/app_service/publishers/extension_apps_base.cc
@@ -13,7 +13,6 @@
#include "base/callback.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/stl_util.h"
#include "build/chromeos_buildflags.h"
@@ -47,6 +46,7 @@
#include "extensions/common/extension_urls.h"
#include "extensions/common/manifest_handlers/options_page_info.h"
#include "extensions/common/switches.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/url_constants.h"
// TODO(crbug.com/826982): life cycle events. Extensions can be installed and
@@ -665,9 +665,9 @@
}
void ExtensionAppsBase::PopulateIntentFilters(
- const base::Optional<GURL>& app_scope,
+ const absl::optional<GURL>& app_scope,
std::vector<mojom::IntentFilterPtr>* target) {
- if (app_scope != base::nullopt) {
+ if (app_scope != absl::nullopt) {
target->push_back(apps_util::CreateIntentFilterForUrlScope(
app_scope.value(),
base::FeatureList::IsEnabled(features::kIntentHandlingSharing)));
diff --git a/chrome/browser/apps/app_service/publishers/extension_apps_base.h b/chrome/browser/apps/app_service/publishers/extension_apps_base.h
index 1c7cd846..f94df59f 100644
--- a/chrome/browser/apps/app_service/publishers/extension_apps_base.h
+++ b/chrome/browser/apps/app_service/publishers/extension_apps_base.h
@@ -168,7 +168,7 @@
static bool ShouldShow(const extensions::Extension* extension,
Profile* profile);
- void PopulateIntentFilters(const base::Optional<GURL>& app_scope,
+ void PopulateIntentFilters(const absl::optional<GURL>& app_scope,
std::vector<mojom::IntentFilterPtr>* target);
virtual apps::mojom::AppPtr Convert(const extensions::Extension* extension,
apps::mojom::Readiness readiness) = 0;
diff --git a/chrome/browser/apps/app_service/publishers/extension_apps_chromeos.cc b/chrome/browser/apps/app_service/publishers/extension_apps_chromeos.cc
index a0c6860..b4d452b 100644
--- a/chrome/browser/apps/app_service/publishers/extension_apps_chromeos.cc
+++ b/chrome/browser/apps/app_service/publishers/extension_apps_chromeos.cc
@@ -407,7 +407,7 @@
return;
}
- base::Optional<web_app::AppId> web_app_id =
+ absl::optional<web_app::AppId> web_app_id =
web_app::FindInstalledAppWithUrlInScope(profile(), web_contents->GetURL(),
/*window_only=*/false);
if (web_app_id.has_value()) {
diff --git a/chrome/browser/apps/app_service/publishers/web_apps_chromeos.cc b/chrome/browser/apps/app_service/publishers/web_apps_chromeos.cc
index 0f4cc0c4..b155275 100644
--- a/chrome/browser/apps/app_service/publishers/web_apps_chromeos.cc
+++ b/chrome/browser/apps/app_service/publishers/web_apps_chromeos.cc
@@ -16,7 +16,6 @@
#include "base/containers/contains.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/apps/app_service/app_service_metrics.h"
@@ -64,6 +63,7 @@
#include "content/public/browser/clear_site_data_utils.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/message_center/public/cpp/notification.h"
#include "url/origin.h"
@@ -511,7 +511,7 @@
return;
}
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
web_app::FindInstalledAppWithUrlInScope(profile(), web_contents->GetURL(),
/*window_only=*/false);
if (!app_id.has_value()) {
@@ -538,7 +538,7 @@
content::WebContents* web_contents) {
DCHECK(web_contents);
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
web_app::FindInstalledAppWithUrlInScope(
profile(), web_contents->GetLastCommittedURL(),
/*window_only=*/false);
@@ -615,7 +615,7 @@
if (persistent_metadata) {
// For persistent notifications, find the web app with the SW scope url.
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
web_app::FindInstalledAppWithUrlInScope(
profile(), persistent_metadata->service_worker_scope,
/*window_only=*/false);
diff --git a/chrome/browser/apps/app_service/publishers/web_apps_chromeos_browsertest.cc b/chrome/browser/apps/app_service/publishers/web_apps_chromeos_browsertest.cc
index 541bf64..9b7e569 100644
--- a/chrome/browser/apps/app_service/publishers/web_apps_chromeos_browsertest.cc
+++ b/chrome/browser/apps/app_service/publishers/web_apps_chromeos_browsertest.cc
@@ -9,7 +9,6 @@
#include "ash/public/cpp/app_menu_constants.h"
#include "ash/public/cpp/shelf_item_delegate.h"
#include "ash/public/cpp/shelf_model.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
@@ -21,6 +20,7 @@
#include "chrome/common/chrome_features.h"
#include "content/public/test/browser_test.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/models/image_model.h"
#include "ui/base/models/simple_menu_model.h"
@@ -34,7 +34,7 @@
int index,
int shortcut_index,
const std::u16string& label,
- base::Optional<SkColor> color) {
+ absl::optional<SkColor> color) {
EXPECT_EQ(model.GetTypeAt(index), ui::MenuModel::TYPE_COMMAND);
EXPECT_EQ(model.GetCommandIdAt(index),
ash::LAUNCH_APP_SHORTCUT_FIRST + shortcut_index);
@@ -119,6 +119,6 @@
CheckShortcut(*result, index++, 4, u"Five", SK_ColorMAGENTA);
CheckSeparator(*result, index++);
// No icons.
- CheckShortcut(*result, index++, 5, u"Six", base::nullopt);
+ CheckShortcut(*result, index++, 5, u"Six", absl::nullopt);
EXPECT_EQ(index, result->GetItemCount());
}
diff --git a/chrome/browser/apps/app_service/webapk/webapk_install_task.cc b/chrome/browser/apps/app_service/webapk/webapk_install_task.cc
index a86b658..2ca40aa 100644
--- a/chrome/browser/apps/app_service/webapk/webapk_install_task.cc
+++ b/chrome/browser/apps/app_service/webapk/webapk_install_task.cc
@@ -168,7 +168,7 @@
void WebApkInstallTask::OnArcFeaturesLoaded(
std::unique_ptr<webapk::WebApk> webapk,
ResultCallback callback,
- base::Optional<arc::ArcFeatures> arc_features) {
+ absl::optional<arc::ArcFeatures> arc_features) {
if (!arc_features) {
LOG(ERROR) << "Could not load ArcFeatures";
std::move(callback).Run(false);
@@ -177,7 +177,7 @@
webapk->set_android_abi(GetArcAbi(arc_features.value()));
auto& icon_manager = web_app_provider_->icon_manager();
- base::Optional<web_app::AppIconManager::IconSizeAndPurpose>
+ absl::optional<web_app::AppIconManager::IconSizeAndPurpose>
icon_size_and_purpose = icon_manager.FindIconMatchBigger(
app_id_, {IconPurpose::MASKABLE, IconPurpose::ANY}, kMinimumIconSize);
diff --git a/chrome/browser/apps/app_service/webapk/webapk_install_task.h b/chrome/browser/apps/app_service/webapk/webapk_install_task.h
index ac85506a..256b5d02 100644
--- a/chrome/browser/apps/app_service/webapk/webapk_install_task.h
+++ b/chrome/browser/apps/app_service/webapk/webapk_install_task.h
@@ -11,10 +11,10 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
#include "components/arc/arc_features_parser.h"
#include "components/arc/mojom/webapk.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -49,7 +49,7 @@
private:
void OnArcFeaturesLoaded(std::unique_ptr<webapk::WebApk> webapk,
ResultCallback callback,
- base::Optional<arc::ArcFeatures> arc_features);
+ absl::optional<arc::ArcFeatures> arc_features);
void OnLoadedIcon(std::unique_ptr<webapk::WebApk> webapk,
ResultCallback callback,
IconPurpose purpose,
diff --git a/chrome/browser/apps/app_service/webapk/webapk_install_task_unittest.cc b/chrome/browser/apps/app_service/webapk/webapk_install_task_unittest.cc
index 663427a..cd0fdc4 100644
--- a/chrome/browser/apps/app_service/webapk/webapk_install_task_unittest.cc
+++ b/chrome/browser/apps/app_service/webapk/webapk_install_task_unittest.cc
@@ -87,7 +87,7 @@
return app_info;
}
-base::Optional<arc::ArcFeatures> GetArcFeaturesWithAbiList(
+absl::optional<arc::ArcFeatures> GetArcFeaturesWithAbiList(
const std::string& abi_list) {
arc::ArcFeatures arc_features;
arc_features.build_props["ro.product.cpu.abilist"] = abi_list;
@@ -191,7 +191,7 @@
std::unique_ptr<arc::FakeWebApkInstance> fake_webapk_instance_;
WebApkResponseBuilder webapk_response_builder_;
std::unique_ptr<webapk::WebApk> last_webapk_request_;
- base::RepeatingCallback<base::Optional<arc::ArcFeatures>()>
+ base::RepeatingCallback<absl::optional<arc::ArcFeatures>()>
arc_features_getter_;
};
diff --git a/chrome/browser/apps/app_service/webapk/webapk_prefs.cc b/chrome/browser/apps/app_service/webapk/webapk_prefs.cc
index ad602e4..076e7aa0f 100644
--- a/chrome/browser/apps/app_service/webapk/webapk_prefs.cc
+++ b/chrome/browser/apps/app_service/webapk/webapk_prefs.cc
@@ -47,18 +47,18 @@
base::Value(package_name));
}
-base::Optional<std::string> GetWebApkPackageName(Profile* profile,
+absl::optional<std::string> GetWebApkPackageName(Profile* profile,
const std::string& app_id) {
const base::Value* app_dict = profile->GetPrefs()
->GetDictionary(kGeneratedWebApksPref)
->FindDictKey(app_id);
if (!app_dict) {
- return base::nullopt;
+ return absl::nullopt;
}
const std::string* package_name = app_dict->FindStringKey(kPackageNameKey);
if (!package_name) {
- return base::nullopt;
+ return absl::nullopt;
}
return *package_name;
diff --git a/chrome/browser/apps/app_service/webapk/webapk_prefs.h b/chrome/browser/apps/app_service/webapk/webapk_prefs.h
index 7904d77..b2cfa5d 100644
--- a/chrome/browser/apps/app_service/webapk/webapk_prefs.h
+++ b/chrome/browser/apps/app_service/webapk/webapk_prefs.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/containers/flat_set.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefRegistrySimple;
class Profile;
@@ -22,7 +22,7 @@
const std::string& app_id,
const std::string& package_name);
-base::Optional<std::string> GetWebApkPackageName(Profile* profile,
+absl::optional<std::string> GetWebApkPackageName(Profile* profile,
const std::string& app_id);
// Returns the app IDs of all WebAPKs installed in the profile.
diff --git a/chrome/browser/apps/app_shim/app_shim_listener_browsertest_mac.mm b/chrome/browser/apps/app_shim/app_shim_listener_browsertest_mac.mm
index 7b4a958..1d10511 100644
--- a/chrome/browser/apps/app_shim/app_shim_listener_browsertest_mac.mm
+++ b/chrome/browser/apps/app_shim/app_shim_listener_browsertest_mac.mm
@@ -13,7 +13,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/mac/foundation_util.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
@@ -39,6 +38,7 @@
#include "mojo/public/cpp/platform/named_platform_channel.h"
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/system/isolated_connection.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A test version of the AppShimController mojo client in chrome_main_app_mode.
class TestShimClient : public chrome::mojom::AppShim {
@@ -135,7 +135,7 @@
std::unique_ptr<TestShimClient> test_client_;
std::vector<base::FilePath> last_launch_files_;
- base::Optional<chrome::mojom::AppShimLaunchType> last_launch_type_;
+ absl::optional<chrome::mojom::AppShimLaunchType> last_launch_type_;
private:
// chrome::mojom::AppShimHost.
diff --git a/chrome/browser/apps/app_shim/app_shim_manager_mac_unittest.cc b/chrome/browser/apps/app_shim/app_shim_manager_mac_unittest.cc
index a09d5dc4..fa853879 100644
--- a/chrome/browser/apps/app_shim/app_shim_manager_mac_unittest.cc
+++ b/chrome/browser/apps/app_shim/app_shim_manager_mac_unittest.cc
@@ -12,7 +12,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_feature_list.h"
@@ -32,6 +31,7 @@
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace apps {
@@ -176,7 +176,7 @@
const base::FilePath& profile_path,
const std::string& app_id,
bool is_from_bookmark,
- base::Optional<chrome::mojom::AppShimLaunchResult>* launch_result)
+ absl::optional<chrome::mojom::AppShimLaunchResult>* launch_result)
: AppShimHostBootstrap(getpid()),
profile_path_(profile_path),
app_id_(app_id),
@@ -209,7 +209,7 @@
}
static void DoTestLaunchDone(
- base::Optional<chrome::mojom::AppShimLaunchResult>* launch_result,
+ absl::optional<chrome::mojom::AppShimLaunchResult>* launch_result,
chrome::mojom::AppShimLaunchResult result,
mojo::PendingReceiver<chrome::mojom::AppShim> app_shim_receiver) {
if (launch_result)
@@ -226,7 +226,7 @@
const bool is_from_bookmark_;
// Note that |launch_result_| is optional so that we can track whether or not
// the callback to set it has arrived.
- base::Optional<chrome::mojom::AppShimLaunchResult>* launch_result_;
+ absl::optional<chrome::mojom::AppShimLaunchResult>* launch_result_;
base::WeakPtrFactory<TestingAppShimHostBootstrap> weak_factory_;
};
@@ -515,15 +515,15 @@
base::WeakPtr<TestingAppShimHostBootstrap> bootstrap_aa_duplicate_;
base::WeakPtr<TestingAppShimHostBootstrap> bootstrap_aa_thethird_;
- base::Optional<chrome::mojom::AppShimLaunchResult> bootstrap_aa_result_;
- base::Optional<chrome::mojom::AppShimLaunchResult> bootstrap_ba_result_;
- base::Optional<chrome::mojom::AppShimLaunchResult> bootstrap_ca_result_;
- base::Optional<chrome::mojom::AppShimLaunchResult> bootstrap_xa_result_;
- base::Optional<chrome::mojom::AppShimLaunchResult> bootstrap_ab_result_;
- base::Optional<chrome::mojom::AppShimLaunchResult> bootstrap_bb_result_;
- base::Optional<chrome::mojom::AppShimLaunchResult>
+ absl::optional<chrome::mojom::AppShimLaunchResult> bootstrap_aa_result_;
+ absl::optional<chrome::mojom::AppShimLaunchResult> bootstrap_ba_result_;
+ absl::optional<chrome::mojom::AppShimLaunchResult> bootstrap_ca_result_;
+ absl::optional<chrome::mojom::AppShimLaunchResult> bootstrap_xa_result_;
+ absl::optional<chrome::mojom::AppShimLaunchResult> bootstrap_ab_result_;
+ absl::optional<chrome::mojom::AppShimLaunchResult> bootstrap_bb_result_;
+ absl::optional<chrome::mojom::AppShimLaunchResult>
bootstrap_aa_duplicate_result_;
- base::Optional<chrome::mojom::AppShimLaunchResult>
+ absl::optional<chrome::mojom::AppShimLaunchResult>
bootstrap_aa_thethird_result_;
// Unique ptr to the TestsHosts used by the tests. These are passed by
diff --git a/chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac_unittest.cc b/chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac_unittest.cc
index 363690f..90dcf01d 100644
--- a/chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac_unittest.cc
+++ b/chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac_unittest.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/test/bind.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/profiles/profile.h"
@@ -18,6 +17,7 @@
#include "chrome/browser/web_applications/web_app_provider.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace web_app {
@@ -98,8 +98,8 @@
protected:
apps::AppLaunchParams CreateLaunchParams(
const std::vector<base::FilePath>& launch_files,
- const base::Optional<GURL>& url_handler_launch_url,
- const base::Optional<GURL>& protocol_handler_launch_url) {
+ const absl::optional<GURL>& url_handler_launch_url,
+ const absl::optional<GURL>& protocol_handler_launch_url) {
apps::AppLaunchParams params(
app_id_, apps::mojom::LaunchContainer::kLaunchContainerWindow,
WindowOpenDisposition::NEW_WINDOW,
@@ -111,8 +111,8 @@
return params;
}
- void ValidateOptionalGURL(const base::Optional<GURL>& actual,
- const base::Optional<GURL>& expected) {
+ void ValidateOptionalGURL(const absl::optional<GURL>& actual,
+ const absl::optional<GURL>& expected) {
ASSERT_EQ(actual.has_value(), expected.has_value());
if (actual.has_value()) {
EXPECT_EQ(actual.value(), expected.value());
@@ -146,7 +146,7 @@
TEST_F(WebAppShimManagerDelegateTest, LaunchApp) {
apps::AppLaunchParams expected_results = CreateLaunchParams(
- std::vector<base::FilePath>(), base::nullopt, base::nullopt);
+ std::vector<base::FilePath>(), absl::nullopt, absl::nullopt);
std::unique_ptr<MockDelegate> delegate = std::make_unique<MockDelegate>();
WebAppShimManagerDelegate shim_manager(std::move(delegate));
@@ -166,7 +166,7 @@
GURL protocol_handler_launch_url("web+test://test");
apps::AppLaunchParams expected_results =
- CreateLaunchParams(std::vector<base::FilePath>(), base::nullopt,
+ CreateLaunchParams(std::vector<base::FilePath>(), absl::nullopt,
protocol_handler_launch_url);
std::unique_ptr<MockDelegate> delegate = std::make_unique<MockDelegate>();
@@ -187,7 +187,7 @@
GURL protocol_handler_launch_url("mailto://[email protected]");
apps::AppLaunchParams expected_results =
- CreateLaunchParams(std::vector<base::FilePath>(), base::nullopt,
+ CreateLaunchParams(std::vector<base::FilePath>(), absl::nullopt,
protocol_handler_launch_url);
std::unique_ptr<MockDelegate> delegate = std::make_unique<MockDelegate>();
@@ -209,7 +209,7 @@
apps::AppLaunchParams expected_results =
CreateLaunchParams({base::FilePath("/test_app_path/test_app_file.txt")},
- base::nullopt, base::nullopt);
+ absl::nullopt, absl::nullopt);
std::unique_ptr<MockDelegate> delegate = std::make_unique<MockDelegate>();
WebAppShimManagerDelegate shim_manager(std::move(delegate));
@@ -229,7 +229,7 @@
GURL protocol_handler_launch_url("https://www.test.com/");
apps::AppLaunchParams expected_results = CreateLaunchParams(
- std::vector<base::FilePath>(), base::nullopt, base::nullopt);
+ std::vector<base::FilePath>(), absl::nullopt, absl::nullopt);
std::unique_ptr<MockDelegate> delegate = std::make_unique<MockDelegate>();
WebAppShimManagerDelegate shim_manager(std::move(delegate));
@@ -251,7 +251,7 @@
base::FilePath test_path(kTestPath);
apps::AppLaunchParams expected_results =
- CreateLaunchParams({test_path}, base::nullopt, base::nullopt);
+ CreateLaunchParams({test_path}, absl::nullopt, absl::nullopt);
std::unique_ptr<MockDelegate> delegate = std::make_unique<MockDelegate>();
WebAppShimManagerDelegate shim_manager(std::move(delegate));
@@ -272,7 +272,7 @@
base::FilePath test_path(kTestPath);
apps::AppLaunchParams expected_results =
- CreateLaunchParams({test_path}, base::nullopt, base::nullopt);
+ CreateLaunchParams({test_path}, absl::nullopt, absl::nullopt);
std::unique_ptr<MockDelegate> delegate = std::make_unique<MockDelegate>();
WebAppShimManagerDelegate shim_manager(std::move(delegate));
@@ -294,7 +294,7 @@
base::FilePath test_path(kTestPath);
apps::AppLaunchParams expected_results = CreateLaunchParams(
- {test_path}, base::nullopt, protocol_handler_launch_url);
+ {test_path}, absl::nullopt, protocol_handler_launch_url);
std::unique_ptr<MockDelegate> delegate = std::make_unique<MockDelegate>();
WebAppShimManagerDelegate shim_manager(std::move(delegate));
@@ -320,7 +320,7 @@
apps::AppLaunchParams expected_results = CreateLaunchParams(
{test_path, base::FilePath("/test_app_path/test_app_file.txt")},
- base::nullopt, protocol_handler_launch_url);
+ absl::nullopt, protocol_handler_launch_url);
std::unique_ptr<MockDelegate> delegate = std::make_unique<MockDelegate>();
WebAppShimManagerDelegate shim_manager(std::move(delegate));
diff --git a/chrome/browser/apps/digital_goods/util.cc b/chrome/browser/apps/digital_goods/util.cc
index 688a2cf..6d8c169 100644
--- a/chrome/browser/apps/digital_goods/util.cc
+++ b/chrome/browser/apps/digital_goods/util.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/apps/digital_goods/util.h"
-#include "base/optional.h"
#include "chrome/browser/ash/apps/apk_web_app_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_finder.h"
@@ -13,6 +12,7 @@
#include "chrome/browser/web_applications/web_app_provider.h"
#include "content/public/browser/render_document_host_user_data.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace apps {
@@ -38,7 +38,7 @@
return "";
}
- base::Optional<std::string> twa_package_name =
+ absl::optional<std::string> twa_package_name =
apk_web_app_service->GetPackageNameForWebApp(
content::WebContents::FromRenderFrameHost(render_frame_host)
->GetLastCommittedURL());
@@ -51,7 +51,7 @@
web_app::WebAppProvider::Get(
Profile::FromBrowserContext(render_frame_host->GetBrowserContext()))
->registrar();
- base::Optional<web_app::AppId> app_id = registrar.FindAppWithUrlInScope(
+ absl::optional<web_app::AppId> app_id = registrar.FindAppWithUrlInScope(
content::WebContents::FromRenderFrameHost(render_frame_host)
->GetLastCommittedURL());
if (!app_id) {
diff --git a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
index f6e870a7..6f85efd1 100644
--- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
@@ -536,7 +536,7 @@
content::TextInputManagerTester tester_;
std::unique_ptr<base::RunLoop> run_loop_;
- base::Optional<uint32_t> last_composition_range_length_;
+ absl::optional<uint32_t> last_composition_range_length_;
uint32_t expected_length_ = 0;
};
};
diff --git a/chrome/browser/apps/intent_helper/apps_navigation_throttle.cc b/chrome/browser/apps/intent_helper/apps_navigation_throttle.cc
index 2a8dfa9..926ba90 100644
--- a/chrome/browser/apps/intent_helper/apps_navigation_throttle.cc
+++ b/chrome/browser/apps/intent_helper/apps_navigation_throttle.cc
@@ -6,7 +6,6 @@
#include <utility>
-#include "base/optional.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
@@ -30,6 +29,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/features.h"
#include "ui/gfx/image/image.h"
#include "url/origin.h"
@@ -134,7 +134,7 @@
// Handles web app link capturing that has not yet integrated with the
// intent handling system.
// TODO(crbug.com/1163398): Remove this code path.
- base::Optional<ThrottleCheckResult> web_app_capture =
+ absl::optional<ThrottleCheckResult> web_app_capture =
CaptureWebAppScopeNavigations(web_contents, handle);
if (web_app_capture.has_value())
return web_app_capture.value();
@@ -157,25 +157,25 @@
return content::NavigationThrottle::PROCEED;
}
-base::Optional<ThrottleCheckResult>
+absl::optional<ThrottleCheckResult>
AppsNavigationThrottle::CaptureWebAppScopeNavigations(
content::WebContents* web_contents,
content::NavigationHandle* handle) const {
if (!navigate_from_link())
- return base::nullopt;
+ return absl::nullopt;
Profile* const profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
web_app::WebAppProviderBase* provider =
web_app::WebAppProviderBase::GetProviderBase(profile);
if (!provider)
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
provider->registrar().FindInstalledAppWithUrlInScope(
handle->GetURL(), /*window_only=*/true);
if (!app_id)
- return base::nullopt;
+ return absl::nullopt;
// Experimental tabbed web app link capturing behaves like new-client.
// This will be removed once we phase out kDesktopPWAsTabStripLinkCapturing in
@@ -192,14 +192,14 @@
// yet integrated with app service's intent handling system.
if ((!app_in_tabbed_mode || !tabbed_link_capturing) &&
web_apps_integrated_into_intent_handling) {
- return base::nullopt;
+ return absl::nullopt;
}
auto* tab_helper =
web_app::WebAppTabHelperBase::FromWebContents(web_contents);
if (tab_helper && tab_helper->GetAppId() == *app_id) {
// Already in app scope, do not alter window state while using the app.
- return base::nullopt;
+ return absl::nullopt;
}
blink::mojom::CaptureLinks capture_links = provider->registrar()
@@ -215,19 +215,19 @@
switch (capture_links) {
case blink::mojom::CaptureLinks::kUndefined:
case blink::mojom::CaptureLinks::kNone:
- return base::nullopt;
+ return absl::nullopt;
case blink::mojom::CaptureLinks::kExistingClientNavigate:
case blink::mojom::CaptureLinks::kNewClient: {
Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
if (!browser) {
// This is a middle click open in new tab action; do not capture.
- return base::nullopt;
+ return absl::nullopt;
}
if (web_app::AppBrowserController::IsForWebApp(browser, *app_id)) {
// Already in the app window; navigation already captured.
- return base::nullopt;
+ return absl::nullopt;
}
if (capture_links ==
diff --git a/chrome/browser/apps/intent_helper/apps_navigation_throttle.h b/chrome/browser/apps/intent_helper/apps_navigation_throttle.h
index d61f389c..c18a8801 100644
--- a/chrome/browser/apps/intent_helper/apps_navigation_throttle.h
+++ b/chrome/browser/apps/intent_helper/apps_navigation_throttle.h
@@ -80,7 +80,7 @@
// When |kIntentPickerPWAPersistence| is enabled |kWebAppEnableLinkCapturing|
// is handled by WebAppsBase::LaunchAppWithIntentImpl() instead and integrates
// properly with App Service's intent handling system.
- base::Optional<ThrottleCheckResult> CaptureWebAppScopeNavigations(
+ absl::optional<ThrottleCheckResult> CaptureWebAppScopeNavigations(
content::WebContents* web_contents,
content::NavigationHandle* handle) const;
diff --git a/chrome/browser/apps/intent_helper/intent_picker_internal.cc b/chrome/browser/apps/intent_helper/intent_picker_internal.cc
index f2eb5c0..17a329cf 100644
--- a/chrome/browser/apps/intent_helper/intent_picker_internal.cc
+++ b/chrome/browser/apps/intent_helper/intent_picker_internal.cc
@@ -69,7 +69,7 @@
Profile* const profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
web_app::FindInstalledAppWithUrlInScope(profile, url,
/*window_only=*/true);
if (!app_id)
@@ -106,7 +106,7 @@
IntentPickerTabHelper::SetShouldShowIcon(web_contents, true);
browser->window()->ShowIntentPickerBubble(
std::move(apps), show_stay_in_chrome, show_remember_selection,
- PageActionIconType::kIntentPicker, base::nullopt, std::move(callback));
+ PageActionIconType::kIntentPicker, absl::nullopt, std::move(callback));
}
bool InAppBrowser(content::WebContents* web_contents) {
diff --git a/chrome/browser/apps/intent_helper/mac_intent_picker_helpers.mm b/chrome/browser/apps/intent_helper/mac_intent_picker_helpers.mm
index 8f6e29f..9973ee0 100644
--- a/chrome/browser/apps/intent_helper/mac_intent_picker_helpers.mm
+++ b/chrome/browser/apps/intent_helper/mac_intent_picker_helpers.mm
@@ -7,9 +7,9 @@
#import <Cocoa/Cocoa.h>
#import <SafariServices/SafariServices.h>
-#include "base/optional.h"
#include "base/strings/sys_string_conversions.h"
#include "net/base/mac/url_conversions.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/models/image_model.h"
namespace apps {
@@ -39,11 +39,11 @@
base::SysNSStringToUTF8(app_name));
}
-base::Optional<IntentPickerAppInfo> AppInfoForUrl(const GURL& url) {
+absl::optional<IntentPickerAppInfo> AppInfoForUrl(const GURL& url) {
if (@available(macOS 10.15, *)) {
NSURL* nsurl = net::NSURLWithGURL(url);
if (!nsurl)
- return base::nullopt;
+ return absl::nullopt;
SFUniversalLink* link =
[[[SFUniversalLink alloc] initWithWebpageURL:nsurl] autorelease];
@@ -51,7 +51,7 @@
return AppInfoForAppUrl(link.applicationURL);
}
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace
diff --git a/chrome/browser/apps/platform_apps/api/arc_apps_private/arc_apps_private_apitest.cc b/chrome/browser/apps/platform_apps/api/arc_apps_private/arc_apps_private_apitest.cc
index 00c7cde3..5e91676a 100644
--- a/chrome/browser/apps/platform_apps/api/arc_apps_private/arc_apps_private_apitest.cc
+++ b/chrome/browser/apps/platform_apps/api/arc_apps_private/arc_apps_private_apitest.cc
@@ -87,7 +87,7 @@
app_instance()->SendRefreshAppList({launchable_app});
static_cast<arc::mojom::AppHost*>(prefs)->OnTaskCreated(
0 /* task_id */, "Package_1", "Dummy_activity_1", "App_1",
- base::nullopt /* intent */, 0 /* session_id */);
+ absl::nullopt /* intent */, 0 /* session_id */);
// Stopping the service makes the app non-ready.
arc::ArcServiceManager::Get()->arc_bridge_service()->app()->CloseInstance(
@@ -134,7 +134,7 @@
app_instance()->SendRefreshAppList({launchable_app});
static_cast<arc::mojom::AppHost*>(prefs)->OnTaskCreated(
0 /* task_id */, "Package_1", "Dummy_activity_1", "App_1",
- base::nullopt /* intent */, 0 /* session_id */);
+ absl::nullopt /* intent */, 0 /* session_id */);
// Verify the JS test receives the onInstalled event for the launchable app
// only, and the app is launched successfully.
EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
diff --git a/chrome/browser/ash/accessibility/accessibility_manager_browsertest.cc b/chrome/browser/ash/accessibility/accessibility_manager_browsertest.cc
index 8593e045..5fc10d2 100644
--- a/chrome/browser/ash/accessibility/accessibility_manager_browsertest.cc
+++ b/chrome/browser/ash/accessibility/accessibility_manager_browsertest.cc
@@ -10,7 +10,6 @@
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/ash/login/session/user_session_manager.h"
#include "chrome/browser/ash/login/test/guest_session_mixin.h"
@@ -34,6 +33,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/test/browser_test.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/ime/chromeos/component_extension_ime_manager.h"
#include "ui/base/ime/chromeos/extension_ime_util.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
@@ -76,7 +76,7 @@
bool observed() const { return observed_; }
bool observed_enabled() const { return observed_enabled_; }
- base::Optional<AccessibilityNotificationType> observed_type() const {
+ absl::optional<AccessibilityNotificationType> observed_type() const {
return observed_type_;
}
@@ -95,7 +95,7 @@
bool observed_ = false;
bool observed_enabled_ = false;
- base::Optional<AccessibilityNotificationType> observed_type_;
+ absl::optional<AccessibilityNotificationType> observed_type_;
base::CallbackListSubscription accessibility_subscription_;
diff --git a/chrome/browser/ash/accessibility/dictation.cc b/chrome/browser/ash/accessibility/dictation.cc
index e431ee2..40add489 100644
--- a/chrome/browser/ash/accessibility/dictation.cc
+++ b/chrome/browser/ash/accessibility/dictation.cc
@@ -128,7 +128,7 @@
void Dictation::OnSpeechResult(
const std::u16string& transcription,
bool is_final,
- const base::Optional<SpeechRecognizerDelegate::TranscriptTiming>&
+ const absl::optional<SpeechRecognizerDelegate::TranscriptTiming>&
word_offsets) {
// If the first character of text isn't a space, add a space before it.
// NetworkSpeechRecognizer adds the preceding space but
diff --git a/chrome/browser/ash/accessibility/dictation.h b/chrome/browser/ash/accessibility/dictation.h
index 5db26634..af1c751 100644
--- a/chrome/browser/ash/accessibility/dictation.h
+++ b/chrome/browser/ash/accessibility/dictation.h
@@ -41,7 +41,7 @@
void OnSpeechResult(
const std::u16string& transcription,
bool is_final,
- const base::Optional<SpeechRecognizerDelegate::TranscriptTiming>&
+ const absl::optional<SpeechRecognizerDelegate::TranscriptTiming>&
word_offsets) override;
void OnSpeechSoundLevelChanged(int16_t level) override;
void OnSpeechRecognitionStateChanged(
diff --git a/chrome/browser/ash/accessibility/dictation_browsertest.cc b/chrome/browser/ash/accessibility/dictation_browsertest.cc
index 00308d4..eaddc740 100644
--- a/chrome/browser/ash/accessibility/dictation_browsertest.cc
+++ b/chrome/browser/ash/accessibility/dictation_browsertest.cc
@@ -6,7 +6,6 @@
#include <memory>
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/timer/timer.h"
#include "chrome/browser/ash/accessibility/accessibility_manager.h"
@@ -19,6 +18,7 @@
#include "content/public/test/browser_test.h"
#include "content/public/test/fake_speech_recognition_manager.h"
#include "media/mojo/mojom/speech_recognition_service.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/accessibility_switches.h"
#include "ui/base/ime/chromeos/ime_bridge.h"
@@ -131,7 +131,7 @@
// FakeSpeechRecognitionManager can only send final results,
// so if this isn't final just send to Dictation directly.
GetManager()->dictation_->OnSpeechResult(base::ASCIIToUTF16(result),
- is_final, base::nullopt);
+ is_final, absl::nullopt);
} else {
base::RunLoop loop;
fake_speech_recognition_manager_->SetFakeResult(result);
diff --git a/chrome/browser/ash/account_manager/account_manager_edu_coexistence_controller.cc b/chrome/browser/ash/account_manager/account_manager_edu_coexistence_controller.cc
index 9911e5de..c8f5c9a9 100644
--- a/chrome/browser/ash/account_manager/account_manager_edu_coexistence_controller.cc
+++ b/chrome/browser/ash/account_manager/account_manager_edu_coexistence_controller.cc
@@ -10,7 +10,6 @@
#include "ash/constants/ash_pref_names.h"
#include "base/containers/contains.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "chrome/browser/ash/account_manager/account_manager_util.h"
#include "chrome/browser/ash/child_accounts/edu_coexistence_tos_store_utils.h"
#include "chrome/browser/profiles/profile.h"
@@ -18,6 +17,7 @@
#include "components/account_manager_core/account_manager_facade.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
diff --git a/chrome/browser/ash/account_manager/account_manager_migrator.cc b/chrome/browser/ash/account_manager/account_manager_migrator.cc
index c58f1303..1e6dfc08 100644
--- a/chrome/browser/ash/account_manager/account_manager_migrator.cc
+++ b/chrome/browser/ash/account_manager/account_manager_migrator.cc
@@ -626,7 +626,7 @@
return migration_runner_->GetStatus();
}
-base::Optional<AccountMigrationRunner::MigrationResult>
+absl::optional<AccountMigrationRunner::MigrationResult>
AccountManagerMigrator::GetLastMigrationRunResult() const {
return last_migration_run_result_;
}
@@ -638,7 +638,7 @@
DCHECK_NE(AccountMigrationRunner::Status::kRunning,
migration_runner_->GetStatus());
- last_migration_run_result_ = base::make_optional(result);
+ last_migration_run_result_ = absl::make_optional(result);
VLOG(1) << "Account migrations completed with result: "
<< static_cast<int>(result.final_status);
diff --git a/chrome/browser/ash/account_manager/account_manager_migrator.h b/chrome/browser/ash/account_manager/account_manager_migrator.h
index e095bf3e..cbe10f4c 100644
--- a/chrome/browser/ash/account_manager/account_manager_migrator.h
+++ b/chrome/browser/ash/account_manager/account_manager_migrator.h
@@ -9,10 +9,10 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ash/account_manager/account_migration_runner.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -40,7 +40,7 @@
// Gets the result of the last migration run. If migrations have not been run
// before, the optional will be empty.
- base::Optional<AccountMigrationRunner::MigrationResult>
+ absl::optional<AccountMigrationRunner::MigrationResult>
GetLastMigrationRunResult() const;
private:
@@ -69,7 +69,7 @@
// Result of the last migration run. Empty if migrations have not been run
// before.
- base::Optional<AccountMigrationRunner::MigrationResult>
+ absl::optional<AccountMigrationRunner::MigrationResult>
last_migration_run_result_;
base::WeakPtrFactory<AccountManagerMigrator> weak_factory_{this};
diff --git a/chrome/browser/ash/app_mode/kiosk_app_icon_loader.cc b/chrome/browser/ash/app_mode/kiosk_app_icon_loader.cc
index a08b291..c86cac3 100644
--- a/chrome/browser/ash/app_mode/kiosk_app_icon_loader.cc
+++ b/chrome/browser/ash/app_mode/kiosk_app_icon_loader.cc
@@ -39,7 +39,7 @@
LOG(ERROR) << "Failed to decode icon image.";
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(std::move(result_callback_),
- base::Optional<gfx::ImageSkia>()));
+ absl::optional<gfx::ImageSkia>()));
delete this;
}
@@ -59,7 +59,7 @@
LOG(ERROR) << "Failed to read icon file.";
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(std::move(result_callback),
- base::Optional<gfx::ImageSkia>()));
+ absl::optional<gfx::ImageSkia>()));
return;
}
@@ -88,7 +88,7 @@
}
void KioskAppIconLoader::OnImageDecodingFinished(
- base::Optional<gfx::ImageSkia> result) {
+ absl::optional<gfx::ImageSkia> result) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (result.has_value()) {
diff --git a/chrome/browser/ash/app_mode/kiosk_app_icon_loader.h b/chrome/browser/ash/app_mode/kiosk_app_icon_loader.h
index 5be44da..7ea32ee 100644
--- a/chrome/browser/ash/app_mode/kiosk_app_icon_loader.h
+++ b/chrome/browser/ash/app_mode/kiosk_app_icon_loader.h
@@ -8,8 +8,8 @@
#include "base/callback_forward.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/image/image_skia.h"
namespace base {
@@ -31,7 +31,7 @@
};
using ResultCallback =
- base::OnceCallback<void(base::Optional<gfx::ImageSkia> result)>;
+ base::OnceCallback<void(absl::optional<gfx::ImageSkia> result)>;
explicit KioskAppIconLoader(Delegate* delegate);
@@ -40,7 +40,7 @@
void Start(const base::FilePath& icon_path);
private:
- void OnImageDecodingFinished(base::Optional<gfx::ImageSkia> result);
+ void OnImageDecodingFinished(absl::optional<gfx::ImageSkia> result);
// Delegate always lives longer than this class as it's owned by delegate.
Delegate* const delegate_;
diff --git a/chrome/browser/ash/app_mode/kiosk_app_manager.h b/chrome/browser/ash/app_mode/kiosk_app_manager.h
index 48fedfa..c8c072e 100644
--- a/chrome/browser/ash/app_mode/kiosk_app_manager.h
+++ b/chrome/browser/ash/app_mode/kiosk_app_manager.h
@@ -13,7 +13,6 @@
#include "base/callback_forward.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/app_mode/kiosk_app_manager_base.h"
#include "chrome/browser/ash/settings/cros_settings.h"
@@ -22,6 +21,7 @@
#include "chromeos/tpm/install_attributes.h"
#include "components/account_id/account_id.h"
#include "extensions/common/extension_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
class PrefRegistrySimple;
@@ -332,13 +332,13 @@
std::unique_ptr<KioskExternalUpdater> usb_stick_updater_;
// Last app id set by UpdatePrimaryAppLoaderPrefs().
- base::Optional<std::string> primary_app_id_;
+ absl::optional<std::string> primary_app_id_;
// Callback registered using SetPrimaryAppLoaderPrefsChangedHandler().
base::RepeatingClosure primary_app_changed_handler_;
// Extensions id set by UpdateSecondatyAppsLoaderPrefs().
- base::Optional<std::vector<std::string>> secondary_app_ids_;
+ absl::optional<std::vector<std::string>> secondary_app_ids_;
// Callback registered using SetSecondaryAppsLoaderPrefsChangedHandler().
base::RepeatingClosure secondary_apps_changed_handler_;
diff --git a/chrome/browser/ash/app_mode/kiosk_app_types.h b/chrome/browser/ash/app_mode/kiosk_app_types.h
index fed1aa1..0961b56 100644
--- a/chrome/browser/ash/app_mode/kiosk_app_types.h
+++ b/chrome/browser/ash/app_mode/kiosk_app_types.h
@@ -7,8 +7,8 @@
#include <string>
-#include "base/optional.h"
#include "components/account_id/account_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -19,8 +19,8 @@
class KioskAppId {
public:
KioskAppType type;
- base::Optional<std::string> app_id;
- base::Optional<AccountId> account_id;
+ absl::optional<std::string> app_id;
+ absl::optional<AccountId> account_id;
KioskAppId();
~KioskAppId();
diff --git a/chrome/browser/ash/app_mode/kiosk_cryptohome_remover.cc b/chrome/browser/ash/app_mode/kiosk_cryptohome_remover.cc
index 44884b9..e15374e4 100644
--- a/chrome/browser/ash/app_mode/kiosk_cryptohome_remover.cc
+++ b/chrome/browser/ash/app_mode/kiosk_cryptohome_remover.cc
@@ -87,7 +87,7 @@
void OnRemoveAppCryptohomeComplete(
const cryptohome::Identification& id,
base::OnceClosure callback,
- base::Optional<user_data_auth::RemoveReply> reply) {
+ absl::optional<user_data_auth::RemoveReply> reply) {
cryptohome::MountError error = ReplyToMountError(reply);
if (error == cryptohome::MOUNT_ERROR_NONE ||
error == cryptohome::MOUNT_ERROR_USER_DOES_NOT_EXIST) {
diff --git a/chrome/browser/ash/app_mode/kiosk_profile_loader.cc b/chrome/browser/ash/app_mode/kiosk_profile_loader.cc
index d5af2907..492dfc0 100644
--- a/chrome/browser/ash/app_mode/kiosk_profile_loader.cc
+++ b/chrome/browser/ash/app_mode/kiosk_profile_loader.cc
@@ -11,7 +11,6 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h"
#include "base/syslog_logging.h"
@@ -29,6 +28,7 @@
#include "components/user_manager/user_names.h"
#include "content/public/browser/browser_thread.h"
#include "google_apis/gaia/gaia_auth_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -60,7 +60,7 @@
////////////////////////////////////////////////////////////////////////////////
// KioskProfileLoader::CryptohomedChecker ensures cryptohome daemon is up
// and running by issuing an IsMounted call. If the call does not go through
-// and base::nullopt is not returned, it will retry after some time out and at
+// and absl::nullopt is not returned, it will retry after some time out and at
// the maximum five times before it gives up. Upon success, it resumes the
// launch by logging in as a kiosk mode account.
@@ -105,7 +105,7 @@
}
void OnCryptohomeIsMounted(
- base::Optional<user_data_auth::IsMountedReply> reply) {
+ absl::optional<user_data_auth::IsMountedReply> reply) {
if (!reply.has_value()) {
Retry();
return;
diff --git a/chrome/browser/ash/app_mode/test_kiosk_extension_builder.cc b/chrome/browser/ash/app_mode/test_kiosk_extension_builder.cc
index 01dc2151..cedcc7c1 100644
--- a/chrome/browser/ash/app_mode/test_kiosk_extension_builder.cc
+++ b/chrome/browser/ash/app_mode/test_kiosk_extension_builder.cc
@@ -27,14 +27,14 @@
TestKioskExtensionBuilder::~TestKioskExtensionBuilder() = default;
void TestKioskExtensionBuilder::AddSecondaryExtension(const std::string& id) {
- secondary_extensions_.emplace_back(id, base::nullopt);
+ secondary_extensions_.emplace_back(id, absl::nullopt);
}
void TestKioskExtensionBuilder::AddSecondaryExtensionWithEnabledOnLaunch(
const std::string& id,
bool enabled_on_launch) {
secondary_extensions_.emplace_back(id,
- base::Optional<bool>(enabled_on_launch));
+ absl::optional<bool>(enabled_on_launch));
}
scoped_refptr<const extensions::Extension> TestKioskExtensionBuilder::Build()
diff --git a/chrome/browser/ash/apps/apk_web_app_installer.cc b/chrome/browser/ash/apps/apk_web_app_installer.cc
index 14f414677..27e7ce2 100644
--- a/chrome/browser/ash/apps/apk_web_app_installer.cc
+++ b/chrome/browser/ash/apps/apk_web_app_installer.cc
@@ -52,7 +52,7 @@
base::WeakPtr<Owner> weak_owner)
: profile_(profile),
is_web_only_twa_(false),
- sha256_fingerprint_(base::nullopt),
+ sha256_fingerprint_(absl::nullopt),
callback_(std::move(callback)),
weak_owner_(weak_owner) {}
diff --git a/chrome/browser/ash/apps/apk_web_app_installer.h b/chrome/browser/ash/apps/apk_web_app_installer.h
index 2c35664..6c01c0b6 100644
--- a/chrome/browser/ash/apps/apk_web_app_installer.h
+++ b/chrome/browser/ash/apps/apk_web_app_installer.h
@@ -11,10 +11,10 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
#include "components/arc/mojom/app.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
class Profile;
@@ -32,7 +32,7 @@
using InstallFinishCallback = base::OnceCallback<void(
const web_app::AppId&,
const bool is_web_only_twa,
- const base::Optional<std::string> sha256_fingerprint,
+ const absl::optional<std::string> sha256_fingerprint,
web_app::InstallResultCode)>;
// Do nothing class purely for the purpose of allowing us to specify
@@ -85,7 +85,7 @@
// shorter than that of |profile_|.
Profile* profile_;
bool is_web_only_twa_;
- base::Optional<std::string> sha256_fingerprint_;
+ absl::optional<std::string> sha256_fingerprint_;
InstallFinishCallback callback_;
base::WeakPtr<Owner> weak_owner_;
diff --git a/chrome/browser/ash/apps/apk_web_app_service.cc b/chrome/browser/ash/apps/apk_web_app_service.cc
index 189eb02..d3ef17c 100644
--- a/chrome/browser/ash/apps/apk_web_app_service.cc
+++ b/chrome/browser/ash/apps/apk_web_app_service.cc
@@ -112,7 +112,7 @@
profile_->GetPrefs(), web_app_id, web_app::ExternalInstallSource::kArc);
}
-base::Optional<std::string> ApkWebAppService::GetPackageNameForWebApp(
+absl::optional<std::string> ApkWebAppService::GetPackageNameForWebApp(
const web_app::AppId& app_id) {
DictionaryPrefUpdate web_apps_to_apks(profile_->GetPrefs(),
kWebAppToApkDictPref);
@@ -122,26 +122,26 @@
{app_id, kPackageNameKey}, base::Value::Type::STRING);
if (!v)
- return base::nullopt;
+ return absl::nullopt;
- return base::Optional<std::string>(v->GetString());
+ return absl::optional<std::string>(v->GetString());
}
-base::Optional<std::string> ApkWebAppService::GetPackageNameForWebApp(
+absl::optional<std::string> ApkWebAppService::GetPackageNameForWebApp(
const GURL& url) {
web_app::AppRegistrar& registrar =
web_app::WebAppProvider::Get(profile_)->registrar();
- base::Optional<web_app::AppId> app_id = registrar.FindAppWithUrlInScope(url);
+ absl::optional<web_app::AppId> app_id = registrar.FindAppWithUrlInScope(url);
if (!app_id)
- return base::nullopt;
+ return absl::nullopt;
return GetPackageNameForWebApp(app_id.value());
}
-base::Optional<std::string> ApkWebAppService::GetCertificateSha256Fingerprint(
+absl::optional<std::string> ApkWebAppService::GetCertificateSha256Fingerprint(
const web_app::AppId& app_id) {
if (!IsWebAppInstalledFromArc(app_id))
- return base::nullopt;
+ return absl::nullopt;
DictionaryPrefUpdate web_apps_to_apks(profile_->GetPrefs(),
kWebAppToApkDictPref);
@@ -151,9 +151,9 @@
{app_id, kSha256FingerprintKey}, base::Value::Type::STRING);
if (!v)
- return base::nullopt;
+ return absl::nullopt;
- return base::Optional<std::string>(v->GetString());
+ return absl::optional<std::string>(v->GetString());
}
void ApkWebAppService::SetArcAppListPrefsForTesting(ArcAppListPrefs* prefs) {
@@ -461,7 +461,7 @@
const std::string& package_name,
const web_app::AppId& web_app_id,
bool is_web_only_twa,
- const base::Optional<std::string> sha256_fingerprint,
+ const absl::optional<std::string> sha256_fingerprint,
web_app::InstallResultCode code) {
// Do nothing: any error cancels installation.
if (code != web_app::InstallResultCode::kSuccessNewInstall)
diff --git a/chrome/browser/ash/apps/apk_web_app_service.h b/chrome/browser/ash/apps/apk_web_app_service.h
index 908881c..0b1b590 100644
--- a/chrome/browser/ash/apps/apk_web_app_service.h
+++ b/chrome/browser/ash/apps/apk_web_app_service.h
@@ -52,12 +52,12 @@
bool IsWebAppInstalledFromArc(const web_app::AppId& web_app_id);
- base::Optional<std::string> GetPackageNameForWebApp(
+ absl::optional<std::string> GetPackageNameForWebApp(
const web_app::AppId& app_id);
- base::Optional<std::string> GetPackageNameForWebApp(const GURL& url);
+ absl::optional<std::string> GetPackageNameForWebApp(const GURL& url);
- base::Optional<std::string> GetCertificateSha256Fingerprint(
+ absl::optional<std::string> GetCertificateSha256Fingerprint(
const web_app::AppId& app_id);
using WebAppCallbackForTesting =
@@ -100,7 +100,7 @@
void OnDidFinishInstall(const std::string& package_name,
const web_app::AppId& web_app_id,
bool is_web_only_twa,
- const base::Optional<std::string> sha256_fingerprint,
+ const absl::optional<std::string> sha256_fingerprint,
web_app::InstallResultCode code);
void UpdatePackageInfo(const std::string& app_id,
const arc::mojom::WebAppInfoPtr& web_app_info);
diff --git a/chrome/browser/ash/apps/intent_helper/common_apps_navigation_throttle.cc b/chrome/browser/ash/apps/intent_helper/common_apps_navigation_throttle.cc
index 957f75a1..da55576 100644
--- a/chrome/browser/ash/apps/intent_helper/common_apps_navigation_throttle.cc
+++ b/chrome/browser/ash/apps/intent_helper/common_apps_navigation_throttle.cc
@@ -131,7 +131,7 @@
if (!navigate_from_link())
return false;
- base::Optional<std::string> preferred_app_id =
+ absl::optional<std::string> preferred_app_id =
proxy->PreferredApps().FindPreferredAppForUrl(url);
if (!preferred_app_id.has_value() ||
!base::Contains(app_ids, preferred_app_id.value())) {
diff --git a/chrome/browser/ash/arc/accessibility/accessibility_node_info_data_wrapper.h b/chrome/browser/ash/arc/accessibility/accessibility_node_info_data_wrapper.h
index 97204f1..7efdecb 100644
--- a/chrome/browser/ash/arc/accessibility/accessibility_node_info_data_wrapper.h
+++ b/chrome/browser/ash/arc/accessibility/accessibility_node_info_data_wrapper.h
@@ -96,7 +96,7 @@
// This property is a cached value so that we can avoid same computation.
// mutable because once the value is computed it won't change.
- mutable base::Optional<bool> has_important_property_cache_;
+ mutable absl::optional<bool> has_important_property_cache_;
DISALLOW_COPY_AND_ASSIGN(AccessibilityNodeInfoDataWrapper);
};
diff --git a/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge.cc b/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge.cc
index a0ce4ecf..1bd96f7 100644
--- a/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge.cc
+++ b/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge.cc
@@ -466,11 +466,11 @@
return;
}
- base::Optional<int32_t> window_id = tree_source->window_id();
+ absl::optional<int32_t> window_id = tree_source->window_id();
if (!window_id)
return;
- const base::Optional<mojom::AccessibilityActionType> action =
+ const absl::optional<mojom::AccessibilityActionType> action =
ConvertToAndroidAction(data.action);
if (!action.has_value())
return;
@@ -664,7 +664,7 @@
void ArcAccessibilityHelperBridge::OnGetTextLocationDataResult(
const ui::AXActionData& data,
- const base::Optional<gfx::Rect>& result_rect) const {
+ const absl::optional<gfx::Rect>& result_rect) const {
AXTreeSourceArc* tree_source = GetFromTreeId(data.target_tree_id);
if (!tree_source)
@@ -674,16 +674,16 @@
data, OnGetTextLocationDataResultInternal(result_rect));
}
-base::Optional<gfx::Rect>
+absl::optional<gfx::Rect>
ArcAccessibilityHelperBridge::OnGetTextLocationDataResultInternal(
- const base::Optional<gfx::Rect>& result_rect) const {
+ const absl::optional<gfx::Rect>& result_rect) const {
if (!result_rect)
- return base::nullopt;
+ return absl::nullopt;
DCHECK(exo::WMHelper::HasInstance());
aura::Window* focused_window = GetFocusedArcWindow();
if (!focused_window)
- return base::nullopt;
+ return absl::nullopt;
const gfx::RectF& rect_f =
ScaleAndroidPxToChromePx(result_rect.value(), focused_window);
diff --git a/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge.h b/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge.h
index e0a267f..6e158a8 100644
--- a/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge.h
+++ b/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge.h
@@ -149,10 +149,10 @@
void OnActionResult(const ui::AXActionData& data, bool result) const;
void OnGetTextLocationDataResult(
const ui::AXActionData& data,
- const base::Optional<gfx::Rect>& result_rect) const;
+ const absl::optional<gfx::Rect>& result_rect) const;
- base::Optional<gfx::Rect> OnGetTextLocationDataResultInternal(
- const base::Optional<gfx::Rect>& result_rect) const;
+ absl::optional<gfx::Rect> OnGetTextLocationDataResultInternal(
+ const absl::optional<gfx::Rect>& result_rect) const;
void OnAccessibilityStatusChanged(
const ash::AccessibilityStatusEventDetails& event_details);
diff --git a/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc b/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc
index 3b105b8..1c46419 100644
--- a/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc
+++ b/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc
@@ -489,7 +489,7 @@
auto event = arc::mojom::AccessibilityEventData::New();
event->event_type = arc::mojom::AccessibilityEventType::ANNOUNCEMENT;
event->event_text =
- base::make_optional<std::vector<std::string>>(std::move(text));
+ absl::make_optional<std::vector<std::string>>(std::move(text));
helper_bridge->OnAccessibilityEvent(event.Clone());
@@ -513,7 +513,7 @@
event->event_type =
arc::mojom::AccessibilityEventType::NOTIFICATION_STATE_CHANGED;
event->event_text =
- base::make_optional<std::vector<std::string>>(std::move(text));
+ absl::make_optional<std::vector<std::string>>(std::move(text));
event->string_properties =
base::flat_map<arc::mojom::AccessibilityEventStringProperty,
std::string>();
@@ -621,7 +621,7 @@
arc::mojom::AccessibilityNotificationStateType::SURFACE_CREATED);
auto event1 = arc::mojom::AccessibilityEventData::New();
event1->event_type = arc::mojom::AccessibilityEventType::WINDOW_STATE_CHANGED;
- event1->notification_key = base::make_optional<std::string>(kNotificationKey);
+ event1->notification_key = absl::make_optional<std::string>(kNotificationKey);
event1->node_data.push_back(arc::mojom::AccessibilityNodeInfoData::New());
event1->window_data =
std::vector<arc::mojom::AccessibilityWindowInfoDataPtr>();
@@ -661,7 +661,7 @@
arc::mojom::AccessibilityNotificationStateType::SURFACE_CREATED);
auto event3 = arc::mojom::AccessibilityEventData::New();
event3->event_type = arc::mojom::AccessibilityEventType::WINDOW_STATE_CHANGED;
- event3->notification_key = base::make_optional<std::string>(kNotificationKey);
+ event3->notification_key = absl::make_optional<std::string>(kNotificationKey);
event3->node_data.push_back(arc::mojom::AccessibilityNodeInfoData::New());
event3->window_data =
std::vector<arc::mojom::AccessibilityWindowInfoDataPtr>();
@@ -730,7 +730,7 @@
arc::mojom::AccessibilityNotificationStateType::SURFACE_CREATED);
auto event1 = arc::mojom::AccessibilityEventData::New();
event1->event_type = arc::mojom::AccessibilityEventType::WINDOW_STATE_CHANGED;
- event1->notification_key = base::make_optional<std::string>(kNotificationKey);
+ event1->notification_key = absl::make_optional<std::string>(kNotificationKey);
event1->node_data.push_back(arc::mojom::AccessibilityNodeInfoData::New());
event1->window_data =
std::vector<arc::mojom::AccessibilityWindowInfoDataPtr>();
@@ -782,7 +782,7 @@
auto event = arc::mojom::AccessibilityEventData::New();
event->event_type =
arc::mojom::AccessibilityEventType::VIEW_TEXT_SELECTION_CHANGED;
- event->notification_key = base::make_optional<std::string>(kNotificationKey);
+ event->notification_key = absl::make_optional<std::string>(kNotificationKey);
event->node_data.push_back(arc::mojom::AccessibilityNodeInfoData::New());
event->window_data =
std::vector<arc::mojom::AccessibilityWindowInfoDataPtr>();
@@ -846,7 +846,7 @@
auto event = arc::mojom::AccessibilityEventData::New();
event->event_type =
arc::mojom::AccessibilityEventType::VIEW_TEXT_SELECTION_CHANGED;
- event->notification_key = base::make_optional<std::string>(kNotificationKey);
+ event->notification_key = absl::make_optional<std::string>(kNotificationKey);
event->node_data.push_back(arc::mojom::AccessibilityNodeInfoData::New());
event->window_data =
std::vector<arc::mojom::AccessibilityWindowInfoDataPtr>();
diff --git a/chrome/browser/ash/arc/accessibility/arc_accessibility_test_util.h b/chrome/browser/ash/arc/accessibility/arc_accessibility_test_util.h
index 5f2fe4a..d59983dc 100644
--- a/chrome/browser/ash/arc/accessibility/arc_accessibility_test_util.h
+++ b/chrome/browser/ash/arc/accessibility/arc_accessibility_test_util.h
@@ -6,15 +6,15 @@
#define CHROME_BROWSER_ASH_ARC_ACCESSIBILITY_ARC_ACCESSIBILITY_TEST_UTIL_H_
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "components/arc/mojom/accessibility_helper.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace arc {
template <class PropType, class ValueType>
void SetProperty(
- base::Optional<base::flat_map<PropType, ValueType>>& properties,
+ absl::optional<base::flat_map<PropType, ValueType>>& properties,
PropType prop,
const ValueType& value) {
if (!properties.has_value())
diff --git a/chrome/browser/ash/arc/accessibility/arc_accessibility_util.cc b/chrome/browser/ash/arc/accessibility/arc_accessibility_util.cc
index 76f49a8..9bc389f 100644
--- a/chrome/browser/ash/arc/accessibility/arc_accessibility_util.cc
+++ b/chrome/browser/ash/arc/accessibility/arc_accessibility_util.cc
@@ -6,9 +6,9 @@
#include "ash/public/cpp/app_types.h"
#include "base/containers/contains.h"
-#include "base/optional.h"
#include "chrome/browser/ash/arc/accessibility/accessibility_info_data_wrapper.h"
#include "components/arc/mojom/accessibility_helper.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/aura/window.h"
@@ -18,19 +18,19 @@
using AXEventIntProperty = mojom::AccessibilityEventIntProperty;
using AXNodeInfoData = mojom::AccessibilityNodeInfoData;
-base::Optional<ax::mojom::Event> FromContentChangeTypesToAXEvent(
+absl::optional<ax::mojom::Event> FromContentChangeTypesToAXEvent(
const std::vector<int32_t>& arc_content_change_types) {
if (base::Contains(
arc_content_change_types,
static_cast<int32_t>(mojom::ContentChangeType::STATE_DESCRIPTION))) {
return ax::mojom::Event::kAriaAttributeChanged;
}
- return base::nullopt;
+ return absl::nullopt;
}
ax::mojom::Event ToAXEvent(
mojom::AccessibilityEventType arc_event_type,
- const base::Optional<std::vector<int>>& arc_content_change_types,
+ const absl::optional<std::vector<int>>& arc_content_change_types,
AccessibilityInfoDataWrapper* source_node,
AccessibilityInfoDataWrapper* focused_node) {
switch (arc_event_type) {
@@ -46,7 +46,7 @@
return ax::mojom::Event::kTextSelectionChanged;
case mojom::AccessibilityEventType::WINDOW_STATE_CHANGED: {
if (source_node && arc_content_change_types.has_value()) {
- const base::Optional<ax::mojom::Event> event_or_null =
+ const absl::optional<ax::mojom::Event> event_or_null =
FromContentChangeTypesToAXEvent(arc_content_change_types.value());
if (event_or_null.has_value()) {
return event_or_null.value();
@@ -61,7 +61,7 @@
return ax::mojom::Event::kLayoutComplete;
case mojom::AccessibilityEventType::WINDOW_CONTENT_CHANGED:
if (source_node && arc_content_change_types.has_value()) {
- const base::Optional<ax::mojom::Event> event_or_null =
+ const absl::optional<ax::mojom::Event> event_or_null =
FromContentChangeTypesToAXEvent(arc_content_change_types.value());
if (event_or_null.has_value()) {
return event_or_null.value();
@@ -108,7 +108,7 @@
return ax::mojom::Event::kChildrenChanged;
}
-base::Optional<mojom::AccessibilityActionType> ConvertToAndroidAction(
+absl::optional<mojom::AccessibilityActionType> ConvertToAndroidAction(
ax::mojom::Action action) {
switch (action) {
case ax::mojom::Action::kDoDefault:
@@ -150,7 +150,7 @@
case ax::mojom::Action::kShowContextMenu:
return arc::mojom::AccessibilityActionType::LONG_CLICK;
default:
- return base::nullopt;
+ return absl::nullopt;
}
}
diff --git a/chrome/browser/ash/arc/accessibility/arc_accessibility_util.h b/chrome/browser/ash/arc/accessibility/arc_accessibility_util.h
index d8393e0..5aeb2f30 100644
--- a/chrome/browser/ash/arc/accessibility/arc_accessibility_util.h
+++ b/chrome/browser/ash/arc/accessibility/arc_accessibility_util.h
@@ -11,9 +11,9 @@
#include <vector>
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "components/arc/mojom/accessibility_helper.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_enum_util.h"
namespace aura {
@@ -26,16 +26,16 @@
// This function is only called when EventType is WINDOW_STATE_CHANGED or
// WINDOW_CONTENT_CHANGED.
-base::Optional<ax::mojom::Event> FromContentChangeTypesToAXEvent(
+absl::optional<ax::mojom::Event> FromContentChangeTypesToAXEvent(
const std::vector<int>& arc_content_change_types);
ax::mojom::Event ToAXEvent(
mojom::AccessibilityEventType arc_event_type,
- const base::Optional<std::vector<int>>& arc_content_change_types,
+ const absl::optional<std::vector<int>>& arc_content_change_types,
AccessibilityInfoDataWrapper* source_node,
AccessibilityInfoDataWrapper* focused_node);
-base::Optional<mojom::AccessibilityActionType> ConvertToAndroidAction(
+absl::optional<mojom::AccessibilityActionType> ConvertToAndroidAction(
ax::mojom::Action action);
AccessibilityInfoDataWrapper* GetSelectedNodeInfoFromAdapterViewEvent(
@@ -80,13 +80,13 @@
}
template <class PropType, class OutType>
-base::Optional<OutType> GetPropertyOrNull(
- const base::Optional<base::flat_map<PropType, OutType>>& properties,
+absl::optional<OutType> GetPropertyOrNull(
+ const absl::optional<base::flat_map<PropType, OutType>>& properties,
const PropType prop) {
OutType out_value;
if (GetProperty(properties, prop, &out_value))
return out_value;
- return base::nullopt;
+ return absl::nullopt;
}
template <class InfoDataType, class PropType>
diff --git a/chrome/browser/ash/arc/accessibility/arc_accessibility_util_unittest.cc b/chrome/browser/ash/arc/accessibility/arc_accessibility_util_unittest.cc
index cdda80ab..e7943c5 100644
--- a/chrome/browser/ash/arc/accessibility/arc_accessibility_util_unittest.cc
+++ b/chrome/browser/ash/arc/accessibility/arc_accessibility_util_unittest.cc
@@ -4,11 +4,11 @@
#include <memory>
-#include "base/optional.h"
#include "chrome/browser/ash/arc/accessibility/accessibility_node_info_data_wrapper.h"
#include "chrome/browser/ash/arc/accessibility/arc_accessibility_util.h"
#include "components/arc/mojom/accessibility_helper.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_enums.mojom.h"
namespace arc {
@@ -23,7 +23,7 @@
nullptr, node_info_data.get());
std::vector<int32_t> empty_list = {};
- EXPECT_EQ(base::nullopt, FromContentChangeTypesToAXEvent(empty_list));
+ EXPECT_EQ(absl::nullopt, FromContentChangeTypesToAXEvent(empty_list));
std::vector<int32_t> state_description = {
static_cast<int32_t>(mojom::ContentChangeType::STATE_DESCRIPTION)};
@@ -39,7 +39,7 @@
std::vector<int32_t> without_state_description = {
static_cast<int32_t>(mojom::ContentChangeType::TEXT)};
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
FromContentChangeTypesToAXEvent(without_state_description));
std::vector<int32_t> include_state_description = {
@@ -58,6 +58,6 @@
&source_node_info_wrapper, &source_node_info_wrapper));
std::vector<int32_t> not_enum_value = {111};
- EXPECT_EQ(base::nullopt, FromContentChangeTypesToAXEvent(not_enum_value));
+ EXPECT_EQ(absl::nullopt, FromContentChangeTypesToAXEvent(not_enum_value));
}
} // namespace arc
diff --git a/chrome/browser/ash/arc/accessibility/auto_complete_handler.h b/chrome/browser/ash/arc/accessibility/auto_complete_handler.h
index 4eecccd..9a283a9 100644
--- a/chrome/browser/ash/arc/accessibility/auto_complete_handler.h
+++ b/chrome/browser/ash/arc/accessibility/auto_complete_handler.h
@@ -9,8 +9,8 @@
#include <utility>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/ash/arc/accessibility/ax_tree_source_arc.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ui {
struct AXNodeData;
@@ -40,8 +40,8 @@
private:
const int32_t anchored_node_id_;
- base::Optional<int32_t> suggestion_window_id_;
- base::Optional<int32_t> selected_node_id_;
+ absl::optional<int32_t> suggestion_window_id_;
+ absl::optional<int32_t> selected_node_id_;
};
} // namespace arc
diff --git a/chrome/browser/ash/arc/accessibility/ax_tree_source_arc.cc b/chrome/browser/ash/arc/accessibility/ax_tree_source_arc.cc
index 7ed0381..f2f45521 100644
--- a/chrome/browser/ash/arc/accessibility/ax_tree_source_arc.cc
+++ b/chrome/browser/ash/arc/accessibility/ax_tree_source_arc.cc
@@ -63,7 +63,7 @@
void AXTreeSourceArc::NotifyGetTextLocationDataResult(
const ui::AXActionData& data,
- const base::Optional<gfx::Rect>& rect) {
+ const absl::optional<gfx::Rect>& rect) {
GetAutomationEventRouter()->DispatchGetTextLocationDataResult(data, rect);
}
diff --git a/chrome/browser/ash/arc/accessibility/ax_tree_source_arc.h b/chrome/browser/ash/arc/accessibility/ax_tree_source_arc.h
index 810e37a..c254096 100644
--- a/chrome/browser/ash/arc/accessibility/ax_tree_source_arc.h
+++ b/chrome/browser/ash/arc/accessibility/ax_tree_source_arc.h
@@ -76,7 +76,7 @@
// Notify automation of result to getTextLocation.
void NotifyGetTextLocationDataResult(const ui::AXActionData& data,
- const base::Optional<gfx::Rect>& rect);
+ const absl::optional<gfx::Rect>& rect);
// Invalidates the tree serializer.
void InvalidateTree();
@@ -112,7 +112,7 @@
bool is_input_method_window() { return is_input_method_window_; }
// The window id of this tree.
- base::Optional<int32_t> window_id() const { return window_id_; }
+ absl::optional<int32_t> window_id() const { return window_id_; }
private:
friend class arc::AXTreeSourceArcTest;
@@ -182,14 +182,14 @@
std::map<int32_t, int32_t> parent_map_;
std::unique_ptr<AXTreeArcSerializer> current_tree_serializer_;
- base::Optional<int32_t> root_id_;
- base::Optional<int32_t> window_id_;
- base::Optional<int32_t> android_focused_id_;
+ absl::optional<int32_t> root_id_;
+ absl::optional<int32_t> window_id_;
+ absl::optional<int32_t> android_focused_id_;
bool is_notification_;
bool is_input_method_window_;
- base::Optional<std::string> notification_key_;
+ absl::optional<std::string> notification_key_;
// Cache of mapping from the *Android* window id to the last focused node id.
std::map<int32_t, int32_t> window_id_to_last_focus_node_id_;
diff --git a/chrome/browser/ash/arc/accessibility/ax_tree_source_arc_unittest.cc b/chrome/browser/ash/arc/accessibility/ax_tree_source_arc_unittest.cc
index 86f330e..f940273 100644
--- a/chrome/browser/ash/arc/accessibility/ax_tree_source_arc_unittest.cc
+++ b/chrome/browser/ash/arc/accessibility/ax_tree_source_arc_unittest.cc
@@ -6,7 +6,6 @@
#include <utility>
-#include "base/optional.h"
#include "base/stl_util.h"
#include "chrome/browser/ash/arc/accessibility/accessibility_node_info_data_wrapper.h"
#include "chrome/browser/ash/arc/accessibility/accessibility_window_info_data_wrapper.h"
@@ -15,6 +14,7 @@
#include "components/arc/mojom/accessibility_helper.mojom.h"
#include "extensions/browser/api/automation_internal/automation_event_router.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_role_properties.h"
@@ -79,7 +79,7 @@
void DispatchGetTextLocationDataResult(
const ui::AXActionData& data,
- const base::Optional<gfx::Rect>& rect) override {}
+ const absl::optional<gfx::Rect>& rect) override {}
ax::mojom::Event last_event_type() const { return last_event_type_; }
diff --git a/chrome/browser/ash/arc/accessibility/drawer_layout_handler.cc b/chrome/browser/ash/arc/accessibility/drawer_layout_handler.cc
index e65afcf..fe6889d 100644
--- a/chrome/browser/ash/arc/accessibility/drawer_layout_handler.cc
+++ b/chrome/browser/ash/arc/accessibility/drawer_layout_handler.cc
@@ -37,19 +37,19 @@
namespace arc {
// static
-base::Optional<std::pair<int32_t, std::unique_ptr<DrawerLayoutHandler>>>
+absl::optional<std::pair<int32_t, std::unique_ptr<DrawerLayoutHandler>>>
DrawerLayoutHandler::CreateIfNecessary(
AXTreeSourceArc* tree_source,
const mojom::AccessibilityEventData& event_data) {
if (event_data.event_type !=
mojom::AccessibilityEventType::WINDOW_STATE_CHANGED) {
- return base::nullopt;
+ return absl::nullopt;
}
AccessibilityInfoDataWrapper* source_node =
tree_source->GetFromId(event_data.source_id);
if (!source_node || !IsDrawerLayout(source_node->GetNode()))
- return base::nullopt;
+ return absl::nullopt;
// Find a node with accessibility importance. That is a menu node opened now.
// Extract the accessibility name of the drawer menu from the event text.
@@ -67,7 +67,7 @@
event_data.event_text.value_or<std::vector<std::string>>({}),
" ")));
}
- return base::nullopt;
+ return absl::nullopt;
}
bool DrawerLayoutHandler::PreDispatchEvent(
diff --git a/chrome/browser/ash/arc/accessibility/drawer_layout_handler.h b/chrome/browser/ash/arc/accessibility/drawer_layout_handler.h
index 86abe5a..eb2944dc 100644
--- a/chrome/browser/ash/arc/accessibility/drawer_layout_handler.h
+++ b/chrome/browser/ash/arc/accessibility/drawer_layout_handler.h
@@ -9,8 +9,8 @@
#include <string>
#include <utility>
-#include "base/optional.h"
#include "chrome/browser/ash/arc/accessibility/ax_tree_source_arc.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ui {
struct AXNodeData;
@@ -24,7 +24,7 @@
class DrawerLayoutHandler : public AXTreeSourceArc::Hook {
public:
- static base::Optional<
+ static absl::optional<
std::pair<int32_t, std::unique_ptr<DrawerLayoutHandler>>>
CreateIfNecessary(AXTreeSourceArc* tree_source,
const mojom::AccessibilityEventData& event_data);
diff --git a/chrome/browser/ash/arc/adbd/arc_adbd_monitor_bridge.cc b/chrome/browser/ash/arc/adbd/arc_adbd_monitor_bridge.cc
index b82180a..26aee044 100644
--- a/chrome/browser/ash/arc/adbd/arc_adbd_monitor_bridge.cc
+++ b/chrome/browser/ash/arc/adbd/arc_adbd_monitor_bridge.cc
@@ -14,7 +14,6 @@
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/singleton.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
@@ -23,6 +22,7 @@
#include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "components/arc/arc_util.h"
#include "components/arc/session/arc_bridge_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace arc {
@@ -89,14 +89,14 @@
}
// Returns cid from vm info. Otherwise, return nullopt.
-base::Optional<int64_t> GetCid() {
+absl::optional<int64_t> GetCid() {
if (g_enable_adb_over_usb_for_testing)
return kCidInTesting;
const auto& vm_info = arc::ArcSessionManager::Get()->GetVmInfo();
if (!vm_info) {
LOG(ERROR) << "ARCVM is NOT ready";
- return base::nullopt;
+ return absl::nullopt;
}
return vm_info->cid();
}
@@ -107,16 +107,16 @@
return arc::ArcSessionManager::Get()->GetSerialNumber();
}
-base::Optional<std::vector<std::string>> CreateAndGetAdbdUpstartEnvironment() {
+absl::optional<std::vector<std::string>> CreateAndGetAdbdUpstartEnvironment() {
auto cid = GetCid();
if (!cid) {
LOG(ERROR) << "ARCVM cid is empty";
- return base::nullopt;
+ return absl::nullopt;
}
auto serial_number = GetSerialNumber();
if (serial_number.empty()) {
LOG(ERROR) << "Serial number is empty";
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<std::string> environment = {
diff --git a/chrome/browser/ash/arc/arc_demo_mode_delegate_impl_unittest.cc b/chrome/browser/ash/arc/arc_demo_mode_delegate_impl_unittest.cc
index 6596f37..ffc01b0 100644
--- a/chrome/browser/ash/arc/arc_demo_mode_delegate_impl_unittest.cc
+++ b/chrome/browser/ash/arc/arc_demo_mode_delegate_impl_unittest.cc
@@ -6,13 +6,13 @@
#include <memory>
-#include "base/optional.h"
#include "chrome/browser/ash/login/demo_mode/demo_mode_test_helper.h"
#include "chrome/browser/ash/login/demo_mode/demo_session.h"
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
#include "components/user_manager/scoped_user_manager.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace arc {
namespace {
diff --git a/chrome/browser/ash/arc/arc_migration_guide_notification.cc b/chrome/browser/ash/arc/arc_migration_guide_notification.cc
index 34036c5..13c5b45 100644
--- a/chrome/browser/ash/arc/arc_migration_guide_notification.cc
+++ b/chrome/browser/ash/arc/arc_migration_guide_notification.cc
@@ -9,7 +9,6 @@
#include "ash/public/cpp/notification_utils.h"
#include "base/bind.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ash/arc/arc_migration_constants.h"
#include "chrome/browser/ash/arc/arc_util.h"
#include "chrome/browser/lifetime/application_lifetime.h"
@@ -21,6 +20,7 @@
#include "chromeos/dbus/power/power_manager_client.h"
#include "chromeos/dbus/power_manager/power_supply_properties.pb.h"
#include "components/vector_icons/vector_icons.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/chromeos/devicetype_utils.h"
#include "ui/gfx/color_palette.h"
@@ -43,7 +43,7 @@
notifier_id.profile_id =
multi_user_util::GetAccountIdFromProfile(profile).GetUserEmail();
- base::Optional<power_manager::PowerSupplyProperties> power =
+ absl::optional<power_manager::PowerSupplyProperties> power =
chromeos::PowerManagerClient::Get()->GetLastStatus();
const bool is_low_battery =
power &&
diff --git a/chrome/browser/ash/arc/arc_optin_uma.cc b/chrome/browser/ash/arc/arc_optin_uma.cc
index 93f07a5..d281d88f 100644
--- a/chrome/browser/ash/arc/arc_optin_uma.cc
+++ b/chrome/browser/ash/arc/arc_optin_uma.cc
@@ -53,7 +53,7 @@
if (!IsRealUserProfile(profile) || profile->IsGuestSession())
return;
- base::Optional<bool> enabled_state;
+ absl::optional<bool> enabled_state;
if (auto* stability_metrics_manager = StabilityMetricsManager::Get())
enabled_state = stability_metrics_manager->GetArcEnabledState();
diff --git a/chrome/browser/ash/arc/arc_support_host.cc b/chrome/browser/ash/arc/arc_support_host.cc
index 423b9c8..82d4e8a 100644
--- a/chrome/browser/ash/arc/arc_support_host.cc
+++ b/chrome/browser/ash/arc/arc_support_host.cc
@@ -190,9 +190,9 @@
} // namespace
ArcSupportHost::ErrorInfo::ErrorInfo(Error error)
- : error(error), arg(base::nullopt) {}
+ : error(error), arg(absl::nullopt) {}
ArcSupportHost::ErrorInfo::ErrorInfo(Error error,
- const base::Optional<int>& arg)
+ const absl::optional<int>& arg)
: error(error), arg(arg) {}
ArcSupportHost::ErrorInfo::ErrorInfo(const ErrorInfo&) = default;
ArcSupportHost::ErrorInfo& ArcSupportHost::ErrorInfo::operator=(
diff --git a/chrome/browser/ash/arc/arc_support_host.h b/chrome/browser/ash/arc/arc_support_host.h
index 6ef1e0407..61c16888 100644
--- a/chrome/browser/ash/arc/arc_support_host.h
+++ b/chrome/browser/ash/arc/arc_support_host.h
@@ -62,7 +62,7 @@
// A struct to represent the error to display on the screen.
struct ErrorInfo {
explicit ErrorInfo(Error error);
- ErrorInfo(Error error, const base::Optional<int>& arg);
+ ErrorInfo(Error error, const absl::optional<int>& arg);
ErrorInfo(const ErrorInfo&);
ErrorInfo& operator=(const ErrorInfo&);
@@ -76,7 +76,7 @@
// For SIGN_IN_UNKNOWN_ERROR the arg should be specific provisioning result
// code. For SIGN_IN_CLOUD_PROVISION_FLOW_* errors the arg should be error
// code received from ARC.
- base::Optional<int> arg;
+ absl::optional<int> arg;
};
// Delegate to handle authentication related events. Currently used for Active
@@ -253,7 +253,7 @@
UIPage ui_page_ = UIPage::NO_PAGE;
// These have valid values iff ui_page_ == ERROR.
- base::Optional<ErrorInfo> error_info_;
+ absl::optional<ErrorInfo> error_info_;
bool should_show_send_feedback_;
bool is_arc_managed_ = false;
diff --git a/chrome/browser/ash/arc/auth/arc_active_directory_enrollment_token_fetcher.cc b/chrome/browser/ash/arc/auth/arc_active_directory_enrollment_token_fetcher.cc
index 7c203140..21290c7 100644
--- a/chrome/browser/ash/arc/auth/arc_active_directory_enrollment_token_fetcher.cc
+++ b/chrome/browser/ash/arc/auth/arc_active_directory_enrollment_token_fetcher.cc
@@ -97,7 +97,7 @@
policy::DeviceManagementService::JobConfiguration::
TYPE_ACTIVE_DIRECTORY_ENROLL_PLAY_USER,
GetClientId(), /*critical=*/false,
- policy::DMAuth::FromDMToken(dm_token_), /*oauth_token=*/base::nullopt,
+ policy::DMAuth::FromDMToken(dm_token_), /*oauth_token=*/absl::nullopt,
url_loader_factory_for_testing()
? url_loader_factory_for_testing()
: g_browser_process->system_network_context_manager()
diff --git a/chrome/browser/ash/arc/auth/arc_auth_code_fetcher.h b/chrome/browser/ash/arc/auth/arc_auth_code_fetcher.h
index b10524d..8bb97f8 100644
--- a/chrome/browser/ash/arc/auth/arc_auth_code_fetcher.h
+++ b/chrome/browser/ash/arc/auth/arc_auth_code_fetcher.h
@@ -23,7 +23,7 @@
// Fetch() should be called once per instance, and it is expected that
// the inflight operation is cancelled without calling the |callback|
// when the instance is deleted.
- // TODO(sinhak): Consider moving to |base::Optional<std::string>| for the
+ // TODO(sinhak): Consider moving to |absl::optional<std::string>| for the
// |auth_code| to avoid meaningless auth_code on error.
using FetchCallback =
base::OnceCallback<void(bool success, const std::string& auth_code)>;
diff --git a/chrome/browser/ash/arc/auth/arc_auth_service.cc b/chrome/browser/ash/arc/auth/arc_auth_service.cc
index 470869c..8b99374 100644
--- a/chrome/browser/ash/arc/auth/arc_auth_service.cc
+++ b/chrome/browser/ash/arc/auth/arc_auth_service.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/memory/singleton.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "chrome/browser/account_manager_facade_factory.h"
@@ -49,6 +48,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace arc {
@@ -110,7 +110,7 @@
account_info->enrollment_token = auth_info;
} else {
if (!is_enforced)
- account_info->auth_code = base::nullopt;
+ account_info->auth_code = absl::nullopt;
else
account_info->auth_code = auth_info;
}
@@ -143,7 +143,7 @@
if (user->IsDeviceLocalAccount())
return true;
- const base::Optional<AccountInfo> account_info =
+ const absl::optional<AccountInfo> account_info =
identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByEmailAddress(
account_name);
@@ -166,7 +166,7 @@
// since there are no accounts to be migrated in that case.
return;
}
- const base::Optional<ash::AccountMigrationRunner::MigrationResult>
+ const absl::optional<ash::AccountMigrationRunner::MigrationResult>
last_migration_run_result = migrator->GetLastMigrationRunResult();
if (!last_migration_run_result)
@@ -665,7 +665,7 @@
const std::string& account_name,
RequestAccountInfoCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
identity_manager_
->FindExtendedAccountInfoForAccountWithRefreshTokenByEmailAddress(
account_name);
@@ -722,7 +722,7 @@
return;
}
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
identity_manager_
->FindExtendedAccountInfoForAccountWithRefreshTokenByEmailAddress(
account_name);
@@ -779,7 +779,7 @@
ArcAuthService::CreateArcBackgroundAuthCodeFetcher(
const CoreAccountId& account_id,
bool initial_signin) {
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
identity_manager_
->FindExtendedAccountInfoForAccountWithRefreshTokenByAccountId(
account_id);
diff --git a/chrome/browser/ash/arc/auth/arc_auth_service.h b/chrome/browser/ash/arc/auth/arc_auth_service.h
index 7ccd3345..619a06e 100644
--- a/chrome/browser/ash/arc/auth/arc_auth_service.h
+++ b/chrome/browser/ash/arc/auth/arc_auth_service.h
@@ -13,13 +13,13 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ash/arc/auth/arc_active_directory_enrollment_token_fetcher.h"
#include "chrome/browser/ash/arc/session/arc_session_manager_observer.h"
#include "components/arc/mojom/auth.mojom.h"
#include "components/arc/session/connection_observer.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/signin/public/identity_manager/identity_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
diff --git a/chrome/browser/ash/arc/auth/arc_auth_service_browsertest.cc b/chrome/browser/ash/arc/auth/arc_auth_service_browsertest.cc
index cdaff504..1d25b49 100644
--- a/chrome/browser/ash/arc/auth/arc_auth_service_browsertest.cc
+++ b/chrome/browser/ash/arc/auth/arc_auth_service_browsertest.cc
@@ -12,7 +12,6 @@
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
@@ -71,6 +70,7 @@
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
@@ -768,7 +768,7 @@
signin::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(profile());
- base::Optional<AccountInfo> maybe_account_info =
+ absl::optional<AccountInfo> maybe_account_info =
identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByEmailAddress(
kSecondaryAccountEmail);
diff --git a/chrome/browser/ash/arc/auth/arc_robot_auth_code_fetcher.cc b/chrome/browser/ash/arc/auth/arc_robot_auth_code_fetcher.cc
index 59092d5f..c7e643b 100644
--- a/chrome/browser/ash/arc/auth/arc_robot_auth_code_fetcher.cc
+++ b/chrome/browser/ash/arc/auth/arc_robot_auth_code_fetcher.cc
@@ -66,7 +66,7 @@
TYPE_API_AUTH_CODE_FETCH,
client->client_id(), /*critical=*/false,
policy::DMAuth::FromDMToken(client->dm_token()),
- /*oauth_token=*/base::nullopt,
+ /*oauth_token=*/absl::nullopt,
url_loader_factory_for_testing()
? url_loader_factory_for_testing()
: g_browser_process->system_network_context_manager()
diff --git a/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc b/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc
index b652a9b..710d8d4 100644
--- a/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc
+++ b/chrome/browser/ash/arc/bluetooth/arc_bluetooth_bridge.cc
@@ -24,7 +24,6 @@
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/singleton.h"
-#include "base/optional.h"
#include "base/posix/eintr_wrapper.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
@@ -54,6 +53,7 @@
#include "device/bluetooth/bluez/bluetooth_remote_gatt_characteristic_bluez.h"
#include "mojo/public/cpp/platform/platform_handle.h"
#include "mojo/public/cpp/system/platform_handle.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using device::BluetoothAdapter;
using device::BluetoothAdapterFactory;
@@ -77,13 +77,13 @@
namespace {
-base::Optional<int> SdkVersion() {
+absl::optional<int> SdkVersion() {
constexpr char kVersionKey[] = "CHROMEOS_ARC_ANDROID_SDK_VERSION";
int sdk_version;
std::string sdk_str;
if (!base::SysInfo::GetLsbReleaseValue(kVersionKey, &sdk_str) ||
!base::StringToInt(sdk_str, &sdk_version))
- return base::nullopt;
+ return absl::nullopt;
return sdk_version;
}
@@ -249,12 +249,12 @@
// Example of identifier: /org/bluez/hci0/dev_E0_CF_65_8C_86_1A/service001a
// Convert the last 4 characters of |identifier| to an
// int, by interpreting them as hexadecimal digits.
-base::Optional<uint16_t> ConvertGattIdentifierToId(
+absl::optional<uint16_t> ConvertGattIdentifierToId(
const std::string identifier) {
uint32_t result;
if (identifier.size() < 4 ||
!base::HexStringToUInt(identifier.substr(identifier.size() - 4), &result))
- return base::nullopt;
+ return absl::nullopt;
return result;
}
@@ -264,7 +264,7 @@
arc::mojom::BluetoothGattDBElementPtr CreateGattDBElement(
const arc::mojom::BluetoothGattDBAttributeType type,
const RemoteGattAttribute* attribute) {
- base::Optional<int16_t> id =
+ absl::optional<int16_t> id =
ConvertGattIdentifierToId(attribute->GetIdentifier());
if (!id)
return nullptr;
@@ -307,7 +307,7 @@
// ReadGattDescriptor.
void OnGattRead(
GattReadCallback callback,
- base::Optional<device::BluetoothGattService::GattErrorCode> error_code,
+ absl::optional<device::BluetoothGattService::GattErrorCode> error_code,
const std::vector<uint8_t>& result) {
arc::mojom::BluetoothGattValuePtr gattValue =
arc::mojom::BluetoothGattValue::New();
@@ -328,7 +328,7 @@
arc::mojom::BluetoothGattStatus status,
const std::vector<uint8_t>& value) {
if (status == arc::mojom::BluetoothGattStatus::GATT_SUCCESS) {
- std::move(callback).Run(/*error_code=*/base::nullopt, value);
+ std::move(callback).Run(/*error_code=*/absl::nullopt, value);
} else {
std::move(callback).Run(BluetoothGattService::GATT_ERROR_FAILED,
/*value=*/std::vector<uint8_t>());
@@ -352,12 +352,12 @@
// This is needed because Android only support UUID 16 bits in service data
// section in advertising data
-base::Optional<uint16_t> GetUUID16(const BluetoothUUID& uuid) {
+absl::optional<uint16_t> GetUUID16(const BluetoothUUID& uuid) {
// Convert xxxxyyyy-xxxx-xxxx-xxxx-xxxxxxxxxxxx to int16 yyyy
uint32_t result;
if (uuid.canonical_value().size() < 8 ||
!base::HexStringToUInt(uuid.canonical_value().substr(4, 4), &result))
- return base::nullopt;
+ return absl::nullopt;
return result;
}
@@ -681,7 +681,7 @@
return;
constexpr int kAndroidPSdkVersion = 28;
- base::Optional<int> sdk_version = SdkVersion();
+ absl::optional<int> sdk_version = SdkVersion();
mojom::BluetoothAddressPtr addr =
mojom::BluetoothAddress::From(device->GetAddress());
if (!sdk_version)
@@ -835,13 +835,13 @@
if (!btle_instance)
return;
- const base::Optional<int16_t> char_inst_id =
+ const absl::optional<int16_t> char_inst_id =
ConvertGattIdentifierToId(characteristic->GetIdentifier());
if (!char_inst_id)
return;
BluetoothRemoteGattService* service = characteristic->GetService();
- const base::Optional<int16_t> service_inst_id =
+ const absl::optional<int16_t> service_inst_id =
ConvertGattIdentifierToId(service->GetIdentifier());
if (!service_inst_id)
return;
@@ -1616,12 +1616,12 @@
const auto& characteristics = service->GetCharacteristics();
if (characteristics.size() > 0) {
const auto& descriptors = characteristics.back()->GetDescriptors();
- const base::Optional<int16_t> start_handle =
+ const absl::optional<int16_t> start_handle =
ConvertGattIdentifierToId(characteristics.front()->GetIdentifier());
if (!start_handle)
continue;
- const base::Optional<int16_t> end_handle = ConvertGattIdentifierToId(
+ const absl::optional<int16_t> end_handle = ConvertGattIdentifierToId(
descriptors.size() > 0 ? descriptors.back()->GetIdentifier()
: characteristics.back()->GetIdentifier());
if (!end_handle)
@@ -2687,7 +2687,7 @@
}
if (type == mojom::BluetoothPropertyType::ALL ||
type == mojom::BluetoothPropertyType::REMOTE_RSSI) {
- base::Optional<int8_t> rssi = device->GetInquiryRSSI();
+ absl::optional<int8_t> rssi = device->GetInquiryRSSI();
if (rssi.has_value()) {
mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
btp->set_remote_rssi(rssi.value());
@@ -2845,7 +2845,7 @@
// Service Data
for (const BluetoothUUID& uuid : device->GetServiceDataUUIDs()) {
- base::Optional<uint16_t> uuid16 = GetUUID16(uuid);
+ absl::optional<uint16_t> uuid16 = GetUUID16(uuid);
if (!uuid16)
continue;
diff --git a/chrome/browser/ash/arc/cast_receiver/arc_cast_receiver_service_unittest.cc b/chrome/browser/ash/arc/cast_receiver/arc_cast_receiver_service_unittest.cc
index 1a72f0f..78c15ca 100644
--- a/chrome/browser/ash/arc/cast_receiver/arc_cast_receiver_service_unittest.cc
+++ b/chrome/browser/ash/arc/cast_receiver/arc_cast_receiver_service_unittest.cc
@@ -6,7 +6,6 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/ash/settings/scoped_cros_settings_test_helper.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
@@ -19,6 +18,7 @@
#include "components/session_manager/core/session_manager.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace arc {
namespace {
@@ -74,12 +74,12 @@
// Test that OnConnectionReady has already been called because of the
// SetInstance() call in SetUp().
TEST_F(ArcCastReceiverServiceTest, OnConnectionReady) {
- const base::Optional<bool>& last_enabled =
+ const absl::optional<bool>& last_enabled =
cast_receiver_instance()->last_enabled();
ASSERT_TRUE(last_enabled); // SetEnabled() has already been called.
EXPECT_FALSE(*last_enabled); // ..and it is called with false.
- const base::Optional<std::string>& last_name =
+ const absl::optional<std::string>& last_name =
cast_receiver_instance()->last_name();
EXPECT_FALSE(last_name); // SetName() hasn't been called yet.
}
@@ -88,7 +88,7 @@
TEST_F(ArcCastReceiverServiceTest, OnCastReceiverEnabledChanged) {
prefs()->SetBoolean(prefs::kCastReceiverEnabled, true);
- const base::Optional<bool>& last_enabled =
+ const absl::optional<bool>& last_enabled =
cast_receiver_instance()->last_enabled();
// Verify that the call was made with true.
ASSERT_TRUE(last_enabled);
@@ -99,7 +99,7 @@
TEST_F(ArcCastReceiverServiceTest, OnCastReceiverNameChanged) {
settings_helper()->SetString(chromeos::kCastReceiverName, "name");
- const base::Optional<std::string>& last_name =
+ const absl::optional<std::string>& last_name =
cast_receiver_instance()->last_name();
// Verify that the call was made with "name".
ASSERT_TRUE(last_name);
diff --git a/chrome/browser/ash/arc/enterprise/arc_force_installed_apps_tracker.cc b/chrome/browser/ash/arc/enterprise/arc_force_installed_apps_tracker.cc
index 2db8ef64..75edfd9b 100644
--- a/chrome/browser/ash/arc/enterprise/arc_force_installed_apps_tracker.cc
+++ b/chrome/browser/ash/arc/enterprise/arc_force_installed_apps_tracker.cc
@@ -283,7 +283,7 @@
void PolicyComplianceObserver::ProcessInitialComplianceReport(
std::string last_report) {
- base::Optional<base::Value> last_report_value =
+ absl::optional<base::Value> last_report_value =
base::JSONReader::Read(last_report);
if (!last_report_value.has_value())
return;
diff --git a/chrome/browser/ash/arc/enterprise/arc_snapshot_reboot_notification_impl.cc b/chrome/browser/ash/arc/enterprise/arc_snapshot_reboot_notification_impl.cc
index 75bea7c..e5cb97f 100644
--- a/chrome/browser/ash/arc/enterprise/arc_snapshot_reboot_notification_impl.cc
+++ b/chrome/browser/ash/arc/enterprise/arc_snapshot_reboot_notification_impl.cc
@@ -81,7 +81,7 @@
}
void ArcSnapshotRebootNotificationImpl::HandleClick(
- base::Optional<int> button_index) {
+ absl::optional<int> button_index) {
if (!button_index)
return;
DCHECK(button_index.value() == kRestartButtonId);
diff --git a/chrome/browser/ash/arc/enterprise/arc_snapshot_reboot_notification_impl.h b/chrome/browser/ash/arc/enterprise/arc_snapshot_reboot_notification_impl.h
index ed5825f..4fab65e 100644
--- a/chrome/browser/ash/arc/enterprise/arc_snapshot_reboot_notification_impl.h
+++ b/chrome/browser/ash/arc/enterprise/arc_snapshot_reboot_notification_impl.h
@@ -33,7 +33,7 @@
static int get_restart_button_id_for_testing();
private:
- void HandleClick(base::Optional<int> button_index);
+ void HandleClick(absl::optional<int> button_index);
base::RepeatingClosure user_consent_callback_;
bool shown_ = false;
diff --git a/chrome/browser/ash/arc/enterprise/arc_snapshot_reboot_notification_impl_unittest.cc b/chrome/browser/ash/arc/enterprise/arc_snapshot_reboot_notification_impl_unittest.cc
index 9f84d1dd..e9888479 100644
--- a/chrome/browser/ash/arc/enterprise/arc_snapshot_reboot_notification_impl_unittest.cc
+++ b/chrome/browser/ash/arc/enterprise/arc_snapshot_reboot_notification_impl_unittest.cc
@@ -45,7 +45,7 @@
tester_->SimulateClick(
NotificationHandler::Type::TRANSIENT,
ArcSnapshotRebootNotificationImpl::get_notification_id_for_testing(),
- base::nullopt, base::nullopt);
+ absl::nullopt, absl::nullopt);
}
void ClickOnRestartButton() {
@@ -53,7 +53,7 @@
NotificationHandler::Type::TRANSIENT,
ArcSnapshotRebootNotificationImpl::get_notification_id_for_testing(),
ArcSnapshotRebootNotificationImpl::get_restart_button_id_for_testing(),
- base::nullopt);
+ absl::nullopt);
}
void OnNotificationAdded() { is_notification_shown_ = true; }
diff --git a/chrome/browser/ash/arc/enterprise/cert_store/cert_store_service.cc b/chrome/browser/ash/arc/enterprise/cert_store/cert_store_service.cc
index 59830554..8c8897a7 100644
--- a/chrome/browser/ash/arc/enterprise/cert_store/cert_store_service.cc
+++ b/chrome/browser/ash/arc/enterprise/cert_store/cert_store_service.cc
@@ -15,7 +15,6 @@
#include "base/logging.h"
#include "base/memory/singleton.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ash/arc/enterprise/cert_store/arc_cert_installer_utils.h"
#include "chrome/browser/ash/arc/keymaster/arc_keymaster_bridge.h"
#include "chrome/browser/ash/arc/policy/arc_policy_bridge.h"
@@ -35,6 +34,7 @@
#include "content/public/browser/browser_context.h"
#include "crypto/rsa_private_key.h"
#include "net/cert/x509_util_nss.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace arc {
@@ -81,7 +81,7 @@
void CheckCorporateFlag(
IsCertificateAllowedCallback callback,
- base::Optional<bool> corporate_key,
+ absl::optional<bool> corporate_key,
chromeos::platform_keys::Status is_corporate_key_status) {
if (is_corporate_key_status != chromeos::platform_keys::Status::kSuccess) {
LOG(ERROR) << "Error checking whether key is corporate. Will not install "
@@ -97,7 +97,7 @@
IsCertificateAllowedCallback callback,
const std::string& public_key_spki_der,
content::BrowserContext* const context,
- base::Optional<bool> key_on_user_token,
+ absl::optional<bool> key_on_user_token,
chromeos::platform_keys::Status is_key_on_token_status) {
if (is_key_on_token_status != chromeos::platform_keys::Status::kSuccess) {
LOG(WARNING) << "Error while checking key location: "
@@ -233,7 +233,7 @@
UpdateCertificates();
}
-base::Optional<CertStoreService::KeyInfo>
+absl::optional<CertStoreService::KeyInfo>
CertStoreService::GetKeyInfoForDummySpki(const std::string& dummy_spki) {
return certificate_cache_.GetKeyInfoForDummySpki(dummy_spki);
}
@@ -428,12 +428,12 @@
}
}
-base::Optional<CertStoreService::KeyInfo>
+absl::optional<CertStoreService::KeyInfo>
CertStoreService::CertificateCache::GetKeyInfoForDummySpki(
const std::string& dummy_spki) {
if (key_info_by_dummy_spki_cache_.count(dummy_spki))
return key_info_by_dummy_spki_cache_[dummy_spki];
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace arc
diff --git a/chrome/browser/ash/arc/enterprise/cert_store/cert_store_service.h b/chrome/browser/ash/arc/enterprise/cert_store/cert_store_service.h
index 7d1b019e..cc6e9bf 100644
--- a/chrome/browser/ash/arc/enterprise/cert_store/cert_store_service.h
+++ b/chrome/browser/ash/arc/enterprise/cert_store/cert_store_service.h
@@ -13,7 +13,6 @@
#include "base/containers/queue.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ash/arc/enterprise/cert_store/arc_cert_installer.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -21,6 +20,7 @@
#include "net/cert/cert_database.h"
#include "net/cert/nss_cert_database.h"
#include "net/cert/scoped_nss_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace arc {
@@ -57,7 +57,7 @@
// Returns a real nickname and chaps id for a dummy SPKI |dummy_spki|.
// Returns nullopt if the key is unknown.
- base::Optional<KeyInfo> GetKeyInfoForDummySpki(const std::string& dummy_spki);
+ absl::optional<KeyInfo> GetKeyInfoForDummySpki(const std::string& dummy_spki);
std::vector<std::string> get_required_cert_names() const {
return certificate_cache_.get_required_cert_names();
@@ -84,7 +84,7 @@
void Update(const std::vector<CertDescription>& certificates);
void Update(std::map<std::string, std::string> dummy_spki_by_name);
- base::Optional<KeyInfo> GetKeyInfoForDummySpki(
+ absl::optional<KeyInfo> GetKeyInfoForDummySpki(
const std::string& dummy_spki);
bool need_policy_update() { return need_policy_update_; }
diff --git a/chrome/browser/ash/arc/fileapi/arc_documents_provider_root.cc b/chrome/browser/ash/arc/fileapi/arc_documents_provider_root.cc
index d2ea982..e275eccf 100644
--- a/chrome/browser/ash/arc/fileapi/arc_documents_provider_root.cc
+++ b/chrome/browser/ash/arc/fileapi/arc_documents_provider_root.cc
@@ -953,7 +953,7 @@
void ArcDocumentsProviderRoot::ReadDirectoryInternalWithChildDocuments(
const std::string& document_id,
- base::Optional<std::vector<mojom::DocumentPtr>> maybe_children) {
+ absl::optional<std::vector<mojom::DocumentPtr>> maybe_children) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto iter = pending_callbacks_map_.find(document_id);
diff --git a/chrome/browser/ash/arc/fileapi/arc_documents_provider_root.h b/chrome/browser/ash/arc/fileapi/arc_documents_provider_root.h
index e086279..4cb45aa 100644
--- a/chrome/browser/ash/arc/fileapi/arc_documents_provider_root.h
+++ b/chrome/browser/ash/arc/fileapi/arc_documents_provider_root.h
@@ -16,12 +16,12 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.h"
#include "components/arc/mojom/file_system.mojom-forward.h"
#include "storage/browser/file_system/async_file_util.h"
#include "storage/browser/file_system/watcher_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
@@ -378,7 +378,7 @@
ReadDirectoryInternalCallback callback);
void ReadDirectoryInternalWithChildDocuments(
const std::string& document_id,
- base::Optional<std::vector<mojom::DocumentPtr>> maybe_children);
+ absl::optional<std::vector<mojom::DocumentPtr>> maybe_children);
// Clears a directory cache.
void ClearDirectoryCache(const std::string& document_id);
diff --git a/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.cc b/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.cc
index f13f00a8..dcbc4ec 100644
--- a/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.cc
+++ b/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.cc
@@ -201,7 +201,7 @@
true /* fail_on_path_separators */,
&unescaped_file_name)) {
LOG(ERROR) << "Invalid URL: " << url << " " << url_decoded;
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
std::move(callback).Run(unescaped_file_name);
@@ -243,7 +243,7 @@
GURL url_decoded = DecodeFromChromeContentProviderUrl(GURL(url));
if (url_decoded.is_empty() || !IsUrlAllowed(url_decoded)) {
LOG(ERROR) << "Invalid URL: " << url << " " << url_decoded;
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
scoped_refptr<storage::FileSystemContext> context =
@@ -253,8 +253,8 @@
extensions::app_file_handler_util::GetMimeTypeForLocalPath(
profile_, file_system_url_and_handle.url.path(),
base::BindOnce([](const std::string& mime_type) {
- return mime_type.empty() ? base::nullopt
- : base::make_optional(mime_type);
+ return mime_type.empty() ? absl::nullopt
+ : absl::make_optional(mime_type);
}).Then(std::move(callback)));
}
@@ -278,7 +278,7 @@
GURL url_decoded = DecodeFromChromeContentProviderUrl(GURL(url));
if (url_decoded.is_empty() || !IsUrlAllowed(url_decoded)) {
LOG(ERROR) << "Invalid URL: " << url << " " << url_decoded;
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
@@ -360,7 +360,7 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (size < 0) {
LOG(ERROR) << "Failed to get file size " << url_decoded;
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
chromeos::DBusThreadManager::Get()
@@ -374,7 +374,7 @@
void ArcFileSystemBridge::OnGenerateVirtualFileId(
const GURL& url_decoded,
GenerateVirtualFileIdCallback callback,
- const base::Optional<std::string>& id) {
+ const absl::optional<std::string>& id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(id.has_value());
DCHECK_EQ(id_to_url_.count(id.value()), 0u);
@@ -385,7 +385,7 @@
void ArcFileSystemBridge::OpenFileById(const GURL& url_decoded,
OpenFileToReadCallback callback,
- const base::Optional<std::string>& id) {
+ const absl::optional<std::string>& id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!id.has_value()) {
LOG(ERROR) << "Missing ID";
diff --git a/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h b/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h
index 185197e4..27c0a8e 100644
--- a/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h
+++ b/chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h
@@ -114,7 +114,7 @@
GetLinuxVFSPathForPathOnFileSystemType);
using GenerateVirtualFileIdCallback =
- base::OnceCallback<void(const base::Optional<std::string>& id)>;
+ base::OnceCallback<void(const absl::optional<std::string>& id)>;
// Used to implement GetFileSize().
void GetFileSizeInternal(const GURL& url_decoded,
@@ -132,12 +132,12 @@
// Used to implement GetVirtualFileId().
void OnGenerateVirtualFileId(const GURL& url_decoded,
GenerateVirtualFileIdCallback callback,
- const base::Optional<std::string>& id);
+ const absl::optional<std::string>& id);
// Used to implement OpenFileToRead().
void OpenFileById(const GURL& url_decoded,
OpenFileToReadCallback callback,
- const base::Optional<std::string>& id);
+ const absl::optional<std::string>& id);
// Used to implement OpenFileToRead().
void OnOpenFileById(const GURL& url_decoded,
diff --git a/chrome/browser/ash/arc/fileapi/arc_file_system_bridge_unittest.cc b/chrome/browser/ash/arc/fileapi/arc_file_system_bridge_unittest.cc
index 5107c69..778aeb7 100644
--- a/chrome/browser/ash/arc/fileapi/arc_file_system_bridge_unittest.cc
+++ b/chrome/browser/ash/arc/fileapi/arc_file_system_bridge_unittest.cc
@@ -102,7 +102,7 @@
EncodeToChromeContentProviderUrl(GURL(kTestUrl)).spec(),
base::BindOnce(
[](base::RunLoop* run_loop,
- const base::Optional<std::string>& result) {
+ const absl::optional<std::string>& result) {
run_loop->Quit();
ASSERT_TRUE(result.has_value());
EXPECT_EQ("hello.txt", result.value());
@@ -123,7 +123,7 @@
EncodeToChromeContentProviderUrl(url).spec(),
base::BindOnce(
[](base::RunLoop* run_loop, const std::string& expected,
- const base::Optional<std::string>& result) {
+ const absl::optional<std::string>& result) {
run_loop->Quit();
ASSERT_TRUE(result.has_value());
EXPECT_EQ(expected, result.value());
@@ -142,7 +142,7 @@
EncodeToChromeContentProviderUrl(url).spec(),
base::BindOnce(
[](base::RunLoop* run_loop,
- const base::Optional<std::string>& result) {
+ const absl::optional<std::string>& result) {
run_loop->Quit();
ASSERT_TRUE(result.has_value());
EXPECT_EQ("\xF0\x9F\x94\x92", result.value());
@@ -160,7 +160,7 @@
EncodeToChromeContentProviderUrl(url).spec(),
base::BindOnce(
[](base::RunLoop* run_loop,
- const base::Optional<std::string>& result) {
+ const absl::optional<std::string>& result) {
run_loop->Quit();
ASSERT_FALSE(result.has_value());
},
@@ -187,7 +187,7 @@
EncodeToChromeContentProviderUrl(GURL(kTestUrl)).spec(),
base::BindOnce(
[](base::RunLoop* run_loop,
- const base::Optional<std::string>& result) {
+ const absl::optional<std::string>& result) {
ASSERT_TRUE(result.has_value());
EXPECT_EQ(kTestFileType, result.value());
run_loop->Quit();
@@ -210,8 +210,8 @@
EncodeToChromeContentProviderUrl(GURL(kTestUrl)).spec(),
base::BindOnce(
[](base::RunLoop* run_loop, const char* kId,
- const base::Optional<std::string>& id) {
- ASSERT_NE(base::nullopt, id);
+ const absl::optional<std::string>& id) {
+ ASSERT_NE(absl::nullopt, id);
EXPECT_EQ(kId, id.value());
run_loop->Quit();
},
diff --git a/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.cc b/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.cc
index cb8cd47..bc76dade 100644
--- a/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.cc
+++ b/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner.cc
@@ -10,7 +10,6 @@
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
-#include "base/optional.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/ash/arc/arc_util.h"
#include "chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h"
@@ -19,6 +18,7 @@
#include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "components/arc/session/arc_bridge_service.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
using content::BrowserThread;
@@ -149,7 +149,7 @@
arc_bridge_service_->file_system(), GetMimeType);
if (!file_system_instance) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
return;
}
file_system_instance->GetMimeType(url.spec(), std::move(callback));
@@ -254,7 +254,7 @@
arc_bridge_service_->file_system(), GetChildDocuments);
if (!file_system_instance) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
return;
}
file_system_instance->GetChildDocuments(authority, parent_document_id,
@@ -277,7 +277,7 @@
arc_bridge_service_->file_system(), GetRecentDocuments);
if (!file_system_instance) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
return;
}
file_system_instance->GetRecentDocuments(authority, root_id,
@@ -296,7 +296,7 @@
ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service_->file_system(), GetRoots);
if (!file_system_instance) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
return;
}
file_system_instance->GetRoots(std::move(callback));
diff --git a/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner_unittest.cc b/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner_unittest.cc
index 987b714..bac5675 100644
--- a/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner_unittest.cc
+++ b/chrome/browser/ash/arc/fileapi/arc_file_system_operation_runner_unittest.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "chrome/test/base/testing_profile.h"
#include "components/arc/arc_service_manager.h"
@@ -21,6 +20,7 @@
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace arc {
@@ -79,7 +79,7 @@
kAuthority, kDocumentId,
base::BindOnce(
[](int* counter,
- base::Optional<std::vector<mojom::DocumentPtr>> documents) {
+ absl::optional<std::vector<mojom::DocumentPtr>> documents) {
++*counter;
},
counter));
@@ -95,7 +95,7 @@
runner_->GetMimeType(
GURL(kUrl),
base::BindOnce(
- [](int* counter, const base::Optional<std::string>& mime_type) {
+ [](int* counter, const absl::optional<std::string>& mime_type) {
++*counter;
},
counter));
@@ -103,12 +103,12 @@
kAuthority, kDocumentId,
base::BindOnce(
[](int* counter,
- base::Optional<std::vector<mojom::DocumentPtr>> documents) {
+ absl::optional<std::vector<mojom::DocumentPtr>> documents) {
++*counter;
},
counter));
runner_->GetRoots(base::BindOnce(
- [](int* counter, base::Optional<std::vector<mojom::RootPtr>> roots) {
+ [](int* counter, absl::optional<std::vector<mojom::RootPtr>> roots) {
++*counter;
},
counter));
diff --git a/chrome/browser/ash/arc/fileapi/file_stream_forwarder_unittest.cc b/chrome/browser/ash/arc/fileapi/file_stream_forwarder_unittest.cc
index ed85c0b..24ef8320 100644
--- a/chrome/browser/ash/arc/fileapi/file_stream_forwarder_unittest.cc
+++ b/chrome/browser/ash/arc/fileapi/file_stream_forwarder_unittest.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "base/rand_util.h"
#include "base/run_loop.h"
#include "content/public/test/browser_task_environment.h"
@@ -18,6 +17,7 @@
#include "storage/browser/test/async_file_test_helper.h"
#include "storage/browser/test/test_file_system_context.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
diff --git a/chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_service_unittest.cc b/chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_service_unittest.cc
index 15cf581..10e96fca 100644
--- a/chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_service_unittest.cc
+++ b/chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_service_unittest.cc
@@ -75,7 +75,7 @@
bool InTabletMode() const override { return in_tablet_mode; }
- bool ForceUiTabletModeState(base::Optional<bool> enabled) override {
+ bool ForceUiTabletModeState(absl::optional<bool> enabled) override {
return false;
}
diff --git a/chrome/browser/ash/arc/input_method_manager/input_connection_impl.cc b/chrome/browser/ash/arc/input_method_manager/input_connection_impl.cc
index c34c55b..d16c44b 100644
--- a/chrome/browser/ash/arc/input_method_manager/input_connection_impl.cc
+++ b/chrome/browser/ash/arc/input_method_manager/input_connection_impl.cc
@@ -100,7 +100,7 @@
ui::TextInputClient* client = GetTextInputClient();
gfx::Range text_range = gfx::Range();
gfx::Range selection_range = gfx::Range();
- base::Optional<gfx::Range> composition_text_range = gfx::Range();
+ absl::optional<gfx::Range> composition_text_range = gfx::Range();
std::u16string text;
if (!client) {
@@ -200,7 +200,7 @@
void InputConnectionImpl::SetComposingText(
const std::u16string& text,
int new_cursor_pos,
- const base::Optional<gfx::Range>& new_selection_range) {
+ const absl::optional<gfx::Range>& new_selection_range) {
// It's relative to the last character of the composing text,
// so 0 means the cursor should be just before the last character of the text.
new_cursor_pos += text.length() - 1;
diff --git a/chrome/browser/ash/arc/input_method_manager/input_connection_impl.h b/chrome/browser/ash/arc/input_method_manager/input_connection_impl.h
index 671747bf..a286294 100644
--- a/chrome/browser/ash/arc/input_method_manager/input_connection_impl.h
+++ b/chrome/browser/ash/arc/input_method_manager/input_connection_impl.h
@@ -10,13 +10,13 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/timer/timer.h"
#include "chrome/browser/ash/arc/input_method_manager/arc_input_method_manager_bridge.h"
#include "chrome/browser/chromeos/input_method/input_method_engine.h"
#include "components/arc/mojom/input_method_manager.mojom-forward.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace arc {
@@ -44,7 +44,7 @@
void SetComposingText(
const std::u16string& text,
int new_cursor_pos,
- const base::Optional<gfx::Range>& new_selection_range) override;
+ const absl::optional<gfx::Range>& new_selection_range) override;
void RequestTextInputState(
mojom::InputConnection::RequestTextInputStateCallback callback) override;
void SetSelection(const gfx::Range& new_selection_range) override;
diff --git a/chrome/browser/ash/arc/input_method_manager/input_connection_impl_unittest.cc b/chrome/browser/ash/arc/input_method_manager/input_connection_impl_unittest.cc
index c3e5ce3..fc73483 100644
--- a/chrome/browser/ash/arc/input_method_manager/input_connection_impl_unittest.cc
+++ b/chrome/browser/ash/arc/input_method_manager/input_connection_impl_unittest.cc
@@ -270,7 +270,7 @@
// If there is composing text, FinishComposingText() calls CommitText() with
// the text.
context_handler()->Reset();
- connection->SetComposingText(u"composing", 0, base::nullopt);
+ connection->SetComposingText(u"composing", 0, absl::nullopt);
client()->SetText("composing");
client()->SetCompositionRange(gfx::Range(0, 9));
EXPECT_EQ(0, context_handler()->commit_text_call_count());
@@ -291,7 +291,7 @@
engine()->FocusIn(context());
context_handler()->Reset();
- connection->SetComposingText(text, 0, base::nullopt);
+ connection->SetComposingText(text, 0, absl::nullopt);
EXPECT_EQ(1, context_handler()->update_preedit_text_call_count());
EXPECT_EQ(
text,
@@ -314,7 +314,7 @@
// Selection range
context_handler()->Reset();
- connection->SetComposingText(text, 0, base::make_optional<gfx::Range>(1, 3));
+ connection->SetComposingText(text, 0, absl::make_optional<gfx::Range>(1, 3));
EXPECT_EQ(1u, context_handler()
->last_update_composition_arg()
.composition_text.selection.start());
@@ -410,7 +410,7 @@
connection->CommitText(u"text", 1);
connection->DeleteSurroundingText(1, 1);
connection->FinishComposingText();
- connection->SetComposingText(u"text", 0, base::nullopt);
+ connection->SetComposingText(u"text", 0, absl::nullopt);
connection->SetSelection(gfx::Range(2, 4));
connection->GetTextInputState(true);
}
diff --git a/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog.cc b/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog.cc
index 84941ff..cba68815 100644
--- a/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog.cc
+++ b/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog.cc
@@ -98,7 +98,7 @@
// is at least one app or device to choose from.
bool MaybeAddDevicesAndShowPicker(
const GURL& url,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
WebContents* web_contents,
std::vector<apps::IntentPickerAppInfo> app_info,
bool stay_in_chrome,
@@ -596,7 +596,7 @@
int render_process_host_id,
int routing_id,
const GURL& url,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
bool safe_to_bypass_ui,
std::vector<mojom::IntentHandlerInfoPtr> handlers,
base::OnceCallback<void(bool)> handled_cb,
@@ -639,7 +639,7 @@
int render_process_host_id,
int routing_id,
const GURL& url,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
base::OnceCallback<void(bool)> handled_cb) {
// Try to show the device picker and fallback to the default dialog otherwise.
bool handled = MaybeAddDevicesAndShowPicker(
@@ -658,7 +658,7 @@
void OnUrlHandlerList(int render_process_host_id,
int routing_id,
const GURL& url,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
bool safe_to_bypass_ui,
base::OnceCallback<void(bool)> handled_cb,
std::vector<mojom::IntentHandlerInfoPtr> handlers) {
@@ -726,7 +726,7 @@
void RunArcExternalProtocolDialog(
const GURL& url,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
int render_process_host_id,
int routing_id,
ui::PageTransition page_transition,
diff --git a/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog.h b/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog.h
index 1ab4edd..326014a 100644
--- a/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog.h
+++ b/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog.h
@@ -10,10 +10,10 @@
#include <utility>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/apps/intent_helper/apps_navigation_types.h"
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include "components/arc/mojom/intent_helper.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
#include "url/origin.h"
@@ -129,7 +129,7 @@
// true if the protocol has been handled by ARC.
void RunArcExternalProtocolDialog(
const GURL& url,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
int render_process_host_id,
int routing_id,
ui::PageTransition page_transition,
diff --git a/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog_unittest.cc b/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog_unittest.cc
index 73437cd..4181b3b2 100644
--- a/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog_unittest.cc
+++ b/chrome/browser/ash/arc/intent_helper/arc_external_protocol_dialog_unittest.cc
@@ -1047,7 +1047,7 @@
bool handled = false;
arc::RunArcExternalProtocolDialog(
- GURL("tel:12341234"), /*initiating_origin=*/base::nullopt,
+ GURL("tel:12341234"), /*initiating_origin=*/absl::nullopt,
rvh->GetProcess()->GetID(), rvh->GetRoutingID(), ui::PAGE_TRANSITION_LINK,
/*has_user_gesture=*/true,
base::BindOnce([](bool* handled, bool result) { *handled = result; },
diff --git a/chrome/browser/ash/arc/notification/arc_boot_error_notification.cc b/chrome/browser/ash/arc/notification/arc_boot_error_notification.cc
index a09b1967..bd781f1 100644
--- a/chrome/browser/ash/arc/notification/arc_boot_error_notification.cc
+++ b/chrome/browser/ash/arc/notification/arc_boot_error_notification.cc
@@ -75,7 +75,7 @@
GURL(), notifier_id, optional_fields,
base::MakeRefCounted<message_center::HandleNotificationClickDelegate>(
base::BindRepeating(
- [](Profile* profile, base::Optional<int> button_index) {
+ [](Profile* profile, absl::optional<int> button_index) {
if (button_index) {
DCHECK_EQ(0, *button_index);
chrome::SettingsWindowManager::GetInstance()
diff --git a/chrome/browser/ash/arc/policy/arc_policy_bridge.cc b/chrome/browser/ash/arc/policy/arc_policy_bridge.cc
index 15d5911..28d2b8c18 100644
--- a/chrome/browser/ash/arc/policy/arc_policy_bridge.cc
+++ b/chrome/browser/ash/arc/policy/arc_policy_bridge.cc
@@ -14,7 +14,6 @@
#include "base/logging.h"
#include "base/memory/singleton.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/values.h"
@@ -39,6 +38,7 @@
#include "components/prefs/pref_service.h"
#include "components/user_manager/user.h"
#include "crypto/sha2.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace arc {
@@ -272,7 +272,7 @@
const base::Value* const app_policy_value =
policy_map.GetValue(policy::key::kArcPolicy);
if (app_policy_value) {
- base::Optional<base::Value> app_policy_dict;
+ absl::optional<base::Value> app_policy_dict;
if (app_policy_value->is_string()) {
app_policy_dict = base::JSONReader::Read(
app_policy_value->GetString(),
diff --git a/chrome/browser/ash/arc/policy/arc_policy_util.cc b/chrome/browser/ash/arc/policy/arc_policy_util.cc
index 37fba2c..293015a 100644
--- a/chrome/browser/ash/arc/policy/arc_policy_util.cc
+++ b/chrome/browser/ash/arc/policy/arc_policy_util.cc
@@ -44,7 +44,7 @@
std::set<std::string> GetRequestedPackagesFromArcPolicy(
const std::string& arc_policy) {
- base::Optional<base::Value> dict = base::JSONReader::Read(
+ absl::optional<base::Value> dict = base::JSONReader::Read(
arc_policy, base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS);
if (!dict.has_value() || !dict.value().is_dict())
return {};
diff --git a/chrome/browser/ash/arc/policy/arc_policy_util.h b/chrome/browser/ash/arc/policy/arc_policy_util.h
index 53d8fbc..9663b4a 100644
--- a/chrome/browser/ash/arc/policy/arc_policy_util.h
+++ b/chrome/browser/ash/arc/policy/arc_policy_util.h
@@ -10,7 +10,7 @@
#include <set>
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
diff --git a/chrome/browser/ash/arc/print_spooler/print_session_impl.cc b/chrome/browser/ash/arc/print_spooler/print_session_impl.cc
index 568ca2f..8516ac8 100644
--- a/chrome/browser/ash/arc/print_spooler/print_session_impl.cc
+++ b/chrome/browser/ash/arc/print_spooler/print_session_impl.cc
@@ -16,7 +16,6 @@
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
@@ -36,6 +35,7 @@
#include "printing/print_settings.h"
#include "printing/print_settings_conversion.h"
#include "printing/units.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/aura/window.h"
#include "ui/gfx/geometry/size.h"
@@ -47,7 +47,7 @@
// Converts a color mode to its Mojo type.
mojom::PrintColorMode ToArcColorMode(int color_mode) {
- base::Optional<bool> is_color = printing::IsColorModelSelected(
+ absl::optional<bool> is_color = printing::IsColorModelSelected(
printing::ColorModeToColorModel(color_mode));
return is_color.value() ? mojom::PrintColorMode::COLOR
: mojom::PrintColorMode::MONOCHROME;
@@ -81,14 +81,14 @@
if (vendor_id && !vendor_id->empty()) {
id = *vendor_id;
}
- base::Optional<int> width_microns =
+ absl::optional<int> width_microns =
media_size_value->FindIntKey(printing::kSettingMediaSizeWidthMicrons);
- base::Optional<int> height_microns =
+ absl::optional<int> height_microns =
media_size_value->FindIntKey(printing::kSettingMediaSizeHeightMicrons);
if (!width_microns.has_value() || !height_microns.has_value())
return nullptr;
// Swap the width and height if layout is landscape.
- base::Optional<bool> landscape =
+ absl::optional<bool> landscape =
job_settings.FindBoolKey(printing::kSettingLandscape);
if (!landscape.has_value())
return nullptr;
@@ -116,13 +116,13 @@
mojom::PrintMarginsPtr margins = mojom::PrintMargins::New(0, 0, 0, 0);
// PrintColorMode:
- base::Optional<int> color = job_settings.FindIntKey(printing::kSettingColor);
+ absl::optional<int> color = job_settings.FindIntKey(printing::kSettingColor);
if (!color.has_value())
return nullptr;
mojom::PrintColorMode color_mode = ToArcColorMode(color.value());
// PrintDuplexMode:
- base::Optional<int> duplex =
+ absl::optional<int> duplex =
job_settings.FindIntKey(printing::kSettingDuplexMode);
if (!duplex.has_value())
return nullptr;
diff --git a/chrome/browser/ash/arc/process/arc_process_service.cc b/chrome/browser/ash/arc/process/arc_process_service.cc
index f640c42..b56c5ae5 100644
--- a/chrome/browser/ash/arc/process/arc_process_service.cc
+++ b/chrome/browser/ash/arc/process/arc_process_service.cc
@@ -477,14 +477,14 @@
// but the user has not opted into ARC. This redundant check avoids that
// logspam.
if (!connection_ready_) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
mojom::ProcessInstance* process_instance = ARC_GET_INSTANCE_FOR_METHOD(
arc_bridge_service_->process(), RequestProcessList);
if (!process_instance) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
diff --git a/chrome/browser/ash/arc/process/arc_process_service.h b/chrome/browser/ash/arc/process/arc_process_service.h
index cacde00..c5901aa4 100644
--- a/chrome/browser/ash/arc/process/arc_process_service.h
+++ b/chrome/browser/ash/arc/process/arc_process_service.h
@@ -14,7 +14,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/process/process_iterator.h"
#include "base/sequenced_task_runner.h"
#include "chrome/browser/ash/arc/process/arc_process.h"
@@ -24,6 +23,7 @@
#include "components/keyed_service/core/keyed_service.h"
#include "services/resource_coordinator/public/cpp/memory_instrumentation/global_memory_dump.h"
#include "services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class BrowserContext;
@@ -37,10 +37,10 @@
//
// Call RequestAppProcessList() / RequestSystemProcessList() on the main UI
// thread to get a list of all ARC app / system processes. It returns
-// base::Optional<vector<arc::ArcProcess>>, which includes pid <-> nspid
+// absl::optional<vector<arc::ArcProcess>>, which includes pid <-> nspid
// mapping. Example:
// void OnUpdateProcessList(
-// base::Optional<vector<arc::ArcProcess>> processes) {
+// absl::optional<vector<arc::ArcProcess>> processes) {
// if (!processes) {
// // Arc process service is not ready.
// return;
@@ -72,7 +72,7 @@
static ArcProcessService* GetForBrowserContext(
content::BrowserContext* context);
- using OptionalArcProcessList = base::Optional<std::vector<ArcProcess>>;
+ using OptionalArcProcessList = absl::optional<std::vector<ArcProcess>>;
using RequestProcessListCallback =
base::OnceCallback<void(OptionalArcProcessList)>;
using RequestMemoryInfoCallback =
@@ -95,7 +95,7 @@
// If ARC IPC is ready for the process list request, the result is returned
// as the argument of |callback|. Otherwise, |callback| is called with
- // base::nullopt.
+ // absl::nullopt.
// The process list maybe stale of up to |kProcessSnapshotRefreshTime|.
void RequestAppProcessList(RequestProcessListCallback callback);
void RequestSystemProcessList(RequestProcessListCallback callback);
diff --git a/chrome/browser/ash/arc/session/arc_provisioning_result.cc b/chrome/browser/ash/arc/session/arc_provisioning_result.cc
index 8dd32e3..98032cf2 100644
--- a/chrome/browser/ash/arc/session/arc_provisioning_result.cc
+++ b/chrome/browser/ash/arc/session/arc_provisioning_result.cc
@@ -19,26 +19,26 @@
default;
ArcProvisioningResult::~ArcProvisioningResult() = default;
-base::Optional<mojom::GMSSignInError> ArcProvisioningResult::gms_sign_in_error()
+absl::optional<mojom::GMSSignInError> ArcProvisioningResult::gms_sign_in_error()
const {
if (!sign_in_error() || !sign_in_error()->is_sign_in_error())
- return base::nullopt;
+ return absl::nullopt;
return sign_in_error()->get_sign_in_error();
}
-base::Optional<mojom::GMSCheckInError>
+absl::optional<mojom::GMSCheckInError>
ArcProvisioningResult::gms_check_in_error() const {
if (!sign_in_error() || !sign_in_error()->is_check_in_error())
- return base::nullopt;
+ return absl::nullopt;
return sign_in_error()->get_check_in_error();
}
-base::Optional<mojom::CloudProvisionFlowError>
+absl::optional<mojom::CloudProvisionFlowError>
ArcProvisioningResult::cloud_provision_flow_error() const {
if (!sign_in_error() || !sign_in_error()->is_cloud_provision_flow_error())
- return base::nullopt;
+ return absl::nullopt;
return sign_in_error()->get_cloud_provision_flow_error();
}
@@ -50,10 +50,10 @@
return sign_in_result()->get_error().get();
}
-base::Optional<mojom::GeneralSignInError> ArcProvisioningResult::general_error()
+absl::optional<mojom::GeneralSignInError> ArcProvisioningResult::general_error()
const {
if (!sign_in_error() || !sign_in_error()->is_general_error())
- return base::nullopt;
+ return absl::nullopt;
return sign_in_error()->get_general_error();
}
@@ -62,9 +62,9 @@
return sign_in_result() && sign_in_result()->is_success();
}
-base::Optional<ArcStopReason> ArcProvisioningResult::stop_reason() const {
+absl::optional<ArcStopReason> ArcProvisioningResult::stop_reason() const {
if (!absl::holds_alternative<ArcStopReason>(result_))
- return base::nullopt;
+ return absl::nullopt;
return absl::get<ArcStopReason>(result_);
}
diff --git a/chrome/browser/ash/arc/session/arc_provisioning_result.h b/chrome/browser/ash/arc/session/arc_provisioning_result.h
index 0e82a285..0203cfc 100644
--- a/chrome/browser/ash/arc/session/arc_provisioning_result.h
+++ b/chrome/browser/ash/arc/session/arc_provisioning_result.h
@@ -7,9 +7,9 @@
#include <ostream>
-#include "base/optional.h"
#include "components/arc/mojom/auth.mojom.h"
#include "components/arc/session/arc_stop_reason.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
enum class ProvisioningStatus;
@@ -29,26 +29,26 @@
~ArcProvisioningResult();
// Returns gms sign-in error if sign-in result has it.
- base::Optional<mojom::GMSSignInError> gms_sign_in_error() const;
+ absl::optional<mojom::GMSSignInError> gms_sign_in_error() const;
// Returns gms check-in error if sign-in result has it.
- base::Optional<mojom::GMSCheckInError> gms_check_in_error() const;
+ absl::optional<mojom::GMSCheckInError> gms_check_in_error() const;
// Returns cloud provision flow error if sign-in result has it.
- base::Optional<mojom::CloudProvisionFlowError> cloud_provision_flow_error()
+ absl::optional<mojom::CloudProvisionFlowError> cloud_provision_flow_error()
const;
// Returns the error of signin_result coming from ARC.
const mojom::ArcSignInError* sign_in_error() const;
// Returns general sign-in error if result has it.
- base::Optional<mojom::GeneralSignInError> general_error() const;
+ absl::optional<mojom::GeneralSignInError> general_error() const;
// Returns true if provisioning was successful.
bool is_success() const;
// Returns the reason for ARC stopped event if it exists.
- base::Optional<ArcStopReason> stop_reason() const;
+ absl::optional<ArcStopReason> stop_reason() const;
// Returns true if ARC provisioning timed out in Chrome.
bool is_timedout() const;
diff --git a/chrome/browser/ash/arc/session/arc_session_manager.cc b/chrome/browser/ash/arc/session/arc_session_manager.cc
index d189303..63dd374 100644
--- a/chrome/browser/ash/arc/session/arc_session_manager.cc
+++ b/chrome/browser/ash/arc/session/arc_session_manager.cc
@@ -86,7 +86,7 @@
// tests, even when the tests are set to skip creating UI.
bool g_enable_arc_terms_of_service_oobe_negotiator_in_tests = false;
-base::Optional<bool> g_enable_check_android_management_in_tests;
+absl::optional<bool> g_enable_check_android_management_in_tests;
constexpr const char kArcSaltPath[] = "/var/lib/misc/arc_salt";
constexpr const size_t kArcSaltFileSize = 16;
@@ -718,7 +718,7 @@
RequestArcDataRemoval();
}
- base::Optional<int> error_code;
+ absl::optional<int> error_code;
ArcSupportHost::Error support_error = GetSupportHostError(result);
if (support_error == ArcSupportHost::Error::SIGN_IN_UNKNOWN_ERROR) {
error_code = static_cast<std::underlying_type_t<ProvisioningStatus>>(
@@ -985,10 +985,10 @@
const vm_tools::concierge::VmStoppedSignal& vm_signal) {
// When an ARCVM stops, clear the stored vm info.
if (vm_signal.name() == kArcVmName)
- vm_info_ = base::nullopt;
+ vm_info_ = absl::nullopt;
}
-const base::Optional<vm_tools::concierge::VmInfo>&
+const absl::optional<vm_tools::concierge::VmInfo>&
ArcSessionManager::GetVmInfo() const {
return vm_info_;
}
@@ -1450,7 +1450,7 @@
weak_ptr_factory_.GetWeakPtr()));
}
-void ArcSessionManager::OnArcDataRemoved(base::Optional<bool> result) {
+void ArcSessionManager::OnArcDataRemoved(absl::optional<bool> result) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_EQ(state_, State::REMOVING_DATA_DIR);
DCHECK(profile_);
diff --git a/chrome/browser/ash/arc/session/arc_session_manager.h b/chrome/browser/ash/arc/session/arc_session_manager.h
index 7dbc6a2..90a087c 100644
--- a/chrome/browser/ash/arc/session/arc_session_manager.h
+++ b/chrome/browser/ash/arc/session/arc_session_manager.h
@@ -13,7 +13,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/timer/timer.h"
#include "chrome/browser/ash/arc/arc_support_host.h"
#include "chrome/browser/ash/arc/session/adb_sideloading_availability_delegate_impl.h"
@@ -24,6 +23,7 @@
#include "chromeos/dbus/session_manager/session_manager_client.h"
#include "components/arc/session/arc_session_runner.h"
#include "components/arc/session/arc_stop_reason.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
class ArcAppLauncher;
@@ -291,8 +291,8 @@
const vm_tools::concierge::VmStoppedSignal& vm_signal) override;
// Getter for |vm_info_|.
- // If ARCVM is not running, return base::nullopt.
- const base::Optional<vm_tools::concierge::VmInfo>& GetVmInfo() const;
+ // If ARCVM is not running, return absl::nullopt.
+ const absl::optional<vm_tools::concierge::VmInfo>& GetVmInfo() const;
// Getter for |serialno|.
std::string GetSerialNumber() const;
@@ -362,7 +362,7 @@
// If not requested, just skipping the data removal, and moves to
// MaybeReenableArc() directly.
void MaybeStartArcDataRemoval();
- void OnArcDataRemoved(base::Optional<bool> success);
+ void OnArcDataRemoved(absl::optional<bool> success);
// On ARC session stopped and/or data removal completion, this is called
// so that, if necessary, ARC session is restarted.
@@ -437,11 +437,11 @@
ArcAppIdProviderImpl app_id_provider_;
// The content of /var/lib/misc/arc_salt. Empty if the file doesn't exist.
- base::Optional<std::string> arc_salt_on_disk_;
+ absl::optional<std::string> arc_salt_on_disk_;
- base::Optional<bool> property_files_expansion_result_;
+ absl::optional<bool> property_files_expansion_result_;
- base::Optional<vm_tools::concierge::VmInfo> vm_info_;
+ absl::optional<vm_tools::concierge::VmInfo> vm_info_;
// Must be the last member.
base::WeakPtrFactory<ArcSessionManager> weak_ptr_factory_{this};
diff --git a/chrome/browser/ash/arc/session/arc_session_manager_unittest.cc b/chrome/browser/ash/arc/session/arc_session_manager_unittest.cc
index 4aac762..f827f5a 100644
--- a/chrome/browser/ash/arc/session/arc_session_manager_unittest.cc
+++ b/chrome/browser/ash/arc/session/arc_session_manager_unittest.cc
@@ -19,7 +19,6 @@
#include "base/macros.h"
#include "base/notreached.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/scoped_command_line.h"
@@ -75,6 +74,7 @@
#include "google_apis/gaia/gaia_urls.h"
#include "net/http/http_status_code.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace arc {
@@ -112,7 +112,7 @@
FileExpansionObserver(const FileExpansionObserver&) = delete;
FileExpansionObserver& operator=(const FileExpansionObserver&) = delete;
- const base::Optional<bool>& property_files_expansion_result() const {
+ const absl::optional<bool>& property_files_expansion_result() const {
return property_files_expansion_result_;
}
@@ -122,7 +122,7 @@
}
private:
- base::Optional<bool> property_files_expansion_result_;
+ absl::optional<bool> property_files_expansion_result_;
};
class ShowErrorObserver : public ArcSessionManagerObserver {
@@ -137,7 +137,7 @@
~ShowErrorObserver() override { session_manager_->RemoveObserver(this); }
- const base::Optional<ArcSupportHost::ErrorInfo> error_info() const {
+ const absl::optional<ArcSupportHost::ErrorInfo> error_info() const {
return error_info_;
}
@@ -146,7 +146,7 @@
}
private:
- base::Optional<ArcSupportHost::ErrorInfo> error_info_;
+ absl::optional<ArcSupportHost::ErrorInfo> error_info_;
ArcSessionManager* const session_manager_;
};
@@ -1090,10 +1090,10 @@
arc_session_manager()->Shutdown();
}
-// Tests that |vm_info| is initialized with base::nullopt.
+// Tests that |vm_info| is initialized with absl::nullopt.
TEST_F(ArcSessionManagerTest, GetVmInfo_InitialValue) {
const auto& vm_info = arc_session_manager()->GetVmInfo();
- EXPECT_EQ(base::nullopt, vm_info);
+ EXPECT_EQ(absl::nullopt, vm_info);
}
// Tests that |vm_info| is updated with that from VmStartedSignal.
@@ -1104,21 +1104,21 @@
arc_session_manager()->OnVmStarted(vm_signal);
const auto& vm_info = arc_session_manager()->GetVmInfo();
- ASSERT_NE(base::nullopt, vm_info);
+ ASSERT_NE(absl::nullopt, vm_info);
EXPECT_EQ(1000UL, vm_info->seneschal_server_handle());
}
-// Tests that |vm_info| remains as base::nullopt after VM stops.
+// Tests that |vm_info| remains as absl::nullopt after VM stops.
TEST_F(ArcSessionManagerTest, GetVmInfo_WithVmStopped) {
vm_tools::concierge::VmStoppedSignal vm_signal;
vm_signal.set_name(kArcVmName);
arc_session_manager()->OnVmStopped(vm_signal);
const auto& vm_info = arc_session_manager()->GetVmInfo();
- EXPECT_EQ(base::nullopt, vm_info);
+ EXPECT_EQ(absl::nullopt, vm_info);
}
-// Tests that |vm_info| is reset to base::nullopt after VM starts and stops.
+// Tests that |vm_info| is reset to absl::nullopt after VM starts and stops.
TEST_F(ArcSessionManagerTest, GetVmInfo_WithVmStarted_ThenStopped) {
vm_tools::concierge::VmStartedSignal start_signal;
start_signal.set_name(kArcVmName);
@@ -1130,7 +1130,7 @@
arc_session_manager()->OnVmStopped(stop_signal);
const auto& vm_info = arc_session_manager()->GetVmInfo();
- EXPECT_EQ(base::nullopt, vm_info);
+ EXPECT_EQ(absl::nullopt, vm_info);
}
// Tests that |vm_info| is not updated with non-ARCVM VmStartedSignal.
@@ -1141,7 +1141,7 @@
arc_session_manager()->OnVmStarted(non_vm_signal);
const auto& vm_info = arc_session_manager()->GetVmInfo();
- EXPECT_EQ(base::nullopt, vm_info);
+ EXPECT_EQ(absl::nullopt, vm_info);
}
class ArcSessionManagerArcAlwaysStartTest : public ArcSessionManagerTest {
@@ -1208,7 +1208,7 @@
ArcSupportHost::Error message;
// the error code sent to arc support host
- base::Optional<int> arg;
+ absl::optional<int> arg;
};
constexpr ProvisioningErrorDisplayTestParam
diff --git a/chrome/browser/ash/arc/tracing/arc_system_stat_collector.cc b/chrome/browser/ash/arc/tracing/arc_system_stat_collector.cc
index 9911fa0..39092b7c 100644
--- a/chrome/browser/ash/arc/tracing/arc_system_stat_collector.cc
+++ b/chrome/browser/ash/arc/tracing/arc_system_stat_collector.cc
@@ -511,7 +511,7 @@
}
bool ArcSystemStatCollector::LoadFromJson(const std::string& json_data) {
- const base::Optional<base::Value> root = base::JSONReader::Read(json_data);
+ const absl::optional<base::Value> root = base::JSONReader::Read(json_data);
if (!root)
return false;
return LoadFromValue(*root);
diff --git a/chrome/browser/ash/arc/tracing/arc_system_stat_collector_unittest.cc b/chrome/browser/ash/arc/tracing/arc_system_stat_collector_unittest.cc
index bc6468db..7c669489 100644
--- a/chrome/browser/ash/arc/tracing/arc_system_stat_collector_unittest.cc
+++ b/chrome/browser/ash/arc/tracing/arc_system_stat_collector_unittest.cc
@@ -75,9 +75,9 @@
ASSERT_TRUE(collector.LoadFromJson(json_content));
const std::string json_content_restored = collector.SerializeToJson();
ASSERT_TRUE(!json_content_restored.empty());
- base::Optional<base::Value> root = base::JSONReader::Read(json_content);
+ absl::optional<base::Value> root = base::JSONReader::Read(json_content);
ASSERT_TRUE(root);
- base::Optional<base::Value> root_restored =
+ absl::optional<base::Value> root_restored =
base::JSONReader::Read(json_content_restored);
ASSERT_TRUE(root_restored);
EXPECT_EQ(*root, *root_restored);
diff --git a/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher.cc b/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher.cc
index ead7494..1347d6e 100644
--- a/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher.cc
+++ b/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher.cc
@@ -79,16 +79,16 @@
return true;
}
-base::Optional<int64_t> ArcTracingEventMatcher::ReadAndroidEventInt64(
+absl::optional<int64_t> ArcTracingEventMatcher::ReadAndroidEventInt64(
const ArcTracingEvent& event) const {
if (!name_prefix_match_ || (event.GetName().find(name_) != 0))
- return base::nullopt;
+ return absl::nullopt;
int64_t value = 0;
if (!base::StringToInt64(event.GetName().data() + name_.size(), &value))
- return base::nullopt;
+ return absl::nullopt;
- return base::make_optional(value);
+ return absl::make_optional(value);
}
} // namespace arc
diff --git a/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher.h b/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher.h
index acb5121..e7e10fdb 100644
--- a/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher.h
+++ b/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher.h
@@ -11,7 +11,7 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace arc {
@@ -31,7 +31,7 @@
// Returns true in case |event| matches criteria set.
bool Match(const ArcTracingEvent& event) const;
- base::Optional<int64_t> ReadAndroidEventInt64(
+ absl::optional<int64_t> ReadAndroidEventInt64(
const ArcTracingEvent& event) const;
// Sets the expected phase. Tested event does not match if its phase does not
diff --git a/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher_unittest.cc b/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher_unittest.cc
index ab519fd0..f8ae2b7 100644
--- a/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher_unittest.cc
+++ b/chrome/browser/ash/arc/tracing/arc_tracing_event_matcher_unittest.cc
@@ -53,19 +53,19 @@
TEST_F(ArcTracingEventMatcherTest, CategoryNamePrefixAndroidInt64) {
ArcTracingEventMatcher matcher("android:ARC_VSYNC|*");
- EXPECT_EQ(base::nullopt, matcher.ReadAndroidEventInt64(
+ EXPECT_EQ(absl::nullopt, matcher.ReadAndroidEventInt64(
MakeEvent(R"({"name":"ARC_VSYNC"})")));
- EXPECT_EQ(base::nullopt, matcher.ReadAndroidEventInt64(
+ EXPECT_EQ(absl::nullopt, matcher.ReadAndroidEventInt64(
MakeEvent(R"({"name":"ARC_VSYNC|"})")));
- EXPECT_EQ(base::nullopt, matcher.ReadAndroidEventInt64(
+ EXPECT_EQ(absl::nullopt, matcher.ReadAndroidEventInt64(
MakeEvent(R"({"name":"ARC_VSYNC|abc"})")));
EXPECT_EQ(
- base::make_optional(0),
+ absl::make_optional(0),
matcher.ReadAndroidEventInt64(MakeEvent(R"({"name":"ARC_VSYNC|0"})")));
- EXPECT_EQ(base::make_optional(777777777777LL),
+ EXPECT_EQ(absl::make_optional(777777777777LL),
matcher.ReadAndroidEventInt64(
MakeEvent(R"({"name":"ARC_VSYNC|777777777777"})")));
- EXPECT_EQ(base::make_optional(-777777777777LL),
+ EXPECT_EQ(absl::make_optional(-777777777777LL),
matcher.ReadAndroidEventInt64(
MakeEvent(R"({"name":"ARC_VSYNC|-777777777777"})")));
}
diff --git a/chrome/browser/ash/arc/tracing/arc_tracing_graphics_model.cc b/chrome/browser/ash/arc/tracing/arc_tracing_graphics_model.cc
index 8e99ab5..7e0442a 100644
--- a/chrome/browser/ash/arc/tracing/arc_tracing_graphics_model.cc
+++ b/chrome/browser/ash/arc/tracing/arc_tracing_graphics_model.cc
@@ -1349,7 +1349,7 @@
// vsync timestamp which is provided as extra metadata encoded in
// the event name string, rather than looking at the the timestamp
// at which the event was recorded.
- base::Optional<int64_t> timestamp =
+ absl::optional<int64_t> timestamp =
matcher.ReadAndroidEventInt64(event);
// The encoded int64 timestamp is in nanoseconds. Convert to
diff --git a/chrome/browser/ash/attestation/attestation_ca_client.cc b/chrome/browser/ash/attestation/attestation_ca_client.cc
index c3c9f67..0411dcb 100644
--- a/chrome/browser/ash/attestation/attestation_ca_client.cc
+++ b/chrome/browser/ash/attestation/attestation_ca_client.cc
@@ -71,7 +71,7 @@
// network::mojom::ProxyLookupClient:
void OnProxyLookupComplete(
int32_t net_error,
- const base::Optional<net::ProxyInfo>& proxy_info) override {
+ const absl::optional<net::ProxyInfo>& proxy_info) override {
LOG_IF(WARNING, !proxy_info.has_value())
<< " Error determining the proxy information: " << net_error;
// Assume there is a proxy if failing to get proxy information.
@@ -95,7 +95,7 @@
receiver_.BindNewPipeAndPassRemote();
receiver_.set_disconnect_handler(base::BindOnce(
&CAProxyLookupClient::OnProxyLookupComplete, base::Unretained(this),
- net::ERR_ABORTED, base::nullopt));
+ net::ERR_ABORTED, absl::nullopt));
network_context->LookUpProxyForURL(url, network_isolation_key,
std::move(proxy_lookup_client));
diff --git a/chrome/browser/ash/attestation/attestation_ca_client_unittest.cc b/chrome/browser/ash/attestation/attestation_ca_client_unittest.cc
index d932bdb..332e5cf 100644
--- a/chrome/browser/ash/attestation/attestation_ca_client_unittest.cc
+++ b/chrome/browser/ash/attestation/attestation_ca_client_unittest.cc
@@ -58,7 +58,7 @@
std::move(proxy_lookup_client));
if (proxy_presence_table_.count(url) == 0) {
client->OnProxyLookupComplete(net::ERR_FAILED,
- /*proxy_info=*/base::nullopt);
+ /*proxy_info=*/absl::nullopt);
return;
}
net::ProxyInfo proxy_info;
diff --git a/chrome/browser/ash/attestation/enrollment_policy_observer.cc b/chrome/browser/ash/attestation/enrollment_policy_observer.cc
index 33c9c2af..b478b908 100644
--- a/chrome/browser/ash/attestation/enrollment_policy_observer.cc
+++ b/chrome/browser/ash/attestation/enrollment_policy_observer.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/location.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
@@ -30,6 +29,7 @@
#include "content/public/browser/notification_details.h"
#include "net/cert/pem.h"
#include "net/cert/x509_certificate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
diff --git a/chrome/browser/ash/attestation/machine_certificate_uploader_impl.cc b/chrome/browser/ash/attestation/machine_certificate_uploader_impl.cc
index 8a0cc08..c8a728d 100644
--- a/chrome/browser/ash/attestation/machine_certificate_uploader_impl.cc
+++ b/chrome/browser/ash/attestation/machine_certificate_uploader_impl.cc
@@ -12,7 +12,6 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/location.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/attestation/attestation_ca_client.h"
#include "chrome/browser/ash/attestation/attestation_key_payload.pb.h"
@@ -30,6 +29,7 @@
#include "content/public/browser/notification_details.h"
#include "net/cert/pem.h"
#include "net/cert/x509_certificate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
diff --git a/chrome/browser/ash/attestation/machine_certificate_uploader_impl.h b/chrome/browser/ash/attestation/machine_certificate_uploader_impl.h
index 892d31b..7b7a50e 100644
--- a/chrome/browser/ash/attestation/machine_certificate_uploader_impl.h
+++ b/chrome/browser/ash/attestation/machine_certificate_uploader_impl.h
@@ -9,8 +9,8 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ash/attestation/machine_certificate_uploader.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): forward declare AttestatoinFlow
// after //chromeos/attestation is moved to ash.
#include "chromeos/attestation/attestation_flow.h"
@@ -107,7 +107,7 @@
int num_retries_ = {};
int retry_limit_ = {};
int retry_delay_ = {};
- base::Optional<bool> certificate_uploaded_;
+ absl::optional<bool> certificate_uploaded_;
// Note: This should remain the last member so it'll be destroyed and
// invalidate the weak pointers before any other members are destroyed.
diff --git a/chrome/browser/ash/attestation/tpm_challenge_key_subtle.h b/chrome/browser/ash/attestation/tpm_challenge_key_subtle.h
index 7a25918f..8d29b588f 100644
--- a/chrome/browser/ash/attestation/tpm_challenge_key_subtle.h
+++ b/chrome/browser/ash/attestation/tpm_challenge_key_subtle.h
@@ -11,7 +11,6 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "chrome/browser/ash/attestation/tpm_challenge_key_result.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys.h"
@@ -22,6 +21,7 @@
#include "chromeos/dbus/tpm_manager/tpm_manager.pb.h"
#include "components/account_id/account_id.h"
#include "components/user_manager/user.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
diff --git a/chrome/browser/ash/attestation/tpm_challenge_key_subtle_unittest.cc b/chrome/browser/ash/attestation/tpm_challenge_key_subtle_unittest.cc
index baf59ae..57a8f56 100644
--- a/chrome/browser/ash/attestation/tpm_challenge_key_subtle_unittest.cc
+++ b/chrome/browser/ash/attestation/tpm_challenge_key_subtle_unittest.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ash/attestation/tpm_challenge_key_subtle.h"
#include "base/bind.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/gmock_callback_support.h"
#include "base/time/time.h"
@@ -33,6 +32,7 @@
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using base::test::RunOnceCallback;
using testing::_;
@@ -99,7 +99,7 @@
}
base::RunLoop loop_;
- base::Optional<TpmChallengeKeyResult> result_;
+ absl::optional<TpmChallengeKeyResult> result_;
};
template <typename T>
diff --git a/chrome/browser/ash/attestation/tpm_challenge_key_unittest.cc b/chrome/browser/ash/attestation/tpm_challenge_key_unittest.cc
index 1cf3803..a9987be3 100644
--- a/chrome/browser/ash/attestation/tpm_challenge_key_unittest.cc
+++ b/chrome/browser/ash/attestation/tpm_challenge_key_unittest.cc
@@ -89,7 +89,7 @@
}
base::RunLoop loop_;
- base::Optional<TpmChallengeKeyResult> result_;
+ absl::optional<TpmChallengeKeyResult> result_;
};
TEST_F(TpmChallengeKeyTest, PrepareKeyFailed) {
diff --git a/chrome/browser/ash/authpolicy/authpolicy_credentials_manager.cc b/chrome/browser/ash/authpolicy/authpolicy_credentials_manager.cc
index 5572975f..3ae5af3 100644
--- a/chrome/browser/ash/authpolicy/authpolicy_credentials_manager.cc
+++ b/chrome/browser/ash/authpolicy/authpolicy_credentials_manager.cc
@@ -203,7 +203,7 @@
void AuthPolicyCredentialsManager::OnGetUserKerberosFilesCallback(
authpolicy::ErrorType error,
const authpolicy::KerberosFiles& kerberos_files) {
- auto nullstr = base::Optional<std::string>();
+ auto nullstr = absl::optional<std::string>();
kerberos_files_handler_.SetFiles(
kerberos_files.has_krb5cc() ? kerberos_files.krb5cc() : nullstr,
kerberos_files.has_krb5conf() ? kerberos_files.krb5conf() : nullstr);
@@ -274,7 +274,7 @@
auto delegate =
base::MakeRefCounted<message_center::HandleNotificationClickDelegate>(
- base::BindRepeating([](base::Optional<int> button_index) {
+ base::BindRepeating([](absl::optional<int> button_index) {
chrome::AttemptUserExit();
}));
diff --git a/chrome/browser/ash/authpolicy/kerberos_files_handler.cc b/chrome/browser/ash/authpolicy/kerberos_files_handler.cc
index b4ccaca4..c650d1c 100644
--- a/chrome/browser/ash/authpolicy/kerberos_files_handler.cc
+++ b/chrome/browser/ash/authpolicy/kerberos_files_handler.cc
@@ -35,7 +35,7 @@
// Writes |blob| into file <UserPath>/kerberos/|file_name|. First writes into
// temporary file and then replaces existing one. Prints an error or failure.
-void WriteFile(const base::FilePath& path, base::Optional<std::string> blob) {
+void WriteFile(const base::FilePath& path, absl::optional<std::string> blob) {
if (!blob.has_value())
return;
if (!base::ImportantFileWriter::WriteFileAtomically(path, blob.value()))
@@ -50,8 +50,8 @@
// Writes |krb5cc| to <DIR_HOME>/kerberos/krb5cc and |krb5config| to
// <DIR_HOME>/kerberos/krb5.conf if set. Creates directories if necessary.
-void WriteFiles(base::Optional<std::string> krb5cc,
- base::Optional<std::string> krb5config) {
+void WriteFiles(absl::optional<std::string> krb5cc,
+ absl::optional<std::string> krb5config) {
base::FilePath dir = GetKerberosDir();
base::File::Error error;
if (!base::CreateDirectoryAndGetError(dir, &error)) {
@@ -74,11 +74,11 @@
// If |config| has a value, puts canonicalization settings first depending on
// user policy. Whatever setting comes first wins, so even if krb5.conf sets
// rdns or dns_canonicalize_hostname below, it would get overridden.
-base::Optional<std::string> MaybeAdjustConfig(
- base::Optional<std::string> config,
+absl::optional<std::string> MaybeAdjustConfig(
+ absl::optional<std::string> config,
bool is_dns_cname_enabled) {
if (!config.has_value())
- return base::nullopt;
+ return absl::nullopt;
std::string adjusted_config = base::StringPrintf(
kKrb5CnameSettings, is_dns_cname_enabled ? "true" : "false");
adjusted_config.append(config.value());
@@ -134,8 +134,8 @@
KerberosFilesHandler::~KerberosFilesHandler() = default;
-void KerberosFilesHandler::SetFiles(base::Optional<std::string> krb5cc,
- base::Optional<std::string> krb5conf) {
+void KerberosFilesHandler::SetFiles(absl::optional<std::string> krb5cc,
+ absl::optional<std::string> krb5conf) {
krb5conf =
MaybeAdjustConfig(krb5conf, !negotiate_disable_cname_lookup_.GetValue());
base::ThreadPool::PostTaskAndReply(
diff --git a/chrome/browser/ash/authpolicy/kerberos_files_handler.h b/chrome/browser/ash/authpolicy/kerberos_files_handler.h
index 35ecf35..a903c74a 100644
--- a/chrome/browser/ash/authpolicy/kerberos_files_handler.h
+++ b/chrome/browser/ash/authpolicy/kerberos_files_handler.h
@@ -10,8 +10,8 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "components/prefs/pref_member.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -41,8 +41,8 @@
virtual ~KerberosFilesHandler();
// Writes the Kerberos credentials to disk asynchronously.
- void SetFiles(base::Optional<std::string> krb5cc,
- base::Optional<std::string> krb5conf);
+ void SetFiles(absl::optional<std::string> krb5cc,
+ absl::optional<std::string> krb5conf);
// Deletes the Kerberos credentials from disk asynchronously.
virtual void DeleteFiles();
diff --git a/chrome/browser/ash/borealis/borealis_app_launcher.cc b/chrome/browser/ash/borealis/borealis_app_launcher.cc
index 9b3fe14..e04d8d0f 100644
--- a/chrome/browser/ash/borealis/borealis_app_launcher.cc
+++ b/chrome/browser/ash/borealis/borealis_app_launcher.cc
@@ -37,7 +37,7 @@
return;
}
- base::Optional<guest_os::GuestOsRegistryService::Registration> reg =
+ absl::optional<guest_os::GuestOsRegistryService::Registration> reg =
guest_os::GuestOsRegistryServiceFactory::GetForProfile(ctx.profile())
->GetRegistration(app_id);
if (!reg) {
@@ -59,7 +59,7 @@
std::move(request),
base::BindOnce(
[](OnLaunchedCallback callback,
- base::Optional<
+ absl::optional<
vm_tools::cicerone::LaunchContainerApplicationResponse>
response) {
if (!response) {
diff --git a/chrome/browser/ash/borealis/borealis_app_uninstaller.cc b/chrome/browser/ash/borealis/borealis_app_uninstaller.cc
index e1e3370..e70709e 100644
--- a/chrome/browser/ash/borealis/borealis_app_uninstaller.cc
+++ b/chrome/browser/ash/borealis/borealis_app_uninstaller.cc
@@ -37,7 +37,7 @@
return;
}
- base::Optional<guest_os::GuestOsRegistryService::Registration> registration =
+ absl::optional<guest_os::GuestOsRegistryService::Registration> registration =
guest_os::GuestOsRegistryServiceFactory::GetForProfile(profile_)
->GetRegistration(app_id);
if (!registration.has_value()) {
@@ -46,7 +46,7 @@
std::move(callback).Run(UninstallResult::kError);
return;
}
- base::Optional<int> uninstall_app_id = GetBorealisAppId(registration->Exec());
+ absl::optional<int> uninstall_app_id = GetBorealisAppId(registration->Exec());
if (!uninstall_app_id.has_value()) {
LOG(ERROR) << "Couldn't retrieve the borealis app id from the exec "
"information provided";
@@ -54,7 +54,7 @@
return;
}
// TODO(174282035): Changeup string usage and finish tests.
- base::Optional<guest_os::GuestOsRegistryService::Registration> main_app =
+ absl::optional<guest_os::GuestOsRegistryService::Registration> main_app =
guest_os::GuestOsRegistryServiceFactory::GetForProfile(profile_)
->GetRegistration(kBorealisMainAppId);
if (!main_app.has_value()) {
diff --git a/chrome/browser/ash/borealis/borealis_context_manager_impl.cc b/chrome/browser/ash/borealis/borealis_context_manager_impl.cc
index d6de2d04..046bc78e 100644
--- a/chrome/browser/ash/borealis/borealis_context_manager_impl.cc
+++ b/chrome/browser/ash/borealis/borealis_context_manager_impl.cc
@@ -114,7 +114,7 @@
std::move(request),
base::BindOnce(
[](base::WeakPtr<BorealisContextManagerImpl> weak_this,
- base::Optional<vm_tools::concierge::GetVmInfoResponse> reply) {
+ absl::optional<vm_tools::concierge::GetVmInfoResponse> reply) {
if (reply.has_value() && reply->success() && weak_this) {
weak_this->SendShutdownRequest(base::DoNothing(),
kBorealisVmName);
@@ -137,7 +137,7 @@
base::BindOnce(
[](base::OnceCallback<void(BorealisShutdownResult)>
on_shutdown_callback,
- base::Optional<vm_tools::concierge::StopVmResponse> response) {
+ absl::optional<vm_tools::concierge::StopVmResponse> response) {
// We don't have a good way to deal with a vm failing to stop (and
// this would be a very rare occurrence anyway). We log an error if
// it actually wasn't successful.
diff --git a/chrome/browser/ash/borealis/borealis_game_mode_controller.cc b/chrome/browser/ash/borealis/borealis_game_mode_controller.cc
index 9bcdf45..61db2a53 100644
--- a/chrome/browser/ash/borealis/borealis_game_mode_controller.cc
+++ b/chrome/browser/ash/borealis/borealis_game_mode_controller.cc
@@ -95,7 +95,7 @@
// State is true if entering game mode, false if exiting.
void BorealisGameModeController::GameModeEnabler::OnSetGameMode(
- base::Optional<bool> state) {
+ absl::optional<bool> state) {
if (!state.has_value()) {
LOG(ERROR) << "Failed to set Game Mode";
// TODO(b/186184700): Remove logging for entering/exiting game mode.
diff --git a/chrome/browser/ash/borealis/borealis_game_mode_controller.h b/chrome/browser/ash/borealis/borealis_game_mode_controller.h
index 75cf1718..bfb1934 100644
--- a/chrome/browser/ash/borealis/borealis_game_mode_controller.h
+++ b/chrome/browser/ash/borealis/borealis_game_mode_controller.h
@@ -46,7 +46,7 @@
~GameModeEnabler();
private:
- static void OnSetGameMode(base::Optional<bool> dbus_response);
+ static void OnSetGameMode(absl::optional<bool> dbus_response);
};
class WindowTracker : public ash::WindowStateObserver,
diff --git a/chrome/browser/ash/borealis/borealis_game_mode_controller_unittest.cc b/chrome/browser/ash/borealis/borealis_game_mode_controller_unittest.cc
index edb2021..f41508fa 100644
--- a/chrome/browser/ash/borealis/borealis_game_mode_controller_unittest.cc
+++ b/chrome/browser/ash/borealis/borealis_game_mode_controller_unittest.cc
@@ -63,7 +63,7 @@
TEST_F(BorealisGameModeControllerTest, ChangingFullScreenTogglesGameMode) {
fake_resourced_client_->set_set_game_mode_response(
- base::Optional<bool>(true));
+ absl::optional<bool>(true));
std::unique_ptr<views::Widget> test_widget =
CreateTestWidget("org.chromium.borealis.foo", true);
aura::Window* window = test_widget->GetNativeWindow();
@@ -71,7 +71,7 @@
EXPECT_EQ(1, fake_resourced_client_->get_enter_game_mode_count());
fake_resourced_client_->set_set_game_mode_response(
- base::Optional<bool>(false));
+ absl::optional<bool>(false));
test_widget->SetFullscreen(false);
EXPECT_FALSE(ash::WindowState::Get(window)->IsFullscreen());
EXPECT_EQ(1, fake_resourced_client_->get_exit_game_mode_count());
@@ -79,7 +79,7 @@
TEST_F(BorealisGameModeControllerTest, NonBorealisWindowDoesNotEnterGameMode) {
fake_resourced_client_->set_set_game_mode_response(
- base::Optional<bool>(false));
+ absl::optional<bool>(false));
std::unique_ptr<aura::Window> window = CreateTestWindow();
views::Widget::GetTopLevelWidgetForNativeView(window.get())
->SetFullscreen(true);
@@ -89,7 +89,7 @@
TEST_F(BorealisGameModeControllerTest, SwitchingWindowsTogglesGameMode) {
fake_resourced_client_->set_set_game_mode_response(
- base::Optional<bool>(true));
+ absl::optional<bool>(true));
std::unique_ptr<views::Widget> test_widget =
CreateTestWidget("org.chromium.borealis.foo", true);
aura::Window* window = test_widget->GetNativeWindow();
@@ -97,7 +97,7 @@
EXPECT_EQ(1, fake_resourced_client_->get_enter_game_mode_count());
fake_resourced_client_->set_set_game_mode_response(
- base::Optional<bool>(false));
+ absl::optional<bool>(false));
std::unique_ptr<views::Widget> other_test_widget =
CreateTestWidget("org.chromium.borealis.bar");
aura::Window* other_window = other_test_widget->GetNativeWindow();
@@ -106,7 +106,7 @@
EXPECT_EQ(1, fake_resourced_client_->get_exit_game_mode_count());
fake_resourced_client_->set_set_game_mode_response(
- base::Optional<bool>(true));
+ absl::optional<bool>(true));
window->Focus();
EXPECT_TRUE(ash::WindowState::Get(window)->IsFullscreen());
@@ -115,7 +115,7 @@
TEST_F(BorealisGameModeControllerTest, DestroyingWindowExitsGameMode) {
fake_resourced_client_->set_set_game_mode_response(
- base::Optional<bool>(true));
+ absl::optional<bool>(true));
std::unique_ptr<views::Widget> test_widget =
CreateTestWidget("org.chromium.borealis.foo", true);
aura::Window* window = test_widget->GetNativeWindow();
@@ -123,7 +123,7 @@
EXPECT_EQ(1, fake_resourced_client_->get_enter_game_mode_count());
fake_resourced_client_->set_set_game_mode_response(
- base::Optional<bool>(false));
+ absl::optional<bool>(false));
test_widget.reset();
EXPECT_EQ(1, fake_resourced_client_->get_exit_game_mode_count());
@@ -131,7 +131,7 @@
TEST_F(BorealisGameModeControllerTest, SwitchingWindowsMaintainsGameMode) {
fake_resourced_client_->set_set_game_mode_response(
- base::Optional<bool>(true));
+ absl::optional<bool>(true));
std::unique_ptr<views::Widget> test_widget =
CreateTestWidget("org.chromium.borealis.foo", true);
aura::Window* window = test_widget->GetNativeWindow();
@@ -148,7 +148,7 @@
TEST_F(BorealisGameModeControllerTest, SetGameModeFailureDoesNotCrash) {
fake_resourced_client_->set_set_game_mode_response(
- base::Optional<bool>(base::nullopt));
+ absl::optional<bool>(absl::nullopt));
std::unique_ptr<views::Widget> test_widget =
CreateTestWidget("org.chromium.borealis.foo", true);
aura::Window* window = test_widget->GetNativeWindow();
diff --git a/chrome/browser/ash/borealis/borealis_installer_impl.cc b/chrome/browser/ash/borealis/borealis_installer_impl.cc
index 8596d43..987a025d 100644
--- a/chrome/browser/ash/borealis/borealis_installer_impl.cc
+++ b/chrome/browser/ash/borealis/borealis_installer_impl.cc
@@ -160,7 +160,7 @@
}
void OnDiskRemoved(
- base::Optional<vm_tools::concierge::DestroyDiskImageResponse> response) {
+ absl::optional<vm_tools::concierge::DestroyDiskImageResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to destroy disk image. Empty response.";
Fail(BorealisUninstallResult::kRemoveDiskFailed);
diff --git a/chrome/browser/ash/borealis/borealis_installer_unittest.cc b/chrome/browser/ash/borealis/borealis_installer_unittest.cc
index ac9500ce2..4fcc72d 100644
--- a/chrome/browser/ash/borealis/borealis_installer_unittest.cc
+++ b/chrome/browser/ash/borealis/borealis_installer_unittest.cc
@@ -426,7 +426,7 @@
chromeos::FakeConciergeClient* fake_concierge_client =
chromeos::FakeConciergeClient::Get();
- fake_concierge_client->set_destroy_disk_image_response(base::nullopt);
+ fake_concierge_client->set_destroy_disk_image_response(absl::nullopt);
installer_->Uninstall(callback_factory.BindOnce());
task_environment_.RunUntilIdle();
diff --git a/chrome/browser/ash/borealis/borealis_launch_watcher.cc b/chrome/browser/ash/borealis/borealis_launch_watcher.cc
index a76a85d..230bd508 100644
--- a/chrome/browser/ash/borealis/borealis_launch_watcher.cc
+++ b/chrome/browser/ash/borealis/borealis_launch_watcher.cc
@@ -50,7 +50,7 @@
void BorealisLaunchWatcher::TimeoutCallback() {
while (!callback_queue_.empty()) {
- std::move(callback_queue_.front()).Run(base::nullopt);
+ std::move(callback_queue_.front()).Run(absl::nullopt);
callback_queue_.pop();
}
}
diff --git a/chrome/browser/ash/borealis/borealis_launch_watcher.h b/chrome/browser/ash/borealis/borealis_launch_watcher.h
index 3304a6d..7301b28 100644
--- a/chrome/browser/ash/borealis/borealis_launch_watcher.h
+++ b/chrome/browser/ash/borealis/borealis_launch_watcher.h
@@ -19,7 +19,7 @@
class BorealisLaunchWatcher : public chromeos::CiceroneClient::Observer {
public:
using OnLaunchCallback =
- base::OnceCallback<void(base::Optional<std::string>)>;
+ base::OnceCallback<void(absl::optional<std::string>)>;
BorealisLaunchWatcher(Profile* profile, std::string vm_name);
BorealisLaunchWatcher(const BorealisLaunchWatcher&) = delete;
@@ -46,7 +46,7 @@
std::string owner_id_;
std::string vm_name_;
base::TimeDelta timeout_ = base::TimeDelta::FromMilliseconds(30000);
- base::Optional<vm_tools::cicerone::ContainerStartedSignal>
+ absl::optional<vm_tools::cicerone::ContainerStartedSignal>
container_started_signal_;
base::queue<OnLaunchCallback> callback_queue_;
diff --git a/chrome/browser/ash/borealis/borealis_launch_watcher_unittest.cc b/chrome/browser/ash/borealis/borealis_launch_watcher_unittest.cc
index 787b6b31..8fb12c0 100644
--- a/chrome/browser/ash/borealis/borealis_launch_watcher_unittest.cc
+++ b/chrome/browser/ash/borealis/borealis_launch_watcher_unittest.cc
@@ -20,11 +20,11 @@
class CallbackForTestingExpectation {
public:
- base::OnceCallback<void(base::Optional<std::string>)> GetCallback() {
+ base::OnceCallback<void(absl::optional<std::string>)> GetCallback() {
return base::BindOnce(&CallbackForTestingExpectation::Callback,
base::Unretained(this));
}
- MOCK_METHOD(void, Callback, (base::Optional<std::string>), ());
+ MOCK_METHOD(void, Callback, (absl::optional<std::string>), ());
};
class BorealisLaunchWatcherTest : public testing::Test {
@@ -73,7 +73,7 @@
signal.set_container_name("FooContainer");
EXPECT_CALL(callback_expectation,
- Callback(base::Optional<std::string>("FooContainer")));
+ Callback(absl::optional<std::string>("FooContainer")));
watcher.AwaitLaunch(callback_expectation.GetCallback());
fake_cicerone_client_->NotifyContainerStarted(std::move(signal));
@@ -86,7 +86,7 @@
watcher.SetTimeoutForTesting(base::TimeDelta::FromMilliseconds(0));
EXPECT_CALL(callback_expectation,
- Callback(base::Optional<std::string>(base::nullopt)));
+ Callback(absl::optional<std::string>(absl::nullopt)));
watcher.AwaitLaunch(callback_expectation.GetCallback());
task_environment_.RunUntilIdle();
@@ -102,7 +102,7 @@
signal.set_container_name("FooContainer");
EXPECT_CALL(callback_expectation,
- Callback(base::Optional<std::string>("FooContainer")));
+ Callback(absl::optional<std::string>("FooContainer")));
fake_cicerone_client_->NotifyContainerStarted(std::move(signal));
watcher.AwaitLaunch(callback_expectation.GetCallback());
@@ -119,7 +119,7 @@
signal.set_container_name("FooContainer");
EXPECT_CALL(callback_expectation,
- Callback(base::Optional<std::string>("FooContainer")))
+ Callback(absl::optional<std::string>("FooContainer")))
.Times(2);
watcher.AwaitLaunch(callback_expectation.GetCallback());
watcher.AwaitLaunch(callback_expectation.GetCallback());
@@ -134,7 +134,7 @@
watcher.SetTimeoutForTesting(base::TimeDelta::FromMilliseconds(0));
EXPECT_CALL(callback_expectation,
- Callback(base::Optional<std::string>(base::nullopt)))
+ Callback(absl::optional<std::string>(absl::nullopt)))
.Times(2);
watcher.AwaitLaunch(callback_expectation.GetCallback());
watcher.AwaitLaunch(callback_expectation.GetCallback());
@@ -155,7 +155,7 @@
signal2.set_vm_name("not-FooVm");
EXPECT_CALL(callback_expectation,
- Callback(base::Optional<std::string>(base::nullopt)));
+ Callback(absl::optional<std::string>(absl::nullopt)));
fake_cicerone_client_->NotifyContainerStarted(std::move(signal1));
fake_cicerone_client_->NotifyContainerStarted(std::move(signal2));
watcher.AwaitLaunch(callback_expectation.GetCallback());
diff --git a/chrome/browser/ash/borealis/borealis_task.cc b/chrome/browser/ash/borealis/borealis_task.cc
index 9c045a1..9f3b699c 100644
--- a/chrome/browser/ash/borealis/borealis_task.cc
+++ b/chrome/browser/ash/borealis/borealis_task.cc
@@ -81,7 +81,7 @@
void CreateDiskImage::OnCreateDiskImage(
BorealisContext* context,
- base::Optional<vm_tools::concierge::CreateDiskImageResponse> response) {
+ absl::optional<vm_tools::concierge::CreateDiskImageResponse> response) {
if (!response) {
context->set_disk_path(base::FilePath());
Complete(BorealisStartupResult::kDiskImageFailed,
@@ -136,7 +136,7 @@
void StartBorealisVm::OnStartBorealisVm(
BorealisContext* context,
- base::Optional<vm_tools::concierge::StartVmResponse> response) {
+ absl::optional<vm_tools::concierge::StartVmResponse> response) {
if (!response) {
Complete(BorealisStartupResult::kStartVmFailed,
"Failed to start Borealis VM: Empty response.");
@@ -171,7 +171,7 @@
void AwaitBorealisStartup::OnAwaitBorealisStartup(
BorealisContext* context,
- base::Optional<std::string> container) {
+ absl::optional<std::string> container) {
if (!container) {
Complete(BorealisStartupResult::kAwaitBorealisStartupFailed,
"Awaiting for Borealis launch failed: timed out");
diff --git a/chrome/browser/ash/borealis/borealis_task.h b/chrome/browser/ash/borealis/borealis_task.h
index 9c729c6..2df0903 100644
--- a/chrome/browser/ash/borealis/borealis_task.h
+++ b/chrome/browser/ash/borealis/borealis_task.h
@@ -65,7 +65,7 @@
private:
void OnCreateDiskImage(
BorealisContext* context,
- base::Optional<vm_tools::concierge::CreateDiskImageResponse> response);
+ absl::optional<vm_tools::concierge::CreateDiskImageResponse> response);
base::WeakPtrFactory<CreateDiskImage> weak_factory_{this};
};
@@ -79,7 +79,7 @@
private:
void OnStartBorealisVm(
BorealisContext* context,
- base::Optional<vm_tools::concierge::StartVmResponse> response);
+ absl::optional<vm_tools::concierge::StartVmResponse> response);
base::WeakPtrFactory<StartBorealisVm> weak_factory_{this};
};
@@ -93,7 +93,7 @@
private:
void OnAwaitBorealisStartup(BorealisContext* context,
- base::Optional<std::string> container);
+ absl::optional<std::string> container);
BorealisLaunchWatcher watcher_;
base::WeakPtrFactory<AwaitBorealisStartup> weak_factory_{this};
};
diff --git a/chrome/browser/ash/borealis/borealis_util.cc b/chrome/browser/ash/borealis/borealis_util.cc
index 0292a15..cd2bc6b 100644
--- a/chrome/browser/ash/borealis/borealis_util.cc
+++ b/chrome/browser/ash/borealis/borealis_util.cc
@@ -15,12 +15,12 @@
// are updated.
const char kBorealisAppIdRegex[] = "([^/]+\\d+)";
-base::Optional<int> GetBorealisAppId(std::string exec) {
+absl::optional<int> GetBorealisAppId(std::string exec) {
int app_id;
if (RE2::PartialMatch(exec, kBorealisAppIdRegex, &app_id)) {
return app_id;
} else {
- return base::nullopt;
+ return absl::nullopt;
}
}
diff --git a/chrome/browser/ash/borealis/borealis_util.h b/chrome/browser/ash/borealis/borealis_util.h
index 5dddd2fc..e1da7f77 100644
--- a/chrome/browser/ash/borealis/borealis_util.h
+++ b/chrome/browser/ash/borealis/borealis_util.h
@@ -30,7 +30,7 @@
// returns true if successful.
// TODO(b/173547790): This should probably be moved when we've decided
// the details of how/where it will be used.
-base::Optional<int> GetBorealisAppId(std::string exec);
+absl::optional<int> GetBorealisAppId(std::string exec);
// Shows the splash screen (borealis_splash_screen_view).
void ShowBorealisSplashScreenView(Profile* profile);
diff --git a/chrome/browser/ash/borealis/infra/state_manager.h b/chrome/browser/ash/borealis/infra/state_manager.h
index f9052e3..1962c2a5 100644
--- a/chrome/browser/ash/borealis/infra/state_manager.h
+++ b/chrome/browser/ash/borealis/infra/state_manager.h
@@ -9,9 +9,9 @@
#include "base/callback_list.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ash/borealis/infra/expected.h"
#include "chrome/browser/ash/borealis/infra/transition.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace borealis {
@@ -61,7 +61,7 @@
using OnTransition = Transition<OffState, State, OnError>;
using OffTransition = Transition<State, OffState, OffError>;
using WhenOn = void(Expected<State*, OnError>);
- using WhenOff = void(base::Optional<OffError>);
+ using WhenOff = void(absl::optional<OffError>);
// Create the state object, turning the state to "on". The |callback| will be
// invoked on completion with the result.
@@ -92,7 +92,7 @@
void TurnOff(base::OnceCallback<WhenOff> callback) {
switch (GetPhase()) {
case Phase::kOff:
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
break;
case Phase::kTransitioningOn:
std::move(callback).Run(GetIsTurningOnError());
@@ -166,8 +166,8 @@
void CompleteOff(typename OffTransition::Result off_result) {
off_transition_.reset();
pending_off_callbacks_.Notify(
- off_result ? base::nullopt
- : base::Optional<OffError>(off_result.Error()));
+ off_result ? absl::nullopt
+ : absl::optional<OffError>(off_result.Error()));
}
std::unique_ptr<State> instance_;
diff --git a/chrome/browser/ash/borealis/infra/state_manager_unittest.cc b/chrome/browser/ash/borealis/infra/state_manager_unittest.cc
index 0a48e39..5aa0304 100644
--- a/chrome/browser/ash/borealis/infra/state_manager_unittest.cc
+++ b/chrome/browser/ash/borealis/infra/state_manager_unittest.cc
@@ -8,11 +8,11 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/test/task_environment.h"
#include "chrome/browser/ash/borealis/infra/expected.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace borealis {
namespace {
@@ -79,7 +79,7 @@
// State managers are created in the "Off" state, so we don't need to
// transition there.
EXPECT_CALL(state_manager, GetOffTransition).Times(0);
- EXPECT_CALL(on_callback_handler, Call(testing::Eq(base::nullopt)));
+ EXPECT_CALL(on_callback_handler, Call(testing::Eq(absl::nullopt)));
state_manager.TurnOff(on_callback_handler.GetOnce());
}
@@ -98,7 +98,7 @@
EXPECT_CALL(on_callback_handler, Call(testing::_))
.WillOnce(testing::Invoke(
[](Expected<Foo*, Bar> result) { EXPECT_TRUE(result); }));
- EXPECT_CALL(off_callback_handler, Call(testing::Eq(base::nullopt)));
+ EXPECT_CALL(off_callback_handler, Call(testing::Eq(absl::nullopt)));
state_manager.TurnOn(on_callback_handler.GetOnce());
task_environment.RunUntilIdle();
@@ -140,7 +140,7 @@
EXPECT_CALL(state_manager, GetIsTurningOnError)
.WillOnce(testing::Return(Baz{.msg = "rejected"}));
EXPECT_CALL(off_callback_handler, Call(testing::_))
- .WillOnce(testing::Invoke([](base::Optional<Baz> err) {
+ .WillOnce(testing::Invoke([](absl::optional<Baz> err) {
ASSERT_TRUE(err.has_value());
EXPECT_EQ(err->msg, "rejected");
}));
@@ -192,7 +192,7 @@
// Additional call to turn off requires no transition, because the state is
// off.
CallbackFactory<MockStateManager::WhenOff> off_callback_handler;
- EXPECT_CALL(off_callback_handler, Call(testing::Eq(base::nullopt)));
+ EXPECT_CALL(off_callback_handler, Call(testing::Eq(absl::nullopt)));
state_manager.TurnOff(off_callback_handler.GetOnce());
}
@@ -212,7 +212,7 @@
.WillOnce(testing::Invoke(
[](Expected<Foo*, Bar> result) { EXPECT_TRUE(result); }));
EXPECT_CALL(off_callback_handler,
- Call(testing::Not(testing::Eq(base::nullopt))));
+ Call(testing::Not(testing::Eq(absl::nullopt))));
state_manager.TurnOn(on_callback_handler.GetOnce());
task_environment.RunUntilIdle();
@@ -221,7 +221,7 @@
// Additional call to turn off requires no transition, because the state is
// off.
- EXPECT_CALL(off_callback_handler, Call(testing::Eq(base::nullopt)));
+ EXPECT_CALL(off_callback_handler, Call(testing::Eq(absl::nullopt)));
state_manager.TurnOff(off_callback_handler.GetOnce());
}
diff --git a/chrome/browser/ash/camera_mic/vm_camera_mic_manager.cc b/chrome/browser/ash/camera_mic/vm_camera_mic_manager.cc
index 3cd68f0..056310a3 100644
--- a/chrome/browser/ash/camera_mic/vm_camera_mic_manager.cc
+++ b/chrome/browser/ash/camera_mic/vm_camera_mic_manager.cc
@@ -298,8 +298,8 @@
// message_center::NotificationObserver:
//
// This open the settings page if the button is clicked on the notification.
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
switch (vm_type_) {
case VmType::kCrostiniVm:
chrome::SettingsWindowManager::GetInstance()->ShowOSSettings(
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_common.cc b/chrome/browser/ash/cert_provisioning/cert_provisioning_common.cc
index b2b3d31..1e4d9c3 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_common.cc
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_common.cc
@@ -8,7 +8,6 @@
#include "base/callback_helpers.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager.h"
@@ -23,12 +22,13 @@
#include "chromeos/dbus/attestation/interface.pb.h"
#include "components/account_id/account_id.h"
#include "components/prefs/pref_registry_simple.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace cert_provisioning {
namespace {
-base::Optional<AccountId> GetAccountId(CertScope scope, Profile* profile) {
+absl::optional<AccountId> GetAccountId(CertScope scope, Profile* profile) {
switch (scope) {
case CertScope::kDevice: {
return EmptyAccountId();
@@ -37,7 +37,7 @@
user_manager::User* user =
ProfileHelper::Get()->GetUserByProfile(profile);
if (!user) {
- return base::nullopt;
+ return absl::nullopt;
}
return user->GetAccountId();
@@ -107,7 +107,7 @@
CertProfile::CertProfile() = default;
CertProfile::~CertProfile() = default;
-base::Optional<CertProfile> CertProfile::MakeFromValue(
+absl::optional<CertProfile> CertProfile::MakeFromValue(
const base::Value& value) {
static_assert(kVersion == 5, "This function should be updated");
@@ -115,13 +115,13 @@
const std::string* name = value.FindStringKey(kCertProfileNameKey);
const std::string* policy_version =
value.FindStringKey(kCertProfilePolicyVersionKey);
- base::Optional<bool> is_va_enabled =
+ absl::optional<bool> is_va_enabled =
value.FindBoolKey(kCertProfileIsVaEnabledKey);
- base::Optional<int> renewal_period_sec =
+ absl::optional<int> renewal_period_sec =
value.FindIntKey(kCertProfileRenewalPeroidSec);
if (!id || !policy_version) {
- return base::nullopt;
+ return absl::nullopt;
}
CertProfile result;
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_common.h b/chrome/browser/ash/cert_provisioning/cert_provisioning_common.h
index 7f1ad5d..a5ce4ef9 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_common.h
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_common.h
@@ -9,9 +9,9 @@
#include "base/callback.h"
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/values.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): forward declare KeyPermissionsManager
// after //chrom/browser/chromeos/platform_keys is moved to ash.
#include "chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager.h"
@@ -88,7 +88,7 @@
const char kCertProfileIsVaEnabledKey[] = "enable_remote_attestation_check";
struct CertProfile {
- static base::Optional<CertProfile> MakeFromValue(const base::Value& value);
+ static absl::optional<CertProfile> MakeFromValue(const base::Value& value);
CertProfile();
// For tests.
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_platform_keys_helpers.cc b/chrome/browser/ash/cert_provisioning/cert_provisioning_platform_keys_helpers.cc
index e279aae..e3ca9e9 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_platform_keys_helpers.cc
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_platform_keys_helpers.cc
@@ -10,10 +10,10 @@
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/containers/flat_set.h"
-#include "base/optional.h"
#include "chrome/browser/ash/cert_provisioning/cert_provisioning_common.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace cert_provisioning {
@@ -78,7 +78,7 @@
void CertIterator::OnGetAttributeForKeyDone(
scoped_refptr<net::X509Certificate> cert,
- const base::Optional<std::string>& attr_value,
+ const absl::optional<std::string>& attr_value,
platform_keys::Status status) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(wait_counter_ > 0);
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_platform_keys_helpers.h b/chrome/browser/ash/cert_provisioning/cert_provisioning_platform_keys_helpers.h
index c770fdad..cbd6ea4 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_platform_keys_helpers.h
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_platform_keys_helpers.h
@@ -9,8 +9,8 @@
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ash/cert_provisioning/cert_provisioning_common.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): forward declare PlatformKeysService
// after //chrom/browser/chromeos/platform_keys is moved to ash.
#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h"
@@ -52,7 +52,7 @@
std::unique_ptr<net::CertificateList> existing_certs,
platform_keys::Status status);
void OnGetAttributeForKeyDone(scoped_refptr<net::X509Certificate> cert,
- const base::Optional<std::string>& attr_value,
+ const absl::optional<std::string>& attr_value,
platform_keys::Status status);
void StopIteration(platform_keys::Status status);
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_platform_keys_helpers_unittest.cc b/chrome/browser/ash/cert_provisioning/cert_provisioning_platform_keys_helpers_unittest.cc
index bcaf970..c8be9eb 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_platform_keys_helpers_unittest.cc
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_platform_keys_helpers_unittest.cc
@@ -157,7 +157,7 @@
certificate_helper_.AddCert(kCertScope, /*cert_profile_id=*/"id1");
certificate_helper_.AddCert(kCertScope, /*cert_profile_id=*/"id2");
- certificate_helper_.AddCert(kCertScope, /*cert_profile_id=*/base::nullopt,
+ certificate_helper_.AddCert(kCertScope, /*cert_profile_id=*/absl::nullopt,
kErrorStatus);
certificate_helper_.AddCert(kCertScope, /*cert_profile_id=*/"id3");
certificate_helper_.AddCert(kCertScope, /*cert_profile_id=*/"id4");
@@ -257,7 +257,7 @@
const CertScope kCertScope = CertScope::kDevice;
size_t cert_count = 4;
for (size_t i = 0; i < cert_count; ++i) {
- certificate_helper_.AddCert(kCertScope, /*cert_profile_id=*/base::nullopt);
+ certificate_helper_.AddCert(kCertScope, /*cert_profile_id=*/absl::nullopt);
}
GetterCallbackObserver callback_observer;
@@ -275,7 +275,7 @@
size_t cert_without_id_count = 4;
for (size_t i = 0; i < cert_without_id_count; ++i) {
- certificate_helper_.AddCert(kCertScope, /*cert_profile_id=*/base::nullopt);
+ certificate_helper_.AddCert(kCertScope, /*cert_profile_id=*/absl::nullopt);
}
std::vector<std::string> ids{"cert_profile_id_0", "cert_profile_id_1",
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler.cc b/chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler.cc
index 913097e..71cdc95 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler.cc
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler.cc
@@ -17,7 +17,6 @@
#include "base/logging.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/cert_provisioning/cert_provisioning_common.h"
#include "chrome/browser/ash/cert_provisioning/cert_provisioning_metrics.h"
@@ -33,6 +32,7 @@
#include "chromeos/network/network_state_handler.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace cert_provisioning {
@@ -354,7 +354,7 @@
EraseByKey(failed_cert_profiles_, cert_profile_id);
- base::Optional<CertProfile> cert_profile = GetOneCertProfile(cert_profile_id);
+ absl::optional<CertProfile> cert_profile = GetOneCertProfile(cert_profile_id);
if (!cert_profile) {
return;
}
@@ -553,7 +553,7 @@
OnVisibleStateChanged();
}
-base::Optional<CertProfile> CertProvisioningSchedulerImpl::GetOneCertProfile(
+absl::optional<CertProfile> CertProvisioningSchedulerImpl::GetOneCertProfile(
const CertProfileId& cert_profile_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -572,7 +572,7 @@
return CertProfile::MakeFromValue(cur_profile);
}
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<CertProfile> CertProvisioningSchedulerImpl::GetCertProfiles() {
@@ -586,7 +586,7 @@
std::vector<CertProfile> result_profiles;
for (const base::Value& cur_profile : profile_list->GetList()) {
- base::Optional<CertProfile> p = CertProfile::MakeFromValue(cur_profile);
+ absl::optional<CertProfile> p = CertProfile::MakeFromValue(cur_profile);
if (!p) {
LOG(WARNING) << "Failed to parse certificate profile";
continue;
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler.h b/chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler.h
index 7eb829f6..db08223 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler.h
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler.h
@@ -180,7 +180,7 @@
// Continues an existing worker if it is in a waiting state.
void ProcessProfile(const CertProfile& profile);
- base::Optional<CertProfile> GetOneCertProfile(
+ absl::optional<CertProfile> GetOneCertProfile(
const CertProfileId& cert_profile_id);
std::vector<CertProfile> GetCertProfiles();
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_serializer.cc b/chrome/browser/ash/cert_provisioning/cert_provisioning_serializer.cc
index d0be863a..6df0c81 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_serializer.cc
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_serializer.cc
@@ -6,11 +6,11 @@
#include "base/base64.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/cert_provisioning/cert_provisioning_common.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace cert_provisioning {
@@ -77,7 +77,7 @@
bool DeserializeRenewalPeriod(const base::Value& parent_value,
const char* value_name,
base::TimeDelta* dst) {
- base::Optional<int> serialized_time = parent_value.FindIntKey(value_name);
+ absl::optional<int> serialized_time = parent_value.FindIntKey(value_name);
*dst = base::TimeDelta::FromSeconds(serialized_time.value_or(0));
return true;
}
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_test_helpers.cc b/chrome/browser/ash/cert_provisioning/cert_provisioning_test_helpers.cc
index 60578b8..6da5d20 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_test_helpers.cc
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_test_helpers.cc
@@ -4,13 +4,13 @@
#include "chrome/browser/ash/cert_provisioning/cert_provisioning_test_helpers.h"
-#include "base/optional.h"
#include "base/test/gmock_callback_support.h"
#include "base/time/time.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chrome/test/base/testing_browser_process.h"
#include "net/test/cert_builder.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using base::test::RunOnceCallback;
using testing::_;
@@ -65,7 +65,7 @@
scoped_refptr<net::X509Certificate> CertificateHelperForTesting::AddCert(
CertScope cert_scope,
- const base::Optional<CertProfileId>& cert_profile_id,
+ const absl::optional<CertProfileId>& cert_profile_id,
platform_keys::Status status,
base::Time not_valid_before,
base::Time not_valid_after) {
@@ -88,7 +88,7 @@
scoped_refptr<net::X509Certificate> CertificateHelperForTesting::AddCert(
CertScope cert_scope,
- const base::Optional<CertProfileId>& cert_profile_id) {
+ const absl::optional<CertProfileId>& cert_profile_id) {
base::Time not_valid_before =
base::Time::Now() - base::TimeDelta::FromDays(1);
base::Time not_valid_after =
@@ -99,7 +99,7 @@
scoped_refptr<net::X509Certificate> CertificateHelperForTesting::AddCert(
CertScope cert_scope,
- const base::Optional<CertProfileId>& cert_profile_id,
+ const absl::optional<CertProfileId>& cert_profile_id,
platform_keys::Status status) {
base::Time not_valid_before =
base::Time::Now() - base::TimeDelta::FromDays(1);
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_test_helpers.h b/chrome/browser/ash/cert_provisioning/cert_provisioning_test_helpers.h
index e08836b2..8a05d3c 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_test_helpers.h
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_test_helpers.h
@@ -5,13 +5,13 @@
#ifndef CHROME_BROWSER_ASH_CERT_PROVISIONING_CERT_PROVISIONING_TEST_HELPERS_H_
#define CHROME_BROWSER_ASH_CERT_PROVISIONING_CERT_PROVISIONING_TEST_HELPERS_H_
-#include "base/optional.h"
#include "chrome/browser/ash/cert_provisioning/cert_provisioning_common.h"
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
#include "chrome/browser/chromeos/platform_keys/mock_platform_keys_service.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace user_manager {
class User;
@@ -39,7 +39,7 @@
// certificate.
scoped_refptr<net::X509Certificate> AddCert(
CertScope cert_scope,
- const base::Optional<CertProfileId>& cert_profile_id,
+ const absl::optional<CertProfileId>& cert_profile_id,
platform_keys::Status status,
base::Time not_valid_before,
base::Time not_valid_after);
@@ -48,13 +48,13 @@
// |cert_profile_id|.
scoped_refptr<net::X509Certificate> AddCert(
CertScope cert_scope,
- const base::Optional<CertProfileId>& cert_profile_id);
+ const absl::optional<CertProfileId>& cert_profile_id);
// Simplified version of AddCert(). The certificate is not expired, but fails
// to retrieve |cert_profile_id|.
scoped_refptr<net::X509Certificate> AddCert(
CertScope cert_scope,
- const base::Optional<CertProfileId>& cert_profile_id,
+ const absl::optional<CertProfileId>& cert_profile_id,
platform_keys::Status status);
void ClearCerts();
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_worker.cc b/chrome/browser/ash/cert_provisioning/cert_provisioning_worker.cc
index 0b5d868..2b4ec12 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_worker.cc
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_worker.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/attestation/tpm_challenge_key_result.h"
#include "chrome/browser/ash/cert_provisioning/cert_provisioning_common.h"
@@ -25,6 +24,7 @@
#include "content/public/browser/browser_context.h"
#include "net/cert/asn1_util.h"
#include "net/cert/x509_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace em = enterprise_management;
@@ -76,7 +76,7 @@
bool ConvertHashingAlgorithm(
em::HashingAlgorithm input_algo,
- base::Optional<chromeos::platform_keys::HashAlgorithm>* output_algo) {
+ absl::optional<chromeos::platform_keys::HashAlgorithm>* output_algo) {
switch (input_algo) {
case em::HashingAlgorithm::SHA1:
*output_algo =
@@ -459,8 +459,8 @@
void CertProvisioningWorkerImpl::OnStartCsrDone(
policy::DeviceManagementStatus status,
- base::Optional<CertProvisioningResponseErrorType> error,
- base::Optional<int64_t> try_later,
+ absl::optional<CertProvisioningResponseErrorType> error,
+ absl::optional<int64_t> try_later,
const std::string& invalidation_topic,
const std::string& va_challenge,
enterprise_management::HashingAlgorithm hashing_algorithm,
@@ -647,8 +647,8 @@
void CertProvisioningWorkerImpl::OnFinishCsrDone(
policy::DeviceManagementStatus status,
- base::Optional<CertProvisioningResponseErrorType> error,
- base::Optional<int64_t> try_later) {
+ absl::optional<CertProvisioningResponseErrorType> error,
+ absl::optional<int64_t> try_later) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!ProcessResponseErrors(DeviceManagementServerRequestType::kFinishCsr,
@@ -672,8 +672,8 @@
void CertProvisioningWorkerImpl::OnDownloadCertDone(
policy::DeviceManagementStatus status,
- base::Optional<CertProvisioningResponseErrorType> error,
- base::Optional<int64_t> try_later,
+ absl::optional<CertProvisioningResponseErrorType> error,
+ absl::optional<int64_t> try_later,
const std::string& pem_encoded_certificate) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -728,8 +728,8 @@
bool CertProvisioningWorkerImpl::ProcessResponseErrors(
DeviceManagementServerRequestType request_type,
policy::DeviceManagementStatus status,
- base::Optional<CertProvisioningResponseErrorType> error,
- base::Optional<int64_t> try_later) {
+ absl::optional<CertProvisioningResponseErrorType> error,
+ absl::optional<int64_t> try_later) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if ((status ==
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_worker.h b/chrome/browser/ash/cert_provisioning/cert_provisioning_worker.h
index 990daca..843a5ad 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_worker.h
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_worker.h
@@ -143,8 +143,8 @@
void StartCsr();
void OnStartCsrDone(policy::DeviceManagementStatus status,
- base::Optional<CertProvisioningResponseErrorType> error,
- base::Optional<int64_t> try_later,
+ absl::optional<CertProvisioningResponseErrorType> error,
+ absl::optional<int64_t> try_later,
const std::string& invalidation_topic,
const std::string& va_challenge,
enterprise_management::HashingAlgorithm hashing_algorithm,
@@ -170,14 +170,14 @@
void FinishCsr();
void OnFinishCsrDone(policy::DeviceManagementStatus status,
- base::Optional<CertProvisioningResponseErrorType> error,
- base::Optional<int64_t> try_later);
+ absl::optional<CertProvisioningResponseErrorType> error,
+ absl::optional<int64_t> try_later);
void DownloadCert();
void OnDownloadCertDone(
policy::DeviceManagementStatus status,
- base::Optional<CertProvisioningResponseErrorType> error,
- base::Optional<int64_t> try_later,
+ absl::optional<CertProvisioningResponseErrorType> error,
+ absl::optional<int64_t> try_later,
const std::string& pem_encoded_certificate);
void ImportCert(const std::string& pem_encoded_certificate);
@@ -221,8 +221,8 @@
bool ProcessResponseErrors(
DeviceManagementServerRequestType request_type,
policy::DeviceManagementStatus status,
- base::Optional<CertProvisioningResponseErrorType> error,
- base::Optional<int64_t> try_later);
+ absl::optional<CertProvisioningResponseErrorType> error,
+ absl::optional<int64_t> try_later);
CertScope cert_scope_ = CertScope::kUser;
Profile* profile_ = nullptr;
@@ -256,7 +256,7 @@
std::string csr_;
std::string va_challenge_;
std::string va_challenge_response_;
- base::Optional<platform_keys::HashAlgorithm> hashing_algorithm_;
+ absl::optional<platform_keys::HashAlgorithm> hashing_algorithm_;
std::string signature_;
// IMPORTANT:
diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_worker_unittest.cc b/chrome/browser/ash/cert_provisioning/cert_provisioning_worker_unittest.cc
index 9082904..9d12559 100644
--- a/chrome/browser/ash/cert_provisioning/cert_provisioning_worker_unittest.cc
+++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_worker_unittest.cc
@@ -165,8 +165,8 @@
.Times(1) \
.WillOnce(RunOnceCallback<4>( \
policy::DeviceManagementStatus::DM_STATUS_SUCCESS, \
- /*response_error=*/base::nullopt, \
- /*try_again_later_ms=*/base::nullopt, kInvalidationTopic, \
+ /*response_error=*/absl::nullopt, \
+ /*try_again_later_ms=*/absl::nullopt, kInvalidationTopic, \
kChallenge, HASHING_ALGO, kDataToSign)); \
}
@@ -176,8 +176,8 @@
.Times(1) \
.WillOnce(RunOnceCallback<4>( \
policy::DeviceManagementStatus::DM_STATUS_SUCCESS, \
- /*response_error=*/base::nullopt, \
- /*try_again_later_ms=*/base::nullopt, kInvalidationTopic, \
+ /*response_error=*/absl::nullopt, \
+ /*try_again_later_ms=*/absl::nullopt, kInvalidationTopic, \
/*va_challenge=*/"", HASHING_ALGO, kDataToSign)); \
}
@@ -187,7 +187,7 @@
.Times(1) \
.WillOnce(RunOnceCallback<4>( \
policy::DeviceManagementStatus::DM_STATUS_SUCCESS, \
- /*response_error=*/base::nullopt, \
+ /*response_error=*/absl::nullopt, \
/*try_again_later_ms=*/(DELAY_MS), kInvalidationTopic, \
/*va_challenge=*/"", \
enterprise_management::HashingAlgorithm:: \
@@ -201,8 +201,8 @@
.Times(1) \
.WillOnce(RunOnceCallback<4>( \
policy::DeviceManagementStatus::DM_STATUS_REQUEST_INVALID, \
- /*response_error=*/base::nullopt, \
- /*try_again_later_ms=*/base::nullopt, /*invalidation_topic=*/"", \
+ /*response_error=*/absl::nullopt, \
+ /*try_again_later_ms=*/absl::nullopt, /*invalidation_topic=*/"", \
/*va_challenge=*/"", \
enterprise_management::HashingAlgorithm:: \
HASHING_ALGORITHM_UNSPECIFIED, \
@@ -216,7 +216,7 @@
.WillOnce(RunOnceCallback<4>( \
policy::DeviceManagementStatus::DM_STATUS_SUCCESS, \
/*response_error=*/CertProvisioningResponseError::CA_ERROR, \
- /*try_again_later_ms=*/base::nullopt, /*invalidation_topic=*/"", \
+ /*try_again_later_ms=*/absl::nullopt, /*invalidation_topic=*/"", \
/*va_challenge=*/"", \
enterprise_management::HashingAlgorithm:: \
HASHING_ALGORITHM_UNSPECIFIED, \
@@ -229,8 +229,8 @@
.Times(1) \
.WillOnce(RunOnceCallback<4>( \
policy::DeviceManagementStatus::DM_STATUS_TEMPORARY_UNAVAILABLE, \
- /*response_error=*/base::nullopt, \
- /*try_again_later_ms=*/base::nullopt, /*invalidation_topic=*/"", \
+ /*response_error=*/absl::nullopt, \
+ /*try_again_later_ms=*/absl::nullopt, /*invalidation_topic=*/"", \
/*va_challenge=*/"", \
enterprise_management::HashingAlgorithm:: \
HASHING_ALGORITHM_UNSPECIFIED, \
@@ -243,8 +243,8 @@
.Times(1) \
.WillOnce(RunOnceCallback<4>(policy::DeviceManagementStatus:: \
DM_STATUS_SERVICE_ACTIVATION_PENDING, \
- /*response_error=*/base::nullopt, \
- /*try_again_later_ms=*/base::nullopt, \
+ /*response_error=*/absl::nullopt, \
+ /*try_again_later_ms=*/absl::nullopt, \
/*invalidation_topic=*/"", \
/*va_challenge=*/"", \
enterprise_management::HashingAlgorithm:: \
@@ -260,7 +260,7 @@
policy::DeviceManagementStatus:: \
DM_STATUS_SUCCESS, /*response_error=*/ \
CertProvisioningResponseError::INCONSISTENT_DATA, \
- /*try_again_later_ms=*/base::nullopt, /*invalidation_topic=*/"", \
+ /*try_again_later_ms=*/absl::nullopt, /*invalidation_topic=*/"", \
/*va_challenge=*/"", \
enterprise_management::HashingAlgorithm:: \
HASHING_ALGORITHM_UNSPECIFIED, \
@@ -275,8 +275,8 @@
EXPECT_CALL(cloud_policy_client_, FINISH_CSR_FUNC) \
.Times(1) \
.WillOnce(RunOnceCallback<6>( \
- policy::DeviceManagementStatus::DM_STATUS_SUCCESS, base::nullopt, \
- base::nullopt)); \
+ policy::DeviceManagementStatus::DM_STATUS_SUCCESS, absl::nullopt, \
+ absl::nullopt)); \
}
#define EXPECT_FINISH_CSR_TRY_LATER(FINISH_CSR_FUNC, DELAY_MS) \
@@ -284,7 +284,7 @@
EXPECT_CALL(cloud_policy_client_, FINISH_CSR_FUNC) \
.Times(1) \
.WillOnce(RunOnceCallback<6>( \
- policy::DeviceManagementStatus::DM_STATUS_SUCCESS, base::nullopt, \
+ policy::DeviceManagementStatus::DM_STATUS_SUCCESS, absl::nullopt, \
/*try_again_later_ms=*/(DELAY_MS))); \
}
@@ -294,7 +294,7 @@
.Times(1) \
.WillOnce(RunOnceCallback<6>(policy::DeviceManagementStatus:: \
DM_STATUS_SERVICE_ACTIVATION_PENDING, \
- base::nullopt, base::nullopt)); \
+ absl::nullopt, absl::nullopt)); \
}
#define EXPECT_DOWNLOAD_CERT_OK(DOWNLOAD_CERT_FUNC) \
@@ -302,8 +302,8 @@
EXPECT_CALL(cloud_policy_client_, DOWNLOAD_CERT_FUNC) \
.Times(1) \
.WillOnce(RunOnceCallback<4>( \
- policy::DeviceManagementStatus::DM_STATUS_SUCCESS, base::nullopt, \
- base::nullopt, kFakeCertificate)); \
+ policy::DeviceManagementStatus::DM_STATUS_SUCCESS, absl::nullopt, \
+ absl::nullopt, kFakeCertificate)); \
}
#define EXPECT_DOWNLOAD_CERT_SERVICE_ACTIVATION_PENDING(DOWNLOAD_CERT_FUNC) \
@@ -312,7 +312,7 @@
.Times(1) \
.WillOnce(RunOnceCallback<4>(policy::DeviceManagementStatus:: \
DM_STATUS_SERVICE_ACTIVATION_PENDING, \
- base::nullopt, base::nullopt, \
+ absl::nullopt, absl::nullopt, \
kFakeCertificate)); \
}
@@ -321,7 +321,7 @@
EXPECT_CALL(cloud_policy_client_, DOWNLOAD_CERT_FUNC) \
.Times(1) \
.WillOnce(RunOnceCallback<4>( \
- policy::DeviceManagementStatus::DM_STATUS_SUCCESS, base::nullopt, \
+ policy::DeviceManagementStatus::DM_STATUS_SUCCESS, absl::nullopt, \
/*try_again_later_ms=*/(DELAY_MS), /*certificate=*/"")); \
}
diff --git a/chrome/browser/ash/certificate_provider/certificate_provider_service.cc b/chrome/browser/ash/certificate_provider/certificate_provider_service.cc
index 58ccefd..cef574c7 100644
--- a/chrome/browser/ash/certificate_provider/certificate_provider_service.cc
+++ b/chrome/browser/ash/certificate_provider/certificate_provider_service.cc
@@ -319,7 +319,7 @@
const std::string& subject_public_key_info,
uint16_t algorithm,
base::span<const uint8_t> input,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
net::SSLPrivateKey::SignCallback callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
bool is_currently_provided = false;
@@ -442,7 +442,7 @@
const scoped_refptr<net::X509Certificate>& certificate,
uint16_t algorithm,
base::span<const uint8_t> input,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
net::SSLPrivateKey::SignCallback callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/chrome/browser/ash/certificate_provider/certificate_provider_service.h b/chrome/browser/ash/certificate_provider/certificate_provider_service.h
index 08fcdb14..f464500 100644
--- a/chrome/browser/ash/certificate_provider/certificate_provider_service.h
+++ b/chrome/browser/ash/certificate_provider/certificate_provider_service.h
@@ -17,7 +17,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "chrome/browser/ash/certificate_provider/certificate_info.h"
#include "chrome/browser/ash/certificate_provider/certificate_requests.h"
@@ -29,6 +28,7 @@
#include "net/cert/x509_certificate.h"
#include "net/ssl/client_cert_identity.h"
#include "net/ssl/ssl_private_key.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -192,7 +192,7 @@
const std::string& subject_public_key_info,
uint16_t algorithm,
base::span<const uint8_t> input,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
net::SSLPrivateKey::SignCallback callback);
// Looks up the certificate identified by |subject_public_key_info|. If any
@@ -243,7 +243,7 @@
const scoped_refptr<net::X509Certificate>& certificate,
uint16_t algorithm,
base::span<const uint8_t> input,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
net::SSLPrivateKey::SignCallback callback);
std::unique_ptr<Delegate> delegate_;
diff --git a/chrome/browser/ash/certificate_provider/pin_dialog_manager.cc b/chrome/browser/ash/certificate_provider/pin_dialog_manager.cc
index 062f2ab..208e3503 100644
--- a/chrome/browser/ash/certificate_provider/pin_dialog_manager.cc
+++ b/chrome/browser/ash/certificate_provider/pin_dialog_manager.cc
@@ -22,7 +22,7 @@
void PinDialogManager::AddSignRequestId(
const std::string& extension_id,
int sign_request_id,
- const base::Optional<AccountId>& authenticating_user_account_id) {
+ const absl::optional<AccountId>& authenticating_user_account_id) {
ExtensionNameRequestIdPair key(extension_id, sign_request_id);
sign_requests_.insert(
std::make_pair(key, SignRequestState(/*begin_time=*/base::Time::Now(),
@@ -182,7 +182,7 @@
PinDialogManager::SignRequestState::SignRequestState(
base::Time begin_time,
- const base::Optional<AccountId>& authenticating_user_account_id)
+ const absl::optional<AccountId>& authenticating_user_account_id)
: begin_time(begin_time),
authenticating_user_account_id(authenticating_user_account_id) {}
diff --git a/chrome/browser/ash/certificate_provider/pin_dialog_manager.h b/chrome/browser/ash/certificate_provider/pin_dialog_manager.h
index 74ea27b..b9cbf48 100644
--- a/chrome/browser/ash/certificate_provider/pin_dialog_manager.h
+++ b/chrome/browser/ash/certificate_provider/pin_dialog_manager.h
@@ -13,12 +13,12 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/certificate_provider/security_token_pin_dialog_host.h"
#include "chrome/browser/ash/certificate_provider/security_token_pin_dialog_host_popup_impl.h"
#include "chromeos/components/security_token_pin/constants.h"
#include "components/account_id/account_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -53,7 +53,7 @@
void AddSignRequestId(
const std::string& extension_id,
int sign_request_id,
- const base::Optional<AccountId>& authenticating_user_account_id);
+ const absl::optional<AccountId>& authenticating_user_account_id);
// Removes the specified sign request, aborting both the current and the
// future PIN dialogs related to it.
@@ -124,13 +124,13 @@
struct SignRequestState {
SignRequestState(
base::Time begin_time,
- const base::Optional<AccountId>& authenticating_user_account_id);
+ const absl::optional<AccountId>& authenticating_user_account_id);
SignRequestState(const SignRequestState&);
SignRequestState& operator=(const SignRequestState&);
~SignRequestState();
base::Time begin_time;
- base::Optional<AccountId> authenticating_user_account_id;
+ absl::optional<AccountId> authenticating_user_account_id;
};
// Holds information related to the currently opened PIN dialog.
@@ -192,7 +192,7 @@
// There can be only one active dialog to request the PIN at any point of
// time.
- base::Optional<ActiveDialogState> active_dialog_state_;
+ absl::optional<ActiveDialogState> active_dialog_state_;
base::WeakPtrFactory<PinDialogManager> weak_factory_{this};
};
diff --git a/chrome/browser/ash/certificate_provider/security_token_pin_dialog_host.h b/chrome/browser/ash/certificate_provider/security_token_pin_dialog_host.h
index 3bac133c..d0c97798 100644
--- a/chrome/browser/ash/certificate_provider/security_token_pin_dialog_host.h
+++ b/chrome/browser/ash/certificate_provider/security_token_pin_dialog_host.h
@@ -8,9 +8,9 @@
#include <string>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chromeos/components/security_token_pin/constants.h"
#include "components/account_id/account_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -57,7 +57,7 @@
bool enable_user_input,
security_token_pin::ErrorLabel error_label,
int attempts_left,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
SecurityTokenPinEnteredCallback pin_entered_callback,
SecurityTokenPinDialogClosedCallback pin_dialog_closed_callback) = 0;
diff --git a/chrome/browser/ash/certificate_provider/security_token_pin_dialog_host_popup_impl.cc b/chrome/browser/ash/certificate_provider/security_token_pin_dialog_host_popup_impl.cc
index 7f8601f..1f21fe3 100644
--- a/chrome/browser/ash/certificate_provider/security_token_pin_dialog_host_popup_impl.cc
+++ b/chrome/browser/ash/certificate_provider/security_token_pin_dialog_host_popup_impl.cc
@@ -50,7 +50,7 @@
bool enable_user_input,
security_token_pin::ErrorLabel error_label,
int attempts_left,
- const base::Optional<AccountId>& /*authenticating_user_account_id*/,
+ const absl::optional<AccountId>& /*authenticating_user_account_id*/,
SecurityTokenPinEnteredCallback pin_entered_callback,
SecurityTokenPinDialogClosedCallback pin_dialog_closed_callback) {
DCHECK(!caller_extension_name.empty());
diff --git a/chrome/browser/ash/certificate_provider/security_token_pin_dialog_host_popup_impl.h b/chrome/browser/ash/certificate_provider/security_token_pin_dialog_host_popup_impl.h
index 16a01d68..56bd5b31 100644
--- a/chrome/browser/ash/certificate_provider/security_token_pin_dialog_host_popup_impl.h
+++ b/chrome/browser/ash/certificate_provider/security_token_pin_dialog_host_popup_impl.h
@@ -38,7 +38,7 @@
bool enable_user_input,
security_token_pin::ErrorLabel error_label,
int attempts_left,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
SecurityTokenPinEnteredCallback pin_entered_callback,
SecurityTokenPinDialogClosedCallback pin_dialog_closed_callback) override;
void CloseSecurityTokenPinDialog() override;
diff --git a/chrome/browser/ash/certificate_provider/sign_requests.cc b/chrome/browser/ash/certificate_provider/sign_requests.cc
index 07271791..319c9f4 100644
--- a/chrome/browser/ash/certificate_provider/sign_requests.cc
+++ b/chrome/browser/ash/certificate_provider/sign_requests.cc
@@ -9,7 +9,7 @@
SignRequests::Request::Request(
const scoped_refptr<net::X509Certificate>& certificate,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
net::SSLPrivateKey::SignCallback callback)
: certificate(certificate),
authenticating_user_account_id(authenticating_user_account_id),
@@ -34,7 +34,7 @@
int SignRequests::AddRequest(
const std::string& extension_id,
const scoped_refptr<net::X509Certificate>& certificate,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
net::SSLPrivateKey::SignCallback callback) {
RequestsState& state = extension_to_requests_[extension_id];
const int request_id = state.next_free_id++;
diff --git a/chrome/browser/ash/certificate_provider/sign_requests.h b/chrome/browser/ash/certificate_provider/sign_requests.h
index b44a498..e95fd271 100644
--- a/chrome/browser/ash/certificate_provider/sign_requests.h
+++ b/chrome/browser/ash/certificate_provider/sign_requests.h
@@ -12,10 +12,10 @@
#include "base/callback.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "components/account_id/account_id.h"
#include "net/cert/x509_certificate.h"
#include "net/ssl/ssl_private_key.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace certificate_provider {
@@ -32,7 +32,7 @@
int AddRequest(
const std::string& extension_id,
const scoped_refptr<net::X509Certificate>& certificate,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
net::SSLPrivateKey::SignCallback callback);
// Returns the list of requests that correspond to the authentication of the
@@ -56,14 +56,14 @@
private:
struct Request {
Request(const scoped_refptr<net::X509Certificate>& certificate,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
net::SSLPrivateKey::SignCallback callback);
Request(Request&& other);
Request& operator=(Request&&);
~Request();
scoped_refptr<net::X509Certificate> certificate;
- base::Optional<AccountId> authenticating_user_account_id;
+ absl::optional<AccountId> authenticating_user_account_id;
net::SSLPrivateKey::SignCallback callback;
};
diff --git a/chrome/browser/ash/certificate_provider/test_certificate_provider_extension.cc b/chrome/browser/ash/certificate_provider/test_certificate_provider_extension.cc
index 0eba316..e72297b 100644
--- a/chrome/browser/ash/certificate_provider/test_certificate_provider_extension.cc
+++ b/chrome/browser/ash/certificate_provider/test_certificate_provider_extension.cc
@@ -15,7 +15,6 @@
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
@@ -36,6 +35,7 @@
#include "net/cert/x509_util.h"
#include "net/test/cert_test_util.h"
#include "net/test/test_data_directory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/boringssl/src/include/openssl/rsa.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
@@ -98,7 +98,7 @@
}
base::Value ParseJsonToValue(const std::string& json) {
- base::Optional<base::Value> value = base::JSONReader::Read(json);
+ absl::optional<base::Value> value = base::JSONReader::Read(json);
CHECK(value);
return std::move(*value);
}
diff --git a/chrome/browser/ash/certificate_provider/test_certificate_provider_extension.h b/chrome/browser/ash/certificate_provider/test_certificate_provider_extension.h
index 388ed3bf..f8ae9fac 100644
--- a/chrome/browser/ash/certificate_provider/test_certificate_provider_extension.h
+++ b/chrome/browser/ash/certificate_provider/test_certificate_provider_extension.h
@@ -11,12 +11,12 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/values.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/common/extension_id.h"
#include "net/cert/x509_certificate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/boringssl/src/include/openssl/base.h"
namespace base {
@@ -107,7 +107,7 @@
int certificate_request_count_ = 0;
// When non-empty, contains the expected PIN; the implementation will request
// the PIN on every signature request in this case.
- base::Optional<std::string> required_pin_;
+ absl::optional<std::string> required_pin_;
// The number of remaining PIN attempts.
// When equal to zero, signature requests will be failed immediately; when is
// negative, infinite number of attempts is allowed.
diff --git a/chrome/browser/ash/child_accounts/child_policy_observer.cc b/chrome/browser/ash/child_accounts/child_policy_observer.cc
index e9a2266..794352d7 100644
--- a/chrome/browser/ash/child_accounts/child_policy_observer.cc
+++ b/chrome/browser/ash/child_accounts/child_policy_observer.cc
@@ -4,18 +4,18 @@
#include "chrome/browser/ash/child_accounts/child_policy_observer.h"
-#include "base/optional.h"
#include "base/timer/timer.h"
#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
#include "chrome/browser/profiles/profile.h"
#include "components/policy/core/common/cloud/cloud_policy_core.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
ChildPolicyObserver::ChildPolicyObserver(Profile* profile) : profile_(profile) {
policy::CloudPolicyService* cloud_policy_service =
GetUserCloudPolicyManager()->core()->service();
- base::Optional<bool> initial_policy_refresh_result =
+ absl::optional<bool> initial_policy_refresh_result =
cloud_policy_service->initial_policy_refresh_result();
if (initial_policy_refresh_result) {
OnPolicyReady(*initial_policy_refresh_result
diff --git a/chrome/browser/ash/child_accounts/child_user_service.cc b/chrome/browser/ash/child_accounts/child_user_service.cc
index 8554296..b6809b4 100644
--- a/chrome/browser/ash/child_accounts/child_user_service.cc
+++ b/chrome/browser/ash/child_accounts/child_user_service.cc
@@ -58,7 +58,7 @@
app_time_controller_->web_time_enforcer();
DCHECK(web_time_enforcer);
- const base::Optional<app_time::AppLimit>& time_limit =
+ const absl::optional<app_time::AppLimit>& time_limit =
app_time_controller_->app_registry()->GetWebTimeLimit();
DCHECK(time_limit.has_value());
DCHECK_EQ(time_limit->restriction(), app_time::AppRestriction::kTimeLimit);
@@ -81,11 +81,11 @@
web_time_enforcer->OnWebTimeLimitEnded();
}
-base::Optional<base::TimeDelta> ChildUserService::GetTimeLimitForApp(
+absl::optional<base::TimeDelta> ChildUserService::GetTimeLimitForApp(
const std::string& app_service_id,
apps::mojom::AppType app_type) {
if (!app_time_controller_)
- return base::nullopt;
+ return absl::nullopt;
return app_time_controller_->GetTimeLimitForApp(app_service_id, app_type);
}
diff --git a/chrome/browser/ash/child_accounts/child_user_service.h b/chrome/browser/ash/child_accounts/child_user_service.h
index d4709a17..308ea52 100644
--- a/chrome/browser/ash/child_accounts/child_user_service.h
+++ b/chrome/browser/ash/child_accounts/child_user_service.h
@@ -68,7 +68,7 @@
// app_time::AppTimeLimitInterface:
void PauseWebActivity(const std::string& app_service_id) override;
void ResumeWebActivity(const std::string& app_service_id) override;
- base::Optional<base::TimeDelta> GetTimeLimitForApp(
+ absl::optional<base::TimeDelta> GetTimeLimitForApp(
const std::string& app_service_id,
apps::mojom::AppType app_type) override;
diff --git a/chrome/browser/ash/child_accounts/family_user_device_metrics_browsertest.cc b/chrome/browser/ash/child_accounts/family_user_device_metrics_browsertest.cc
index 0b5157f..41ca6de1 100644
--- a/chrome/browser/ash/child_accounts/family_user_device_metrics_browsertest.cc
+++ b/chrome/browser/ash/child_accounts/family_user_device_metrics_browsertest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include <tuple>
-#include "base/optional.h"
#include "base/test/metrics/histogram_tester.h"
#include "chrome/browser/ash/login/test/device_state_mixin.h"
#include "chrome/browser/ash/login/test/logged_in_user_mixin.h"
@@ -20,6 +19,7 @@
#include "components/user_manager/user_manager.h"
#include "components/user_manager/user_type.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -53,7 +53,7 @@
embedded_test_server(),
this,
/*should_launch_browser=*/false,
- /*account_id=*/base::nullopt,
+ /*account_id=*/absl::nullopt,
/*include_initial_user=*/IsUserExisting()};
// MixinBasedInProcessBrowserTest:
diff --git a/chrome/browser/ash/child_accounts/parent_access_code/authenticator.cc b/chrome/browser/ash/child_accounts/parent_access_code/authenticator.cc
index addd448..03f85d3 100644
--- a/chrome/browser/ash/child_accounts/parent_access_code/authenticator.cc
+++ b/chrome/browser/ash/child_accounts/parent_access_code/authenticator.cc
@@ -33,23 +33,23 @@
} // namespace
// static
-base::Optional<AccessCodeConfig> AccessCodeConfig::FromDictionary(
+absl::optional<AccessCodeConfig> AccessCodeConfig::FromDictionary(
const base::DictionaryValue& dict) {
const std::string* secret = dict.FindStringKey(kSharedSecretDictKey);
if (!secret || secret->empty())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<int> validity = dict.FindIntKey(kCodeValidityDictKey);
+ absl::optional<int> validity = dict.FindIntKey(kCodeValidityDictKey);
if (!(validity.has_value() && *validity >= kMinCodeValidity.InSeconds() &&
*validity <= kMaxCodeValidity.InSeconds())) {
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<int> clock_drift = dict.FindIntKey(kClockDriftDictKey);
+ absl::optional<int> clock_drift = dict.FindIntKey(kClockDriftDictKey);
if (!(clock_drift.has_value() &&
*clock_drift >= kMinClockDriftTolerance.InSeconds() &&
*clock_drift <= kMaxClockDriftTolerance.InSeconds())) {
- return base::nullopt;
+ return absl::nullopt;
}
return AccessCodeConfig(*secret, base::TimeDelta::FromSeconds(*validity),
@@ -126,7 +126,7 @@
Authenticator::~Authenticator() = default;
-base::Optional<AccessCode> Authenticator::Generate(base::Time timestamp) const {
+absl::optional<AccessCode> Authenticator::Generate(base::Time timestamp) const {
DCHECK_LE(base::Time::UnixEpoch(), timestamp);
// We find the beginning of the interval for the given timestamp and adjust by
@@ -146,7 +146,7 @@
std::vector<uint8_t> digest(hmac_.DigestLength());
if (!hmac_.Sign(big_endian_timestamp, &digest[0], digest.size())) {
LOG(ERROR) << "Signing HMAC data to generate Parent Access Code failed";
- return base::nullopt;
+ return absl::nullopt;
}
// Read 4 bytes in Big-endian order starting from |offset|.
@@ -164,7 +164,7 @@
valid_from + config_.code_validity());
}
-base::Optional<AccessCode> Authenticator::Validate(const std::string& code,
+absl::optional<AccessCode> Authenticator::Validate(const std::string& code,
base::Time timestamp) const {
DCHECK_LE(base::Time::UnixEpoch(), timestamp);
@@ -175,7 +175,7 @@
timestamp + config_.clock_drift_tolerance());
}
-base::Optional<AccessCode> Authenticator::ValidateInRange(
+absl::optional<AccessCode> Authenticator::ValidateInRange(
const std::string& code,
base::Time valid_from,
base::Time valid_to) const {
@@ -189,11 +189,11 @@
for (int i = start_interval; i <= end_interval; ++i) {
const base::Time generation_timestamp =
base::Time::FromJavaTime(i * kAccessCodeGranularity.InMilliseconds());
- base::Optional<AccessCode> pac = Generate(generation_timestamp);
+ absl::optional<AccessCode> pac = Generate(generation_timestamp);
if (pac.has_value() && pac->code() == code)
return pac;
}
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace parent_access
diff --git a/chrome/browser/ash/child_accounts/parent_access_code/authenticator.h b/chrome/browser/ash/child_accounts/parent_access_code/authenticator.h
index 62ddf0ce..b7a6ac0 100644
--- a/chrome/browser/ash/child_accounts/parent_access_code/authenticator.h
+++ b/chrome/browser/ash/child_accounts/parent_access_code/authenticator.h
@@ -10,10 +10,10 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "components/account_id/account_id.h"
#include "crypto/hmac.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class DictionaryValue;
@@ -28,7 +28,7 @@
public:
// Returns AccessCodeConfig created from a |dictionary|, if the |dictionary|
// contains valid config data.
- static base::Optional<AccessCodeConfig> FromDictionary(
+ static absl::optional<AccessCodeConfig> FromDictionary(
const base::DictionaryValue& value);
// TODO(agawronska): Make constructor private.
@@ -118,12 +118,12 @@
// Generates parent access code from the given |timestamp|. Returns the code
// if generation was successful. |timestamp| needs to be greater or equal Unix
// Epoch.
- base::Optional<AccessCode> Generate(base::Time timestamp) const;
+ absl::optional<AccessCode> Generate(base::Time timestamp) const;
// Returns AccessCode structure with validity information, if |code| is
// valid for the given timestamp. |timestamp| needs to be greater or equal
// Unix Epoch.
- base::Optional<AccessCode> Validate(const std::string& code,
+ absl::optional<AccessCode> Validate(const std::string& code,
base::Time timestamp) const;
private:
@@ -131,7 +131,7 @@
// for the range [|valid_from|, |valid_to|). |valid_to| needs to be greater or
// equal to |valid_from|. |valid_from| needs to be greater or equal Unix
// Epoch.
- base::Optional<AccessCode> ValidateInRange(const std::string& code,
+ absl::optional<AccessCode> ValidateInRange(const std::string& code,
base::Time valid_from,
base::Time valid_to) const;
diff --git a/chrome/browser/ash/child_accounts/parent_access_code/authenticator_unittest.cc b/chrome/browser/ash/child_accounts/parent_access_code/authenticator_unittest.cc
index 161aeb7..90e0ff2 100644
--- a/chrome/browser/ash/child_accounts/parent_access_code/authenticator_unittest.cc
+++ b/chrome/browser/ash/child_accounts/parent_access_code/authenticator_unittest.cc
@@ -9,10 +9,10 @@
#include "base/macros.h"
#include "base/numerics/safe_conversions.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/child_accounts/parent_access_code/parent_access_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace parent_access {
@@ -28,7 +28,7 @@
~ParentAccessCodeAuthenticatorTest() override = default;
// Verifies that |code| is valid for the given |timestamp|.
- void Verify(base::Optional<AccessCode> code, base::Time timestamp) {
+ void Verify(absl::optional<AccessCode> code, base::Time timestamp) {
ASSERT_TRUE(code.has_value());
EXPECT_GE(timestamp, code->valid_from());
EXPECT_LE(timestamp, code->valid_to());
@@ -46,7 +46,7 @@
Authenticator gen(GetDefaultTestConfig());
for (const auto& it : test_values) {
- base::Optional<AccessCode> code = gen.Generate(it.first);
+ absl::optional<AccessCode> code = gen.Generate(it.first);
ASSERT_NO_FATAL_FAILURE(Verify(code, it.first));
EXPECT_EQ(it.second, code->code());
}
@@ -60,7 +60,7 @@
const AccessCodeConfig config = GetDefaultTestConfig();
Authenticator gen(GetDefaultTestConfig());
- base::Optional<AccessCode> first_code = gen.Generate(timestamp);
+ absl::optional<AccessCode> first_code = gen.Generate(timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(first_code, timestamp));
int range = base::ClampFloor(config.code_validity() /
@@ -68,7 +68,7 @@
1;
for (int i = 0; i < range; ++i) {
timestamp += Authenticator::kAccessCodeGranularity;
- base::Optional<AccessCode> code = gen.Generate(timestamp);
+ absl::optional<AccessCode> code = gen.Generate(timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(code, timestamp));
EXPECT_EQ(*first_code, *code);
}
@@ -82,21 +82,21 @@
base::Time::FromString("14 Jan 2019 15:00:00 PST", &initial_timestamp));
Authenticator gen(GetDefaultTestConfig());
- base::Optional<AccessCode> first_code = gen.Generate(initial_timestamp);
+ absl::optional<AccessCode> first_code = gen.Generate(initial_timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(first_code, initial_timestamp));
for (int i = 1; i < 10; ++i) {
// "Earlier" time bucket.
{
const base::Time timestamp = initial_timestamp - i * kDefaultCodeValidity;
- base::Optional<AccessCode> code = gen.Generate(timestamp);
+ absl::optional<AccessCode> code = gen.Generate(timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(code, timestamp));
EXPECT_NE(*first_code, *code);
}
// "Later" time bucket.
{
const base::Time timestamp = initial_timestamp + i * kDefaultCodeValidity;
- base::Optional<AccessCode> code = gen.Generate(timestamp);
+ absl::optional<AccessCode> code = gen.Generate(timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(code, timestamp));
EXPECT_NE(*first_code, *code);
}
@@ -109,11 +109,11 @@
const base::Time timestamp = base::Time::Now();
Authenticator gen1(GetDefaultTestConfig());
- base::Optional<AccessCode> code1 = gen1.Generate(timestamp);
+ absl::optional<AccessCode> code1 = gen1.Generate(timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(code1, timestamp));
Authenticator gen2(GetDefaultTestConfig());
- base::Optional<AccessCode> code2 = gen2.Generate(timestamp);
+ absl::optional<AccessCode> code2 = gen2.Generate(timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(code2, timestamp));
EXPECT_EQ(*code1, *code2);
@@ -125,12 +125,12 @@
Authenticator gen1(AccessCodeConfig(
"AAAAAAAAAAAAAAAAAAA", kDefaultCodeValidity, kDefaultClockDrift));
- base::Optional<AccessCode> code1 = gen1.Generate(timestamp);
+ absl::optional<AccessCode> code1 = gen1.Generate(timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(code1, timestamp));
Authenticator gen2(AccessCodeConfig(
"AAAAAAAAAAAAAAAAAAB", kDefaultCodeValidity, kDefaultClockDrift));
- base::Optional<AccessCode> code2 = gen2.Generate(timestamp);
+ absl::optional<AccessCode> code2 = gen2.Generate(timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(code2, timestamp));
EXPECT_NE(*code1, *code2);
@@ -142,12 +142,12 @@
Authenticator gen1(AccessCodeConfig(
kTestSharedSecret, base::TimeDelta::FromMinutes(1), kDefaultClockDrift));
- base::Optional<AccessCode> code1 = gen1.Generate(timestamp);
+ absl::optional<AccessCode> code1 = gen1.Generate(timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(code1, timestamp));
Authenticator gen2(AccessCodeConfig(
kTestSharedSecret, base::TimeDelta::FromMinutes(3), kDefaultClockDrift));
- base::Optional<AccessCode> code2 = gen2.Generate(timestamp);
+ absl::optional<AccessCode> code2 = gen2.Generate(timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(code2, timestamp));
EXPECT_NE(*code1, *code2);
@@ -160,12 +160,12 @@
Authenticator gen1(AccessCodeConfig(kTestSharedSecret, kDefaultCodeValidity,
base::TimeDelta::FromMinutes(1)));
- base::Optional<AccessCode> code1 = gen1.Generate(timestamp);
+ absl::optional<AccessCode> code1 = gen1.Generate(timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(code1, timestamp));
Authenticator gen2(AccessCodeConfig(kTestSharedSecret, kDefaultCodeValidity,
base::TimeDelta::FromMinutes(10)));
- base::Optional<AccessCode> code2 = gen2.Generate(timestamp);
+ absl::optional<AccessCode> code2 = gen2.Generate(timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(code2, timestamp));
EXPECT_EQ(*code1, *code2);
@@ -180,7 +180,7 @@
Authenticator gen(AccessCodeConfig(kTestSharedSecret, kDefaultCodeValidity,
base::TimeDelta::FromMinutes(0)));
for (const auto& it : test_values) {
- base::Optional<AccessCode> code = gen.Validate(it.second, it.first);
+ absl::optional<AccessCode> code = gen.Validate(it.second, it.first);
ASSERT_NO_FATAL_FAILURE(Verify(code, it.first));
EXPECT_EQ(it.second, code->code());
}
@@ -199,12 +199,12 @@
ASSERT_TRUE(base::Time::FromString("15 Jan 2019 00:00:00 PST",
&generation_timestamp));
- base::Optional<AccessCode> generated_code =
+ absl::optional<AccessCode> generated_code =
generator.Generate(generation_timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(generated_code, generation_timestamp));
// Before valid period.
- base::Optional<AccessCode> validated_code = validator.Validate(
+ absl::optional<AccessCode> validated_code = validator.Validate(
generated_code->code(),
generation_timestamp - base::TimeDelta::FromSeconds(1));
EXPECT_FALSE(validated_code);
@@ -237,12 +237,12 @@
ASSERT_TRUE(base::Time::FromString("15 Jan 2019 00:00:00 PST",
&generation_timestamp));
- base::Optional<AccessCode> generated_code =
+ absl::optional<AccessCode> generated_code =
authenticator.Generate(generation_timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(generated_code, generation_timestamp));
// Before valid period.
- base::Optional<AccessCode> validated_code = authenticator.Validate(
+ absl::optional<AccessCode> validated_code = authenticator.Validate(
generated_code->code(),
generation_timestamp - base::TimeDelta::FromSeconds(1));
EXPECT_FALSE(validated_code);
@@ -278,7 +278,7 @@
ASSERT_TRUE(base::Time::FromString("15 Jan 2019 15:30:00 PST",
&generation_timestamp));
- base::Optional<AccessCode> generated_code =
+ absl::optional<AccessCode> generated_code =
generator.Generate(generation_timestamp);
ASSERT_NO_FATAL_FAILURE(Verify(generated_code, generation_timestamp));
@@ -286,8 +286,8 @@
int range = base::ClampFloor(kDefaultCodeValidity /
Authenticator::kAccessCodeGranularity);
base::Time timestamp;
- base::Optional<AccessCode> validated_code_no_tolerance;
- base::Optional<AccessCode> validated_code_with_tolerance;
+ absl::optional<AccessCode> validated_code_no_tolerance;
+ absl::optional<AccessCode> validated_code_with_tolerance;
for (int i = 0; i < range; ++i) {
timestamp =
generation_timestamp + i * Authenticator::kAccessCodeGranularity;
@@ -351,9 +351,9 @@
const base::Time unix_epoch = base::Time::UnixEpoch();
Authenticator authenticator(GetDefaultTestConfig());
- base::Optional<AccessCode> generated = authenticator.Generate(unix_epoch);
+ absl::optional<AccessCode> generated = authenticator.Generate(unix_epoch);
ASSERT_NO_FATAL_FAILURE(Verify(generated, unix_epoch));
- base::Optional<AccessCode> validated =
+ absl::optional<AccessCode> validated =
authenticator.Validate(generated->code(), unix_epoch);
ASSERT_NO_FATAL_FAILURE(Verify(validated, unix_epoch));
EXPECT_EQ(generated, validated);
diff --git a/chrome/browser/ash/child_accounts/parent_access_code/config_source.cc b/chrome/browser/ash/child_accounts/parent_access_code/config_source.cc
index 541b736..adc20a2 100644
--- a/chrome/browser/ash/child_accounts/parent_access_code/config_source.cc
+++ b/chrome/browser/ash/child_accounts/parent_access_code/config_source.cc
@@ -80,7 +80,7 @@
if (!dict.is_dict())
return;
- base::Optional<AccessCodeConfig> code_config =
+ absl::optional<AccessCodeConfig> code_config =
AccessCodeConfig::FromDictionary(
static_cast<const base::DictionaryValue&>(dict));
if (code_config) {
diff --git a/chrome/browser/ash/child_accounts/parent_access_code/config_source.h b/chrome/browser/ash/child_accounts/parent_access_code/config_source.h
index 2a866f9..153dd5cd 100644
--- a/chrome/browser/ash/child_accounts/parent_access_code/config_source.h
+++ b/chrome/browser/ash/child_accounts/parent_access_code/config_source.h
@@ -10,8 +10,8 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ash/child_accounts/parent_access_code/authenticator.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class AccountId;
diff --git a/chrome/browser/ash/child_accounts/parent_access_code/parent_access_service.h b/chrome/browser/ash/child_accounts/parent_access_code/parent_access_service.h
index cd467f5..c8db379 100644
--- a/chrome/browser/ash/child_accounts/parent_access_code/parent_access_service.h
+++ b/chrome/browser/ash/child_accounts/parent_access_code/parent_access_service.h
@@ -38,7 +38,7 @@
// specifically to the account identified by the parameter.
virtual void OnAccessCodeValidation(
ParentCodeValidationResult result,
- base::Optional<AccountId> account_id) = 0;
+ absl::optional<AccountId> account_id) = 0;
};
// Registers preferences.
diff --git a/chrome/browser/ash/child_accounts/parent_access_code/parent_access_service_browsertest.cc b/chrome/browser/ash/child_accounts/parent_access_code/parent_access_service_browsertest.cc
index d1b202c4..f62574c 100644
--- a/chrome/browser/ash/child_accounts/parent_access_code/parent_access_service_browsertest.cc
+++ b/chrome/browser/ash/child_accounts/parent_access_code/parent_access_service_browsertest.cc
@@ -69,7 +69,7 @@
~TestParentAccessServiceObserver() override = default;
void OnAccessCodeValidation(ParentCodeValidationResult result,
- base::Optional<AccountId> account_id) override {
+ absl::optional<AccountId> account_id) override {
ASSERT_TRUE(account_id);
EXPECT_EQ(account_id_, account_id.value());
result == ParentCodeValidationResult::kValid
@@ -148,7 +148,7 @@
embedded_test_server(),
this,
true /*should_launch_browser*/,
- base::nullopt /*account_id*/,
+ absl::nullopt /*account_id*/,
true /*include_initial_user*/};
std::unique_ptr<TestParentAccessServiceObserver> test_observer_;
diff --git a/chrome/browser/ash/child_accounts/screen_time_controller.cc b/chrome/browser/ash/child_accounts/screen_time_controller.cc
index 7a93804..f938d78 100644
--- a/chrome/browser/ash/child_accounts/screen_time_controller.cc
+++ b/chrome/browser/ash/child_accounts/screen_time_controller.cc
@@ -147,7 +147,7 @@
base::Time now = clock_->Now();
const icu::TimeZone& time_zone =
system::TimezoneSettings::GetInstance()->GetTimezone();
- base::Optional<usage_time_limit::State> last_state = GetLastStateFromPref();
+ absl::optional<usage_time_limit::State> last_state = GetLastStateFromPref();
const base::DictionaryValue* time_limit =
pref_service_->GetDictionary(prefs::kUsageTimeLimit);
const base::DictionaryValue* local_override =
@@ -168,7 +168,7 @@
ForceScreenLockByPolicy();
} else {
OnScreenLockByPolicyEnd();
- base::Optional<TimeLimitNotifier::LimitType> notification_type =
+ absl::optional<TimeLimitNotifier::LimitType> notification_type =
ConvertPolicyType(state.next_state_active_policy);
if (notification_type.has_value()) {
// Schedule notification based on the remaining screen time until lock.
@@ -187,11 +187,11 @@
auto updated_policy_types =
usage_time_limit::UpdatedPolicyTypes(*last_policy_, *time_limit);
for (const auto& policy_type : updated_policy_types) {
- base::Optional<base::Time> lock_time;
+ absl::optional<base::Time> lock_time;
if (policy_type == usage_time_limit::PolicyType::kOverride)
lock_time = state.next_state_change_time;
- base::Optional<TimeLimitNotifier::LimitType> notification_type =
+ absl::optional<TimeLimitNotifier::LimitType> notification_type =
ConvertPolicyType(policy_type);
DCHECK(notification_type);
time_limit_notifier_.ShowPolicyUpdateNotification(notification_type.value(),
@@ -233,7 +233,7 @@
void ScreenTimeController::OnAccessCodeValidation(
ash::ParentCodeValidationResult result,
- base::Optional<AccountId> account_id) {
+ absl::optional<AccountId> account_id) {
AccountId current_user_id =
ProfileHelper::Get()
->GetUserByProfile(Profile::FromBrowserContext(context_))
@@ -247,7 +247,7 @@
usage_time_limit::TimeLimitOverride local_override(
usage_time_limit::TimeLimitOverride::Action::kUnlock, clock_->Now(),
- base::nullopt);
+ absl::nullopt);
// Replace previous local override stored in pref, because PAC can only be
// entered if previous override is not active anymore.
pref_service_->Set(prefs::kTimeLimitLocalOverride,
@@ -361,18 +361,18 @@
pref_service_->CommitPendingWrite();
}
-base::Optional<usage_time_limit::State>
+absl::optional<usage_time_limit::State>
ScreenTimeController::GetLastStateFromPref() {
const base::DictionaryValue* last_state =
pref_service_->GetDictionary(prefs::kScreenTimeLastState);
usage_time_limit::State result;
if (last_state->DictEmpty())
- return base::nullopt;
+ return absl::nullopt;
// Verify is_locked from the pref is a boolean value.
const base::Value* is_locked = last_state->FindKey(kScreenStateLocked);
if (!is_locked || !is_locked->is_bool())
- return base::nullopt;
+ return absl::nullopt;
result.is_locked = is_locked->GetBool();
// Verify active policy type is a value of usage_time_limit::PolicyType.
@@ -384,7 +384,7 @@
active_policy->GetInt() < 0 ||
active_policy->GetInt() >
static_cast<int>(usage_time_limit::PolicyType::kUsageLimit)) {
- return base::nullopt;
+ return absl::nullopt;
}
result.active_policy =
static_cast<usage_time_limit::PolicyType>(active_policy->GetInt());
@@ -393,14 +393,14 @@
const base::Value* time_usage_limit_enabled =
last_state->FindKey(kScreenStateTimeUsageLimitEnabled);
if (!time_usage_limit_enabled || !time_usage_limit_enabled->is_bool())
- return base::nullopt;
+ return absl::nullopt;
result.is_time_usage_limit_enabled = time_usage_limit_enabled->GetBool();
// Verify remaining_usage from the pref is a int value.
const base::Value* remaining_usage =
last_state->FindKey(kScreenStateRemainingUsage);
if (!remaining_usage || !remaining_usage->is_int())
- return base::nullopt;
+ return absl::nullopt;
result.remaining_usage =
base::TimeDelta::FromMilliseconds(remaining_usage->GetInt());
@@ -408,7 +408,7 @@
const base::Value* time_usage_limit_started =
last_state->FindKey(kScreenStateUsageLimitStarted);
if (!time_usage_limit_started || !time_usage_limit_started->is_double())
- return base::nullopt;
+ return absl::nullopt;
result.time_usage_limit_started =
base::Time::FromDoubleT(time_usage_limit_started->GetDouble());
@@ -416,7 +416,7 @@
const base::Value* next_state_change_time =
last_state->FindKey(kScreenStateNextStateChangeTime);
if (!next_state_change_time || !next_state_change_time->is_double())
- return base::nullopt;
+ return absl::nullopt;
result.next_state_change_time =
base::Time::FromDoubleT(next_state_change_time->GetDouble());
@@ -427,7 +427,7 @@
next_active_policy->GetInt() < 0 ||
next_active_policy->GetInt() >
static_cast<int>(usage_time_limit::PolicyType::kUsageLimit)) {
- return base::nullopt;
+ return absl::nullopt;
}
result.next_state_active_policy =
static_cast<usage_time_limit::PolicyType>(next_active_policy->GetInt());
@@ -436,7 +436,7 @@
const base::Value* next_unlock_time =
last_state->FindKey(kScreenStateNextUnlockTime);
if (!next_unlock_time || !next_unlock_time->is_double())
- return base::nullopt;
+ return absl::nullopt;
result.next_unlock_time =
base::Time::FromDoubleT(next_unlock_time->GetDouble());
return result;
@@ -451,7 +451,7 @@
const base::DictionaryValue* local_override =
pref_service_->GetDictionary(prefs::kTimeLimitLocalOverride);
- base::Optional<base::TimeDelta> remaining_usage =
+ absl::optional<base::TimeDelta> remaining_usage =
usage_time_limit::GetRemainingTimeUsage(*time_limit, local_override, now,
GetScreenTimeDuration(),
&time_zone);
@@ -468,28 +468,28 @@
}
}
-base::Optional<TimeLimitNotifier::LimitType>
+absl::optional<TimeLimitNotifier::LimitType>
ScreenTimeController::ConvertPolicyType(
usage_time_limit::PolicyType policy_type) {
switch (policy_type) {
case usage_time_limit::PolicyType::kFixedLimit:
- return base::make_optional(TimeLimitNotifier::LimitType::kBedTime);
+ return absl::make_optional(TimeLimitNotifier::LimitType::kBedTime);
break;
case usage_time_limit::PolicyType::kUsageLimit:
- return base::make_optional(TimeLimitNotifier::LimitType::kScreenTime);
+ return absl::make_optional(TimeLimitNotifier::LimitType::kScreenTime);
break;
case usage_time_limit::PolicyType::kOverride:
- return base::make_optional(TimeLimitNotifier::LimitType::kOverride);
+ return absl::make_optional(TimeLimitNotifier::LimitType::kOverride);
break;
case usage_time_limit::PolicyType::kNoPolicy:
- return base::nullopt;
+ return absl::nullopt;
}
}
void ScreenTimeController::OnSessionStateChanged() {
session_manager::SessionState session_state =
session_manager::SessionManager::Get()->session_state();
- base::Optional<usage_time_limit::State> last_state = GetLastStateFromPref();
+ absl::optional<usage_time_limit::State> last_state = GetLastStateFromPref();
if (session_state == session_manager::SessionState::LOCKED && last_state &&
last_state->is_locked) {
OnScreenLockByPolicy(last_state->active_policy,
diff --git a/chrome/browser/ash/child_accounts/screen_time_controller.h b/chrome/browser/ash/child_accounts/screen_time_controller.h
index 55644e9..6042aa0d 100644
--- a/chrome/browser/ash/child_accounts/screen_time_controller.h
+++ b/chrome/browser/ash/child_accounts/screen_time_controller.h
@@ -11,7 +11,6 @@
#include "base/memory/scoped_refptr.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/child_accounts/parent_access_code/parent_access_service.h"
#include "chrome/browser/ash/child_accounts/time_limit_notifier.h"
@@ -21,6 +20,7 @@
#include "components/keyed_service/core/keyed_service.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/session_manager/core/session_manager_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefRegistrySimple;
class PrefService;
@@ -117,7 +117,7 @@
// Get the last calculated |state| from |prefs::kScreenTimeLastState|, if it
// exists.
- base::Optional<usage_time_limit::State> GetLastStateFromPref();
+ absl::optional<usage_time_limit::State> GetLastStateFromPref();
// Called when the usage time limit is |kUsageTimeLimitWarningTime| or less to
// finish. It should call the method UsageTimeLimitWarning for each observer.
@@ -125,12 +125,12 @@
// Converts a usage_time_limit::PolicyType to its TimeLimitNotifier::LimitType
// equivalent.
- base::Optional<TimeLimitNotifier::LimitType> ConvertPolicyType(
+ absl::optional<TimeLimitNotifier::LimitType> ConvertPolicyType(
usage_time_limit::PolicyType policy_type);
// parent_access::ParentAccessService::Observer:
void OnAccessCodeValidation(ParentCodeValidationResult result,
- base::Optional<AccountId> account_id) override;
+ absl::optional<AccountId> account_id) override;
// session_manager::SessionManagerObserver:
void OnSessionStateChanged() override;
diff --git a/chrome/browser/ash/child_accounts/screen_time_controller_browsertest.cc b/chrome/browser/ash/child_accounts/screen_time_controller_browsertest.cc
index dfc25cc3..d13e385 100644
--- a/chrome/browser/ash/child_accounts/screen_time_controller_browsertest.cc
+++ b/chrome/browser/ash/child_accounts/screen_time_controller_browsertest.cc
@@ -142,7 +142,7 @@
embedded_test_server(),
this,
true /*should_launch_browser*/,
- base::nullopt /*account_id*/,
+ absl::nullopt /*account_id*/,
false /*include_initial_user*/};
DISALLOW_COPY_AND_ASSIGN(ScreenTimeControllerTest);
diff --git a/chrome/browser/ash/child_accounts/secondary_account_consent_logger_unittest.cc b/chrome/browser/ash/child_accounts/secondary_account_consent_logger_unittest.cc
index 0baf5f5..40449d5 100644
--- a/chrome/browser/ash/child_accounts/secondary_account_consent_logger_unittest.cc
+++ b/chrome/browser/ash/child_accounts/secondary_account_consent_logger_unittest.cc
@@ -216,7 +216,7 @@
TEST_F(SecondaryAccountConsentLoggerTest, RequestBody) {
CoreAccountInfo account_info = SetPrimaryAccount();
CreateLogger();
- base::Optional<base::Value> test_request_body =
+ absl::optional<base::Value> test_request_body =
base::JSONReader::Read(GetTestRequestBody(
kChromeSyncId, kSecondaryEmail, kParentObfuscatedGaiaId,
kReAuthProofToken, kConsentScreenTextVersion));
diff --git a/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter.cc b/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter.cc
index 3ca567f..fb381bfb 100644
--- a/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter.cc
+++ b/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter.cc
@@ -153,7 +153,7 @@
return golden_output;
}
-base::Optional<usage_time_limit::State>
+absl::optional<usage_time_limit::State>
GenerateUnlockUsageLimitOverrideStateFromInput(
const ConsistencyGoldenInput& input) {
const ConsistencyGoldenOverride* usage_limit_override = nullptr;
@@ -167,7 +167,7 @@
}
if (!usage_limit_override)
- return base::nullopt;
+ return absl::nullopt;
usage_time_limit::State previous_state;
previous_state.is_locked = true;
diff --git a/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter.h b/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter.h
index ec827f0..5793f6d9 100644
--- a/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter.h
+++ b/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter.h
@@ -8,9 +8,9 @@
#ifndef CHROME_BROWSER_ASH_CHILD_ACCOUNTS_TIME_LIMIT_CONSISTENCY_TEST_CONSISTENCY_GOLDEN_CONVERTER_H_
#define CHROME_BROWSER_ASH_CHILD_ACCOUNTS_TIME_LIMIT_CONSISTENCY_TEST_CONSISTENCY_GOLDEN_CONVERTER_H_
-#include "base/optional.h"
#include "chrome/browser/ash/child_accounts/time_limit_consistency_test/goldens/consistency_golden.pb.h"
#include "chrome/browser/ash/child_accounts/usage_time_limit_processor.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Value;
@@ -33,8 +33,8 @@
// processor if there is a UNLOCK_USAGE_LIMIT override present. The generated
// state simulates being locked by usage limit since one minute before the
// override was created.
-// If the override is of another type, base::nullopt will be returned.
-base::Optional<usage_time_limit::State>
+// If the override is of another type, absl::nullopt will be returned.
+absl::optional<usage_time_limit::State>
GenerateUnlockUsageLimitOverrideStateFromInput(
const ConsistencyGoldenInput& input);
diff --git a/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter_unittest.cc b/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter_unittest.cc
index 5fe8b84..8d7c820 100644
--- a/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter_unittest.cc
+++ b/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter_unittest.cc
@@ -48,7 +48,7 @@
// First window: Wednesday, 22:30 to 8:00
consistency_utils::AddWindowLimitEntryToGoldenInput(
&input, WEDNESDAY, consistency_utils::TimeOfDay({22, 30}),
- consistency_utils::TimeOfDay({8, 0}), base::nullopt);
+ consistency_utils::TimeOfDay({8, 0}), absl::nullopt);
utils::AddTimeWindowLimit(&expected_output, utils::kWednesday,
utils::CreateTime(22, 30), utils::CreateTime(8, 0),
kTestLastUpdated);
@@ -56,7 +56,7 @@
// Second window: Saturday, 18:45 to 22:30
consistency_utils::AddWindowLimitEntryToGoldenInput(
&input, SATURDAY, consistency_utils::TimeOfDay({18, 45}),
- consistency_utils::TimeOfDay({22, 30}), base::nullopt);
+ consistency_utils::TimeOfDay({22, 30}), absl::nullopt);
utils::AddTimeWindowLimit(&expected_output, utils::kSaturday,
utils::CreateTime(18, 45),
utils::CreateTime(22, 30), kTestLastUpdated);
@@ -94,13 +94,13 @@
// First quota: Tuesday, 60 minutes
consistency_utils::AddUsageLimitEntryToGoldenInput(&input, TUESDAY, 60,
- base::nullopt);
+ absl::nullopt);
utils::AddTimeUsageLimit(&expected_output, utils::kTuesday,
base::TimeDelta::FromMinutes(60), kTestLastUpdated);
// Second quota: Friday, 30 minutes
consistency_utils::AddUsageLimitEntryToGoldenInput(&input, FRIDAY, 30,
- base::nullopt);
+ absl::nullopt);
utils::AddTimeUsageLimit(&expected_output, utils::kFriday,
base::TimeDelta::FromMinutes(30), kTestLastUpdated);
@@ -116,13 +116,13 @@
// First quota: Tuesday, 60 minutes
consistency_utils::AddUsageLimitEntryToGoldenInput(&input, TUESDAY, 60,
- base::nullopt);
+ absl::nullopt);
utils::AddTimeUsageLimit(&expected_output, utils::kTuesday,
base::TimeDelta::FromMinutes(60), kTestLastUpdated);
// Second quota: Friday, 30 minutes
consistency_utils::AddUsageLimitEntryToGoldenInput(&input, FRIDAY, 30,
- base::nullopt);
+ absl::nullopt);
utils::AddTimeUsageLimit(&expected_output, utils::kFriday,
base::TimeDelta::FromMinutes(30), kTestLastUpdated);
@@ -250,7 +250,7 @@
consistency_utils::AddOverrideToGoldenInput(&input, UNLOCK_USAGE_LIMIT,
kTestTimestamp);
- base::Optional<usage_time_limit::State> generated_state =
+ absl::optional<usage_time_limit::State> generated_state =
GenerateUnlockUsageLimitOverrideStateFromInput(input);
EXPECT_TRUE(generated_state->is_locked);
@@ -268,10 +268,10 @@
consistency_utils::AddOverrideToGoldenInput(&input, UNLOCK_WINDOW_LIMIT,
kTestTimestamp);
- base::Optional<usage_time_limit::State> generated_state =
+ absl::optional<usage_time_limit::State> generated_state =
GenerateUnlockUsageLimitOverrideStateFromInput(input);
- EXPECT_EQ(generated_state, base::nullopt);
+ EXPECT_EQ(generated_state, absl::nullopt);
}
} // namespace time_limit_consistency
diff --git a/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_test.cc b/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_test.cc
index 3b9a6b8..dfa9c00 100644
--- a/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_test.cc
+++ b/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_test.cc
@@ -36,7 +36,7 @@
base::Time::FromJavaTime(current_state.time_millis());
base::Time usage_timestamp =
base::Time::FromJavaTime(current_state.usage_timestamp());
- base::Optional<usage_time_limit::State> previous_state =
+ absl::optional<usage_time_limit::State> previous_state =
GenerateUnlockUsageLimitOverrideStateFromInput(golden_case.input());
base::Value policy = ConvertGoldenInputToProcessorInput(golden_case.input());
diff --git a/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_test_utils.cc b/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_test_utils.cc
index dadb1c0..12864f9 100644
--- a/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_test_utils.cc
+++ b/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_test_utils.cc
@@ -16,7 +16,7 @@
time_limit_consistency::ConsistencyGoldenEffectiveDay effective_day,
const TimeOfDay& starts_at,
const TimeOfDay& ends_at,
- base::Optional<int64_t> last_updated) {
+ absl::optional<int64_t> last_updated) {
time_limit_consistency::ConsistencyGoldenWindowLimitEntry* window =
golden_input->add_window_limits();
window->mutable_starts_at()->set_hour(starts_at.hour);
@@ -33,7 +33,7 @@
time_limit_consistency::ConsistencyGoldenInput* golden_input,
time_limit_consistency::ConsistencyGoldenEffectiveDay effective_day,
int usage_quota_mins,
- base::Optional<int64_t> last_updated) {
+ absl::optional<int64_t> last_updated) {
time_limit_consistency::ConsistencyGoldenUsageLimitEntry* usage_limit =
golden_input->add_usage_limits();
usage_limit->set_usage_quota_mins(usage_quota_mins);
diff --git a/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_test_utils.h b/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_test_utils.h
index c980461..2fddc64 100644
--- a/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_test_utils.h
+++ b/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_test_utils.h
@@ -7,8 +7,8 @@
#ifndef CHROME_BROWSER_ASH_CHILD_ACCOUNTS_TIME_LIMIT_CONSISTENCY_TEST_CONSISTENCY_TEST_UTILS_H_
#define CHROME_BROWSER_ASH_CHILD_ACCOUNTS_TIME_LIMIT_CONSISTENCY_TEST_CONSISTENCY_TEST_UTILS_H_
-#include "base/optional.h"
#include "chrome/browser/ash/child_accounts/time_limit_consistency_test/goldens/consistency_golden.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace time_limit_consistency_utils {
@@ -26,14 +26,14 @@
time_limit_consistency::ConsistencyGoldenEffectiveDay effective_day,
const TimeOfDay& starts_at,
const TimeOfDay& ends_at,
- base::Optional<int64_t> last_updated);
+ absl::optional<int64_t> last_updated);
// Adds a usage limit entry to the provided ConsistencyGoldenInput.
void AddUsageLimitEntryToGoldenInput(
time_limit_consistency::ConsistencyGoldenInput* golden_input,
time_limit_consistency::ConsistencyGoldenEffectiveDay effective_day,
int usage_quota_mins,
- base::Optional<int64_t> last_updated);
+ absl::optional<int64_t> last_updated);
// Adds an override to the provided ConsistencyGoldenInput. Must not be used
// for UNLOCK_UNTIL_LOCK_DEADLINE actions (will DCHECK()), use
diff --git a/chrome/browser/ash/child_accounts/time_limit_notifier.cc b/chrome/browser/ash/child_accounts/time_limit_notifier.cc
index dfa5fd0..e901826 100644
--- a/chrome/browser/ash/child_accounts/time_limit_notifier.cc
+++ b/chrome/browser/ash/child_accounts/time_limit_notifier.cc
@@ -119,7 +119,7 @@
void TimeLimitNotifier::ShowPolicyUpdateNotification(
LimitType limit_type,
- base::Optional<base::Time> lock_time) {
+ absl::optional<base::Time> lock_time) {
int title_id;
std::u16string message;
std::string notification_id;
diff --git a/chrome/browser/ash/child_accounts/time_limit_notifier.h b/chrome/browser/ash/child_accounts/time_limit_notifier.h
index bb1b326e..66682fb 100644
--- a/chrome/browser/ash/child_accounts/time_limit_notifier.h
+++ b/chrome/browser/ash/child_accounts/time_limit_notifier.h
@@ -7,9 +7,9 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class SequencedTaskRunner;
@@ -36,7 +36,7 @@
// Shows a notification informing that the provided limit was updated.
void ShowPolicyUpdateNotification(LimitType limit_type,
- base::Optional<base::Time> lock_time);
+ absl::optional<base::Time> lock_time);
// Cancels any scheduled notification timers.
void UnscheduleNotifications();
diff --git a/chrome/browser/ash/child_accounts/time_limit_notifier_unittest.cc b/chrome/browser/ash/child_accounts/time_limit_notifier_unittest.cc
index caae8ff..e574da2 100644
--- a/chrome/browser/ash/child_accounts/time_limit_notifier_unittest.cc
+++ b/chrome/browser/ash/child_accounts/time_limit_notifier_unittest.cc
@@ -167,7 +167,7 @@
TEST_F(TimeLimitNotifierTest, NoOverriePolicyUpdateNotification) {
notifier_.ShowPolicyUpdateNotification(
- TimeLimitNotifier::LimitType::kOverride, base::nullopt);
+ TimeLimitNotifier::LimitType::kOverride, absl::nullopt);
EXPECT_FALSE(
HasPolicyUpdateNotification(TimeLimitNotifier::LimitType::kOverride));
@@ -175,13 +175,13 @@
TEST_F(TimeLimitNotifierTest, ShowPolicyUpdateNotifications) {
notifier_.ShowPolicyUpdateNotification(
- TimeLimitNotifier::LimitType::kScreenTime, base::nullopt);
+ TimeLimitNotifier::LimitType::kScreenTime, absl::nullopt);
notifier_.ShowPolicyUpdateNotification(TimeLimitNotifier::LimitType::kBedTime,
- base::nullopt);
+ absl::nullopt);
base::Time lock_time;
ASSERT_TRUE(base::Time::FromUTCString("1 Jan 2019 22:00 PST", &lock_time));
notifier_.ShowPolicyUpdateNotification(
- TimeLimitNotifier::LimitType::kOverride, base::make_optional(lock_time));
+ TimeLimitNotifier::LimitType::kOverride, absl::make_optional(lock_time));
EXPECT_TRUE(
HasPolicyUpdateNotification(TimeLimitNotifier::LimitType::kScreenTime));
diff --git a/chrome/browser/ash/child_accounts/time_limit_override.cc b/chrome/browser/ash/child_accounts/time_limit_override.cc
index 40eb4b4..d9db4c39 100644
--- a/chrome/browser/ash/child_accounts/time_limit_override.cc
+++ b/chrome/browser/ash/child_accounts/time_limit_override.cc
@@ -45,17 +45,17 @@
}
// static
-base::Optional<TimeLimitOverride> TimeLimitOverride::FromDictionary(
+absl::optional<TimeLimitOverride> TimeLimitOverride::FromDictionary(
const base::Value* dict) {
if (!dict || !dict->is_dict()) {
DLOG(ERROR) << "Override entry is not a dictionary";
- return base::nullopt;
+ return absl::nullopt;
}
const std::string* action_string = dict->FindStringKey(kOverrideAction);
if (!action_string || action_string->empty()) {
DLOG(ERROR) << "Invalid override action.";
- return base::nullopt;
+ return absl::nullopt;
}
const std::string* creation_time_string =
@@ -64,7 +64,7 @@
if (!creation_time_string || creation_time_string->empty() ||
!base::StringToInt64(*creation_time_string, &creation_time_millis)) {
DLOG(ERROR) << "Invalid override creation time.";
- return base::nullopt;
+ return absl::nullopt;
}
Action action =
@@ -76,25 +76,25 @@
const base::Value* duration_value = dict->FindPath(
{kOverrideActionSpecificData, kOverrideActionDurationMins});
- base::Optional<base::TimeDelta> duration =
+ absl::optional<base::TimeDelta> duration =
duration_value ? base::TimeDelta::FromMinutes(duration_value->GetInt())
- : base::Optional<base::TimeDelta>();
+ : absl::optional<base::TimeDelta>();
return TimeLimitOverride(action, creation_time, duration);
}
// static
-base::Optional<TimeLimitOverride> TimeLimitOverride::MostRecentFromList(
+absl::optional<TimeLimitOverride> TimeLimitOverride::MostRecentFromList(
const base::Value* list) {
if (!list || !list->is_list()) {
DLOG(ERROR) << "Override entries should be a list.";
- return base::nullopt;
+ return absl::nullopt;
}
// The most recent override created.
- base::Optional<TimeLimitOverride> last_override;
+ absl::optional<TimeLimitOverride> last_override;
for (const base::Value& override_value : list->GetList()) {
- base::Optional<TimeLimitOverride> current_override =
+ absl::optional<TimeLimitOverride> current_override =
FromDictionary(&override_value);
if (!current_override.has_value()) {
DLOG(ERROR) << "Invalid override entry";
@@ -111,7 +111,7 @@
TimeLimitOverride::TimeLimitOverride(Action action,
base::Time created_at,
- base::Optional<base::TimeDelta> duration)
+ absl::optional<base::TimeDelta> duration)
: action_(action), created_at_(created_at), duration_(duration) {}
TimeLimitOverride::~TimeLimitOverride() = default;
diff --git a/chrome/browser/ash/child_accounts/time_limit_override.h b/chrome/browser/ash/child_accounts/time_limit_override.h
index 35257d1..c29ac22 100644
--- a/chrome/browser/ash/child_accounts/time_limit_override.h
+++ b/chrome/browser/ash/child_accounts/time_limit_override.h
@@ -8,8 +8,8 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Value;
@@ -36,18 +36,18 @@
// Factory method. Creates TimeLimitOverride from a |dict|. Returns nullopt if
// |dict| could not be parsed.
- static base::Optional<TimeLimitOverride> FromDictionary(
+ static absl::optional<TimeLimitOverride> FromDictionary(
const base::Value* dict);
// Factory method. Creates TimeLimitOverride from the most recent override in
// the list of overrides passed in |list|. Returns nullopt if |list| could not
// be parsed.
- static base::Optional<TimeLimitOverride> MostRecentFromList(
+ static absl::optional<TimeLimitOverride> MostRecentFromList(
const base::Value* list);
TimeLimitOverride(Action action,
base::Time created_at,
- base::Optional<base::TimeDelta> duration);
+ absl::optional<base::TimeDelta> duration);
~TimeLimitOverride();
TimeLimitOverride(TimeLimitOverride&&);
TimeLimitOverride& operator=(TimeLimitOverride&&);
@@ -63,7 +63,7 @@
base::Time created_at() const { return created_at_; }
// Returns override duration if specified.
- base::Optional<base::TimeDelta> duration() const { return duration_; }
+ absl::optional<base::TimeDelta> duration() const { return duration_; }
// Convenience method to quickly check if is this is a locking override.
bool IsLock() const;
@@ -74,7 +74,7 @@
private:
Action action_;
base::Time created_at_;
- base::Optional<base::TimeDelta> duration_;
+ absl::optional<base::TimeDelta> duration_;
DISALLOW_COPY_AND_ASSIGN(TimeLimitOverride);
};
diff --git a/chrome/browser/ash/child_accounts/time_limit_test_utils.cc b/chrome/browser/ash/child_accounts/time_limit_test_utils.cc
index 843943f..18607bd 100644
--- a/chrome/browser/ash/child_accounts/time_limit_test_utils.cc
+++ b/chrome/browser/ash/child_accounts/time_limit_test_utils.cc
@@ -9,7 +9,7 @@
#include "base/json/json_writer.h"
#include "base/logging.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace time_limit_test_utils {
@@ -162,7 +162,7 @@
}
usage_time_limit::TimeLimitOverride new_override(action, created_at,
- base::nullopt);
+ absl::nullopt);
overrides->Append(new_override.ToDictionary());
}
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_activity_registry.cc b/chrome/browser/ash/child_accounts/time_limits/app_activity_registry.cc
index 5ade892..17a534f 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_activity_registry.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/app_activity_registry.cc
@@ -59,13 +59,13 @@
AppActivityRegistry::TestApi::~TestApi() = default;
-const base::Optional<AppLimit>& AppActivityRegistry::TestApi::GetAppLimit(
+const absl::optional<AppLimit>& AppActivityRegistry::TestApi::GetAppLimit(
const AppId& app_id) const {
DCHECK(base::Contains(registry_->activity_registry_, app_id));
return registry_->activity_registry_.at(app_id).limit;
}
-base::Optional<base::TimeDelta> AppActivityRegistry::TestApi::GetTimeLeft(
+absl::optional<base::TimeDelta> AppActivityRegistry::TestApi::GetTimeLeft(
const AppId& app_id) const {
return registry_->GetTimeLeftForApp(app_id);
}
@@ -75,7 +75,7 @@
}
AppActivityRegistry::SystemNotification::SystemNotification(
- base::Optional<base::TimeDelta> app_time_limit,
+ absl::optional<base::TimeDelta> app_time_limit,
AppNotification app_notification)
: time_limit(app_time_limit), notification(app_notification) {}
@@ -114,7 +114,7 @@
}
bool AppActivityRegistry::AppDetails::IsLimitEqual(
- const base::Optional<AppLimit>& another_limit) const {
+ const absl::optional<AppLimit>& another_limit) const {
if (limit.has_value() != another_limit.has_value())
return false;
@@ -355,7 +355,7 @@
return activity_registry_.at(app_id).activity.RunningActiveTime();
}
-const base::Optional<AppLimit>& AppActivityRegistry::GetWebTimeLimit() const {
+const absl::optional<AppLimit>& AppActivityRegistry::GetWebTimeLimit() const {
DCHECK(base::Contains(activity_registry_, GetChromeAppId()));
return activity_registry_.at(GetChromeAppId()).limit;
}
@@ -365,20 +365,20 @@
return activity_registry_.at(app_id).activity.app_state();
}
-base::Optional<base::TimeDelta> AppActivityRegistry::GetTimeLimit(
+absl::optional<base::TimeDelta> AppActivityRegistry::GetTimeLimit(
const AppId& app_id) const {
if (!base::Contains(activity_registry_, app_id))
- return base::nullopt;
+ return absl::nullopt;
- const base::Optional<AppLimit>& limit = activity_registry_.at(app_id).limit;
+ const absl::optional<AppLimit>& limit = activity_registry_.at(app_id).limit;
if (!limit || limit->restriction() != AppRestriction::kTimeLimit)
- return base::nullopt;
+ return absl::nullopt;
DCHECK(limit->daily_limit());
return limit->daily_limit();
}
-void AppActivityRegistry::SetReportingEnabled(base::Optional<bool> value) {
+void AppActivityRegistry::SetReportingEnabled(absl::optional<bool> value) {
if (value.has_value())
activity_reporting_enabled_ = value.value();
}
@@ -480,7 +480,7 @@
if (app_id != GetChromeAppId() && IsWebAppOrExtension(app_id))
continue;
- base::Optional<AppLimit> new_limit = base::nullopt;
+ absl::optional<AppLimit> new_limit = absl::nullopt;
if (base::Contains(app_limits, app_id))
new_limit = app_limits.at(app_id);
@@ -502,7 +502,7 @@
bool AppActivityRegistry::SetAppLimit(
const AppId& app_id,
- const base::Optional<AppLimit>& app_limit) {
+ const absl::optional<AppLimit>& app_limit) {
DCHECK(base::Contains(activity_registry_, app_id));
// If an application is not installed but present in the registry return
@@ -526,13 +526,13 @@
// If |did_change| is false, handle the following corner case before
// returning. The default value for app limit during construction at the
- // beginning of the session is base::nullopt. If the application was paused in
+ // beginning of the session is absl::nullopt. If the application was paused in
// the previous session, and its limit was removed or feature is disabled in
- // the current session, the |app_limit| provided will be base::nullopt. Since
+ // the current session, the |app_limit| provided will be absl::nullopt. Since
// both values(the default app limit and the |app_limit| provided as an
- // argument for this method) are the same base::nullopt, |did_change| will be
+ // argument for this method) are the same absl::nullopt, |did_change| will be
// false. But we still need to update the state to available as the new app
- // limit is base::nullopt.
+ // limit is absl::nullopt.
if (!did_change && (IsAppAvailable(app_id) || app_limit.has_value()))
return updated;
@@ -542,7 +542,7 @@
<< " which is allowlisted.";
}
- details.limit = base::nullopt;
+ details.limit = absl::nullopt;
return false;
}
@@ -612,9 +612,9 @@
if (GetAppState(app) == AppState::kAlwaysAvailable)
continue;
- base::Optional<AppLimit>& limit = activity_registry_.at(app).limit;
+ absl::optional<AppLimit>& limit = activity_registry_.at(app).limit;
if (limit.has_value())
- limit = base::nullopt;
+ limit = absl::nullopt;
SetAppState(app, AppState::kAlwaysAvailable);
}
@@ -629,11 +629,11 @@
base::Value::ListView list_view = list_value->GetList();
for (base::Value& entry : list_view) {
- base::Optional<AppId> app_id = policy::AppIdFromAppInfoDict(entry);
+ absl::optional<AppId> app_id = policy::AppIdFromAppInfoDict(entry);
DCHECK(app_id.has_value());
if (!base::Contains(activity_registry_, app_id.value())) {
- base::Optional<AppState> state =
+ absl::optional<AppState> state =
PersistedAppInfo::GetAppStateFromDict(&entry);
DCHECK(state.has_value() && state.value() == AppState::kUninstalled);
continue;
@@ -702,7 +702,7 @@
for (size_t index = 0; index < list_storage.size();) {
base::Value& entry = list_storage[index];
- base::Optional<PersistedAppInfo> info =
+ absl::optional<PersistedAppInfo> info =
PersistedAppInfo::PersistedAppInfoFromDict(&entry, true);
DCHECK(info.has_value());
info->RemoveActiveTimeEarlierThan(timestamp);
@@ -795,7 +795,7 @@
DCHECK(base::Contains(activity_registry_, app_id));
DCHECK_EQ(GetAppState(app_id), AppState::kLimitReached);
- const base::Optional<AppLimit>& limit = activity_registry_.at(app_id).limit;
+ const absl::optional<AppLimit>& limit = activity_registry_.at(app_id).limit;
DCHECK(limit->daily_limit());
for (auto& observer : app_state_observers_) {
observer.OnAppLimitReached(app_id, limit->daily_limit().value(),
@@ -861,7 +861,7 @@
DCHECK(!app_details.app_limit_timer->IsRunning());
// Check that the timer instance has been created.
- base::Optional<base::TimeDelta> time_limit = GetTimeLeftForApp(app_id);
+ absl::optional<base::TimeDelta> time_limit = GetTimeLeftForApp(app_id);
DCHECK(time_limit.has_value());
if (time_limit > kFiveMinutes) {
@@ -884,26 +884,26 @@
base::Unretained(this), app_id));
}
-base::Optional<base::TimeDelta> AppActivityRegistry::GetTimeLeftForApp(
+absl::optional<base::TimeDelta> AppActivityRegistry::GetTimeLeftForApp(
const AppId& app_id) const {
DCHECK(base::Contains(activity_registry_, app_id));
const AppDetails& app_details = activity_registry_.at(app_id);
// If |app_details.limit| doesn't have value, the app has no restriction.
if (!app_details.limit.has_value())
- return base::nullopt;
+ return absl::nullopt;
const AppLimit& limit = app_details.limit.value();
if (limit.restriction() != AppRestriction::kTimeLimit)
- return base::nullopt;
+ return absl::nullopt;
// If the app has kTimeLimit restriction, DCHECK that daily limit has value.
DCHECK(limit.daily_limit().has_value());
AppState state = app_details.activity.app_state();
if (state == AppState::kAlwaysAvailable || state == AppState::kBlocked)
- return base::nullopt;
+ return absl::nullopt;
if (state == AppState::kLimitReached)
return kZeroMinutes;
@@ -928,7 +928,7 @@
void AppActivityRegistry::CheckTimeLimitForApp(const AppId& app_id) {
AppDetails& details = activity_registry_[app_id];
- base::Optional<base::TimeDelta> time_left = GetTimeLeftForApp(app_id);
+ absl::optional<base::TimeDelta> time_left = GetTimeLeftForApp(app_id);
AppNotification last_notification = details.activity.last_notification();
if (!time_left.has_value())
@@ -970,8 +970,8 @@
bool AppActivityRegistry::ShowLimitUpdatedNotificationIfNeeded(
const AppId& app_id,
- const base::Optional<AppLimit>& old_limit,
- const base::Optional<AppLimit>& new_limit) {
+ const absl::optional<AppLimit>& old_limit,
+ const absl::optional<AppLimit>& new_limit) {
// Web app limit changes are covered by Chrome notification.
if (app_id != GetChromeAppId() && IsWebAppOrExtension(app_id))
return false;
@@ -988,7 +988,7 @@
if (!was_blocked && is_blocked) {
MaybeShowSystemNotification(
- app_id, SystemNotification(base::nullopt, AppNotification::kBlocked));
+ app_id, SystemNotification(absl::nullopt, AppNotification::kBlocked));
return true;
}
@@ -999,7 +999,7 @@
if (was_blocked && !is_blocked && !has_time_limit) {
MaybeShowSystemNotification(
- app_id, SystemNotification(base::nullopt, AppNotification::kAvailable));
+ app_id, SystemNotification(absl::nullopt, AppNotification::kAvailable));
return true;
}
@@ -1007,7 +1007,7 @@
if (!has_time_limit && had_time_limit) {
MaybeShowSystemNotification(
app_id,
- SystemNotification(base::nullopt, AppNotification::kTimeLimitChanged));
+ SystemNotification(absl::nullopt, AppNotification::kTimeLimitChanged));
return true;
}
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_activity_registry.h b/chrome/browser/ash/child_accounts/time_limits/app_activity_registry.h
index 60ed8ea5..a4eb484 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_activity_registry.h
+++ b/chrome/browser/ash/child_accounts/time_limits/app_activity_registry.h
@@ -11,12 +11,12 @@
#include <vector>
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/ash/child_accounts/time_limits/app_activity_report_interface.h"
#include "chrome/browser/ash/child_accounts/time_limits/app_service_wrapper.h"
#include "chrome/browser/ash/child_accounts/time_limits/app_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace aura {
class Window;
@@ -48,8 +48,8 @@
explicit TestApi(AppActivityRegistry* registry);
~TestApi();
- const base::Optional<AppLimit>& GetAppLimit(const AppId& app_id) const;
- base::Optional<base::TimeDelta> GetTimeLeft(const AppId& app_id) const;
+ const absl::optional<AppLimit>& GetAppLimit(const AppId& app_id) const;
+ absl::optional<base::TimeDelta> GetTimeLeft(const AppId& app_id) const;
void SaveAppActivity();
private:
@@ -123,16 +123,16 @@
// Web time limit is the time limit set for Chrome browser. It is shared
// between Chrome and Web apps.
- const base::Optional<AppLimit>& GetWebTimeLimit() const;
+ const absl::optional<AppLimit>& GetWebTimeLimit() const;
AppState GetAppState(const AppId& app_id) const;
// Returns current time limit for the app identified by |app_id|.
// Will return nullopt if there is no limit set.
- base::Optional<base::TimeDelta> GetTimeLimit(const AppId& app_id) const;
+ absl::optional<base::TimeDelta> GetTimeLimit(const AppId& app_id) const;
// Reporting enablement is set if |enabled| has value.
- void SetReportingEnabled(base::Optional<bool> enabled);
+ void SetReportingEnabled(absl::optional<bool> enabled);
void GenerateHiddenApps(
enterprise_management::ChildStatusReportRequest* report);
@@ -156,7 +156,7 @@
// that app does not have limit set. Does not affect limits of any other app.
// Returns true if a new app limit is observed.
bool SetAppLimit(const AppId& app_id,
- const base::Optional<AppLimit>& app_limit);
+ const absl::optional<AppLimit>& app_limit);
// Sets the app identified with |app_id| as being always available.
void SetAppAllowlisted(const AppId& app_id);
@@ -180,11 +180,11 @@
private:
struct SystemNotification {
- SystemNotification(base::Optional<base::TimeDelta> app_time_limit,
+ SystemNotification(absl::optional<base::TimeDelta> app_time_limit,
AppNotification app_notification);
SystemNotification(const SystemNotification&);
SystemNotification& operator=(const SystemNotification&);
- base::Optional<base::TimeDelta> time_limit = base::nullopt;
+ absl::optional<base::TimeDelta> time_limit = absl::nullopt;
AppNotification notification = AppNotification::kUnknown;
};
@@ -204,7 +204,7 @@
// Checks if |limit| is equal to |another_limit| with exception for the
// timestamp (that does not indicate that limit changed).
- bool IsLimitEqual(const base::Optional<AppLimit>& another_limit) const;
+ bool IsLimitEqual(const absl::optional<AppLimit>& another_limit) const;
// Contains information about current app state and logged activity.
AppActivity activity{AppState::kAvailable};
@@ -217,7 +217,7 @@
std::set<aura::Window*> paused_windows;
// Contains information about restriction set for the app.
- base::Optional<AppLimit> limit;
+ absl::optional<AppLimit> limit;
// Timer set up for when the app time limit is expected to be reached and
// preceding notifications.
@@ -258,7 +258,7 @@
void SetAppActive(const AppId& app_id, base::Time timestamp);
void SetAppInactive(const AppId& app_id, base::Time timestamp);
- base::Optional<base::TimeDelta> GetTimeLeftForApp(const AppId& app_id) const;
+ absl::optional<base::TimeDelta> GetTimeLeftForApp(const AppId& app_id) const;
// Schedules a time limit check for application when it becomes active.
void ScheduleTimeLimitCheckForApp(const AppId& app_id);
@@ -271,8 +271,8 @@
// notification has been made.
bool ShowLimitUpdatedNotificationIfNeeded(
const AppId& app_id,
- const base::Optional<AppLimit>& old_limit,
- const base::Optional<AppLimit>& new_limit);
+ const absl::optional<AppLimit>& old_limit,
+ const absl::optional<AppLimit>& new_limit);
base::TimeDelta GetWebActiveRunningTime() const;
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_activity_registry_unittest.cc b/chrome/browser/ash/child_accounts/time_limits/app_activity_registry_unittest.cc
index 12d48946..28b72f93 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_activity_registry_unittest.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/app_activity_registry_unittest.cc
@@ -8,7 +8,6 @@
#include <memory>
#include <vector>
-#include "base/optional.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "chrome/browser/ash/child_accounts/time_limits/app_service_wrapper.h"
@@ -26,6 +25,7 @@
#include "components/services/app_service/public/mojom/types.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/aura/client/window_types.h"
#include "ui/aura/window.h"
@@ -51,7 +51,7 @@
MOCK_METHOD3(ShowAppTimeLimitNotification,
void(const AppId&,
- const base::Optional<base::TimeDelta>&,
+ const absl::optional<base::TimeDelta>&,
AppNotification));
};
@@ -86,7 +86,7 @@
aura::Window* GetWindowForApp(const AppId& app_id);
void SetAppLimit(const AppId& app_id,
- const base::Optional<AppLimit>& app_limit);
+ const absl::optional<AppLimit>& app_limit);
void ReInitializeRegistry();
@@ -150,7 +150,7 @@
void AppActivityRegistryTest::SetAppLimit(
const AppId& app_id,
- const base::Optional<AppLimit>& app_limit) {
+ const absl::optional<AppLimit>& app_limit) {
registry().SetAppLimit(app_id, app_limit);
task_environment()->RunUntilIdle();
}
@@ -459,9 +459,9 @@
EXPECT_TRUE(registry().IsAppActive(kApp1));
EXPECT_EQ(base::TimeDelta::FromMinutes(0), registry().GetActiveTime(kApp1));
- EXPECT_EQ(base::nullopt, registry_test().GetAppLimit(kApp1));
- EXPECT_EQ(base::nullopt, registry().GetTimeLimit(kApp1));
- EXPECT_EQ(base::nullopt, registry_test().GetTimeLeft(kApp1));
+ EXPECT_EQ(absl::nullopt, registry_test().GetAppLimit(kApp1));
+ EXPECT_EQ(absl::nullopt, registry().GetTimeLimit(kApp1));
+ EXPECT_EQ(absl::nullopt, registry_test().GetTimeLeft(kApp1));
task_environment()->FastForwardBy(base::TimeDelta::FromMinutes(5));
@@ -1090,7 +1090,7 @@
}
TEST_F(AppActivityRegistryTest, AppBlocked) {
- const AppLimit app1_limit(AppRestriction::kBlocked, base::nullopt,
+ const AppLimit app1_limit(AppRestriction::kBlocked, absl::nullopt,
base::Time::Now());
const std::map<AppId, AppLimit> limits{{kApp1, app1_limit}};
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper.cc b/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper.cc
index aa81bf8..0401ddc 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/apps/app_service/launch_utils.h"
@@ -25,6 +24,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/image/image_skia.h"
namespace ash {
@@ -167,7 +167,7 @@
void AppServiceWrapper::GetAppIcon(
const AppId& app_id,
int size_hint_in_dp,
- base::OnceCallback<void(base::Optional<gfx::ImageSkia>)> on_icon_ready)
+ base::OnceCallback<void(absl::optional<gfx::ImageSkia>)> on_icon_ready)
const {
apps::AppServiceProxyChromeOs* proxy =
apps::AppServiceProxyFactory::GetForProfile(profile_);
@@ -183,14 +183,14 @@
size_hint_in_dp,
/* allow_placeholder_icon */ false,
base::BindOnce(
- [](base::OnceCallback<void(base::Optional<gfx::ImageSkia>)> callback,
+ [](base::OnceCallback<void(absl::optional<gfx::ImageSkia>)> callback,
apps::mojom::IconValuePtr icon_value) {
auto icon_type = (base::FeatureList::IsEnabled(
features::kAppServiceAdaptiveIcon))
? apps::mojom::IconType::kStandard
: apps::mojom::IconType::kUncompressed;
if (!icon_value || icon_value->icon_type != icon_type) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
} else {
std::move(callback).Run(icon_value->uncompressed);
}
@@ -209,7 +209,7 @@
AppId AppServiceWrapper::AppIdFromAppServiceId(
const std::string& app_service_id,
apps::mojom::AppType app_type) const {
- base::Optional<AppId> app_id;
+ absl::optional<AppId> app_id;
GetAppCache().ForOneApp(app_service_id,
[&app_id](const apps::AppUpdate& update) {
app_id = AppIdFromAppUpdate(update);
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper.h b/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper.h
index ea19713..791db85 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper.h
+++ b/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper.h
@@ -128,7 +128,7 @@
// size |size_hint_in_dp|.
void GetAppIcon(const AppId& app_id,
int size_hint_in_dp,
- base::OnceCallback<void(base::Optional<gfx::ImageSkia>)>
+ base::OnceCallback<void(absl::optional<gfx::ImageSkia>)>
on_icon_ready) const;
// Returns app service id for the app identified by |app_id|.
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper_unittest.cc b/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper_unittest.cc
index 8b6bfdc..d9f9c283 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper_unittest.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/app_service_wrapper_unittest.cc
@@ -13,7 +13,6 @@
#include "base/containers/flat_map.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/test/bind.h"
@@ -45,6 +44,7 @@
#include "extensions/common/constants.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
using web_app::GenerateAppIdFromURL;
@@ -136,7 +136,7 @@
void SimulateAppInstalled(const AppId& app_id,
const std::string& app_name,
- base::Optional<std::string> url = base::nullopt) {
+ absl::optional<std::string> url = absl::nullopt) {
if (app_id.app_type() == apps::mojom::AppType::kArc) {
const std::string& package_name = app_id.app_id();
arc_test_.AddPackage(CreateArcAppPackage(package_name)->Clone());
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_time_browsertest.cc b/chrome/browser/ash/child_accounts/time_limits/app_time_browsertest.cc
index 51e8f63..55d5b45 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_time_browsertest.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/app_time_browsertest.cc
@@ -6,7 +6,6 @@
#include <string>
#include "base/json/json_writer.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/test/scoped_feature_list.h"
@@ -39,6 +38,7 @@
#include "content/public/test/browser_test.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace app_time {
@@ -222,7 +222,7 @@
// Block the app.
AppTimeLimitsPolicyBuilder block_policy;
const AppLimit block_limit =
- AppLimit(AppRestriction::kBlocked, base::nullopt, base::Time::Now());
+ AppLimit(AppRestriction::kBlocked, absl::nullopt, base::Time::Now());
block_policy.AddAppLimit(app1, block_limit);
block_policy.SetResetTime(6, 0);
@@ -296,7 +296,7 @@
// Send policy.
AppTimeLimitsPolicyBuilder policy;
policy.SetResetTime(6, 0);
- policy.AddAppLimit(app2, AppLimit(AppRestriction::kBlocked, base::nullopt,
+ policy.AddAppLimit(app2, AppLimit(AppRestriction::kBlocked, absl::nullopt,
base::Time::Now()));
policy.AddAppLimit(
app3, AppLimit(AppRestriction::kTimeLimit,
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_time_controller.cc b/chrome/browser/ash/child_accounts/time_limits/app_time_controller.cc
index 0e7a69b..6f11804 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_time_controller.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/app_time_controller.cc
@@ -108,7 +108,7 @@
std::u16string GetNotificationMessageFor(
const std::u16string& app_name,
AppNotification notification,
- base::Optional<base::TimeDelta> time_limit) {
+ absl::optional<base::TimeDelta> time_limit) {
switch (notification) {
case AppNotification::kFiveMinutes:
return l10n_util::GetStringFUTF16(
@@ -259,7 +259,7 @@
// sessions.
if (app_registry_->IsAppInstalled(GetChromeAppId()) &&
app_registry_->IsAppTimeLimitReached(GetChromeAppId())) {
- base::Optional<AppLimit> web_time_limit = app_registry_->GetWebTimeLimit();
+ absl::optional<AppLimit> web_time_limit = app_registry_->GetWebTimeLimit();
DCHECK(web_time_limit);
DCHECK(web_time_limit->daily_limit());
DCHECK(web_time_enforcer_);
@@ -285,7 +285,7 @@
return true;
}
-base::Optional<base::TimeDelta> AppTimeController::GetTimeLimitForApp(
+absl::optional<base::TimeDelta> AppTimeController::GetTimeLimitForApp(
const std::string& app_service_id,
apps::mojom::AppType app_type) const {
const app_time::AppId app_id =
@@ -317,7 +317,7 @@
if (!app_registry_->IsAppInstalled(GetChromeAppId()))
return false;
- const base::Optional<app_time::AppLimit>& time_limit =
+ const absl::optional<app_time::AppLimit>& time_limit =
app_registry_->GetWebTimeLimit();
if (!time_limit.has_value())
return false;
@@ -368,7 +368,7 @@
app_registry_->SetReportingEnabled(
policy::ActivityReportingEnabledFromDict(*policy));
- base::Optional<base::TimeDelta> new_reset_time =
+ absl::optional<base::TimeDelta> new_reset_time =
policy::ResetTimeFromDict(*policy);
// TODO(agawronska): Propagate the information about reset time change.
if (new_reset_time && *new_reset_time != limits_reset_time_)
@@ -409,7 +409,7 @@
void AppTimeController::ShowAppTimeLimitNotification(
const AppId& app_id,
- const base::Optional<base::TimeDelta>& time_limit,
+ const absl::optional<base::TimeDelta>& time_limit,
AppNotification notification) {
DCHECK_NE(AppNotification::kUnknown, notification);
@@ -595,8 +595,8 @@
void AppTimeController::ShowNotificationForApp(
const std::string& app_name,
AppNotification notification,
- base::Optional<base::TimeDelta> time_limit,
- base::Optional<gfx::ImageSkia> icon) {
+ absl::optional<base::TimeDelta> time_limit,
+ absl::optional<gfx::ImageSkia> icon) {
DCHECK(notification == AppNotification::kFiveMinutes ||
notification == AppNotification::kOneMinute ||
notification == AppNotification::kTimeLimitChanged ||
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_time_controller.h b/chrome/browser/ash/child_accounts/time_limits/app_time_controller.h
index c28ab06..fbd5406 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_time_controller.h
+++ b/chrome/browser/ash/child_accounts/time_limits/app_time_controller.h
@@ -9,7 +9,6 @@
#include <string>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/default_tick_clock.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -18,6 +17,7 @@
#include "chromeos/dbus/system_clock/system_clock_client.h"
#include "chromeos/settings/timezone_settings.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
class PrefRegistrySimple;
@@ -80,7 +80,7 @@
// Returns current time limit for the app identified by |app_service_id| and
// |app_type|.Will return nullopt if there is no limit set or app is not
// tracked.
- base::Optional<base::TimeDelta> GetTimeLimitForApp(
+ absl::optional<base::TimeDelta> GetTimeLimitForApp(
const std::string& app_service_id,
apps::mojom::AppType app_type) const;
@@ -96,7 +96,7 @@
// AppTimeNotificationDelegate:
void ShowAppTimeLimitNotification(
const AppId& app_id,
- const base::Optional<base::TimeDelta>& time_limit,
+ const absl::optional<base::TimeDelta>& time_limit,
AppNotification notification) override;
// AppActivityRegistry::AppStateObserver:
@@ -152,8 +152,8 @@
void ShowNotificationForApp(const std::string& app_name,
AppNotification notification,
- base::Optional<base::TimeDelta> time_limit,
- base::Optional<gfx::ImageSkia> icon);
+ absl::optional<base::TimeDelta> time_limit,
+ absl::optional<gfx::ImageSkia> icon);
// Profile
Profile* const profile_;
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_time_controller_unittest.cc b/chrome/browser/ash/child_accounts/time_limits/app_time_controller_unittest.cc
index 8c6e7d83..9e492f9 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_time_controller_unittest.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/app_time_controller_unittest.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/ash/child_accounts/time_limits/app_time_controller.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
@@ -34,6 +33,7 @@
#include "components/services/app_service/public/cpp/icon_loader.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep_default.h"
#include "ui/message_center/public/cpp/notification.h"
@@ -256,7 +256,7 @@
notification_id = base::StrCat({notification_id, app_name});
- base::Optional<message_center::Notification> message_center_notification =
+ absl::optional<message_center::Notification> message_center_notification =
notification_tester_.GetNotification(notification_id);
return message_center_notification.has_value();
}
@@ -538,7 +538,7 @@
AppTimeLimitsPolicyBuilder builder;
AppId absent_app(apps::mojom::AppType::kArc, "absent_app");
AppLimit app_limit(AppRestriction::kTimeLimit, kOneHour, base::Time::Now());
- AppLimit blocked_app(AppRestriction::kBlocked, base::nullopt,
+ AppLimit blocked_app(AppRestriction::kBlocked, absl::nullopt,
base::Time::Now());
builder.AddAppLimit(kApp1, app_limit);
builder.AddAppLimit(absent_app, app_limit);
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_time_limit_interface.h b/chrome/browser/ash/child_accounts/time_limits/app_time_limit_interface.h
index 70ddda5..9e1674f 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_time_limit_interface.h
+++ b/chrome/browser/ash/child_accounts/time_limits/app_time_limit_interface.h
@@ -7,8 +7,8 @@
#include <string>
-#include "base/optional.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -48,7 +48,7 @@
// Returns current time limit for the app identified by |app_service_id| and
// |app_type|.Will return nullopt if there is no limit set or app does not
// exist.
- virtual base::Optional<base::TimeDelta> GetTimeLimitForApp(
+ virtual absl::optional<base::TimeDelta> GetTimeLimitForApp(
const std::string& app_service_id,
apps::mojom::AppType app_type) = 0;
};
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_time_limits_allowlist_policy_wrapper.cc b/chrome/browser/ash/child_accounts/time_limits/app_time_limits_allowlist_policy_wrapper.cc
index f096efc..33ac68e 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_time_limits_allowlist_policy_wrapper.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/app_time_limits_allowlist_policy_wrapper.cc
@@ -5,9 +5,9 @@
#include "chrome/browser/ash/child_accounts/time_limits/app_time_limits_allowlist_policy_wrapper.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "chrome/browser/ash/child_accounts/time_limits/app_time_policy_helpers.h"
#include "chrome/browser/ash/child_accounts/time_limits/app_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace app_time {
@@ -52,7 +52,7 @@
base::Value::ConstListView list_view = app_list->GetList();
for (const base::Value& value : list_view) {
- base::Optional<AppId> app_id = policy::AppIdFromDict(value);
+ absl::optional<AppId> app_id = policy::AppIdFromDict(value);
if (app_id)
return_value.push_back(*app_id);
}
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_time_notification_delegate.h b/chrome/browser/ash/child_accounts/time_limits/app_time_notification_delegate.h
index aa74e127..60efb101 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_time_notification_delegate.h
+++ b/chrome/browser/ash/child_accounts/time_limits/app_time_notification_delegate.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_ASH_CHILD_ACCOUNTS_TIME_LIMITS_APP_TIME_NOTIFICATION_DELEGATE_H_
#define CHROME_BROWSER_ASH_CHILD_ACCOUNTS_TIME_LIMITS_APP_TIME_NOTIFICATION_DELEGATE_H_
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class TimeDelta;
@@ -29,7 +29,7 @@
virtual void ShowAppTimeLimitNotification(
const AppId& app_id,
- const base::Optional<base::TimeDelta>& time_limit,
+ const absl::optional<base::TimeDelta>& time_limit,
AppNotification notification) = 0;
};
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_time_policy_helpers.cc b/chrome/browser/ash/child_accounts/time_limits/app_time_policy_helpers.cc
index 32341db..919f122b 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_time_policy_helpers.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/app_time_policy_helpers.cc
@@ -94,20 +94,20 @@
}
}
-base::Optional<AppId> AppIdFromDict(const base::Value& dict) {
+absl::optional<AppId> AppIdFromDict(const base::Value& dict) {
if (!dict.is_dict())
- return base::nullopt;
+ return absl::nullopt;
const std::string* id = dict.FindStringKey(kAppId);
if (!id || id->empty()) {
DLOG(ERROR) << "Invalid id.";
- return base::nullopt;
+ return absl::nullopt;
}
const std::string* type_string = dict.FindStringKey(kAppType);
if (!type_string || type_string->empty()) {
DLOG(ERROR) << "Invalid type.";
- return base::nullopt;
+ return absl::nullopt;
}
return AppId(PolicyStringToAppType(*type_string), *id);
@@ -121,44 +121,44 @@
return value;
}
-base::Optional<AppId> AppIdFromAppInfoDict(const base::Value& dict) {
+absl::optional<AppId> AppIdFromAppInfoDict(const base::Value& dict) {
if (!dict.is_dict())
- return base::nullopt;
+ return absl::nullopt;
const base::Value* app_info = dict.FindKey(kAppInfoDict);
if (!app_info || !app_info->is_dict()) {
DLOG(ERROR) << "Invalid app info dictionary.";
- return base::nullopt;
+ return absl::nullopt;
}
return AppIdFromDict(*app_info);
}
-base::Optional<AppLimit> AppLimitFromDict(const base::Value& dict) {
+absl::optional<AppLimit> AppLimitFromDict(const base::Value& dict) {
if (!dict.is_dict())
- return base::nullopt;
+ return absl::nullopt;
const std::string* restriction_string = dict.FindStringKey(kRestrictionEnum);
if (!restriction_string || restriction_string->empty()) {
DLOG(ERROR) << "Invalid restriction.";
- return base::nullopt;
+ return absl::nullopt;
}
const AppRestriction restriction =
PolicyStringToAppRestriction(*restriction_string);
- base::Optional<int> daily_limit_mins = dict.FindIntKey(kDailyLimitInt);
+ absl::optional<int> daily_limit_mins = dict.FindIntKey(kDailyLimitInt);
if ((restriction == AppRestriction::kTimeLimit && !daily_limit_mins) ||
(restriction == AppRestriction::kBlocked && daily_limit_mins)) {
DLOG(ERROR) << "Invalid restriction.";
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<base::TimeDelta> daily_limit;
+ absl::optional<base::TimeDelta> daily_limit;
if (daily_limit_mins) {
daily_limit = base::TimeDelta::FromMinutes(*daily_limit_mins);
if (daily_limit && (*daily_limit < base::TimeDelta::FromHours(0) ||
*daily_limit > base::TimeDelta::FromHours(24))) {
DLOG(ERROR) << "Invalid daily limit.";
- return base::nullopt;
+ return absl::nullopt;
}
}
@@ -168,7 +168,7 @@
if (!last_updated_string || last_updated_string->empty() ||
!base::StringToInt64(*last_updated_string, &last_updated_millis)) {
DLOG(ERROR) << "Invalid last updated time.";
- return base::nullopt;
+ return absl::nullopt;
}
const base::Time last_updated =
@@ -191,26 +191,26 @@
return value;
}
-base::Optional<base::TimeDelta> ResetTimeFromDict(const base::Value& dict) {
+absl::optional<base::TimeDelta> ResetTimeFromDict(const base::Value& dict) {
if (!dict.is_dict())
- return base::nullopt;
+ return absl::nullopt;
const base::Value* reset_dict = dict.FindKey(kResetAtDict);
if (!reset_dict || !reset_dict->is_dict()) {
DLOG(ERROR) << "Invalid reset time dictionary.";
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<int> hour = reset_dict->FindIntKey(kHourInt);
+ absl::optional<int> hour = reset_dict->FindIntKey(kHourInt);
if (!hour) {
DLOG(ERROR) << "Invalid reset hour.";
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<int> minutes = reset_dict->FindIntKey(kMinInt);
+ absl::optional<int> minutes = reset_dict->FindIntKey(kMinInt);
if (!minutes) {
DLOG(ERROR) << "Invalid reset minutes.";
- return base::nullopt;
+ return absl::nullopt;
}
const int hour_in_mins = base::TimeDelta::FromHours(1).InMinutes();
@@ -226,9 +226,9 @@
return value;
}
-base::Optional<bool> ActivityReportingEnabledFromDict(const base::Value& dict) {
+absl::optional<bool> ActivityReportingEnabledFromDict(const base::Value& dict) {
if (!dict.is_dict())
- return base::nullopt;
+ return absl::nullopt;
return dict.FindBoolPath(kActivityReportingEnabled);
}
@@ -248,13 +248,13 @@
continue;
}
- base::Optional<AppId> app_id = AppIdFromAppInfoDict(dict);
+ absl::optional<AppId> app_id = AppIdFromAppInfoDict(dict);
if (!app_id) {
DLOG(ERROR) << "Invalid app id.";
continue;
}
- base::Optional<AppLimit> app_limit = AppLimitFromDict(dict);
+ absl::optional<AppLimit> app_limit = AppLimitFromDict(dict);
if (!app_limit) {
DLOG(ERROR) << "Invalid app limit.";
continue;
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_time_policy_helpers.h b/chrome/browser/ash/child_accounts/time_limits/app_time_policy_helpers.h
index feb608c..6725413 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_time_policy_helpers.h
+++ b/chrome/browser/ash/child_accounts/time_limits/app_time_policy_helpers.h
@@ -8,8 +8,8 @@
#include <map>
#include <string>
-#include "base/optional.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class TimeDelta;
@@ -51,7 +51,7 @@
// Deserializes AppId from |dict|.
// Returns value if |dict| contains valid app information.
-base::Optional<AppId> AppIdFromDict(const base::Value& dict);
+absl::optional<AppId> AppIdFromDict(const base::Value& dict);
// Serializes AppId to the dictionary.
base::Value AppIdToDict(const AppId& app_id);
@@ -59,25 +59,25 @@
// Deserializes AppId from |dict|.
// Returns value if |dict| contains valid app information in its entry keyed by
// kAppInfoDict.
-base::Optional<AppId> AppIdFromAppInfoDict(const base::Value& dict);
+absl::optional<AppId> AppIdFromAppInfoDict(const base::Value& dict);
// Deserializes AppLimit from |dict|.
// Returns value if |dict| contains valid app limit information.
-base::Optional<AppLimit> AppLimitFromDict(const base::Value& dict);
+absl::optional<AppLimit> AppLimitFromDict(const base::Value& dict);
// Serializes AppLimit to the dictionary.
base::Value AppLimitToDict(const AppLimit& limit);
// Deserializes daily limits reset time from |dict|.
// Returns value if |dict| contains valid reset time information.
-base::Optional<base::TimeDelta> ResetTimeFromDict(const base::Value& dict);
+absl::optional<base::TimeDelta> ResetTimeFromDict(const base::Value& dict);
// Serializes daily limits reset to the dictionary.
base::Value ResetTimeToDict(int hour, int minutes);
// Deserializes activity reporting enabled boolean from |dict|.
// Returns value if |dict| contains a valid entry.
-base::Optional<bool> ActivityReportingEnabledFromDict(const base::Value& dict);
+absl::optional<bool> ActivityReportingEnabledFromDict(const base::Value& dict);
// Deserializes app limits data from the |dict|.
// Will return empty map if |dict| is invalid.
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_types.cc b/chrome/browser/ash/child_accounts/time_limits/app_types.cc
index 36ea9035..9a30892 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_types.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/app_types.cc
@@ -103,16 +103,16 @@
: app_id(app), daily_limit(limit), show_pause_dialog(show_dialog) {}
AppLimit::AppLimit(AppRestriction restriction,
- base::Optional<base::TimeDelta> daily_limit,
+ absl::optional<base::TimeDelta> daily_limit,
base::Time last_updated)
: restriction_(restriction),
daily_limit_(daily_limit),
last_updated_(last_updated) {
DCHECK_EQ(restriction_ == AppRestriction::kBlocked,
- daily_limit_ == base::nullopt);
- DCHECK(daily_limit_ == base::nullopt ||
+ daily_limit_ == absl::nullopt);
+ DCHECK(daily_limit_ == absl::nullopt ||
daily_limit >= base::TimeDelta::FromHours(0));
- DCHECK(daily_limit_ == base::nullopt ||
+ DCHECK(daily_limit_ == absl::nullopt ||
daily_limit <= base::TimeDelta::FromHours(24));
}
@@ -127,11 +127,11 @@
AppLimit::~AppLimit() = default;
// static
-base::Optional<AppActivity::ActiveTime> AppActivity::ActiveTime::Merge(
+absl::optional<AppActivity::ActiveTime> AppActivity::ActiveTime::Merge(
const ActiveTime& t1,
const ActiveTime& t2) {
if (!CanMerge(t1, t2))
- return base::nullopt;
+ return absl::nullopt;
base::Time active_from = std::min(t1.active_from(), t2.active_from());
base::Time active_to = std::max(t1.active_to(), t2.active_to());
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_types.h b/chrome/browser/ash/child_accounts/time_limits/app_types.h
index 720e967..4698be9 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_types.h
+++ b/chrome/browser/ash/child_accounts/time_limits/app_types.h
@@ -8,9 +8,9 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "base/time/time.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace app_time {
@@ -121,7 +121,7 @@
// |daily_limit| can only be set when |restriction| is kTimeLimit.
// |daily_limit| needs to be in range of [0, 24] hours.
AppLimit(AppRestriction restriction,
- base::Optional<base::TimeDelta> daily_limit,
+ absl::optional<base::TimeDelta> daily_limit,
base::Time last_updated);
AppLimit(const AppLimit&);
AppLimit& operator=(const AppLimit&);
@@ -131,7 +131,7 @@
AppRestriction restriction() const { return restriction_; }
base::Time last_updated() const { return last_updated_; }
- const base::Optional<base::TimeDelta>& daily_limit() const {
+ const absl::optional<base::TimeDelta>& daily_limit() const {
return daily_limit_;
}
@@ -141,7 +141,7 @@
// Daily usage limit. Only set |restriction| is kTimeLimit.
// Has to be between 0 and 24 hours.
- base::Optional<base::TimeDelta> daily_limit_;
+ absl::optional<base::TimeDelta> daily_limit_;
// UTC timestamp for the last time the limit was updated.
base::Time last_updated_;
@@ -158,7 +158,7 @@
// each other, this static method creates a new ActiveTime with the earlier
// of |t1|'s or |t2|'s |active_from| and the later of |t1|'s or |t2|'s
// |active_to_|.
- static base::Optional<ActiveTime> Merge(const ActiveTime& t1,
+ static absl::optional<ActiveTime> Merge(const ActiveTime& t1,
const ActiveTime& t2);
ActiveTime(base::Time start, base::Time end);
diff --git a/chrome/browser/ash/child_accounts/time_limits/app_types_unittest.cc b/chrome/browser/ash/child_accounts/time_limits/app_types_unittest.cc
index a126e54e..fab6ae2 100644
--- a/chrome/browser/ash/child_accounts/time_limits/app_types_unittest.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/app_types_unittest.cc
@@ -103,27 +103,27 @@
AppActivity::ActiveTime active_time_2(time2 + delta, time3);
AppActivity::ActiveTime active_time_3(time2 + 3 * delta, time3);
- base::Optional<AppActivity::ActiveTime> merged_time1 =
+ absl::optional<AppActivity::ActiveTime> merged_time1 =
AppActivity::ActiveTime::Merge(active_time_1, active_time_2);
EXPECT_TRUE(merged_time1.has_value());
EXPECT_EQ(merged_time1->active_from(), time1);
EXPECT_EQ(merged_time1->active_to(), time3);
- base::Optional<AppActivity::ActiveTime> merged_time2 =
+ absl::optional<AppActivity::ActiveTime> merged_time2 =
AppActivity::ActiveTime::Merge(active_time_2, active_time_1);
EXPECT_TRUE(merged_time2.has_value());
EXPECT_EQ(merged_time2->active_from(), time1);
EXPECT_EQ(merged_time2->active_to(), time3);
- base::Optional<AppActivity::ActiveTime> merged_time3 =
+ absl::optional<AppActivity::ActiveTime> merged_time3 =
AppActivity::ActiveTime::Merge(active_time_1, active_time_3);
EXPECT_FALSE(merged_time3.has_value());
- base::Optional<AppActivity::ActiveTime> merged_time4 =
+ absl::optional<AppActivity::ActiveTime> merged_time4 =
AppActivity::ActiveTime::Merge(active_time_3, active_time_1);
EXPECT_FALSE(merged_time4.has_value());
- base::Optional<AppActivity::ActiveTime> merged_time5 =
+ absl::optional<AppActivity::ActiveTime> merged_time5 =
AppActivity::ActiveTime::Merge(active_time_2, active_time_3);
EXPECT_TRUE(merged_time5.has_value());
EXPECT_EQ(merged_time5->active_from(), time2 + delta);
diff --git a/chrome/browser/ash/child_accounts/time_limits/persisted_app_info.cc b/chrome/browser/ash/child_accounts/time_limits/persisted_app_info.cc
index b8e99f7..15bbc66 100644
--- a/chrome/browser/ash/child_accounts/time_limits/persisted_app_info.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/persisted_app_info.cc
@@ -23,30 +23,30 @@
constexpr char kActiveFromKey[] = "active_from";
constexpr char kActiveToKey[] = "active_to";
-base::Optional<AppActivity::ActiveTime> AppActivityFromDict(
+absl::optional<AppActivity::ActiveTime> AppActivityFromDict(
const base::Value& value) {
if (!value.is_dict()) {
VLOG(1) << "Value is not a dictionary";
- return base::nullopt;
+ return absl::nullopt;
}
const std::string* active_from = value.FindStringKey(kActiveFromKey);
if (!active_from) {
VLOG(1) << "Invalid |active_from| entry in dictionary";
- return base::nullopt;
+ return absl::nullopt;
}
const std::string* active_to = value.FindStringKey(kActiveToKey);
if (!active_to) {
VLOG(1) << "Invalid |active_to| entry in dictionary.";
- return base::nullopt;
+ return absl::nullopt;
}
int64_t active_from_microseconds;
int64_t active_to_microseconds;
if (!base::StringToInt64(*active_from, &active_from_microseconds) ||
!base::StringToInt64(*active_to, &active_to_microseconds)) {
- return base::nullopt;
+ return absl::nullopt;
}
base::Time active_from_time = base::Time::FromDeltaSinceWindowsEpoch(
@@ -83,7 +83,7 @@
base::Value::ConstListView list_view = list->GetList();
for (const auto& value : list_view) {
- base::Optional<AppActivity::ActiveTime> entry = AppActivityFromDict(value);
+ absl::optional<AppActivity::ActiveTime> entry = AppActivityFromDict(value);
if (!entry)
continue;
active_times.push_back(entry.value());
@@ -95,35 +95,35 @@
} // namespace
// static
-base::Optional<PersistedAppInfo> PersistedAppInfo::PersistedAppInfoFromDict(
+absl::optional<PersistedAppInfo> PersistedAppInfo::PersistedAppInfoFromDict(
const base::Value* dict,
bool include_app_activity_array) {
if (!dict || !dict->is_dict()) {
VLOG(1) << "Invalid application information.";
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<AppId> app_id = policy::AppIdFromAppInfoDict(*dict);
+ absl::optional<AppId> app_id = policy::AppIdFromAppInfoDict(*dict);
if (!app_id)
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<AppState> state = GetAppStateFromDict(dict);
+ absl::optional<AppState> state = GetAppStateFromDict(dict);
if (!state) {
VLOG(1) << "Invalid application state.";
- return base::nullopt;
+ return absl::nullopt;
}
const std::string* running_active_time =
dict->FindStringKey(kRunningActiveTimeKey);
if (!running_active_time) {
VLOG(1) << "Invalid running active time.";
- return base::nullopt;
+ return absl::nullopt;
}
int64_t running_active_time_int;
if (!base::StringToInt64(*running_active_time, &running_active_time_int)) {
VLOG(1) << "Invalid running active time.";
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<AppActivity::ActiveTime> active_times;
@@ -149,7 +149,7 @@
base::Value::ConstListView list_view = value->GetList();
for (const auto& per_app_info : list_view) {
- base::Optional<PersistedAppInfo> info =
+ absl::optional<PersistedAppInfo> info =
PersistedAppInfoFromDict(&per_app_info, include_app_activity_array);
if (!info.has_value())
continue;
@@ -161,14 +161,14 @@
}
// static
-base::Optional<AppState> PersistedAppInfo::GetAppStateFromDict(
+absl::optional<AppState> PersistedAppInfo::GetAppStateFromDict(
const base::Value* value) {
if (!value || !value->is_dict())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<int> state = value->FindIntKey(kAppStateKey);
+ absl::optional<int> state = value->FindIntKey(kAppStateKey);
if (!state.has_value())
- return base::nullopt;
+ return absl::nullopt;
return static_cast<AppState>(state.value());
}
@@ -251,11 +251,11 @@
base::Value::ListView list_view = value->GetList();
if (list_view.size() > 0) {
base::Value& mergeable_entry = list_view[list_view.size() - 1];
- base::Optional<AppActivity::ActiveTime> active_time =
+ absl::optional<AppActivity::ActiveTime> active_time =
AppActivityFromDict(mergeable_entry);
DCHECK(active_time.has_value());
- base::Optional<AppActivity::ActiveTime> merged =
+ absl::optional<AppActivity::ActiveTime> merged =
AppActivity::ActiveTime::Merge(active_time.value(), active_times_[0]);
if (merged.has_value()) {
mergeable_entry = AppActivityToDict(merged.value());
diff --git a/chrome/browser/ash/child_accounts/time_limits/persisted_app_info.h b/chrome/browser/ash/child_accounts/time_limits/persisted_app_info.h
index 31427cc..efe875e 100644
--- a/chrome/browser/ash/child_accounts/time_limits/persisted_app_info.h
+++ b/chrome/browser/ash/child_accounts/time_limits/persisted_app_info.h
@@ -7,9 +7,9 @@
#include <vector>
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/child_accounts/time_limits/app_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Value;
@@ -20,13 +20,13 @@
class PersistedAppInfo {
public:
- static base::Optional<PersistedAppInfo> PersistedAppInfoFromDict(
+ static absl::optional<PersistedAppInfo> PersistedAppInfoFromDict(
const base::Value* value,
bool include_app_activity_array);
static std::vector<PersistedAppInfo> PersistedAppInfosFromList(
const base::Value* value,
bool include_app_activity_array);
- static base::Optional<AppState> GetAppStateFromDict(const base::Value* value);
+ static absl::optional<AppState> GetAppStateFromDict(const base::Value* value);
PersistedAppInfo(const AppId& app_id,
AppState state,
diff --git a/chrome/browser/ash/child_accounts/time_limits/persisted_app_info_unittest.cc b/chrome/browser/ash/child_accounts/time_limits/persisted_app_info_unittest.cc
index f24d14d..996ccb9 100644
--- a/chrome/browser/ash/child_accounts/time_limits/persisted_app_info_unittest.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/persisted_app_info_unittest.cc
@@ -74,7 +74,7 @@
{{to_append}});
app_info2.UpdateAppActivityPreference(&entry, /* replace */ false);
- base::Optional<PersistedAppInfo> updated_entry =
+ absl::optional<PersistedAppInfo> updated_entry =
PersistedAppInfo::PersistedAppInfoFromDict(
&entry, /* include_app_activity_array */ true);
ASSERT_TRUE(updated_entry.has_value());
@@ -89,7 +89,7 @@
EXPECT_EQ(active_times[3], to_append);
app_info2.UpdateAppActivityPreference(&entry, /* replace */ true);
- base::Optional<PersistedAppInfo> final_entry =
+ absl::optional<PersistedAppInfo> final_entry =
PersistedAppInfo::PersistedAppInfoFromDict(
&entry, /* include_app_activity_array */ true);
EXPECT_TRUE(final_entry.has_value());
diff --git a/chrome/browser/ash/child_accounts/time_limits/web_time_activity_provider.cc b/chrome/browser/ash/child_accounts/time_limits/web_time_activity_provider.cc
index b4849f4..4fca813b 100644
--- a/chrome/browser/ash/child_accounts/time_limits/web_time_activity_provider.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/web_time_activity_provider.cc
@@ -225,7 +225,7 @@
continue;
}
- const base::Optional<WebTimeNavigationObserver::NavigationInfo>& info =
+ const absl::optional<WebTimeNavigationObserver::NavigationInfo>& info =
observer->last_navigation_info();
// The first navigation has not occurred yet.
diff --git a/chrome/browser/ash/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.cc b/chrome/browser/ash/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.cc
index 07cb7b7..70902df 100644
--- a/chrome/browser/ash/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.cc
@@ -33,7 +33,7 @@
std::u16string block_message,
base::TimeDelta time_limit,
const std::string& app_locale,
- const base::Optional<std::u16string>& title) {
+ const absl::optional<std::u16string>& title) {
base::DictionaryValue strings;
if (!title.has_value()) {
@@ -66,7 +66,7 @@
std::string GetWebTimeLimitChromeErrorPage(
const std::string& domain,
- const base::Optional<std::u16string>& title,
+ const absl::optional<std::u16string>& title,
base::TimeDelta time_limit,
const std::string& app_locale) {
auto block_header = l10n_util::GetStringFUTF16(
diff --git a/chrome/browser/ash/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.h b/chrome/browser/ash/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.h
index ef13d7d3..7ef990aa 100644
--- a/chrome/browser/ash/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.h
+++ b/chrome/browser/ash/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_ASH_CHILD_ACCOUNTS_TIME_LIMITS_WEB_TIME_LIMIT_ERROR_PAGE_WEB_TIME_LIMIT_ERROR_PAGE_H_
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
@@ -23,7 +23,7 @@
// |app_locale| is used to specify the locale used by the browser.
std::string GetWebTimeLimitChromeErrorPage(
const std::string& domain,
- const base::Optional<std::u16string>& title,
+ const absl::optional<std::u16string>& title,
base::TimeDelta time_limit,
const std::string& app_locale);
diff --git a/chrome/browser/ash/child_accounts/time_limits/web_time_limit_navigation_throttle.cc b/chrome/browser/ash/child_accounts/time_limits/web_time_limit_navigation_throttle.cc
index 5d00dbc..ca2b0c9 100644
--- a/chrome/browser/ash/child_accounts/time_limits/web_time_limit_navigation_throttle.cc
+++ b/chrome/browser/ash/child_accounts/time_limits/web_time_limit_navigation_throttle.cc
@@ -8,7 +8,6 @@
#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "chrome/browser/ash/child_accounts/child_user_service.h"
#include "chrome/browser/ash/child_accounts/child_user_service_factory.h"
#include "chrome/browser/ash/child_accounts/time_limits/app_types.h"
@@ -28,6 +27,7 @@
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -183,8 +183,8 @@
app_time::WebTimeNavigationObserver* observer =
app_time::WebTimeNavigationObserver::FromWebContents(web_contents);
- const base::Optional<std::u16string>& prev_title =
- observer ? observer->previous_title() : base::nullopt;
+ const absl::optional<std::u16string>& prev_title =
+ observer ? observer->previous_title() : absl::nullopt;
return NavigationThrottle::ThrottleCheckResult(
CANCEL, net::ERR_BLOCKED_BY_CLIENT,
diff --git a/chrome/browser/ash/child_accounts/time_limits/web_time_navigation_observer.h b/chrome/browser/ash/child_accounts/time_limits/web_time_navigation_observer.h
index ecf9cbb..e233b34 100644
--- a/chrome/browser/ash/child_accounts/time_limits/web_time_navigation_observer.h
+++ b/chrome/browser/ash/child_accounts/time_limits/web_time_navigation_observer.h
@@ -8,11 +8,11 @@
#include <string>
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/child_accounts/time_limits/app_types.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -68,11 +68,11 @@
void WebContentsDestroyed() override;
void TitleWasSet(content::NavigationEntry* entry) override;
- const base::Optional<NavigationInfo>& last_navigation_info() const {
+ const absl::optional<NavigationInfo>& last_navigation_info() const {
return last_navigation_info_;
}
- const base::Optional<std::u16string>& previous_title() const {
+ const absl::optional<std::u16string>& previous_title() const {
return previous_title_;
}
@@ -86,9 +86,9 @@
base::ObserverList<EventListener> listeners_;
- base::Optional<NavigationInfo> last_navigation_info_ = base::nullopt;
+ absl::optional<NavigationInfo> last_navigation_info_ = absl::nullopt;
- base::Optional<std::u16string> previous_title_;
+ absl::optional<std::u16string> previous_title_;
WEB_CONTENTS_USER_DATA_KEY_DECL();
};
diff --git a/chrome/browser/ash/child_accounts/usage_time_limit_processor.cc b/chrome/browser/ash/child_accounts/usage_time_limit_processor.cc
index 08b4f71..18eba28 100644
--- a/chrome/browser/ash/child_accounts/usage_time_limit_processor.cc
+++ b/chrome/browser/ash/child_accounts/usage_time_limit_processor.cc
@@ -65,7 +65,7 @@
// Returns usage limit reset time or default value if |time_usage_limit| is
// invalid.
base::TimeDelta GetUsageLimitResetTime(
- const base::Optional<internal::TimeUsageLimit>& time_usage_limit) {
+ const absl::optional<internal::TimeUsageLimit>& time_usage_limit) {
if (time_usage_limit)
return time_usage_limit->resets_at;
return kDefaultUsageLimitResetTime;
@@ -75,15 +75,15 @@
class UsageTimeLimitProcessor {
public:
UsageTimeLimitProcessor(
- base::Optional<internal::TimeWindowLimit> time_window_limit,
- base::Optional<internal::TimeUsageLimit> time_usage_limit,
- base::Optional<TimeLimitOverride> time_limit_override,
- base::Optional<TimeLimitOverride> local_time_limit_override,
+ absl::optional<internal::TimeWindowLimit> time_window_limit,
+ absl::optional<internal::TimeUsageLimit> time_usage_limit,
+ absl::optional<TimeLimitOverride> time_limit_override,
+ absl::optional<TimeLimitOverride> local_time_limit_override,
const base::TimeDelta& used_time,
const base::Time& usage_timestamp,
const base::Time& current_time,
const icu::TimeZone* const time_zone,
- const base::Optional<State>& previous_state);
+ const absl::optional<State>& previous_state);
~UsageTimeLimitProcessor() = default;
@@ -94,17 +94,17 @@
base::Time GetExpectedResetTime();
// Difference between today user's usage quota and usage time.
- base::Optional<base::TimeDelta> GetRemainingTimeUsage();
+ absl::optional<base::TimeDelta> GetRemainingTimeUsage();
private:
// Get the active time window limit.
- base::Optional<internal::TimeWindowLimitEntry> GetActiveTimeWindowLimit();
+ absl::optional<internal::TimeWindowLimitEntry> GetActiveTimeWindowLimit();
// Get the active time usage limit.
- base::Optional<internal::TimeUsageLimitEntry> GetActiveTimeUsageLimit();
+ absl::optional<internal::TimeUsageLimitEntry> GetActiveTimeUsageLimit();
// Get the enabled time usage limit.
- base::Optional<internal::TimeUsageLimitEntry> GetEnabledTimeUsageLimit();
+ absl::optional<internal::TimeUsageLimitEntry> GetEnabledTimeUsageLimit();
// Returns the duration of all the consuctive time window limit starting at
// the given weekday.
@@ -187,16 +187,16 @@
base::Time ConvertPolicyTime(base::TimeDelta policy_time, int shift_in_days);
// The policy time window limit object.
- base::Optional<internal::TimeWindowLimit> time_window_limit_;
+ absl::optional<internal::TimeWindowLimit> time_window_limit_;
// The policy time usage limit object.
- base::Optional<internal::TimeUsageLimit> time_usage_limit_;
+ absl::optional<internal::TimeUsageLimit> time_usage_limit_;
// The policy override object.
- base::Optional<TimeLimitOverride> time_limit_override_;
+ absl::optional<TimeLimitOverride> time_limit_override_;
// The local override object.
- base::Optional<TimeLimitOverride> local_time_limit_override_;
+ absl::optional<TimeLimitOverride> local_time_limit_override_;
// How long the user has used the device.
const base::TimeDelta used_time_;
@@ -214,25 +214,25 @@
internal::Weekday current_weekday_;
// The previous state calculated by this class.
- const base::Optional<State>& previous_state_;
+ const absl::optional<State>& previous_state_;
// The active time window limit. If this is set, it means that the user
// session should be locked, in other words, there is a time window limit set
// for the current day, the current time is inside that window and no unlock
// override is preventing it to be locked.
- base::Optional<internal::TimeWindowLimitEntry> active_time_window_limit_;
+ absl::optional<internal::TimeWindowLimitEntry> active_time_window_limit_;
// The active time usage limit. If this is set, it means that the user session
// should be locked, in other words, there is a time usage limit set for the
// current day, the user has used all their usage quota and no unlock override
// is preventing it to be locked.
- base::Optional<internal::TimeUsageLimitEntry> active_time_usage_limit_;
+ absl::optional<internal::TimeUsageLimitEntry> active_time_usage_limit_;
// If this is set, it means that there is a time usage limit set for today,
// but it is not necessarily active. It could be inactive either because the
// user haven't used all their quota or because there is an unlock override
// active.
- base::Optional<internal::TimeUsageLimitEntry> enabled_time_usage_limit_;
+ absl::optional<internal::TimeUsageLimitEntry> enabled_time_usage_limit_;
// Whether there is a window limit overridden.
bool overridden_window_limit_ = false;
@@ -242,15 +242,15 @@
};
UsageTimeLimitProcessor::UsageTimeLimitProcessor(
- base::Optional<internal::TimeWindowLimit> time_window_limit,
- base::Optional<internal::TimeUsageLimit> time_usage_limit,
- base::Optional<TimeLimitOverride> time_limit_override,
- base::Optional<TimeLimitOverride> local_time_limit_override,
+ absl::optional<internal::TimeWindowLimit> time_window_limit,
+ absl::optional<internal::TimeUsageLimit> time_usage_limit,
+ absl::optional<TimeLimitOverride> time_limit_override,
+ absl::optional<TimeLimitOverride> local_time_limit_override,
const base::TimeDelta& used_time,
const base::Time& usage_timestamp,
const base::Time& current_time,
const icu::TimeZone* const time_zone,
- const base::Optional<State>& previous_state)
+ const absl::optional<State>& previous_state)
: time_window_limit_(std::move(time_window_limit)),
time_usage_limit_(std::move(time_usage_limit)),
used_time_(used_time),
@@ -291,10 +291,10 @@
return ConvertPolicyTime(UsageLimitResetTime(), shift_in_days);
}
-base::Optional<base::TimeDelta>
+absl::optional<base::TimeDelta>
UsageTimeLimitProcessor::GetRemainingTimeUsage() {
if (!enabled_time_usage_limit_)
- return base::nullopt;
+ return absl::nullopt;
return std::max(enabled_time_usage_limit_->usage_quota - used_time_,
base::TimeDelta::FromMinutes(0));
}
@@ -306,7 +306,7 @@
// Time usage limit is enabled if there is an entry for the current day and it
// is not overridden.
- base::Optional<base::TimeDelta> remaining_usage = GetRemainingTimeUsage();
+ absl::optional<base::TimeDelta> remaining_usage = GetRemainingTimeUsage();
if (remaining_usage) {
state.is_time_usage_limit_enabled = true;
state.remaining_usage = remaining_usage.value();
@@ -344,7 +344,7 @@
base::TimeDelta UsageTimeLimitProcessor::GetConsecutiveTimeWindowLimitDuration(
internal::Weekday weekday) {
base::TimeDelta duration = base::TimeDelta::FromMinutes(0);
- base::Optional<internal::TimeWindowLimitEntry> current_day_entry =
+ absl::optional<internal::TimeWindowLimitEntry> current_day_entry =
time_window_limit_->entries[weekday];
if (!time_window_limit_ || !current_day_entry)
@@ -353,7 +353,7 @@
// Iterate throught entries as long as they are consecutive, or overlap.
base::TimeDelta last_entry_end = current_day_entry->starts_at;
for (int i = 0; i < static_cast<int>(internal::Weekday::kCount); i++) {
- base::Optional<internal::TimeWindowLimitEntry> window_limit_entry =
+ absl::optional<internal::TimeWindowLimitEntry> window_limit_entry =
time_window_limit_->entries[internal::WeekdayShift(weekday, i)];
// It is not consecutive.
@@ -393,7 +393,7 @@
if (WasOverrideCanceledByWindowLimit(weekday))
return false;
- base::Optional<internal::TimeWindowLimitEntry> window_limit_entry =
+ absl::optional<internal::TimeWindowLimitEntry> window_limit_entry =
time_window_limit_->entries[weekday];
int days_behind = 0;
@@ -449,7 +449,7 @@
if (!time_usage_limit_ || !time_limit_override_)
return false;
- base::Optional<internal::TimeUsageLimitEntry> usage_limit_entry =
+ absl::optional<internal::TimeUsageLimitEntry> usage_limit_entry =
time_usage_limit_->entries[weekday];
// If the time usage limit has been updated since the override, the
@@ -463,7 +463,7 @@
if (!time_window_limit_ || !time_limit_override_)
return false;
- base::Optional<TimeWindowLimitEntry> window_limit =
+ absl::optional<TimeWindowLimitEntry> window_limit =
time_window_limit_->entries[weekday];
// If the window limit has been updated since the override, the
@@ -495,7 +495,7 @@
internal::Weekday previous_weekday =
internal::WeekdayShift(current_weekday_, -1);
- base::Optional<internal::TimeWindowLimitEntry> previous_day_entry =
+ absl::optional<internal::TimeWindowLimitEntry> previous_day_entry =
time_window_limit_->entries[previous_weekday];
// Active time window limit that started on the previous day.
@@ -507,18 +507,18 @@
return !WasOverrideCanceledByWindowLimit(current_weekday_);
}
-base::Optional<internal::TimeWindowLimitEntry>
+absl::optional<internal::TimeWindowLimitEntry>
UsageTimeLimitProcessor::GetActiveTimeWindowLimit() {
if (!time_window_limit_)
- return base::nullopt;
+ return absl::nullopt;
internal::Weekday previous_weekday =
internal::WeekdayShift(current_weekday_, -1);
- base::Optional<internal::TimeWindowLimitEntry> previous_day_entry =
+ absl::optional<internal::TimeWindowLimitEntry> previous_day_entry =
time_window_limit_->entries[previous_weekday];
// Active time window limit that started on the previous day.
- base::Optional<internal::TimeWindowLimitEntry> previous_day_active_entry;
+ absl::optional<internal::TimeWindowLimitEntry> previous_day_active_entry;
if (previous_day_entry && previous_day_entry->IsOvernight()) {
base::Time limit_start =
ConvertPolicyTime(previous_day_entry->starts_at, -1);
@@ -533,11 +533,11 @@
}
}
- base::Optional<internal::TimeWindowLimitEntry> current_day_entry =
+ absl::optional<internal::TimeWindowLimitEntry> current_day_entry =
time_window_limit_->entries[current_weekday_];
// Active time window limit that started today.
- base::Optional<internal::TimeWindowLimitEntry> current_day_active_entry;
+ absl::optional<internal::TimeWindowLimitEntry> current_day_active_entry;
if (current_day_entry) {
base::Time limit_start = ConvertPolicyTime(current_day_entry->starts_at, 0);
base::Time limit_end = ConvertPolicyTime(
@@ -569,10 +569,10 @@
return previous_day_active_entry;
}
-base::Optional<internal::TimeUsageLimitEntry>
+absl::optional<internal::TimeUsageLimitEntry>
UsageTimeLimitProcessor::GetEnabledTimeUsageLimit() {
if (!time_usage_limit_)
- return base::nullopt;
+ return absl::nullopt;
internal::Weekday current_usage_limit_day =
current_time_ >= ConvertPolicyTime(UsageLimitResetTime(), 0)
@@ -581,28 +581,28 @@
return time_usage_limit_->entries[current_usage_limit_day];
}
-base::Optional<internal::TimeUsageLimitEntry>
+absl::optional<internal::TimeUsageLimitEntry>
UsageTimeLimitProcessor::GetActiveTimeUsageLimit() {
if (!time_usage_limit_)
- return base::nullopt;
+ return absl::nullopt;
internal::Weekday current_usage_limit_day =
current_time_ > ConvertPolicyTime(UsageLimitResetTime(), 0)
? current_weekday_
: internal::WeekdayShift(current_weekday_, -1);
- base::Optional<internal::TimeUsageLimitEntry> current_usage_limit =
+ absl::optional<internal::TimeUsageLimitEntry> current_usage_limit =
GetEnabledTimeUsageLimit();
if (IsUsageLimitOverridden(current_usage_limit_day)) {
overridden_usage_limit_ = true;
- return base::nullopt;
+ return absl::nullopt;
}
if (current_usage_limit && used_time_ >= current_usage_limit->usage_quota)
return current_usage_limit;
- return base::nullopt;
+ return absl::nullopt;
}
bool UsageTimeLimitProcessor::IsOverrideDurationFinished() {
@@ -646,7 +646,7 @@
// created.
for (int i = -1; i <= 0; i++) {
internal::Weekday weekday = WeekdayShift(current_weekday_, i);
- base::Optional<TimeWindowLimitEntry> window_limit =
+ absl::optional<TimeWindowLimitEntry> window_limit =
time_window_limit_->entries[weekday];
if (window_limit) {
base::Time window_limit_start =
@@ -766,7 +766,7 @@
// Check if yesterdays, todays or tomorrows window limit will be active
// when the reset happens.
for (int i = -1; i <= 1; i++) {
- base::Optional<TimeWindowLimitEntry> window_limit =
+ absl::optional<TimeWindowLimitEntry> window_limit =
time_window_limit_->entries[WeekdayShift(current_weekday_, i)];
if (window_limit) {
TimeWindowLimitBoundaries limits = window_limit->GetLimits(
@@ -794,7 +794,7 @@
// tomorrow's time window limit.
for (int i = -1; i <= 1; i++) {
internal::Weekday weekday = WeekdayShift(current_weekday_, i);
- base::Optional<TimeWindowLimitEntry> window_limit =
+ absl::optional<TimeWindowLimitEntry> window_limit =
time_window_limit_->entries[weekday];
if (window_limit) {
base::Time window_limit_start =
@@ -853,7 +853,7 @@
// Search a time window limit in the next following days.
for (int i = 0; i < static_cast<int>(internal::Weekday::kCount); i++) {
- base::Optional<internal::TimeWindowLimitEntry> entry =
+ absl::optional<internal::TimeWindowLimitEntry> entry =
time_window_limit_.value()
.entries[internal::WeekdayShift(start_day, i)];
if (entry) {
@@ -888,7 +888,7 @@
// end.
if (time_usage_limit_) {
for (int i = 1; i < static_cast<int>(internal::Weekday::kCount); i++) {
- base::Optional<internal::TimeUsageLimitEntry> usage_limit_entry =
+ absl::optional<internal::TimeUsageLimitEntry> usage_limit_entry =
time_usage_limit_
->entries[internal::WeekdayShift(current_weekday_, i)];
if (usage_limit_entry) {
@@ -963,7 +963,7 @@
// time, if it happens, the next active policy should be fixed limit.
for (int i = -1; i <= 1; i++) {
internal::Weekday weekday = WeekdayShift(current_weekday_, i);
- base::Optional<TimeWindowLimitEntry> window_limit =
+ absl::optional<TimeWindowLimitEntry> window_limit =
time_window_limit_->entries[weekday];
if (window_limit) {
base::Time window_start =
@@ -986,7 +986,7 @@
if (!time_window_limit_)
return false;
- base::Optional<internal::TimeWindowLimitEntry> yesterday_window_limit =
+ absl::optional<internal::TimeWindowLimitEntry> yesterday_window_limit =
time_window_limit_.value()
.entries[internal::WeekdayShift(current_weekday_, -1)];
base::TimeDelta delta_from_midnight =
@@ -1203,27 +1203,27 @@
} // namespace internal
-base::Optional<internal::TimeWindowLimit> TimeWindowLimitFromPolicy(
+absl::optional<internal::TimeWindowLimit> TimeWindowLimitFromPolicy(
const base::Value& time_limit) {
DCHECK(time_limit.is_dict());
const base::Value* time_window_limit_value =
time_limit.FindKey(internal::kTimeWindowLimit);
if (!time_window_limit_value)
- return base::nullopt;
+ return absl::nullopt;
return internal::TimeWindowLimit(*time_window_limit_value);
}
-base::Optional<internal::TimeUsageLimit> TimeUsageLimitFromPolicy(
+absl::optional<internal::TimeUsageLimit> TimeUsageLimitFromPolicy(
const base::Value& time_limit) {
DCHECK(time_limit.is_dict());
const base::Value* time_usage_limit_value =
time_limit.FindKey(internal::kTimeUsageLimit);
if (!time_usage_limit_value)
- return base::nullopt;
+ return absl::nullopt;
return internal::TimeUsageLimit(*time_usage_limit_value);
}
-base::Optional<TimeLimitOverride> OverrideFromPolicy(
+absl::optional<TimeLimitOverride> OverrideFromPolicy(
const base::Value& time_limit) {
DCHECK(time_limit.is_dict());
const base::Value* override_value =
@@ -1237,15 +1237,15 @@
const base::Time& usage_timestamp,
const base::Time& current_time,
const icu::TimeZone* const time_zone,
- const base::Optional<State>& previous_state) {
+ const absl::optional<State>& previous_state) {
DCHECK(time_limit.is_dict());
- base::Optional<internal::TimeWindowLimit> time_window_limit =
+ absl::optional<internal::TimeWindowLimit> time_window_limit =
TimeWindowLimitFromPolicy(time_limit);
- base::Optional<internal::TimeUsageLimit> time_usage_limit =
+ absl::optional<internal::TimeUsageLimit> time_usage_limit =
TimeUsageLimitFromPolicy(time_limit);
- base::Optional<TimeLimitOverride> time_limit_override =
+ absl::optional<TimeLimitOverride> time_limit_override =
OverrideFromPolicy(time_limit);
- base::Optional<TimeLimitOverride> local_time_limit_override =
+ absl::optional<TimeLimitOverride> local_time_limit_override =
TimeLimitOverride::FromDictionary(local_override);
// TODO(agawronska): Pass |usage_timestamp| instead of second |current_time|.
return internal::UsageTimeLimitProcessor(
@@ -1261,43 +1261,43 @@
const base::Time current_time,
const icu::TimeZone* const time_zone) {
DCHECK(time_limit.is_dict());
- base::Optional<internal::TimeWindowLimit> time_window_limit =
+ absl::optional<internal::TimeWindowLimit> time_window_limit =
TimeWindowLimitFromPolicy(time_limit);
- base::Optional<internal::TimeUsageLimit> time_usage_limit =
+ absl::optional<internal::TimeUsageLimit> time_usage_limit =
TimeUsageLimitFromPolicy(time_limit);
- base::Optional<TimeLimitOverride> time_limit_override =
+ absl::optional<TimeLimitOverride> time_limit_override =
OverrideFromPolicy(time_limit);
- base::Optional<TimeLimitOverride> local_time_limit_override =
+ absl::optional<TimeLimitOverride> local_time_limit_override =
TimeLimitOverride::FromDictionary(local_override);
return internal::UsageTimeLimitProcessor(
std::move(time_window_limit), std::move(time_usage_limit),
std::move(time_limit_override),
std::move(local_time_limit_override),
base::TimeDelta::FromMinutes(0), base::Time(), current_time,
- time_zone, base::nullopt)
+ time_zone, absl::nullopt)
.GetExpectedResetTime();
}
-base::Optional<base::TimeDelta> GetRemainingTimeUsage(
+absl::optional<base::TimeDelta> GetRemainingTimeUsage(
const base::Value& time_limit,
const base::Value* local_override,
const base::Time current_time,
const base::TimeDelta& used_time,
const icu::TimeZone* const time_zone) {
DCHECK(time_limit.is_dict());
- base::Optional<internal::TimeWindowLimit> time_window_limit =
+ absl::optional<internal::TimeWindowLimit> time_window_limit =
TimeWindowLimitFromPolicy(time_limit);
- base::Optional<internal::TimeUsageLimit> time_usage_limit =
+ absl::optional<internal::TimeUsageLimit> time_usage_limit =
TimeUsageLimitFromPolicy(time_limit);
- base::Optional<TimeLimitOverride> time_limit_override =
+ absl::optional<TimeLimitOverride> time_limit_override =
OverrideFromPolicy(time_limit);
- base::Optional<TimeLimitOverride> local_time_limit_override =
+ absl::optional<TimeLimitOverride> local_time_limit_override =
TimeLimitOverride::FromDictionary(local_override);
return internal::UsageTimeLimitProcessor(
std::move(time_window_limit), std::move(time_usage_limit),
std::move(time_limit_override),
std::move(local_time_limit_override), used_time, base::Time(),
- current_time, time_zone, base::nullopt)
+ current_time, time_zone, absl::nullopt)
.GetRemainingTimeUsage();
}
@@ -1321,9 +1321,9 @@
updated_policies.insert(PolicyType::kFixedLimit);
}
- base::Optional<TimeLimitOverride> old_override =
+ absl::optional<TimeLimitOverride> old_override =
OverrideFromPolicy(old_policy);
- base::Optional<TimeLimitOverride> new_override =
+ absl::optional<TimeLimitOverride> new_override =
OverrideFromPolicy(new_policy);
// Override changes are added only when the new override has a duration.
if (old_override != new_override && new_override &&
@@ -1340,21 +1340,21 @@
DCHECK(time_limit_prefs.is_dict());
if (!enabled_policies)
return;
- base::Optional<internal::TimeWindowLimit> time_window_limit =
+ absl::optional<internal::TimeWindowLimit> time_window_limit =
TimeWindowLimitFromPolicy(time_limit_prefs);
if (time_window_limit && !time_window_limit->entries.empty()) {
enabled_policies->insert(
FamilyUserParentalControlMetrics::TimeLimitPolicyType::kBedTimeLimit);
}
- base::Optional<internal::TimeUsageLimit> time_usage_limit =
+ absl::optional<internal::TimeUsageLimit> time_usage_limit =
TimeUsageLimitFromPolicy(time_limit_prefs);
if (time_usage_limit && !time_usage_limit->entries.empty()) {
enabled_policies->insert(FamilyUserParentalControlMetrics::
TimeLimitPolicyType::kScreenTimeLimit);
}
- base::Optional<TimeLimitOverride> time_limit_override =
+ absl::optional<TimeLimitOverride> time_limit_override =
OverrideFromPolicy(time_limit_prefs);
base::Time now = base::Time::Now();
// Ignores the override time limit that is not created within 1 day.
diff --git a/chrome/browser/ash/child_accounts/usage_time_limit_processor.h b/chrome/browser/ash/child_accounts/usage_time_limit_processor.h
index c7b6e75..cf9e795 100644
--- a/chrome/browser/ash/child_accounts/usage_time_limit_processor.h
+++ b/chrome/browser/ash/child_accounts/usage_time_limit_processor.h
@@ -14,10 +14,10 @@
#include <unordered_map>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/child_accounts/family_user_parental_control_metrics.h"
#include "chromeos/settings/timezone_settings.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Value;
@@ -75,7 +75,7 @@
bool operator==(const TimeWindowLimit&) const;
bool operator!=(const TimeWindowLimit& rhs) const { return !(*this == rhs); }
- std::unordered_map<Weekday, base::Optional<TimeWindowLimitEntry>> entries;
+ std::unordered_map<Weekday, absl::optional<TimeWindowLimitEntry>> entries;
private:
DISALLOW_COPY_AND_ASSIGN(TimeWindowLimit);
@@ -101,7 +101,7 @@
bool operator==(const TimeUsageLimit&) const;
bool operator!=(const TimeUsageLimit& rhs) const { return !(*this == rhs); }
- std::unordered_map<Weekday, base::Optional<TimeUsageLimitEntry>> entries;
+ std::unordered_map<Weekday, absl::optional<TimeUsageLimitEntry>> entries;
base::TimeDelta resets_at;
private:
@@ -167,7 +167,7 @@
const base::Time& usage_timestamp,
const base::Time& current_time,
const icu::TimeZone* const time_zone,
- const base::Optional<State>& previous_state);
+ const absl::optional<State>& previous_state);
// Returns the expected time that the used time stored should be reset.
// |time_limit| dictionary with UsageTimeLimit policy data.
@@ -183,7 +183,7 @@
// |local_override| dictionary with data of the last local override (authorized
// by parent access code).
// |used_time| time used in the current day.
-base::Optional<base::TimeDelta> GetRemainingTimeUsage(
+absl::optional<base::TimeDelta> GetRemainingTimeUsage(
const base::Value& time_limit,
const base::Value* local_override,
const base::Time current_time,
diff --git a/chrome/browser/ash/child_accounts/usage_time_limit_processor_unittest.cc b/chrome/browser/ash/child_accounts/usage_time_limit_processor_unittest.cc
index efa6e2f..fdf4ceb 100644
--- a/chrome/browser/ash/child_accounts/usage_time_limit_processor_unittest.cc
+++ b/chrome/browser/ash/child_accounts/usage_time_limit_processor_unittest.cc
@@ -178,7 +178,7 @@
overrides.Append(std::move(override_two));
// Call tested functions.
- base::Optional<TimeLimitOverride> override_struct =
+ absl::optional<TimeLimitOverride> override_struct =
TimeLimitOverride::MostRecentFromList(&overrides);
// Assert right fields are set.
@@ -225,7 +225,7 @@
overrides.Append(std::move(override_three));
// Call tested functions.
- base::Optional<TimeLimitOverride> override_struct =
+ absl::optional<TimeLimitOverride> override_struct =
TimeLimitOverride::MostRecentFromList(&overrides);
// Assert right fields are set.
@@ -269,7 +269,7 @@
overrides.Append(std::move(override_four));
// Call tested functions.
- base::Optional<TimeLimitOverride> override_struct =
+ absl::optional<TimeLimitOverride> override_struct =
TimeLimitOverride::MostRecentFromList(&overrides);
// Assert right fields are set.
@@ -312,7 +312,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 20:00 GMT+0300");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(0), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -375,7 +375,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 20:00");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(120), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -447,7 +447,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 14:00");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(80), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -532,7 +532,7 @@
base::Time time_one = utils::TimeFromString("Fri, 5 Jan 2018 15:00 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromHours(1), time_one, time_one,
- timezone.get(), base::nullopt);
+ timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = true;
@@ -560,7 +560,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 15:05");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(0), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
// Check that the device is locked until next morning.
State expected_state_one;
@@ -591,7 +591,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 15:05");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(0), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
// Check that the device is locked until end of window limit.
State expected_state_one;
@@ -644,7 +644,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 18:35 GMT+0800");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(120), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -699,7 +699,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 22:10 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(40), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -748,7 +748,7 @@
base::Time time_one = utils::TimeFromString("Sun, 7 Jan 2018 15:00 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(40), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -818,7 +818,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 21:00 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(40), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = true;
@@ -908,7 +908,7 @@
State night_state = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(40), night_time,
- night_time, timezone.get(), base::nullopt);
+ night_time, timezone.get(), absl::nullopt);
State expected_night_state;
expected_night_state.is_locked = true;
@@ -923,7 +923,7 @@
State morning_state = GetState(
policy, nullptr /* local_override */, base::TimeDelta::FromMinutes(40),
- morning_time, night_time, timezone.get(), base::nullopt);
+ morning_time, night_time, timezone.get(), absl::nullopt);
State expected_morning_state;
expected_morning_state.is_locked = true;
@@ -977,7 +977,7 @@
State night_state = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromHours(3), night_time,
- night_time, timezone.get(), base::nullopt);
+ night_time, timezone.get(), absl::nullopt);
State expected_night_state;
expected_night_state.is_locked = true;
@@ -1023,7 +1023,7 @@
base::Time time_one = utils::TimeFromString("Sun, 7 Jan 2018 8:00 GMT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(80), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = true;
@@ -1052,7 +1052,7 @@
base::Time time_one = utils::TimeFromString("Sun, 7 Jan 2018 4:00 GMT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromHours(2), time_one, time_one,
- timezone.get(), base::nullopt);
+ timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = true;
@@ -1083,7 +1083,7 @@
base::Time time_one = utils::TimeFromString("Sat, 6 Jan 2018 20:00 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromHours(2), time_one, time_one,
- timezone.get(), base::nullopt);
+ timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = true;
@@ -1117,7 +1117,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 15:00 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = true;
@@ -1182,7 +1182,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 12:00 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -1252,7 +1252,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 22:00 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -1268,7 +1268,7 @@
base::Time time_two = utils::TimeFromString("Mon, 1 Jan 2018 22:15 PST");
State state_two = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_two,
- time_two, timezone.get(), base::nullopt);
+ time_two, timezone.get(), absl::nullopt);
State expected_state_two;
expected_state_two.is_locked = true;
@@ -1301,7 +1301,7 @@
base::Time time = utils::TimeFromString("Mon, 1 Jan 2018 22:35 GMT");
State state = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time, time,
- timezone.get(), base::nullopt);
+ timezone.get(), absl::nullopt);
// Check that the device is locked until 6AM.
State expected_state;
@@ -1340,7 +1340,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 22:00 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -1356,7 +1356,7 @@
base::Time time_two = utils::TimeFromString("Mon, 1 Jan 2018 22:15 PST");
State state_two = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_two,
- time_two, timezone.get(), base::nullopt);
+ time_two, timezone.get(), absl::nullopt);
State expected_state_two;
expected_state_two.is_locked = true;
@@ -1374,7 +1374,7 @@
base::Time time_three = utils::TimeFromString("Tue, 2 Jan 2018 6:00 PST");
State state_three = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_three,
- time_three, timezone.get(), base::nullopt);
+ time_three, timezone.get(), absl::nullopt);
State expected_state_three;
expected_state_three.is_locked = true;
@@ -1404,7 +1404,7 @@
base::Time time_one = utils::TimeFromString("Thu, 4 Jan 2018 9:45 GMT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(105), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -1476,7 +1476,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 9:45 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(105), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -1550,7 +1550,7 @@
base::Time time_one = utils::TimeFromString("Sat, 6 Jan 2018 9:45 GMT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(105), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -1625,7 +1625,7 @@
base::Time time_one = utils::TimeFromString("Wed, 3 Jan 2018 9:45 BRT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(105), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -1701,7 +1701,7 @@
base::Time time_one = utils::TimeFromString("Tue, 2 Jan 2018 22:45 BRT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromHours(2), time_one, time_one,
- timezone.get(), base::nullopt);
+ timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -1717,7 +1717,7 @@
base::Time time_two = utils::TimeFromString("Tue, 2 Jan 2018 23:00 BRT");
State state_two = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromHours(2), time_two, time_two,
- timezone.get(), base::nullopt);
+ timezone.get(), absl::nullopt);
State expected_state_two;
expected_state_two.is_locked = true;
@@ -1748,7 +1748,7 @@
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 10:00 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromHours(2), time_one, time_one,
- timezone.get(), base::nullopt);
+ timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = true;
@@ -1821,7 +1821,7 @@
base::Time time_one = utils::TimeFromString("Sat, 6 Jan 2018 9:45 BRT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(105), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -1900,7 +1900,7 @@
base::Time time_one = utils::TimeFromString("Wed, 3 Jan 2018 22:00 GMT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -1919,7 +1919,7 @@
time_two);
State state_two = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_two,
- time_two, timezone.get(), base::nullopt);
+ time_two, timezone.get(), absl::nullopt);
State expected_state_two;
expected_state_two.is_locked = false;
@@ -1948,7 +1948,7 @@
base::Time time_one = utils::TimeFromString("Sun, 7 Jan 2018 9:45 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(105), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -2023,7 +2023,7 @@
base::Time time_one = utils::TimeFromString("Tue, 2 Jan 2018 0:15 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -2041,7 +2041,7 @@
utils::CreateTime(10, 0), time_two);
State state_two = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_two,
- time_two, timezone.get(), base::nullopt);
+ time_two, timezone.get(), absl::nullopt);
State expected_state_two;
expected_state_two.is_locked = true;
@@ -2072,7 +2072,7 @@
base::Time time_one = utils::TimeFromString("Fri, 5 Jan 2018 9:45 PST");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(105), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -2148,7 +2148,7 @@
base::Time time_one = utils::TimeFromString("Wed, 3 Jan 2018 22:15 GMT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_one,
- time_one, timezone.get(), base::nullopt);
+ time_one, timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = false;
@@ -2164,7 +2164,7 @@
base::Time time_two = utils::TimeFromString("Wed, 3 Jan 2018 22:30 GMT");
State state_two = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromMinutes(60), time_two,
- time_two, timezone.get(), base::nullopt);
+ time_two, timezone.get(), absl::nullopt);
State expected_state_two;
expected_state_two.is_locked = true;
@@ -2185,7 +2185,7 @@
time_three);
State state_three = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromHours(2), time_three,
- time_three, timezone.get(), base::nullopt);
+ time_three, timezone.get(), absl::nullopt);
State expected_state_three;
expected_state_three.is_locked = false;
@@ -2214,7 +2214,7 @@
base::Time time_one = utils::TimeFromString("Thu, 4 Jan 2018 10:00 BRT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromHours(2), time_one, time_one,
- timezone.get(), base::nullopt);
+ timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = true;
@@ -2290,7 +2290,7 @@
base::Time time_one = utils::TimeFromString("Wed, 3 Jan 2018 14:00 BRT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromHours(2), time_one, time_one,
- timezone.get(), base::nullopt);
+ timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = true;
@@ -2394,7 +2394,7 @@
base::Time time_one = utils::TimeFromString("Wed, 3 Jan 2018 7:00 BRT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromHours(0), time_one, time_one,
- timezone.get(), base::nullopt);
+ timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = true;
@@ -2504,7 +2504,7 @@
base::Time time_one = utils::TimeFromString("Wed, 3 Jan 2018 7:00 BRT");
State state_one = GetState(policy, nullptr /* local_override */,
base::TimeDelta::FromHours(0), time_one, time_one,
- timezone.get(), base::nullopt);
+ timezone.get(), absl::nullopt);
State expected_state_one;
expected_state_one.is_locked = true;
@@ -2589,13 +2589,13 @@
usage_time_limit::TimeLimitOverride(
usage_time_limit::TimeLimitOverride::Action::kUnlock,
last_updated - base::TimeDelta::FromMinutes(5),
- base::nullopt /* duration */)
+ absl::nullopt /* duration */)
.ToDictionary();
State state =
GetState(policy, &inactive_local_override,
base::TimeDelta::FromMinutes(0), current_time, current_time,
- timezone.get(), base::nullopt /* previous_state */);
+ timezone.get(), absl::nullopt /* previous_state */);
base::Time monday_bedtime_end;
ASSERT_TRUE(
@@ -2612,12 +2612,12 @@
usage_time_limit::TimeLimitOverride(
usage_time_limit::TimeLimitOverride::Action::kUnlock,
current_time - base::TimeDelta::FromMinutes(5),
- base::nullopt /* duration */)
+ absl::nullopt /* duration */)
.ToDictionary();
state = GetState(policy, &active_local_override,
base::TimeDelta::FromMinutes(0), current_time, current_time,
- timezone.get(), base::nullopt /* previous_state */);
+ timezone.get(), absl::nullopt /* previous_state */);
base::Time tuesday_bedtime_start;
ASSERT_TRUE(base::Time::FromString("Tue, 2 Jan 2018 18:00 GMT",
@@ -2666,7 +2666,7 @@
usage_time_limit::TimeLimitOverride(
usage_time_limit::TimeLimitOverride::Action::kUnlock,
timestamp - base::TimeDelta::FromMinutes(5),
- base::nullopt /* duration */)
+ absl::nullopt /* duration */)
.ToDictionary();
const base::Time current_time = timestamp + base::TimeDelta::FromMinutes(10);
@@ -2682,7 +2682,7 @@
base::Value active_local_override =
usage_time_limit::TimeLimitOverride(
usage_time_limit::TimeLimitOverride::Action::kUnlock, current_time,
- base::nullopt /* duration */)
+ absl::nullopt /* duration */)
.ToDictionary();
state = GetState(policy, &active_local_override, kDailyLimit, current_time,
@@ -2715,13 +2715,13 @@
usage_time_limit::TimeLimitOverride(
usage_time_limit::TimeLimitOverride::Action::kUnlock,
current_time - base::TimeDelta::FromHours(2),
- base::nullopt /* duration */)
+ absl::nullopt /* duration */)
.ToDictionary();
State state =
GetState(policy, &inactive_local_override,
base::TimeDelta::FromMinutes(0), current_time, current_time,
- timezone.get(), base::nullopt /* previous_state */);
+ timezone.get(), absl::nullopt /* previous_state */);
base::Time next_day;
ASSERT_TRUE(base::Time::FromString("Mon, 2 Jan 2018 00:00 GMT", &next_day));
@@ -2737,12 +2737,12 @@
usage_time_limit::TimeLimitOverride(
usage_time_limit::TimeLimitOverride::Action::kUnlock,
current_time - base::TimeDelta::FromMinutes(5),
- base::nullopt /* duration */)
+ absl::nullopt /* duration */)
.ToDictionary();
state = GetState(policy, &active_local_override,
base::TimeDelta::FromMinutes(0), current_time, current_time,
- timezone.get(), base::nullopt /* previous_state */);
+ timezone.get(), absl::nullopt /* previous_state */);
// Unlocked by local override.
EXPECT_FALSE(state.is_locked);
@@ -2819,11 +2819,11 @@
// Setup policy.
base::Value policy = base::Value(base::Value::Type::DICTIONARY);
base::Time time_one = utils::TimeFromString("Mon, 1 Jan 2018 22:00");
- base::Optional<base::TimeDelta> remaining_usage =
+ absl::optional<base::TimeDelta> remaining_usage =
GetRemainingTimeUsage(policy, nullptr /* local_override */, time_one,
base::TimeDelta(), timezone.get());
- ASSERT_EQ(remaining_usage, base::nullopt);
+ ASSERT_EQ(remaining_usage, absl::nullopt);
}
// Test GetExpectedResetTime with a policy.
@@ -2840,20 +2840,20 @@
// Check that the remaining time is 2 hours.
base::Time time_one = utils::TimeFromString("Wed, 3 Jan 2018 10:00 BRT");
- base::Optional<base::TimeDelta> remaining_usage_one =
+ absl::optional<base::TimeDelta> remaining_usage_one =
GetRemainingTimeUsage(policy, nullptr /* local_override */, time_one,
base::TimeDelta::FromHours(0), timezone.get());
- ASSERT_FALSE(remaining_usage_one == base::nullopt);
+ ASSERT_FALSE(remaining_usage_one == absl::nullopt);
ASSERT_EQ(remaining_usage_one, base::TimeDelta::FromHours(2));
// Check that remaining time changes to 1 hour if device was used for 1 hour.
base::Time time_two = utils::TimeFromString("Wed, 3 Jan 2018 11:00 BRT");
- base::Optional<base::TimeDelta> remaining_usage_two =
+ absl::optional<base::TimeDelta> remaining_usage_two =
GetRemainingTimeUsage(policy, nullptr /* local_override */, time_two,
base::TimeDelta::FromHours(1), timezone.get());
- ASSERT_FALSE(remaining_usage_two == base::nullopt);
+ ASSERT_FALSE(remaining_usage_two == absl::nullopt);
ASSERT_EQ(remaining_usage_two, base::TimeDelta::FromHours(1));
}
diff --git a/chrome/browser/ash/crosapi/browser_manager.h b/chrome/browser/ash/crosapi/browser_manager.h
index a87056a..bed82b44 100644
--- a/chrome/browser/ash/crosapi/browser_manager.h
+++ b/chrome/browser/ash/crosapi/browser_manager.h
@@ -14,7 +14,6 @@
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/process/process.h"
#include "base/time/time.h"
#include "chrome/browser/ash/crosapi/browser_manager_observer.h"
@@ -25,6 +24,7 @@
#include "chromeos/crosapi/mojom/crosapi.mojom.h"
#include "components/session_manager/core/session_manager_observer.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace component_updater {
class CrOSComponentManager;
@@ -119,7 +119,7 @@
bool GetActiveTabUrlSupported() const;
using GetActiveTabUrlCallback =
- base::OnceCallback<void(const base::Optional<GURL>&)>;
+ base::OnceCallback<void(const absl::optional<GURL>&)>;
// Gets Url of the active tab from lacros if there is any.
void GetActiveTabUrl(GetActiveTabUrlCallback callback);
@@ -321,12 +321,12 @@
// ID for the current Crosapi connection.
// Available only when lacros-chrome is running.
- base::Optional<CrosapiId> crosapi_id_;
- base::Optional<CrosapiId> legacy_crosapi_id_;
+ absl::optional<CrosapiId> crosapi_id_;
+ absl::optional<CrosapiId> legacy_crosapi_id_;
// Proxy to BrowserService mojo service in lacros-chrome.
// Available during lacros-chrome is running.
- base::Optional<BrowserServiceInfo> browser_service_;
+ absl::optional<BrowserServiceInfo> browser_service_;
// Helps set up and manage the mojo connections between lacros-chrome and
// ash-chrome in testing environment. Only applicable when
diff --git a/chrome/browser/ash/crosapi/browser_util.cc b/chrome/browser/ash/crosapi/browser_util.cc
index adb6a4e1..c2593c0 100644
--- a/chrome/browser/ash/crosapi/browser_util.cc
+++ b/chrome/browser/ash/crosapi/browser_util.cc
@@ -16,7 +16,6 @@
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/process/process_handle.h"
#include "base/stl_util.h"
@@ -54,6 +53,7 @@
#include "media/capture/mojom/video_capture.mojom.h"
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/system/invitation.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using user_manager::User;
using version_info::Channel;
@@ -64,7 +64,7 @@
bool g_lacros_enabled_for_test = false;
-base::Optional<bool> g_lacros_primary_browser_for_test;
+absl::optional<bool> g_lacros_primary_browser_for_test;
// Some account types require features that aren't yet supported by lacros.
// See https://crbug.com/1080693
@@ -152,16 +152,16 @@
// Returns the vector containing policy data of the device account. In case of
// an error, returns nullopt.
-base::Optional<std::vector<uint8_t>> GetDeviceAccountPolicy(
+absl::optional<std::vector<uint8_t>> GetDeviceAccountPolicy(
EnvironmentProvider* environment_provider) {
if (!user_manager::UserManager::IsInitialized()) {
LOG(ERROR) << "User not initialized.";
- return base::nullopt;
+ return absl::nullopt;
}
const auto* primary_user = user_manager::UserManager::Get()->GetPrimaryUser();
if (!primary_user) {
LOG(ERROR) << "No primary user.";
- return base::nullopt;
+ return absl::nullopt;
}
std::string policy_data = environment_provider->GetDeviceAccountPolicy();
return std::vector<uint8_t>(policy_data.begin(), policy_data.end());
@@ -405,7 +405,7 @@
return base::FeatureList::IsEnabled(chromeos::features::kLacrosPrimary);
}
-void SetLacrosPrimaryBrowserForTest(base::Optional<bool> value) {
+void SetLacrosPrimaryBrowserForTest(absl::optional<bool> value) {
g_lacros_primary_browser_for_test = value;
}
@@ -514,7 +514,7 @@
params->device_account_gaia_id =
environment_provider->GetDeviceAccountGaiaId();
- const base::Optional<account_manager::Account> maybe_device_account =
+ const absl::optional<account_manager::Account> maybe_device_account =
environment_provider->GetDeviceAccount();
if (maybe_device_account) {
params->device_account =
diff --git a/chrome/browser/ash/crosapi/browser_util.h b/chrome/browser/ash/crosapi/browser_util.h
index db2dd74..f3ad60fb 100644
--- a/chrome/browser/ash/crosapi/browser_util.h
+++ b/chrome/browser/ash/crosapi/browser_util.h
@@ -8,12 +8,12 @@
#include "base/callback_forward.h"
#include "base/containers/flat_map.h"
#include "base/feature_list.h"
-#include "base/optional.h"
#include "base/token.h"
#include "chrome/browser/ash/crosapi/environment_provider.h"
#include "chromeos/crosapi/mojom/crosapi.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefRegistrySimple;
class PrefService;
@@ -126,8 +126,8 @@
bool IsLacrosPrimaryBrowser(version_info::Channel channel);
// Forces IsLacrosPrimaryBrowser() to return true or false for testing.
-// Passing base::nullopt will reset the state.
-void SetLacrosPrimaryBrowserForTest(base::Optional<bool> value);
+// Passing absl::nullopt will reset the state.
+void SetLacrosPrimaryBrowserForTest(absl::optional<bool> value);
// Returns true if the lacros can be used as a primary browser
// for the current session.
diff --git a/chrome/browser/ash/crosapi/browser_util_unittest.cc b/chrome/browser/ash/crosapi/browser_util_unittest.cc
index 670ea6f..5378494 100644
--- a/chrome/browser/ash/crosapi/browser_util_unittest.cc
+++ b/chrome/browser/ash/crosapi/browser_util_unittest.cc
@@ -366,7 +366,7 @@
"metadata_version": 1
}
)###";
- base::Optional<base::Value> value = base::JSONReader::Read(json_string);
+ absl::optional<base::Value> value = base::JSONReader::Read(json_string);
EXPECT_FALSE(
browser_util::DoesMetadataSupportNewAccountManager(&value.value()));
}
@@ -380,7 +380,7 @@
"metadata_version": 1
}
)###";
- base::Optional<base::Value> value = base::JSONReader::Read(json_string);
+ absl::optional<base::Value> value = base::JSONReader::Read(json_string);
EXPECT_FALSE(
browser_util::DoesMetadataSupportNewAccountManager(&value.value()));
}
@@ -394,7 +394,7 @@
"metadata_version": 1
}
)###";
- base::Optional<base::Value> value = base::JSONReader::Read(json_string);
+ absl::optional<base::Value> value = base::JSONReader::Read(json_string);
EXPECT_FALSE(
browser_util::DoesMetadataSupportNewAccountManager(&value.value()));
}
@@ -408,7 +408,7 @@
"metadata_version": 1
}
)###";
- base::Optional<base::Value> value = base::JSONReader::Read(json_string);
+ absl::optional<base::Value> value = base::JSONReader::Read(json_string);
EXPECT_TRUE(
browser_util::DoesMetadataSupportNewAccountManager(&value.value()));
}
diff --git a/chrome/browser/ash/crosapi/cert_database_ash.cc b/chrome/browser/ash/crosapi/cert_database_ash.cc
index 10f367d..f7d026e 100644
--- a/chrome/browser/ash/crosapi/cert_database_ash.cc
+++ b/chrome/browser/ash/crosapi/cert_database_ash.cc
@@ -97,7 +97,7 @@
void CertDatabaseAsh::OnTpmTokenReady(
std::unique_ptr<chromeos::TPMTokenInfoGetter> token_getter,
GetCertDatabaseInfoCallback callback,
- base::Optional<user_data_auth::TpmTokenInfo> token_info) {
+ absl::optional<user_data_auth::TpmTokenInfo> token_info) {
is_tpm_token_ready_ = token_info.has_value();
// Calling the initial method again. Since |is_tpm_token_ready_| is not empty
diff --git a/chrome/browser/ash/crosapi/cert_database_ash.h b/chrome/browser/ash/crosapi/cert_database_ash.h
index f43d965a4..0fbd417 100644
--- a/chrome/browser/ash/crosapi/cert_database_ash.h
+++ b/chrome/browser/ash/crosapi/cert_database_ash.h
@@ -6,12 +6,12 @@
#define CHROME_BROWSER_ASH_CROSAPI_CERT_DATABASE_ASH_H_
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chromeos/crosapi/mojom/cert_database.mojom.h"
#include "chromeos/dbus/cryptohome/UserDataAuth.pb.h"
#include "chromeos/login/login_state/login_state.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
class TPMTokenInfoGetter;
@@ -54,9 +54,9 @@
void OnTpmTokenReady(
std::unique_ptr<chromeos::TPMTokenInfoGetter> token_getter,
GetCertDatabaseInfoCallback callback,
- base::Optional<user_data_auth::TpmTokenInfo> token_info);
+ absl::optional<user_data_auth::TpmTokenInfo> token_info);
- base::Optional<bool> is_tpm_token_ready_;
+ absl::optional<bool> is_tpm_token_ready_;
// This class supports any number of connections. This allows the client to
// have multiple, potentially thread-affine, remotes.
diff --git a/chrome/browser/ash/crosapi/environment_provider.cc b/chrome/browser/ash/crosapi/environment_provider.cc
index dfd5f92..403ee62 100644
--- a/chrome/browser/ash/crosapi/environment_provider.cc
+++ b/chrome/browser/ash/crosapi/environment_provider.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ash/crosapi/environment_provider.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/system/sys_info.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chrome/browser/chromeos/file_manager/path_util.h"
@@ -18,6 +17,7 @@
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crosapi {
@@ -101,29 +101,29 @@
return account_id.GetGaiaId();
}
-base::Optional<account_manager::Account>
+absl::optional<account_manager::Account>
EnvironmentProvider::GetDeviceAccount() {
// Lacros doesn't support Multi-Login. Get the Primary User.
const user_manager::User* user =
user_manager::UserManager::Get()->GetPrimaryUser();
if (!user)
- return base::nullopt;
+ return absl::nullopt;
const AccountId& account_id = user->GetAccountId();
switch (account_id.GetAccountType()) {
case AccountType::ACTIVE_DIRECTORY:
- return base::make_optional(account_manager::Account{
+ return absl::make_optional(account_manager::Account{
account_manager::AccountKey{
account_id.GetObjGuid(),
account_manager::AccountType::kActiveDirectory},
user->GetDisplayEmail()});
case AccountType::GOOGLE:
- return base::make_optional(account_manager::Account{
+ return absl::make_optional(account_manager::Account{
account_manager::AccountKey{account_id.GetGaiaId(),
account_manager::AccountType::kGaia},
user->GetDisplayEmail()});
case AccountType::UNKNOWN:
- return base::nullopt;
+ return absl::nullopt;
}
}
diff --git a/chrome/browser/ash/crosapi/environment_provider.h b/chrome/browser/ash/crosapi/environment_provider.h
index 1bbc0c19..a835a56 100644
--- a/chrome/browser/ash/crosapi/environment_provider.h
+++ b/chrome/browser/ash/crosapi/environment_provider.h
@@ -7,9 +7,9 @@
#include <string>
-#include "base/optional.h"
#include "chromeos/crosapi/mojom/crosapi.mojom.h"
#include "components/account_manager_core/account.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crosapi {
@@ -38,7 +38,7 @@
// a Microsoft Active Directory account.
// Returns a `nullopt` for Guest Sessions, Managed Guest Sessions,
// Demo Mode, and Kiosks.
- virtual base::Optional<account_manager::Account> GetDeviceAccount();
+ virtual absl::optional<account_manager::Account> GetDeviceAccount();
// Getter and setter for device account policy data. Used to pass data from
// Ash to Lacros. The format is serialized PolicyFetchResponse object. See
diff --git a/chrome/browser/ash/crosapi/keystore_service_ash.cc b/chrome/browser/ash/crosapi/keystore_service_ash.cc
index 251d183d..1bd7721f 100644
--- a/chrome/browser/ash/crosapi/keystore_service_ash.cc
+++ b/chrome/browser/ash/crosapi/keystore_service_ash.cc
@@ -8,7 +8,6 @@
#include "base/memory/scoped_refptr.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/unguessable_token.h"
#include "chrome/browser/ash/attestation/tpm_challenge_key.h"
@@ -21,6 +20,7 @@
#include "chromeos/crosapi/cpp/keystore_service_util.h"
#include "content/public/browser/browser_thread.h"
#include "net/cert/x509_certificate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/boringssl/src/include/openssl/pool.h"
namespace crosapi {
@@ -66,9 +66,9 @@
return service;
}
-base::Optional<TokenId> KeystoreToToken(mojom::KeystoreType type) {
+absl::optional<TokenId> KeystoreToToken(mojom::KeystoreType type) {
if (!crosapi::mojom::IsKnownEnumValue(type)) {
- return base::nullopt;
+ return absl::nullopt;
}
switch (type) {
case mojom::KeystoreType::kUser:
@@ -78,7 +78,7 @@
}
}
-base::Optional<std::string> StringFromSigningAlgorithmName(
+absl::optional<std::string> StringFromSigningAlgorithmName(
SigningAlgorithmName name) {
switch (name) {
case SigningAlgorithmName::kRsassaPkcs115:
@@ -86,7 +86,7 @@
case SigningAlgorithmName::kEcdsa:
return crosapi::keystore_service_util::kWebCryptoEcdsa;
case SigningAlgorithmName::kUnknown:
- return base::nullopt;
+ return absl::nullopt;
}
}
@@ -270,7 +270,7 @@
GetCertificatesCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
PlatformKeysService* platform_keys_service = GetPlatformKeys();
- base::Optional<TokenId> token_id = KeystoreToToken(keystore);
+ absl::optional<TokenId> token_id = KeystoreToToken(keystore);
if (!token_id) {
std::move(callback).Run(mojom::GetCertificatesResult::NewErrorMessage(
kUnsupportedKeystoreType));
@@ -321,7 +321,7 @@
std::move(callback).Run(kEnterprisePlatformErrorInvalidX509Cert);
return;
}
- base::Optional<TokenId> token_id = KeystoreToToken(keystore);
+ absl::optional<TokenId> token_id = KeystoreToToken(keystore);
if (!token_id) {
std::move(callback).Run(kUnsupportedKeystoreType);
return;
@@ -356,7 +356,7 @@
std::move(callback).Run(kEnterprisePlatformErrorInvalidX509Cert);
return;
}
- base::Optional<TokenId> token_id = KeystoreToToken(keystore);
+ absl::optional<TokenId> token_id = KeystoreToToken(keystore);
if (!token_id) {
std::move(callback).Run(kUnsupportedKeystoreType);
return;
@@ -386,7 +386,7 @@
mojom::KeystoreSigningAlgorithmName algorithm_name,
GetPublicKeyCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<std::string> name =
+ absl::optional<std::string> name =
StringFromSigningAlgorithmName(algorithm_name);
if (!name) {
std::move(callback).Run(mojom::GetPublicKeyResult::NewErrorMessage(
@@ -402,7 +402,7 @@
mojom::GetPublicKeyResultPtr result_ptr = mojom::GetPublicKeyResult::New();
if (output.status == chromeos::platform_keys::Status::kSuccess) {
- base::Optional<crosapi::mojom::KeystoreSigningAlgorithmPtr>
+ absl::optional<crosapi::mojom::KeystoreSigningAlgorithmPtr>
signing_algorithm =
crosapi::keystore_service_util::SigningAlgorithmFromDictionary(
output.algorithm);
@@ -428,7 +428,7 @@
void KeystoreServiceAsh::ExtensionGenerateKey(
mojom::KeystoreType keystore,
mojom::KeystoreSigningAlgorithmPtr algorithm,
- const base::Optional<std::string>& extension_id,
+ const absl::optional<std::string>& extension_id,
ExtensionGenerateKeyCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!extension_id) {
@@ -440,7 +440,7 @@
ExtensionPlatformKeysService* ext_platform_keys_service =
GetExtensionPlatformKeys();
- base::Optional<TokenId> token_id = KeystoreToToken(keystore);
+ absl::optional<TokenId> token_id = KeystoreToToken(keystore);
if (!token_id) {
std::move(callback).Run(
mojom::ExtensionKeystoreBinaryResult::NewErrorMessage(
@@ -480,7 +480,7 @@
void KeystoreServiceAsh::DidExtensionGenerateKey(
ExtensionGenerateKeyCallback callback,
const std::string& public_key,
- base::Optional<crosapi::mojom::KeystoreError> error) {
+ absl::optional<crosapi::mojom::KeystoreError> error) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
crosapi::mojom::ExtensionKeystoreBinaryResultPtr result_ptr =
mojom::ExtensionKeystoreBinaryResult::New();
@@ -503,7 +503,7 @@
const std::string& extension_id,
ExtensionSignCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<TokenId> token_id = KeystoreToToken(keystore);
+ absl::optional<TokenId> token_id = KeystoreToToken(keystore);
if (!token_id) {
std::move(callback).Run(
mojom::ExtensionKeystoreBinaryResult::NewErrorMessage(
@@ -594,7 +594,7 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
PlatformKeysService* platform_keys_service = GetPlatformKeys();
- base::Optional<TokenId> token_id = KeystoreToToken(keystore);
+ absl::optional<TokenId> token_id = KeystoreToToken(keystore);
if (!token_id) {
std::move(callback).Run(mojom::KeystoreBinaryResult::NewError(
mojom::KeystoreError::kUnsupportedKeystoreType));
diff --git a/chrome/browser/ash/crosapi/keystore_service_ash.h b/chrome/browser/ash/crosapi/keystore_service_ash.h
index 043bc77e..0d13fc5b 100644
--- a/chrome/browser/ash/crosapi/keystore_service_ash.h
+++ b/chrome/browser/ash/crosapi/keystore_service_ash.h
@@ -58,7 +58,7 @@
GetPublicKeyCallback callback) override;
void ExtensionGenerateKey(mojom::KeystoreType keystore,
mojom::KeystoreSigningAlgorithmPtr algorithm,
- const base::Optional<std::string>& extension_id,
+ const absl::optional<std::string>& extension_id,
ExtensionGenerateKeyCallback callback) override;
void ExtensionSign(KeystoreType keystore,
const std::vector<uint8_t>& public_key,
@@ -92,7 +92,7 @@
static void DidExtensionGenerateKey(
ExtensionGenerateKeyCallback callback,
const std::string& public_key,
- base::Optional<crosapi::mojom::KeystoreError> error);
+ absl::optional<crosapi::mojom::KeystoreError> error);
static void DidExtensionSign(ExtensionSignCallback callback,
const std::string& signature,
chromeos::platform_keys::Status status);
diff --git a/chrome/browser/ash/crosapi/local_printer_ash.cc b/chrome/browser/ash/crosapi/local_printer_ash.cc
index a171343..36d2bee 100644
--- a/chrome/browser/ash/crosapi/local_printer_ash.cc
+++ b/chrome/browser/ash/crosapi/local_printer_ash.cc
@@ -16,7 +16,6 @@
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chrome/browser/browser_process.h"
@@ -41,6 +40,7 @@
#include "printing/print_settings.h"
#include "printing/printing_features.h"
#include "printing/printing_utils.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace crosapi {
@@ -148,7 +148,7 @@
std::unique_ptr<chromeos::PrinterConfigurer>,
PrefService* prefs,
const chromeos::Printer& printer,
- const base::Optional<printing::PrinterSemanticCapsAndDefaults>& caps) {
+ const absl::optional<printing::PrinterSemanticCapsAndDefaults>& caps) {
return mojom::CapabilitiesResponse::New(
PrinterToMojom(printer), printer.HasSecureProtocol(), caps,
prefs->GetInteger(prefs::kPrintingAllowedColorModes),
@@ -197,7 +197,7 @@
chromeos::CupsPrintersManagerFactory::GetForBrowserContext(profile);
std::unique_ptr<chromeos::PrinterConfigurer> printer_configurer(
chromeos::PrinterConfigurer::Create(profile));
- base::Optional<chromeos::Printer> printer =
+ absl::optional<chromeos::Printer> printer =
printers_manager->GetPrinter(printer_id);
if (!printer) {
// If the printer was removed, the lookup will fail.
@@ -217,7 +217,7 @@
Profile* profile = ProfileManager::GetActiveUserProfile();
chromeos::CupsPrintersManager* printers_manager =
chromeos::CupsPrintersManagerFactory::GetForBrowserContext(profile);
- base::Optional<chromeos::Printer> printer =
+ absl::optional<chromeos::Printer> printer =
printers_manager->GetPrinter(printer_id);
if (!printer) {
// If the printer does not exist, fetching for the license will fail.
diff --git a/chrome/browser/ash/crosapi/message_center_ash.cc b/chrome/browser/ash/crosapi/message_center_ash.cc
index c744b26..001e2d28 100644
--- a/chrome/browser/ash/crosapi/message_center_ash.cc
+++ b/chrome/browser/ash/crosapi/message_center_ash.cc
@@ -12,11 +12,11 @@
#include "base/check.h"
#include "base/memory/scoped_refptr.h"
#include "base/numerics/ranges.h"
-#include "base/optional.h"
#include "chromeos/crosapi/mojom/message_center.mojom.h"
#include "chromeos/crosapi/mojom/notification.mojom.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/image/image.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/public/cpp/notification.h"
@@ -134,8 +134,8 @@
remote_delegate_->OnNotificationClosed(by_user);
}
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
if (button_index) {
// Chrome OS does not support inline reply. The button index comes out of
// trusted ash-side message center UI code and is guaranteed not to be
diff --git a/chrome/browser/ash/crosapi/message_center_ash_unittest.cc b/chrome/browser/ash/crosapi/message_center_ash_unittest.cc
index 6e77d40c..760f6c9 100644
--- a/chrome/browser/ash/crosapi/message_center_ash_unittest.cc
+++ b/chrome/browser/ash/crosapi/message_center_ash_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
@@ -17,6 +16,7 @@
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/image/image.h"
@@ -314,14 +314,14 @@
ASSERT_TRUE(ui_notification);
// Simulate the user clicking on the notification body.
- ui_notification->delegate()->Click(/*button_index=*/base::nullopt,
- /*reply=*/base::nullopt);
+ ui_notification->delegate()->Click(/*button_index=*/absl::nullopt,
+ /*reply=*/absl::nullopt);
mojo_delegate.receiver_.FlushForTesting();
EXPECT_EQ(1, mojo_delegate.clicked_count_);
// Simulate the user clicking on a notification button.
ui_notification->delegate()->Click(/*button_index=*/1,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
mojo_delegate.receiver_.FlushForTesting();
EXPECT_EQ(1, mojo_delegate.button_clicked_count_);
EXPECT_EQ(1u, mojo_delegate.last_button_index_);
diff --git a/chrome/browser/ash/crosapi/metrics_reporting_ash_unittest.cc b/chrome/browser/ash/crosapi/metrics_reporting_ash_unittest.cc
index 8cfd933..638a6a5 100644
--- a/chrome/browser/ash/crosapi/metrics_reporting_ash_unittest.cc
+++ b/chrome/browser/ash/crosapi/metrics_reporting_ash_unittest.cc
@@ -6,7 +6,6 @@
#include <memory>
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "chrome/test/base/scoped_testing_local_state.h"
@@ -17,6 +16,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crosapi {
namespace {
@@ -34,7 +34,7 @@
}
// Public because this is test code.
- base::Optional<bool> metrics_enabled_;
+ absl::optional<bool> metrics_enabled_;
mojo::Receiver<mojom::MetricsReportingObserver> receiver_{this};
};
@@ -49,7 +49,7 @@
void SetMetricsReportingEnabled(bool enabled) override { enabled_ = enabled; }
// Public because this is test code.
- base::Optional<bool> enabled_;
+ absl::optional<bool> enabled_;
};
class MetricsReportingAshTest : public testing::Test {
diff --git a/chrome/browser/ash/crosapi/prefs_ash.cc b/chrome/browser/ash/crosapi/prefs_ash.cc
index fc45d39..b96058e 100644
--- a/chrome/browser/ash/crosapi/prefs_ash.cc
+++ b/chrome/browser/ash/crosapi/prefs_ash.cc
@@ -58,8 +58,8 @@
auto state = GetState(path);
const base::Value* value =
state ? state->pref_service->Get(state->path) : nullptr;
- std::move(callback).Run(value ? base::Optional<base::Value>(value->Clone())
- : base::nullopt);
+ std::move(callback).Run(value ? absl::optional<base::Value>(value->Clone())
+ : absl::nullopt);
}
void PrefsAsh::SetPref(mojom::PrefPath path,
@@ -108,7 +108,7 @@
OnPrimaryProfileReady(primary_profile);
}
-base::Optional<PrefsAsh::State> PrefsAsh::GetState(mojom::PrefPath path) {
+absl::optional<PrefsAsh::State> PrefsAsh::GetState(mojom::PrefPath path) {
switch (path) {
case mojom::PrefPath::kMetricsReportingEnabled:
return State{local_state_, &local_state_registrar_,
@@ -116,13 +116,13 @@
case mojom::PrefPath::kAccessibilitySpokenFeedbackEnabled:
if (!profile_prefs_) {
LOG(WARNING) << "Primary profile is not yet initialized";
- return base::nullopt;
+ return absl::nullopt;
}
return State{profile_prefs_, &profile_prefs_registrar_,
ash::prefs::kAccessibilitySpokenFeedbackEnabled};
default:
LOG(WARNING) << "Unknown pref path: " << path;
- return base::nullopt;
+ return absl::nullopt;
}
}
diff --git a/chrome/browser/ash/crosapi/prefs_ash.h b/chrome/browser/ash/crosapi/prefs_ash.h
index e7b9ec7..a1fbd8d 100644
--- a/chrome/browser/ash/crosapi/prefs_ash.h
+++ b/chrome/browser/ash/crosapi/prefs_ash.h
@@ -10,13 +10,13 @@
#include <utility>
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "chrome/browser/profiles/profile_manager_observer.h"
#include "chromeos/crosapi/mojom/prefs.mojom.h"
#include "components/prefs/pref_change_registrar.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote_set.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefService;
class PrefChangeRegistrar;
@@ -59,7 +59,7 @@
PrefChangeRegistrar* registrar;
std::string path;
};
- base::Optional<State> GetState(mojom::PrefPath path);
+ absl::optional<State> GetState(mojom::PrefPath path);
void OnPrefChanged(mojom::PrefPath path);
void OnDisconnect(mojom::PrefPath path, mojo::RemoteSetElementId id);
diff --git a/chrome/browser/ash/crosapi/prefs_ash_unittest.cc b/chrome/browser/ash/crosapi/prefs_ash_unittest.cc
index e965736..d5418f1 100644
--- a/chrome/browser/ash/crosapi/prefs_ash_unittest.cc
+++ b/chrome/browser/ash/crosapi/prefs_ash_unittest.cc
@@ -8,7 +8,6 @@
#include "ash/public/cpp/ash_pref_names.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/test/bind.h"
#include "chrome/test/base/scoped_testing_local_state.h"
#include "chrome/test/base/testing_browser_process.h"
@@ -21,6 +20,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crosapi {
namespace {
@@ -35,7 +35,7 @@
// crosapi::mojom::PrefObserver:
void OnPrefChanged(base::Value value) override { value_ = std::move(value); }
- base::Optional<base::Value> value_;
+ absl::optional<base::Value> value_;
mojo::Receiver<mojom::PrefObserver> receiver_{this};
};
@@ -79,7 +79,7 @@
// Get returns value.
base::Value get_value;
prefs_remote->GetPref(
- path, base::BindLambdaForTesting([&](base::Optional<base::Value> value) {
+ path, base::BindLambdaForTesting([&](absl::optional<base::Value> value) {
get_value = std::move(*value);
}));
prefs_remote.FlushForTesting();
@@ -143,7 +143,7 @@
// Get returns value.
base::Value get_value;
prefs_remote->GetPref(
- path, base::BindLambdaForTesting([&](base::Optional<base::Value> value) {
+ path, base::BindLambdaForTesting([&](absl::optional<base::Value> value) {
get_value = std::move(*value);
}));
prefs_remote.FlushForTesting();
@@ -170,10 +170,10 @@
prefs_ash.BindReceiver(prefs_remote.BindNewPipeAndPassReceiver());
mojom::PrefPath path = mojom::PrefPath::kUnknown;
- // Get for an unknown value returns base::nullopt.
+ // Get for an unknown value returns absl::nullopt.
bool has_value = true;
prefs_remote->GetPref(
- path, base::BindLambdaForTesting([&](base::Optional<base::Value> value) {
+ path, base::BindLambdaForTesting([&](absl::optional<base::Value> value) {
has_value = value.has_value();
}));
prefs_remote.FlushForTesting();
diff --git a/chrome/browser/ash/crosapi/test_controller_ash.cc b/chrome/browser/ash/crosapi/test_controller_ash.cc
index 3514d06..5dbddf0 100644
--- a/chrome/browser/ash/crosapi/test_controller_ash.cc
+++ b/chrome/browser/ash/crosapi/test_controller_ash.cc
@@ -10,10 +10,10 @@
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/overview/overview_observer.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/ash/crosapi/window_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tree_host.h"
@@ -159,7 +159,7 @@
GetWindowPositionInScreenCallback cb) {
aura::Window* window = GetShellSurfaceWindow(window_id);
if (!window) {
- std::move(cb).Run(base::nullopt);
+ std::move(cb).Run(absl::nullopt);
return;
}
std::move(cb).Run(window->GetBoundsInScreen().origin());
diff --git a/chrome/browser/ash/crosapi/test_mojo_connection_manager.cc b/chrome/browser/ash/crosapi/test_mojo_connection_manager.cc
index 7b63605c..d7ad4e4b 100644
--- a/chrome/browser/ash/crosapi/test_mojo_connection_manager.cc
+++ b/chrome/browser/ash/crosapi/test_mojo_connection_manager.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
@@ -21,6 +20,7 @@
#include "mojo/public/cpp/platform/named_platform_channel.h"
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/platform/socket_utils_posix.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crosapi {
@@ -43,8 +43,8 @@
return paths;
}
std::string GetDeviceAccountGaiaId() override { return kFakeGaiaId; }
- base::Optional<account_manager::Account> GetDeviceAccount() override {
- return base::make_optional(account_manager::Account{
+ absl::optional<account_manager::Account> GetDeviceAccount() override {
+ return absl::make_optional(account_manager::Account{
account_manager::AccountKey{kFakeGaiaId,
account_manager::AccountType::kGaia},
kFakeEmail});
diff --git a/chrome/browser/ash/crostini/ansible/ansible_management_service.cc b/chrome/browser/ash/crostini/ansible/ansible_management_service.cc
index 2c25d6d..14e44486 100644
--- a/chrome/browser/ash/crostini/ansible/ansible_management_service.cc
+++ b/chrome/browser/ash/crostini/ansible/ansible_management_service.cc
@@ -163,7 +163,7 @@
}
void AnsibleManagementService::OnApplyAnsiblePlaybook(
- base::Optional<vm_tools::cicerone::ApplyAnsiblePlaybookResponse> response) {
+ absl::optional<vm_tools::cicerone::ApplyAnsiblePlaybookResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to apply Ansible playbook. Empty response.";
OnConfigurationFinished(false);
diff --git a/chrome/browser/ash/crostini/ansible/ansible_management_service.h b/chrome/browser/ash/crostini/ansible/ansible_management_service.h
index 6a9cac8..cb5d0ab 100644
--- a/chrome/browser/ash/crostini/ansible/ansible_management_service.h
+++ b/chrome/browser/ash/crostini/ansible/ansible_management_service.h
@@ -64,7 +64,7 @@
void OnAnsiblePlaybookRetrieved(bool success);
void ApplyAnsiblePlaybookToDefaultContainer();
void OnApplyAnsiblePlaybook(
- base::Optional<vm_tools::cicerone::ApplyAnsiblePlaybookResponse>
+ absl::optional<vm_tools::cicerone::ApplyAnsiblePlaybookResponse>
response);
// Helper function that runs relevant callback and notifies observers.
diff --git a/chrome/browser/ash/crostini/crostini_disk.cc b/chrome/browser/ash/crostini/crostini_disk.cc
index b4102c2..9014bb9f 100644
--- a/chrome/browser/ash/crostini/crostini_disk.cc
+++ b/chrome/browser/ash/crostini/crostini_disk.cc
@@ -126,7 +126,7 @@
OnceDiskInfoCallback callback,
std::string vm_name,
int64_t free_space,
- base::Optional<vm_tools::concierge::ListVmDisksResponse> response) {
+ absl::optional<vm_tools::concierge::ListVmDisksResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to get response from concierge";
std::move(callback).Run(nullptr);
@@ -297,7 +297,7 @@
void OnResize(
base::OnceCallback<void(bool)> callback,
- base::Optional<vm_tools::concierge::ResizeDiskImageResponse> response) {
+ absl::optional<vm_tools::concierge::ResizeDiskImageResponse> response) {
if (!response) {
LOG(ERROR) << "Got null response from concierge";
EmitResizeResultMetric(
diff --git a/chrome/browser/ash/crostini/crostini_disk.h b/chrome/browser/ash/crostini/crostini_disk.h
index 8be5175..684bb85 100644
--- a/chrome/browser/ash/crostini/crostini_disk.h
+++ b/chrome/browser/ash/crostini/crostini_disk.h
@@ -9,11 +9,11 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/ash/crostini/crostini_simple_types.h"
#include "chrome/browser/ash/crostini/crostini_types.mojom-forward.h"
#include "chrome/browser/profiles/profile.h"
#include "chromeos/dbus/concierge/concierge_service.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crostini {
@@ -93,7 +93,7 @@
OnceDiskInfoCallback callback,
std::string vm_name,
int64_t free_space,
- base::Optional<vm_tools::concierge::ListVmDisksResponse> response);
+ absl::optional<vm_tools::concierge::ListVmDisksResponse> response);
// Given a minimum, currently selected and maximum value, constructs a range of
// DiskSliderTicks spanning from min to max. Ensures that one of the ticks
@@ -117,7 +117,7 @@
// crostini_disk or tests.
void OnResize(
base::OnceCallback<void(bool)> callback,
- base::Optional<vm_tools::concierge::ResizeDiskImageResponse> response);
+ absl::optional<vm_tools::concierge::ResizeDiskImageResponse> response);
// Splits the range between |min_size| and |available_space| into enough
// evenly-spaced intervals you can use them as ticks on a slider. Will return an
diff --git a/chrome/browser/ash/crostini/crostini_disk_unittest.cc b/chrome/browser/ash/crostini/crostini_disk_unittest.cc
index f34e0271..e4671e6 100644
--- a/chrome/browser/ash/crostini/crostini_disk_unittest.cc
+++ b/chrome/browser/ash/crostini/crostini_disk_unittest.cc
@@ -36,7 +36,7 @@
std::unique_ptr<CrostiniDiskInfo> OnListVmDisksWithResult(
const char* vm_name,
int64_t free_space,
- base::Optional<vm_tools::concierge::ListVmDisksResponse>
+ absl::optional<vm_tools::concierge::ListVmDisksResponse>
list_disks_response) {
std::unique_ptr<CrostiniDiskInfo> result;
auto store = base::BindLambdaForTesting(
@@ -117,7 +117,7 @@
}
TEST_F(CrostiniDiskTest, CallbackGetsEmptyInfoOnError) {
- auto disk_info_nullopt = OnListVmDisksWithResult("vm_name", 0, base::nullopt);
+ auto disk_info_nullopt = OnListVmDisksWithResult("vm_name", 0, absl::nullopt);
EXPECT_FALSE(disk_info_nullopt);
vm_tools::concierge::ListVmDisksResponse failure_response;
diff --git a/chrome/browser/ash/crostini/crostini_export_import_notification_controller.cc b/chrome/browser/ash/crostini/crostini_export_import_notification_controller.cc
index 5cdea04..8199ac1d 100644
--- a/chrome/browser/ash/crostini/crostini_export_import_notification_controller.cc
+++ b/chrome/browser/ash/crostini/crostini_export_import_notification_controller.cc
@@ -96,7 +96,7 @@
delegate_->SetCallback(base::BindRepeating(
[](Profile* profile, ExportImportType type, ContainerId container_id,
- base::Optional<int> button_index) {
+ absl::optional<int> button_index) {
if (!button_index.has_value()) {
return;
}
diff --git a/chrome/browser/ash/crostini/crostini_export_import_unittest.cc b/chrome/browser/ash/crostini/crostini_export_import_unittest.cc
index 301946f..9b26e14 100644
--- a/chrome/browser/ash/crostini/crostini_export_import_unittest.cc
+++ b/chrome/browser/ash/crostini/crostini_export_import_unittest.cc
@@ -61,10 +61,10 @@
const message_center::Notification* controller_notification =
controller->get_notification();
[&] { ASSERT_NE(controller_notification, nullptr); }();
- const base::Optional<message_center::Notification>& ui_notification =
+ const absl::optional<message_center::Notification>& ui_notification =
notification_display_service_->GetNotification(
controller_notification->id());
- [&] { ASSERT_NE(ui_notification, base::nullopt); }();
+ [&] { ASSERT_NE(ui_notification, absl::nullopt); }();
// The controller notification is stored on the
// CrostiniExportImportNotificationController, but copied into the
// message_center's storage whenever it changes. If they could share the
@@ -289,9 +289,9 @@
EXPECT_EQ(GetController(), nullptr);
EXPECT_EQ(controller, nullptr);
{
- const base::Optional<message_center::Notification> ui_notification =
+ const absl::optional<message_center::Notification> ui_notification =
notification_display_service_->GetNotification(notification_id);
- ASSERT_NE(ui_notification, base::nullopt);
+ ASSERT_NE(ui_notification, absl::nullopt);
EXPECT_FALSE(ui_notification->pinned());
std::string msg("Linux apps & files have been successfully backed up");
EXPECT_EQ(ui_notification->message(), base::UTF8ToUTF16(msg));
@@ -326,9 +326,9 @@
EXPECT_EQ(GetController(), nullptr);
EXPECT_EQ(controller, nullptr);
{
- const base::Optional<message_center::Notification> ui_notification =
+ const absl::optional<message_center::Notification> ui_notification =
notification_display_service_->GetNotification(notification_id);
- ASSERT_NE(ui_notification, base::nullopt);
+ ASSERT_NE(ui_notification, absl::nullopt);
EXPECT_FALSE(ui_notification->pinned());
std::string msg("Backup couldn't be completed due to an error");
EXPECT_EQ(ui_notification->message(), base::UTF8ToUTF16(msg));
@@ -396,9 +396,9 @@
EXPECT_EQ(GetController(), nullptr);
EXPECT_EQ(controller, nullptr);
{
- const base::Optional<message_center::Notification> ui_notification =
+ const absl::optional<message_center::Notification> ui_notification =
notification_display_service_->GetNotification(notification_id);
- EXPECT_EQ(ui_notification, base::nullopt);
+ EXPECT_EQ(ui_notification, absl::nullopt);
}
task_environment_.RunUntilIdle();
@@ -443,9 +443,9 @@
EXPECT_EQ(GetController(), nullptr);
EXPECT_EQ(controller, nullptr);
{
- const base::Optional<message_center::Notification> ui_notification =
+ const absl::optional<message_center::Notification> ui_notification =
notification_display_service_->GetNotification(notification_id);
- EXPECT_EQ(ui_notification, base::nullopt);
+ EXPECT_EQ(ui_notification, absl::nullopt);
}
task_environment_.RunUntilIdle();
@@ -522,9 +522,9 @@
EXPECT_EQ(GetController(), nullptr);
EXPECT_EQ(controller, nullptr);
{
- const base::Optional<message_center::Notification> ui_notification =
+ const absl::optional<message_center::Notification> ui_notification =
notification_display_service_->GetNotification(notification_id);
- ASSERT_NE(ui_notification, base::nullopt);
+ ASSERT_NE(ui_notification, absl::nullopt);
EXPECT_FALSE(ui_notification->pinned());
std::string msg("Linux apps & files have been successfully replaced");
EXPECT_EQ(ui_notification->message(), base::UTF8ToUTF16(msg));
@@ -555,9 +555,9 @@
EXPECT_EQ(GetController(), nullptr);
EXPECT_EQ(controller, nullptr);
{
- const base::Optional<message_center::Notification> ui_notification =
+ const absl::optional<message_center::Notification> ui_notification =
notification_display_service_->GetNotification(notification_id);
- ASSERT_NE(ui_notification, base::nullopt);
+ ASSERT_NE(ui_notification, absl::nullopt);
EXPECT_FALSE(ui_notification->pinned());
std::string msg("Restoring couldn't be completed due to an error");
EXPECT_EQ(ui_notification->message(), base::UTF8ToUTF16(msg));
@@ -616,9 +616,9 @@
EXPECT_EQ(GetController(), nullptr);
EXPECT_EQ(controller, nullptr);
{
- const base::Optional<message_center::Notification> ui_notification =
+ const absl::optional<message_center::Notification> ui_notification =
notification_display_service_->GetNotification(notification_id);
- EXPECT_EQ(ui_notification, base::nullopt);
+ EXPECT_EQ(ui_notification, absl::nullopt);
}
}
@@ -659,9 +659,9 @@
EXPECT_EQ(GetController(), nullptr);
EXPECT_EQ(controller, nullptr);
{
- const base::Optional<message_center::Notification> ui_notification =
+ const absl::optional<message_center::Notification> ui_notification =
notification_display_service_->GetNotification(notification_id);
- ASSERT_NE(ui_notification, base::nullopt);
+ ASSERT_NE(ui_notification, absl::nullopt);
EXPECT_FALSE(ui_notification->pinned());
std::string msg("Linux apps & files have been successfully replaced");
EXPECT_EQ(ui_notification->message(), base::UTF8ToUTF16(msg));
@@ -693,9 +693,9 @@
EXPECT_EQ(GetController(), nullptr);
EXPECT_EQ(controller, nullptr);
{
- const base::Optional<message_center::Notification> ui_notification =
+ const absl::optional<message_center::Notification> ui_notification =
notification_display_service_->GetNotification(notification_id);
- ASSERT_NE(ui_notification, base::nullopt);
+ ASSERT_NE(ui_notification, absl::nullopt);
EXPECT_FALSE(ui_notification->pinned());
std::string msg(
"Cannot import container architecture type arch_con with this device "
@@ -734,9 +734,9 @@
EXPECT_EQ(GetController(), nullptr);
EXPECT_EQ(controller, nullptr);
{
- const base::Optional<message_center::Notification> ui_notification =
+ const absl::optional<message_center::Notification> ui_notification =
notification_display_service_->GetNotification(notification_id);
- ASSERT_NE(ui_notification, base::nullopt);
+ ASSERT_NE(ui_notification, absl::nullopt);
EXPECT_FALSE(ui_notification->pinned());
std::string msg =
"Cannot restore due to lack of storage space. Free up 15.0 GB from the "
diff --git a/chrome/browser/ash/crostini/crostini_force_close_watcher.h b/chrome/browser/ash/crostini/crostini_force_close_watcher.h
index 4cff5d1..2d563017 100644
--- a/chrome/browser/ash/crostini/crostini_force_close_watcher.h
+++ b/chrome/browser/ash/crostini/crostini_force_close_watcher.h
@@ -11,9 +11,9 @@
#include "base/callback.h"
#include "base/callback_forward.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/elapsed_timer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/widget/widget_observer.h"
namespace exo {
@@ -91,7 +91,7 @@
// Implements the delay between the first and second time the user tries to
// close the window.
- base::Optional<base::ElapsedTimer> show_dialog_timer_;
+ absl::optional<base::ElapsedTimer> show_dialog_timer_;
DISALLOW_COPY_AND_ASSIGN(ForceCloseWatcher);
};
diff --git a/chrome/browser/ash/crostini/crostini_installer_unittest.cc b/chrome/browser/ash/crostini/crostini_installer_unittest.cc
index f1fe829b0a0..fb1a869 100644
--- a/chrome/browser/ash/crostini/crostini_installer_unittest.cc
+++ b/chrome/browser/ash/crostini/crostini_installer_unittest.cc
@@ -8,7 +8,6 @@
#include "base/callback_helpers.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
@@ -35,6 +34,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using crostini::mojom::InstallerError;
using crostini::mojom::InstallerState;
diff --git a/chrome/browser/ash/crostini/crostini_low_disk_notification.cc b/chrome/browser/ash/crostini/crostini_low_disk_notification.cc
index 27dec85..03d4a31 100644
--- a/chrome/browser/ash/crostini/crostini_low_disk_notification.cc
+++ b/chrome/browser/ash/crostini/crostini_low_disk_notification.cc
@@ -119,7 +119,7 @@
message_center::NotifierId notifier_id(
message_center::NotifierType::SYSTEM_COMPONENT, kNotifierLowDisk);
- auto on_click = base::BindRepeating([](base::Optional<int> button_index) {
+ auto on_click = base::BindRepeating([](absl::optional<int> button_index) {
if (button_index) {
DCHECK_EQ(0, *button_index);
chrome::SettingsWindowManager::GetInstance()->ShowOSSettings(
diff --git a/chrome/browser/ash/crostini/crostini_low_disk_notification_unittest.cc b/chrome/browser/ash/crostini/crostini_low_disk_notification_unittest.cc
index 2ab00b1f..d399cf97 100644
--- a/chrome/browser/ash/crostini/crostini_low_disk_notification_unittest.cc
+++ b/chrome/browser/ash/crostini/crostini_low_disk_notification_unittest.cc
@@ -76,7 +76,7 @@
BrowserWithTestWindowTest::TearDown();
}
- base::Optional<message_center::Notification> GetNotification() {
+ absl::optional<message_center::Notification> GetNotification() {
return tester_->GetNotification("crostini_low_disk");
}
diff --git a/chrome/browser/ash/crostini/crostini_manager.cc b/chrome/browser/ash/crostini/crostini_manager.cc
index 8d5f3848..4a12211 100644
--- a/chrome/browser/ash/crostini/crostini_manager.cc
+++ b/chrome/browser/ash/crostini/crostini_manager.cc
@@ -581,7 +581,7 @@
auto* scheduler_configuration_manager =
g_browser_process->platform_part()->scheduler_configuration_manager();
- base::Optional<std::pair<bool, size_t>> scheduler_configuration =
+ absl::optional<std::pair<bool, size_t>> scheduler_configuration =
scheduler_configuration_manager->GetLastReply();
if (!scheduler_configuration) {
// Wait for the configuration to become available.
@@ -666,7 +666,7 @@
}
void GetTerminaVmKernelVersionFinished(
- const base::Optional<std::string>& maybe_kernel_version) {
+ const absl::optional<std::string>& maybe_kernel_version) {
// In the error case, Crostini should still start, so we do not propagate
// errors any further here. Also, any error would already have been logged
// by CrostiniManager, so here we just (re)set the kernel version pref to
@@ -773,11 +773,11 @@
return false;
}
-base::Optional<VmInfo> CrostiniManager::GetVmInfo(std::string vm_name) {
+absl::optional<VmInfo> CrostiniManager::GetVmInfo(std::string vm_name) {
auto it = running_vms_.find(std::move(vm_name));
if (it != running_vms_.end())
return it->second;
- return base::nullopt;
+ return absl::nullopt;
}
void CrostiniManager::AddRunningVmForTesting(std::string vm_name) {
@@ -841,7 +841,7 @@
UpdateContainerPref(profile_, container_id, prefs::kContainerOsVersionKey,
base::Value(static_cast<int>(version)));
- base::Optional<ContainerOsVersion> old_version;
+ absl::optional<ContainerOsVersion> old_version;
auto it = container_os_releases_.find(container_id);
if (it != container_os_releases_.end()) {
old_version = VersionFromOsRelease(it->second);
@@ -888,7 +888,7 @@
GetCiceroneClient()->ConfigureForArcSideload(
request,
base::BindOnce(
- [](base::Optional<
+ [](absl::optional<
vm_tools::cicerone::ConfigureForArcSideloadResponse>
response) {
if (!response) {
@@ -962,10 +962,10 @@
is_unclean_startup_ = is_unclean_startup;
}
-base::Optional<ContainerInfo> CrostiniManager::GetContainerInfo(
+absl::optional<ContainerInfo> CrostiniManager::GetContainerInfo(
const ContainerId& container_id) {
if (!IsVmRunning(container_id.vm_name)) {
- return base::nullopt;
+ return absl::nullopt;
}
auto range = running_containers_.equal_range(container_id.vm_name);
for (auto it = range.first; it != range.second; ++it) {
@@ -973,7 +973,7 @@
return it->second;
}
}
- return base::nullopt;
+ return absl::nullopt;
}
void CrostiniManager::AddRunningContainerForTesting(std::string vm_name,
@@ -1068,7 +1068,7 @@
std::move(concierge_request),
base::BindOnce(
[](base::WeakPtr<CrostiniManager> weak_this,
- base::Optional<vm_tools::concierge::GetVmInfoResponse> reply) {
+ absl::optional<vm_tools::concierge::GetVmInfoResponse> reply) {
if (weak_this) {
VLOG(1) << "Exit type: "
<< static_cast<int>(Profile::EXIT_CRASHED);
@@ -1251,7 +1251,7 @@
}
vm_tools::concierge::StartVmRequest request;
- base::Optional<std::string> dlc_id = termina_installer_.GetDlcId();
+ absl::optional<std::string> dlc_id = termina_installer_.GetDlcId();
if (dlc_id.has_value()) {
request.mutable_vm()->set_dlc_id(*dlc_id);
}
@@ -1418,7 +1418,7 @@
void CrostiniManager::OnDeleteLxdContainer(
const ContainerId& container_id,
BoolCallback callback,
- base::Optional<vm_tools::cicerone::DeleteLxdContainerResponse> response) {
+ absl::optional<vm_tools::cicerone::DeleteLxdContainerResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to delete lxd container in vm. Empty response.";
std::move(callback).Run(/*success=*/false);
@@ -1967,7 +1967,7 @@
request,
base::BindOnce(
[](BoolCallback callback,
- base::Optional<vm_tools::cicerone::AddFileWatchResponse>
+ absl::optional<vm_tools::cicerone::AddFileWatchResponse>
response) {
std::move(callback).Run(
response &&
@@ -2018,7 +2018,7 @@
GetCiceroneClient()->GetVshSession(
request, base::BindOnce(
[](VshSessionCallback callback,
- base::Optional<vm_tools::cicerone::GetVshSessionResponse>
+ absl::optional<vm_tools::cicerone::GetVshSessionResponse>
response) {
if (!response) {
std::move(callback).Run(false, "Empty response", 0);
@@ -2224,7 +2224,7 @@
void CrostiniManager::OnCreateDiskImage(
CreateDiskImageCallback callback,
- base::Optional<vm_tools::concierge::CreateDiskImageResponse> response) {
+ absl::optional<vm_tools::concierge::CreateDiskImageResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to create disk image. Empty response.";
std::move(callback).Run(/*success=*/false,
@@ -2247,7 +2247,7 @@
void CrostiniManager::OnDestroyDiskImage(
BoolCallback callback,
- base::Optional<vm_tools::concierge::DestroyDiskImageResponse> response) {
+ absl::optional<vm_tools::concierge::DestroyDiskImageResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to destroy disk image. Empty response.";
std::move(callback).Run(/*success=*/false);
@@ -2267,7 +2267,7 @@
void CrostiniManager::OnListVmDisks(
ListVmDisksCallback callback,
- base::Optional<vm_tools::concierge::ListVmDisksResponse> response) {
+ absl::optional<vm_tools::concierge::ListVmDisksResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to get list of VM disks. Empty response.";
std::move(callback).Run(
@@ -2292,7 +2292,7 @@
void CrostiniManager::OnStartTerminaVm(
std::string vm_name,
BoolCallback callback,
- base::Optional<vm_tools::concierge::StartVmResponse> response) {
+ absl::optional<vm_tools::concierge::StartVmResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to start termina vm. Empty response.";
std::move(callback).Run(/*success=*/false);
@@ -2406,7 +2406,7 @@
void CrostiniManager::OnStopVm(
std::string vm_name,
CrostiniResultCallback callback,
- base::Optional<vm_tools::concierge::StopVmResponse> response) {
+ absl::optional<vm_tools::concierge::StopVmResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to stop termina vm. Empty response.";
std::move(callback).Run(CrostiniResult::VM_STOP_FAILED);
@@ -2469,18 +2469,18 @@
void CrostiniManager::OnGetTerminaVmKernelVersion(
GetTerminaVmKernelVersionCallback callback,
- base::Optional<vm_tools::concierge::GetVmEnterpriseReportingInfoResponse>
+ absl::optional<vm_tools::concierge::GetVmEnterpriseReportingInfoResponse>
response) {
if (!response) {
LOG(ERROR) << "No reply to GetVmEnterpriseReportingInfo";
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
if (!response->success()) {
LOG(ERROR) << "Error response for GetVmEnterpriseReportingInfo: "
<< response->failure_reason();
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
@@ -2731,7 +2731,7 @@
void CrostiniManager::OnUninstallPackageOwningFile(
CrostiniResultCallback callback,
- base::Optional<vm_tools::cicerone::UninstallPackageOwningFileResponse>
+ absl::optional<vm_tools::cicerone::UninstallPackageOwningFileResponse>
response) {
if (!response) {
LOG(ERROR) << "Failed to uninstall Linux package. Empty response.";
@@ -2762,7 +2762,7 @@
void CrostiniManager::OnStartLxd(
std::string vm_name,
CrostiniResultCallback callback,
- base::Optional<vm_tools::cicerone::StartLxdResponse> response) {
+ absl::optional<vm_tools::cicerone::StartLxdResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to start lxd in vm. Empty response.";
std::move(callback).Run(CrostiniResult::START_LXD_FAILED);
@@ -2789,7 +2789,7 @@
void CrostiniManager::OnCreateLxdContainer(
const ContainerId& container_id,
CrostiniResultCallback callback,
- base::Optional<vm_tools::cicerone::CreateLxdContainerResponse> response) {
+ absl::optional<vm_tools::cicerone::CreateLxdContainerResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to create lxd container in vm. Empty response.";
std::move(callback).Run(CrostiniResult::CONTAINER_CREATE_FAILED);
@@ -2817,7 +2817,7 @@
void CrostiniManager::OnStartLxdContainer(
const ContainerId& container_id,
CrostiniResultCallback callback,
- base::Optional<vm_tools::cicerone::StartLxdContainerResponse> response) {
+ absl::optional<vm_tools::cicerone::StartLxdContainerResponse> response) {
if (!response) {
VLOG(1) << "Failed to start lxd container in vm. Empty response.";
std::move(callback).Run(CrostiniResult::CONTAINER_START_FAILED);
@@ -2864,7 +2864,7 @@
void CrostiniManager::OnSetUpLxdContainerUser(
const ContainerId& container_id,
BoolCallback callback,
- base::Optional<vm_tools::cicerone::SetUpLxdContainerUserResponse>
+ absl::optional<vm_tools::cicerone::SetUpLxdContainerUserResponse>
response) {
if (!response) {
LOG(ERROR) << "Failed to set up lxd container user. Empty response.";
@@ -3014,7 +3014,7 @@
void CrostiniManager::OnLaunchContainerApplication(
CrostiniSuccessCallback callback,
- base::Optional<vm_tools::cicerone::LaunchContainerApplicationResponse>
+ absl::optional<vm_tools::cicerone::LaunchContainerApplicationResponse>
response) {
if (!response) {
LOG(ERROR) << "Failed to launch application. Empty response.";
@@ -3028,7 +3028,7 @@
void CrostiniManager::OnGetContainerAppIcons(
GetContainerAppIconsCallback callback,
- base::Optional<vm_tools::cicerone::ContainerAppIconResponse> response) {
+ absl::optional<vm_tools::cicerone::ContainerAppIconResponse> response) {
std::vector<Icon> icons;
if (!response) {
LOG(ERROR) << "Failed to get container application icons. Empty response.";
@@ -3046,7 +3046,7 @@
void CrostiniManager::OnGetLinuxPackageInfo(
GetLinuxPackageInfoCallback callback,
- base::Optional<vm_tools::cicerone::LinuxPackageInfoResponse> response) {
+ absl::optional<vm_tools::cicerone::LinuxPackageInfoResponse> response) {
LinuxPackageInfo result;
if (!response) {
LOG(ERROR) << "Failed to get Linux package info. Empty response.";
@@ -3092,7 +3092,7 @@
void CrostiniManager::OnInstallLinuxPackage(
InstallLinuxPackageCallback callback,
- base::Optional<vm_tools::cicerone::InstallLinuxPackageResponse> response) {
+ absl::optional<vm_tools::cicerone::InstallLinuxPackageResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to install Linux package. Empty response.";
std::move(callback).Run(CrostiniResult::INSTALL_LINUX_PACKAGE_FAILED);
@@ -3119,7 +3119,7 @@
void CrostiniManager::OnGetContainerSshKeys(
GetContainerSshKeysCallback callback,
- base::Optional<vm_tools::concierge::ContainerSshKeysResponse> response) {
+ absl::optional<vm_tools::concierge::ContainerSshKeysResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to get ssh keys. Empty response.";
std::move(callback).Run(/*success=*/false, "", "", "");
@@ -3179,7 +3179,7 @@
void CrostiniManager::OnExportLxdContainer(
const ContainerId& container_id,
- base::Optional<vm_tools::cicerone::ExportLxdContainerResponse> response) {
+ absl::optional<vm_tools::cicerone::ExportLxdContainerResponse> response) {
auto it = export_lxd_container_callbacks_.find(container_id);
if (it == export_lxd_container_callbacks_.end()) {
LOG(ERROR) << "No export callback for " << container_id;
@@ -3269,7 +3269,7 @@
void CrostiniManager::OnImportLxdContainer(
const ContainerId& container_id,
- base::Optional<vm_tools::cicerone::ImportLxdContainerResponse> response) {
+ absl::optional<vm_tools::cicerone::ImportLxdContainerResponse> response) {
auto it = import_lxd_container_callbacks_.find(container_id);
if (it == import_lxd_container_callbacks_.end()) {
LOG(ERROR) << "No import callback for " << container_id;
@@ -3366,7 +3366,7 @@
void CrostiniManager::OnCancelExportLxdContainer(
const ContainerId& key,
- base::Optional<vm_tools::cicerone::CancelExportLxdContainerResponse>
+ absl::optional<vm_tools::cicerone::CancelExportLxdContainerResponse>
response) {
auto it = export_lxd_container_callbacks_.find(key);
if (it == export_lxd_container_callbacks_.end()) {
@@ -3389,7 +3389,7 @@
void CrostiniManager::OnCancelImportLxdContainer(
const ContainerId& key,
- base::Optional<vm_tools::cicerone::CancelImportLxdContainerResponse>
+ absl::optional<vm_tools::cicerone::CancelImportLxdContainerResponse>
response) {
auto it = import_lxd_container_callbacks_.find(key);
if (it == import_lxd_container_callbacks_.end()) {
@@ -3412,7 +3412,7 @@
void CrostiniManager::OnUpgradeContainer(
CrostiniResultCallback callback,
- base::Optional<vm_tools::cicerone::UpgradeContainerResponse> response) {
+ absl::optional<vm_tools::cicerone::UpgradeContainerResponse> response) {
if (!response) {
LOG(ERROR) << "Failed to start upgrading container. Empty response";
std::move(callback).Run(CrostiniResult::UPGRADE_CONTAINER_FAILED);
@@ -3446,7 +3446,7 @@
void CrostiniManager::OnCancelUpgradeContainer(
CrostiniResultCallback callback,
- base::Optional<vm_tools::cicerone::CancelUpgradeContainerResponse>
+ absl::optional<vm_tools::cicerone::CancelUpgradeContainerResponse>
response) {
if (!response) {
LOG(ERROR) << "Failed to cancel upgrading container. Empty response";
@@ -3570,7 +3570,7 @@
request.set_vm_name(vm_name);
GetConciergeClient()->ListVmDisks(
std::move(request),
- base::BindOnce([](base::Optional<vm_tools::concierge::ListVmDisksResponse>
+ base::BindOnce([](absl::optional<vm_tools::concierge::ListVmDisksResponse>
response) {
if (response) {
if (response.value().images().size() != 1) {
diff --git a/chrome/browser/ash/crostini/crostini_manager.h b/chrome/browser/ash/crostini/crostini_manager.h
index b0b799a8..7a2f076 100644
--- a/chrome/browser/ash/crostini/crostini_manager.h
+++ b/chrome/browser/ash/crostini/crostini_manager.h
@@ -14,7 +14,6 @@
#include "base/memory/singleton.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/unguessable_token.h"
#include "chrome/browser/ash/crostini/crostini_low_disk_notification.h"
#include "chrome/browser/ash/crostini/crostini_simple_types.h"
@@ -37,6 +36,7 @@
#include "chromeos/network/network_state_handler_observer.h"
#include "components/keyed_service/core/keyed_service.h"
#include "services/device/public/mojom/usb_manager.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -201,8 +201,8 @@
struct RestartOptions {
bool start_vm_only = false;
// These two options only affect new containers.
- base::Optional<std::string> container_username;
- base::Optional<int64_t> disk_size_bytes;
+ absl::optional<std::string> container_username;
+ absl::optional<int64_t> disk_size_bytes;
RestartOptions();
~RestartOptions();
@@ -290,7 +290,7 @@
// Asynchronously retrieve the Termina VM kernel version using
// concierge's GetVmEnterpriseReportingInfo method.
using GetTerminaVmKernelVersionCallback = base::OnceCallback<void(
- const base::Optional<std::string>& maybe_kernel_version)>;
+ const absl::optional<std::string>& maybe_kernel_version)>;
void GetTerminaVmKernelVersion(GetTerminaVmKernelVersionCallback callback);
// Wrapper for CiceroneClient::StartLxd with some extra parameter validation.
@@ -577,7 +577,7 @@
void UpdateVmState(std::string vm_name, VmState vm_state);
bool IsVmRunning(std::string vm_name);
// Returns null if VM is not running.
- base::Optional<VmInfo> GetVmInfo(std::string vm_name);
+ absl::optional<VmInfo> GetVmInfo(std::string vm_name);
void AddRunningVmForTesting(std::string vm_name);
void AddStoppingVmForTesting(std::string vm_name);
@@ -586,7 +586,7 @@
const vm_tools::cicerone::OsRelease* GetContainerOsRelease(
const ContainerId& container_id) const;
// Returns null if VM or container is not running.
- base::Optional<ContainerInfo> GetContainerInfo(
+ absl::optional<ContainerInfo> GetContainerInfo(
const ContainerId& container_id);
void AddRunningContainerForTesting(std::string vm_name, ContainerInfo info);
@@ -652,19 +652,19 @@
// service method finishes.
void OnCreateDiskImage(
CreateDiskImageCallback callback,
- base::Optional<vm_tools::concierge::CreateDiskImageResponse> response);
+ absl::optional<vm_tools::concierge::CreateDiskImageResponse> response);
// Callback for ConciergeClient::DestroyDiskImage. Called after the Concierge
// service method finishes.
void OnDestroyDiskImage(
BoolCallback callback,
- base::Optional<vm_tools::concierge::DestroyDiskImageResponse> response);
+ absl::optional<vm_tools::concierge::DestroyDiskImageResponse> response);
// Callback for ConciergeClient::ListVmDisks. Called after the Concierge
// service method finishes.
void OnListVmDisks(
ListVmDisksCallback callback,
- base::Optional<vm_tools::concierge::ListVmDisksResponse> response);
+ absl::optional<vm_tools::concierge::ListVmDisksResponse> response);
// Callback for ConciergeClient::StartTerminaVm. Called after the Concierge
// service method finishes. Updates running containers list then calls the
@@ -673,7 +673,7 @@
void OnStartTerminaVm(
std::string vm_name,
BoolCallback callback,
- base::Optional<vm_tools::concierge::StartVmResponse> response);
+ absl::optional<vm_tools::concierge::StartVmResponse> response);
// Callback for ConciergeClient::TremplinStartedSignal. Called after the
// Tremplin service starts. Updates running containers list and then calls the
@@ -684,14 +684,14 @@
// service method finishes.
void OnStopVm(std::string vm_name,
CrostiniResultCallback callback,
- base::Optional<vm_tools::concierge::StopVmResponse> response);
+ absl::optional<vm_tools::concierge::StopVmResponse> response);
// Callback for ConciergeClient::GetVmEnterpriseReportingInfo.
// Currently used to report the Termina kernel version for enterprise
// reporting.
void OnGetTerminaVmKernelVersion(
GetTerminaVmKernelVersionCallback callback,
- base::Optional<vm_tools::concierge::GetVmEnterpriseReportingInfoResponse>
+ absl::optional<vm_tools::concierge::GetVmEnterpriseReportingInfoResponse>
response);
// Callback for CiceroneClient::StartLxd. May indicate that LXD is still being
@@ -699,7 +699,7 @@
void OnStartLxd(
std::string vm_name,
CrostiniResultCallback callback,
- base::Optional<vm_tools::cicerone::StartLxdResponse> response);
+ absl::optional<vm_tools::cicerone::StartLxdResponse> response);
// Callback for CiceroneClient::CreateLxdContainer. May indicate the container
// is still being created, in which case we will wait for an
@@ -707,93 +707,93 @@
void OnCreateLxdContainer(
const ContainerId& container_id,
CrostiniResultCallback callback,
- base::Optional<vm_tools::cicerone::CreateLxdContainerResponse> response);
+ absl::optional<vm_tools::cicerone::CreateLxdContainerResponse> response);
// Callback for CiceroneClient::DeleteLxdContainer.
void OnDeleteLxdContainer(
const ContainerId& container_id,
BoolCallback callback,
- base::Optional<vm_tools::cicerone::DeleteLxdContainerResponse> response);
+ absl::optional<vm_tools::cicerone::DeleteLxdContainerResponse> response);
// Callback for CiceroneClient::StartLxdContainer.
void OnStartLxdContainer(
const ContainerId& container_id,
CrostiniResultCallback callback,
- base::Optional<vm_tools::cicerone::StartLxdContainerResponse> response);
+ absl::optional<vm_tools::cicerone::StartLxdContainerResponse> response);
// Callback for CiceroneClient::SetUpLxdContainerUser.
void OnSetUpLxdContainerUser(
const ContainerId& container_id,
BoolCallback callback,
- base::Optional<vm_tools::cicerone::SetUpLxdContainerUserResponse>
+ absl::optional<vm_tools::cicerone::SetUpLxdContainerUserResponse>
response);
// Callback for CiceroneClient::ExportLxdContainer.
void OnExportLxdContainer(
const ContainerId& container_id,
- base::Optional<vm_tools::cicerone::ExportLxdContainerResponse> response);
+ absl::optional<vm_tools::cicerone::ExportLxdContainerResponse> response);
// Callback for CiceroneClient::ImportLxdContainer.
void OnImportLxdContainer(
const ContainerId& container_id,
- base::Optional<vm_tools::cicerone::ImportLxdContainerResponse> response);
+ absl::optional<vm_tools::cicerone::ImportLxdContainerResponse> response);
// Callback for CiceroneClient::CancelExportLxdContainer.
void OnCancelExportLxdContainer(
const ContainerId& key,
- base::Optional<vm_tools::cicerone::CancelExportLxdContainerResponse>
+ absl::optional<vm_tools::cicerone::CancelExportLxdContainerResponse>
response);
// Callback for CiceroneClient::CancelImportLxdContainer.
void OnCancelImportLxdContainer(
const ContainerId& key,
- base::Optional<vm_tools::cicerone::CancelImportLxdContainerResponse>
+ absl::optional<vm_tools::cicerone::CancelImportLxdContainerResponse>
response);
// Callback for CiceroneClient::UpgradeContainer.
void OnUpgradeContainer(
CrostiniResultCallback callback,
- base::Optional<vm_tools::cicerone::UpgradeContainerResponse> response);
+ absl::optional<vm_tools::cicerone::UpgradeContainerResponse> response);
// Callback for CiceroneClient::CancelUpgradeContainer.
void OnCancelUpgradeContainer(
CrostiniResultCallback callback,
- base::Optional<vm_tools::cicerone::CancelUpgradeContainerResponse>
+ absl::optional<vm_tools::cicerone::CancelUpgradeContainerResponse>
response);
// Callback for CrostiniManager::LaunchContainerApplication.
void OnLaunchContainerApplication(
CrostiniSuccessCallback callback,
- base::Optional<vm_tools::cicerone::LaunchContainerApplicationResponse>
+ absl::optional<vm_tools::cicerone::LaunchContainerApplicationResponse>
response);
// Callback for CrostiniManager::GetContainerAppIcons. Called after the
// Concierge service finishes.
void OnGetContainerAppIcons(
GetContainerAppIconsCallback callback,
- base::Optional<vm_tools::cicerone::ContainerAppIconResponse> response);
+ absl::optional<vm_tools::cicerone::ContainerAppIconResponse> response);
// Callback for CrostiniManager::GetLinuxPackageInfo.
void OnGetLinuxPackageInfo(
GetLinuxPackageInfoCallback callback,
- base::Optional<vm_tools::cicerone::LinuxPackageInfoResponse> response);
+ absl::optional<vm_tools::cicerone::LinuxPackageInfoResponse> response);
// Callback for CrostiniManager::InstallLinuxPackage.
void OnInstallLinuxPackage(
InstallLinuxPackageCallback callback,
- base::Optional<vm_tools::cicerone::InstallLinuxPackageResponse> response);
+ absl::optional<vm_tools::cicerone::InstallLinuxPackageResponse> response);
// Callback for CrostiniManager::UninstallPackageOwningFile.
void OnUninstallPackageOwningFile(
CrostiniResultCallback callback,
- base::Optional<vm_tools::cicerone::UninstallPackageOwningFileResponse>
+ absl::optional<vm_tools::cicerone::UninstallPackageOwningFileResponse>
response);
// Callback for CrostiniManager::GetContainerSshKeys. Called after the
// Concierge service finishes.
void OnGetContainerSshKeys(
GetContainerSshKeysCallback callback,
- base::Optional<vm_tools::concierge::ContainerSshKeysResponse> response);
+ absl::optional<vm_tools::concierge::ContainerSshKeysResponse> response);
// Callback for AnsibleManagementService::ConfigureDefaultContainer
void OnDefaultContainerConfigured(bool success);
diff --git a/chrome/browser/ash/crostini/crostini_manager_unittest.cc b/chrome/browser/ash/crostini/crostini_manager_unittest.cc
index 7966635..8df40756 100644
--- a/chrome/browser/ash/crostini/crostini_manager_unittest.cc
+++ b/chrome/browser/ash/crostini/crostini_manager_unittest.cc
@@ -12,7 +12,6 @@
#include "base/callback_helpers.h"
#include "base/files/file_util.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
@@ -56,6 +55,7 @@
#include "storage/browser/file_system/external_mount_points.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crostini {
@@ -413,7 +413,7 @@
auto notification = notification_service.GetNotification(
"crostini_powerwash_request_instead_of_run");
- EXPECT_NE(base::nullopt, notification);
+ EXPECT_NE(absl::nullopt, notification);
}
TEST_F(CrostiniManagerTest,
@@ -450,7 +450,7 @@
auto notification = notification_service.GetNotification(
"crostini_powerwash_request_cryptohome_error");
- EXPECT_NE(base::nullopt, notification);
+ EXPECT_NE(absl::nullopt, notification);
}
TEST_F(CrostiniManagerTest, StartTerminaVmMountError) {
@@ -792,7 +792,7 @@
EXPECT_GE(fake_concierge_client_->start_termina_vm_call_count(), 1);
EXPECT_EQ(1, restart_crostini_callback_count_);
- base::Optional<ContainerInfo> container_info =
+ absl::optional<ContainerInfo> container_info =
crostini_manager()->GetContainerInfo(container_id());
EXPECT_EQ(container_info.value().username,
DefaultContainerUserNameForProfile(profile()));
@@ -813,7 +813,7 @@
EXPECT_GE(fake_concierge_client_->start_termina_vm_call_count(), 1);
EXPECT_EQ(1, restart_crostini_callback_count_);
- base::Optional<ContainerInfo> container_info =
+ absl::optional<ContainerInfo> container_info =
crostini_manager()->GetContainerInfo(container_id());
EXPECT_EQ(container_info.value().username,
DefaultContainerUserNameForProfile(profile()));
@@ -846,7 +846,7 @@
EXPECT_GE(fake_concierge_client_->start_termina_vm_call_count(), 1);
EXPECT_EQ(1, restart_crostini_callback_count_);
- base::Optional<ContainerInfo> container_info =
+ absl::optional<ContainerInfo> container_info =
crostini_manager()->GetContainerInfo(container_id());
EXPECT_EQ(container_info.value().username,
DefaultContainerUserNameForProfile(profile()));
@@ -866,7 +866,7 @@
EXPECT_GE(fake_concierge_client_->start_termina_vm_call_count(), 1);
EXPECT_EQ(1, restart_crostini_callback_count_);
- base::Optional<ContainerInfo> container_info =
+ absl::optional<ContainerInfo> container_info =
crostini_manager()->GetContainerInfo(container_id());
EXPECT_EQ(container_info.value().username, "helloworld");
ExpectRestarterUmaCount(1);
diff --git a/chrome/browser/ash/crostini/crostini_package_notification.cc b/chrome/browser/ash/crostini/crostini_package_notification.cc
index f1c2d3ce..d615979 100644
--- a/chrome/browser/ash/crostini/crostini_package_notification.cc
+++ b/chrome/browser/ash/crostini/crostini_package_notification.cc
@@ -280,8 +280,8 @@
}
void CrostiniPackageNotification::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
if (current_status_ == PackageOperationStatus::FAILED) {
crostini::ShowCrostiniPackageInstallFailureView(error_message_);
}
diff --git a/chrome/browser/ash/crostini/crostini_package_notification.h b/chrome/browser/ash/crostini/crostini_package_notification.h
index a721879..1842c5c 100644
--- a/chrome/browser/ash/crostini/crostini_package_notification.h
+++ b/chrome/browser/ash/crostini/crostini_package_notification.h
@@ -54,8 +54,8 @@
// message_center::NotificationObserver:
void Close(bool by_user) override;
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
// GuestOsRegistryService::Observer:
void OnRegistryUpdated(
diff --git a/chrome/browser/ash/crostini/crostini_package_service.h b/chrome/browser/ash/crostini/crostini_package_service.h
index 328eaa6..7b8c2fe 100644
--- a/chrome/browser/ash/crostini/crostini_package_service.h
+++ b/chrome/browser/ash/crostini/crostini_package_service.h
@@ -15,7 +15,6 @@
#include "base/callback_forward.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ash/crostini/crostini_manager.h"
#include "chrome/browser/ash/crostini/crostini_package_notification.h"
#include "chrome/browser/ash/crostini/crostini_package_operation_status.h"
@@ -23,6 +22,7 @@
#include "chrome/browser/ash/guest_os/guest_os_registry_service.h"
#include "components/keyed_service/core/keyed_service.h"
#include "storage/browser/file_system/file_system_url.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crostini {
diff --git a/chrome/browser/ash/crostini/crostini_port_forwarder.cc b/chrome/browser/ash/crostini/crostini_port_forwarder.cc
index f5da0b8..6e2c425 100644
--- a/chrome/browser/ash/crostini/crostini_port_forwarder.cc
+++ b/chrome/browser/ash/crostini/crostini_port_forwarder.cc
@@ -77,8 +77,8 @@
bool CrostiniPortForwarder::MatchPortRuleDict(const base::Value& dict,
const PortRuleKey& key) {
- base::Optional<int> port_number = dict.FindIntKey(kPortNumberKey);
- base::Optional<int> protocol_type = dict.FindIntKey(kPortProtocolKey);
+ absl::optional<int> port_number = dict.FindIntKey(kPortNumberKey);
+ absl::optional<int> protocol_type = dict.FindIntKey(kPortProtocolKey);
const std::string* vm_name = dict.FindStringKey(kPortVmNameKey);
const std::string* container_name = dict.FindStringKey(kPortContainerNameKey);
return (port_number && port_number.value() == key.port_number) &&
@@ -125,7 +125,7 @@
return all_ports->EraseListIter(it);
}
-base::Optional<base::Value> CrostiniPortForwarder::ReadPortPreference(
+absl::optional<base::Value> CrostiniPortForwarder::ReadPortPreference(
const PortRuleKey& key) {
PrefService* pref_service = profile_->GetPrefs();
const base::Value* all_ports =
@@ -134,9 +134,9 @@
all_ports->GetList().begin(), all_ports->GetList().end(),
[&key, this](const auto& dict) { return MatchPortRuleDict(dict, key); });
if (it == all_ports->GetList().end()) {
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<base::Value>(it->Clone());
+ return absl::optional<base::Value>(it->Clone());
}
void CrostiniPortForwarder::OnActivatePortCompleted(
@@ -384,7 +384,7 @@
return forwarded_ports_.size();
}
-base::Optional<base::Value> CrostiniPortForwarder::ReadPortPreferenceForTesting(
+absl::optional<base::Value> CrostiniPortForwarder::ReadPortPreferenceForTesting(
const PortRuleKey& key) {
return ReadPortPreference(key);
}
diff --git a/chrome/browser/ash/crostini/crostini_port_forwarder.h b/chrome/browser/ash/crostini/crostini_port_forwarder.h
index bed6241..079e1162 100644
--- a/chrome/browser/ash/crostini/crostini_port_forwarder.h
+++ b/chrome/browser/ash/crostini/crostini_port_forwarder.h
@@ -106,7 +106,7 @@
base::ListValue GetActivePorts();
size_t GetNumberOfForwardedPortsForTesting();
- base::Optional<base::Value> ReadPortPreferenceForTesting(
+ absl::optional<base::Value> ReadPortPreferenceForTesting(
const PortRuleKey& key);
void ActiveNetworksChanged(const std::string& interface);
@@ -126,7 +126,7 @@
const ContainerId& container_id);
void AddNewPortPreference(const PortRuleKey& key, const std::string& label);
bool RemovePortPreference(const PortRuleKey& key);
- base::Optional<base::Value> ReadPortPreference(const PortRuleKey& key);
+ absl::optional<base::Value> ReadPortPreference(const PortRuleKey& key);
void OnActivatePortCompleted(ResultCallback result_callback,
PortRuleKey key,
diff --git a/chrome/browser/ash/crostini/crostini_port_forwarder_unittest.cc b/chrome/browser/ash/crostini/crostini_port_forwarder_unittest.cc
index ed63490b7..0a4c86f 100644
--- a/chrome/browser/ash/crostini/crostini_port_forwarder_unittest.cc
+++ b/chrome/browser/ash/crostini/crostini_port_forwarder_unittest.cc
@@ -113,7 +113,7 @@
void MakePortPreferenceExpectation(CrostiniPortForwarder::PortRuleKey key,
bool exists,
std::string label) {
- base::Optional<base::Value> pref =
+ absl::optional<base::Value> pref =
crostini_port_forwarder_->ReadPortPreferenceForTesting(key);
EXPECT_EQ(exists, pref.has_value());
if (!exists) {
diff --git a/chrome/browser/ash/crostini/crostini_shelf_utils_unittest.cc b/chrome/browser/ash/crostini/crostini_shelf_utils_unittest.cc
index 73bc0a3..6e3b00f 100644
--- a/chrome/browser/ash/crostini/crostini_shelf_utils_unittest.cc
+++ b/chrome/browser/ash/crostini/crostini_shelf_utils_unittest.cc
@@ -7,7 +7,6 @@
#include <iterator>
#include <memory>
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/ash/crostini/crostini_test_helper.h"
#include "chrome/browser/ash/guest_os/guest_os_pref_names.h"
@@ -17,6 +16,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crostini {
@@ -27,14 +27,14 @@
std::string vm_name = "vm";
std::string container_name = "container";
std::string app_name;
- base::Optional<std::string> startup_wm_class;
- base::Optional<bool> startup_notify;
- base::Optional<bool> no_display;
+ absl::optional<std::string> startup_wm_class;
+ absl::optional<bool> startup_notify;
+ absl::optional<bool> no_display;
};
struct WindowIds {
- base::Optional<std::string> app_id;
- base::Optional<std::string> startup_id;
+ absl::optional<std::string> app_id;
+ absl::optional<std::string> startup_id;
};
std::string GenAppId(const App& app) {
diff --git a/chrome/browser/ash/crostini/crostini_sshfs.cc b/chrome/browser/ash/crostini/crostini_sshfs.cc
index 8a1f3f2..9c3400a9 100644
--- a/chrome/browser/ash/crostini/crostini_sshfs.cc
+++ b/chrome/browser/ash/crostini/crostini_sshfs.cc
@@ -95,7 +95,7 @@
}
auto* manager = CrostiniManagerFactory::GetForProfile(profile_);
- base::Optional<ContainerInfo> info = manager->GetContainerInfo(container_id);
+ absl::optional<ContainerInfo> info = manager->GetContainerInfo(container_id);
if (!info) {
LOG(ERROR) << "Unable to mount files for a container that's not running";
Finish(false);
@@ -120,7 +120,7 @@
}
auto* manager = CrostiniManagerFactory::GetForProfile(profile_);
- base::Optional<ContainerInfo> info =
+ absl::optional<ContainerInfo> info =
manager->GetContainerInfo(in_progress_mount_->container_id);
if (!info) {
LOG(ERROR) << "Got ssh keys for a container that's not running. Aborting.";
diff --git a/chrome/browser/ash/crostini/crostini_terminal.h b/chrome/browser/ash/crostini/crostini_terminal.h
index 509a37e..58aa9263 100644
--- a/chrome/browser/ash/crostini/crostini_terminal.h
+++ b/chrome/browser/ash/crostini/crostini_terminal.h
@@ -7,9 +7,9 @@
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/ash/crostini/crostini_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/display/types/display_constants.h"
#include "ui/gfx/geometry/point.h"
diff --git a/chrome/browser/ash/crostini/crostini_unsupported_action_notifier.cc b/chrome/browser/ash/crostini/crostini_unsupported_action_notifier.cc
index 15e9bc5..801200b 100644
--- a/chrome/browser/ash/crostini/crostini_unsupported_action_notifier.cc
+++ b/chrome/browser/ash/crostini/crostini_unsupported_action_notifier.cc
@@ -12,11 +12,11 @@
#include "ash/public/cpp/toast_manager.h"
#include "base/check.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ash/accessibility/magnification_manager.h"
#include "chrome/grit/generated_resources.h"
#include "components/exo/wm_helper.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/base/ime/chromeos/input_method_util.h"
#include "ui/base/l10n/l10n_util.h"
@@ -116,7 +116,7 @@
/*text=*/
l10n_util::GetStringUTF16(IDS_CROSTINI_UNSUPPORTED_VIRTUAL_KEYBOARD),
/*timeout_ms=*/delegate_->ToastTimeoutMs(),
- /*dismiss_text=*/base::nullopt};
+ /*dismiss_text=*/absl::nullopt};
delegate_->ShowToast(data);
virtual_keyboard_unsupported_message_shown_ = true;
EmitMetricReasonShown(reason);
@@ -139,7 +139,7 @@
/*text=*/
l10n_util::GetStringFUTF16(IDS_CROSTINI_UNSUPPORTED_IME, ime_name),
/*timeout_ms=*/delegate_->ToastTimeoutMs(),
- /*dismiss_text=*/base::nullopt};
+ /*dismiss_text=*/absl::nullopt};
delegate_->ShowToast(data);
ime_unsupported_message_shown_ = true;
EmitMetricReasonShown(NotificationReason::kUnsupportedIME);
diff --git a/chrome/browser/ash/crostini/crostini_upgrade_available_notification.cc b/chrome/browser/ash/crostini/crostini_upgrade_available_notification.cc
index 8a39baf..92b1be5 100644
--- a/chrome/browser/ash/crostini/crostini_upgrade_available_notification.cc
+++ b/chrome/browser/ash/crostini/crostini_upgrade_available_notification.cc
@@ -35,8 +35,8 @@
ContainerId::GetDefault());
}
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
disposition_ =
CrostiniUpgradeAvailableNotificationClosed::kNotificationBody;
if (button_index && button_index.value() == 0) {
diff --git a/chrome/browser/ash/crostini/crostini_upgrade_available_notification_unittest.cc b/chrome/browser/ash/crostini/crostini_upgrade_available_notification_unittest.cc
index 0789344..b0288d0 100644
--- a/chrome/browser/ash/crostini/crostini_upgrade_available_notification_unittest.cc
+++ b/chrome/browser/ash/crostini/crostini_upgrade_available_notification_unittest.cc
@@ -118,7 +118,7 @@
void RunUntilIdle() { task_environment()->RunUntilIdle(); }
- base::Optional<message_center::Notification> GetNotification(std::string id) {
+ absl::optional<message_center::Notification> GetNotification(std::string id) {
return display_service_->GetNotification(id);
}
@@ -142,7 +142,7 @@
// Wait for notification, press Upgrade
ASSERT_TRUE(notification);
- notification->Get()->delegate()->Click(0, base::nullopt);
+ notification->Get()->delegate()->Click(0, absl::nullopt);
run_loop.Run();
// Dialog should show because we clicked button 0 (Upgrade).
diff --git a/chrome/browser/ash/crostini/crostini_upgrader.cc b/chrome/browser/ash/crostini/crostini_upgrader.cc
index 9939b2b2..70cfeb5e1 100644
--- a/chrome/browser/ash/crostini/crostini_upgrader.cc
+++ b/chrome/browser/ash/crostini/crostini_upgrader.cc
@@ -7,7 +7,6 @@
#include "base/barrier_closure.h"
#include "base/files/file_util.h"
#include "base/location.h"
-#include "base/optional.h"
#include "base/system/sys_info.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
@@ -25,6 +24,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/network_service_instance.h"
#include "services/network/public/cpp/network_connection_tracker.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crostini {
@@ -66,9 +66,7 @@
}
CrostiniUpgrader::CrostiniUpgrader(Profile* profile)
- : profile_(profile),
- container_id_("", ""),
- backup_path_(base::nullopt) {
+ : profile_(profile), container_id_("", ""), backup_path_(absl::nullopt) {
CrostiniManager::GetForProfile(profile_)->AddUpgradeContainerProgressObserver(
this);
}
@@ -140,7 +138,7 @@
result = CrostiniResult::CONTAINER_EXPORT_IMPORT_FAILED_SPACE;
}
if (type() == ExportImportType::EXPORT) {
- upgrader_->OnBackup(result, base::nullopt);
+ upgrader_->OnBackup(result, absl::nullopt);
} else {
upgrader_->OnRestore(result);
}
@@ -178,7 +176,7 @@
}
void CrostiniUpgrader::OnBackup(CrostiniResult result,
- base::Optional<base::FilePath> backup_path) {
+ absl::optional<base::FilePath> backup_path) {
if (result != CrostiniResult::SUCCESS) {
for (auto& observer : upgrader_observers_) {
observer.OnBackupFailed();
diff --git a/chrome/browser/ash/crostini/crostini_upgrader.h b/chrome/browser/ash/crostini/crostini_upgrader.h
index c50f132..c9f3290 100644
--- a/chrome/browser/ash/crostini/crostini_upgrader.h
+++ b/chrome/browser/ash/crostini/crostini_upgrader.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_ASH_CROSTINI_CROSTINI_UPGRADER_H_
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/ash/crostini/crostini_export_import.h"
#include "chrome/browser/ash/crostini/crostini_export_import_status_tracker.h"
@@ -14,6 +13,7 @@
#include "chrome/browser/ash/crostini/crostini_upgrader_ui_delegate.h"
#include "chromeos/dbus/power/power_manager_client.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -74,7 +74,7 @@
// is different from if |result|==SUCCESS) the |backup_path| will contain a
// path to the backup tarball.
void OnBackup(CrostiniResult result,
- base::Optional<base::FilePath> backup_path);
+ absl::optional<base::FilePath> backup_path);
void OnCancel(CrostiniResult result);
void OnBackupProgress(int progress_percent);
void OnUpgrade(CrostiniResult result);
@@ -124,7 +124,7 @@
// When restoring after a failed upgrade, if the user successfully completed a
// backup, we will auto-restore from that (if the file still exists),
// otherwise |backup_path_|==nullopt and restore will bring up a file-chooser.
- base::Optional<base::FilePath> backup_path_;
+ absl::optional<base::FilePath> backup_path_;
base::WeakPtrFactory<CrostiniUpgrader> weak_ptr_factory_{this};
};
diff --git a/chrome/browser/ash/crostini/crostini_util.cc b/chrome/browser/ash/crostini/crostini_util.cc
index 7961e295..17609193a 100644
--- a/chrome/browser/ash/crostini/crostini_util.cc
+++ b/chrome/browser/ash/crostini/crostini_util.cc
@@ -236,7 +236,7 @@
}
auto* registry_service =
guest_os::GuestOsRegistryServiceFactory::GetForProfile(profile);
- base::Optional<guest_os::GuestOsRegistryService::Registration> registration =
+ absl::optional<guest_os::GuestOsRegistryService::Registration> registration =
registry_service->GetRegistration(app_id);
if (registration)
return registration->CanUninstall();
@@ -387,7 +387,7 @@
auto* registry_service =
guest_os::GuestOsRegistryServiceFactory::GetForProfile(profile);
- base::Optional<guest_os::GuestOsRegistryService::Registration> registration =
+ absl::optional<guest_os::GuestOsRegistryService::Registration> registration =
registry_service->GetRegistration(app_id);
if (!registration) {
RecordAppLaunchHistogram(CrostiniAppLaunchAppType::kUnknownApp);
diff --git a/chrome/browser/ash/crostini/crostini_util.h b/chrome/browser/ash/crostini/crostini_util.h
index cddc113..7c70188 100644
--- a/chrome/browser/ash/crostini/crostini_util.h
+++ b/chrome/browser/ash/crostini/crostini_util.h
@@ -12,10 +12,10 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/ash/crostini/crostini_simple_types.h"
#include "storage/browser/file_system/file_system_url.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace aura {
diff --git a/chrome/browser/ash/crostini/crosvm_metrics.cc b/chrome/browser/ash/crostini/crosvm_metrics.cc
index 5cd2640..3f63662 100644
--- a/chrome/browser/ash/crostini/crosvm_metrics.cc
+++ b/chrome/browser/ash/crostini/crosvm_metrics.cc
@@ -51,7 +51,7 @@
void CrosvmMetrics::CollectCycleStartData() {
previous_pid_stat_map_ = GetCrosvmPidStatMap();
- base::Optional<int64_t> total_cpu_time = ash::system::GetCpuTimeJiffies();
+ absl::optional<int64_t> total_cpu_time = ash::system::GetCpuTimeJiffies();
if (!total_cpu_time.has_value()) {
cycle_start_data_collected_ = false;
return;
@@ -104,13 +104,13 @@
}
PidStatMap pid_stat_map = GetCrosvmPidStatMap();
- base::Optional<int64_t> total_cpu_time = ash::system::GetCpuTimeJiffies();
+ absl::optional<int64_t> total_cpu_time = ash::system::GetCpuTimeJiffies();
if (!total_cpu_time.has_value()) {
cycle_start_data_collected_ = false;
return;
}
int64_t cycle_cpu_time = total_cpu_time.value() - previous_total_cpu_time_;
- base::Optional<int64_t> mem_used = ash::system::GetUsedMemTotalKB();
+ absl::optional<int64_t> mem_used = ash::system::GetUsedMemTotalKB();
if (!mem_used.has_value()) {
cycle_start_data_collected_ = false;
return;
diff --git a/chrome/browser/ash/crostini/crosvm_metrics.h b/chrome/browser/ash/crostini/crosvm_metrics.h
index 5d4d04ea..8c529cb 100644
--- a/chrome/browser/ash/crostini/crosvm_metrics.h
+++ b/chrome/browser/ash/crostini/crosvm_metrics.h
@@ -11,10 +11,10 @@
#include "base/files/file_path.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/timer/timer.h"
#include "chrome/browser/ash/system/procfs_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crostini {
diff --git a/chrome/browser/ash/crostini/crosvm_process_list.cc b/chrome/browser/ash/crostini/crosvm_process_list.cc
index f90da8b..bea9a6d 100644
--- a/chrome/browser/ash/crostini/crosvm_process_list.cc
+++ b/chrome/browser/ash/crostini/crosvm_process_list.cc
@@ -32,7 +32,7 @@
const base::FilePath& slash_proc) {
base::FilePath file_path =
slash_proc.Append(base::NumberToString(pid)).Append("stat");
- base::Optional<ash::system::SingleProcStat> stat =
+ absl::optional<ash::system::SingleProcStat> stat =
ash::system::GetSingleProcStat(file_path);
if (!stat.has_value())
return;
diff --git a/chrome/browser/ash/crostini/fake_crostini_features.cc b/chrome/browser/ash/crostini/fake_crostini_features.cc
index 10e4f713..05662d7 100644
--- a/chrome/browser/ash/crostini/fake_crostini_features.cc
+++ b/chrome/browser/ash/crostini/fake_crostini_features.cc
@@ -27,14 +27,14 @@
}
void FakeCrostiniFeatures::ClearAll() {
- could_be_allowed_ = base::nullopt;
- allowed_now_ = base::nullopt;
- enabled_ = base::nullopt;
- export_import_ui_allowed_ = base::nullopt;
- root_access_allowed_ = base::nullopt;
- container_upgrade_ui_allowed_ = base::nullopt;
- can_change_adb_sideloading_ = base::nullopt;
- port_forwarding_allowed_ = base::nullopt;
+ could_be_allowed_ = absl::nullopt;
+ allowed_now_ = absl::nullopt;
+ enabled_ = absl::nullopt;
+ export_import_ui_allowed_ = absl::nullopt;
+ root_access_allowed_ = absl::nullopt;
+ container_upgrade_ui_allowed_ = absl::nullopt;
+ can_change_adb_sideloading_ = absl::nullopt;
+ port_forwarding_allowed_ = absl::nullopt;
}
bool FakeCrostiniFeatures::CouldBeAllowed(Profile* profile,
diff --git a/chrome/browser/ash/crostini/fake_crostini_features.h b/chrome/browser/ash/crostini/fake_crostini_features.h
index b6ecd96b..8ddbc4a 100644
--- a/chrome/browser/ash/crostini/fake_crostini_features.h
+++ b/chrome/browser/ash/crostini/fake_crostini_features.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_ASH_CROSTINI_FAKE_CROSTINI_FEATURES_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ash/crostini/crostini_features.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -61,14 +61,14 @@
// FakeCrostiniFeatures is created and replaced at destruction.
CrostiniFeatures* original_features_;
- base::Optional<bool> could_be_allowed_;
- base::Optional<bool> allowed_now_;
- base::Optional<bool> enabled_;
- base::Optional<bool> export_import_ui_allowed_;
- base::Optional<bool> root_access_allowed_;
- base::Optional<bool> container_upgrade_ui_allowed_;
- base::Optional<bool> can_change_adb_sideloading_;
- base::Optional<bool> port_forwarding_allowed_;
+ absl::optional<bool> could_be_allowed_;
+ absl::optional<bool> allowed_now_;
+ absl::optional<bool> enabled_;
+ absl::optional<bool> export_import_ui_allowed_;
+ absl::optional<bool> root_access_allowed_;
+ absl::optional<bool> container_upgrade_ui_allowed_;
+ absl::optional<bool> can_change_adb_sideloading_;
+ absl::optional<bool> port_forwarding_allowed_;
};
} // namespace crostini
diff --git a/chrome/browser/ash/crostini/termina_installer.cc b/chrome/browser/ash/crostini/termina_installer.cc
index 3c322ef..4321f08 100644
--- a/chrome/browser/ash/crostini/termina_installer.cc
+++ b/chrome/browser/ash/crostini/termina_installer.cc
@@ -196,7 +196,7 @@
error == component_updater::CrOSComponentManager::Error::NONE;
if (is_successful) {
- dlc_id_ = base::nullopt;
+ dlc_id_ = absl::nullopt;
termina_location_ = path;
UMA_HISTOGRAM_ENUMERATION(kHistogram, InstallSource::Component);
} else {
@@ -295,7 +295,7 @@
void TerminaInstaller::Uninstall(base::OnceCallback<void(bool)> callback) {
// Unset |termina_location_| now since it will become invalid at some point
// soon.
- termina_location_ = base::nullopt;
+ termina_location_ = absl::nullopt;
// This is really a vector of bool, but std::vector<bool> has weird properties
// that stop us from using it in this way.
@@ -423,7 +423,7 @@
return *termina_location_;
}
-base::Optional<std::string> TerminaInstaller::GetDlcId() {
+absl::optional<std::string> TerminaInstaller::GetDlcId() {
CHECK(termina_location_) << "GetDlcId() called while termina not installed";
return dlc_id_;
}
diff --git a/chrome/browser/ash/crostini/termina_installer.h b/chrome/browser/ash/crostini/termina_installer.h
index 1d0cec9..77bbc2eb 100644
--- a/chrome/browser/ash/crostini/termina_installer.h
+++ b/chrome/browser/ash/crostini/termina_installer.h
@@ -10,9 +10,9 @@
#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/component_updater/cros_component_manager.h"
#include "chromeos/dbus/dlcservice/dlcservice_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crostini {
@@ -65,7 +65,7 @@
base::FilePath GetInstallLocation();
// Get the id of the installed DLC, or nullopt if DLC is not being used.
- base::Optional<std::string> GetDlcId();
+ absl::optional<std::string> GetDlcId();
// Attempt to cancel a pending install. Note that neither DLC service nor
// component updater support this, but we have some retry logic that can be
@@ -105,8 +105,8 @@
// successfully check for an update or we need to install a new major version.
bool component_update_check_needed_{true};
- base::Optional<base::FilePath> termina_location_{base::nullopt};
- base::Optional<std::string> dlc_id_{};
+ absl::optional<base::FilePath> termina_location_{absl::nullopt};
+ absl::optional<std::string> dlc_id_{};
base::WeakPtrFactory<TerminaInstaller> weak_ptr_factory_{this};
};
diff --git a/chrome/browser/ash/crostini/termina_installer_unittest.cc b/chrome/browser/ash/crostini/termina_installer_unittest.cc
index 2ff1e10..84011b9 100644
--- a/chrome/browser/ash/crostini/termina_installer_unittest.cc
+++ b/chrome/browser/ash/crostini/termina_installer_unittest.cc
@@ -144,7 +144,7 @@
imageloader::kTerminaComponentName));
EXPECT_EQ(termina_installer_.GetInstallLocation(),
base::FilePath(component_mount_path_));
- EXPECT_EQ(termina_installer_.GetDlcId(), base::nullopt);
+ EXPECT_EQ(termina_installer_.GetDlcId(), absl::nullopt);
}
protected:
diff --git a/chrome/browser/ash/drive/drive_integration_service.cc b/chrome/browser/ash/drive/drive_integration_service.cc
index 4233f68..903851b8 100644
--- a/chrome/browser/ash/drive/drive_integration_service.cc
+++ b/chrome/browser/ash/drive/drive_integration_service.cc
@@ -494,7 +494,7 @@
}
void OnMountFailed(MountFailure failure,
- base::Optional<base::TimeDelta> remount_delay) override {
+ absl::optional<base::TimeDelta> remount_delay) override {
mount_observer_->OnMountFailed(failure, std::move(remount_delay));
}
@@ -502,7 +502,7 @@
mount_observer_->OnMounted(path);
}
- void OnUnmounted(base::Optional<base::TimeDelta> remount_delay) override {
+ void OnUnmounted(absl::optional<base::TimeDelta> remount_delay) override {
mount_observer_->OnUnmounted(std::move(remount_delay));
}
@@ -869,7 +869,7 @@
}
void DriveIntegrationService::MaybeRemountFileSystem(
- base::Optional<base::TimeDelta> remount_delay,
+ absl::optional<base::TimeDelta> remount_delay,
bool failed_to_mount) {
DCHECK_EQ(INITIALIZED, state_);
@@ -933,7 +933,7 @@
}
void DriveIntegrationService::OnUnmounted(
- base::Optional<base::TimeDelta> remount_delay) {
+ absl::optional<base::TimeDelta> remount_delay) {
UmaEmitUnmountOutcome(remount_delay ? DriveMountStatus::kTemporaryUnavailable
: DriveMountStatus::kUnknownFailure);
MaybeRemountFileSystem(remount_delay, false);
@@ -941,7 +941,7 @@
void DriveIntegrationService::OnMountFailed(
MountFailure failure,
- base::Optional<base::TimeDelta> remount_delay) {
+ absl::optional<base::TimeDelta> remount_delay) {
PrefService* prefs = profile_->GetPrefs();
DriveMountStatus status = ConvertMountFailure(failure);
UmaEmitMountStatus(status);
@@ -1053,13 +1053,13 @@
std::move(query),
mojo::WrapCallbackWithDefaultInvokeIfNotRun(
std::move(on_response), drive::FileError::FILE_ERROR_ABORT,
- base::Optional<std::vector<drivefs::mojom::QueryItemPtr>>()));
+ absl::optional<std::vector<drivefs::mojom::QueryItemPtr>>()));
}
void DriveIntegrationService::OnGetQuickAccessItems(
GetQuickAccessItemsCallback callback,
drive::FileError error,
- base::Optional<std::vector<drivefs::mojom::QueryItemPtr>> items) {
+ absl::optional<std::vector<drivefs::mojom::QueryItemPtr>> items) {
if (error != drive::FILE_ERROR_OK || !items.has_value()) {
std::move(callback).Run(error, {});
return;
@@ -1101,13 +1101,13 @@
std::move(drive_query),
mojo::WrapCallbackWithDefaultInvokeIfNotRun(
std::move(on_response), drive::FileError::FILE_ERROR_ABORT,
- base::Optional<std::vector<drivefs::mojom::QueryItemPtr>>()));
+ absl::optional<std::vector<drivefs::mojom::QueryItemPtr>>()));
}
void DriveIntegrationService::OnSearchDriveByFileName(
SearchDriveByFileNameCallback callback,
drive::FileError error,
- base::Optional<std::vector<drivefs::mojom::QueryItemPtr>> items) {
+ absl::optional<std::vector<drivefs::mojom::QueryItemPtr>> items) {
if (error != drive::FILE_ERROR_OK || !items.has_value()) {
std::move(callback).Run(error, {});
return;
diff --git a/chrome/browser/ash/drive/drive_integration_service.h b/chrome/browser/ash/drive/drive_integration_service.h
index 0e279f5..b08b02a 100644
--- a/chrome/browser/ash/drive/drive_integration_service.h
+++ b/chrome/browser/ash/drive/drive_integration_service.h
@@ -141,9 +141,9 @@
// MountObserver implementation.
void OnMounted(const base::FilePath& mount_path) override;
- void OnUnmounted(base::Optional<base::TimeDelta> remount_delay) override;
+ void OnUnmounted(absl::optional<base::TimeDelta> remount_delay) override;
void OnMountFailed(MountFailure failure,
- base::Optional<base::TimeDelta> remount_delay) override;
+ absl::optional<base::TimeDelta> remount_delay) override;
EventLogger* event_logger() { return logger_.get(); }
@@ -251,7 +251,7 @@
// then tries to add it back after that delay. If |remount_delay| isn't
// specified, |failed_to_mount| is true and the user is offline, schedules a
// retry when the user is online.
- void MaybeRemountFileSystem(base::Optional<base::TimeDelta> remount_delay,
+ void MaybeRemountFileSystem(absl::optional<base::TimeDelta> remount_delay,
bool failed_to_mount);
// Helper function for ClearCacheAndRemountFileSystem() that deletes the cache
@@ -282,12 +282,12 @@
void OnGetQuickAccessItems(
GetQuickAccessItemsCallback callback,
drive::FileError error,
- base::Optional<std::vector<drivefs::mojom::QueryItemPtr>> items);
+ absl::optional<std::vector<drivefs::mojom::QueryItemPtr>> items);
void OnSearchDriveByFileName(
SearchDriveByFileNameCallback callback,
drive::FileError error,
- base::Optional<std::vector<drivefs::mojom::QueryItemPtr>> items);
+ absl::optional<std::vector<drivefs::mojom::QueryItemPtr>> items);
friend class DriveIntegrationServiceFactory;
diff --git a/chrome/browser/ash/drive/drive_integration_service_browsertest.cc b/chrome/browser/ash/drive/drive_integration_service_browsertest.cc
index d92865c6..31106a7 100644
--- a/chrome/browser/ash/drive/drive_integration_service_browsertest.cc
+++ b/chrome/browser/ash/drive/drive_integration_service_browsertest.cc
@@ -238,7 +238,7 @@
drive_service->LocateFilesByItemIds(
{"qwertyqwerty", "foobar"},
base::BindLambdaForTesting(
- [=](base::Optional<std::vector<drivefs::mojom::FilePathOrErrorPtr>>
+ [=](absl::optional<std::vector<drivefs::mojom::FilePathOrErrorPtr>>
result) {
ASSERT_EQ(2u, result->size());
EXPECT_EQ(some_other_file,
diff --git a/chrome/browser/ash/file_system_provider/notification_manager.cc b/chrome/browser/ash/file_system_provider/notification_manager.cc
index a51ddaa3..a6bd748 100644
--- a/chrome/browser/ash/file_system_provider/notification_manager.cc
+++ b/chrome/browser/ash/file_system_provider/notification_manager.cc
@@ -60,8 +60,8 @@
}
}
-void NotificationManager::Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+void NotificationManager::Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
if (!button_index)
return;
diff --git a/chrome/browser/ash/file_system_provider/notification_manager.h b/chrome/browser/ash/file_system_provider/notification_manager.h
index 93f32b8..c4c3301 100644
--- a/chrome/browser/ash/file_system_provider/notification_manager.h
+++ b/chrome/browser/ash/file_system_provider/notification_manager.h
@@ -49,8 +49,8 @@
const gfx::ImageSkia& image) override;
// message_center::NotificationObserver overrides:
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
void Close(bool by_user) override;
private:
diff --git a/chrome/browser/ash/guest_os/guest_os_diagnostics_builder.cc b/chrome/browser/ash/guest_os/guest_os_diagnostics_builder.cc
index 99b6614..282b2fe 100644
--- a/chrome/browser/ash/guest_os/guest_os_diagnostics_builder.cc
+++ b/chrome/browser/ash/guest_os/guest_os_diagnostics_builder.cc
@@ -41,7 +41,7 @@
DiagnosticsBuilder::EntryBuilder& DiagnosticsBuilder::EntryBuilder::SetFail(
const std::string& explanation,
- const base::Optional<std::string>& learn_more_link) {
+ const absl::optional<std::string>& learn_more_link) {
DCHECK_EQ(entry_->status, Status::kPass)
<< "SetFail() should only be called on a builder in the initial state";
@@ -54,7 +54,7 @@
void DiagnosticsBuilder::EntryBuilder::OverrideTopError(
const std::string& error,
- const base::Optional<std::string>& learn_more_link) {
+ const absl::optional<std::string>& learn_more_link) {
DCHECK_EQ(entry_->status, Status::kFail);
overridden_top_error_ = mojom::DiagnosticMessage::New(error, learn_more_link);
diff --git a/chrome/browser/ash/guest_os/guest_os_diagnostics_builder.h b/chrome/browser/ash/guest_os/guest_os_diagnostics_builder.h
index 5db3432..a489bef76 100644
--- a/chrome/browser/ash/guest_os/guest_os_diagnostics_builder.h
+++ b/chrome/browser/ash/guest_os/guest_os_diagnostics_builder.h
@@ -7,9 +7,9 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/ash/guest_os/guest_os_diagnostics.mojom.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace guest_os {
@@ -37,10 +37,10 @@
// error is applied.
EntryBuilder& SetFail(
const std::string& explanation,
- const base::Optional<std::string>& learn_more_link = base::nullopt);
+ const absl::optional<std::string>& learn_more_link = absl::nullopt);
void OverrideTopError(
const std::string& error,
- const base::Optional<std::string>& learn_more_link = base::nullopt);
+ const absl::optional<std::string>& learn_more_link = absl::nullopt);
private:
mojom::DiagnosticEntryPtr entry_;
diff --git a/chrome/browser/ash/guest_os/guest_os_external_protocol_handler.cc b/chrome/browser/ash/guest_os/guest_os_external_protocol_handler.cc
index 02794adc..2221624 100644
--- a/chrome/browser/ash/guest_os/guest_os_external_protocol_handler.cc
+++ b/chrome/browser/ash/guest_os/guest_os_external_protocol_handler.cc
@@ -27,7 +27,7 @@
} // namespace
-base::Optional<GuestOsRegistryService::Registration> GetHandler(
+absl::optional<GuestOsRegistryService::Registration> GetHandler(
Profile* profile,
const GURL& url) {
auto* registry_service =
@@ -35,10 +35,10 @@
if (!registry_service) {
// GuestOsRegistryService does not exist for incognito or guest profiles, so
// don't try and use it.
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<GuestOsRegistryService::Registration> result;
+ absl::optional<GuestOsRegistryService::Registration> result;
for (auto& pair : registry_service->GetEnabledApps()) {
auto& registration = pair.second;
if (AppHandlesProtocol(registration, url.scheme()) &&
@@ -50,7 +50,7 @@
}
void Launch(Profile* profile, const GURL& url) {
- base::Optional<GuestOsRegistryService::Registration> registration =
+ absl::optional<GuestOsRegistryService::Registration> registration =
GetHandler(profile, url);
if (!registration) {
LOG(ERROR) << "No handler for " << url;
diff --git a/chrome/browser/ash/guest_os/guest_os_external_protocol_handler.h b/chrome/browser/ash/guest_os/guest_os_external_protocol_handler.h
index 828fd6a..e2bfefd 100644
--- a/chrome/browser/ash/guest_os/guest_os_external_protocol_handler.h
+++ b/chrome/browser/ash/guest_os/guest_os_external_protocol_handler.h
@@ -5,15 +5,15 @@
#ifndef CHROME_BROWSER_ASH_GUEST_OS_GUEST_OS_EXTERNAL_PROTOCOL_HANDLER_H_
#define CHROME_BROWSER_ASH_GUEST_OS_GUEST_OS_EXTERNAL_PROTOCOL_HANDLER_H_
-#include "base/optional.h"
#include "chrome/browser/ash/guest_os/guest_os_registry_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
namespace guest_os {
// Returns handler for |url| if one exists.
-base::Optional<GuestOsRegistryService::Registration> GetHandler(
+absl::optional<GuestOsRegistryService::Registration> GetHandler(
Profile* profile,
const GURL& url);
diff --git a/chrome/browser/ash/guest_os/guest_os_external_protocol_handler_unittest.cc b/chrome/browser/ash/guest_os/guest_os_external_protocol_handler_unittest.cc
index dea2f1d..4c536d4 100644
--- a/chrome/browser/ash/guest_os/guest_os_external_protocol_handler_unittest.cc
+++ b/chrome/browser/ash/guest_os/guest_os_external_protocol_handler_unittest.cc
@@ -65,7 +65,7 @@
AddApp("id2", "x-scheme-handler/testscheme", base::Time::FromTimeT(2));
GuestOsRegistryService(profile()).UpdateApplicationList(app_list());
- base::Optional<GuestOsRegistryService::Registration> registration =
+ absl::optional<GuestOsRegistryService::Registration> registration =
GetHandler(profile(), GURL("testscheme:12341234"));
EXPECT_TRUE(registration);
EXPECT_EQ("id2", registration->DesktopFileId());
diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service.cc b/chrome/browser/ash/guest_os/guest_os_registry_service.cc
index c7bcc4db..7ada820 100644
--- a/chrome/browser/ash/guest_os/guest_os_registry_service.cc
+++ b/chrome/browser/ash/guest_os/guest_os_registry_service.cc
@@ -354,7 +354,7 @@
GuestOsRegistryService::VmType GuestOsRegistryService::Registration::VmType()
const {
- base::Optional<int> vm_type =
+ absl::optional<int> vm_type =
pref_.FindIntKey(guest_os::prefs::kAppVmTypeKey);
// The VmType field is new, existing Apps that do not include it must be
// TERMINA Apps, as Plugin VM apps are not yet in production.
@@ -622,7 +622,7 @@
return apps;
}
-base::Optional<GuestOsRegistryService::Registration>
+absl::optional<GuestOsRegistryService::Registration>
GuestOsRegistryService::GetRegistration(const std::string& app_id) const {
const base::DictionaryValue* apps =
prefs_->GetDictionary(guest_os::prefs::kGuestOsRegistry);
@@ -635,8 +635,8 @@
const base::Value* pref_registration =
apps->FindKeyOfType(app_id, base::Value::Type::DICTIONARY);
if (!pref_registration)
- return base::nullopt;
- return base::make_optional<Registration>(app_id, pref_registration->Clone());
+ return absl::nullopt;
+ return absl::make_optional<Registration>(app_id, pref_registration->Clone());
}
void GuestOsRegistryService::RecordStartupMetrics() {
@@ -660,12 +660,12 @@
if (item.first == crostini::kCrostiniTerminalSystemAppId)
continue;
- base::Optional<bool> no_display =
+ absl::optional<bool> no_display =
item.second.FindBoolKey(guest_os::prefs::kAppNoDisplayKey);
if (no_display && no_display.value())
continue;
- base::Optional<int> vm_type =
+ absl::optional<int> vm_type =
item.second.FindIntKey(guest_os::prefs::kAppVmTypeKey);
if (!vm_type ||
vm_type ==
@@ -1060,7 +1060,7 @@
const std::string& app_id,
ui::ScaleFactor scale_factor) {
// Ignore requests for app_id that isn't registered.
- base::Optional<GuestOsRegistryService::Registration> registration =
+ absl::optional<GuestOsRegistryService::Registration> registration =
GetRegistration(app_id);
DCHECK(registration);
if (!registration) {
diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service.h b/chrome/browser/ash/guest_os/guest_os_registry_service.h
index 68077aa..66c0e7b 100644
--- a/chrome/browser/ash/guest_os/guest_os_registry_service.h
+++ b/chrome/browser/ash/guest_os/guest_os_registry_service.h
@@ -147,7 +147,7 @@
VmType vm_type) const;
// Return null if |app_id| is not found in the registry.
- base::Optional<GuestOsRegistryService::Registration> GetRegistration(
+ absl::optional<GuestOsRegistryService::Registration> GetRegistration(
const std::string& app_id) const;
// Constructs path to app icon for specific scale factor.
diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc b/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc
index c713ba0..80f1efb 100644
--- a/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc
+++ b/chrome/browser/ash/guest_os/guest_os_registry_service_unittest.cc
@@ -147,13 +147,13 @@
app->add_mime_types(mime_type);
service()->UpdateApplicationList(app_list);
- base::Optional<GuestOsRegistryService::Registration> result =
+ absl::optional<GuestOsRegistryService::Registration> result =
service()->GetRegistration(app_id);
ASSERT_TRUE(result.has_value());
EXPECT_EQ(result->DesktopFileId(), desktop_file_id);
EXPECT_EQ(
result->VmType(),
- base::make_optional(
+ absl::make_optional(
GuestOsRegistryService::VmType::ApplicationList_VmType_TERMINA));
EXPECT_EQ(result->VmName(), vm_name);
EXPECT_EQ(result->ContainerName(), container_name);
@@ -322,7 +322,7 @@
testing::ElementsAre(app_id)));
service()->UpdateApplicationList(app_list);
- base::Optional<GuestOsRegistryService::Registration> result =
+ absl::optional<GuestOsRegistryService::Registration> result =
service()->GetRegistration(app_id);
base::Time install_time = test_clock_.Now();
EXPECT_EQ(result->InstallTime(), install_time);
@@ -435,7 +435,7 @@
ApplicationList app_list =
crostini::CrostiniTestHelper::BasicAppList("app", "vm", "container");
service()->UpdateApplicationList(app_list);
- base::Optional<GuestOsRegistryService::Registration> registration =
+ absl::optional<GuestOsRegistryService::Registration> registration =
service()->GetRegistration(app_id);
EXPECT_TRUE(registration.has_value());
EXPECT_FALSE(registration.value().IsScaled());
@@ -448,7 +448,7 @@
crostini::CrostiniTestHelper::BasicAppList("app", "vm", "container");
service()->UpdateApplicationList(app_list);
service()->SetAppScaled(app_id, true);
- base::Optional<GuestOsRegistryService::Registration> registration =
+ absl::optional<GuestOsRegistryService::Registration> registration =
service()->GetRegistration(app_id);
EXPECT_TRUE(registration.has_value());
EXPECT_TRUE(registration.value().IsScaled());
@@ -479,7 +479,7 @@
}
service()->UpdateApplicationList(app_list);
- base::Optional<GuestOsRegistryService::Registration> result =
+ absl::optional<GuestOsRegistryService::Registration> result =
service()->GetRegistration(app_id);
g_browser_process->SetApplicationLocale("");
EXPECT_EQ(result->Keywords(), keywords[""]);
@@ -504,9 +504,9 @@
app_list.mutable_apps(0)->set_exec(exec);
service()->UpdateApplicationList(app_list);
- base::Optional<GuestOsRegistryService::Registration> result_valid_exec =
+ absl::optional<GuestOsRegistryService::Registration> result_valid_exec =
service()->GetRegistration(app_id_valid_exec);
- base::Optional<GuestOsRegistryService::Registration> result_no_exec =
+ absl::optional<GuestOsRegistryService::Registration> result_no_exec =
service()->GetRegistration(app_id_no_exec);
EXPECT_EQ(result_valid_exec->Exec(), exec);
EXPECT_EQ(result_no_exec->Exec(), "");
@@ -525,9 +525,9 @@
app_list.mutable_apps(0)->set_executable_file_name(executable_file_name);
service()->UpdateApplicationList(app_list);
- base::Optional<GuestOsRegistryService::Registration> result_valid_exec =
+ absl::optional<GuestOsRegistryService::Registration> result_valid_exec =
service()->GetRegistration(app_id_valid_exec);
- base::Optional<GuestOsRegistryService::Registration> result_no_exec =
+ absl::optional<GuestOsRegistryService::Registration> result_no_exec =
service()->GetRegistration(app_id_no_exec);
EXPECT_EQ(result_valid_exec->ExecutableFileName(), executable_file_name);
EXPECT_EQ(result_no_exec->ExecutableFileName(), "");
@@ -548,9 +548,9 @@
app_list.mutable_apps(0)->set_package_id(package_id);
service()->UpdateApplicationList(app_list);
- base::Optional<GuestOsRegistryService::Registration> result_valid_package_id =
+ absl::optional<GuestOsRegistryService::Registration> result_valid_package_id =
service()->GetRegistration(app_id_valid_package_id);
- base::Optional<GuestOsRegistryService::Registration> result_no_package_id =
+ absl::optional<GuestOsRegistryService::Registration> result_no_package_id =
service()->GetRegistration(app_id_no_package_id);
EXPECT_EQ(result_valid_package_id->PackageId(), package_id);
EXPECT_EQ(result_no_package_id->PackageId(), "");
diff --git a/chrome/browser/ash/guest_os/guest_os_share_path.cc b/chrome/browser/ash/guest_os/guest_os_share_path.cc
index b6c8e6d4..9cfefa6 100644
--- a/chrome/browser/ash/guest_os/guest_os_share_path.cc
+++ b/chrome/browser/ash/guest_os/guest_os_share_path.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/containers/contains.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/ash/arc/session/arc_session_manager.h"
#include "chrome/browser/ash/crostini/crostini_util.h"
@@ -33,6 +32,7 @@
#include "content/public/browser/browser_thread.h"
#include "storage/browser/file_system/external_mount_points.h"
#include "storage/browser/file_system/file_system_url.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
@@ -43,7 +43,7 @@
void OnSeneschalSharePathResponse(
guest_os::GuestOsSharePath::SharePathCallback callback,
- base::Optional<vm_tools::seneschal::SharePathResponse> response) {
+ absl::optional<vm_tools::seneschal::SharePathResponse> response) {
if (!response) {
std::move(callback).Run(base::FilePath(), false, "System error");
return;
@@ -61,7 +61,7 @@
vm_tools::seneschal::SharePathRequest request,
crostini::CrostiniResult result) {
auto* crostini_manager = crostini::CrostiniManager::GetForProfile(profile);
- base::Optional<crostini::VmInfo> vm_info =
+ absl::optional<crostini::VmInfo> vm_info =
crostini_manager->GetVmInfo(vm_name);
if (!vm_info || vm_info->state != crostini::VmState::STARTED) {
std::move(callback).Run(base::FilePath(), false, "VM could not be started");
@@ -75,7 +75,7 @@
void OnSeneschalUnsharePathResponse(
guest_os::SuccessCallback callback,
- base::Optional<vm_tools::seneschal::UnsharePathResponse> response) {
+ absl::optional<vm_tools::seneschal::UnsharePathResponse> response) {
if (!response) {
std::move(callback).Run(false, "System error");
return;
@@ -374,7 +374,7 @@
} else {
// Restart VM if not currently running.
auto* crostini_manager = crostini::CrostiniManager::GetForProfile(profile_);
- base::Optional<crostini::VmInfo> vm_info =
+ absl::optional<crostini::VmInfo> vm_info =
crostini_manager->GetVmInfo(vm_name);
if (!vm_info || vm_info->state != crostini::VmState::STARTED) {
crostini_manager->RestartCrostini(
@@ -418,7 +418,7 @@
request.set_handle(vm_info->seneschal_server_handle());
} else {
auto* crostini_manager = crostini::CrostiniManager::GetForProfile(profile_);
- base::Optional<crostini::VmInfo> vm_info =
+ absl::optional<crostini::VmInfo> vm_info =
crostini_manager->GetVmInfo(vm_name);
if (!vm_info || vm_info->state != crostini::VmState::STARTED) {
std::move(callback).Run(true, "VM not running");
diff --git a/chrome/browser/ash/hats/hats_notification_controller.cc b/chrome/browser/ash/hats/hats_notification_controller.cc
index d8e3bf2b..36c4f860 100644
--- a/chrome/browser/ash/hats/hats_notification_controller.cc
+++ b/chrome/browser/ash/hats/hats_notification_controller.cc
@@ -182,8 +182,8 @@
}
void HatsNotificationController::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
UpdateLastInteractionTime();
diff --git a/chrome/browser/ash/hats/hats_notification_controller.h b/chrome/browser/ash/hats/hats_notification_controller.h
index 22e5411b..a474b48 100644
--- a/chrome/browser/ash/hats/hats_notification_controller.h
+++ b/chrome/browser/ash/hats/hats_notification_controller.h
@@ -70,8 +70,8 @@
// NotificationDelegate overrides:
void Initialize(bool is_new_device);
void Close(bool by_user) override;
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
// NetworkPortalDetector::Observer override:
void OnPortalDetectionCompleted(
diff --git a/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc b/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc
index add806b..c1296a6 100644
--- a/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc
+++ b/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc
@@ -142,7 +142,7 @@
KerberosAddAccountRunner(KerberosCredentialsManager* manager,
std::string normalized_principal,
bool is_managed,
- const base::Optional<std::string>& password,
+ const absl::optional<std::string>& password,
bool remember_password,
const std::string& krb5_conf,
bool allow_existing,
@@ -274,7 +274,7 @@
KerberosCredentialsManager* const manager_ = nullptr;
std::string normalized_principal_;
bool is_managed_ = false;
- base::Optional<std::string> password_;
+ absl::optional<std::string> password_;
bool remember_password_ = false;
std::string krb5_conf_;
bool allow_existing_ = false;
@@ -433,7 +433,7 @@
void KerberosCredentialsManager::AddAccountAndAuthenticate(
std::string principal_name,
bool is_managed,
- const base::Optional<std::string>& password,
+ const absl::optional<std::string>& password,
bool remember_password,
const std::string& krb5_conf,
bool allow_existing,
@@ -867,7 +867,7 @@
// Get the password, default to not set.
const std::string* password_str = account.FindStringKey(kPassword);
- base::Optional<std::string> password;
+ absl::optional<std::string> password;
if (password_str)
password = std::move(*password_str);
diff --git a/chrome/browser/ash/kerberos/kerberos_credentials_manager.h b/chrome/browser/ash/kerberos/kerberos_credentials_manager.h
index 16cc63e..5328ad7 100644
--- a/chrome/browser/ash/kerberos/kerberos_credentials_manager.h
+++ b/chrome/browser/ash/kerberos/kerberos_credentials_manager.h
@@ -13,10 +13,10 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "base/timer/timer.h"
#include "chrome/browser/ash/authpolicy/kerberos_files_handler.h"
#include "chromeos/dbus/kerberos/kerberos_service.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): forward declare when moved ash
#include "chromeos/network/onc/variable_expander.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -111,7 +111,7 @@
// existing account is updated.
void AddAccountAndAuthenticate(std::string principal_name,
bool is_managed,
- const base::Optional<std::string>& password,
+ const absl::optional<std::string>& password,
bool remember_password,
const std::string& krb5_conf,
bool allow_existing,
diff --git a/chrome/browser/ash/kerberos/kerberos_credentials_manager_test.cc b/chrome/browser/ash/kerberos/kerberos_credentials_manager_test.cc
index 07b5dde..efd3be5 100644
--- a/chrome/browser/ash/kerberos/kerberos_credentials_manager_test.cc
+++ b/chrome/browser/ash/kerberos/kerberos_credentials_manager_test.cc
@@ -12,7 +12,6 @@
#include "base/callback.h"
#include "base/containers/contains.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
@@ -31,6 +30,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -448,7 +448,7 @@
EXPECT_EQ(calls, "AddAccount,SetConfig,AcquireKerberosTgt,GetKerberosFiles");
// Specifying no password excludes AcquireKerberosTgt() call.
- const base::Optional<std::string> kNoPassword;
+ const absl::optional<std::string> kNoPassword;
client_test_interface()->StartRecordingFunctionCalls();
mgr_->AddAccountAndAuthenticate(kPrincipal, kManaged, kNoPassword,
kDontRememberPassword, kConfig,
diff --git a/chrome/browser/ash/kerberos/kerberos_ticket_expiry_notification.cc b/chrome/browser/ash/kerberos/kerberos_ticket_expiry_notification.cc
index b539064..b8390b8 100644
--- a/chrome/browser/ash/kerberos/kerberos_ticket_expiry_notification.cc
+++ b/chrome/browser/ash/kerberos/kerberos_ticket_expiry_notification.cc
@@ -52,7 +52,7 @@
void OnClick(ClickCallback click_callback,
const std::string& passed_principal_name,
- base::Optional<int> /* button_idx */) {
+ absl::optional<int> /* button_idx */) {
click_callback.Run(passed_principal_name);
}
diff --git a/chrome/browser/ash/kerberos/kerberos_ticket_expiry_notification_test.cc b/chrome/browser/ash/kerberos/kerberos_ticket_expiry_notification_test.cc
index e210ec3..ed404ba 100644
--- a/chrome/browser/ash/kerberos/kerberos_ticket_expiry_notification_test.cc
+++ b/chrome/browser/ash/kerberos/kerberos_ticket_expiry_notification_test.cc
@@ -41,7 +41,7 @@
}
protected:
- base::Optional<Notification> Notification() {
+ absl::optional<Notification> Notification() {
return display_service_tester_->GetNotification(kNotificationId);
}
@@ -81,7 +81,7 @@
EXPECT_EQ(0, notification_click_count_[kUser]);
display_service_tester_->SimulateClick(
NotificationHandler::Type::TRANSIENT, kNotificationId,
- base::nullopt /* action_index */, base::nullopt /* reply */);
+ absl::nullopt /* action_index */, absl::nullopt /* reply */);
EXPECT_EQ(1, notification_click_count_[kUser]);
}
diff --git a/chrome/browser/ash/lock_screen_apps/app_window_metrics_tracker.h b/chrome/browser/ash/lock_screen_apps/app_window_metrics_tracker.h
index a55c753..0030931 100644
--- a/chrome/browser/ash/lock_screen_apps/app_window_metrics_tracker.h
+++ b/chrome/browser/ash/lock_screen_apps/app_window_metrics_tracker.h
@@ -8,9 +8,9 @@
#include <map>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "content/public/browser/web_contents_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class TickClock;
@@ -77,7 +77,7 @@
// The state to which the metrics tracker should move after
// the window contents is loaded.
// Should be either kForeground or kBackground.
- base::Optional<State> state_after_window_contents_load_ = State::kForeground;
+ absl::optional<State> state_after_window_contents_load_ = State::kForeground;
DISALLOW_COPY_AND_ASSIGN(AppWindowMetricsTracker);
};
diff --git a/chrome/browser/ash/lock_screen_apps/state_controller.h b/chrome/browser/ash/lock_screen_apps/state_controller.h
index b79e1bb..edc3653 100644
--- a/chrome/browser/ash/lock_screen_apps/state_controller.h
+++ b/chrome/browser/ash/lock_screen_apps/state_controller.h
@@ -12,7 +12,6 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/ash/lock_screen_apps/app_manager.h"
#include "chrome/browser/ash/lock_screen_apps/state_observer.h"
@@ -24,6 +23,7 @@
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/aura/window.h"
#include "ui/events/devices/device_data_manager.h"
#include "ui/events/devices/input_device_event_observer.h"
diff --git a/chrome/browser/ash/login/app_mode/kiosk_browsertest.cc b/chrome/browser/ash/login/app_mode/kiosk_browsertest.cc
index 627d76b6..114da1f 100644
--- a/chrome/browser/ash/login/app_mode/kiosk_browsertest.cc
+++ b/chrome/browser/ash/login/app_mode/kiosk_browsertest.cc
@@ -753,7 +753,7 @@
int current_width) {
std::string message;
while (message_queue->WaitForMessage(&message)) {
- base::Optional<base::Value> message_value =
+ absl::optional<base::Value> message_value =
base::JSONReader::Read(message);
if (!message_value.has_value() || !message_value.value().is_dict())
diff --git a/chrome/browser/ash/login/arc_terms_of_service_browsertest.cc b/chrome/browser/ash/login/arc_terms_of_service_browsertest.cc
index c8220c2..e10d98d 100644
--- a/chrome/browser/ash/login/arc_terms_of_service_browsertest.cc
+++ b/chrome/browser/ash/login/arc_terms_of_service_browsertest.cc
@@ -215,7 +215,7 @@
on_screen_exit_called_ = std::move(on_screen_exit_called);
}
- const base::Optional<ArcTermsOfServiceScreen::Result>& screen_exit_result()
+ const absl::optional<ArcTermsOfServiceScreen::Result>& screen_exit_result()
const {
return screen_exit_result_;
}
@@ -291,7 +291,7 @@
bool serve_tos_with_privacy_policy_footer_ = false;
- base::Optional<ArcTermsOfServiceScreen::Result> screen_exit_result_;
+ absl::optional<ArcTermsOfServiceScreen::Result> screen_exit_result_;
ArcTermsOfServiceScreen::ScreenExitCallback original_callback_;
base::OnceClosure on_screen_exit_called_ = base::DoNothing();
diff --git a/chrome/browser/ash/login/auth/chrome_login_performer.cc b/chrome/browser/ash/login/auth/chrome_login_performer.cc
index ff40090e..6e6eedd 100644
--- a/chrome/browser/ash/login/auth/chrome_login_performer.cc
+++ b/chrome/browser/ash/login/auth/chrome_login_performer.cc
@@ -83,7 +83,7 @@
bool ChromeLoginPerformer::IsUserAllowlisted(
const AccountId& account_id,
bool* wildcard_match,
- const base::Optional<user_manager::UserType>& user_type) {
+ const absl::optional<user_manager::UserType>& user_type) {
return CrosSettings::Get()->IsUserAllowlisted(account_id.GetUserEmail(),
wildcard_match, user_type);
}
diff --git a/chrome/browser/ash/login/auth/chrome_login_performer.h b/chrome/browser/ash/login/auth/chrome_login_performer.h
index 70d7b7a..74bb16a 100644
--- a/chrome/browser/ash/login/auth/chrome_login_performer.h
+++ b/chrome/browser/ash/login/auth/chrome_login_performer.h
@@ -10,7 +10,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/policy/wildcard_login_checker.h"
#include "chromeos/login/auth/auth_status_consumer.h"
#include "chromeos/login/auth/authenticator.h"
@@ -21,6 +20,7 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "google_apis/gaia/google_service_auth_error.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class AccountId;
@@ -41,7 +41,7 @@
bool IsUserAllowlisted(
const AccountId& account_id,
bool* wildcard_match,
- const base::Optional<user_manager::UserType>& user_type) override;
+ const absl::optional<user_manager::UserType>& user_type) override;
protected:
bool RunTrustedCheck(base::OnceClosure callback) override;
diff --git a/chrome/browser/ash/login/auth/cryptohome_authenticator_unittest.cc b/chrome/browser/ash/login/auth/cryptohome_authenticator_unittest.cc
index 76e1529..78b8385 100644
--- a/chrome/browser/ash/login/auth/cryptohome_authenticator_unittest.cc
+++ b/chrome/browser/ash/login/auth/cryptohome_authenticator_unittest.cc
@@ -396,7 +396,7 @@
request.mutable_authorization_request();
fake_userdataauth_client_->AddKey(
request,
- base::BindOnce([](base::Optional<::user_data_auth::AddKeyReply> reply) {
+ base::BindOnce([](absl::optional<::user_data_auth::AddKeyReply> reply) {
ASSERT_TRUE(reply.has_value());
EXPECT_EQ(
reply->error(),
diff --git a/chrome/browser/ash/login/challenge_response_auth_keys_loader.cc b/chrome/browser/ash/login/challenge_response_auth_keys_loader.cc
index 28a50be1..45f09fa8 100644
--- a/chrome/browser/ash/login/challenge_response_auth_keys_loader.cc
+++ b/chrome/browser/ash/login/challenge_response_auth_keys_loader.cc
@@ -12,7 +12,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/containers/flat_set.h"
-#include "base/optional.h"
#include "base/scoped_multi_source_observation.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
@@ -38,6 +37,7 @@
#include "extensions/browser/process_manager.h"
#include "extensions/browser/process_manager_observer.h"
#include "extensions/common/manifest_handlers/background_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -118,7 +118,7 @@
std::vector<ChallengeResponseKey::SignatureAlgorithm>
challenge_response_algorithms;
for (auto ssl_algorithm : ssl_algorithms) {
- base::Optional<ChallengeResponseKey::SignatureAlgorithm> algorithm =
+ absl::optional<ChallengeResponseKey::SignatureAlgorithm> algorithm =
GetChallengeResponseKeyAlgorithmFromSsl(ssl_algorithm);
if (algorithm)
challenge_response_algorithms.push_back(*algorithm);
diff --git a/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader.cc b/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader.cc
index 6b2fb588..c04b4e0 100644
--- a/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader.cc
+++ b/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader.cc
@@ -11,7 +11,6 @@
#include "base/json/json_reader.h"
#include "base/location.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
@@ -25,6 +24,7 @@
#include "extensions/browser/extension_file_task_runner.h"
#include "extensions/common/extension_urls.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace {
@@ -32,11 +32,11 @@
// Arbitrary, but reasonable size limit in bytes for prefs file.
constexpr size_t kPrefsSizeLimit = 1024 * 1024;
-base::Optional<base::Value> LoadPrefsFromDisk(
+absl::optional<base::Value> LoadPrefsFromDisk(
const base::FilePath& prefs_path) {
if (!base::PathExists(prefs_path)) {
LOG(WARNING) << "Demo extensions prefs not found " << prefs_path.value();
- return base::nullopt;
+ return absl::nullopt;
}
std::string prefs_str;
@@ -44,19 +44,19 @@
kPrefsSizeLimit)) {
LOG(ERROR) << "Failed to read prefs " << prefs_path.value() << "; "
<< "failed after reading " << prefs_str.size() << " bytes";
- return base::nullopt;
+ return absl::nullopt;
}
std::unique_ptr<base::Value> prefs_value =
base::JSONReader::ReadDeprecated(prefs_str);
if (!prefs_value) {
LOG(ERROR) << "Unable to parse demo extensions prefs.";
- return base::nullopt;
+ return absl::nullopt;
}
if (!prefs_value->is_dict()) {
LOG(ERROR) << "Demo extensions prefs not a dictionary.";
- return base::nullopt;
+ return absl::nullopt;
}
return base::Value::FromUniquePtrValue(std::move(prefs_value));
@@ -142,7 +142,7 @@
}
void DemoExtensionsExternalLoader::DemoExternalExtensionsPrefsLoaded(
- base::Optional<base::Value> prefs) {
+ absl::optional<base::Value> prefs) {
if (!prefs.has_value()) {
LoadFinished(std::make_unique<base::DictionaryValue>());
return;
diff --git a/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader.h b/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader.h
index f601f1bc..78ac933 100644
--- a/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader.h
+++ b/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader.h
@@ -11,7 +11,7 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): move to forward declaration
#include "chrome/browser/chromeos/extensions/external_cache.h"
#include "chrome/browser/chromeos/extensions/external_cache_delegate.h"
@@ -62,7 +62,7 @@
// Called when the external extensions prefs are read from the disk.
// `prefs` - demo extensions prefs.
- void DemoExternalExtensionsPrefsLoaded(base::Optional<base::Value> prefs);
+ void DemoExternalExtensionsPrefsLoaded(absl::optional<base::Value> prefs);
std::unique_ptr<ExternalCache> external_cache_;
diff --git a/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader_unittest.cc b/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader_unittest.cc
index b7347de..48af32e 100644
--- a/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader_unittest.cc
+++ b/chrome/browser/ash/login/demo_mode/demo_extensions_external_loader_unittest.cc
@@ -178,8 +178,8 @@
}
void AddExtensionToConfig(const std::string& id,
- const base::Optional<std::string>& version,
- const base::Optional<std::string>& path,
+ const absl::optional<std::string>& version,
+ const absl::optional<std::string>& path,
base::Value* config) {
ASSERT_TRUE(config->is_dict());
@@ -261,8 +261,8 @@
demo_mode_test_helper_->InitializeSession();
base::Value config = base::Value(base::Value::Type::DICTIONARY);
- AddExtensionToConfig(std::string(32, 'a'), base::make_optional("1.0.0"),
- base::make_optional("extensions/a.crx"), &config);
+ AddExtensionToConfig(std::string(32, 'a'), absl::make_optional("1.0.0"),
+ absl::make_optional("extensions/a.crx"), &config);
ASSERT_TRUE(SetExtensionsConfig(std::move(config)));
std::unique_ptr<extensions::ExternalProviderImpl> external_provider =
@@ -282,12 +282,12 @@
demo_mode_test_helper_->InitializeSession();
base::Value config = base::Value(base::Value::Type::DICTIONARY);
- AddExtensionToConfig(std::string(32, 'a'), base::make_optional("1.0.0"),
- base::make_optional("extensions/a.crx"), &config);
- AddExtensionToConfig(std::string(32, 'b'), base::make_optional("1.1.0"),
- base::make_optional("b.crx"), &config);
- AddExtensionToConfig(std::string(32, 'c'), base::make_optional("2.0.0"),
- base::make_optional("c.crx"), &config);
+ AddExtensionToConfig(std::string(32, 'a'), absl::make_optional("1.0.0"),
+ absl::make_optional("extensions/a.crx"), &config);
+ AddExtensionToConfig(std::string(32, 'b'), absl::make_optional("1.1.0"),
+ absl::make_optional("b.crx"), &config);
+ AddExtensionToConfig(std::string(32, 'c'), absl::make_optional("2.0.0"),
+ absl::make_optional("c.crx"), &config);
ASSERT_TRUE(SetExtensionsConfig(std::move(config)));
std::unique_ptr<extensions::ExternalProviderImpl> external_provider =
@@ -313,10 +313,10 @@
demo_mode_test_helper_->InitializeSession();
base::Value config = base::Value(base::Value::Type::DICTIONARY);
- AddExtensionToConfig(std::string(32, 'a'), base::make_optional("1.0.0"),
- base::make_optional("a.crx"), &config);
- AddExtensionToConfig(std::string(32, 'b'), base::make_optional("1.1.0"),
- base::make_optional(GetTestResourcePath("b.crx")),
+ AddExtensionToConfig(std::string(32, 'a'), absl::make_optional("1.0.0"),
+ absl::make_optional("a.crx"), &config);
+ AddExtensionToConfig(std::string(32, 'b'), absl::make_optional("1.1.0"),
+ absl::make_optional(GetTestResourcePath("b.crx")),
&config);
ASSERT_TRUE(SetExtensionsConfig(std::move(config)));
@@ -339,10 +339,10 @@
demo_mode_test_helper_->InitializeSession();
base::Value config = base::Value(base::Value::Type::DICTIONARY);
- AddExtensionToConfig(std::string(32, 'a'), base::make_optional("1.0.0"),
- base::make_optional("a.crx"), &config);
- AddExtensionToConfig(std::string(32, 'b'), base::make_optional("1.1.0"),
- base::nullopt, &config);
+ AddExtensionToConfig(std::string(32, 'a'), absl::make_optional("1.0.0"),
+ absl::make_optional("a.crx"), &config);
+ AddExtensionToConfig(std::string(32, 'b'), absl::make_optional("1.1.0"),
+ absl::nullopt, &config);
ASSERT_TRUE(SetExtensionsConfig(std::move(config)));
std::unique_ptr<extensions::ExternalProviderImpl> external_provider =
@@ -364,10 +364,10 @@
demo_mode_test_helper_->InitializeSession();
base::Value config = base::Value(base::Value::Type::DICTIONARY);
- AddExtensionToConfig(std::string(32, 'a'), base::make_optional("1.0.0"),
- base::make_optional("a.crx"), &config);
- AddExtensionToConfig(std::string(32, 'b'), base::nullopt,
- base::make_optional("b.crx"), &config);
+ AddExtensionToConfig(std::string(32, 'a'), absl::make_optional("1.0.0"),
+ absl::make_optional("a.crx"), &config);
+ AddExtensionToConfig(std::string(32, 'b'), absl::nullopt,
+ absl::make_optional("b.crx"), &config);
ASSERT_TRUE(SetExtensionsConfig(std::move(config)));
std::unique_ptr<extensions::ExternalProviderImpl> external_provider =
@@ -402,8 +402,8 @@
demo_mode_test_helper_->InitializeSessionWithPendingComponent();
base::Value config = base::Value(base::Value::Type::DICTIONARY);
- AddExtensionToConfig(std::string(32, 'a'), base::make_optional("1.0.0"),
- base::make_optional("a.crx"), &config);
+ AddExtensionToConfig(std::string(32, 'a'), absl::make_optional("1.0.0"),
+ absl::make_optional("a.crx"), &config);
ASSERT_TRUE(SetExtensionsConfig(std::move(config)));
std::unique_ptr<extensions::ExternalProviderImpl> external_provider =
@@ -426,8 +426,8 @@
demo_mode_test_helper_->InitializeSessionWithPendingComponent();
base::Value config = base::Value(base::Value::Type::DICTIONARY);
- AddExtensionToConfig(std::string(32, 'a'), base::make_optional("1.0.0"),
- base::make_optional("a.crx"), &config);
+ AddExtensionToConfig(std::string(32, 'a'), absl::make_optional("1.0.0"),
+ absl::make_optional("a.crx"), &config);
ASSERT_TRUE(SetExtensionsConfig(std::move(config)));
std::unique_ptr<extensions::ExternalProviderImpl> external_provider =
diff --git a/chrome/browser/ash/login/demo_mode/demo_mode_resources_remover.cc b/chrome/browser/ash/login/demo_mode/demo_mode_resources_remover.cc
index 492b310..2cab4f46f 100644
--- a/chrome/browser/ash/login/demo_mode/demo_mode_resources_remover.cc
+++ b/chrome/browser/ash/login/demo_mode/demo_mode_resources_remover.cc
@@ -236,8 +236,8 @@
const UsageAccumulationConfig& config) {
tick_clock_ = tick_clock;
- usage_start_ = base::nullopt;
- usage_end_ = base::nullopt;
+ usage_start_ = absl::nullopt;
+ usage_end_ = absl::nullopt;
usage_accumulation_config_ = config;
}
@@ -262,8 +262,8 @@
local_state_->SetInteger(kAccumulatedUsagePref, accumulated_activity);
- usage_start_ = base::nullopt;
- usage_end_ = base::nullopt;
+ usage_start_ = absl::nullopt;
+ usage_end_ = absl::nullopt;
}
bool DemoModeResourcesRemover::AttemptRemovalIfUsageOverThreshold() {
@@ -293,8 +293,8 @@
ChromeUserManager::Get()->RemoveSessionStateObserver(this);
user_activity_observation_.Reset();
- usage_start_ = base::nullopt;
- usage_end_ = base::nullopt;
+ usage_start_ = absl::nullopt;
+ usage_end_ = absl::nullopt;
}
// Only report metrics when the resources were found; otherwise this is
diff --git a/chrome/browser/ash/login/demo_mode/demo_mode_resources_remover.h b/chrome/browser/ash/login/demo_mode/demo_mode_resources_remover.h
index 841bd90..952ea07 100644
--- a/chrome/browser/ash/login/demo_mode/demo_mode_resources_remover.h
+++ b/chrome/browser/ash/login/demo_mode/demo_mode_resources_remover.h
@@ -12,10 +12,10 @@
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chromeos/dbus/userdataauth/userdataauth_client.h"
#include "components/user_manager/user_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/user_activity/user_activity_detector.h"
#include "ui/base/user_activity/user_activity_observer.h"
@@ -186,8 +186,8 @@
const base::TickClock* tick_clock_;
// Used to track the duration of last unrecorded interval of user activity.
- base::Optional<base::TimeTicks> usage_start_;
- base::Optional<base::TimeTicks> usage_end_;
+ absl::optional<base::TimeTicks> usage_start_;
+ absl::optional<base::TimeTicks> usage_end_;
base::ScopedObservation<UserDataAuthClient, UserDataAuthClient::Observer>
userdataauth_observation_{this};
diff --git a/chrome/browser/ash/login/demo_mode/demo_mode_resources_remover_unittest.cc b/chrome/browser/ash/login/demo_mode/demo_mode_resources_remover_unittest.cc
index e0cd54a..ad7b730 100644
--- a/chrome/browser/ash/login/demo_mode/demo_mode_resources_remover_unittest.cc
+++ b/chrome/browser/ash/login/demo_mode/demo_mode_resources_remover_unittest.cc
@@ -11,7 +11,6 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/values.h"
#include "chrome/browser/ash/login/demo_mode/demo_mode_test_helper.h"
@@ -24,6 +23,7 @@
#include "components/user_manager/user_names.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/user_activity/user_activity_detector.h"
namespace ash {
@@ -41,7 +41,7 @@
// Used as a callback to DemoModeResourcesRemover::AttemptRemoval - it records
// the result of the attempt to `result_out`.
void RecordRemovalResult(
- base::Optional<DemoModeResourcesRemover::RemovalResult>* result_out,
+ absl::optional<DemoModeResourcesRemover::RemovalResult>* result_out,
DemoModeResourcesRemover::RemovalResult result) {
*result_out = result;
}
@@ -287,7 +287,7 @@
ASSERT_TRUE(remover.get());
EXPECT_EQ(DemoModeResourcesRemover::Get(), remover.get());
- base::Optional<DemoModeResourcesRemover::RemovalResult> result;
+ absl::optional<DemoModeResourcesRemover::RemovalResult> result;
remover->AttemptRemoval(
DemoModeResourcesRemover::RemovalReason::kEnterpriseEnrolled,
base::BindOnce(&RecordRemovalResult, &result));
@@ -305,7 +305,7 @@
ASSERT_TRUE(remover.get());
EXPECT_EQ(DemoModeResourcesRemover::Get(), remover.get());
- base::Optional<DemoModeResourcesRemover::RemovalResult> result;
+ absl::optional<DemoModeResourcesRemover::RemovalResult> result;
remover->AttemptRemoval(
DemoModeResourcesRemover::RemovalReason::kLowDiskSpace,
base::BindOnce(&RecordRemovalResult, &result));
@@ -322,7 +322,7 @@
DemoModeResourcesRemover::CreateIfNeeded(&local_state_);
demo_mode_test_helper_->InitializeSession();
- base::Optional<DemoModeResourcesRemover::RemovalResult> result;
+ absl::optional<DemoModeResourcesRemover::RemovalResult> result;
remover->AttemptRemoval(
DemoModeResourcesRemover::RemovalReason::kLowDiskSpace,
base::BindOnce(&RecordRemovalResult, &result));
@@ -340,12 +340,12 @@
ASSERT_TRUE(remover.get());
EXPECT_EQ(DemoModeResourcesRemover::Get(), remover.get());
- base::Optional<DemoModeResourcesRemover::RemovalResult> result_1;
+ absl::optional<DemoModeResourcesRemover::RemovalResult> result_1;
remover->AttemptRemoval(
DemoModeResourcesRemover::RemovalReason::kLowDiskSpace,
base::BindOnce(&RecordRemovalResult, &result_1));
- base::Optional<DemoModeResourcesRemover::RemovalResult> result_2;
+ absl::optional<DemoModeResourcesRemover::RemovalResult> result_2;
remover->AttemptRemoval(
DemoModeResourcesRemover::RemovalReason::kLowDiskSpace,
base::BindOnce(&RecordRemovalResult, &result_2));
@@ -374,7 +374,7 @@
EXPECT_FALSE(DemoModeResourcesExist());
- base::Optional<DemoModeResourcesRemover::RemovalResult> result;
+ absl::optional<DemoModeResourcesRemover::RemovalResult> result;
remover->AttemptRemoval(
DemoModeResourcesRemover::RemovalReason::kLowDiskSpace,
base::BindOnce(&RecordRemovalResult, &result));
diff --git a/chrome/browser/ash/login/demo_mode/demo_resources.cc b/chrome/browser/ash/login/demo_mode/demo_resources.cc
index 1fc8ef5..0e7957d 100644
--- a/chrome/browser/ash/login/demo_mode/demo_resources.cc
+++ b/chrome/browser/ash/login/demo_mode/demo_resources.cc
@@ -120,7 +120,7 @@
component_updater::CrOSComponentManager::Error error,
const base::FilePath& path) {
component_error_ = error;
- OnDemoResourcesLoaded(base::make_optional(path));
+ OnDemoResourcesLoaded(absl::make_optional(path));
}
void DemoResources::LoadPreinstalledOfflineResources() {
@@ -133,7 +133,7 @@
}
void DemoResources::OnDemoResourcesLoaded(
- base::Optional<base::FilePath> mounted_path) {
+ absl::optional<base::FilePath> mounted_path) {
loaded_ = true;
if (mounted_path.has_value())
diff --git a/chrome/browser/ash/login/demo_mode/demo_resources.h b/chrome/browser/ash/login/demo_mode/demo_resources.h
index bba581d3..2ac859f 100644
--- a/chrome/browser/ash/login/demo_mode/demo_resources.h
+++ b/chrome/browser/ash/login/demo_mode/demo_resources.h
@@ -11,9 +11,9 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ash/login/demo_mode/demo_session.h"
#include "chrome/browser/component_updater/cros_component_installer_chromeos.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -71,7 +71,7 @@
// The error from trying to load the demo mode resources CrOS component from
// the CrOSComponentManager.
- const base::Optional<component_updater::CrOSComponentManager::Error>&
+ const absl::optional<component_updater::CrOSComponentManager::Error>&
component_error() const {
return component_error_;
}
@@ -90,7 +90,7 @@
// Callback for the component or image loader request to load demo resources.
// `mount_path` is the path at which the resources were loaded.
- void OnDemoResourcesLoaded(base::Optional<base::FilePath> mounted_path);
+ void OnDemoResourcesLoaded(absl::optional<base::FilePath> mounted_path);
// Which config to load resources for: online or offline.
DemoSession::DemoModeConfig config_;
@@ -100,7 +100,7 @@
// Last error (or NONE) seen when trying to load the CrOS component. Has no
// value until the load attempt has completed.
- base::Optional<component_updater::CrOSComponentManager::Error>
+ absl::optional<component_updater::CrOSComponentManager::Error>
component_error_;
// Path at which demo mode resources were loaded.
diff --git a/chrome/browser/ash/login/demo_mode/demo_session.cc b/chrome/browser/ash/login/demo_mode/demo_session.cc
index 7908a89d..d047c68 100644
--- a/chrome/browser/ash/login/demo_mode/demo_session.cc
+++ b/chrome/browser/ash/login/demo_mode/demo_session.cc
@@ -17,7 +17,6 @@
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info.h"
@@ -52,6 +51,7 @@
#include "extensions/browser/app_window/app_window.h"
#include "extensions/common/constants.h"
#include "services/network/public/cpp/network_connection_tracker.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
namespace ash {
@@ -66,7 +66,7 @@
DemoSession* g_demo_session = nullptr;
// Type of demo config forced on for tests.
-base::Optional<DemoSession::DemoModeConfig> g_force_demo_config;
+absl::optional<DemoSession::DemoModeConfig> g_force_demo_config;
// Path relative to the path at which offline demo resources are loaded that
// contains the highlights app.
@@ -283,7 +283,7 @@
// static
void DemoSession::ResetDemoConfigForTesting() {
- g_force_demo_config = base::nullopt;
+ g_force_demo_config = absl::nullopt;
}
// static
diff --git a/chrome/browser/ash/login/demo_mode/demo_session_unittest.cc b/chrome/browser/ash/login/demo_mode/demo_session_unittest.cc
index ff24533..47ea58c 100644
--- a/chrome/browser/ash/login/demo_mode/demo_session_unittest.cc
+++ b/chrome/browser/ash/login/demo_mode/demo_session_unittest.cc
@@ -13,7 +13,6 @@
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/timer/mock_timer.h"
#include "chrome/browser/ash/login/demo_mode/demo_resources.h"
@@ -42,6 +41,7 @@
#include "extensions/browser/app_window/app_window.h"
#include "extensions/common/extension_builder.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace {
diff --git a/chrome/browser/ash/login/demo_mode/demo_setup_controller.cc b/chrome/browser/ash/login/demo_mode/demo_setup_controller.cc
index d04e62f..616911a 100644
--- a/chrome/browser/ash/login/demo_mode/demo_setup_controller.cc
+++ b/chrome/browser/ash/login/demo_mode/demo_setup_controller.cc
@@ -102,10 +102,10 @@
// A utility function of base::ReadFileToString which returns an optional
// string.
// TODO(mukai): move this to base/files.
-base::Optional<std::string> ReadFileToOptionalString(
+absl::optional<std::string> ReadFileToOptionalString(
const base::FilePath& file_path) {
std::string content;
- base::Optional<std::string> result;
+ absl::optional<std::string> result;
if (base::ReadFileToString(file_path, &content))
result = std::move(content);
return result;
@@ -763,7 +763,7 @@
}
void DemoSetupController::OnDeviceLocalAccountPolicyLoaded(
- base::Optional<std::string> blob) {
+ absl::optional<std::string> blob) {
if (!blob.has_value()) {
// This is very unlikely to happen since the file existence is already
// checked as CheckOfflinePolicyFilesExist.
diff --git a/chrome/browser/ash/login/demo_mode/demo_setup_controller.h b/chrome/browser/ash/login/demo_mode/demo_setup_controller.h
index 77ecb8e..bb883c99 100644
--- a/chrome/browser/ash/login/demo_mode/demo_setup_controller.h
+++ b/chrome/browser/ash/login/demo_mode/demo_setup_controller.h
@@ -262,7 +262,7 @@
// Called when the device local account policy for the offline demo mode is
// loaded.
- void OnDeviceLocalAccountPolicyLoaded(base::Optional<std::string> blob);
+ void OnDeviceLocalAccountPolicyLoaded(absl::optional<std::string> blob);
// Called when device is marked as registered and the second part of OOBE flow
// is completed. This is the last step of demo mode setup flow.
diff --git a/chrome/browser/ash/login/demo_mode/demo_setup_controller_unittest.cc b/chrome/browser/ash/login/demo_mode/demo_setup_controller_unittest.cc
index c702dbf..37ddf4fe 100644
--- a/chrome/browser/ash/login/demo_mode/demo_setup_controller_unittest.cc
+++ b/chrome/browser/ash/login/demo_mode/demo_setup_controller_unittest.cc
@@ -11,7 +11,6 @@
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "chrome/browser/ash/login/demo_mode/demo_session.h"
@@ -31,6 +30,7 @@
#include "components/policy/core/common/cloud/mock_cloud_policy_store.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace {
@@ -97,9 +97,9 @@
}
private:
- base::Optional<bool> succeeded_;
- base::Optional<DemoSetupController::DemoSetupStep> setup_step_;
- base::Optional<DemoSetupController::DemoSetupError> error_;
+ absl::optional<bool> succeeded_;
+ absl::optional<DemoSetupController::DemoSetupStep> setup_step_;
+ absl::optional<DemoSetupController::DemoSetupError> error_;
std::unique_ptr<base::RunLoop> run_loop_;
DISALLOW_COPY_AND_ASSIGN(DemoSetupControllerTestHelper);
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_create_keys_operation.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_create_keys_operation.cc
index 9f2f1e9..e492c45 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_create_keys_operation.cc
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_create_keys_operation.cc
@@ -362,7 +362,7 @@
void EasyUnlockCreateKeysOperation::OnKeyCreated(
size_t index,
const Key& user_key,
- base::Optional<::user_data_auth::AddKeyReply> reply) {
+ absl::optional<::user_data_auth::AddKeyReply> reply) {
DCHECK_EQ(key_creation_index_, index);
cryptohome::MountError return_code = cryptohome::MOUNT_ERROR_FATAL;
if (reply.has_value())
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_create_keys_operation.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_create_keys_operation.h
index b63ce689..a8756e5 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_create_keys_operation.h
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_create_keys_operation.h
@@ -44,7 +44,7 @@
void OnGetSystemSalt(size_t index, const std::string& system_salt);
void OnKeyCreated(size_t index,
const Key& user_key,
- base::Optional<::user_data_auth::AddKeyReply> reply);
+ absl::optional<::user_data_auth::AddKeyReply> reply);
UserContext user_context_;
std::string tpm_public_key_;
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_get_keys_operation.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_get_keys_operation.cc
index cf0ec68..d3a8eb5 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_get_keys_operation.cc
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_get_keys_operation.cc
@@ -64,7 +64,7 @@
}
void EasyUnlockGetKeysOperation::OnGetKeyData(
- base::Optional<user_data_auth::GetKeyDataReply> reply) {
+ absl::optional<user_data_auth::GetKeyDataReply> reply) {
cryptohome::MountError return_code = user_data_auth::ReplyToMountError(reply);
std::vector<cryptohome::KeyDefinition> key_definitions =
user_data_auth::GetKeyDataReplyToKeyDefinitions(reply);
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_get_keys_operation.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_get_keys_operation.h
index 16750f4..9d2053f 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_get_keys_operation.h
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_get_keys_operation.h
@@ -10,11 +10,11 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ash/login/easy_unlock/easy_unlock_types.h"
#include "chromeos/dbus/cryptohome/UserDataAuth.pb.h"
#include "chromeos/dbus/cryptohome/rpc.pb.h"
#include "chromeos/login/auth/user_context.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace ash {
@@ -41,7 +41,7 @@
// Callback for GetKeyData(). Updates `devices_`, increments `key_index_`, and
// calls GetKeyData() again.
- void OnGetKeyData(base::Optional<user_data_auth::GetKeyDataReply> reply);
+ void OnGetKeyData(absl::optional<user_data_auth::GetKeyDataReply> reply);
UserContext user_context_;
GetKeysCallback callback_;
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller.cc
index ff52bae2..3a6446d1 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller.cc
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller.cc
@@ -151,8 +151,8 @@
~NotificationDelegate() {}
void EasyUnlockNotificationController::NotificationDelegate::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
if (!notification_controller_)
return;
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller.h
index 65918b1..ad1979e 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller.h
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller.h
@@ -49,8 +49,8 @@
notification_controller);
// message_center::NotificationDelegate:
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
private:
~NotificationDelegate() override;
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller_chromeos_unittest.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller_chromeos_unittest.cc
index a2455fa..ca4bed6 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller_chromeos_unittest.cc
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_notification_controller_chromeos_unittest.cc
@@ -61,7 +61,7 @@
const char kNotificationId[] = "easyunlock_notification_ids.chromebook_added";
notification_controller_->ShowChromebookAddedNotification();
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(kNotificationId);
ASSERT_TRUE(notification);
ASSERT_EQ(1u, notification->buttons().size());
@@ -69,11 +69,11 @@
// Clicking notification button should launch settings.
EXPECT_CALL(*notification_controller_, LaunchEasyUnlockSettings());
- notification->delegate()->Click(0, base::nullopt);
+ notification->delegate()->Click(0, absl::nullopt);
// Clicking the notification itself should also launch settings.
EXPECT_CALL(*notification_controller_, LaunchEasyUnlockSettings());
- notification->delegate()->Click(base::nullopt, base::nullopt);
+ notification->delegate()->Click(absl::nullopt, absl::nullopt);
}
TEST_F(EasyUnlockNotificationControllerTest,
@@ -81,7 +81,7 @@
const char kNotificationId[] = "easyunlock_notification_ids.pairing_change";
notification_controller_->ShowPairingChangeNotification();
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(kNotificationId);
ASSERT_TRUE(notification);
ASSERT_EQ(2u, notification->buttons().size());
@@ -89,14 +89,14 @@
// Clicking 1st notification button should lock screen settings.
EXPECT_CALL(*notification_controller_, LockScreen());
- notification->delegate()->Click(0, base::nullopt);
+ notification->delegate()->Click(0, absl::nullopt);
// Clicking 2nd notification button should launch settings.
EXPECT_CALL(*notification_controller_, LaunchEasyUnlockSettings());
- notification->delegate()->Click(1, base::nullopt);
+ notification->delegate()->Click(1, absl::nullopt);
// Clicking the notification itself should do nothing.
- notification->delegate()->Click(base::nullopt, base::nullopt);
+ notification->delegate()->Click(absl::nullopt, absl::nullopt);
}
TEST_F(EasyUnlockNotificationControllerTest,
@@ -105,7 +105,7 @@
"easyunlock_notification_ids.pairing_change_applied";
notification_controller_->ShowPairingChangeAppliedNotification(kPhoneName);
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(kNotificationId);
ASSERT_TRUE(notification);
ASSERT_EQ(1u, notification->buttons().size());
@@ -116,11 +116,11 @@
// Clicking notification button should launch settings.
EXPECT_CALL(*notification_controller_, LaunchEasyUnlockSettings());
- notification->delegate()->Click(0, base::nullopt);
+ notification->delegate()->Click(0, absl::nullopt);
// Clicking the notification itself should also launch settings.
EXPECT_CALL(*notification_controller_, LaunchEasyUnlockSettings());
- notification->delegate()->Click(base::nullopt, base::nullopt);
+ notification->delegate()->Click(absl::nullopt, absl::nullopt);
}
TEST_F(EasyUnlockNotificationControllerTest,
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_remove_keys_operation.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_remove_keys_operation.cc
index eeec96d..85c8898 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_remove_keys_operation.cc
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_remove_keys_operation.cc
@@ -65,7 +65,7 @@
}
void EasyUnlockRemoveKeysOperation::OnKeyRemoved(
- base::Optional<::user_data_auth::RemoveKeyReply> reply) {
+ absl::optional<::user_data_auth::RemoveKeyReply> reply) {
if (reply.has_value() &&
reply->error() ==
::user_data_auth::CryptohomeErrorCode::CRYPTOHOME_ERROR_NOT_SET) {
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_remove_keys_operation.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_remove_keys_operation.h
index 94708af..ffc356d 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_remove_keys_operation.h
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_remove_keys_operation.h
@@ -32,7 +32,7 @@
void OnGetSystemSalt(const std::string& system_salt);
void RemoveKey();
- void OnKeyRemoved(base::Optional<::user_data_auth::RemoveKeyReply> reply);
+ void OnKeyRemoved(absl::optional<::user_data_auth::RemoveKeyReply> reply);
UserContext user_context_;
RemoveKeysCallback callback_;
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_service.cc
index 1d158a1..0b11503 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service.cc
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service.cc
@@ -617,7 +617,7 @@
void EasyUnlockService::SetProximityAuthDevices(
const AccountId& account_id,
const multidevice::RemoteDeviceRefList& remote_devices,
- base::Optional<multidevice::RemoteDeviceRef> local_device) {
+ absl::optional<multidevice::RemoteDeviceRef> local_device) {
UMA_HISTOGRAM_COUNTS_100("SmartLock.EnabledDevicesCount",
remote_devices.size());
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h
index bca299b..4c8fca5 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h
@@ -223,7 +223,7 @@
void SetProximityAuthDevices(
const AccountId& account_id,
const multidevice::RemoteDeviceRefList& remote_devices,
- base::Optional<multidevice::RemoteDeviceRef> local_device);
+ absl::optional<multidevice::RemoteDeviceRef> local_device);
bool will_authenticate_using_easy_unlock() const {
return will_authenticate_using_easy_unlock_;
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular.cc
index 4d87313..4e8f52ed 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular.cc
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular.cc
@@ -130,7 +130,7 @@
// changes.
PA_LOG(VERBOSE) << "Smart Lock is not enabled by user; aborting.";
SetProximityAuthDevices(GetAccountId(), multidevice::RemoteDeviceRefList(),
- base::nullopt /* local_device */);
+ absl::nullopt /* local_device */);
return;
}
@@ -151,7 +151,7 @@
PA_LOG(ERROR) << "Smart Lock is enabled by user, but no unlock key is "
"present; aborting.";
SetProximityAuthDevices(GetAccountId(), multidevice::RemoteDeviceRefList(),
- base::nullopt /* local_device */);
+ absl::nullopt /* local_device */);
if (pref_manager_->IsEasyUnlockEnabledStateSet()) {
LogSmartLockEnabledState(SmartLockEnabledState::DISABLED);
@@ -180,18 +180,18 @@
PA_LOG(ERROR) << "There should only be 1 Smart Lock host, but there are: "
<< remote_devices.size();
SetProximityAuthDevices(GetAccountId(), multidevice::RemoteDeviceRefList(),
- base::nullopt);
+ absl::nullopt);
NOTREACHED();
return;
}
- base::Optional<multidevice::RemoteDeviceRef> local_device =
+ absl::optional<multidevice::RemoteDeviceRef> local_device =
device_sync_client_->GetLocalDeviceMetadata();
if (!local_device) {
PA_LOG(ERROR) << "EasyUnlockServiceRegular::" << __func__
<< ": Local device unexpectedly null.";
SetProximityAuthDevices(GetAccountId(), multidevice::RemoteDeviceRefList(),
- base::nullopt);
+ absl::nullopt);
return;
}
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular.h
index a3b9122..4847b6e 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular.h
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular.h
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/ash/login/easy_unlock/easy_unlock_service.h"
@@ -19,6 +18,7 @@
#include "chromeos/services/device_sync/proto/cryptauth_api.pb.h"
#include "chromeos/services/device_sync/public/cpp/device_sync_client.h"
#include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): move to forward declaration
#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h"
#include "components/prefs/pref_change_registrar.h"
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc
index 3e7b6a9..8eade635 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc
@@ -185,7 +185,7 @@
}
void SetLocalDevice(
- const base::Optional<multidevice::RemoteDeviceRef>& local_device) {
+ const absl::optional<multidevice::RemoteDeviceRef>& local_device) {
fake_device_sync_client_->set_local_device_metadata(test_local_device_);
fake_device_sync_client_->NotifyEnrollmentFinished();
}
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_signin_chromeos.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_signin_chromeos.cc
index a7705c2..d0cfecb 100644
--- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_signin_chromeos.cc
+++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_signin_chromeos.cc
@@ -391,7 +391,7 @@
pref_manager_->SetActiveUser(account_id);
user_pod_last_focused_timestamp_ = base::TimeTicks::Now();
SetProximityAuthDevices(account_id_, multidevice::RemoteDeviceRefList(),
- base::nullopt /* local_device */);
+ absl::nullopt /* local_device */);
ResetScreenlockState();
pref_manager_->SetActiveUser(account_id);
@@ -574,13 +574,13 @@
remote_device_cache_->SetRemoteDevices(remote_devices);
- base::Optional<multidevice::RemoteDeviceRef> unlock_key_device =
+ absl::optional<multidevice::RemoteDeviceRef> unlock_key_device =
remote_device_cache_->GetRemoteDevice(
- base::nullopt /* instance_id */,
+ absl::nullopt /* instance_id */,
unlock_key_id /* legacy_device_id */);
- base::Optional<multidevice::RemoteDeviceRef> local_device =
+ absl::optional<multidevice::RemoteDeviceRef> local_device =
remote_device_cache_->GetRemoteDevice(
- base::nullopt /* instance_id */,
+ absl::nullopt /* instance_id */,
local_device_id /* legacy_device_id */);
// TODO(hansberry): It is possible that there may not be an unlock key by this
diff --git a/chrome/browser/ash/login/encryption_migration_browsertest.cc b/chrome/browser/ash/login/encryption_migration_browsertest.cc
index a60aa17..ec0529c 100644
--- a/chrome/browser/ash/login/encryption_migration_browsertest.cc
+++ b/chrome/browser/ash/login/encryption_migration_browsertest.cc
@@ -7,7 +7,6 @@
#include "ash/constants/ash_switches.h"
#include "ash/public/cpp/login_screen_test_api.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "chrome/browser/ash/arc/policy/arc_policy_util.h"
#include "chrome/browser/ash/login/login_wizard.h"
@@ -32,6 +31,7 @@
#include "components/account_id/account_id.h"
#include "components/user_manager/known_user.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h"
namespace chromeos {
@@ -157,7 +157,7 @@
// Updates the battery percent info reported by the power manager client.
void SetBatteryPercent(int battery_percent) {
- base::Optional<power_manager::PowerSupplyProperties> properties =
+ absl::optional<power_manager::PowerSupplyProperties> properties =
FakePowerManagerClient::Get()->GetLastStatus();
ASSERT_TRUE(properties.has_value());
properties->set_battery_percent(battery_percent);
diff --git a/chrome/browser/ash/login/enrollment/auto_enrollment_controller.cc b/chrome/browser/ash/login/enrollment/auto_enrollment_controller.cc
index a92dbc6e..d8ab7ce4 100644
--- a/chrome/browser/ash/login/enrollment/auto_enrollment_controller.cc
+++ b/chrome/browser/ash/login/enrollment/auto_enrollment_controller.cc
@@ -830,7 +830,7 @@
}
void AutoEnrollmentController::OnFirmwareManagementParametersRemoved(
- base::Optional<user_data_auth::RemoveFirmwareManagementParametersReply>
+ absl::optional<user_data_auth::RemoveFirmwareManagementParametersReply>
reply) {
if (!reply.has_value() ||
reply->error() !=
diff --git a/chrome/browser/ash/login/enrollment/auto_enrollment_controller.h b/chrome/browser/ash/login/enrollment/auto_enrollment_controller.h
index 94ded48..744e5a3 100644
--- a/chrome/browser/ash/login/enrollment/auto_enrollment_controller.h
+++ b/chrome/browser/ash/login/enrollment/auto_enrollment_controller.h
@@ -12,11 +12,11 @@
#include "base/callback_list.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/timer/timer.h"
#include "chrome/browser/ash/settings/device_settings_service.h"
#include "chrome/browser/chromeos/policy/auto_enrollment_client.h"
#include "chromeos/dbus/cryptohome/UserDataAuth.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class CommandLine;
@@ -219,7 +219,7 @@
// the FWMP is used only for newer devices.
// This also starts the VPD clearing process.
void OnFirmwareManagementParametersRemoved(
- base::Optional<user_data_auth::RemoveFirmwareManagementParametersReply>
+ absl::optional<user_data_auth::RemoveFirmwareManagementParametersReply>
reply);
// Makes a D-Bus call to session_manager to set block_devmode=0 and
diff --git a/chrome/browser/ash/login/enrollment/enrollment_local_policy_server_browsertest.cc b/chrome/browser/ash/login/enrollment/enrollment_local_policy_server_browsertest.cc
index f4e79e5..2e5d7c97 100644
--- a/chrome/browser/ash/login/enrollment/enrollment_local_policy_server_browsertest.cc
+++ b/chrome/browser/ash/login/enrollment/enrollment_local_policy_server_browsertest.cc
@@ -833,7 +833,7 @@
INITIAL_ENROLLMENT_MODE_ENROLLMENT_ENFORCED;
policy_server_.SetDeviceInitialEnrollmentResponse(
test::kTestRlzBrandCodeKey, test::kTestSerialNumber, initial_enrollment,
- test::kTestDomain, base::nullopt /* is_license_packaged_with_device */);
+ test::kTestDomain, absl::nullopt /* is_license_packaged_with_device */);
host()->StartWizard(AutoEnrollmentCheckScreenView::kScreenId);
OobeScreenWaiter(EnrollmentScreenView::kScreenId).Wait();
@@ -860,7 +860,7 @@
INITIAL_ENROLLMENT_MODE_ZERO_TOUCH_ENFORCED;
policy_server_.SetDeviceInitialEnrollmentResponse(
test::kTestRlzBrandCodeKey, test::kTestSerialNumber, initial_enrollment,
- test::kTestDomain, base::nullopt /* is_license_packaged_with_device */);
+ test::kTestDomain, absl::nullopt /* is_license_packaged_with_device */);
host()->StartWizard(AutoEnrollmentCheckScreenView::kScreenId);
OobeScreenWaiter(EnrollmentScreenView::kScreenId).Wait();
diff --git a/chrome/browser/ash/login/enrollment/enrollment_screen_browsertest.cc b/chrome/browser/ash/login/enrollment/enrollment_screen_browsertest.cc
index cb37104c..f670e4f 100644
--- a/chrome/browser/ash/login/enrollment/enrollment_screen_browsertest.cc
+++ b/chrome/browser/ash/login/enrollment/enrollment_screen_browsertest.cc
@@ -5,7 +5,6 @@
#include "ash/constants/ash_switches.h"
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "chrome/browser/ash/login/enrollment/enrollment_screen.h"
#include "chrome/browser/ash/login/enrollment/mock_enrollment_screen.h"
@@ -25,6 +24,7 @@
#include "content/public/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
diff --git a/chrome/browser/ash/login/enrollment/enrollment_screen_unittest.cc b/chrome/browser/ash/login/enrollment/enrollment_screen_unittest.cc
index bda66f9..65054c48 100644
--- a/chrome/browser/ash/login/enrollment/enrollment_screen_unittest.cc
+++ b/chrome/browser/ash/login/enrollment/enrollment_screen_unittest.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/test/scoped_mock_time_message_loop_task_runner.h"
#include "base/test/task_environment.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -23,6 +22,7 @@
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/tpm/stub_install_attributes.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -69,7 +69,7 @@
std::unique_ptr<WizardContext> wizard_context_;
// The last result reported by `enrollment_screen_`.
- base::Optional<EnrollmentScreen::Result> last_screen_result_;
+ absl::optional<EnrollmentScreen::Result> last_screen_result_;
policy::EnrollmentConfig enrollment_config_;
diff --git a/chrome/browser/ash/login/existing_user_controller.cc b/chrome/browser/ash/login/existing_user_controller.cc
index 7e3df0a..891da9059 100644
--- a/chrome/browser/ash/login/existing_user_controller.cc
+++ b/chrome/browser/ash/login/existing_user_controller.cc
@@ -21,7 +21,6 @@
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -121,6 +120,7 @@
#include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "services/network/public/mojom/network_context.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/message_center/public/cpp/notification.h"
#include "ui/message_center/public/cpp/notification_delegate.h"
@@ -296,7 +296,7 @@
prefs->CommitPendingWrite();
}
-base::Optional<EncryptionMigrationMode> GetEncryptionMigrationMode(
+absl::optional<EncryptionMigrationMode> GetEncryptionMigrationMode(
const UserContext& user_context,
bool has_incomplete_migration) {
if (has_incomplete_migration) {
@@ -307,7 +307,7 @@
if (user_context.GetUserType() == user_manager::USER_TYPE_CHILD) {
// TODO(https://crbug.com/1147009): Remove child user special case or
// implement finch experiment for child user migration mode.
- return base::nullopt;
+ return absl::nullopt;
}
const bool profile_has_policy =
@@ -663,7 +663,7 @@
}
if (new_user_context.IsUsingPin()) {
- base::Optional<Key> key = quick_unlock::PinStorageCryptohome::TransformKey(
+ absl::optional<Key> key = quick_unlock::PinStorageCryptohome::TransformKey(
new_user_context.GetAccountId(), *new_user_context.GetKey());
if (key) {
new_user_context.SetKey(*key);
@@ -749,7 +749,7 @@
bool ExistingUserController::IsUserAllowlisted(
const AccountId& account_id,
- const base::Optional<user_manager::UserType>& user_type) {
+ const absl::optional<user_manager::UserType>& user_type) {
bool wildcard_match = false;
if (login_performer_.get()) {
return login_performer_->IsUserAllowlisted(account_id, &wildcard_match,
@@ -1042,7 +1042,7 @@
base::UTF8ToUTF16(connector->GetEnterpriseDomainManager()));
auto delegate =
base::MakeRefCounted<message_center::HandleNotificationClickDelegate>(
- base::BindRepeating([](base::Optional<int> button_index) {
+ base::BindRepeating([](absl::optional<int> button_index) {
DCHECK(button_index);
SystemTrayClientImpl::Get()->ShowEnterpriseInfo();
}));
@@ -1126,7 +1126,7 @@
void ExistingUserController::OnOldEncryptionDetected(
const UserContext& user_context,
bool has_incomplete_migration) {
- base::Optional<EncryptionMigrationMode> encryption_migration_mode =
+ absl::optional<EncryptionMigrationMode> encryption_migration_mode =
GetEncryptionMigrationMode(user_context, has_incomplete_migration);
if (!encryption_migration_mode.has_value()) {
ContinuePerformLoginWithoutMigration(login_performer_->auth_mode(),
diff --git a/chrome/browser/ash/login/existing_user_controller.h b/chrome/browser/ash/login/existing_user_controller.h
index 7a9f70c..0d30fd6 100644
--- a/chrome/browser/ash/login/existing_user_controller.h
+++ b/chrome/browser/ash/login/existing_user_controller.h
@@ -16,10 +16,10 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/timer/timer.h"
#include "chrome/browser/ash/app_mode/kiosk_app_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): move KioskAppId to forward declaration
// when moved to chrome/browser/ash/.
#include "chrome/browser/ash/app_mode/kiosk_app_types.h"
@@ -114,7 +114,7 @@
const std::string& given_name);
bool IsUserAllowlisted(
const AccountId& account_id,
- const base::Optional<user_manager::UserType>& user_type);
+ const absl::optional<user_manager::UserType>& user_type);
// user_manager::UserManager::Observer:
void LocalStateChanged(user_manager::UserManager* user_manager) override;
diff --git a/chrome/browser/ash/login/lock/screen_locker.h b/chrome/browser/ash/login/lock/screen_locker.h
index 1ca16c7a..f47f7373 100644
--- a/chrome/browser/ash/login/lock/screen_locker.h
+++ b/chrome/browser/ash/login/lock/screen_locker.h
@@ -15,7 +15,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner_helpers.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -31,6 +30,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/device/public/mojom/fingerprint.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
diff --git a/chrome/browser/ash/login/login_auth_recorder.cc b/chrome/browser/ash/login/login_auth_recorder.cc
index 07b795110..914787a 100644
--- a/chrome/browser/ash/login/login_auth_recorder.cc
+++ b/chrome/browser/ash/login/login_auth_recorder.cc
@@ -15,7 +15,7 @@
namespace {
-base::Optional<AuthMethodSwitchType> SwitchFromPasswordTo(AuthMethod current) {
+absl::optional<AuthMethodSwitchType> SwitchFromPasswordTo(AuthMethod current) {
DCHECK_NE(AuthMethod::kPassword, current);
switch (current) {
case AuthMethod::kPin:
@@ -29,11 +29,11 @@
case AuthMethod::kPassword:
case AuthMethod::kNothing:
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
}
-base::Optional<AuthMethodSwitchType> SwitchFromPinTo(AuthMethod current) {
+absl::optional<AuthMethodSwitchType> SwitchFromPinTo(AuthMethod current) {
DCHECK_NE(AuthMethod::kPin, current);
switch (current) {
case AuthMethod::kPassword:
@@ -46,11 +46,11 @@
case AuthMethod::kChallengeResponse:
case AuthMethod::kNothing:
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
}
-base::Optional<AuthMethodSwitchType> SwitchFromSmartlockTo(AuthMethod current) {
+absl::optional<AuthMethodSwitchType> SwitchFromSmartlockTo(AuthMethod current) {
DCHECK_NE(AuthMethod::kSmartlock, current);
switch (current) {
case AuthMethod::kPassword:
@@ -63,11 +63,11 @@
case AuthMethod::kChallengeResponse:
case AuthMethod::kNothing:
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
}
-base::Optional<AuthMethodSwitchType> SwitchFromFingerprintTo(
+absl::optional<AuthMethodSwitchType> SwitchFromFingerprintTo(
AuthMethod current) {
DCHECK_NE(AuthMethod::kFingerprint, current);
switch (current) {
@@ -81,11 +81,11 @@
case AuthMethod::kChallengeResponse:
case AuthMethod::kNothing:
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
}
-base::Optional<AuthMethodSwitchType> SwitchFromNothingTo(AuthMethod current) {
+absl::optional<AuthMethodSwitchType> SwitchFromNothingTo(AuthMethod current) {
DCHECK_NE(AuthMethod::kNothing, current);
switch (current) {
case AuthMethod::kPassword:
@@ -100,11 +100,11 @@
return AuthMethodSwitchType::kNothingToChallengeResponse;
case AuthMethod::kNothing:
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
}
-base::Optional<AuthMethodSwitchType> FindSwitchType(AuthMethod previous,
+absl::optional<AuthMethodSwitchType> FindSwitchType(AuthMethod previous,
AuthMethod current) {
DCHECK_NE(previous, current);
switch (previous) {
@@ -120,7 +120,7 @@
return SwitchFromNothingTo(current);
case AuthMethod::kChallengeResponse:
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
}
@@ -163,7 +163,7 @@
if (last_auth_method_ != method) {
// Record switching between unlock methods.
- const base::Optional<AuthMethodSwitchType> switch_type =
+ const absl::optional<AuthMethodSwitchType> switch_type =
FindSwitchType(last_auth_method_, method);
if (switch_type) {
base::UmaHistogramEnumeration(prefix + "Switched", *switch_type);
diff --git a/chrome/browser/ash/login/login_auth_recorder.h b/chrome/browser/ash/login/login_auth_recorder.h
index 74d33b14e..0a363b9 100644
--- a/chrome/browser/ash/login/login_auth_recorder.h
+++ b/chrome/browser/ash/login/login_auth_recorder.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_ASH_LOGIN_LOGIN_AUTH_RECORDER_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "components/session_manager/core/session_manager_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
diff --git a/chrome/browser/ash/login/login_client_cert_usage_observer.cc b/chrome/browser/ash/login/login_client_cert_usage_observer.cc
index 930949a..b8c8403b 100644
--- a/chrome/browser/ash/login/login_client_cert_usage_observer.cc
+++ b/chrome/browser/ash/login/login_client_cert_usage_observer.cc
@@ -8,7 +8,6 @@
#include <string>
#include "base/logging.h"
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "chrome/browser/ash/certificate_provider/certificate_provider_service.h"
#include "chrome/browser/ash/certificate_provider/certificate_provider_service_factory.h"
@@ -17,6 +16,7 @@
#include "chromeos/login/auth/challenge_response/cert_utils.h"
#include "net/cert/asn1_util.h"
#include "net/cert/x509_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -47,7 +47,7 @@
}
signature_algorithms->clear();
for (auto ssl_algorithm : ssl_algorithms) {
- base::Optional<ChallengeResponseKey::SignatureAlgorithm> algorithm =
+ absl::optional<ChallengeResponseKey::SignatureAlgorithm> algorithm =
GetChallengeResponseKeyAlgorithmFromSsl(ssl_algorithm);
if (algorithm)
signature_algorithms->push_back(*algorithm);
diff --git a/chrome/browser/ash/login/login_screen_extensions_storage_cleaner.cc b/chrome/browser/ash/login/login_screen_extensions_storage_cleaner.cc
index 1dca510..ef3a249 100644
--- a/chrome/browser/ash/login/login_screen_extensions_storage_cleaner.cc
+++ b/chrome/browser/ash/login/login_screen_extensions_storage_cleaner.cc
@@ -61,7 +61,7 @@
ClearPersistentDataForUninstalledExtensionsImpl(
const std::vector<std::string>& installed_extension_ids,
std::vector<std::string> keys,
- base::Optional<std::string> error) {
+ absl::optional<std::string> error) {
if (error)
return;
diff --git a/chrome/browser/ash/login/login_screen_extensions_storage_cleaner.h b/chrome/browser/ash/login/login_screen_extensions_storage_cleaner.h
index 322f8c8..ff94da7d 100644
--- a/chrome/browser/ash/login/login_screen_extensions_storage_cleaner.h
+++ b/chrome/browser/ash/login/login_screen_extensions_storage_cleaner.h
@@ -10,8 +10,8 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "components/prefs/pref_change_registrar.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefService;
@@ -38,7 +38,7 @@
void ClearPersistentDataForUninstalledExtensionsImpl(
const std::vector<std::string>& installed_extension_ids,
std::vector<std::string> keys,
- base::Optional<std::string> error);
+ absl::optional<std::string> error);
PrefService* prefs_;
PrefChangeRegistrar pref_change_registrar_;
diff --git a/chrome/browser/ash/login/mojo_system_info_dispatcher.cc b/chrome/browser/ash/login/mojo_system_info_dispatcher.cc
index 2104fdc..20a37bf 100644
--- a/chrome/browser/ash/login/mojo_system_info_dispatcher.cc
+++ b/chrome/browser/ash/login/mojo_system_info_dispatcher.cc
@@ -55,7 +55,7 @@
}
void MojoSystemInfoDispatcher::OnSystemInfoUpdated() {
- const base::Optional<bool> policy_show =
+ const absl::optional<bool> policy_show =
version_info_updater_.IsSystemInfoEnforced();
bool enforced = policy_show.has_value();
bool show = false;
diff --git a/chrome/browser/ash/login/oobe_interactive_ui_test.cc b/chrome/browser/ash/login/oobe_interactive_ui_test.cc
index b93d84a..bec88af9 100644
--- a/chrome/browser/ash/login/oobe_interactive_ui_test.cc
+++ b/chrome/browser/ash/login/oobe_interactive_ui_test.cc
@@ -14,7 +14,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
@@ -71,6 +70,7 @@
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#include "ui/display/display_switches.h"
diff --git a/chrome/browser/ash/login/password_change_browsertest.cc b/chrome/browser/ash/login/password_change_browsertest.cc
index dbec45e9..c605283 100644
--- a/chrome/browser/ash/login/password_change_browsertest.cc
+++ b/chrome/browser/ash/login/password_change_browsertest.cc
@@ -398,8 +398,8 @@
chrome::NOTIFICATION_APP_TERMINATING,
content::NotificationService::AllSources());
display_service_tester->SimulateClick(NotificationHandler::Type::TRANSIENT,
- notifications[0].id(), base::nullopt,
- base::nullopt);
+ notifications[0].id(), absl::nullopt,
+ absl::nullopt);
exit_waiter.Wait();
}
diff --git a/chrome/browser/ash/login/quick_unlock/auth_token.cc b/chrome/browser/ash/login/quick_unlock/auth_token.cc
index 214bed7..ffba2d0 100644
--- a/chrome/browser/ash/login/quick_unlock/auth_token.cc
+++ b/chrome/browser/ash/login/quick_unlock/auth_token.cc
@@ -25,15 +25,15 @@
AuthToken::~AuthToken() = default;
-base::Optional<std::string> AuthToken::Identifier() const {
+absl::optional<std::string> AuthToken::Identifier() const {
if (!user_context_)
- return base::nullopt;
+ return absl::nullopt;
return identifier_.ToString();
}
-base::Optional<base::TimeDelta> AuthToken::GetAge() const {
+absl::optional<base::TimeDelta> AuthToken::GetAge() const {
if (!user_context_)
- return base::nullopt;
+ return absl::nullopt;
return base::TimeTicks::Now() - creation_time_;
}
diff --git a/chrome/browser/ash/login/quick_unlock/auth_token.h b/chrome/browser/ash/login/quick_unlock/auth_token.h
index 071e6576..fb5e96d 100644
--- a/chrome/browser/ash/login/quick_unlock/auth_token.h
+++ b/chrome/browser/ash/login/quick_unlock/auth_token.h
@@ -9,9 +9,9 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/unguessable_token.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -34,10 +34,10 @@
// An unguessable identifier that can be passed to webui to verify the token
// instance has not changed. Returns nullopt if Reset() was called.
- base::Optional<std::string> Identifier() const;
+ absl::optional<std::string> Identifier() const;
- // Time since token was created or `base::nullopt` if Reset() was called.
- base::Optional<base::TimeDelta> GetAge() const;
+ // Time since token was created or `absl::nullopt` if Reset() was called.
+ absl::optional<base::TimeDelta> GetAge() const;
// The UserContext returned here can be null if Reset() was called.
const chromeos::UserContext* user_context() const {
diff --git a/chrome/browser/ash/login/quick_unlock/pin_backend.cc b/chrome/browser/ash/login/quick_unlock/pin_backend.cc
index 51d64cd..7cd7ffc6 100644
--- a/chrome/browser/ash/login/quick_unlock/pin_backend.cc
+++ b/chrome/browser/ash/login/quick_unlock/pin_backend.cc
@@ -193,7 +193,7 @@
// There may be a pref value if resetting PIN and the device now supports
// cryptohome-based PIN.
storage->pin_storage_prefs()->RemovePin();
- cryptohome_backend_->SetPin(*user_context, pin, base::nullopt,
+ cryptohome_backend_->SetPin(*user_context, pin, absl::nullopt,
std::move(did_set));
UpdatePinAutosubmitOnSet(account_id, pin.length());
} else {
diff --git a/chrome/browser/ash/login/quick_unlock/pin_migration_browsertest.cc b/chrome/browser/ash/login/quick_unlock/pin_migration_browsertest.cc
index 8b488a4..f68ce05 100644
--- a/chrome/browser/ash/login/quick_unlock/pin_migration_browsertest.cc
+++ b/chrome/browser/ash/login/quick_unlock/pin_migration_browsertest.cc
@@ -61,7 +61,7 @@
// Validate PIN is set.
base::RunLoop run_loop;
- base::Optional<bool> has_pin_result;
+ absl::optional<bool> has_pin_result;
PinBackend::GetInstance()->IsSet(
test_account, base::BindLambdaForTesting([&](bool has_pin) {
has_pin_result = has_pin;
@@ -87,7 +87,7 @@
// Since prefs-based PIN is not set, calling IsSet on PinBackend will only
// return true if the PIN is set in cryptohome.
base::RunLoop run_loop;
- base::Optional<bool> has_pin_result;
+ absl::optional<bool> has_pin_result;
PinBackend::GetInstance()->IsSet(
test_account, base::BindLambdaForTesting([&](bool has_pin) {
has_pin_result = has_pin;
diff --git a/chrome/browser/ash/login/quick_unlock/pin_storage_cryptohome.cc b/chrome/browser/ash/login/quick_unlock/pin_storage_cryptohome.cc
index dab20d3..bfc4e92 100644
--- a/chrome/browser/ash/login/quick_unlock/pin_storage_cryptohome.cc
+++ b/chrome/browser/ash/login/quick_unlock/pin_storage_cryptohome.cc
@@ -41,7 +41,7 @@
template <typename ReplyType>
void OnCryptohomeCallComplete(PinStorageCryptohome::BoolCallback callback,
- base::Optional<ReplyType> reply) {
+ absl::optional<ReplyType> reply) {
std::move(callback).Run(
reply.has_value() &&
reply->error() ==
@@ -53,7 +53,7 @@
void CheckCryptohomePinKey(
PinStorageCryptohome::BoolCallback callback,
bool require_unlocked,
- base::Optional<user_data_auth::GetKeyDataReply> reply) {
+ absl::optional<user_data_auth::GetKeyDataReply> reply) {
const cryptohome::MountError return_code =
user_data_auth::ReplyToMountError(reply);
if (return_code == cryptohome::MOUNT_ERROR_NONE) {
@@ -75,7 +75,7 @@
// cryptohome supports low entropy credentials (ie, PIN).
void OnGetSupportedKeyPolicies(
PinStorageCryptohome::BoolCallback callback,
- base::Optional<user_data_auth::GetSupportedKeyPoliciesReply> reply) {
+ absl::optional<user_data_auth::GetSupportedKeyPoliciesReply> reply) {
if (!reply) {
std::move(callback).Run(false);
return;
@@ -130,7 +130,7 @@
}
// static
-base::Optional<Key> PinStorageCryptohome::TransformKey(
+absl::optional<Key> PinStorageCryptohome::TransformKey(
const AccountId& account_id,
const Key& key) {
Key result = key;
@@ -138,12 +138,12 @@
DCHECK(key.GetKeyType() == Key::KEY_TYPE_PASSWORD_PLAIN);
if (key.GetKeyType() != Key::KEY_TYPE_PASSWORD_PLAIN)
- return base::nullopt;
+ return absl::nullopt;
// Try to lookup in known_user.
const std::string salt = GetSalt(account_id);
if (salt.empty())
- return base::nullopt;
+ return absl::nullopt;
result.Transform(Key::KEY_TYPE_SALTED_PBKDF2_AES256_1234, salt);
return result;
@@ -171,7 +171,7 @@
void PinStorageCryptohome::SetPin(const UserContext& user_context,
const std::string& pin,
- const base::Optional<std::string>& pin_salt,
+ const absl::optional<std::string>& pin_salt,
BoolCallback did_set) {
// Rerun this method only after we have system salt.
if (!salt_obtained_) {
diff --git a/chrome/browser/ash/login/quick_unlock/pin_storage_cryptohome.h b/chrome/browser/ash/login/quick_unlock/pin_storage_cryptohome.h
index e4c7e470..8042c9d 100644
--- a/chrome/browser/ash/login/quick_unlock/pin_storage_cryptohome.h
+++ b/chrome/browser/ash/login/quick_unlock/pin_storage_cryptohome.h
@@ -9,8 +9,8 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chromeos/login/auth/user_context.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class AccountId;
@@ -29,7 +29,7 @@
// Transforms `key` for usage in PIN. Returns nullopt if the key could not be
// transformed.
- static base::Optional<Key> TransformKey(const AccountId& account_id,
+ static absl::optional<Key> TransformKey(const AccountId& account_id,
const Key& key);
PinStorageCryptohome();
@@ -41,7 +41,7 @@
// plain-text. If `pin_salt` contains a value, `pin` will not be hashed.
void SetPin(const UserContext& user_context,
const std::string& pin,
- const base::Optional<std::string>& pin_salt,
+ const absl::optional<std::string>& pin_salt,
BoolCallback did_set);
void RemovePin(const UserContext& user_context, BoolCallback did_remove);
void CanAuthenticate(const AccountId& account_id, BoolCallback result) const;
diff --git a/chrome/browser/ash/login/quick_unlock/pin_storage_cryptohome_unittest.cc b/chrome/browser/ash/login/quick_unlock/pin_storage_cryptohome_unittest.cc
index 0ffcead..19704403 100644
--- a/chrome/browser/ash/login/quick_unlock/pin_storage_cryptohome_unittest.cc
+++ b/chrome/browser/ash/login/quick_unlock/pin_storage_cryptohome_unittest.cc
@@ -89,7 +89,7 @@
bool res;
base::RunLoop loop;
storage_->SetPin(
- user_context, pin, base::nullopt,
+ user_context, pin, absl::nullopt,
base::BindOnce(
[](base::OnceClosure closure, bool* res, bool did_set) {
*res = did_set;
@@ -116,7 +116,7 @@
chromeos::UserDataAuthClient::Get()->AddKey(
request, base::BindOnce(
[](base::OnceClosure closure,
- base::Optional<::user_data_auth::AddKeyReply> reply) {
+ absl::optional<::user_data_auth::AddKeyReply> reply) {
std::move(closure).Run();
},
run_loop.QuitClosure()));
@@ -146,7 +146,7 @@
chromeos::UserDataAuthClient::Get()->AddKey(
request, base::BindOnce(
[](base::OnceClosure closure,
- base::Optional<::user_data_auth::AddKeyReply> reply) {
+ absl::optional<::user_data_auth::AddKeyReply> reply) {
std::move(closure).Run();
},
run_loop.QuitClosure()));
diff --git a/chrome/browser/ash/login/saml/fake_saml_idp_mixin.cc b/chrome/browser/ash/login/saml/fake_saml_idp_mixin.cc
index f8a2236..e204c89 100644
--- a/chrome/browser/ash/login/saml/fake_saml_idp_mixin.cc
+++ b/chrome/browser/ash/login/saml/fake_saml_idp_mixin.cc
@@ -337,7 +337,7 @@
}
void FakeSamlIdpMixin::SaveChallengeResponse(const std::string& response) {
- EXPECT_EQ(challenge_response_, base::nullopt);
+ EXPECT_EQ(challenge_response_, absl::nullopt);
challenge_response_ = response;
}
diff --git a/chrome/browser/ash/login/saml/fake_saml_idp_mixin.h b/chrome/browser/ash/login/saml/fake_saml_idp_mixin.h
index 4865533..2b7c59939 100644
--- a/chrome/browser/ash/login/saml/fake_saml_idp_mixin.h
+++ b/chrome/browser/ash/login/saml/fake_saml_idp_mixin.h
@@ -9,9 +9,9 @@
#include <string>
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "chromeos/dbus/dbus_method_call_status.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "chrome/test/base/mixin_based_in_process_browser_test.h"
#include "net/test/embedded_test_server/http_request.h"
@@ -108,7 +108,7 @@
bool require_http_basic_auth_ = false;
- base::Optional<std::string> challenge_response_;
+ absl::optional<std::string> challenge_response_;
};
} // namespace chromeos
diff --git a/chrome/browser/ash/login/saml/in_session_password_change_manager_unittest.cc b/chrome/browser/ash/login/saml/in_session_password_change_manager_unittest.cc
index 3fdab89..265fd5d 100644
--- a/chrome/browser/ash/login/saml/in_session_password_change_manager_unittest.cc
+++ b/chrome/browser/ash/login/saml/in_session_password_change_manager_unittest.cc
@@ -77,7 +77,7 @@
}
protected:
- base::Optional<Notification> Notification() {
+ absl::optional<Notification> Notification() {
return NotificationDisplayServiceTester::Get()->GetNotification(
"saml.password-expiry-notification");
}
diff --git a/chrome/browser/ash/login/saml/password_expiry_notification.cc b/chrome/browser/ash/login/saml/password_expiry_notification.cc
index 8d09eca..9e601b7 100644
--- a/chrome/browser/ash/login/saml/password_expiry_notification.cc
+++ b/chrome/browser/ash/login/saml/password_expiry_notification.cc
@@ -94,8 +94,8 @@
// message_center::NotificationDelegate:
void Close(bool by_user) override;
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
};
PasswordExpiryNotificationDelegate::PasswordExpiryNotificationDelegate() =
@@ -111,8 +111,8 @@
}
void PasswordExpiryNotificationDelegate::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
bool clicked_on_button = button_index.has_value();
if (clicked_on_button) {
InSessionPasswordChangeManager::Get()->StartInSessionPasswordChange();
diff --git a/chrome/browser/ash/login/saml/password_expiry_notification_unittest.cc b/chrome/browser/ash/login/saml/password_expiry_notification_unittest.cc
index 28f119d..a5c39e3c 100644
--- a/chrome/browser/ash/login/saml/password_expiry_notification_unittest.cc
+++ b/chrome/browser/ash/login/saml/password_expiry_notification_unittest.cc
@@ -40,7 +40,7 @@
class PasswordExpiryNotificationTest : public testing::Test {
protected:
- base::Optional<Notification> Notification() {
+ absl::optional<Notification> Notification() {
return NotificationDisplayServiceTester::Get()->GetNotification(
"saml.password-expiry-notification");
}
diff --git a/chrome/browser/ash/login/saml/public_saml_url_fetcher.cc b/chrome/browser/ash/login/saml/public_saml_url_fetcher.cc
index dcf7e90..c5ea741 100644
--- a/chrome/browser/ash/login/saml/public_saml_url_fetcher.cc
+++ b/chrome/browser/ash/login/saml/public_saml_url_fetcher.cc
@@ -75,7 +75,7 @@
policy::DMAuth::FromDMToken(chromeos::DeviceSettingsService::Get()
->policy_data()
->request_token()),
- /*oauth_token=*/base::nullopt,
+ /*oauth_token=*/absl::nullopt,
g_browser_process->system_network_context_manager()
->GetSharedURLLoaderFactory(),
base::BindOnce(&PublicSamlUrlFetcher::OnPublicSamlUrlReceived,
diff --git a/chrome/browser/ash/login/screens/assistant_optin_flow_screen_browsertest.cc b/chrome/browser/ash/login/screens/assistant_optin_flow_screen_browsertest.cc
index 0a172b0..9356b8d9 100644
--- a/chrome/browser/ash/login/screens/assistant_optin_flow_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/assistant_optin_flow_screen_browsertest.cc
@@ -453,7 +453,7 @@
std::unique_ptr<ScopedAssistantSettings> assistant_settings_;
- base::Optional<AssistantOptInFlowScreen::Result> screen_result_;
+ absl::optional<AssistantOptInFlowScreen::Result> screen_result_;
base::HistogramTester histogram_tester_;
// If set, HandleRequest will return an error for the next value prop URL
diff --git a/chrome/browser/ash/login/screens/edu_coexistence_login_browsertest.cc b/chrome/browser/ash/login/screens/edu_coexistence_login_browsertest.cc
index 7071a00..c54918ad 100644
--- a/chrome/browser/ash/login/screens/edu_coexistence_login_browsertest.cc
+++ b/chrome/browser/ash/login/screens/edu_coexistence_login_browsertest.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ash/login/screens/edu_coexistence_login_screen.h"
#include "base/callback.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ash/login/test/fake_gaia_mixin.h"
@@ -27,6 +26,7 @@
#include "chrome/browser/ui/webui/signin/inline_login_dialog_chromeos_onboarding.h"
#include "components/account_id/account_id.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace {
@@ -59,7 +59,7 @@
EduCoexistenceLoginScreen* GetEduCoexistenceLoginScreen();
- const base::Optional<EduCoexistenceLoginScreen::Result>& result() {
+ const absl::optional<EduCoexistenceLoginScreen::Result>& result() {
return result_;
}
@@ -72,7 +72,7 @@
base::OnceCallback<void()> quit_closure_;
- base::Optional<EduCoexistenceLoginScreen::Result> result_;
+ absl::optional<EduCoexistenceLoginScreen::Result> result_;
EduCoexistenceLoginScreen::ScreenExitCallback original_callback_;
diff --git a/chrome/browser/ash/login/screens/encryption_migration_screen.cc b/chrome/browser/ash/login/screens/encryption_migration_screen.cc
index 20eb0e6..421efc2 100644
--- a/chrome/browser/ash/login/screens/encryption_migration_screen.cc
+++ b/chrome/browser/ash/login/screens/encryption_migration_screen.cc
@@ -498,7 +498,7 @@
}
void EncryptionMigrationScreen::OnMountExistingVault(
- base::Optional<user_data_auth::MountReply> reply) {
+ absl::optional<user_data_auth::MountReply> reply) {
cryptohome::MountError return_code = user_data_auth::ReplyToMountError(reply);
if (return_code != cryptohome::MOUNT_ERROR_NONE) {
RecordMigrationResultMountFailure(IsResumingIncompleteMigration(),
@@ -557,7 +557,7 @@
}
void EncryptionMigrationScreen::OnRemoveCryptohome(
- base::Optional<user_data_auth::RemoveReply> reply) {
+ absl::optional<user_data_auth::RemoveReply> reply) {
cryptohome::MountError error = user_data_auth::ReplyToMountError(reply);
if (error == cryptohome::MOUNT_ERROR_NONE) {
RecordRemoveCryptohomeResultSuccess(IsResumingIncompleteMigration(),
@@ -640,7 +640,7 @@
}
void EncryptionMigrationScreen::OnMigrationRequested(
- base::Optional<user_data_auth::StartMigrateToDircryptoReply> reply) {
+ absl::optional<user_data_auth::StartMigrateToDircryptoReply> reply) {
if (!reply.has_value() ||
reply->error() !=
user_data_auth::CryptohomeErrorCode::CRYPTOHOME_ERROR_NOT_SET) {
diff --git a/chrome/browser/ash/login/screens/encryption_migration_screen.h b/chrome/browser/ash/login/screens/encryption_migration_screen.h
index d81074eb..2ad26bb 100644
--- a/chrome/browser/ash/login/screens/encryption_migration_screen.h
+++ b/chrome/browser/ash/login/screens/encryption_migration_screen.h
@@ -10,10 +10,10 @@
#include "base/callback_forward.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/ash/login/screens/base_screen.h"
#include "chrome/browser/ash/login/screens/encryption_migration_mode.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): move to forward declaration.
#include "chrome/browser/ash/login/ui/login_feedback.h"
#include "chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h"
@@ -96,10 +96,10 @@
void OnGetAvailableStorage(int64_t size);
void WaitBatteryAndMigrate();
void StartMigration();
- void OnMountExistingVault(base::Optional<user_data_auth::MountReply> reply);
+ void OnMountExistingVault(absl::optional<user_data_auth::MountReply> reply);
// Removes cryptohome and shows the error screen after the removal finishes.
void RemoveCryptohome();
- void OnRemoveCryptohome(base::Optional<user_data_auth::RemoveReply> reply);
+ void OnRemoveCryptohome(absl::optional<user_data_auth::RemoveReply> reply);
// Creates authorization request for MountEx method using |user_context_|.
cryptohome::AuthorizationRequest CreateAuthorizationRequest();
@@ -109,7 +109,7 @@
// Handlers for cryptohome API callbacks.
void OnMigrationRequested(
- base::Optional<user_data_auth::StartMigrateToDircryptoReply> reply);
+ absl::optional<user_data_auth::StartMigrateToDircryptoReply> reply);
// Records UMA about visible screen after delay.
void OnDelayedRecordVisibleScreen(
@@ -142,7 +142,7 @@
EncryptionMigrationMode mode_ = EncryptionMigrationMode::ASK_USER;
// The current battery level.
- base::Optional<double> current_battery_percent_;
+ absl::optional<double> current_battery_percent_;
// True if the migration should start immediately once the battery level gets
// sufficient.
diff --git a/chrome/browser/ash/login/screens/family_link_notice_browsertest.cc b/chrome/browser/ash/login/screens/family_link_notice_browsertest.cc
index f7a5c921..4456898 100644
--- a/chrome/browser/ash/login/screens/family_link_notice_browsertest.cc
+++ b/chrome/browser/ash/login/screens/family_link_notice_browsertest.cc
@@ -71,7 +71,7 @@
run_loop.Run();
}
- base::Optional<FamilyLinkNoticeScreen::Result> screen_result_;
+ absl::optional<FamilyLinkNoticeScreen::Result> screen_result_;
protected:
LoginManagerMixin login_manager_mixin_{&mixin_host_, {}, &fake_gaia_};
@@ -95,7 +95,7 @@
}
bool screen_exited_ = false;
- base::Optional<bool> help_app_pref_fal_;
+ absl::optional<bool> help_app_pref_fal_;
base::RepeatingClosure screen_exit_callback_;
FamilyLinkNoticeScreen::ScreenExitCallback original_callback_;
diff --git a/chrome/browser/ash/login/screens/fingerprint_setup_browsertest.cc b/chrome/browser/ash/login/screens/fingerprint_setup_browsertest.cc
index 0b3980d..bed49510 100644
--- a/chrome/browser/ash/login/screens/fingerprint_setup_browsertest.cc
+++ b/chrome/browser/ash/login/screens/fingerprint_setup_browsertest.cc
@@ -129,7 +129,7 @@
private:
bool screen_exit_ = false;
- base::Optional<Result> screen_result_;
+ absl::optional<Result> screen_result_;
base::HistogramTester histogram_tester_;
FingerprintSetupScreen::ScreenExitCallback original_callback_;
base::RepeatingClosure screen_exit_callback_;
diff --git a/chrome/browser/ash/login/screens/gesture_navigation_screen_browsertest.cc b/chrome/browser/ash/login/screens/gesture_navigation_screen_browsertest.cc
index 2183e9b5..cf3f603 100644
--- a/chrome/browser/ash/login/screens/gesture_navigation_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/gesture_navigation_screen_browsertest.cc
@@ -104,7 +104,7 @@
run_loop.Run();
}
- base::Optional<GestureNavigationScreen::Result> screen_result_;
+ absl::optional<GestureNavigationScreen::Result> screen_result_;
base::HistogramTester histogram_tester_;
private:
diff --git a/chrome/browser/ash/login/screens/hid_detection_screen.h b/chrome/browser/ash/login/screens/hid_detection_screen.h
index 5b6f031..7a727ac 100644
--- a/chrome/browser/ash/login/screens/hid_detection_screen.h
+++ b/chrome/browser/ash/login/screens/hid_detection_screen.h
@@ -16,9 +16,9 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ash/login/demo_mode/demo_mode_detector.h"
#include "chrome/browser/ash/login/screens/base_screen.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): move to forward declaration.
#include "chrome/browser/ash/login/wizard_context.h"
// TODO(https://crbug.com/1164001): move to forward declaration.
@@ -69,7 +69,7 @@
InputDeviceManagerBinder binder);
void InputDeviceAddedForTesting(InputDeviceInfoPtr info);
- const base::Optional<Result>& get_exit_result_for_testing() const {
+ const absl::optional<Result>& get_exit_result_for_testing() const {
return exit_result_for_testing_;
}
@@ -231,7 +231,7 @@
HIDDetectionView* view_;
const ScreenExitCallback exit_callback_;
- base::Optional<Result> exit_result_for_testing_;
+ absl::optional<Result> exit_result_for_testing_;
std::unique_ptr<DemoModeDetector> demo_mode_detector_;
diff --git a/chrome/browser/ash/login/screens/hid_detection_screen_browsertest.cc b/chrome/browser/ash/login/screens/hid_detection_screen_browsertest.cc
index 23e9e74..fd8dbfce 100644
--- a/chrome/browser/ash/login/screens/hid_detection_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/hid_detection_screen_browsertest.cc
@@ -79,7 +79,7 @@
}
protected:
- const base::Optional<HIDDetectionScreen::Result>& GetExitResult() {
+ const absl::optional<HIDDetectionScreen::Result>& GetExitResult() {
return WizardController::default_controller()
->GetScreen<HIDDetectionScreen>()
->get_exit_result_for_testing();
diff --git a/chrome/browser/ash/login/screens/locale_switch_screen.cc b/chrome/browser/ash/login/screens/locale_switch_screen.cc
index 372b9ff..143720e 100644
--- a/chrome/browser/ash/login/screens/locale_switch_screen.cc
+++ b/chrome/browser/ash/login/screens/locale_switch_screen.cc
@@ -112,7 +112,7 @@
identity_manager_observer_.Observe(identity_manager);
gaia_id_ = user->GetAccountId().GetGaiaId();
- base::Optional<AccountInfo> maybe_account_info =
+ absl::optional<AccountInfo> maybe_account_info =
identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByGaiaId(gaia_id_);
if (!maybe_account_info.has_value() || maybe_account_info->locale.empty()) {
diff --git a/chrome/browser/ash/login/screens/marketing_opt_in_screen_browsertest.cc b/chrome/browser/ash/login/screens/marketing_opt_in_screen_browsertest.cc
index 38e4699..73cf8df6 100644
--- a/chrome/browser/ash/login/screens/marketing_opt_in_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/marketing_opt_in_screen_browsertest.cc
@@ -139,7 +139,7 @@
// Logs in as a normal user. Overridden by subclasses.
virtual void PerformLogin();
- base::Optional<MarketingOptInScreen::Result> screen_result_;
+ absl::optional<MarketingOptInScreen::Result> screen_result_;
base::HistogramTester histogram_tester_;
protected:
diff --git a/chrome/browser/ash/login/screens/multidevice_setup_screen_browsertest.cc b/chrome/browser/ash/login/screens/multidevice_setup_screen_browsertest.cc
index 391b4379..c1789cc 100644
--- a/chrome/browser/ash/login/screens/multidevice_setup_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/multidevice_setup_screen_browsertest.cc
@@ -107,7 +107,7 @@
!Accepted);
}
- base::Optional<MultiDeviceSetupScreen::Result> screen_result_;
+ absl::optional<MultiDeviceSetupScreen::Result> screen_result_;
base::HistogramTester histogram_tester_;
private:
diff --git a/chrome/browser/ash/login/screens/network_screen_browsertest.cc b/chrome/browser/ash/login/screens/network_screen_browsertest.cc
index c832e3e0..db267170 100644
--- a/chrome/browser/ash/login/screens/network_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/network_screen_browsertest.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "chrome/browser/ash/login/enrollment/enrollment_screen.h"
#include "chrome/browser/ash/login/helper.h"
@@ -27,6 +26,7 @@
#include "content/public/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/views/controls/button/button.h"
@@ -103,7 +103,7 @@
login::MockNetworkStateHelper* mock_network_state_helper_;
NetworkScreen* network_screen_;
- base::Optional<NetworkScreen::Result> last_screen_result_;
+ absl::optional<NetworkScreen::Result> last_screen_result_;
DISALLOW_COPY_AND_ASSIGN(NetworkScreenTest);
};
diff --git a/chrome/browser/ash/login/screens/network_screen_unittest.cc b/chrome/browser/ash/login/screens/network_screen_unittest.cc
index b291269..cc093e6 100644
--- a/chrome/browser/ash/login/screens/network_screen_unittest.cc
+++ b/chrome/browser/ash/login/screens/network_screen_unittest.cc
@@ -9,7 +9,6 @@
#include "ash/constants/ash_switches.h"
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_mock_time_message_loop_task_runner.h"
#include "chrome/browser/ash/login/mock_network_state_helper.h"
@@ -18,6 +17,7 @@
#include "chromeos/dbus/dbus_thread_manager.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -59,7 +59,7 @@
std::unique_ptr<NetworkScreen> network_screen_;
login::MockNetworkStateHelper* mock_network_state_helper_ = nullptr;
- base::Optional<NetworkScreen::Result> last_screen_result_;
+ absl::optional<NetworkScreen::Result> last_screen_result_;
private:
void HandleScreenExit(NetworkScreen::Result screen_result) {
diff --git a/chrome/browser/ash/login/screens/offline_login_screen.cc b/chrome/browser/ash/login/screens/offline_login_screen.cc
index 9fecba3f..35a2a9c 100644
--- a/chrome/browser/ash/login/screens/offline_login_screen.cc
+++ b/chrome/browser/ash/login/screens/offline_login_screen.cc
@@ -180,7 +180,7 @@
const std::string sanitized_email = gaia::SanitizeEmail(email);
const AccountId account_id = user_manager::known_user::GetAccountId(
sanitized_email, std::string(), AccountType::UNKNOWN);
- const base::Optional<base::TimeDelta> offline_signin_interval =
+ const absl::optional<base::TimeDelta> offline_signin_interval =
user_manager::known_user::GetOfflineSigninLimit(account_id);
// Further checks only if the limit is set.
diff --git a/chrome/browser/ash/login/screens/parental_handoff_screen_browsertest.cc b/chrome/browser/ash/login/screens/parental_handoff_screen_browsertest.cc
index c21815b1..6481a47 100644
--- a/chrome/browser/ash/login/screens/parental_handoff_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/parental_handoff_screen_browsertest.cc
@@ -9,7 +9,6 @@
#include "ash/constants/ash_features.h"
#include "base/auto_reset.h"
#include "base/callback.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
@@ -36,6 +35,7 @@
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
#include "components/account_id/account_id.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace {
@@ -69,7 +69,7 @@
void SkipToParentalHandoffScreen();
- const base::Optional<ParentalHandoffScreen::Result>& result() const {
+ const absl::optional<ParentalHandoffScreen::Result>& result() const {
return result_;
}
@@ -82,7 +82,7 @@
base::OnceCallback<void()> quit_closure_;
- base::Optional<ParentalHandoffScreen::Result> result_;
+ absl::optional<ParentalHandoffScreen::Result> result_;
ParentalHandoffScreen::ScreenExitCallback original_callback_;
diff --git a/chrome/browser/ash/login/screens/pin_setup_screen.h b/chrome/browser/ash/login/screens/pin_setup_screen.h
index 95c7eb0..89ee10c3f 100644
--- a/chrome/browser/ash/login/screens/pin_setup_screen.h
+++ b/chrome/browser/ash/login/screens/pin_setup_screen.h
@@ -10,13 +10,13 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/timer/timer.h"
#include "chrome/browser/ash/login/screens/base_screen.h"
// TODO(https://crbug.com/1164001): move to forward declaration.
#include "chrome/browser/ash/login/wizard_context.h"
// TODO(https://crbug.com/1164001): move to forward declaration.
#include "chrome/browser/ui/webui/chromeos/login/pin_setup_screen_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -66,7 +66,7 @@
// Inticates whether the device supports usage of PIN for login.
// This information is retrived in an async way and will not be available
// immediately.
- base::Optional<bool> has_login_support_;
+ absl::optional<bool> has_login_support_;
PinSetupScreenView* const view_;
ScreenExitCallback exit_callback_;
diff --git a/chrome/browser/ash/login/screens/pin_setup_screen_browsertest.cc b/chrome/browser/ash/login/screens/pin_setup_screen_browsertest.cc
index 45d98f4..54c7cf7 100644
--- a/chrome/browser/ash/login/screens/pin_setup_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/pin_setup_screen_browsertest.cc
@@ -124,7 +124,7 @@
run_loop.Run();
}
- base::Optional<PinSetupScreen::Result> screen_result_;
+ absl::optional<PinSetupScreen::Result> screen_result_;
base::HistogramTester histogram_tester_;
private:
diff --git a/chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_impl.cc b/chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_impl.cc
index 2b54f7fe..f03d866 100644
--- a/chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_impl.cc
+++ b/chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_impl.cc
@@ -369,10 +369,10 @@
}
void RecommendAppsFetcherImpl::OnArcFeaturesRead(
- base::Optional<arc::ArcFeatures> read_result) {
+ absl::optional<arc::ArcFeatures> read_result) {
arc_features_ready_ = true;
- if (read_result != base::nullopt) {
+ if (read_result != absl::nullopt) {
for (const auto& feature : read_result.value().feature_map) {
device_config_.add_system_available_feature(feature.first);
}
@@ -485,7 +485,7 @@
base::StringPiece response_body_json(*response_body);
if (base::StartsWith(response_body_json, json_xss_prevention_prefix))
response_body_json.remove_prefix(json_xss_prevention_prefix.length());
- base::Optional<base::Value> output = ParseResponse(response_body_json);
+ absl::optional<base::Value> output = ParseResponse(response_body_json);
if (!output.has_value()) {
RecordUmaResponseAppCount(0);
delegate_->OnParseResponseError();
@@ -507,7 +507,7 @@
StartDownload();
}
-base::Optional<base::Value> RecommendAppsFetcherImpl::ParseResponse(
+absl::optional<base::Value> RecommendAppsFetcherImpl::ParseResponse(
base::StringPiece response) {
base::Value output(base::Value::Type::LIST);
@@ -519,7 +519,7 @@
LOG(ERROR) << "Error parsing response JSON: " << parsed_json.error_message;
RecordUmaResponseParseResult(
RECOMMEND_APPS_RESPONSE_PARSE_RESULT_INVALID_JSON);
- return base::nullopt;
+ return absl::nullopt;
}
// If the response is a dictionary, it is an error message in the
@@ -535,7 +535,7 @@
<< response.substr(0, 128);
RecordUmaResponseParseResult(
RECOMMEND_APPS_RESPONSE_PARSE_RESULT_INVALID_JSON);
- return base::nullopt;
+ return absl::nullopt;
}
base::StringPiece response_error_code_str =
@@ -545,7 +545,7 @@
LOG(WARNING) << "Unable to parse error code: " << response_error_code_str;
RecordUmaResponseParseResult(
RECOMMEND_APPS_RESPONSE_PARSE_RESULT_INVALID_ERROR_CODE);
- return base::nullopt;
+ return absl::nullopt;
}
if (response_error_code == kResponseErrorNotFirstTimeChromebookUser) {
@@ -559,7 +559,7 @@
RECOMMEND_APPS_RESPONSE_PARSE_RESULT_UNKNOWN_ERROR_CODE);
}
- return base::nullopt;
+ return absl::nullopt;
}
// Otherwise, the response should return a list of apps.
@@ -567,7 +567,7 @@
if (app_list.empty()) {
DVLOG(1) << "No app in the response.";
RecordUmaResponseParseResult(RECOMMEND_APPS_RESPONSE_PARSE_RESULT_NO_APP);
- return base::nullopt;
+ return absl::nullopt;
}
for (auto& item : app_list) {
diff --git a/chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_impl.h b/chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_impl.h
index 1a0c5d1..6bbf5cbe 100644
--- a/chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_impl.h
+++ b/chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_impl.h
@@ -70,7 +70,7 @@
void Retry() override;
using ArcFeaturesGetter = base::RepeatingCallback<void(
- base::OnceCallback<void(base::Optional<arc::ArcFeatures> callback)>)>;
+ base::OnceCallback<void(absl::optional<arc::ArcFeatures> callback)>)>;
void set_arc_features_getter_for_testing(const ArcFeaturesGetter& getter) {
arc_features_getter_ = getter;
}
@@ -93,7 +93,7 @@
// Callback function called when ARC features are read by the parser.
// It will populate the device config info related to ARC features.
- void OnArcFeaturesRead(base::Optional<arc::ArcFeatures> read_result);
+ void OnArcFeaturesRead(absl::optional<arc::ArcFeatures> read_result);
// Callback function called when the proto message has been compressed and
// encoded.
@@ -110,8 +110,8 @@
// Callback function called when SimpleURLLoader completes.
void OnDownloaded(std::unique_ptr<std::string> response_body);
- // If the response is not a valid JSON, return base::nullopt.
- // If the response contains no app, return base::nullopt;
+ // If the response is not a valid JSON, return absl::nullopt.
+ // If the response contains no app, return absl::nullopt;
// Value output, in true, is a list containing:
// 1. name: the title of the app.
// 2. package_name
@@ -124,7 +124,7 @@
// {"title_" : "title of second app",
// "packageName_": "second package name.",
// }]
- base::Optional<base::Value> ParseResponse(base::StringPiece response);
+ absl::optional<base::Value> ParseResponse(base::StringPiece response);
device_configuration::DeviceConfigurationProto device_config_;
diff --git a/chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_impl_unittest.cc b/chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_impl_unittest.cc
index b67c1b5..14802cdf 100644
--- a/chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_impl_unittest.cc
+++ b/chrome/browser/ash/login/screens/recommend_apps/recommend_apps_fetcher_impl_unittest.cc
@@ -102,7 +102,7 @@
void SetUnifiedDesktopEnabled(bool enabled) override {}
void OverscanCalibration(const std::string& display_id,
mojom::DisplayConfigOperation op,
- const base::Optional<gfx::Insets>& delta,
+ const absl::optional<gfx::Insets>& delta,
OverscanCalibrationCallback callback) override {}
void TouchCalibration(const std::string& display_id,
mojom::DisplayConfigOperation op,
@@ -252,7 +252,7 @@
std::vector<mojom::DisplayUnitInfoPtr> CreateDisplayUnitInfo(
const Dpi& internal_dpi,
- base::Optional<Dpi> external_dpi) {
+ absl::optional<Dpi> external_dpi) {
std::vector<mojom::DisplayUnitInfoPtr> info_list;
if (external_dpi.has_value()) {
@@ -311,7 +311,7 @@
ui::DeviceDataManagerTestApi device_data_manager_test_api_;
display::test::TestScreen test_screen_;
- base::OnceCallback<void(base::Optional<arc::ArcFeatures>)>
+ base::OnceCallback<void(absl::optional<arc::ArcFeatures>)>
arc_features_callback_;
private:
@@ -325,7 +325,7 @@
}
void HandleArcFeaturesRequest(
- base::OnceCallback<void(base::Optional<arc::ArcFeatures>)> callback) {
+ base::OnceCallback<void(absl::optional<arc::ArcFeatures>)> callback) {
arc_features_callback_ = std::move(callback);
}
@@ -415,7 +415,7 @@
CreateDisplayUnitInfo(Dpi(110, 120), Dpi(117.23, 117.23))));
ASSERT_TRUE(arc_features_callback_);
- std::move(arc_features_callback_).Run(base::nullopt);
+ std::move(arc_features_callback_).Run(absl::nullopt);
network::ResourceRequest* request = WaitForAppListRequest();
ASSERT_TRUE(request);
@@ -606,7 +606,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117.23, 117.23), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117.23, 117.23), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -667,7 +667,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -727,7 +727,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -788,7 +788,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -852,7 +852,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
network::ResourceRequest* request = WaitForAppListRequest();
ASSERT_TRUE(request);
@@ -910,7 +910,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
recommend_apps_fetcher_->Retry();
EXPECT_TRUE(test_url_loader_factory_.pending_requests()->empty());
@@ -960,7 +960,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
network::ResourceRequest* request = WaitForAppListRequest();
ASSERT_TRUE(request);
@@ -982,7 +982,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
network::ResourceRequest* request = WaitForAppListRequest();
ASSERT_TRUE(request);
@@ -999,7 +999,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -1039,7 +1039,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -1060,7 +1060,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -1081,7 +1081,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -1127,7 +1127,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -1171,7 +1171,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -1192,7 +1192,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -1214,7 +1214,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -1236,7 +1236,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -1258,7 +1258,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -1280,7 +1280,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
@@ -1334,7 +1334,7 @@
cros_display_config_->Flush();
ASSERT_TRUE(cros_display_config_->RunGetDisplayUnitInfoListCallback(
- CreateDisplayUnitInfo(Dpi(117, 117), base::nullopt)));
+ CreateDisplayUnitInfo(Dpi(117, 117), absl::nullopt)));
ASSERT_TRUE(arc_features_callback_);
std::move(arc_features_callback_).Run(CreateArcFeaturesForTest());
diff --git a/chrome/browser/ash/login/screens/recommend_apps_screen_browsertest.cc b/chrome/browser/ash/login/screens/recommend_apps_screen_browsertest.cc
index a8f939e..2a3e5a2 100644
--- a/chrome/browser/ash/login/screens/recommend_apps_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/recommend_apps_screen_browsertest.cc
@@ -219,7 +219,7 @@
}
RecommendAppsScreen* recommend_apps_screen_;
- base::Optional<RecommendAppsScreen::Result> screen_result_;
+ absl::optional<RecommendAppsScreen::Result> screen_result_;
StubRecommendAppsFetcher* recommend_apps_fetcher_ = nullptr;
LoginManagerMixin login_manager_{&mixin_host_};
diff --git a/chrome/browser/ash/login/screens/reset_screen.cc b/chrome/browser/ash/login/screens/reset_screen.cc
index c1dc47e..b891af9 100644
--- a/chrome/browser/ash/login/screens/reset_screen.cc
+++ b/chrome/browser/ash/login/screens/reset_screen.cc
@@ -92,7 +92,7 @@
// Checks if powerwash is allowed based on update modes and passes the result
// to `callback`.
void OnUpdateModesAvailable(
- base::OnceCallback<void(bool, base::Optional<tpm_firmware_update::Mode>)>
+ base::OnceCallback<void(bool, absl::optional<tpm_firmware_update::Mode>)>
callback,
const std::set<tpm_firmware_update::Mode>& modes) {
using tpm_firmware_update::Mode;
@@ -103,7 +103,7 @@
std::move(callback).Run(true, mode);
return;
}
- std::move(callback).Run(false, base::nullopt);
+ std::move(callback).Run(false, absl::nullopt);
}
} // namespace
@@ -116,7 +116,7 @@
// static
void ResetScreen::CheckIfPowerwashAllowed(
- base::OnceCallback<void(bool, base::Optional<tpm_firmware_update::Mode>)>
+ base::OnceCallback<void(bool, absl::optional<tpm_firmware_update::Mode>)>
callback) {
if (g_browser_process->platform_part()
->browser_policy_connector_chromeos()
@@ -128,7 +128,7 @@
CrosSettings::Get()->GetBoolean(kDevicePowerwashAllowed,
&is_powerwash_allowed);
if (is_powerwash_allowed) {
- std::move(callback).Run(true, base::nullopt);
+ std::move(callback).Run(true, absl::nullopt);
return;
}
@@ -147,7 +147,7 @@
std::move(callback).Run(
AutoEnrollmentController::GetFRERequirement() !=
AutoEnrollmentController::FRERequirement::kExplicitlyRequired,
- base::nullopt);
+ absl::nullopt);
}
ResetScreen::ResetScreen(ResetView* view,
diff --git a/chrome/browser/ash/login/screens/reset_screen.h b/chrome/browser/ash/login/screens/reset_screen.h
index c09b040..1b5c57e 100644
--- a/chrome/browser/ash/login/screens/reset_screen.h
+++ b/chrome/browser/ash/login/screens/reset_screen.h
@@ -14,10 +14,10 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ash/login/help_app_launcher.h"
#include "chrome/browser/ash/login/screens/base_screen.h"
#include "chrome/browser/chromeos/tpm_firmware_update.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): move to forward declaration.
#include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h"
#include "chromeos/dbus/update_engine_client.h"
@@ -59,7 +59,7 @@
// TPM firmware update has to be installed, the mode of update will be passed
// as second parameter to `callback`.
static void CheckIfPowerwashAllowed(
- base::OnceCallback<void(bool, base::Optional<tpm_firmware_update::Mode>)>
+ base::OnceCallback<void(bool, absl::optional<tpm_firmware_update::Mode>)>
callback);
private:
diff --git a/chrome/browser/ash/login/screens/signin_fatal_error_screen.cc b/chrome/browser/ash/login/screens/signin_fatal_error_screen.cc
index 8fd75dc..4fc719c7 100644
--- a/chrome/browser/ash/login/screens/signin_fatal_error_screen.cc
+++ b/chrome/browser/ash/login/screens/signin_fatal_error_screen.cc
@@ -4,10 +4,10 @@
#include "chrome/browser/ash/login/screens/signin_fatal_error_screen.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/ash/login/ui/login_display_host.h"
#include "chrome/browser/ui/webui/chromeos/login/signin_fatal_error_screen_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace {
@@ -40,8 +40,8 @@
void SignInFatalErrorScreen::SetErrorState(Error error,
const base::Value* params) {
error_state_ = error;
- extra_error_info_ = params ? base::make_optional<base::Value>(params->Clone())
- : base::nullopt;
+ extra_error_info_ = params ? absl::make_optional<base::Value>(params->Clone())
+ : absl::nullopt;
}
void SignInFatalErrorScreen::SetCustomError(const std::string& error_text,
@@ -50,7 +50,7 @@
const std::string& help_link_text) {
error_state_ = Error::CUSTOM;
extra_error_info_ =
- base::make_optional<base::Value>(base::Value::Type::DICTIONARY);
+ absl::make_optional<base::Value>(base::Value::Type::DICTIONARY);
DCHECK(!error_text.empty());
extra_error_info_->SetStringKey("errorText", error_text);
if (!keyboard_hint.empty()) {
diff --git a/chrome/browser/ash/login/screens/signin_fatal_error_screen.h b/chrome/browser/ash/login/screens/signin_fatal_error_screen.h
index c7701c6..b7597e8 100644
--- a/chrome/browser/ash/login/screens/signin_fatal_error_screen.h
+++ b/chrome/browser/ash/login/screens/signin_fatal_error_screen.h
@@ -9,11 +9,11 @@
#include <string>
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/ash/login/help_app_launcher.h"
#include "chrome/browser/ash/login/screen_manager.h"
#include "chrome/browser/ash/login/screens/base_screen.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
class SignInFatalErrorView;
@@ -59,7 +59,7 @@
void OnUserAction(const std::string& action_id) override;
Error error_state_ = Error::UNKNOWN;
- base::Optional<base::Value> extra_error_info_;
+ absl::optional<base::Value> extra_error_info_;
chromeos::SignInFatalErrorView* view_ = nullptr;
base::RepeatingClosure exit_callback_;
diff --git a/chrome/browser/ash/login/screens/sync_consent_browsertest.cc b/chrome/browser/ash/login/screens/sync_consent_browsertest.cc
index ef2b562..9a3d66d 100644
--- a/chrome/browser/ash/login/screens/sync_consent_browsertest.cc
+++ b/chrome/browser/ash/login/screens/sync_consent_browsertest.cc
@@ -202,7 +202,7 @@
}
protected:
- base::Optional<SyncConsentScreen::Result> screen_result_;
+ absl::optional<SyncConsentScreen::Result> screen_result_;
base::HistogramTester histogram_tester_;
std::vector<int> expected_consent_ids_;
diff --git a/chrome/browser/ash/login/screens/sync_consent_screen.h b/chrome/browser/ash/login/screens/sync_consent_screen.h
index 35b1b96..ee45dc7f 100644
--- a/chrome/browser/ash/login/screens/sync_consent_screen.h
+++ b/chrome/browser/ash/login/screens/sync_consent_screen.h
@@ -10,7 +10,6 @@
#include "base/auto_reset.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/ash/login/screens/base_screen.h"
// TODO(https://crbug.com/1164001): move to forward declaration.
@@ -18,6 +17,7 @@
#include "components/sync/driver/sync_service.h"
#include "components/sync/driver/sync_service_observer.h"
#include "components/user_manager/user.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -166,8 +166,8 @@
Profile* profile_ = nullptr;
bool is_initialized_ = false;
- base::Optional<bool> test_sync_disabled_by_policy_;
- base::Optional<bool> test_sync_engine_initialized_;
+ absl::optional<bool> test_sync_disabled_by_policy_;
+ absl::optional<bool> test_sync_engine_initialized_;
// Notify tests.
SyncConsentScreenTestDelegate* test_delegate_ = nullptr;
diff --git a/chrome/browser/ash/login/screens/terms_of_service_screen_browsertest.cc b/chrome/browser/ash/login/screens/terms_of_service_screen_browsertest.cc
index e477592c..52382ae0 100644
--- a/chrome/browser/ash/login/screens/terms_of_service_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/terms_of_service_screen_browsertest.cc
@@ -174,7 +174,7 @@
return chromeos::FakeSessionManagerClient::Get();
}
- base::Optional<TermsOfServiceScreen::Result> result_;
+ absl::optional<TermsOfServiceScreen::Result> result_;
base::HistogramTester histogram_tester_;
private:
diff --git a/chrome/browser/ash/login/screens/update_required_screen_browsertest.cc b/chrome/browser/ash/login/screens/update_required_screen_browsertest.cc
index 2f84e4b..1fab3dc 100644
--- a/chrome/browser/ash/login/screens/update_required_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/update_required_screen_browsertest.cc
@@ -9,7 +9,6 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/json/json_writer.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
@@ -40,6 +39,7 @@
#include "components/user_manager/user_manager.h"
#include "content/public/test/browser_test.h"
#include "dbus/object_path.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace ash {
diff --git a/chrome/browser/ash/login/screens/update_required_screen_unittest.cc b/chrome/browser/ash/login/screens/update_required_screen_unittest.cc
index 320cc06..dd79d1a 100644
--- a/chrome/browser/ash/login/screens/update_required_screen_unittest.cc
+++ b/chrome/browser/ash/login/screens/update_required_screen_unittest.cc
@@ -9,7 +9,6 @@
#include "ash/constants/ash_switches.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/test/scoped_mock_time_message_loop_task_runner.h"
#include "chrome/browser/ash/login/screens/mock_error_screen.h"
#include "chrome/browser/ash/login/startup_utils.h"
@@ -29,6 +28,7 @@
#include "chromeos/tpm/stub_install_attributes.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace {
diff --git a/chrome/browser/ash/login/screens/update_screen.cc b/chrome/browser/ash/login/screens/update_screen.cc
index 4a92c3f..e61c0e8 100644
--- a/chrome/browser/ash/login/screens/update_screen.cc
+++ b/chrome/browser/ash/login/screens/update_screen.cc
@@ -448,7 +448,7 @@
void UpdateScreen::UpdateBatteryWarningVisibility() {
if (!view_)
return;
- const base::Optional<power_manager::PowerSupplyProperties>& proto =
+ const absl::optional<power_manager::PowerSupplyProperties>& proto =
PowerManagerClient::Get()->GetLastStatus();
if (!proto.has_value())
return;
diff --git a/chrome/browser/ash/login/screens/update_screen.h b/chrome/browser/ash/login/screens/update_screen.h
index 3028bee0..42535493 100644
--- a/chrome/browser/ash/login/screens/update_screen.h
+++ b/chrome/browser/ash/login/screens/update_screen.h
@@ -176,7 +176,7 @@
bool is_critical_checked_ = false;
// Caches the result of HasCriticalUpdate function.
- base::Optional<bool> has_critical_update_;
+ absl::optional<bool> has_critical_update_;
// True if the update progress should be hidden even if update_info suggests
// the opposite.
diff --git a/chrome/browser/ash/login/screens/update_screen_browsertest.cc b/chrome/browser/ash/login/screens/update_screen_browsertest.cc
index 49e176a..c2077870 100644
--- a/chrome/browser/ash/login/screens/update_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/update_screen_browsertest.cc
@@ -9,7 +9,6 @@
#include "ash/constants/ash_features.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/test/scoped_feature_list.h"
@@ -37,6 +36,7 @@
#include "chromeos/network/network_connection_handler.h"
#include "chromeos/network/network_handler.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
namespace ash {
@@ -158,7 +158,7 @@
base::HistogramTester histogram_tester_;
- base::Optional<UpdateScreen::Result> last_screen_result_;
+ absl::optional<UpdateScreen::Result> last_screen_result_;
private:
void HandleScreenExit(UpdateScreen::Result result) {
diff --git a/chrome/browser/ash/login/screens/update_screen_unittest.cc b/chrome/browser/ash/login/screens/update_screen_unittest.cc
index 43c8d495..22c4ca737 100644
--- a/chrome/browser/ash/login/screens/update_screen_unittest.cc
+++ b/chrome/browser/ash/login/screens/update_screen_unittest.cc
@@ -8,7 +8,6 @@
#include "ash/constants/ash_switches.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/test/scoped_mock_time_message_loop_task_runner.h"
#include "chrome/browser/ash/login/screens/mock_error_screen.h"
#include "chrome/browser/ash/login/screens/mock_update_screen.h"
@@ -25,6 +24,7 @@
#include "chromeos/network/portal_detector/network_portal_detector.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -115,7 +115,7 @@
FakeUpdateEngineClient* fake_update_engine_client_;
std::unique_ptr<WizardContext> wizard_context_;
- base::Optional<UpdateScreen::Result> last_screen_result_;
+ absl::optional<UpdateScreen::Result> last_screen_result_;
private:
void HandleScreenExit(UpdateScreen::Result result) {
diff --git a/chrome/browser/ash/login/screens/user_creation_screen_browsertest.cc b/chrome/browser/ash/login/screens/user_creation_screen_browsertest.cc
index 7ec68ef..7171f6c 100644
--- a/chrome/browser/ash/login/screens/user_creation_screen_browsertest.cc
+++ b/chrome/browser/ash/login/screens/user_creation_screen_browsertest.cc
@@ -79,7 +79,7 @@
run_loop.Run();
}
- base::Optional<UserCreationScreen::Result> screen_result_;
+ absl::optional<UserCreationScreen::Result> screen_result_;
protected:
chromeos::DeviceStateMixin device_state_{
diff --git a/chrome/browser/ash/login/screens/user_selection_screen.cc b/chrome/browser/ash/login/screens/user_selection_screen.cc
index 8a2fc96..2042389 100644
--- a/chrome/browser/ash/login/screens/user_selection_screen.cc
+++ b/chrome/browser/ash/login/screens/user_selection_screen.cc
@@ -18,7 +18,6 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
@@ -64,6 +63,7 @@
#include "services/device/public/mojom/wake_lock.mojom.h"
#include "services/device/public/mojom/wake_lock_provider.mojom.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/chromeos/resources/grit/ui_chromeos_resources.h"
@@ -290,7 +290,7 @@
// Callback invoked when NeedsDircryptoMigration call is finished.
void OnCryptohomeNeedsDircryptoMigrationCallback(
const AccountId& account_id,
- base::Optional<user_data_auth::NeedsDircryptoMigrationReply> reply) {
+ absl::optional<user_data_auth::NeedsDircryptoMigrationReply> reply) {
if (!reply.has_value()) {
LOG(ERROR) << "Failed to call cryptohome NeedsDircryptoMigration.";
// Hide the banner to avoid confusion in http://crbug.com/721948.
@@ -509,7 +509,7 @@
return true;
}
- const base::Optional<base::TimeDelta> offline_signin_time_limit =
+ const absl::optional<base::TimeDelta> offline_signin_time_limit =
user_manager::known_user::GetOfflineSigninLimit(user->GetAccountId());
if (!offline_signin_time_limit)
return false;
diff --git a/chrome/browser/ash/login/screens/user_selection_screen.h b/chrome/browser/ash/login/screens/user_selection_screen.h
index 4854559..7b0a32b 100644
--- a/chrome/browser/ash/login/screens/user_selection_screen.h
+++ b/chrome/browser/ash/login/screens/user_selection_screen.h
@@ -159,13 +159,13 @@
user_manager::UserList users_to_send_;
AccountId focused_pod_account_id_;
- base::Optional<system::SystemClock::ScopedHourClockType>
+ absl::optional<system::SystemClock::ScopedHourClockType>
focused_user_clock_type_;
// Sometimes we might get focused pod while user session is still active. e.g.
// while creating lock screen. So postpone any work until after the session
// state changes.
- base::Optional<AccountId> pending_focused_account_id_;
+ absl::optional<AccountId> pending_focused_account_id_;
// Input Method Engine state used at the user selection screen.
scoped_refptr<input_method::InputMethodManager::State> ime_state_;
diff --git a/chrome/browser/ash/login/security_token_pin_dialog_host_ash_impl.cc b/chrome/browser/ash/login/security_token_pin_dialog_host_ash_impl.cc
index 5ee798d..1749febf 100644
--- a/chrome/browser/ash/login/security_token_pin_dialog_host_ash_impl.cc
+++ b/chrome/browser/ash/login/security_token_pin_dialog_host_ash_impl.cc
@@ -26,7 +26,7 @@
bool enable_user_input,
security_token_pin::ErrorLabel error_label,
int attempts_left,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
SecurityTokenPinEnteredCallback pin_entered_callback,
SecurityTokenPinDialogClosedCallback pin_dialog_closed_callback) {
DCHECK(!enable_user_input || attempts_left);
diff --git a/chrome/browser/ash/login/security_token_pin_dialog_host_ash_impl.h b/chrome/browser/ash/login/security_token_pin_dialog_host_ash_impl.h
index dc14f44..a04b681 100644
--- a/chrome/browser/ash/login/security_token_pin_dialog_host_ash_impl.h
+++ b/chrome/browser/ash/login/security_token_pin_dialog_host_ash_impl.h
@@ -29,7 +29,7 @@
bool enable_user_input,
security_token_pin::ErrorLabel error_label,
int attempts_left,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
SecurityTokenPinEnteredCallback pin_entered_callback,
SecurityTokenPinDialogClosedCallback pin_dialog_closed_callback) override;
void CloseSecurityTokenPinDialog() override;
diff --git a/chrome/browser/ash/login/session/user_session_manager.cc b/chrome/browser/ash/login/session/user_session_manager.cc
index 579c731..72758aed3 100644
--- a/chrome/browser/ash/login/session/user_session_manager.cc
+++ b/chrome/browser/ash/login/session/user_session_manager.cc
@@ -1293,7 +1293,7 @@
IdentityManagerFactory::GetForProfile(profile);
std::string gaia_id = user_context.GetGaiaID();
if (gaia_id.empty()) {
- base::Optional<AccountInfo> maybe_account_info =
+ absl::optional<AccountInfo> maybe_account_info =
identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByEmailAddress(
user_context.GetAccountId().GetUserEmail());
@@ -1418,7 +1418,7 @@
DCHECK(is_child ==
(user_context.GetUserType() == user_manager::USER_TYPE_CHILD));
- base::Optional<bool> is_under_advanced_protection;
+ absl::optional<bool> is_under_advanced_protection;
if (IsOnlineSignin(user_context)) {
is_under_advanced_protection = user_context.IsUnderAdvancedProtection();
}
@@ -1881,7 +1881,7 @@
}
void UserSessionManager::OnRestoreActiveSessions(
- base::Optional<SessionManagerClient::ActiveSessionsMap> sessions) {
+ absl::optional<SessionManagerClient::ActiveSessionsMap> sessions) {
if (!sessions.has_value()) {
LOG(ERROR) << "Could not get list of active user sessions after crash.";
// If we could not get list of active user sessions it is safer to just
diff --git a/chrome/browser/ash/login/session/user_session_manager.h b/chrome/browser/ash/login/session/user_session_manager.h
index 45df8f9..c5df211 100644
--- a/chrome/browser/ash/login/session/user_session_manager.h
+++ b/chrome/browser/ash/login/session/user_session_manager.h
@@ -19,11 +19,11 @@
#include "base/memory/singleton.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/base/locale_util.h"
#include "chrome/browser/ash/child_accounts/child_policy_observer.h"
#include "chrome/browser/ash/hats/hats_notification_controller.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): move to forward declaration.
#include "chrome/browser/ash/login/easy_unlock/easy_unlock_key_manager.h"
#include "chrome/browser/ash/login/oobe_screen.h"
@@ -458,7 +458,7 @@
// Callback to process RetrieveActiveSessions() request results.
void OnRestoreActiveSessions(
- base::Optional<SessionManagerClient::ActiveSessionsMap> sessions);
+ absl::optional<SessionManagerClient::ActiveSessionsMap> sessions);
// Called by OnRestoreActiveSessions() when there're user sessions in
// `pending_user_sessions_` that has to be restored one by one.
diff --git a/chrome/browser/ash/login/signin/offline_signin_limiter.cc b/chrome/browser/ash/login/signin/offline_signin_limiter.cc
index b2f7123..324ea6d 100644
--- a/chrome/browser/ash/login/signin/offline_signin_limiter.cc
+++ b/chrome/browser/ash/login/signin/offline_signin_limiter.cc
@@ -148,14 +148,14 @@
bool using_saml =
ProfileHelper::Get()->GetUserByProfile(profile_)->using_saml();
- const base::Optional<base::TimeDelta> offline_signin_time_limit =
+ const absl::optional<base::TimeDelta> offline_signin_time_limit =
using_saml ? GetGaiaSamlTimeLimit() : GetGaiaNoSamlTimeLimit();
base::Time last_gaia_signin_time =
prefs->GetTime(using_saml ? prefs::kSAMLLastGAIASignInTime
: prefs::kGaiaLastOnlineSignInTime);
if (!offline_signin_time_limit.has_value()) {
- UpdateOnlineSigninData(last_gaia_signin_time, base::nullopt);
+ UpdateOnlineSigninData(last_gaia_signin_time, absl::nullopt);
// If no limit is in force, return.
return;
}
@@ -209,7 +209,7 @@
bool using_saml =
ProfileHelper::Get()->GetUserByProfile(profile_)->using_saml();
- const base::Optional<base::TimeDelta> offline_lock_screen_signin_time_limit =
+ const absl::optional<base::TimeDelta> offline_lock_screen_signin_time_limit =
using_saml ? GetGaiaSamlLockScreenTimeLimit()
: GetGaiaNoSamlLockScreenTimeLimit();
base::Time last_gaia_signin_time =
@@ -261,7 +261,7 @@
base::Unretained(this)));
}
-base::Optional<base::TimeDelta> OfflineSigninLimiter::GetGaiaNoSamlTimeLimit() {
+absl::optional<base::TimeDelta> OfflineSigninLimiter::GetGaiaNoSamlTimeLimit() {
// TODO(crbug.com/1177416): Clean up this override once testing is complete.
auto override_val = GetTimeLimitOverrideForTesting();
if (override_val.has_value())
@@ -270,13 +270,13 @@
int no_saml_offline_limit =
profile_->GetPrefs()->GetInteger(prefs::kGaiaOfflineSigninTimeLimitDays);
if (no_saml_offline_limit <= constants::kOfflineSigninTimeLimitNotSet)
- return base::nullopt;
+ return absl::nullopt;
- return base::make_optional<base::TimeDelta>(
+ return absl::make_optional<base::TimeDelta>(
base::TimeDelta::FromDays(no_saml_offline_limit));
}
-base::Optional<base::TimeDelta> OfflineSigninLimiter::GetGaiaSamlTimeLimit() {
+absl::optional<base::TimeDelta> OfflineSigninLimiter::GetGaiaSamlTimeLimit() {
// TODO(crbug.com/1177416): Clean up this override once testing is complete.
auto override_val = GetTimeLimitOverrideForTesting();
if (override_val.has_value())
@@ -285,13 +285,13 @@
const int saml_offline_limit =
profile_->GetPrefs()->GetInteger(prefs::kSAMLOfflineSigninTimeLimit);
if (saml_offline_limit <= constants::kOfflineSigninTimeLimitNotSet)
- return base::nullopt;
+ return absl::nullopt;
- return base::make_optional<base::TimeDelta>(
+ return absl::make_optional<base::TimeDelta>(
base::TimeDelta::FromSeconds(saml_offline_limit));
}
-base::Optional<base::TimeDelta>
+absl::optional<base::TimeDelta>
OfflineSigninLimiter::GetGaiaNoSamlLockScreenTimeLimit() {
// TODO(crbug.com/1177416): Clean up this override once testing is complete.
auto override_val = GetTimeLimitOverrideForTesting();
@@ -309,14 +309,14 @@
if (no_saml_lock_screen_offline_limit <=
constants::kOfflineSigninTimeLimitNotSet) {
- return base::nullopt;
+ return absl::nullopt;
}
- return base::make_optional<base::TimeDelta>(
+ return absl::make_optional<base::TimeDelta>(
base::TimeDelta::FromDays(no_saml_lock_screen_offline_limit));
}
-base::Optional<base::TimeDelta>
+absl::optional<base::TimeDelta>
OfflineSigninLimiter::GetGaiaSamlLockScreenTimeLimit() {
// TODO(crbug.com/1177416): Clean up this override once testing is complete.
auto override_val = GetTimeLimitOverrideForTesting();
@@ -334,14 +334,14 @@
if (saml_lock_screen_offline_limit <=
constants::kOfflineSigninTimeLimitNotSet) {
- return base::nullopt;
+ return absl::nullopt;
}
- return base::make_optional<base::TimeDelta>(
+ return absl::make_optional<base::TimeDelta>(
base::TimeDelta::FromDays(saml_lock_screen_offline_limit));
}
-base::Optional<base::TimeDelta>
+absl::optional<base::TimeDelta>
OfflineSigninLimiter::GetTimeLimitOverrideForTesting() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kOfflineSignInTimeLimitInSecondsOverrideForTesting)) {
@@ -350,14 +350,14 @@
switches::kOfflineSignInTimeLimitInSecondsOverrideForTesting);
int numeric_val = 0;
if (base::StringToInt(ascii_value, &numeric_val) && numeric_val >= 0) {
- return base::make_optional<base::TimeDelta>(
+ return absl::make_optional<base::TimeDelta>(
base::TimeDelta::FromSeconds(numeric_val));
}
LOG(WARNING)
<< "Manual offline signin time limit override requested but failed.";
}
- return base::nullopt;
+ return absl::nullopt;
}
void OfflineSigninLimiter::ForceOnlineLogin() {
@@ -403,7 +403,7 @@
void OfflineSigninLimiter::UpdateOnlineSigninData(
base::Time time,
- base::Optional<base::TimeDelta> limit) {
+ absl::optional<base::TimeDelta> limit) {
const user_manager::User* user =
ProfileHelper::Get()->GetUserByProfile(profile_);
if (!user) {
diff --git a/chrome/browser/ash/login/signin/offline_signin_limiter.h b/chrome/browser/ash/login/signin/offline_signin_limiter.h
index eadeea7..b411556 100644
--- a/chrome/browser/ash/login/signin/offline_signin_limiter.h
+++ b/chrome/browser/ash/login/signin/offline_signin_limiter.h
@@ -68,11 +68,11 @@
// Convenience method to get the time limit for SAML and no-SAML flows
// taking into consideration a possible override from the command line.
// Returns nullopt if it is an invalid time.
- base::Optional<base::TimeDelta> GetGaiaSamlTimeLimit();
- base::Optional<base::TimeDelta> GetGaiaNoSamlTimeLimit();
- base::Optional<base::TimeDelta> GetGaiaNoSamlLockScreenTimeLimit();
- base::Optional<base::TimeDelta> GetGaiaSamlLockScreenTimeLimit();
- base::Optional<base::TimeDelta> GetTimeLimitOverrideForTesting();
+ absl::optional<base::TimeDelta> GetGaiaSamlTimeLimit();
+ absl::optional<base::TimeDelta> GetGaiaNoSamlTimeLimit();
+ absl::optional<base::TimeDelta> GetGaiaNoSamlLockScreenTimeLimit();
+ absl::optional<base::TimeDelta> GetGaiaSamlLockScreenTimeLimit();
+ absl::optional<base::TimeDelta> GetTimeLimitOverrideForTesting();
// Sets the flag enforcing online login. This will cause the user's next login
// to use online authentication against GAIA.
@@ -83,7 +83,7 @@
// Stores the last online login time and offline login time limit
void UpdateOnlineSigninData(base::Time time,
- base::Optional<base::TimeDelta> limit);
+ absl::optional<base::TimeDelta> limit);
Profile* profile_;
const base::Clock* clock_;
diff --git a/chrome/browser/ash/login/signin/signin_error_notifier_ash.cc b/chrome/browser/ash/login/signin/signin_error_notifier_ash.cc
index ac4f3d5..b7dfccfc 100644
--- a/chrome/browser/ash/login/signin/signin_error_notifier_ash.cc
+++ b/chrome/browser/ash/login/signin/signin_error_notifier_ash.cc
@@ -59,7 +59,7 @@
bool g_ignore_sync_errors_for_test_ = false;
void HandleDeviceAccountReauthNotificationClick(
- base::Optional<int> button_index) {
+ absl::optional<int> button_index) {
chrome::AttemptUserExit();
}
@@ -296,7 +296,7 @@
}
void SigninErrorNotifier::HandleSecondaryAccountReauthNotificationClick(
- base::Optional<int> button_index) {
+ absl::optional<int> button_index) {
if (profile_->IsChild() && !profile_->GetPrefs()->GetBoolean(
prefs::kEduCoexistenceArcMigrationCompleted)) {
if (!chromeos::AccountManagerWelcomeDialog::
diff --git a/chrome/browser/ash/login/signin/signin_error_notifier_ash.h b/chrome/browser/ash/login/signin/signin_error_notifier_ash.h
index a5d3eaf..ed0dd02 100644
--- a/chrome/browser/ash/login/signin/signin_error_notifier_ash.h
+++ b/chrome/browser/ash/login/signin/signin_error_notifier_ash.h
@@ -69,7 +69,7 @@
// Handles clicks on the Secondary Account reauth notification. See
// `message_center::HandleNotificationClickDelegate`.
void HandleSecondaryAccountReauthNotificationClick(
- base::Optional<int> button_index);
+ absl::optional<int> button_index);
std::u16string GetMessageBody(bool is_secondary_account_error) const;
diff --git a/chrome/browser/ash/login/signin/signin_error_notifier_ash_unittest.cc b/chrome/browser/ash/login/signin/signin_error_notifier_ash_unittest.cc
index 9d5f785..cc7e8c1 100644
--- a/chrome/browser/ash/login/signin/signin_error_notifier_ash_unittest.cc
+++ b/chrome/browser/ash/login/signin/signin_error_notifier_ash_unittest.cc
@@ -182,7 +182,7 @@
account_id,
GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(kPrimaryAccountErrorNotificationId);
ASSERT_TRUE(notification);
std::u16string message = notification->message();
@@ -228,7 +228,7 @@
for (size_t i = 0; i < base::size(table); ++i) {
SetAuthError(account_id, GoogleServiceAuthError(table[i].error_state));
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(kPrimaryAccountErrorNotificationId);
ASSERT_EQ(table[i].is_error, !!notification) << "Failed case #" << i;
if (table[i].is_error) {
@@ -256,7 +256,7 @@
GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
// Expect that there is a notification, accounts didn't migrate yet.
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(kSecondaryAccountErrorNotificationId);
ASSERT_TRUE(notification);
std::u16string message = notification->message();
diff --git a/chrome/browser/ash/login/signin/token_handle_util.cc b/chrome/browser/ash/login/signin/token_handle_util.cc
index 2dfd948..1243d30 100644
--- a/chrome/browser/ash/login/signin/token_handle_util.cc
+++ b/chrome/browser/ash/login/signin/token_handle_util.cc
@@ -118,7 +118,7 @@
return false;
}
- base::Optional<base::Time> last_checked = util::ValueToTime(value);
+ absl::optional<base::Time> last_checked = util::ValueToTime(value);
if (!last_checked.has_value()) {
return false;
}
diff --git a/chrome/browser/ash/login/test/enrollment_ui_mixin.h b/chrome/browser/ash/login/test/enrollment_ui_mixin.h
index bb5fe9b3..ec14fc2 100644
--- a/chrome/browser/ash/login/test/enrollment_ui_mixin.h
+++ b/chrome/browser/ash/login/test/enrollment_ui_mixin.h
@@ -8,9 +8,9 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ash/login/enrollment/enrollment_screen.h"
#include "chrome/test/base/mixin_based_in_process_browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace test {
@@ -80,8 +80,8 @@
EnrollmentScreen::Result WaitForScreenExit();
private:
- base::Optional<EnrollmentScreen::Result> screen_result_;
- base::Optional<base::RunLoop> screen_exit_waiter_;
+ absl::optional<EnrollmentScreen::Result> screen_result_;
+ absl::optional<base::RunLoop> screen_exit_waiter_;
void HandleScreenExit(EnrollmentScreen::Result result);
diff --git a/chrome/browser/ash/login/test/https_forwarder.cc b/chrome/browser/ash/login/test/https_forwarder.cc
index 0bb30c8..d96a075 100644
--- a/chrome/browser/ash/login/test/https_forwarder.cc
+++ b/chrome/browser/ash/login/test/https_forwarder.cc
@@ -32,7 +32,7 @@
ForwardingServer(const std::string& ssl_host, const GURL& forward_target);
// net::LocalTestServer:
- base::Optional<std::vector<base::FilePath>> GetPythonPath() const override;
+ absl::optional<std::vector<base::FilePath>> GetPythonPath() const override;
bool GetTestServerPath(base::FilePath* testserver_path) const override;
bool GenerateAdditionalArguments(
base::DictionaryValue* arguments) const override;
@@ -52,16 +52,16 @@
ssl_host_(ssl_host),
forward_target_(forward_target) {}
-base::Optional<std::vector<base::FilePath>> ForwardingServer::GetPythonPath()
+absl::optional<std::vector<base::FilePath>> ForwardingServer::GetPythonPath()
const {
- base::Optional<std::vector<base::FilePath>> ret =
+ absl::optional<std::vector<base::FilePath>> ret =
net::LocalTestServer::GetPythonPath();
if (!ret)
- return base::nullopt;
+ return absl::nullopt;
base::FilePath net_testserver_path;
if (!LocalTestServer::GetTestServerPath(&net_testserver_path))
- return base::nullopt;
+ return absl::nullopt;
ret->push_back(net_testserver_path.DirName());
return ret;
}
diff --git a/chrome/browser/ash/login/test/local_policy_test_server_mixin.cc b/chrome/browser/ash/login/test/local_policy_test_server_mixin.cc
index 92794f7..6e10d44 100644
--- a/chrome/browser/ash/login/test/local_policy_test_server_mixin.cc
+++ b/chrome/browser/ash/login/test/local_policy_test_server_mixin.cc
@@ -197,8 +197,8 @@
const std::string& device_serial_number,
enterprise_management::DeviceInitialEnrollmentStateResponse::
InitialEnrollmentMode initial_mode,
- const base::Optional<std::string>& management_domain,
- const base::Optional<bool> is_license_packaged_with_device) {
+ const absl::optional<std::string>& management_domain,
+ const absl::optional<bool> is_license_packaged_with_device) {
base::Value serial_entry(base::Value::Type::DICTIONARY);
serial_entry.SetKey("initial_enrollment_mode", base::Value(initial_mode));
@@ -226,7 +226,7 @@
SetUpdateDeviceAttributesPermission(false);
SetDeviceInitialEnrollmentResponse(
test::kTestRlzBrandCodeKey, test::kTestSerialNumber, initial_enrollment,
- test::kTestDomain, base::nullopt /* is_license_packaged_with_device */);
+ test::kTestDomain, absl::nullopt /* is_license_packaged_with_device */);
}
void LocalPolicyTestServerMixin::ConfigureFakeStatisticsForZeroTouch(
diff --git a/chrome/browser/ash/login/test/local_policy_test_server_mixin.h b/chrome/browser/ash/login/test/local_policy_test_server_mixin.h
index 3f4e3e7..a32d8da 100644
--- a/chrome/browser/ash/login/test/local_policy_test_server_mixin.h
+++ b/chrome/browser/ash/login/test/local_policy_test_server_mixin.h
@@ -94,8 +94,8 @@
const std::string& device_serial_number,
enterprise_management::DeviceInitialEnrollmentStateResponse::
InitialEnrollmentMode initial_mode,
- const base::Optional<std::string>& management_domain,
- const base::Optional<bool> is_license_packaged_with_device);
+ const absl::optional<std::string>& management_domain,
+ const absl::optional<bool> is_license_packaged_with_device);
// Utility function that configures server parameters for zero-touch
// enrollment. Should be used in conjunction with enabling zero-touch
diff --git a/chrome/browser/ash/login/test/logged_in_user_mixin.cc b/chrome/browser/ash/login/test/logged_in_user_mixin.cc
index deff109..dbc7c25 100644
--- a/chrome/browser/ash/login/test/logged_in_user_mixin.cc
+++ b/chrome/browser/ash/login/test/logged_in_user_mixin.cc
@@ -41,7 +41,7 @@
net::EmbeddedTestServer* embedded_test_server,
InProcessBrowserTest* test_base,
bool should_launch_browser,
- base::Optional<AccountId> account_id,
+ absl::optional<AccountId> account_id,
bool include_initial_user,
bool use_local_policy_server)
: InProcessBrowserTestMixin(mixin_host),
diff --git a/chrome/browser/ash/login/test/logged_in_user_mixin.h b/chrome/browser/ash/login/test/logged_in_user_mixin.h
index eff84bf..5042137a 100644
--- a/chrome/browser/ash/login/test/logged_in_user_mixin.h
+++ b/chrome/browser/ash/login/test/logged_in_user_mixin.h
@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_ASH_LOGIN_TEST_LOGGED_IN_USER_MIXIN_H_
#define CHROME_BROWSER_ASH_LOGIN_TEST_LOGGED_IN_USER_MIXIN_H_
-#include "base/optional.h"
#include "chrome/browser/ash/login/test/embedded_test_server_mixin.h"
#include "chrome/browser/ash/login/test/fake_gaia_mixin.h"
#include "chrome/browser/ash/login/test/local_policy_test_server_mixin.h"
@@ -13,6 +12,7 @@
#include "chrome/browser/ash/login/test/user_policy_mixin.h"
#include "chrome/browser/chromeos/policy/user_policy_test_helper.h"
#include "chrome/test/base/mixin_based_in_process_browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class AccountId;
@@ -73,7 +73,7 @@
net::EmbeddedTestServer* embedded_test_server,
InProcessBrowserTest* test_base,
bool should_launch_browser = true,
- base::Optional<AccountId> account_id = base::nullopt,
+ absl::optional<AccountId> account_id = absl::nullopt,
bool include_initial_user = true,
// TODO(crbug/1112885): Remove this parameter.
bool use_local_policy_server = true);
diff --git a/chrome/browser/ash/login/test/session_flags_manager.h b/chrome/browser/ash/login/test/session_flags_manager.h
index 032c7ef..b99d386 100644
--- a/chrome/browser/ash/login/test/session_flags_manager.h
+++ b/chrome/browser/ash/login/test/session_flags_manager.h
@@ -11,7 +11,7 @@
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class CommandLine;
@@ -99,10 +99,10 @@
// session restore mode), the logged in user information.
std::string user_id_;
std::string user_hash_;
- base::Optional<std::vector<Switch>> user_flags_;
+ absl::optional<std::vector<Switch>> user_flags_;
// List of switches passed as a restart job arguments.
- base::Optional<std::vector<Switch>> restart_job_;
+ absl::optional<std::vector<Switch>> restart_job_;
// If `session_restore_enabled_` is set, the path to the file where session
// state is saved.
diff --git a/chrome/browser/ash/login/test/session_manager_state_waiter.cc b/chrome/browser/ash/login/test/session_manager_state_waiter.cc
index 5b6a7fa..98e5e9e 100644
--- a/chrome/browser/ash/login/test/session_manager_state_waiter.cc
+++ b/chrome/browser/ash/login/test/session_manager_state_waiter.cc
@@ -18,7 +18,7 @@
} // namespace test
SessionStateWaiter::SessionStateWaiter(
- base::Optional<session_manager::SessionState> target_state)
+ absl::optional<session_manager::SessionState> target_state)
: target_state_(target_state) {}
SessionStateWaiter::~SessionStateWaiter() = default;
diff --git a/chrome/browser/ash/login/test/session_manager_state_waiter.h b/chrome/browser/ash/login/test/session_manager_state_waiter.h
index a52fadb..fb0ba6b 100644
--- a/chrome/browser/ash/login/test/session_manager_state_waiter.h
+++ b/chrome/browser/ash/login/test/session_manager_state_waiter.h
@@ -7,10 +7,10 @@
#include "base/callback.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "components/session_manager/core/session_manager.h"
#include "components/session_manager/core/session_manager_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -27,8 +27,8 @@
public:
// If `target_state` is null, SessionStateWaiter will simply wait until a
// session starts.
- explicit SessionStateWaiter(base::Optional<session_manager::SessionState>
- target_state = base::nullopt);
+ explicit SessionStateWaiter(absl::optional<session_manager::SessionState>
+ target_state = absl::nullopt);
~SessionStateWaiter() override;
void Wait();
@@ -38,7 +38,7 @@
void OnUserSessionStarted(bool is_primary_user) override;
private:
- base::Optional<session_manager::SessionState> target_state_;
+ absl::optional<session_manager::SessionState> target_state_;
base::OnceClosure session_state_callback_;
base::ScopedObservation<session_manager::SessionManager,
session_manager::SessionManagerObserver>
diff --git a/chrome/browser/ash/login/ui/fake_login_display_host.cc b/chrome/browser/ash/login/ui/fake_login_display_host.cc
index 19da11e..63f9239 100644
--- a/chrome/browser/ash/login/ui/fake_login_display_host.cc
+++ b/chrome/browser/ash/login/ui/fake_login_display_host.cc
@@ -106,7 +106,7 @@
bool FakeLoginDisplayHost::IsUserAllowlisted(
const AccountId& account_id,
- const base::Optional<user_manager::UserType>& user_type) {
+ const absl::optional<user_manager::UserType>& user_type) {
return false;
}
diff --git a/chrome/browser/ash/login/ui/fake_login_display_host.h b/chrome/browser/ash/login/ui/fake_login_display_host.h
index 8aa7e82..2a56ceb 100644
--- a/chrome/browser/ash/login/ui/fake_login_display_host.h
+++ b/chrome/browser/ash/login/ui/fake_login_display_host.h
@@ -9,9 +9,9 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ash/login/ui/login_display_host.h"
#include "components/user_manager/user_type.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace session_manager {
class SessionManager;
@@ -53,7 +53,7 @@
void LoadSigninWallpaper() override;
bool IsUserAllowlisted(
const AccountId& account_id,
- const base::Optional<user_manager::UserType>& user_type) override;
+ const absl::optional<user_manager::UserType>& user_type) override;
void ShowGaiaDialog(const AccountId& prefilled_account) override;
void HideOobeDialog() override;
void SetShelfButtonsEnabled(bool enabled) override;
diff --git a/chrome/browser/ash/login/ui/login_display_host.h b/chrome/browser/ash/login/ui/login_display_host.h
index fe8cf23..66f19412 100644
--- a/chrome/browser/ash/login/ui/login_display_host.h
+++ b/chrome/browser/ash/login/ui/login_display_host.h
@@ -12,7 +12,7 @@
#include "base/callback_forward.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): move KioskAppId to forward declaration
// when moved to chrome/browser/ash/.
#include "chrome/browser/ash/app_mode/kiosk_app_types.h"
@@ -183,7 +183,7 @@
// Returns true if user is allowed to log in by domain policy.
virtual bool IsUserAllowlisted(
const AccountId& account_id,
- const base::Optional<user_manager::UserType>& user_type) = 0;
+ const absl::optional<user_manager::UserType>& user_type) = 0;
// ----- Password change flow methods -----
// Cancels current password changed flow.
diff --git a/chrome/browser/ash/login/ui/login_display_host_common.cc b/chrome/browser/ash/login/ui/login_display_host_common.cc
index 5f843ce..2cc1ecb3 100644
--- a/chrome/browser/ash/login/ui/login_display_host_common.cc
+++ b/chrome/browser/ash/login/ui/login_display_host_common.cc
@@ -344,7 +344,7 @@
bool LoginDisplayHostCommon::IsUserAllowlisted(
const AccountId& account_id,
- const base::Optional<user_manager::UserType>& user_type) {
+ const absl::optional<user_manager::UserType>& user_type) {
if (!GetExistingUserController())
return true;
return GetExistingUserController()->IsUserAllowlisted(account_id, user_type);
diff --git a/chrome/browser/ash/login/ui/login_display_host_common.h b/chrome/browser/ash/login/ui/login_display_host_common.h
index 7a9526e..98f34c4 100644
--- a/chrome/browser/ash/login/ui/login_display_host_common.h
+++ b/chrome/browser/ash/login/ui/login_display_host_common.h
@@ -10,7 +10,6 @@
#include <vector>
#include "ash/public/cpp/login_accelerators.h"
-#include "base/optional.h"
#include "chrome/browser/ash/login/ui/kiosk_app_menu_controller.h"
#include "chrome/browser/ash/login/ui/login_display_host.h"
#include "chrome/browser/ash/login/ui/signin_ui.h"
@@ -19,6 +18,7 @@
#include "components/user_manager/user_type.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class AccountId;
@@ -55,7 +55,7 @@
void LoadSigninWallpaper() final;
bool IsUserAllowlisted(
const AccountId& account_id,
- const base::Optional<user_manager::UserType>& user_type) final;
+ const absl::optional<user_manager::UserType>& user_type) final;
void CancelPasswordChangedFlow() final;
void MigrateUserData(const std::string& old_password) final;
void ResyncUserData() final;
diff --git a/chrome/browser/ash/login/ui/login_display_host_mojo.cc b/chrome/browser/ash/login/ui/login_display_host_mojo.cc
index 7809950..4b22ba0 100644
--- a/chrome/browser/ash/login/ui/login_display_host_mojo.cc
+++ b/chrome/browser/ash/login/ui/login_display_host_mojo.cc
@@ -681,7 +681,7 @@
return;
bool offline_limit_expired = false;
- const base::Optional<base::TimeDelta> offline_signin_interval =
+ const absl::optional<base::TimeDelta> offline_signin_interval =
user_manager::known_user::GetOfflineSigninLimit(account_id);
// Check if the limit is set only.
diff --git a/chrome/browser/ash/login/ui/login_display_host_mojo.h b/chrome/browser/ash/login/ui/login_display_host_mojo.h
index 4a47dc8d..f3168232 100644
--- a/chrome/browser/ash/login/ui/login_display_host_mojo.h
+++ b/chrome/browser/ash/login/ui/login_display_host_mojo.h
@@ -13,7 +13,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/ash/login/challenge_response_auth_keys_loader.h"
#include "chrome/browser/ash/login/screens/user_selection_screen.h"
@@ -24,6 +23,7 @@
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "chromeos/login/auth/auth_status_consumer.h"
#include "chromeos/login/auth/challenge_response_key.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/view.h"
#include "ui/views/view_observer.h"
@@ -217,7 +217,7 @@
bool added_as_oobe_observer_ = false;
// Set if Gaia dialog is shown with prefilled email.
- base::Optional<AccountId> gaia_reauth_account_id_;
+ absl::optional<AccountId> gaia_reauth_account_id_;
// Store which screen is currently displayed.
DisplayedScreen displayed_screen_ = DisplayedScreen::SIGN_IN_SCREEN;
diff --git a/chrome/browser/ash/login/ui/login_display_host_webui.h b/chrome/browser/ash/login/ui/login_display_host_webui.h
index 6045717..19524ff9 100644
--- a/chrome/browser/ash/login/ui/login_display_host_webui.h
+++ b/chrome/browser/ash/login/ui/login_display_host_webui.h
@@ -16,7 +16,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/timer/elapsed_timer.h"
#include "chrome/browser/ash/login/existing_user_controller.h"
#include "chrome/browser/ash/login/oobe_configuration.h"
@@ -28,6 +27,7 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/display/display_observer.h"
#include "ui/events/devices/input_device_event_observer.h"
#include "ui/gfx/geometry/rect.h"
@@ -270,7 +270,7 @@
bool need_to_play_startup_sound_ = false;
// Measures OOBE WebUI load time.
- base::Optional<base::ElapsedTimer> oobe_load_timer_;
+ absl::optional<base::ElapsedTimer> oobe_load_timer_;
base::ObserverList<LoginDisplayHost::Observer> observers_;
diff --git a/chrome/browser/ash/login/ui/mock_login_display_host.h b/chrome/browser/ash/login/ui/mock_login_display_host.h
index 0657517..d4f9182 100644
--- a/chrome/browser/ash/login/ui/mock_login_display_host.h
+++ b/chrome/browser/ash/login/ui/mock_login_display_host.h
@@ -9,12 +9,12 @@
#include "ash/public/cpp/login_accelerators.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ash/app_mode/kiosk_app_types.h"
#include "chrome/browser/ash/login/ui/login_display_host.h"
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
#include "components/user_manager/user_type.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -76,7 +76,7 @@
MOCK_METHOD(void, LoadSigninWallpaper, (), (override));
MOCK_METHOD(bool,
IsUserAllowlisted,
- (const AccountId&, const base::Optional<user_manager::UserType>&),
+ (const AccountId&, const absl::optional<user_manager::UserType>&),
(override));
MOCK_METHOD(void, CancelPasswordChangedFlow, (), (override));
MOCK_METHOD(void, MigrateUserData, (const std::string&), (override));
diff --git a/chrome/browser/ash/login/user_online_signin_notifier.cc b/chrome/browser/ash/login/user_online_signin_notifier.cc
index 6678251b..6b313b2b 100644
--- a/chrome/browser/ash/login/user_online_signin_notifier.cc
+++ b/chrome/browser/ash/login/user_online_signin_notifier.cc
@@ -20,7 +20,7 @@
void UserOnlineSigninNotifier::CheckForPolicyEnforcedOnlineSignin() {
base::TimeDelta min_delta = base::TimeDelta::Max();
for (auto* user : users_) {
- const base::Optional<base::TimeDelta> offline_signin_limit =
+ const absl::optional<base::TimeDelta> offline_signin_limit =
user_manager::known_user::GetOfflineSigninLimit(user->GetAccountId());
if (!offline_signin_limit) {
continue;
diff --git a/chrome/browser/ash/login/user_online_signin_notifier_unittest.cc b/chrome/browser/ash/login/user_online_signin_notifier_unittest.cc
index 60a89ad..7c49a3c 100644
--- a/chrome/browser/ash/login/user_online_signin_notifier_unittest.cc
+++ b/chrome/browser/ash/login/user_online_signin_notifier_unittest.cc
@@ -170,7 +170,7 @@
const base::Time now = base::DefaultClock::GetInstance()->Now();
user_manager::known_user::SetLastOnlineSignin(saml_login_account1_id_, now);
user_manager::known_user::SetOfflineSigninLimit(saml_login_account1_id_,
- base::nullopt);
+ absl::nullopt);
mock_user_manager()->AddPublicAccountWithSAML(saml_login_account1_id_);
user_online_signin_notifier_ = std::make_unique<UserOnlineSigninNotifier>(
@@ -286,12 +286,12 @@
// No `LastOnlineSignin` value, case where devices didn't store that value in
// the first Gaia login.
user_manager::known_user::SetOfflineSigninLimit(gaia_login_account1_id_,
- base::nullopt);
+ absl::nullopt);
// Case where the user has already stored last online signin.
user_manager::known_user::SetLastOnlineSignin(gaia_login_account2_id_, now);
user_manager::known_user::SetOfflineSigninLimit(gaia_login_account2_id_,
- base::nullopt);
+ absl::nullopt);
mock_user_manager()->AddUser(gaia_login_account1_id_);
mock_user_manager()->AddUser(gaia_login_account2_id_);
diff --git a/chrome/browser/ash/login/users/chrome_user_manager_impl.cc b/chrome/browser/ash/login/users/chrome_user_manager_impl.cc
index 56adea4..1cb706d 100644
--- a/chrome/browser/ash/login/users/chrome_user_manager_impl.cc
+++ b/chrome/browser/ash/login/users/chrome_user_manager_impl.cc
@@ -151,7 +151,7 @@
// Callback that is called after user removal is complete.
void OnRemoveUserComplete(const AccountId& account_id,
- base::Optional<user_data_auth::RemoveReply> reply) {
+ absl::optional<user_data_auth::RemoveReply> reply) {
cryptohome::MountError error = user_data_auth::ReplyToMountError(reply);
if (error != cryptohome::MOUNT_ERROR_NONE) {
LOG(ERROR) << "Removal of cryptohome for " << account_id.Serialize()
@@ -259,7 +259,7 @@
}
void CheckCryptohomeIsMounted(
- base::Optional<user_data_auth::IsMountedReply> result) {
+ absl::optional<user_data_auth::IsMountedReply> result) {
if (!result.has_value()) {
LOG(ERROR) << "IsMounted call failed.";
return;
diff --git a/chrome/browser/ash/login/users/wallpaper_policy_browsertest.cc b/chrome/browser/ash/login/users/wallpaper_policy_browsertest.cc
index 9a564b13..d558464b 100644
--- a/chrome/browser/ash/login/users/wallpaper_policy_browsertest.cc
+++ b/chrome/browser/ash/login/users/wallpaper_policy_browsertest.cc
@@ -307,7 +307,7 @@
private:
// The average ARGB color of the current wallpaper.
- base::Optional<SkColor> average_color_;
+ absl::optional<SkColor> average_color_;
base::WeakPtrFactory<WallpaperPolicyTest> weak_ptr_factory_{this};
diff --git a/chrome/browser/ash/login/version_info_updater.cc b/chrome/browser/ash/login/version_info_updater.cc
index 8bba539d..3b57063 100644
--- a/chrome/browser/ash/login/version_info_updater.cc
+++ b/chrome/browser/ash/login/version_info_updater.cc
@@ -119,13 +119,13 @@
}
}
-base::Optional<bool> VersionInfoUpdater::IsSystemInfoEnforced() const {
+absl::optional<bool> VersionInfoUpdater::IsSystemInfoEnforced() const {
bool is_system_info_enforced = false;
if (cros_settings_->GetBoolean(chromeos::kDeviceLoginScreenSystemInfoEnforced,
&is_system_info_enforced)) {
return is_system_info_enforced;
}
- return base::nullopt;
+ return absl::nullopt;
}
void VersionInfoUpdater::UpdateVersionLabel() {
diff --git a/chrome/browser/ash/login/version_info_updater.h b/chrome/browser/ash/login/version_info_updater.h
index ff24baa..d0a6e1c 100644
--- a/chrome/browser/ash/login/version_info_updater.h
+++ b/chrome/browser/ash/login/version_info_updater.h
@@ -57,7 +57,7 @@
void StartUpdate(bool is_chrome_branded);
// Determine whether the system information will be displayed forcedly.
- base::Optional<bool> IsSystemInfoEnforced() const;
+ absl::optional<bool> IsSystemInfoEnforced() const;
private:
// policy::CloudPolicyStore::Observer interface:
diff --git a/chrome/browser/ash/login/version_updater/version_updater_unittest.cc b/chrome/browser/ash/login/version_updater/version_updater_unittest.cc
index 9d765268..51bb2a9 100644
--- a/chrome/browser/ash/login/version_updater/version_updater_unittest.cc
+++ b/chrome/browser/ash/login/version_updater/version_updater_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/test/scoped_mock_time_message_loop_task_runner.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
@@ -25,6 +24,7 @@
#include "chromeos/network/portal_detector/network_portal_detector.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using testing::_;
using testing::AnyNumber;
diff --git a/chrome/browser/ash/login/wizard_controller.cc b/chrome/browser/ash/login/wizard_controller.cc
index 7e3b570a..2b60cad 100644
--- a/chrome/browser/ash/login/wizard_controller.cc
+++ b/chrome/browser/ash/login/wizard_controller.cc
@@ -1925,7 +1925,7 @@
}
void WizardController::SimulateDemoModeSetupForTesting(
- base::Optional<DemoSession::DemoModeConfig> demo_config) {
+ absl::optional<DemoSession::DemoModeConfig> demo_config) {
if (!demo_setup_controller_)
demo_setup_controller_ = std::make_unique<DemoSetupController>();
if (demo_config.has_value())
diff --git a/chrome/browser/ash/login/wizard_controller.h b/chrome/browser/ash/login/wizard_controller.h
index 1f41202..231644f 100644
--- a/chrome/browser/ash/login/wizard_controller.h
+++ b/chrome/browser/ash/login/wizard_controller.h
@@ -14,9 +14,9 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/accessibility/accessibility_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): move KioskAppType to forward declaration
// when moved to chrome/browser/ash/.
#include "chrome/browser/ash/app_mode/kiosk_app_types.h"
@@ -165,7 +165,7 @@
// is explicitly set on DemoSetupController and going through demo settings
// screens can be skipped.
void SimulateDemoModeSetupForTesting(
- base::Optional<DemoSession::DemoModeConfig> demo_config = base::nullopt);
+ absl::optional<DemoSession::DemoModeConfig> demo_config = absl::nullopt);
// Stores authorization data that will be used to configure extra auth factors
// during user onboarding.
diff --git a/chrome/browser/ash/net/secure_dns_manager_unittest.cc b/chrome/browser/ash/net/secure_dns_manager_unittest.cc
index 3491ff9..e622cfd 100644
--- a/chrome/browser/ash/net/secure_dns_manager_unittest.cc
+++ b/chrome/browser/ash/net/secure_dns_manager_unittest.cc
@@ -28,7 +28,7 @@
void OnGetProperties(bool* success_out,
std::map<std::string, std::string>* props_out,
base::OnceClosure callback,
- base::Optional<base::Value> result) {
+ absl::optional<base::Value> result) {
*success_out = result.has_value();
if (result) {
base::Value* value = result->FindKeyOfType(
diff --git a/chrome/browser/ash/notifications/adb_sideloading_policy_change_notification.cc b/chrome/browser/ash/notifications/adb_sideloading_policy_change_notification.cc
index 25700ff5..bbc6cc7c 100644
--- a/chrome/browser/ash/notifications/adb_sideloading_policy_change_notification.cc
+++ b/chrome/browser/ash/notifications/adb_sideloading_policy_change_notification.cc
@@ -106,7 +106,7 @@
}
void AdbSideloadingPolicyChangeNotification::HandleNotificationClick(
- base::Optional<int> button_index) {
+ absl::optional<int> button_index) {
// Only request restart when the button is clicked, i.e. ignore the clicks
// on the body of the notification.
if (!button_index)
diff --git a/chrome/browser/ash/notifications/adb_sideloading_policy_change_notification.h b/chrome/browser/ash/notifications/adb_sideloading_policy_change_notification.h
index b7677d4f7..06aa93f 100644
--- a/chrome/browser/ash/notifications/adb_sideloading_policy_change_notification.h
+++ b/chrome/browser/ash/notifications/adb_sideloading_policy_change_notification.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_ASH_NOTIFICATIONS_ADB_SIDELOADING_POLICY_CHANGE_NOTIFICATION_H_
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -43,7 +43,7 @@
virtual ~AdbSideloadingPolicyChangeNotification();
virtual void Show(Type type);
- void HandleNotificationClick(base::Optional<int> button_index);
+ void HandleNotificationClick(absl::optional<int> button_index);
private:
base::WeakPtrFactory<AdbSideloadingPolicyChangeNotification>
diff --git a/chrome/browser/ash/notifications/gnubby_notification_unittest.cc b/chrome/browser/ash/notifications/gnubby_notification_unittest.cc
index 1737ffc..535aac9 100644
--- a/chrome/browser/ash/notifications/gnubby_notification_unittest.cc
+++ b/chrome/browser/ash/notifications/gnubby_notification_unittest.cc
@@ -39,7 +39,7 @@
notification_count_ = 0;
}
- base::Optional<message_center::Notification> GetNotification() {
+ absl::optional<message_center::Notification> GetNotification() {
return tester_->GetNotification("gnubby_notification");
}
diff --git a/chrome/browser/ash/notifications/low_disk_notification.cc b/chrome/browser/ash/notifications/low_disk_notification.cc
index 7d658efa..a6b8a53 100644
--- a/chrome/browser/ash/notifications/low_disk_notification.cc
+++ b/chrome/browser/ash/notifications/low_disk_notification.cc
@@ -113,7 +113,7 @@
message_center::NotifierId notifier_id(
message_center::NotifierType::SYSTEM_COMPONENT, kNotifierLowDisk);
- auto on_click = base::BindRepeating([](base::Optional<int> button_index) {
+ auto on_click = base::BindRepeating([](absl::optional<int> button_index) {
if (button_index) {
DCHECK_EQ(0, *button_index);
chrome::SettingsWindowManager::GetInstance()->ShowOSSettings(
diff --git a/chrome/browser/ash/notifications/low_disk_notification_unittest.cc b/chrome/browser/ash/notifications/low_disk_notification_unittest.cc
index e951898..beb2e799 100644
--- a/chrome/browser/ash/notifications/low_disk_notification_unittest.cc
+++ b/chrome/browser/ash/notifications/low_disk_notification_unittest.cc
@@ -73,7 +73,7 @@
BrowserWithTestWindowTest::TearDown();
}
- base::Optional<message_center::Notification> GetNotification() {
+ absl::optional<message_center::Notification> GetNotification() {
return tester_->GetNotification("low_disk");
}
diff --git a/chrome/browser/ash/notifications/update_required_notification.cc b/chrome/browser/ash/notifications/update_required_notification.cc
index 6bdee30..916a3241 100644
--- a/chrome/browser/ash/notifications/update_required_notification.cc
+++ b/chrome/browser/ash/notifications/update_required_notification.cc
@@ -175,8 +175,8 @@
}
void UpdateRequiredNotification::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
// |button_index| may be empty if the notification body was clicked.
if (!button_index)
return;
diff --git a/chrome/browser/ash/notifications/update_required_notification.h b/chrome/browser/ash/notifications/update_required_notification.h
index a469f4a..6c86165 100644
--- a/chrome/browser/ash/notifications/update_required_notification.h
+++ b/chrome/browser/ash/notifications/update_required_notification.h
@@ -9,9 +9,9 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/policy/minimum_version_policy_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/message_center/public/cpp/notification.h"
#include "ui/message_center/public/cpp/notification_delegate.h"
@@ -32,8 +32,8 @@
// message_center::NotificationObserver:
void Close(bool by_user) override;
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
// Collects notification data like title, body, button text, priority on the
// basis of |type| and |warning_time|. Sets the |button_click_callback| to be
diff --git a/chrome/browser/ash/plugin_vm/fake_plugin_vm_features.h b/chrome/browser/ash/plugin_vm/fake_plugin_vm_features.h
index 950c35c..f2cd5e9d 100644
--- a/chrome/browser/ash/plugin_vm/fake_plugin_vm_features.h
+++ b/chrome/browser/ash/plugin_vm/fake_plugin_vm_features.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_ASH_PLUGIN_VM_FAKE_PLUGIN_VM_FEATURES_H_
#define CHROME_BROWSER_ASH_PLUGIN_VM_FAKE_PLUGIN_VM_FEATURES_H_
-#include "base/optional.h"
#include "chrome/browser/ash/plugin_vm/plugin_vm_features.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -38,10 +38,10 @@
// FakePluginVmFeatures is created and replaced at destruction.
PluginVmFeatures* original_features_;
- base::Optional<bool> allowed_;
+ absl::optional<bool> allowed_;
std::string disallowed_reason_;
- base::Optional<bool> configured_;
- base::Optional<bool> enabled_;
+ absl::optional<bool> configured_;
+ absl::optional<bool> enabled_;
};
} // namespace plugin_vm
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_diagnostics.cc b/chrome/browser/ash/plugin_vm/plugin_vm_diagnostics.cc
index 77719e2..803ee00a 100644
--- a/chrome/browser/ash/plugin_vm/plugin_vm_diagnostics.cc
+++ b/chrome/browser/ash/plugin_vm/plugin_vm_diagnostics.cc
@@ -190,7 +190,7 @@
void CheckDefaultVmExists(bool plugin_vm_is_allowed) {
if (!plugin_vm_is_allowed) {
- OnListVmDisks(false, base::nullopt);
+ OnListVmDisks(false, absl::nullopt);
return;
}
@@ -208,7 +208,7 @@
void OnListVmDisks(
bool plugin_vm_is_allowed,
- base::Optional<vm_tools::concierge::ListVmDisksResponse> response) {
+ absl::optional<vm_tools::concierge::ListVmDisksResponse> response) {
EntryBuilder entry(l10n_util::GetStringFUTF8(
IDS_VM_STATUS_PAGE_DEFAULT_VM_EXISTS_REQUIREMENT,
l10n_util::GetStringUTF16(IDS_PLUGIN_VM_APP_NAME)));
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_files.cc b/chrome/browser/ash/plugin_vm/plugin_vm_files.cc
index a247d0d6..47c534d 100644
--- a/chrome/browser/ash/plugin_vm/plugin_vm_files.cc
+++ b/chrome/browser/ash/plugin_vm/plugin_vm_files.cc
@@ -112,7 +112,7 @@
std::move(request),
base::BindOnce(
[](const std::string& app_id, LaunchPluginVmAppCallback callback,
- base::Optional<
+ absl::optional<
vm_tools::cicerone::LaunchContainerApplicationResponse>
response) {
if (!response || !response->success()) {
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_image_download_client.h b/chrome/browser/ash/plugin_vm/plugin_vm_image_download_client.h
index ad8c5db..283b7b6c 100644
--- a/chrome/browser/ash/plugin_vm/plugin_vm_image_download_client.h
+++ b/chrome/browser/ash/plugin_vm/plugin_vm_image_download_client.h
@@ -59,7 +59,7 @@
void GetUploadData(const std::string& guid,
download::GetUploadDataCallback callback) override;
- base::Optional<double> GetFractionComplete(int64_t bytes_downloaded);
+ absl::optional<double> GetFractionComplete(int64_t bytes_downloaded);
DISALLOW_COPY_AND_ASSIGN(PluginVmImageDownloadClient);
};
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_installer.cc b/chrome/browser/ash/plugin_vm/plugin_vm_installer.cc
index 0e237e04..ea1e124 100644
--- a/chrome/browser/ash/plugin_vm/plugin_vm_installer.cc
+++ b/chrome/browser/ash/plugin_vm/plugin_vm_installer.cc
@@ -110,7 +110,7 @@
download_service_(
DownloadServiceFactory::GetForKey(profile->GetProfileKey())) {}
-base::Optional<PluginVmInstaller::FailureReason> PluginVmInstaller::Start() {
+absl::optional<PluginVmInstaller::FailureReason> PluginVmInstaller::Start() {
LOG_FUNCTION_CALL();
if (IsProcessing()) {
LOG(ERROR) << "Download of a PluginVm image couldn't be started as"
@@ -145,7 +145,7 @@
FROM_HERE, base::BindOnce(&PluginVmInstaller::CheckLicense,
weak_ptr_factory_.GetWeakPtr()));
- return base::nullopt;
+ return absl::nullopt;
}
void PluginVmInstaller::Cancel() {
@@ -382,7 +382,7 @@
}
void PluginVmInstaller::OnListVmDisks(
- base::Optional<vm_tools::concierge::ListVmDisksResponse> response) {
+ absl::optional<vm_tools::concierge::ListVmDisksResponse> response) {
if (state_ == State::kCancelling) {
CancelFinished();
return;
@@ -550,7 +550,7 @@
return;
}
- base::Optional<std::string> drive_id = GetIdFromDriveUrl(url);
+ absl::optional<std::string> drive_id = GetIdFromDriveUrl(url);
using_drive_download_service_ = drive_id.has_value();
if (using_drive_download_service_) {
@@ -610,22 +610,22 @@
weak_ptr_factory_.GetWeakPtr()));
}
-base::Optional<base::ScopedFD> PluginVmInstaller::PrepareFD() {
+absl::optional<base::ScopedFD> PluginVmInstaller::PrepareFD() {
// In case import has been cancelled meantime.
if (state_ != State::kInstalling)
- return base::nullopt;
+ return absl::nullopt;
base::File file(downloaded_image_,
base::File::FLAG_OPEN | base::File::FLAG_READ);
if (!file.IsValid()) {
LOG(ERROR) << "Failed to open " << downloaded_image_.value();
- return base::nullopt;
+ return absl::nullopt;
}
return base::ScopedFD(file.TakePlatformFile());
}
-void PluginVmInstaller::OnFDPrepared(base::Optional<base::ScopedFD> maybeFd) {
+void PluginVmInstaller::OnFDPrepared(absl::optional<base::ScopedFD> maybeFd) {
// In case import has been cancelled meantime.
if (state_ != State::kInstalling)
return;
@@ -674,7 +674,7 @@
}
template <typename ReplyType>
-void PluginVmInstaller::OnImportDiskImage(base::Optional<ReplyType> reply) {
+void PluginVmInstaller::OnImportDiskImage(absl::optional<ReplyType> reply) {
if (!reply.has_value()) {
LOG(ERROR) << "Could not retrieve response from Create/ImportDiskImage "
<< "call to concierge";
@@ -716,7 +716,7 @@
}
void PluginVmInstaller::OnFinalDiskImageStatus(
- base::Optional<vm_tools::concierge::DiskImageStatusResponse> reply) {
+ absl::optional<vm_tools::concierge::DiskImageStatusResponse> reply) {
if (!reply.has_value()) {
LOG(ERROR) << "Could not retrieve response from DiskImageStatus call to "
<< "concierge";
@@ -728,7 +728,7 @@
DCHECK(response.command_uuid() == current_import_command_uuid_);
switch (response.status()) {
case vm_tools::concierge::DiskImageStatus::DISK_STATUS_CREATED:
- OnImported(base::nullopt);
+ OnImported(absl::nullopt);
break;
case vm_tools::concierge::DiskImageStatus::DISK_STATUS_NOT_ENOUGH_SPACE:
LOG(ERROR) << "Disk image import operation ran out of disk space "
@@ -744,7 +744,7 @@
}
void PluginVmInstaller::OnImported(
- base::Optional<FailureReason> failure_reason) {
+ absl::optional<FailureReason> failure_reason) {
LOG_FUNCTION_CALL();
GetConciergeClient()->RemoveDiskImageObserver(this);
RemoveTemporaryImageIfExists();
@@ -865,7 +865,7 @@
}
void PluginVmInstaller::OnImportDiskImageCancelled(
- base::Optional<vm_tools::concierge::CancelDiskImageResponse> reply) {
+ absl::optional<vm_tools::concierge::CancelDiskImageResponse> reply) {
DCHECK_EQ(state_, State::kCancelling);
DCHECK_EQ(installing_state_, InstallingState::kImporting);
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_installer.h b/chrome/browser/ash/plugin_vm/plugin_vm_installer.h
index 3e1f0f58d..5c1012d 100644
--- a/chrome/browser/ash/plugin_vm/plugin_vm_installer.h
+++ b/chrome/browser/ash/plugin_vm/plugin_vm_installer.h
@@ -120,7 +120,7 @@
// Start the installation. Progress updates will be sent to the observer.
// Returns a FailureReason if the installation couldn't be started.
- base::Optional<FailureReason> Start();
+ absl::optional<FailureReason> Start();
// Cancel the installation, and calls OnCancelFinished() when done. Some steps
// cannot be directly cancelled, in which case we wait for the step to
// complete and then abort the installation.
@@ -182,7 +182,7 @@
void CheckForExistingVm();
void OnConciergeAvailable(bool success);
void OnListVmDisks(
- base::Optional<vm_tools::concierge::ListVmDisksResponse> response);
+ absl::optional<vm_tools::concierge::ListVmDisksResponse> response);
void CheckDiskSpace();
void OnAvailableDiskSpace(int64_t bytes);
@@ -206,23 +206,23 @@
void DetectImageType();
void OnImageTypeDetected();
// Ran as a blocking task preparing the FD for the ImportDiskImage call.
- base::Optional<base::ScopedFD> PrepareFD();
+ absl::optional<base::ScopedFD> PrepareFD();
// Calls CreateDiskImage or ImportDiskImage, depending on whether we are
// creating a new VM from an ISO, or importing a prepared VM image.
- void OnFDPrepared(base::Optional<base::ScopedFD> maybe_fd);
+ void OnFDPrepared(absl::optional<base::ScopedFD> maybe_fd);
// Callback for the concierge CreateDiskImage/ImportDiskImage calls. The
// import has just started (unless that failed).
template <typename ReplyType>
- void OnImportDiskImage(base::Optional<ReplyType> reply);
+ void OnImportDiskImage(absl::optional<ReplyType> reply);
// Progress updates are sent to OnDiskImageProgress(). After we get a signal
// that the import is finished successfully, we make one final call to
// concierge's DiskImageStatus method to get a final resolution.
void RequestFinalStatus();
void OnFinalDiskImageStatus(
- base::Optional<vm_tools::concierge::DiskImageStatusResponse> response);
+ absl::optional<vm_tools::concierge::DiskImageStatusResponse> response);
// Finishes the processing of installation. If |failure_reason| has a value,
// then the import has failed, otherwise it was successful.
- void OnImported(base::Optional<FailureReason> failure_reason);
+ void OnImported(absl::optional<FailureReason> failure_reason);
// End of the install flow!
@@ -245,7 +245,7 @@
void CancelImport();
// Callback for the concierge CancelDiskImageOperation call.
void OnImportDiskImageCancelled(
- base::Optional<vm_tools::concierge::CancelDiskImageResponse> response);
+ absl::optional<vm_tools::concierge::CancelDiskImageResponse> response);
// Called once cancel is completed, firing the OnCancelFinished() observer
// event.
void CancelFinished();
@@ -282,7 +282,7 @@
// -1 indicates not set
int64_t free_disk_space_for_testing_ = -1;
- base::Optional<base::FilePath> downloaded_image_for_testing_;
+ absl::optional<base::FilePath> downloaded_image_for_testing_;
// Keep the system awake during installation.
mojo::Remote<device::mojom::WakeLock> wake_lock_;
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_installer_unittest.cc b/chrome/browser/ash/plugin_vm/plugin_vm_installer_unittest.cc
index 080c0ea38..db16ddd 100644
--- a/chrome/browser/ash/plugin_vm/plugin_vm_installer_unittest.cc
+++ b/chrome/browser/ash/plugin_vm/plugin_vm_installer_unittest.cc
@@ -13,7 +13,6 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "base/test/bind.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/metrics/histogram_tester.h"
@@ -41,6 +40,7 @@
#include "google_apis/drive/drive_api_error_codes.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace plugin_vm {
@@ -480,7 +480,7 @@
StartAndRunUntil(InstallingState::kDownloadingImage);
std::string guid = installer_->GetCurrentDownloadGuid();
- const base::Optional<download::DownloadParams>& params =
+ const absl::optional<download::DownloadParams>& params =
download_service_->GetDownload(guid);
ASSERT_TRUE(params.has_value());
EXPECT_EQ(guid, params->guid);
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_license_checker.cc b/chrome/browser/ash/plugin_vm/plugin_vm_license_checker.cc
index e951498..b2d3e2b 100644
--- a/chrome/browser/ash/plugin_vm/plugin_vm_license_checker.cc
+++ b/chrome/browser/ash/plugin_vm/plugin_vm_license_checker.cc
@@ -100,7 +100,7 @@
// Expected response body:
// { "status": "ACTIVE", ...}
- base::Optional<base::Value> response = base::JSONReader::Read(response_body);
+ absl::optional<base::Value> response = base::JSONReader::Read(response_body);
if (!response || !response->is_dict()) {
LOG(ERROR) << "response_body was of unexpected format.";
return false;
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.cc b/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.cc
index a8081b9..27caaddf 100644
--- a/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.cc
+++ b/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.cc
@@ -149,7 +149,7 @@
chromeos::DBusThreadManager::Get()->GetVmPluginDispatcherClient()->ListVms(
std::move(request),
base::BindOnce(
- [](base::Optional<vm_tools::plugin_dispatcher::ListVmResponse>
+ [](absl::optional<vm_tools::plugin_dispatcher::ListVmResponse>
reply) {
// If the dispatcher is already running here, Chrome probably
// crashed. Restart it so it can bind to the new wayland socket.
@@ -263,7 +263,7 @@
}
void PluginVmManagerImpl::OnSuspendVmForRelaunch(
- base::Optional<vm_tools::plugin_dispatcher::SuspendVmResponse> reply) {
+ absl::optional<vm_tools::plugin_dispatcher::SuspendVmResponse> reply) {
LOG_FUNCTION_CALL();
if (reply &&
reply->error() == vm_tools::plugin_dispatcher::VmErrorCode::VM_SUCCESS) {
@@ -469,7 +469,7 @@
void PluginVmManagerImpl::OnListVms(
base::OnceCallback<void(bool)> success_callback,
base::OnceClosure error_callback,
- base::Optional<vm_tools::plugin_dispatcher::ListVmResponse> reply) {
+ absl::optional<vm_tools::plugin_dispatcher::ListVmResponse> reply) {
LOG_FUNCTION_CALL();
if (!reply.has_value()) {
LOG(ERROR) << "Failed to list VMs.";
@@ -545,7 +545,7 @@
}
void PluginVmManagerImpl::OnStartVm(
- base::Optional<vm_tools::plugin_dispatcher::StartVmResponse> reply) {
+ absl::optional<vm_tools::plugin_dispatcher::StartVmResponse> reply) {
PluginVmLaunchResult result;
if (reply) {
switch (reply->error()) {
@@ -587,7 +587,7 @@
}
void PluginVmManagerImpl::OnShowVm(
- base::Optional<vm_tools::plugin_dispatcher::ShowVmResponse> reply) {
+ absl::optional<vm_tools::plugin_dispatcher::ShowVmResponse> reply) {
LOG_FUNCTION_CALL();
if (!reply.has_value() || reply->error()) {
LOG(ERROR) << "Failed to show VM.";
@@ -606,7 +606,7 @@
}
void PluginVmManagerImpl::OnGetVmInfoForSharing(
- base::Optional<vm_tools::concierge::GetVmInfoResponse> reply) {
+ absl::optional<vm_tools::concierge::GetVmInfoResponse> reply) {
LOG_FUNCTION_CALL();
if (!reply.has_value()) {
LOG(ERROR) << "Failed to get concierge VM info.";
@@ -728,7 +728,7 @@
}
void PluginVmManagerImpl::OnStopVmForUninstall(
- base::Optional<vm_tools::plugin_dispatcher::StopVmResponse> reply) {
+ absl::optional<vm_tools::plugin_dispatcher::StopVmResponse> reply) {
LOG_FUNCTION_CALL();
if (!reply || reply->error() != vm_tools::plugin_dispatcher::VM_SUCCESS) {
LOG(ERROR) << "Failed to stop VM.";
@@ -755,7 +755,7 @@
}
void PluginVmManagerImpl::OnDestroyDiskImage(
- base::Optional<vm_tools::concierge::DestroyDiskImageResponse> response) {
+ absl::optional<vm_tools::concierge::DestroyDiskImageResponse> response) {
LOG_FUNCTION_CALL();
if (!response) {
LOG(ERROR) << "Failed to uninstall Plugin Vm. Received empty "
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.h b/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.h
index 733e7e4..afe2dec 100644
--- a/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.h
+++ b/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.h
@@ -8,7 +8,6 @@
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "chrome/browser/ash/plugin_vm/plugin_vm_manager.h"
#include "chrome/browser/ash/plugin_vm/plugin_vm_metrics_util.h"
#include "chrome/browser/ash/plugin_vm/plugin_vm_uninstaller_notification.h"
@@ -17,6 +16,7 @@
#include "chromeos/dbus/dlcservice/dlcservice_client.h"
#include "chromeos/dbus/vm_plugin_dispatcher/vm_plugin_dispatcher.pb.h"
#include "chromeos/dbus/vm_plugin_dispatcher_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -98,7 +98,7 @@
void OnListVms(
base::OnceCallback<void(bool default_vm_exists)> success_callback,
base::OnceClosure error_callback,
- base::Optional<vm_tools::plugin_dispatcher::ListVmResponse> reply);
+ absl::optional<vm_tools::plugin_dispatcher::ListVmResponse> reply);
// The flow to launch a Plugin Vm. We'll probably want to add additional
// abstraction around starting the services in the future but this is
@@ -106,12 +106,12 @@
void OnListVmsForLaunch(bool default_vm_exists);
void StartVm();
void OnStartVm(
- base::Optional<vm_tools::plugin_dispatcher::StartVmResponse> reply);
+ absl::optional<vm_tools::plugin_dispatcher::StartVmResponse> reply);
void ShowVm();
void OnShowVm(
- base::Optional<vm_tools::plugin_dispatcher::ShowVmResponse> reply);
+ absl::optional<vm_tools::plugin_dispatcher::ShowVmResponse> reply);
void OnGetVmInfoForSharing(
- base::Optional<vm_tools::concierge::GetVmInfoResponse> reply);
+ absl::optional<vm_tools::concierge::GetVmInfoResponse> reply);
void OnDefaultSharedDirExists(const base::FilePath& dir, bool exists);
void UninstallSucceeded();
@@ -122,17 +122,17 @@
// The flow to relaunch Plugin Vm.
void OnSuspendVmForRelaunch(
- base::Optional<vm_tools::plugin_dispatcher::SuspendVmResponse> reply);
+ absl::optional<vm_tools::plugin_dispatcher::SuspendVmResponse> reply);
void OnRelaunchVmComplete(bool success);
// The flow to uninstall Plugin Vm.
void OnListVmsForUninstall(bool default_vm_exists);
void StopVmForUninstall();
void OnStopVmForUninstall(
- base::Optional<vm_tools::plugin_dispatcher::StopVmResponse> reply);
+ absl::optional<vm_tools::plugin_dispatcher::StopVmResponse> reply);
void DestroyDiskImage();
void OnDestroyDiskImage(
- base::Optional<vm_tools::concierge::DestroyDiskImageResponse> response);
+ absl::optional<vm_tools::concierge::DestroyDiskImageResponse> response);
// Called when UninstallPluginVm() is unsuccessful.
void UninstallFailed(
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_util.cc b/chrome/browser/ash/plugin_vm/plugin_vm_util.cc
index a2194594..712f549 100644
--- a/chrome/browser/ash/plugin_vm/plugin_vm_util.cc
+++ b/chrome/browser/ash/plugin_vm/plugin_vm_util.cc
@@ -124,7 +124,7 @@
base::BindOnce(std::move(log_file_deletion_if_failed)));
}
-base::Optional<std::string> GetIdFromDriveUrl(const GURL& url) {
+absl::optional<std::string> GetIdFromDriveUrl(const GURL& url) {
const std::string& spec = url.spec();
const std::string kOpenUrlBase = "https://drive.google.com/open?";
@@ -133,7 +133,7 @@
// e.g. https://drive.google.com/open?id=[ID]
std::string id;
if (!net::GetValueForKeyInQuery(url, "id", &id))
- return base::nullopt;
+ return absl::nullopt;
return id;
}
@@ -151,7 +151,7 @@
return spec.substr(id_start, id_end - id_start);
}
- return base::nullopt;
+ return absl::nullopt;
}
PluginVmPolicySubscription::PluginVmPolicySubscription(
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_util.h b/chrome/browser/ash/plugin_vm/plugin_vm_util.h
index e794a81..b561e927 100644
--- a/chrome/browser/ash/plugin_vm/plugin_vm_util.h
+++ b/chrome/browser/ash/plugin_vm/plugin_vm_util.h
@@ -10,10 +10,10 @@
#include "base/callback.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "chrome/browser/ash/settings/cros_settings.h"
#include "components/prefs/pref_change_registrar.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace aura {
class Window;
@@ -92,7 +92,7 @@
void RemoveDriveDownloadDirectoryIfExists();
// Returns nullopt if not a drive URL.
-base::Optional<std::string> GetIdFromDriveUrl(const GURL& url);
+absl::optional<std::string> GetIdFromDriveUrl(const GURL& url);
// A subscription for changes to PluginVm policy that may affect
// PluginVmFeatures::Get()->IsAllowed.
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_util_unittest.cc b/chrome/browser/ash/plugin_vm/plugin_vm_util_unittest.cc
index bfaf1cd85..49bedc5 100644
--- a/chrome/browser/ash/plugin_vm/plugin_vm_util_unittest.cc
+++ b/chrome/browser/ash/plugin_vm/plugin_vm_util_unittest.cc
@@ -134,19 +134,19 @@
}
TEST_F(PluginVmUtilTest, DriveUrlNonMatches) {
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
GetIdFromDriveUrl(GURL(
"http://192.168.0.2?id=Yxhi5BDTxsEl9onT8AunH4o_tkKviFGjY")));
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
GetIdFromDriveUrl(
GURL("https://drive.notgoogle.com/open?id=someSortOfId123")));
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
GetIdFromDriveUrl(GURL(
"https://site.com/a/site.com/file/d/definitelyNotDrive/view")));
EXPECT_EQ(
- base::nullopt,
+ absl::nullopt,
GetIdFromDriveUrl(GURL("file:///home/chronos/user/Downloads/file.zip")));
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
GetIdFromDriveUrl(GURL("http://drive.google.com/open?id=fancyId")));
}
diff --git a/chrome/browser/ash/remote_apps/remote_apps_impl.cc b/chrome/browser/ash/remote_apps/remote_apps_impl.cc
index b0f482d..312aa99d 100644
--- a/chrome/browser/ash/remote_apps/remote_apps_impl.cc
+++ b/chrome/browser/ash/remote_apps/remote_apps_impl.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/containers/contains.h"
-#include "base/optional.h"
#include "chrome/browser/ash/remote_apps/remote_apps_manager.h"
#include "chrome/browser/ash/remote_apps/remote_apps_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -18,6 +17,7 @@
#include "extensions/common/features/behavior_feature.h"
#include "extensions/common/features/feature.h"
#include "extensions/common/features/feature_provider.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -78,7 +78,7 @@
bool add_to_front,
AddFolderCallback callback) {
const std::string& folder_id = manager_->AddFolder(name, add_to_front);
- std::move(callback).Run(folder_id, base::nullopt);
+ std::move(callback).Run(folder_id, absl::nullopt);
}
void RemoteAppsImpl::AddApp(const std::string& name,
@@ -104,14 +104,14 @@
RemoteAppsError error) {
switch (error) {
case RemoteAppsError::kNotReady:
- std::move(callback).Run(base::nullopt, kErrNotReady);
+ std::move(callback).Run(absl::nullopt, kErrNotReady);
return;
case RemoteAppsError::kFolderIdDoesNotExist:
- std::move(callback).Run(base::nullopt, kErrFolderIdDoesNotExist);
+ std::move(callback).Run(absl::nullopt, kErrFolderIdDoesNotExist);
return;
case RemoteAppsError::kNone:
app_ids_.insert(id);
- std::move(callback).Run(id, base::nullopt);
+ std::move(callback).Run(id, absl::nullopt);
return;
case RemoteAppsError::kAppIdDoesNotExist:
// Only occurs when deleting an app, which is not yet implemented in the
diff --git a/chrome/browser/ash/scanning/fake_lorgnette_scanner_manager.cc b/chrome/browser/ash/scanning/fake_lorgnette_scanner_manager.cc
index eeb0f3d0..78aeedb 100644
--- a/chrome/browser/ash/scanning/fake_lorgnette_scanner_manager.cc
+++ b/chrome/browser/ash/scanning/fake_lorgnette_scanner_manager.cc
@@ -70,13 +70,13 @@
}
void FakeLorgnetteScannerManager::SetGetScannerCapabilitiesResponse(
- const base::Optional<lorgnette::ScannerCapabilities>&
+ const absl::optional<lorgnette::ScannerCapabilities>&
scanner_capabilities) {
scanner_capabilities_ = scanner_capabilities;
}
void FakeLorgnetteScannerManager::SetScanResponse(
- const base::Optional<std::vector<std::string>>& scan_data) {
+ const absl::optional<std::vector<std::string>>& scan_data) {
scan_data_ = scan_data;
}
diff --git a/chrome/browser/ash/scanning/fake_lorgnette_scanner_manager.h b/chrome/browser/ash/scanning/fake_lorgnette_scanner_manager.h
index 45e50d0..b4cee1c 100644
--- a/chrome/browser/ash/scanning/fake_lorgnette_scanner_manager.h
+++ b/chrome/browser/ash/scanning/fake_lorgnette_scanner_manager.h
@@ -8,10 +8,10 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/ash/scanning/lorgnette_scanner_manager.h"
#include "chromeos/dbus/lorgnette/lorgnette_service.pb.h"
#include "chromeos/dbus/lorgnette_manager/lorgnette_manager_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -41,17 +41,17 @@
// Sets the response returned by GetScannerCapabilities().
void SetGetScannerCapabilitiesResponse(
- const base::Optional<lorgnette::ScannerCapabilities>&
+ const absl::optional<lorgnette::ScannerCapabilities>&
scanner_capabilities);
// Sets the response returned by Scan().
void SetScanResponse(
- const base::Optional<std::vector<std::string>>& scan_data);
+ const absl::optional<std::vector<std::string>>& scan_data);
private:
std::vector<std::string> scanner_names_;
- base::Optional<lorgnette::ScannerCapabilities> scanner_capabilities_;
- base::Optional<std::vector<std::string>> scan_data_;
+ absl::optional<lorgnette::ScannerCapabilities> scanner_capabilities_;
+ absl::optional<std::vector<std::string>> scan_data_;
};
} // namespace ash
diff --git a/chrome/browser/ash/scanning/lorgnette_scanner_manager.cc b/chrome/browser/ash/scanning/lorgnette_scanner_manager.cc
index d22d2af..9af939b 100644
--- a/chrome/browser/ash/scanning/lorgnette_scanner_manager.cc
+++ b/chrome/browser/ash/scanning/lorgnette_scanner_manager.cc
@@ -95,7 +95,7 @@
std::string device_name;
chromeos::ScanProtocol protocol;
if (!GetUsableDeviceNameAndProtocol(scanner_name, device_name, protocol)) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
@@ -140,7 +140,7 @@
// Handles the result of calling LorgnetteManagerClient::ListScanners().
void OnListScannersResponse(
GetScannerNamesCallback callback,
- base::Optional<lorgnette::ListScannersResponse> response) {
+ absl::optional<lorgnette::ListScannersResponse> response) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_);
RebuildDedupedScanners(response);
std::vector<std::string> scanner_names;
@@ -163,7 +163,7 @@
const std::string& scanner_name,
const std::string& device_name,
const chromeos::ScanProtocol protocol,
- base::Optional<lorgnette::ScannerCapabilities> capabilities) {
+ absl::optional<lorgnette::ScannerCapabilities> capabilities) {
if (!capabilities) {
LOG(WARNING) << "Failed to get scanner capabilities using device name: "
<< device_name;
@@ -177,7 +177,7 @@
// Uses |response| and zeroconf_scanners_ to rebuild deduped_scanners_.
void RebuildDedupedScanners(
- base::Optional<lorgnette::ListScannersResponse> response) {
+ absl::optional<lorgnette::ListScannersResponse> response) {
ResetDedupedScanners();
if (!response || response->scanners_size() == 0)
return;
diff --git a/chrome/browser/ash/scanning/lorgnette_scanner_manager.h b/chrome/browser/ash/scanning/lorgnette_scanner_manager.h
index 9c18b50..e2381f4 100644
--- a/chrome/browser/ash/scanning/lorgnette_scanner_manager.h
+++ b/chrome/browser/ash/scanning/lorgnette_scanner_manager.h
@@ -11,10 +11,10 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "chromeos/dbus/lorgnette/lorgnette_service.pb.h"
#include "chromeos/dbus/lorgnette_manager/lorgnette_manager_client.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -27,7 +27,7 @@
using GetScannerNamesCallback =
base::OnceCallback<void(std::vector<std::string> scanner_names)>;
using GetScannerCapabilitiesCallback = base::OnceCallback<void(
- const base::Optional<lorgnette::ScannerCapabilities>& capabilities)>;
+ const absl::optional<lorgnette::ScannerCapabilities>& capabilities)>;
using ProgressCallback =
base::RepeatingCallback<void(uint32_t progress_percent,
uint32_t page_number)>;
@@ -46,7 +46,7 @@
virtual void GetScannerNames(GetScannerNamesCallback callback) = 0;
// Returns the capabilities of the scanner specified by |scanner_name|. If
- // |scanner_name| does not correspond to a known scanner, base::nullopt is
+ // |scanner_name| does not correspond to a known scanner, absl::nullopt is
// returned in the callback.
virtual void GetScannerCapabilities(
const std::string& scanner_name,
diff --git a/chrome/browser/ash/scanning/lorgnette_scanner_manager_unittest.cc b/chrome/browser/ash/scanning/lorgnette_scanner_manager_unittest.cc
index b21b2ba1..b22523a 100644
--- a/chrome/browser/ash/scanning/lorgnette_scanner_manager_unittest.cc
+++ b/chrome/browser/ash/scanning/lorgnette_scanner_manager_unittest.cc
@@ -13,7 +13,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
@@ -27,6 +26,7 @@
#include "net/base/ip_address.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -207,7 +207,7 @@
return scanner_names_;
}
- base::Optional<lorgnette::ScannerCapabilities> scanner_capabilities() const {
+ absl::optional<lorgnette::ScannerCapabilities> scanner_capabilities() const {
return scanner_capabilities_;
}
@@ -223,7 +223,7 @@
}
void GetScannerCapabilitiesCallback(
- const base::Optional<lorgnette::ScannerCapabilities>&
+ const absl::optional<lorgnette::ScannerCapabilities>&
scanner_capabilities) {
scanner_capabilities_ = scanner_capabilities;
run_loop_->Quit();
@@ -255,7 +255,7 @@
std::unique_ptr<LorgnetteScannerManager> lorgnette_scanner_manager_;
std::vector<std::string> scanner_names_;
- base::Optional<lorgnette::ScannerCapabilities> scanner_capabilities_;
+ absl::optional<lorgnette::ScannerCapabilities> scanner_capabilities_;
lorgnette::ScanFailureMode failure_mode_ =
lorgnette::SCAN_FAILURE_MODE_NO_FAILURE;
bool cancel_scan_success_ = false;
@@ -414,7 +414,7 @@
CompleteTasks();
GetScannerNames();
WaitForResult();
- GetLorgnetteManagerClient()->SetScannerCapabilitiesResponse(base::nullopt);
+ GetLorgnetteManagerClient()->SetScannerCapabilitiesResponse(absl::nullopt);
GetScannerCapabilities(scanner.display_name);
WaitForResult();
EXPECT_FALSE(scanner_capabilities());
diff --git a/chrome/browser/ash/scanning/scan_service.cc b/chrome/browser/ash/scanning/scan_service.cc
index 3aa12e9..8a7421d 100644
--- a/chrome/browser/ash/scanning/scan_service.cc
+++ b/chrome/browser/ash/scanning/scan_service.cc
@@ -16,7 +16,6 @@
#include "base/location.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -26,6 +25,7 @@
#include "base/time/time.h"
#include "chrome/browser/ash/scanning/lorgnette_scanner_manager.h"
#include "chrome/browser/ash/scanning/scanning_type_converters.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/re2/src/re2/re2.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkData.h"
@@ -233,7 +233,7 @@
// Records the histograms based on the scan job result.
void RecordScanJobResult(
bool success,
- const base::Optional<scanning::ScanJobFailureReason>& failure_reason,
+ const absl::optional<scanning::ScanJobFailureReason>& failure_reason,
int num_pages_scanned) {
base::UmaHistogramBoolean("Scanning.ScanJobSuccessful", success);
if (success) {
@@ -379,7 +379,7 @@
void ScanService::OnScannerCapabilitiesReceived(
GetScannerCapabilitiesCallback callback,
- const base::Optional<lorgnette::ScannerCapabilities>& capabilities) {
+ const absl::optional<lorgnette::ScannerCapabilities>& capabilities) {
if (!capabilities) {
LOG(ERROR) << "Failed to get scanner capabilities.";
std::move(callback).Run(mojo_ipc::ScannerCapabilities::New());
@@ -488,7 +488,7 @@
}
void ScanService::OnAllPagesSaved(lorgnette::ScanFailureMode failure_mode) {
- base::Optional<scanning::ScanJobFailureReason> failure_reason = base::nullopt;
+ absl::optional<scanning::ScanJobFailureReason> failure_reason = absl::nullopt;
if (failure_mode != lorgnette::SCAN_FAILURE_MODE_NO_FAILURE) {
failure_reason = GetScanJobFailureReason(failure_mode);
scanned_file_paths_.clear();
diff --git a/chrome/browser/ash/scanning/scan_service.h b/chrome/browser/ash/scanning/scan_service.h
index c338f69..c0d6485 100644
--- a/chrome/browser/ash/scanning/scan_service.h
+++ b/chrome/browser/ash/scanning/scan_service.h
@@ -14,7 +14,6 @@
#include "base/files/file_path.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/unguessable_token.h"
#include "chromeos/dbus/lorgnette/lorgnette_service.pb.h"
@@ -23,6 +22,7 @@
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class SequencedTaskRunner;
@@ -77,7 +77,7 @@
// LorgnetteScannerManager::GetScannerCapabilities().
void OnScannerCapabilitiesReceived(
GetScannerCapabilitiesCallback callback,
- const base::Optional<lorgnette::ScannerCapabilities>& capabilities);
+ const absl::optional<lorgnette::ScannerCapabilities>& capabilities);
// Receives progress updates after calling LorgnetteScannerManager::Scan().
// |page_number| indicates the page the |progress_percent| corresponds to.
diff --git a/chrome/browser/ash/scanning/scan_service_unittest.cc b/chrome/browser/ash/scanning/scan_service_unittest.cc
index b2ce93ea..e2046fe 100644
--- a/chrome/browser/ash/scanning/scan_service_unittest.cc
+++ b/chrome/browser/ash/scanning/scan_service_unittest.cc
@@ -15,7 +15,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
@@ -28,6 +27,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/codec/png_codec.h"
@@ -318,7 +318,7 @@
fake_lorgnette_scanner_manager_.SetGetScannerNamesResponse(
{kFirstTestScannerName});
fake_lorgnette_scanner_manager_.SetGetScannerCapabilitiesResponse(
- base::nullopt);
+ absl::nullopt);
auto scanners = GetScanners();
ASSERT_EQ(scanners.size(), 1u);
auto caps = GetScannerCapabilities(scanners[0]->id);
diff --git a/chrome/browser/ash/scanning/zeroconf_scanner_detector.cc b/chrome/browser/ash/scanning/zeroconf_scanner_detector.cc
index 102759c..161fd89 100644
--- a/chrome/browser/ash/scanning/zeroconf_scanner_detector.cc
+++ b/chrome/browser/ash/scanning/zeroconf_scanner_detector.cc
@@ -13,7 +13,6 @@
#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_piece_forward.h"
@@ -22,6 +21,7 @@
#include "chrome/browser/ash/scanning/zeroconf_scanner_detector_utils.h"
#include "chrome/browser/local_discovery/service_discovery_shared_client.h"
#include "chromeos/scanning/scanner.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -71,8 +71,8 @@
};
// Attempts to create a Scanner using the information in |service_description|
-// and |metadata|. Returns the Scanner on success, base::nullopt on failure.
-base::Optional<chromeos::Scanner> CreateScanner(
+// and |metadata|. Returns the Scanner on success, absl::nullopt on failure.
+absl::optional<chromeos::Scanner> CreateScanner(
const std::string& service_type,
const ServiceDescription& service_description,
const ParsedMetadata& metadata) {
@@ -83,7 +83,7 @@
if (service_description.service_name.empty() ||
service_description.ip_address.empty() ||
service_description.address.port() == 0) {
- return base::nullopt;
+ return absl::nullopt;
}
return CreateSaneAirscanScanner(
diff --git a/chrome/browser/ash/scanning/zeroconf_scanner_detector_utils.cc b/chrome/browser/ash/scanning/zeroconf_scanner_detector_utils.cc
index c78a8da..af53ac1 100644
--- a/chrome/browser/ash/scanning/zeroconf_scanner_detector_utils.cc
+++ b/chrome/browser/ash/scanning/zeroconf_scanner_detector_utils.cc
@@ -68,7 +68,7 @@
} // namespace
-base::Optional<chromeos::Scanner> CreateSaneAirscanScanner(
+absl::optional<chromeos::Scanner> CreateSaneAirscanScanner(
const std::string& name,
const std::string& service_type,
const std::string& rs,
@@ -81,7 +81,7 @@
const std::string device_name =
CreateDeviceName(name, scheme, rs, ip_address, port);
if (device_name.empty())
- return base::nullopt;
+ return absl::nullopt;
chromeos::Scanner scanner;
scanner.display_name = name;
diff --git a/chrome/browser/ash/scanning/zeroconf_scanner_detector_utils.h b/chrome/browser/ash/scanning/zeroconf_scanner_detector_utils.h
index 1cd5c70..c77e5d1 100644
--- a/chrome/browser/ash/scanning/zeroconf_scanner_detector_utils.h
+++ b/chrome/browser/ash/scanning/zeroconf_scanner_detector_utils.h
@@ -7,21 +7,21 @@
#include <string>
-#include "base/optional.h"
#include "chromeos/scanning/scanner.h"
#include "net/base/ip_address.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
// Creates a Scanner with a device name that can be used to interact with a
-// scanner via the sane-airscan backend. If errors occur, base::nullopts is
+// scanner via the sane-airscan backend. If errors occur, absl::nullopts is
// returned. The device name must be in the format "airscan:escl:name:url",
// where name is an arbitrary name. The IP address is used instead of the host
// name since sane-airscan may not be able to resolve host names it did not
// discover itself. See mdns_make_escl_endpoint() at
// https://github.com/alexpevzner/sane-airscan/blob/master/airscan-mdns.c for
// more details.
-base::Optional<chromeos::Scanner> CreateSaneAirscanScanner(
+absl::optional<chromeos::Scanner> CreateSaneAirscanScanner(
const std::string& name,
const std::string& service_type,
const std::string& rs,
diff --git a/chrome/browser/ash/settings/cros_settings.cc b/chrome/browser/ash/settings/cros_settings.cc
index f1ebb303..74cccb0 100644
--- a/chrome/browser/ash/settings/cros_settings.cc
+++ b/chrome/browser/ash/settings/cros_settings.cc
@@ -187,7 +187,7 @@
bool CrosSettings::IsUserAllowlisted(
const std::string& username,
bool* wildcard_match,
- const base::Optional<user_manager::UserType>& user_type) const {
+ const absl::optional<user_manager::UserType>& user_type) const {
// Skip allowlist check for tests.
if (chromeos::switches::ShouldSkipOobePostLogin()) {
return true;
diff --git a/chrome/browser/ash/settings/cros_settings.h b/chrome/browser/ash/settings/cros_settings.h
index f0c1e36..6e1b45a 100644
--- a/chrome/browser/ash/settings/cros_settings.h
+++ b/chrome/browser/ash/settings/cros_settings.h
@@ -13,11 +13,11 @@
#include "base/callback_forward.h"
#include "base/callback_list.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "chromeos/settings/cros_settings_names.h"
#include "chromeos/settings/cros_settings_provider.h"
#include "components/user_manager/user_type.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefService;
@@ -99,7 +99,7 @@
bool IsUserAllowlisted(
const std::string& username,
bool* wildcard_match,
- const base::Optional<user_manager::UserType>& user_type) const;
+ const absl::optional<user_manager::UserType>& user_type) const;
// Helper function for the allowlist op. Implemented here because we will need
// this in a few places. The functions searches for |email| in the pref |path|
diff --git a/chrome/browser/ash/settings/cros_settings_unittest.cc b/chrome/browser/ash/settings/cros_settings_unittest.cc
index 1bca17c..b5e5bca0 100644
--- a/chrome/browser/ash/settings/cros_settings_unittest.cc
+++ b/chrome/browser/ash/settings/cros_settings_unittest.cc
@@ -11,7 +11,6 @@
#include "ash/constants/ash_features.h"
#include "base/bind.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
@@ -33,6 +32,7 @@
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace em = enterprise_management;
@@ -134,7 +134,7 @@
}
bool IsUserAllowed(const std::string& username,
- const base::Optional<user_manager::UserType>& user_type) {
+ const absl::optional<user_manager::UserType>& user_type) {
return CrosSettings::Get()->IsUserAllowlisted(username, nullptr, user_type);
}
@@ -374,7 +374,7 @@
ExpectPref(kAccountsPrefUsers, base::ListValue());
ExpectPref(kAccountsPrefFamilyLinkAccountsAllowed, base::Value(false));
- EXPECT_FALSE(IsUserAllowed(kUser1, base::nullopt));
+ EXPECT_FALSE(IsUserAllowed(kUser1, absl::nullopt));
EXPECT_FALSE(IsUserAllowed(kUser1, user_manager::USER_TYPE_CHILD));
EXPECT_FALSE(IsUserAllowed(kUser1, user_manager::USER_TYPE_REGULAR));
}
@@ -401,8 +401,8 @@
ExpectPref(kAccountsPrefUsers, allowlist);
ExpectPref(kAccountsPrefFamilyLinkAccountsAllowed, base::Value(false));
- EXPECT_TRUE(IsUserAllowed(kOwner, base::nullopt));
- EXPECT_FALSE(IsUserAllowed(kUser1, base::nullopt));
+ EXPECT_TRUE(IsUserAllowed(kOwner, absl::nullopt));
+ EXPECT_FALSE(IsUserAllowed(kUser1, absl::nullopt));
EXPECT_FALSE(IsUserAllowed(kUser1, user_manager::USER_TYPE_CHILD));
EXPECT_FALSE(IsUserAllowed(kUser1, user_manager::USER_TYPE_REGULAR));
}
@@ -426,8 +426,8 @@
ExpectPref(kAccountsPrefUsers, allowlist);
ExpectPref(kAccountsPrefFamilyLinkAccountsAllowed, base::Value(true));
- EXPECT_TRUE(IsUserAllowed(kOwner, base::nullopt));
- EXPECT_FALSE(IsUserAllowed(kUser1, base::nullopt));
+ EXPECT_TRUE(IsUserAllowed(kOwner, absl::nullopt));
+ EXPECT_FALSE(IsUserAllowed(kUser1, absl::nullopt));
EXPECT_TRUE(IsUserAllowed(kUser1, user_manager::USER_TYPE_CHILD));
EXPECT_FALSE(IsUserAllowed(kUser1, user_manager::USER_TYPE_REGULAR));
}
diff --git a/chrome/browser/ash/settings/device_settings_provider.cc b/chrome/browser/ash/settings/device_settings_provider.cc
index 2e7663c..df940ac 100644
--- a/chrome/browser/ash/settings/device_settings_provider.cc
+++ b/chrome/browser/ash/settings/device_settings_provider.cc
@@ -19,7 +19,6 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/syslog_logging.h"
#include "base/threading/thread_restrictions.h"
#include "base/values.h"
@@ -40,6 +39,7 @@
#include "components/policy/policy_constants.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "components/prefs/pref_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/re2/src/re2/re2.h"
using google::protobuf::RepeatedField;
@@ -171,7 +171,7 @@
const std::string& json_string,
PrefValueMap* pref_value_map) {
std::string error;
- base::Optional<base::Value> decoded_json =
+ absl::optional<base::Value> decoded_json =
policy::DecodeJsonStringAndNormalize(json_string, policy_name, &error);
if (decoded_json.has_value()) {
pref_value_map->SetValue(setting_name, std::move(decoded_json.value()));
diff --git a/chrome/browser/ash/system/automatic_reboot_manager.cc b/chrome/browser/ash/system/automatic_reboot_manager.cc
index f8539d17..0be69b4e 100644
--- a/chrome/browser/ash/system/automatic_reboot_manager.cc
+++ b/chrome/browser/ash/system/automatic_reboot_manager.cc
@@ -127,8 +127,8 @@
SystemEventTimes() = default;
- base::Optional<base::TimeTicks> boot_time;
- base::Optional<base::TimeTicks> update_reboot_needed_time;
+ absl::optional<base::TimeTicks> boot_time;
+ absl::optional<base::TimeTicks> update_reboot_needed_time;
};
SystemEventTimes GetSystemEventTimes() {
diff --git a/chrome/browser/ash/system/automatic_reboot_manager.h b/chrome/browser/ash/system/automatic_reboot_manager.h
index 1807bac1..29bd290 100644
--- a/chrome/browser/ash/system/automatic_reboot_manager.h
+++ b/chrome/browser/ash/system/automatic_reboot_manager.h
@@ -158,11 +158,11 @@
std::unique_ptr<base::OneShotTimer> login_screen_idle_timer_;
// The time at which the device was booted, in |clock_| ticks.
- base::Optional<base::TimeTicks> boot_time_;
+ absl::optional<base::TimeTicks> boot_time_;
// The time at which an update was applied and a reboot became necessary to
// complete the update process, in |clock_| ticks.
- base::Optional<base::TimeTicks> update_reboot_needed_time_;
+ absl::optional<base::TimeTicks> update_reboot_needed_time_;
// The reason for the reboot request. Updated whenever a reboot is scheduled.
AutomaticRebootManagerObserver::Reason reboot_reason_ =
diff --git a/chrome/browser/ash/system/input_device_settings.cc b/chrome/browser/ash/system/input_device_settings.cc
index e26c025..5872bf5 100644
--- a/chrome/browser/ash/system/input_device_settings.cc
+++ b/chrome/browser/ash/system/input_device_settings.cc
@@ -17,8 +17,8 @@
// |to_set|. This differs from *to_set = other; in so far as nothing is changed
// if |other| has no value. Returns true if |to_set| was updated.
template <typename T>
-bool UpdateIfHasValue(const base::Optional<T>& other,
- base::Optional<T>* to_set) {
+bool UpdateIfHasValue(const absl::optional<T>& other,
+ absl::optional<T>* to_set) {
if (!other.has_value() || other == *to_set)
return false;
*to_set = other;
diff --git a/chrome/browser/ash/system/input_device_settings.h b/chrome/browser/ash/system/input_device_settings.h
index fe16acf..478e999 100644
--- a/chrome/browser/ash/system/input_device_settings.h
+++ b/chrome/browser/ash/system/input_device_settings.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_ASH_SYSTEM_INPUT_DEVICE_SETTINGS_H_
#include "base/callback_forward.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace system {
@@ -77,14 +77,14 @@
InputDeviceSettings* input_device_settings);
private:
- base::Optional<bool> acceleration_;
- base::Optional<bool> natural_scroll_;
- base::Optional<int> sensitivity_;
- base::Optional<bool> scroll_acceleration_;
- base::Optional<int> scroll_sensitivity_;
- base::Optional<bool> tap_dragging_;
- base::Optional<bool> tap_to_click_;
- base::Optional<bool> three_finger_click_;
+ absl::optional<bool> acceleration_;
+ absl::optional<bool> natural_scroll_;
+ absl::optional<int> sensitivity_;
+ absl::optional<bool> scroll_acceleration_;
+ absl::optional<int> scroll_sensitivity_;
+ absl::optional<bool> tap_dragging_;
+ absl::optional<bool> tap_to_click_;
+ absl::optional<bool> three_finger_click_;
};
// Auxiliary class used to update several mouse settings at a time. User
@@ -132,12 +132,12 @@
InputDeviceSettings* input_device_settings);
private:
- base::Optional<bool> acceleration_;
- base::Optional<bool> primary_button_right_;
- base::Optional<bool> reverse_scroll_;
- base::Optional<bool> scroll_acceleration_;
- base::Optional<int> scroll_sensitivity_;
- base::Optional<int> sensitivity_;
+ absl::optional<bool> acceleration_;
+ absl::optional<bool> primary_button_right_;
+ absl::optional<bool> reverse_scroll_;
+ absl::optional<bool> scroll_acceleration_;
+ absl::optional<int> scroll_sensitivity_;
+ absl::optional<int> sensitivity_;
};
// Auxiliary class used to update several pointing stick settings at a time.
@@ -173,9 +173,9 @@
InputDeviceSettings* input_device_settings);
private:
- base::Optional<bool> acceleration_;
- base::Optional<bool> primary_button_right_;
- base::Optional<int> sensitivity_;
+ absl::optional<bool> acceleration_;
+ absl::optional<bool> primary_button_right_;
+ absl::optional<int> sensitivity_;
};
// Interface for configuring input device settings.
diff --git a/chrome/browser/ash/system/procfs_util.cc b/chrome/browser/ash/system/procfs_util.cc
index 6ada7e5..766a22a 100644
--- a/chrome/browser/ash/system/procfs_util.cc
+++ b/chrome/browser/ash/system/procfs_util.cc
@@ -12,12 +12,12 @@
namespace ash {
namespace system {
-base::Optional<SingleProcStat> GetSingleProcStat(
+absl::optional<SingleProcStat> GetSingleProcStat(
const base::FilePath& stat_file) {
SingleProcStat stat;
std::string stat_contents;
if (!base::ReadFileToString(stat_file, &stat_contents))
- return base::nullopt;
+ return absl::nullopt;
// This file looks like:
// <num1> (<str>) <char> <num2> <num3> ...
@@ -30,18 +30,18 @@
// The entry at index 23 represents process resident memory in pages.
const auto first_space = stat_contents.find(' ');
if (first_space == std::string::npos)
- return base::nullopt;
+ return absl::nullopt;
if (!base::StringToInt(stat_contents.substr(0, first_space), &stat.pid))
- return base::nullopt;
+ return absl::nullopt;
const auto left_parenthesis = stat_contents.find('(');
if (left_parenthesis == std::string::npos)
- return base::nullopt;
+ return absl::nullopt;
const auto right_parenthesis = stat_contents.find(')');
if (right_parenthesis == std::string::npos)
- return base::nullopt;
+ return absl::nullopt;
if ((right_parenthesis - left_parenthesis - 1) <= 0)
- return base::nullopt;
+ return absl::nullopt;
stat.name = stat_contents.substr(left_parenthesis + 1,
right_parenthesis - left_parenthesis - 1);
@@ -49,7 +49,7 @@
const auto last_parenthesis = stat_contents.find_last_of(')');
if (last_parenthesis == std::string::npos ||
last_parenthesis + 1 > stat_contents.length())
- return base::nullopt;
+ return absl::nullopt;
// Skip the parenthesis itself.
const std::string truncated_proc_stat_contents =
@@ -62,28 +62,28 @@
// The first 2 entries of the file were removed earlier, so all the indices
// for the entries will be shifted by 2.
if (proc_stat_split.size() < 21)
- return base::nullopt;
+ return absl::nullopt;
if (!base::StringToInt(proc_stat_split[1], &stat.ppid))
- return base::nullopt;
+ return absl::nullopt;
// These two entries contain the total time this process spent in user mode
// and kernel mode. This is roughly the total CPU time that the process has
// used.
if (!base::StringToInt64(proc_stat_split[11], &stat.utime))
- return base::nullopt;
+ return absl::nullopt;
if (!base::StringToInt64(proc_stat_split[12], &stat.stime))
- return base::nullopt;
+ return absl::nullopt;
if (!base::StringToInt64(proc_stat_split[21], &stat.rss))
- return base::nullopt;
+ return absl::nullopt;
return stat;
}
-base::Optional<int64_t> GetCpuTimeJiffies(const base::FilePath& stat_file) {
+absl::optional<int64_t> GetCpuTimeJiffies(const base::FilePath& stat_file) {
std::string stat_contents;
if (!base::ReadFileToString(stat_file, &stat_contents))
- return base::nullopt;
+ return absl::nullopt;
// This file looks like:
// cpu <num1> <num2> ...
@@ -107,28 +107,28 @@
std::vector<base::StringPiece> cpu_info_parts = base::SplitStringPiece(
line, " \t", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
if (cpu_info_parts.size() != 11)
- return base::nullopt;
+ return absl::nullopt;
int64_t total_time = 0;
// Sum the first 8 numbers. Element 0 is "cpu".
for (int i = 1; i <= 8; i++) {
int64_t curr;
if (!base::StringToInt64(cpu_info_parts.at(i), &curr))
- return base::nullopt;
+ return absl::nullopt;
total_time += curr;
}
return total_time;
}
}
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<int64_t> GetUsedMemTotalKB(const base::FilePath& meminfo_file) {
+absl::optional<int64_t> GetUsedMemTotalKB(const base::FilePath& meminfo_file) {
int64_t mem_total = 0;
int64_t mem_free = 0;
std::string meminfo_contents;
if (!base::ReadFileToString(meminfo_file, &meminfo_contents))
- return base::nullopt;
+ return absl::nullopt;
std::vector<base::StringPiece> meminfo_lines = base::SplitStringPiece(
meminfo_contents, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
@@ -137,17 +137,17 @@
std::vector<base::StringPiece> line_items = base::SplitStringPiece(
line, " \t", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
if (line_items.size() != 3)
- return base::nullopt;
+ return absl::nullopt;
if (!base::StringToInt64(line_items.at(1), &mem_total))
- return base::nullopt;
+ return absl::nullopt;
}
if (base::StartsWith(line, "MemFree:", base::CompareCase::SENSITIVE)) {
std::vector<base::StringPiece> line_items = base::SplitStringPiece(
line, " \t", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
if (line_items.size() != 3)
- return base::nullopt;
+ return absl::nullopt;
if (!base::StringToInt64(line_items.at(1), &mem_free))
- return base::nullopt;
+ return absl::nullopt;
break;
}
}
diff --git a/chrome/browser/ash/system/procfs_util.h b/chrome/browser/ash/system/procfs_util.h
index 46fda76c..77aaf805 100644
--- a/chrome/browser/ash/system/procfs_util.h
+++ b/chrome/browser/ash/system/procfs_util.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_ASH_SYSTEM_PROCFS_UTIL_H_
#include "base/files/file_path.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace system {
@@ -44,18 +44,18 @@
};
// Returns a single process information by reading a /proc/[pid]stat file.
-base::Optional<SingleProcStat> GetSingleProcStat(
+absl::optional<SingleProcStat> GetSingleProcStat(
const base::FilePath& stat_file);
// Returns the total CPU time used in jiffies by reading /proc/stat file.
// The input |stat_file| is used for testing.
-base::Optional<int64_t> GetCpuTimeJiffies(
+absl::optional<int64_t> GetCpuTimeJiffies(
const base::FilePath& stat_file = base::FilePath("/proc/stat"));
// Returns the total system memory used at the moment in kBs by reading
// /proc/meminfo file.
// The input |meminfo_file| is used for testing.
-base::Optional<int64_t> GetUsedMemTotalKB(
+absl::optional<int64_t> GetUsedMemTotalKB(
const base::FilePath& meminfo_file = base::FilePath("/proc/meminfo"));
} // namespace system
diff --git a/chrome/browser/ash/system/system_clock.h b/chrome/browser/ash/system/system_clock.h
index 8fe5001..746b4fd1 100644
--- a/chrome/browser/ash/system/system_clock.h
+++ b/chrome/browser/ash/system/system_clock.h
@@ -83,7 +83,7 @@
void UpdateClockType();
- base::Optional<base::HourClockType> scoped_hour_clock_type_;
+ absl::optional<base::HourClockType> scoped_hour_clock_type_;
Profile* user_profile_ = nullptr;
base::ScopedObservation<Profile, ProfileObserver> profile_observation_{this};
diff --git a/chrome/browser/ash/system_extensions/system_extensions_install_manager.cc b/chrome/browser/ash/system_extensions/system_extensions_install_manager.cc
index 3872ce3..3d7e218 100644
--- a/chrome/browser/ash/system_extensions/system_extensions_install_manager.cc
+++ b/chrome/browser/ash/system_extensions/system_extensions_install_manager.cc
@@ -77,7 +77,7 @@
// For now just use a hardcoded System Extension manifest. Future CLs will
// change this to take a command line argument to a CRX.
- base::Optional<base::Value> value =
+ absl::optional<base::Value> value =
base::JSONReader::Read(kEchoSystemExtensionManifest);
if (base::CompareCaseInsensitiveASCII("echo",
*value->FindStringKey("type")) != 0) {
diff --git a/chrome/browser/ash/system_logs/debug_daemon_log_source.cc b/chrome/browser/ash/system_logs/debug_daemon_log_source.cc
index bcf0d11..e94c88a 100644
--- a/chrome/browser/ash/system_logs/debug_daemon_log_source.cc
+++ b/chrome/browser/ash/system_logs/debug_daemon_log_source.cc
@@ -141,7 +141,7 @@
void DebugDaemonLogSource::OnGetRoutes(
bool is_ipv6,
- base::Optional<std::vector<std::string>> routes) {
+ absl::optional<std::vector<std::string>> routes) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::string key = is_ipv6 ? kRoutesv6KeyName : kRoutesKeyName;
(*response_)[key] = routes.has_value()
@@ -151,7 +151,7 @@
}
void DebugDaemonLogSource::OnGetOneLog(std::string key,
- base::Optional<std::string> status) {
+ absl::optional<std::string> status) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
(*response_)[std::move(key)] = std::move(status).value_or(kNotAvailable);
diff --git a/chrome/browser/ash/system_logs/debug_daemon_log_source.h b/chrome/browser/ash/system_logs/debug_daemon_log_source.h
index b5907012..adf4f82 100644
--- a/chrome/browser/ash/system_logs/debug_daemon_log_source.h
+++ b/chrome/browser/ash/system_logs/debug_daemon_log_source.h
@@ -13,8 +13,8 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "components/feedback/system_logs/system_logs_source.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace system_logs {
@@ -44,8 +44,8 @@
// Callbacks for the dbus calls to debugd.
void OnGetRoutes(bool is_ipv6,
- base::Optional<std::vector<std::string>> routes);
- void OnGetOneLog(std::string key, base::Optional<std::string> status);
+ absl::optional<std::vector<std::string>> routes);
+ void OnGetOneLog(std::string key, absl::optional<std::string> status);
void OnGetLogs(bool succeeded,
const KeyValueMap& logs);
diff --git a/chrome/browser/ash/system_logs/debug_log_writer.cc b/chrome/browser/ash/system_logs/debug_log_writer.cc
index 55a78ce..027a893 100644
--- a/chrome/browser/ash/system_logs/debug_log_writer.cc
+++ b/chrome/browser/ash/system_logs/debug_log_writer.cc
@@ -30,7 +30,7 @@
namespace {
using StoreLogsCallback =
- base::OnceCallback<void(base::Optional<base::FilePath> log_path)>;
+ base::OnceCallback<void(absl::optional<base::FilePath> log_path)>;
// Callback for returning status of executed external command.
typedef base::OnceCallback<void(bool succeeded)> CommandCompletionCallback;
@@ -54,7 +54,7 @@
if (!succeeded) {
bool posted = g_sequenced_task_runner.Get()->PostTaskAndReply(
FROM_HERE, base::BindOnce(base::GetDeleteFileCallback(), file_path),
- base::BindOnce(std::move(callback), base::nullopt));
+ base::BindOnce(std::move(callback), absl::nullopt));
DCHECK(posted);
return;
}
@@ -118,7 +118,7 @@
if (!compression_command_success) {
LOG(ERROR) << "Failed compressing " << compressed_output_path.value();
content::GetUIThreadTaskRunner({})->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
base::DeleteFile(tar_file_path);
base::DeleteFile(compressed_output_path);
return;
@@ -136,7 +136,7 @@
if (!add_user_logs_command_success) {
LOG(ERROR) << "Failed adding user logs to " << tar_file_path.value();
content::GetUIThreadTaskRunner({})->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
base::DeleteFile(tar_file_path);
return;
}
@@ -167,10 +167,10 @@
// Appends user logs after system logs are archived into |tar_file_path|.
void OnSystemLogsAdded(StoreLogsCallback callback,
- base::Optional<base::FilePath> tar_file_path) {
+ absl::optional<base::FilePath> tar_file_path) {
if (!tar_file_path) {
if (!callback.is_null())
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
@@ -222,7 +222,7 @@
void StoreLogs(
const base::FilePath& out_dir,
bool include_chrome_logs,
- base::OnceCallback<void(base::Optional<base::FilePath> logs_path)>
+ base::OnceCallback<void(absl::optional<base::FilePath> logs_path)>
callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(!callback.is_null());
diff --git a/chrome/browser/ash/system_logs/debug_log_writer.h b/chrome/browser/ash/system_logs/debug_log_writer.h
index cc59355..7a84d23 100644
--- a/chrome/browser/ash/system_logs/debug_log_writer.h
+++ b/chrome/browser/ash/system_logs/debug_log_writer.h
@@ -8,7 +8,7 @@
#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
namespace debug_log_writer {
@@ -20,7 +20,7 @@
void StoreLogs(
const base::FilePath& out_dir,
bool include_chrome_logs,
- base::OnceCallback<void(base::Optional<base::FilePath> logs_path)>
+ base::OnceCallback<void(absl::optional<base::FilePath> logs_path)>
callback);
} // namespace debug_log_writer
diff --git a/chrome/browser/ash/system_logs/shill_log_source.cc b/chrome/browser/ash/system_logs/shill_log_source.cc
index e08e73d..aca3137f 100644
--- a/chrome/browser/ash/system_logs/shill_log_source.cc
+++ b/chrome/browser/ash/system_logs/shill_log_source.cc
@@ -104,7 +104,7 @@
}
void ShillLogSource::OnGetManagerProperties(
- base::Optional<base::Value> result) {
+ absl::optional<base::Value> result) {
if (!result) {
LOG(ERROR) << "ManagerPropertiesCallback Failed";
std::move(callback_).Run(std::make_unique<SystemLogsResponse>());
@@ -143,7 +143,7 @@
}
void ShillLogSource::OnGetDevice(const std::string& device_path,
- base::Optional<base::Value> properties) {
+ absl::optional<base::Value> properties) {
if (!properties) {
LOG(ERROR) << "Get Device Properties Failed for : " << device_path;
} else {
@@ -183,7 +183,7 @@
void ShillLogSource::OnGetIPConfig(const std::string& device_path,
const std::string& ip_config_path,
- base::Optional<base::Value> properties) {
+ absl::optional<base::Value> properties) {
if (!properties) {
LOG(ERROR) << "Get IPConfig Properties Failed for : " << device_path << ": "
<< ip_config_path;
@@ -207,7 +207,7 @@
}
void ShillLogSource::OnGetService(const std::string& service_path,
- base::Optional<base::Value> properties) {
+ absl::optional<base::Value> properties) {
if (!properties) {
LOG(ERROR) << "Get Service Properties Failed for : " << service_path;
} else {
diff --git a/chrome/browser/ash/system_logs/shill_log_source.h b/chrome/browser/ash/system_logs/shill_log_source.h
index f9d2349..2050c7e 100644
--- a/chrome/browser/ash/system_logs/shill_log_source.h
+++ b/chrome/browser/ash/system_logs/shill_log_source.h
@@ -10,9 +10,9 @@
#include <string>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/values.h"
#include "components/feedback/system_logs/system_logs_source.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace system_logs {
@@ -28,19 +28,19 @@
void Fetch(SysLogsSourceCallback callback) override;
private:
- void OnGetManagerProperties(base::Optional<base::Value> result);
+ void OnGetManagerProperties(absl::optional<base::Value> result);
void OnGetDevice(const std::string& device_path,
- base::Optional<base::Value> properties);
+ absl::optional<base::Value> properties);
void AddDeviceAndRequestIPConfigs(const std::string& device_path,
const base::Value& properties);
void OnGetIPConfig(const std::string& device_path,
const std::string& ip_config_path,
- base::Optional<base::Value> properties);
+ absl::optional<base::Value> properties);
void AddIPConfig(const std::string& device_path,
const std::string& ip_config_path,
const base::Value& properties);
void OnGetService(const std::string& service_path,
- base::Optional<base::Value> properties);
+ absl::optional<base::Value> properties);
// Scrubs |properties| for PII data based on the |object_path|. Also expands
// UIData from JSON into a dictionary if present.
base::Value ScrubAndExpandProperties(const std::string& object_path,
diff --git a/chrome/browser/ash/system_logs/single_debug_daemon_log_source.cc b/chrome/browser/ash/system_logs/single_debug_daemon_log_source.cc
index 5825514..262a227 100644
--- a/chrome/browser/ash/system_logs/single_debug_daemon_log_source.cc
+++ b/chrome/browser/ash/system_logs/single_debug_daemon_log_source.cc
@@ -59,7 +59,7 @@
void SingleDebugDaemonLogSource::OnFetchComplete(
const std::string& log_name,
SysLogsSourceCallback callback,
- base::Optional<std::string> result) const {
+ absl::optional<std::string> result) const {
// |result| and |response| are the same type, but |result| is passed in from
// DebugDaemonClient, which does not use the SystemLogsResponse alias.
auto response = std::make_unique<SystemLogsResponse>();
diff --git a/chrome/browser/ash/system_logs/single_debug_daemon_log_source.h b/chrome/browser/ash/system_logs/single_debug_daemon_log_source.h
index b002f757..87b1ae6 100644
--- a/chrome/browser/ash/system_logs/single_debug_daemon_log_source.h
+++ b/chrome/browser/ash/system_logs/single_debug_daemon_log_source.h
@@ -11,8 +11,8 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "components/feedback/system_logs/system_logs_source.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace system_logs {
@@ -46,7 +46,7 @@
// Callback for handling response from DebugDaemonClient.
void OnFetchComplete(const std::string& log_name,
SysLogsSourceCallback callback,
- base::Optional<std::string> result) const;
+ absl::optional<std::string> result) const;
base::WeakPtrFactory<SingleDebugDaemonLogSource> weak_ptr_factory_{this};
diff --git a/chrome/browser/ash/system_logs/system_logs_writer.cc b/chrome/browser/ash/system_logs/system_logs_writer.cc
index 808049e..d5aeb71 100644
--- a/chrome/browser/ash/system_logs/system_logs_writer.cc
+++ b/chrome/browser/ash/system_logs/system_logs_writer.cc
@@ -21,26 +21,26 @@
// Writes |contents| to a temp directory then compresses it to |dest_file_path|.
// Returns the name of the compressed file (with the zip extension) on success,
// or nullopt on failure.
-base::Optional<base::FilePath> WriteCompressedFile(
+absl::optional<base::FilePath> WriteCompressedFile(
const std::string& contents,
base::FilePath dest_file_path) {
base::ScopedTempDir temp_dir;
if (!temp_dir.CreateUniqueTempDir()) {
LOG(ERROR) << "Unable to create temp dir.";
- return base::nullopt;
+ return absl::nullopt;
}
base::FilePath temp_file_path(
temp_dir.GetPath().Append(dest_file_path.BaseName()));
if (!base::WriteFile(temp_file_path, contents.c_str(), contents.size())) {
LOG(ERROR) << "Unable to write file: " << temp_file_path.value();
- return base::nullopt;
+ return absl::nullopt;
}
base::FilePath zip_file_path(
dest_file_path.AddExtension(FILE_PATH_LITERAL(".zip")));
if (!zip::Zip(temp_dir.GetPath(), zip_file_path,
/*include_hidden_files=*/false)) {
LOG(ERROR) << "Failed to zip file to: " << zip_file_path.value();
- return base::nullopt;
+ return absl::nullopt;
}
return zip_file_path;
}
@@ -50,7 +50,7 @@
// string to a compressed system_logs.txt.zip file and invokes |callback|.
void FetchCompleted(
const base::FilePath& dest_dir,
- base::OnceCallback<void(base::Optional<base::FilePath>)> callback,
+ base::OnceCallback<void(absl::optional<base::FilePath>)> callback,
std::unique_ptr<system_logs::SystemLogsResponse> sys_info) {
base::FilePath system_logs_file_path =
logging::GenerateTimestampedName(
@@ -75,7 +75,7 @@
void WriteSystemLogs(
const base::FilePath& dest_dir,
bool scrub_data,
- base::OnceCallback<void(base::Optional<base::FilePath>)> callback) {
+ base::OnceCallback<void(absl::optional<base::FilePath>)> callback) {
system_logs::BuildChromeSystemLogsFetcher(scrub_data)
->Fetch(base::BindOnce(FetchCompleted, dest_dir, std::move(callback)));
}
diff --git a/chrome/browser/ash/system_logs/system_logs_writer.h b/chrome/browser/ash/system_logs/system_logs_writer.h
index 43e135e6..e7413b78 100644
--- a/chrome/browser/ash/system_logs/system_logs_writer.h
+++ b/chrome/browser/ash/system_logs/system_logs_writer.h
@@ -8,7 +8,7 @@
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Helper function for writing system logs used in Feedback reports. Currently
// used by chrome://net-internals#chromeos for manual uploading of system logs.
@@ -23,7 +23,7 @@
void WriteSystemLogs(
const base::FilePath& dest_dir,
bool scrub_data,
- base::OnceCallback<void(base::Optional<base::FilePath>)> callback);
+ base::OnceCallback<void(absl::optional<base::FilePath>)> callback);
} // namespace system_logs_writer
} // namespace ash
diff --git a/chrome/browser/ash/usb/cros_usb_detector.cc b/chrome/browser/ash/usb/cros_usb_detector.cc
index 8291ad8b..bede3a4 100644
--- a/chrome/browser/ash/usb/cros_usb_detector.cc
+++ b/chrome/browser/ash/usb/cros_usb_detector.cc
@@ -151,8 +151,8 @@
settings_sub_page_(std::move(settings_sub_page)),
disposition_(CrosUsbNotificationClosed::kUnknown) {}
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
disposition_ = CrosUsbNotificationClosed::kUnknown;
if (button_index && *button_index < static_cast<int>(vm_names_.size())) {
HandleConnectToVm(vm_names_[*button_index]);
@@ -324,7 +324,7 @@
CrosUsbDeviceInfo::CrosUsbDeviceInfo(std::string guid,
std::u16string label,
- base::Optional<std::string> shared_vm_name,
+ absl::optional<std::string> shared_vm_name,
bool prompt_before_sharing)
: guid(guid),
label(label),
@@ -640,7 +640,7 @@
if (device.shared_vm_name == vm_name) {
VLOG(1) << "Connecting " << device.label << " to " << vm_name;
// Clear any older guest_port setting.
- device.guest_port = base::nullopt;
+ device.guest_port = absl::nullopt;
AttachUsbDeviceToVm(vm_name, device.info->guid, base::DoNothing());
}
}
@@ -711,7 +711,7 @@
// TODO(timloh): Check what happens if attaching to a different VM races
// with an in progress attach.
RelinquishDeviceClaim(guid);
- device.shared_vm_name = base::nullopt;
+ device.shared_vm_name = absl::nullopt;
SignalUsbDeviceObservers();
std::move(callback).Run(/*success=*/true);
return;
@@ -903,7 +903,7 @@
const std::string& vm_name,
const std::string& guid,
base::OnceCallback<void(bool success)> callback,
- base::Optional<vm_tools::concierge::AttachUsbDeviceResponse> response) {
+ absl::optional<vm_tools::concierge::AttachUsbDeviceResponse> response) {
bool success = true;
if (!response) {
LOG(ERROR) << "Failed to attach USB device, empty dbus response";
@@ -932,7 +932,7 @@
const std::string& vm_name,
const std::string& guid,
base::OnceCallback<void(bool success)> callback,
- base::Optional<vm_tools::concierge::DetachUsbDeviceResponse> response) {
+ absl::optional<vm_tools::concierge::DetachUsbDeviceResponse> response) {
bool success = true;
if (!response) {
LOG(ERROR) << "Failed to detach USB device, empty dbus response";
@@ -947,8 +947,8 @@
LOG(WARNING) << "Dbus response indicates successful detach but device info "
<< "was missing for " << guid;
} else {
- it->second.shared_vm_name = base::nullopt;
- it->second.guest_port = base::nullopt;
+ it->second.shared_vm_name = absl::nullopt;
+ it->second.guest_port = absl::nullopt;
}
RelinquishDeviceClaim(guid);
SignalUsbDeviceObservers();
diff --git a/chrome/browser/ash/usb/cros_usb_detector.h b/chrome/browser/ash/usb/cros_usb_detector.h
index 99119c9..007c8d0f 100644
--- a/chrome/browser/ash/usb/cros_usb_detector.h
+++ b/chrome/browser/ash/usb/cros_usb_detector.h
@@ -51,7 +51,7 @@
struct CrosUsbDeviceInfo {
CrosUsbDeviceInfo(std::string guid,
std::u16string label,
- base::Optional<std::string> shared_vm_name,
+ absl::optional<std::string> shared_vm_name,
bool prompt_before_sharing);
CrosUsbDeviceInfo(const CrosUsbDeviceInfo&);
~CrosUsbDeviceInfo();
@@ -60,7 +60,7 @@
std::u16string label;
// Name of VM shared with. Unset if not shared. The device may be shared but
// not yet attached.
- base::Optional<std::string> shared_vm_name;
+ absl::optional<std::string> shared_vm_name;
// Devices shared with other devices or otherwise in use by the system
// should have a confirmation prompt shown prior to sharing.
bool prompt_before_sharing;
@@ -142,9 +142,9 @@
bool shareable = false;
// Name of VM shared with. Unset if not shared. The device may be shared but
// not yet attached.
- base::Optional<std::string> shared_vm_name;
+ absl::optional<std::string> shared_vm_name;
// Non-empty only when device is attached to a VM.
- base::Optional<uint8_t> guest_port;
+ absl::optional<uint8_t> guest_port;
// Interfaces shareable with guest OSes
uint32_t allowed_interfaces_mask = 0;
// For a mass storage device, the mount points for active mounts.
@@ -229,13 +229,13 @@
const std::string& vm_name,
const std::string& guid,
base::OnceCallback<void(bool success)> callback,
- base::Optional<vm_tools::concierge::AttachUsbDeviceResponse> response);
+ absl::optional<vm_tools::concierge::AttachUsbDeviceResponse> response);
void OnUsbDeviceDetachFinished(
const std::string& vm_name,
const std::string& guid,
base::OnceCallback<void(bool success)> callback,
- base::Optional<vm_tools::concierge::DetachUsbDeviceResponse> response);
+ absl::optional<vm_tools::concierge::DetachUsbDeviceResponse> response);
// Returns true when a device should show a notification when attached.
bool ShouldShowNotification(const UsbDevice& device);
diff --git a/chrome/browser/ash/usb/cros_usb_detector_unittest.cc b/chrome/browser/ash/usb/cros_usb_detector_unittest.cc
index 8116aec..222bc3e 100644
--- a/chrome/browser/ash/usb/cros_usb_detector_unittest.cc
+++ b/chrome/browser/ash/usb/cros_usb_detector_unittest.cc
@@ -195,7 +195,7 @@
void AttachDeviceToVm(const std::string& vm_name,
const std::string& guid,
bool success = true) {
- base::Optional<vm_tools::concierge::AttachUsbDeviceResponse> response;
+ absl::optional<vm_tools::concierge::AttachUsbDeviceResponse> response;
response.emplace();
response->set_success(success);
response->set_guest_port(0);
@@ -228,7 +228,7 @@
return devices.front();
}
- base::Optional<uint8_t> GetSingleGuestPort() const {
+ absl::optional<uint8_t> GetSingleGuestPort() const {
EXPECT_EQ(1U, cros_usb_detector_->usb_devices_.size());
return cros_usb_detector_->usb_devices_.begin()->second.guest_port;
}
@@ -306,7 +306,7 @@
std::string notification_id =
chromeos::CrosUsbDetector::MakeNotificationId(device->guid());
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(notification_id);
ASSERT_TRUE(notification);
@@ -335,7 +335,7 @@
device_manager_.AddDevice(device);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(notification_id);
EXPECT_FALSE(notification);
device_manager_.RemoveDevice(device);
@@ -373,11 +373,11 @@
std::string notification_id =
chromeos::CrosUsbDetector::MakeNotificationId(device->guid());
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(notification_id);
ASSERT_TRUE(notification);
- notification->delegate()->Click(0, base::nullopt);
+ notification->delegate()->Click(0, absl::nullopt);
base::RunLoop().RunUntilIdle();
EXPECT_GE(fake_concierge_client_->attach_usb_device_call_count(), 1);
@@ -453,7 +453,7 @@
std::string notification_id =
chromeos::CrosUsbDetector::MakeNotificationId(device->guid());
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(notification_id);
ASSERT_TRUE(notification);
@@ -483,7 +483,7 @@
std::string notification_id =
chromeos::CrosUsbDetector::MakeNotificationId(device->guid());
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(notification_id);
ASSERT_TRUE(notification);
EXPECT_EQ(expected_title(), notification->title());
@@ -651,7 +651,7 @@
device_manager_.AddDevice(device_2);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(notification_id_2);
ASSERT_TRUE(notification);
@@ -685,7 +685,7 @@
device_manager_.AddDevice(device_1);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_1 =
+ absl::optional<message_center::Notification> notification_1 =
display_service_->GetNotification(notification_id_1);
ASSERT_TRUE(notification_1);
@@ -699,7 +699,7 @@
device_manager_.AddDevice(device_2);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_2 =
+ absl::optional<message_center::Notification> notification_2 =
display_service_->GetNotification(notification_id_2);
ASSERT_TRUE(notification_2);
@@ -713,7 +713,7 @@
device_manager_.AddDevice(device_3);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_3 =
+ absl::optional<message_center::Notification> notification_3 =
display_service_->GetNotification(notification_id_3);
ASSERT_TRUE(notification_3);
@@ -747,7 +747,7 @@
device_manager_.AddDevice(device_1);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_1 =
+ absl::optional<message_center::Notification> notification_1 =
display_service_->GetNotification(notification_id_1);
ASSERT_TRUE(notification_1);
@@ -757,7 +757,7 @@
device_manager_.AddDevice(device_2);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_2 =
+ absl::optional<message_center::Notification> notification_2 =
display_service_->GetNotification(notification_id_2);
ASSERT_TRUE(notification_2);
@@ -771,7 +771,7 @@
device_manager_.AddDevice(device_3);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_3 =
+ absl::optional<message_center::Notification> notification_3 =
display_service_->GetNotification(notification_id_3);
ASSERT_TRUE(notification_3);
diff --git a/chrome/browser/ash/web_applications/chrome_personalization_app_ui_delegate.cc b/chrome/browser/ash/web_applications/chrome_personalization_app_ui_delegate.cc
index 079aee1..b5f62ef 100644
--- a/chrome/browser/ash/web_applications/chrome_personalization_app_ui_delegate.cc
+++ b/chrome/browser/ash/web_applications/chrome_personalization_app_ui_delegate.cc
@@ -10,7 +10,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ash/backdrop_wallpaper_handlers/backdrop_wallpaper.pb.h"
#include "chrome/browser/ash/backdrop_wallpaper_handlers/backdrop_wallpaper_handlers.h"
@@ -19,6 +18,7 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/type_converter.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace mojo {
@@ -32,7 +32,7 @@
// now, continue even if it is missing.
// TODO(b/185580965) switch to using StructTraits and reject if preview is
// missing.
- base::Optional<GURL> preview_url;
+ absl::optional<GURL> preview_url;
if (collection.preview_size() > 0)
preview_url = GURL(collection.preview(0).image_url());
@@ -105,7 +105,7 @@
using ResultType =
std::vector<chromeos::personalization_app::mojom::WallpaperCollectionPtr>;
- base::Optional<ResultType> result;
+ absl::optional<ResultType> result;
if (success && !collections.empty()) {
ResultType data;
std::transform(
@@ -128,7 +128,7 @@
using ResultType =
std::vector<chromeos::personalization_app::mojom::WallpaperImagePtr>;
- base::Optional<ResultType> result;
+ absl::optional<ResultType> result;
if (success && !images.empty()) {
ResultType data;
std::transform(images.cbegin(), images.cend(), std::back_inserter(data),
diff --git a/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification.cc b/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification.cc
index e86efcd..5b26d85 100644
--- a/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification.cc
+++ b/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification.cc
@@ -49,7 +49,7 @@
base::UserMetricsAction("Discover.DiscoverTabNotification.Shown"));
}
-void HelpAppDiscoverTabNotification::OnClick(base::Optional<int> button_index) {
+void HelpAppDiscoverTabNotification::OnClick(absl::optional<int> button_index) {
SystemNotificationHelper::GetInstance()->Close(
kShowHelpAppDiscoverTabNotificationId);
diff --git a/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification.h b/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification.h
index 41a0baa..363ac40 100644
--- a/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification.h
+++ b/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification.h
@@ -9,7 +9,7 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -38,7 +38,7 @@
void SetOnClickCallbackForTesting(base::RepeatingCallback<void()> callback);
private:
- void OnClick(base::Optional<int> button_index);
+ void OnClick(absl::optional<int> button_index);
Profile* const profile_;
std::unique_ptr<message_center::Notification> notification_;
diff --git a/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification_unittest.cc b/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification_unittest.cc
index db656dc5..0930803f 100644
--- a/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification_unittest.cc
+++ b/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification_unittest.cc
@@ -91,7 +91,7 @@
notification_tester_->SimulateClick(NotificationHandler::Type::TRANSIENT,
kShowHelpAppDiscoverTabNotificationId,
/*action_index=*/0,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
EXPECT_EQ(false, HasDiscoverTabNotification());
}
@@ -106,7 +106,7 @@
notification_tester_->SimulateClick(NotificationHandler::Type::TRANSIENT,
kShowHelpAppDiscoverTabNotificationId,
/*action_index=*/0,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
EXPECT_EQ(false, HasDiscoverTabNotification());
}
@@ -120,7 +120,7 @@
notification_tester_->SimulateClick(NotificationHandler::Type::TRANSIENT,
kShowHelpAppDiscoverTabNotificationId,
/*action_index=*/0,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
EXPECT_EQ(1, user_action_tester.GetActionCount(
"Discover.DiscoverTabNotification.Clicked"));
}
diff --git a/chrome/browser/ash/web_applications/help_app/help_app_integration_browsertest.cc b/chrome/browser/ash/web_applications/help_app/help_app_integration_browsertest.cc
index 9859a3c..bde9f73 100644
--- a/chrome/browser/ash/web_applications/help_app/help_app_integration_browsertest.cc
+++ b/chrome/browser/ash/web_applications/help_app/help_app_integration_browsertest.cc
@@ -254,7 +254,7 @@
// Then click.
display_service->SimulateClick(NotificationHandler::Type::TRANSIENT,
"show_release_notes_notification",
- base::nullopt, base::nullopt);
+ absl::nullopt, absl::nullopt);
EXPECT_EQ(
1, user_action_tester.GetActionCount("ReleaseNotes.NotificationShown"));
@@ -291,8 +291,8 @@
// Then click.
display_service->SimulateClick(
NotificationHandler::Type::TRANSIENT,
- chromeos::kShowHelpAppDiscoverTabNotificationId, base::nullopt,
- base::nullopt);
+ chromeos::kShowHelpAppDiscoverTabNotificationId, absl::nullopt,
+ absl::nullopt);
#if BUILDFLAG(IS_CHROMEOS_ASH) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
EXPECT_NO_FATAL_FAILURE(WaitForAppToOpen(GURL("chrome://help-app/discover")));
diff --git a/chrome/browser/ash/web_applications/help_app/help_app_ui_delegate.cc b/chrome/browser/ash/web_applications/help_app/help_app_ui_delegate.cc
index 3908778..f0004d9 100644
--- a/chrome/browser/ash/web_applications/help_app/help_app_ui_delegate.cc
+++ b/chrome/browser/ash/web_applications/help_app/help_app_ui_delegate.cc
@@ -38,7 +38,7 @@
ChromeHelpAppUIDelegate::ChromeHelpAppUIDelegate(content::WebUI* web_ui)
: web_ui_(web_ui) {}
-base::Optional<std::string> ChromeHelpAppUIDelegate::OpenFeedbackDialog() {
+absl::optional<std::string> ChromeHelpAppUIDelegate::OpenFeedbackDialog() {
Profile* profile = Profile::FromWebUI(web_ui_);
constexpr char kHelpAppFeedbackCategoryTag[] = "FromHelpApp";
// We don't change the default description, or add extra diagnostics so those
@@ -49,7 +49,7 @@
std::string() /* description_placeholder_text */,
kHelpAppFeedbackCategoryTag /* category_tag */,
std::string() /* extra_diagnostics */);
- return base::nullopt;
+ return absl::nullopt;
}
void ChromeHelpAppUIDelegate::PopulateLoadTimeData(
diff --git a/chrome/browser/ash/web_applications/help_app/help_app_ui_delegate.h b/chrome/browser/ash/web_applications/help_app/help_app_ui_delegate.h
index 97f1558..0061360a 100644
--- a/chrome/browser/ash/web_applications/help_app/help_app_ui_delegate.h
+++ b/chrome/browser/ash/web_applications/help_app/help_app_ui_delegate.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_ASH_WEB_APPLICATIONS_HELP_APP_HELP_APP_UI_DELEGATE_H_
#define CHROME_BROWSER_ASH_WEB_APPLICATIONS_HELP_APP_HELP_APP_UI_DELEGATE_H_
-#include "base/optional.h"
#include "chromeos/components/help_app_ui/help_app_ui_delegate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebUI;
@@ -24,7 +24,7 @@
ChromeHelpAppUIDelegate& operator=(const ChromeHelpAppUIDelegate&) = delete;
// HelpAppUIDelegate:
- base::Optional<std::string> OpenFeedbackDialog() override;
+ absl::optional<std::string> OpenFeedbackDialog() override;
void PopulateLoadTimeData(content::WebUIDataSource* source) override;
void ShowParentalControls() override;
PrefService* GetLocalState() override;
diff --git a/chrome/browser/ash/web_applications/media_app/chrome_media_app_ui_delegate.cc b/chrome/browser/ash/web_applications/media_app/chrome_media_app_ui_delegate.cc
index da7b9fe..0764d2d 100644
--- a/chrome/browser/ash/web_applications/media_app/chrome_media_app_ui_delegate.cc
+++ b/chrome/browser/ash/web_applications/media_app/chrome_media_app_ui_delegate.cc
@@ -17,7 +17,7 @@
ChromeMediaAppUIDelegate::ChromeMediaAppUIDelegate(content::WebUI* web_ui)
: web_ui_(web_ui) {}
-base::Optional<std::string> ChromeMediaAppUIDelegate::OpenFeedbackDialog() {
+absl::optional<std::string> ChromeMediaAppUIDelegate::OpenFeedbackDialog() {
Profile* profile = Profile::FromWebUI(web_ui_);
constexpr char kMediaAppFeedbackCategoryTag[] = "FromMediaApp";
@@ -34,5 +34,5 @@
// TODO(crbug/1048368): Showing the feedback dialog can fail, communicate this
// back to the client with an error string. For now assume dialog opened.
- return base::nullopt;
+ return absl::nullopt;
}
diff --git a/chrome/browser/ash/web_applications/media_app/chrome_media_app_ui_delegate.h b/chrome/browser/ash/web_applications/media_app/chrome_media_app_ui_delegate.h
index f712ea6e..a54cf17 100644
--- a/chrome/browser/ash/web_applications/media_app/chrome_media_app_ui_delegate.h
+++ b/chrome/browser/ash/web_applications/media_app/chrome_media_app_ui_delegate.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_ASH_WEB_APPLICATIONS_MEDIA_APP_CHROME_MEDIA_APP_UI_DELEGATE_H_
#define CHROME_BROWSER_ASH_WEB_APPLICATIONS_MEDIA_APP_CHROME_MEDIA_APP_UI_DELEGATE_H_
-#include "base/optional.h"
#include "chromeos/components/media_app_ui/media_app_ui_delegate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebUI;
@@ -24,7 +24,7 @@
ChromeMediaAppUIDelegate& operator=(const ChromeMediaAppUIDelegate&) = delete;
// MediaAppUIDelegate:
- base::Optional<std::string> OpenFeedbackDialog() override;
+ absl::optional<std::string> OpenFeedbackDialog() override;
private:
content::WebUI* web_ui_; // Owns |this|.
diff --git a/chrome/browser/ash/wilco_dtc_supportd/fake_wilco_dtc_supportd_client.cc b/chrome/browser/ash/wilco_dtc_supportd/fake_wilco_dtc_supportd_client.cc
index 2627b88..4c1fd53 100644
--- a/chrome/browser/ash/wilco_dtc_supportd/fake_wilco_dtc_supportd_client.cc
+++ b/chrome/browser/ash/wilco_dtc_supportd/fake_wilco_dtc_supportd_client.cc
@@ -50,7 +50,7 @@
}
void FakeWilcoDtcSupportdClient::SetWaitForServiceToBeAvailableResult(
- base::Optional<bool> wait_for_service_to_be_available_result) {
+ absl::optional<bool> wait_for_service_to_be_available_result) {
wait_for_service_to_be_available_result_ =
wait_for_service_to_be_available_result;
if (!wait_for_service_to_be_available_result_)
@@ -67,7 +67,7 @@
}
void FakeWilcoDtcSupportdClient::SetBootstrapMojoConnectionResult(
- base::Optional<bool> bootstrap_mojo_connection_result) {
+ absl::optional<bool> bootstrap_mojo_connection_result) {
bootstrap_mojo_connection_result_ = bootstrap_mojo_connection_result;
if (!bootstrap_mojo_connection_result_)
return;
diff --git a/chrome/browser/ash/wilco_dtc_supportd/fake_wilco_dtc_supportd_client.h b/chrome/browser/ash/wilco_dtc_supportd/fake_wilco_dtc_supportd_client.h
index 26f0d9b..f5c6cf96 100644
--- a/chrome/browser/ash/wilco_dtc_supportd/fake_wilco_dtc_supportd_client.h
+++ b/chrome/browser/ash/wilco_dtc_supportd/fake_wilco_dtc_supportd_client.h
@@ -9,9 +9,9 @@
#include "base/component_export.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_client.h"
#include "chromeos/dbus/dbus_method_call_status.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
@@ -35,7 +35,7 @@
// pending and future WaitForServiceToBeAvailable calls. Otherwise, the
// requests will stay pending.
void SetWaitForServiceToBeAvailableResult(
- base::Optional<bool> wait_for_service_to_be_available_result);
+ absl::optional<bool> wait_for_service_to_be_available_result);
// Whether there's a pending BootstrapMojoConnection call.
int bootstrap_mojo_connection_in_flight_call_count() const;
@@ -43,14 +43,14 @@
// pending and future BootstrapMojoConnection calls. Otherwise, the requests
// will stay pending.
void SetBootstrapMojoConnectionResult(
- base::Optional<bool> bootstrap_mojo_connection_result);
+ absl::optional<bool> bootstrap_mojo_connection_result);
private:
- base::Optional<bool> wait_for_service_to_be_available_result_;
+ absl::optional<bool> wait_for_service_to_be_available_result_;
std::vector<WaitForServiceToBeAvailableCallback>
pending_wait_for_service_to_be_available_callbacks_;
- base::Optional<bool> bootstrap_mojo_connection_result_;
+ absl::optional<bool> bootstrap_mojo_connection_result_;
std::vector<VoidDBusMethodCallback>
pending_bootstrap_mojo_connection_callbacks_;
diff --git a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_bridge_unittest.cc b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_bridge_unittest.cc
index 17329b2..9145891 100644
--- a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_bridge_unittest.cc
+++ b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_bridge_unittest.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/check.h"
-#include "base/optional.h"
#include "base/posix/eintr_wrapper.h"
#include "base/test/task_environment.h"
#include "chrome/browser/ash/wilco_dtc_supportd/fake_wilco_dtc_supportd_client.h"
@@ -25,6 +24,7 @@
#include "mojo/public/cpp/system/handle.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using testing::StrictMock;
@@ -128,7 +128,7 @@
chromeos::wilco_dtc_supportd::mojom::WilcoDtcSupportdServiceFactory>
self_receiver_{this};
- base::Optional<PendingGetServiceCall> pending_get_service_call_;
+ absl::optional<PendingGetServiceCall> pending_get_service_call_;
};
// Fake implementation of the WilcoDtcSupportdBridge delegate that simulates
@@ -292,7 +292,7 @@
// GetService Mojo call on the WilcoDtcSupportdServiceFactory interface.
wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult(true);
wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult(
- base::nullopt);
+ absl::nullopt);
task_environment_.RunUntilIdle();
ASSERT_TRUE(is_mojo_factory_get_service_call_in_flight());
@@ -337,7 +337,7 @@
->bootstrap_mojo_connection_in_flight_call_count());
wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult(false);
wilco_dtc_supportd_dbus_client()->SetBootstrapMojoConnectionResult(
- base::nullopt);
+ absl::nullopt);
task_environment_.RunUntilIdle();
// Verify that no new BootstrapMojoConnection call is made immediately after
diff --git a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_network_context.cc b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_network_context.cc
index c6d0c70..ea75c67 100644
--- a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_network_context.cc
+++ b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_network_context.cc
@@ -88,7 +88,7 @@
}
void WilcoDtcSupportdNetworkContextImpl::OnCertificateRequested(
- const base::Optional<base::UnguessableToken>& window_id,
+ const absl::optional<base::UnguessableToken>& window_id,
const scoped_refptr<net::SSLCertRequestInfo>& cert_info,
mojo::PendingRemote<network::mojom::ClientCertificateResponder>
cert_responder_remote) {
@@ -98,7 +98,7 @@
}
void WilcoDtcSupportdNetworkContextImpl::OnAuthRequired(
- const base::Optional<base::UnguessableToken>& window_id,
+ const absl::optional<base::UnguessableToken>& window_id,
uint32_t request_id,
const GURL& url,
bool first_auth_attempt,
@@ -108,7 +108,7 @@
auth_challenge_responder) {
mojo::Remote<network::mojom::AuthChallengeResponder>
auth_challenge_responder_remote(std::move(auth_challenge_responder));
- auth_challenge_responder_remote->OnAuthCredentials(base::nullopt);
+ auth_challenge_responder_remote->OnAuthCredentials(absl::nullopt);
}
void WilcoDtcSupportdNetworkContextImpl::OnClearSiteData(
diff --git a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_network_context.h b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_network_context.h
index 089f8c6..29e1fef 100644
--- a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_network_context.h
+++ b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_network_context.h
@@ -7,7 +7,6 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/unguessable_token.h"
#include "chrome/browser/net/proxy_config_monitor.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
@@ -20,6 +19,7 @@
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/public/mojom/url_loader_network_service_observer.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace ash {
@@ -57,12 +57,12 @@
bool fatal,
OnSSLCertificateErrorCallback response) override;
void OnCertificateRequested(
- const base::Optional<base::UnguessableToken>& window_id,
+ const absl::optional<base::UnguessableToken>& window_id,
const scoped_refptr<net::SSLCertRequestInfo>& cert_info,
mojo::PendingRemote<network::mojom::ClientCertificateResponder>
cert_responder) override;
void OnAuthRequired(
- const base::Optional<base::UnguessableToken>& window_id,
+ const absl::optional<base::UnguessableToken>& window_id,
uint32_t request_id,
const GURL& url,
bool first_auth_attempt,
diff --git a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_notification_controller.cc b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_notification_controller.cc
index 0397ee3..185fea7 100644
--- a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_notification_controller.cc
+++ b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_notification_controller.cc
@@ -47,8 +47,8 @@
WilcoDtcSupportdNotificationDelegate& operator=(
const WilcoDtcSupportdNotificationDelegate& other) = delete;
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
if (button_index && *button_index == 0) {
auto help_app(
base::MakeRefCounted<HelpAppLauncher>(nullptr /* parent_window */));
diff --git a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_notification_controller_unittest.cc b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_notification_controller_unittest.cc
index 348ef77..38f7410 100644
--- a/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_notification_controller_unittest.cc
+++ b/chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_notification_controller_unittest.cc
@@ -98,7 +98,7 @@
.size();
}
- base::Optional<message_center::Notification> GetNotification(
+ absl::optional<message_center::Notification> GetNotification(
const std::string& notification_id) const {
return service_tester_->GetNotification(notification_id);
}
@@ -132,7 +132,7 @@
EXPECT_EQ(0u, NotificationCount());
std::string id = (notification_controller()->*test_params.function)();
EXPECT_EQ(1u, NotificationCount());
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
GetNotification(id);
EXPECT_EQ(l10n_util::GetStringUTF16(test_params.title),
notification->title());
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index a8cb1b6..6b9875b 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -141,7 +141,7 @@
class SearchProviderFeatureTestComponent {
public:
SearchProviderFeatureTestComponent(
- const base::Optional<bool> warm_up_on_focus,
+ const absl::optional<bool> warm_up_on_focus,
const bool command_line_overrides);
~SearchProviderFeatureTestComponent() {
@@ -153,7 +153,7 @@
};
SearchProviderFeatureTestComponent::SearchProviderFeatureTestComponent(
- const base::Optional<bool> warm_up_on_focus,
+ const absl::optional<bool> warm_up_on_focus,
const bool command_line_overrides) {
if (warm_up_on_focus.has_value()) {
if (warm_up_on_focus.value())
@@ -219,7 +219,7 @@
};
BaseSearchProviderTest(
- const base::Optional<bool> warm_up_on_focus = base::nullopt,
+ const absl::optional<bool> warm_up_on_focus = absl::nullopt,
const bool command_line_overrides = false)
: feature_test_component_(warm_up_on_focus, command_line_overrides) {
// We need both the history service and template url model loaded.
@@ -340,7 +340,7 @@
class SearchProviderTest : public BaseSearchProviderTest {
public:
SearchProviderTest(
- const base::Optional<bool> warm_up_on_focus = base::nullopt,
+ const absl::optional<bool> warm_up_on_focus = absl::nullopt,
const bool command_line_overrides = false)
: BaseSearchProviderTest(warm_up_on_focus, command_line_overrides) {}
@@ -3781,7 +3781,7 @@
class SearchProviderCommandLineOverrideTest : public SearchProviderTest {
public:
SearchProviderCommandLineOverrideTest()
- : SearchProviderTest(base::nullopt, true) {}
+ : SearchProviderTest(absl::nullopt, true) {}
SearchProviderCommandLineOverrideTest(
SearchProviderCommandLineOverrideTest const&) = delete;
diff --git a/chrome/browser/autofill/accessory_controller.h b/chrome/browser/autofill/accessory_controller.h
index 3a2bea7..e256137 100644
--- a/chrome/browser/autofill/accessory_controller.h
+++ b/chrome/browser/autofill/accessory_controller.h
@@ -6,10 +6,10 @@
#define CHROME_BROWSER_AUTOFILL_ACCESSORY_CONTROLLER_H_
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "base/types/strong_alias.h"
#include "components/autofill/core/browser/ui/accessory_sheet_data.h"
#include "components/autofill/core/common/unique_ids.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Interface for the portions of type-specific manual filling controllers (e.g.,
// password, credit card) which interact with the generic
@@ -29,12 +29,12 @@
virtual void RegisterFillingSourceObserver(
FillingSourceObserver observer) = 0;
- // Reurns a base::nullopt if the accessory controller can't provide any data.
+ // Reurns a absl::nullopt if the accessory controller can't provide any data.
// If the controller can provide data, it returns a non-empty sheet that *can*
// be in a loading state while the data is being fetched.
// Use |RegisterFillingSourceObserver()| to repeatedly be notified about
// changes in the sheet data.
- virtual base::Optional<autofill::AccessorySheetData> GetSheetData() const = 0;
+ virtual absl::optional<autofill::AccessorySheetData> GetSheetData() const = 0;
// Triggered when a user selects an item for filling. This handler is
// responsible for propagating it so that it ultimately ends up in the form
diff --git a/chrome/browser/autofill/address_accessory_controller_impl.cc b/chrome/browser/autofill/address_accessory_controller_impl.cc
index 2e3fd2af2..7190e77 100644
--- a/chrome/browser/autofill/address_accessory_controller_impl.cc
+++ b/chrome/browser/autofill/address_accessory_controller_impl.cc
@@ -8,7 +8,6 @@
#include <utility>
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/android/preferences/autofill/autofill_profile_bridge.h"
#include "chrome/browser/autofill/manual_filling_controller.h"
@@ -21,6 +20,7 @@
#include "components/autofill/core/common/autofill_features.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
namespace autofill {
@@ -106,10 +106,10 @@
source_observer_ = std::move(observer);
}
-base::Optional<autofill::AccessorySheetData>
+absl::optional<autofill::AccessorySheetData>
AddressAccessoryControllerImpl::GetSheetData() const {
if (!personal_data_manager_) {
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<AutofillProfile*> profiles =
personal_data_manager_->GetProfilesToSuggest();
@@ -163,7 +163,7 @@
Profile::FromBrowserContext(web_contents_->GetBrowserContext()));
personal_data_manager_->AddObserver(this);
}
- base::Optional<AccessorySheetData> data = GetSheetData();
+ absl::optional<AccessorySheetData> data = GetSheetData();
if (source_observer_) {
source_observer_.Run(this, IsFillingSourceAvailable(data.has_value()));
} else {
diff --git a/chrome/browser/autofill/address_accessory_controller_impl.h b/chrome/browser/autofill/address_accessory_controller_impl.h
index ef0f44d8..67bd23b5 100644
--- a/chrome/browser/autofill/address_accessory_controller_impl.h
+++ b/chrome/browser/autofill/address_accessory_controller_impl.h
@@ -31,7 +31,7 @@
// AccessoryController:
void RegisterFillingSourceObserver(FillingSourceObserver observer) override;
- base::Optional<AccessorySheetData> GetSheetData() const override;
+ absl::optional<AccessorySheetData> GetSheetData() const override;
void OnFillingTriggered(FieldGlobalId focused_field_id,
const UserInfo::Field& selection) override;
void OnOptionSelected(AccessoryAction selected_action) override;
diff --git a/chrome/browser/autofill/android/save_address_profile_prompt_controller.h b/chrome/browser/autofill/android/save_address_profile_prompt_controller.h
index efe6527..59ec431 100644
--- a/chrome/browser/autofill/android/save_address_profile_prompt_controller.h
+++ b/chrome/browser/autofill/android/save_address_profile_prompt_controller.h
@@ -77,7 +77,7 @@
// The profile which is being confirmed by the user.
AutofillProfile profile_;
// The profile (if exists) which will be updated if the user confirms.
- base::Optional<AutofillProfile> original_profile_;
+ absl::optional<AutofillProfile> original_profile_;
// The callback to run once the user makes a decision.
AutofillClient::AddressProfileSavePromptCallback decision_callback_;
// The callback guaranteed to be run once the prompt is dismissed.
diff --git a/chrome/browser/autofill/autofill_gstatic_reader.cc b/chrome/browser/autofill/autofill_gstatic_reader.cc
index 71a1b0a..b12fea0 100644
--- a/chrome/browser/autofill/autofill_gstatic_reader.cc
+++ b/chrome/browser/autofill/autofill_gstatic_reader.cc
@@ -143,8 +143,8 @@
const std::string& key) {
if (!response_body)
return {};
- base::Optional<base::Value> data = base::JSONReader::Read(*response_body);
- if (data == base::nullopt || !data->is_dict())
+ absl::optional<base::Value> data = base::JSONReader::Read(*response_body);
+ if (data == absl::nullopt || !data->is_dict())
return {};
base::Value* raw_result = data->FindKey(key);
if (!raw_result || !raw_result->is_list())
diff --git a/chrome/browser/autofill/autofill_keyboard_accessory_adapter.cc b/chrome/browser/autofill/autofill_keyboard_accessory_adapter.cc
index 65a39ad..e5ec011 100644
--- a/chrome/browser/autofill/autofill_keyboard_accessory_adapter.cc
+++ b/chrome/browser/autofill/autofill_keyboard_accessory_adapter.cc
@@ -52,15 +52,15 @@
}
void AutofillKeyboardAccessoryAdapter::OnSelectedRowChanged(
- base::Optional<int> previous_row_selection,
- base::Optional<int> current_row_selection) {}
+ absl::optional<int> previous_row_selection,
+ absl::optional<int> current_row_selection) {}
void AutofillKeyboardAccessoryAdapter::OnSuggestionsChanged() {
DCHECK(controller_) << "Call OnSuggestionsChanged only from its owner!";
DCHECK(view_) << "OnSuggestionsChanged called before a View was set!";
labels_.clear();
- front_element_ = base::nullopt;
+ front_element_ = absl::nullopt;
for (int i = 0; i < GetLineCount(); ++i) {
const Suggestion& suggestion = controller_->GetSuggestionAt(i);
if (suggestion.frontend_id != POPUP_ITEM_ID_CLEAR_FORM) {
@@ -68,7 +68,7 @@
continue;
}
DCHECK(!front_element_.has_value()) << "Additional front item at: " << i;
- front_element_ = base::Optional<int>(i);
+ front_element_ = absl::optional<int>(i);
// If there is a special popup item, just reuse the previously used label.
labels_.push_back(controller_->GetSuggestionLabelAt(i));
}
@@ -76,9 +76,9 @@
view_->Show();
}
-base::Optional<int32_t> AutofillKeyboardAccessoryAdapter::GetAxUniqueId() {
+absl::optional<int32_t> AutofillKeyboardAccessoryAdapter::GetAxUniqueId() {
NOTIMPLEMENTED() << "See https://crbug.com/985927";
- return base::nullopt;
+ return absl::nullopt;
}
// AutofillPopupController implementation.
@@ -138,25 +138,25 @@
}
void AutofillKeyboardAccessoryAdapter::SetSelectedLine(
- base::Optional<int> selected_line) {
+ absl::optional<int> selected_line) {
if (!controller_)
return;
if (!selected_line.has_value()) {
- controller_->SetSelectedLine(base::nullopt);
+ controller_->SetSelectedLine(absl::nullopt);
return;
}
controller_->SetSelectedLine(OffsetIndexFor(selected_line.value()));
}
-base::Optional<int> AutofillKeyboardAccessoryAdapter::selected_line() const {
+absl::optional<int> AutofillKeyboardAccessoryAdapter::selected_line() const {
if (!controller_ || !controller_->selected_line().has_value())
- return base::nullopt;
+ return absl::nullopt;
for (int i = 0; i < GetLineCount(); ++i) {
if (OffsetIndexFor(i) == controller_->selected_line().value()) {
return i;
}
}
- return base::nullopt;
+ return absl::nullopt;
}
// AutofillPopupViewDelegate implementation
diff --git a/chrome/browser/autofill/autofill_keyboard_accessory_adapter.h b/chrome/browser/autofill/autofill_keyboard_accessory_adapter.h
index a00d338..8ee518b0 100644
--- a/chrome/browser/autofill/autofill_keyboard_accessory_adapter.h
+++ b/chrome/browser/autofill/autofill_keyboard_accessory_adapter.h
@@ -58,10 +58,10 @@
// AutofillPopupView implementation.
void Show() override;
void Hide() override;
- void OnSelectedRowChanged(base::Optional<int> previous_row_selection,
- base::Optional<int> current_row_selection) override;
+ void OnSelectedRowChanged(absl::optional<int> previous_row_selection,
+ absl::optional<int> current_row_selection) override;
void OnSuggestionsChanged() override;
- base::Optional<int32_t> GetAxUniqueId() override;
+ absl::optional<int32_t> GetAxUniqueId() override;
// AutofillPopupController implementation.
// Hidden: void OnSuggestionsChanged() override;
@@ -74,8 +74,8 @@
std::u16string* title,
std::u16string* body) override;
bool RemoveSuggestion(int index) override;
- void SetSelectedLine(base::Optional<int> selected_line) override;
- base::Optional<int> selected_line() const override;
+ void SetSelectedLine(absl::optional<int> selected_line) override;
+ absl::optional<int> selected_line() const override;
PopupType GetPopupType() const override;
void Hide(PopupHidingReason reason) override;
@@ -102,7 +102,7 @@
// Position that the front element has in the suggestion list returned by
// controller_. It is used to determine the offset suggestions.
- base::Optional<int> front_element_;
+ absl::optional<int> front_element_;
base::WeakPtrFactory<AutofillKeyboardAccessoryAdapter> weak_ptr_factory_{
this};
diff --git a/chrome/browser/autofill/autofill_keyboard_accessory_adapter_unittest.cc b/chrome/browser/autofill/autofill_keyboard_accessory_adapter_unittest.cc
index cea49c3..74328a4f 100644
--- a/chrome/browser/autofill/autofill_keyboard_accessory_adapter_unittest.cc
+++ b/chrome/browser/autofill/autofill_keyboard_accessory_adapter_unittest.cc
@@ -225,7 +225,7 @@
controller()->set_suggestions(createSuggestions(/*clearItemOffset=*/2));
NotifyAboutSuggestions();
- EXPECT_CALL(*controller(), SetSelectedLine(base::Optional<int>(0)));
+ EXPECT_CALL(*controller(), SetSelectedLine(absl::optional<int>(0)));
adapter_as_controller()->SetSelectedLine(1);
EXPECT_CALL(*controller(), selected_line()).WillRepeatedly(Return(0));
diff --git a/chrome/browser/autofill/automated_tests/cache_replayer_unittest.cc b/chrome/browser/autofill/automated_tests/cache_replayer_unittest.cc
index 33f81c1..4f8d0f7b 100644
--- a/chrome/browser/autofill/automated_tests/cache_replayer_unittest.cc
+++ b/chrome/browser/autofill/automated_tests/cache_replayer_unittest.cc
@@ -88,7 +88,7 @@
// Returns a query request URL. If |query| is not empty, the corresponding
// query is encoded into the URL.
-bool MakeQueryRequestURL(const base::Optional<AutofillPageQueryRequest>& query,
+bool MakeQueryRequestURL(const absl::optional<AutofillPageQueryRequest>& query,
std::string* request_url) {
if (!query.has_value()) {
*request_url = CreateQueryUrl("");
@@ -118,7 +118,7 @@
std::string* request_url) {
// Make body and query content for URL depending on the |type|.
std::string body;
- base::Optional<AutofillPageQueryRequest> query_for_url;
+ absl::optional<AutofillPageQueryRequest> query_for_url;
if (type == RequestType::kQueryProtoGET) {
query_for_url = std::move(query);
} else {
@@ -130,7 +130,7 @@
AutofillPageResourceQueryRequest request;
request.set_serialized_request(encoded_query);
request.SerializeToString(&body);
- query_for_url = base::nullopt;
+ query_for_url = absl::nullopt;
}
// Make header according to query content for URL.
diff --git a/chrome/browser/autofill/captured_sites_test_utils.cc b/chrome/browser/autofill/captured_sites_test_utils.cc
index f44ce25b..b7744d6b 100644
--- a/chrome/browser/autofill/captured_sites_test_utils.cc
+++ b/chrome/browser/autofill/captured_sites_test_utils.cc
@@ -332,13 +332,13 @@
#endif
}
-base::Optional<base::FilePath> GetCommandFilePath() {
+absl::optional<base::FilePath> GetCommandFilePath() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line && command_line->HasSwitch(kCommandFileFlag)) {
- return base::make_optional(
+ return absl::make_optional(
command_line->GetSwitchValuePath(kCommandFileFlag));
}
- return base::nullopt;
+ return absl::nullopt;
}
void PrintInstructions(const char* test_file_name) {
@@ -494,7 +494,7 @@
bool TestRecipeReplayer::ReplayTest(
const base::FilePath& capture_file_path,
const base::FilePath& recipe_file_path,
- const base::Optional<base::FilePath>& command_file_path) {
+ const absl::optional<base::FilePath>& command_file_path) {
if (!StartWebPageReplayServer(capture_file_path))
return false;
if (OverrideAutofillClock(capture_file_path))
@@ -526,7 +526,7 @@
return false;
}
// Convert the file text into a json object.
- base::Optional<base::Value> parsed_json =
+ absl::optional<base::Value> parsed_json =
base::JSONReader::Read(decompressed_json_text);
if (!parsed_json) {
VLOG(1) << kClockNotSetMessage << "Failed to deserialize json";
@@ -862,7 +862,7 @@
bool TestRecipeReplayer::ReplayRecordedActions(
const base::FilePath& recipe_file_path,
- const base::Optional<base::FilePath>& command_file_path) {
+ const absl::optional<base::FilePath>& command_file_path) {
// Read the text of the recipe file.
base::ScopedAllowBlockingForTesting for_testing;
std::string json_text;
@@ -872,7 +872,7 @@
}
// Convert the file text into a json object.
- base::Optional<base::Value> parsed_json = base::JSONReader::Read(json_text);
+ absl::optional<base::Value> parsed_json = base::JSONReader::Read(json_text);
if (!parsed_json) {
ADD_FAILURE() << "Failed to deserialize json text!";
return false;
@@ -1295,7 +1295,7 @@
bool TestRecipeReplayer::ExecuteSelectDropdownAction(
const base::DictionaryValue& action) {
- base::Optional<int> index = action.FindIntKey("index");
+ absl::optional<int> index = action.FindIntKey("index");
if (!index) {
ADD_FAILURE() << "Failed to extract Selection Index from action";
return false;
@@ -1533,7 +1533,7 @@
return false;
}
- base::Optional<bool> is_iframe_container = iframe->FindBoolKey("isIframe");
+ absl::optional<bool> is_iframe_container = iframe->FindBoolKey("isIframe");
if (!is_iframe_container) {
ADD_FAILURE() << "Failed to extract isIframe from the iframe context! ";
return false;
diff --git a/chrome/browser/autofill/captured_sites_test_utils.h b/chrome/browser/autofill/captured_sites_test_utils.h
index c22a275..8b5c3c3 100644
--- a/chrome/browser/autofill/captured_sites_test_utils.h
+++ b/chrome/browser/autofill/captured_sites_test_utils.h
@@ -86,7 +86,7 @@
}
};
-base::Optional<base::FilePath> GetCommandFilePath();
+absl::optional<base::FilePath> GetCommandFilePath();
// Prints tips on how to run captured-site tests.
// |test_file_name| should be without the .cc suffix.
@@ -214,7 +214,7 @@
// 2. Replaying the specified Test Recipe file.
bool ReplayTest(const base::FilePath& capture_file_path,
const base::FilePath& recipe_file_path,
- const base::Optional<base::FilePath>& command_file_path);
+ const absl::optional<base::FilePath>& command_file_path);
const std::vector<testing::AssertionResult> GetValidationFailures() const;
@@ -261,7 +261,7 @@
base::Process* process);
bool ReplayRecordedActions(
const base::FilePath& recipe_file_path,
- const base::Optional<base::FilePath>& command_file_path);
+ const absl::optional<base::FilePath>& command_file_path);
bool InitializeBrowserToExecuteRecipe(
const std::unique_ptr<base::DictionaryValue>& recipe);
bool ExecuteAutofillAction(const base::DictionaryValue& action);
diff --git a/chrome/browser/autofill/credit_card_accessory_controller_impl.cc b/chrome/browser/autofill/credit_card_accessory_controller_impl.cc
index 4087f4d..ed03b04 100644
--- a/chrome/browser/autofill/credit_card_accessory_controller_impl.cc
+++ b/chrome/browser/autofill/credit_card_accessory_controller_impl.cc
@@ -81,7 +81,7 @@
source_observer_ = std::move(observer);
}
-base::Optional<autofill::AccessorySheetData>
+absl::optional<autofill::AccessorySheetData>
CreditCardAccessoryControllerImpl::GetSheetData() const {
bool valid_manager = web_contents_->GetFocusedFrame() && GetManager();
std::vector<UserInfo> info_to_add;
@@ -201,7 +201,7 @@
} else {
cards_cache_.clear(); // If cards cannot be filled, don't show them.
}
- base::Optional<AccessorySheetData> data = GetSheetData();
+ absl::optional<AccessorySheetData> data = GetSheetData();
if (source_observer_) {
source_observer_.Run(this, IsFillingSourceAvailable(data.has_value()));
} else {
diff --git a/chrome/browser/autofill/credit_card_accessory_controller_impl.h b/chrome/browser/autofill/credit_card_accessory_controller_impl.h
index 865f9bb..347b9cf8 100644
--- a/chrome/browser/autofill/credit_card_accessory_controller_impl.h
+++ b/chrome/browser/autofill/credit_card_accessory_controller_impl.h
@@ -26,7 +26,7 @@
// AccessoryController:
void RegisterFillingSourceObserver(FillingSourceObserver observer) override;
- base::Optional<autofill::AccessorySheetData> GetSheetData() const override;
+ absl::optional<autofill::AccessorySheetData> GetSheetData() const override;
void OnFillingTriggered(FieldGlobalId focused_field_id,
const UserInfo::Field& selection) override;
void OnOptionSelected(AccessoryAction selected_action) override;
diff --git a/chrome/browser/autofill/manual_filling_controller_impl.cc b/chrome/browser/autofill/manual_filling_controller_impl.cc
index da10fe10..b80bda1 100644
--- a/chrome/browser/autofill/manual_filling_controller_impl.cc
+++ b/chrome/browser/autofill/manual_filling_controller_impl.cc
@@ -13,7 +13,6 @@
#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/trace_event/memory_allocator_dump.h"
#include "base/trace_event/memory_dump_manager.h"
@@ -33,6 +32,7 @@
#include "components/password_manager/core/browser/credential_cache.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using autofill::AccessoryAction;
using autofill::AccessorySheetData;
@@ -218,7 +218,7 @@
autofill::AccessoryTabType tab_type,
base::OnceCallback<void(const autofill::AccessorySheetData&)> callback) {
// TODO(crbug.com/1169167): Consider to execute this async to reduce jank.
- base::Optional<AccessorySheetData> sheet =
+ absl::optional<AccessorySheetData> sheet =
GetControllerForTabType(tab_type)->GetSheetData();
// After they were loaded, all currently existing sheet types always return a
// value and will always result in a called callback.
@@ -356,7 +356,7 @@
}
if (source == FillingSource::AUTOFILL)
continue; // Autofill suggestions have no sheet.
- base::Optional<AccessorySheetData> sheet =
+ absl::optional<AccessorySheetData> sheet =
GetControllerForFillingSource(source)->GetSheetData();
if (sheet.has_value())
view_->OnItemsAvailable(std::move(sheet.value()));
@@ -387,7 +387,7 @@
FillingSource source,
AccessoryController* source_controller,
AccessoryController::IsFillingSourceAvailable is_source_available) {
- base::Optional<AccessorySheetData> sheet = source_controller->GetSheetData();
+ absl::optional<AccessorySheetData> sheet = source_controller->GetSheetData();
bool show_filling_source = sheet.has_value() && is_source_available;
// TODO(crbug.com/1169167): Remove once all sheets pull this information
// instead of waiting to get it pushed.
diff --git a/chrome/browser/autofill/manual_filling_controller_impl_unittest.cc b/chrome/browser/autofill/manual_filling_controller_impl_unittest.cc
index 2e2cf96..3f3896c 100644
--- a/chrome/browser/autofill/manual_filling_controller_impl_unittest.cc
+++ b/chrome/browser/autofill/manual_filling_controller_impl_unittest.cc
@@ -11,7 +11,6 @@
#include "base/bind.h"
#include "base/callback.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/mock_callback.h"
@@ -32,6 +31,7 @@
#include "content/public/test/test_web_contents_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
using autofill::AccessoryAction;
diff --git a/chrome/browser/autofill/mock_address_accessory_controller.h b/chrome/browser/autofill/mock_address_accessory_controller.h
index d3d8c428..734c21c 100644
--- a/chrome/browser/autofill/mock_address_accessory_controller.h
+++ b/chrome/browser/autofill/mock_address_accessory_controller.h
@@ -21,7 +21,7 @@
RegisterFillingSourceObserver,
(FillingSourceObserver),
(override));
- MOCK_METHOD(base::Optional<autofill::AccessorySheetData>,
+ MOCK_METHOD(absl::optional<autofill::AccessorySheetData>,
GetSheetData,
(),
(const, override));
diff --git a/chrome/browser/autofill/mock_autofill_popup_controller.h b/chrome/browser/autofill/mock_autofill_popup_controller.h
index 47d9b1f..47c73ea 100644
--- a/chrome/browser/autofill/mock_autofill_popup_controller.h
+++ b/chrome/browser/autofill/mock_autofill_popup_controller.h
@@ -69,8 +69,8 @@
MOCK_METHOD3(GetRemovalConfirmationText,
bool(int index, std::u16string* title, std::u16string* body));
MOCK_METHOD1(RemoveSuggestion, bool(int index));
- MOCK_METHOD1(SetSelectedLine, void(base::Optional<int> selected_line));
- MOCK_CONST_METHOD0(selected_line, base::Optional<int>());
+ MOCK_METHOD1(SetSelectedLine, void(absl::optional<int> selected_line));
+ MOCK_CONST_METHOD0(selected_line, absl::optional<int>());
MOCK_CONST_METHOD0(GetPopupType, PopupType());
void set_suggestions(const std::vector<int>& ids) {
diff --git a/chrome/browser/autofill/mock_credit_card_accessory_controller.h b/chrome/browser/autofill/mock_credit_card_accessory_controller.h
index e13985d..7f61a69 100644
--- a/chrome/browser/autofill/mock_credit_card_accessory_controller.h
+++ b/chrome/browser/autofill/mock_credit_card_accessory_controller.h
@@ -25,7 +25,7 @@
RegisterFillingSourceObserver,
(FillingSourceObserver),
(override));
- MOCK_METHOD(base::Optional<autofill::AccessorySheetData>,
+ MOCK_METHOD(absl::optional<autofill::AccessorySheetData>,
GetSheetData,
(),
(const, override));
diff --git a/chrome/browser/autofill/mock_password_accessory_controller.h b/chrome/browser/autofill/mock_password_accessory_controller.h
index 1d64ab62..b267ec9 100644
--- a/chrome/browser/autofill/mock_password_accessory_controller.h
+++ b/chrome/browser/autofill/mock_password_accessory_controller.h
@@ -38,7 +38,7 @@
RegisterFillingSourceObserver,
(FillingSourceObserver),
(override));
- MOCK_METHOD(base::Optional<autofill::AccessorySheetData>,
+ MOCK_METHOD(absl::optional<autofill::AccessorySheetData>,
GetSheetData,
(),
(const, override));
diff --git a/chrome/browser/availability/availability_prober.cc b/chrome/browser/availability/availability_prober.cc
index 6c49e43..e747dc5 100644
--- a/chrome/browser/availability/availability_prober.cc
+++ b/chrome/browser/availability/availability_prober.cc
@@ -135,30 +135,30 @@
return id;
}
-base::Optional<base::Value> EncodeCacheEntryValue(
+absl::optional<base::Value> EncodeCacheEntryValue(
const AvailabilityProberCacheEntry& entry) {
std::string serialized_entry;
bool serialize_to_string_ok = entry.SerializeToString(&serialized_entry);
if (!serialize_to_string_ok)
- return base::nullopt;
+ return absl::nullopt;
std::string base64_encoded;
base::Base64Encode(serialized_entry, &base64_encoded);
return base::Value(base64_encoded);
}
-base::Optional<AvailabilityProberCacheEntry> DecodeCacheEntryValue(
+absl::optional<AvailabilityProberCacheEntry> DecodeCacheEntryValue(
const base::Value& value) {
if (!value.is_string())
- return base::nullopt;
+ return absl::nullopt;
std::string base64_decoded;
if (!base::Base64Decode(value.GetString(), &base64_decoded))
- return base::nullopt;
+ return absl::nullopt;
AvailabilityProberCacheEntry entry;
if (!entry.ParseFromString(base64_decoded))
- return base::nullopt;
+ return absl::nullopt;
return entry;
}
@@ -175,7 +175,7 @@
std::string oldest_key;
base::Time oldest_mod_time = base::Time::Max();
for (const auto& iter : dict->DictItems()) {
- base::Optional<AvailabilityProberCacheEntry> entry =
+ absl::optional<AvailabilityProberCacheEntry> entry =
DecodeCacheEntryValue(iter.second);
if (!entry.has_value()) {
// Also remove anything that can't be decoded.
@@ -359,7 +359,7 @@
base::Value* cache_entry =
cached_probe_results_->FindKey(GetCacheKeyForCurrentNetwork());
if (cache_entry) {
- base::Optional<AvailabilityProberCacheEntry> entry =
+ absl::optional<AvailabilityProberCacheEntry> entry =
DecodeCacheEntryValue(*cache_entry);
if (entry.has_value()) {
base::BooleanHistogram::FactoryGet(
@@ -373,7 +373,7 @@
}
void AvailabilityProber::ResetState() {
- time_when_set_active_ = base::nullopt;
+ time_when_set_active_ = absl::nullopt;
successive_retry_count_ = 0;
successive_timeout_count_ = 0;
retry_timer_.reset();
@@ -606,18 +606,18 @@
OnProbingEnd();
}
-base::Optional<bool> AvailabilityProber::LastProbeWasSuccessful() {
+absl::optional<bool> AvailabilityProber::LastProbeWasSuccessful() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
base::Value* cache_entry =
cached_probe_results_->FindKey(GetCacheKeyForCurrentNetwork());
if (!cache_entry)
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<AvailabilityProberCacheEntry> entry =
+ absl::optional<AvailabilityProberCacheEntry> entry =
DecodeCacheEntryValue(*cache_entry);
if (!entry.has_value())
- return base::nullopt;
+ return absl::nullopt;
base::TimeDelta cache_entry_age =
clock_->Now() - LastModifiedTimeFromCacheEntry(entry.value());
@@ -660,7 +660,7 @@
entry.set_last_modified(
clock_->Now().ToDeltaSinceWindowsEpoch().InMicroseconds());
- base::Optional<base::Value> encoded = EncodeCacheEntryValue(entry);
+ absl::optional<base::Value> encoded = EncodeCacheEntryValue(entry);
if (!encoded.has_value()) {
NOTREACHED();
return;
diff --git a/chrome/browser/availability/availability_prober.h b/chrome/browser/availability/availability_prober.h
index 6b8a4f1..6f5f258 100644
--- a/chrome/browser/availability/availability_prober.h
+++ b/chrome/browser/availability/availability_prober.h
@@ -14,7 +14,6 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/clock.h"
#include "base/time/tick_clock.h"
@@ -27,6 +26,7 @@
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/network_connection_tracker.h"
#include "services/network/public/mojom/url_response_head.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#if defined(OS_ANDROID)
@@ -182,7 +182,7 @@
// Returns the successfulness of the last probe, if there was one. If the last
// probe status was cached and needs to be revalidated, this may activate the
// prober.
- base::Optional<bool> LastProbeWasSuccessful();
+ absl::optional<bool> LastProbeWasSuccessful();
// True if probes are being attempted, including retries.
bool is_active() const { return time_when_set_active_.has_value(); }
@@ -305,7 +305,7 @@
const base::Clock* clock_;
// Remembers the last time the prober became active.
- base::Optional<base::Time> time_when_set_active_;
+ absl::optional<base::Time> time_when_set_active_;
// This reference is kept around for unregistering |this| as an observer on
// any thread.
diff --git a/chrome/browser/availability/availability_prober_unittest.cc b/chrome/browser/availability/availability_prober_unittest.cc
index df07c69..217b5800 100644
--- a/chrome/browser/availability/availability_prober_unittest.cc
+++ b/chrome/browser/availability/availability_prober_unittest.cc
@@ -195,7 +195,7 @@
void OnProbeComplete(bool success) { callback_result_ = success; }
- base::Optional<bool> callback_result() { return callback_result_; }
+ absl::optional<bool> callback_result() { return callback_result_; }
private:
content::BrowserTaskEnvironment task_environment_;
@@ -203,14 +203,14 @@
scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_;
TestDelegate test_delegate_;
TestingPrefServiceSimple test_prefs_;
- base::Optional<bool> callback_result_;
+ absl::optional<bool> callback_result_;
const GURL kTestUrl{"https://test.com"};
};
TEST_F(AvailabilityProberTest, OK) {
base::HistogramTester histogram_tester;
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -238,7 +238,7 @@
TEST_F(AvailabilityProberTest, OK_Callback) {
base::HistogramTester histogram_tester;
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -264,7 +264,7 @@
TEST_F(AvailabilityProberTest, MultipleStart) {
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
// Calling |SendNowIfInactive| many times should result in only one url
// request, which is verified in |VerifyRequest|.
@@ -276,7 +276,7 @@
TEST_F(AvailabilityProberTest, NetworkChangeStartsProber) {
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
EXPECT_FALSE(prober->is_active());
network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType(
@@ -292,7 +292,7 @@
RunUntilIdle();
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -315,7 +315,7 @@
network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType(
network::mojom::ConnectionType::CONNECTION_WIFI);
RunUntilIdle();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
}
TEST_F(AvailabilityProberTest, CacheMaxSize) {
@@ -324,7 +324,7 @@
RunUntilIdle();
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -340,7 +340,7 @@
network::mojom::ConnectionType::CONNECTION_WIFI);
RunUntilIdle();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -355,12 +355,12 @@
network::mojom::ConnectionType::CONNECTION_3G);
RunUntilIdle();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
}
TEST_F(AvailabilityProberTest, CacheAutoRevalidation) {
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -383,7 +383,7 @@
TEST_F(AvailabilityProberTest, PersistentCache) {
base::HistogramTester histogram_tester;
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -418,7 +418,7 @@
#if defined(OS_ANDROID)
TEST_F(AvailabilityProberTest, StartInForeground) {
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
EXPECT_FALSE(prober->is_active());
prober->SendNowIfInactive(true);
@@ -427,7 +427,7 @@
TEST_F(AvailabilityProberTest, DoesntCallSendInForegroundIfInactive) {
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
EXPECT_FALSE(prober->is_active());
base::android::ApplicationStatusListener::NotifyApplicationStateChange(
@@ -439,7 +439,7 @@
TEST_F(AvailabilityProberTest, NetError) {
base::HistogramTester histogram_tester;
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -462,7 +462,7 @@
TEST_F(AvailabilityProberTest, NetError_Callback) {
base::HistogramTester histogram_tester;
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -488,7 +488,7 @@
TEST_F(AvailabilityProberTest, HttpError) {
base::HistogramTester histogram_tester;
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -512,7 +512,7 @@
TEST_F(AvailabilityProberTest, TimeUntilSuccess) {
base::HistogramTester histogram_tester;
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -538,7 +538,7 @@
std::unique_ptr<AvailabilityProber> prober =
NewProberWithRetryPolicy(retry_policy);
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -563,7 +563,7 @@
std::unique_ptr<AvailabilityProber> prober =
NewProberWithRetryPolicy(retry_policy);
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest(true /* expect_random_guid */);
@@ -582,7 +582,7 @@
std::unique_ptr<AvailabilityProber> prober =
NewProberWithRetryPolicy(retry_policy);
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -642,7 +642,7 @@
std::unique_ptr<AvailabilityProber> prober =
NewProberWithRetryPolicy(retry_policy);
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -710,7 +710,7 @@
std::unique_ptr<AvailabilityProber> prober =
NewProberWithRetryPolicy(retry_policy);
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -757,7 +757,7 @@
std::unique_ptr<AvailabilityProber> prober =
NewProberWithPolicies(retry_policy, timeout_policy);
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
// First attempt.
prober->SendNowIfInactive(false);
@@ -802,7 +802,7 @@
std::unique_ptr<AvailabilityProber> prober =
NewProberWithPolicies(retry_policy, timeout_policy);
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
// First attempt.
prober->SendNowIfInactive(false);
@@ -847,10 +847,10 @@
std::unique_ptr<AvailabilityProber> prober = NewProberWithPoliciesAndDelegate(
&delegate, retry_policy, AvailabilityProber::TimeoutPolicy());
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
EXPECT_FALSE(prober->is_active());
VerifyNoRequests();
@@ -870,7 +870,7 @@
std::unique_ptr<AvailabilityProber> prober = NewProberWithPoliciesAndDelegate(
&delegate, retry_policy, AvailabilityProber::TimeoutPolicy());
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -893,7 +893,7 @@
base::HistogramTester histogram_tester;
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->SendNowIfInactive(false);
VerifyRequest();
@@ -919,7 +919,7 @@
base::HistogramTester histogram_tester;
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
prober->RepeatedlyProbe(base::TimeDelta::FromSeconds(1), false);
VerifyRequest();
@@ -939,7 +939,7 @@
TEST_F(AvailabilityProberTest, ReportExternalFailure_WhileIdle) {
base::HistogramTester histogram_tester;
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
EXPECT_FALSE(prober->is_active());
prober->ReportExternalFailureAndRetry();
@@ -964,11 +964,11 @@
TEST_F(AvailabilityProberTest, ReportExternalFailure_WhileActive) {
base::HistogramTester histogram_tester;
std::unique_ptr<AvailabilityProber> prober = NewProber();
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
EXPECT_FALSE(prober->is_active());
prober->SendNowIfInactive(false);
- EXPECT_EQ(prober->LastProbeWasSuccessful(), base::nullopt);
+ EXPECT_EQ(prober->LastProbeWasSuccessful(), absl::nullopt);
EXPECT_TRUE(prober->is_active());
VerifyRequest();
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc
index 3e47cc54..74978a33 100644
--- a/chrome/browser/background/background_contents_service.cc
+++ b/chrome/browser/background/background_contents_service.cc
@@ -92,8 +92,8 @@
is_platform_app_(extension->is_platform_app()),
extension_id_(extension->id()) {}
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
// Pass arguments by value as HandleClick() might destroy *this.
HandleClick(is_hosted_app_, is_platform_app_, extension_id_, profile_);
// *this might be destroyed now, do not access any members anymore!
diff --git a/chrome/browser/background/background_mode_manager.h b/chrome/browser/background/background_mode_manager.h
index 8c1087e..2b03e5a 100644
--- a/chrome/browser/background/background_mode_manager.h
+++ b/chrome/browser/background/background_mode_manager.h
@@ -469,7 +469,7 @@
// Set to true when background mode is suspended.
bool background_mode_suspended_ = false;
- base::Optional<bool> launch_on_startup_enabled_;
+ absl::optional<bool> launch_on_startup_enabled_;
// Task runner for making startup/login configuration changes that may
// require file system or registry access.
diff --git a/chrome/browser/background/background_mode_manager_unittest.cc b/chrome/browser/background/background_mode_manager_unittest.cc
index c36c931b..423f01c5 100644
--- a/chrome/browser/background/background_mode_manager_unittest.cc
+++ b/chrome/browser/background/background_mode_manager_unittest.cc
@@ -207,7 +207,7 @@
profile_manager_ = CreateTestingProfileManager();
profile_ = profile_manager_->CreateTestingProfile(
"p1", nullptr, u"p1", 0, "", TestingProfile::TestingFactories(),
- base::nullopt, std::move(policy_service));
+ absl::nullopt, std::move(policy_service));
}
protected:
diff --git a/chrome/browser/background_fetch/background_fetch_browsertest.cc b/chrome/browser/background_fetch/background_fetch_browsertest.cc
index 0addcb5..79946561 100644
--- a/chrome/browser/background_fetch/background_fetch_browsertest.cc
+++ b/chrome/browser/background_fetch/background_fetch_browsertest.cc
@@ -180,7 +180,7 @@
void OnItemRemoved(const ContentId& id) override {}
void OnItemUpdated(
const OfflineItem& item,
- const base::Optional<offline_items_collection::UpdateDelta>& update_delta)
+ const absl::optional<offline_items_collection::UpdateDelta>& update_delta)
override {
if (item.state != offline_items_collection::OfflineItemState::IN_PROGRESS &&
item.state != offline_items_collection::OfflineItemState::PENDING &&
diff --git a/chrome/browser/background_fetch/background_fetch_delegate_impl.cc b/chrome/browser/background_fetch/background_fetch_delegate_impl.cc
index 869758ab..482b1ca 100644
--- a/chrome/browser/background_fetch/background_fetch_delegate_impl.cc
+++ b/chrome/browser/background_fetch/background_fetch_delegate_impl.cc
@@ -72,8 +72,8 @@
void BackgroundFetchDelegateImpl::UpdateUI(
const std::string& job_id,
- const base::Optional<std::string>& title,
- const base::Optional<SkBitmap>& icon) {
+ const absl::optional<std::string>& title,
+ const absl::optional<SkBitmap>& icon) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(title || icon); // One of the UI options must be updatable.
DCHECK(!icon || !icon->isNull()); // The |icon|, if provided, is not null.
@@ -148,7 +148,7 @@
const offline_items_collection::ContentId& id,
SingleItemCallback callback) {
auto iter = ui_state_map_.find(id.id);
- base::Optional<offline_items_collection::OfflineItem> offline_item;
+ absl::optional<offline_items_collection::OfflineItem> offline_item;
if (iter != ui_state_map_.end())
offline_item = iter->second.offline_item;
base::ThreadTaskRunnerHandle::Get()->PostTask(
@@ -210,7 +210,7 @@
void BackgroundFetchDelegateImpl::ChangeSchedule(
const offline_items_collection::ContentId& id,
- base::Optional<offline_items_collection::OfflineItemSchedule> schedule) {
+ absl::optional<offline_items_collection::OfflineItemSchedule> schedule) {
NOTIMPLEMENTED();
}
@@ -337,7 +337,7 @@
void BackgroundFetchDelegateImpl::DidGetBackgroundSourceId(
bool user_initiated_abort,
- base::Optional<ukm::SourceId> source_id) {
+ absl::optional<ukm::SourceId> source_id) {
// This background event did not meet the requirements for the UKM service.
if (!source_id)
return;
diff --git a/chrome/browser/background_fetch/background_fetch_delegate_impl.h b/chrome/browser/background_fetch/background_fetch_delegate_impl.h
index 31d1bd4..6f6a723 100644
--- a/chrome/browser/background_fetch/background_fetch_delegate_impl.h
+++ b/chrome/browser/background_fetch/background_fetch_delegate_impl.h
@@ -43,8 +43,8 @@
// BackgroundFetchDelegate implementation:
void MarkJobComplete(const std::string& job_id) override;
void UpdateUI(const std::string& job_unique_id,
- const base::Optional<std::string>& title,
- const base::Optional<SkBitmap>& icon) override;
+ const absl::optional<std::string>& title,
+ const absl::optional<SkBitmap>& icon) override;
// OfflineContentProvider implementation:
void OpenItem(const offline_items_collection::OpenParams& open_params,
@@ -67,7 +67,7 @@
RenameCallback callback) override;
void ChangeSchedule(
const offline_items_collection::ContentId& id,
- base::Optional<offline_items_collection::OfflineItemSchedule> schedule)
+ absl::optional<offline_items_collection::OfflineItemSchedule> schedule)
override;
protected:
@@ -93,7 +93,7 @@
~UiState();
offline_items_collection::OfflineItem offline_item;
- base::Optional<offline_items_collection::UpdateDelta> update_delta;
+ absl::optional<offline_items_collection::UpdateDelta> update_delta;
};
// Updates the entry in |ui_state_map_| based on the corresponding JobDetails
@@ -107,7 +107,7 @@
const url::Origin& origin,
bool user_initiated_abort);
void DidGetBackgroundSourceId(bool user_initiated_abort,
- base::Optional<ukm::SourceId> source_id);
+ absl::optional<ukm::SourceId> source_id);
// The profile this service is being created for.
Profile* profile_;
diff --git a/chrome/browser/background_sync/background_sync_delegate_impl.cc b/chrome/browser/background_sync/background_sync_delegate_impl.cc
index 51ff1db..e078f4ae 100644
--- a/chrome/browser/background_sync/background_sync_delegate_impl.cc
+++ b/chrome/browser/background_sync/background_sync_delegate_impl.cc
@@ -64,7 +64,7 @@
void BackgroundSyncDelegateImpl::GetUkmSourceId(
const url::Origin& origin,
- base::OnceCallback<void(base::Optional<ukm::SourceId>)> callback) {
+ base::OnceCallback<void(absl::optional<ukm::SourceId>)> callback) {
ukm_background_service_->GetBackgroundSourceIdIfAllowed(origin,
std::move(callback));
}
diff --git a/chrome/browser/background_sync/background_sync_delegate_impl.h b/chrome/browser/background_sync/background_sync_delegate_impl.h
index 48f12910..eef61ec 100644
--- a/chrome/browser/background_sync/background_sync_delegate_impl.h
+++ b/chrome/browser/background_sync/background_sync_delegate_impl.h
@@ -60,7 +60,7 @@
#endif
void GetUkmSourceId(const url::Origin& origin,
- base::OnceCallback<void(base::Optional<ukm::SourceId>)>
+ base::OnceCallback<void(absl::optional<ukm::SourceId>)>
callback) override;
void Shutdown() override;
HostContentSettingsMap* GetHostContentSettingsMap() override;
diff --git a/chrome/browser/badging/badge_manager.cc b/chrome/browser/badging/badge_manager.cc
index efde6190..f24512773 100644
--- a/chrome/browser/badging/badge_manager.cc
+++ b/chrome/browser/badging/badge_manager.cc
@@ -123,11 +123,11 @@
std::move(context));
}
-base::Optional<BadgeManager::BadgeValue> BadgeManager::GetBadgeValue(
+absl::optional<BadgeManager::BadgeValue> BadgeManager::GetBadgeValue(
const web_app::AppId& app_id) {
const auto& it = badged_apps_.find(app_id);
if (it == badged_apps_.end())
- return base::nullopt;
+ return absl::nullopt;
return it->second;
}
@@ -141,7 +141,7 @@
BadgeValue value,
ukm::UkmRecorder* test_recorder) {
ukm::SourceId source_id = ukm::UkmRecorder::GetNewSourceID();
- if (value == base::nullopt) {
+ if (value == absl::nullopt) {
ukm::builders::Badging(source_id)
.SetUpdateAppBadge(kSetFlagBadge)
.Record(test_recorder);
@@ -159,7 +159,7 @@
ukm::builders::Badging(source_id)
.SetUpdateAppBadge(kClearBadge)
.Record(test_recorder);
- UpdateBadge(app_id, base::nullopt);
+ UpdateBadge(app_id, absl::nullopt);
}
const base::Clock* BadgeManager::SetClockForTesting(const base::Clock* clock) {
@@ -169,7 +169,7 @@
}
void BadgeManager::UpdateBadge(const web_app::AppId& app_id,
- base::Optional<BadgeValue> value) {
+ absl::optional<BadgeValue> value) {
UpdateBadgingTime(clock_, profile_, app_id);
if (!value)
@@ -196,8 +196,8 @@
// Convert the mojo badge representation into a BadgeManager::BadgeValue.
BadgeValue value = mojo_value->is_flag()
- ? base::nullopt
- : base::make_optional(mojo_value->get_number());
+ ? absl::nullopt
+ : absl::make_optional(mojo_value->get_number());
// ukm::SourceId source_id = ukm::UkmRecorder::GetNewSourceID();
ukm::UkmRecorder* recorder = ukm::UkmRecorder::Get();
@@ -206,7 +206,7 @@
// The app's start_url is used to identify the app
// for recording badging usage per app.
ukm::SourceId source_id = ukm::AppSourceUrlRecorder::GetSourceIdForPWA(url);
- if (value == base::nullopt) {
+ if (value == absl::nullopt) {
ukm::builders::Badging(source_id)
.SetUpdateAppBadge(kSetFlagBadge)
.Record(recorder);
@@ -216,7 +216,7 @@
.Record(recorder);
}
- UpdateBadge(/*app_id=*/std::get<0>(app), base::make_optional(value));
+ UpdateBadge(/*app_id=*/std::get<0>(app), absl::make_optional(value));
}
}
@@ -233,7 +233,7 @@
ukm::builders::Badging(source_id)
.SetUpdateAppBadge(kClearBadge)
.Record(recorder);
- UpdateBadge(/*app_id=*/std::get<0>(app), base::nullopt);
+ UpdateBadge(/*app_id=*/std::get<0>(app), absl::nullopt);
}
}
@@ -256,7 +256,7 @@
return std::vector<std::tuple<web_app::AppId, GURL>>{};
const web_app::AppRegistrar& registrar = provider->registrar();
- const base::Optional<web_app::AppId> app_id =
+ const absl::optional<web_app::AppId> app_id =
registrar.FindAppWithUrlInScope(frame->GetLastCommittedURL());
if (!app_id)
return std::vector<std::tuple<web_app::AppId, GURL>>{};
@@ -287,7 +287,7 @@
return app_ids_urls;
}
-std::string GetBadgeString(base::Optional<uint64_t> badge_content) {
+std::string GetBadgeString(absl::optional<uint64_t> badge_content) {
if (!badge_content)
return "•";
diff --git a/chrome/browser/badging/badge_manager.h b/chrome/browser/badging/badge_manager.h
index 5322212..99c1bed 100644
--- a/chrome/browser/badging/badge_manager.h
+++ b/chrome/browser/badging/badge_manager.h
@@ -11,11 +11,11 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "components/keyed_service/core/keyed_service.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/badging/badging.mojom.h"
#include "url/gurl.h"
@@ -69,9 +69,9 @@
class BadgeManager : public KeyedService, public blink::mojom::BadgeService {
public:
// The badge being applied to a document URL or service worker scope. If the
- // optional is |base::nullopt| then the badge is "flag". Otherwise the badge
+ // optional is |absl::nullopt| then the badge is "flag". Otherwise the badge
// is a non-zero integer.
- using BadgeValue = base::Optional<uint64_t>;
+ using BadgeValue = absl::optional<uint64_t>;
explicit BadgeManager(Profile* profile);
~BadgeManager() override;
@@ -91,9 +91,9 @@
const GURL& service_worker_scope,
mojo::PendingReceiver<blink::mojom::BadgeService> receiver);
- // Gets the badge for |app_id|. This will be base::nullopt if the app is not
+ // Gets the badge for |app_id|. This will be absl::nullopt if the app is not
// badged.
- base::Optional<BadgeValue> GetBadgeValue(const web_app::AppId& app_id);
+ absl::optional<BadgeValue> GetBadgeValue(const web_app::AppId& app_id);
bool HasRecentApiUsage(const web_app::AppId& app_id) const;
@@ -154,10 +154,10 @@
GURL scope_;
};
- // Updates the badge for |app_id| to be |value|, if it is not base::nullopt.
- // If value is |base::nullopt| then this clears the badge.
+ // Updates the badge for |app_id| to be |value|, if it is not absl::nullopt.
+ // If value is |absl::nullopt| then this clears the badge.
void UpdateBadge(const web_app::AppId& app_id,
- base::Optional<BadgeValue> value);
+ absl::optional<BadgeValue> value);
// blink::mojom::BadgeService:
// Note: These are private to stop them being called outside of mojo as they
diff --git a/chrome/browser/badging/badge_manager_delegate.h b/chrome/browser/badging/badge_manager_delegate.h
index 3c6d293..39675bf7 100644
--- a/chrome/browser/badging/badge_manager_delegate.h
+++ b/chrome/browser/badging/badge_manager_delegate.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_BADGING_BADGE_MANAGER_DELEGATE_H_
#define CHROME_BROWSER_BADGING_BADGE_MANAGER_DELEGATE_H_
-#include "base/optional.h"
#include "chrome/browser/badging/badge_manager.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class Profile;
diff --git a/chrome/browser/badging/badge_manager_delegate_mac.cc b/chrome/browser/badging/badge_manager_delegate_mac.cc
index 85e3c46..13a0688 100644
--- a/chrome/browser/badging/badge_manager_delegate_mac.cc
+++ b/chrome/browser/badging/badge_manager_delegate_mac.cc
@@ -19,7 +19,7 @@
: BadgeManagerDelegate(profile, badge_manager) {}
void BadgeManagerDelegateMac::OnAppBadgeUpdated(const web_app::AppId& app_id) {
- const base::Optional<BadgeManager::BadgeValue>& badge =
+ const absl::optional<BadgeManager::BadgeValue>& badge =
badge_manager()->GetBadgeValue(app_id);
SetAppBadgeLabel(app_id, badge ? badging::GetBadgeString(badge.value()) : "");
}
diff --git a/chrome/browser/badging/badge_manager_delegate_mac.h b/chrome/browser/badging/badge_manager_delegate_mac.h
index b9d342ca..4408a342 100644
--- a/chrome/browser/badging/badge_manager_delegate_mac.h
+++ b/chrome/browser/badging/badge_manager_delegate_mac.h
@@ -7,8 +7,8 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/badging/badge_manager_delegate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
diff --git a/chrome/browser/badging/badge_manager_delegate_win.cc b/chrome/browser/badging/badge_manager_delegate_win.cc
index ab1060a..70911d1 100644
--- a/chrome/browser/badging/badge_manager_delegate_win.cc
+++ b/chrome/browser/badging/badge_manager_delegate_win.cc
@@ -20,14 +20,14 @@
namespace {
// Determines the badge contents and alt text.
-// base::nullopt if the badge is not set.
+// absl::nullopt if the badge is not set.
// otherwise a pair (badge_content, badge_alt_text), based on the content of the
// badge.
-base::Optional<std::pair<std::string, std::string>> GetBadgeContentAndAlt(
- const base::Optional<BadgeManager::BadgeValue>& badge) {
+absl::optional<std::pair<std::string, std::string>> GetBadgeContentAndAlt(
+ const absl::optional<BadgeManager::BadgeValue>& badge) {
// If there is no badge, there is no contents or alt text.
if (!badge)
- return base::nullopt;
+ return absl::nullopt;
std::string badge_string = badging::GetBadgeString(badge.value());
// There are 3 different cases when the badge has a value:
diff --git a/chrome/browser/badging/badge_manager_delegate_win.h b/chrome/browser/badging/badge_manager_delegate_win.h
index 76bb448..149c518 100644
--- a/chrome/browser/badging/badge_manager_delegate_win.h
+++ b/chrome/browser/badging/badge_manager_delegate_win.h
@@ -7,9 +7,9 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/badging/badge_manager_delegate.h"
#include "chrome/browser/ui/browser.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
diff --git a/chrome/browser/badging/badge_manager_unittest.cc b/chrome/browser/badging/badge_manager_unittest.cc
index 7cd5101..7acd00f 100644
--- a/chrome/browser/badging/badge_manager_unittest.cc
+++ b/chrome/browser/badging/badge_manager_unittest.cc
@@ -9,7 +9,6 @@
#include <vector>
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/test/bind.h"
#include "chrome/browser/badging/badge_manager_delegate.h"
#include "chrome/browser/badging/badge_manager_factory.h"
@@ -26,6 +25,7 @@
#include "extensions/common/extension_id.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
using badging::BadgeManager;
@@ -34,7 +34,7 @@
namespace {
-typedef std::pair<GURL, base::Optional<int>> SetBadgeAction;
+typedef std::pair<GURL, absl::optional<int>> SetBadgeAction;
constexpr uint64_t kBadgeContents = 1;
const web_app::AppId kAppId = "1";
@@ -115,7 +115,7 @@
TEST_F(BadgeManagerUnittest, SetFlagBadgeForApp) {
ukm::TestUkmRecorder test_recorder;
- badge_manager()->SetBadgeForTesting(kAppId, base::nullopt, &test_recorder);
+ badge_manager()->SetBadgeForTesting(kAppId, absl::nullopt, &test_recorder);
auto entries =
test_recorder.GetEntriesByName(ukm::builders::Badging::kEntryName);
@@ -125,13 +125,13 @@
EXPECT_EQ(1UL, delegate()->set_badges().size());
EXPECT_EQ(kAppId, delegate()->set_badges().front().first);
- EXPECT_EQ(base::nullopt, delegate()->set_badges().front().second);
+ EXPECT_EQ(absl::nullopt, delegate()->set_badges().front().second);
}
TEST_F(BadgeManagerUnittest, SetBadgeForApp) {
ukm::TestUkmRecorder test_recorder;
badge_manager()->SetBadgeForTesting(
- kAppId, base::make_optional(kBadgeContents), &test_recorder);
+ kAppId, absl::make_optional(kBadgeContents), &test_recorder);
auto entries =
test_recorder.GetEntriesByName(ukm::builders::Badging::kEntryName);
ASSERT_EQ(entries.size(), 1u);
@@ -148,9 +148,9 @@
constexpr uint64_t kOtherContents = 2;
badge_manager()->SetBadgeForTesting(
- kAppId, base::make_optional(kBadgeContents), ukm::TestUkmRecorder::Get());
+ kAppId, absl::make_optional(kBadgeContents), ukm::TestUkmRecorder::Get());
badge_manager()->SetBadgeForTesting(kOtherAppId,
- base::make_optional(kOtherContents),
+ absl::make_optional(kOtherContents),
ukm::TestUkmRecorder::Get());
EXPECT_EQ(2UL, delegate()->set_badges().size());
@@ -168,10 +168,10 @@
TEST_F(BadgeManagerUnittest, SetBadgeForAppAfterClear) {
badge_manager()->SetBadgeForTesting(
- kAppId, base::make_optional(kBadgeContents), ukm::TestUkmRecorder::Get());
+ kAppId, absl::make_optional(kBadgeContents), ukm::TestUkmRecorder::Get());
badge_manager()->ClearBadgeForTesting(kAppId, ukm::TestUkmRecorder::Get());
badge_manager()->SetBadgeForTesting(
- kAppId, base::make_optional(kBadgeContents), ukm::TestUkmRecorder::Get());
+ kAppId, absl::make_optional(kBadgeContents), ukm::TestUkmRecorder::Get());
EXPECT_EQ(2UL, delegate()->set_badges().size());
@@ -186,7 +186,7 @@
ukm::TestUkmRecorder test_recorder;
badge_manager()->SetBadgeForTesting(
- kAppId, base::make_optional(kBadgeContents), ukm::TestUkmRecorder::Get());
+ kAppId, absl::make_optional(kBadgeContents), ukm::TestUkmRecorder::Get());
badge_manager()->ClearBadgeForTesting(kAppId, &test_recorder);
auto entries =
test_recorder.GetEntriesByName(ukm::builders::Badging::kEntryName);
@@ -209,11 +209,11 @@
auto* other_delegate = owned_other_delegate.get();
other_badge_manager->SetDelegate(std::move(owned_other_delegate));
- other_badge_manager->SetBadgeForTesting(kAppId, base::nullopt,
+ other_badge_manager->SetBadgeForTesting(kAppId, absl::nullopt,
ukm::TestUkmRecorder::Get());
other_badge_manager->SetBadgeForTesting(
- kAppId, base::make_optional(kBadgeContents), ukm::TestUkmRecorder::Get());
- other_badge_manager->SetBadgeForTesting(kAppId, base::nullopt,
+ kAppId, absl::make_optional(kBadgeContents), ukm::TestUkmRecorder::Get());
+ other_badge_manager->SetBadgeForTesting(kAppId, absl::nullopt,
ukm::TestUkmRecorder::Get());
other_badge_manager->ClearBadgeForTesting(kAppId,
ukm::TestUkmRecorder::Get());
@@ -227,7 +227,7 @@
EXPECT_EQ(1UL, delegate()->cleared_badges().size());
EXPECT_EQ(kAppId, other_delegate->set_badges().back().first);
- EXPECT_EQ(base::nullopt, other_delegate->set_badges().back().second);
+ EXPECT_EQ(absl::nullopt, other_delegate->set_badges().back().second);
EXPECT_EQ(1UL, updated_apps().size());
EXPECT_EQ(kAppId, updated_apps()[0]);
@@ -243,10 +243,10 @@
TEST_F(BadgeManagerUnittest, BadgingWithNoDelegateDoesNotCrash) {
badge_manager()->SetDelegate(nullptr);
- badge_manager()->SetBadgeForTesting(kAppId, base::nullopt,
+ badge_manager()->SetBadgeForTesting(kAppId, absl::nullopt,
ukm::TestUkmRecorder::Get());
badge_manager()->SetBadgeForTesting(
- kAppId, base::make_optional(kBadgeContents), ukm::TestUkmRecorder::Get());
+ kAppId, absl::make_optional(kBadgeContents), ukm::TestUkmRecorder::Get());
badge_manager()->ClearBadgeForTesting(kAppId, ukm::TestUkmRecorder::Get());
}
diff --git a/chrome/browser/badging/test_badge_manager_delegate.h b/chrome/browser/badging/test_badge_manager_delegate.h
index b0b89fce..df310ec 100644
--- a/chrome/browser/badging/test_badge_manager_delegate.h
+++ b/chrome/browser/badging/test_badge_manager_delegate.h
@@ -8,10 +8,10 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/badging/badge_manager.h"
#include "chrome/browser/badging/badge_manager_delegate.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
diff --git a/chrome/browser/banners/app_banner_manager_browsertest.cc b/chrome/browser/banners/app_banner_manager_browsertest.cc
index 52a253f..bd42e91 100644
--- a/chrome/browser/banners/app_banner_manager_browsertest.cc
+++ b/chrome/browser/banners/app_banner_manager_browsertest.cc
@@ -11,7 +11,6 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
@@ -32,6 +31,7 @@
#include "components/webapps/browser/installable/installable_metrics.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace webapps {
@@ -188,7 +188,7 @@
Browser* browser,
AppBannerManagerTest* manager,
const GURL& url,
- base::Optional<InstallableStatusCode> expected_code_for_histogram) {
+ absl::optional<InstallableStatusCode> expected_code_for_histogram) {
base::HistogramTester histograms;
site_engagement::SiteEngagementService* service =
@@ -244,7 +244,7 @@
AppBannerManagerTest* manager,
base::OnceClosure trigger_task,
bool expected_will_show,
- base::Optional<State> expected_state) {
+ absl::optional<State> expected_state) {
base::RunLoop run_loop;
manager->clear_will_show();
manager->PrepareDone(run_loop.QuitClosure());
@@ -266,7 +266,7 @@
CreateAppBannerManager(browser()));
RunBannerTest(browser(), manager.get(),
GetBannerURLWithManifest("/banners/manifest_no_type.json"),
- base::nullopt);
+ absl::nullopt);
}
IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest,
@@ -275,7 +275,7 @@
CreateAppBannerManager(browser()));
RunBannerTest(browser(), manager.get(),
GetBannerURLWithManifest("/banners/manifest_no_type_caps.json"),
- base::nullopt);
+ absl::nullopt);
}
IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerSvgIcon) {
@@ -283,7 +283,7 @@
CreateAppBannerManager(browser()));
RunBannerTest(browser(), manager.get(),
GetBannerURLWithManifest("/banners/manifest_svg_icon.json"),
- base::nullopt);
+ absl::nullopt);
}
IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest, WebAppBannerWebPIcon) {
@@ -291,7 +291,7 @@
CreateAppBannerManager(browser()));
RunBannerTest(browser(), manager.get(),
GetBannerURLWithManifest("/banners/manifest_webp_icon.json"),
- base::nullopt);
+ absl::nullopt);
}
IN_PROC_BROWSER_TEST_F(AppBannerManagerBrowserTest,
@@ -321,7 +321,7 @@
RunBannerTest(
browser(), manager.get(),
embedded_test_server()->GetURL("/banners/manifest_test_page.html"),
- base::nullopt);
+ absl::nullopt);
EXPECT_EQ(manager->state(), AppBannerManager::State::PENDING_PROMPT);
// Dynamically remove the manifest.
@@ -347,7 +347,7 @@
RunBannerTest(
browser(), manager.get(),
embedded_test_server()->GetURL("/banners/manifest_test_page.html"),
- base::nullopt);
+ absl::nullopt);
EXPECT_EQ(manager->state(), AppBannerManager::State::PENDING_PROMPT);
// Dynamically change the manifest, which results in a
@@ -362,7 +362,7 @@
browser()->tab_strip_model()->GetActiveWebContents(),
"addManifestLinkTag('/banners/manifest_one_icon.json')"));
}),
- false, base::nullopt);
+ false, absl::nullopt);
histograms.ExpectTotalCount(kInstallableStatusCodeHistogram, 1);
histograms.ExpectUniqueSample(kInstallableStatusCodeHistogram,
RENDERER_CANCELLED, 1);
diff --git a/chrome/browser/banners/app_banner_manager_desktop.cc b/chrome/browser/banners/app_banner_manager_desktop.cc
index 5c29b31..e23d7876 100644
--- a/chrome/browser/banners/app_banner_manager_desktop.cc
+++ b/chrome/browser/banners/app_banner_manager_desktop.cc
@@ -10,7 +10,6 @@
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
@@ -24,6 +23,7 @@
#include "components/webapps/browser/banners/app_banner_settings_helper.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
@@ -194,7 +194,7 @@
void AppBannerManagerDesktop::OnWebAppInstalled(
const web_app::AppId& installed_app_id) {
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
registrar().FindAppWithUrlInScope(validated_url_);
if (app_id.has_value() && *app_id == installed_app_id &&
registrar().GetAppUserDisplayMode(*app_id) ==
diff --git a/chrome/browser/banners/test_app_banner_manager_desktop.h b/chrome/browser/banners/test_app_banner_manager_desktop.h
index e4fe41a..bfa4247 100644
--- a/chrome/browser/banners/test_app_banner_manager_desktop.h
+++ b/chrome/browser/banners/test_app_banner_manager_desktop.h
@@ -8,7 +8,7 @@
#include "chrome/browser/banners/app_banner_manager_desktop.h"
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -69,7 +69,7 @@
void SetInstallable(bool installable);
void OnFinished();
- base::Optional<bool> installable_;
+ absl::optional<bool> installable_;
base::OnceClosure tear_down_quit_closure_;
base::OnceClosure installable_quit_closure_;
base::OnceClosure on_done_;
diff --git a/chrome/browser/battery/battery_metrics.cc b/chrome/browser/battery/battery_metrics.cc
index a53621b..489fb1f 100644
--- a/chrome/browser/battery/battery_metrics.cc
+++ b/chrome/browser/battery/battery_metrics.cc
@@ -69,7 +69,7 @@
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (battery_status.charging) {
// If the battery charges, drop the stored battery level.
- last_recorded_battery_level_ = base::nullopt;
+ last_recorded_battery_level_ = absl::nullopt;
return;
}
diff --git a/chrome/browser/battery/battery_metrics.h b/chrome/browser/battery/battery_metrics.h
index cd496f9..21a434e 100644
--- a/chrome/browser/battery/battery_metrics.h
+++ b/chrome/browser/battery/battery_metrics.h
@@ -8,13 +8,13 @@
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "build/build_config.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/device/public/mojom/battery_monitor.mojom.h"
#include "services/device/public/mojom/battery_status.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Records metrics around battery usage on all platforms. Connects to
// Battery monitor via mojo.
@@ -45,7 +45,7 @@
// The battery level at the last time the battery level was recorded. This
// value is updated by the amount of battery drop reported, so may be
// different from the last update by .01.
- base::Optional<float> last_recorded_battery_level_;
+ absl::optional<float> last_recorded_battery_level_;
// The battery monitor backend for the device Chrome is running on.
mojo::Remote<device::mojom::BatteryMonitor> battery_monitor_;
diff --git a/chrome/browser/bluetooth/bluetooth_chooser_context_unittest.cc b/chrome/browser/bluetooth/bluetooth_chooser_context_unittest.cc
index dfda525..d4e491f 100644
--- a/chrome/browser/bluetooth/bluetooth_chooser_context_unittest.cc
+++ b/chrome/browser/bluetooth/bluetooth_chooser_context_unittest.cc
@@ -191,7 +191,7 @@
.IsValid());
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
+ absl::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
ContentSettingsType::BLUETOOTH_CHOOSER_DATA));
blink::WebBluetoothDeviceId device_id = context->GrantServiceAccessPermission(
@@ -241,7 +241,7 @@
testing::Mock::VerifyAndClearExpectations(&mock_permission_observer_);
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
+ absl::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
ContentSettingsType::BLUETOOTH_CHOOSER_DATA));
EXPECT_CALL(mock_permission_observer_, OnPermissionRevoked(foo_origin_));
@@ -272,7 +272,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
+ absl::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
ContentSettingsType::BLUETOOTH_CHOOSER_DATA));
blink::WebBluetoothDeviceId device_id = context->GrantServiceAccessPermission(
foo_origin_, fake_device1_.get(), options.get());
@@ -298,7 +298,7 @@
testing::Mock::VerifyAndClearExpectations(&mock_permission_observer_);
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
+ absl::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
ContentSettingsType::BLUETOOTH_CHOOSER_DATA));
blink::WebBluetoothDeviceId incognito_device_id =
incognito_context->GrantServiceAccessPermission(
@@ -356,7 +356,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
+ absl::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
ContentSettingsType::BLUETOOTH_CHOOSER_DATA));
blink::WebBluetoothDeviceId device_id1 =
context->GrantServiceAccessPermission(foo_origin_, fake_device1_.get(),
@@ -376,7 +376,7 @@
testing::Mock::VerifyAndClearExpectations(&mock_permission_observer_);
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
+ absl::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
ContentSettingsType::BLUETOOTH_CHOOSER_DATA));
blink::WebBluetoothDeviceId device_id2 =
context->GrantServiceAccessPermission(foo_origin_, fake_device1_.get(),
@@ -403,7 +403,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
+ absl::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
ContentSettingsType::BLUETOOTH_CHOOSER_DATA));
blink::WebBluetoothDeviceId device_id = context->GrantServiceAccessPermission(
foo_origin_, fake_device1_.get(), options.get());
@@ -432,7 +432,7 @@
CreateOptionsForManufacturerData(optional_manufacturer_data);
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
+ absl::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
ContentSettingsType::BLUETOOTH_CHOOSER_DATA));
blink::WebBluetoothDeviceId device_id =
context->GrantServiceAccessPermission(foo_origin_, fake_device1_.get(),
@@ -453,7 +453,7 @@
CreateOptionsForManufacturerData(optional_manufacturer_data);
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
+ absl::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
ContentSettingsType::BLUETOOTH_CHOOSER_DATA));
blink::WebBluetoothDeviceId device_id =
context->GrantServiceAccessPermission(foo_origin_, fake_device1_.get(),
@@ -487,7 +487,7 @@
BluetoothChooserContext* context = GetChooserContext(profile());
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
+ absl::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
ContentSettingsType::BLUETOOTH_CHOOSER_DATA))
.Times(4);
@@ -535,7 +535,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
+ absl::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
ContentSettingsType::BLUETOOTH_CHOOSER_DATA))
.Times(0);
blink::WebBluetoothDeviceId scanned_id =
@@ -555,7 +555,7 @@
testing::Mock::VerifyAndClearExpectations(&mock_permission_observer_);
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
+ absl::make_optional(ContentSettingsType::BLUETOOTH_GUARD),
ContentSettingsType::BLUETOOTH_CHOOSER_DATA));
blink::WebBluetoothDeviceId granted_id =
context->GrantServiceAccessPermission(foo_origin_, fake_device1_.get(),
diff --git a/chrome/browser/bluetooth/web_bluetooth_browsertest.cc b/chrome/browser/bluetooth/web_bluetooth_browsertest.cc
index 0c254d9..415db5d 100644
--- a/chrome/browser/bluetooth/web_bluetooth_browsertest.cc
+++ b/chrome/browser/bluetooth/web_bluetooth_browsertest.cc
@@ -8,7 +8,6 @@
#include "base/callback.h"
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/bluetooth/bluetooth_chooser_context.h"
@@ -43,6 +42,7 @@
#include "device/bluetooth/test/mock_bluetooth_device.h"
#include "device/bluetooth/test/mock_bluetooth_gatt_connection.h"
#include "device/bluetooth/test/mock_bluetooth_gatt_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/bluetooth/web_bluetooth_device_id.h"
namespace {
@@ -65,13 +65,13 @@
void SimulateDeviceAdvertisementReceived(
const std::string& device_address,
- const base::Optional<std::string>& advertisement_name =
- base::nullopt) const {
+ const absl::optional<std::string>& advertisement_name =
+ absl::nullopt) const {
for (auto& observer : observers_) {
observer.DeviceAdvertisementReceived(
- device_address, /*device_name=*/base::nullopt, advertisement_name,
- /*rssi=*/base::nullopt, /*tx_power=*/base::nullopt,
- /*appearance=*/base::nullopt,
+ device_address, /*device_name=*/absl::nullopt, advertisement_name,
+ /*rssi=*/absl::nullopt, /*tx_power=*/absl::nullopt,
+ /*appearance=*/absl::nullopt,
/*advertised_uuids=*/{}, /*service_data_map=*/{},
/*manufacturer_data_map=*/{});
}
@@ -165,8 +165,8 @@
base::OnceCallback<void(std::unique_ptr<device::BluetoothGattConnection>)>
callback,
base::OnceCallback<void(enum ConnectErrorCode)> error_callback,
- base::Optional<device::BluetoothUUID> service_uuid =
- base::nullopt) override {
+ absl::optional<device::BluetoothUUID> service_uuid =
+ absl::nullopt) override {
SetConnected(true);
gatt_services_discovery_complete_ = true;
std::move(callback).Run(
@@ -193,7 +193,7 @@
class FakeBluetoothChooser : public content::BluetoothChooser {
public:
FakeBluetoothChooser(content::BluetoothChooser::EventHandler event_handler,
- const base::Optional<std::string>& device_to_select)
+ const absl::optional<std::string>& device_to_select)
: event_handler_(event_handler), device_to_select_(device_to_select) {}
~FakeBluetoothChooser() override = default;
@@ -224,7 +224,7 @@
private:
content::BluetoothChooser::EventHandler event_handler_;
- base::Optional<std::string> device_to_select_;
+ absl::optional<std::string> device_to_select_;
};
class TestBluetoothDelegate : public ChromeBluetoothDelegate {
@@ -266,7 +266,7 @@
}
private:
- base::Optional<std::string> device_to_select_;
+ absl::optional<std::string> device_to_select_;
bool use_real_chooser_ = false;
};
diff --git a/chrome/browser/browser_about_handler_unittest.cc b/chrome/browser/browser_about_handler_unittest.cc
index f0a170b..5bd414f 100644
--- a/chrome/browser/browser_about_handler_unittest.cc
+++ b/chrome/browser/browser_about_handler_unittest.cc
@@ -112,7 +112,7 @@
TestingProfile profile;
std::unique_ptr<NavigationEntry> entry(
NavigationController::CreateNavigationEntry(
- url, Referrer(), base::nullopt, ui::PAGE_TRANSITION_RELOAD, false,
+ url, Referrer(), absl::nullopt, ui::PAGE_TRANSITION_RELOAD, false,
std::string(), &profile, nullptr /* blob_url_loader_factory */));
EXPECT_EQ(expected_virtual_url, entry->GetVirtualURL());
EXPECT_EQ(expected_url, entry->GetURL());
diff --git a/chrome/browser/browser_switcher/browser_switcher_service.cc b/chrome/browser/browser_switcher/browser_switcher_service.cc
index 92511d3..7effd84 100644
--- a/chrome/browser/browser_switcher/browser_switcher_service.cc
+++ b/chrome/browser/browser_switcher/browser_switcher_service.cc
@@ -318,10 +318,10 @@
void BrowserSwitcherService::LoadRulesFromPrefs() {
if (prefs().GetExternalSitelistUrl().is_valid())
sitelist()->SetExternalSitelist(
- ParsedXml(prefs().GetCachedExternalSitelist(), base::nullopt));
+ ParsedXml(prefs().GetCachedExternalSitelist(), absl::nullopt));
if (prefs().GetExternalGreylistUrl().is_valid())
sitelist()->SetExternalGreylist(
- ParsedXml(prefs().GetCachedExternalGreylist(), base::nullopt));
+ ParsedXml(prefs().GetCachedExternalGreylist(), absl::nullopt));
}
void BrowserSwitcherService::OnAllRulesetsParsed() {
diff --git a/chrome/browser/browser_switcher/browser_switcher_service.h b/chrome/browser/browser_switcher/browser_switcher_service.h
index cf2d46c..c2465ad 100644
--- a/chrome/browser/browser_switcher/browser_switcher_service.h
+++ b/chrome/browser/browser_switcher/browser_switcher_service.h
@@ -12,7 +12,6 @@
#include "base/callback_list.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/browser_switcher/browser_switcher_prefs.h"
@@ -20,6 +19,7 @@
#include "mojo/public/cpp/bindings/remote.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class BrowserSwitchHandler;
diff --git a/chrome/browser/browser_switcher/browser_switcher_service_win.cc b/chrome/browser/browser_switcher/browser_switcher_service_win.cc
index 13a36a7..7e245828 100644
--- a/chrome/browser/browser_switcher/browser_switcher_service_win.cc
+++ b/chrome/browser/browser_switcher/browser_switcher_service_win.cc
@@ -114,8 +114,8 @@
}
// URL to fetch the IEEM sitelist from. Only used for testing.
-base::Optional<std::string>* IeemSitelistUrlForTesting() {
- static base::NoDestructor<base::Optional<std::string>>
+absl::optional<std::string>* IeemSitelistUrlForTesting() {
+ static base::NoDestructor<absl::optional<std::string>>
ieem_sitelist_url_for_testing;
return ieem_sitelist_url_for_testing.get();
}
@@ -173,7 +173,7 @@
BrowserSwitcherService::LoadRulesFromPrefs();
if (prefs().UseIeSitelist())
sitelist()->SetIeemSitelist(
- ParsedXml(prefs().GetCachedIeemSitelist(), base::nullopt));
+ ParsedXml(prefs().GetCachedIeemSitelist(), absl::nullopt));
}
base::FilePath BrowserSwitcherServiceWin::GetCacheDir() {
@@ -204,7 +204,7 @@
if (!prefs().UseIeSitelist())
return GURL();
- if (*IeemSitelistUrlForTesting() != base::nullopt)
+ if (*IeemSitelistUrlForTesting() != absl::nullopt)
return GURL((*IeemSitelistUrlForTesting()).value());
base::win::RegKey key;
diff --git a/chrome/browser/browser_switcher/browser_switcher_service_win.h b/chrome/browser/browser_switcher/browser_switcher_service_win.h
index 7ad6e259..119e6f9 100644
--- a/chrome/browser/browser_switcher/browser_switcher_service_win.h
+++ b/chrome/browser/browser_switcher/browser_switcher_service_win.h
@@ -9,8 +9,8 @@
#include <string>
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "chrome/browser/browser_switcher/browser_switcher_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace browser_switcher {
diff --git a/chrome/browser/browser_switcher/ieem_sitelist_parser.cc b/chrome/browser/browser_switcher/ieem_sitelist_parser.cc
index 68f58b6..7686f4eb 100644
--- a/chrome/browser/browser_switcher/ieem_sitelist_parser.cc
+++ b/chrome/browser/browser_switcher/ieem_sitelist_parser.cc
@@ -154,7 +154,7 @@
ParsedXml::ParsedXml() = default;
ParsedXml::ParsedXml(ParsedXml&&) = default;
ParsedXml::ParsedXml(std::vector<std::string>&& rules_,
- base::Optional<std::string>&& error_)
+ absl::optional<std::string>&& error_)
: rules(std::move(rules_)), error(std::move(error_)) {}
ParsedXml::~ParsedXml() = default;
diff --git a/chrome/browser/browser_switcher/ieem_sitelist_parser.h b/chrome/browser/browser_switcher/ieem_sitelist_parser.h
index 222a5e3b..68e99b5 100644
--- a/chrome/browser/browser_switcher/ieem_sitelist_parser.h
+++ b/chrome/browser/browser_switcher/ieem_sitelist_parser.h
@@ -7,7 +7,7 @@
#include "base/callback.h"
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace browser_switcher {
@@ -18,14 +18,14 @@
ParsedXml();
ParsedXml(ParsedXml&&);
ParsedXml(std::vector<std::string>&& rules,
- base::Optional<std::string>&& error);
+ absl::optional<std::string>&& error);
~ParsedXml();
ParsedXml(const ParsedXml&) = delete;
ParsedXml& operator=(const ParsedXml&) = delete;
std::vector<std::string> rules;
- base::Optional<std::string> error;
+ absl::optional<std::string> error;
};
// Parses the XML contained in |xml|, and calls |callback| with the parsed XML
diff --git a/chrome/browser/browser_switcher/ieem_sitelist_parser_browsertest.cc b/chrome/browser/browser_switcher/ieem_sitelist_parser_browsertest.cc
index 54c71c9..767de7f 100644
--- a/chrome/browser/browser_switcher/ieem_sitelist_parser_browsertest.cc
+++ b/chrome/browser/browser_switcher/ieem_sitelist_parser_browsertest.cc
@@ -50,7 +50,7 @@
IN_PROC_BROWSER_TEST_F(IeemSitelistParserTest, BadXmlParsed) {
TestParseXml("<bogus></bogus>", ParsedXml({}, "Invalid XML root element"));
TestParseXml("<rules version=\"424\"><unknown></unknown></rules>",
- ParsedXml({}, base::nullopt));
+ ParsedXml({}, absl::nullopt));
}
IN_PROC_BROWSER_TEST_F(IeemSitelistParserTest, V1OnlyBogusElements) {
@@ -60,7 +60,7 @@
"</more><emie><domain>ignoretoo.com<path>/ignored_path</path>"
"</domain></emie><domain>onemoreignored.com</domain>"
"<path>/ignore_outside_of_domain></path></unknown></rules>";
- TestParseXml(xml, ParsedXml({}, base::nullopt));
+ TestParseXml(xml, ParsedXml({}, absl::nullopt));
}
IN_PROC_BROWSER_TEST_F(IeemSitelistParserTest, V1Full) {
@@ -131,7 +131,7 @@
"!yes.com/actuallyno",
"!no.com",
};
- TestParseXml(xml, ParsedXml(std::move(expected_sitelist), base::nullopt));
+ TestParseXml(xml, ParsedXml(std::move(expected_sitelist), absl::nullopt));
}
IN_PROC_BROWSER_TEST_F(IeemSitelistParserTest, V2Full) {
@@ -160,7 +160,7 @@
"!google.com", "!good.site", "www.cpandl.com",
"!contoso.com", "!relecloud.com", "!relecloud.com/about",
};
- TestParseXml(xml, ParsedXml(std::move(expected_sitelist), base::nullopt));
+ TestParseXml(xml, ParsedXml(std::move(expected_sitelist), absl::nullopt));
}
} // namespace browser_switcher
diff --git a/chrome/browser/browsing_data/access_context_audit_service_unittest.cc b/chrome/browser/browsing_data/access_context_audit_service_unittest.cc
index d9140e6..f8c72090 100644
--- a/chrome/browser/browsing_data/access_context_audit_service_unittest.cc
+++ b/chrome/browser/browsing_data/access_context_audit_service_unittest.cc
@@ -193,10 +193,10 @@
auto test_cookie = net::CanonicalCookie::Create(
kTestCookieURL, kTestCookieName + "=1; max-age=3600", kAccessTime1,
- base::nullopt /* server_time */);
+ absl::nullopt /* server_time */);
auto test_non_persistent_cookie = net::CanonicalCookie::Create(
kTestCookieURL, kTestNonPersistentCookieName + "=1", kAccessTime1,
- base::nullopt /* server_time */);
+ absl::nullopt /* server_time */);
// Record access to these cookies against a URL.
url::Origin kTopFrameOrigin = url::Origin::Create(GURL("https://test.com"));
@@ -281,7 +281,7 @@
const GURL kTestURL("https://test.com");
auto test_cookie_expired = net::CanonicalCookie::Create(
kTestURL, "test_1=1; expires=Thu, 01 Jan 1970 00:00:00 GMT",
- base::Time::Now(), base::nullopt /* server_time */);
+ base::Time::Now(), absl::nullopt /* server_time */);
service()->RecordCookieAccess({*test_cookie_expired},
url::Origin::Create(kTestURL));
@@ -299,7 +299,7 @@
service()->RecordCookieAccess(
{*net::CanonicalCookie::Create(kTestUrl, "foo=bar; max-age=3600",
kAccessTime1,
- base::nullopt /* server_time */)},
+ absl::nullopt /* server_time */)},
kTopFrameOrigin);
url::Origin kTestOrigin = url::Origin::Create(kTestUrl);
service()->RecordStorageAPIAccess(
@@ -343,7 +343,7 @@
service()->RecordCookieAccess(
{*net::CanonicalCookie::Create(kTestUrl, "foo=bar; max-age=3600",
kAccessTime1,
- base::nullopt /* server_time */)},
+ absl::nullopt /* server_time */)},
kTopFrameOrigin);
service()->RecordStorageAPIAccess(
kTestOrigin, AccessContextAuditDatabase::StorageAPIType::kLocalStorage,
@@ -426,7 +426,7 @@
auto test_cookie = net::CanonicalCookie::Create(
kTestCookieURL, kTestCookieName + "=1; max-age=3600", kAccessTime,
- base::nullopt /* server_time */);
+ absl::nullopt /* server_time */);
// Record access for two top level origins for the same storage and cookie.
service()->RecordCookieAccess({*test_cookie}, kHistoryEntriesRemainingOrigin);
@@ -485,12 +485,12 @@
service()->RecordCookieAccess(
{*net::CanonicalCookie::Create(GURL("https://foo.com"),
"foo=1; max-age=3600", base::Time::Now(),
- base::nullopt /* server_time */)},
+ absl::nullopt /* server_time */)},
kHistoryEntryOrigin);
service()->RecordCookieAccess(
{*net::CanonicalCookie::Create(GURL("https://bar.com"),
"bar=1; max-age=3600", base::Time::Now(),
- base::nullopt /* server_time */)},
+ absl::nullopt /* server_time */)},
kNoHistoryEntryOrigin);
service()->RecordStorageAPIAccess(
url::Origin::Create(GURL("https://foo.com")),
@@ -555,10 +555,10 @@
// Record accesses to cookies both inside and outside the deletion range.
auto cookie_accessed_in_range = net::CanonicalCookie::Create(
kTestCookieURL, "inside=1; max-age=3600", kInsideTimeRange,
- base::nullopt /* server_time */);
+ absl::nullopt /* server_time */);
auto cookie_accessed_outside_range = net::CanonicalCookie::Create(
kTestCookieURL, "outside=1; max-age=3600", kOutsideTimeRange,
- base::nullopt /* server_time */);
+ absl::nullopt /* server_time */);
clock()->SetNow(kInsideTimeRange);
service()->RecordCookieAccess({*cookie_accessed_in_range}, kOrigin1);
@@ -611,19 +611,19 @@
// Create a cookie that will persist after shutdown.
auto test_cookie_persistent = net::CanonicalCookie::Create(
kTestPersistentURL, kTestCookieName + "=1; max-age=3600", kAccessTime,
- base::nullopt /* server_time */);
+ absl::nullopt /* server_time */);
// Create a cookie that will persist (be cleared on next startup) because it
// is explicitly session only.
auto test_cookie_session_only_explicit = net::CanonicalCookie::Create(
kTestSessionOnlyExplicitURL, kTestCookieName + "=1", kAccessTime,
- base::nullopt /* server_time */);
+ absl::nullopt /* server_time */);
// Create a cookie that will be cleared because the content setting associated
// with the cookie domain is set to session only.
auto test_cookie_session_only_content_setting = net::CanonicalCookie::Create(
kTestSessionOnlyContentSettingURL, kTestCookieName + "=1; max-age=3600",
- kAccessTime, base::nullopt /* server_time */);
+ kAccessTime, absl::nullopt /* server_time */);
service()->RecordCookieAccess(
{*test_cookie_persistent, *test_cookie_session_only_explicit,
@@ -745,7 +745,7 @@
// Check that records which have opaque top frame origins are not recorded.
auto test_cookie = net::CanonicalCookie::Create(
GURL("https://example.com"), "test_1=1; max-age=3600", base::Time::Now(),
- base::nullopt /* server_time */);
+ absl::nullopt /* server_time */);
service()->RecordCookieAccess({*test_cookie}, url::Origin());
service()->RecordStorageAPIAccess(
url::Origin::Create(GURL("https://example.com")),
@@ -767,7 +767,7 @@
auto test_cookie = net::CanonicalCookie::Create(
kTestCookieURL, kTestCookieName + "=1; max-age=3600", kAccessTime1,
- base::nullopt /* server_time */);
+ absl::nullopt /* server_time */);
// Record access to the cookie via a helper.
auto helper = std::make_unique<AccessContextAuditService::CookieAccessHelper>(
diff --git a/chrome/browser/browsing_data/browsing_data_history_observer_service.cc b/chrome/browser/browsing_data/browsing_data_history_observer_service.cc
index 5274ffa..3a36dd77 100644
--- a/chrome/browser/browsing_data/browsing_data_history_observer_service.cc
+++ b/chrome/browser/browsing_data/browsing_data_history_observer_service.cc
@@ -116,7 +116,7 @@
content::StoragePartition* storage_partition,
base::Time delete_begin,
base::Time delete_end,
- const base::Optional<std::set<GURL>>& urls) {
+ const absl::optional<std::set<GURL>>& urls) {
std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder;
if (urls) {
filter_builder = content::BrowsingDataFilterBuilder::Create(
diff --git a/chrome/browser/browsing_data/browsing_data_history_observer_service_unittest.cc b/chrome/browser/browsing_data/browsing_data_history_observer_service_unittest.cc
index 18b0ea4..c66abef6 100644
--- a/chrome/browser/browsing_data/browsing_data_history_observer_service_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_history_observer_service_unittest.cc
@@ -7,7 +7,6 @@
#include <set>
#include <utility>
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/test/base/testing_profile.h"
#include "components/history/core/browser/history_types.h"
@@ -15,6 +14,7 @@
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_storage_partition.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -52,10 +52,10 @@
std::move(callback).Run();
}
- const base::Optional<RemovalData>& GetRemovalData() { return removal_data_; }
+ const absl::optional<RemovalData>& GetRemovalData() { return removal_data_; }
private:
- base::Optional<RemovalData> removal_data_;
+ absl::optional<RemovalData> removal_data_;
};
} // namespace
@@ -77,7 +77,7 @@
service.OnURLsDeleted(nullptr /* history_service */,
history::DeletionInfo::ForAllHistory());
- const base::Optional<RemovalData>& removal_data = partition.GetRemovalData();
+ const absl::optional<RemovalData>& removal_data = partition.GetRemovalData();
EXPECT_TRUE(removal_data.has_value());
EXPECT_EQ(content::StoragePartition::REMOVE_DATA_MASK_CONVERSIONS,
removal_data->removal_mask);
@@ -111,7 +111,7 @@
service.OnURLsDeleted(nullptr /* history_service */, deletion_info);
- const base::Optional<RemovalData>& removal_data = partition.GetRemovalData();
+ const absl::optional<RemovalData>& removal_data = partition.GetRemovalData();
EXPECT_TRUE(removal_data.has_value());
EXPECT_EQ(base::Time(), removal_data->begin);
@@ -136,11 +136,11 @@
history::DeletionInfo deletion_info(
history::DeletionTimeRange(begin, end), false /* is_from_expiration */,
{} /* deleted_rows */, {} /* favicon_urls */,
- base::nullopt /* restrict_urls */);
+ absl::nullopt /* restrict_urls */);
service.OnURLsDeleted(nullptr /* history_service */, deletion_info);
- const base::Optional<RemovalData>& removal_data = partition.GetRemovalData();
+ const absl::optional<RemovalData>& removal_data = partition.GetRemovalData();
EXPECT_TRUE(removal_data.has_value());
EXPECT_EQ(begin, removal_data->begin);
@@ -169,7 +169,7 @@
service.OnURLsDeleted(nullptr /* history_service */, deletion_info);
- const base::Optional<RemovalData>& removal_data = partition.GetRemovalData();
+ const absl::optional<RemovalData>& removal_data = partition.GetRemovalData();
EXPECT_TRUE(removal_data.has_value());
EXPECT_EQ(begin, removal_data->begin);
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager.h b/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager.h
index e309365..58cf04f 100644
--- a/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager.h
+++ b/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager.h
@@ -10,11 +10,11 @@
#include <vector>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/prefs/pref_change_registrar.h"
#include "content/public/browser/browsing_data_remover.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class BrowserContext;
@@ -67,7 +67,7 @@
// Sets the end time of the period for which data must be deleted, for all
// configurations. If this is |end_time_for_testing| has no value, use the
// computed end time from each configuration.
- void SetEndTimeForTesting(base::Optional<base::Time> end_time_for_testing) {
+ void SetEndTimeForTesting(absl::optional<base::Time> end_time_for_testing) {
end_time_for_testing_ = std::move(end_time_for_testing);
}
void SetBrowsingDataRemoverObserverForTesting(
@@ -102,7 +102,7 @@
Profile* profile_;
content::BrowsingDataRemover::Observer* testing_data_remover_observer_ =
nullptr;
- base::Optional<base::Time> end_time_for_testing_;
+ absl::optional<base::Time> end_time_for_testing_;
base::WeakPtrFactory<ChromeBrowsingDataLifetimeManager> weak_ptr_factory_{
this};
};
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_browsertest.cc b/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_browsertest.cc
index 408c50b..b120eff 100644
--- a/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_browsertest.cc
+++ b/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_browsertest.cc
@@ -9,7 +9,6 @@
#include "base/files/file_path.h"
#include "base/guid.h"
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
@@ -58,6 +57,7 @@
#include "storage/browser/quota/special_storage_policy.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_unittest.cc b/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_unittest.cc
index 2d9536c..d3c9170 100644
--- a/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_unittest.cc
+++ b/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
@@ -23,6 +22,7 @@
#include "content/public/test/mock_browsing_data_remover_delegate.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
TEST(ChromeBrowsingDataLifetimeManager, ScheduledRemoval) {
base::test::ScopedFeatureList feature_list;
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h
index 1d02e801..324f9fd 100644
--- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h
+++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h
@@ -10,7 +10,6 @@
#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/synchronization/waitable_event_watcher.h"
#include "base/task/cancelable_task_tracker.h"
#include "build/build_config.h"
@@ -26,6 +25,7 @@
#include "media/media_buildflags.h"
#include "ppapi/buildflags/buildflags.h"
#include "services/network/public/mojom/network_context.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
class ScopedProfileKeepAlive;
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc
index c910a38..9d05f5f 100644
--- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc
+++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc
@@ -298,7 +298,7 @@
void AddCookie() {
base::RunLoop run_loop;
auto cookie = net::CanonicalCookie::Create(
- Origin1(), "A=1", base::Time::Now(), base::nullopt /* server_time */);
+ Origin1(), "A=1", base::Time::Now(), absl::nullopt /* server_time */);
cookie_manager_->SetCanonicalCookie(
*cookie, Origin1(), net::CookieOptions::MakeAllInclusive(),
base::BindLambdaForTesting([&](net::CookieAccessResult result) {
diff --git a/chrome/browser/browsing_data/navigation_entry_remover.cc b/chrome/browser/browsing_data/navigation_entry_remover.cc
index 9d07adc..b83a3e1 100644
--- a/chrome/browser/browsing_data/navigation_entry_remover.cc
+++ b/chrome/browser/browsing_data/navigation_entry_remover.cc
@@ -37,7 +37,7 @@
bool ShouldDeleteUrl(base::Time begin,
base::Time end,
- const base::Optional<std::set<GURL>>& restrict_urls,
+ const absl::optional<std::set<GURL>>& restrict_urls,
const GURL& url,
base::Time time_stamp) {
return begin <= time_stamp && (time_stamp < end || end.is_null()) &&
@@ -48,7 +48,7 @@
bool ShouldDeleteNavigationEntry(
base::Time begin,
base::Time end,
- const base::Optional<std::set<GURL>>& restrict_urls,
+ const absl::optional<std::set<GURL>>& restrict_urls,
content::NavigationEntry* entry) {
return ShouldDeleteUrl(begin, end, restrict_urls, entry->GetURL(),
entry->GetTimestamp());
@@ -57,7 +57,7 @@
bool ShouldDeleteSerializedNavigationEntry(
base::Time begin,
base::Time end,
- const base::Optional<std::set<GURL>>& restrict_urls,
+ const absl::optional<std::set<GURL>>& restrict_urls,
const sessions::SerializedNavigationEntry& entry) {
return ShouldDeleteUrl(begin, end, restrict_urls, entry.virtual_url(),
entry.timestamp());
@@ -95,7 +95,7 @@
void DeleteTabNavigationEntries(
Profile* profile,
const history::DeletionTimeRange& time_range,
- const base::Optional<std::set<GURL>>& restrict_urls,
+ const absl::optional<std::set<GURL>>& restrict_urls,
const base::flat_set<GURL>& url_set) {
auto predicate = time_range.IsValid()
? base::BindRepeating(
@@ -178,7 +178,7 @@
void DeleteTabRestoreEntries(
Profile* profile,
const history::DeletionTimeRange& time_range,
- const base::Optional<std::set<GURL>>& restrict_urls,
+ const absl::optional<std::set<GURL>>& restrict_urls,
const base::flat_set<GURL>& url_set) {
sessions::TabRestoreService* tab_service =
TabRestoreServiceFactory::GetForProfile(profile);
diff --git a/chrome/browser/browsing_data/navigation_entry_remover_browsertest.cc b/chrome/browser/browsing_data/navigation_entry_remover_browsertest.cc
index ea9146a..7e373c81 100644
--- a/chrome/browser/browsing_data/navigation_entry_remover_browsertest.cc
+++ b/chrome/browser/browsing_data/navigation_entry_remover_browsertest.cc
@@ -88,7 +88,7 @@
base::Time to,
std::set<GURL> restrict_urls = {}) {
return DeletionInfo(history::DeletionTimeRange(from, to), false, {}, {},
- restrict_urls.empty() ? base::Optional<std::set<GURL>>()
+ restrict_urls.empty() ? absl::optional<std::set<GURL>>()
: restrict_urls);
}
diff --git a/chrome/browser/cart/cart_discount_fetcher.cc b/chrome/browser/cart/cart_discount_fetcher.cc
index 8e50965..ee61e99 100644
--- a/chrome/browser/cart/cart_discount_fetcher.cc
+++ b/chrome/browser/cart/cart_discount_fetcher.cc
@@ -317,7 +317,7 @@
CartDiscountFetcherCallback callback,
std::unique_ptr<EndpointResponse> responses) {
CartDiscountMap cart_discount_map;
- base::Optional<base::Value> value =
+ absl::optional<base::Value> value =
base::JSONReader::Read(responses->response);
if (!value || !value.has_value() || !value->is_dict()) {
NOTREACHED() << "Response is not valid or does not have value or it is "
diff --git a/chrome/browser/cart/cart_discount_link_fetcher.cc b/chrome/browser/cart/cart_discount_link_fetcher.cc
index a8e466a7a..480fa7da 100644
--- a/chrome/browser/cart/cart_discount_link_fetcher.cc
+++ b/chrome/browser/cart/cart_discount_link_fetcher.cc
@@ -152,7 +152,7 @@
return;
}
- base::Optional<base::Value> value =
+ absl::optional<base::Value> value =
base::JSONReader::Read(responses->response);
if (!value || !value->is_dict()) {
diff --git a/chrome/browser/cart/cart_handler_unittest.cc b/chrome/browser/cart/cart_handler_unittest.cc
index f2fefa4..57717c6 100644
--- a/chrome/browser/cart/cart_handler_unittest.cc
+++ b/chrome/browser/cart/cart_handler_unittest.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/cart/cart_handler.h"
-#include "base/optional.h"
#include "base/test/metrics/histogram_tester.h"
#include "build/build_config.h"
#include "chrome/browser/cart/cart_db_content.pb.h"
@@ -17,6 +16,7 @@
#include "components/search/ntp_features.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
void GetEvaluationMerchantCarts(
@@ -245,8 +245,8 @@
// Remove fake data loaded by CartService::CartService.
service_->DeleteCartsWithFakeData();
- service_->AddCart(kFakeMerchantKey, base::nullopt, kFakeProto);
- service_->AddCart(kMockMerchantBKey, base::nullopt, kMockProtoB);
+ service_->AddCart(kFakeMerchantKey, absl::nullopt, kFakeProto);
+ service_->AddCart(kMockMerchantBKey, absl::nullopt, kMockProtoB);
task_environment_.RunUntilIdle();
std::vector<chrome_cart::mojom::MerchantCartPtr> carts;
@@ -276,8 +276,8 @@
// Flaky, see crbug.com/1185497.
TEST_F(CartHandlerNtpModuleTest, DISABLED_TestDisableFakeData) {
base::RunLoop run_loop;
- service_->AddCart(kFakeMerchantKey, base::nullopt, kFakeProto);
- service_->AddCart(kMockMerchantBKey, base::nullopt, kMockProtoB);
+ service_->AddCart(kFakeMerchantKey, absl::nullopt, kFakeProto);
+ service_->AddCart(kMockMerchantBKey, absl::nullopt, kMockProtoB);
task_environment_.RunUntilIdle();
std::vector<chrome_cart::mojom::MerchantCartPtr> carts;
@@ -372,7 +372,7 @@
cart_db::ChromeCartContentProto merchant_proto =
BuildProto(kMockMerchantBKey, kMockMerchantB, kMockMerchantURLB);
merchant_proto.mutable_discount_info()->set_discount_text("15% off");
- service_->AddCart(kMockMerchantBKey, base::nullopt, merchant_proto);
+ service_->AddCart(kMockMerchantBKey, absl::nullopt, merchant_proto);
task_environment_.RunUntilIdle();
// Skip the welcome surface stage as discount is not showing for welcome
@@ -486,7 +486,7 @@
cart_db::ChromeCartContentProto merchant_proto =
BuildProto(kMockMerchantBKey, kMockMerchantB, kMockMerchantURLB);
merchant_proto.mutable_discount_info()->set_discount_text("15% off");
- service_->AddCart(kMockMerchantBKey, base::nullopt, merchant_proto);
+ service_->AddCart(kMockMerchantBKey, absl::nullopt, merchant_proto);
task_environment_.RunUntilIdle();
profile_.GetPrefs()->SetInteger(prefs::kCartModuleWelcomeSurfaceShownTimes,
0);
diff --git a/chrome/browser/cart/cart_service.cc b/chrome/browser/cart/cart_service.cc
index 33d7e8d..5a362047 100644
--- a/chrome/browser/cart/cart_service.cc
+++ b/chrome/browser/cart/cart_service.cc
@@ -44,10 +44,10 @@
return pair1.second.timestamp() > pair2.second.timestamp();
}
-base::Optional<base::Value> JSONToDictionary(int resource_id) {
+absl::optional<base::Value> JSONToDictionary(int resource_id) {
base::StringPiece json_resource(
ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id));
- base::Optional<base::Value> value = base::JSONReader::Read(json_resource);
+ absl::optional<base::Value> value = base::JSONReader::Read(json_resource);
DCHECK(value && value.has_value() && value->is_dict());
return value;
}
@@ -117,7 +117,7 @@
}
void CartService::AddCart(const std::string& domain,
- const base::Optional<GURL>& cart_url,
+ const absl::optional<GURL>& cart_url,
const cart_db::ChromeCartContentProto& proto) {
cart_db_->LoadCart(domain, base::BindOnce(&CartService::OnAddCart,
weak_ptr_factory_.GetWeakPtr(),
@@ -458,7 +458,7 @@
}
void CartService::OnAddCart(const std::string& domain,
- const base::Optional<GURL>& cart_url,
+ const absl::optional<GURL>& cart_url,
cart_db::ChromeCartContentProto proto,
bool success,
std::vector<CartDB::KeyAndValue> proto_pairs) {
diff --git a/chrome/browser/cart/cart_service.h b/chrome/browser/cart/cart_service.h
index 16b5c6a..8a28b3a 100644
--- a/chrome/browser/cart/cart_service.h
+++ b/chrome/browser/cart/cart_service.h
@@ -6,7 +6,6 @@
#include "base/callback_helpers.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/values.h"
#include "chrome/browser/cart/cart_db.h"
@@ -17,6 +16,7 @@
#include "components/history/core/browser/history_service_observer.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/prefs/pref_registry_simple.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class FetchDiscountWorker;
@@ -48,7 +48,7 @@
void LoadAllActiveCarts(CartDB::LoadCallback callback);
// Add a cart to the cart service.
void AddCart(const std::string& domain,
- const base::Optional<GURL>& cart_url,
+ const absl::optional<GURL>& cart_url,
const cart_db::ChromeCartContentProto& proto);
// Delete the cart from certain domain in the cart service.
void DeleteCart(const std::string& domain);
@@ -135,7 +135,7 @@
std::vector<CartDB::KeyAndValue> proto_pairs);
// A callback to handle adding a cart.
void OnAddCart(const std::string& domain,
- const base::Optional<GURL>& cart_url,
+ const absl::optional<GURL>& cart_url,
cart_db::ChromeCartContentProto proto,
bool success,
std::vector<CartDB::KeyAndValue> proto_pairs);
@@ -154,8 +154,8 @@
history::HistoryService* history_service_;
base::ScopedObservation<history::HistoryService, HistoryServiceObserver>
history_service_observation_{this};
- base::Optional<base::Value> domain_name_mapping_;
- base::Optional<base::Value> domain_cart_url_mapping_;
+ absl::optional<base::Value> domain_name_mapping_;
+ absl::optional<base::Value> domain_cart_url_mapping_;
std::unique_ptr<FetchDiscountWorker> fetch_discount_worker_;
base::WeakPtrFactory<CartService> weak_ptr_factory_{this};
};
diff --git a/chrome/browser/cart/cart_service_unittest.cc b/chrome/browser/cart/cart_service_unittest.cc
index ea419b7..c6e9619 100644
--- a/chrome/browser/cart/cart_service_unittest.cc
+++ b/chrome/browser/cart/cart_service_unittest.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/cart/cart_service.h"
-#include "base/optional.h"
#include "chrome/browser/cart/cart_db_content.pb.h"
#include "chrome/browser/cart/cart_service_factory.h"
#include "chrome/browser/history/history_service_factory.h"
@@ -17,6 +16,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
cart_db::ChromeCartContentProto BuildProto(const char* domain,
@@ -279,7 +279,7 @@
run_loop[0].QuitClosure(), kEmptyExpected));
run_loop[0].Run();
- service_->AddCart(kMockMerchantA, base::nullopt, kMockProtoA);
+ service_->AddCart(kMockMerchantA, absl::nullopt, kMockProtoA);
task_environment_.RunUntilIdle();
cart_db_->LoadAllCarts(base::BindOnce(&CartServiceTest::GetEvaluationURL,
@@ -335,14 +335,14 @@
merchant_A_proto.set_timestamp(0);
merchant_A_proto.add_product_image_urls("https://image1.com");
merchant_A_proto.set_is_hidden(true);
- service_->AddCart(kMockMerchantA, base::nullopt, merchant_A_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, merchant_A_proto);
task_environment_.RunUntilIdle();
// Add a new proto with the same key and no product images.
cart_db::ChromeCartContentProto new_proto =
BuildProto(kMockMerchantA, kMockMerchantURLA);
new_proto.set_timestamp(1);
- service_->AddCart(kMockMerchantA, base::nullopt, new_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, new_proto);
task_environment_.RunUntilIdle();
cart_db_->LoadCart(
@@ -373,7 +373,7 @@
merchant_A_proto.set_timestamp(0);
merchant_A_proto.add_product_image_urls("https://image1.com");
merchant_A_proto.set_is_hidden(true);
- service_->AddCart(kMockMerchantA, base::nullopt, merchant_A_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, merchant_A_proto);
task_environment_.RunUntilIdle();
// Add a new proto with the same key and some product images.
@@ -381,7 +381,7 @@
BuildProto(kMockMerchantA, kMockMerchantURLA);
new_proto.set_timestamp(1);
new_proto.add_product_image_urls("https://image2.com");
- service_->AddCart(kMockMerchantA, base::nullopt, new_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, new_proto);
task_environment_.RunUntilIdle();
cart_db_->LoadCart(
@@ -411,7 +411,7 @@
merchant_A_proto.set_timestamp(0);
merchant_A_proto.add_product_image_urls("https://image1.com");
merchant_A_proto.set_is_removed(true);
- service_->AddCart(kMockMerchantA, base::nullopt, merchant_A_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, merchant_A_proto);
task_environment_.RunUntilIdle();
// Add a new proto with the same key and some product images.
@@ -419,7 +419,7 @@
BuildProto(kMockMerchantA, kMockMerchantURLA);
new_proto.set_timestamp(2);
new_proto.add_product_image_urls("https://image2.com");
- service_->AddCart(kMockMerchantA, base::nullopt, new_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, new_proto);
task_environment_.RunUntilIdle();
cart_db_->LoadCart(
@@ -447,7 +447,7 @@
BuildProto(kMockMerchantA, kMockMerchantURLA);
merchant_proto.set_timestamp(0);
merchant_proto.add_product_image_urls("https://image1.com");
- service_->AddCart(kMockMerchantA, base::nullopt, merchant_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, merchant_proto);
task_environment_.RunUntilIdle();
// Adding a new proto with new product infos should reflect in storage.
@@ -457,7 +457,7 @@
auto* added_product = new_proto.add_product_infos();
*added_product = product_info;
new_proto.set_timestamp(1);
- service_->AddCart(kMockMerchantA, base::nullopt, new_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, new_proto);
task_environment_.RunUntilIdle();
cart_db_->LoadCart(
@@ -482,7 +482,7 @@
// Adding a new proto with same product infos shouldn't change the current
// storage about product infos.
new_proto.set_timestamp(2);
- service_->AddCart(kMockMerchantA, base::nullopt, new_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, new_proto);
task_environment_.RunUntilIdle();
cart_db_->LoadCart(
@@ -615,7 +615,7 @@
ServiceAccessType::EXPLICIT_ACCESS),
history::DeletionInfo(history::DeletionTimeRange::Invalid(), false,
history::URLRows(), std::set<GURL>(),
- base::nullopt));
+ absl::nullopt));
cart_db_->LoadAllCarts(
base::BindOnce(&CartServiceTest::GetEvaluationURL, base::Unretained(this),
@@ -782,9 +782,9 @@
cart_db::ChromeCartContentProto merchant_C_proto =
BuildProto(kMockMerchantC, kMockMerchantURLC);
merchant_C_proto.set_timestamp(time_now + 2);
- service_->AddCart(kMockMerchantA, base::nullopt, merchant_A_proto);
- service_->AddCart(kMockMerchantB, base::nullopt, merchant_B_proto);
- service_->AddCart(kMockMerchantC, base::nullopt, merchant_C_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, merchant_A_proto);
+ service_->AddCart(kMockMerchantB, absl::nullopt, merchant_B_proto);
+ service_->AddCart(kMockMerchantC, absl::nullopt, merchant_C_proto);
task_environment_.RunUntilIdle();
const ShoppingCarts result1 = {{kMockMerchantC, merchant_C_proto},
@@ -796,7 +796,7 @@
run_loop[0].Run();
merchant_A_proto.set_timestamp(time_now + 3);
- service_->AddCart(kMockMerchantA, base::nullopt, merchant_A_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, merchant_A_proto);
task_environment_.RunUntilIdle();
const ShoppingCarts result2 = {{kMockMerchantA, merchant_A_proto},
{kMockMerchantC, merchant_C_proto},
@@ -807,7 +807,7 @@
run_loop[1].Run();
merchant_C_proto.set_timestamp(time_now + 4);
- service_->AddCart(kMockMerchantC, base::nullopt, merchant_C_proto);
+ service_->AddCart(kMockMerchantC, absl::nullopt, merchant_C_proto);
task_environment_.RunUntilIdle();
const ShoppingCarts result3 = {{kMockMerchantC, merchant_C_proto},
{kMockMerchantA, merchant_A_proto},
@@ -844,7 +844,7 @@
base::RunLoop run_loop[3];
cart_db::ChromeCartContentProto merchant_A_proto =
BuildProto(amazon_domain, kMockMerchantURLA);
- service_->AddCart(amazon_domain, base::nullopt, merchant_A_proto);
+ service_->AddCart(amazon_domain, absl::nullopt, merchant_A_proto);
task_environment_.RunUntilIdle();
merchant_A_proto.set_merchant_cart_url(getDomainCartURL(amazon_domain));
@@ -862,7 +862,7 @@
const char* fake_cart_url = "fake.com/cart";
cart_db::ChromeCartContentProto fake_proto =
BuildProto(fake_domain, fake_cart_url);
- service_->AddCart(fake_domain, base::nullopt, fake_proto);
+ service_->AddCart(fake_domain, absl::nullopt, fake_proto);
task_environment_.RunUntilIdle();
const ShoppingCarts result2 = {{fake_domain, fake_proto}};
@@ -889,12 +889,12 @@
// - The navigation URL
// * Lowest priority: no overriding.
- service_->AddCart(example_domain, base::nullopt, merchant_A_proto);
+ service_->AddCart(example_domain, absl::nullopt, merchant_A_proto);
task_environment_.RunUntilIdle();
EXPECT_EQ(GetCartURL(example_domain), kMockMerchantURLA);
// * Higher priority: from look up table.
- service_->AddCart(amazon_domain, base::nullopt, merchant_A_proto);
+ service_->AddCart(amazon_domain, absl::nullopt, merchant_A_proto);
task_environment_.RunUntilIdle();
EXPECT_EQ(GetCartURL(amazon_domain),
"https://www.amazon.com/gp/cart/view.html");
@@ -904,14 +904,14 @@
service_->AddCart(amazon_domain, amazon_cart, merchant_A_proto);
task_environment_.RunUntilIdle();
EXPECT_EQ(GetCartURL(amazon_domain), amazon_cart.spec());
- service_->AddCart(amazon_domain, base::nullopt, merchant_A_proto);
+ service_->AddCart(amazon_domain, absl::nullopt, merchant_A_proto);
task_environment_.RunUntilIdle();
// Lookup table cannot override existing entry.
EXPECT_EQ(GetCartURL(amazon_domain), amazon_cart.spec());
service_->DeleteCart(amazon_domain);
// * Highest priority: overriding existing entry.
- service_->AddCart(amazon_domain, base::nullopt, merchant_A_proto);
+ service_->AddCart(amazon_domain, absl::nullopt, merchant_A_proto);
task_environment_.RunUntilIdle();
EXPECT_EQ(GetCartURL(amazon_domain),
"https://www.amazon.com/gp/cart/view.html");
@@ -970,7 +970,7 @@
merchant_proto.set_timestamp(
(base::Time::Now() - base::TimeDelta::FromDays(16)).ToDoubleT());
- service_->AddCart(kMockMerchantA, base::nullopt, merchant_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, merchant_proto);
task_environment_.RunUntilIdle();
// The expired entry is deleted in load results.
@@ -988,7 +988,7 @@
merchant_proto.set_timestamp(
(base::Time::Now() - base::TimeDelta::FromDays(13)).ToDoubleT());
- service_->AddCart(kMockMerchantA, base::nullopt, merchant_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, merchant_proto);
task_environment_.RunUntilIdle();
const ShoppingCarts result = {{kMockMerchantA, merchant_proto}};
@@ -1004,7 +1004,7 @@
cart_db::ChromeCartContentProto merchant_proto =
BuildProto(kMockMerchantA, kMockMerchantURLA);
const ShoppingCarts result = {{kMockMerchantA, merchant_proto}};
- service_->AddCart(kMockMerchantA, base::nullopt, merchant_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, merchant_proto);
task_environment_.RunUntilIdle();
service_->LoadAllActiveCarts(
base::BindOnce(&CartServiceTest::GetEvaluationURL, base::Unretained(this),
@@ -1018,7 +1018,7 @@
run_loop[1].QuitClosure(), kEmptyExpected));
run_loop[1].Run();
- service_->AddCart(kMockMerchantA, base::nullopt, merchant_proto);
+ service_->AddCart(kMockMerchantA, absl::nullopt, merchant_proto);
task_environment_.RunUntilIdle();
ASSERT_FALSE(service_->IsHidden());
service_->LoadAllActiveCarts(
diff --git a/chrome/browser/cart/commerce_hint_service.cc b/chrome/browser/cart/commerce_hint_service.cc
index d27f75f..79654161 100644
--- a/chrome/browser/cart/commerce_hint_service.cc
+++ b/chrome/browser/cart/commerce_hint_service.cc
@@ -71,7 +71,7 @@
~CommerceHintObserverImpl() override = default;
- void OnAddToCart(const base::Optional<GURL>& cart_url,
+ void OnAddToCart(const absl::optional<GURL>& cart_url,
const std::string& product_id) override {
DVLOG(1) << "Received OnAddToCart in the browser process on "
<< binding_url_;
@@ -161,14 +161,14 @@
}
void CommerceHintService::OnAddToCart(const GURL& navigation_url,
- const base::Optional<GURL>& cart_url,
+ const absl::optional<GURL>& cart_url,
const std::string& product_id) {
if (ShouldSkip(navigation_url))
return;
- base::Optional<GURL> validated_cart = cart_url;
+ absl::optional<GURL> validated_cart = cart_url;
if (cart_url && GetDomain(*cart_url) != GetDomain(navigation_url)) {
DVLOG(1) << "Reject cart URL with different eTLD+1 domain.";
- validated_cart = base::nullopt;
+ validated_cart = absl::nullopt;
}
cart_db::ChromeCartContentProto proto;
std::vector<mojom::ProductPtr> products;
diff --git a/chrome/browser/cart/commerce_hint_service.h b/chrome/browser/cart/commerce_hint_service.h
index c7f6535..bf4c801c 100644
--- a/chrome/browser/cart/commerce_hint_service.h
+++ b/chrome/browser/cart/commerce_hint_service.h
@@ -6,13 +6,13 @@
#define CHROME_BROWSER_CART_COMMERCE_HINT_SERVICE_H_
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/cart/cart_service.h"
#include "chrome/common/cart/commerce_hints.mojom.h"
#include "components/optimization_guide/content/browser/optimization_guide_decider.h"
#include "components/optimization_guide/proto/hints.pb.h"
#include "content/public/browser/web_contents_user_data.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cart {
@@ -25,7 +25,7 @@
mojo::PendingReceiver<mojom::CommerceHintObserver> receiver);
content::WebContents* WebContents();
void OnAddToCart(const GURL& navigation_url,
- const base::Optional<GURL>& cart_url,
+ const absl::optional<GURL>& cart_url,
const std::string& product_id = std::string());
void OnRemoveCart(const GURL& url);
void OnCartUpdated(const GURL& cart_url,
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index d471796..4b75f87 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -1104,7 +1104,7 @@
content::WebContents::OnceGetter web_contents_getter,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin) {
+ const absl::optional<url::Origin>& initiating_origin) {
// 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 = std::move(web_contents_getter).Run();
@@ -1871,7 +1871,7 @@
ui::PageTransition* transition,
bool* is_renderer_initiated,
content::Referrer* referrer,
- base::Optional<url::Origin>* initiator_origin) {
+ absl::optional<url::Origin>* initiator_origin) {
DCHECK(transition);
DCHECK(is_renderer_initiated);
DCHECK(referrer);
@@ -1888,7 +1888,7 @@
*transition = ui::PAGE_TRANSITION_AUTO_BOOKMARK;
*is_renderer_initiated = false;
*referrer = content::Referrer();
- *initiator_origin = base::nullopt;
+ *initiator_origin = absl::nullopt;
}
#if defined(OS_ANDROID)
if (web_contents) {
@@ -2542,7 +2542,7 @@
bool ChromeContentBrowserClient::AllowAppCache(
const GURL& manifest_url,
const GURL& site_for_cookies,
- const base::Optional<url::Origin>& top_frame_origin,
+ const absl::optional<url::Origin>& top_frame_origin,
content::BrowserContext* context) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
return embedder_support::AllowAppCache(
@@ -2555,7 +2555,7 @@
ChromeContentBrowserClient::AllowServiceWorker(
const GURL& scope,
const GURL& site_for_cookies,
- const base::Optional<url::Origin>& top_frame_origin,
+ const absl::optional<url::Origin>& top_frame_origin,
const GURL& script_url,
content::BrowserContext* context) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -2584,7 +2584,7 @@
bool ChromeContentBrowserClient::AllowSharedWorker(
const GURL& worker_url,
const GURL& site_for_cookies,
- const base::Optional<url::Origin>& top_frame_origin,
+ const absl::optional<url::Origin>& top_frame_origin,
const std::string& name,
const storage::StorageKey& storage_key,
content::BrowserContext* context,
@@ -3428,7 +3428,7 @@
':', ',', &pairs);
for (const auto& pair : pairs) {
- base::Optional<net::EffectiveConnectionType> effective_connection_type =
+ absl::optional<net::EffectiveConnectionType> effective_connection_type =
net::GetEffectiveConnectionTypeForName(pair.first);
int value = 0;
if (effective_connection_type && base::StringToInt(pair.second, &value)) {
@@ -3453,7 +3453,7 @@
':', ',', &pairs);
for (const auto& pair : pairs) {
- base::Optional<net::EffectiveConnectionType> effective_connection_type =
+ absl::optional<net::EffectiveConnectionType> effective_connection_type =
net::GetEffectiveConnectionTypeForName(pair.first);
int value = 0;
if (effective_connection_type && base::StringToInt(pair.second, &value)) {
@@ -3470,7 +3470,7 @@
':', ',', &pairs);
for (const auto& pair : pairs) {
- base::Optional<net::EffectiveConnectionType> effective_connection_type =
+ absl::optional<net::EffectiveConnectionType> effective_connection_type =
net::GetEffectiveConnectionTypeForName(pair.first);
int value = 0;
if (effective_connection_type && base::StringToInt(pair.second, &value)) {
@@ -3488,7 +3488,7 @@
features::kNetworkQualityEstimatorWebHoldback,
"web_effective_connection_type_override");
- base::Optional<net::EffectiveConnectionType> effective_connection_type =
+ absl::optional<net::EffectiveConnectionType> effective_connection_type =
net::GetEffectiveConnectionTypeForName(effective_connection_type_param);
DCHECK(effective_connection_type_param.empty() ||
effective_connection_type);
@@ -3522,7 +3522,7 @@
web_prefs->translate_service_available = TranslateService::IsAvailable(prefs);
- base::Optional<ui::CaptionStyle> style =
+ absl::optional<ui::CaptionStyle> style =
captions::GetCaptionStyleFromUserSettings(prefs,
true /* record_metrics */);
if (style) {
@@ -4829,7 +4829,7 @@
int render_process_id,
URLLoaderFactoryType type,
const url::Origin& request_initiator,
- base::Optional<int64_t> navigation_id,
+ absl::optional<int64_t> navigation_id,
ukm::SourceIdObj ukm_source_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
@@ -4964,7 +4964,7 @@
WebSocketFactory factory,
const GURL& url,
const net::SiteForCookies& site_for_cookies,
- const base::Optional<std::string>& user_agent,
+ const absl::optional<std::string>& user_agent,
mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
handshake_client) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
@@ -5217,7 +5217,7 @@
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
// External protocols are disabled for guests. An exception is made for the
@@ -5419,7 +5419,7 @@
return nullptr;
}
-base::Optional<std::string>
+absl::optional<std::string>
ChromeContentBrowserClient::GetOriginPolicyErrorPage(
network::OriginPolicyState error_reason,
content::NavigationHandle* handle) {
@@ -5487,15 +5487,15 @@
return embedder_support::GetUserAgentMetadata();
}
-base::Optional<gfx::ImageSkia> ChromeContentBrowserClient::GetProductLogo() {
+absl::optional<gfx::ImageSkia> ChromeContentBrowserClient::GetProductLogo() {
// This icon is available on Android, but adds 19KiB to the APK. Since it
// isn't used on Android we exclude it to avoid bloat.
#if !defined(OS_ANDROID)
- return base::Optional<gfx::ImageSkia>(
+ return absl::optional<gfx::ImageSkia>(
*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
IDR_PRODUCT_LOGO_256));
#else
- return base::nullopt;
+ return absl::nullopt;
#endif
}
@@ -5584,7 +5584,7 @@
ChromeContentBrowserClient::GetInterestCohortForJsApi(
content::WebContents* web_contents,
const GURL& url,
- const base::Optional<url::Origin>& top_frame_origin) {
+ const absl::optional<url::Origin>& top_frame_origin) {
federated_learning::FlocEligibilityObserver::GetOrCreateForCurrentDocument(
web_contents->GetMainFrame())
->OnInterestCohortApiUsed();
@@ -5642,7 +5642,7 @@
content::BrowserContext* browser_context,
const GURL& url,
const GURL& site_for_cookies,
- const base::Optional<url::Origin>& top_frame_origin) {
+ const absl::optional<url::Origin>& top_frame_origin) {
// Persistent MediaDevice IDs are allowed if cookies are allowed.
return CookieSettingsFactory::GetForProfile(
Profile::FromBrowserContext(browser_context))
@@ -5653,9 +5653,9 @@
base::OnceClosure ChromeContentBrowserClient::FetchRemoteSms(
content::WebContents* web_contents,
const url::Origin& origin,
- base::OnceCallback<void(base::Optional<std::vector<url::Origin>>,
- base::Optional<std::string>,
- base::Optional<content::SmsFetchFailureType>)>
+ base::OnceCallback<void(absl::optional<std::vector<url::Origin>>,
+ absl::optional<std::string>,
+ absl::optional<content::SmsFetchFailureType>)>
callback) {
return ::FetchRemoteSms(web_contents, origin, std::move(callback));
}
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index dbc831e8..14ac158 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -194,7 +194,7 @@
ui::PageTransition* transition,
bool* is_renderer_initiated,
content::Referrer* referrer,
- base::Optional<url::Origin>* initiator_origin) override;
+ absl::optional<url::Origin>* initiator_origin) override;
bool ShouldStayInParentProcessForNTP(
const GURL& url,
content::SiteInstance* parent_site_instance) override;
@@ -241,17 +241,17 @@
bool AllowAppCache(const GURL& manifest_url,
const GURL& site_for_cookies,
- const base::Optional<url::Origin>& top_frame_origin,
+ const absl::optional<url::Origin>& top_frame_origin,
content::BrowserContext* context) override;
content::AllowServiceWorkerResult AllowServiceWorker(
const GURL& scope,
const GURL& site_for_cookies,
- const base::Optional<url::Origin>& top_frame_origin,
+ const absl::optional<url::Origin>& top_frame_origin,
const GURL& script_url,
content::BrowserContext* context) override;
bool AllowSharedWorker(const GURL& worker_url,
const GURL& site_for_cookies,
- const base::Optional<url::Origin>& top_frame_origin,
+ const absl::optional<url::Origin>& top_frame_origin,
const std::string& name,
const storage::StorageKey& storage_key,
content::BrowserContext* context,
@@ -492,7 +492,7 @@
int render_process_id,
URLLoaderFactoryType type,
const url::Origin& request_initiator,
- base::Optional<int64_t> navigation_id,
+ absl::optional<int64_t> navigation_id,
ukm::SourceIdObj ukm_source_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
@@ -516,7 +516,7 @@
WebSocketFactory factory,
const GURL& url,
const net::SiteForCookies& site_for_cookies,
- const base::Optional<std::string>& user_agent,
+ const absl::optional<std::string>& user_agent,
mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
handshake_client) override;
bool WillCreateRestrictedCookieManager(
@@ -588,7 +588,7 @@
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
override;
std::unique_ptr<content::OverlayWindow> CreateWindowForPictureInPicture(
@@ -597,7 +597,7 @@
content::BrowserContext* browser_context,
mojo::PendingRemote<blink::mojom::RendererPreferenceWatcher> watcher)
override;
- base::Optional<std::string> GetOriginPolicyErrorPage(
+ absl::optional<std::string> GetOriginPolicyErrorPage(
network::OriginPolicyState error_reason,
content::NavigationHandle* handle) override;
bool CanAcceptUntrustedExchangesIfNeeded() override;
@@ -616,7 +616,7 @@
std::string GetUserAgent() override;
blink::UserAgentMetadata GetUserAgentMetadata() override;
- base::Optional<gfx::ImageSkia> GetProductLogo() override;
+ absl::optional<gfx::ImageSkia> GetProductLogo() override;
bool IsBuiltinComponent(content::BrowserContext* browser_context,
const url::Origin& origin) override;
@@ -644,7 +644,7 @@
blink::mojom::InterestCohortPtr GetInterestCohortForJsApi(
content::WebContents* web_contents,
const GURL& url,
- const base::Optional<url::Origin>& top_frame_origin) override;
+ const absl::optional<url::Origin>& top_frame_origin) override;
bool IsBluetoothScanningBlocked(content::BrowserContext* browser_context,
const url::Origin& requesting_origin,
@@ -660,15 +660,15 @@
content::BrowserContext* browser_context,
const GURL& scope,
const GURL& site_for_cookies,
- const base::Optional<url::Origin>& top_frame_origin) override;
+ const absl::optional<url::Origin>& top_frame_origin) override;
#if !defined(OS_ANDROID)
base::OnceClosure FetchRemoteSms(
content::WebContents* web_contents,
const url::Origin& origin,
- base::OnceCallback<void(base::Optional<std::vector<url::Origin>>,
- base::Optional<std::string>,
- base::Optional<content::SmsFetchFailureType>)>
+ base::OnceCallback<void(absl::optional<std::vector<url::Origin>>,
+ absl::optional<std::string>,
+ absl::optional<content::SmsFetchFailureType>)>
callback) override;
#endif
diff --git a/chrome/browser/chrome_content_browser_client_unittest.cc b/chrome/browser/chrome_content_browser_client_unittest.cc
index f3ae8ac3..3947647 100644
--- a/chrome/browser/chrome_content_browser_client_unittest.cc
+++ b/chrome/browser/chrome_content_browser_client_unittest.cc
@@ -164,7 +164,7 @@
ui::PageTransition transition;
bool is_renderer_initiated;
content::Referrer referrer = content::Referrer();
- base::Optional<url::Origin> initiator_origin = base::nullopt;
+ absl::optional<url::Origin> initiator_origin = absl::nullopt;
scoped_refptr<content::SiteInstance> site_instance =
content::SiteInstance::CreateForURL(browser()->profile(),
@@ -172,7 +172,7 @@
transition = ui::PAGE_TRANSITION_LINK;
is_renderer_initiated = true;
// The origin is a placeholder to test that |initiator_origin| is set to
- // base::nullopt and is not meant to represent what would happen in practice.
+ // absl::nullopt and is not meant to represent what would happen in practice.
initiator_origin = url::Origin::Create(GURL("https://www.example.com"));
client.OverrideNavigationParams(nullptr, site_instance.get(), &transition,
&is_renderer_initiated, &referrer,
@@ -180,7 +180,7 @@
EXPECT_TRUE(ui::PageTransitionCoreTypeIs(ui::PAGE_TRANSITION_AUTO_BOOKMARK,
transition));
EXPECT_FALSE(is_renderer_initiated);
- EXPECT_EQ(base::nullopt, initiator_origin);
+ EXPECT_EQ(absl::nullopt, initiator_origin);
site_instance = content::SiteInstance::CreateForURL(
browser()->profile(), GURL("chrome://new-tab-page"));
@@ -193,7 +193,7 @@
EXPECT_TRUE(ui::PageTransitionCoreTypeIs(ui::PAGE_TRANSITION_AUTO_BOOKMARK,
transition));
EXPECT_FALSE(is_renderer_initiated);
- EXPECT_EQ(base::nullopt, initiator_origin);
+ EXPECT_EQ(absl::nullopt, initiator_origin);
// No change for transitions that are not PAGE_TRANSITION_LINK.
site_instance = content::SiteInstance::CreateForURL(
diff --git a/chrome/browser/chrome_render_widget_host_browsertests.cc b/chrome/browser/chrome_render_widget_host_browsertests.cc
index d3d55d8..6e1095c 100644
--- a/chrome/browser/chrome_render_widget_host_browsertests.cc
+++ b/chrome/browser/chrome_render_widget_host_browsertests.cc
@@ -241,7 +241,7 @@
// On MacOS, calling omnibox->SetFocus function doesn't invoke
// RWHI::SetActive. Hence there is no IPC call to renderer and
// FakeFrameWidget's 'active' state remains uninitialised.
- EXPECT_EQ(fake_frame_widget.GetActive(), base::nullopt);
+ EXPECT_EQ(fake_frame_widget.GetActive(), absl::nullopt);
#else
EXPECT_EQ(fake_frame_widget.GetActive(), false);
#endif
diff --git a/chrome/browser/chrome_service_worker_browsertest.cc b/chrome/browser/chrome_service_worker_browsertest.cc
index 81dd3f7..99b86518 100644
--- a/chrome/browser/chrome_service_worker_browsertest.cc
+++ b/chrome/browser/chrome_service_worker_browsertest.cc
@@ -948,7 +948,7 @@
base::test::ScopedFeatureList scoped_feature_list_;
// The request that hit the "test" endpoint.
- base::Optional<net::test_server::HttpRequest> received_request_;
+ absl::optional<net::test_server::HttpRequest> received_request_;
DISALLOW_COPY_AND_ASSIGN(ChromeServiceWorkerNavigationPreloadTest);
};
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_manager.h b/chrome/browser/chromeos/android_sms/android_sms_app_manager.h
index 99952007..d155a350 100644
--- a/chrome/browser/chromeos/android_sms/android_sms_app_manager.h
+++ b/chrome/browser/chromeos/android_sms/android_sms_app_manager.h
@@ -8,8 +8,8 @@
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "chromeos/services/multidevice_setup/public/cpp/android_sms_app_helper_delegate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace chromeos {
@@ -36,7 +36,7 @@
~AndroidSmsAppManager() override;
// If no app is installed, null is returned.
- virtual base::Optional<GURL> GetCurrentAppUrl() = 0;
+ virtual absl::optional<GURL> GetCurrentAppUrl() = 0;
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.cc b/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.cc
index ebf3073..b9238d7 100644
--- a/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.cc
+++ b/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.cc
@@ -104,10 +104,10 @@
AndroidSmsAppManagerImpl::~AndroidSmsAppManagerImpl() = default;
-base::Optional<GURL> AndroidSmsAppManagerImpl::GetCurrentAppUrl() {
- base::Optional<PwaDomain> domain = GetInstalledPwaDomain();
+absl::optional<GURL> AndroidSmsAppManagerImpl::GetCurrentAppUrl() {
+ absl::optional<PwaDomain> domain = GetInstalledPwaDomain();
if (!domain)
- return base::nullopt;
+ return absl::nullopt;
return GetAndroidMessagesURL(false /* use_install_url */, *domain);
}
@@ -117,7 +117,7 @@
if (is_new_app_setup_in_progress_)
return;
- base::Optional<PwaDomain> migrating_from =
+ absl::optional<PwaDomain> migrating_from =
GetInstalledPwaDomainForMigration();
// If the preferred domain is already installed, no migration is happening at
@@ -143,7 +143,7 @@
void AndroidSmsAppManagerImpl::TearDownAndroidSmsApp() {
pref_service_->SetString(kLastSuccessfulDomainPref, std::string());
- base::Optional<GURL> installed_app_url = GetCurrentAppUrl();
+ absl::optional<GURL> installed_app_url = GetCurrentAppUrl();
if (!installed_app_url)
return;
@@ -172,7 +172,7 @@
pwa_delegate_->ExecuteOnAppRegistryReady(profile_, std::move(task));
}
-base::Optional<PwaDomain> AndroidSmsAppManagerImpl::GetInstalledPwaDomain() {
+absl::optional<PwaDomain> AndroidSmsAppManagerImpl::GetInstalledPwaDomain() {
PwaDomain preferred_domain = GetPreferredPwaDomain();
if (setup_controller_->GetPwa(GetAndroidMessagesURL(
true /* use_install_url */, preferred_domain))) {
@@ -183,7 +183,7 @@
return GetInstalledPwaDomainForMigration();
}
-base::Optional<PwaDomain>
+absl::optional<PwaDomain>
AndroidSmsAppManagerImpl::GetInstalledPwaDomainForMigration() {
for (auto* it = std::begin(kDomains); it != std::end(kDomains); ++it) {
if (setup_controller_->GetPwa(
@@ -192,14 +192,14 @@
}
}
- return base::nullopt;
+ return absl::nullopt;
}
void AndroidSmsAppManagerImpl::CompleteAsyncInitialization() {
// Must wait until the app registry is ready before querying the current url.
last_installed_url_ = GetCurrentAppUrl();
- base::Optional<PwaDomain> domain = GetInstalledPwaDomain();
+ absl::optional<PwaDomain> domain = GetInstalledPwaDomain();
// If no app was installed before this object was created, there is nothing
// else to initialize.
@@ -219,7 +219,7 @@
}
void AndroidSmsAppManagerImpl::NotifyInstalledAppUrlChangedIfNecessary() {
- base::Optional<GURL> installed_app_url = GetCurrentAppUrl();
+ absl::optional<GURL> installed_app_url = GetCurrentAppUrl();
if (last_installed_url_ == installed_app_url)
return;
@@ -228,12 +228,12 @@
}
void AndroidSmsAppManagerImpl::OnSetUpNewAppResult(
- const base::Optional<PwaDomain>& migrating_from,
+ const absl::optional<PwaDomain>& migrating_from,
const GURL& install_url,
bool success) {
is_new_app_setup_in_progress_ = false;
- base::Optional<web_app::AppId> new_pwa = setup_controller_->GetPwa(
+ absl::optional<web_app::AppId> new_pwa = setup_controller_->GetPwa(
GetAndroidMessagesURL(true /* use_install_url */));
// If the app failed to install or the PWA does not exist, do not launch.
@@ -252,7 +252,7 @@
return;
}
- base::Optional<web_app::AppId> old_pwa = setup_controller_->GetPwa(
+ absl::optional<web_app::AppId> old_pwa = setup_controller_->GetPwa(
GetAndroidMessagesURL(true /* use_install_url */, *migrating_from));
// Transfer attributes from the old PWA to the new one. This ensures that the
@@ -278,7 +278,7 @@
}
void AndroidSmsAppManagerImpl::OnRemoveOldAppResult(
- const base::Optional<PwaDomain>& migrating_from,
+ const absl::optional<PwaDomain>& migrating_from,
bool success) {
// If app removal fails, log an error but continue anyway, since clients
// should still be notified of the URL change.
@@ -300,7 +300,7 @@
is_app_launch_pending_ = false;
// If launch was requested but setup failed, there is no app to launch.
- base::Optional<PwaDomain> domain = GetInstalledPwaDomain();
+ absl::optional<PwaDomain> domain = GetInstalledPwaDomain();
if (!domain)
return;
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.h b/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.h
index d4ab70a5..894389a 100644
--- a/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.h
+++ b/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl.h
@@ -11,11 +11,11 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/chromeos/android_sms/android_sms_app_manager.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class PrefRegistrySimple;
@@ -64,7 +64,7 @@
friend class AndroidSmsAppManagerImplTest;
// AndroidSmsAppManager:
- base::Optional<GURL> GetCurrentAppUrl() override;
+ absl::optional<GURL> GetCurrentAppUrl() override;
// AndroidSmsAppHelperDelegate:
void SetUpAndroidSmsApp() override;
@@ -75,14 +75,14 @@
bool IsAppRegistryReady() override;
void ExecuteOnAppRegistryReady(base::OnceClosure task) override;
- base::Optional<PwaDomain> GetInstalledPwaDomain();
- base::Optional<PwaDomain> GetInstalledPwaDomainForMigration();
+ absl::optional<PwaDomain> GetInstalledPwaDomain();
+ absl::optional<PwaDomain> GetInstalledPwaDomainForMigration();
void CompleteAsyncInitialization();
void NotifyInstalledAppUrlChangedIfNecessary();
- void OnSetUpNewAppResult(const base::Optional<PwaDomain>& migrating_from,
+ void OnSetUpNewAppResult(const absl::optional<PwaDomain>& migrating_from,
const GURL& install_url,
bool success);
- void OnRemoveOldAppResult(const base::Optional<PwaDomain>& migrating_from,
+ void OnRemoveOldAppResult(const absl::optional<PwaDomain>& migrating_from,
bool success);
void HandleAppSetupFinished();
@@ -100,7 +100,7 @@
// The installed app URL, initialized when app registry is ready and updated
// any time NotifyInstalledAppUrlChanged() is invoked.
- base::Optional<GURL> last_installed_url_;
+ absl::optional<GURL> last_installed_url_;
std::unique_ptr<PwaDelegate> pwa_delegate_;
base::WeakPtrFactory<AndroidSmsAppManagerImpl> weak_ptr_factory_{this};
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl_unittest.cc b/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl_unittest.cc
index 1a69078..4695100 100644
--- a/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl_unittest.cc
+++ b/chrome/browser/chromeos/android_sms/android_sms_app_manager_impl_unittest.cc
@@ -175,7 +175,7 @@
GetAndroidMessagesURL() /* expected_app_url */,
GetAndroidMessagesURL(
true /* use_install_url */) /* expected_install_url */,
- base::nullopt /* id_for_app */);
+ absl::nullopt /* id_for_app */);
// Verify that no installed app exists and no observers were notified.
EXPECT_FALSE(fake_android_sms_app_setup_controller()->GetAppMetadataAtUrl(
@@ -267,7 +267,7 @@
GetAndroidMessagesURL() /* expected_app_url */,
GetAndroidMessagesURL(
true /* use_install_url */) /* expected_install_url */,
- base::nullopt /* id_for_app */);
+ absl::nullopt /* id_for_app */);
// Verify that the new app was not installed and no observers were notified.
EXPECT_FALSE(fake_android_sms_app_setup_controller()->GetAppMetadataAtUrl(
@@ -357,7 +357,7 @@
// Now uninstall the app and verify that the app manager registers it.
fake_android_sms_app_setup_controller()->SetAppAtUrl(install_url,
- base::nullopt);
+ absl::nullopt);
EXPECT_TRUE(android_sms_app_manager()->HasAppBeenManuallyUninstalledByUser());
}
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller.h b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller.h
index db29328..80e7c32 100644
--- a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller.h
+++ b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller.h
@@ -36,8 +36,8 @@
SuccessCallback callback) = 0;
// Returns the id for the PWA at |install_url|; if no PWA exists,
- // base::nullopt is returned.
- virtual base::Optional<web_app::AppId> GetPwa(const GURL& install_url) = 0;
+ // absl::nullopt is returned.
+ virtual absl::optional<web_app::AppId> GetPwa(const GURL& install_url) = 0;
// Deletes the cookie which causes the PWA to remember this computer by
// default. Note that this does not actually stop the PWA from remembering
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl.cc b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl.cc
index 9074320..6d3fc7d 100644
--- a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl.cc
+++ b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl.cc
@@ -12,7 +12,6 @@
#include "base/containers/flat_map.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/components/external_install_options.h"
@@ -28,6 +27,7 @@
#include "net/base/url_util.h"
#include "net/cookies/cookie_util.h"
#include "services/network/public/mojom/cookie_manager.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom.h"
#include "url/gurl.h"
@@ -52,7 +52,7 @@
AndroidSmsAppSetupControllerImpl::PwaDelegate::~PwaDelegate() = default;
-base::Optional<web_app::AppId>
+absl::optional<web_app::AppId>
AndroidSmsAppSetupControllerImpl::PwaDelegate::GetPwaForUrl(
const GURL& install_url,
Profile* profile) {
@@ -123,7 +123,7 @@
std::move(callback)));
}
-base::Optional<web_app::AppId> AndroidSmsAppSetupControllerImpl::GetPwa(
+absl::optional<web_app::AppId> AndroidSmsAppSetupControllerImpl::GetPwa(
const GURL& install_url) {
return pwa_delegate_->GetPwaForUrl(install_url, profile_);
}
@@ -152,7 +152,7 @@
const GURL& install_url,
const GURL& migrated_to_app_url,
SuccessCallback callback) {
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
pwa_delegate_->GetPwaForUrl(install_url, profile_);
// If there is no app installed at |url|, there is nothing more to do.
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl.h b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl.h
index 83fd14c..71cf9d9 100644
--- a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl.h
+++ b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl.h
@@ -56,7 +56,7 @@
PwaDelegate();
virtual ~PwaDelegate();
- virtual base::Optional<web_app::AppId> GetPwaForUrl(const GURL& install_url,
+ virtual absl::optional<web_app::AppId> GetPwaForUrl(const GURL& install_url,
Profile* profile);
virtual network::mojom::CookieManager* GetCookieManager(const GURL& app_url,
Profile* profile);
@@ -69,7 +69,7 @@
void SetUpApp(const GURL& app_url,
const GURL& install_url,
SuccessCallback callback) override;
- base::Optional<web_app::AppId> GetPwa(const GURL& install_url) override;
+ absl::optional<web_app::AppId> GetPwa(const GURL& install_url) override;
void DeleteRememberDeviceByDefaultCookie(const GURL& app_url,
SuccessCallback callback) override;
void RemoveApp(const GURL& app_url,
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl_unittest.cc b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl_unittest.cc
index 001f20db..d2b50a2 100644
--- a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl_unittest.cc
+++ b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl_unittest.cc
@@ -146,10 +146,10 @@
}
// AndroidSmsAppSetupControllerImpl::PwaDelegate:
- base::Optional<web_app::AppId> GetPwaForUrl(const GURL& install_url,
+ absl::optional<web_app::AppId> GetPwaForUrl(const GURL& install_url,
Profile* profile) override {
if (!base::Contains(url_to_pwa_map_, install_url))
- return base::nullopt;
+ return absl::nullopt;
return url_to_pwa_map_[install_url];
}
@@ -423,9 +423,9 @@
content::BrowserTaskEnvironment task_environment_;
- base::Optional<bool> last_set_up_app_result_;
- base::Optional<bool> last_delete_cookie_result_;
- base::Optional<bool> last_remove_app_result_;
+ absl::optional<bool> last_set_up_app_result_;
+ absl::optional<bool> last_delete_cookie_result_;
+ absl::optional<bool> last_remove_app_result_;
TestingProfile profile_;
HostContentSettingsMap* host_content_settings_map_;
diff --git a/chrome/browser/chromeos/android_sms/android_sms_pairing_state_tracker_impl.cc b/chrome/browser/chromeos/android_sms/android_sms_pairing_state_tracker_impl.cc
index b2e2fb0..b426b0a 100644
--- a/chrome/browser/chromeos/android_sms/android_sms_pairing_state_tracker_impl.cc
+++ b/chrome/browser/chromeos/android_sms/android_sms_pairing_state_tracker_impl.cc
@@ -99,7 +99,7 @@
// If the app registry is not ready, we can't see check what is currently
// installed.
if (android_sms_app_manager_->IsAppRegistryReady()) {
- base::Optional<GURL> app_url = android_sms_app_manager_->GetCurrentAppUrl();
+ absl::optional<GURL> app_url = android_sms_app_manager_->GetCurrentAppUrl();
if (app_url)
return *app_url;
}
diff --git a/chrome/browser/chromeos/android_sms/connection_manager.cc b/chrome/browser/chromeos/android_sms/connection_manager.cc
index c88df09..a358c5b 100644
--- a/chrome/browser/chromeos/android_sms/connection_manager.cc
+++ b/chrome/browser/chromeos/android_sms/connection_manager.cc
@@ -135,7 +135,7 @@
}
void ConnectionManager::UpdateConnectionStatus() {
- base::Optional<GURL> updated_pwa_url =
+ absl::optional<GURL> updated_pwa_url =
ConnectionManager::GenerateEnabledPwaUrl();
if (enabled_pwa_url_ == updated_pwa_url)
return;
@@ -161,16 +161,16 @@
StartConnection();
}
-base::Optional<GURL> ConnectionManager::GenerateEnabledPwaUrl() {
+absl::optional<GURL> ConnectionManager::GenerateEnabledPwaUrl() {
const auto it = multidevice_setup_client_->GetFeatureStates().find(
multidevice_setup::mojom::Feature::kMessages);
// If the feature is not enabled, there is no enabled URL.
if (it->second != multidevice_setup::mojom::FeatureState::kEnabledByUser)
- return base::nullopt;
+ return absl::nullopt;
// Return the installed app URL if the PWA is installed.
- base::Optional<GURL> installed_url =
+ absl::optional<GURL> installed_url =
android_sms_app_manager_->GetCurrentAppUrl();
if (installed_url)
return installed_url;
diff --git a/chrome/browser/chromeos/android_sms/connection_manager.h b/chrome/browser/chromeos/android_sms/connection_manager.h
index 5ea9b0e..3901046 100644
--- a/chrome/browser/chromeos/android_sms/connection_manager.h
+++ b/chrome/browser/chromeos/android_sms/connection_manager.h
@@ -94,7 +94,7 @@
feature_state_map) override;
void UpdateConnectionStatus();
- base::Optional<GURL> GenerateEnabledPwaUrl();
+ absl::optional<GURL> GenerateEnabledPwaUrl();
content::ServiceWorkerContext* GetCurrentServiceWorkerContext();
void SetServiceWorkerProviderForTesting(
@@ -109,15 +109,15 @@
// Version ID of the Android Messages for Web service worker that's currently
// active i.e., capable of handling messages and controlling pages.
- base::Optional<int64_t> active_version_id_;
+ absl::optional<int64_t> active_version_id_;
// Version ID of the previously active Android Messages for Web
// service worker.
- base::Optional<int64_t> prev_active_version_id_;
+ absl::optional<int64_t> prev_active_version_id_;
// The URL of the Android Messages PWA, if it is currently enabled. If the
// feature is not currently enabled, this field is null.
- base::Optional<GURL> enabled_pwa_url_;
+ absl::optional<GURL> enabled_pwa_url_;
DISALLOW_COPY_AND_ASSIGN(ConnectionManager);
};
diff --git a/chrome/browser/chromeos/android_sms/connection_manager_unittest.cc b/chrome/browser/chromeos/android_sms/connection_manager_unittest.cc
index 15479d0..54071e3 100644
--- a/chrome/browser/chromeos/android_sms/connection_manager_unittest.cc
+++ b/chrome/browser/chromeos/android_sms/connection_manager_unittest.cc
@@ -149,7 +149,7 @@
void SetPwaState(PwaState pwa_state) {
if (pwa_state == PwaState::kDisabled) {
- fake_android_sms_app_manager_->SetInstalledAppUrl(base::nullopt);
+ fake_android_sms_app_manager_->SetInstalledAppUrl(absl::nullopt);
fake_multidevice_setup_client_->SetFeatureState(
multidevice_setup::mojom::Feature::kMessages,
multidevice_setup::mojom::FeatureState::kDisabledByUser);
diff --git a/chrome/browser/chromeos/android_sms/fake_android_sms_app_manager.cc b/chrome/browser/chromeos/android_sms/fake_android_sms_app_manager.cc
index 75e6a72..0145ae0 100644
--- a/chrome/browser/chromeos/android_sms/fake_android_sms_app_manager.cc
+++ b/chrome/browser/chromeos/android_sms/fake_android_sms_app_manager.cc
@@ -15,7 +15,7 @@
FakeAndroidSmsAppManager::~FakeAndroidSmsAppManager() = default;
void FakeAndroidSmsAppManager::SetInstalledAppUrl(
- const base::Optional<GURL>& url) {
+ const absl::optional<GURL>& url) {
if (url == url_)
return;
@@ -23,7 +23,7 @@
NotifyInstalledAppUrlChanged();
}
-base::Optional<GURL> FakeAndroidSmsAppManager::GetCurrentAppUrl() {
+absl::optional<GURL> FakeAndroidSmsAppManager::GetCurrentAppUrl() {
return url_;
}
diff --git a/chrome/browser/chromeos/android_sms/fake_android_sms_app_manager.h b/chrome/browser/chromeos/android_sms/fake_android_sms_app_manager.h
index ba290b4b..a7312ac 100644
--- a/chrome/browser/chromeos/android_sms/fake_android_sms_app_manager.h
+++ b/chrome/browser/chromeos/android_sms/fake_android_sms_app_manager.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_CHROMEOS_ANDROID_SMS_FAKE_ANDROID_SMS_APP_MANAGER_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/android_sms/android_sms_app_manager.h"
#include "chromeos/services/multidevice_setup/public/cpp/fake_android_sms_app_helper_delegate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace chromeos {
@@ -27,13 +27,13 @@
FakeAndroidSmsAppManager();
~FakeAndroidSmsAppManager() override;
- void SetInstalledAppUrl(const base::Optional<GURL>& url);
+ void SetInstalledAppUrl(const absl::optional<GURL>& url);
private:
// AndroidSmsAppManager:
- base::Optional<GURL> GetCurrentAppUrl() override;
+ absl::optional<GURL> GetCurrentAppUrl() override;
- base::Optional<GURL> url_;
+ absl::optional<GURL> url_;
DISALLOW_COPY_AND_ASSIGN(FakeAndroidSmsAppManager);
};
diff --git a/chrome/browser/chromeos/android_sms/fake_android_sms_app_setup_controller.cc b/chrome/browser/chromeos/android_sms/fake_android_sms_app_setup_controller.cc
index 69e1ac5..eb1c512e 100644
--- a/chrome/browser/chromeos/android_sms/fake_android_sms_app_setup_controller.cc
+++ b/chrome/browser/chromeos/android_sms/fake_android_sms_app_setup_controller.cc
@@ -34,7 +34,7 @@
void FakeAndroidSmsAppSetupController::SetAppAtUrl(
const GURL& install_url,
- const base::Optional<web_app::AppId>& id_for_app) {
+ const absl::optional<web_app::AppId>& id_for_app) {
if (!id_for_app) {
install_url_to_metadata_map_.erase(install_url);
return;
@@ -46,7 +46,7 @@
void FakeAndroidSmsAppSetupController::CompletePendingSetUpAppRequest(
const GURL& expected_app_url,
const GURL& expected_install_url,
- const base::Optional<web_app::AppId>& id_for_app) {
+ const absl::optional<web_app::AppId>& id_for_app) {
DCHECK(!pending_set_up_app_requests_.empty());
auto request = std::move(pending_set_up_app_requests_.front());
@@ -96,7 +96,7 @@
DCHECK_EQ(expected_migrated_to_app_url, std::get<2>(*request));
if (should_succeed)
- SetAppAtUrl(expected_install_url, base::nullopt /* id_for_app */);
+ SetAppAtUrl(expected_install_url, absl::nullopt /* id_for_app */);
std::move(std::get<3>(*request)).Run(should_succeed);
}
@@ -108,11 +108,11 @@
app_url, install_url, std::move(callback)));
}
-base::Optional<web_app::AppId> FakeAndroidSmsAppSetupController::GetPwa(
+absl::optional<web_app::AppId> FakeAndroidSmsAppSetupController::GetPwa(
const GURL& install_url) {
auto it = install_url_to_metadata_map_.find(install_url);
if (it == install_url_to_metadata_map_.end())
- return base::nullopt;
+ return absl::nullopt;
return it->second.pwa;
}
diff --git a/chrome/browser/chromeos/android_sms/fake_android_sms_app_setup_controller.h b/chrome/browser/chromeos/android_sms/fake_android_sms_app_setup_controller.h
index 951e78b..5cbffb0 100644
--- a/chrome/browser/chromeos/android_sms/fake_android_sms_app_setup_controller.h
+++ b/chrome/browser/chromeos/android_sms/fake_android_sms_app_setup_controller.h
@@ -12,9 +12,9 @@
#include "base/containers/flat_map.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/android_sms/android_sms_app_setup_controller.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace chromeos {
@@ -43,7 +43,7 @@
// ID at |install_url|. Otherwise, this function removes any existing app at
// that URL.
void SetAppAtUrl(const GURL& install_url,
- const base::Optional<web_app::AppId>& id_for_app);
+ const absl::optional<web_app::AppId>& id_for_app);
// Completes a pending setup request (i.e., a previous call to SetUpApp()).
// If |id_for_app| is set, the request is successful and the installed app
@@ -51,7 +51,7 @@
void CompletePendingSetUpAppRequest(
const GURL& expected_app_url,
const GURL& expected_install_url,
- const base::Optional<web_app::AppId>& id_for_app);
+ const absl::optional<web_app::AppId>& id_for_app);
// Completes a pending cookie deletion request (i.e., a previous call to
// DeleteRememberDeviceByDefaultCookie()).
@@ -71,7 +71,7 @@
void SetUpApp(const GURL& app_url,
const GURL& install_url,
SuccessCallback callback) override;
- base::Optional<web_app::AppId> GetPwa(const GURL& install_url) override;
+ absl::optional<web_app::AppId> GetPwa(const GURL& install_url) override;
void DeleteRememberDeviceByDefaultCookie(const GURL& app_url,
SuccessCallback callback) override;
void RemoveApp(const GURL& app_url,
diff --git a/chrome/browser/chromeos/android_sms/fcm_connection_establisher.h b/chrome/browser/chromeos/android_sms/fcm_connection_establisher.h
index 44132fa9..40fe8ac 100644
--- a/chrome/browser/chromeos/android_sms/fcm_connection_establisher.h
+++ b/chrome/browser/chromeos/android_sms/fcm_connection_establisher.h
@@ -85,7 +85,7 @@
void OnMessageDispatchResult(bool status);
std::unique_ptr<base::OneShotTimer> retry_timer_;
- base::Optional<InFlightMessage> in_flight_message_;
+ absl::optional<InFlightMessage> in_flight_message_;
// A queue of messages to be dispatched. Messages are dispatched and retried
// one at a time from this queue.
diff --git a/chrome/browser/chromeos/android_sms/pairing_lost_notifier.cc b/chrome/browser/chromeos/android_sms/pairing_lost_notifier.cc
index 9de5a5d..cfb9ce6 100644
--- a/chrome/browser/chromeos/android_sms/pairing_lost_notifier.cc
+++ b/chrome/browser/chromeos/android_sms/pairing_lost_notifier.cc
@@ -155,7 +155,7 @@
}
void PairingLostNotifier::OnPairingLostNotificationClick(
- base::Optional<int> button_index) {
+ absl::optional<int> button_index) {
PA_LOG(INFO) << "PairingLostNotifier::OnPairingLostNotificationClick(): "
<< "Pairing notification clicked; opening PWA.";
diff --git a/chrome/browser/chromeos/android_sms/pairing_lost_notifier.h b/chrome/browser/chromeos/android_sms/pairing_lost_notifier.h
index 687cad6..b9e0a2d 100644
--- a/chrome/browser/chromeos/android_sms/pairing_lost_notifier.h
+++ b/chrome/browser/chromeos/android_sms/pairing_lost_notifier.h
@@ -46,7 +46,7 @@
void ShowPairingLostNotification();
void ClosePairingLostNotificationIfVisible();
- void OnPairingLostNotificationClick(base::Optional<int> button_index);
+ void OnPairingLostNotificationClick(absl::optional<int> button_index);
Profile* profile_;
multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client_;
diff --git a/chrome/browser/chromeos/android_sms/pairing_lost_notifier_unittest.cc b/chrome/browser/chromeos/android_sms/pairing_lost_notifier_unittest.cc
index 64319eb..144b320 100644
--- a/chrome/browser/chromeos/android_sms/pairing_lost_notifier_unittest.cc
+++ b/chrome/browser/chromeos/android_sms/pairing_lost_notifier_unittest.cc
@@ -55,7 +55,7 @@
ASSERT_TRUE(IsNotificationVisible());
display_service_tester_->SimulateClick(
NotificationHandler::Type::TRANSIENT, kPairingLostNotificationId,
- base::nullopt /* action_index */, base::nullopt /* reply */);
+ absl::nullopt /* action_index */, absl::nullopt /* reply */);
}
void SetWasPreviouslySetUpPreference(bool was_previously_set_up) {
diff --git a/chrome/browser/chromeos/chromebox_for_meetings/browser/cfm_browser_service_unittest.cc b/chrome/browser/chromeos/chromebox_for_meetings/browser/cfm_browser_service_unittest.cc
index 9c86adb1..4774da1 100644
--- a/chrome/browser/chromeos/chromebox_for_meetings/browser/cfm_browser_service_unittest.cc
+++ b/chrome/browser/chromeos/chromebox_for_meetings/browser/cfm_browser_service_unittest.cc
@@ -12,7 +12,6 @@
#include "base/macros.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
@@ -30,6 +29,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace cfm {
diff --git a/chrome/browser/chromeos/chromebox_for_meetings/device_info/device_info_service.cc b/chrome/browser/chromeos/chromebox_for_meetings/device_info/device_info_service.cc
index 17535902..8661e50b 100644
--- a/chrome/browser/chromeos/chromebox_for_meetings/device_info/device_info_service.cc
+++ b/chrome/browser/chromeos/chromebox_for_meetings/device_info/device_info_service.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/system/sys_info.h"
#include "base/time/time.h"
@@ -18,6 +17,7 @@
#include "chromeos/system/statistics_provider.h"
#include "components/version_info/version_info.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace cfm {
diff --git a/chrome/browser/chromeos/chromebox_for_meetings/device_info/device_info_service_unittest.cc b/chrome/browser/chromeos/chromebox_for_meetings/device_info/device_info_service_unittest.cc
index c6512c0..518513c 100644
--- a/chrome/browser/chromeos/chromebox_for_meetings/device_info/device_info_service_unittest.cc
+++ b/chrome/browser/chromeos/chromebox_for_meetings/device_info/device_info_service_unittest.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
@@ -35,6 +34,7 @@
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace cfm {
diff --git a/chrome/browser/chromeos/chromebox_for_meetings/diagnostics/diagnostics_service_unittest.cc b/chrome/browser/chromeos/chromebox_for_meetings/diagnostics/diagnostics_service_unittest.cc
index 8c48792..6cbf33f 100644
--- a/chrome/browser/chromeos/chromebox_for_meetings/diagnostics/diagnostics_service_unittest.cc
+++ b/chrome/browser/chromeos/chromebox_for_meetings/diagnostics/diagnostics_service_unittest.cc
@@ -9,7 +9,6 @@
#include <vector>
#include "base/bind.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/bind.h"
@@ -30,6 +29,7 @@
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace cfm {
diff --git a/chrome/browser/chromeos/chromebox_for_meetings/logger/cfm_logger_service_unittest.cc b/chrome/browser/chromeos/chromebox_for_meetings/logger/cfm_logger_service_unittest.cc
index ffd8c39..f722980 100644
--- a/chrome/browser/chromeos/chromebox_for_meetings/logger/cfm_logger_service_unittest.cc
+++ b/chrome/browser/chromeos/chromebox_for_meetings/logger/cfm_logger_service_unittest.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
@@ -29,6 +28,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace cfm {
diff --git a/chrome/browser/chromeos/chromebox_for_meetings/service_adaptor_unittest.cc b/chrome/browser/chromeos/chromebox_for_meetings/service_adaptor_unittest.cc
index 0907afa2..d9c66e9 100644
--- a/chrome/browser/chromeos/chromebox_for_meetings/service_adaptor_unittest.cc
+++ b/chrome/browser/chromeos/chromebox_for_meetings/service_adaptor_unittest.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
@@ -24,6 +23,7 @@
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using ::testing::_;
using ::testing::Invoke;
diff --git a/chrome/browser/chromeos/concierge_helper_service.cc b/chrome/browser/chromeos/concierge_helper_service.cc
index 3e7ef90..32cef73 100644
--- a/chrome/browser/chromeos/concierge_helper_service.cc
+++ b/chrome/browser/chromeos/concierge_helper_service.cc
@@ -6,19 +6,19 @@
#include "base/bind.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "chromeos/dbus/concierge/concierge_client.h"
#include "chromeos/dbus/concierge/concierge_service.pb.h"
#include "chromeos/dbus/debug_daemon/debug_daemon_client.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "content/public/browser/browser_context.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace {
void OnSetVmCpuRestriction(
- base::Optional<vm_tools::concierge::SetVmCpuRestrictionResponse> response) {
+ absl::optional<vm_tools::concierge::SetVmCpuRestrictionResponse> response) {
if (!response || !response->success()) {
LOG(ERROR) << "Failed to call SetVmCpuRestriction";
return;
@@ -49,7 +49,7 @@
auto* client = ConciergeClient::Get();
if (!client) {
LOG(WARNING) << "ConciergeClient is not available";
- OnSetVmCpuRestriction(base::nullopt);
+ OnSetVmCpuRestriction(absl::nullopt);
return;
}
client->SetVmCpuRestriction(request, base::BindOnce(&OnSetVmCpuRestriction));
diff --git a/chrome/browser/chromeos/cryptauth/client_app_metadata_provider_service.h b/chrome/browser/chromeos/cryptauth/client_app_metadata_provider_service.h
index 2f4ee3d..5cbd663 100644
--- a/chrome/browser/chromeos/cryptauth/client_app_metadata_provider_service.h
+++ b/chrome/browser/chromeos/cryptauth/client_app_metadata_provider_service.h
@@ -11,12 +11,12 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/system/sys_info.h"
#include "chromeos/services/device_sync/proto/cryptauth_client_app_metadata.pb.h"
#include "chromeos/services/device_sync/public/cpp/client_app_metadata_provider.h"
#include "components/gcm_driver/instance_id/instance_id.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefRegistrySimple;
class PrefService;
@@ -98,8 +98,8 @@
instance_id::InstanceIDProfileService* instance_id_profile_service_;
bool instance_id_recreated_ = false;
- base::Optional<std::string> pending_gcm_registration_id_;
- base::Optional<cryptauthv2::ClientAppMetadata> client_app_metadata_;
+ absl::optional<std::string> pending_gcm_registration_id_;
+ absl::optional<cryptauthv2::ClientAppMetadata> client_app_metadata_;
std::list<GetMetadataCallback> pending_callbacks_;
base::WeakPtrFactory<ClientAppMetadataProviderService> weak_ptr_factory_{
this};
diff --git a/chrome/browser/chromeos/dbus/encrypted_reporting_service_provider_unittest.cc b/chrome/browser/chromeos/dbus/encrypted_reporting_service_provider_unittest.cc
index 3e66ab3..4d97b0d 100644
--- a/chrome/browser/chromeos/dbus/encrypted_reporting_service_provider_unittest.cc
+++ b/chrome/browser/chromeos/dbus/encrypted_reporting_service_provider_unittest.cc
@@ -52,7 +52,7 @@
// Helper function composes JSON represented as base::Value from Sequencing
// information in request.
base::Value ValueFromSucceededSequencingInfo(
- const base::Optional<base::Value> request,
+ const absl::optional<base::Value> request,
bool force_confirm_flag) {
EXPECT_TRUE(request.has_value());
EXPECT_TRUE(request.value().is_dict());
diff --git a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc
index d89d17d..599cdb68 100644
--- a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc
+++ b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc
@@ -58,7 +58,7 @@
receiver_.BindNewPipeAndPassRemote();
receiver_.set_disconnect_handler(base::BindOnce(
&ProxyLookupRequest::OnProxyLookupComplete, base::Unretained(this),
- net::ERR_ABORTED, base::nullopt));
+ net::ERR_ABORTED, absl::nullopt));
network_context->LookUpProxyForURL(source_url, network_isolation_key,
std::move(proxy_lookup_client));
@@ -68,7 +68,7 @@
void OnProxyLookupComplete(
int32_t net_error,
- const base::Optional<net::ProxyInfo>& proxy_info) override {
+ const absl::optional<net::ProxyInfo>& proxy_info) override {
DCHECK_EQ(net_error == net::OK, proxy_info.has_value());
std::string error;
diff --git a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc
index 4237166..c8e7c4af 100644
--- a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc
+++ b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc
@@ -68,7 +68,7 @@
proxy_lookup_client_remote->OnProxyLookupComplete(net::OK, proxy_info);
} else {
proxy_lookup_client_remote->OnProxyLookupComplete(
- lookup_proxy_result_.error, base::nullopt);
+ lookup_proxy_result_.error, absl::nullopt);
}
}
diff --git a/chrome/browser/chromeos/eol_notification.cc b/chrome/browser/chromeos/eol_notification.cc
index 29960f9..e1c5945 100644
--- a/chrome/browser/chromeos/eol_notification.cc
+++ b/chrome/browser/chromeos/eol_notification.cc
@@ -102,7 +102,7 @@
dismiss_pref_ = prefs::kFirstEolWarningDismissed;
} else {
// |now| < FirstWarningDate() so don't show anything.
- dismiss_pref_ = base::nullopt;
+ dismiss_pref_ = absl::nullopt;
return;
}
@@ -178,8 +178,8 @@
profile_->GetPrefs()->SetBoolean(*dismiss_pref_, true);
}
-void EolNotification::Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+void EolNotification::Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
if (!button_index)
return;
diff --git a/chrome/browser/chromeos/eol_notification.h b/chrome/browser/chromeos/eol_notification.h
index ed84d41c..f1bce25 100644
--- a/chrome/browser/chromeos/eol_notification.h
+++ b/chrome/browser/chromeos/eol_notification.h
@@ -37,8 +37,8 @@
// message_center::NotificationObserver:
void Close(bool by_user) override;
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
private:
friend class EolNotificationTest;
@@ -68,7 +68,7 @@
Profile* const profile_;
// Pref which determines which warning should be displayed to the user.
- base::Optional<std::string> dismiss_pref_;
+ absl::optional<std::string> dismiss_pref_;
// Factory of callbacks.
base::WeakPtrFactory<EolNotification> weak_ptr_factory_{this};
diff --git a/chrome/browser/chromeos/eol_notification_unittest.cc b/chrome/browser/chromeos/eol_notification_unittest.cc
index fe0c8f2..f196f60 100644
--- a/chrome/browser/chromeos/eol_notification_unittest.cc
+++ b/chrome/browser/chromeos/eol_notification_unittest.cc
@@ -63,7 +63,7 @@
void DismissNotification() {
eol_notification_->Click(EolNotification::ButtonIndex::BUTTON_DISMISS,
- base::nullopt);
+ absl::nullopt);
}
void SetCurrentTimeToUtc(const char* utc_date_string) {
diff --git a/chrome/browser/chromeos/events/event_rewriter_unittest.cc b/chrome/browser/chromeos/events/event_rewriter_unittest.cc
index 67c954a..d344b4c 100644
--- a/chrome/browser/chromeos/events/event_rewriter_unittest.cc
+++ b/chrome/browser/chromeos/events/event_rewriter_unittest.cc
@@ -255,8 +255,8 @@
fake_udev_.Reset();
fake_udev_.AddFakeDevice(keyboard.name, keyboard.sys_path.value(),
- /*subsystem=*/"input", /*devnode=*/base::nullopt,
- /*devtype=*/base::nullopt,
+ /*subsystem=*/"input", /*devnode=*/absl::nullopt,
+ /*devtype=*/absl::nullopt,
std::move(sysfs_attributes),
std::move(sysfs_properties));
diff --git a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc
index 1056ac0..18c415748 100644
--- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc
+++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.cc
@@ -45,7 +45,6 @@
#include "base/lazy_instance.h"
#include "base/no_destructor.h"
#include "base/numerics/safe_conversions.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/strings/strcat.h"
@@ -157,6 +156,7 @@
#include "extensions/common/permissions/permissions_data.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "net/base/filename_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
@@ -790,7 +790,7 @@
}
struct SmoothnessTrackerInfo {
- base::Optional<ui::ThroughputTracker> tracker;
+ absl::optional<ui::ThroughputTracker> tracker;
ui::ThroughputTrackerHost::ReportCallback callback;
};
using DisplaySmoothnessTrackerInfos = std::map<int64_t, SmoothnessTrackerInfo>;
@@ -1874,7 +1874,7 @@
api::autotest_private::IsSystemWebAppOpen::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
DVLOG(1) << "AutotestPrivateIsSystemWebAppOpenFunction " << params->app_id;
- base::Optional<web_app::SystemAppType> app_type =
+ absl::optional<web_app::SystemAppType> app_type =
web_app::GetSystemWebAppTypeForAppId(profile, params->app_id);
if (!app_type)
return RespondNow(Error("No system web app is found by given app id."));
@@ -1897,7 +1897,7 @@
DVLOG(1) << "AutotestPrivateLaunchArcIntentFunction " << params->app_id << "/"
<< params->intent;
- base::Optional<std::string> launch_intent;
+ absl::optional<std::string> launch_intent;
if (!params->intent.empty())
launch_intent = params->intent;
const bool result = arc::LaunchAppWithIntent(
@@ -1950,7 +1950,7 @@
if (!provider)
return RespondNow(Error("Web Apps not enabled for profile."));
- base::Optional<web_app::SystemAppType> app_type;
+ absl::optional<web_app::SystemAppType> app_type;
for (const auto& type_and_info :
provider->system_web_app_manager().GetRegisteredSystemAppsForTesting()) {
if (type_and_info.second.internal_name == params->app_name) {
@@ -2775,7 +2775,7 @@
: public chromeos::assistant::AssistantInteractionSubscriber {
public:
using OnInteractionFinishedCallback =
- base::OnceCallback<void(const base::Optional<std::string>& error)>;
+ base::OnceCallback<void(const absl::optional<std::string>& error)>;
AssistantInteractionHelper()
: query_status_(std::make_unique<base::DictionaryValue>()) {}
@@ -2889,7 +2889,7 @@
}
void SendSuccessResponse() {
- std::move(on_interaction_finished_callback_).Run(base::nullopt);
+ std::move(on_interaction_finished_callback_).Run(absl::nullopt);
}
void SendErrorResponse(const std::string& error) {
@@ -2953,7 +2953,7 @@
}
void AutotestPrivateSendAssistantTextQueryFunction::
- OnInteractionFinishedCallback(const base::Optional<std::string>& error) {
+ OnInteractionFinishedCallback(const absl::optional<std::string>& error) {
DCHECK(!did_respond());
if (error) {
Respond(Error(error.value()));
@@ -3016,7 +3016,7 @@
}
void AutotestPrivateWaitForAssistantQueryStatusFunction::
- OnInteractionFinishedCallback(const base::Optional<std::string>& error) {
+ OnInteractionFinishedCallback(const absl::optional<std::string>& error) {
DCHECK(!did_respond());
if (error) {
Respond(Error(error.value()));
@@ -3757,7 +3757,7 @@
// Use negative number to avoid potential collision with normal use if any.
static int id_count = -10000;
- base::Optional<ash::OverviewInfo> overview_info =
+ absl::optional<ash::OverviewInfo> overview_info =
ash::OverviewTestApi().GetOverviewInfo();
auto window_list = ash::GetAppWindowList();
diff --git a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h
index 58b24874..b089601 100644
--- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h
+++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h
@@ -13,7 +13,6 @@
#include "ash/public/cpp/assistant/assistant_state.h"
#include "ash/rotator/screen_rotation_animator_observer.h"
#include "base/compiler_specific.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/timer/timer.h"
#include "chrome/browser/chromeos/printing/cups_printers_manager.h"
@@ -25,6 +24,7 @@
#include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_function_histogram_value.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/clipboard/clipboard_monitor.h"
#include "ui/base/clipboard/clipboard_observer.h"
#include "ui/display/display.h"
@@ -652,7 +652,7 @@
// will respond with an error.
void Timeout();
- base::Optional<bool> enabled_;
+ absl::optional<bool> enabled_;
base::OneShotTimer timeout_timer_;
};
@@ -692,7 +692,7 @@
ResponseAction Run() override;
// Called when the interaction finished with non-empty response.
- void OnInteractionFinishedCallback(const base::Optional<std::string>& error);
+ void OnInteractionFinishedCallback(const absl::optional<std::string>& error);
// Called when Assistant service fails to respond in a certain amount of
// time. We will respond with an error.
@@ -716,7 +716,7 @@
ResponseAction Run() override;
// Called when the current interaction finished with non-empty response.
- void OnInteractionFinishedCallback(const base::Optional<std::string>& error);
+ void OnInteractionFinishedCallback(const absl::optional<std::string>& error);
// Called when Assistant service fails to respond in a certain amount of
// time. We will respond with an error.
@@ -1019,7 +1019,7 @@
ResponseValue CheckScreenRotationAnimation();
int64_t display_id_ = display::kInvalidDisplayId;
- base::Optional<display::Display::Rotation> target_rotation_;
+ absl::optional<display::Display::Rotation> target_rotation_;
// A reference to keep the instance alive while waiting for rotation.
scoped_refptr<ExtensionFunction> self_;
};
diff --git a/chrome/browser/chromeos/extensions/document_scan/document_scan_api.h b/chrome/browser/chromeos/extensions/document_scan/document_scan_api.h
index c696701d..656b563 100644
--- a/chrome/browser/chromeos/extensions/document_scan/document_scan_api.h
+++ b/chrome/browser/chromeos/extensions/document_scan/document_scan_api.h
@@ -10,10 +10,10 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/common/extensions/api/document_scan.h"
#include "chromeos/dbus/lorgnette/lorgnette_service.pb.h"
#include "extensions/browser/extension_function.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
@@ -39,7 +39,7 @@
void OnPageReceived(std::string scanned_image, uint32_t /*page_number*/);
void OnScanCompleted(lorgnette::ScanFailureMode failure_mode);
- base::Optional<std::string> scan_data_;
+ absl::optional<std::string> scan_data_;
std::unique_ptr<document_scan::Scan::Params> params_;
};
diff --git a/chrome/browser/chromeos/extensions/document_scan/document_scan_api_unittest.cc b/chrome/browser/chromeos/extensions/document_scan/document_scan_api_unittest.cc
index 1f68ac7..8bb0d47 100644
--- a/chrome/browser/chromeos/extensions/document_scan/document_scan_api_unittest.cc
+++ b/chrome/browser/chromeos/extensions/document_scan/document_scan_api_unittest.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/ash/scanning/fake_lorgnette_scanner_manager.h"
#include "chrome/browser/ash/scanning/lorgnette_scanner_manager_factory.h"
@@ -20,6 +19,7 @@
#include "extensions/browser/api_test_utils.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/dbus/lorgnette/dbus-constants.h"
namespace extensions {
@@ -91,7 +91,7 @@
TEST_F(DocumentScanScanFunctionTest, ScanImageError) {
GetLorgnetteScannerManager()->SetGetScannerNamesResponse({kTestScannerName});
- GetLorgnetteScannerManager()->SetScanResponse(base::nullopt);
+ GetLorgnetteScannerManager()->SetScanResponse(absl::nullopt);
EXPECT_EQ("Failed to scan image",
RunFunctionAndReturnError("[{\"mimeTypes\": [\"image/png\"]}]"));
}
diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.cc b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
index bc3f5c0..01570dd 100644
--- a/chrome/browser/chromeos/extensions/file_manager/event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
@@ -440,7 +440,7 @@
EventRouter::~EventRouter() = default;
void EventRouter::OnIntentFiltersUpdated(
- const base::Optional<std::string>& package_name) {
+ const absl::optional<std::string>& package_name) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
BroadcastEvent(profile_,
extensions::events::FILE_MANAGER_PRIVATE_ON_APPS_UPDATED,
diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.h b/chrome/browser/chromeos/extensions/file_manager/event_router.h
index 32bb6cc..fc61147 100644
--- a/chrome/browser/chromeos/extensions/file_manager/event_router.h
+++ b/chrome/browser/chromeos/extensions/file_manager/event_router.h
@@ -15,7 +15,6 @@
#include "ash/public/cpp/tablet_mode_observer.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ash/drive/drive_integration_service.h"
#include "chrome/browser/ash/guest_os/guest_os_share_path.h"
#include "chrome/browser/chromeos/extensions/file_manager/device_event_router.h"
@@ -33,6 +32,7 @@
#include "extensions/browser/extension_registry_observer.h"
#include "services/network/public/cpp/network_connection_tracker.h"
#include "storage/browser/file_system/file_system_operation.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefChangeRegistrar;
class Profile;
@@ -64,7 +64,7 @@
// arc::ArcIntentHelperObserver overrides.
void OnIntentFiltersUpdated(
- const base::Optional<std::string>& package_name) override;
+ const absl::optional<std::string>& package_name) override;
// KeyedService overrides.
void Shutdown() override;
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
index 5cfe834..54f6f94 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc
@@ -326,7 +326,7 @@
bool filter_dirs,
base::OnceCallback<void(std::unique_ptr<base::ListValue>)> callback,
drive::FileError error,
- base::Optional<std::vector<drivefs::mojom::QueryItemPtr>> items) {
+ absl::optional<std::vector<drivefs::mojom::QueryItemPtr>> items) {
Profile* const profile =
Profile::FromBrowserContext(function->browser_context());
drive::DriveIntegrationService* integration_service =
@@ -385,7 +385,7 @@
std::move(query),
mojo::WrapCallbackWithDefaultInvokeIfNotRun(
std::move(on_response), drive::FileError::FILE_ERROR_ABORT,
- base::Optional<std::vector<drivefs::mojom::QueryItemPtr>>()));
+ absl::optional<std::vector<drivefs::mojom::QueryItemPtr>>()));
}
void UmaEmitSearchOutcome(
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_thumbnail.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_thumbnail.cc
index b9307d1..834392a 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_thumbnail.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_thumbnail.cc
@@ -170,12 +170,12 @@
base::BindOnce(&FileManagerPrivateInternalGetDriveThumbnailFunction::
GotThumbnail,
this),
- base::nullopt));
+ absl::nullopt));
return RespondLater();
}
void FileManagerPrivateInternalGetDriveThumbnailFunction::GotThumbnail(
- const base::Optional<std::vector<uint8_t>>& data) {
+ const absl::optional<std::vector<uint8_t>>& data) {
if (!data) {
Respond(OneArgument(base::Value("")));
return;
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_thumbnail.h b/chrome/browser/chromeos/extensions/file_manager/private_api_thumbnail.h
index b8adc66..941e06f 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_thumbnail.h
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_thumbnail.h
@@ -51,7 +51,7 @@
private:
// A callback invoked when thumbnail data has been generated.
- void GotThumbnail(const base::Optional<std::vector<uint8_t>>& data);
+ void GotThumbnail(const absl::optional<std::vector<uint8_t>>& data);
};
class FileManagerPrivateInternalGetPdfThumbnailFunction
diff --git a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc
index 45353a42..647796a1 100644
--- a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc
+++ b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc
@@ -66,11 +66,11 @@
private:
void ClickButton() {
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
NotificationDisplayServiceTester::Get()->GetNotification(
file_system_info_.mount_path().value());
if (notification)
- notification->delegate()->Click(0, base::nullopt);
+ notification->delegate()->Click(0, absl::nullopt);
}
ProvidedFileSystemInfo file_system_info_;
diff --git a/chrome/browser/chromeos/extensions/login_screen/login_screen_storage/login_screen_storage_api.cc b/chrome/browser/chromeos/extensions/login_screen/login_screen_storage/login_screen_storage_api.cc
index 8b9354d..e6612327 100644
--- a/chrome/browser/chromeos/extensions/login_screen/login_screen_storage/login_screen_storage_api.cc
+++ b/chrome/browser/chromeos/extensions/login_screen/login_screen_storage/login_screen_storage_api.cc
@@ -27,13 +27,13 @@
default;
void LoginScreenStorageExtensionFunction::OnDataStored(
- base::Optional<std::string> error) {
+ absl::optional<std::string> error) {
Respond(error ? Error(*error) : NoArguments());
}
void LoginScreenStorageExtensionFunction::OnDataRetrieved(
- base::Optional<std::string> data,
- base::Optional<std::string> error) {
+ absl::optional<std::string> data,
+ absl::optional<std::string> error) {
if (error) {
Respond(Error(*error));
return;
@@ -62,7 +62,7 @@
std::vector<std::string> extension_ids,
const login_manager::LoginScreenStorageMetadata& metadata,
const std::string& data,
- base::Optional<std::string> error) {
+ absl::optional<std::string> error) {
if (error) {
Respond(Error(*error));
return;
diff --git a/chrome/browser/chromeos/extensions/login_screen/login_screen_storage/login_screen_storage_api.h b/chrome/browser/chromeos/extensions/login_screen/login_screen_storage/login_screen_storage_api.h
index b78f87d8..a44c715 100644
--- a/chrome/browser/chromeos/extensions/login_screen/login_screen_storage/login_screen_storage_api.h
+++ b/chrome/browser/chromeos/extensions/login_screen/login_screen_storage/login_screen_storage_api.h
@@ -19,12 +19,12 @@
// When passed as a callback to the 'LoginScreenStorageStore' D-Bus method,
// returns its result to the calling extension.
- void OnDataStored(base::Optional<std::string> error);
+ void OnDataStored(absl::optional<std::string> error);
// When passed as a callback to the 'LoginScreenStorageRetrieve' D-Bus method,
// returns its result to the calling extension.
- void OnDataRetrieved(base::Optional<std::string> data,
- base::Optional<std::string> error);
+ void OnDataRetrieved(absl::optional<std::string> data,
+ absl::optional<std::string> error);
private:
DISALLOW_COPY_AND_ASSIGN(LoginScreenStorageExtensionFunction);
@@ -48,7 +48,7 @@
void OnDataStored(std::vector<std::string> extension_ids,
const login_manager::LoginScreenStorageMetadata& metadata,
const std::string& data,
- base::Optional<std::string> error);
+ absl::optional<std::string> error);
// Asynchronously stores data for every extension from |extension_ids|.
void StoreDataForExtensions(
diff --git a/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/login_screen_ui_api.cc b/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/login_screen_ui_api.cc
index a478ac313..44037585 100644
--- a/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/login_screen_ui_api.cc
+++ b/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/login_screen_ui_api.cc
@@ -46,7 +46,7 @@
void LoginScreenUiCloseFunction::OnClosed(
bool success,
- const base::Optional<std::string>& error) {
+ const absl::optional<std::string>& error) {
if (!success) {
Respond(Error(error.value()));
return;
diff --git a/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/login_screen_ui_api.h b/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/login_screen_ui_api.h
index 6dd3882d..f6ecd6c 100644
--- a/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/login_screen_ui_api.h
+++ b/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/login_screen_ui_api.h
@@ -39,7 +39,7 @@
private:
// Callback upon completion of window closing.
- void OnClosed(bool success, const base::Optional<std::string>& error);
+ void OnClosed(bool success, const absl::optional<std::string>& error);
DISALLOW_COPY_AND_ASSIGN(LoginScreenUiCloseFunction);
};
diff --git a/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/ui_handler.cc b/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/ui_handler.cc
index cc0a8f41..0cb78bc 100644
--- a/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/ui_handler.cc
+++ b/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/ui_handler.cc
@@ -154,7 +154,7 @@
void UiHandler::OnWindowClosed(const std::string& extension_id) {
if (!close_callback_.is_null()) {
- std::move(close_callback_).Run(/*success=*/true, base::nullopt);
+ std::move(close_callback_).Run(/*success=*/true, absl::nullopt);
close_callback_.Reset();
}
diff --git a/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/ui_handler.h b/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/ui_handler.h
index adda6061..d8103fc 100644
--- a/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/ui_handler.h
+++ b/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/ui_handler.h
@@ -48,7 +48,7 @@
public:
using WindowClosedCallback =
base::OnceCallback<void(bool success,
- const base::Optional<std::string>& error)>;
+ const absl::optional<std::string>& error)>;
static UiHandler* Get(bool can_create);
static void Shutdown();
diff --git a/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/ui_handler_unittest.cc b/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/ui_handler_unittest.cc
index 05e5ecc..d0bac6f 100644
--- a/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/ui_handler_unittest.cc
+++ b/chrome/browser/chromeos/extensions/login_screen/login_screen_ui/ui_handler_unittest.cc
@@ -162,7 +162,7 @@
void CheckCanCloseWindow(const extensions::Extension* extension) {
base::MockCallback<UiHandler::WindowClosedCallback> callback;
EXPECT_CALL(callback,
- Run(true, base::Optional<std::string>(base::nullopt)));
+ Run(true, absl::optional<std::string>(absl::nullopt)));
ui_handler_->Close(extension, callback.Get());
// Invoke close callback from dialog delegate because UiHandler::Close() is
// synchronous and will invoke its callback after that.
@@ -184,7 +184,7 @@
const std::string& expected_error) {
base::MockCallback<UiHandler::WindowClosedCallback> callback;
EXPECT_CALL(callback,
- Run(false, base::Optional<std::string>(expected_error)));
+ Run(false, absl::optional<std::string>(expected_error)));
ui_handler_->Close(extension, callback.Get());
// No need to invoke the close callback here since in case of no open window
// we directly invoke the callback with an error.
diff --git a/chrome/browser/chromeos/extensions/printing/fake_print_job_controller.cc b/chrome/browser/chromeos/extensions/printing/fake_print_job_controller.cc
index 5cdd1532..10b87ea5 100644
--- a/chrome/browser/chromeos/extensions/printing/fake_print_job_controller.cc
+++ b/chrome/browser/chromeos/extensions/printing/fake_print_job_controller.cc
@@ -33,7 +33,7 @@
std::unique_ptr<printing::MetafileSkia> metafile,
std::unique_ptr<printing::PrintSettings> settings,
StartPrintJobCallback callback) {
- base::Optional<chromeos::Printer> printer =
+ absl::optional<chromeos::Printer> printer =
printers_manager_->GetPrinter(base::UTF16ToUTF8(settings->device_name()));
if (!printer) {
std::move(callback).Run(nullptr);
diff --git a/chrome/browser/chromeos/extensions/printing/print_job_submitter.cc b/chrome/browser/chromeos/extensions/printing/print_job_submitter.cc
index 7720706..ad275e7c 100644
--- a/chrome/browser/chromeos/extensions/printing/print_job_submitter.cc
+++ b/chrome/browser/chromeos/extensions/printing/print_job_submitter.cc
@@ -130,7 +130,7 @@
}
void PrintJobSubmitter::CheckPrinter() {
- base::Optional<chromeos::Printer> printer =
+ absl::optional<chromeos::Printer> printer =
printers_manager_->GetPrinter(request_.job.printer_id);
if (!printer) {
FireErrorCallback(kInvalidPrinterId);
@@ -144,7 +144,7 @@
}
void PrintJobSubmitter::CheckCapabilitiesCompatibility(
- base::Optional<printing::PrinterSemanticCapsAndDefaults> capabilities) {
+ absl::optional<printing::PrinterSemanticCapsAndDefaults> capabilities) {
if (!capabilities) {
FireErrorCallback(kPrinterUnavailable);
return;
@@ -266,7 +266,7 @@
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback_),
api::printing::SUBMIT_JOB_STATUS_USER_REJECTED,
- nullptr, base::nullopt));
+ nullptr, absl::nullopt));
}
void PrintJobSubmitter::OnPrintJobSubmitted(
@@ -276,14 +276,14 @@
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(callback_), api::printing::SUBMIT_JOB_STATUS_OK,
- std::move(job_id), base::nullopt));
+ std::move(job_id), absl::nullopt));
}
void PrintJobSubmitter::FireErrorCallback(const std::string& error) {
DCHECK(callback_);
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
- base::BindOnce(std::move(callback_), base::nullopt, nullptr, error));
+ base::BindOnce(std::move(callback_), absl::nullopt, nullptr, error));
}
// static
diff --git a/chrome/browser/chromeos/extensions/printing/print_job_submitter.h b/chrome/browser/chromeos/extensions/printing/print_job_submitter.h
index 79ed4e91..2b9932a 100644
--- a/chrome/browser/chromeos/extensions/printing/print_job_submitter.h
+++ b/chrome/browser/chromeos/extensions/printing/print_job_submitter.h
@@ -12,9 +12,9 @@
#include "base/callback.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/common/extensions/api/printing.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/native_widget_types.h"
namespace base {
@@ -55,12 +55,12 @@
public:
// In case of success |job_id| will contain unique job identifier returned
// by CUPS. In case of failure |job_id| is nullptr.
- // We could use base::Optional but to be consistent with auto-generated API
+ // We could use absl::optional but to be consistent with auto-generated API
// wrappers we use std::unique_ptr.
using SubmitJobCallback = base::OnceCallback<void(
- base::Optional<api::printing::SubmitJobStatus> status,
+ absl::optional<api::printing::SubmitJobStatus> status,
std::unique_ptr<std::string> job_id,
- base::Optional<std::string> error)>;
+ absl::optional<std::string> error)>;
PrintJobSubmitter(gfx::NativeWindow native_window,
content::BrowserContext* browser_context,
@@ -89,7 +89,7 @@
void CheckPrinter();
void CheckCapabilitiesCompatibility(
- base::Optional<printing::PrinterSemanticCapsAndDefaults> capabilities);
+ absl::optional<printing::PrinterSemanticCapsAndDefaults> capabilities);
void ReadDocumentData();
diff --git a/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider.cc b/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider.cc
index 8f96361..12e5618 100644
--- a/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider.cc
+++ b/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider.cc
@@ -23,7 +23,7 @@
constexpr int kMaxPrintersCount = 20;
-base::Optional<printing::PrinterSemanticCapsAndDefaults>
+absl::optional<printing::PrinterSemanticCapsAndDefaults>
FetchCapabilitiesOnBlockingTaskRunner(const std::string& printer_id) {
scoped_refptr<printing::PrintBackend> backend(
printing::PrintBackend::CreateInstance(
@@ -32,7 +32,7 @@
if (backend->GetPrinterSemanticCapsAndDefaults(printer_id, &capabilities) !=
printing::mojom::ResultCode::kSuccess) {
LOG(WARNING) << "Failed to get capabilities for " << printer_id;
- return base::nullopt;
+ return absl::nullopt;
}
return capabilities;
}
@@ -51,11 +51,11 @@
void PrinterCapabilitiesProvider::GetPrinterCapabilities(
const std::string& printer_id,
GetPrinterCapabilitiesCallback callback) {
- base::Optional<chromeos::Printer> printer =
+ absl::optional<chromeos::Printer> printer =
printers_manager_->GetPrinter(printer_id);
if (!printer) {
base::SequencedTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
return;
}
@@ -83,7 +83,7 @@
chromeos::PrinterSetupResult result) {
if (result != chromeos::kSuccess) {
base::SequencedTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
return;
}
printers_manager_->PrinterInstalled(printer, /*is_automatic=*/true);
@@ -104,7 +104,7 @@
void PrinterCapabilitiesProvider::OnCapabilitiesFetched(
const std::string& printer_id,
GetPrinterCapabilitiesCallback callback,
- base::Optional<printing::PrinterSemanticCapsAndDefaults> capabilities) {
+ absl::optional<printing::PrinterSemanticCapsAndDefaults> capabilities) {
if (capabilities.has_value())
printer_capabilities_cache_.Put(printer_id, capabilities.value());
base::SequencedTaskRunnerHandle::Get()->PostTask(
diff --git a/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider.h b/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider.h
index c0c2c6d..25806d4 100644
--- a/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider.h
+++ b/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider.h
@@ -11,8 +11,8 @@
#include "base/callback_forward.h"
#include "base/containers/mru_cache.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/printing/printer_configurer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
class CupsPrintersManager;
@@ -30,7 +30,7 @@
class PrinterCapabilitiesProvider {
public:
using GetPrinterCapabilitiesCallback = base::OnceCallback<void(
- base::Optional<printing::PrinterSemanticCapsAndDefaults> capabilities)>;
+ absl::optional<printing::PrinterSemanticCapsAndDefaults> capabilities)>;
PrinterCapabilitiesProvider(
chromeos::CupsPrintersManager* printers_manager,
@@ -54,7 +54,7 @@
void OnCapabilitiesFetched(
const std::string& printer_id,
GetPrinterCapabilitiesCallback callback,
- base::Optional<printing::PrinterSemanticCapsAndDefaults> capabilities);
+ absl::optional<printing::PrinterSemanticCapsAndDefaults> capabilities);
chromeos::CupsPrintersManager* const printers_manager_;
std::unique_ptr<chromeos::PrinterConfigurer> printer_configurer_;
diff --git a/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider_unittest.cc b/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider_unittest.cc
index 3088381..5b9ce65 100644
--- a/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider_unittest.cc
+++ b/chrome/browser/chromeos/extensions/printing/printer_capabilities_provider_unittest.cc
@@ -74,7 +74,7 @@
void OnPrinterCapabilitiesRetrieved(
base::RepeatingClosure run_loop_closure,
- base::Optional<printing::PrinterSemanticCapsAndDefaults> capabilities) {
+ absl::optional<printing::PrinterSemanticCapsAndDefaults> capabilities) {
capabilities_ = std::move(capabilities);
run_loop_closure.Run();
}
@@ -85,7 +85,7 @@
std::unique_ptr<chromeos::TestCupsPrintersManager> printers_manager_;
chromeos::TestPrinterConfigurer* printer_configurer_;
std::unique_ptr<PrinterCapabilitiesProvider> printer_capabilities_provider_;
- base::Optional<printing::PrinterSemanticCapsAndDefaults> capabilities_;
+ absl::optional<printing::PrinterSemanticCapsAndDefaults> capabilities_;
};
// Tests that no capabilities are returned if the printer is not added to
diff --git a/chrome/browser/chromeos/extensions/printing/printing_api.cc b/chrome/browser/chromeos/extensions/printing/printing_api.cc
index 9adbb47a..f24d302 100644
--- a/chrome/browser/chromeos/extensions/printing/printing_api.cc
+++ b/chrome/browser/chromeos/extensions/printing/printing_api.cc
@@ -40,9 +40,9 @@
}
void PrintingSubmitJobFunction::OnPrintJobSubmitted(
- base::Optional<api::printing::SubmitJobStatus> status,
+ absl::optional<api::printing::SubmitJobStatus> status,
std::unique_ptr<std::string> job_id,
- base::Optional<std::string> error) {
+ absl::optional<std::string> error) {
if (error.has_value()) {
Respond(Error(error.value()));
return;
@@ -60,7 +60,7 @@
std::unique_ptr<api::printing::CancelJob::Params> params(
api::printing::CancelJob::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- base::Optional<std::string> error =
+ absl::optional<std::string> error =
PrintingAPIHandler::Get(browser_context())
->CancelJob(extension_id(), params->job_id);
@@ -102,9 +102,9 @@
}
void PrintingGetPrinterInfoFunction::OnPrinterInfoRetrieved(
- base::Optional<base::Value> capabilities,
- base::Optional<api::printing::PrinterStatus> status,
- base::Optional<std::string> error) {
+ absl::optional<base::Value> capabilities,
+ absl::optional<api::printing::PrinterStatus> status,
+ absl::optional<std::string> error) {
if (error.has_value()) {
Respond(Error(error.value()));
return;
diff --git a/chrome/browser/chromeos/extensions/printing/printing_api.h b/chrome/browser/chromeos/extensions/printing/printing_api.h
index 889d8ee..c7ee6562 100644
--- a/chrome/browser/chromeos/extensions/printing/printing_api.h
+++ b/chrome/browser/chromeos/extensions/printing/printing_api.h
@@ -8,10 +8,10 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "chrome/common/extensions/api/printing.h"
#include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_function_histogram_value.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Value;
@@ -29,9 +29,9 @@
private:
void OnPrintJobSubmitted(
- base::Optional<api::printing::SubmitJobStatus> status,
+ absl::optional<api::printing::SubmitJobStatus> status,
std::unique_ptr<std::string> job_id,
- base::Optional<std::string> error);
+ absl::optional<std::string> error);
DECLARE_EXTENSION_FUNCTION("printing.submitJob", PRINTING_SUBMITJOB)
};
@@ -67,9 +67,9 @@
private:
void OnPrinterInfoRetrieved(
- base::Optional<base::Value> capabilities,
- base::Optional<api::printing::PrinterStatus> status,
- base::Optional<std::string> error);
+ absl::optional<base::Value> capabilities,
+ absl::optional<api::printing::PrinterStatus> status,
+ absl::optional<std::string> error);
DECLARE_EXTENSION_FUNCTION("printing.getPrinterInfo", PRINTING_GETPRINTERINFO)
};
diff --git a/chrome/browser/chromeos/extensions/printing/printing_api_handler.cc b/chrome/browser/chromeos/extensions/printing/printing_api_handler.cc
index 7376470..16607593 100644
--- a/chrome/browser/chromeos/extensions/printing/printing_api_handler.cc
+++ b/chrome/browser/chromeos/extensions/printing/printing_api_handler.cc
@@ -136,15 +136,15 @@
void PrintingAPIHandler::OnPrintJobSubmitted(
std::unique_ptr<PrintJobSubmitter> print_job_submitter,
PrintJobSubmitter::SubmitJobCallback callback,
- base::Optional<api::printing::SubmitJobStatus> status,
+ absl::optional<api::printing::SubmitJobStatus> status,
std::unique_ptr<std::string> job_id,
- base::Optional<std::string> error) {
+ absl::optional<std::string> error) {
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(std::move(callback), status, std::move(job_id), error));
}
-base::Optional<std::string> PrintingAPIHandler::CancelJob(
+absl::optional<std::string> PrintingAPIHandler::CancelJob(
const std::string& extension_id,
const std::string& job_id) {
auto it = print_jobs_extension_ids_.find(job_id);
@@ -159,14 +159,14 @@
return kNoActivePrintJobWithIdError;
// Return no error otherwise.
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<api::printing::Printer> PrintingAPIHandler::GetPrinters() {
PrefService* prefs =
Profile::FromBrowserContext(browser_context_)->GetPrefs();
- base::Optional<DefaultPrinterRules> default_printer_rules =
+ absl::optional<DefaultPrinterRules> default_printer_rules =
GetDefaultPrinterRules(prefs->GetString(
prefs::kPrintPreviewDefaultDestinationSelectionRules));
@@ -197,8 +197,8 @@
if (!printers_manager_->GetPrinter(printer_id)) {
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
- base::BindOnce(std::move(callback), /*capabilities=*/base::nullopt,
- /*status=*/base::nullopt, kInvalidPrinterIdError));
+ base::BindOnce(std::move(callback), /*capabilities=*/absl::nullopt,
+ /*status=*/absl::nullopt, kInvalidPrinterIdError));
return;
}
printer_capabilities_provider_.GetPrinterCapabilities(
@@ -210,13 +210,13 @@
void PrintingAPIHandler::GetPrinterStatus(
const std::string& printer_id,
GetPrinterInfoCallback callback,
- base::Optional<printing::PrinterSemanticCapsAndDefaults> capabilities) {
+ absl::optional<printing::PrinterSemanticCapsAndDefaults> capabilities) {
if (!capabilities.has_value()) {
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
- base::BindOnce(std::move(callback), /*capabilities=*/base::nullopt,
+ base::BindOnce(std::move(callback), /*capabilities=*/absl::nullopt,
api::printing::PRINTER_STATUS_UNREACHABLE,
- /*error=*/base::nullopt));
+ /*error=*/absl::nullopt));
return;
}
base::Value capabilities_value =
@@ -236,7 +236,7 @@
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback), std::move(capabilities),
api::printing::PRINTER_STATUS_UNREACHABLE,
- /*error=*/base::nullopt));
+ /*error=*/absl::nullopt));
return;
}
base::SequencedTaskRunnerHandle::Get()->PostTask(
@@ -245,7 +245,7 @@
std::move(callback), std::move(capabilities),
PrinterStatusToIdl(chromeos::PrinterErrorCodeFromPrinterStatusReasons(
*printer_status)),
- /*error=*/base::nullopt));
+ /*error=*/absl::nullopt));
}
void PrintingAPIHandler::SetPrintJobControllerForTesting(
diff --git a/chrome/browser/chromeos/extensions/printing/printing_api_handler.h b/chrome/browser/chromeos/extensions/printing/printing_api_handler.h
index 7629f90c..fa7ea99 100644
--- a/chrome/browser/chromeos/extensions/printing/printing_api_handler.h
+++ b/chrome/browser/chromeos/extensions/printing/printing_api_handler.h
@@ -11,7 +11,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/chromeos/extensions/printing/print_job_controller.h"
#include "chrome/browser/chromeos/extensions/printing/print_job_submitter.h"
@@ -24,6 +23,7 @@
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/event_router_factory.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/native_widget_types.h"
class PrefRegistrySimple;
@@ -54,13 +54,13 @@
public chromeos::CupsPrintJobManager::Observer {
public:
using SubmitJobCallback = base::OnceCallback<void(
- base::Optional<api::printing::SubmitJobStatus> status,
+ absl::optional<api::printing::SubmitJobStatus> status,
std::unique_ptr<std::string> job_id,
- base::Optional<std::string> error)>;
+ absl::optional<std::string> error)>;
using GetPrinterInfoCallback = base::OnceCallback<void(
- base::Optional<base::Value> capabilities,
- base::Optional<api::printing::PrinterStatus> status,
- base::Optional<std::string> error)>;
+ absl::optional<base::Value> capabilities,
+ absl::optional<api::printing::PrinterStatus> status,
+ absl::optional<std::string> error)>;
static std::unique_ptr<PrintingAPIHandler> CreateForTesting(
content::BrowserContext* browser_context,
@@ -96,7 +96,7 @@
PrintJobSubmitter::SubmitJobCallback callback);
// Returns an error message if an error occurred.
- base::Optional<std::string> CancelJob(const std::string& extension_id,
+ absl::optional<std::string> CancelJob(const std::string& extension_id,
const std::string& job_id);
std::vector<api::printing::Printer> GetPrinters();
@@ -126,14 +126,14 @@
void OnPrintJobSubmitted(
std::unique_ptr<PrintJobSubmitter> print_job_submitter,
PrintJobSubmitter::SubmitJobCallback callback,
- base::Optional<api::printing::SubmitJobStatus> status,
+ absl::optional<api::printing::SubmitJobStatus> status,
std::unique_ptr<std::string> job_id,
- base::Optional<std::string> error);
+ absl::optional<std::string> error);
void GetPrinterStatus(
const std::string& printer_id,
GetPrinterInfoCallback callback,
- base::Optional<printing::PrinterSemanticCapsAndDefaults> capabilities);
+ absl::optional<printing::PrinterSemanticCapsAndDefaults> capabilities);
void OnPrinterStatusRetrieved(
GetPrinterInfoCallback callback,
diff --git a/chrome/browser/chromeos/extensions/printing/printing_api_handler_unittest.cc b/chrome/browser/chromeos/extensions/printing/printing_api_handler_unittest.cc
index dfbb882..7206d5a 100644
--- a/chrome/browser/chromeos/extensions/printing/printing_api_handler_unittest.cc
+++ b/chrome/browser/chromeos/extensions/printing/printing_api_handler_unittest.cc
@@ -168,7 +168,7 @@
api::printing::SubmitJobRequest request;
request.job.printer_id = printer_id;
request.job.title = title;
- base::Optional<base::Value> ticket_value = base::JSONReader::Read(ticket);
+ absl::optional<base::Value> ticket_value = base::JSONReader::Read(ticket);
DCHECK(ticket_value.has_value());
EXPECT_TRUE(api::printer_provider::PrintJob::Ticket::Populate(
ticket_value.value(), &request.job.ticket));
@@ -307,9 +307,9 @@
}
void OnJobSubmitted(base::RepeatingClosure run_loop_closure,
- base::Optional<api::printing::SubmitJobStatus> status,
+ absl::optional<api::printing::SubmitJobStatus> status,
std::unique_ptr<std::string> job_id,
- base::Optional<std::string> error) {
+ absl::optional<std::string> error) {
submit_job_status_ = status;
job_id_ = std::move(job_id);
error_ = error;
@@ -318,13 +318,13 @@
void OnPrinterInfoRetrieved(
base::RepeatingClosure run_loop_closure,
- base::Optional<base::Value> capabilities,
- base::Optional<api::printing::PrinterStatus> printer_status,
- base::Optional<std::string> error) {
+ absl::optional<base::Value> capabilities,
+ absl::optional<api::printing::PrinterStatus> printer_status,
+ absl::optional<std::string> error) {
if (capabilities)
capabilities_ = capabilities.value().Clone();
else
- capabilities_ = base::nullopt;
+ capabilities_ = absl::nullopt;
printer_status_ = printer_status;
error_ = error;
run_loop_closure.Run();
@@ -341,11 +341,11 @@
chromeos::TestCupsWrapper* cups_wrapper_;
std::unique_ptr<PrintingAPIHandler> printing_api_handler_;
scoped_refptr<const Extension> extension_;
- base::Optional<api::printing::SubmitJobStatus> submit_job_status_;
+ absl::optional<api::printing::SubmitJobStatus> submit_job_status_;
std::unique_ptr<std::string> job_id_;
- base::Optional<base::Value> capabilities_;
- base::Optional<api::printing::PrinterStatus> printer_status_;
- base::Optional<std::string> error_;
+ absl::optional<base::Value> capabilities_;
+ absl::optional<api::printing::PrinterStatus> printer_status_;
+ absl::optional<std::string> error_;
private:
// Resets |disable_pdf_flattening_for_testing| back to false automatically
@@ -746,7 +746,7 @@
}
TEST_F(PrintingAPIHandlerUnittest, CancelJob_InvalidId) {
- base::Optional<std::string> error =
+ absl::optional<std::string> error =
printing_api_handler_->CancelJob(kExtensionId, "job_id");
ASSERT_TRUE(error.has_value());
@@ -762,7 +762,7 @@
print_job_manager_->CreatePrintJob(print_job.get());
// Try to cancel print job from other extension.
- base::Optional<std::string> error = printing_api_handler_->CancelJob(
+ absl::optional<std::string> error = printing_api_handler_->CancelJob(
kExtensionId2,
chromeos::CupsPrintJob::CreateUniqueId(kPrinterId, kJobId));
@@ -793,7 +793,7 @@
print_job_controller_->GetCupsPrintJob(*job_id_));
// Try to cancel already completed print job.
- base::Optional<std::string> error =
+ absl::optional<std::string> error =
printing_api_handler_->CancelJob(kExtensionId, *job_id_);
ASSERT_TRUE(error.has_value());
@@ -819,7 +819,7 @@
run_loop.Run();
// Cancel started print job.
- base::Optional<std::string> error =
+ absl::optional<std::string> error =
printing_api_handler_->CancelJob(kExtensionId, *job_id_);
EXPECT_FALSE(error.has_value());
diff --git a/chrome/browser/chromeos/extensions/printing/printing_api_utils.cc b/chrome/browser/chromeos/extensions/printing/printing_api_utils.cc
index e4a3ef7..1215e32d 100644
--- a/chrome/browser/chromeos/extensions/printing/printing_api_utils.cc
+++ b/chrome/browser/chromeos/extensions/printing/printing_api_utils.cc
@@ -43,7 +43,7 @@
bool DoesPrinterMatchDefaultPrinterRules(
const chromeos::Printer& printer,
- const base::Optional<DefaultPrinterRules>& rules) {
+ const absl::optional<DefaultPrinterRules>& rules) {
if (!rules.has_value())
return false;
return (rules->kind.empty() || rules->kind == kLocal) &&
@@ -55,15 +55,15 @@
} // namespace
-base::Optional<DefaultPrinterRules> GetDefaultPrinterRules(
+absl::optional<DefaultPrinterRules> GetDefaultPrinterRules(
const std::string& default_destination_selection_rules) {
if (default_destination_selection_rules.empty())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<base::Value> default_destination_selection_rules_value =
+ absl::optional<base::Value> default_destination_selection_rules_value =
base::JSONReader::Read(default_destination_selection_rules);
if (!default_destination_selection_rules_value)
- return base::nullopt;
+ return absl::nullopt;
DefaultPrinterRules default_printer_rules;
const std::string* kind =
@@ -83,7 +83,7 @@
idl::Printer PrinterToIdl(
const chromeos::Printer& printer,
- const base::Optional<DefaultPrinterRules>& default_printer_rules,
+ const absl::optional<DefaultPrinterRules>& default_printer_rules,
const base::flat_map<std::string, int>& recently_used_ranks) {
idl::Printer idl_printer;
idl_printer.id = printer.id();
@@ -231,7 +231,7 @@
if (!base::Contains(capabilities.duplex_modes, settings.duplex_mode()))
return false;
- base::Optional<bool> is_color =
+ absl::optional<bool> is_color =
::printing::IsColorModelSelected(settings.color());
bool color_mode_selected = is_color.has_value() && is_color.value();
if (!color_mode_selected &&
diff --git a/chrome/browser/chromeos/extensions/printing/printing_api_utils.h b/chrome/browser/chromeos/extensions/printing/printing_api_utils.h
index 35896e7..96d6932c 100644
--- a/chrome/browser/chromeos/extensions/printing/printing_api_utils.h
+++ b/chrome/browser/chromeos/extensions/printing/printing_api_utils.h
@@ -9,9 +9,9 @@
#include <string>
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/printing/printer_error_codes.h"
#include "chrome/common/extensions/api/printing.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Value;
@@ -37,12 +37,12 @@
// Parses the string containing
// |prefs::kPrintPreviewDefaultDestinationSelectionRules| value and returns
// default printer selection rules in the form declared above.
-base::Optional<DefaultPrinterRules> GetDefaultPrinterRules(
+absl::optional<DefaultPrinterRules> GetDefaultPrinterRules(
const std::string& default_destination_selection_rules);
api::printing::Printer PrinterToIdl(
const chromeos::Printer& printer,
- const base::Optional<DefaultPrinterRules>& default_printer_rules,
+ const absl::optional<DefaultPrinterRules>& default_printer_rules,
const base::flat_map<std::string, int>& recently_used_ranks);
api::printing::PrinterStatus PrinterStatusToIdl(
diff --git a/chrome/browser/chromeos/extensions/printing/printing_api_utils_unittest.cc b/chrome/browser/chromeos/extensions/printing/printing_api_utils_unittest.cc
index 258662a..5bef3f0 100644
--- a/chrome/browser/chromeos/extensions/printing/printing_api_utils_unittest.cc
+++ b/chrome/browser/chromeos/extensions/printing/printing_api_utils_unittest.cc
@@ -115,7 +115,7 @@
TEST(PrintingApiUtilsTest, GetDefaultPrinterRules) {
std::string default_printer_rules_str =
R"({"kind": "local", "idPattern": "id.*", "namePattern": "name.*"})";
- base::Optional<DefaultPrinterRules> default_printer_rules =
+ absl::optional<DefaultPrinterRules> default_printer_rules =
GetDefaultPrinterRules(default_printer_rules_str);
ASSERT_TRUE(default_printer_rules.has_value());
EXPECT_EQ("local", default_printer_rules->kind);
@@ -125,7 +125,7 @@
TEST(PrintingApiUtilsTest, GetDefaultPrinterRules_EmptyPref) {
std::string default_printer_rules_str;
- base::Optional<DefaultPrinterRules> default_printer_rules =
+ absl::optional<DefaultPrinterRules> default_printer_rules =
GetDefaultPrinterRules(default_printer_rules_str);
EXPECT_FALSE(default_printer_rules.has_value());
}
@@ -137,7 +137,7 @@
EXPECT_TRUE(printer.SetUri(kUri));
printer.set_source(chromeos::Printer::SRC_POLICY);
- base::Optional<DefaultPrinterRules> default_printer_rules =
+ absl::optional<DefaultPrinterRules> default_printer_rules =
DefaultPrinterRules();
default_printer_rules->kind = "local";
default_printer_rules->name_pattern = "n.*e";
@@ -157,7 +157,7 @@
}
TEST(PrintingApiUtilsTest, ParsePrintTicket) {
- base::Optional<base::Value> cjt_ticket = base::JSONReader::Read(kCjt);
+ absl::optional<base::Value> cjt_ticket = base::JSONReader::Read(kCjt);
ASSERT_TRUE(cjt_ticket);
std::unique_ptr<printing::PrintSettings> settings =
ParsePrintTicket(std::move(*cjt_ticket));
@@ -175,7 +175,7 @@
}
TEST(PrintingApiUtilsTest, ParsePrintTicket_IncompleteCjt) {
- base::Optional<base::Value> incomplete_cjt_ticket =
+ absl::optional<base::Value> incomplete_cjt_ticket =
base::JSONReader::Read(kIncompleteCjt);
ASSERT_TRUE(incomplete_cjt_ticket);
EXPECT_FALSE(ParsePrintTicket(std::move(*incomplete_cjt_ticket)));
diff --git a/chrome/browser/chromeos/external_protocol_dialog.cc b/chrome/browser/chromeos/external_protocol_dialog.cc
index e09917f..790e80c 100644
--- a/chrome/browser/chromeos/external_protocol_dialog.cc
+++ b/chrome/browser/chromeos/external_protocol_dialog.cc
@@ -30,7 +30,7 @@
const int kMessageWidth = 400;
void OnArcHandled(const GURL& url,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
int render_process_host_id,
int routing_id,
bool handled) {
@@ -42,7 +42,7 @@
// Display the standard ExternalProtocolDialog if Guest OS has a handler.
if (web_contents) {
- base::Optional<guest_os::GuestOsRegistryService::Registration>
+ absl::optional<guest_os::GuestOsRegistryService::Registration>
registration = guest_os::GetHandler(
Profile::FromBrowserContext(web_contents->GetBrowserContext()),
url);
@@ -67,7 +67,7 @@
WebContents* web_contents,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin) {
+ const absl::optional<url::Origin>& initiating_origin) {
// First, check if ARC version of the dialog is available and run ARC version
// when possible.
// TODO(ellyjones): Refactor arc::RunArcExternalProtocolDialog() to take a
diff --git a/chrome/browser/chromeos/file_manager/documents_provider_root_manager.cc b/chrome/browser/chromeos/file_manager/documents_provider_root_manager.cc
index 9e34e1a5..c6aad12 100644
--- a/chrome/browser/chromeos/file_manager/documents_provider_root_manager.cc
+++ b/chrome/browser/chromeos/file_manager/documents_provider_root_manager.cc
@@ -167,7 +167,7 @@
}
void DocumentsProviderRootManager::OnGetRoots(
- base::Optional<std::vector<arc::mojom::RootPtr>> maybe_roots) {
+ absl::optional<std::vector<arc::mojom::RootPtr>> maybe_roots) {
if (!maybe_roots.has_value())
return;
diff --git a/chrome/browser/chromeos/file_manager/documents_provider_root_manager.h b/chrome/browser/chromeos/file_manager/documents_provider_root_manager.h
index ea93d5b5..71560d7 100644
--- a/chrome/browser/chromeos/file_manager/documents_provider_root_manager.h
+++ b/chrome/browser/chromeos/file_manager/documents_provider_root_manager.h
@@ -11,9 +11,9 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "chrome/browser/ash/arc/fileapi/arc_file_system_bridge.h"
#include "components/arc/mojom/file_system.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "url/gurl.h"
@@ -107,7 +107,7 @@
void RequestGetRoots();
// Called when retrieving available roots from ARC container is done.
- void OnGetRoots(base::Optional<std::vector<arc::mojom::RootPtr>> maybe_roots);
+ void OnGetRoots(absl::optional<std::vector<arc::mojom::RootPtr>> maybe_roots);
// Updates this class's internal list of available roots.
void UpdateRoots(std::vector<RootInfo> roots);
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
index 798c47d..6068abc 100644
--- a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
+++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
@@ -22,7 +22,6 @@
#include "base/json/json_reader.h"
#include "base/json/json_value_converter.h"
#include "base/json/json_writer.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
@@ -113,6 +112,7 @@
#include "storage/browser/file_system/external_mount_points.h"
#include "storage/browser/file_system/file_system_context.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/events/event.h"
@@ -1177,7 +1177,7 @@
base::Unretained(this)));
}
- base::Optional<drivefs::mojom::DialogResult> last_dialog_result() {
+ absl::optional<drivefs::mojom::DialogResult> last_dialog_result() {
return last_dialog_result_;
}
@@ -1280,7 +1280,7 @@
last_dialog_result_ = result;
}
- base::Optional<drivefs::mojom::DialogResult> last_dialog_result_;
+ absl::optional<drivefs::mojom::DialogResult> last_dialog_result_;
// Profile associated with this volume: not owned.
Profile* profile_ = nullptr;
@@ -2427,14 +2427,14 @@
ASSERT_TRUE(value.GetString("notificationId", ¬ification_id));
const std::string delegate_id = extension_id + "-" + notification_id;
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(delegate_id);
EXPECT_TRUE(notification);
int index;
ASSERT_TRUE(value.GetInteger("index", &index));
display_service_->SimulateClick(NotificationHandler::Type::EXTENSION,
- delegate_id, index, base::nullopt);
+ delegate_id, index, absl::nullopt);
return;
}
@@ -2735,7 +2735,7 @@
}
if (name == "getLastDriveDialogResult") {
- base::Optional<drivefs::mojom::DialogResult> result =
+ absl::optional<drivefs::mojom::DialogResult> result =
drive_volume_->last_dialog_result();
base::JSONWriter::Write(
base::Value(result ? static_cast<int32_t>(result.value()) : -1),
diff --git a/chrome/browser/chromeos/file_manager/filesystem_api_util.cc b/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
index 4e38db7..60bdd89 100644
--- a/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
+++ b/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
@@ -37,12 +37,12 @@
namespace {
void GetMimeTypeAfterGetMetadata(
- base::OnceCallback<void(const base::Optional<std::string>&)> callback,
+ base::OnceCallback<void(const absl::optional<std::string>&)> callback,
drive::FileError error,
drivefs::mojom::FileMetadataPtr metadata) {
if (error != drive::FILE_ERROR_OK || !metadata ||
metadata->content_mime_type.empty()) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
std::move(callback).Run(std::move(metadata->content_mime_type));
@@ -51,13 +51,13 @@
// Helper function used to implement GetNonNativeLocalPathMimeType. It extracts
// the mime type from the passed metadata from a providing extension.
void GetMimeTypeAfterGetMetadataForProvidedFileSystem(
- base::OnceCallback<void(const base::Optional<std::string>&)> callback,
+ base::OnceCallback<void(const absl::optional<std::string>&)> callback,
std::unique_ptr<chromeos::file_system_provider::EntryMetadata> metadata,
base::File::Error result) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (result != base::File::FILE_OK || !metadata->mime_type.get()) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
std::move(callback).Run(*metadata->mime_type);
@@ -66,13 +66,13 @@
// Helper function used to implement GetNonNativeLocalPathMimeType. It passes
// the returned mime type to the callback.
void GetMimeTypeAfterGetMimeTypeForArcContentFileSystem(
- base::OnceCallback<void(const base::Optional<std::string>&)> callback,
- const base::Optional<std::string>& mime_type) {
+ base::OnceCallback<void(const absl::optional<std::string>&)> callback,
+ const absl::optional<std::string>& mime_type) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (mime_type.has_value()) {
std::move(callback).Run(mime_type.value());
} else {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
}
}
@@ -170,7 +170,7 @@
void GetNonNativeLocalPathMimeType(
Profile* profile,
const base::FilePath& path,
- base::OnceCallback<void(const base::Optional<std::string>&)> callback) {
+ base::OnceCallback<void(const absl::optional<std::string>&)> callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(HasNonNativeMimeTypeProvider(profile, path));
@@ -190,7 +190,7 @@
return;
}
base::SequencedTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
return;
}
@@ -199,7 +199,7 @@
chromeos::file_system_provider::util::LocalPathParser parser(profile, path);
if (!parser.Parse()) {
content::GetUIThreadTaskRunner({})->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
return;
}
@@ -219,7 +219,7 @@
arc::ArcFileSystemOperationRunner::GetForBrowserContext(profile);
if (!runner) {
content::GetUIThreadTaskRunner({})->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
return;
}
runner->GetMimeType(
@@ -233,7 +233,7 @@
// error with empty MIME type, that leads fallback guessing mime type from
// file extensions.
content::GetUIThreadTaskRunner({})->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
}
void IsNonNativeLocalPathDirectory(Profile* profile,
diff --git a/chrome/browser/chromeos/file_manager/filesystem_api_util.h b/chrome/browser/chromeos/file_manager/filesystem_api_util.h
index e2d4849..96304d7 100644
--- a/chrome/browser/chromeos/file_manager/filesystem_api_util.h
+++ b/chrome/browser/chromeos/file_manager/filesystem_api_util.h
@@ -13,8 +13,8 @@
#include <vector>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "storage/common/file_system/file_system_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -41,7 +41,7 @@
void GetNonNativeLocalPathMimeType(
Profile* profile,
const base::FilePath& path,
- base::OnceCallback<void(const base::Optional<std::string>&)> callback);
+ base::OnceCallback<void(const absl::optional<std::string>&)> callback);
// Checks whether the |path| points to a directory, and asynchronously sends
// the result to |callback|.
diff --git a/chrome/browser/chromeos/file_manager/guest_os_file_tasks.cc b/chrome/browser/chromeos/file_manager/guest_os_file_tasks.cc
index dddea045..4416da57 100644
--- a/chrome/browser/chromeos/file_manager/guest_os_file_tasks.cc
+++ b/chrome/browser/chromeos/file_manager/guest_os_file_tasks.cc
@@ -264,7 +264,7 @@
auto* registry_service =
guest_os::GuestOsRegistryServiceFactory::GetForProfile(profile);
- base::Optional<guest_os::GuestOsRegistryService::Registration> registration =
+ absl::optional<guest_os::GuestOsRegistryService::Registration> registration =
registry_service->GetRegistration(task.app_id);
if (!registration) {
std::move(done).Run(
diff --git a/chrome/browser/chromeos/file_manager/path_util.cc b/chrome/browser/chromeos/file_manager/path_util.cc
index eea15686..e1f0c4b 100644
--- a/chrome/browser/chromeos/file_manager/path_util.cc
+++ b/chrome/browser/chromeos/file_manager/path_util.cc
@@ -428,7 +428,7 @@
} else if (id == GetCrostiniMountPointName(profile)) {
// Crostini.
if (map_crostini_home) {
- base::Optional<crostini::ContainerInfo> container_info =
+ absl::optional<crostini::ContainerInfo> container_info =
crostini::CrostiniManager::GetForProfile(profile)->GetContainerInfo(
crostini::ContainerId::GetDefault());
if (!container_info) {
@@ -483,7 +483,7 @@
base::FilePath relative_path;
if (map_crostini_home) {
- base::Optional<crostini::ContainerInfo> container_info =
+ absl::optional<crostini::ContainerInfo> container_info =
crostini::CrostiniManager::GetForProfile(profile)->GetContainerInfo(
crostini::ContainerId::GetDefault());
if (container_info &&
diff --git a/chrome/browser/chromeos/fileapi/external_file_url_loader_factory.cc b/chrome/browser/chromeos/fileapi/external_file_url_loader_factory.cc
index c1e9f1b..2096516 100644
--- a/chrome/browser/chromeos/fileapi/external_file_url_loader_factory.cc
+++ b/chrome/browser/chromeos/fileapi/external_file_url_loader_factory.cc
@@ -216,7 +216,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) override {}
+ const absl::optional<GURL>& new_url) override {}
void SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) override {}
void PauseReadingBodyFromNet() override {}
diff --git a/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc b/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc
index 8102bf13..53026a8 100644
--- a/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc
+++ b/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc
@@ -14,7 +14,6 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "chrome/browser/ash/arc/arc_util.h"
#include "chrome/browser/ash/arc/fileapi/arc_documents_provider_root.h"
@@ -25,6 +24,7 @@
#include "components/arc/mojom/file_system.mojom.h"
#include "content/public/browser/browser_thread.h"
#include "storage/browser/file_system/external_mount_points.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
using content::BrowserThread;
@@ -100,7 +100,7 @@
private:
void OnGetRecentDocuments(
- base::Optional<std::vector<arc::mojom::DocumentPtr>> maybe_documents);
+ absl::optional<std::vector<arc::mojom::DocumentPtr>> maybe_documents);
void ScanDirectory(const base::FilePath& path);
void OnReadDirectory(
const base::FilePath& path,
@@ -118,7 +118,7 @@
const base::FilePath relative_mount_path_;
// Set at the beginning of GetRecentFiles().
- base::Optional<Params> params_;
+ absl::optional<Params> params_;
// Number of in-flight ReadDirectory() calls by ScanDirectory().
int num_inflight_readdirs_ = 0;
@@ -130,7 +130,7 @@
// In case of multiple files with the same document ID found, the file with
// lexicographically smallest URL is kept. A nullopt value means the
// corresponding file is not (yet) found.
- std::map<std::string, base::Optional<RecentFile>> document_id_to_file_;
+ std::map<std::string, absl::optional<RecentFile>> document_id_to_file_;
base::WeakPtrFactory<MediaRoot> weak_ptr_factory_{this};
@@ -178,7 +178,7 @@
}
void RecentArcMediaSource::MediaRoot::OnGetRecentDocuments(
- base::Optional<std::vector<arc::mojom::DocumentPtr>> maybe_documents) {
+ absl::optional<std::vector<arc::mojom::DocumentPtr>> maybe_documents) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(params_.has_value());
DCHECK_EQ(0, num_inflight_readdirs_);
@@ -194,7 +194,7 @@
document->android_file_system_path.value())) {
continue;
}
- document_id_to_file_.emplace(document->document_id, base::nullopt);
+ document_id_to_file_.emplace(document->document_id, absl::nullopt);
}
}
@@ -260,7 +260,7 @@
// We keep the lexicographically smallest URL to stabilize the results when
// there are multiple files with the same document ID.
auto url = BuildDocumentsProviderUrl(subpath);
- base::Optional<RecentFile>& entry = iter->second;
+ absl::optional<RecentFile>& entry = iter->second;
if (!entry.has_value() ||
storage::FileSystemURL::Comparator()(url, entry.value().url()))
entry = RecentFile(url, file.last_modified);
@@ -280,7 +280,7 @@
std::vector<RecentFile> files;
for (const auto& entry : document_id_to_file_) {
- const base::Optional<RecentFile>& file = entry.second;
+ const absl::optional<RecentFile>& file = entry.second;
if (file.has_value())
files.emplace_back(file.value());
}
diff --git a/chrome/browser/chromeos/fileapi/recent_arc_media_source.h b/chrome/browser/chromeos/fileapi/recent_arc_media_source.h
index ca940a6..0ae0d4d 100644
--- a/chrome/browser/chromeos/fileapi/recent_arc_media_source.h
+++ b/chrome/browser/chromeos/fileapi/recent_arc_media_source.h
@@ -12,9 +12,9 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/fileapi/recent_source.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -49,7 +49,7 @@
Profile* const profile_;
std::vector<std::unique_ptr<MediaRoot>> roots_;
- base::Optional<Params> params_;
+ absl::optional<Params> params_;
// Time when the build started.
base::TimeTicks build_start_time_;
diff --git a/chrome/browser/chromeos/fileapi/recent_disk_source.h b/chrome/browser/chromeos/fileapi/recent_disk_source.h
index c5de8ec..96d38db 100644
--- a/chrome/browser/chromeos/fileapi/recent_disk_source.h
+++ b/chrome/browser/chromeos/fileapi/recent_disk_source.h
@@ -15,12 +15,12 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/fileapi/recent_file.h"
#include "chrome/browser/chromeos/fileapi/recent_model.h"
#include "chrome/browser/chromeos/fileapi/recent_source.h"
#include "storage/browser/file_system/file_system_operation.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -67,7 +67,7 @@
const std::string uma_histogram_name_;
// Parameters given to GetRecentFiles().
- base::Optional<Params> params_;
+ absl::optional<Params> params_;
// Time when the build started.
base::TimeTicks build_start_time_;
diff --git a/chrome/browser/chromeos/fileapi/recent_drive_source.cc b/chrome/browser/chromeos/fileapi/recent_drive_source.cc
index 2de56d63..240cadd6 100644
--- a/chrome/browser/chromeos/fileapi/recent_drive_source.cc
+++ b/chrome/browser/chromeos/fileapi/recent_drive_source.cc
@@ -112,7 +112,7 @@
void RecentDriveSource::GotSearchResults(
drive::FileError error,
- base::Optional<std::vector<drivefs::mojom::QueryItemPtr>> results) {
+ absl::optional<std::vector<drivefs::mojom::QueryItemPtr>> results) {
search_query_.reset();
auto* integration_service =
drive::util::GetIntegrationServiceByProfile(profile_);
diff --git a/chrome/browser/chromeos/fileapi/recent_drive_source.h b/chrome/browser/chromeos/fileapi/recent_drive_source.h
index c63308a..c31febe 100644
--- a/chrome/browser/chromeos/fileapi/recent_drive_source.h
+++ b/chrome/browser/chromeos/fileapi/recent_drive_source.h
@@ -12,12 +12,12 @@
#include "base/files/file.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/fileapi/recent_source.h"
#include "chromeos/components/drivefs/mojom/drivefs.mojom.h"
#include "components/drive/file_errors.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -45,12 +45,12 @@
void GotSearchResults(
drive::FileError error,
- base::Optional<std::vector<drivefs::mojom::QueryItemPtr>> results);
+ absl::optional<std::vector<drivefs::mojom::QueryItemPtr>> results);
Profile* const profile_;
// Set at the beginning of GetRecentFiles().
- base::Optional<Params> params_;
+ absl::optional<Params> params_;
base::TimeTicks build_start_time_;
diff --git a/chrome/browser/chromeos/fileapi/recent_model.h b/chrome/browser/chromeos/fileapi/recent_model.h
index b3dc3d8..a3e94b17 100644
--- a/chrome/browser/chromeos/fileapi/recent_model.h
+++ b/chrome/browser/chromeos/fileapi/recent_model.h
@@ -13,13 +13,13 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/chromeos/fileapi/recent_file.h"
#include "chrome/browser/chromeos/fileapi/recent_source.h"
#include "components/keyed_service/core/keyed_service.h"
#include "storage/browser/file_system/file_system_url.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
class Profile;
@@ -91,10 +91,10 @@
// If this is set to non-null, it is used as a cut-off time. Should be used
// only in unit tests.
- base::Optional<base::Time> forced_cutoff_time_;
+ absl::optional<base::Time> forced_cutoff_time_;
// Cached GetRecentFiles() response.
- base::Optional<std::vector<RecentFile>> cached_files_ = base::nullopt;
+ absl::optional<std::vector<RecentFile>> cached_files_ = absl::nullopt;
// File type of the cached GetRecentFiles() response.
FileType cached_files_type_ = FileType::kAll;
diff --git a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc
index e990186..d072e66 100644
--- a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc
+++ b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc
@@ -415,7 +415,7 @@
auto delegate =
base::MakeRefCounted<message_center::HandleNotificationClickDelegate>(
base::BindRepeating(
- [](Profile* profile, base::Optional<int> button_index) {
+ [](Profile* profile, absl::optional<int> button_index) {
if (!button_index)
return;
diff --git a/chrome/browser/chromeos/full_restore/arc_ghost_window_delegate.cc b/chrome/browser/chromeos/full_restore/arc_ghost_window_delegate.cc
index cc7d610..9e7e920 100644
--- a/chrome/browser/chromeos/full_restore/arc_ghost_window_delegate.cc
+++ b/chrome/browser/chromeos/full_restore/arc_ghost_window_delegate.cc
@@ -149,7 +149,7 @@
}
bool ArcGhostWindowDelegate::SetDisplayId(int64_t display_id) {
- base::Optional<double> scale_factor = GetDisplayScaleFactor(display_id);
+ absl::optional<double> scale_factor = GetDisplayScaleFactor(display_id);
if (!scale_factor.has_value()) {
LOG(ERROR) << "Invalid display id for ARC Ghost Window";
scale_factor_ = 1.;
diff --git a/chrome/browser/chromeos/full_restore/arc_ghost_window_shell_surface.cc b/chrome/browser/chromeos/full_restore/arc_ghost_window_shell_surface.cc
index 1bcdb70..8a6a4bc 100644
--- a/chrome/browser/chromeos/full_restore/arc_ghost_window_shell_surface.cc
+++ b/chrome/browser/chromeos/full_restore/arc_ghost_window_shell_surface.cc
@@ -22,11 +22,11 @@
int window_id,
int64_t display_id,
gfx::Rect bounds,
- base::Optional<gfx::Size> maximum_size,
- base::Optional<gfx::Size> minimum_size,
+ absl::optional<gfx::Size> maximum_size,
+ absl::optional<gfx::Size> minimum_size,
std::unique_ptr<views::View> content,
base::RepeatingClosure close_callback) {
- base::Optional<double> scale_factor = GetDisplayScaleFactor(display_id);
+ absl::optional<double> scale_factor = GetDisplayScaleFactor(display_id);
DCHECK(scale_factor.has_value());
// TODO(sstan): Handle the desk container from full_restore data.
diff --git a/chrome/browser/chromeos/full_restore/arc_ghost_window_shell_surface.h b/chrome/browser/chromeos/full_restore/arc_ghost_window_shell_surface.h
index e523042..4edc9c2 100644
--- a/chrome/browser/chromeos/full_restore/arc_ghost_window_shell_surface.h
+++ b/chrome/browser/chromeos/full_restore/arc_ghost_window_shell_surface.h
@@ -26,8 +26,8 @@
int window_id,
int64_t display_id,
gfx::Rect bounds,
- base::Optional<gfx::Size> maximum_size,
- base::Optional<gfx::Size> minimum_size,
+ absl::optional<gfx::Size> maximum_size,
+ absl::optional<gfx::Size> minimum_size,
std::unique_ptr<views::View> content,
base::RepeatingClosure close_callback);
diff --git a/chrome/browser/chromeos/full_restore/arc_window_utils.cc b/chrome/browser/chromeos/full_restore/arc_window_utils.cc
index a30bfef..a009ce1 100644
--- a/chrome/browser/chromeos/full_restore/arc_window_utils.cc
+++ b/chrome/browser/chromeos/full_restore/arc_window_utils.cc
@@ -35,13 +35,13 @@
exo::WMHelper::HasInstance();
}
-base::Optional<double> GetDisplayScaleFactor(int64_t display_id) {
+absl::optional<double> GetDisplayScaleFactor(int64_t display_id) {
display::Display display;
if (display::Screen::GetScreen()->GetDisplayWithDisplayId(display_id,
&display)) {
return display.device_scale_factor();
}
- return base::nullopt;
+ return absl::nullopt;
}
apps::mojom::WindowInfoPtr HandleArcWindowInfo(
diff --git a/chrome/browser/chromeos/full_restore/arc_window_utils.h b/chrome/browser/chromeos/full_restore/arc_window_utils.h
index baaebf77..fd3a19e9 100644
--- a/chrome/browser/chromeos/full_restore/arc_window_utils.h
+++ b/chrome/browser/chromeos/full_restore/arc_window_utils.h
@@ -7,13 +7,13 @@
#include <utility>
-#include "base/optional.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace full_restore {
-base::Optional<double> GetDisplayScaleFactor(int64_t display_id);
+absl::optional<double> GetDisplayScaleFactor(int64_t display_id);
// Returns true if the ARC supports ghost window.
bool IsArcGhostWindowEnabled();
diff --git a/chrome/browser/chromeos/full_restore/full_restore_service.cc b/chrome/browser/chromeos/full_restore/full_restore_service.cc
index d5a8ec0b..73eea604 100644
--- a/chrome/browser/chromeos/full_restore/full_restore_service.cc
+++ b/chrome/browser/chromeos/full_restore/full_restore_service.cc
@@ -163,7 +163,7 @@
}
void FullRestoreService::HandleRestoreNotificationClicked(
- base::Optional<int> button_index) {
+ absl::optional<int> button_index) {
DCHECK(notification_);
if (!is_shut_down_) {
NotificationDisplayService::GetForProfile(profile_)->Close(
diff --git a/chrome/browser/chromeos/full_restore/full_restore_service.h b/chrome/browser/chromeos/full_restore/full_restore_service.h
index a33fa3dd..86852a3 100644
--- a/chrome/browser/chromeos/full_restore/full_restore_service.h
+++ b/chrome/browser/chromeos/full_restore/full_restore_service.h
@@ -8,9 +8,9 @@
#include <memory>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/sync_preferences/pref_service_syncable_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -62,7 +62,7 @@
// Show the restore notification on startup.
void ShowRestoreNotification(const std::string& id);
- void HandleRestoreNotificationClicked(base::Optional<int> button_index);
+ void HandleRestoreNotificationClicked(absl::optional<int> button_index);
// Implement the restoration.
void Restore();
diff --git a/chrome/browser/chromeos/full_restore/full_restore_service_unittest.cc b/chrome/browser/chromeos/full_restore/full_restore_service_unittest.cc
index a1985f28..d305f26 100644
--- a/chrome/browser/chromeos/full_restore/full_restore_service_unittest.cc
+++ b/chrome/browser/chromeos/full_restore/full_restore_service_unittest.cc
@@ -8,7 +8,6 @@
#include "ash/public/cpp/ash_features.h"
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_string_value_serializer.h"
-#include "base/optional.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
#include "chrome/browser/chromeos/full_restore/full_restore_prefs.h"
@@ -35,6 +34,7 @@
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/message_center/public/cpp/notification.h"
// TODO(crbug.com/909794): Verify apps restoration.
@@ -113,7 +113,7 @@
}
bool HasNotificationFor(const std::string& notification_id) {
- base::Optional<message_center::Notification> message_center_notification =
+ absl::optional<message_center::Notification> message_center_notification =
display_service()->GetNotification(notification_id);
return message_center_notification.has_value();
}
@@ -141,7 +141,7 @@
RestoreNotificationButtonIndex action_index) {
display_service()->SimulateClick(
NotificationHandler::Type::TRANSIENT, notification_id,
- static_cast<int>(action_index), base::nullopt);
+ static_cast<int>(action_index), absl::nullopt);
}
// Simulates the initial sync of preferences.
diff --git a/chrome/browser/chromeos/input_method/multi_word_suggester.cc b/chrome/browser/chromeos/input_method/multi_word_suggester.cc
index 128b53ec..145fc30 100644
--- a/chrome/browser/chromeos/input_method/multi_word_suggester.cc
+++ b/chrome/browser/chromeos/input_method/multi_word_suggester.cc
@@ -4,10 +4,10 @@
#include "chrome/browser/chromeos/input_method/multi_word_suggester.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chromeos/input_method/ui/suggestion_details.h"
#include "chromeos/services/ime/public/cpp/suggestions.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/events/keycodes/dom/dom_code.h"
namespace chromeos {
@@ -16,16 +16,16 @@
using TextSuggestion = ::chromeos::ime::TextSuggestion;
using TextSuggestionType = ::chromeos::ime::TextSuggestionType;
-base::Optional<TextSuggestion> GetMultiWordSuggestion(
+absl::optional<TextSuggestion> GetMultiWordSuggestion(
const std::vector<TextSuggestion>& suggestions) {
if (suggestions.empty())
- return base::nullopt;
+ return absl::nullopt;
if (suggestions[0].type == TextSuggestionType::kMultiWord) {
// There should only ever be one multi word suggestion given at a time.
DCHECK_EQ(suggestions.size(), 1);
return suggestions[0];
}
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace
diff --git a/chrome/browser/chromeos/input_method/personal_info_suggester.h b/chrome/browser/chromeos/input_method/personal_info_suggester.h
index 4c6f376..562a929 100644
--- a/chrome/browser/chromeos/input_method/personal_info_suggester.h
+++ b/chrome/browser/chromeos/input_method/personal_info_suggester.h
@@ -7,7 +7,6 @@
#include <string>
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/input_method/input_method_engine_base.h"
#include "chrome/browser/chromeos/input_method/suggester.h"
@@ -16,6 +15,7 @@
#include "chrome/browser/chromeos/input_method/tts_handler.h"
#include "chrome/browser/extensions/api/input_ime/input_ime_api.h"
#include "chromeos/services/ime/public/cpp/suggestions.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace autofill {
class PersonalDataManager;
diff --git a/chrome/browser/chromeos/input_method/suggestions_service_client.cc b/chrome/browser/chromeos/input_method/suggestions_service_client.cc
index 793c27a..4ea44c27 100644
--- a/chrome/browser/chromeos/input_method/suggestions_service_client.cc
+++ b/chrome/browser/chromeos/input_method/suggestions_service_client.cc
@@ -5,8 +5,8 @@
#include "chrome/browser/chromeos/input_method/suggestions_service_client.h"
#include "base/bind.h"
-#include "base/optional.h"
#include "chromeos/services/machine_learning/public/cpp/service_connection.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace {
@@ -19,11 +19,11 @@
using ::chromeos::machine_learning::mojom::TextSuggesterResultPtr;
using ::chromeos::machine_learning::mojom::TextSuggestionCandidatePtr;
-base::Optional<TextSuggestion> ToTextSuggestion(
+absl::optional<TextSuggestion> ToTextSuggestion(
const TextSuggestionCandidatePtr& candidate) {
if (!candidate->is_multi_word()) {
// TODO(crbug/1146266): Handle emoji suggestions
- return base::nullopt;
+ return absl::nullopt;
}
return TextSuggestion{
diff --git a/chrome/browser/chromeos/input_method/ui/suggestion_window_view_unittest.cc b/chrome/browser/chromeos/input_method/ui/suggestion_window_view_unittest.cc
index 17f0ede..75bf190 100644
--- a/chrome/browser/chromeos/input_method/ui/suggestion_window_view_unittest.cc
+++ b/chrome/browser/chromeos/input_method/ui/suggestion_window_view_unittest.cc
@@ -6,13 +6,13 @@
#include <string>
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/chromeos/input_method/assistive_window_properties.h"
#include "chrome/browser/chromeos/input_method/ui/assistive_delegate.h"
#include "chrome/browser/chromeos/input_method/ui/suggestion_view.h"
#include "chrome/test/views/chrome_views_test_base.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/link.h"
@@ -64,15 +64,15 @@
[](const views::View* v) { return !!v->background(); });
}
- base::Optional<int> GetHighlightedIndex() const {
+ absl::optional<int> GetHighlightedIndex() const {
const auto& children =
suggestion_window_view_->candidate_area_for_testing()->children();
const auto it =
std::find_if(children.cbegin(), children.cend(),
[](const views::View* v) { return !!v->background(); });
return (it == children.cend())
- ? base::nullopt
- : base::make_optional(std::distance(children.cbegin(), it));
+ ? absl::nullopt
+ : absl::make_optional(std::distance(children.cbegin(), it));
}
SuggestionWindowView* suggestion_window_view_;
diff --git a/chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine.cc b/chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine.cc
index d720d6b..37e31a1 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine.cc
@@ -11,7 +11,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/rand_util.h"
#include "base/time/default_tick_clock.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
@@ -21,6 +20,7 @@
#include "net/base/host_port_pair.h"
#include "net/base/net_errors.h"
#include "net/base/network_isolation_key.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class TimeTicks;
@@ -131,7 +131,7 @@
void DnsLatencyRoutine::OnMojoConnectionError() {
CreateHostResolver();
OnComplete(net::ERR_NAME_NOT_RESOLVED, net::ResolveErrorInfo(net::ERR_FAILED),
- base::nullopt);
+ absl::nullopt);
}
void DnsLatencyRoutine::AttemptNextResolution() {
@@ -161,7 +161,7 @@
void DnsLatencyRoutine::OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) {
+ const absl::optional<net::AddressList>& resolved_addresses) {
receiver_.reset();
resolution_complete_time_ = tick_clock_->NowTicks();
const base::TimeDelta latency =
diff --git a/chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine.h b/chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine.h
index b1c3354..761d3d3 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine.h
+++ b/chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine.h
@@ -8,13 +8,13 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/net/network_diagnostics/network_diagnostics_routine.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/network/public/cpp/resolve_host_client_base.h"
#include "services/network/public/mojom/host_resolver.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -44,7 +44,7 @@
void OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) override;
+ const absl::optional<net::AddressList>& resolved_addresses) override;
// Run the core logic of this routine. Set |callback| to
// |routine_completed_callback_|, which is to be executed in
diff --git a/chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine_unittest.cc b/chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine_unittest.cc
index 2a61d64..82aed0f6 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine_unittest.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine_unittest.cc
@@ -61,14 +61,14 @@
struct DnsResult {
DnsResult(int32_t result,
net::ResolveErrorInfo resolve_error_info,
- base::Optional<net::AddressList> resolved_addresses)
+ absl::optional<net::AddressList> resolved_addresses)
: result(result),
resolve_error_info(resolve_error_info),
resolved_addresses(resolved_addresses) {}
int result;
net::ResolveErrorInfo resolve_error_info;
- base::Optional<net::AddressList> resolved_addresses;
+ absl::optional<net::AddressList> resolved_addresses;
};
FakeHostResolver(mojo::PendingReceiver<network::mojom::HostResolver> receiver,
@@ -112,7 +112,7 @@
// network::TestNetworkContext:
void CreateHostResolver(
- const base::Optional<net::DnsConfigOverrides>& config_overrides,
+ const absl::optional<net::DnsConfigOverrides>& config_overrides,
mojo::PendingReceiver<network::mojom::HostResolver> receiver) override {
ASSERT_FALSE(resolver_);
resolver_ =
diff --git a/chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine.cc b/chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine.cc
index b29c345..2306341 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine.cc
@@ -8,7 +8,6 @@
#include <utility>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -18,6 +17,7 @@
#include "net/base/net_errors.h"
#include "net/base/network_isolation_key.h"
#include "services/network/public/mojom/network_context.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
@@ -80,7 +80,7 @@
void DnsResolutionRoutine::OnMojoConnectionError() {
CreateHostResolver();
OnComplete(net::ERR_NAME_NOT_RESOLVED, net::ResolveErrorInfo(net::ERR_FAILED),
- base::nullopt);
+ absl::nullopt);
}
void DnsResolutionRoutine::AttemptResolution() {
@@ -109,7 +109,7 @@
void DnsResolutionRoutine::OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) {
+ const absl::optional<net::AddressList>& resolved_addresses) {
receiver_.reset();
bool success = result == net::OK && !resolved_addresses->empty() &&
diff --git a/chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine.h b/chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine.h
index 5529c15e..8375f19e 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine.h
+++ b/chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine.h
@@ -8,12 +8,12 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/net/network_diagnostics/network_diagnostics_routine.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/network/public/cpp/resolve_host_client_base.h"
#include "services/network/public/mojom/host_resolver.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -45,7 +45,7 @@
void OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) override;
+ const absl::optional<net::AddressList>& resolved_addresses) override;
// Run the core logic of this routine. Set |callback| to
// |routine_completed_callback_|, which is to be executed in
diff --git a/chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine_unittest.cc b/chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine_unittest.cc
index c0042332..113200c 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine_unittest.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine_unittest.cc
@@ -33,14 +33,14 @@
struct DnsResult {
DnsResult(int32_t result,
net::ResolveErrorInfo resolve_error_info,
- base::Optional<net::AddressList> resolved_addresses)
+ absl::optional<net::AddressList> resolved_addresses)
: result(result),
resolve_error_info(resolve_error_info),
resolved_addresses(resolved_addresses) {}
int result;
net::ResolveErrorInfo resolve_error_info;
- base::Optional<net::AddressList> resolved_addresses;
+ absl::optional<net::AddressList> resolved_addresses;
};
FakeHostResolver(mojo::PendingReceiver<network::mojom::HostResolver> receiver,
@@ -90,7 +90,7 @@
// network::TestNetworkContext:
void CreateHostResolver(
- const base::Optional<net::DnsConfigOverrides>& config_overrides,
+ const absl::optional<net::DnsConfigOverrides>& config_overrides,
mojo::PendingReceiver<network::mojom::HostResolver> receiver) override {
ASSERT_FALSE(resolver_);
resolver_ = std::make_unique<FakeHostResolver>(
diff --git a/chrome/browser/chromeos/net/network_diagnostics/dns_resolver_present_routine.cc b/chrome/browser/chromeos/net/network_diagnostics/dns_resolver_present_routine.cc
index 73533b4e..852d952 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/dns_resolver_present_routine.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/dns_resolver_present_routine.cc
@@ -9,11 +9,11 @@
#include <vector>
#include "base/bind.h"
-#include "base/optional.h"
#include "chromeos/services/network_config/in_process_instance.h"
#include "chromeos/services/network_config/public/cpp/cros_network_config_util.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
diff --git a/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.cc b/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.cc
index 8ecd070..5d0cd20 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.cc
@@ -9,10 +9,10 @@
#include "base/logging.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/address_list.h"
#include "net/dns/public/resolve_error_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
@@ -20,7 +20,7 @@
FakeHostResolver::DnsResult::DnsResult(
int32_t result,
net::ResolveErrorInfo resolve_error_info,
- base::Optional<net::AddressList> resolved_addresses)
+ absl::optional<net::AddressList> resolved_addresses)
: result_(result),
resolve_error_info_(resolve_error_info),
resolved_addresses_(resolved_addresses) {}
diff --git a/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.h b/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.h
index ab66f772..496fe43 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.h
+++ b/chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.h
@@ -8,12 +8,12 @@
#include <memory>
#include <utility>
-#include "base/optional.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "net/base/address_list.h"
#include "net/dns/public/resolve_error_info.h"
#include "services/network/public/mojom/host_resolver.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
@@ -26,12 +26,12 @@
public:
DnsResult(int32_t result,
net::ResolveErrorInfo resolve_error_info,
- base::Optional<net::AddressList> resolved_addresses);
+ absl::optional<net::AddressList> resolved_addresses);
~DnsResult();
int result_;
net::ResolveErrorInfo resolve_error_info_;
- base::Optional<net::AddressList> resolved_addresses_;
+ absl::optional<net::AddressList> resolved_addresses_;
};
FakeHostResolver(
diff --git a/chrome/browser/chromeos/net/network_diagnostics/fake_network_context.cc b/chrome/browser/chromeos/net/network_diagnostics/fake_network_context.cc
index 42b6819b..a86b0a1 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/fake_network_context.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/fake_network_context.cc
@@ -28,7 +28,7 @@
FakeNetworkContext::~FakeNetworkContext() = default;
void FakeNetworkContext::CreateHostResolver(
- const base::Optional<net::DnsConfigOverrides>& config_overrides,
+ const absl::optional<net::DnsConfigOverrides>& config_overrides,
mojo::PendingReceiver<network::mojom::HostResolver> receiver) {
DCHECK(!resolver_);
resolver_ = std::make_unique<FakeHostResolver>(std::move(receiver));
@@ -37,7 +37,7 @@
}
void FakeNetworkContext::CreateTCPConnectedSocket(
- const base::Optional<net::IPEndPoint>& local_addr,
+ const absl::optional<net::IPEndPoint>& local_addr,
const net::AddressList& remote_addr_list,
network::mojom::TCPConnectedSocketOptionsPtr tcp_connected_socket_options,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
@@ -80,7 +80,7 @@
}
void FakeNetworkContext::SetTCPConnectCode(
- base::Optional<net::Error>& tcp_connect_code) {
+ absl::optional<net::Error>& tcp_connect_code) {
if (tcp_connect_code.has_value()) {
tcp_connect_code_ = tcp_connect_code.value();
fake_tcp_connected_socket_ = std::make_unique<FakeTCPConnectedSocket>();
@@ -88,7 +88,7 @@
}
void FakeNetworkContext::SetTLSUpgradeCode(
- base::Optional<net::Error>& tls_upgrade_code) {
+ absl::optional<net::Error>& tls_upgrade_code) {
if (tls_upgrade_code.has_value()) {
DCHECK(fake_tcp_connected_socket_);
diff --git a/chrome/browser/chromeos/net/network_diagnostics/fake_network_context.h b/chrome/browser/chromeos/net/network_diagnostics/fake_network_context.h
index c4f90e8..5af342c 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/fake_network_context.h
+++ b/chrome/browser/chromeos/net/network_diagnostics/fake_network_context.h
@@ -10,11 +10,11 @@
#include "base/containers/circular_deque.h"
#include "base/containers/span.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.h"
#include "chrome/browser/chromeos/net/network_diagnostics/fake_tcp_connected_socket.h"
#include "chrome/browser/chromeos/net/network_diagnostics/fake_udp_socket.h"
#include "services/network/test/test_network_context.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
@@ -30,11 +30,11 @@
// network::TestNetworkContext:
void CreateHostResolver(
- const base::Optional<net::DnsConfigOverrides>& config_overrides,
+ const absl::optional<net::DnsConfigOverrides>& config_overrides,
mojo::PendingReceiver<network::mojom::HostResolver> receiver) override;
void CreateTCPConnectedSocket(
- const base::Optional<net::IPEndPoint>& local_addr,
+ const absl::optional<net::IPEndPoint>& local_addr,
const net::AddressList& remote_addr_list,
network::mojom::TCPConnectedSocketOptionsPtr tcp_connected_socket_options,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
@@ -48,10 +48,10 @@
// Sets the fake TCP connect code. TODO(khegde): Change this to
// SetTCPConnectCompleteCode.
- void SetTCPConnectCode(base::Optional<net::Error>& tcp_connect_code);
+ void SetTCPConnectCode(absl::optional<net::Error>& tcp_connect_code);
// Sets the fake TLS upgrade code.
- void SetTLSUpgradeCode(base::Optional<net::Error>& tls_upgrade_code);
+ void SetTLSUpgradeCode(absl::optional<net::Error>& tls_upgrade_code);
// Sets the fake UDP connect code.
void SetUdpConnectCode(net::Error udp_connect_code);
diff --git a/chrome/browser/chromeos/net/network_diagnostics/fake_tcp_connected_socket.cc b/chrome/browser/chromeos/net/network_diagnostics/fake_tcp_connected_socket.cc
index 401c083..8b86c15 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/fake_tcp_connected_socket.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/fake_tcp_connected_socket.cc
@@ -8,8 +8,8 @@
#include "base/callback.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "mojo/public/cpp/system/data_pipe.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
FakeTCPConnectedSocket::FakeTCPConnectedSocket() = default;
@@ -30,7 +30,7 @@
std::move(callback).Run(tls_upgrade_code_,
mojo::ScopedDataPipeConsumerHandle(),
mojo::ScopedDataPipeProducerHandle(),
- /*ssl_info=*/base::nullopt);
+ /*ssl_info=*/absl::nullopt);
}
void FakeTCPConnectedSocket::SetSendBufferSize(
diff --git a/chrome/browser/chromeos/net/network_diagnostics/fake_udp_socket.cc b/chrome/browser/chromeos/net/network_diagnostics/fake_udp_socket.cc
index 2451277..bc8a3239 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/fake_udp_socket.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/fake_udp_socket.cc
@@ -6,8 +6,8 @@
#include <utility>
-#include "base/optional.h"
#include "net/base/ip_endpoint.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
diff --git a/chrome/browser/chromeos/net/network_diagnostics/gateway_can_be_pinged_routine.cc b/chrome/browser/chromeos/net/network_diagnostics/gateway_can_be_pinged_routine.cc
index 621e158..9ac375d 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/gateway_can_be_pinged_routine.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/gateway_can_be_pinged_routine.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chromeos/dbus/debug_daemon/debug_daemon_client.h"
#include "chromeos/services/network_config/in_process_instance.h"
@@ -16,6 +15,7 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/net_errors.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
@@ -136,7 +136,7 @@
bool GatewayCanBePingedRoutine::ParseICMPResult(const std::string& status,
std::string* ip,
base::TimeDelta* latency) {
- base::Optional<base::Value> parsed_value(base::JSONReader::Read(status));
+ absl::optional<base::Value> parsed_value(base::JSONReader::Read(status));
if (!parsed_value.has_value()) {
return false;
}
@@ -215,7 +215,7 @@
void GatewayCanBePingedRoutine::OnTestICMPCompleted(
bool is_default_network_ping_result,
- const base::Optional<std::string> status) {
+ const absl::optional<std::string> status) {
DCHECK(gateways_remaining_ > 0);
std::string result_ip;
base::TimeDelta result_latency;
diff --git a/chrome/browser/chromeos/net/network_diagnostics/gateway_can_be_pinged_routine.h b/chrome/browser/chromeos/net/network_diagnostics/gateway_can_be_pinged_routine.h
index b6b943c..789b9c00 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/gateway_can_be_pinged_routine.h
+++ b/chrome/browser/chromeos/net/network_diagnostics/gateway_can_be_pinged_routine.h
@@ -58,7 +58,7 @@
// |is_default_network_ping_result| is true if the ICMP result, stored in
// |status| corresponds to that of the default network.
void OnTestICMPCompleted(bool is_default_network_ping_result,
- const base::Optional<std::string> status);
+ const absl::optional<std::string> status);
chromeos::DebugDaemonClient* debug_daemon_client() const {
DCHECK(debug_daemon_client_);
return debug_daemon_client_;
diff --git a/chrome/browser/chromeos/net/network_diagnostics/gateway_can_be_pinged_routine_unittest.cc b/chrome/browser/chromeos/net/network_diagnostics/gateway_can_be_pinged_routine_unittest.cc
index bc9c5a5..74e5f93 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/gateway_can_be_pinged_routine_unittest.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/gateway_can_be_pinged_routine_unittest.cc
@@ -82,7 +82,7 @@
void TestICMP(const std::string& ip_address,
TestICMPCallback callback) override {
// Invoke the test callback with fake output.
- std::move(callback).Run(base::Optional<std::string>{icmp_output_});
+ std::move(callback).Run(absl::optional<std::string>{icmp_output_});
}
private:
diff --git a/chrome/browser/chromeos/net/network_diagnostics/host_resolver.cc b/chrome/browser/chromeos/net/network_diagnostics/host_resolver.cc
index 0ce2d88..c14b4f0 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/host_resolver.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/host_resolver.cc
@@ -7,10 +7,10 @@
#include <utility>
#include "base/bind.h"
-#include "base/optional.h"
#include "net/base/net_errors.h"
#include "net/base/network_isolation_key.h"
#include "net/dns/public/dns_config_overrides.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
@@ -18,7 +18,7 @@
HostResolver::ResolutionResult::ResolutionResult(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses)
+ const absl::optional<net::AddressList>& resolved_addresses)
: result(result),
resolve_error_info(resolve_error_info),
resolved_addresses(resolved_addresses) {}
@@ -55,7 +55,7 @@
void HostResolver::OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) {
+ const absl::optional<net::AddressList>& resolved_addresses) {
receiver_.reset();
host_resolver_.reset();
@@ -66,7 +66,7 @@
void HostResolver::OnMojoConnectionError() {
OnComplete(net::ERR_NAME_NOT_RESOLVED, net::ResolveErrorInfo(net::ERR_FAILED),
- base::nullopt);
+ absl::nullopt);
}
} // namespace network_diagnostics
diff --git a/chrome/browser/chromeos/net/network_diagnostics/host_resolver.h b/chrome/browser/chromeos/net/network_diagnostics/host_resolver.h
index 00c4aa0..2b79920 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/host_resolver.h
+++ b/chrome/browser/chromeos/net/network_diagnostics/host_resolver.h
@@ -24,12 +24,12 @@
ResolutionResult(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses);
+ const absl::optional<net::AddressList>& resolved_addresses);
~ResolutionResult();
int result;
net::ResolveErrorInfo resolve_error_info;
- base::Optional<net::AddressList> resolved_addresses;
+ absl::optional<net::AddressList> resolved_addresses;
};
using OnResolutionComplete = base::OnceCallback<void(ResolutionResult&)>;
@@ -47,7 +47,7 @@
void OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) override;
+ const absl::optional<net::AddressList>& resolved_addresses) override;
private:
// Handles Mojo connection errors during host resolution.
diff --git a/chrome/browser/chromeos/net/network_diagnostics/host_resolver_unittest.cc b/chrome/browser/chromeos/net/network_diagnostics/host_resolver_unittest.cc
index 5f1a702c5..1bd38f0 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/host_resolver_unittest.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/host_resolver_unittest.cc
@@ -53,7 +53,7 @@
net::OK, net::ResolveErrorInfo(net::OK), address_list);
InitializeNetworkContext(std::move(fake_dns_result));
HostResolver::ResolutionResult resolution_result{
- net::ERR_FAILED, net::ResolveErrorInfo(net::OK), base::nullopt};
+ net::ERR_FAILED, net::ResolveErrorInfo(net::OK), absl::nullopt};
base::RunLoop run_loop;
host_resolver_ = std::make_unique<HostResolver>(
kFakeHostPortPair, fake_network_context(),
@@ -82,10 +82,10 @@
TEST_F(HostResolverTest, TestFailedHostResolution) {
auto fake_dns_result = std::make_unique<FakeHostResolver::DnsResult>(
net::ERR_NAME_NOT_RESOLVED,
- net::ResolveErrorInfo(net::ERR_NAME_NOT_RESOLVED), base::nullopt);
+ net::ResolveErrorInfo(net::ERR_NAME_NOT_RESOLVED), absl::nullopt);
InitializeNetworkContext(std::move(fake_dns_result));
HostResolver::ResolutionResult resolution_result{
- net::ERR_FAILED, net::ResolveErrorInfo(net::OK), base::nullopt};
+ net::ERR_FAILED, net::ResolveErrorInfo(net::OK), absl::nullopt};
base::RunLoop run_loop;
host_resolver_ = std::make_unique<HostResolver>(
kFakeHostPortPair, fake_network_context(),
@@ -113,7 +113,7 @@
InitializeNetworkContext(/*fake_dns_result=*/{});
fake_network_context()->set_disconnect_during_host_resolution(true);
HostResolver::ResolutionResult resolution_result{
- net::ERR_FAILED, net::ResolveErrorInfo(net::OK), base::nullopt};
+ net::ERR_FAILED, net::ResolveErrorInfo(net::OK), absl::nullopt};
base::RunLoop run_loop;
host_resolver_ = std::make_unique<HostResolver>(
kFakeHostPortPair, fake_network_context(),
diff --git a/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine.cc b/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine.cc
index cc9823c8..1694b96ba 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine.cc
@@ -12,7 +12,6 @@
#include "base/bind.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/sequence_checker.h"
@@ -27,6 +26,7 @@
#include "net/socket/client_socket_factory.h"
#include "net/socket/transport_client_socket.h"
#include "services/network/public/mojom/network_context.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
@@ -97,7 +97,7 @@
void OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) override;
+ const absl::optional<net::AddressList>& resolved_addresses) override;
// Performs the DNS resolution.
void Run(const std::string& hostname);
@@ -137,7 +137,7 @@
void HttpFirewallRoutine::HostResolver::OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) {
+ const absl::optional<net::AddressList>& resolved_addresses) {
receiver_.reset();
http_firewall_routine_->OnHostResolutionComplete(result, resolve_error_info,
@@ -175,7 +175,7 @@
void HttpFirewallRoutine::HostResolver::OnMojoConnectionError() {
CreateHostResolver();
OnComplete(net::ERR_NAME_NOT_RESOLVED, net::ResolveErrorInfo(net::ERR_FAILED),
- base::nullopt);
+ absl::nullopt);
}
HttpFirewallRoutine::HttpFirewallRoutine() {
@@ -240,7 +240,7 @@
void HttpFirewallRoutine::OnHostResolutionComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) {
+ const absl::optional<net::AddressList>& resolved_addresses) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
bool success = result == net::OK && !resolved_addresses->empty() &&
diff --git a/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine.h b/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine.h
index 3495fef..a762150 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine.h
+++ b/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine.h
@@ -9,7 +9,6 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/net/network_diagnostics/network_diagnostics_routine.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
@@ -17,6 +16,7 @@
#include "net/log/net_log_with_source.h"
#include "services/network/public/cpp/resolve_host_client_base.h"
#include "services/network/public/mojom/host_resolver.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -58,7 +58,7 @@
void OnHostResolutionComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses);
+ const absl::optional<net::AddressList>& resolved_addresses);
void SetNetworkContextForTesting(
network::mojom::NetworkContext* network_context);
diff --git a/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine_unittest.cc b/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine_unittest.cc
index 77477449..84e6533 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine_unittest.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/http_firewall_routine_unittest.cc
@@ -42,14 +42,14 @@
struct DnsResult {
DnsResult(int32_t result,
net::ResolveErrorInfo resolve_error_info,
- base::Optional<net::AddressList> resolved_addresses)
+ absl::optional<net::AddressList> resolved_addresses)
: result(result),
resolve_error_info(resolve_error_info),
resolved_addresses(resolved_addresses) {}
int result;
net::ResolveErrorInfo resolve_error_info;
- base::Optional<net::AddressList> resolved_addresses;
+ absl::optional<net::AddressList> resolved_addresses;
};
FakeHostResolver(mojo::PendingReceiver<network::mojom::HostResolver> receiver,
@@ -99,7 +99,7 @@
// network::TestNetworkContext:
void CreateHostResolver(
- const base::Optional<net::DnsConfigOverrides>& config_overrides,
+ const absl::optional<net::DnsConfigOverrides>& config_overrides,
mojo::PendingReceiver<network::mojom::HostResolver> receiver) override {
ASSERT_FALSE(resolver_);
resolver_ = std::make_unique<FakeHostResolver>(
diff --git a/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine.cc b/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine.cc
index 12a6dd72..4dfff32 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine.cc
@@ -75,7 +75,7 @@
void OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) override;
+ const absl::optional<net::AddressList>& resolved_addresses) override;
// Performs the DNS resolution.
void Run(const GURL& url);
@@ -107,7 +107,7 @@
void HttpsLatencyRoutine::HostResolver::OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) {
+ const absl::optional<net::AddressList>& resolved_addresses) {
receiver_.reset();
host_resolver_.reset();
@@ -143,7 +143,7 @@
void HttpsLatencyRoutine::HostResolver::OnMojoConnectionError() {
OnComplete(net::ERR_NAME_NOT_RESOLVED, net::ResolveErrorInfo(net::ERR_FAILED),
- base::nullopt);
+ absl::nullopt);
}
HttpsLatencyRoutine::HttpsLatencyRoutine()
@@ -212,7 +212,7 @@
void HttpsLatencyRoutine::OnHostResolutionComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) {
+ const absl::optional<net::AddressList>& resolved_addresses) {
bool success = result == net::OK && !resolved_addresses->empty() &&
resolved_addresses.has_value();
if (!success) {
diff --git a/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine.h b/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine.h
index 8d37f45..0223202 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine.h
+++ b/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine.h
@@ -10,7 +10,6 @@
#include <vector>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/net/network_diagnostics/http_request_manager.h"
#include "chrome/browser/chromeos/net/network_diagnostics/network_diagnostics_routine.h"
@@ -18,6 +17,7 @@
#include "net/dns/public/resolve_error_info.h"
#include "services/network/public/cpp/resolve_host_client_base.h"
#include "services/network/public/mojom/host_resolver.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class HttpRequestManager;
@@ -64,7 +64,7 @@
void OnHostResolutionComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses);
+ const absl::optional<net::AddressList>& resolved_addresses);
// Sets the NetworkContextGetter for testing.
void set_network_context_getter(NetworkContextGetter network_context_getter) {
diff --git a/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine_unittest.cc b/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine_unittest.cc
index e3ab482..4c6f44449 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine_unittest.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine_unittest.cc
@@ -47,14 +47,14 @@
struct DnsResult {
DnsResult(int32_t result,
net::ResolveErrorInfo resolve_error_info,
- base::Optional<net::AddressList> resolved_addresses)
+ absl::optional<net::AddressList> resolved_addresses)
: result(result),
resolve_error_info(resolve_error_info),
resolved_addresses(resolved_addresses) {}
int result;
net::ResolveErrorInfo resolve_error_info;
- base::Optional<net::AddressList> resolved_addresses;
+ absl::optional<net::AddressList> resolved_addresses;
};
FakeHostResolver(mojo::PendingReceiver<network::mojom::HostResolver> receiver,
@@ -100,7 +100,7 @@
// network::TestNetworkContext:
void CreateHostResolver(
- const base::Optional<net::DnsConfigOverrides>& config_overrides,
+ const absl::optional<net::DnsConfigOverrides>& config_overrides,
mojo::PendingReceiver<network::mojom::HostResolver> receiver) override {
FakeHostResolver::DnsResult* result = fake_dns_results_.front();
DCHECK(result);
diff --git a/chrome/browser/chromeos/net/network_diagnostics/network_diagnostics.cc b/chrome/browser/chromeos/net/network_diagnostics/network_diagnostics.cc
index 5aa8d62..b65e886a 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/network_diagnostics.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/network_diagnostics.cc
@@ -8,7 +8,6 @@
#include <utility>
#include "base/bind.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/net/network_diagnostics/captive_portal_routine.h"
#include "chrome/browser/chromeos/net/network_diagnostics/dns_latency_routine.h"
#include "chrome/browser/chromeos/net/network_diagnostics/dns_resolution_routine.h"
@@ -23,6 +22,7 @@
#include "chrome/browser/chromeos/net/network_diagnostics/video_conferencing_routine.h"
#include "chromeos/dbus/debug_daemon/debug_daemon_client.h"
#include "components/device_event_log/device_event_log.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
@@ -212,7 +212,7 @@
}
void NetworkDiagnostics::VideoConferencing(
- const base::Optional<std::string>& stun_server_name,
+ const absl::optional<std::string>& stun_server_name,
VideoConferencingCallback callback) {
auto routine = std::make_unique<VideoConferencingRoutine>();
if (stun_server_name.has_value()) {
@@ -227,7 +227,7 @@
[](std::unique_ptr<VideoConferencingRoutine> routine,
VideoConferencingCallback callback, mojom::RoutineVerdict verdict,
const std::vector<mojom::VideoConferencingProblem>& problems,
- const base::Optional<std::string>& support_details) {
+ const absl::optional<std::string>& support_details) {
std::move(callback).Run(verdict, problems, support_details);
},
std::move(routine), std::move(callback)));
diff --git a/chrome/browser/chromeos/net/network_diagnostics/network_diagnostics.h b/chrome/browser/chromeos/net/network_diagnostics/network_diagnostics.h
index ce17a7d..a8619d36 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/network_diagnostics.h
+++ b/chrome/browser/chromeos/net/network_diagnostics/network_diagnostics.h
@@ -8,10 +8,10 @@
#include <string>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chromeos/services/network_health/public/mojom/network_diagnostics.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
class DebugDaemonClient;
@@ -42,7 +42,7 @@
void DnsResolution(DnsResolutionCallback callback) override;
void CaptivePortal(CaptivePortalCallback callback) override;
void HttpsLatency(HttpsLatencyCallback callback) override;
- void VideoConferencing(const base::Optional<std::string>& stun_server_name,
+ void VideoConferencing(const absl::optional<std::string>& stun_server_name,
VideoConferencingCallback callback) override;
private:
diff --git a/chrome/browser/chromeos/net/network_diagnostics/network_diagnostics_unittest.cc b/chrome/browser/chromeos/net/network_diagnostics/network_diagnostics_unittest.cc
index 4c1a80f..5441b3e 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/network_diagnostics_unittest.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/network_diagnostics_unittest.cc
@@ -58,7 +58,7 @@
void TestICMP(const std::string& ip_address,
TestICMPCallback callback) override {
// Invoke the test callback with fake output.
- std::move(callback).Run(base::Optional<std::string>{icmp_output_});
+ std::move(callback).Run(absl::optional<std::string>{icmp_output_});
}
void set_icmp_output(const std::string& icmp_output) {
diff --git a/chrome/browser/chromeos/net/network_diagnostics/tls_prober.cc b/chrome/browser/chromeos/net/network_diagnostics/tls_prober.cc
index 75789e0..90a7595 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/tls_prober.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/tls_prober.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/task_runner.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "chrome/browser/chromeos/net/network_diagnostics/network_diagnostics_util.h"
@@ -22,6 +21,7 @@
#include "net/base/host_port_pair.h"
#include "net/base/net_errors.h"
#include "services/network/public/cpp/resolve_host_client_base.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
@@ -108,7 +108,7 @@
DCHECK(network_context);
network_context->CreateTCPConnectedSocket(
- /*local_addr=*/base::nullopt,
+ /*local_addr=*/absl::nullopt,
resolution_result.resolved_addresses.value(),
/*options=*/nullptr,
net::MutableNetworkTrafficAnnotationTag(GetTrafficAnnotationTag()),
@@ -118,8 +118,8 @@
void TlsProber::OnConnectComplete(
int result,
- const base::Optional<net::IPEndPoint>& local_addr,
- const base::Optional<net::IPEndPoint>& peer_addr,
+ const absl::optional<net::IPEndPoint>& local_addr,
+ const absl::optional<net::IPEndPoint>& peer_addr,
mojo::ScopedDataPipeConsumerHandle receive_stream,
mojo::ScopedDataPipeProducerHandle send_stream) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -157,7 +157,7 @@
void TlsProber::OnTlsUpgrade(int result,
mojo::ScopedDataPipeConsumerHandle receive_stream,
mojo::ScopedDataPipeProducerHandle send_stream,
- const base::Optional<net::SSLInfo>& ssl_info) {
+ const absl::optional<net::SSLInfo>& ssl_info) {
// |send_stream| and |receive_stream|, created on the TLS connection, fall out
// of scope when this method completes.
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
diff --git a/chrome/browser/chromeos/net/network_diagnostics/tls_prober.h b/chrome/browser/chromeos/net/network_diagnostics/tls_prober.h
index 2117b35..16994da5 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/tls_prober.h
+++ b/chrome/browser/chromeos/net/network_diagnostics/tls_prober.h
@@ -39,7 +39,7 @@
using NetworkContextGetter =
base::RepeatingCallback<network::mojom::NetworkContext*()>;
using OnConnectCompleteOnUIThreadCallback = base::OnceCallback<
- void(int result, const base::Optional<net::IPEndPoint>& peer_addr)>;
+ void(int result, const absl::optional<net::IPEndPoint>& peer_addr)>;
using TlsProbeCompleteCallback =
base::OnceCallback<void(int result, ProbeExitEnum probe_exit_enum)>;
@@ -76,8 +76,8 @@
// handling has not been set up, the streams should not be used and fall out
// of scope when this method completes.
void OnConnectComplete(int result,
- const base::Optional<net::IPEndPoint>& local_addr,
- const base::Optional<net::IPEndPoint>& peer_addr,
+ const absl::optional<net::IPEndPoint>& local_addr,
+ const absl::optional<net::IPEndPoint>& peer_addr,
mojo::ScopedDataPipeConsumerHandle receive_stream,
mojo::ScopedDataPipeProducerHandle send_stream);
@@ -89,7 +89,7 @@
void OnTlsUpgrade(int result,
mojo::ScopedDataPipeConsumerHandle receive_stream,
mojo::ScopedDataPipeProducerHandle send_stream,
- const base::Optional<net::SSLInfo>& ssl_info);
+ const absl::optional<net::SSLInfo>& ssl_info);
// Handles disconnects on the TCP connected and TLS client remotes.
void OnDisconnect();
diff --git a/chrome/browser/chromeos/net/network_diagnostics/tls_prober_unittest.cc b/chrome/browser/chromeos/net/network_diagnostics/tls_prober_unittest.cc
index 96ad683..2d90f38b 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/tls_prober_unittest.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/tls_prober_unittest.cc
@@ -9,7 +9,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/chromeos/net/network_diagnostics/fake_host_resolver.h"
@@ -30,6 +29,7 @@
#include "services/network/network_service.h"
#include "services/network/test/test_network_context.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
@@ -50,8 +50,8 @@
void InitializeProberNetworkContext(
std::unique_ptr<FakeHostResolver::DnsResult> fake_dns_result,
- base::Optional<net::Error> tcp_connect_code,
- base::Optional<net::Error> tls_upgrade_code) {
+ absl::optional<net::Error> tcp_connect_code,
+ absl::optional<net::Error> tls_upgrade_code) {
fake_network_context_ = std::make_unique<FakeNetworkContext>();
fake_network_context_->set_fake_dns_result(std::move(fake_dns_result));
fake_network_context_->SetTCPConnectCode(tcp_connect_code);
@@ -123,8 +123,8 @@
net::ResolveErrorInfo(net::ERR_NAME_NOT_RESOLVED), net::AddressList());
// Neither TCP connect nor TLS upgrade should not be called in this scenario.
InitializeProberNetworkContext(std::move(fake_dns_result),
- /*tcp_connect_code=*/base::nullopt,
- /*tls_upgrade_code=*/base::nullopt);
+ /*tcp_connect_code=*/absl::nullopt,
+ /*tls_upgrade_code=*/absl::nullopt);
int probe_result = -1;
ProbeExitEnum probe_exit_enum = ProbeExitEnum::kSuccess;
base::RunLoop run_loop;
@@ -148,8 +148,8 @@
// Host resolution will not be successful due to Mojo disconnect. Neither TCP
// connect nor TLS upgrade should not be called in this scenario.
InitializeProberNetworkContext(/*fake_dns_result=*/{},
- /*tcp_connect_code=*/base::nullopt,
- /*tls_upgrade_code=*/base::nullopt);
+ /*tcp_connect_code=*/absl::nullopt,
+ /*tls_upgrade_code=*/absl::nullopt);
fake_network_context()->set_disconnect_during_host_resolution(true);
int probe_result = -1;
ProbeExitEnum probe_exit_enum = ProbeExitEnum::kSuccess;
@@ -177,7 +177,7 @@
net::Error tcp_connect_code = net::ERR_CONNECTION_FAILED;
// TLS upgrade should not be called in this scenario.
InitializeProberNetworkContext(std::move(fake_dns_result), tcp_connect_code,
- /*tls_upgrade_code=*/base::nullopt);
+ /*tls_upgrade_code=*/absl::nullopt);
int probe_result = -1;
ProbeExitEnum probe_exit_enum = ProbeExitEnum::kSuccess;
base::RunLoop run_loop;
@@ -231,8 +231,8 @@
net::AddressList(kFakeIPAddress));
// Since the TCP connection is disconnected, no connection codes are needed.
InitializeProberNetworkContext(std::move(fake_dns_result),
- /*tcp_connect_code=*/base::nullopt,
- /*tls_upgrade_code=*/base::nullopt);
+ /*tcp_connect_code=*/absl::nullopt,
+ /*tls_upgrade_code=*/absl::nullopt);
fake_network_context()->set_disconnect_during_tcp_connection_attempt(true);
int probe_result = -1;
ProbeExitEnum probe_exit_enum = ProbeExitEnum::kSuccess;
@@ -290,7 +290,7 @@
net::AddressList(kFakeIPAddress));
net::Error tcp_connect_code = net::OK;
InitializeProberNetworkContext(std::move(fake_dns_result), tcp_connect_code,
- /*tls_upgrade_code=*/base::nullopt);
+ /*tls_upgrade_code=*/absl::nullopt);
int probe_result = -1;
ProbeExitEnum probe_exit_enum = ProbeExitEnum::kTcpConnectionFailure;
base::RunLoop run_loop;
diff --git a/chrome/browser/chromeos/net/network_diagnostics/udp_prober.cc b/chrome/browser/chromeos/net/network_diagnostics/udp_prober.cc
index d2f0d6f..9603ee2 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/udp_prober.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/udp_prober.cc
@@ -12,7 +12,6 @@
#include "base/containers/span.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/chromeos/net/network_diagnostics/host_resolver.h"
@@ -32,6 +31,7 @@
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/udp_socket.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace chromeos {
@@ -42,7 +42,7 @@
public UdpProber {
public:
using ConnectCallback = base::OnceCallback<
- void(int result, const base::Optional<net::IPEndPoint>& local_addr_out)>;
+ void(int result, const absl::optional<net::IPEndPoint>& local_addr_out)>;
using SendCallback = base::OnceCallback<void(int result)>;
// Establishes a UDP connection and sends |data| to |host_port_pair|. The
@@ -75,7 +75,7 @@
// On success, the UDP socket is connected to the destination and is ready to
// send data. On failure, the UdpProberImpl exits with a failure.
void OnConnectComplete(int result,
- const base::Optional<net::IPEndPoint>& local_addr_out);
+ const absl::optional<net::IPEndPoint>& local_addr_out);
// On success, the UDP socket is ready to receive data. So long as the
// received data is not empty, it is considered valid. The content itself is
@@ -84,8 +84,8 @@
// network::mojom::UDPSocketListener:
void OnReceived(int32_t result,
- const base::Optional<net::IPEndPoint>& src_ip,
- base::Optional<base::span<const uint8_t>> data) override;
+ const absl::optional<net::IPEndPoint>& src_ip,
+ absl::optional<base::span<const uint8_t>> data) override;
// Signals the end of the probe. Manages the clean up and returns a response
// to the caller.
@@ -190,7 +190,7 @@
void UdpProberImpl::OnConnectComplete(
int result,
- const base::Optional<net::IPEndPoint>& local_addr_out) {
+ const absl::optional<net::IPEndPoint>& local_addr_out) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (result != net::OK) {
OnDone(result, ProbeExitEnum::kConnectFailure);
@@ -213,8 +213,8 @@
}
void UdpProberImpl::OnReceived(int32_t result,
- const base::Optional<net::IPEndPoint>& src_ip,
- base::Optional<base::span<const uint8_t>> data) {
+ const absl::optional<net::IPEndPoint>& src_ip,
+ absl::optional<base::span<const uint8_t>> data) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (result != net::OK) {
diff --git a/chrome/browser/chromeos/net/network_diagnostics/udp_prober_unittest.cc b/chrome/browser/chromeos/net/network_diagnostics/udp_prober_unittest.cc
index b35a849..33d8f05 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/udp_prober_unittest.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/udp_prober_unittest.cc
@@ -49,10 +49,10 @@
void InitializeProberNetworkContext(
std::unique_ptr<FakeHostResolver::DnsResult> fake_dns_result,
- base::Optional<net::Error> udp_connect_complete_code,
- base::Optional<net::Error> udp_send_complete_code,
- base::Optional<net::Error> udp_on_received_code,
- base::Optional<base::span<const uint8_t>> udp_on_received_data) {
+ absl::optional<net::Error> udp_connect_complete_code,
+ absl::optional<net::Error> udp_send_complete_code,
+ absl::optional<net::Error> udp_on_received_code,
+ absl::optional<base::span<const uint8_t>> udp_on_received_data) {
fake_network_context_ = std::make_unique<FakeNetworkContext>();
fake_network_context_->set_fake_dns_result(std::move(fake_dns_result));
if (udp_connect_complete_code.has_value()) {
@@ -71,9 +71,9 @@
}
}
- void SetUdpDelays(base::Optional<base::TimeDelta> connection_delay,
- base::Optional<base::TimeDelta> send_delay,
- base::Optional<base::TimeDelta> receive_delay) {
+ void SetUdpDelays(absl::optional<base::TimeDelta> connection_delay,
+ absl::optional<base::TimeDelta> send_delay,
+ absl::optional<base::TimeDelta> receive_delay) {
fake_network_context_->SetTaskEnvironmentForTesting(&task_environment_);
if (connection_delay.has_value()) {
fake_network_context_->SetUdpConnectionDelay(connection_delay.value());
@@ -159,10 +159,10 @@
net::ResolveErrorInfo(net::ERR_NAME_NOT_RESOLVED), net::AddressList());
// UDP connect and subsequent steps will not happen in this scenario.
InitializeProberNetworkContext(std::move(fake_dns_result),
- /*udp_connect_code=*/base::nullopt,
- /*udp_send_complete_code=*/base::nullopt,
- /*udp_on_received_code=*/base::nullopt,
- /*udp_on_received_data=*/base::nullopt);
+ /*udp_connect_code=*/absl::nullopt,
+ /*udp_send_complete_code=*/absl::nullopt,
+ /*udp_on_received_code=*/absl::nullopt,
+ /*udp_on_received_data=*/absl::nullopt);
RunProberExpectingResult(net::ERR_NAME_NOT_RESOLVED,
ProbeExitEnum::kDnsFailure);
}
@@ -170,10 +170,10 @@
TEST_F(UdpProberWithFakeNetworkContextTest, MojoDisconnectDnsLookup) {
// UDP connect and subsequent steps will not happen in this scenario.
InitializeProberNetworkContext(/*fake_dns_result=*/{},
- /*udp_connect_code=*/base::nullopt,
- /*udp_send_code=*/base::nullopt,
- /*udp_on_received_code=*/base::nullopt,
- /*udp_on_received_data=*/base::nullopt);
+ /*udp_connect_code=*/absl::nullopt,
+ /*udp_send_code=*/absl::nullopt,
+ /*udp_on_received_code=*/absl::nullopt,
+ /*udp_on_received_data=*/absl::nullopt);
fake_network_context()->set_disconnect_during_host_resolution(true);
RunProberExpectingResult(net::ERR_NAME_NOT_RESOLVED,
ProbeExitEnum::kDnsFailure);
@@ -186,12 +186,12 @@
InitializeProberNetworkContext(
std::move(fake_dns_result),
/*udp_connect_code=*/net::ERR_CONNECTION_FAILED,
- /*udp_send_code=*/base::nullopt,
- /*udp_on_received_code=*/base::nullopt,
- /*udp_on_received_data=*/base::nullopt);
+ /*udp_send_code=*/absl::nullopt,
+ /*udp_on_received_code=*/absl::nullopt,
+ /*udp_on_received_data=*/absl::nullopt);
SetUdpDelays(/*connection_delay=*/base::TimeDelta::FromSeconds(1),
- /*send_delay=*/base::nullopt,
- /*receive_delay=*/base::nullopt);
+ /*send_delay=*/absl::nullopt,
+ /*receive_delay=*/absl::nullopt);
RunProberExpectingResult(net::ERR_CONNECTION_FAILED,
ProbeExitEnum::kConnectFailure);
}
@@ -202,12 +202,12 @@
net::AddressList(kFakeIPAddress));
InitializeProberNetworkContext(std::move(fake_dns_result),
/*udp_connect_code=*/net::OK,
- /*udp_send_code=*/base::nullopt,
- /*udp_on_received_code=*/base::nullopt,
- /*udp_on_received_data=*/base::nullopt);
+ /*udp_send_code=*/absl::nullopt,
+ /*udp_on_received_code=*/absl::nullopt,
+ /*udp_on_received_data=*/absl::nullopt);
SetUdpDelays(/*connection_delay=*/base::TimeDelta::FromSeconds(1),
- /*send_delay=*/base::nullopt,
- /*receive_delay=*/base::nullopt);
+ /*send_delay=*/absl::nullopt,
+ /*receive_delay=*/absl::nullopt);
fake_network_context()->set_disconnect_during_udp_connection_attempt(true);
RunProberExpectingResult(net::ERR_FAILED,
ProbeExitEnum::kMojoDisconnectFailure);
@@ -220,11 +220,11 @@
InitializeProberNetworkContext(std::move(fake_dns_result),
/*udp_connect_code=*/net::OK,
/*udp_send_code=*/net::ERR_CONNECTION_FAILED,
- /*udp_on_received_code=*/base::nullopt,
- /*udp_on_received_data=*/base::nullopt);
+ /*udp_on_received_code=*/absl::nullopt,
+ /*udp_on_received_data=*/absl::nullopt);
SetUdpDelays(/*connection_delay=*/base::TimeDelta::FromSeconds(1),
/*send_delay=*/base::TimeDelta::FromSeconds(1),
- /*receive_delay=*/base::nullopt);
+ /*receive_delay=*/absl::nullopt);
RunProberExpectingResult(net::ERR_CONNECTION_FAILED,
ProbeExitEnum::kSendFailure);
}
@@ -235,12 +235,12 @@
net::AddressList(kFakeIPAddress));
net::Error udp_connect_code = net::OK;
InitializeProberNetworkContext(std::move(fake_dns_result), udp_connect_code,
- /*udp_send_code=*/base::nullopt,
- /*udp_on_received_code=*/base::nullopt,
- /*udp_on_received_data=*/base::nullopt);
+ /*udp_send_code=*/absl::nullopt,
+ /*udp_on_received_code=*/absl::nullopt,
+ /*udp_on_received_data=*/absl::nullopt);
SetUdpDelays(/*connection_delay=*/base::TimeDelta::FromSeconds(1),
/*send_delay=*/base::TimeDelta::FromSeconds(1),
- /*receive_delay=*/base::nullopt);
+ /*receive_delay=*/absl::nullopt);
fake_network_context()->SetDisconnectDuringUdpSendAttempt(true);
RunProberExpectingResult(net::ERR_FAILED,
ProbeExitEnum::kMojoDisconnectFailure);
@@ -255,7 +255,7 @@
/*udp_connect_code=*/net::OK,
/*udp_send_code=*/net::OK,
/*udp_on_received_code=*/net::ERR_CONNECTION_FAILED,
- /*udp_on_received_data=*/base::nullopt);
+ /*udp_on_received_data=*/absl::nullopt);
SetUdpDelays(/*connection_delay=*/base::TimeDelta::FromSeconds(1),
/*send_delay=*/base::TimeDelta::FromSeconds(1),
/*receive_delay=*/base::TimeDelta::FromSeconds(1));
@@ -302,12 +302,12 @@
net::AddressList(kFakeIPAddress));
InitializeProberNetworkContext(std::move(fake_dns_result),
/*udp_connect_code=*/net::OK,
- /*udp_send_complete_code=*/base::nullopt,
- /*udp_on_received_code=*/base::nullopt,
+ /*udp_send_complete_code=*/absl::nullopt,
+ /*udp_on_received_code=*/absl::nullopt,
/*udp_on_received_data=*/{});
SetUdpDelays(/*connection_delay=*/base::TimeDelta::FromSeconds(15),
- /*send_delay=*/base::nullopt,
- /*receive_delay=*/base::nullopt);
+ /*send_delay=*/absl::nullopt,
+ /*receive_delay=*/absl::nullopt);
RunProberExpectingResult(net::ERR_TIMED_OUT, ProbeExitEnum::kTimeout);
}
@@ -318,11 +318,11 @@
InitializeProberNetworkContext(std::move(fake_dns_result),
/*udp_connect_code=*/net::OK,
/*udp_send_complete_code=*/net::OK,
- /*udp_on_received_code=*/base::nullopt,
+ /*udp_on_received_code=*/absl::nullopt,
/*udp_on_received_data=*/{});
SetUdpDelays(/*connection_delay=*/base::TimeDelta::FromSeconds(1),
/*send_delay=*/base::TimeDelta::FromSeconds(15),
- /*receive_delay=*/base::nullopt);
+ /*receive_delay=*/absl::nullopt);
RunProberExpectingResult(net::ERR_TIMED_OUT, ProbeExitEnum::kTimeout);
}
diff --git a/chrome/browser/chromeos/net/network_diagnostics/video_conferencing_routine.cc b/chrome/browser/chromeos/net/network_diagnostics/video_conferencing_routine.cc
index d772e11e..5b271b33 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/video_conferencing_routine.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/video_conferencing_routine.cc
@@ -8,7 +8,6 @@
#include <utility>
#include "base/logging.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/net/network_diagnostics/network_diagnostics_util.h"
#include "chrome/browser/chromeos/net/network_diagnostics/udp_prober.h"
@@ -16,6 +15,7 @@
#include "content/public/browser/storage_partition.h"
#include "net/base/net_errors.h"
#include "services/network/public/mojom/network_context.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
@@ -54,7 +54,7 @@
VideoConferencingRoutine::~VideoConferencingRoutine() = default;
void VideoConferencingRoutine::AnalyzeResultsAndExecuteCallback() {
- base::Optional<std::string> support_details = kSupportDetails;
+ absl::optional<std::string> support_details = kSupportDetails;
set_verdict(mojom::RoutineVerdict::kProblem);
if (!open_udp_port_found_) {
problems_.push_back(mojom::VideoConferencingProblem::kUdpFailure);
@@ -67,7 +67,7 @@
}
if (problems_.empty()) {
set_verdict(mojom::RoutineVerdict::kNoProblem);
- support_details = base::nullopt;
+ support_details = absl::nullopt;
}
std::move(routine_completed_callback_)
.Run(verdict(), std::move(problems_), support_details);
@@ -76,7 +76,7 @@
void VideoConferencingRoutine::RunRoutine(
VideoConferencingRoutineCallback callback) {
if (!CanRun()) {
- std::move(callback).Run(verdict(), std::move(problems_), base::nullopt);
+ std::move(callback).Run(verdict(), std::move(problems_), absl::nullopt);
return;
}
routine_completed_callback_ = std::move(callback);
diff --git a/chrome/browser/chromeos/net/network_diagnostics/video_conferencing_routine_unittest.cc b/chrome/browser/chromeos/net/network_diagnostics/video_conferencing_routine_unittest.cc
index bc09d5e..8c723f78 100644
--- a/chrome/browser/chromeos/net/network_diagnostics/video_conferencing_routine_unittest.cc
+++ b/chrome/browser/chromeos/net/network_diagnostics/video_conferencing_routine_unittest.cc
@@ -9,7 +9,6 @@
#include <string>
#include <utility>
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/net/network_diagnostics/network_diagnostics_util.h"
@@ -19,6 +18,7 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace network_diagnostics {
@@ -109,10 +109,10 @@
void CompareVerdict(
mojom::RoutineVerdict expected_verdict,
const std::vector<mojom::VideoConferencingProblem>& expected_problems,
- const base::Optional<std::string>& expected_support_details,
+ const absl::optional<std::string>& expected_support_details,
mojom::RoutineVerdict actual_verdict,
const std::vector<mojom::VideoConferencingProblem>& actual_problems,
- const base::Optional<std::string>& actual_support_details) {
+ const absl::optional<std::string>& actual_support_details) {
EXPECT_EQ(expected_verdict, actual_verdict);
EXPECT_EQ(expected_problems, actual_problems);
EXPECT_EQ(expected_support_details.has_value(),
@@ -159,7 +159,7 @@
void RunRoutine(
mojom::RoutineVerdict expected_routine_verdict,
const std::vector<mojom::VideoConferencingProblem>& expected_problems,
- const base::Optional<std::string>& expected_support_details) {
+ const absl::optional<std::string>& expected_support_details) {
video_conferencing_routine_->RunRoutine(base::BindOnce(
&VideoConferencingRoutineTest::CompareVerdict, weak_ptr(),
expected_routine_verdict, expected_problems, expected_support_details));
@@ -195,7 +195,7 @@
std::deque<TlsProberReturnValue> fake_tls_probe_results,
mojom::RoutineVerdict expected_routine_verdict,
const std::vector<mojom::VideoConferencingProblem>& expected_problems,
- const base::Optional<std::string>& expected_support_details) {
+ const absl::optional<std::string>& expected_support_details) {
SetUpRoutine(std::move(fake_udp_probe_results),
std::move(fake_tls_probe_results));
RunRoutine(expected_routine_verdict, expected_problems,
@@ -258,7 +258,7 @@
SetUpAndRunRoutine(
std::move(fake_udp_probe_results), std::move(fake_tls_probe_results),
mojom::RoutineVerdict::kNoProblem,
- /*expected_problems=*/{}, /*expected_support_problems=*/base::nullopt);
+ /*expected_problems=*/{}, /*expected_support_problems=*/absl::nullopt);
}
// Tests the scenario where:
diff --git a/chrome/browser/chromeos/net/network_portal_detector_impl_browsertest.cc b/chrome/browser/chromeos/net/network_portal_detector_impl_browsertest.cc
index 89d2a44..647288d 100644
--- a/chrome/browser/chromeos/net/network_portal_detector_impl_browsertest.cc
+++ b/chrome/browser/chromeos/net/network_portal_detector_impl_browsertest.cc
@@ -223,7 +223,7 @@
display_service_->GetNotification(kNotificationId)
->delegate()
- ->Click(base::nullopt, base::nullopt);
+ ->Click(absl::nullopt, absl::nullopt);
content::RunAllPendingInMessageLoop();
diff --git a/chrome/browser/chromeos/net/system_proxy_manager.cc b/chrome/browser/chromeos/net/system_proxy_manager.cc
index 1a2f95a..b93136d3 100644
--- a/chrome/browser/chromeos/net/system_proxy_manager.cc
+++ b/chrome/browser/chromeos/net/system_proxy_manager.cc
@@ -78,7 +78,7 @@
const std::string& password,
LoginAuthRequiredCallback auth_required_callback) {
std::move(auth_required_callback)
- .Run(base::make_optional<net::AuthCredentials>(
+ .Run(absl::make_optional<net::AuthCredentials>(
base::UTF8ToUTF16(username), base::UTF8ToUTF16(password)));
}
@@ -649,7 +649,7 @@
void SystemProxyManager::LookupProxyAuthCredentialsCallback(
const system_proxy::ProtectionSpace& protection_space,
- const base::Optional<net::AuthCredentials>& credentials) {
+ const absl::optional<net::AuthCredentials>& credentials) {
if (!credentials) {
// Ask the user for credentials
ShowAuthenticationNotification(protection_space, /*show_error=*/false);
diff --git a/chrome/browser/chromeos/net/system_proxy_manager.h b/chrome/browser/chromeos/net/system_proxy_manager.h
index fc2d181..a6aaea19 100644
--- a/chrome/browser/chromeos/net/system_proxy_manager.h
+++ b/chrome/browser/chromeos/net/system_proxy_manager.h
@@ -12,13 +12,13 @@
#include "base/callback_forward.h"
#include "base/gtest_prod_util.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/extensions/api/settings_private/prefs_util.h"
#include "chromeos/dbus/system_proxy/system_proxy_service.pb.h"
#include "chromeos/network/network_state_handler_observer.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/content_browser_client.h"
#include "net/base/auth.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace ash {
@@ -223,7 +223,7 @@
// available.
void LookupProxyAuthCredentialsCallback(
const system_proxy::ProtectionSpace& protection_space,
- const base::Optional<net::AuthCredentials>& credentials);
+ const absl::optional<net::AuthCredentials>& credentials);
void ShowAuthenticationNotification(
const system_proxy::ProtectionSpace& protection_space,
diff --git a/chrome/browser/chromeos/net/system_proxy_manager_browsertest.cc b/chrome/browser/chromeos/net/system_proxy_manager_browsertest.cc
index 3e98d68..43ebb5c 100644
--- a/chrome/browser/chromeos/net/system_proxy_manager_browsertest.cc
+++ b/chrome/browser/chromeos/net/system_proxy_manager_browsertest.cc
@@ -237,7 +237,7 @@
display_service_tester_->SimulateClick(
NotificationHandler::Type::TRANSIENT, kSystemProxyNotificationId,
- /*action_index=*/base::nullopt, /*reply=*/base::nullopt);
+ /*action_index=*/absl::nullopt, /*reply=*/absl::nullopt);
// Dialog is created.
ASSERT_TRUE(dialog());
@@ -281,7 +281,7 @@
display_service_tester_->SimulateClick(
NotificationHandler::Type::TRANSIENT, kSystemProxyNotificationId,
- /*action_index=*/base::nullopt, /*reply=*/base::nullopt);
+ /*action_index=*/absl::nullopt, /*reply=*/absl::nullopt);
// Dialog is created.
ASSERT_TRUE(dialog());
@@ -325,7 +325,7 @@
display_service_tester_->SimulateClick(
NotificationHandler::Type::TRANSIENT, kSystemProxyNotificationId,
- /*action_index=*/base::nullopt, /*reply=*/base::nullopt);
+ /*action_index=*/absl::nullopt, /*reply=*/absl::nullopt);
ASSERT_TRUE(dialog());
// Expect warning is shown.
@@ -709,7 +709,7 @@
base::BindOnce(
[](std::string* username, std::string* password,
base::OnceClosure closure,
- const base::Optional<net::AuthCredentials>& credentials) {
+ const absl::optional<net::AuthCredentials>& credentials) {
if (credentials) {
*username = base::UTF16ToUTF8(credentials->username());
*password = base::UTF16ToUTF8(credentials->password());
diff --git a/chrome/browser/chromeos/note_taking_helper.cc b/chrome/browser/chromeos/note_taking_helper.cc
index db9d0f94..fc370b2 100644
--- a/chrome/browser/chromeos/note_taking_helper.cc
+++ b/chrome/browser/chromeos/note_taking_helper.cc
@@ -419,7 +419,7 @@
}
void NoteTakingHelper::OnIntentFiltersUpdated(
- const base::Optional<std::string>& package_name) {
+ const absl::optional<std::string>& package_name) {
if (play_store_enabled_)
UpdateAndroidApps();
}
diff --git a/chrome/browser/chromeos/note_taking_helper.h b/chrome/browser/chromeos/note_taking_helper.h
index 1f959b6..7296e6b 100644
--- a/chrome/browser/chromeos/note_taking_helper.h
+++ b/chrome/browser/chromeos/note_taking_helper.h
@@ -13,7 +13,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_multi_source_observation.h"
#include "chrome/browser/ash/arc/session/arc_session_manager_observer.h"
#include "chrome/browser/profiles/profile_manager_observer.h"
@@ -23,6 +22,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/common/extension.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -201,7 +201,7 @@
// arc::ArcIntentHelperObserver:
void OnIntentFiltersUpdated(
- const base::Optional<std::string>& package_name) override;
+ const absl::optional<std::string>& package_name) override;
// arc::ArcSessionManagerObserver:
void OnArcPlayStoreEnabledChanged(bool enabled) override;
diff --git a/chrome/browser/chromeos/note_taking_helper_unittest.cc b/chrome/browser/chromeos/note_taking_helper_unittest.cc
index f9a970c..d66b40c 100644
--- a/chrome/browser/chromeos/note_taking_helper_unittest.cc
+++ b/chrome/browser/chromeos/note_taking_helper_unittest.cc
@@ -906,7 +906,7 @@
// After the callback to receive intent handlers has run, the "apps received"
// member should be updated (even if there aren't any apps).
- helper()->OnIntentFiltersUpdated(base::nullopt);
+ helper()->OnIntentFiltersUpdated(absl::nullopt);
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(helper()->play_store_enabled());
EXPECT_TRUE(helper()->android_apps_received());
@@ -942,7 +942,7 @@
// Notification of updated intent filters should result in the apps being
// refreshed.
- helper()->OnIntentFiltersUpdated(base::nullopt);
+ helper()->OnIntentFiltersUpdated(absl::nullopt);
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(helper()->play_store_enabled());
EXPECT_TRUE(helper()->android_apps_received());
@@ -1036,7 +1036,7 @@
handlers.emplace_back(CreateIntentHandlerInfo("App 2", kPackage2));
intent_helper_.SetIntentHandlers(NoteTakingHelper::kIntentAction,
std::move(handlers));
- helper()->OnIntentFiltersUpdated(base::nullopt);
+ helper()->OnIntentFiltersUpdated(absl::nullopt);
base::RunLoop().RunUntilIdle();
helper()->SetPreferredApp(profile(), kPackage2);
@@ -1177,7 +1177,7 @@
// Update intent filters and check that the observer is notified again after
// apps are received.
- helper()->OnIntentFiltersUpdated(base::nullopt);
+ helper()->OnIntentFiltersUpdated(absl::nullopt);
EXPECT_EQ(3, observer.num_updates());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(4, observer.num_updates());
diff --git a/chrome/browser/chromeos/phonehub/browser_tabs_metadata_fetcher_impl.cc b/chrome/browser/chromeos/phonehub/browser_tabs_metadata_fetcher_impl.cc
index b155511..9e5ad81 100644
--- a/chrome/browser/chromeos/phonehub/browser_tabs_metadata_fetcher_impl.cc
+++ b/chrome/browser/chromeos/phonehub/browser_tabs_metadata_fetcher_impl.cc
@@ -78,10 +78,10 @@
void BrowserTabsMetadataFetcherImpl::Fetch(
const sync_sessions::SyncedSession* session,
base::OnceCallback<void(BrowserTabsMetadataResponse)> callback) {
- // A new fetch was made, return a base::nullopt to the previous |callback_|.
+ // A new fetch was made, return a absl::nullopt to the previous |callback_|.
if (!callback_.is_null()) {
weak_ptr_factory_.InvalidateWeakPtrs();
- std::move(callback_).Run(base::nullopt);
+ std::move(callback_).Run(absl::nullopt);
}
results_ = GetSortedMetadataWithoutFavicons(session);
diff --git a/chrome/browser/chromeos/phonehub/browser_tabs_metadata_fetcher_impl_unittest.cc b/chrome/browser/chromeos/phonehub/browser_tabs_metadata_fetcher_impl_unittest.cc
index 0d03a49..79f25d49 100644
--- a/chrome/browser/chromeos/phonehub/browser_tabs_metadata_fetcher_impl_unittest.cc
+++ b/chrome/browser/chromeos/phonehub/browser_tabs_metadata_fetcher_impl_unittest.cc
@@ -79,7 +79,7 @@
using BrowserTabMetadata = BrowserTabsModel::BrowserTabMetadata;
void OnBrowserTabMetadataFetched(
- base::Optional<std::vector<BrowserTabsModel::BrowserTabMetadata>>
+ absl::optional<std::vector<BrowserTabsModel::BrowserTabMetadata>>
browser_tab_metadatas) {
actual_browser_tabs_metadata_ = browser_tab_metadatas;
}
@@ -158,7 +158,7 @@
}
}
- const base::Optional<std::vector<BrowserTabsModel::BrowserTabMetadata>>&
+ const absl::optional<std::vector<BrowserTabsModel::BrowserTabMetadata>>&
actual_browser_tabs_metadata() const {
return actual_browser_tabs_metadata_;
}
@@ -167,7 +167,7 @@
testing::NiceMock<MockHistoryUiFaviconRequestHandler>
favicon_request_handler_;
BrowserTabsMetadataFetcherImpl browser_tabs_metadata_job_;
- base::Optional<std::vector<BrowserTabsModel::BrowserTabMetadata>>
+ absl::optional<std::vector<BrowserTabsModel::BrowserTabMetadata>>
actual_browser_tabs_metadata_;
std::map<SessionID, std::unique_ptr<sync_sessions::SyncedSessionWindow>>
diff --git a/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl.cc b/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl.cc
index d82d04d..db50733 100644
--- a/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl.cc
+++ b/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl.cc
@@ -37,12 +37,12 @@
multidevice_setup_client_->RemoveObserver(this);
}
-base::Optional<std::string> BrowserTabsModelProviderImpl::GetSessionName()
+absl::optional<std::string> BrowserTabsModelProviderImpl::GetSessionName()
const {
const multidevice_setup::MultiDeviceSetupClient::HostStatusWithDevice&
host_device_with_status = multidevice_setup_client_->GetHostStatus();
if (!host_device_with_status.second)
- return base::nullopt;
+ return absl::nullopt;
// The pii_free_name field of the device matches the session name for
// sync.
return host_device_with_status.second->pii_free_name();
@@ -65,7 +65,7 @@
}
void BrowserTabsModelProviderImpl::AttemptBrowserTabsModelUpdate() {
- base::Optional<std::string> session_name = GetSessionName();
+ absl::optional<std::string> session_name = GetSessionName();
sync_sessions::OpenTabsUIDelegate* open_tabs =
session_sync_service_->GetOpenTabsUIDelegate();
// Tab sync is disabled or no valid |pii_free_name_|.
@@ -119,7 +119,7 @@
}
void BrowserTabsModelProviderImpl::OnMetadataFetched(
- base::Optional<std::vector<BrowserTabsModel::BrowserTabMetadata>>
+ absl::optional<std::vector<BrowserTabsModel::BrowserTabMetadata>>
metadata) {
// The operation to fetch metadata was cancelled.
if (!metadata)
diff --git a/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl.h b/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl.h
index 1cf6457..1566665 100644
--- a/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl.h
+++ b/chrome/browser/chromeos/phonehub/browser_tabs_model_provider_impl.h
@@ -61,9 +61,9 @@
void AttemptBrowserTabsModelUpdate();
void InvalidateWeakPtrsAndClearTabMetadata(bool is_tab_sync_enabled);
void OnMetadataFetched(
- base::Optional<std::vector<BrowserTabsModel::BrowserTabMetadata>>
+ absl::optional<std::vector<BrowserTabsModel::BrowserTabMetadata>>
metadata);
- base::Optional<std::string> GetSessionName() const;
+ absl::optional<std::string> GetSessionName() const;
multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client_;
syncer::SyncService* sync_service_;
diff --git a/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.cc b/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.cc
index d3ed6d3..f4a9216 100644
--- a/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.cc
+++ b/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.cc
@@ -14,7 +14,6 @@
#include "base/containers/contains.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/ash/crosapi/crosapi_ash.h"
@@ -39,6 +38,7 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/cert/x509_certificate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using content::BrowserThread;
using crosapi::mojom::KeystoreBinaryResult;
@@ -188,7 +188,7 @@
void OnKeyRegisteredForCorporateUsage(platform_keys::Status status) {
if (status == platform_keys::Status::kSuccess) {
- std::move(callback_).Run(public_key_spki_der_, /*error=*/base::nullopt);
+ std::move(callback_).Run(public_key_spki_der_, /*error=*/absl::nullopt);
DoStep();
return;
}
@@ -324,7 +324,7 @@
// multiple times, also updates the permission to prevent any future signing
// operation of that extension using that same key. If an error occurs, an
// error status is passed to |callback|.
- SignTask(base::Optional<platform_keys::TokenId> token_id,
+ SignTask(absl::optional<platform_keys::TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
platform_keys::KeyType key_type,
@@ -475,7 +475,7 @@
Step next_step_ = Step::GET_EXTENSION_PERMISSIONS;
- base::Optional<platform_keys::TokenId> token_id_;
+ absl::optional<platform_keys::TokenId> token_id_;
const std::string data_;
const std::string public_key_spki_der_;
@@ -847,7 +847,7 @@
}
void ExtensionPlatformKeysService::SignDigest(
- base::Optional<platform_keys::TokenId> token_id,
+ absl::optional<platform_keys::TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
platform_keys::KeyType key_type,
@@ -861,7 +861,7 @@
}
void ExtensionPlatformKeysService::SignRSAPKCS1Raw(
- base::Optional<platform_keys::TokenId> token_id,
+ absl::optional<platform_keys::TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
const std::string& extension_id,
diff --git a/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.h b/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.h
index 5ade6660..3238dfde5 100644
--- a/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.h
+++ b/chrome/browser/chromeos/platform_keys/extension_platform_keys_service.h
@@ -80,7 +80,7 @@
// failed, |public_key_spki_der| will be empty.
using GenerateKeyCallback = base::OnceCallback<void(
const std::string& public_key_spki_der,
- base::Optional<crosapi::mojom::KeystoreError> error)>;
+ absl::optional<crosapi::mojom::KeystoreError> error)>;
// Generates an RSA key pair with |modulus_length_bits| and registers the key
// to allow a single sign operation by the given extension. |token_id|
@@ -126,7 +126,7 @@
// future signing attempts. If signing was successful, |callback| will be
// invoked with the signature. If it failed, the resulting signature will be
// empty. Will only call back during the lifetime of this object.
- void SignDigest(base::Optional<platform_keys::TokenId> token_id,
+ void SignDigest(absl::optional<platform_keys::TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
platform_keys::KeyType key_type,
@@ -146,7 +146,7 @@
// future signing attempts. If signing was successful, |callback| will be
// invoked with the signature. If it failed, the resulting signature will be
// empty. Will only call back during the lifetime of this object.
- void SignRSAPKCS1Raw(base::Optional<platform_keys::TokenId> token_id,
+ void SignRSAPKCS1Raw(absl::optional<platform_keys::TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
const std::string& extension_id,
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/extension_key_permissions_service.cc b/chrome/browser/chromeos/platform_keys/key_permissions/extension_key_permissions_service.cc
index b1b4d4d..236a5e5 100644
--- a/chrome/browser/chromeos/platform_keys/key_permissions/extension_key_permissions_service.cc
+++ b/chrome/browser/chromeos/platform_keys/key_permissions/extension_key_permissions_service.cc
@@ -12,7 +12,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys.h"
@@ -21,6 +20,7 @@
#include "components/policy/core/common/policy_service.h"
#include "components/policy/policy_constants.h"
#include "extensions/browser/state_store.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace platform_keys {
@@ -159,7 +159,7 @@
void ExtensionKeyPermissionsService::CanUseKeyForSigningWithFlags(
CanUseKeyForSigningCallback callback,
bool sign_unlimited_allowed,
- base::Optional<bool> is_corporate_key,
+ absl::optional<bool> is_corporate_key,
Status is_corporate_key_status) {
if (is_corporate_key_status != Status::kSuccess) {
LOG(ERROR) << "Failed to check if the key is corporate: "
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/extension_key_permissions_service.h b/chrome/browser/chromeos/platform_keys/key_permissions/extension_key_permissions_service.h
index 641a2a5..cf0eb0a 100644
--- a/chrome/browser/chromeos/platform_keys/key_permissions/extension_key_permissions_service.h
+++ b/chrome/browser/chromeos/platform_keys/key_permissions/extension_key_permissions_service.h
@@ -195,7 +195,7 @@
void CanUseKeyForSigningWithFlags(CanUseKeyForSigningCallback callback,
bool sign_unlimited_allowed,
- base::Optional<bool> is_corporate_key,
+ absl::optional<bool> is_corporate_key,
Status is_corporate_key_status);
void SetUserGrantedPermissionWithFlag(
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager.h b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager.h
index c8a1c00d..28a6276 100644
--- a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager.h
+++ b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager.h
@@ -8,8 +8,8 @@
#include <string>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace platform_keys {
@@ -26,7 +26,7 @@
// has occurred, an error |status| will be returned and |allowed| will be
// nullopt.
using IsKeyAllowedForUsageCallback =
- base::OnceCallback<void(base::Optional<bool> allowed, Status status)>;
+ base::OnceCallback<void(absl::optional<bool> allowed, Status status)>;
// ** KeyPermissionsManager (KPM) instances **
// Every KPM instance is responsible for managing key permissions of keys
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_browsertest.cc b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_browsertest.cc
index 6b19839..25612b8 100644
--- a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_browsertest.cc
+++ b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_browsertest.cc
@@ -10,7 +10,6 @@
#include <utility>
#include <vector>
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/ash/login/test/device_state_mixin.h"
#include "chrome/browser/ash/login/test/login_manager_mixin.h"
@@ -33,6 +32,7 @@
#include "content/public/test/browser_test.h"
#include "content/public/test/test_launcher.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace platform_keys {
@@ -54,7 +54,7 @@
// Supports waiting for the result of KeyPermissionsService::AllowKeyForUsage.
class IsKeyAllowedForUsageExecutionWaiter
- : public test_util::ExecutionWaiter<base::Optional<bool>> {
+ : public test_util::ExecutionWaiter<absl::optional<bool>> {
public:
IsKeyAllowedForUsageExecutionWaiter() = default;
IsKeyAllowedForUsageExecutionWaiter(
@@ -63,7 +63,7 @@
const IsKeyAllowedForUsageExecutionWaiter& other) = delete;
~IsKeyAllowedForUsageExecutionWaiter() = default;
- base::Optional<bool> allowed() const {
+ absl::optional<bool> allowed() const {
return std::get<0>(result_callback_args());
}
};
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_impl.cc b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_impl.cc
index 8044533..48e20dac 100644
--- a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_impl.cc
+++ b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_impl.cc
@@ -14,7 +14,6 @@
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chrome/browser/browser_process.h"
@@ -34,6 +33,7 @@
#include "components/policy/policy_constants.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -210,7 +210,7 @@
void KeyPermissionsManagerImpl::KeyPermissionsInChapsUpdater::
UpdatePermissionsForKeyWithCorporateFlag(
const std::string& public_key_spki_der,
- base::Optional<bool> corporate_usage_allowed,
+ absl::optional<bool> corporate_usage_allowed,
Status corporate_usage_retrieval_status) {
if (corporate_usage_retrieval_status != Status::kSuccess) {
LOG(ERROR) << "Couldn't retrieve corporate usage flag for a key.";
@@ -426,7 +426,7 @@
void KeyPermissionsManagerImpl::IsKeyAllowedForUsageWithPermissions(
IsKeyAllowedForUsageCallback callback,
KeyUsage usage,
- const base::Optional<std::string>& serialized_key_permissions,
+ const absl::optional<std::string>& serialized_key_permissions,
Status key_attribute_retrieval_status) {
if (key_attribute_retrieval_status != Status::kSuccess) {
LOG(ERROR) << "Error while retrieving key permissions: "
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_impl.h b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_impl.h
index 6c352e3..4aee23f3b85 100644
--- a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_impl.h
+++ b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_impl.h
@@ -13,12 +13,12 @@
#include "base/containers/queue.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/platform_keys/key_permissions/arc_key_permissions_manager_delegate.h"
#include "chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefRegistrySimple;
class PrefService;
@@ -73,7 +73,7 @@
void UpdatePermissionsForKey(const std::string& public_key_spki_der);
void UpdatePermissionsForKeyWithCorporateFlag(
const std::string& public_key_spki_der,
- base::Optional<bool> corporate_usage_allowed,
+ absl::optional<bool> corporate_usage_allowed,
Status corporate_usage_retrieval_status);
void OnKeyPermissionsUpdated(Status permissions_update_status);
@@ -174,13 +174,13 @@
void OnKeyPermissionsRetrieved(
IsKeyAllowedForUsageCallback callback,
- const base::Optional<std::string>& attribute_value,
+ const absl::optional<std::string>& attribute_value,
Status status);
void IsKeyAllowedForUsageWithPermissions(
IsKeyAllowedForUsageCallback callback,
KeyUsage usage,
- const base::Optional<std::string>& serialized_key_permissions,
+ const absl::optional<std::string>& serialized_key_permissions,
Status key_attribute_retrieval_status);
// Called when the token is ready and the one-time migration is done.
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service.h b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service.h
index 4101bc2..2cb7c4a 100644
--- a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service.h
+++ b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service.h
@@ -10,9 +10,9 @@
#include <vector>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace platform_keys {
@@ -22,7 +22,7 @@
// If an error occurs, |corporate| will be a nullopt.
using IsCorporateKeyCallback =
- base::OnceCallback<void(base::Optional<bool> corporate, Status status)>;
+ base::OnceCallback<void(absl::optional<bool> corporate, Status status)>;
using SetCorporateKeyCallback = base::OnceCallback<void(Status status)>;
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.cc b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.cc
index fe2e7c7..d3729b1 100644
--- a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.cc
+++ b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.cc
@@ -15,7 +15,6 @@
#include "base/callback.h"
#include "base/callback_forward.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/values.h"
#include "chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_impl.h"
@@ -28,6 +27,7 @@
#include "components/policy/policy_constants.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace platform_keys {
@@ -92,7 +92,7 @@
const std::string& public_key_spki_der,
CanUserGrantPermissionForKeyCallback callback,
const std::vector<TokenId>& key_locations,
- base::Optional<bool> corporate_key,
+ absl::optional<bool> corporate_key,
Status status) {
if (status != Status::kSuccess) {
std::move(callback).Run(/*allowed=*/false);
@@ -128,7 +128,7 @@
Status status) {
if (status != Status::kSuccess) {
LOG(ERROR) << "Key locations retrieval failed: " << StatusToString(status);
- std::move(callback).Run(/*corporate=*/base::nullopt, status);
+ std::move(callback).Run(/*corporate=*/absl::nullopt, status);
return;
}
@@ -164,7 +164,7 @@
void KeyPermissionsServiceImpl::IsCorporateKeyWithKpmResponse(
IsCorporateKeyCallback callback,
- base::Optional<bool> allowed,
+ absl::optional<bool> allowed,
Status status) {
if (allowed.has_value()) {
std::move(callback).Run(allowed.value(), Status::kSuccess);
@@ -173,7 +173,7 @@
LOG(ERROR) << "Checking corporate flag via KeyPermissionsManager failed: "
<< StatusToString(status);
- std::move(callback).Run(/*corporate=*/base::nullopt, status);
+ std::move(callback).Run(/*corporate=*/absl::nullopt, status);
}
void KeyPermissionsServiceImpl::SetCorporateKey(
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.h b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.h
index 6cc1ce9..fc63255 100644
--- a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.h
+++ b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl.h
@@ -68,7 +68,7 @@
const std::string& public_key_spki_der,
CanUserGrantPermissionForKeyCallback callback,
const std::vector<TokenId>& key_locations,
- base::Optional<bool> corporate_key,
+ absl::optional<bool> corporate_key,
Status status);
void IsCorporateKeyWithLocations(const std::string& public_key_spki_der,
@@ -76,7 +76,7 @@
const std::vector<TokenId>& key_locations,
Status key_locations_retrieval_status);
void IsCorporateKeyWithKpmResponse(IsCorporateKeyCallback callback,
- base::Optional<bool> allowed,
+ absl::optional<bool> allowed,
Status status);
void SetCorporateKeyWithLocations(const std::string& public_key_spki_der,
diff --git a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl_unittest.cc b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl_unittest.cc
index 9fa1973..0bba2d0 100644
--- a/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl_unittest.cc
+++ b/chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_service_impl_unittest.cc
@@ -8,7 +8,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/test/gmock_callback_support.h"
#include "chrome/browser/chromeos/platform_keys/key_permissions/key_permissions_manager_impl.h"
#include "chrome/browser/chromeos/platform_keys/key_permissions/mock_key_permissions_manager.h"
@@ -19,6 +18,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using ::testing::_;
@@ -77,7 +77,7 @@
// Supports waiting for the result of KeyPermissionsService::IsCorporateKey.
class IsCorporateKeyExecutionWaiter
- : public ExecutionWaiter<base::Optional<bool>, Status> {
+ : public ExecutionWaiter<absl::optional<bool>, Status> {
public:
IsCorporateKeyExecutionWaiter() = default;
~IsCorporateKeyExecutionWaiter() = default;
diff --git a/chrome/browser/chromeos/platform_keys/mock_platform_keys_service.h b/chrome/browser/chromeos/platform_keys/mock_platform_keys_service.h
index f9b1ba6e..560e51b 100644
--- a/chrome/browser/chromeos/platform_keys/mock_platform_keys_service.h
+++ b/chrome/browser/chromeos/platform_keys/mock_platform_keys_service.h
@@ -51,7 +51,7 @@
MOCK_METHOD(void,
SignRSAPKCS1Digest,
- (base::Optional<TokenId> token_id,
+ (absl::optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
@@ -60,7 +60,7 @@
MOCK_METHOD(void,
SignRSAPKCS1Raw,
- (base::Optional<TokenId> token_id,
+ (absl::optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
SignCallback callback),
@@ -68,7 +68,7 @@
MOCK_METHOD(void,
SignECDSADigest,
- (base::Optional<TokenId> token_id,
+ (absl::optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_service.h b/chrome/browser/chromeos/platform_keys/platform_keys_service.h
index 45e354e..8f11d97 100644
--- a/chrome/browser/chromeos/platform_keys/platform_keys_service.h
+++ b/chrome/browser/chromeos/platform_keys/platform_keys_service.h
@@ -16,10 +16,10 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys.h"
#include "components/keyed_service/core/keyed_service.h"
#include "net/cert/x509_certificate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace net {
class NSSCertDatabase;
@@ -87,14 +87,14 @@
// If the attribute value has been successfully retrieved, |attribute_value|
// will contain the result. If an error occurs, |attribute_value| will be empty.
using GetAttributeForKeyCallback =
- base::OnceCallback<void(const base::Optional<std::string>& attribute_value,
+ base::OnceCallback<void(const absl::optional<std::string>& attribute_value,
Status status)>;
// If the availability of the key on the provided token has been successfully
// determined, |on_token| will contain the result. If an error occurs,
// |on_token| will be empty and an error |status| will be returned.
using IsKeyOnTokenCallback =
- base::OnceCallback<void(base::Optional<bool> on_token, Status status)>;
+ base::OnceCallback<void(absl::optional<bool> on_token, Status status)>;
// An observer that gets notified when the PlatformKeysService is being shut
// down.
@@ -149,7 +149,7 @@
// that |token_id| (or in none of the available tokens if |token_id| is not
// specified), the operation aborts. |callback| will be invoked with the
// signature or an error status.
- virtual void SignRSAPKCS1Digest(base::Optional<TokenId> token_id,
+ virtual void SignRSAPKCS1Digest(absl::optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
@@ -162,7 +162,7 @@
// The size of |data| (number of octets) must be smaller than k - 11, where k
// is the key size in octets. |callback| will be invoked with the signature or
// an error status.
- virtual void SignRSAPKCS1Raw(base::Optional<TokenId> token_id,
+ virtual void SignRSAPKCS1Raw(absl::optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
SignCallback callback) = 0;
@@ -172,7 +172,7 @@
// none of the available tokens if |token_id| is not specified), the operation
// aborts. |callback| will be invoked with the ECDSA signature or an error
// status.
- virtual void SignECDSADigest(base::Optional<TokenId> token_id,
+ virtual void SignECDSADigest(absl::optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
@@ -252,7 +252,7 @@
// |public_key_spki_der| only if the key is in |token_id|. |callback| will be
// invoked on the UI thread when getting the attribute is done, possibly with
// an error message. In case no value was set for |attribute_type|, an error
- // |status| and base::nullopt |attribute_value| will be returned.
+ // |status| and absl::nullopt |attribute_value| will be returned.
virtual void GetAttributeForKey(TokenId token_id,
const std::string& public_key_spki_der,
KeyAttributeType attribute_type,
@@ -260,7 +260,7 @@
// Determines if |public_key_spki_der| resides on |token_id|. |callback| will
// be invoked on the UI thread with the result. If an error occurred, an error
- // |status| will be returned and base::nullopt |on_token| will be returned.
+ // |status| will be returned and absl::nullopt |on_token| will be returned.
virtual void IsKeyOnToken(TokenId token_id,
const std::string& public_key_spki_der,
IsKeyOnTokenCallback callback) = 0;
@@ -332,16 +332,16 @@
void GenerateECKey(TokenId token_id,
const std::string& named_curve,
GenerateKeyCallback callback) override;
- void SignRSAPKCS1Digest(base::Optional<TokenId> token_id,
+ void SignRSAPKCS1Digest(absl::optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
SignCallback callback) override;
- void SignRSAPKCS1Raw(base::Optional<TokenId> token_id,
+ void SignRSAPKCS1Raw(absl::optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
SignCallback callback) override;
- void SignECDSADigest(base::Optional<TokenId> token_id,
+ void SignECDSADigest(absl::optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_service_browsertest.cc b/chrome/browser/chromeos/platform_keys/platform_keys_service_browsertest.cc
index b75d822..dd4b108c 100644
--- a/chrome/browser/chromeos/platform_keys/platform_keys_service_browsertest.cc
+++ b/chrome/browser/chromeos/platform_keys/platform_keys_service_browsertest.cc
@@ -14,7 +14,6 @@
#include "base/containers/span.h"
#include "base/location.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/strings/strcat.h"
@@ -58,6 +57,7 @@
#include "net/test/test_data_directory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/constants/pkcs11_custom_attributes.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc b/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc
index c762e22..3259effc 100644
--- a/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc
+++ b/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc
@@ -26,7 +26,6 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_piece.h"
#include "base/task/thread_pool.h"
@@ -52,6 +51,7 @@
#include "net/cert/x509_util_nss.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/third_party/mozilla_security_manager/nsNSSCertificateDB.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/boringssl/src/include/openssl/bn.h"
#include "third_party/boringssl/src/include/openssl/bytestring.h"
#include "third_party/boringssl/src/include/openssl/ec_key.h"
@@ -114,7 +114,7 @@
base::OnceCallback<void(net::NSSCertDatabase* cert_db)>;
// Called on the UI thread with certificate database.
-void DidGetCertDbOnUiThread(base::Optional<TokenId> token_id,
+void DidGetCertDbOnUiThread(absl::optional<TokenId> token_id,
GetCertDBCallback callback,
NSSOperationState* state,
net::NSSCertDatabase* cert_db) {
@@ -152,7 +152,7 @@
// Asynchronously fetches the NSSCertDatabase using |delegate| and, if
// |token_id| is not empty, the slot for |token_id|. Stores the slot in |state|
// and passes the database to |callback|. Will run |callback| on the IO thread.
-void GetCertDatabase(base::Optional<TokenId> token_id,
+void GetCertDatabase(absl::optional<TokenId> token_id,
GetCertDBCallback callback,
PlatformKeysServiceImplDelegate* delegate,
NSSOperationState* state) {
@@ -641,11 +641,11 @@
~GetAttributeForKeyState() override = default;
void OnError(const base::Location& from, Status status) override {
- CallBack(from, /*attribute_value=*/base::nullopt, status);
+ CallBack(from, /*attribute_value=*/absl::nullopt, status);
}
void OnSuccess(const base::Location& from,
- const base::Optional<std::string>& attribute_value) {
+ const absl::optional<std::string>& attribute_value) {
CallBack(from, attribute_value, Status::kSuccess);
}
@@ -655,7 +655,7 @@
private:
void CallBack(const base::Location& from,
- const base::Optional<std::string>& attribute_value,
+ const absl::optional<std::string>& attribute_value,
Status status) {
auto bound_callback =
base::BindOnce(std::move(callback_), attribute_value, status);
@@ -680,7 +680,7 @@
~IsKeyOnTokenState() override = default;
void OnError(const base::Location& from, Status status) override {
- CallBack(from, /*on_token=*/base::nullopt, status);
+ CallBack(from, /*on_token=*/absl::nullopt, status);
}
void OnSuccess(const base::Location& from, bool on_token) {
@@ -692,7 +692,7 @@
private:
void CallBack(const base::Location& from,
- base::Optional<bool> on_token,
+ absl::optional<bool> on_token,
Status status) {
auto bound_callback =
base::BindOnce(std::move(callback_), on_token, status);
@@ -1456,7 +1456,7 @@
// to return nullopt |attribute_value| instead.
int error = PORT_GetError();
if (error == SEC_ERROR_BAD_DATA) {
- state->OnSuccess(FROM_HERE, /*attribute_value=*/base::nullopt);
+ state->OnSuccess(FROM_HERE, /*attribute_value=*/absl::nullopt);
return;
}
@@ -1527,7 +1527,7 @@
}
void PlatformKeysServiceImpl::SignRSAPKCS1Digest(
- base::Optional<TokenId> token_id,
+ absl::optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
@@ -1553,7 +1553,7 @@
}
void PlatformKeysServiceImpl::SignRSAPKCS1Raw(
- base::Optional<TokenId> token_id,
+ absl::optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
SignCallback callback) {
@@ -1579,7 +1579,7 @@
}
void PlatformKeysServiceImpl::SignECDSADigest(
- base::Optional<TokenId> token_id,
+ absl::optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
@@ -1887,7 +1887,7 @@
// Get the pointer to |state| before transferring ownership of |state| to the
// callback's bound arguments.
NSSOperationState* state_ptr = state.get();
- GetCertDatabase(/*token_id=*/base::nullopt /* don't get any specific slot */,
+ GetCertDatabase(/*token_id=*/absl::nullopt /* don't get any specific slot */,
base::BindOnce(&GetTokensWithDB, std::move(state)),
delegate_.get(), state_ptr);
}
@@ -1907,7 +1907,7 @@
// Get the pointer to |state| before transferring ownership of |state| to the
// callback's bound arguments.
GetCertDatabase(
- /*token_id=*/base::nullopt /* don't get any specific slot */,
+ /*token_id=*/absl::nullopt /* don't get any specific slot */,
base::BindOnce(&GetKeyLocationsWithDB, std::move(state)), delegate_.get(),
state_ptr);
}
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_service_test_util.h b/chrome/browser/chromeos/platform_keys/platform_keys_service_test_util.h
index c6602db33..52bc31c6 100644
--- a/chrome/browser/chromeos/platform_keys/platform_keys_service_test_util.h
+++ b/chrome/browser/chromeos/platform_keys/platform_keys_service_test_util.h
@@ -13,10 +13,10 @@
#include "base/bind.h"
#include "base/callback_forward.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace platform_keys {
@@ -144,12 +144,12 @@
// Supports waiting for the result of the
// PlatformKeysService::GetAttributeForKey.
class GetAttributeForKeyExecutionWaiter
- : public ExecutionWaiter<const base::Optional<std::string>&> {
+ : public ExecutionWaiter<const absl::optional<std::string>&> {
public:
GetAttributeForKeyExecutionWaiter();
~GetAttributeForKeyExecutionWaiter();
- const base::Optional<std::string>& attribute_value() const {
+ const absl::optional<std::string>& attribute_value() const {
return std::get<0>(result_callback_args());
}
};
@@ -173,12 +173,12 @@
};
class IsKeyOnTokenExecutionWaiter
- : public ExecutionWaiter<base::Optional<bool>> {
+ : public ExecutionWaiter<absl::optional<bool>> {
public:
IsKeyOnTokenExecutionWaiter();
~IsKeyOnTokenExecutionWaiter();
- base::Optional<bool> on_slot() const {
+ absl::optional<bool> on_slot() const {
return std::get<0>(result_callback_args());
}
};
diff --git a/chrome/browser/chromeos/policy/adb_sideloading_allowance_mode_policy_handler.cc b/chrome/browser/chromeos/policy/adb_sideloading_allowance_mode_policy_handler.cc
index 340c61b6..d107652 100644
--- a/chrome/browser/chromeos/policy/adb_sideloading_allowance_mode_policy_handler.cc
+++ b/chrome/browser/chromeos/policy/adb_sideloading_allowance_mode_policy_handler.cc
@@ -9,7 +9,6 @@
#include "ash/constants/ash_features.h"
#include "base/bind.h"
#include "base/feature_list.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "base/values.h"
@@ -25,20 +24,21 @@
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/user_manager/user_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
constexpr base::TimeDelta kAdbSideloadingPlannedNotificationWaitTime =
base::TimeDelta::FromDays(1);
-base::Optional<policy::AdbSideloadingAllowanceMode>
+absl::optional<policy::AdbSideloadingAllowanceMode>
GetAdbSideloadingDevicePolicyMode(const ash::CrosSettings* cros_settings,
const base::RepeatingClosure callback) {
auto status = cros_settings->PrepareTrustedValues(callback);
// If the policy value is still not trusted, return optional null
if (status != chromeos::CrosSettingsProvider::TRUSTED) {
- return base::nullopt;
+ return absl::nullopt;
}
// Get the trusted policy value.
@@ -63,7 +63,7 @@
case Mode::ALLOW_FOR_AFFILIATED_USERS:
return policy::AdbSideloadingAllowanceMode::kAllowForAffiliatedUser;
default:
- return base::nullopt;
+ return absl::nullopt;
}
}
} // namespace
@@ -127,7 +127,7 @@
}
void AdbSideloadingAllowanceModePolicyHandler::MaybeShowNotification() {
- base::Optional<policy::AdbSideloadingAllowanceMode> mode =
+ absl::optional<policy::AdbSideloadingAllowanceMode> mode =
GetAdbSideloadingDevicePolicyMode(
cros_settings_,
base::BindRepeating(
diff --git a/chrome/browser/chromeos/policy/auto_enrollment_client_impl.cc b/chrome/browser/chromeos/policy/auto_enrollment_client_impl.cc
index b97adf14..74dde7b4 100644
--- a/chrome/browser/chromeos/policy/auto_enrollment_client_impl.cc
+++ b/chrome/browser/chromeos/policy/auto_enrollment_client_impl.cc
@@ -13,7 +13,6 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/ash/login/enrollment/auto_enrollment_controller.h"
@@ -32,6 +31,7 @@
#include "content/public/browser/network_service_instance.h"
#include "crypto/sha2.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/private_membership/src/private_membership_rlwe_client.h"
#include "url/gurl.h"
@@ -156,9 +156,9 @@
// Parsed fields of DeviceManagementResponse.
struct ParsedResponse {
std::string restore_mode;
- base::Optional<std::string> management_domain;
- base::Optional<std::string> disabled_message;
- base::Optional<bool> is_license_packaged_with_device;
+ absl::optional<std::string> management_domain;
+ absl::optional<std::string> disabled_message;
+ absl::optional<bool> is_license_packaged_with_device;
};
// Returns the request job type. This must match the request filled in
@@ -172,7 +172,7 @@
// Parses the |response|. If it is valid, returns a ParsedResponse struct
// instance. If it is invalid, returns nullopt.
- virtual base::Optional<ParsedResponse> ParseResponse(
+ virtual absl::optional<ParsedResponse> ParseResponse(
const enterprise_management::DeviceManagementResponse& response) = 0;
};
@@ -265,14 +265,14 @@
// Tries to load the result of a previous execution of the PSM protocol from
// local state. Returns decision value if it has been made and is valid,
// otherwise nullopt.
- base::Optional<bool> GetPsmCachedDecision() const {
+ absl::optional<bool> GetPsmCachedDecision() const {
const PrefService::Preference* has_psm_server_state_pref =
local_state_->FindPreference(prefs::kShouldRetrieveDeviceState);
if (!has_psm_server_state_pref ||
has_psm_server_state_pref->IsDefaultValue() ||
!has_psm_server_state_pref->GetValue()->is_bool()) {
- return base::nullopt;
+ return absl::nullopt;
}
return has_psm_server_state_pref->GetValue()->GetBool();
@@ -521,7 +521,7 @@
TYPE_PSM_HAS_DEVICE_STATE_REQUEST,
random_device_id_,
/*critical=*/true, DMAuth::NoAuth(),
- /*oauth_token=*/base::nullopt, url_loader_factory_,
+ /*oauth_token=*/absl::nullopt, url_loader_factory_,
std::move(callback));
}
@@ -664,18 +664,18 @@
inner_request->set_serial_number(device_serial_number_);
}
- base::Optional<ParsedResponse> ParseResponse(
+ absl::optional<ParsedResponse> ParseResponse(
const em::DeviceManagementResponse& response) override {
if (!response.has_device_initial_enrollment_state_response()) {
LOG(ERROR) << "Server failed to provide initial enrollment response.";
- return base::nullopt;
+ return absl::nullopt;
}
return ParseInitialEnrollmentStateResponse(
response.device_initial_enrollment_state_response());
}
- static base::Optional<ParsedResponse> ParseInitialEnrollmentStateResponse(
+ static absl::optional<ParsedResponse> ParseInitialEnrollmentStateResponse(
const em::DeviceInitialEnrollmentStateResponse& state_response) {
StateDownloadMessageProcessor::ParsedResponse parsed_response;
@@ -738,11 +738,11 @@
->set_server_backed_state_key(server_backed_state_key_);
}
- base::Optional<ParsedResponse> ParseResponse(
+ absl::optional<ParsedResponse> ParseResponse(
const em::DeviceManagementResponse& response) override {
if (!response.has_device_state_retrieval_response()) {
LOG(ERROR) << "Server failed to provide auto-enrollment response.";
- return base::nullopt;
+ return absl::nullopt;
}
const em::DeviceStateRetrievalResponse& state_response =
@@ -809,7 +809,7 @@
std::make_unique<StateDownloadMessageProcessorFRE>(
server_backed_state_key),
power_initial, power_limit,
- /*power_outdated_server_detect=*/base::nullopt, kUMAHashDanceSuffixFRE,
+ /*power_outdated_server_detect=*/absl::nullopt, kUMAHashDanceSuffixFRE,
/*private_set_membership_helper=*/nullptr));
}
@@ -832,7 +832,7 @@
std::make_unique<StateDownloadMessageProcessorInitialEnrollment>(
device_serial_number, device_brand_code),
power_initial, power_limit,
- base::make_optional(power_outdated_server_detect),
+ absl::make_optional(power_outdated_server_detect),
kUMAHashDanceSuffixInitialEnrollment,
ash::AutoEnrollmentController::IsPsmEnabled()
? std::make_unique<PsmHelper>(
@@ -913,7 +913,7 @@
state_download_message_processor,
int power_initial,
int power_limit,
- base::Optional<int> power_outdated_server_detect,
+ absl::optional<int> power_outdated_server_detect,
std::string uma_suffix,
std::unique_ptr<PsmHelper> private_set_membership_helper)
: progress_callback_(callback),
@@ -995,7 +995,7 @@
if (psm_helper_->IsCheckMembershipInProgress())
return true;
- const base::Optional<bool> private_set_membership_server_state =
+ const absl::optional<bool> private_set_membership_server_state =
psm_helper_->GetPsmCachedDecision();
if (private_set_membership_server_state.has_value()) {
@@ -1097,7 +1097,7 @@
policy::DeviceManagementService::JobConfiguration::TYPE_AUTO_ENROLLMENT,
device_id_,
/*critical=*/false, DMAuth::NoAuth(),
- /*oauth_token=*/base::nullopt, url_loader_factory_,
+ /*oauth_token=*/absl::nullopt, url_loader_factory_,
base::BindOnce(
&AutoEnrollmentClientImpl::HandleRequestCompletion,
base::Unretained(this),
@@ -1121,7 +1121,7 @@
device_management_service_,
state_download_message_processor_->GetJobType(), device_id_,
/*critical=*/false, DMAuth::NoAuth(),
- /*oauth_token=*/base::nullopt, url_loader_factory_,
+ /*oauth_token=*/absl::nullopt, url_loader_factory_,
base::BindRepeating(
&AutoEnrollmentClientImpl::HandleRequestCompletion,
base::Unretained(this),
@@ -1247,7 +1247,7 @@
DeviceManagementStatus status,
int net_error,
const em::DeviceManagementResponse& response) {
- base::Optional<StateDownloadMessageProcessor::ParsedResponse>
+ absl::optional<StateDownloadMessageProcessor::ParsedResponse>
parsed_response_opt;
parsed_response_opt =
@@ -1373,7 +1373,7 @@
auto comparison = PsmHashDanceComparison::kEqualResults;
if (!hash_dance_error && !psm_error) {
- base::Optional<bool> psm_decision = psm_helper_->GetPsmCachedDecision();
+ absl::optional<bool> psm_decision = psm_helper_->GetPsmCachedDecision();
// There was no error and this function is only invoked after PSM has been
// performed, so there must be a decision.
diff --git a/chrome/browser/chromeos/policy/auto_enrollment_client_impl.h b/chrome/browser/chromeos/policy/auto_enrollment_client_impl.h
index e06d5f42..ac3a5f8 100644
--- a/chrome/browser/chromeos/policy/auto_enrollment_client_impl.h
+++ b/chrome/browser/chromeos/policy/auto_enrollment_client_impl.h
@@ -11,12 +11,12 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/policy/auto_enrollment_client.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/core/common/cloud/device_management_service.h"
#include "services/network/public/cpp/network_connection_tracker.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/protobuf/src/google/protobuf/repeated_field.h"
class PrefRegistrySimple;
@@ -161,7 +161,7 @@
state_download_message_processor,
int power_initial,
int power_limit,
- base::Optional<int> power_outdated_server_detect,
+ absl::optional<int> power_outdated_server_detect,
std::string uma_suffix,
std::unique_ptr<PsmHelper> psm_helper);
@@ -257,7 +257,7 @@
// If set and the modulus requested by the server is higher than
// |1<<power_outdated_server_detect|, this client will assume that the server
// is outdated.
- base::Optional<int> power_outdated_server_detect_;
+ absl::optional<int> power_outdated_server_detect_;
// Number of requests for a different modulus received from the server.
// Used to determine if the server keeps asking for different moduli.
diff --git a/chrome/browser/chromeos/policy/auto_enrollment_client_impl_unittest.cc b/chrome/browser/chromeos/policy/auto_enrollment_client_impl_unittest.cc
index b1f05b0..b4b5856b 100644
--- a/chrome/browser/chromeos/policy/auto_enrollment_client_impl_unittest.cc
+++ b/chrome/browser/chromeos/policy/auto_enrollment_client_impl_unittest.cc
@@ -16,7 +16,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
@@ -41,6 +40,7 @@
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/private_membership/src/internal/testing/regression_test_data/regression_test_data.pb.h"
#include "third_party/private_membership/src/private_membership_rlwe_client.h"
#include "third_party/shell-encryption/src/testing/status_testing.h"
@@ -286,7 +286,7 @@
bool is_license_packaged_with_device) {
if (GetAutoEnrollmentProtocol() == AutoEnrollmentProtocol::kFRE) {
ServerWillSendStateForFRE(management_domain, restore_mode,
- device_disabled_message, base::nullopt);
+ device_disabled_message, absl::nullopt);
} else {
ServerWillSendStateForInitialEnrollment(
management_domain, is_license_packaged_with_device,
@@ -307,7 +307,7 @@
const std::string& management_domain,
em::DeviceStateRetrievalResponse::RestoreMode restore_mode,
const std::string& device_disabled_message,
- base::Optional<em::DeviceInitialEnrollmentStateResponse>
+ absl::optional<em::DeviceInitialEnrollmentStateResponse>
initial_state_response) {
em::DeviceManagementResponse response;
em::DeviceStateRetrievalResponse* state_response =
@@ -473,7 +473,7 @@
EXPECT_FALSE(state_dict->GetString(kDeviceStateDisabledMessage,
&actual_disabled_message));
- base::Optional<bool> actual_is_license_packaged_with_device;
+ absl::optional<bool> actual_is_license_packaged_with_device;
actual_is_license_packaged_with_device =
state_dict->FindBoolPath(kDeviceStatePackagedLicense);
if (actual_is_license_packaged_with_device) {
@@ -1282,7 +1282,7 @@
ServerWillSendStateForFRE(
std::string(), em::DeviceStateRetrievalResponse::RESTORE_MODE_NONE,
std::string(),
- base::Optional<em::DeviceInitialEnrollmentStateResponse>(
+ absl::optional<em::DeviceInitialEnrollmentStateResponse>(
initial_state_response));
client()->Start();
base::RunLoop().RunUntilIdle();
@@ -1315,7 +1315,7 @@
ServerWillSendStateForFRE(
std::string(), em::DeviceStateRetrievalResponse::RESTORE_MODE_NONE,
std::string(),
- base::Optional<em::DeviceInitialEnrollmentStateResponse>(
+ absl::optional<em::DeviceInitialEnrollmentStateResponse>(
initial_state_response));
client()->Start();
base::RunLoop().RunUntilIdle();
@@ -1349,7 +1349,7 @@
ServerWillSendStateForFRE(
std::string(), em::DeviceStateRetrievalResponse::RESTORE_MODE_NONE,
std::string(),
- base::Optional<em::DeviceInitialEnrollmentStateResponse>(
+ absl::optional<em::DeviceInitialEnrollmentStateResponse>(
initial_state_response));
client()->Start();
base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.cc b/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.cc
index a06de20a..547078f1 100644
--- a/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.cc
+++ b/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.cc
@@ -82,7 +82,7 @@
request.set_username(
cryptohome::CreateAccountIdentifierFromAccountId(account_id_)
.account_id());
- base::Optional<user_data_auth::GetSanitizedUsernameReply> reply =
+ absl::optional<user_data_auth::GetSanitizedUsernameReply> reply =
cryptohome_misc_client_->BlockingGetSanitizedUsername(request);
if (!reply.has_value() || reply->sanitized_username().empty()) {
return false;
@@ -176,7 +176,7 @@
}
void CachedPolicyKeyLoaderChromeOS::OnGetSanitizedUsername(
- base::Optional<user_data_auth::GetSanitizedUsernameReply> reply) {
+ absl::optional<user_data_auth::GetSanitizedUsernameReply> reply) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!reply.has_value() || reply->sanitized_username().empty()) {
// Don't bother trying to load a key if we don't know where it is - just
diff --git a/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.h b/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.h
index 94de102..d15378c 100644
--- a/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.h
+++ b/chrome/browser/chromeos/policy/cached_policy_key_loader_chromeos.h
@@ -13,10 +13,10 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "chromeos/dbus/cryptohome/UserDataAuth.pb.h"
#include "components/account_id/account_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class SequencedTaskRunner;
@@ -66,7 +66,7 @@
// Callback for getting the sanitized username from |cryptohome_client_|.
void OnGetSanitizedUsername(
- base::Optional<user_data_auth::GetSanitizedUsernameReply> reply);
+ absl::optional<user_data_auth::GetSanitizedUsernameReply> reply);
void NotifyAndClearCallbacks();
diff --git a/chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc b/chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc
index 5320fbdb..0584eeb 100644
--- a/chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc
+++ b/chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc
@@ -13,7 +13,6 @@
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/task_environment.h"
@@ -33,6 +32,7 @@
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace policy {
@@ -115,7 +115,7 @@
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
resource_cache_ = std::make_unique<ResourceCache>(
temp_dir_.GetPath(), task_environment_.GetMainThreadTaskRunner(),
- /* max_cache_size */ base::nullopt);
+ /* max_cache_size */ absl::nullopt);
SetUpExternalDataManager();
// Set |kStringPolicy| to a string value.
diff --git a/chrome/browser/chromeos/policy/cloud_external_data_store_unittest.cc b/chrome/browser/chromeos/policy/cloud_external_data_store_unittest.cc
index 557da06..4f026a3 100644
--- a/chrome/browser/chromeos/policy/cloud_external_data_store_unittest.cc
+++ b/chrome/browser/chromeos/policy/cloud_external_data_store_unittest.cc
@@ -11,11 +11,11 @@
#include "base/compiler_specific.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/test/test_simple_task_runner.h"
#include "components/policy/core/common/cloud/resource_cache.h"
#include "crypto/sha2.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -60,7 +60,7 @@
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
resource_cache_ =
std::make_unique<ResourceCache>(temp_dir_.GetPath(), task_runner_,
- /* max_cache_size */ base::nullopt);
+ /* max_cache_size */ absl::nullopt);
}
TEST_F(CouldExternalDataStoreTest, StoreAndLoad) {
diff --git a/chrome/browser/chromeos/policy/component_active_directory_policy_service.cc b/chrome/browser/chromeos/policy/component_active_directory_policy_service.cc
index 4de22be..92c1364 100644
--- a/chrome/browser/chromeos/policy/component_active_directory_policy_service.cc
+++ b/chrome/browser/chromeos/policy/component_active_directory_policy_service.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "chromeos/dbus/login_manager/policy_descriptor.pb.h"
@@ -18,6 +17,7 @@
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/registry_dict.h"
#include "components/policy/proto/device_management_backend.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace em = enterprise_management;
@@ -72,20 +72,20 @@
// Parses |json| to a base::Value. Returns nullptr and prints errors
// on failure.
-base::Optional<base::Value> ParseJsonToDict(const std::string& json) {
+absl::optional<base::Value> ParseJsonToDict(const std::string& json) {
base::JSONReader::ValueWithError value_with_error =
base::JSONReader::ReadAndReturnValueWithError(
json, base::JSON_ALLOW_TRAILING_COMMAS);
if (!value_with_error.value) {
LOG(ERROR) << "Could not parse policy value as JSON: "
<< value_with_error.error_message;
- return base::nullopt;
+ return absl::nullopt;
}
base::Value value = std::move(value_with_error.value.value());
if (!value.is_dict()) {
LOG(ERROR) << "The JSON policy value is not a dictionary.";
- return base::nullopt;
+ return absl::nullopt;
}
return value;
@@ -112,7 +112,7 @@
// { "Name1": { "Value":Value1 },
// "Name2": { "Value":Value2, "Level":"Recommended" } }
// (see ParsePolicy in ComponentCloudPolicyStore).
- base::Optional<base::Value> dict = ParseJsonToDict(policy_value);
+ absl::optional<base::Value> dict = ParseJsonToDict(policy_value);
if (!dict.has_value())
return false;
@@ -132,7 +132,7 @@
// be converted to the types specified in the schema:
// string -> double for 'number' type policies
// int -> bool for 'boolean' type policies
- base::Optional<base::Value> converted_value =
+ absl::optional<base::Value> converted_value =
ConvertRegistryValue(it.second, schema);
if (!converted_value.has_value() || !converted_value.value().is_dict()) {
LOG(ERROR) << "Failed to filter JSON policy at level " << level->json_key;
diff --git a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc
index f4ffdda..c6c6994 100644
--- a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc
+++ b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc
@@ -16,7 +16,6 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
@@ -39,6 +38,7 @@
#include "components/prefs/pref_value_map.h"
#include "components/strings/grit/components_strings.h"
#include "crypto/sha2.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace policy {
@@ -49,22 +49,22 @@
const char kSubkeyURL[] = "url";
const char kSubkeyHash[] = "hash";
-base::Optional<std::string> GetSubkeyString(const base::Value& dict,
+absl::optional<std::string> GetSubkeyString(const base::Value& dict,
policy::PolicyErrorMap* errors,
const std::string& policy,
const std::string& subkey) {
const base::Value* policy_value = dict.FindKey(subkey);
if (!policy_value) {
errors->AddError(policy, subkey, IDS_POLICY_NOT_SPECIFIED_ERROR);
- return base::nullopt;
+ return absl::nullopt;
}
if (!policy_value->is_string()) {
errors->AddError(policy, subkey, IDS_POLICY_TYPE_ERROR, "string");
- return base::nullopt;
+ return absl::nullopt;
}
if (policy_value->GetString().empty()) {
errors->AddError(policy, subkey, IDS_POLICY_NOT_SPECIFIED_ERROR);
- return base::nullopt;
+ return absl::nullopt;
}
return policy_value->GetString();
}
@@ -134,9 +134,9 @@
NOTREACHED();
return false;
}
- base::Optional<std::string> url_string =
+ absl::optional<std::string> url_string =
GetSubkeyString(*value, errors, policy, kSubkeyURL);
- base::Optional<std::string> hash_string =
+ absl::optional<std::string> hash_string =
GetSubkeyString(*value, errors, policy, kSubkeyHash);
if (!url_string || !hash_string)
return false;
@@ -263,7 +263,7 @@
const PolicyMap::Entry* entry = policies->Get(policy_name());
if (!entry)
return;
- base::Optional<base::Value> sanitized_config =
+ absl::optional<base::Value> sanitized_config =
SanitizeNetworkConfig(entry->value());
if (!sanitized_config.has_value())
@@ -282,16 +282,16 @@
pref_path_(pref_path) {}
// static
-base::Optional<base::Value>
+absl::optional<base::Value>
NetworkConfigurationPolicyHandler::SanitizeNetworkConfig(
const base::Value* config) {
if (!config->is_string())
- return base::nullopt;
+ return absl::nullopt;
base::Value toplevel_dict =
chromeos::onc::ReadDictionaryFromJson(config->GetString());
if (!toplevel_dict.is_dict())
- return base::nullopt;
+ return absl::nullopt;
// Placeholder to insert in place of the filtered setting.
const char kPlaceholder[] = "********";
diff --git a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h
index 75cc924..b322fbc 100644
--- a/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h
+++ b/chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h
@@ -63,7 +63,7 @@
// that contains a pretty-printed and sanitized version. In particular, we
// remove any Passphrases that may be contained in the JSON. Ownership of the
// return value is transferred to the caller.
- static base::Optional<base::Value> SanitizeNetworkConfig(
+ static absl::optional<base::Value> SanitizeNetworkConfig(
const base::Value* config);
// The kind of ONC source that this handler represents. ONCSource
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_browsertest.cc b/chrome/browser/chromeos/policy/device_cloud_policy_browsertest.cc
index 3b3e288b..e0639578 100644
--- a/chrome/browser/chromeos/policy/device_cloud_policy_browsertest.cc
+++ b/chrome/browser/chromeos/policy/device_cloud_policy_browsertest.cc
@@ -13,7 +13,6 @@
#include "base/files/dir_reader_posix.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/values.h"
#include "chrome/browser/ash/login/test/local_policy_test_server_mixin.h"
@@ -59,6 +58,7 @@
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace policy {
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc b/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc
index 6b225da..42d070a 100644
--- a/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc
+++ b/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc
@@ -212,7 +212,7 @@
local_state_->GetDictionary(prefs::kServerBackedDeviceState);
std::string device_state_mode;
std::string device_state_management_domain;
- base::Optional<bool> is_license_packaged_with_device;
+ absl::optional<bool> is_license_packaged_with_device;
if (device_state) {
device_state->GetString(kDeviceStateMode, &device_state_mode);
diff --git a/chrome/browser/chromeos/policy/device_local_account_external_data_service.cc b/chrome/browser/chromeos/policy/device_local_account_external_data_service.cc
index 16ad28c7..3b3a322 100644
--- a/chrome/browser/chromeos/policy/device_local_account_external_data_service.cc
+++ b/chrome/browser/chromeos/policy/device_local_account_external_data_service.cc
@@ -14,11 +14,11 @@
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/location.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/sequenced_task_runner.h"
#include "components/policy/core/common/cloud/cloud_policy_store.h"
#include "components/policy/policy_constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -30,7 +30,7 @@
chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTERNAL_DATA);
resource_cache_ =
std::make_unique<ResourceCache>(cache_dir, backend_task_runner_,
- /* max_cache_size */ base::nullopt);
+ /* max_cache_size */ absl::nullopt);
parent_->AddObserver(this);
}
diff --git a/chrome/browser/chromeos/policy/device_local_account_policy_service.cc b/chrome/browser/chromeos/policy/device_local_account_policy_service.cc
index b5dd9e3..71454b2 100644
--- a/chrome/browser/chromeos/policy/device_local_account_policy_service.cc
+++ b/chrome/browser/chromeos/policy/device_local_account_policy_service.cc
@@ -15,7 +15,6 @@
#include "base/containers/contains.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_number_conversions.h"
@@ -45,6 +44,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/network_service_instance.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace em = enterprise_management;
@@ -241,7 +241,7 @@
CloudPolicyClient* client) {
std::unique_ptr<ResourceCache> resource_cache(new ResourceCache(
component_policy_cache_path_, resource_cache_task_runner_,
- /* max_cache_size */ base::nullopt));
+ /* max_cache_size */ absl::nullopt));
component_policy_service_ = std::make_unique<ComponentCloudPolicyService>(
dm_protocol::kChromeExtensionPolicyType, POLICY_SOURCE_CLOUD, this,
diff --git a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
index fd08a1ac..30e40824 100644
--- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
+++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
@@ -12,7 +12,6 @@
#include "base/callback.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -34,6 +33,7 @@
#include "components/policy/policy_constants.h"
#include "components/policy/proto/chrome_device_policy.pb.h"
#include "components/strings/grit/components_strings.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "third_party/re2/src/re2/re2.h"
#include "ui/base/l10n/l10n_util.h"
@@ -62,7 +62,7 @@
std::unique_ptr<ExternalDataFetcher> external_data_fetcher,
PolicyMap* policies) {
std::string error;
- base::Optional<base::Value> decoded_json =
+ absl::optional<base::Value> decoded_json =
DecodeJsonStringAndNormalize(json_string, policy_name, &error);
base::Value value_to_set = decoded_json.has_value()
? std::move(decoded_json.value())
@@ -1956,7 +1956,7 @@
} // namespace
-base::Optional<base::Value> DecodeJsonStringAndNormalize(
+absl::optional<base::Value> DecodeJsonStringAndNormalize(
const std::string& json_string,
const std::string& policy_name,
std::string* error) {
@@ -1965,7 +1965,7 @@
json_string, base::JSON_ALLOW_TRAILING_COMMAS);
if (!value_with_error.value) {
*error = "Invalid JSON string: " + value_with_error.error_message;
- return base::nullopt;
+ return absl::nullopt;
}
base::Value root = std::move(value_with_error.value.value());
@@ -1982,7 +1982,7 @@
msg << "Invalid policy value: " << schema_error << " (at "
<< (error_path.empty() ? "toplevel" : error_path) << ")";
*error = msg.str();
- return base::nullopt;
+ return absl::nullopt;
}
if (changed) {
std::ostringstream msg;
diff --git a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h
index 04c4368..e2c67e3 100644
--- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h
+++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace enterprise_management {
class ChromeDeviceSettingsProto;
@@ -33,7 +33,7 @@
// valid JSON string or doesn't comply with the declared schema (e.g. mismatched
// type, missing required field, etc.). Any warning or error messages from the
// decoding and schema validation process are stored in |error|.
-base::Optional<base::Value> DecodeJsonStringAndNormalize(
+absl::optional<base::Value> DecodeJsonStringAndNormalize(
const std::string& json_string,
const std::string& policy_name,
std::string* error);
diff --git a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos_unittest.cc b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos_unittest.cc
index a6ab025..8c51398e 100644
--- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos_unittest.cc
+++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos_unittest.cc
@@ -90,7 +90,7 @@
TEST_F(DevicePolicyDecoderChromeOSTest,
DecodeJsonStringAndNormalizeJSONParseError) {
std::string error;
- base::Optional<base::Value> decoded_json = DecodeJsonStringAndNormalize(
+ absl::optional<base::Value> decoded_json = DecodeJsonStringAndNormalize(
kInvalidJson, key::kDeviceWallpaperImage, &error);
std::string localized_error = l10n_util::GetStringFUTF8(
IDS_POLICY_PROTO_PARSING_ERROR, base::UTF8ToUTF16(error));
@@ -114,7 +114,7 @@
TEST_F(DevicePolicyDecoderChromeOSTest,
DecodeJsonStringAndNormalizeInvalidValue) {
std::string error;
- base::Optional<base::Value> decoded_json = DecodeJsonStringAndNormalize(
+ absl::optional<base::Value> decoded_json = DecodeJsonStringAndNormalize(
kWallpaperJsonInvalidValue, key::kDeviceWallpaperImage, &error);
EXPECT_FALSE(decoded_json.has_value());
std::string localized_error = l10n_util::GetStringFUTF8(
@@ -128,7 +128,7 @@
TEST_F(DevicePolicyDecoderChromeOSTest,
DecodeJsonStringAndNormalizeUnknownProperty) {
std::string error;
- base::Optional<base::Value> decoded_json = DecodeJsonStringAndNormalize(
+ absl::optional<base::Value> decoded_json = DecodeJsonStringAndNormalize(
kWallpaperJsonUnknownProperty, key::kDeviceWallpaperImage, &error);
std::string localized_error = l10n_util::GetStringFUTF8(
IDS_POLICY_PROTO_PARSING_ERROR, base::UTF8ToUTF16(error));
@@ -141,7 +141,7 @@
TEST_F(DevicePolicyDecoderChromeOSTest, DecodeJsonStringAndNormalizeSuccess) {
std::string error;
- base::Optional<base::Value> decoded_json = DecodeJsonStringAndNormalize(
+ absl::optional<base::Value> decoded_json = DecodeJsonStringAndNormalize(
kWallpaperJson, key::kDeviceWallpaperImage, &error);
EXPECT_EQ(*GetWallpaperDict(), decoded_json.value());
EXPECT_TRUE(error.empty());
@@ -178,7 +178,7 @@
TEST_F(DevicePolicyDecoderChromeOSTest, DecodeServiceUUIDListSuccess) {
std::string error;
- base::Optional<base::Value> decoded_json = DecodeJsonStringAndNormalize(
+ absl::optional<base::Value> decoded_json = DecodeJsonStringAndNormalize(
kValidBluetoothServiceUUIDList, key::kDeviceAllowedBluetoothServices,
&error);
EXPECT_EQ(*GetBluetoothServiceAllowedList(), decoded_json.value());
@@ -187,7 +187,7 @@
TEST_F(DevicePolicyDecoderChromeOSTest, DecodeServiceUUIDListError) {
std::string error;
- base::Optional<base::Value> decoded_json = DecodeJsonStringAndNormalize(
+ absl::optional<base::Value> decoded_json = DecodeJsonStringAndNormalize(
kInvalidBluetoothServiceUUIDList, key::kDeviceAllowedBluetoothServices,
&error);
EXPECT_FALSE(decoded_json.has_value());
diff --git a/chrome/browser/chromeos/policy/display_resolution_handler.cc b/chrome/browser/chromeos/policy/display_resolution_handler.cc
index 6305aa09..b23f3223 100644
--- a/chrome/browser/chromeos/policy/display_resolution_handler.cc
+++ b/chrome/browser/chromeos/policy/display_resolution_handler.cc
@@ -8,11 +8,11 @@
#include <vector>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/ash/settings/cros_settings.h"
#include "chromeos/settings/cros_settings_names.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -60,7 +60,7 @@
bool use_native = false;
int width = 0;
int height = 0;
- base::Optional<int> scale_percentage = base::nullopt;
+ absl::optional<int> scale_percentage = absl::nullopt;
bool operator==(const ExternalDisplaySettings& rhs) const {
return use_native == rhs.use_native && width == rhs.width &&
diff --git a/chrome/browser/chromeos/policy/display_resolution_handler_browsertest.cc b/chrome/browser/chromeos/policy/display_resolution_handler_browsertest.cc
index a1bb36e..e8210699 100644
--- a/chrome/browser/chromeos/policy/display_resolution_handler_browsertest.cc
+++ b/chrome/browser/chromeos/policy/display_resolution_handler_browsertest.cc
@@ -39,11 +39,11 @@
namespace {
struct PolicyValue {
- base::Optional<int> external_width;
- base::Optional<int> external_height;
- base::Optional<int> external_scale_percentage;
+ absl::optional<int> external_width;
+ absl::optional<int> external_height;
+ absl::optional<int> external_scale_percentage;
bool use_native = false;
- base::Optional<int> internal_scale_percentage;
+ absl::optional<int> internal_scale_percentage;
bool operator==(const PolicyValue& rhs) const {
return external_width == rhs.external_width &&
@@ -404,11 +404,11 @@
extensions::api::system_display::DisplayProperties props) {
base::RunLoop run_loop;
base::OnceClosure quit_closure(run_loop.QuitClosure());
- base::Optional<std::string> operation_error;
+ absl::optional<std::string> operation_error;
extensions::DisplayInfoProvider::Get()->SetDisplayProperties(
std::to_string(display_id), std::move(props),
base::BindOnce(
- [](base::OnceClosure quit_closure, base::Optional<std::string>) {
+ [](base::OnceClosure quit_closure, absl::optional<std::string>) {
std::move(quit_closure).Run();
},
std::move(quit_closure)));
diff --git a/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc b/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc
index ae4abd1f..4a08b79 100644
--- a/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc
+++ b/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc
@@ -126,7 +126,7 @@
MOCK_METHOD1(OnWidgetClosing, void(views::Widget* widget));
views::Widget* widget_ = nullptr;
FakeClipboardNotifier* helper_ = nullptr;
- base::Optional<ui::DataTransferEndpoint> blink_data_dst_;
+ absl::optional<ui::DataTransferEndpoint> blink_data_dst_;
base::RepeatingClosure blink_quit_cb_ = base::DoNothing();
};
diff --git a/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_unittest.cc b/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_unittest.cc
index 01a3494c..88bc3f4 100644
--- a/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_unittest.cc
+++ b/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_unittest.cc
@@ -6,7 +6,6 @@
#include <memory>
-#include "base/optional.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_histogram_helper.h"
@@ -21,6 +20,7 @@
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/data_transfer_policy/data_transfer_endpoint.h"
#include "url/origin.h"
@@ -63,7 +63,7 @@
return std::make_unique<::testing::StrictMock<MockDlpRulesManager>>();
}
-base::Optional<ui::DataTransferEndpoint> CreateEndpoint(
+absl::optional<ui::DataTransferEndpoint> CreateEndpoint(
ui::EndpointType* type,
bool notify_if_restricted) {
if (type && *type == ui::EndpointType::kUrl) {
@@ -75,7 +75,7 @@
*type,
/*notify_if_restricted=*/notify_if_restricted);
}
- return base::nullopt;
+ return absl::nullopt;
}
std::unique_ptr<content::WebContents> CreateTestWebContents(
@@ -89,7 +89,7 @@
class DataTransferDlpControllerTest
: public ::testing::TestWithParam<
- std::tuple<base::Optional<ui::EndpointType>, bool>> {
+ std::tuple<absl::optional<ui::EndpointType>, bool>> {
protected:
DataTransferDlpControllerTest()
: rules_manager_(), dlp_controller_(rules_manager_) {}
@@ -222,7 +222,7 @@
INSTANTIATE_TEST_SUITE_P(
DlpClipboard,
DlpControllerTest,
- ::testing::Combine(::testing::Values(base::nullopt,
+ ::testing::Combine(::testing::Values(absl::nullopt,
ui::EndpointType::kDefault,
ui::EndpointType::kUnknownVm,
ui::EndpointType::kBorealis,
@@ -231,10 +231,10 @@
TEST_P(DlpControllerTest, Allow) {
ui::DataTransferEndpoint data_src(url::Origin::Create(GURL(kExample1Url)));
- base::Optional<ui::EndpointType> endpoint_type;
+ absl::optional<ui::EndpointType> endpoint_type;
bool do_notify;
std::tie(endpoint_type, do_notify) = GetParam();
- base::Optional<ui::DataTransferEndpoint> data_dst =
+ absl::optional<ui::DataTransferEndpoint> data_dst =
CreateEndpoint(base::OptionalOrNullptr(endpoint_type), do_notify);
auto* dst_ptr = base::OptionalOrNullptr(data_dst);
@@ -260,10 +260,10 @@
TEST_P(DlpControllerTest, Block) {
ui::DataTransferEndpoint data_src(url::Origin::Create(GURL(kExample1Url)));
- base::Optional<ui::EndpointType> endpoint_type;
+ absl::optional<ui::EndpointType> endpoint_type;
bool do_notify;
std::tie(endpoint_type, do_notify) = GetParam();
- base::Optional<ui::DataTransferEndpoint> data_dst =
+ absl::optional<ui::DataTransferEndpoint> data_dst =
CreateEndpoint(base::OptionalOrNullptr(endpoint_type), do_notify);
auto* dst_ptr = base::OptionalOrNullptr(data_dst);
@@ -296,10 +296,10 @@
TEST_P(DlpControllerTest, Warn) {
ui::DataTransferEndpoint data_src(url::Origin::Create(GURL(kExample1Url)));
- base::Optional<ui::EndpointType> endpoint_type;
+ absl::optional<ui::EndpointType> endpoint_type;
bool do_notify;
std::tie(endpoint_type, do_notify) = GetParam();
- base::Optional<ui::DataTransferEndpoint> data_dst =
+ absl::optional<ui::DataTransferEndpoint> data_dst =
CreateEndpoint(base::OptionalOrNullptr(endpoint_type), do_notify);
auto* dst_ptr = base::OptionalOrNullptr(data_dst);
@@ -337,10 +337,10 @@
TEST_P(DlpControllerTest, Warn_ShouldCancelOnWarn) {
ui::DataTransferEndpoint data_src(url::Origin::Create(GURL(kExample1Url)));
- base::Optional<ui::EndpointType> endpoint_type;
+ absl::optional<ui::EndpointType> endpoint_type;
bool do_notify;
std::tie(endpoint_type, do_notify) = GetParam();
- base::Optional<ui::DataTransferEndpoint> data_dst =
+ absl::optional<ui::DataTransferEndpoint> data_dst =
CreateEndpoint(base::OptionalOrNullptr(endpoint_type), do_notify);
auto* dst_ptr = base::OptionalOrNullptr(data_dst);
@@ -369,7 +369,7 @@
TEST_P(DlpControllerVMsTest, Allow) {
ui::DataTransferEndpoint data_src(url::Origin::Create(GURL(kExample1Url)));
- base::Optional<ui::EndpointType> endpoint_type;
+ absl::optional<ui::EndpointType> endpoint_type;
bool do_notify;
std::tie(endpoint_type, do_notify) = GetParam();
ASSERT_TRUE(endpoint_type.has_value());
@@ -397,7 +397,7 @@
TEST_P(DlpControllerVMsTest, Block) {
ui::DataTransferEndpoint data_src(url::Origin::Create(GURL(kExample1Url)));
- base::Optional<ui::EndpointType> endpoint_type;
+ absl::optional<ui::EndpointType> endpoint_type;
bool do_notify;
std::tie(endpoint_type, do_notify) = GetParam();
ASSERT_TRUE(endpoint_type.has_value());
@@ -433,7 +433,7 @@
TEST_P(DlpControllerVMsTest, Warn) {
ui::DataTransferEndpoint data_src(url::Origin::Create(GURL(kExample1Url)));
- base::Optional<ui::EndpointType> endpoint_type;
+ absl::optional<ui::EndpointType> endpoint_type;
bool do_notify;
std::tie(endpoint_type, do_notify) = GetParam();
ASSERT_TRUE(endpoint_type.has_value());
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_clipboard_notifier.cc b/chrome/browser/chromeos/policy/dlp/dlp_clipboard_notifier.cc
index a4df1dd..bc0ba8cc 100644
--- a/chrome/browser/chromeos/policy/dlp/dlp_clipboard_notifier.cc
+++ b/chrome/browser/chromeos/policy/dlp/dlp_clipboard_notifier.cc
@@ -245,7 +245,7 @@
void DlpClipboardNotifier::ShowToast(const std::string& id,
const std::u16string& text) const {
ash::ToastData toast(id, text, kClipboardDlpBlockDurationMs,
- /*dismiss_text=*/base::nullopt);
+ /*dismiss_text=*/absl::nullopt);
toast.is_managed = true;
ash::ToastManager::Get()->Show(toast);
}
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_clipboard_notifier_unittest.cc b/chrome/browser/chromeos/policy/dlp/dlp_clipboard_notifier_unittest.cc
index be4d1d5..92d1a06 100644
--- a/chrome/browser/chromeos/policy/dlp/dlp_clipboard_notifier_unittest.cc
+++ b/chrome/browser/chromeos/policy/dlp/dlp_clipboard_notifier_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/mock_callback.h"
@@ -21,6 +20,7 @@
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/data_transfer_policy/data_transfer_endpoint.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/widget/widget.h"
@@ -84,7 +84,7 @@
} // namespace
class ClipboardBubbleTestWithParam
- : public ::testing::TestWithParam<base::Optional<ui::EndpointType>> {
+ : public ::testing::TestWithParam<absl::optional<ui::EndpointType>> {
public:
ClipboardBubbleTestWithParam() = default;
ClipboardBubbleTestWithParam(const ClipboardBubbleTestWithParam&) = delete;
@@ -96,7 +96,7 @@
TEST_P(ClipboardBubbleTestWithParam, BlockBubble) {
::testing::StrictMock<MockDlpClipboardNotifier> notifier;
ui::DataTransferEndpoint data_src(url::Origin::Create(GURL(kExampleUrl)));
- base::Optional<ui::DataTransferEndpoint> data_dst;
+ absl::optional<ui::DataTransferEndpoint> data_dst;
auto param = GetParam();
if (param.has_value())
data_dst.emplace(CreateEndpoint(param.value()));
@@ -110,7 +110,7 @@
::testing::StrictMock<MockDlpClipboardNotifier> notifier;
url::Origin origin = url::Origin::Create(GURL(kExampleUrl));
ui::DataTransferEndpoint data_src(origin);
- base::Optional<ui::DataTransferEndpoint> data_dst;
+ absl::optional<ui::DataTransferEndpoint> data_dst;
auto param = GetParam();
if (param.has_value())
data_dst.emplace(CreateEndpoint(param.value()));
@@ -124,7 +124,7 @@
INSTANTIATE_TEST_SUITE_P(DlpClipboardNotifierTest,
ClipboardBubbleTestWithParam,
- ::testing::Values(base::nullopt,
+ ::testing::Values(absl::nullopt,
ui::EndpointType::kDefault,
ui::EndpointType::kUnknownVm,
ui::EndpointType::kBorealis,
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_content_manager.h b/chrome/browser/chromeos/policy/dlp/dlp_content_manager.h
index bc0464c..446657b 100644
--- a/chrome/browser/chromeos/policy/dlp/dlp_content_manager.h
+++ b/chrome/browser/chromeos/policy/dlp/dlp_content_manager.h
@@ -11,13 +11,13 @@
#include "base/callback.h"
#include "base/containers/flat_map.h"
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_content_restriction_set.h"
#include "chrome/browser/chromeos/policy/dlp/dlp_window_observer.h"
#include "chrome/browser/ui/ash/screenshot_area.h"
#include "content/public/browser/desktop_media_id.h"
#include "content/public/browser/media_stream_request.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
struct ScreenshotArea;
@@ -207,7 +207,7 @@
DlpContentRestrictionSet on_screen_restrictions_;
// The currently running video capture area if any.
- base::Optional<ScreenshotArea> running_video_capture_area_;
+ absl::optional<ScreenshotArea> running_video_capture_area_;
// List of the currently running screen captures.
std::vector<ScreenCaptureInfo> running_screen_captures_;
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_content_manager_unittest.cc b/chrome/browser/chromeos/policy/dlp/dlp_content_manager_unittest.cc
index 83c4d5d..4a0ca9b 100644
--- a/chrome/browser/chromeos/policy/dlp/dlp_content_manager_unittest.cc
+++ b/chrome/browser/chromeos/policy/dlp/dlp_content_manager_unittest.cc
@@ -9,7 +9,6 @@
#include "ash/public/cpp/privacy_screen_dlp_helper.h"
#include "base/bind.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
@@ -30,6 +29,7 @@
#include "content/public/test/web_contents_tester.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using ::testing::_;
using ::testing::Mock;
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_drag_drop_notifier_unittest.cc b/chrome/browser/chromeos/policy/dlp/dlp_drag_drop_notifier_unittest.cc
index 3422662..bad7018e 100644
--- a/chrome/browser/chromeos/policy/dlp/dlp_drag_drop_notifier_unittest.cc
+++ b/chrome/browser/chromeos/policy/dlp/dlp_drag_drop_notifier_unittest.cc
@@ -4,10 +4,10 @@
#include "chrome/browser/chromeos/policy/dlp/dlp_drag_drop_notifier.h"
-#include "base/optional.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/data_transfer_policy/data_transfer_endpoint.h"
namespace policy {
@@ -36,7 +36,7 @@
} // namespace
class DragDropBubbleTestWithParam
- : public ::testing::TestWithParam<base::Optional<ui::EndpointType>> {
+ : public ::testing::TestWithParam<absl::optional<ui::EndpointType>> {
public:
DragDropBubbleTestWithParam() = default;
DragDropBubbleTestWithParam(const DragDropBubbleTestWithParam&) = delete;
@@ -48,7 +48,7 @@
TEST_P(DragDropBubbleTestWithParam, NotifyBlocked) {
::testing::StrictMock<MockDlpDragDropNotifier> notifier;
ui::DataTransferEndpoint data_src(url::Origin::Create(GURL(kExampleUrl)));
- base::Optional<ui::DataTransferEndpoint> data_dst;
+ absl::optional<ui::DataTransferEndpoint> data_dst;
auto param = GetParam();
if (param.has_value())
data_dst.emplace(CreateEndpoint(param.value()));
@@ -60,7 +60,7 @@
INSTANTIATE_TEST_SUITE_P(DlpDragDropNotifierTest,
DragDropBubbleTestWithParam,
- ::testing::Values(base::nullopt,
+ ::testing::Values(absl::nullopt,
ui::EndpointType::kDefault,
ui::EndpointType::kUnknownVm,
ui::EndpointType::kBorealis,
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_rules_manager_impl.cc b/chrome/browser/chromeos/policy/dlp/dlp_rules_manager_impl.cc
index 41b0af86..c8e426e 100644
--- a/chrome/browser/chromeos/policy/dlp/dlp_rules_manager_impl.cc
+++ b/chrome/browser/chromeos/policy/dlp/dlp_rules_manager_impl.cc
@@ -14,7 +14,6 @@
#include "base/containers/contains.h"
#include "base/containers/fixed_flat_map.h"
#include "base/feature_list.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller.h"
@@ -28,6 +27,7 @@
#include "components/policy/core/common/policy_pref_names.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -139,7 +139,7 @@
// Returns the maximum level of the rules of given `restriction` joined with
// the `selected_rules`.
template <typename T>
-std::pair<DlpRulesManager::Level, base::Optional<T>> GetMaxJoinRestrictionLevel(
+std::pair<DlpRulesManager::Level, absl::optional<T>> GetMaxJoinRestrictionLevel(
const DlpRulesManager::Restriction restriction,
const std::map<RuleId, T>& selected_rules,
const std::map<DlpRulesManager::Restriction,
@@ -147,13 +147,13 @@
restrictions_map) {
auto restriction_it = restrictions_map.find(restriction);
if (restriction_it == restrictions_map.end())
- return std::make_pair(DlpRulesManager::Level::kAllow, base::nullopt);
+ return std::make_pair(DlpRulesManager::Level::kAllow, absl::nullopt);
const std::map<RuleId, DlpRulesManager::Level>& restriction_rules =
restriction_it->second;
- std::pair<DlpRulesManager::Level, base::Optional<T>> max_level =
- std::make_pair(DlpRulesManager::Level::kNotSet, base::nullopt);
+ std::pair<DlpRulesManager::Level, absl::optional<T>> max_level =
+ std::make_pair(DlpRulesManager::Level::kNotSet, absl::nullopt);
for (const auto& rule_pair : selected_rules) {
const auto& restriction_rule_itr = restriction_rules.find(rule_pair.first);
@@ -167,7 +167,7 @@
}
if (max_level.first == DlpRulesManager::Level::kNotSet)
- return std::make_pair(DlpRulesManager::Level::kAllow, base::nullopt);
+ return std::make_pair(DlpRulesManager::Level::kAllow, absl::nullopt);
return max_level;
}
@@ -262,7 +262,7 @@
}
}
- std::pair<Level, base::Optional<std::pair<UrlConditionId, UrlConditionId>>>
+ std::pair<Level, absl::optional<std::pair<UrlConditionId, UrlConditionId>>>
level_urls_pair = GetMaxJoinRestrictionLevel(
restriction, intersection_rules, restrictions_map_);
if (level_urls_pair.second.has_value() && out_source_pattern &&
@@ -308,7 +308,7 @@
}
}
- std::pair<Level, base::Optional<UrlConditionId>> level_url_pair =
+ std::pair<Level, absl::optional<UrlConditionId>> level_url_pair =
GetMaxJoinRestrictionLevel(restriction, intersection_rules,
restrictions_map_);
if (level_url_pair.second.has_value() && out_source_pattern) {
diff --git a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
index 9e4ab75..4a04b1a2 100644
--- a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
+++ b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
@@ -134,10 +134,10 @@
// A utility funciton of base::ReadFileToString which returns an optional
// string.
// TODO(mukai): move this to base/files.
-base::Optional<std::string> ReadFileToOptionalString(
+absl::optional<std::string> ReadFileToOptionalString(
const base::FilePath& file_path) {
std::string content;
- base::Optional<std::string> result;
+ absl::optional<std::string> result;
if (base::ReadFileToString(file_path, &content))
result = std::move(content);
return result;
@@ -455,7 +455,7 @@
}
void EnrollmentHandlerChromeOS::OnOfflinePolicyBlobLoaded(
- base::Optional<std::string> blob) {
+ absl::optional<std::string> blob) {
DCHECK_EQ(EnrollmentConfig::MODE_OFFLINE_DEMO, enrollment_config_.mode);
DCHECK_EQ(STEP_POLICY_FETCH, enrollment_step_);
@@ -601,7 +601,7 @@
}
void EnrollmentHandlerChromeOS::OnFirmwareManagementParametersDataSet(
- base::Optional<user_data_auth::SetFirmwareManagementParametersReply>
+ absl::optional<user_data_auth::SetFirmwareManagementParametersReply>
reply) {
DCHECK_EQ(STEP_SET_FWMP_DATA, enrollment_step_);
if (!reply.has_value()) {
diff --git a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.h b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.h
index 3a33920..2eafe30d 100644
--- a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.h
+++ b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.h
@@ -12,7 +12,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h"
#include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h"
#include "chrome/browser/chromeos/policy/enrollment_config.h"
@@ -27,6 +26,7 @@
#include "components/policy/core/common/cloud/dm_auth.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "google_apis/gaia/gaia_oauth_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class SequencedTaskRunner;
@@ -166,7 +166,7 @@
// Invoked after the firmware management partition in TPM is updated.
void OnFirmwareManagementParametersDataSet(
- base::Optional<user_data_auth::SetFirmwareManagementParametersReply>
+ absl::optional<user_data_auth::SetFirmwareManagementParametersReply>
reply);
// Calls InstallAttributes::LockDevice() for enterprise enrollment and
@@ -191,7 +191,7 @@
void HandleActiveDirectoryPolicyRefreshed(authpolicy::ErrorType error);
// Handles the blob for the device policy for the offline demo mode.
- void OnOfflinePolicyBlobLoaded(base::Optional<std::string> blob);
+ void OnOfflinePolicyBlobLoaded(absl::optional<std::string> blob);
// Handles the policy validation result for the offline demo mode.
void OnOfflinePolicyValidated(DeviceCloudPolicyValidator* validator);
diff --git a/chrome/browser/chromeos/policy/lacros_availability_policy_handler.cc b/chrome/browser/chromeos/policy/lacros_availability_policy_handler.cc
index db1eea1..7ef3632 100644
--- a/chrome/browser/chromeos/policy/lacros_availability_policy_handler.cc
+++ b/chrome/browser/chromeos/policy/lacros_availability_policy_handler.cc
@@ -50,20 +50,20 @@
}
}
-base::Optional<crosapi::browser_util::LacrosLaunchSwitch>
+absl::optional<crosapi::browser_util::LacrosLaunchSwitch>
LacrosAvailabilityPolicyHandler::GetValue(const PolicyMap& policies,
PolicyErrorMap* errors) {
const base::Value* value;
const bool value_found = CheckAndGetValue(policies, errors, &value) && value;
if (!value_found) {
- return base::nullopt;
+ return absl::nullopt;
}
const auto value_it = policy_value_to_enum_.find(value->GetString());
if (value_it == policy_value_to_enum_.end()) {
if (errors)
errors->AddError(policy_name(), IDS_POLICY_VALUE_FORMAT_ERROR);
- return base::nullopt;
+ return absl::nullopt;
}
return value_it->second;
diff --git a/chrome/browser/chromeos/policy/lacros_availability_policy_handler.h b/chrome/browser/chromeos/policy/lacros_availability_policy_handler.h
index 250d123..a86dc78 100644
--- a/chrome/browser/chromeos/policy/lacros_availability_policy_handler.h
+++ b/chrome/browser/chromeos/policy/lacros_availability_policy_handler.h
@@ -8,11 +8,11 @@
#include <string>
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "build/buildflag.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/ash/crosapi/browser_util.h"
#include "components/policy/core/browser/configuration_policy_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#error This file shall only be used in ash.
@@ -38,7 +38,7 @@
PrefValueMap* prefs) override;
private:
- base::Optional<crosapi::browser_util::LacrosLaunchSwitch> GetValue(
+ absl::optional<crosapi::browser_util::LacrosLaunchSwitch> GetValue(
const PolicyMap& policies,
PolicyErrorMap* errors);
diff --git a/chrome/browser/chromeos/policy/lock_to_single_user_manager.cc b/chrome/browser/chromeos/policy/lock_to_single_user_manager.cc
index 8a2eec7..368f7fe 100644
--- a/chrome/browser/chromeos/policy/lock_to_single_user_manager.cc
+++ b/chrome/browser/chromeos/policy/lock_to_single_user_manager.cc
@@ -150,7 +150,7 @@
}
void LockToSingleUserManager::OnLockToSingleUserMountUntilRebootDone(
- base::Optional<RebootOnSignOutReply> reply) {
+ absl::optional<RebootOnSignOutReply> reply) {
if (!reply.has_value()) {
LOG(ERROR) << "Signing out user: no reply from "
"LockToSingleUserMountUntilReboot D-Bus call.";
diff --git a/chrome/browser/chromeos/policy/lock_to_single_user_manager.h b/chrome/browser/chromeos/policy/lock_to_single_user_manager.h
index b1af4b7e..541be17 100644
--- a/chrome/browser/chromeos/policy/lock_to_single_user_manager.h
+++ b/chrome/browser/chromeos/policy/lock_to_single_user_manager.h
@@ -7,13 +7,13 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/ash/arc/session/arc_session_manager.h"
#include "chrome/browser/chromeos/vm_starting_observer.h"
#include "chromeos/dbus/concierge/concierge_client.h"
#include "chromeos/dbus/cryptohome/UserDataAuth.pb.h"
#include "components/user_manager/user_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -60,7 +60,7 @@
// Processes the response from D-Bus call.
void OnLockToSingleUserMountUntilRebootDone(
- base::Optional<user_data_auth::LockToSingleUserMountUntilRebootReply>
+ absl::optional<user_data_auth::LockToSingleUserMountUntilRebootReply>
reply);
// true if locking is required when DbusNotifyVmStarting() is called
diff --git a/chrome/browser/chromeos/policy/minimum_version_policy_handler.cc b/chrome/browser/chromeos/policy/minimum_version_policy_handler.cc
index d1af051..b28f8cb12 100644
--- a/chrome/browser/chromeos/policy/minimum_version_policy_handler.cc
+++ b/chrome/browser/chromeos/policy/minimum_version_policy_handler.cc
@@ -457,10 +457,10 @@
build_state->AddObserver(this);
}
-base::Optional<int> MinimumVersionPolicyHandler::GetTimeRemainingInDays() {
+absl::optional<int> MinimumVersionPolicyHandler::GetTimeRemainingInDays() {
const base::Time now = clock_->Now();
if (!state_ || update_required_deadline_ <= now)
- return base::nullopt;
+ return absl::nullopt;
base::TimeDelta time_remaining = update_required_deadline_ - now;
return GetDaysRounded(time_remaining);
}
@@ -469,7 +469,7 @@
// |days| could be null if |update_required_deadline_timer_| expired while
// login was in progress, else we would have shown the update required screen
// at startup.
- base::Optional<int> days = GetTimeRemainingInDays();
+ absl::optional<int> days = GetTimeRemainingInDays();
if (days && days.value() <= 1)
MaybeShowNotification(base::TimeDelta::FromDays(days.value()));
}
diff --git a/chrome/browser/chromeos/policy/minimum_version_policy_handler.h b/chrome/browser/chromeos/policy/minimum_version_policy_handler.h
index 3dee59cd..58bde27 100644
--- a/chrome/browser/chromeos/policy/minimum_version_policy_handler.h
+++ b/chrome/browser/chromeos/policy/minimum_version_policy_handler.h
@@ -167,7 +167,7 @@
// Returns the number of days to deadline if update is required and deadline
// has not been reached. Returns null if update is not required.
- base::Optional<int> GetTimeRemainingInDays();
+ absl::optional<int> GetTimeRemainingInDays();
// Callback used in tests and invoked after end-of-life status has been
// fetched from the update_engine.
diff --git a/chrome/browser/chromeos/policy/minimum_version_policy_handler_browsertest.cc b/chrome/browser/chromeos/policy/minimum_version_policy_handler_browsertest.cc
index abdc817..4a08fa3 100644
--- a/chrome/browser/chromeos/policy/minimum_version_policy_handler_browsertest.cc
+++ b/chrome/browser/chromeos/policy/minimum_version_policy_handler_browsertest.cc
@@ -468,7 +468,7 @@
// notification.
display_service_tester_->SimulateClick(NotificationHandler::Type::TRANSIENT,
kUpdateRequiredNotificationId,
- 0 /*action_index*/, base::nullopt);
+ 0 /*action_index*/, absl::nullopt);
EXPECT_FALSE(
display_service_tester_->GetNotification(kUpdateRequiredNotificationId));
EXPECT_TRUE(tray_test_api_->IsTrayBubbleOpen());
@@ -520,7 +520,7 @@
// network settings and hides the notification.
display_service_tester_->SimulateClick(NotificationHandler::Type::TRANSIENT,
kUpdateRequiredNotificationId,
- 0 /*action_index*/, base::nullopt);
+ 0 /*action_index*/, absl::nullopt);
EXPECT_FALSE(
display_service_tester_->GetNotification(kUpdateRequiredNotificationId));
EXPECT_TRUE(tray_test_api_->IsTrayBubbleOpen());
@@ -601,7 +601,7 @@
// Clicking on notification button starts update and hides the notification.
display_service_tester_->SimulateClick(NotificationHandler::Type::TRANSIENT,
kUpdateRequiredNotificationId,
- 0 /*action_index*/, base::nullopt);
+ 0 /*action_index*/, absl::nullopt);
EXPECT_FALSE(
display_service_tester_->GetNotification(kUpdateRequiredNotificationId));
@@ -646,7 +646,7 @@
// Clicking on notification button opens settings page and hides notification.
display_service_tester_->SimulateClick(NotificationHandler::Type::TRANSIENT,
kUpdateRequiredNotificationId,
- 0 /*action_index*/, base::nullopt);
+ 0 /*action_index*/, absl::nullopt);
EXPECT_FALSE(
display_service_tester_->GetNotification(kUpdateRequiredNotificationId));
Browser* settings_browser = chrome::FindLastActive();
diff --git a/chrome/browser/chromeos/policy/network_policy_application_browsertest.cc b/chrome/browser/chromeos/policy/network_policy_application_browsertest.cc
index a0c7bfe..f1f20623 100644
--- a/chrome/browser/chromeos/policy/network_policy_application_browsertest.cc
+++ b/chrome/browser/chromeos/policy/network_policy_application_browsertest.cc
@@ -289,7 +289,7 @@
testing::ElementsAre(std::string() /* shill shared profile */));
network_policy_application_observer.ResetEvents();
- base::Optional<std::string> wifi_service =
+ absl::optional<std::string> wifi_service =
shill_service_client_test_->FindServiceMatchingGUID(
"{device-policy-for-Wifi1}");
ASSERT_TRUE(wifi_service);
@@ -386,7 +386,7 @@
base::Value(shill::kStateIdle)));
}
- base::Optional<std::string> wifi2_service =
+ absl::optional<std::string> wifi2_service =
shill_service_client_test_->FindServiceMatchingGUID(
"{user-policy-for-Wifi2}");
ASSERT_TRUE(wifi2_service);
diff --git a/chrome/browser/chromeos/policy/off_hours/device_off_hours_controller.cc b/chrome/browser/chromeos/policy/off_hours/device_off_hours_controller.cc
index b2e83e65..ef4ef2b9 100644
--- a/chrome/browser/chromeos/policy/off_hours/device_off_hours_controller.cc
+++ b/chrome/browser/chromeos/policy/off_hours/device_off_hours_controller.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/time/default_clock.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
@@ -22,6 +21,7 @@
#include "components/prefs/pref_value_map.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace em = enterprise_management;
@@ -94,7 +94,7 @@
if (device_settings_proto.has_device_off_hours()) {
const em::DeviceOffHoursProto& container(
device_settings_proto.device_off_hours());
- base::Optional<std::string> timezone = ExtractTimezoneFromProto(container);
+ absl::optional<std::string> timezone = ExtractTimezoneFromProto(container);
if (timezone) {
off_hours_intervals = weekly_time_utils::ConvertIntervalsToGmt(
ExtractWeeklyTimeIntervalsFromProto(container, *timezone, clock_));
@@ -130,7 +130,7 @@
namespace wtu = ::policy::weekly_time_utils;
const base::Time now = clock_->Now();
const bool in_interval = wtu::Contains(now, off_hours_intervals_);
- const base::Optional<base::Time> update_time =
+ const absl::optional<base::Time> update_time =
wtu::GetNextEventTime(now, off_hours_intervals_);
// weekly off_hours_intervals_ is not empty -> update_time has a value
diff --git a/chrome/browser/chromeos/policy/off_hours/off_hours_proto_parser.cc b/chrome/browser/chromeos/policy/off_hours/off_hours_proto_parser.cc
index 943eeda6..4cc76be 100644
--- a/chrome/browser/chromeos/policy/off_hours/off_hours_proto_parser.cc
+++ b/chrome/browser/chromeos/policy/off_hours/off_hours_proto_parser.cc
@@ -37,17 +37,17 @@
container.ignored_policy_proto_tags().end());
}
-base::Optional<std::string> ExtractTimezoneFromProto(
+absl::optional<std::string> ExtractTimezoneFromProto(
const em::DeviceOffHoursProto& container) {
if (!container.has_timezone()) {
- return base::nullopt;
+ return absl::nullopt;
}
- return base::make_optional(container.timezone());
+ return absl::make_optional(container.timezone());
}
std::unique_ptr<base::DictionaryValue> ConvertOffHoursProtoToValue(
const em::DeviceOffHoursProto& container) {
- base::Optional<std::string> timezone = ExtractTimezoneFromProto(container);
+ absl::optional<std::string> timezone = ExtractTimezoneFromProto(container);
if (!timezone)
return nullptr;
auto off_hours = std::make_unique<base::DictionaryValue>();
diff --git a/chrome/browser/chromeos/policy/off_hours/off_hours_proto_parser.h b/chrome/browser/chromeos/policy/off_hours/off_hours_proto_parser.h
index 8d5caf1..adf7126 100644
--- a/chrome/browser/chromeos/policy/off_hours/off_hours_proto_parser.h
+++ b/chrome/browser/chromeos/policy/off_hours/off_hours_proto_parser.h
@@ -9,11 +9,11 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "base/values.h"
#include "chromeos/policy/weekly_time/weekly_time.h"
#include "chromeos/policy/weekly_time/weekly_time_interval.h"
#include "components/policy/proto/chrome_device_policy.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Clock;
@@ -36,7 +36,7 @@
const enterprise_management::DeviceOffHoursProto& container);
// Return timezone from DeviceOffHoursProto if exists otherwise return nullptr.
-base::Optional<std::string> ExtractTimezoneFromProto(
+absl::optional<std::string> ExtractTimezoneFromProto(
const enterprise_management::DeviceOffHoursProto& container);
// Return DictionaryValue in format:
diff --git a/chrome/browser/chromeos/policy/powerwash_requirements_checker.cc b/chrome/browser/chromeos/policy/powerwash_requirements_checker.cc
index 8fe09ad..a3e00b5 100644
--- a/chrome/browser/chromeos/policy/powerwash_requirements_checker.cc
+++ b/chrome/browser/chromeos/policy/powerwash_requirements_checker.cc
@@ -6,7 +6,6 @@
#include "ash/public/cpp/notification_utils.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
@@ -25,6 +24,7 @@
#include "chromeos/dbus/userdataauth/cryptohome_misc_client.h"
#include "components/policy/proto/chrome_device_policy.pb.h"
#include "components/vector_icons/vector_icons.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/message_center/public/cpp/notification.h"
@@ -77,7 +77,7 @@
void OnCryptohomeCheckHealth(
base::OnceClosure on_initialized_callback,
- base::Optional<user_data_auth::CheckHealthReply> reply) {
+ absl::optional<user_data_auth::CheckHealthReply> reply) {
if (!reply) {
LOG(ERROR) << "Cryptohome failed to send health state";
} else {
diff --git a/chrome/browser/chromeos/policy/powerwash_requirements_checker_unittest.cc b/chrome/browser/chromeos/policy/powerwash_requirements_checker_unittest.cc
index 1c7f8be..3274d00f 100644
--- a/chrome/browser/chromeos/policy/powerwash_requirements_checker_unittest.cc
+++ b/chrome/browser/chromeos/policy/powerwash_requirements_checker_unittest.cc
@@ -206,13 +206,13 @@
// normal one.
auto error_notification = notification_service.GetNotification(
"arc_powerwash_request_cryptohome_error");
- EXPECT_NE(base::nullopt, error_notification);
+ EXPECT_NE(absl::nullopt, error_notification);
EXPECT_THAT(base::UTF16ToUTF8(error_notification->message()),
HasSubstr("Google Play"));
auto notification = notification_service.GetNotification(
"arc_powerwash_request_instead_of_run");
- EXPECT_EQ(base::nullopt, notification);
+ EXPECT_EQ(absl::nullopt, notification);
}
SetupCryptohomeRequiresPowerwash(true);
@@ -224,11 +224,11 @@
// Cryptohome state is available. Show normal notification.
auto error_notification = notification_service.GetNotification(
"arc_powerwash_request_cryptohome_error");
- EXPECT_EQ(base::nullopt, error_notification);
+ EXPECT_EQ(absl::nullopt, error_notification);
auto notification = notification_service.GetNotification(
"arc_powerwash_request_instead_of_run");
- EXPECT_NE(base::nullopt, notification);
+ EXPECT_NE(absl::nullopt, notification);
EXPECT_THAT(base::UTF16ToUTF8(notification->message()),
HasSubstr("Google Play"));
}
@@ -252,13 +252,13 @@
// normal one.
auto error_notification = notification_service.GetNotification(
"crostini_powerwash_request_cryptohome_error");
- EXPECT_NE(base::nullopt, error_notification);
+ EXPECT_NE(absl::nullopt, error_notification);
EXPECT_THAT(base::UTF16ToUTF8(error_notification->message()),
HasSubstr("Linux"));
auto notification = notification_service.GetNotification(
"crostini_powerwash_request_instead_of_run");
- EXPECT_EQ(base::nullopt, notification);
+ EXPECT_EQ(absl::nullopt, notification);
}
SetupCryptohomeRequiresPowerwash(true);
@@ -270,11 +270,11 @@
// Cryptohome state is available. Show normal notification.
auto error_notification = notification_service.GetNotification(
"crostini_powerwash_request_cryptohome_error");
- EXPECT_EQ(base::nullopt, error_notification);
+ EXPECT_EQ(absl::nullopt, error_notification);
auto notification = notification_service.GetNotification(
"crostini_powerwash_request_instead_of_run");
- EXPECT_NE(base::nullopt, notification);
+ EXPECT_NE(absl::nullopt, notification);
EXPECT_THAT(base::UTF16ToUTF8(notification->message()), HasSubstr("Linux"));
}
}
diff --git a/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.cc b/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.cc
index 0de3d8b..5515917f 100644
--- a/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.cc
+++ b/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.cc
@@ -247,7 +247,7 @@
const std::string& message_string) {
CRD_DVLOG(1) << "Received message from CRD host: " << message_string;
- base::Optional<base::Value> message = base::JSONReader::Read(message_string);
+ absl::optional<base::Value> message = base::JSONReader::Read(message_string);
if (!message) {
OnProtocolBroken("Message is invalid JSON");
return;
@@ -369,7 +369,7 @@
}
const std::string* access_code = message.FindStringKey(remoting::kAccessCode);
- base::Optional<int> code_lifetime =
+ absl::optional<int> code_lifetime =
message.FindIntKey(remoting::kAccessCodeLifetime);
if (!access_code || !code_lifetime) {
OnProtocolBroken("Can not obtain access code");
diff --git a/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate_unittest.cc b/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate_unittest.cc
index 9e9511b5..c403baf 100644
--- a/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate_unittest.cc
+++ b/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate_unittest.cc
@@ -48,7 +48,7 @@
<< "Wrong value for key '" << key << "'";
#define EXPECT_BOOL_KEY(dictionary, key, value) \
- base::Optional<bool> value_maybe = dictionary.FindBoolKey(key); \
+ absl::optional<bool> value_maybe = dictionary.FindBoolKey(key); \
EXPECT_TRUE(value_maybe.has_value()) << "Missing key '" << key << "'"; \
EXPECT_EQ(value_maybe.value_or(false), value) \
<< "Wrong value for key '" << key << "'";
@@ -145,7 +145,7 @@
private:
std::unique_ptr<base::RunLoop> run_loop_;
- base::Optional<Type> value_;
+ absl::optional<Type> value_;
};
// Stub implementation of the |NativeMessageHost| which allows the test to wait
@@ -197,7 +197,7 @@
// Prepare the future value for our next message.
last_message_.Reset();
- base::Optional<base::Value> message = base::JSONReader::Read(message_str);
+ absl::optional<base::Value> message = base::JSONReader::Read(message_str);
if (!message) {
ADD_FAILURE() << "Malformed JSON message: " << message_str;
base::Value dummy_message(base::Value::Type::DICTIONARY);
@@ -337,9 +337,9 @@
bool HasResponse() const { return HasAccessCode() || HasError(); }
- base::Optional<std::string> access_code_;
- base::Optional<DeviceCommandStartCRDSessionJob::ResultCode> error_code_;
- base::Optional<std::string> error_message_;
+ absl::optional<std::string> access_code_;
+ absl::optional<DeviceCommandStartCRDSessionJob::ResultCode> error_code_;
+ absl::optional<std::string> error_message_;
base::RunLoop run_loop_;
base::WeakPtrFactory<Response> weak_factory_{this};
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_get_routine_update_job.cc b/chrome/browser/chromeos/policy/remote_commands/device_command_get_routine_update_job.cc
index 0b7c21b..f43a4528 100644
--- a/chrome/browser/chromeos/policy/remote_commands/device_command_get_routine_update_job.cc
+++ b/chrome/browser/chromeos/policy/remote_commands/device_command_get_routine_update_job.cc
@@ -13,12 +13,12 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/numerics/safe_conversions.h"
-#include "base/optional.h"
#include "base/syslog_logging.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
#include "chromeos/services/cros_healthd/public/cpp/service_connection.h"
#include "components/policy/proto/device_management_backend.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -135,21 +135,21 @@
bool DeviceCommandGetRoutineUpdateJob::ParseCommandPayload(
const std::string& command_payload) {
- base::Optional<base::Value> root(base::JSONReader::Read(command_payload));
+ absl::optional<base::Value> root(base::JSONReader::Read(command_payload));
if (!root.has_value())
return false;
if (!root->is_dict())
return false;
// Make sure the command payload specified a valid integer for the routine ID.
- base::Optional<int> id = root->FindIntKey(kIdFieldName);
+ absl::optional<int> id = root->FindIntKey(kIdFieldName);
if (!id.has_value())
return false;
routine_id_ = id.value();
// Make sure the command payload specified a valid
// DiagnosticRoutineCommandEnum.
- base::Optional<int> command_enum = root->FindIntKey(kCommandFieldName);
+ absl::optional<int> command_enum = root->FindIntKey(kCommandFieldName);
if (!command_enum.has_value())
return false;
if (!PopulateMojoEnumValueIfValid(command_enum.value(), &command_)) {
@@ -159,7 +159,7 @@
}
// Make sure the command payload specified a boolean for include_output.
- base::Optional<bool> include_output =
+ absl::optional<bool> include_output =
root->FindBoolKey(kIncludeOutputFieldName);
if (!include_output.has_value())
return false;
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_get_routine_update_job_unittest.cc b/chrome/browser/chromeos/policy/remote_commands/device_command_get_routine_update_job_unittest.cc
index 858802e..1c5b2de 100644
--- a/chrome/browser/chromeos/policy/remote_commands/device_command_get_routine_update_job_unittest.cc
+++ b/chrome/browser/chromeos/policy/remote_commands/device_command_get_routine_update_job_unittest.cc
@@ -8,7 +8,6 @@
#include <memory>
#include "base/json/json_writer.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
@@ -20,6 +19,7 @@
#include "chromeos/services/cros_healthd/public/mojom/cros_healthd_diagnostics.mojom.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -67,10 +67,10 @@
base::TimeDelta age_of_command,
base::TimeDelta idleness_cutoff,
bool terminate_upon_input,
- base::Optional<int32_t> id,
- base::Optional<chromeos::cros_healthd::mojom::DiagnosticRoutineCommandEnum>
+ absl::optional<int32_t> id,
+ absl::optional<chromeos::cros_healthd::mojom::DiagnosticRoutineCommandEnum>
command,
- base::Optional<bool> include_output) {
+ absl::optional<bool> include_output) {
em::RemoteCommand command_proto;
command_proto.set_type(
em::RemoteCommand_Type_DEVICE_GET_DIAGNOSTIC_ROUTINE_UPDATE);
@@ -94,7 +94,7 @@
std::string CreateInteractivePayload(
uint32_t progress_percent,
- base::Optional<std::string> output,
+ absl::optional<std::string> output,
chromeos::cros_healthd::mojom::DiagnosticRoutineUserMessageEnum
user_message) {
base::Value root_dict(base::Value::Type::DICTIONARY);
@@ -114,7 +114,7 @@
std::string CreateNonInteractivePayload(
uint32_t progress_percent,
- base::Optional<std::string> output,
+ absl::optional<std::string> output,
chromeos::cros_healthd::mojom::DiagnosticRoutineStatusEnum status,
const std::string& status_message) {
base::Value root_dict(base::Value::Type::DICTIONARY);
@@ -223,7 +223,7 @@
GenerateCommandProto(kUniqueID, base::TimeTicks::Now() - test_start_time_,
base::TimeDelta::FromSeconds(30),
/*terminate_upon_input=*/false,
- /*id=*/base::nullopt,
+ /*id=*/absl::nullopt,
chromeos::cros_healthd::mojom::
DiagnosticRoutineCommandEnum::kGetStatus,
/*include_output=*/true),
@@ -243,7 +243,7 @@
GenerateCommandProto(kUniqueID, base::TimeTicks::Now() - test_start_time_,
base::TimeDelta::FromSeconds(30),
/*terminate_upon_input=*/false,
- /*id=*/1293, /*command=*/base::nullopt,
+ /*id=*/1293, /*command=*/absl::nullopt,
/*include_output=*/true),
nullptr));
@@ -265,7 +265,7 @@
/*terminate_upon_input=*/false,
/*id=*/457658,
chromeos::cros_healthd::mojom::DiagnosticRoutineCommandEnum::kCancel,
- /*include_output=*/base::nullopt),
+ /*include_output=*/absl::nullopt),
nullptr));
EXPECT_EQ(kUniqueID, job->unique_id());
@@ -301,7 +301,7 @@
EXPECT_TRUE(payload);
// TODO(crbug.com/1056323): Verify output.
EXPECT_EQ(CreateInteractivePayload(kProgressPercent,
- /*output=*/base::nullopt,
+ /*output=*/absl::nullopt,
kUserMessage),
*payload);
run_loop.Quit();
@@ -339,7 +339,7 @@
EXPECT_TRUE(payload);
// TODO(crbug.com/1056323): Verify output.
EXPECT_EQ(CreateNonInteractivePayload(kProgressPercent,
- /*output=*/base::nullopt,
+ /*output=*/absl::nullopt,
kStatus, kStatusMessage),
*payload);
run_loop.Quit();
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_run_routine_job.cc b/chrome/browser/chromeos/policy/remote_commands/device_command_run_routine_job.cc
index ba7b602..56a1cac 100644
--- a/chrome/browser/chromeos/policy/remote_commands/device_command_run_routine_job.cc
+++ b/chrome/browser/chromeos/policy/remote_commands/device_command_run_routine_job.cc
@@ -13,12 +13,12 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/numerics/safe_conversions.h"
-#include "base/optional.h"
#include "base/syslog_logging.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
#include "chromeos/services/cros_healthd/public/cpp/service_connection.h"
#include "components/policy/proto/device_management_backend.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -105,14 +105,14 @@
bool DeviceCommandRunRoutineJob::ParseCommandPayload(
const std::string& command_payload) {
- base::Optional<base::Value> root(base::JSONReader::Read(command_payload));
+ absl::optional<base::Value> root(base::JSONReader::Read(command_payload));
if (!root.has_value())
return false;
if (!root->is_dict())
return false;
// Make sure the command payload specified a valid DiagnosticRoutineEnum.
- base::Optional<int> routine_enum = root->FindIntKey(kRoutineEnumFieldName);
+ absl::optional<int> routine_enum = root->FindIntKey(kRoutineEnumFieldName);
if (!routine_enum.has_value())
return false;
if (!PopulateMojoEnumValueIfValid(routine_enum.value(), &routine_enum_)) {
@@ -157,9 +157,9 @@
}
case chromeos::cros_healthd::mojom::DiagnosticRoutineEnum::kUrandom: {
constexpr char kLengthSecondsFieldName[] = "lengthSeconds";
- base::Optional<int> length_seconds =
+ absl::optional<int> length_seconds =
params_dict_.FindIntKey(kLengthSecondsFieldName);
- base::Optional<base::TimeDelta> routine_parameter;
+ absl::optional<base::TimeDelta> routine_parameter;
if (length_seconds.has_value()) {
// If the optional integer parameter is specified, it must be >= 0.
int value = length_seconds.value();
@@ -194,7 +194,7 @@
constexpr char kExpectedStatusFieldName[] = "expectedStatus";
// Note that expectedPowerType is an optional parameter.
constexpr char kExpectedPowerTypeFieldName[] = "expectedPowerType";
- base::Optional<int> expected_status =
+ absl::optional<int> expected_status =
params_dict_.FindIntKey(kExpectedStatusFieldName);
std::string* expected_power_type =
params_dict_.FindStringKey(kExpectedPowerTypeFieldName);
@@ -215,8 +215,8 @@
->RunAcPowerRoutine(
expected_status_enum,
expected_power_type
- ? base::Optional<std::string>(*expected_power_type)
- : base::nullopt,
+ ? absl::optional<std::string>(*expected_power_type)
+ : absl::nullopt,
base::BindOnce(
&DeviceCommandRunRoutineJob::OnCrosHealthdResponseReceived,
weak_ptr_factory_.GetWeakPtr(), std::move(succeeded_callback),
@@ -225,9 +225,9 @@
}
case chromeos::cros_healthd::mojom::DiagnosticRoutineEnum::kCpuCache: {
constexpr char kLengthSecondsFieldName[] = "lengthSeconds";
- base::Optional<int> length_seconds =
+ absl::optional<int> length_seconds =
params_dict_.FindIntKey(kLengthSecondsFieldName);
- base::Optional<base::TimeDelta> routine_duration;
+ absl::optional<base::TimeDelta> routine_duration;
if (length_seconds.has_value()) {
// If the optional integer parameter is specified, it must be >= 0.
int value = length_seconds.value();
@@ -252,9 +252,9 @@
}
case chromeos::cros_healthd::mojom::DiagnosticRoutineEnum::kCpuStress: {
constexpr char kLengthSecondsFieldName[] = "lengthSeconds";
- base::Optional<int> length_seconds =
+ absl::optional<int> length_seconds =
params_dict_.FindIntKey(kLengthSecondsFieldName);
- base::Optional<base::TimeDelta> routine_duration;
+ absl::optional<base::TimeDelta> routine_duration;
if (length_seconds.has_value()) {
// If the optional integer parameter is specified, it must be >= 0.
int value = length_seconds.value();
@@ -280,9 +280,9 @@
case chromeos::cros_healthd::mojom::DiagnosticRoutineEnum::
kFloatingPointAccuracy: {
constexpr char kLengthSecondsFieldName[] = "lengthSeconds";
- base::Optional<int> length_seconds =
+ absl::optional<int> length_seconds =
params_dict_.FindIntKey(kLengthSecondsFieldName);
- base::Optional<base::TimeDelta> routine_duration;
+ absl::optional<base::TimeDelta> routine_duration;
if (length_seconds.has_value()) {
// If the optional integer parameter is specified, it must be >= 0.
int value = length_seconds.value();
@@ -308,7 +308,7 @@
}
case chromeos::cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeWearLevel: {
constexpr char kWearLevelThresholdFieldName[] = "wearLevelThreshold";
- base::Optional<int> wear_level_threshold =
+ absl::optional<int> wear_level_threshold =
params_dict_.FindIntKey(kWearLevelThresholdFieldName);
// The NVMe wear level routine expects one integer >= 0.
if (!wear_level_threshold.has_value() ||
@@ -331,7 +331,7 @@
}
case chromeos::cros_healthd::mojom::DiagnosticRoutineEnum::kNvmeSelfTest: {
constexpr char kNvmeSelfTestTypeFieldName[] = "nvmeSelfTestType";
- base::Optional<int> nvme_self_test_type =
+ absl::optional<int> nvme_self_test_type =
params_dict_.FindIntKey(kNvmeSelfTestTypeFieldName);
chromeos::cros_healthd::mojom::NvmeSelfTestTypeEnum
nvme_self_test_type_enum;
@@ -359,10 +359,10 @@
constexpr char kTypeFieldName[] = "type";
constexpr char kLengthSecondsFieldName[] = "lengthSeconds";
constexpr char kFileSizeMbFieldName[] = "fileSizeMb";
- base::Optional<int> type = params_dict_.FindIntKey(kTypeFieldName);
- base::Optional<int> length_seconds =
+ absl::optional<int> type = params_dict_.FindIntKey(kTypeFieldName);
+ absl::optional<int> length_seconds =
params_dict_.FindIntKey(kLengthSecondsFieldName);
- base::Optional<int> file_size_mb =
+ absl::optional<int> file_size_mb =
params_dict_.FindIntKey(kFileSizeMbFieldName);
chromeos::cros_healthd::mojom::DiskReadRoutineTypeEnum type_enum;
if (!length_seconds.has_value() || length_seconds.value() < 0 ||
@@ -388,9 +388,9 @@
}
case chromeos::cros_healthd::mojom::DiagnosticRoutineEnum::kPrimeSearch: {
constexpr char kLengthSecondsFieldName[] = "lengthSeconds";
- base::Optional<int> length_seconds =
+ absl::optional<int> length_seconds =
params_dict_.FindIntKey(kLengthSecondsFieldName);
- base::Optional<base::TimeDelta> routine_duration;
+ absl::optional<base::TimeDelta> routine_duration;
if (length_seconds.has_value()) {
// If the optional integer parameter is specified, it must be >= 0.
int value = length_seconds.value();
@@ -418,9 +418,9 @@
constexpr char kLengthSecondsFieldName[] = "lengthSeconds";
constexpr char kMaximumDischargePercentAllowedFieldName[] =
"maximumDischargePercentAllowed";
- base::Optional<int> length_seconds =
+ absl::optional<int> length_seconds =
params_dict_.FindIntKey(kLengthSecondsFieldName);
- base::Optional<int> maximum_discharge_percent_allowed =
+ absl::optional<int> maximum_discharge_percent_allowed =
params_dict_.FindIntKey(kMaximumDischargePercentAllowedFieldName);
// The battery discharge routine expects two integers >= 0.
if (!length_seconds.has_value() ||
@@ -448,9 +448,9 @@
constexpr char kLengthSecondsFieldName[] = "lengthSeconds";
constexpr char kMinimumChargePercentRequiredFieldName[] =
"minimumChargePercentRequired";
- base::Optional<int> length_seconds =
+ absl::optional<int> length_seconds =
params_dict_.FindIntKey(kLengthSecondsFieldName);
- base::Optional<int> minimum_charge_percent_required =
+ absl::optional<int> minimum_charge_percent_required =
params_dict_.FindIntKey(kMinimumChargePercentRequiredFieldName);
// The battery charge routine expects two integers >= 0.
if (!length_seconds.has_value() ||
@@ -582,8 +582,8 @@
chromeos::cros_healthd::ServiceConnection::GetInstance()
->RunVideoConferencingRoutine(
stun_server_hostname
- ? base::make_optional<std::string>(*stun_server_hostname)
- : base::nullopt,
+ ? absl::make_optional<std::string>(*stun_server_hostname)
+ : absl::nullopt,
base::BindOnce(
&DeviceCommandRunRoutineJob::OnCrosHealthdResponseReceived,
weak_ptr_factory_.GetWeakPtr(), std::move(succeeded_callback),
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_run_routine_job_unittest.cc b/chrome/browser/chromeos/policy/remote_commands/device_command_run_routine_job_unittest.cc
index bbcf62e..2964a84 100644
--- a/chrome/browser/chromeos/policy/remote_commands/device_command_run_routine_job_unittest.cc
+++ b/chrome/browser/chromeos/policy/remote_commands/device_command_run_routine_job_unittest.cc
@@ -8,7 +8,6 @@
#include <memory>
#include "base/json/json_writer.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
@@ -20,6 +19,7 @@
#include "chromeos/services/cros_healthd/public/mojom/cros_healthd_diagnostics.mojom.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -87,9 +87,9 @@
base::TimeDelta age_of_command,
base::TimeDelta idleness_cutoff,
bool terminate_upon_input,
- base::Optional<chromeos::cros_healthd::mojom::DiagnosticRoutineEnum>
+ absl::optional<chromeos::cros_healthd::mojom::DiagnosticRoutineEnum>
routine,
- base::Optional<base::Value> params) {
+ absl::optional<base::Value> params) {
em::RemoteCommand command_proto;
command_proto.set_type(em::RemoteCommand_Type_DEVICE_RUN_DIAGNOSTIC_ROUTINE);
command_proto.set_command_id(unique_id);
@@ -239,7 +239,7 @@
GenerateCommandProto(kUniqueID, base::TimeTicks::Now() - test_start_time_,
base::TimeDelta::FromSeconds(30),
/*terminate_upon_input=*/false,
- /*routine=*/base::nullopt, std::move(params_dict)),
+ /*routine=*/absl::nullopt, std::move(params_dict)),
nullptr));
EXPECT_EQ(kUniqueID, job->unique_id());
@@ -257,7 +257,7 @@
GenerateCommandProto(kUniqueID, base::TimeTicks::Now() - test_start_time_,
base::TimeDelta::FromSeconds(30),
/*terminate_upon_input=*/false, kValidRoutineEnum,
- /*params=*/base::nullopt),
+ /*params=*/absl::nullopt),
nullptr));
EXPECT_EQ(kUniqueID, job->unique_id());
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_screenshot_job.cc b/chrome/browser/chromeos/policy/remote_commands/device_command_screenshot_job.cc
index 1430c27..c09ae36e 100644
--- a/chrome/browser/chromeos/policy/remote_commands/device_command_screenshot_job.cc
+++ b/chrome/browser/chromeos/policy/remote_commands/device_command_screenshot_job.cc
@@ -12,7 +12,6 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/syslog_logging.h"
@@ -22,6 +21,7 @@
#include "components/policy/proto/device_management_backend.pb.h"
#include "content/public/browser/browser_thread.h"
#include "net/http/http_request_headers.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -130,7 +130,7 @@
bool DeviceCommandScreenshotJob::ParseCommandPayload(
const std::string& command_payload) {
- base::Optional<base::Value> root(base::JSONReader::Read(command_payload));
+ absl::optional<base::Value> root(base::JSONReader::Read(command_payload));
if (!root)
return false;
base::DictionaryValue* payload = nullptr;
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_set_volume_job.cc b/chrome/browser/chromeos/policy/remote_commands/device_command_set_volume_job.cc
index 2295403..c37f3711 100644
--- a/chrome/browser/chromeos/policy/remote_commands/device_command_set_volume_job.cc
+++ b/chrome/browser/chromeos/policy/remote_commands/device_command_set_volume_job.cc
@@ -10,11 +10,11 @@
#include "ash/components/audio/cras_audio_handler.h"
#include "base/bind.h"
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "base/syslog_logging.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
#include "components/policy/proto/device_management_backend.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -35,7 +35,7 @@
bool DeviceCommandSetVolumeJob::ParseCommandPayload(
const std::string& command_payload) {
- base::Optional<base::Value> root(base::JSONReader::Read(command_payload));
+ absl::optional<base::Value> root(base::JSONReader::Read(command_payload));
if (!root)
return false;
base::DictionaryValue* payload = nullptr;
diff --git a/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.cc b/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.cc
index abb9e0e..50082a6 100644
--- a/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.cc
+++ b/chrome/browser/chromeos/policy/remote_commands/device_command_start_crd_session_job.cc
@@ -12,10 +12,10 @@
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
#include "components/policy/proto/device_management_backend.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -52,9 +52,9 @@
: public RemoteCommandJob::ResultPayload {
public:
ResultPayload(ResultCode result_code,
- const base::Optional<std::string>& access_code,
- const base::Optional<base::TimeDelta>& time_delta,
- const base::Optional<std::string>& error_message);
+ const absl::optional<std::string>& access_code,
+ const absl::optional<base::TimeDelta>& time_delta,
+ const absl::optional<std::string>& error_message);
~ResultPayload() override {}
static std::unique_ptr<ResultPayload> CreateSuccessPayload(
@@ -74,9 +74,9 @@
DeviceCommandStartCRDSessionJob::ResultPayload::ResultPayload(
ResultCode result_code,
- const base::Optional<std::string>& access_code,
- const base::Optional<base::TimeDelta>& time_delta,
- const base::Optional<std::string>& error_message) {
+ const absl::optional<std::string>& access_code,
+ const absl::optional<base::TimeDelta>& time_delta,
+ const absl::optional<std::string>& error_message) {
base::Value value(base::Value::Type::DICTIONARY);
value.SetKey(kResultCodeFieldName, base::Value(result_code));
if (error_message && !error_message.value().empty())
@@ -94,16 +94,16 @@
DeviceCommandStartCRDSessionJob::ResultPayload::CreateSuccessPayload(
const std::string& access_code) {
return std::make_unique<ResultPayload>(ResultCode::SUCCESS, access_code,
- base::nullopt /*time_delta*/,
- base::nullopt /* error_message */);
+ absl::nullopt /*time_delta*/,
+ absl::nullopt /* error_message */);
}
std::unique_ptr<DeviceCommandStartCRDSessionJob::ResultPayload>
DeviceCommandStartCRDSessionJob::ResultPayload::CreateNonIdlePayload(
const base::TimeDelta& time_delta) {
return std::make_unique<ResultPayload>(
- ResultCode::FAILURE_NOT_IDLE, base::nullopt /* access_code */, time_delta,
- base::nullopt /* error_message */);
+ ResultCode::FAILURE_NOT_IDLE, absl::nullopt /* access_code */, time_delta,
+ absl::nullopt /* error_message */);
}
std::unique_ptr<DeviceCommandStartCRDSessionJob::ResultPayload>
@@ -113,8 +113,8 @@
DCHECK(result_code != ResultCode::SUCCESS);
DCHECK(result_code != ResultCode::FAILURE_NOT_IDLE);
return std::make_unique<ResultPayload>(
- result_code, base::nullopt /* access_code */,
- base::nullopt /*time_delta*/, error_message);
+ result_code, absl::nullopt /* access_code */,
+ absl::nullopt /*time_delta*/, error_message);
}
std::unique_ptr<std::string>
@@ -135,7 +135,7 @@
bool DeviceCommandStartCRDSessionJob::ParseCommandPayload(
const std::string& command_payload) {
- base::Optional<base::Value> root(base::JSONReader::Read(command_payload));
+ absl::optional<base::Value> root(base::JSONReader::Read(command_payload));
if (!root)
return false;
if (!root->is_dict())
diff --git a/chrome/browser/chromeos/policy/rsu/lookup_key_uploader.cc b/chrome/browser/chromeos/policy/rsu/lookup_key_uploader.cc
index 75367a4..1152907 100644
--- a/chrome/browser/chromeos/policy/rsu/lookup_key_uploader.cc
+++ b/chrome/browser/chromeos/policy/rsu/lookup_key_uploader.cc
@@ -75,7 +75,7 @@
}
void LookupKeyUploader::OnRsuDeviceIdReceived(
- base::Optional<user_data_auth::GetRsuDeviceIdReply> result) {
+ absl::optional<user_data_auth::GetRsuDeviceIdReply> result) {
if (!result.has_value()) {
Result(std::string(), false /* success */);
return;
diff --git a/chrome/browser/chromeos/policy/rsu/lookup_key_uploader.h b/chrome/browser/chromeos/policy/rsu/lookup_key_uploader.h
index 1e2609b9d..b7fb714 100644
--- a/chrome/browser/chromeos/policy/rsu/lookup_key_uploader.h
+++ b/chrome/browser/chromeos/policy/rsu/lookup_key_uploader.h
@@ -10,12 +10,12 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/clock.h"
#include "base/time/time.h"
#include "chrome/browser/ash/attestation/enrollment_certificate_uploader.h"
#include "chromeos/dbus/cryptohome/UserDataAuth.pb.h"
#include "components/policy/core/common/cloud/cloud_policy_store.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefService;
@@ -52,7 +52,7 @@
void Start();
void GetDataFromCryptohome(bool available);
void OnRsuDeviceIdReceived(
- base::Optional<user_data_auth::GetRsuDeviceIdReply> result);
+ absl::optional<user_data_auth::GetRsuDeviceIdReply> result);
void HandleRsuDeviceId(const std::string& rsu_device_id);
void OnEnrollmentCertificateUploaded(
diff --git a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.cc b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.cc
index 0612f08..b0e3a0e 100644
--- a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.cc
+++ b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.cc
@@ -154,7 +154,7 @@
namespace update_checker_internal {
-base::Optional<DeviceScheduledUpdateChecker::ScheduledUpdateCheckData>
+absl::optional<DeviceScheduledUpdateChecker::ScheduledUpdateCheckData>
ParseScheduledUpdate(const base::Value& value) {
DeviceScheduledUpdateChecker::ScheduledUpdateCheckData result;
// Parse mandatory values first i.e. hour, minute and frequency of update
@@ -190,7 +190,7 @@
const std::string* day_of_week = value.FindStringKey({"day_of_week"});
if (!day_of_week) {
LOG(ERROR) << "Day of week missing";
- return base::nullopt;
+ return absl::nullopt;
}
// Validated by schema validation at higher layers.
@@ -199,10 +199,10 @@
}
case DeviceScheduledUpdateChecker::Frequency::kMonthly: {
- base::Optional<int> day_of_month = value.FindIntKey({"day_of_month"});
+ absl::optional<int> day_of_month = value.FindIntKey({"day_of_month"});
if (!day_of_month) {
LOG(ERROR) << "Day of month missing";
- return base::nullopt;
+ return absl::nullopt;
}
// Validated by schema validation at higher layers.
@@ -354,7 +354,7 @@
// Keep any old policy timers running if a new policy is ill-formed and can't
// be used to set a new timer.
- base::Optional<ScheduledUpdateCheckData> scheduled_update_check_data =
+ absl::optional<ScheduledUpdateCheckData> scheduled_update_check_data =
update_checker_internal::ParseScheduledUpdate(*value);
if (!scheduled_update_check_data) {
LOG(ERROR) << "Failed to parse policy";
@@ -536,7 +536,7 @@
void DeviceScheduledUpdateChecker::ResetState() {
update_check_timer_.reset();
- scheduled_update_check_data_ = base::nullopt;
+ scheduled_update_check_data_ = absl::nullopt;
os_and_policies_update_checker_.Stop();
start_update_check_timer_task_executor_.Stop();
}
diff --git a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.h b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.h
index aa082a3d..ae6ae6c 100644
--- a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.h
+++ b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.h
@@ -10,7 +10,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/settings/cros_settings.h"
#include "chrome/browser/chromeos/policy/scheduled_update_checker/os_and_policies_update_checker.h"
@@ -20,6 +19,7 @@
#include "chromeos/network/network_state_handler.h"
#include "chromeos/settings/timezone_settings.h"
#include "services/device/public/mojom/wake_lock.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/icu/source/i18n/unicode/calendar.h"
#include "third_party/icu/source/i18n/unicode/timezone.h"
@@ -58,11 +58,11 @@
// Only set when frequency is |kWeekly|. Corresponds to UCAL_DAY_OF_WEEK in
// icu::Calendar. Values between 1 (SUNDAY) to 7 (SATURDAY).
- base::Optional<UCalendarDaysOfWeek> day_of_week;
+ absl::optional<UCalendarDaysOfWeek> day_of_week;
// Only set when frequency is |kMonthly|. Corresponds to UCAL_DAY_OF_MONTH
// in icu::Calendar i.e. values between 1 to 31.
- base::Optional<int> day_of_month;
+ absl::optional<int> day_of_month;
// Absolute time ticks when the next update check (i.e. |UpdateCheck|) will
// happen.
@@ -133,7 +133,7 @@
base::CallbackListSubscription cros_settings_subscription_;
// Currently active scheduled update check policy.
- base::Optional<ScheduledUpdateCheckData> scheduled_update_check_data_;
+ absl::optional<ScheduledUpdateCheckData> scheduled_update_check_data_;
// Used to run and retry |StartUpdateCheckTimer| if it fails.
TaskExecutorWithRetries start_update_check_timer_task_executor_;
@@ -168,7 +168,7 @@
// Parses |value| into a |ScheduledUpdateCheckData|. Returns nullopt if there
// is any error while parsing |value|.
-base::Optional<DeviceScheduledUpdateChecker::ScheduledUpdateCheckData>
+absl::optional<DeviceScheduledUpdateChecker::ScheduledUpdateCheckData>
ParseScheduledUpdate(const base::Value& value);
// Converts an icu::Calendar to base::Time. Assumes |time| is valid.
diff --git a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker_unittest.cc b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker_unittest.cc
index f1cdfd2..d71b8de 100644
--- a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker_unittest.cc
+++ b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker_unittest.cc
@@ -1165,10 +1165,10 @@
std::move(policy_and_next_update_check_time.first));
task_environment_.FastForwardBy(delay_from_now);
- base::Optional<int> active_wake_locks_before_update_check;
+ absl::optional<int> active_wake_locks_before_update_check;
wake_lock_provider_.GetActiveWakeLocksForTests(
device::mojom::WakeLockType::kPreventAppSuspension,
- base::BindOnce([](base::Optional<int>* result,
+ base::BindOnce([](absl::optional<int>* result,
int32_t wake_lock_count) { *result = wake_lock_count; },
&active_wake_locks_before_update_check));
EXPECT_TRUE(active_wake_locks_before_update_check);
@@ -1179,10 +1179,10 @@
// Simulate update check succeeding.
NotifyUpdateCheckStatus(update_engine::Operation::UPDATED_NEED_REBOOT);
- base::Optional<int> active_wake_locks_after_update_check;
+ absl::optional<int> active_wake_locks_after_update_check;
wake_lock_provider_.GetActiveWakeLocksForTests(
device::mojom::WakeLockType::kPreventAppSuspension,
- base::BindOnce([](base::Optional<int>* result,
+ base::BindOnce([](absl::optional<int>* result,
int32_t wake_lock_count) { *result = wake_lock_count; },
&active_wake_locks_after_update_check));
// After all steps are completed the wake lock should be released.
diff --git a/chrome/browser/chromeos/policy/status_collector/activity_storage.h b/chrome/browser/chromeos/policy/status_collector/activity_storage.h
index 9627af30..441228ca 100644
--- a/chrome/browser/chromeos/policy/status_collector/activity_storage.h
+++ b/chrome/browser/chromeos/policy/status_collector/activity_storage.h
@@ -12,9 +12,9 @@
#include <vector>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "components/policy/proto/device_management_backend.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefService;
diff --git a/chrome/browser/chromeos/policy/status_collector/app_info_generator.cc b/chrome/browser/chromeos/policy/status_collector/app_info_generator.cc
index 880db60..e293060 100644
--- a/chrome/browser/chromeos/policy/status_collector/app_info_generator.cc
+++ b/chrome/browser/chromeos/policy/status_collector/app_info_generator.cc
@@ -98,11 +98,11 @@
const AppInfoGenerator::Result AppInfoGenerator::Generate() const {
if (!should_report_) {
VLOG(1) << "App usage reporting is not enabled for this user.";
- return base::nullopt;
+ return absl::nullopt;
}
if (!provider_) {
VLOG(1) << "No affiliated user session. Returning empty app list.";
- return base::nullopt;
+ return absl::nullopt;
}
auto activity_periods = provider_->activity_storage.GetActivityPeriods();
auto activity_compare = [](const em::TimePeriod& time_period1,
diff --git a/chrome/browser/chromeos/policy/status_collector/app_info_generator.h b/chrome/browser/chromeos/policy/status_collector/app_info_generator.h
index b187d061..ea139bf 100644
--- a/chrome/browser/chromeos/policy/status_collector/app_info_generator.h
+++ b/chrome/browser/chromeos/policy/status_collector/app_info_generator.h
@@ -10,13 +10,13 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "base/time/default_clock.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/chromeos/policy/status_collector/activity_storage.h"
#include "chrome/browser/chromeos/policy/status_collector/affiliated_session_service.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "components/prefs/pref_registry_simple.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -35,7 +35,7 @@
class AppInfoGenerator : public apps::InstanceRegistry::Observer,
public AffiliatedSessionService::Observer {
public:
- using Result = base::Optional<std::vector<enterprise_management::AppInfo>>;
+ using Result = absl::optional<std::vector<enterprise_management::AppInfo>>;
explicit AppInfoGenerator(
base::TimeDelta max_stored_past_activity_interval,
diff --git a/chrome/browser/chromeos/policy/status_collector/child_status_collector.cc b/chrome/browser/chromeos/policy/status_collector/child_status_collector.cc
index f327b7a..c583346 100644
--- a/chrome/browser/chromeos/policy/status_collector/child_status_collector.cc
+++ b/chrome/browser/chromeos/policy/status_collector/child_status_collector.cc
@@ -21,7 +21,6 @@
#include "base/feature_list.h"
#include "base/format_macros.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -51,6 +50,7 @@
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace {
@@ -394,7 +394,7 @@
anything_reported |= GetAppActivity(status);
if (report_boot_mode_) {
- base::Optional<std::string> boot_mode =
+ absl::optional<std::string> boot_mode =
StatusCollector::GetBootMode(statistics_provider_);
if (boot_mode) {
status->set_boot_mode(*boot_mode);
diff --git a/chrome/browser/chromeos/policy/status_collector/child_status_collector.h b/chrome/browser/chromeos/policy/status_collector/child_status_collector.h
index c253ef75..c83d2a08 100644
--- a/chrome/browser/chromeos/policy/status_collector/child_status_collector.h
+++ b/chrome/browser/chromeos/policy/status_collector/child_status_collector.h
@@ -16,7 +16,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -24,6 +23,7 @@
#include "chrome/browser/ash/child_accounts/usage_time_state_notifier.h"
#include "chrome/browser/chromeos/policy/status_collector/status_collector.h"
#include "components/policy/proto/device_management_backend.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -137,7 +137,7 @@
int64_t last_reported_end_timestamp_ = 0;
// The parameters associated with last app activity report.
- base::Optional<ash::app_time::AppActivityReportInterface::ReportParams>
+ absl::optional<ash::app_time::AppActivityReportInterface::ReportParams>
last_report_params_;
base::RepeatingTimer update_child_usage_timer_;
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc b/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc
index 3db8268..2f0dce0f 100644
--- a/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc
+++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector.cc
@@ -27,7 +27,6 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/posix/eintr_wrapper.h"
#include "base/sequenced_task_runner.h"
#include "base/stl_util.h"
@@ -103,6 +102,7 @@
#include "gpu/config/gpu_info.h"
#include "gpu/ipc/common/memory_stats.h"
#include "storage/browser/file_system/external_mount_points.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
@@ -307,20 +307,20 @@
// If |contents| contains |prefix| followed by a hex integer, parses the hex
// integer of specified length and returns it.
-// Otherwise, returns base::nullopt.
-base::Optional<int> ExtractHexIntegerAfterPrefix(base::StringPiece contents,
+// Otherwise, returns absl::nullopt.
+absl::optional<int> ExtractHexIntegerAfterPrefix(base::StringPiece contents,
base::StringPiece prefix,
size_t hex_number_length) {
size_t prefix_position = contents.find(prefix);
if (prefix_position == std::string::npos)
- return base::nullopt;
+ return absl::nullopt;
if (prefix_position + prefix.size() + hex_number_length >= contents.size())
- return base::nullopt;
+ return absl::nullopt;
int parsed_number;
if (!base::HexStringToInt(
contents.substr(prefix_position + prefix.size(), hex_number_length),
&parsed_number)) {
- return base::nullopt;
+ return absl::nullopt;
}
return parsed_number;
}
@@ -2380,7 +2380,7 @@
->GetUpdateEngineClient()
->GetLastStatus();
- base::Optional<base::Version> required_platform_version;
+ absl::optional<base::Version> required_platform_version;
if (required_platform_version_string.empty()) {
// If this is non-Kiosk session, the OS is considered as up-to-date if the
@@ -2537,7 +2537,7 @@
anything_reported |= GetVersionInfo(status);
if (report_boot_mode_) {
- base::Optional<std::string> boot_mode =
+ absl::optional<std::string> boot_mode =
StatusCollector::GetBootMode(statistics_provider_);
if (boot_mode) {
status->set_boot_mode(*boot_mode);
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc b/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc
index f1a91b8..5368506 100644
--- a/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc
+++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc
@@ -21,7 +21,6 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
@@ -104,6 +103,7 @@
#include "storage/common/file_system/file_system_types.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/aura/env.h"
#include "ui/aura/test/test_windows.h"
diff --git a/chrome/browser/chromeos/policy/status_collector/status_collector.cc b/chrome/browser/chromeos/policy/status_collector/status_collector.cc
index 0890ef2..d7410ee 100644
--- a/chrome/browser/chromeos/policy/status_collector/status_collector.cc
+++ b/chrome/browser/chromeos/policy/status_collector/status_collector.cc
@@ -82,12 +82,12 @@
}
// static
-base::Optional<std::string> StatusCollector::GetBootMode(
+absl::optional<std::string> StatusCollector::GetBootMode(
chromeos::system::StatisticsProvider* statistics_provider) {
std::string dev_switch_mode;
if (!statistics_provider->GetMachineStatistic(
chromeos::system::kDevSwitchBootKey, &dev_switch_mode)) {
- return base::nullopt;
+ return absl::nullopt;
}
if (dev_switch_mode == chromeos::system::kDevSwitchBootValueDev) {
@@ -98,7 +98,7 @@
return std::string("Verified");
}
- return base::nullopt;
+ return absl::nullopt;
}
StatusCollector::StatusCollector(chromeos::system::StatisticsProvider* provider,
diff --git a/chrome/browser/chromeos/policy/status_collector/status_collector.h b/chrome/browser/chromeos/policy/status_collector/status_collector.h
index eb25269..6f6b5f3 100644
--- a/chrome/browser/chromeos/policy/status_collector/status_collector.h
+++ b/chrome/browser/chromeos/policy/status_collector/status_collector.h
@@ -9,13 +9,13 @@
#include <string>
#include "base/callback.h"
-#include "base/optional.h"
#include "base/threading/thread_checker.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
#include "chrome/browser/ash/settings/cros_settings.h"
#include "components/policy/proto/device_management_backend.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefRegistrySimple;
class Profile;
@@ -84,7 +84,7 @@
// Simplifies filling the boot mode for any of the relevant status report
// requests.
- static base::Optional<std::string> GetBootMode(
+ static absl::optional<std::string> GetBootMode(
chromeos::system::StatisticsProvider* statistics_provider);
StatusCollector(chromeos::system::StatisticsProvider* provider,
diff --git a/chrome/browser/chromeos/policy/user_cloud_external_data_manager.cc b/chrome/browser/chromeos/policy/user_cloud_external_data_manager.cc
index bc30b74..8d7a2d0 100644
--- a/chrome/browser/chromeos/policy/user_cloud_external_data_manager.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_external_data_manager.cc
@@ -7,11 +7,11 @@
#include <memory>
#include "base/location.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "chrome/browser/chromeos/policy/cloud_external_data_store.h"
#include "components/policy/core/common/cloud/cloud_policy_store.h"
#include "components/policy/core/common/cloud/resource_cache.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -29,7 +29,7 @@
: CloudExternalDataManagerBase(get_policy_details, backend_task_runner),
resource_cache_(new ResourceCache(cache_path,
backend_task_runner,
- /* max_cache_size */ base::nullopt)) {
+ /* max_cache_size */ absl::nullopt)) {
SetPolicyStore(policy_store);
SetExternalDataStore(std::make_unique<CloudExternalDataStore>(
kCacheKey, backend_task_runner, resource_cache_));
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc
index f0efcf7..0bfa5ab3 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc
@@ -843,7 +843,7 @@
const std::string& refresh_token) {
DCHECK(!refresh_token.empty());
DCHECK(!user_context_refresh_token_for_tests_);
- user_context_refresh_token_for_tests_ = base::make_optional(refresh_token);
+ user_context_refresh_token_for_tests_ = absl::make_optional(refresh_token);
}
enterprise_reporting::ReportScheduler*
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h
index fe74ea6..9c3f33e9 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h
@@ -13,7 +13,6 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -28,6 +27,7 @@
#include "components/policy/core/common/cloud/cloud_policy_manager.h"
#include "components/policy/core/common/cloud/cloud_policy_service.h"
#include "components/session_manager/core/session_manager_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GoogleServiceAuthError;
class PrefService;
@@ -336,7 +336,7 @@
// Refresh token used in tests instead of the user context refresh token to
// fetch the policy OAuth token.
- base::Optional<std::string> user_context_refresh_token_for_tests_;
+ absl::optional<std::string> user_context_refresh_token_for_tests_;
// Used to track the reregistration state of the CloudPolicyClient, i.e.
// whether this class has triggered a re-registration after the client failed
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.cc b/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.cc
index a7310df..39c91f9 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.cc
@@ -77,11 +77,11 @@
return refresh_oauth_token_timer_ && refresh_oauth_token_timer_->IsRunning();
}
-base::Optional<base::TimeDelta>
+absl::optional<base::TimeDelta>
UserCloudPolicyTokenForwarder::GetTokenRefreshDelayForTesting() const {
return IsTokenRefreshScheduledForTesting()
? refresh_oauth_token_timer_->GetCurrentDelay()
- : base::Optional<base::TimeDelta>();
+ : absl::optional<base::TimeDelta>();
}
void UserCloudPolicyTokenForwarder::OverrideTimeForTesting(
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.h b/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.h
index 2cda2b5..b74b014 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.h
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.h
@@ -10,13 +10,13 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/policy/core/common/cloud/cloud_policy_service.h"
#include "components/signin/public/identity_manager/access_token_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "net/base/backoff_entry.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Clock;
@@ -70,7 +70,7 @@
bool IsTokenRefreshScheduledForTesting() const;
// Returns delay to next token refresh if it is scheduled.
- base::Optional<base::TimeDelta> GetTokenRefreshDelayForTesting() const;
+ absl::optional<base::TimeDelta> GetTokenRefreshDelayForTesting() const;
// Overrides elements responsible for time progression to allow testing.
// Affects time calculation and timer objects.
@@ -90,7 +90,7 @@
access_token_fetcher_;
// Last fetched OAuth token.
- base::Optional<signin::AccessTokenInfo> oauth_token_;
+ absl::optional<signin::AccessTokenInfo> oauth_token_;
// Timer that measures time to the next OAuth token refresh. Not initialized
// if token refresh is not scheduled.
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder_unittest.cc
index 6f61dad..9fd59b5 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder_unittest.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder_unittest.cc
@@ -12,7 +12,6 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
@@ -46,6 +45,7 @@
#include "net/base/backoff_entry.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
diff --git a/chrome/browser/chromeos/policy/value_validation/onc_device_policy_value_validator.cc b/chrome/browser/chromeos/policy/value_validation/onc_device_policy_value_validator.cc
index 7bd11e4e..c1e34adb 100644
--- a/chrome/browser/chromeos/policy/value_validation/onc_device_policy_value_validator.cc
+++ b/chrome/browser/chromeos/policy/value_validation/onc_device_policy_value_validator.cc
@@ -16,7 +16,7 @@
key::kDeviceOpenNetworkConfiguration,
::onc::ONCSource::ONC_SOURCE_DEVICE_POLICY) {}
-base::Optional<std::string>
+absl::optional<std::string>
ONCDevicePolicyValueValidator::GetONCStringFromPayload(
const em::ChromeDeviceSettingsProto& policy_payload) const {
if (policy_payload.has_open_network_configuration() &&
@@ -25,7 +25,7 @@
return policy_payload.open_network_configuration()
.open_network_configuration();
}
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace policy
diff --git a/chrome/browser/chromeos/policy/value_validation/onc_device_policy_value_validator.h b/chrome/browser/chromeos/policy/value_validation/onc_device_policy_value_validator.h
index a9b301d..4e5b556 100644
--- a/chrome/browser/chromeos/policy/value_validation/onc_device_policy_value_validator.h
+++ b/chrome/browser/chromeos/policy/value_validation/onc_device_policy_value_validator.h
@@ -21,7 +21,7 @@
protected:
// ONCPolicyValueValidatorBase:
- base::Optional<std::string> GetONCStringFromPayload(
+ absl::optional<std::string> GetONCStringFromPayload(
const enterprise_management::ChromeDeviceSettingsProto& policy_payload)
const override;
diff --git a/chrome/browser/chromeos/policy/value_validation/onc_policy_value_validator_base.h b/chrome/browser/chromeos/policy/value_validation/onc_policy_value_validator_base.h
index b905697..8f98d0c2 100644
--- a/chrome/browser/chromeos/policy/value_validation/onc_policy_value_validator_base.h
+++ b/chrome/browser/chromeos/policy/value_validation/onc_policy_value_validator_base.h
@@ -29,7 +29,7 @@
bool ValidateValues(
const PayloadProto& policy_payload,
std::vector<ValueValidationIssue>* out_validation_issues) const override {
- base::Optional<std::string> onc_string =
+ absl::optional<std::string> onc_string =
GetONCStringFromPayload(policy_payload);
if (!onc_string.has_value())
@@ -69,7 +69,7 @@
}
protected:
- virtual base::Optional<std::string> GetONCStringFromPayload(
+ virtual absl::optional<std::string> GetONCStringFromPayload(
const PayloadProto& policy_payload) const = 0;
private:
diff --git a/chrome/browser/chromeos/policy/value_validation/onc_user_policy_value_validator.cc b/chrome/browser/chromeos/policy/value_validation/onc_user_policy_value_validator.cc
index 01382f3..685724b 100644
--- a/chrome/browser/chromeos/policy/value_validation/onc_user_policy_value_validator.cc
+++ b/chrome/browser/chromeos/policy/value_validation/onc_user_policy_value_validator.cc
@@ -16,7 +16,7 @@
key::kOpenNetworkConfiguration,
::onc::ONCSource::ONC_SOURCE_USER_POLICY) {}
-base::Optional<std::string>
+absl::optional<std::string>
ONCUserPolicyValueValidator::GetONCStringFromPayload(
const em::CloudPolicySettings& policy_payload) const {
if (policy_payload.has_opennetworkconfiguration()) {
@@ -25,7 +25,7 @@
if (policy_proto.has_value())
return policy_proto.value();
}
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace policy
diff --git a/chrome/browser/chromeos/policy/value_validation/onc_user_policy_value_validator.h b/chrome/browser/chromeos/policy/value_validation/onc_user_policy_value_validator.h
index 8a356215..ade5b9d 100644
--- a/chrome/browser/chromeos/policy/value_validation/onc_user_policy_value_validator.h
+++ b/chrome/browser/chromeos/policy/value_validation/onc_user_policy_value_validator.h
@@ -21,7 +21,7 @@
protected:
// ONCPolicyValueValidatorBase:
- base::Optional<std::string> GetONCStringFromPayload(
+ absl::optional<std::string> GetONCStringFromPayload(
const enterprise_management::CloudPolicySettings& policy_payload)
const override;
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/adapter.cc b/chrome/browser/chromeos/power/auto_screen_brightness/adapter.cc
index 06caf36..bc336b21 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/adapter.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/adapter.cc
@@ -169,8 +169,8 @@
const auto decision_at_first_recent_user_brightness_request =
decision_at_first_recent_user_brightness_request_;
- first_recent_user_brightness_request_time_ = base::nullopt;
- decision_at_first_recent_user_brightness_request_ = base::nullopt;
+ first_recent_user_brightness_request_time_ = absl::nullopt;
+ decision_at_first_recent_user_brightness_request_ = absl::nullopt;
// We skip this notification if adapter hasn't been initialised because its
// |params_| may change. We need to log even if adapter is initialized to
@@ -194,7 +194,7 @@
*decision_at_first_recent_user_brightness_request,
old_brightness_percent, new_brightness_percent);
- const base::Optional<AlsAvgStdDev> log_als_avg_stddev =
+ const absl::optional<AlsAvgStdDev> log_als_avg_stddev =
decision_at_first_recent_user_brightness_request->log_als_avg_stddev;
const std::string log_als =
@@ -202,8 +202,8 @@
: "";
OnBrightnessChanged(
*first_recent_user_brightness_request_time, new_brightness_percent,
- log_als_avg_stddev ? base::Optional<double>(log_als_avg_stddev->avg)
- : base::nullopt);
+ log_als_avg_stddev ? absl::optional<double>(log_als_avg_stddev->avg)
+ : absl::nullopt);
}
if (!metrics_reporter_)
@@ -269,7 +269,7 @@
UpdateStatus();
}
-void Adapter::OnModelConfigLoaded(base::Optional<ModelConfig> model_config) {
+void Adapter::OnModelConfigLoaded(absl::optional<ModelConfig> model_config) {
DCHECK(!enabled_by_model_configs_.has_value());
enabled_by_model_configs_ = model_config.has_value();
@@ -320,16 +320,16 @@
!adapter_disabled_by_user_adjustment_);
}
-base::Optional<MonotoneCubicSpline> Adapter::GetGlobalCurveForTesting() const {
+absl::optional<MonotoneCubicSpline> Adapter::GetGlobalCurveForTesting() const {
return model_.global_curve;
}
-base::Optional<MonotoneCubicSpline> Adapter::GetPersonalCurveForTesting()
+absl::optional<MonotoneCubicSpline> Adapter::GetPersonalCurveForTesting()
const {
return model_.personal_curve;
}
-base::Optional<AlsAvgStdDev> Adapter::GetAverageAmbientWithStdDevForTesting(
+absl::optional<AlsAvgStdDev> Adapter::GetAverageAmbientWithStdDevForTesting(
base::TimeTicks now) {
DCHECK(log_als_values_);
return log_als_values_->AverageAmbientWithStdDev(now);
@@ -343,7 +343,7 @@
return *darkening_threshold_;
}
-base::Optional<double> Adapter::GetCurrentAvgLogAlsForTesting() const {
+absl::optional<double> Adapter::GetCurrentAvgLogAlsForTesting() const {
return average_log_ambient_lux_;
}
@@ -536,7 +536,7 @@
DCHECK(!als_init_time_.is_null());
AdapterDecision decision;
- const base::Optional<AlsAvgStdDev> log_als_avg_stddev =
+ const absl::optional<AlsAvgStdDev> log_als_avg_stddev =
log_als_values_->AverageAmbientWithStdDev(now);
decision.log_als_avg_stddev = log_als_avg_stddev;
@@ -701,7 +701,7 @@
void Adapter::OnBrightnessChanged(base::TimeTicks now,
double new_brightness_percent,
- base::Optional<double> new_log_als) {
+ absl::optional<double> new_log_als) {
DCHECK_NE(adapter_status_, Status::kInitializing);
current_brightness_ = new_brightness_percent;
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/adapter.h b/chrome/browser/chromeos/power/auto_screen_brightness/adapter.h
index c34da784..2b4c4e492 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/adapter.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/adapter.h
@@ -10,7 +10,6 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/sequenced_task_runner.h"
#include "base/time/tick_clock.h"
@@ -25,6 +24,7 @@
#include "chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline.h"
#include "chrome/browser/chromeos/power/auto_screen_brightness/utils.h"
#include "chromeos/dbus/power/power_manager_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -147,9 +147,9 @@
// |brightness_change_cause| should be non-nullopt.
// |log_als_avg_stddev| may be set even when brightness should not be
// changed. It is only nullopt if there is no ALS data in the data cache.
- base::Optional<NoBrightnessChangeCause> no_brightness_change_cause;
- base::Optional<BrightnessChangeCause> brightness_change_cause;
- base::Optional<AlsAvgStdDev> log_als_avg_stddev;
+ absl::optional<NoBrightnessChangeCause> no_brightness_change_cause;
+ absl::optional<BrightnessChangeCause> brightness_change_cause;
+ absl::optional<AlsAvgStdDev> log_als_avg_stddev;
};
Adapter(Profile* profile,
@@ -178,7 +178,7 @@
void OnModelInitialized(const Model& model) override;
// ModelConfigLoader::Observer overrides:
- void OnModelConfigLoaded(base::Optional<ModelConfig> model_config) override;
+ void OnModelConfigLoaded(absl::optional<ModelConfig> model_config) override;
// chromeos::PowerManagerClient::Observer overrides:
void PowerManagerBecameAvailable(bool service_is_ready) override;
@@ -191,17 +191,17 @@
// Only returns true if Adapter status is success and it's not disabled by
// user adjustment.
bool IsAppliedForTesting() const;
- base::Optional<MonotoneCubicSpline> GetGlobalCurveForTesting() const;
- base::Optional<MonotoneCubicSpline> GetPersonalCurveForTesting() const;
+ absl::optional<MonotoneCubicSpline> GetGlobalCurveForTesting() const;
+ absl::optional<MonotoneCubicSpline> GetPersonalCurveForTesting() const;
// Returns the average and std-dev over |log_als_values_|.
- base::Optional<AlsAvgStdDev> GetAverageAmbientWithStdDevForTesting(
+ absl::optional<AlsAvgStdDev> GetAverageAmbientWithStdDevForTesting(
base::TimeTicks now);
double GetBrighteningThresholdForTesting() const;
double GetDarkeningThresholdForTesting() const;
// Returns |average_log_ambient_lux_|.
- base::Optional<double> GetCurrentAvgLogAlsForTesting() const;
+ absl::optional<double> GetCurrentAvgLogAlsForTesting() const;
static std::unique_ptr<Adapter> CreateForTesting(
Profile* profile,
@@ -263,7 +263,7 @@
// happens.
void OnBrightnessChanged(base::TimeTicks now,
double new_brightness_percent,
- base::Optional<double> new_log_als);
+ absl::optional<double> new_log_als);
// Called by |AdjustBrightness| when brightness should be changed.
void WriteLogMessages(double new_log_als,
@@ -312,21 +312,21 @@
// log space.
std::unique_ptr<AmbientLightSampleBuffer> log_als_values_;
- base::Optional<AlsReader::AlsInitStatus> als_init_status_;
+ absl::optional<AlsReader::AlsInitStatus> als_init_status_;
// Time when AlsReader is initialized.
base::TimeTicks als_init_time_;
- base::Optional<bool> brightness_monitor_success_;
+ absl::optional<bool> brightness_monitor_success_;
// |enabled_by_model_configs_| will remain nullopt until |OnModelConfigLoaded|
// is called. Its value will then be set to true if the input model config
// exists (not nullopt), and if |InitParams| properly sets params and checks
// the model is enabled.
- base::Optional<bool> enabled_by_model_configs_;
+ absl::optional<bool> enabled_by_model_configs_;
bool model_initialized_ = false;
- base::Optional<bool> power_manager_service_available_;
+ absl::optional<bool> power_manager_service_available_;
// |adapter_status_| should only be set to |kDisabled| or |kSuccess| by
// |UpdateStatus|.
@@ -349,16 +349,16 @@
// when |OnUserBrightnessChanged| is called. We use this to ensure we only
// log the elapsed time between previous model adjustment and the 1st user
// brightness adjustment action.
- base::Optional<base::TimeTicks> first_recent_user_brightness_request_time_;
- base::Optional<AdapterDecision>
+ absl::optional<base::TimeTicks> first_recent_user_brightness_request_time_;
+ absl::optional<AdapterDecision>
decision_at_first_recent_user_brightness_request_;
int model_iteration_count_at_user_brightness_change_ = 0;
// The thresholds are calculated from the |average_log_ambient_lux_|.
// They are only updated when brightness is changed (either by user or model).
- base::Optional<double> brightening_threshold_;
- base::Optional<double> darkening_threshold_;
+ absl::optional<double> brightening_threshold_;
+ absl::optional<double> darkening_threshold_;
Model model_;
@@ -371,7 +371,7 @@
// |average_log_ambient_lux_| is only recorded when screen brightness is
// changed by either model or user. New thresholds will be calculated from it.
- base::Optional<double> average_log_ambient_lux_;
+ absl::optional<double> average_log_ambient_lux_;
// Last time brightness change occurred, either by user or model.
base::TimeTicks latest_brightness_change_time_;
@@ -381,18 +381,18 @@
// Brightness change triggered by the model. It's only unset if model changes
// brightness when there's no pior recorded brightness level.
- base::Optional<double> model_brightness_change_;
+ absl::optional<double> model_brightness_change_;
// Current recorded brightness. It can be either the user requested brightness
// or the model requested brightness.
- base::Optional<double> current_brightness_;
+ absl::optional<double> current_brightness_;
// Used to record number of model-triggered brightness changes.
int model_brightness_change_counter_ = 1;
// If lid is closed then we do not record any ambient light. If a device
// has no lid, it is considered as open.
- base::Optional<bool> is_lid_closed_;
+ absl::optional<bool> is_lid_closed_;
// Ignored ALS due to closed lid is only recorded once: the 1st time when
// ALS changes.
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/adapter_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/adapter_unittest.cc
index 2d34226..a57ff18 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/adapter_unittest.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/adapter_unittest.cc
@@ -216,7 +216,7 @@
void Init(AlsReader::AlsInitStatus als_reader_status,
BrightnessMonitor::Status brightness_monitor_status,
const Model& model,
- const base::Optional<ModelConfig>& model_config,
+ const absl::optional<ModelConfig>& model_config,
const std::map<std::string, std::string>& params,
bool brightness_set_by_policy = false) {
fake_light_provider_->set_als_init_status(als_reader_status);
@@ -289,8 +289,8 @@
std::unique_ptr<TestingProfile> profile_;
- base::Optional<MonotoneCubicSpline> global_curve_;
- base::Optional<MonotoneCubicSpline> personal_curve_;
+ absl::optional<MonotoneCubicSpline> global_curve_;
+ absl::optional<MonotoneCubicSpline> personal_curve_;
std::unique_ptr<FakeLightProvider> fake_light_provider_;
std::unique_ptr<AlsReader> als_reader_;
@@ -322,7 +322,7 @@
// AlsReader is |kDisabled| when Adapter is created.
TEST_F(AdapterTest, AlsReaderDisabledOnInit) {
Init(AlsReader::AlsInitStatus::kDisabled, BrightnessMonitor::Status::kSuccess,
- Model(global_curve_, base::nullopt, 0), GetTestModelConfig(),
+ Model(global_curve_, absl::nullopt, 0), GetTestModelConfig(),
default_params_);
EXPECT_EQ(adapter_->GetStatusForTesting(), Adapter::Status::kDisabled);
@@ -331,7 +331,7 @@
// BrightnessMonitor is |kDisabled| when Adapter is created.
TEST_F(AdapterTest, BrightnessMonitorDisabledOnInit) {
Init(AlsReader::AlsInitStatus::kSuccess, BrightnessMonitor::Status::kDisabled,
- Model(global_curve_, base::nullopt, 0), GetTestModelConfig(),
+ Model(global_curve_, absl::nullopt, 0), GetTestModelConfig(),
default_params_);
EXPECT_EQ(adapter_->GetStatusForTesting(), Adapter::Status::kDisabled);
@@ -348,7 +348,7 @@
// ModelConfigLoader has an invalid config, hence Modeller is disabled.
TEST_F(AdapterTest, ModelConfigLoaderDisabledOnInit) {
Init(AlsReader::AlsInitStatus::kSuccess, BrightnessMonitor::Status::kSuccess,
- Model(global_curve_, base::nullopt, 0), ModelConfig(), default_params_);
+ Model(global_curve_, absl::nullopt, 0), ModelConfig(), default_params_);
EXPECT_EQ(adapter_->GetStatusForTesting(), Adapter::Status::kDisabled);
}
@@ -357,7 +357,7 @@
TEST_F(AdapterTest, AlsReaderDisabledOnNotification) {
Init(AlsReader::AlsInitStatus::kInProgress,
BrightnessMonitor::Status::kSuccess,
- Model(global_curve_, base::nullopt, 0), GetTestModelConfig(),
+ Model(global_curve_, absl::nullopt, 0), GetTestModelConfig(),
default_params_);
EXPECT_EQ(adapter_->GetStatusForTesting(), Adapter::Status::kInitializing);
@@ -372,7 +372,7 @@
TEST_F(AdapterTest, AlsReaderEnabledOnNotification) {
Init(AlsReader::AlsInitStatus::kInProgress,
BrightnessMonitor::Status::kSuccess,
- Model(global_curve_, base::nullopt, 0), GetTestModelConfig(),
+ Model(global_curve_, absl::nullopt, 0), GetTestModelConfig(),
default_params_);
EXPECT_EQ(adapter_->GetStatusForTesting(), Adapter::Status::kInitializing);
@@ -391,7 +391,7 @@
TEST_F(AdapterTest, BrightnessMonitorDisabledOnNotification) {
Init(AlsReader::AlsInitStatus::kSuccess,
BrightnessMonitor::Status::kInitializing,
- Model(global_curve_, base::nullopt, 0), GetTestModelConfig(),
+ Model(global_curve_, absl::nullopt, 0), GetTestModelConfig(),
default_params_);
EXPECT_EQ(adapter_->GetStatusForTesting(), Adapter::Status::kInitializing);
@@ -405,7 +405,7 @@
TEST_F(AdapterTest, BrightnessMonitorEnabledOnNotification) {
Init(AlsReader::AlsInitStatus::kSuccess,
BrightnessMonitor::Status::kInitializing,
- Model(global_curve_, base::nullopt, 0), GetTestModelConfig(),
+ Model(global_curve_, absl::nullopt, 0), GetTestModelConfig(),
default_params_);
EXPECT_EQ(adapter_->GetStatusForTesting(), Adapter::Status::kInitializing);
@@ -457,7 +457,7 @@
// ModelConfigLoader reports an invalid config on later notification.
TEST_F(AdapterTest, InvalidModelConfigOnNotification) {
Init(AlsReader::AlsInitStatus::kSuccess, BrightnessMonitor::Status::kSuccess,
- Model(global_curve_, base::nullopt, 0), base::nullopt, default_params_);
+ Model(global_curve_, absl::nullopt, 0), absl::nullopt, default_params_);
EXPECT_EQ(adapter_->GetStatusForTesting(), Adapter::Status::kInitializing);
@@ -473,7 +473,7 @@
// ModelConfigLoader reports a valid config on later notification.
TEST_F(AdapterTest, ValidModelConfigOnNotification) {
Init(AlsReader::AlsInitStatus::kSuccess, BrightnessMonitor::Status::kSuccess,
- Model(global_curve_, base::nullopt, 0), base::nullopt, default_params_);
+ Model(global_curve_, absl::nullopt, 0), absl::nullopt, default_params_);
EXPECT_EQ(adapter_->GetStatusForTesting(), Adapter::Status::kInitializing);
@@ -586,7 +586,7 @@
EXPECT_EQ(adapter_->GetAverageAmbientWithStdDevForTesting(
task_environment_.NowTicks()),
- base::nullopt);
+ absl::nullopt);
// A new ALS value triggers a brightness change.
ForwardTimeAndReportAls({100});
@@ -703,7 +703,7 @@
histogram_tester_.ExpectUniqueSample(
"AutoScreenBrightness.MissingAlsWhenBrightnessChanged", true, 1);
- EXPECT_EQ(adapter_->GetCurrentAvgLogAlsForTesting(), base::nullopt);
+ EXPECT_EQ(adapter_->GetCurrentAvgLogAlsForTesting(), absl::nullopt);
EXPECT_EQ(adapter_->GetStatusForTesting(), Adapter::Status::kSuccess);
EXPECT_FALSE(adapter_->IsAppliedForTesting());
EXPECT_FALSE(adapter_->GetCurrentAvgLogAlsForTesting());
@@ -741,7 +741,7 @@
histogram_tester_.ExpectUniqueSample(
"AutoScreenBrightness.MissingAlsWhenBrightnessChanged", true, 1);
- EXPECT_EQ(adapter_->GetCurrentAvgLogAlsForTesting(), base::nullopt);
+ EXPECT_EQ(adapter_->GetCurrentAvgLogAlsForTesting(), absl::nullopt);
EXPECT_EQ(adapter_->GetStatusForTesting(), Adapter::Status::kSuccess);
EXPECT_TRUE(adapter_->IsAppliedForTesting());
EXPECT_FALSE(adapter_->GetCurrentAvgLogAlsForTesting());
@@ -908,7 +908,7 @@
TEST_F(AdapterTest, UseLatestCurve) {
Init(AlsReader::AlsInitStatus::kSuccess, BrightnessMonitor::Status::kSuccess,
- Model(global_curve_, base::nullopt, 0), GetTestModelConfig(),
+ Model(global_curve_, absl::nullopt, 0), GetTestModelConfig(),
default_params_);
EXPECT_EQ(adapter_->GetStatusForTesting(), Adapter::Status::kSuccess);
@@ -946,7 +946,7 @@
ForwardTimeAndReportAls({1, 2, 3, 4, 5, 6, 7, 8});
EXPECT_EQ(test_observer_.num_changes(), 0);
- EXPECT_EQ(adapter_->GetCurrentAvgLogAlsForTesting(), base::nullopt);
+ EXPECT_EQ(adapter_->GetCurrentAvgLogAlsForTesting(), absl::nullopt);
}
TEST_F(AdapterTest, FeatureDisabled) {
@@ -967,7 +967,7 @@
// No brightness is changed.
ForwardTimeAndReportAls({1, 2, 3, 4, 5, 6, 7, 8});
EXPECT_EQ(test_observer_.num_changes(), 0);
- EXPECT_EQ(adapter_->GetCurrentAvgLogAlsForTesting(), base::nullopt);
+ EXPECT_EQ(adapter_->GetCurrentAvgLogAlsForTesting(), absl::nullopt);
}
TEST_F(AdapterTest, FeatureEnabledConfigDisabled) {
@@ -987,7 +987,7 @@
// No brightness is changed.
ForwardTimeAndReportAls({1, 2, 3, 4, 5, 6, 7, 8});
EXPECT_EQ(test_observer_.num_changes(), 0);
- EXPECT_EQ(adapter_->GetCurrentAvgLogAlsForTesting(), base::nullopt);
+ EXPECT_EQ(adapter_->GetCurrentAvgLogAlsForTesting(), absl::nullopt);
}
TEST_F(AdapterTest, ValidParameters) {
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/als_samples.cc b/chrome/browser/chromeos/power/auto_screen_brightness/als_samples.cc
index 5da0cba..67784d5 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/als_samples.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/als_samples.cc
@@ -29,11 +29,11 @@
samples_.clear();
}
-base::Optional<AlsAvgStdDev> AmbientLightSampleBuffer::AverageAmbientWithStdDev(
+absl::optional<AlsAvgStdDev> AmbientLightSampleBuffer::AverageAmbientWithStdDev(
base::TimeTicks now) {
Prune(now);
if (samples_.empty())
- return base::nullopt;
+ return absl::nullopt;
const size_t count = samples_.size();
double avg = 0;
@@ -44,7 +44,7 @@
}
avg = avg / count;
- return base::Optional<AlsAvgStdDev>(
+ return absl::optional<AlsAvgStdDev>(
{avg, std::sqrt(stddev / count - avg * avg)});
}
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/als_samples.h b/chrome/browser/chromeos/power/auto_screen_brightness/als_samples.h
index 3af96a3..93f0516 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/als_samples.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/als_samples.h
@@ -8,8 +8,8 @@
#include <deque>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace power {
@@ -44,7 +44,7 @@
// Returns average and std-dev of ambient lux from the buffer (discarding
// samples that are now too old). |now| must be no earlier than any previously
// added sample. If there are no valid samples, returns nullopt.
- base::Optional<AlsAvgStdDev> AverageAmbientWithStdDev(base::TimeTicks now);
+ absl::optional<AlsAvgStdDev> AverageAmbientWithStdDev(base::TimeTicks now);
// Returns the number of recorded samples within |horizon| of the last
// observed time point. |now| must be no earlier than any previously added
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl.cc b/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl.cc
index 3c32216..4bffd5a 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl.cc
@@ -115,7 +115,7 @@
}
void BrightnessMonitorImpl::OnReceiveInitialBrightnessPercent(
- const base::Optional<double> brightness_percent) {
+ const absl::optional<double> brightness_percent) {
DCHECK_EQ(brightness_monitor_status_, Status::kInitializing);
if (brightness_percent && *brightness_percent >= 0.0 &&
@@ -161,7 +161,7 @@
}
stable_brightness_percent_ = user_brightness_percent_;
- user_brightness_percent_ = base::nullopt;
+ user_brightness_percent_ = absl::nullopt;
}
void BrightnessMonitorImpl::NotifyUserBrightnessChangeRequested() {
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl.h b/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl.h
index 0496be3..f051da1 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl.h
@@ -9,13 +9,13 @@
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/sequenced_task_runner.h"
#include "base/task_runner_util.h"
#include "base/timer/timer.h"
#include "chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor.h"
#include "chromeos/dbus/power/power_manager_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace power {
@@ -54,7 +54,7 @@
// Sets initial brightness obtained from powerd. If nullopt is received from
// powerd, the monitor status will be set to kDisabled.
void OnReceiveInitialBrightnessPercent(
- base::Optional<double> brightness_percent);
+ absl::optional<double> brightness_percent);
// Notifies its observers on the initialization status of the monitor.
void OnInitializationComplete();
@@ -94,11 +94,11 @@
// final/consolidated brightness (i.e. ignoring intermediate values selected
// by the user). If the change is not user requested, it will simply be the
// new brightness value.
- base::Optional<double> stable_brightness_percent_;
+ absl::optional<double> stable_brightness_percent_;
// Current user selected brightness. It is reset after we've collected
// final/stable user-requested brightness (i.e. after
// |brightness_sample_timer_| times out).
- base::Optional<double> user_brightness_percent_;
+ absl::optional<double> user_brightness_percent_;
base::ObserverList<BrightnessMonitor::Observer> observers_;
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl_unittest.cc
index 08892992..fa6c14c 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl_unittest.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/brightness_monitor_impl_unittest.cc
@@ -28,7 +28,7 @@
// BrightnessMonitor::Observer overrides:
void OnBrightnessMonitorInitialized(bool success) override {
- status_ = base::Optional<BrightnessMonitor::Status>(
+ status_ = absl::optional<BrightnessMonitor::Status>(
success ? BrightnessMonitor::Status::kSuccess
: BrightnessMonitor::Status::kDisabled);
}
@@ -61,7 +61,7 @@
double new_brightness_percent_ = -1;
int num_brightness_changes_ = 0;
int num_user_brightness_change_requested_ = 0;
- base::Optional<BrightnessMonitor::Status> status_;
+ absl::optional<BrightnessMonitor::Status> status_;
DISALLOW_COPY_AND_ASSIGN(TestObserver);
};
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/fake_model_config_loader.cc b/chrome/browser/chromeos/power/auto_screen_brightness/fake_model_config_loader.cc
index 863e5ac..288f34f 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/fake_model_config_loader.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/fake_model_config_loader.cc
@@ -35,8 +35,8 @@
void FakeModelConfigLoader::NotifyObserver(Observer* const observer) {
DCHECK(observer);
observer->OnModelConfigLoaded(is_model_config_valid_
- ? base::Optional<ModelConfig>(model_config_)
- : base::nullopt);
+ ? absl::optional<ModelConfig>(model_config_)
+ : absl::nullopt);
}
} // namespace auto_screen_brightness
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/fake_observer.h b/chrome/browser/chromeos/power/auto_screen_brightness/fake_observer.h
index 4161a085..86eefb0a 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/fake_observer.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/fake_observer.h
@@ -7,7 +7,7 @@
#include "chrome/browser/chromeos/power/auto_screen_brightness/als_reader.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace power {
@@ -38,7 +38,7 @@
private:
int ambient_light_ = -1;
int num_received_ambient_lights_ = 0;
- base::Optional<AlsReader::AlsInitStatus> status_;
+ absl::optional<AlsReader::AlsInitStatus> status_;
};
} // namespace auto_screen_brightness
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/gaussian_trainer.cc b/chrome/browser/chromeos/power/auto_screen_brightness/gaussian_trainer.cc
index 6762590..3c0995b 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/gaussian_trainer.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/gaussian_trainer.cc
@@ -49,7 +49,7 @@
// |is_lower_bound_exceeded| is nullopt if the new brightness is within the
// bounds.
BoundedBrightnessChange GetBoundedBrightnessChange(
- base::Optional<bool> is_lower_bound_exceeded,
+ absl::optional<bool> is_lower_bound_exceeded,
bool is_user) {
if (!is_lower_bound_exceeded.has_value()) {
if (is_user) {
@@ -130,8 +130,8 @@
const bool exceeded_lower = brightness_new < lower_bound;
const BoundedBrightnessChange change = GetBoundedBrightnessChange(
- exceeded_lower || exceeded_upper ? base::Optional<bool>(exceeded_lower)
- : base::nullopt,
+ exceeded_lower || exceeded_upper ? absl::optional<bool>(exceeded_lower)
+ : absl::nullopt,
is_user);
UMA_HISTOGRAM_ENUMERATION(
"AutoScreenBrightness.ModelTraining.BrightnessChange", change);
@@ -203,7 +203,7 @@
TrainingResult::TrainingResult() = default;
TrainingResult::TrainingResult(
- const base::Optional<MonotoneCubicSpline>& new_curve,
+ const absl::optional<MonotoneCubicSpline>& new_curve,
double error)
: new_curve(new_curve), error(error) {}
@@ -413,7 +413,7 @@
if (!need_to_update_curve_) {
const double error = CalculateCurveError(data);
LogModelCurveError(error, false /* model_updated */);
- return TrainingResult(base::nullopt, error);
+ return TrainingResult(absl::nullopt, error);
}
need_to_update_curve_ = false;
@@ -421,7 +421,7 @@
const auto new_curve = MonotoneCubicSpline::CreateMonotoneCubicSpline(
ambient_log_lux_, brightness_);
if (!new_curve) {
- return TrainingResult(base::nullopt, 0 /* error */);
+ return TrainingResult(absl::nullopt, 0 /* error */);
}
current_curve_ = new_curve;
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/gaussian_trainer.h b/chrome/browser/chromeos/power/auto_screen_brightness/gaussian_trainer.h
index d530bd4..29c626e 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/gaussian_trainer.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/gaussian_trainer.h
@@ -15,13 +15,13 @@
struct TrainingResult {
TrainingResult();
- TrainingResult(const base::Optional<MonotoneCubicSpline>& new_curve,
+ TrainingResult(const absl::optional<MonotoneCubicSpline>& new_curve,
double error);
TrainingResult(const TrainingResult& result);
~TrainingResult();
// |new_curve| will be nullopt if trainer's curve stays unchanged after
// training.
- base::Optional<MonotoneCubicSpline> new_curve;
+ absl::optional<MonotoneCubicSpline> new_curve;
// Evaluation error of the latest curve (possibly updated) using the training
// data points.
double error;
@@ -111,10 +111,10 @@
Params params_;
// |global_curve| does not change after |SetInitialCurves| is called.
- base::Optional<MonotoneCubicSpline> global_curve_;
+ absl::optional<MonotoneCubicSpline> global_curve_;
// |current_curve_| initially is set by |SetInitialCurves| and then gets
// updated during training.
- base::Optional<MonotoneCubicSpline> current_curve_;
+ absl::optional<MonotoneCubicSpline> current_curve_;
// Whether the |brightness_| has been updated since last time |Train| updated
// the curve.
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/gaussian_trainer_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/gaussian_trainer_unittest.cc
index ec3227b..7acbe59 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/gaussian_trainer_unittest.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/gaussian_trainer_unittest.cc
@@ -574,7 +574,7 @@
const MonotoneCubicSpline trained_curve =
*(gaussian_trainer_->Train({data}).new_curve);
- const base::Optional<MonotoneCubicSpline> expected_curve =
+ const absl::optional<MonotoneCubicSpline> expected_curve =
MonotoneCubicSpline::CreateMonotoneCubicSpline(
log_lux_, {3.0, 8.0, 12.48, 18.72, 24.96, 31.2, 37.44,
43.68, 49.92, 56.16, 62.4, 62.4, 62.4, 66.0,
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/light_provider_mojo.cc b/chrome/browser/chromeos/power/auto_screen_brightness/light_provider_mojo.cc
index 722bba7e..fdc51e1e 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/light_provider_mojo.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/light_provider_mojo.cc
@@ -227,7 +227,7 @@
void LightProviderMojo::GetNameLocationCallback(
int32_t id,
- const std::vector<base::Optional<std::string>>& values) {
+ const std::vector<absl::optional<std::string>>& values) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_NE(light_device_id_.value_or(-1), id);
@@ -276,7 +276,7 @@
void LightProviderMojo::GetNameCallback(
int32_t id,
- const std::vector<base::Optional<std::string>>& values) {
+ const std::vector<absl::optional<std::string>>& values) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_NE(light_device_id_.value_or(-1), id);
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/light_provider_mojo.h b/chrome/browser/chromeos/power/auto_screen_brightness/light_provider_mojo.h
index 3563ef8..40c0c87 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/light_provider_mojo.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/light_provider_mojo.h
@@ -10,7 +10,6 @@
#include <vector>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "chrome/browser/chromeos/power/auto_screen_brightness/als_reader.h"
#include "chrome/browser/chromeos/power/auto_screen_brightness/light_samples_observer.h"
@@ -18,6 +17,7 @@
#include "chromeos/components/sensors/mojom/sensor.mojom.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace power {
@@ -58,8 +58,8 @@
// Something wrong with attributes of this light sensor or simply not needed
// if true.
bool ignored = false;
- base::Optional<std::string> name;
- base::Optional<bool> on_lid;
+ absl::optional<std::string> name;
+ absl::optional<bool> on_lid;
// Temporarily stores the remote, waiting for its attributes information.
// It'll be passed to LightProviderMojo' constructor as an argument after
@@ -90,9 +90,9 @@
void RegisterLightWithId(int32_t id);
void GetNameLocationCallback(
int32_t id,
- const std::vector<base::Optional<std::string>>& values);
+ const std::vector<absl::optional<std::string>>& values);
void GetNameCallback(int32_t id,
- const std::vector<base::Optional<std::string>>& values);
+ const std::vector<absl::optional<std::string>>& values);
// Ignores the light with |id| due to some errors of it's attributes.
void IgnoreLight(int32_t id);
@@ -124,7 +124,7 @@
std::map<int32_t, LightData> lights_;
// The device id of light to be used.
- base::Optional<int32_t> light_device_id_;
+ absl::optional<int32_t> light_device_id_;
// The observer that waits for the wanted light sensor's samples and sends
// them to |als_reader_|.
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/light_provider_mojo_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/light_provider_mojo_unittest.cc
index acfbeca..b3b65e4 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/light_provider_mojo_unittest.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/light_provider_mojo_unittest.cc
@@ -56,8 +56,8 @@
}
void AddDevice(int32_t iio_device_id,
- const base::Optional<std::string> name,
- const base::Optional<std::string> location) {
+ const absl::optional<std::string> name,
+ const absl::optional<std::string> location) {
std::vector<chromeos::sensors::FakeSensorDevice::ChannelData> channels_data(
1);
channels_data[0].id = chromeos::sensors::mojom::kLightChannel;
@@ -116,7 +116,7 @@
TEST_F(LightProviderMojoTest, GetSamplesWithOneSensor) {
SetProvider(/*has_several_light_sensors=*/false);
- AddDevice(kFakeAcpiAlsId, kAcpiAlsName, base::nullopt);
+ AddDevice(kFakeAcpiAlsId, kAcpiAlsName, absl::nullopt);
StartConnection();
@@ -128,7 +128,7 @@
TEST_F(LightProviderMojoTest, AssumingAcpiAlsWithoutDeviceNameWithOneSensor) {
SetProvider(/*has_several_light_sensors=*/false);
- AddDevice(kFakeAcpiAlsId, base::nullopt, base::nullopt);
+ AddDevice(kFakeAcpiAlsId, absl::nullopt, absl::nullopt);
StartConnection();
@@ -140,8 +140,8 @@
TEST_F(LightProviderMojoTest, PreferCrosECLightWithOneSensor) {
SetProvider(/*has_several_light_sensors=*/false);
- AddDevice(kFakeAcpiAlsId, kAcpiAlsName, base::nullopt);
- AddDevice(kFakeLidLightId, kCrosECLightName, base::nullopt);
+ AddDevice(kFakeAcpiAlsId, kAcpiAlsName, absl::nullopt);
+ AddDevice(kFakeLidLightId, kCrosECLightName, absl::nullopt);
StartConnection();
@@ -173,7 +173,7 @@
TEST_F(LightProviderMojoTest, GetSamplesFromLidLightsSeveralLightSensors) {
SetProvider(/*has_several_light_sensors=*/true);
- AddDevice(kFakeAcpiAlsId, kAcpiAlsName, base::nullopt);
+ AddDevice(kFakeAcpiAlsId, kAcpiAlsName, absl::nullopt);
AddDevice(kFakeBaseLightId, kCrosECLightName,
chromeos::sensors::mojom::kLocationBase);
AddDevice(kFakeLidLightId, kCrosECLightName,
@@ -221,7 +221,7 @@
EXPECT_FALSE(fake_observer_.has_status());
- AddDevice(kFakeAcpiAlsId, kAcpiAlsName, base::nullopt);
+ AddDevice(kFakeAcpiAlsId, kAcpiAlsName, absl::nullopt);
// Wait until all tasks are done.
base::RunLoop().RunUntilIdle();
@@ -229,7 +229,7 @@
// Acpi-als is used.
CheckValues(kFakeAcpiAlsId);
- AddDevice(kFakeLidLightId, kCrosECLightName, base::nullopt);
+ AddDevice(kFakeLidLightId, kCrosECLightName, absl::nullopt);
// Wait until all tasks are done.
base::RunLoop().RunUntilIdle();
@@ -254,7 +254,7 @@
EXPECT_FALSE(fake_observer_.has_status());
- AddDevice(kFakeAcpiAlsId, kAcpiAlsName, base::nullopt);
+ AddDevice(kFakeAcpiAlsId, kAcpiAlsName, absl::nullopt);
AddDevice(kFakeBaseLightId, kCrosECLightName,
chromeos::sensors::mojom::kLocationBase);
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/light_samples_observer.h b/chrome/browser/chromeos/power/auto_screen_brightness/light_samples_observer.h
index 580b25c..4637848 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/light_samples_observer.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/light_samples_observer.h
@@ -6,12 +6,12 @@
#define CHROME_BROWSER_CHROMEOS_POWER_AUTO_SCREEN_BRIGHTNESS_LIGHT_SAMPLES_OBSERVER_H_
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "chrome/browser/chromeos/power/auto_screen_brightness/als_reader.h"
#include "chromeos/components/sensors/mojom/sensor.mojom.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace power {
@@ -59,7 +59,7 @@
receiver_{this};
// Channel index of the target channel: "illuminance".
- base::Optional<int32_t> channel_index_;
+ absl::optional<int32_t> channel_index_;
SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/metrics_reporter.h b/chrome/browser/chromeos/power/auto_screen_brightness/metrics_reporter.h
index 7570a8e6..0c81e23c 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/metrics_reporter.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/metrics_reporter.h
@@ -93,7 +93,7 @@
// Used as an index into |daily_counts_| for counting adjustments.
// Set once and then never changed during the Chrome session.
- base::Optional<DeviceClass> device_class_;
+ absl::optional<DeviceClass> device_class_;
base::ScopedObservation<PowerManagerClient, PowerManagerClient::Observer>
power_manager_client_observation_{this};
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader.h b/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader.h
index eff8ad64..e8e34a80 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_CHROMEOS_POWER_AUTO_SCREEN_BRIGHTNESS_MODEL_CONFIG_LOADER_H_
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/power/auto_screen_brightness/model_config.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace power {
@@ -29,7 +29,7 @@
// non-nullopt if a valid ModelConfig is created, either from the disk or
// from experiment flags.
virtual void OnModelConfigLoaded(
- base::Optional<ModelConfig> model_config) = 0;
+ absl::optional<ModelConfig> model_config) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(Observer);
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl.cc b/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl.cc
index b355c43..b9cd897 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl.cc
@@ -144,8 +144,8 @@
observers_.AddObserver(observer);
if (is_initialized_) {
observer->OnModelConfigLoaded(
- is_model_config_valid_ ? base::Optional<ModelConfig>(model_config_)
- : base::nullopt);
+ is_model_config_valid_ ? absl::optional<ModelConfig>(model_config_)
+ : absl::nullopt);
}
}
@@ -247,7 +247,7 @@
return;
}
- base::Optional<base::Value> value = base::JSONReader::Read(content);
+ absl::optional<base::Value> value = base::JSONReader::Read(content);
if (!value) {
InitFromParams();
return;
@@ -291,8 +291,8 @@
is_initialized_ = true;
for (auto& observer : observers_) {
observer.OnModelConfigLoaded(
- is_model_config_valid_ ? base::Optional<ModelConfig>(model_config_)
- : base::nullopt);
+ is_model_config_valid_ ? absl::optional<ModelConfig>(model_config_)
+ : absl::nullopt);
}
}
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl.h b/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl.h
index 6a501d8..ce781d6 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl.h
@@ -13,11 +13,11 @@
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observer.h"
#include "base/sequence_checker.h"
#include "chrome/browser/chromeos/power/auto_screen_brightness/model_config.h"
#include "chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace power {
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl_unittest.cc
index 2a5bf779..0a2166f7 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl_unittest.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/model_config_loader_impl_unittest.cc
@@ -33,7 +33,7 @@
~TestObserver() override = default;
// ModelConfigLoader::Observer overrides:
- void OnModelConfigLoaded(base::Optional<ModelConfig> model_config) override {
+ void OnModelConfigLoaded(absl::optional<ModelConfig> model_config) override {
model_config_loader_initialized_ = true;
model_config_ = model_config;
}
@@ -41,11 +41,11 @@
bool model_config_loader_initialized() const {
return model_config_loader_initialized_;
}
- base::Optional<ModelConfig> model_config() { return model_config_; }
+ absl::optional<ModelConfig> model_config() { return model_config_; }
private:
bool model_config_loader_initialized_ = false;
- base::Optional<ModelConfig> model_config_;
+ absl::optional<ModelConfig> model_config_;
DISALLOW_COPY_AND_ASSIGN(TestObserver);
};
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/modeller.h b/chrome/browser/chromeos/power/auto_screen_brightness/modeller.h
index 71aea74..f1df0a1 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/modeller.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/modeller.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_CHROMEOS_POWER_AUTO_SCREEN_BRIGHTNESS_MODELLER_H_
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace power {
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl.cc b/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl.cc
index c8d2e46..5480e17 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl.cc
@@ -155,8 +155,8 @@
constexpr char ModellerImpl::kModelIterationCountFileName[];
Model::Model() = default;
-Model::Model(const base::Optional<MonotoneCubicSpline>& global_curve,
- const base::Optional<MonotoneCubicSpline>& personal_curve,
+Model::Model(const absl::optional<MonotoneCubicSpline>& global_curve,
+ const absl::optional<MonotoneCubicSpline>& personal_curve,
int iteration_count)
: global_curve(global_curve),
personal_curve(personal_curve),
@@ -265,7 +265,7 @@
DCHECK(log_als_values_);
const base::TimeTicks now = tick_clock_->NowTicks();
// We don't add any training data if there is no ambient light sample.
- const base::Optional<AlsAvgStdDev> log_als_avg_stddev =
+ const absl::optional<AlsAvgStdDev> log_als_avg_stddev =
log_als_values_->AverageAmbientWithStdDev(now);
if (!log_als_avg_stddev)
return;
@@ -279,7 +279,7 @@
void ModellerImpl::OnUserBrightnessChangeRequested() {}
void ModellerImpl::OnModelConfigLoaded(
- base::Optional<ModelConfig> model_config) {
+ absl::optional<ModelConfig> model_config) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!model_config_exists_.has_value());
@@ -313,14 +313,14 @@
tick_clock, true /* is_testing */));
}
-base::Optional<double> ModellerImpl::AverageAmbientForTesting(
+absl::optional<double> ModellerImpl::AverageAmbientForTesting(
base::TimeTicks now) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(log_als_values_);
- const base::Optional<AlsAvgStdDev> log_als_avg_stddev =
+ const absl::optional<AlsAvgStdDev> log_als_avg_stddev =
log_als_values_->AverageAmbientWithStdDev(now);
if (!log_als_avg_stddev)
- return base::nullopt;
+ return absl::nullopt;
return log_als_avg_stddev->avg;
}
@@ -671,7 +671,7 @@
}
void ModellerImpl::ErasePersonalCurve() {
- model_.personal_curve = base::nullopt;
+ model_.personal_curve = absl::nullopt;
model_.iteration_count = 0;
}
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl.h b/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl.h
index a4e650b0..5f7fa00 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl.h
@@ -11,7 +11,6 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/sequence_checker.h"
#include "base/sequenced_task_runner.h"
@@ -27,6 +26,7 @@
#include "chrome/browser/chromeos/power/auto_screen_brightness/modeller.h"
#include "chrome/browser/chromeos/power/auto_screen_brightness/utils.h"
#include "chrome/browser/profiles/profile.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/user_activity/user_activity_detector.h"
#include "ui/base/user_activity/user_activity_observer.h"
@@ -36,13 +36,13 @@
struct Model {
Model();
- Model(const base::Optional<MonotoneCubicSpline>& global_curve,
- const base::Optional<MonotoneCubicSpline>& personal_curve,
+ Model(const absl::optional<MonotoneCubicSpline>& global_curve,
+ const absl::optional<MonotoneCubicSpline>& personal_curve,
int iteration_count);
Model(const Model& model);
~Model();
- base::Optional<MonotoneCubicSpline> global_curve;
- base::Optional<MonotoneCubicSpline> personal_curve;
+ absl::optional<MonotoneCubicSpline> global_curve;
+ absl::optional<MonotoneCubicSpline> personal_curve;
int iteration_count = 0;
};
@@ -95,7 +95,7 @@
void OnUserBrightnessChangeRequested() override;
// ModelConfigLoader::Observer overrides:
- void OnModelConfigLoaded(base::Optional<ModelConfig> model_config) override;
+ void OnModelConfigLoaded(absl::optional<ModelConfig> model_config) override;
// ui::UserActivityObserver overrides:
void OnUserActivity(const ui::Event* event) override;
@@ -112,7 +112,7 @@
const base::TickClock* tick_clock);
// Current average log ambient light.
- base::Optional<double> AverageAmbientForTesting(base::TimeTicks now);
+ absl::optional<double> AverageAmbientForTesting(base::TimeTicks now);
// Current number of training data points stored, which will be used for next
// training.
@@ -239,22 +239,22 @@
base::OneShotTimer model_timer_;
- base::Optional<AlsReader::AlsInitStatus> als_init_status_;
- base::Optional<bool> brightness_monitor_success_;
+ absl::optional<AlsReader::AlsInitStatus> als_init_status_;
+ absl::optional<bool> brightness_monitor_success_;
// |model_config_exists_| will remain nullopt until |OnModelConfigLoaded| is
// called. Its value will then be set to true if the input model config exists
// (not nullopt), else its value will be false.
- base::Optional<bool> model_config_exists_;
+ absl::optional<bool> model_config_exists_;
ModelConfig model_config_;
// Whether this modeller has initialized successfully, including connecting
// to AlsReader, BrightnessMonitor and loading a Trainer.
// Initially has no value. Guaranteed to have a value after the completion of
// |OnModelLoadedFromDisk|.
- base::Optional<bool> is_modeller_enabled_;
+ absl::optional<bool> is_modeller_enabled_;
- base::Optional<ModelSavingSpec> model_saving_spec_;
+ absl::optional<ModelSavingSpec> model_saving_spec_;
// Whether the initial global curve is reset to the one constructed from
// model config. It is true if there is no saved model loaded from the disk
@@ -269,7 +269,7 @@
Model model_;
// |initial_global_curve_| is constructed from model config.
- base::Optional<MonotoneCubicSpline> initial_global_curve_;
+ absl::optional<MonotoneCubicSpline> initial_global_curve_;
// Recent log ambient values.
std::unique_ptr<AmbientLightSampleBuffer> log_als_values_;
@@ -279,7 +279,7 @@
base::ObserverList<Modeller::Observer> observers_;
// Training start time.
- base::Optional<base::TimeTicks> training_start_;
+ absl::optional<base::TimeTicks> training_start_;
SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl_unittest.cc
index c2fb3008..aa21d39 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl_unittest.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/modeller_impl_unittest.cc
@@ -55,8 +55,8 @@
}
void CheckOptionalCurves(
- const base::Optional<MonotoneCubicSpline>& result_curve,
- const base::Optional<MonotoneCubicSpline>& expected_curve) {
+ const absl::optional<MonotoneCubicSpline>& result_curve,
+ const absl::optional<MonotoneCubicSpline>& expected_curve) {
EXPECT_EQ(result_curve.has_value(), expected_curve.has_value());
if (result_curve) {
EXPECT_EQ(*result_curve, *expected_curve);
@@ -105,7 +105,7 @@
TrainingResult Train(const std::vector<TrainingDataPoint>& data) override {
if (!return_new_curve_) {
- return TrainingResult(base::nullopt, curve_error_);
+ return TrainingResult(absl::nullopt, curve_error_);
}
DCHECK(is_configured_);
@@ -124,8 +124,8 @@
private:
bool is_configured_;
bool is_personal_curve_valid_;
- base::Optional<MonotoneCubicSpline> global_curve_;
- base::Optional<MonotoneCubicSpline> current_curve_;
+ absl::optional<MonotoneCubicSpline> global_curve_;
+ absl::optional<MonotoneCubicSpline> current_curve_;
bool return_new_curve_ = false;
double curve_error_ = 0.0;
@@ -149,7 +149,7 @@
model_ = model;
}
- base::Optional<MonotoneCubicSpline> personal_curve() const {
+ absl::optional<MonotoneCubicSpline> personal_curve() const {
return model_.personal_curve;
}
@@ -214,7 +214,7 @@
void Init(AlsReader::AlsInitStatus als_reader_status,
BrightnessMonitor::Status brightness_monitor_status,
- base::Optional<ModelConfig> model_config,
+ absl::optional<ModelConfig> model_config,
bool is_trainer_configured = true,
bool is_personal_curve_valid = true,
bool return_new_curve = true,
@@ -273,7 +273,7 @@
std::unique_ptr<TestingProfile> profile_;
ModelConfig test_model_config_;
- base::Optional<MonotoneCubicSpline> test_initial_global_curve_;
+ absl::optional<MonotoneCubicSpline> test_initial_global_curve_;
std::unique_ptr<FakeLightProvider> fake_light_provider_;
std::unique_ptr<AlsReader> als_reader_;
@@ -342,7 +342,7 @@
fake_light_provider_->ReportReaderInitialized();
task_environment_.RunUntilIdle();
- const Model expected_model(test_initial_global_curve_, base::nullopt, 0);
+ const Model expected_model(test_initial_global_curve_, absl::nullopt, 0);
test_observer_->CheckStatus(true /* is_model_initialized */, expected_model);
}
@@ -371,14 +371,14 @@
fake_brightness_monitor_.ReportBrightnessMonitorInitialized();
task_environment_.RunUntilIdle();
- const Model expected_model(test_initial_global_curve_, base::nullopt, 0);
+ const Model expected_model(test_initial_global_curve_, absl::nullopt, 0);
test_observer_->CheckStatus(true /* is_model_initialized */, expected_model);
}
// ModelConfigLoader reports an invalid config on later notification.
TEST_F(ModellerImplTest, InvalidModelConfigOnNotification) {
Init(AlsReader::AlsInitStatus::kSuccess, BrightnessMonitor::Status::kSuccess,
- base::nullopt /* model_config */);
+ absl::nullopt /* model_config */);
test_observer_->CheckStatus(false /* is_model_initialized */, Model());
@@ -393,7 +393,7 @@
// ModelConfigLoader reports a valid config on later notification.
TEST_F(ModellerImplTest, ValidModelConfigOnNotification) {
Init(AlsReader::AlsInitStatus::kSuccess, BrightnessMonitor::Status::kSuccess,
- base::nullopt /* model_config */);
+ absl::nullopt /* model_config */);
test_observer_->CheckStatus(false /* is_model_initialized */, Model());
@@ -401,7 +401,7 @@
fake_model_config_loader_.ReportModelConfigLoaded();
task_environment_.RunUntilIdle();
- const Model expected_model(test_initial_global_curve_, base::nullopt, 0);
+ const Model expected_model(test_initial_global_curve_, absl::nullopt, 0);
test_observer_->CheckStatus(true /* is_model_initialized */, expected_model);
}
@@ -411,7 +411,7 @@
TEST_F(ModellerImplTest, ModelLoadedFromProfilePath) {
const std::vector<double> xs = {0, 10, 20, 40, 60, 80, 90, 100};
const std::vector<double> ys = {0, 5, 10, 15, 20, 25, 30, 40};
- const base::Optional<MonotoneCubicSpline> personal_curve =
+ const absl::optional<MonotoneCubicSpline> personal_curve =
MonotoneCubicSpline::CreateMonotoneCubicSpline(xs, ys);
DCHECK(personal_curve);
@@ -437,7 +437,7 @@
TEST_F(ModellerImplTest, ModelLoadedFromProfilePathWithReset) {
const std::vector<double> xs = {0, 10, 20, 40, 60, 80, 90, 100};
const std::vector<double> ys = {0, 5, 10, 15, 20, 25, 30, 40};
- const base::Optional<MonotoneCubicSpline> saved_global_curve =
+ const absl::optional<MonotoneCubicSpline> saved_global_curve =
MonotoneCubicSpline::CreateMonotoneCubicSpline(xs, ys);
DCHECK(saved_global_curve);
@@ -450,7 +450,7 @@
Init(AlsReader::AlsInitStatus::kSuccess, BrightnessMonitor::Status::kSuccess,
test_model_config_);
- const Model expected_model(test_initial_global_curve_, base::nullopt, 0);
+ const Model expected_model(test_initial_global_curve_, absl::nullopt, 0);
test_observer_->CheckStatus(true /* is_model_initialized */, expected_model);
histogram_tester_.ExpectUniqueSample(
@@ -468,7 +468,7 @@
test_model_config_, true /* is_trainer_configured */,
false /* is_personal_curve_valid */);
- const Model expected_model(test_initial_global_curve_, base::nullopt, 0);
+ const Model expected_model(test_initial_global_curve_, absl::nullopt, 0);
test_observer_->CheckStatus(true /* is_model_initialized */, expected_model);
histogram_tester_.ExpectUniqueSample(
@@ -486,7 +486,7 @@
// No model is saved to disk, hence the initial model only has the global
// curve set from the config.
- const Model expected_model(test_initial_global_curve_, base::nullopt, 0);
+ const Model expected_model(test_initial_global_curve_, absl::nullopt, 0);
test_observer_->CheckStatus(true /* is_model_initialized */, expected_model);
EXPECT_EQ(modeller_->GetModelConfigForTesting(), test_model_config_);
@@ -525,7 +525,7 @@
0.0 /* curve_error */,
{{"training_delay_in_seconds", base::NumberToString(60)}});
- const Model expected_model(test_initial_global_curve_, base::nullopt, 0);
+ const Model expected_model(test_initial_global_curve_, absl::nullopt, 0);
test_observer_->CheckStatus(true /* is_model_initialized */, expected_model);
std::vector<TrainingDataPoint> expected_data;
@@ -564,7 +564,7 @@
EXPECT_EQ(0u, modeller_->NumberTrainingDataPointsForTesting());
EXPECT_EQ(test_observer_->iteration_count(), 1);
- const base::Optional<MonotoneCubicSpline>& result_curve =
+ const absl::optional<MonotoneCubicSpline>& result_curve =
test_observer_->personal_curve();
DCHECK(result_curve);
@@ -581,7 +581,7 @@
0.0 /* curve_error */,
{{"training_delay_in_seconds", base::NumberToString(60)}});
- const Model expected_model(test_initial_global_curve_, base::nullopt, 0);
+ const Model expected_model(test_initial_global_curve_, absl::nullopt, 0);
test_observer_->CheckStatus(true /* is_model_initialized */, expected_model);
task_environment_.FastForwardBy(base::TimeDelta::FromSeconds(1));
@@ -627,7 +627,7 @@
EXPECT_EQ(0u, modeller_->NumberTrainingDataPointsForTesting());
EXPECT_EQ(test_observer_->iteration_count(), 1);
- const base::Optional<MonotoneCubicSpline>& result_curve =
+ const absl::optional<MonotoneCubicSpline>& result_curve =
test_observer_->personal_curve();
DCHECK(result_curve);
@@ -646,7 +646,7 @@
{"training_delay_in_seconds", "0"},
});
- const Model expected_model(test_initial_global_curve_, base::nullopt, 0);
+ const Model expected_model(test_initial_global_curve_, absl::nullopt, 0);
test_observer_->CheckStatus(true /* is_model_initialized */, expected_model);
fake_light_provider_->ReportAmbientLightUpdate(30);
@@ -670,7 +670,7 @@
{"training_delay_in_seconds", "0"},
});
- const Model expected_model(test_initial_global_curve_, base::nullopt, 0);
+ const Model expected_model(test_initial_global_curve_, absl::nullopt, 0);
test_observer_->CheckStatus(true /* is_model_initialized */, expected_model);
fake_light_provider_->ReportAmbientLightUpdate(30);
@@ -693,7 +693,7 @@
{"curve_error_tolerance", "5"},
});
- const Model expected_model(test_initial_global_curve_, base::nullopt, 0);
+ const Model expected_model(test_initial_global_curve_, absl::nullopt, 0);
test_observer_->CheckStatus(true /* is_model_initialized */, expected_model);
fake_light_provider_->ReportAmbientLightUpdate(30);
@@ -716,7 +716,7 @@
{"curve_error_tolerance", "10"},
});
- const Model expected_model(test_initial_global_curve_, base::nullopt, 0);
+ const Model expected_model(test_initial_global_curve_, absl::nullopt, 0);
test_observer_->CheckStatus(true /* is_model_initialized */, expected_model);
fake_light_provider_->ReportAmbientLightUpdate(30);
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline.cc b/chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline.cc
index 1dfb8b1..b1b72bc 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline.cc
@@ -124,18 +124,18 @@
MonotoneCubicSpline::~MonotoneCubicSpline() = default;
-base::Optional<MonotoneCubicSpline> MonotoneCubicSpline::FromString(
+absl::optional<MonotoneCubicSpline> MonotoneCubicSpline::FromString(
const std::string& data) {
std::vector<double> xs;
std::vector<double> ys;
if (data.empty())
- return base::nullopt;
+ return absl::nullopt;
base::StringPairs key_value_pairs;
if (!base::SplitStringIntoKeyValuePairs(data, ',', '\n', &key_value_pairs)) {
LOG(ERROR) << "Ill-formatted spline";
- return base::nullopt;
+ return absl::nullopt;
}
for (base::StringPairs::iterator it = key_value_pairs.begin();
@@ -143,29 +143,29 @@
double x;
if (!base::StringToDouble(it->first, &x)) {
LOG(ERROR) << "Ill-formatted xs";
- return base::nullopt;
+ return absl::nullopt;
}
double y;
if (!base::StringToDouble(it->second, &y)) {
LOG(ERROR) << "Ill-formatted ys";
- return base::nullopt;
+ return absl::nullopt;
}
xs.push_back(x);
ys.push_back(y);
}
if (!IsDataValid(xs, ys))
- return base::nullopt;
+ return absl::nullopt;
return MonotoneCubicSpline(xs, ys);
}
-base::Optional<MonotoneCubicSpline>
+absl::optional<MonotoneCubicSpline>
MonotoneCubicSpline::CreateMonotoneCubicSpline(const std::vector<double>& xs,
const std::vector<double>& ys) {
if (!IsDataValid(xs, ys))
- return base::nullopt;
+ return absl::nullopt;
return MonotoneCubicSpline(xs, ys);
}
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline.h b/chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline.h
index 05cf71e..d28f896 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline.h
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline.h
@@ -8,7 +8,7 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace power {
@@ -29,12 +29,12 @@
// parsing fails. Correct formatting in |data| should be 1 row per
// (<x>, <y>) mapping, and values of xs should strictly increase per row and
// ys should be non-decreasing.
- static base::Optional<MonotoneCubicSpline> FromString(
+ static absl::optional<MonotoneCubicSpline> FromString(
const std::string& data);
// Creates a MonotoneCubicSpline if inputs are valid according to the comments
// for MonotoneCubicSpline's ctor. Otherwise returns nullopt.
- static base::Optional<MonotoneCubicSpline> CreateMonotoneCubicSpline(
+ static absl::optional<MonotoneCubicSpline> CreateMonotoneCubicSpline(
const std::vector<double>& xs,
const std::vector<double>& ys);
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline_unittest.cc b/chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline_unittest.cc
index ec24785..248077b 100644
--- a/chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline_unittest.cc
+++ b/chrome/browser/chromeos/power/auto_screen_brightness/monotone_cubic_spline_unittest.cc
@@ -20,7 +20,7 @@
100, 500, 1000, 2000, 3000};
const std::vector<double> ys = {0, 5, 10, 15, 20, 25, 30, 40, 60, 80, 1000};
- const base::Optional<MonotoneCubicSpline> spline =
+ const absl::optional<MonotoneCubicSpline> spline =
MonotoneCubicSpline::CreateMonotoneCubicSpline(xs, ys);
DCHECK(spline);
EXPECT_EQ(spline->GetControlPointsY().size(), xs.size());
@@ -67,7 +67,7 @@
std::sort(ys.begin(), ys.end());
- const base::Optional<MonotoneCubicSpline> spline =
+ const absl::optional<MonotoneCubicSpline> spline =
MonotoneCubicSpline::CreateMonotoneCubicSpline(xs, ys);
DCHECK(spline);
@@ -85,12 +85,12 @@
TEST(MonotoneCubicSpline, FromStringCorrectFormat) {
const std::string data("1,10\n2,20\n3,30");
- const base::Optional<MonotoneCubicSpline> spline_from_string =
+ const absl::optional<MonotoneCubicSpline> spline_from_string =
MonotoneCubicSpline::FromString(data);
DCHECK(spline_from_string);
const std::vector<double> xs = {1, 2, 3};
const std::vector<double> ys = {10, 20, 30};
- const base::Optional<MonotoneCubicSpline> expected_spline =
+ const absl::optional<MonotoneCubicSpline> expected_spline =
MonotoneCubicSpline::CreateMonotoneCubicSpline(xs, ys);
DCHECK(expected_spline);
EXPECT_EQ(*expected_spline, *spline_from_string);
@@ -98,7 +98,7 @@
TEST(MonotoneCubicSpline, FromStringTooFewRows) {
const std::string data("1,10");
- const base::Optional<MonotoneCubicSpline> spline_from_string =
+ const absl::optional<MonotoneCubicSpline> spline_from_string =
MonotoneCubicSpline::FromString(data);
EXPECT_FALSE(spline_from_string.has_value());
}
@@ -106,7 +106,7 @@
TEST(MonotoneCubicSpline, ToString) {
const std::vector<double> xs = {1, 2, 3};
const std::vector<double> ys = {10, 20, 30};
- const base::Optional<MonotoneCubicSpline> spline =
+ const absl::optional<MonotoneCubicSpline> spline =
MonotoneCubicSpline::CreateMonotoneCubicSpline(xs, ys);
DCHECK(spline);
const std::string string_from_spline = spline->ToString();
@@ -120,12 +120,12 @@
const std::vector<double> xs1 = {0, 10, 20, 40, 60, 80,
100, 500, 1000, 2000, 3000};
const std::vector<double> ys1 = {0, 5, 10, 15, 20, 25, 30, 40, 60, 80, 1000};
- base::Optional<MonotoneCubicSpline> spline1 =
+ absl::optional<MonotoneCubicSpline> spline1 =
MonotoneCubicSpline::CreateMonotoneCubicSpline(xs1, ys1);
const std::vector<double> xs2 = {1, 2, 3};
const std::vector<double> ys2 = {10, 20, 30};
- const base::Optional<MonotoneCubicSpline> spline2 =
+ const absl::optional<MonotoneCubicSpline> spline2 =
MonotoneCubicSpline::CreateMonotoneCubicSpline(xs2, ys2);
EXPECT_NE(*spline1, *spline2);
diff --git a/chrome/browser/chromeos/power/ml/adaptive_screen_brightness_manager.cc b/chrome/browser/chromeos/power/ml/adaptive_screen_brightness_manager.cc
index 652c231..37605a4 100644
--- a/chrome/browser/chromeos/power/ml/adaptive_screen_brightness_manager.cc
+++ b/chrome/browser/chromeos/power/ml/adaptive_screen_brightness_manager.cc
@@ -305,7 +305,7 @@
}
void AdaptiveScreenBrightnessManager::OnReceiveSwitchStates(
- const base::Optional<chromeos::PowerManagerClient::SwitchStates>
+ const absl::optional<chromeos::PowerManagerClient::SwitchStates>
switch_states) {
if (switch_states.has_value()) {
lid_state_ = switch_states->lid_state;
@@ -314,25 +314,25 @@
}
void AdaptiveScreenBrightnessManager::OnReceiveScreenBrightnessPercent(
- const base::Optional<double> screen_brightness_percent) {
+ const absl::optional<double> screen_brightness_percent) {
if (screen_brightness_percent.has_value()) {
previous_screen_brightness_percent_ = screen_brightness_percent_;
screen_brightness_percent_ = *screen_brightness_percent;
}
}
-const base::Optional<int>
+const absl::optional<int>
AdaptiveScreenBrightnessManager::GetNightLightTemperaturePercent() const {
const Profile* const profile = ProfileManager::GetActiveUserProfile();
if (!profile)
- return base::nullopt;
+ return absl::nullopt;
const PrefService* const pref_service = profile->GetPrefs();
if (!pref_service)
- return base::nullopt;
+ return absl::nullopt;
if (!pref_service->GetBoolean(ash::prefs::kNightLightEnabled))
- return base::nullopt;
+ return absl::nullopt;
return std::floor(
pref_service->GetDouble(ash::prefs::kNightLightTemperature) * 100);
}
@@ -349,7 +349,7 @@
event->set_brightness(*screen_brightness_percent_);
if (reason_.has_value()) {
event->set_reason(*reason_);
- reason_ = base::nullopt;
+ reason_ = absl::nullopt;
}
if (last_event_time_since_boot_.has_value()) {
event->set_time_since_last_event_sec(
@@ -424,7 +424,7 @@
ScreenBrightnessEvent::Features::EnvData::UNKNOWN_MODE);
}
- const base::Optional<int> temperature = GetNightLightTemperaturePercent();
+ const absl::optional<int> temperature = GetNightLightTemperaturePercent();
if (temperature.has_value()) {
features->mutable_env_data()->set_night_light_temperature_percent(
*temperature);
diff --git a/chrome/browser/chromeos/power/ml/adaptive_screen_brightness_manager.h b/chrome/browser/chromeos/power/ml/adaptive_screen_brightness_manager.h
index ab88f7d..181607a 100644
--- a/chrome/browser/chromeos/power/ml/adaptive_screen_brightness_manager.h
+++ b/chrome/browser/chromeos/power/ml/adaptive_screen_brightness_manager.h
@@ -9,9 +9,9 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(https://crbug.com/1164001): use forward declaration when moving to
// chrome/browser/ash/.
#include "chrome/browser/ash/accessibility/accessibility_manager.h"
@@ -90,15 +90,15 @@
// Updates lid state and tablet mode from received switch states.
void OnReceiveSwitchStates(
- base::Optional<chromeos::PowerManagerClient::SwitchStates> switch_states);
+ absl::optional<chromeos::PowerManagerClient::SwitchStates> switch_states);
// Updates screen brightness percent from received value.
void OnReceiveScreenBrightnessPercent(
- base::Optional<double> screen_brightness_percent);
+ absl::optional<double> screen_brightness_percent);
// Returns the night light temperature as a percentage in the range [0, 100].
// Returns nullopt when the night light is not enabled.
- const base::Optional<int> GetNightLightTemperaturePercent() const;
+ const absl::optional<int> GetNightLightTemperaturePercent() const;
void LogEvent();
@@ -132,27 +132,27 @@
chromeos::PowerManagerClient::TabletMode tablet_mode_ =
chromeos::PowerManagerClient::TabletMode::UNSUPPORTED;
- base::Optional<power_manager::PowerSupplyProperties::ExternalPower>
+ absl::optional<power_manager::PowerSupplyProperties::ExternalPower>
external_power_;
// Battery percent. This is in the range [0.0, 100.0].
- base::Optional<float> battery_percent_;
+ absl::optional<float> battery_percent_;
// Both |screen_brightness_percent_| and |previous_screen_brightness_percent_|
// are values reported directly by powerd. They are percentages as double but
// are in the range of [0, 100]. When we convert these values to the fields in
// ScreenBrightnessEvent, we cast them to ints.
- base::Optional<double> screen_brightness_percent_;
- base::Optional<double> previous_screen_brightness_percent_;
- base::Optional<base::TimeDelta> last_event_time_since_boot_;
+ absl::optional<double> screen_brightness_percent_;
+ absl::optional<double> previous_screen_brightness_percent_;
+ absl::optional<base::TimeDelta> last_event_time_since_boot_;
// The time (since boot) of the most recent active event. This is the end of
// the most recent period of activity.
- base::Optional<base::TimeDelta> last_activity_time_since_boot_;
+ absl::optional<base::TimeDelta> last_activity_time_since_boot_;
// The time (since boot) of the start of the most recent period of activity.
- base::Optional<base::TimeDelta> start_activity_time_since_boot_;
- base::Optional<bool> is_video_playing_;
- base::Optional<ScreenBrightnessEvent_Event_Reason> reason_;
+ absl::optional<base::TimeDelta> start_activity_time_since_boot_;
+ absl::optional<bool> is_video_playing_;
+ absl::optional<ScreenBrightnessEvent_Event_Reason> reason_;
base::WeakPtrFactory<AdaptiveScreenBrightnessManager> weak_ptr_factory_{this};
diff --git a/chrome/browser/chromeos/power/ml/idle_event_notifier.cc b/chrome/browser/chromeos/power/ml/idle_event_notifier.cc
index 3bc8511..8000589 100644
--- a/chrome/browser/chromeos/power/ml/idle_event_notifier.cc
+++ b/chrome/browser/chromeos/power/ml/idle_event_notifier.cc
@@ -32,12 +32,12 @@
base::Time last_user_activity_time;
TimeSinceBoot last_activity_since_boot;
- base::Optional<TimeSinceBoot> earliest_activity_since_boot;
- base::Optional<TimeSinceBoot> last_key_since_boot;
- base::Optional<TimeSinceBoot> last_mouse_since_boot;
- base::Optional<TimeSinceBoot> last_touch_since_boot;
- base::Optional<TimeSinceBoot> video_start_time;
- base::Optional<TimeSinceBoot> video_end_time;
+ absl::optional<TimeSinceBoot> earliest_activity_since_boot;
+ absl::optional<TimeSinceBoot> last_key_since_boot;
+ absl::optional<TimeSinceBoot> last_mouse_since_boot;
+ absl::optional<TimeSinceBoot> last_touch_since_boot;
+ absl::optional<TimeSinceBoot> video_start_time;
+ absl::optional<TimeSinceBoot> video_end_time;
};
IdleEventNotifier::ActivityData::ActivityData() {}
@@ -277,9 +277,9 @@
// time active, which should be reset between idle events.
void IdleEventNotifier::ResetTimestampsForRecentActivity() {
internal_data_->last_activity_since_boot = base::TimeDelta();
- internal_data_->earliest_activity_since_boot = base::nullopt;
- internal_data_->video_start_time = base::nullopt;
- internal_data_->video_end_time = base::nullopt;
+ internal_data_->earliest_activity_since_boot = absl::nullopt;
+ internal_data_->video_start_time = absl::nullopt;
+ internal_data_->video_end_time = absl::nullopt;
}
} // namespace ml
diff --git a/chrome/browser/chromeos/power/ml/idle_event_notifier.h b/chrome/browser/chromeos/power/ml/idle_event_notifier.h
index 94f53121..2bbe42e 100644
--- a/chrome/browser/chromeos/power/ml/idle_event_notifier.h
+++ b/chrome/browser/chromeos/power/ml/idle_event_notifier.h
@@ -9,7 +9,6 @@
#include "base/macros.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/power/ml/boot_clock.h"
@@ -19,6 +18,7 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "services/viz/public/mojom/compositing/video_detector_observer.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/user_activity/user_activity_detector.h"
#include "ui/base/user_activity/user_activity_observer.h"
@@ -68,7 +68,7 @@
// activity. It could be different from |last_activity_time_of_day|
// if the last activity is not a user activity (e.g. video). It is unset if
// there is no user activity before the idle event is fired.
- base::Optional<TimeOfDay> last_user_activity_time_of_day;
+ absl::optional<TimeOfDay> last_user_activity_time_of_day;
// Duration of activity up to the last activity.
base::TimeDelta recent_time_active;
@@ -76,14 +76,14 @@
// Duration from the last key/mouse/touch to the time when idle event is
// generated. It is unset if there is no key/mouse/touch activity before
// the idle event.
- base::Optional<base::TimeDelta> time_since_last_key;
- base::Optional<base::TimeDelta> time_since_last_mouse;
- base::Optional<base::TimeDelta> time_since_last_touch;
+ absl::optional<base::TimeDelta> time_since_last_key;
+ absl::optional<base::TimeDelta> time_since_last_mouse;
+ absl::optional<base::TimeDelta> time_since_last_touch;
// How long recent video has been playing.
base::TimeDelta video_playing_time;
// Duration from when video ended. It is unset if video did not play
// (|video_playing_time| = 0).
- base::Optional<base::TimeDelta> time_since_video_ended;
+ absl::optional<base::TimeDelta> time_since_video_ended;
int key_events_in_last_hour = 0;
int mouse_events_in_last_hour = 0;
@@ -153,7 +153,7 @@
user_activity_observation_{this};
// Last-received external power state. Changes are treated as user activity.
- base::Optional<power_manager::PowerSupplyProperties_ExternalPower>
+ absl::optional<power_manager::PowerSupplyProperties_ExternalPower>
external_power_;
base::ObserverList<Observer>::Unchecked observers_;
diff --git a/chrome/browser/chromeos/power/ml/smart_dim/ml_agent.cc b/chrome/browser/chromeos/power/ml/smart_dim/ml_agent.cc
index b28391e..e5ab43dd 100644
--- a/chrome/browser/chromeos/power/ml/smart_dim/ml_agent.cc
+++ b/chrome/browser/chromeos/power/ml/smart_dim/ml_agent.cc
@@ -44,7 +44,7 @@
void ExecuteCallback(const double threshold,
DimDecisionCallback decision_callback,
ExecuteResult result,
- base::Optional<std::vector<TensorPtr>> outputs) {
+ absl::optional<std::vector<TensorPtr>> outputs) {
UserActivityEvent::ModelPrediction prediction;
if (result != ExecuteResult::OK) {
diff --git a/chrome/browser/chromeos/power/ml/smart_dim/ml_agent_util.cc b/chrome/browser/chromeos/power/ml/smart_dim/ml_agent_util.cc
index 4f5023e..5563e12 100644
--- a/chrome/browser/chromeos/power/ml/smart_dim/ml_agent_util.cc
+++ b/chrome/browser/chromeos/power/ml/smart_dim/ml_agent_util.cc
@@ -8,7 +8,7 @@
#include <vector>
#include "base/logging.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace power {
@@ -52,14 +52,14 @@
const std::string* metrics_model_name_value =
root.FindStringKey("metrics_model_name");
- const base::Optional<double> dim_threshold_value =
+ const absl::optional<double> dim_threshold_value =
root.FindDoubleKey("threshold");
- const base::Optional<int> expected_feature_size_value =
+ const absl::optional<int> expected_feature_size_value =
root.FindIntKey("expected_feature_size");
if (!metrics_model_name_value || *metrics_model_name_value == "" ||
- dim_threshold_value == base::nullopt ||
- expected_feature_size_value == base::nullopt) {
+ dim_threshold_value == absl::nullopt ||
+ expected_feature_size_value == absl::nullopt) {
DVLOG(1) << "metadata_json missing expected field(s).";
return false;
}
diff --git a/chrome/browser/chromeos/power/ml/smart_dim/ml_agent_util_unittest.cc b/chrome/browser/chromeos/power/ml/smart_dim/ml_agent_util_unittest.cc
index 526e676b..4ed1c5a 100644
--- a/chrome/browser/chromeos/power/ml/smart_dim/ml_agent_util_unittest.cc
+++ b/chrome/browser/chromeos/power/ml/smart_dim/ml_agent_util_unittest.cc
@@ -40,7 +40,7 @@
base::flat_map<std::string, int> inputs;
base::flat_map<std::string, int> outputs;
- const base::Optional<base::Value> root = base::JSONReader::Read(json_string);
+ const absl::optional<base::Value> root = base::JSONReader::Read(json_string);
EXPECT_FALSE(ParseMetaInfoFromJsonObject(root.value(), &metrics_model_name,
&threshold, &expected_feature_size,
&inputs, &outputs));
@@ -62,7 +62,7 @@
base::flat_map<std::string, int> inputs;
base::flat_map<std::string, int> outputs;
- const base::Optional<base::Value> root = base::JSONReader::Read(json_string);
+ const absl::optional<base::Value> root = base::JSONReader::Read(json_string);
EXPECT_TRUE(ParseMetaInfoFromJsonObject(root.value(), &metrics_model_name,
&threshold, &expected_feature_size,
&inputs, &outputs));
diff --git a/chrome/browser/chromeos/power/ml/user_activity_manager.cc b/chrome/browser/chromeos/power/ml/user_activity_manager.cc
index b54b03a..cc32fb62 100644
--- a/chrome/browser/chromeos/power/ml/user_activity_manager.cc
+++ b/chrome/browser/chromeos/power/ml/user_activity_manager.cc
@@ -307,7 +307,7 @@
}
void UserActivityManager::OnReceiveSwitchStates(
- base::Optional<chromeos::PowerManagerClient::SwitchStates> switch_states) {
+ absl::optional<chromeos::PowerManagerClient::SwitchStates> switch_states) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (switch_states.has_value()) {
lid_state_ = switch_states->lid_state;
@@ -316,7 +316,7 @@
}
void UserActivityManager::OnReceiveInactivityDelays(
- base::Optional<power_manager::PowerManagementPolicy::Delays> delays) {
+ absl::optional<power_manager::PowerManagementPolicy::Delays> delays) {
if (delays.has_value()) {
screen_dim_delay_ =
base::TimeDelta::FromMilliseconds(delays->screen_dim_ms());
@@ -585,9 +585,9 @@
void UserActivityManager::ResetAfterLogging() {
features_.Clear();
- idle_event_start_since_boot_ = base::nullopt;
+ idle_event_start_since_boot_ = absl::nullopt;
waiting_for_final_action_ = false;
- model_prediction_ = base::nullopt;
+ model_prediction_ = absl::nullopt;
previous_idle_event_data_.reset();
}
diff --git a/chrome/browser/chromeos/power/ml/user_activity_manager.h b/chrome/browser/chromeos/power/ml/user_activity_manager.h
index 653bc989..c9e6d1b0 100644
--- a/chrome/browser/chromeos/power/ml/user_activity_manager.h
+++ b/chrome/browser/chromeos/power/ml/user_activity_manager.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_CHROMEOS_POWER_ML_USER_ACTIVITY_MANAGER_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/sequenced_task_runner.h"
#include "base/time/time.h"
@@ -26,6 +25,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/viz/public/mojom/compositing/video_detector_observer.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/aura/window.h"
#include "ui/base/user_activity/user_activity_detector.h"
#include "ui/base/user_activity/user_activity_observer.h"
@@ -128,10 +128,10 @@
// Updates lid state and tablet mode from received switch states.
void OnReceiveSwitchStates(
- base::Optional<chromeos::PowerManagerClient::SwitchStates> switch_states);
+ absl::optional<chromeos::PowerManagerClient::SwitchStates> switch_states);
void OnReceiveInactivityDelays(
- base::Optional<power_manager::PowerManagementPolicy::Delays> delays);
+ absl::optional<power_manager::PowerManagementPolicy::Delays> delays);
// Gets properties of active tab from visible focused/topmost browser.
TabProperty UpdateOpenTabURL();
@@ -158,7 +158,7 @@
// Time when an idle event is received and we start logging. Null if an idle
// event hasn't been observed.
- base::Optional<base::TimeDelta> idle_event_start_since_boot_;
+ absl::optional<base::TimeDelta> idle_event_start_since_boot_;
chromeos::PowerManagerClient::LidState lid_state_ =
chromeos::PowerManagerClient::LidState::NOT_PRESENT;
@@ -169,11 +169,11 @@
UserActivityEvent::Features::DeviceType device_type_ =
UserActivityEvent::Features::UNKNOWN_DEVICE;
- base::Optional<power_manager::PowerSupplyProperties::ExternalPower>
+ absl::optional<power_manager::PowerSupplyProperties::ExternalPower>
external_power_;
// Battery percent. This is in the range [0.0, 100.0].
- base::Optional<float> battery_percent_;
+ absl::optional<float> battery_percent_;
// Indicates whether the screen is locked.
bool screen_is_locked_ = false;
@@ -239,7 +239,7 @@
// Model prediction for the current ScreenDimImminent event. Unset if
// model prediction is disabled by an experiment.
- base::Optional<UserActivityEvent::ModelPrediction> model_prediction_;
+ absl::optional<UserActivityEvent::ModelPrediction> model_prediction_;
std::unique_ptr<PreviousIdleEventData> previous_idle_event_data_;
diff --git a/chrome/browser/chromeos/power/process_data_collector.cc b/chrome/browser/chromeos/power/process_data_collector.cc
index 4f336e9..d645593 100644
--- a/chrome/browser/chromeos/power/process_data_collector.cc
+++ b/chrome/browser/chromeos/power/process_data_collector.cc
@@ -78,7 +78,7 @@
using ProcCpuUsageAndPpid = std::pair<int64_t, pid_t>;
// Returns ARC's init PID.
-base::Optional<pid_t> GetAndroidInitPid(
+absl::optional<pid_t> GetAndroidInitPid(
const base::FilePath& android_pid_file) {
// This function does I/O and must be done on a blocking thread.
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
@@ -86,7 +86,7 @@
std::string android_pid_contents;
if (!base::ReadFileToString(android_pid_file, &android_pid_contents))
- return base::nullopt;
+ return absl::nullopt;
// This file contains a single number which contains the PID of the Android
// init PID.
@@ -94,60 +94,60 @@
base::TrimWhitespaceASCII(android_pid_contents, base::TRIM_ALL,
&android_pid_contents);
if (!base::StringToInt(android_pid_contents, &android_pid))
- return base::nullopt;
+ return absl::nullopt;
return android_pid;
}
// Calculates the total CPU time used by a single process in jiffies and its
// PPID.
-base::Optional<ProcCpuUsageAndPpid> ComputeProcCpuTimeJiffiesAndPpid(
+absl::optional<ProcCpuUsageAndPpid> ComputeProcCpuTimeJiffiesAndPpid(
const base::FilePath& proc_stat_file) {
// This function does I/O and must be done on a blocking thread.
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::MAY_BLOCK);
- base::Optional<system::SingleProcStat> stat =
+ absl::optional<system::SingleProcStat> stat =
system::GetSingleProcStat(proc_stat_file);
if (!stat.has_value())
- return base::nullopt;
+ return absl::nullopt;
return std::make_pair(stat.value().utime + stat.value().stime,
stat.value().ppid);
}
// Reads a process' name from |comm_file|, a file like "/proc/%u/comm".
-base::Optional<std::string> GetProcName(const base::FilePath& comm_file) {
+absl::optional<std::string> GetProcName(const base::FilePath& comm_file) {
// This function does I/O and must be done on a blocking thread.
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::MAY_BLOCK);
std::string comm_contents;
if (!base::ReadFileToString(comm_file, &comm_contents))
- return base::nullopt;
+ return absl::nullopt;
base::TrimWhitespaceASCII(comm_contents, base::TRIM_ALL, &comm_contents);
- return comm_contents.empty() ? base::nullopt
- : base::make_optional(comm_contents);
+ return comm_contents.empty() ? absl::nullopt
+ : absl::make_optional(comm_contents);
}
// Reads a process's command line from |cmdline|, a path like
// "/proc/%u/cmdline".
-base::Optional<std::string> GetProcCmdline(const base::FilePath& cmdline) {
+absl::optional<std::string> GetProcCmdline(const base::FilePath& cmdline) {
// This function does I/O and must be done on a blocking thread.
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::MAY_BLOCK);
std::string cmdline_contents;
if (!base::ReadFileToString(cmdline, &cmdline_contents))
- return base::nullopt;
+ return absl::nullopt;
base::TrimWhitespaceASCII(cmdline_contents, base::TRIM_ALL,
&cmdline_contents);
- return cmdline_contents.empty() ? base::nullopt
- : base::make_optional(cmdline_contents);
+ return cmdline_contents.empty() ? absl::nullopt
+ : absl::make_optional(cmdline_contents);
}
// Finds all children of a root PID recursively and stores the results in
@@ -382,11 +382,11 @@
// Don't track if either the process name or cmdline are empty or
// non-existent.
- base::Optional<std::string> proc_name = GetProcName(
+ absl::optional<std::string> proc_name = GetProcName(
base::FilePath(base::StringPrintf(config.proc_comm_fmt.c_str(), proc)));
if (!proc_name)
continue;
- base::Optional<std::string> proc_cmdline = GetProcCmdline(base::FilePath(
+ absl::optional<std::string> proc_cmdline = GetProcCmdline(base::FilePath(
base::StringPrintf(config.proc_cmdline_fmt.c_str(), proc)));
if (!proc_cmdline)
continue;
@@ -421,7 +421,7 @@
// later be calculated. Additionally, a PPID to PID map is constructed so that
// different types of processes can be classified; this is needed to classify
// ARC process for example.
- base::Optional<int64_t> total_cpu_time =
+ absl::optional<int64_t> total_cpu_time =
system::GetCpuTimeJiffies(config.total_cpu_time_path);
// If this can't be read, then the average CPU usage over this interval can't
// be calculated. Ignore these samples.
@@ -432,13 +432,13 @@
return curr_samples;
}
- base::Optional<int64_t> concierge_pid = base::nullopt;
+ absl::optional<int64_t> concierge_pid = absl::nullopt;
std::unordered_map<pid_t, int64_t> pid_to_cpu_usage_before;
std::unordered_set<uint64_t> chrome_pids;
PpidToPidMap proc_ppid_to_pid;
for (auto& sample : curr_samples) {
- base::Optional<ProcCpuUsageAndPpid> proc_cpu_time_and_ppid =
+ absl::optional<ProcCpuUsageAndPpid> proc_cpu_time_and_ppid =
ComputeProcCpuTimeJiffiesAndPpid(base::FilePath(
base::StringPrintf(config.proc_stat_fmt.c_str(), sample.first)));
@@ -468,7 +468,7 @@
}
std::unordered_set<pid_t> arc_pids;
- base::Optional<pid_t> android_init_pid =
+ absl::optional<pid_t> android_init_pid =
GetAndroidInitPid(config.android_init_pid_path);
// Compute all processes associated with ARC.
if (android_init_pid.has_value())
diff --git a/chrome/browser/chromeos/power/process_data_collector.h b/chrome/browser/chromeos/power/process_data_collector.h
index 221a4b5..29038c5 100644
--- a/chrome/browser/chromeos/power/process_data_collector.h
+++ b/chrome/browser/chromeos/power/process_data_collector.h
@@ -20,13 +20,13 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/sequenced_task_runner.h"
#include "base/synchronization/lock.h"
#include "base/timer/timer.h"
#include "chrome/browser/chromeos/power/process_data_collector.h"
#include "chromeos/dbus/power/power_manager_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/power/smart_charging/smart_charging_manager.cc b/chrome/browser/chromeos/power/smart_charging/smart_charging_manager.cc
index fcc9813..aa54daf 100644
--- a/chrome/browser/chromeos/power/smart_charging/smart_charging_manager.cc
+++ b/chrome/browser/chromeos/power/smart_charging/smart_charging_manager.cc
@@ -477,14 +477,14 @@
}
void SmartChargingManager::OnReceiveScreenBrightnessPercent(
- base::Optional<double> screen_brightness_percent) {
+ absl::optional<double> screen_brightness_percent) {
if (screen_brightness_percent.has_value()) {
screen_brightness_percent_ = *screen_brightness_percent;
}
}
void SmartChargingManager::OnReceiveSwitchStates(
- const base::Optional<chromeos::PowerManagerClient::SwitchStates>
+ const absl::optional<chromeos::PowerManagerClient::SwitchStates>
switch_states) {
if (switch_states.has_value()) {
lid_state_ = switch_states->lid_state;
diff --git a/chrome/browser/chromeos/power/smart_charging/smart_charging_manager.h b/chrome/browser/chromeos/power/smart_charging/smart_charging_manager.h
index 2d208d2..06b398ab 100644
--- a/chrome/browser/chromeos/power/smart_charging/smart_charging_manager.h
+++ b/chrome/browser/chromeos/power/smart_charging/smart_charging_manager.h
@@ -9,7 +9,6 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -22,6 +21,7 @@
#include "components/session_manager/core/session_manager_observer.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "services/viz/public/mojom/compositing/video_detector_observer.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/user_activity/user_activity_detector.h"
#include "ui/base/user_activity/user_activity_observer.h"
@@ -99,11 +99,11 @@
// Updates screen brightness percent from received value.
void OnReceiveScreenBrightnessPercent(
- base::Optional<double> screen_brightness_percent);
+ absl::optional<double> screen_brightness_percent);
// Updates lid state and tablet mode from received switch states.
void OnReceiveSwitchStates(
- base::Optional<chromeos::PowerManagerClient::SwitchStates> switch_states);
+ absl::optional<chromeos::PowerManagerClient::SwitchStates> switch_states);
// Gets amount of time of video playing recently (e.g. in the last 30
// minutes).
@@ -172,13 +172,13 @@
UserChargingEvent user_charging_event_for_test_;
std::vector<PastEvent> past_events_;
- base::Optional<double> battery_percent_;
- base::Optional<double> screen_brightness_percent_;
- base::Optional<power_manager::PowerSupplyProperties::ExternalPower>
+ absl::optional<double> battery_percent_;
+ absl::optional<double> screen_brightness_percent_;
+ absl::optional<power_manager::PowerSupplyProperties::ExternalPower>
external_power_;
- base::Optional<bool> is_charging_;
+ absl::optional<bool> is_charging_;
- base::Optional<base::FilePath> profile_path_;
+ absl::optional<base::FilePath> profile_path_;
const std::unique_ptr<SmartChargingUkmLogger> ukm_logger_;
SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/browser/chromeos/power/smart_charging/smart_charging_manager_unittest.cc b/chrome/browser/chromeos/power/smart_charging/smart_charging_manager_unittest.cc
index 5ef043e1..38fedf91 100644
--- a/chrome/browser/chromeos/power/smart_charging/smart_charging_manager_unittest.cc
+++ b/chrome/browser/chromeos/power/smart_charging/smart_charging_manager_unittest.cc
@@ -66,7 +66,7 @@
return smart_charging_manager_->user_charging_event_for_test_;
}
- base::Optional<power_manager::PowerSupplyProperties::ExternalPower>
+ absl::optional<power_manager::PowerSupplyProperties::ExternalPower>
GetExternalPower() {
return smart_charging_manager_->external_power_;
}
diff --git a/chrome/browser/chromeos/printing/automatic_usb_printer_configurer_unittest.cc b/chrome/browser/chromeos/printing/automatic_usb_printer_configurer_unittest.cc
index 8c24442..93d3244 100644
--- a/chrome/browser/chromeos/printing/automatic_usb_printer_configurer_unittest.cc
+++ b/chrome/browser/chromeos/printing/automatic_usb_printer_configurer_unittest.cc
@@ -9,12 +9,12 @@
#include <vector>
#include "base/containers/flat_set.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/printing/cups_printers_manager.h"
#include "chrome/browser/chromeos/printing/printers_map.h"
#include "chrome/browser/chromeos/printing/test_printer_configurer.h"
#include "chrome/browser/chromeos/printing/usb_printer_notification_controller.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace {
diff --git a/chrome/browser/chromeos/printing/cups_print_job_manager_impl.cc b/chrome/browser/chromeos/printing/cups_print_job_manager_impl.cc
index 027c7fd..1a9a461 100644
--- a/chrome/browser/chromeos/printing/cups_print_job_manager_impl.cc
+++ b/chrome/browser/chromeos/printing/cups_print_job_manager_impl.cc
@@ -14,7 +14,6 @@
#include "base/compiler_specific.h"
#include "base/containers/contains.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task_runner_util.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -38,6 +37,7 @@
#include "content/public/browser/notification_service.h"
#include "printing/printed_document.h"
#include "printing/printing_utils.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
@@ -274,7 +274,7 @@
return false;
}
- base::Optional<Printer> printer = manager->GetPrinter(printer_id);
+ absl::optional<Printer> printer = manager->GetPrinter(printer_id);
if (!printer) {
LOG(WARNING)
<< "Printer was removed while job was in progress. It cannot "
diff --git a/chrome/browser/chromeos/printing/cups_print_job_notification.cc b/chrome/browser/chromeos/printing/cups_print_job_notification.cc
index 31b510b..1a663f2 100644
--- a/chrome/browser/chromeos/printing/cups_print_job_notification.cc
+++ b/chrome/browser/chromeos/printing/cups_print_job_notification.cc
@@ -112,8 +112,8 @@
}
void CupsPrintJobNotification::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
// If we are in guest mode then we need to use the OffTheRecord profile to
// open the Print Manageament App. There is a check in Browser::Browser
// that only OffTheRecord profiles can open browser windows in guest mode.
diff --git a/chrome/browser/chromeos/printing/cups_print_job_notification.h b/chrome/browser/chromeos/printing/cups_print_job_notification.h
index 7698ac7..431a028 100644
--- a/chrome/browser/chromeos/printing/cups_print_job_notification.h
+++ b/chrome/browser/chromeos/printing/cups_print_job_notification.h
@@ -39,8 +39,8 @@
// message_center::NotificationObserver
void Close(bool by_user) override;
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
private:
// Update the notification based on the print job's status.
diff --git a/chrome/browser/chromeos/printing/cups_printers_manager.cc b/chrome/browser/chromeos/printing/cups_printers_manager.cc
index 7fadfbc..5116f53 100644
--- a/chrome/browser/chromeos/printing/cups_printers_manager.cc
+++ b/chrome/browser/chromeos/printing/cups_printers_manager.cc
@@ -11,7 +11,6 @@
#include "base/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/sequence_checker.h"
#include "base/strings/stringprintf.h"
@@ -48,6 +47,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "printing/printer_query_result.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -219,7 +219,7 @@
}
// Public API function.
- base::Optional<Printer> GetPrinter(const std::string& id) const override {
+ absl::optional<Printer> GetPrinter(const std::string& id) const override {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_);
if (!user_printers_allowed_.GetValue()) {
LOG(WARNING) << "UserPrintersAllowed is disabled - only searching "
@@ -312,7 +312,7 @@
void FetchPrinterStatus(const std::string& printer_id,
PrinterStatusCallback cb) override {
- base::Optional<Printer> printer = GetPrinter(printer_id);
+ absl::optional<Printer> printer = GetPrinter(printer_id);
if (!printer) {
PRINTER_LOG(ERROR) << "Unable to complete printer status request. "
<< "Printer not found. Printer id: " << printer_id;
@@ -458,7 +458,7 @@
}
private:
- base::Optional<Printer> GetEnterprisePrinter(const std::string& id) const {
+ absl::optional<Printer> GetEnterprisePrinter(const std::string& id) const {
return printers_.Get(PrinterClass::kEnterprise, id);
}
diff --git a/chrome/browser/chromeos/printing/cups_printers_manager.h b/chrome/browser/chromeos/printing/cups_printers_manager.h
index 2cf0533..1a73f647 100644
--- a/chrome/browser/chromeos/printing/cups_printers_manager.h
+++ b/chrome/browser/chromeos/printing/cups_printers_manager.h
@@ -109,8 +109,8 @@
void PrinterIsNotAutoconfigurable(const Printer& printer) override = 0;
// Look for a printer with the given id in any class. Returns a copy of the
- // printer if found, base::nullopt if not found.
- virtual base::Optional<Printer> GetPrinter(const std::string& id) const = 0;
+ // printer if found, absl::nullopt if not found.
+ virtual absl::optional<Printer> GetPrinter(const std::string& id) const = 0;
// Log an event that the user started trying to set up the given printer,
// but setup was not completed for some reason.
diff --git a/chrome/browser/chromeos/printing/cups_printers_manager_unittest.cc b/chrome/browser/chromeos/printing/cups_printers_manager_unittest.cc
index 0d5ae9b7..6fa4fb9 100644
--- a/chrome/browser/chromeos/printing/cups_printers_manager_unittest.cc
+++ b/chrome/browser/chromeos/printing/cups_printers_manager_unittest.cc
@@ -626,12 +626,12 @@
for (const std::string& id :
{"Saved", "Enterprise", "Discovered", "Automatic"}) {
- base::Optional<Printer> printer = manager_->GetPrinter(id);
+ absl::optional<Printer> printer = manager_->GetPrinter(id);
ASSERT_TRUE(printer);
EXPECT_EQ(printer->id(), id);
}
- base::Optional<Printer> printer = manager_->GetPrinter("Nope");
+ absl::optional<Printer> printer = manager_->GetPrinter("Nope");
EXPECT_FALSE(printer);
}
@@ -727,10 +727,10 @@
// Disable the use of non-enterprise printers.
UpdatePolicyValue(prefs::kUserPrintersAllowed, false);
- base::Optional<Printer> saved_printer = manager_->GetPrinter("Saved");
+ absl::optional<Printer> saved_printer = manager_->GetPrinter("Saved");
EXPECT_FALSE(saved_printer);
- base::Optional<Printer> enterprise_printer =
+ absl::optional<Printer> enterprise_printer =
manager_->GetPrinter("Enterprise");
ASSERT_TRUE(enterprise_printer);
EXPECT_EQ(enterprise_printer->id(), "Enterprise");
diff --git a/chrome/browser/chromeos/printing/cups_proxy_service_delegate_impl.cc b/chrome/browser/chromeos/printing/cups_proxy_service_delegate_impl.cc
index 37e78f35..33997ec6 100644
--- a/chrome/browser/chromeos/printing/cups_proxy_service_delegate_impl.cc
+++ b/chrome/browser/chromeos/printing/cups_proxy_service_delegate_impl.cc
@@ -36,7 +36,7 @@
prefs->GetBoolean(plugin_vm::prefs::kPluginVmPrintersAllowed);
}
-base::Optional<Printer> CupsProxyServiceDelegateImpl::GetPrinter(
+absl::optional<Printer> CupsProxyServiceDelegateImpl::GetPrinter(
const std::string& id) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return printers_manager_->GetPrinter(id);
diff --git a/chrome/browser/chromeos/printing/cups_proxy_service_delegate_impl.h b/chrome/browser/chromeos/printing/cups_proxy_service_delegate_impl.h
index f2073bc0..e915c70e 100644
--- a/chrome/browser/chromeos/printing/cups_proxy_service_delegate_impl.h
+++ b/chrome/browser/chromeos/printing/cups_proxy_service_delegate_impl.h
@@ -37,7 +37,7 @@
// Look for a printer with the given id in any class. Returns a copy of the
// printer if found, nullptr otherwise.
- base::Optional<Printer> GetPrinter(const std::string& id) override;
+ absl::optional<Printer> GetPrinter(const std::string& id) override;
// Get the currently known list of printers.
std::vector<Printer> GetPrinters(PrinterClass printer_class) override;
diff --git a/chrome/browser/chromeos/printing/enterprise_printers_provider.cc b/chrome/browser/chromeos/printing/enterprise_printers_provider.cc
index 5dc542c..f6bb1af6 100644
--- a/chrome/browser/chromeos/printing/enterprise_printers_provider.cc
+++ b/chrome/browser/chromeos/printing/enterprise_printers_provider.cc
@@ -130,7 +130,7 @@
recommended_printers_.clear();
std::vector<std::string> data = FromPrefs(prefs::kRecommendedPrinters);
for (const auto& printer_json : data) {
- base::Optional<base::Value> printer_dictionary = base::JSONReader::Read(
+ absl::optional<base::Value> printer_dictionary = base::JSONReader::Read(
printer_json, base::JSON_ALLOW_TRAILING_COMMAS);
if (!printer_dictionary.has_value() ||
!printer_dictionary.value().is_dict()) {
diff --git a/chrome/browser/chromeos/printing/enterprise_printers_provider_unittest.cc b/chrome/browser/chromeos/printing/enterprise_printers_provider_unittest.cc
index 7c06577..73f0c9f 100644
--- a/chrome/browser/chromeos/printing/enterprise_printers_provider_unittest.cc
+++ b/chrome/browser/chromeos/printing/enterprise_printers_provider_unittest.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/debug/dump_without_crashing.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/strings/string_util.h"
@@ -26,6 +25,7 @@
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/printing/history/print_job_info_proto_conversions.cc b/chrome/browser/chromeos/printing/history/print_job_info_proto_conversions.cc
index 8d6099f..93738e93 100644
--- a/chrome/browser/chromeos/printing/history/print_job_info_proto_conversions.cc
+++ b/chrome/browser/chromeos/printing/history/print_job_info_proto_conversions.cc
@@ -6,9 +6,9 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/chromeos/printing/printer_error_codes.h"
#include "printing/mojom/print.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -18,7 +18,7 @@
proto::PrintSettings_ColorMode ColorModelToProto(
::printing::mojom::ColorModel color) {
- base::Optional<bool> is_color = ::printing::IsColorModelSelected(color);
+ absl::optional<bool> is_color = ::printing::IsColorModelSelected(color);
return is_color.value() ? proto::PrintSettings_ColorMode_COLOR
: proto::PrintSettings_ColorMode_BLACK_AND_WHITE;
}
diff --git a/chrome/browser/chromeos/printing/print_servers_manager.cc b/chrome/browser/chromeos/printing/print_servers_manager.cc
index 24c9a42..fb0d6909 100644
--- a/chrome/browser/chromeos/printing/print_servers_manager.cc
+++ b/chrome/browser/chromeos/printing/print_servers_manager.cc
@@ -11,7 +11,6 @@
#include "base/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observer.h"
#include "chrome/browser/chromeos/printing/cups_printer_status_creator.h"
#include "chrome/browser/chromeos/printing/enterprise_printers_provider.h"
@@ -42,6 +41,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "printing/printer_query_result.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -166,7 +166,7 @@
ServerPrintersFetchingMode fetching_mode_;
- base::Optional<std::map<std::string, PrintServer>> print_servers_;
+ absl::optional<std::map<std::string, PrintServer>> print_servers_;
PrintServersConfig config_;
diff --git a/chrome/browser/chromeos/printing/print_servers_manager_unittest.cc b/chrome/browser/chromeos/printing/print_servers_manager_unittest.cc
index 43be6077..78264c51 100644
--- a/chrome/browser/chromeos/printing/print_servers_manager_unittest.cc
+++ b/chrome/browser/chromeos/printing/print_servers_manager_unittest.cc
@@ -69,11 +69,11 @@
const std::string& allowlist_pref) override {}
void ClearData() override {}
- base::Optional<std::vector<PrintServer>> GetPrintServers() override {
+ absl::optional<std::vector<PrintServer>> GetPrintServers() override {
return print_servers_;
}
- void SetPrintServers(base::Optional<std::vector<PrintServer>> print_servers) {
+ void SetPrintServers(absl::optional<std::vector<PrintServer>> print_servers) {
print_servers_ = print_servers;
if (observer_) {
observer_->OnServersChanged(print_servers.has_value(),
@@ -82,7 +82,7 @@
}
private:
- base::Optional<std::vector<PrintServer>> print_servers_;
+ absl::optional<std::vector<PrintServer>> print_servers_;
PrintServersProvider::Observer* observer_;
};
diff --git a/chrome/browser/chromeos/printing/print_servers_provider.cc b/chrome/browser/chromeos/printing/print_servers_provider.cc
index 5150aa7b..45ec044 100644
--- a/chrome/browser/chromeos/printing/print_servers_provider.cc
+++ b/chrome/browser/chromeos/printing/print_servers_provider.cc
@@ -182,8 +182,8 @@
}
}
- base::Optional<std::vector<PrintServer>> GetPrintServers() override {
- return IsCompleted() ? base::make_optional(result_servers_) : base::nullopt;
+ absl::optional<std::vector<PrintServer>> GetPrintServers() override {
+ return IsCompleted() ? absl::make_optional(result_servers_) : absl::nullopt;
}
void AddObserver(PrintServersProvider::Observer* observer) override {
@@ -242,7 +242,7 @@
// Called when a new allowlist is available.
void UpdateAllowlist() {
- allowlist_ = base::nullopt;
+ allowlist_ = absl::nullopt;
// Fetch and parse the allowlist.
const PrefService::Preference* pref =
prefs_->FindPreference(allowlist_pref_);
@@ -319,7 +319,7 @@
// The current input list of servers.
std::vector<PrintServer> servers_;
// The current allowlist.
- base::Optional<std::set<std::string>> allowlist_ = base::nullopt;
+ absl::optional<std::set<std::string>> allowlist_ = absl::nullopt;
// The current resultant list of servers.
std::vector<PrintServer> result_servers_;
diff --git a/chrome/browser/chromeos/printing/print_servers_provider.h b/chrome/browser/chromeos/printing/print_servers_provider.h
index 063620f..c89252a 100644
--- a/chrome/browser/chromeos/printing/print_servers_provider.h
+++ b/chrome/browser/chromeos/printing/print_servers_provider.h
@@ -65,7 +65,7 @@
// Returns the list of all print servers given from the data provided in
// SetData(...) and limited by the allowlist.
- virtual base::Optional<std::vector<PrintServer>> GetPrintServers() = 0;
+ virtual absl::optional<std::vector<PrintServer>> GetPrintServers() = 0;
protected:
PrintServersProvider() = default;
diff --git a/chrome/browser/chromeos/printing/printer_setup_util.cc b/chrome/browser/chromeos/printing/printer_setup_util.cc
index 87dc537..a78c7fe 100644
--- a/chrome/browser/chromeos/printing/printer_setup_util.cc
+++ b/chrome/browser/chromeos/printing/printer_setup_util.cc
@@ -13,7 +13,6 @@
#include "base/callback_helpers.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
@@ -28,6 +27,7 @@
#include "content/public/browser/browser_thread.h"
#include "printing/mojom/print.mojom.h"
#include "printing/printing_features.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace printing {
@@ -86,7 +86,7 @@
}
// This runs on a ThreadPoolForegroundWorker and not the UI thread.
-base::Optional<PrinterSemanticCapsAndDefaults>
+absl::optional<PrinterSemanticCapsAndDefaults>
FetchCapabilitiesOnBlockingTaskRunner(const std::string& printer_id,
const std::string& locale) {
auto print_backend = PrintBackend::CreateInstance(locale);
@@ -97,13 +97,13 @@
crash_keys::ScopedPrinterInfo crash_key(
print_backend->GetPrinterDriverInfo(printer_id));
- auto caps = base::make_optional<PrinterSemanticCapsAndDefaults>();
+ auto caps = absl::make_optional<PrinterSemanticCapsAndDefaults>();
if (print_backend->GetPrinterSemanticCapsAndDefaults(printer_id, &*caps) !=
mojom::ResultCode::kSuccess) {
// Failed to get capabilities, but proceed to assemble the settings to
// return what information we do have.
LOG(WARNING) << "Failed to get capabilities for " << printer_id;
- return base::nullopt;
+ return absl::nullopt;
}
return caps;
}
@@ -116,7 +116,7 @@
LOG(WARNING) << "Failure fetching printer capabilities from service for "
<< printer_id << " - error "
<< printer_caps->get_result_code();
- std::move(cb).Run(base::nullopt);
+ std::move(cb).Run(absl::nullopt);
return;
}
VLOG(1) << "Successfully received printer capabilities from service for "
@@ -150,13 +150,13 @@
chromeos::CupsPrintersManager* printers_manager,
const chromeos::Printer& printer,
base::OnceCallback<
- void(const base::Optional<PrinterSemanticCapsAndDefaults>&)> cb,
+ void(const absl::optional<PrinterSemanticCapsAndDefaults>&)> cb,
chromeos::PrinterSetupResult result) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
LogPrinterSetup(printer, result);
if (result != chromeos::PrinterSetupResult::kSuccess) {
- std::move(cb).Run(base::nullopt);
+ std::move(cb).Run(absl::nullopt);
return;
}
printers_manager->PrinterInstalled(printer, /*is_automatic=*/true);
diff --git a/chrome/browser/chromeos/printing/printer_setup_util.h b/chrome/browser/chromeos/printing/printer_setup_util.h
index 7cb8e9f..529beee 100644
--- a/chrome/browser/chromeos/printing/printer_setup_util.h
+++ b/chrome/browser/chromeos/printing/printer_setup_util.h
@@ -6,16 +6,16 @@
#define CHROME_BROWSER_CHROMEOS_PRINTING_PRINTER_SETUP_UTIL_H_
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/chromeos/printing/cups_printers_manager.h"
#include "chrome/browser/chromeos/printing/printer_configurer.h"
#include "chromeos/printing/printer_configuration.h"
#include "printing/backend/print_backend.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace printing {
using GetPrinterCapabilitiesCallback = base::OnceCallback<void(
- const base::Optional<PrinterSemanticCapsAndDefaults>&)>;
+ const absl::optional<PrinterSemanticCapsAndDefaults>&)>;
// Sets up a printer (if necessary) and runs a callback with the printer
// capabilities once printer setup is complete. The callback is run
diff --git a/chrome/browser/chromeos/printing/printers_map.cc b/chrome/browser/chromeos/printing/printers_map.cc
index e1908bf..9ecbb66 100644
--- a/chrome/browser/chromeos/printing/printers_map.cc
+++ b/chrome/browser/chromeos/printing/printers_map.cc
@@ -14,7 +14,7 @@
PrintersMap::PrintersMap() = default;
PrintersMap::~PrintersMap() = default;
-base::Optional<Printer> PrintersMap::Get(const std::string& printer_id) const {
+absl::optional<Printer> PrintersMap::Get(const std::string& printer_id) const {
for (const auto& kv : printers_) {
const PrinterClass& printer_class = kv.first;
const auto& printer_list = kv.second;
@@ -22,13 +22,13 @@
return printer_list.at(printer_id);
}
}
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<Printer> PrintersMap::Get(PrinterClass printer_class,
+absl::optional<Printer> PrintersMap::Get(PrinterClass printer_class,
const std::string& printer_id) const {
if (!IsPrinterInClass(printer_class, printer_id)) {
- return base::nullopt;
+ return absl::nullopt;
}
return printers_.at(printer_class).at(printer_id);
@@ -92,7 +92,7 @@
// deleted.
statuses_to_remove.erase(printer.id());
- base::Optional<CupsPrinterStatus> printer_status =
+ absl::optional<CupsPrinterStatus> printer_status =
GetPrinterStatus(printer.id());
if (printer_status) {
Insert(printer_class, printer, printer_status.value());
@@ -176,13 +176,13 @@
}
}
-base::Optional<CupsPrinterStatus> PrintersMap::GetPrinterStatus(
+absl::optional<CupsPrinterStatus> PrintersMap::GetPrinterStatus(
const std::string& printer_id) const {
auto printer_iter = printer_statuses_.find(printer_id);
if (printer_iter != printer_statuses_.end()) {
return printer_iter->second;
}
- return base::nullopt;
+ return absl::nullopt;
}
std::set<std::string> PrintersMap::GetPrinterIdsInClass(
diff --git a/chrome/browser/chromeos/printing/printers_map.h b/chrome/browser/chromeos/printing/printers_map.h
index eeafb0c..1ea36439 100644
--- a/chrome/browser/chromeos/printing/printers_map.h
+++ b/chrome/browser/chromeos/printing/printers_map.h
@@ -12,9 +12,9 @@
#include "base/containers/flat_map.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chromeos/printing/cups_printer_status.h"
#include "chromeos/printing/printer_configuration.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -25,10 +25,10 @@
~PrintersMap();
// Returns printer matching |printer_id| if found in any PrinterClass.
- base::Optional<Printer> Get(const std::string& printer_id) const;
+ absl::optional<Printer> Get(const std::string& printer_id) const;
// Returns printer matching |printer_id| in |printer_class|.
- base::Optional<Printer> Get(PrinterClass printer_class,
+ absl::optional<Printer> Get(PrinterClass printer_class,
const std::string& printer_id) const;
// Returns all printers across all classes.
@@ -80,7 +80,7 @@
// Returns true if |printer_id| exists in any class. Used only for DCHECKs.
bool IsExistingPrinter(const std::string& printer_id) const;
- base::Optional<CupsPrinterStatus> GetPrinterStatus(
+ absl::optional<CupsPrinterStatus> GetPrinterStatus(
const std::string& printer_id) const;
// Returns set of printer id's for printers in class |printer_class|.
diff --git a/chrome/browser/chromeos/printing/printers_map_unittest.cc b/chrome/browser/chromeos/printing/printers_map_unittest.cc
index be3dee87..3c2cf76b 100644
--- a/chrome/browser/chromeos/printing/printers_map_unittest.cc
+++ b/chrome/browser/chromeos/printing/printers_map_unittest.cc
@@ -85,7 +85,7 @@
TEST_F(PrintersMapTest, GetByIdReturnsEmptyOptionalWhenNonExistant) {
PrintersMap printers_map;
- base::Optional<Printer> printer = printers_map.Get("non_existant_id");
+ absl::optional<Printer> printer = printers_map.Get("non_existant_id");
EXPECT_FALSE(printer);
}
@@ -98,7 +98,7 @@
printers_map.Insert(PrinterClass::kEnterprise, expected_printer);
- base::Optional<Printer> actual_printer =
+ absl::optional<Printer> actual_printer =
printers_map.Get(expected_printer.id());
EXPECT_TRUE(actual_printer);
@@ -138,7 +138,7 @@
GetByClassAndIdOnlyReturnsEmptyOptionalWhenNonExistant) {
PrintersMap printers_map;
- base::Optional<Printer> found_printer =
+ absl::optional<Printer> found_printer =
printers_map.Get(PrinterClass::kDiscovered, "printer_id");
EXPECT_FALSE(found_printer);
@@ -155,7 +155,7 @@
printers_map.Insert(PrinterClass::kDiscovered, printer2);
// No printer is found because |printer1| *is not* in kDiscovered.
- base::Optional<Printer> found_printer =
+ absl::optional<Printer> found_printer =
printers_map.Get(PrinterClass::kDiscovered, printer1_id);
EXPECT_FALSE(found_printer);
@@ -399,7 +399,7 @@
printers_map.Insert(PrinterClass::kDiscovered, Printer(printer_id));
printers_map.SavePrinterStatus(printer_id, CupsPrinterStatus(printer_id));
- base::Optional<Printer> printer = printers_map.Get(printer_id);
+ absl::optional<Printer> printer = printers_map.Get(printer_id);
CupsPrinterStatus printer_status = printer->printer_status();
EXPECT_EQ(printer_id, printer_status.GetPrinterId());
}
@@ -413,11 +413,11 @@
printers_map.SavePrinterStatus(printer_id1, CupsPrinterStatus(printer_id1));
printers_map.SavePrinterStatus(printer_id2, CupsPrinterStatus(printer_id2));
- base::Optional<Printer> printer1 = printers_map.Get(printer_id1);
+ absl::optional<Printer> printer1 = printers_map.Get(printer_id1);
CupsPrinterStatus printer_status1 = printer1->printer_status();
EXPECT_EQ(printer_id1, printer_status1.GetPrinterId());
- base::Optional<Printer> printer2 = printers_map.Get(printer_id2);
+ absl::optional<Printer> printer2 = printers_map.Get(printer_id2);
CupsPrinterStatus printer_status2 = printer2->printer_status();
EXPECT_EQ(printer_id2, printer_status2.GetPrinterId());
}
@@ -430,7 +430,7 @@
printers_map.Insert(PrinterClass::kDiscovered, Printer(wrong_printer_id));
printers_map.SavePrinterStatus(new_printer_id, CupsPrinterStatus());
- base::Optional<Printer> wrong_printer = printers_map.Get(wrong_printer_id);
+ absl::optional<Printer> wrong_printer = printers_map.Get(wrong_printer_id);
CupsPrinterStatus printer_status = wrong_printer->printer_status();
EXPECT_TRUE(printer_status.GetPrinterId().empty());
}
@@ -440,7 +440,7 @@
const std::string printer_id = "id";
printers_map.Insert(PrinterClass::kDiscovered, Printer(printer_id));
- base::Optional<Printer> printer = printers_map.Get(printer_id);
+ absl::optional<Printer> printer = printers_map.Get(printer_id);
CupsPrinterStatus printer_status = printer->printer_status();
EXPECT_TRUE(printer_status.GetPrinterId().empty());
}
@@ -453,7 +453,7 @@
CupsPrinterStatus saved_printer_status = CreatePrinterStatus(printer_id);
printers_map.SavePrinterStatus(printer_id, saved_printer_status);
- base::Optional<Printer> printer = printers_map.Get(printer_id);
+ absl::optional<Printer> printer = printers_map.Get(printer_id);
EXPECT_TRUE(printer);
ExpectPrinterStatusesEqual(saved_printer_status, printer->printer_status());
}
@@ -466,7 +466,7 @@
CupsPrinterStatus saved_printer_status = CreatePrinterStatus(printer_id);
printers_map.SavePrinterStatus(printer_id, saved_printer_status);
- base::Optional<Printer> printer =
+ absl::optional<Printer> printer =
printers_map.Get(PrinterClass::kDiscovered, printer_id);
EXPECT_TRUE(printer);
@@ -534,9 +534,9 @@
printers_map.ReplacePrintersInClass(PrinterClass::kDiscovered, printers);
- base::Optional<Printer> printer1 = printers_map.Get(printer_id1);
+ absl::optional<Printer> printer1 = printers_map.Get(printer_id1);
ExpectPrinterStatusesEqual(saved_printer_status1, printer1->printer_status());
- base::Optional<Printer> printer2 = printers_map.Get(printer_id2);
+ absl::optional<Printer> printer2 = printers_map.Get(printer_id2);
ExpectPrinterStatusesEqual(saved_printer_status2, printer2->printer_status());
}
@@ -555,14 +555,14 @@
// deleted.
std::vector<Printer> printer1_list{Printer(printer_id1)};
printers_map.ReplacePrintersInClass(PrinterClass::kDiscovered, printer1_list);
- base::Optional<Printer> printer1 = printers_map.Get(printer_id1);
+ absl::optional<Printer> printer1 = printers_map.Get(printer_id1);
ExpectPrinterStatusesEqual(saved_printer_status1, printer1->printer_status());
// Add printer2 back to the map so it can be fetched then confirm no status
// was leftover from the replace.
std::vector<Printer> printer2_list{Printer(printer_id2)};
printers_map.ReplacePrintersInClass(PrinterClass::kDiscovered, printer2_list);
- base::Optional<Printer> printer2 = printers_map.Get(printer_id2);
+ absl::optional<Printer> printer2 = printers_map.Get(printer_id2);
CupsPrinterStatus printer_status2 = printer2->printer_status();
EXPECT_TRUE(printer_status2.GetPrinterId().empty());
}
@@ -580,10 +580,10 @@
std::vector<Printer> printer1_list{Printer(printer_id1)};
printers_map.ReplacePrintersInClass(PrinterClass::kDiscovered, printer1_list);
- base::Optional<Printer> printer1 = printers_map.Get(printer_id1);
+ absl::optional<Printer> printer1 = printers_map.Get(printer_id1);
ExpectPrinterStatusesEqual(saved_printer_status1, printer1->printer_status());
- base::Optional<Printer> printer2 = printers_map.Get(printer_id2);
+ absl::optional<Printer> printer2 = printers_map.Get(printer_id2);
CupsPrinterStatus printer_status2 = printer2->printer_status();
ExpectPrinterStatusesEqual(saved_printer_status2, printer2->printer_status());
}
@@ -596,7 +596,7 @@
// Confirm the printer status is attached to the printer
CupsPrinterStatus saved_printer_status = CreatePrinterStatus(printer_id);
printers_map.SavePrinterStatus(printer_id, saved_printer_status);
- base::Optional<Printer> saved_printer = printers_map.Get(printer_id);
+ absl::optional<Printer> saved_printer = printers_map.Get(printer_id);
CupsPrinterStatus printer_status = saved_printer->printer_status();
EXPECT_EQ(printer_id, printer_status.GetPrinterId());
@@ -606,7 +606,7 @@
std::vector<Printer> printers{Printer(printer_id)};
printers_map.ReplacePrintersInClass(PrinterClass::kDiscovered, printers);
- base::Optional<Printer> printer = printers_map.Get(printer_id);
+ absl::optional<Printer> printer = printers_map.Get(printer_id);
CupsPrinterStatus empty_printer_status = printer->printer_status();
EXPECT_TRUE(empty_printer_status.GetPrinterId().empty());
}
diff --git a/chrome/browser/chromeos/printing/printers_sync_bridge.cc b/chrome/browser/chromeos/printing/printers_sync_bridge.cc
index 9c07a7b..19b52ea2 100644
--- a/chrome/browser/chromeos/printing/printers_sync_bridge.cc
+++ b/chrome/browser/chromeos/printing/printers_sync_bridge.cc
@@ -108,7 +108,7 @@
private:
// Callback for ModelTypeStore initialization.
- void OnStoreCreated(const base::Optional<syncer::ModelError>& error,
+ void OnStoreCreated(const absl::optional<syncer::ModelError>& error,
std::unique_ptr<ModelTypeStore> store) {
if (error) {
owner_->change_processor()->ReportError(*error);
@@ -120,7 +120,7 @@
weak_ptr_factory_.GetWeakPtr()));
}
- void OnReadAllData(const base::Optional<syncer::ModelError>& error,
+ void OnReadAllData(const absl::optional<syncer::ModelError>& error,
std::unique_ptr<ModelTypeStore::RecordList> record_list) {
if (error) {
owner_->change_processor()->ReportError(*error);
@@ -154,7 +154,7 @@
}
// Callback to handle commit errors.
- void OnCommit(const base::Optional<syncer::ModelError>& error) {
+ void OnCommit(const absl::optional<syncer::ModelError>& error) {
if (error) {
LOG(WARNING) << "Failed to commit operation to store";
owner_->change_processor()->ReportError(*error);
@@ -163,7 +163,7 @@
}
void OnReadAllMetadata(
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::MetadataBatch> metadata_batch) {
if (error) {
owner_->change_processor()->ReportError(*error);
@@ -195,7 +195,7 @@
return ModelTypeStore::WriteBatch::CreateMetadataChangeList();
}
-base::Optional<syncer::ModelError> PrintersSyncBridge::MergeSyncData(
+absl::optional<syncer::ModelError> PrintersSyncBridge::MergeSyncData(
std::unique_ptr<MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_data) {
DCHECK(change_processor()->IsTrackingMetadata());
@@ -248,7 +248,7 @@
return {};
}
-base::Optional<syncer::ModelError> PrintersSyncBridge::ApplySyncChanges(
+absl::optional<syncer::ModelError> PrintersSyncBridge::ApplySyncChanges(
std::unique_ptr<MetadataChangeList> metadata_change_list,
EntityChangeList entity_changes) {
std::unique_ptr<ModelTypeStore::WriteBatch> batch =
@@ -414,7 +414,7 @@
return printers;
}
-base::Optional<sync_pb::PrinterSpecifics> PrintersSyncBridge::GetPrinter(
+absl::optional<sync_pb::PrinterSpecifics> PrintersSyncBridge::GetPrinter(
const std::string& id) const {
base::AutoLock lock(data_lock_);
auto iter = all_data_.find(id);
diff --git a/chrome/browser/chromeos/printing/printers_sync_bridge.h b/chrome/browser/chromeos/printing/printers_sync_bridge.h
index 9702a32..164a750 100644
--- a/chrome/browser/chromeos/printing/printers_sync_bridge.h
+++ b/chrome/browser/chromeos/printing/printers_sync_bridge.h
@@ -11,12 +11,12 @@
#include <vector>
#include "base/observer_list_threadsafe.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/synchronization/lock.h"
#include "components/sync/model/conflict_resolution.h"
#include "components/sync/model/model_type_store.h"
#include "components/sync/model/model_type_sync_bridge.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace sync_pb {
class PrinterSpecifics;
@@ -35,10 +35,10 @@
// ModelTypeSyncBridge implementation.
std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList()
override;
- base::Optional<syncer::ModelError> MergeSyncData(
+ absl::optional<syncer::ModelError> MergeSyncData(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_data) override;
- base::Optional<syncer::ModelError> ApplySyncChanges(
+ absl::optional<syncer::ModelError> ApplySyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) override;
void GetData(StorageKeyList storage_keys, DataCallback callback) override;
@@ -59,7 +59,7 @@
// Returns all printers stored in the database and synced.
std::vector<sync_pb::PrinterSpecifics> GetAllPrinters() const;
// Returns the printer with |id| from storage if it could be found.
- base::Optional<sync_pb::PrinterSpecifics> GetPrinter(
+ absl::optional<sync_pb::PrinterSpecifics> GetPrinter(
const std::string& id) const;
// Returns whether or not the printer with |id| is contained in the storage.
bool HasPrinter(const std::string& id) const;
diff --git a/chrome/browser/chromeos/printing/printers_sync_bridge_unittest.cc b/chrome/browser/chromeos/printing/printers_sync_bridge_unittest.cc
index 138fafd..0366e3e5 100644
--- a/chrome/browser/chromeos/printing/printers_sync_bridge_unittest.cc
+++ b/chrome/browser/chromeos/printing/printers_sync_bridge_unittest.cc
@@ -56,7 +56,7 @@
overwrite->set_description(kLazerDescription);
bridge_->AddPrinter(std::move(overwrite));
- base::Optional<PrinterSpecifics> printer = bridge_->GetPrinter("0");
+ absl::optional<PrinterSpecifics> printer = bridge_->GetPrinter("0");
ASSERT_TRUE(printer.has_value());
EXPECT_EQ("0", printer->id());
EXPECT_EQ(kLazerDescription, printer->description());
@@ -76,7 +76,7 @@
bool is_new = bridge_->UpdatePrinter(std::move(overwrite));
EXPECT_FALSE(is_new);
- base::Optional<PrinterSpecifics> printer = bridge_->GetPrinter("0");
+ absl::optional<PrinterSpecifics> printer = bridge_->GetPrinter("0");
ASSERT_TRUE(printer.has_value());
EXPECT_EQ("0", printer->id());
// Description is overwritten.
@@ -93,7 +93,7 @@
bool is_new = bridge_->UpdatePrinter(std::move(first));
EXPECT_TRUE(is_new);
- base::Optional<PrinterSpecifics> printer = bridge_->GetPrinter("0");
+ absl::optional<PrinterSpecifics> printer = bridge_->GetPrinter("0");
ASSERT_TRUE(printer.has_value());
EXPECT_EQ("0", printer->id());
EXPECT_EQ(kInkyDescription, printer->description());
diff --git a/chrome/browser/chromeos/printing/printing_stubs.cc b/chrome/browser/chromeos/printing/printing_stubs.cc
index 97d509b..503f31f 100644
--- a/chrome/browser/chromeos/printing/printing_stubs.cc
+++ b/chrome/browser/chromeos/printing/printing_stubs.cc
@@ -15,7 +15,7 @@
return false;
}
-base::Optional<Printer> StubCupsPrintersManager::GetPrinter(
+absl::optional<Printer> StubCupsPrintersManager::GetPrinter(
const std::string& id) const {
return {};
}
diff --git a/chrome/browser/chromeos/printing/printing_stubs.h b/chrome/browser/chromeos/printing/printing_stubs.h
index 770c687..669ceee 100644
--- a/chrome/browser/chromeos/printing/printing_stubs.h
+++ b/chrome/browser/chromeos/printing/printing_stubs.h
@@ -8,11 +8,11 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/chromeos/printing/cups_printers_manager.h"
#include "chrome/browser/chromeos/printing/printer_configurer.h"
#include "chromeos/printing/ppd_provider.h"
#include "chromeos/printing/printer_configuration.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -22,7 +22,7 @@
std::vector<Printer> GetPrinters(PrinterClass printer_class) const override;
bool IsPrinterInstalled(const Printer& printer) const override;
- base::Optional<Printer> GetPrinter(const std::string& id) const override;
+ absl::optional<Printer> GetPrinter(const std::string& id) const override;
PrintServersManager* GetPrintServersManager() const override;
void SavePrinter(const Printer& printer) override {}
diff --git a/chrome/browser/chromeos/printing/server_printers_provider.cc b/chrome/browser/chromeos/printing/server_printers_provider.cc
index 7b24070..2637d7c 100644
--- a/chrome/browser/chromeos/printing/server_printers_provider.cc
+++ b/chrome/browser/chromeos/printing/server_printers_provider.cc
@@ -12,7 +12,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/scoped_observer.h"
#include "base/sequenced_task_runner.h"
#include "base/task/post_task.h"
@@ -22,6 +21,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "components/device_event_log/device_event_log.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class PrefService;
diff --git a/chrome/browser/chromeos/printing/synced_printers_manager.cc b/chrome/browser/chromeos/printing/synced_printers_manager.cc
index 7919c0f..38be3cb 100644
--- a/chrome/browser/chromeos/printing/synced_printers_manager.cc
+++ b/chrome/browser/chromeos/printing/synced_printers_manager.cc
@@ -9,7 +9,6 @@
#include "base/guid.h"
#include "base/observer_list_threadsafe.h"
-#include "base/optional.h"
#include "base/synchronization/lock.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
@@ -24,6 +23,7 @@
#include "components/policy/policy_constants.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -91,7 +91,7 @@
std::unique_ptr<Printer> GetPrinterLocked(
const std::string& printer_id) const {
lock_.AssertAcquired();
- base::Optional<sync_pb::PrinterSpecifics> printer =
+ absl::optional<sync_pb::PrinterSpecifics> printer =
sync_bridge_->GetPrinter(printer_id);
return printer.has_value() ? SpecificsToPrinter(*printer) : nullptr;
}
diff --git a/chrome/browser/chromeos/printing/synced_printers_manager_unittest.cc b/chrome/browser/chromeos/printing/synced_printers_manager_unittest.cc
index a72d5e7..f981d38 100644
--- a/chrome/browser/chromeos/printing/synced_printers_manager_unittest.cc
+++ b/chrome/browser/chromeos/printing/synced_printers_manager_unittest.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/debug/dump_without_crashing.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/strings/string_util.h"
@@ -25,6 +24,7 @@
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/printing/test_cups_printers_manager.cc b/chrome/browser/chromeos/printing/test_cups_printers_manager.cc
index 7324385..e5e6cfe 100644
--- a/chrome/browser/chromeos/printing/test_cups_printers_manager.cc
+++ b/chrome/browser/chromeos/printing/test_cups_printers_manager.cc
@@ -19,7 +19,7 @@
return installed_.contains(printer.id());
}
-base::Optional<Printer> TestCupsPrintersManager::GetPrinter(
+absl::optional<Printer> TestCupsPrintersManager::GetPrinter(
const std::string& id) const {
return printers_.Get(id);
}
diff --git a/chrome/browser/chromeos/printing/test_cups_printers_manager.h b/chrome/browser/chromeos/printing/test_cups_printers_manager.h
index 9dcdb77..a1e9fdf 100644
--- a/chrome/browser/chromeos/printing/test_cups_printers_manager.h
+++ b/chrome/browser/chromeos/printing/test_cups_printers_manager.h
@@ -21,7 +21,7 @@
// CupsPrintersManager:
std::vector<Printer> GetPrinters(PrinterClass printer_class) const override;
bool IsPrinterInstalled(const Printer& printer) const override;
- base::Optional<Printer> GetPrinter(const std::string& id) const override;
+ absl::optional<Printer> GetPrinter(const std::string& id) const override;
void AddPrinter(const Printer& printer, PrinterClass printer_class);
void InstallPrinter(const std::string& id);
diff --git a/chrome/browser/chromeos/printing/usb_printer_notification.cc b/chrome/browser/chromeos/printing/usb_printer_notification.cc
index b02e4ea..27ccd6cd 100644
--- a/chrome/browser/chromeos/printing/usb_printer_notification.cc
+++ b/chrome/browser/chromeos/printing/usb_printer_notification.cc
@@ -74,8 +74,8 @@
}
void UsbPrinterNotification::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
if (!button_index) {
// Body of notification clicked.
visible_ = false;
diff --git a/chrome/browser/chromeos/printing/usb_printer_notification.h b/chrome/browser/chromeos/printing/usb_printer_notification.h
index cd2109e..8aff2cd1 100644
--- a/chrome/browser/chromeos/printing/usb_printer_notification.h
+++ b/chrome/browser/chromeos/printing/usb_printer_notification.h
@@ -40,8 +40,8 @@
// message_center::NotificationObserver
void Close(bool by_user) override;
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
private:
void UpdateContents();
diff --git a/chrome/browser/chromeos/scheduler_configuration_manager.cc b/chrome/browser/chromeos/scheduler_configuration_manager.cc
index ac1cdc6..192aae7f 100644
--- a/chrome/browser/chromeos/scheduler_configuration_manager.cc
+++ b/chrome/browser/chromeos/scheduler_configuration_manager.cc
@@ -50,7 +50,7 @@
registry->RegisterStringPref(prefs::kSchedulerConfiguration, std::string());
}
-base::Optional<std::pair<bool, size_t>>
+absl::optional<std::pair<bool, size_t>>
SchedulerConfigurationManager::GetLastReply() const {
return last_reply_;
}
diff --git a/chrome/browser/chromeos/scheduler_configuration_manager.h b/chrome/browser/chromeos/scheduler_configuration_manager.h
index db06b3df4..e096f70 100644
--- a/chrome/browser/chromeos/scheduler_configuration_manager.h
+++ b/chrome/browser/chromeos/scheduler_configuration_manager.h
@@ -9,9 +9,9 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chromeos/system/scheduler_configuration_manager_base.h"
#include "components/prefs/pref_change_registrar.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefRegistrySimple;
class PrefService;
@@ -38,7 +38,7 @@
static void RegisterLocalStatePrefs(PrefRegistrySimple* registry);
// SchedulerConfigurationManagerBase overrides:
- base::Optional<std::pair<bool, size_t>> GetLastReply() const override;
+ absl::optional<std::pair<bool, size_t>> GetLastReply() const override;
private:
void OnDebugDaemonReady(bool service_is_ready);
@@ -48,7 +48,7 @@
DebugDaemonClient* debug_daemon_client_ = nullptr;
PrefChangeRegistrar observer_;
bool debug_daemon_ready_ = false;
- base::Optional<std::pair<bool, size_t>> last_reply_;
+ absl::optional<std::pair<bool, size_t>> last_reply_;
base::WeakPtrFactory<SchedulerConfigurationManager> weak_ptr_factory_{this};
diff --git a/chrome/browser/chromeos/secure_channel/nearby_connection_broker_impl.cc b/chrome/browser/chromeos/secure_channel/nearby_connection_broker_impl.cc
index 8e61921..35dc602 100644
--- a/chrome/browser/chromeos/secure_channel/nearby_connection_broker_impl.cc
+++ b/chrome/browser/chromeos/secure_channel/nearby_connection_broker_impl.cc
@@ -206,7 +206,7 @@
/*ble=*/false,
/*webrtc=*/true,
/*wifi_lan=*/false),
- /*remote_bluetooth_mac_address=*/base::nullopt),
+ /*remote_bluetooth_mac_address=*/absl::nullopt),
connection_lifecycle_listener_receiver_.BindNewPipeAndPassRemote(),
base::BindOnce(&NearbyConnectionBrokerImpl::OnRequestConnectionResult,
weak_ptr_factory_.GetWeakPtr()));
diff --git a/chrome/browser/chromeos/secure_channel/nearby_connector_impl.h b/chrome/browser/chromeos/secure_channel/nearby_connector_impl.h
index acd08469..b38698d 100644
--- a/chrome/browser/chromeos/secure_channel/nearby_connector_impl.h
+++ b/chrome/browser/chromeos/secure_channel/nearby_connector_impl.h
@@ -118,7 +118,7 @@
// Metadata for an ongoing connection attempt. If this field is set, it means
// that the entry in |id_to_brokers_map_| with the given ID is currently
// attempting a connection. If null, there is no pending connection attempt.
- base::Optional<ActiveConnectionAttempt> active_connection_attempt_;
+ absl::optional<ActiveConnectionAttempt> active_connection_attempt_;
base::WeakPtrFactory<NearbyConnectorImpl> weak_ptr_factory_{this};
};
diff --git a/chrome/browser/chromeos/secure_channel/nearby_endpoint_finder_impl.cc b/chrome/browser/chromeos/secure_channel/nearby_endpoint_finder_impl.cc
index bc87e68..ddb47a3 100644
--- a/chrome/browser/chromeos/secure_channel/nearby_endpoint_finder_impl.cc
+++ b/chrome/browser/chromeos/secure_channel/nearby_endpoint_finder_impl.cc
@@ -96,7 +96,7 @@
/*ble=*/false,
/*webrtc=*/false,
/*wifi_lan=*/false),
- /*fast_advertisement_service_uuid=*/base::nullopt,
+ /*fast_advertisement_service_uuid=*/absl::nullopt,
/*is_out_of_band_connection=*/true),
endpoint_discovery_listener_receiver_.BindNewPipeAndPassRemote(),
base::BindOnce(&NearbyEndpointFinderImpl::OnStartDiscoveryResult,
diff --git a/chrome/browser/chromeos/smb_client/discovery/netbios_client.cc b/chrome/browser/chromeos/smb_client/discovery/netbios_client.cc
index fa5f739..ab8c987 100644
--- a/chrome/browser/chromeos/smb_client/discovery/netbios_client.cc
+++ b/chrome/browser/chromeos/smb_client/discovery/netbios_client.cc
@@ -99,7 +99,7 @@
void NetBiosClient::OnBindComplete(
int32_t result,
- const base::Optional<net::IPEndPoint>& local_ip) {
+ const absl::optional<net::IPEndPoint>& local_ip) {
if (result != net::OK) {
LOG(ERROR) << "NetBiosClient: Binding socket failed: " << result;
return;
@@ -137,8 +137,8 @@
}
void NetBiosClient::OnReceived(int32_t result,
- const base::Optional<net::IPEndPoint>& src_ip,
- base::Optional<base::span<const uint8_t>> data) {
+ const absl::optional<net::IPEndPoint>& src_ip,
+ absl::optional<base::span<const uint8_t>> data) {
if (result != net::OK) {
LOG(ERROR) << "NetBiosClient: Receive failed: " << result;
return;
diff --git a/chrome/browser/chromeos/smb_client/discovery/netbios_client.h b/chrome/browser/chromeos/smb_client/discovery/netbios_client.h
index 314f62c..e00c7a0 100644
--- a/chrome/browser/chromeos/smb_client/discovery/netbios_client.h
+++ b/chrome/browser/chromeos/smb_client/discovery/netbios_client.h
@@ -80,7 +80,7 @@
// Callback handler for bind. Calls OpenPort.
void OnBindComplete(int32_t result,
- const base::Optional<net::IPEndPoint>& local_ip);
+ const absl::optional<net::IPEndPoint>& local_ip);
// Callback handler for OpenPort. Calls SetBroadcast.
void OnOpenPortComplete(std::unique_ptr<FirewallHole> firewall_hole);
@@ -93,8 +93,8 @@
// network::mojom::UDPSocketListener implementation.
void OnReceived(int32_t result,
- const base::Optional<net::IPEndPoint>& src_ip,
- base::Optional<base::span<const uint8_t>> data) override;
+ const absl::optional<net::IPEndPoint>& src_ip,
+ absl::optional<base::span<const uint8_t>> data) override;
// Creates a NetBios Name Query Request packet.
// https://tools.ietf.org/html/rfc1002
diff --git a/chrome/browser/chromeos/smb_client/smb_file_system_id.cc b/chrome/browser/chromeos/smb_client/smb_file_system_id.cc
index a8a005dc..09b7843 100644
--- a/chrome/browser/chromeos/smb_client/smb_file_system_id.cc
+++ b/chrome/browser/chromeos/smb_client/smb_file_system_id.cc
@@ -80,7 +80,7 @@
return components.size() >= 3 && components[2] == kKerberosSymbol;
}
-base::Optional<std::string> GetUserFromFileSystemId(
+absl::optional<std::string> GetUserFromFileSystemId(
const std::string& file_system_id) {
const std::vector<std::string> components = GetComponents(file_system_id);
if (components.size() < 3 ||
diff --git a/chrome/browser/chromeos/smb_client/smb_file_system_id.h b/chrome/browser/chromeos/smb_client/smb_file_system_id.h
index 0dc3ecca..65af7c3 100644
--- a/chrome/browser/chromeos/smb_client/smb_file_system_id.h
+++ b/chrome/browser/chromeos/smb_client/smb_file_system_id.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/files/file_path.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace smb_client {
@@ -39,7 +39,7 @@
// Returns the username if |file_system_id| was constructed with
// CreateFileSystemIdForUser(). Returns nullopt if |file_system_id| does not
// store the username.
-base::Optional<std::string> GetUserFromFileSystemId(
+absl::optional<std::string> GetUserFromFileSystemId(
const std::string& file_system_id);
} // namespace smb_client
diff --git a/chrome/browser/chromeos/smb_client/smb_file_system_id_test.cc b/chrome/browser/chromeos/smb_client/smb_file_system_id_test.cc
index 39981a8..d19c801 100644
--- a/chrome/browser/chromeos/smb_client/smb_file_system_id_test.cc
+++ b/chrome/browser/chromeos/smb_client/smb_file_system_id_test.cc
@@ -98,7 +98,7 @@
const std::string file_system_id_2 = base::StrCat(
{"EFAFF3864D0FE389@@smb://192.168.0.1/test@@user=", user_workgroup});
- base::Optional<std::string> actual_user =
+ absl::optional<std::string> actual_user =
GetUserFromFileSystemId(file_system_id_1);
ASSERT_TRUE(actual_user);
EXPECT_EQ(kTestUsername, *actual_user);
diff --git a/chrome/browser/chromeos/smb_client/smb_persisted_share_registry.cc b/chrome/browser/chromeos/smb_client/smb_persisted_share_registry.cc
index 4e90a29..59ca879e85 100644
--- a/chrome/browser/chromeos/smb_client/smb_persisted_share_registry.cc
+++ b/chrome/browser/chromeos/smb_client/smb_persisted_share_registry.cc
@@ -69,7 +69,7 @@
return {decoded_value.begin(), decoded_value.end()};
}
-base::Optional<SmbShareInfo> DictToShare(const base::Value& dict) {
+absl::optional<SmbShareInfo> DictToShare(const base::Value& dict) {
std::string share_url = GetStringValue(dict, kShareUrlKey);
if (share_url.empty()) {
return {};
@@ -82,7 +82,7 @@
GetStringValue(dict, kWorkgroupKey),
dict.FindBoolKey(kUseKerberosKey).value_or(false),
GetEncodedBinaryValue(dict, kPasswordSaltKey));
- return base::make_optional(std::move(info));
+ return absl::make_optional(std::move(info));
}
} // namespace
@@ -126,7 +126,7 @@
}
}
-base::Optional<SmbShareInfo> SmbPersistedShareRegistry::Get(
+absl::optional<SmbShareInfo> SmbPersistedShareRegistry::Get(
const SmbUrl& share_url) const {
const base::Value* pref =
profile_->GetPrefs()->Get(prefs::kNetworkFileSharesSavedShares);
@@ -153,7 +153,7 @@
std::vector<SmbShareInfo> shares;
base::Value::ConstListView share_list = pref->GetList();
for (auto it = share_list.begin(); it != share_list.end(); ++it) {
- base::Optional<SmbShareInfo> info = DictToShare(*it);
+ absl::optional<SmbShareInfo> info = DictToShare(*it);
if (!info) {
continue;
}
diff --git a/chrome/browser/chromeos/smb_client/smb_persisted_share_registry.h b/chrome/browser/chromeos/smb_client/smb_persisted_share_registry.h
index 932ad8b1b..5eb976f 100644
--- a/chrome/browser/chromeos/smb_client/smb_persisted_share_registry.h
+++ b/chrome/browser/chromeos/smb_client/smb_persisted_share_registry.h
@@ -8,8 +8,8 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/chromeos/smb_client/smb_share_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -44,7 +44,7 @@
// Return the saved share with URL |share_url|, or the empty Optional<> if no
// share is found.
- base::Optional<SmbShareInfo> Get(const SmbUrl& share_url) const;
+ absl::optional<SmbShareInfo> Get(const SmbUrl& share_url) const;
// Return a list of all saved shares.
std::vector<SmbShareInfo> GetAll() const;
diff --git a/chrome/browser/chromeos/smb_client/smb_persisted_share_registry_unittest.cc b/chrome/browser/chromeos/smb_client/smb_persisted_share_registry_unittest.cc
index 719a641..1b068a2e 100644
--- a/chrome/browser/chromeos/smb_client/smb_persisted_share_registry_unittest.cc
+++ b/chrome/browser/chromeos/smb_client/smb_persisted_share_registry_unittest.cc
@@ -28,7 +28,7 @@
TEST_F(SmbPersistedShareRegistryTest, Empty) {
SmbPersistedShareRegistry registry(&profile_);
- base::Optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
+ absl::optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
EXPECT_FALSE(info);
std::vector<SmbShareInfo> all_info = registry.GetAll();
@@ -56,7 +56,7 @@
// SmbPersistedShareRegistry are not the same (and have no hidden state).
{
SmbPersistedShareRegistry registry(&profile_);
- base::Optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
+ absl::optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
ASSERT_TRUE(info);
EXPECT_EQ(info->share_url().ToString(), kShareUrl);
EXPECT_EQ(info->display_name(), kDisplayName);
@@ -65,7 +65,7 @@
EXPECT_FALSE(info->use_kerberos());
EXPECT_EQ(info->password_salt(), kSalt);
- base::Optional<SmbShareInfo> info2 = registry.Get(SmbUrl(kShareUrl2));
+ absl::optional<SmbShareInfo> info2 = registry.Get(SmbUrl(kShareUrl2));
ASSERT_TRUE(info2);
EXPECT_EQ(info2->share_url().ToString(), kShareUrl2);
EXPECT_EQ(info2->display_name(), kDisplayName);
@@ -92,7 +92,7 @@
// SmbPersistedShareRegistry are not the same (and have no hidden state).
{
SmbPersistedShareRegistry registry(&profile_);
- base::Optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
+ absl::optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
ASSERT_TRUE(info);
EXPECT_EQ(info->share_url().ToString(), kShareUrl);
EXPECT_EQ(info->display_name(), kDisplayName);
@@ -109,7 +109,7 @@
}
{
SmbPersistedShareRegistry registry(&profile_);
- base::Optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
+ absl::optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
ASSERT_TRUE(info);
EXPECT_EQ(info->share_url().ToString(), kShareUrl);
EXPECT_EQ(info->display_name(), kDisplayName);
@@ -139,7 +139,7 @@
SmbPersistedShareRegistry registry(&profile_);
registry.Delete(SmbUrl(kShareUrl2));
- base::Optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
+ absl::optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
ASSERT_TRUE(info);
EXPECT_EQ(info->share_url().ToString(), kShareUrl);
EXPECT_EQ(info->display_name(), kDisplayName);
@@ -147,7 +147,7 @@
EXPECT_EQ(info->workgroup(), kWorkgroup);
EXPECT_FALSE(info->use_kerberos());
- base::Optional<SmbShareInfo> info2 = registry.Get(SmbUrl(kShareUrl2));
+ absl::optional<SmbShareInfo> info2 = registry.Get(SmbUrl(kShareUrl2));
ASSERT_FALSE(info2);
std::vector<SmbShareInfo> all_info = registry.GetAll();
diff --git a/chrome/browser/chromeos/smb_client/smb_service.cc b/chrome/browser/chromeos/smb_client/smb_service.cc
index 96cc40b..cc4a49e0b 100644
--- a/chrome/browser/chromeos/smb_client/smb_service.cc
+++ b/chrome/browser/chromeos/smb_client/smb_service.cc
@@ -457,12 +457,12 @@
if (info.use_kerberos()) {
if (user->IsActiveDirectoryUser()) {
smbfs_options.kerberos_options =
- base::make_optional<SmbFsShare::KerberosOptions>(
+ absl::make_optional<SmbFsShare::KerberosOptions>(
SmbFsShare::KerberosOptions::Source::kActiveDirectory,
user->GetAccountId().GetObjGuid());
} else if (smb_credentials_updater_) {
smbfs_options.kerberos_options =
- base::make_optional<SmbFsShare::KerberosOptions>(
+ absl::make_optional<SmbFsShare::KerberosOptions>(
SmbFsShare::KerberosOptions::Source::kKerberos,
smb_credentials_updater_->active_account_name());
} else {
@@ -664,7 +664,7 @@
ParseUserPrincipalName(user->GetDisplayEmail(), &username, &workgroup);
} else {
- base::Optional<std::string> user_workgroup =
+ absl::optional<std::string> user_workgroup =
GetUserFromFileSystemId(file_system_info.file_system_id());
if (user_workgroup &&
!ParseUserName(*user_workgroup, &username, &workgroup)) {
diff --git a/chrome/browser/chromeos/smb_client/smb_service_unittest.cc b/chrome/browser/chromeos/smb_client/smb_service_unittest.cc
index 1a9e332..576eb08 100644
--- a/chrome/browser/chromeos/smb_client/smb_service_unittest.cc
+++ b/chrome/browser/chromeos/smb_client/smb_service_unittest.cc
@@ -418,7 +418,7 @@
// Check that the share was saved.
SmbPersistedShareRegistry registry(profile_);
- base::Optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
+ absl::optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
ASSERT_TRUE(info);
EXPECT_EQ(info->share_url().ToString(), kShareUrl);
EXPECT_EQ(info->display_name(), kDisplayName);
@@ -490,7 +490,7 @@
// Check that the share was saved.
SmbPersistedShareRegistry registry(profile_);
- base::Optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
+ absl::optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
ASSERT_TRUE(info);
EXPECT_EQ(info->share_url().ToString(), kShareUrl);
EXPECT_EQ(info->display_name(), kDisplayName);
@@ -561,7 +561,7 @@
// Check that the share was saved.
SmbPersistedShareRegistry registry(ad_profile_);
- base::Optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
+ absl::optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
ASSERT_TRUE(info);
EXPECT_EQ(info->share_url().ToString(), kShareUrl);
EXPECT_EQ(info->display_name(), kDisplayName);
@@ -691,7 +691,7 @@
run_loop2.Run();
SmbPersistedShareRegistry registry(profile_);
- base::Optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
+ absl::optional<SmbShareInfo> info = registry.Get(SmbUrl(kShareUrl));
EXPECT_FALSE(info);
EXPECT_TRUE(registry.GetAll().empty());
}
diff --git a/chrome/browser/chromeos/smb_client/smbfs_share_unittest.cc b/chrome/browser/chromeos/smb_client/smbfs_share_unittest.cc
index 0b1a869..8ba4830 100644
--- a/chrome/browser/chromeos/smb_client/smbfs_share_unittest.cc
+++ b/chrome/browser/chromeos/smb_client/smbfs_share_unittest.cc
@@ -458,7 +458,7 @@
smbfs::SmbFsMounter::MountOptions options2;
options2.kerberos_options =
- base::make_optional<smbfs::SmbFsMounter::KerberosOptions>(
+ absl::make_optional<smbfs::SmbFsMounter::KerberosOptions>(
smbfs::SmbFsMounter::KerberosOptions::Source::kKerberos,
kKerberosIdentity);
SmbFsShare share2(&profile_, SmbUrl(kSharePath2), kDisplayName, options2);
diff --git a/chrome/browser/chromeos/startup_settings_cache.cc b/chrome/browser/chromeos/startup_settings_cache.cc
index 3a9b164..ce522f7 100644
--- a/chrome/browser/chromeos/startup_settings_cache.cc
+++ b/chrome/browser/chromeos/startup_settings_cache.cc
@@ -42,7 +42,7 @@
if (!base::ReadFileToString(cache_file, &input))
return std::string();
- base::Optional<base::Value> settings = base::JSONReader::Read(input);
+ absl::optional<base::Value> settings = base::JSONReader::Read(input);
if (!settings.has_value())
return std::string();
diff --git a/chrome/browser/chromeos/tether/tether_service.cc b/chrome/browser/chromeos/tether/tether_service.cc
index 0fcd31b..92a2045 100644
--- a/chrome/browser/chromeos/tether/tether_service.cc
+++ b/chrome/browser/chromeos/tether/tether_service.cc
@@ -318,7 +318,7 @@
if (is_enabled != was_pref_enabled) {
multidevice_setup_client_->SetFeatureEnabledState(
chromeos::multidevice_setup::mojom::Feature::kInstantTethering,
- is_enabled, base::nullopt /* auth_token */, base::DoNothing());
+ is_enabled, absl::nullopt /* auth_token */, base::DoNothing());
} else {
UpdateTetherTechnologyState();
}
diff --git a/chrome/browser/chromeos/tether/tether_service_unittest.cc b/chrome/browser/chromeos/tether/tether_service_unittest.cc
index 2913f16..dfe3ed5 100644
--- a/chrome/browser/chromeos/tether/tether_service_unittest.cc
+++ b/chrome/browser/chromeos/tether/tether_service_unittest.cc
@@ -1237,7 +1237,7 @@
SetTetherTechnologyStateEnabled(false);
fake_multidevice_setup_client_->InvokePendingSetFeatureEnabledStateCallback(
chromeos::multidevice_setup::mojom::Feature::kInstantTethering,
- false /* expected_enabled */, base::nullopt /* expected_auth_token */,
+ false /* expected_enabled */, absl::nullopt /* expected_auth_token */,
true /* success */);
profile_->GetPrefs()->SetBoolean(
chromeos::multidevice_setup::kInstantTetheringEnabledPrefName, false);
@@ -1256,7 +1256,7 @@
SetTetherTechnologyStateEnabled(true);
fake_multidevice_setup_client_->InvokePendingSetFeatureEnabledStateCallback(
chromeos::multidevice_setup::mojom::Feature::kInstantTethering,
- true /* expected_enabled */, base::nullopt /* expected_auth_token */,
+ true /* expected_enabled */, absl::nullopt /* expected_auth_token */,
false /* success */);
profile_->GetPrefs()->SetBoolean(
chromeos::multidevice_setup::kInstantTetheringEnabledPrefName, true);
diff --git a/chrome/browser/chromeos/tpm_firmware_update_notification.cc b/chrome/browser/chromeos/tpm_firmware_update_notification.cc
index 0e158ac..b75b9c1b7 100644
--- a/chrome/browser/chromeos/tpm_firmware_update_notification.cc
+++ b/chrome/browser/chromeos/tpm_firmware_update_notification.cc
@@ -47,8 +47,8 @@
prefs::kTPMFirmwareUpdateCleanupDismissed, true);
}
}
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
// Show the about page which contains the line item allowing the user to
// trigger TPM firmware update installation.
chrome::SettingsWindowManager::GetInstance()->ShowOSSettings(
diff --git a/chrome/browser/chromeos/u2f_notification.cc b/chrome/browser/chromeos/u2f_notification.cc
index 9b5ad3d..c43ca40 100644
--- a/chrome/browser/chromeos/u2f_notification.cc
+++ b/chrome/browser/chromeos/u2f_notification.cc
@@ -54,7 +54,7 @@
&U2FNotification::CheckStatus, weak_factory_.GetWeakPtr()));
}
-void U2FNotification::CheckStatus(base::Optional<std::set<std::string>> flags) {
+void U2FNotification::CheckStatus(absl::optional<std::set<std::string>> flags) {
if (!flags) {
LOG(ERROR) << "Failed to get U2F flags.";
return;
@@ -127,7 +127,7 @@
}
void U2FNotification::OnNotificationClick(
- const base::Optional<int> button_index) {
+ const absl::optional<int> button_index) {
Profile* profile = ProfileManager::GetPrimaryUserProfile();
if (!button_index || !profile) {
return;
@@ -146,7 +146,7 @@
case ButtonIndex::kReset: {
// Add the user_keys flag.
DBusThreadManager::Get()->GetDebugDaemonClient()->GetU2fFlags(
- base::BindOnce([](base::Optional<std::set<std::string>> flags) {
+ base::BindOnce([](absl::optional<std::set<std::string>> flags) {
if (!flags) {
LOG(ERROR) << "Failed to get U2F flags.";
return;
diff --git a/chrome/browser/chromeos/u2f_notification.h b/chrome/browser/chromeos/u2f_notification.h
index 5ee45f1..fe4cee9 100644
--- a/chrome/browser/chromeos/u2f_notification.h
+++ b/chrome/browser/chromeos/u2f_notification.h
@@ -10,7 +10,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -27,13 +27,13 @@
private:
// Checks status given the current U2F flags.
- void CheckStatus(base::Optional<std::set<std::string>> flags);
+ void CheckStatus(absl::optional<std::set<std::string>> flags);
// Shows the notification.
void ShowNotification();
// Handles clicks on the notification.
- void OnNotificationClick(const base::Optional<int> button_index);
+ void OnNotificationClick(const absl::optional<int> button_index);
base::WeakPtrFactory<U2FNotification> weak_factory_{this};
diff --git a/chrome/browser/client_hints/client_hints_browsertest.cc b/chrome/browser/client_hints/client_hints_browsertest.cc
index 122863668..67224a4 100644
--- a/chrome/browser/client_hints/client_hints_browsertest.cc
+++ b/chrome/browser/client_hints/client_hints_browsertest.cc
@@ -2190,7 +2190,7 @@
}
content::URLLoaderInterceptor interceptor_;
- base::Optional<std::vector<network::mojom::WebClientHintsType>>
+ absl::optional<std::vector<network::mojom::WebClientHintsType>>
accept_ch_frame_;
};
diff --git a/chrome/browser/component_updater/cros_component_installer_chromeos.cc b/chrome/browser/component_updater/cros_component_installer_chromeos.cc
index d4ca8c6..9dcef12 100644
--- a/chrome/browser/component_updater/cros_component_installer_chromeos.cc
+++ b/chrome/browser/component_updater/cros_component_installer_chromeos.cc
@@ -80,7 +80,7 @@
}
// TODO(xiaochu): add metrics for component usage (https://crbug.com/793052).
-void LogCustomUninstall(base::Optional<bool> result) {}
+void LogCustomUninstall(absl::optional<bool> result) {}
void FinishCustomUninstallOnUIThread(const std::string& name) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -439,7 +439,7 @@
void CrOSComponentInstaller::FinishLoad(LoadCallback load_callback,
const base::TimeTicks start_time,
const std::string& name,
- base::Optional<base::FilePath> result) {
+ absl::optional<base::FilePath> result) {
// Report component image mount time.
UMA_HISTOGRAM_LONG_TIMES("ComponentUpdater.ChromeOS.MountTime",
base::TimeTicks::Now() - start_time);
diff --git a/chrome/browser/component_updater/cros_component_installer_chromeos.h b/chrome/browser/component_updater/cros_component_installer_chromeos.h
index 5c82dbe..f7b447a 100644
--- a/chrome/browser/component_updater/cros_component_installer_chromeos.h
+++ b/chrome/browser/component_updater/cros_component_installer_chromeos.h
@@ -11,11 +11,11 @@
#include "base/containers/flat_map.h"
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "chrome/browser/component_updater/cros_component_manager.h"
#include "components/component_updater/component_installer.h"
#include "components/component_updater/component_updater_service.h"
#include "components/update_client/update_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace component_updater {
@@ -192,7 +192,7 @@
void FinishLoad(LoadCallback load_callback,
const base::TimeTicks start_time,
const std::string& name,
- base::Optional<base::FilePath> result);
+ absl::optional<base::FilePath> result);
// Registers component |configs| to be updated.
void RegisterN(const std::vector<ComponentConfig>& configs);
diff --git a/chrome/browser/component_updater/cros_component_installer_chromeos_unittest.cc b/chrome/browser/component_updater/cros_component_installer_chromeos_unittest.cc
index e36da5e..df4622a 100644
--- a/chrome/browser/component_updater/cros_component_installer_chromeos_unittest.cc
+++ b/chrome/browser/component_updater/cros_component_installer_chromeos_unittest.cc
@@ -14,7 +14,6 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
@@ -35,6 +34,7 @@
#include "components/user_manager/scoped_user_manager.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace component_updater {
@@ -54,7 +54,7 @@
// Used as a callback to CrOSComponentManager::Load callback - it records the
// callback params to |result_out| and |mount_path_out|.
-void RecordLoadResult(base::Optional<CrOSComponentManager::Error>* result_out,
+void RecordLoadResult(absl::optional<CrOSComponentManager::Error>* result_out,
base::FilePath* mount_path_out,
CrOSComponentManager::Error reported_result,
const base::FilePath& reported_mount_path) {
@@ -228,7 +228,7 @@
// Creates a fake "user" installed component.
// On success, it returns the path at which the component was created, nullopt
// otherwise.
- base::Optional<base::FilePath> CreateInstalledComponent(
+ absl::optional<base::FilePath> CreateInstalledComponent(
const std::string& name,
const std::string& version,
const std::string& min_env_version) {
@@ -239,7 +239,7 @@
// Creates a fake component at a pre-installed component path.
// On success, it returns the path at which the component was created, nullopt
// otherwise.
- base::Optional<base::FilePath> CreatePreinstalledComponent(
+ absl::optional<base::FilePath> CreatePreinstalledComponent(
const std::string& name,
const std::string& version,
const std::string& min_env_version) {
@@ -252,7 +252,7 @@
// be installed as a user-installed component by the test OnDemandUpdater.
// On success, it returns the path at which the component was created, nullopt
// otherwise.
- base::Optional<base::FilePath> CreateUnpackedComponent(
+ absl::optional<base::FilePath> CreateUnpackedComponent(
const std::string& name,
const std::string& version,
const std::string& min_env_version) {
@@ -303,7 +303,7 @@
void VerifyComponentLoaded(
scoped_refptr<CrOSComponentManager> cros_component_manager,
const std::string& component_name,
- base::Optional<CrOSComponentManager::Error> load_result,
+ absl::optional<CrOSComponentManager::Error> load_result,
const base::FilePath& component_install_path) {
ASSERT_TRUE(load_result.has_value());
ASSERT_EQ(CrOSComponentManager::Error::NONE, load_result.value());
@@ -318,13 +318,13 @@
private:
// Creates a fake component at the specified path. Returns the target path on
// success, nullopt otherwise.
- base::Optional<base::FilePath> CreateComponentAtPath(
+ absl::optional<base::FilePath> CreateComponentAtPath(
const base::FilePath& path,
const std::string& name,
const std::string& version,
const std::string& min_env_version) {
if (!base::CreateDirectory(path))
- return base::nullopt;
+ return absl::nullopt;
const std::string manifest_template = R"({
"name": "%s",
@@ -335,9 +335,9 @@
base::StringPrintf(manifest_template.c_str(), name.c_str(),
version.c_str(), min_env_version.c_str());
if (!base::WriteFile(path.AppendASCII("manifest.json"), manifest))
- return base::nullopt;
+ return absl::nullopt;
- return base::make_optional(path);
+ return absl::make_optional(path);
}
content::BrowserTaskEnvironment task_environment_;
@@ -464,7 +464,7 @@
}
TEST_F(CrOSComponentInstallerTest, LoadPreinstalledComponent_Skip_Mount) {
- base::Optional<base::FilePath> install_path = CreatePreinstalledComponent(
+ absl::optional<base::FilePath> install_path = CreatePreinstalledComponent(
kTestComponentName, "1.0", kTestComponentValidMinEnvVersion);
ASSERT_TRUE(install_path.has_value());
@@ -478,7 +478,7 @@
base::MakeRefCounted<CrOSComponentInstaller>(nullptr,
update_service.get());
- base::Optional<CrOSComponentManager::Error> load_result;
+ absl::optional<CrOSComponentManager::Error> load_result;
base::FilePath mount_path;
cros_component_manager->Load(
kTestComponentName, CrOSComponentManager::MountPolicy::kMount,
@@ -495,12 +495,12 @@
TEST_F(CrOSComponentInstallerTest,
LoadInstalledComponentWhenOlderPreinstalledVersionExists_Skip_Mount) {
- base::Optional<base::FilePath> preinstalled_path =
+ absl::optional<base::FilePath> preinstalled_path =
CreatePreinstalledComponent(kTestComponentName, "1.0",
kTestComponentValidMinEnvVersion);
ASSERT_TRUE(preinstalled_path.has_value());
- base::Optional<base::FilePath> install_path = CreateInstalledComponent(
+ absl::optional<base::FilePath> install_path = CreateInstalledComponent(
kTestComponentName, "2.0", kTestComponentValidMinEnvVersion);
ASSERT_TRUE(install_path.has_value());
@@ -514,7 +514,7 @@
base::MakeRefCounted<CrOSComponentInstaller>(nullptr,
update_service.get());
- base::Optional<CrOSComponentManager::Error> load_result;
+ absl::optional<CrOSComponentManager::Error> load_result;
base::FilePath mount_path;
cros_component_manager->Load(
kTestComponentName, CrOSComponentManager::MountPolicy::kMount,
@@ -530,7 +530,7 @@
}
TEST_F(CrOSComponentInstallerTest, LoadInstalledComponent) {
- base::Optional<base::FilePath> install_path = CreateInstalledComponent(
+ absl::optional<base::FilePath> install_path = CreateInstalledComponent(
kTestComponentName, "2.0", kTestComponentValidMinEnvVersion);
ASSERT_TRUE(install_path.has_value());
@@ -544,7 +544,7 @@
base::MakeRefCounted<CrOSComponentInstaller>(nullptr,
update_service.get());
- base::Optional<CrOSComponentManager::Error> load_result;
+ absl::optional<CrOSComponentManager::Error> load_result;
base::FilePath mount_path;
cros_component_manager->Load(
kTestComponentName, CrOSComponentManager::MountPolicy::kMount,
@@ -570,7 +570,7 @@
base::MakeRefCounted<CrOSComponentInstaller>(nullptr,
update_service.get());
- base::Optional<CrOSComponentManager::Error> load_result;
+ absl::optional<CrOSComponentManager::Error> load_result;
base::FilePath mount_path;
cros_component_manager->Load(
kTestComponentName, CrOSComponentManager::MountPolicy::kMount,
@@ -591,10 +591,10 @@
}
TEST_F(CrOSComponentInstallerTest, LoadObsoleteInstalledComponent_Skip_Mount) {
- base::Optional<base::FilePath> old_install_path = CreateInstalledComponent(
+ absl::optional<base::FilePath> old_install_path = CreateInstalledComponent(
kTestComponentName, "0.5", kTestComponentInvalidMinEnvVersion);
ASSERT_TRUE(old_install_path.has_value());
- base::Optional<base::FilePath> old_preinstall_path = CreateInstalledComponent(
+ absl::optional<base::FilePath> old_preinstall_path = CreateInstalledComponent(
kTestComponentName, "0.5", kTestComponentInvalidMinEnvVersion);
ASSERT_TRUE(old_preinstall_path.has_value());
@@ -608,7 +608,7 @@
base::MakeRefCounted<CrOSComponentInstaller>(nullptr,
update_service.get());
- base::Optional<CrOSComponentManager::Error> load_result;
+ absl::optional<CrOSComponentManager::Error> load_result;
base::FilePath mount_path;
cros_component_manager->Load(
kTestComponentName, CrOSComponentManager::MountPolicy::kMount,
@@ -639,7 +639,7 @@
base::MakeRefCounted<CrOSComponentInstaller>(nullptr,
update_service.get());
- base::Optional<CrOSComponentManager::Error> load_result;
+ absl::optional<CrOSComponentManager::Error> load_result;
base::FilePath mount_path;
cros_component_manager->Load(
kTestComponentName, CrOSComponentManager::MountPolicy::kMount,
@@ -647,7 +647,7 @@
base::BindOnce(&RecordLoadResult, &load_result, &mount_path));
RunUntilIdle();
- base::Optional<base::FilePath> unpacked_path = CreateUnpackedComponent(
+ absl::optional<base::FilePath> unpacked_path = CreateUnpackedComponent(
kTestComponentName, "2.0", kTestComponentValidMinEnvVersion);
ASSERT_TRUE(unpacked_path.has_value());
ASSERT_TRUE(updater.FinishForegroundUpdate(
@@ -672,14 +672,14 @@
base::MakeRefCounted<CrOSComponentInstaller>(nullptr,
update_service.get());
- base::Optional<CrOSComponentManager::Error> load_result1;
+ absl::optional<CrOSComponentManager::Error> load_result1;
base::FilePath mount_path1;
cros_component_manager->Load(
kTestComponentName, CrOSComponentManager::MountPolicy::kMount,
CrOSComponentManager::UpdatePolicy::kForce,
base::BindOnce(&RecordLoadResult, &load_result1, &mount_path1));
- base::Optional<CrOSComponentManager::Error> load_result2;
+ absl::optional<CrOSComponentManager::Error> load_result2;
base::FilePath mount_path2;
cros_component_manager->Load(
kTestComponentName, CrOSComponentManager::MountPolicy::kMount,
@@ -687,7 +687,7 @@
base::BindOnce(&RecordLoadResult, &load_result2, &mount_path2));
RunUntilIdle();
- base::Optional<base::FilePath> unpacked_path = CreateUnpackedComponent(
+ absl::optional<base::FilePath> unpacked_path = CreateUnpackedComponent(
kTestComponentName, "2.0", kTestComponentValidMinEnvVersion);
ASSERT_TRUE(unpacked_path.has_value());
ASSERT_TRUE(updater.FinishForegroundUpdate(
@@ -732,7 +732,7 @@
base::MakeRefCounted<CrOSComponentInstaller>(nullptr,
update_service.get());
- base::Optional<CrOSComponentManager::Error> load_result;
+ absl::optional<CrOSComponentManager::Error> load_result;
base::FilePath mount_path;
cros_component_manager->Load(
kTestComponentName, CrOSComponentManager::MountPolicy::kMount,
@@ -759,10 +759,10 @@
TEST_F(CrOSComponentInstallerTest,
LoadWithObsoleteInstalledComponent_DontForce_Mount) {
- base::Optional<base::FilePath> old_install_path = CreateInstalledComponent(
+ absl::optional<base::FilePath> old_install_path = CreateInstalledComponent(
kTestComponentName, "0.5", kTestComponentInvalidMinEnvVersion);
ASSERT_TRUE(old_install_path.has_value());
- base::Optional<base::FilePath> old_preinstall_path =
+ absl::optional<base::FilePath> old_preinstall_path =
CreatePreinstalledComponent(kTestComponentName, "0.5",
kTestComponentInvalidMinEnvVersion);
ASSERT_TRUE(old_preinstall_path.has_value());
@@ -777,7 +777,7 @@
base::MakeRefCounted<CrOSComponentInstaller>(nullptr,
update_service.get());
- base::Optional<CrOSComponentManager::Error> load_result;
+ absl::optional<CrOSComponentManager::Error> load_result;
base::FilePath mount_path;
cros_component_manager->Load(
kTestComponentName, CrOSComponentManager::MountPolicy::kMount,
@@ -785,7 +785,7 @@
base::BindOnce(&RecordLoadResult, &load_result, &mount_path));
RunUntilIdle();
- base::Optional<base::FilePath> unpacked_path = CreateUnpackedComponent(
+ absl::optional<base::FilePath> unpacked_path = CreateUnpackedComponent(
kTestComponentName, "2.0", kTestComponentValidMinEnvVersion);
ASSERT_TRUE(unpacked_path.has_value());
ASSERT_TRUE(updater.FinishForegroundUpdate(
@@ -800,7 +800,7 @@
}
TEST_F(CrOSComponentInstallerTest, RegisterAllRegistersInstalledComponent) {
- base::Optional<base::FilePath> install_path = CreateInstalledComponent(
+ absl::optional<base::FilePath> install_path = CreateInstalledComponent(
kTestComponentName, "1.0", kTestComponentValidMinEnvVersion);
ASSERT_TRUE(install_path.has_value());
@@ -824,7 +824,7 @@
}
TEST_F(CrOSComponentInstallerTest, RegisterAllIgnoresPrenstalledComponent) {
- base::Optional<base::FilePath> preinstall_path = CreatePreinstalledComponent(
+ absl::optional<base::FilePath> preinstall_path = CreatePreinstalledComponent(
kTestComponentName, "1.0", kTestComponentValidMinEnvVersion);
ASSERT_TRUE(preinstall_path.has_value());
@@ -844,7 +844,7 @@
TEST_F(CrOSComponentInstallerTest,
LoadInstalledComponentAfterRegisterInstalled) {
- base::Optional<base::FilePath> install_path = CreateInstalledComponent(
+ absl::optional<base::FilePath> install_path = CreateInstalledComponent(
kTestComponentName, "1.0", kTestComponentValidMinEnvVersion);
ASSERT_TRUE(install_path.has_value());
@@ -864,7 +864,7 @@
EXPECT_EQ(install_path.value(),
cros_component_manager->GetCompatiblePath(kTestComponentName));
- base::Optional<CrOSComponentManager::Error> load_result;
+ absl::optional<CrOSComponentManager::Error> load_result;
base::FilePath mount_path;
cros_component_manager->Load(
kTestComponentName, CrOSComponentManager::MountPolicy::kMount,
@@ -881,7 +881,7 @@
TEST_F(CrOSComponentInstallerTest,
LoadInstalledComponentConcurrentWithRegisterInstalled) {
- base::Optional<base::FilePath> install_path = CreateInstalledComponent(
+ absl::optional<base::FilePath> install_path = CreateInstalledComponent(
kTestComponentName, "1.0", kTestComponentValidMinEnvVersion);
ASSERT_TRUE(install_path.has_value());
@@ -905,7 +905,7 @@
cros_component_manager->RegisterInstalled();
EXPECT_FALSE(updater.HasPendingUpdate(kTestComponentName));
- base::Optional<CrOSComponentManager::Error> load_result;
+ absl::optional<CrOSComponentManager::Error> load_result;
base::FilePath mount_path;
cros_component_manager->Load(
kTestComponentName, CrOSComponentManager::MountPolicy::kMount,
diff --git a/chrome/browser/component_updater/first_party_sets_component_installer.cc b/chrome/browser/component_updater/first_party_sets_component_installer.cc
index c63116e..ac7db03 100644
--- a/chrome/browser/component_updater/first_party_sets_component_installer.cc
+++ b/chrome/browser/component_updater/first_party_sets_component_installer.cc
@@ -10,7 +10,6 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/stl_util.h"
#include "base/task/post_task.h"
@@ -20,6 +19,7 @@
#include "content/public/browser/network_service_instance.h"
#include "net/base/features.h"
#include "services/network/public/mojom/network_service.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using component_updater::ComponentUpdateService;
@@ -42,9 +42,9 @@
// Reads the sets as raw JSON from their storage file, returning the raw sets on
// success and nullopt on failure.
-base::Optional<std::string> LoadSetsFromDisk(const base::FilePath& pb_path) {
+absl::optional<std::string> LoadSetsFromDisk(const base::FilePath& pb_path) {
if (pb_path.empty())
- return base::nullopt;
+ return absl::nullopt;
VLOG(1) << "Reading First-Party Sets from file: " << pb_path.value();
std::string result;
@@ -52,7 +52,7 @@
// The file won't exist on new installations, so this is not always an
// error.
VLOG(1) << "Failed reading from " << pb_path.value();
- return base::nullopt;
+ return absl::nullopt;
}
return result;
}
@@ -72,7 +72,7 @@
base::BindOnce(&LoadSetsFromDisk, GetConfigPathInstance()),
base::BindOnce(
[](base::RepeatingCallback<void(const std::string&)> on_sets_ready,
- base::Optional<std::string> raw_sets) {
+ absl::optional<std::string> raw_sets) {
if (raw_sets.has_value())
on_sets_ready.Run(*raw_sets);
},
diff --git a/chrome/browser/component_updater/smart_dim_component_installer.cc b/chrome/browser/component_updater/smart_dim_component_installer.cc
index bddebe77..104e499 100644
--- a/chrome/browser/component_updater/smart_dim_component_installer.cc
+++ b/chrome/browser/component_updater/smart_dim_component_installer.cc
@@ -15,7 +15,6 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/metrics/field_trial_params.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/version.h"
@@ -23,6 +22,7 @@
#include "chrome/browser/chromeos/power/ml/smart_dim/ml_agent.h"
#include "components/component_updater/component_updater_service.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -56,7 +56,7 @@
// Read files from the component to strings, should be called from a blocking
// task runner.
-base::Optional<ComponentFileContents> ReadComponentFiles(
+absl::optional<ComponentFileContents> ReadComponentFiles(
const base::FilePath& meta_json_path,
const base::FilePath& preprocessor_pb_path,
const base::FilePath& model_path) {
@@ -65,7 +65,7 @@
!base::ReadFileToString(preprocessor_pb_path, &preprocessor_proto) ||
!base::ReadFileToString(model_path, &model_flatbuffer)) {
DLOG(ERROR) << "Failed reading component files.";
- return base::nullopt;
+ return absl::nullopt;
}
return std::make_tuple(std::move(metadata_json),
@@ -74,8 +74,8 @@
}
void UpdateSmartDimMlAgent(
- const base::Optional<ComponentFileContents>& result) {
- if (result == base::nullopt) {
+ const absl::optional<ComponentFileContents>& result) {
+ if (result == absl::nullopt) {
LogLoadComponentEvent(LoadComponentEvent::kReadComponentFilesError);
return;
}
diff --git a/chrome/browser/component_updater/soda_component_installer.cc b/chrome/browser/component_updater/soda_component_installer.cc
index 5503b9ba..e0ad8baf 100644
--- a/chrome/browser/component_updater/soda_component_installer.cc
+++ b/chrome/browser/component_updater/soda_component_installer.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/task/task_traits.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
@@ -22,6 +21,7 @@
#include "content/public/browser/browser_thread.h"
#include "crypto/sha2.h"
#include "media/base/media_switches.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include <memory>
#include <utility>
@@ -248,7 +248,7 @@
if (base::FeatureList::IsEnabled(media::kUseSodaForLiveCaption) &&
media::IsLiveCaptionFeatureEnabled()) {
- base::Optional<speech::SodaLanguagePackComponentConfig> config =
+ absl::optional<speech::SodaLanguagePackComponentConfig> config =
speech::GetLanguageComponentConfig(language);
if (config) {
RegisterSodaLanguagePackComponent(config.value(), cus, global_prefs,
diff --git a/chrome/browser/component_updater/soda_language_pack_component_installer.cc b/chrome/browser/component_updater/soda_language_pack_component_installer.cc
index e2bb1eb3..f8b6b83c 100644
--- a/chrome/browser/component_updater/soda_language_pack_component_installer.cc
+++ b/chrome/browser/component_updater/soda_language_pack_component_installer.cc
@@ -52,7 +52,7 @@
std::string SodaLanguagePackComponentInstallerPolicy::GetExtensionId(
speech::LanguageCode language_code) {
- base::Optional<speech::SodaLanguagePackComponentConfig> config =
+ absl::optional<speech::SodaLanguagePackComponentConfig> config =
speech::GetLanguageComponentConfig(language_code);
if (config) {
@@ -158,7 +158,7 @@
PrefService* prefs,
const base::FilePath& install_dir) {
#if !defined(OS_ANDROID)
- base::Optional<speech::SodaLanguagePackComponentConfig> config =
+ absl::optional<speech::SodaLanguagePackComponentConfig> config =
speech::GetLanguageComponentConfig(language_code);
if (config) {
prefs->SetFilePath(
diff --git a/chrome/browser/component_updater/soda_language_pack_component_installer_unittest.cc b/chrome/browser/component_updater/soda_language_pack_component_installer_unittest.cc
index 10c45451..0cbd122 100644
--- a/chrome/browser/component_updater/soda_language_pack_component_installer_unittest.cc
+++ b/chrome/browser/component_updater/soda_language_pack_component_installer_unittest.cc
@@ -24,13 +24,13 @@
};
TEST_F(SodaLanguagePackComponentInstallerTest, TestGetLanguageComponentConfig) {
- base::Optional<speech::SodaLanguagePackComponentConfig> config_by_name =
+ absl::optional<speech::SodaLanguagePackComponentConfig> config_by_name =
speech::GetLanguageComponentConfig("fr-FR");
ASSERT_TRUE(config_by_name);
ASSERT_EQ(config_by_name.value().language_code, speech::LanguageCode::kFrFr);
- base::Optional<speech::SodaLanguagePackComponentConfig>
+ absl::optional<speech::SodaLanguagePackComponentConfig>
config_by_language_code =
speech::GetLanguageComponentConfig(speech::LanguageCode::kFrFr);
diff --git a/chrome/browser/component_updater/zxcvbn_data_component_installer_unittest.cc b/chrome/browser/component_updater/zxcvbn_data_component_installer_unittest.cc
index 3689a5f..f30d415 100644
--- a/chrome/browser/component_updater/zxcvbn_data_component_installer_unittest.cc
+++ b/chrome/browser/component_updater/zxcvbn_data_component_installer_unittest.cc
@@ -7,11 +7,11 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "base/test/task_environment.h"
#include "base/values.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/zxcvbn-cpp/native-src/zxcvbn/frequency_lists.hpp"
namespace component_updater {
diff --git a/chrome/browser/content_index/content_index_browsertest.cc b/chrome/browser/content_index/content_index_browsertest.cc
index 7457dfc..fa96018 100644
--- a/chrome/browser/content_index/content_index_browsertest.cc
+++ b/chrome/browser/content_index/content_index_browsertest.cc
@@ -7,7 +7,6 @@
#include <vector>
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/test/bind.h"
@@ -27,6 +26,7 @@
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/service_worker/service_worker_status_code.h"
#include "third_party/re2/src/re2/re2.h"
#include "url/gurl.h"
@@ -97,7 +97,7 @@
void OnItemUpdated(
const OfflineItem& item,
- const base::Optional<offline_items_collection::UpdateDelta>& update_delta)
+ const absl::optional<offline_items_collection::UpdateDelta>& update_delta)
override {
NOTREACHED();
}
@@ -116,12 +116,12 @@
wait_for_tab_change_ = std::move(closure);
}
- base::Optional<OfflineItem> GetItem(const ContentId& id) {
- base::Optional<OfflineItem> out_item;
+ absl::optional<OfflineItem> GetItem(const ContentId& id) {
+ absl::optional<OfflineItem> out_item;
base::RunLoop run_loop;
provider_->GetItemById(id,
base::BindLambdaForTesting(
- [&](const base::Optional<OfflineItem>& item) {
+ [&](const absl::optional<OfflineItem>& item) {
out_item = item;
run_loop.Quit();
}));
diff --git a/chrome/browser/content_index/content_index_metrics.cc b/chrome/browser/content_index/content_index_metrics.cc
index 468a45b..712783a 100644
--- a/chrome/browser/content_index/content_index_metrics.cc
+++ b/chrome/browser/content_index/content_index_metrics.cc
@@ -14,7 +14,7 @@
namespace {
void MaybeRecordUkmContentAdded(blink::mojom::ContentCategory category,
- base::Optional<ukm::SourceId> source_id) {
+ absl::optional<ukm::SourceId> source_id) {
if (!source_id)
return;
@@ -24,7 +24,7 @@
}
void MaybeRecordUkmContentDeletedByUser(
- base::Optional<ukm::SourceId> source_id) {
+ absl::optional<ukm::SourceId> source_id) {
if (!source_id)
return;
diff --git a/chrome/browser/content_index/content_index_provider_impl.cc b/chrome/browser/content_index/content_index_provider_impl.cc
index dc9173e..d1666691f 100644
--- a/chrome/browser/content_index/content_index_provider_impl.cc
+++ b/chrome/browser/content_index/content_index_provider_impl.cc
@@ -183,7 +183,7 @@
}
void ContentIndexProviderImpl::DidGetEntryToOpen(
- base::Optional<content::ContentIndexEntry> entry) {
+ absl::optional<content::ContentIndexEntry> entry) {
if (!entry)
return;
@@ -247,7 +247,7 @@
if (!storage_partition || !storage_partition->GetContentIndexContext()) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(std::move(callback), base::nullopt));
+ FROM_HERE, base::BindOnce(std::move(callback), absl::nullopt));
return;
}
@@ -259,9 +259,9 @@
void ContentIndexProviderImpl::DidGetItem(
SingleItemCallback callback,
- base::Optional<content::ContentIndexEntry> entry) {
+ absl::optional<content::ContentIndexEntry> entry) {
if (!entry)
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
else
std::move(callback).Run(EntryToOfflineItem(*entry));
}
@@ -395,6 +395,6 @@
void ContentIndexProviderImpl::ChangeSchedule(
const ContentId& id,
- base::Optional<OfflineItemSchedule> schedule) {
+ absl::optional<OfflineItemSchedule> schedule) {
NOTREACHED();
}
diff --git a/chrome/browser/content_index/content_index_provider_impl.h b/chrome/browser/content_index/content_index_provider_impl.h
index ccf85ba..9d97070c 100644
--- a/chrome/browser/content_index/content_index_provider_impl.h
+++ b/chrome/browser/content_index/content_index_provider_impl.h
@@ -9,12 +9,12 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/content_index/content_index_metrics.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/offline_items_collection/core/offline_content_provider.h"
#include "components/offline_items_collection/core/offline_item.h"
#include "content/public/browser/content_index_provider.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -72,7 +72,7 @@
RenameCallback callback) override;
void ChangeSchedule(
const offline_items_collection::ContentId& id,
- base::Optional<offline_items_collection::OfflineItemSchedule> schedule)
+ absl::optional<offline_items_collection::OfflineItemSchedule> schedule)
override;
void SetIconSizesForTesting(std::vector<gfx::Size> icon_sizes) {
@@ -81,7 +81,7 @@
private:
void DidGetItem(SingleItemCallback callback,
- base::Optional<content::ContentIndexEntry> entry);
+ absl::optional<content::ContentIndexEntry> entry);
void DidGetAllEntriesAcrossStorageParitions(
std::unique_ptr<OfflineItemList> item_list,
MultipleItemCallback callback);
@@ -92,7 +92,7 @@
void DidGetIcons(const offline_items_collection::ContentId& id,
VisualsCallback callback,
std::vector<SkBitmap> icons);
- void DidGetEntryToOpen(base::Optional<content::ContentIndexEntry> entry);
+ void DidGetEntryToOpen(absl::optional<content::ContentIndexEntry> entry);
void DidOpenTab(content::ContentIndexEntry entry,
content::WebContents* web_contents);
offline_items_collection::OfflineItem EntryToOfflineItem(
@@ -102,7 +102,7 @@
ContentIndexMetrics metrics_;
offline_items_collection::OfflineContentAggregator* aggregator_;
site_engagement::SiteEngagementService* site_engagement_service_;
- base::Optional<std::vector<gfx::Size>> icon_sizes_for_testing_;
+ absl::optional<std::vector<gfx::Size>> icon_sizes_for_testing_;
base::WeakPtrFactory<ContentIndexProviderImpl> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ContentIndexProviderImpl);
diff --git a/chrome/browser/content_index/content_index_provider_unittest.cc b/chrome/browser/content_index/content_index_provider_unittest.cc
index bbfaca5..76efea3 100644
--- a/chrome/browser/content_index/content_index_provider_unittest.cc
+++ b/chrome/browser/content_index/content_index_provider_unittest.cc
@@ -93,7 +93,7 @@
void(const OfflineContentProvider::OfflineItemList& items));
MOCK_METHOD1(OnItemRemoved, void(const ContentId& id));
void OnItemUpdated(const OfflineItem& item,
- const base::Optional<UpdateDelta>& update_delta) override {
+ const absl::optional<UpdateDelta>& update_delta) override {
NOTREACHED();
}
void OnContentProviderGoingDown() override {}
diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
index 98bebee..8df1e0a 100644
--- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc
+++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -2077,7 +2077,7 @@
ASSERT_EQ(3u, settings.size());
// Validate that using no SessionModel functions the exact same way.
- map->GetSettingsForOneType(persistent_type, &settings, base::nullopt);
+ map->GetSettingsForOneType(persistent_type, &settings, absl::nullopt);
ASSERT_EQ(3u, settings.size());
// Each one/type of settings we set should be retrievable by specifying the
diff --git a/chrome/browser/continuous_search/internal/search_url_helper.cc b/chrome/browser/continuous_search/internal/search_url_helper.cc
index 4a8deae..2c5784d 100644
--- a/chrome/browser/continuous_search/internal/search_url_helper.cc
+++ b/chrome/browser/continuous_search/internal/search_url_helper.cc
@@ -39,7 +39,7 @@
if (!url->is_valid())
return base::android::ScopedJavaLocalRef<jstring>();
- base::Optional<std::string> query = ExtractSearchQueryIfValidUrl(*url);
+ absl::optional<std::string> query = ExtractSearchQueryIfValidUrl(*url);
return query.has_value()
? base::android::ConvertUTF8ToJavaString(env, query.value())
@@ -56,10 +56,10 @@
return static_cast<jint>(GetSrpPageCategoryForUrl(*url));
}
-base::Optional<std::string> ExtractSearchQueryIfValidUrl(const GURL& url) {
+absl::optional<std::string> ExtractSearchQueryIfValidUrl(const GURL& url) {
if (!google_util::IsGoogleSearchUrl(url) ||
GetSrpPageCategoryForUrl(url) == PageCategory::kNone)
- return base::nullopt;
+ return absl::nullopt;
base::StringPiece query_str = url.query_piece();
url::Component query(0, static_cast<int>(query_str.length())), key, value;
@@ -73,7 +73,7 @@
base::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS);
}
}
- return base::nullopt;
+ return absl::nullopt;
}
PageCategory GetSrpPageCategoryForUrl(const GURL& url) {
diff --git a/chrome/browser/continuous_search/internal/search_url_helper.h b/chrome/browser/continuous_search/internal/search_url_helper.h
index 305bf9b..079ee15 100644
--- a/chrome/browser/continuous_search/internal/search_url_helper.h
+++ b/chrome/browser/continuous_search/internal/search_url_helper.h
@@ -7,13 +7,13 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/continuous_search/page_category.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace continuous_search {
-base::Optional<std::string> ExtractSearchQueryIfValidUrl(const GURL& url);
+absl::optional<std::string> ExtractSearchQueryIfValidUrl(const GURL& url);
PageCategory GetSrpPageCategoryForUrl(const GURL& url);
diff --git a/chrome/browser/continuous_search/internal/search_url_helper_unittest.cc b/chrome/browser/continuous_search/internal/search_url_helper_unittest.cc
index 205cd69..4b29fdc 100644
--- a/chrome/browser/continuous_search/internal/search_url_helper_unittest.cc
+++ b/chrome/browser/continuous_search/internal/search_url_helper_unittest.cc
@@ -6,10 +6,10 @@
#include <string>
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace continuous_search {
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc
index 49cd2b5..041ab36b 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc
@@ -15,7 +15,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/profiles/profile_io_data.h"
@@ -25,6 +24,7 @@
#include "components/prefs/pref_service.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/child_process_security_policy.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/security/protocol_handler_security_level.h"
using content::BrowserThread;
@@ -929,7 +929,7 @@
if (handlers.size() == 1 && handlers[0] == default_handler)
app_protocols[protocol] = default_handler.web_app_id();
else
- app_protocols[protocol] = base::nullopt;
+ app_protocols[protocol] = absl::nullopt;
}
delegate_->RegisterAppProtocolsWithOS(
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
index dfae8b98..456ab10 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -119,7 +119,7 @@
}
bool IsFakeAppHandlerRegisteredWithOS(const std::string& protocol,
- base::Optional<std::string> app_id) {
+ absl::optional<std::string> app_id) {
auto handler_iter = os_registered_app_protocols_.find(protocol);
return handler_iter != os_registered_app_protocols_.end() &&
handler_iter->second == app_id;
@@ -1359,7 +1359,7 @@
registry()->RegisterAppProtocolHandlers("app_id2", {ph2_info});
// The protocol should be registered for disambiguation with a null app_id.
EXPECT_TRUE(delegate()->IsFakeAppHandlerRegisteredWithOS(ph2.protocol(),
- base::nullopt));
+ absl::nullopt));
}
TEST_F(ProtocolHandlerRegistryTest, TestRemoveWebAppHandlers) {
@@ -1378,7 +1378,7 @@
registry()->RegisterAppProtocolHandlers("app_id2", {ph3_info});
EXPECT_TRUE(
- delegate()->IsFakeAppHandlerRegisteredWithOS("mailto", base::nullopt));
+ delegate()->IsFakeAppHandlerRegisteredWithOS("mailto", absl::nullopt));
EXPECT_TRUE(
delegate()->IsFakeAppHandlerRegisteredWithOS("web+testing", "app_id1"));
@@ -1416,7 +1416,7 @@
registry()->RegisterAppProtocolHandlers("app_id2", {ph2_info});
ASSERT_TRUE(
- delegate()->IsFakeAppHandlerRegisteredWithOS("mailto", base::nullopt));
+ delegate()->IsFakeAppHandlerRegisteredWithOS("mailto", absl::nullopt));
// Remove the non default handler (ph2) and test that the protocol is handled
// by ph1 and no longer registered for disambiguation.
diff --git a/chrome/browser/device_api/device_attribute_api.cc b/chrome/browser/device_api/device_attribute_api.cc
index 70cc06c..8a2a8f1 100644
--- a/chrome/browser/device_api/device_attribute_api.cc
+++ b/chrome/browser/device_api/device_attribute_api.cc
@@ -35,7 +35,7 @@
Result::NewErrorMessage(lacros_result->get_error_message()));
} else if (lacros_result->get_contents().empty()) {
std::move(callback).Run(
- Result::NewAttribute(base::Optional<std::string>()));
+ Result::NewAttribute(absl::optional<std::string>()));
} else {
std::move(callback).Run(
Result::NewAttribute(lacros_result->get_contents()));
@@ -52,7 +52,7 @@
->GetDirectoryApiID();
if (attribute.empty())
std::move(callback).Run(
- Result::NewAttribute(base::Optional<std::string>()));
+ Result::NewAttribute(absl::optional<std::string>()));
else
std::move(callback).Run(Result::NewAttribute(attribute));
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -74,7 +74,7 @@
->GetDeviceHostname();
if (attribute.empty())
std::move(callback).Run(
- Result::NewAttribute(base::Optional<std::string>()));
+ Result::NewAttribute(absl::optional<std::string>()));
else
std::move(callback).Run(Result::NewAttribute(attribute));
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -95,7 +95,7 @@
->GetEnterpriseMachineID();
if (attribute.empty())
std::move(callback).Run(
- Result::NewAttribute(base::Optional<std::string>()));
+ Result::NewAttribute(absl::optional<std::string>()));
else
std::move(callback).Run(Result::NewAttribute(attribute));
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -117,7 +117,7 @@
->GetDeviceAssetID();
if (attribute.empty())
std::move(callback).Run(
- Result::NewAttribute(base::Optional<std::string>()));
+ Result::NewAttribute(absl::optional<std::string>()));
else
std::move(callback).Run(Result::NewAttribute(attribute));
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -139,7 +139,7 @@
->GetDeviceAnnotatedLocation();
if (attribute.empty())
std::move(callback).Run(
- Result::NewAttribute(base::Optional<std::string>()));
+ Result::NewAttribute(absl::optional<std::string>()));
else
std::move(callback).Run(Result::NewAttribute(attribute));
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/chrome/browser/device_api/managed_configuration_service.cc b/chrome/browser/device_api/managed_configuration_service.cc
index abe456d..97a631e 100644
--- a/chrome/browser/device_api/managed_configuration_service.cc
+++ b/chrome/browser/device_api/managed_configuration_service.cc
@@ -45,7 +45,7 @@
[](GetManagedConfigurationCallback callback,
std::unique_ptr<base::DictionaryValue> result) {
if (!result) {
- return std::move(callback).Run(base::nullopt);
+ return std::move(callback).Run(absl::nullopt);
}
std::vector<std::pair<std::string, std::string>> items;
for (const auto& it : result->DictItems())
diff --git a/chrome/browser/devtools/device/devtools_device_discovery.cc b/chrome/browser/devtools/device/devtools_device_discovery.cc
index fb700c13..76575a5 100644
--- a/chrome/browser/devtools/device/devtools_device_discovery.cc
+++ b/chrome/browser/devtools/device/devtools_device_discovery.cc
@@ -457,7 +457,7 @@
if (result < 0)
return;
// Parse version, append to package name if available,
- base::Optional<base::Value> value = base::JSONReader::Read(response);
+ absl::optional<base::Value> value = base::JSONReader::Read(response);
if (value && value->is_dict()) {
const std::string* browser_name = value->FindStringKey("Browser");
if (browser_name) {
@@ -487,7 +487,7 @@
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (result < 0)
return;
- base::Optional<base::Value> value = base::JSONReader::Read(response);
+ absl::optional<base::Value> value = base::JSONReader::Read(response);
if (value && value->is_list()) {
for (base::Value& page_value : value->GetList()) {
if (page_value.is_dict())
diff --git a/chrome/browser/devtools/device/port_forwarding_controller.cc b/chrome/browser/devtools/device/port_forwarding_controller.cc
index 582822f..092fd69 100644
--- a/chrome/browser/devtools/device/port_forwarding_controller.cc
+++ b/chrome/browser/devtools/device/port_forwarding_controller.cc
@@ -69,8 +69,8 @@
static bool ParseNotification(const std::string& json,
std::string* method,
- base::Optional<base::Value>* params) {
- base::Optional<base::Value> value = base::JSONReader::Read(json);
+ absl::optional<base::Value>* params) {
+ absl::optional<base::Value> value = base::JSONReader::Read(json);
if (!value || !value->is_dict())
return false;
@@ -88,15 +88,15 @@
static bool ParseResponse(const std::string& json,
int* command_id,
int* error_code) {
- base::Optional<base::Value> value = base::JSONReader::Read(json);
+ absl::optional<base::Value> value = base::JSONReader::Read(json);
if (!value || !value->is_dict())
return false;
- base::Optional<int> command_id_opt = value->FindIntKey(kIdParam);
+ absl::optional<int> command_id_opt = value->FindIntKey(kIdParam);
if (!command_id_opt)
return false;
*command_id = *command_id_opt;
- base::Optional<int> error_value = value->FindIntPath(kErrorCodePath);
+ absl::optional<int> error_value = value->FindIntPath(kErrorCodePath);
if (error_value)
*error_code = *error_value;
@@ -168,7 +168,7 @@
receiver_.set_disconnect_handler(
base::BindOnce(&PortForwardingHostResolver::OnComplete,
base::Unretained(this), net::ERR_NAME_NOT_RESOLVED,
- net::ResolveErrorInfo(net::ERR_FAILED), base::nullopt));
+ net::ResolveErrorInfo(net::ERR_FAILED), absl::nullopt));
}
private:
@@ -180,7 +180,7 @@
void OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) override {
+ const absl::optional<net::AddressList>& resolved_addresses) override {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (result < 0) {
@@ -562,14 +562,14 @@
return;
std::string method;
- base::Optional<base::Value> params;
+ absl::optional<base::Value> params;
if (!ParseNotification(message, &method, ¶ms))
return;
if (method != kAcceptedEvent || !params)
return;
- base::Optional<int> port = params->FindIntKey(kPortParam);
+ absl::optional<int> port = params->FindIntKey(kPortParam);
if (!port)
return;
const std::string* connection_id = params->FindStringKey(kConnectionIdParam);
diff --git a/chrome/browser/devtools/device/tcp_device_provider.cc b/chrome/browser/devtools/device/tcp_device_provider.cc
index d7ce27e..6584673 100644
--- a/chrome/browser/devtools/device/tcp_device_provider.cc
+++ b/chrome/browser/devtools/device/tcp_device_provider.cc
@@ -51,7 +51,7 @@
pending_receiver) {
g_browser_process->system_network_context_manager()
->GetContext()
- ->CreateHostResolver(base::nullopt,
+ ->CreateHostResolver(absl::nullopt,
std::move(pending_receiver));
},
resolver.BindNewPipeAndPassReceiver()));
@@ -63,7 +63,7 @@
receiver_.set_disconnect_handler(
base::BindOnce(&ResolveHostAndOpenSocket::OnComplete,
base::Unretained(this), net::ERR_NAME_NOT_RESOLVED,
- net::ResolveErrorInfo(net::ERR_FAILED), base::nullopt));
+ net::ResolveErrorInfo(net::ERR_FAILED), absl::nullopt));
}
private:
@@ -71,7 +71,7 @@
void OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) override {
+ const absl::optional<net::AddressList>& resolved_addresses) override {
if (result != net::OK) {
RunSocketCallback(std::move(callback_), nullptr,
resolve_error_info.error);
diff --git a/chrome/browser/devtools/devtools_browsertest.cc b/chrome/browser/devtools/devtools_browsertest.cc
index fa572f1..7a83ce3 100644
--- a/chrome/browser/devtools/devtools_browsertest.cc
+++ b/chrome/browser/devtools/devtools_browsertest.cc
@@ -15,7 +15,6 @@
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
@@ -110,6 +109,7 @@
#include "net/test/embedded_test_server/http_response.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/chrome_debug_urls.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/base/ui_base_switches.h"
diff --git a/chrome/browser/devtools/devtools_file_helper.cc b/chrome/browser/devtools/devtools_file_helper.cc
index 012065cc..ab66df8d 100644
--- a/chrome/browser/devtools/devtools_file_helper.cc
+++ b/chrome/browser/devtools/devtools_file_helper.cc
@@ -249,7 +249,7 @@
const base::Value* path_value;
if (file_map->Get(base::MD5String(url), &path_value)) {
- base::Optional<base::FilePath> path = util::ValueToFilePath(*path_value);
+ absl::optional<base::FilePath> path = util::ValueToFilePath(*path_value);
if (path)
initial_path = std::move(*path);
}
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc
index 838a512..0335038 100644
--- a/chrome/browser/devtools/devtools_ui_bindings.cc
+++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -1035,7 +1035,7 @@
if (indexing_jobs_.count(index_request_id) != 0)
return;
std::vector<std::string> excluded_folders;
- base::Optional<base::Value> parsed_excluded_folders =
+ absl::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()) {
@@ -1117,11 +1117,11 @@
const std::string& port_forwarding_config,
bool network_discovery_enabled,
const std::string& network_discovery_config) {
- base::Optional<base::Value> parsed_port_forwarding =
+ absl::optional<base::Value> parsed_port_forwarding =
base::JSONReader::Read(port_forwarding_config);
if (!parsed_port_forwarding || !parsed_port_forwarding->is_dict())
return;
- base::Optional<base::Value> parsed_network =
+ absl::optional<base::Value> parsed_network =
base::JSONReader::Read(network_discovery_config);
if (!parsed_network || !parsed_network->is_list())
return;
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc
index e49c598..905e509 100644
--- a/chrome/browser/devtools/devtools_window.cc
+++ b/chrome/browser/devtools/devtools_window.cc
@@ -126,7 +126,7 @@
}
void SetPreferencesFromJson(Profile* profile, const std::string& json) {
- base::Optional<base::Value> parsed = base::JSONReader::Read(json);
+ absl::optional<base::Value> parsed = base::JSONReader::Read(json);
if (!parsed || !parsed->is_dict())
return;
DictionaryPrefUpdate update(profile->GetPrefs(), prefs::kDevToolsPreferences);
@@ -273,7 +273,7 @@
void DevToolsEventForwarder::SetWhitelistedShortcuts(
const std::string& message) {
- base::Optional<base::Value> parsed_message = base::JSONReader::Read(message);
+ absl::optional<base::Value> parsed_message = base::JSONReader::Read(message);
if (!parsed_message || !parsed_message->is_list())
return;
for (const auto& list_item : parsed_message->GetList()) {
@@ -1555,7 +1555,7 @@
}
void DevToolsWindow::ShowCertificateViewer(const std::string& cert_chain) {
- base::Optional<base::Value> value = base::JSONReader::Read(cert_chain);
+ absl::optional<base::Value> value = base::JSONReader::Read(cert_chain);
CHECK(value && value->is_list());
std::vector<std::string> decoded;
for (const auto& item : value->GetList()) {
diff --git a/chrome/browser/devtools/protocol/devtools_protocol_test_support.cc b/chrome/browser/devtools/protocol/devtools_protocol_test_support.cc
index 8102d36..3dd8bd1 100644
--- a/chrome/browser/devtools/protocol/devtools_protocol_test_support.cc
+++ b/chrome/browser/devtools/protocol/devtools_protocol_test_support.cc
@@ -32,7 +32,7 @@
base::span<const uint8_t> message) {
base::StringPiece message_str(reinterpret_cast<const char*>(message.data()),
message.size());
- base::Optional<base::Value> parsed_message =
+ absl::optional<base::Value> parsed_message =
base::JSONReader::Read(message_str);
ASSERT_TRUE(parsed_message.has_value());
if (auto id = parsed_message->FindIntPath("id")) {
diff --git a/chrome/browser/dom_distiller/distillable_page_utils_browsertest.cc b/chrome/browser/dom_distiller/distillable_page_utils_browsertest.cc
index 0111def..0892676 100644
--- a/chrome/browser/dom_distiller/distillable_page_utils_browsertest.cc
+++ b/chrome/browser/dom_distiller/distillable_page_utils_browsertest.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
@@ -25,6 +24,7 @@
#include "content/public/test/test_utils.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_MAC) || \
defined(OS_WIN)
@@ -163,7 +163,7 @@
LocalUrlsDoNotCallObserver) {
EXPECT_CALL(holder_, OnResult(_)).Times(0);
NavigateAndWait("about:blank", kWaitNoExpectedCall);
- EXPECT_EQ(GetLatestResult(web_contents_), base::nullopt);
+ EXPECT_EQ(GetLatestResult(web_contents_), absl::nullopt);
}
using DistillablePageUtilsBrowserTestNone =
@@ -172,7 +172,7 @@
IN_PROC_BROWSER_TEST_F(DistillablePageUtilsBrowserTestNone, NeverCallObserver) {
EXPECT_CALL(holder_, OnResult(_)).Times(0);
NavigateAndWait(kSimpleArticlePath, kWaitNoExpectedCall);
- EXPECT_EQ(GetLatestResult(web_contents_), base::nullopt);
+ EXPECT_EQ(GetLatestResult(web_contents_), absl::nullopt);
}
using DistillablePageUtilsBrowserTestOGArticle =
diff --git a/chrome/browser/downgrade/downgrade_manager.cc b/chrome/browser/downgrade/downgrade_manager.cc
index d2b8378..28f8bbc 100644
--- a/chrome/browser/downgrade/downgrade_manager.cc
+++ b/chrome/browser/downgrade/downgrade_manager.cc
@@ -18,7 +18,6 @@
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/syslog_logging.h"
@@ -39,6 +38,7 @@
#include "components/version_info/version_info.h"
#include "components/version_info/version_info_values.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if defined(OS_WIN)
#include "chrome/installer/util/install_util.h"
@@ -54,7 +54,7 @@
// exception of files/directories that should be left behind for a full data
// wipe. Returns no value if the target directory could not be created, or the
// number of items that could not be moved.
-base::Optional<int> MoveUserData(const base::FilePath& source,
+absl::optional<int> MoveUserData(const base::FilePath& source,
const base::FilePath& target) {
// Returns true to exclude a file.
auto exclusion_predicate =
@@ -194,7 +194,7 @@
return false;
}
- base::Optional<base::Version> last_version = GetLastVersion(user_data_dir);
+ absl::optional<base::Version> last_version = GetLastVersion(user_data_dir);
if (!last_version)
return false;
@@ -228,7 +228,7 @@
auto current_milestone = current_version.components()[0];
int max_number_of_snapshots = g_browser_process->local_state()->GetInteger(
prefs::kUserDataSnapshotRetentionLimit);
- base::Optional<uint32_t> purge_milestone;
+ absl::optional<uint32_t> purge_milestone;
if (current_milestone == last_version->components()[0]) {
// Mid-milestone snapshots are only taken on canary installs.
if (chrome::GetChannel() != version_info::Channel::CANARY)
diff --git a/chrome/browser/downgrade/downgrade_utils.cc b/chrome/browser/downgrade/downgrade_utils.cc
index e5338514..8fd9f6bb 100644
--- a/chrome/browser/downgrade/downgrade_utils.cc
+++ b/chrome/browser/downgrade/downgrade_utils.cc
@@ -53,7 +53,7 @@
#endif
}
-base::Optional<int> MoveContents(const base::FilePath& source,
+absl::optional<int> MoveContents(const base::FilePath& source,
const base::FilePath& target,
ExclusionPredicate exclusion_predicate) {
// Implementation note: moving is better than deleting in this case since it
@@ -64,7 +64,7 @@
// containing directory be moved or deleted.
if (!base::CreateDirectory(target)) {
PLOG(ERROR) << target;
- return base::nullopt;
+ return absl::nullopt;
}
int failure_count = 0;
diff --git a/chrome/browser/downgrade/downgrade_utils.h b/chrome/browser/downgrade/downgrade_utils.h
index e4c02f9..f46d04f 100644
--- a/chrome/browser/downgrade/downgrade_utils.h
+++ b/chrome/browser/downgrade/downgrade_utils.h
@@ -7,7 +7,7 @@
#include "base/callback.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace downgrade {
@@ -33,7 +33,7 @@
// |source| to determine whether or not they should be skipped. Returns the
// number of items within |source| or its subdirectories that could not be
// moved, or no value if |target| could not be created.
-base::Optional<int> MoveContents(const base::FilePath& source,
+absl::optional<int> MoveContents(const base::FilePath& source,
const base::FilePath& target,
ExclusionPredicate exclusion_predicate);
diff --git a/chrome/browser/downgrade/snapshot_manager.cc b/chrome/browser/downgrade/snapshot_manager.cc
index d80d9dc..e95c0d7 100644
--- a/chrome/browser/downgrade/snapshot_manager.cc
+++ b/chrome/browser/downgrade/snapshot_manager.cc
@@ -47,7 +47,7 @@
// found at the source and successfully copied. Returns |false| if the item was
// found at the source but not successfully copied. Returns no value if the file
// was not at the source.
-base::Optional<bool> CopyItemToSnapshotDirectory(
+absl::optional<bool> CopyItemToSnapshotDirectory(
const base::FilePath& relative_path,
const base::FilePath& user_data_dir,
const base::FilePath& snapshot_dir,
@@ -57,7 +57,7 @@
// If nothing exists to be moved, do not consider it a success or a failure.
if (!base::PathExists(source))
- return base::nullopt;
+ return absl::nullopt;
bool copy_success = is_directory ? base::CopyDirectory(source, destination,
/*recursive=*/true)
@@ -156,7 +156,7 @@
size_t success_count = 0;
size_t error_count = 0;
auto record_success_error = [&success_count, &error_count](
- base::Optional<bool> success,
+ absl::optional<bool> success,
SnapshotItemId id) {
if (!success.has_value())
return;
@@ -300,7 +300,7 @@
void SnapshotManager::PurgeInvalidAndOldSnapshots(
int max_number_of_snapshots,
- base::Optional<uint32_t> milestone) const {
+ absl::optional<uint32_t> milestone) const {
const auto snapshot_dir = user_data_dir_.Append(kSnapshotsDir);
// Move the invalid snapshots within from Snapshots/NN to Snapshots.DELETE/NN.
diff --git a/chrome/browser/downgrade/snapshot_manager.h b/chrome/browser/downgrade/snapshot_manager.h
index 7c3e42f..e2e5bad 100644
--- a/chrome/browser/downgrade/snapshot_manager.h
+++ b/chrome/browser/downgrade/snapshot_manager.h
@@ -9,9 +9,9 @@
#include <vector>
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/version.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace downgrade {
@@ -46,7 +46,7 @@
// by moving invalid and older snapshots for later deletion. If |milestone| is
// specified, limit the deletion to the snapshots from that milestone.
void PurgeInvalidAndOldSnapshots(int max_number_of_snapshots,
- base::Optional<uint32_t> milestone) const;
+ absl::optional<uint32_t> milestone) const;
// Deletes snapshot data created after |delete_begin| for |profile_base_name|.
// |remove_mask| (of bits from ChromeBrowsingDataRemoverDelegate::DataType)
diff --git a/chrome/browser/downgrade/snapshot_manager_unittest.cc b/chrome/browser/downgrade/snapshot_manager_unittest.cc
index 360fdef9..6e3c3d3 100644
--- a/chrome/browser/downgrade/snapshot_manager_unittest.cc
+++ b/chrome/browser/downgrade/snapshot_manager_unittest.cc
@@ -389,7 +389,7 @@
int max_number_of_snapshots = 3;
SnapshotManager snapshot_manager(user_data_dir());
snapshot_manager.PurgeInvalidAndOldSnapshots(max_number_of_snapshots,
- base::nullopt);
+ absl::nullopt);
const base::FilePath deletion_directory =
user_data_dir()
@@ -427,7 +427,7 @@
int max_number_of_snapshots = 3;
SnapshotManager snapshot_manager(user_data_dir());
snapshot_manager.PurgeInvalidAndOldSnapshots(max_number_of_snapshots,
- base::nullopt);
+ absl::nullopt);
for (const auto& path : valid_snapshot_paths)
EXPECT_TRUE(base::PathExists(path));
diff --git a/chrome/browser/downgrade/user_data_downgrade.cc b/chrome/browser/downgrade/user_data_downgrade.cc
index a40115c4..5c3d8dd 100644
--- a/chrome/browser/downgrade/user_data_downgrade.cc
+++ b/chrome/browser/downgrade/user_data_downgrade.cc
@@ -56,7 +56,7 @@
return user_data_dir.Append(kDowngradeLastVersionFile);
}
-base::Optional<base::Version> GetLastVersion(
+absl::optional<base::Version> GetLastVersion(
const base::FilePath& user_data_dir) {
DCHECK(!user_data_dir.empty());
std::string last_version_str;
@@ -67,7 +67,7 @@
if (version.IsValid())
return version;
}
- return base::nullopt;
+ return absl::nullopt;
}
base::FilePath GetDiskCacheDir() {
@@ -108,7 +108,7 @@
return result;
}
-base::Optional<base::Version> GetSnapshotToRestore(
+absl::optional<base::Version> GetSnapshotToRestore(
const base::Version& version,
const base::FilePath& user_data_dir) {
DCHECK(version.IsValid());
@@ -118,7 +118,7 @@
auto upper_bound = available_snapshots.upper_bound(version);
if (upper_bound != available_snapshots.begin())
return *--upper_bound;
- return base::nullopt;
+ return absl::nullopt;
}
void RemoveDataForProfile(base::Time delete_begin,
diff --git a/chrome/browser/downgrade/user_data_downgrade.h b/chrome/browser/downgrade/user_data_downgrade.h
index d6d9b15..532df9f 100644
--- a/chrome/browser/downgrade/user_data_downgrade.h
+++ b/chrome/browser/downgrade/user_data_downgrade.h
@@ -7,9 +7,9 @@
#include "base/containers/flat_set.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/version.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Time;
@@ -32,7 +32,7 @@
// Returns the value contained in the "Last Version" file in |user_data_dir|, or
// a null value if the file does not exist, cannot be read, or does not contain
// a version number.
-base::Optional<base::Version> GetLastVersion(
+absl::optional<base::Version> GetLastVersion(
const base::FilePath& user_data_dir);
// Return the disk cache directory override if one is set via administrative
@@ -51,7 +51,7 @@
// Return the highest available snapshot version that is not greater than
// |version|.
-base::Optional<base::Version> GetSnapshotToRestore(
+absl::optional<base::Version> GetSnapshotToRestore(
const base::Version& version,
const base::FilePath& user_data_dir);
diff --git a/chrome/browser/downgrade/user_data_downgrade_unittest.cc b/chrome/browser/downgrade/user_data_downgrade_unittest.cc
index b8dd64e..1fa75c9 100644
--- a/chrome/browser/downgrade/user_data_downgrade_unittest.cc
+++ b/chrome/browser/downgrade/user_data_downgrade_unittest.cc
@@ -9,12 +9,12 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_constants.h"
#include "chrome/browser/downgrade/snapshot_file_collector.h"
#include "chrome/common/chrome_constants.h"
#include "content/public/browser/browsing_data_remover.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace downgrade {
@@ -82,7 +82,7 @@
}
EXPECT_EQ(GetSnapshotToRestore(base::Version("9"), user_data_dir.GetPath()),
- base::nullopt);
+ absl::nullopt);
EXPECT_EQ(
*GetSnapshotToRestore(base::Version("10.1.0"), user_data_dir.GetPath()),
base::Version("10.0.0"));
diff --git a/chrome/browser/download/android/chrome_duplicate_download_infobar_delegate.cc b/chrome/browser/download/android/chrome_duplicate_download_infobar_delegate.cc
index a0662757..ebd77672 100644
--- a/chrome/browser/download/android/chrome_duplicate_download_infobar_delegate.cc
+++ b/chrome/browser/download/android/chrome_duplicate_download_infobar_delegate.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "chrome/browser/download/android/download_controller.h"
#include "chrome/browser/ui/android/infobars/duplicate_download_infobar.h"
#include "components/download/public/common/download_path_reservation_tracker.h"
@@ -19,6 +18,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_item_utils.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -29,12 +29,12 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (result == download::PathValidationResult::SUCCESS) {
std::move(callback).Run(DownloadConfirmationResult::CONFIRMED, target_path,
- base::nullopt /*download_schedule*/);
+ absl::nullopt /*download_schedule*/);
} else {
std::move(callback).Run(DownloadConfirmationResult::FAILED,
base::FilePath(),
- base::nullopt /*download_schedule*/);
+ absl::nullopt /*download_schedule*/);
}
}
@@ -105,7 +105,7 @@
std::move(file_selected_callback_)
.Run(DownloadConfirmationResult::CANCELED, base::FilePath(),
- base::nullopt /*download_schedule*/);
+ absl::nullopt /*download_schedule*/);
return true;
}
@@ -117,7 +117,7 @@
Cancel();
}
-base::Optional<Profile::OTRProfileID>
+absl::optional<Profile::OTRProfileID>
ChromeDuplicateDownloadInfoBarDelegate::GetOTRProfileID() const {
content::BrowserContext* browser_context =
content::DownloadItemUtils::GetBrowserContext(download_item_);
@@ -127,7 +127,7 @@
return Profile::FromBrowserContext(browser_context)->GetOTRProfileID();
}
// If belongs to the regular profile, then OTRProfileID should be null.
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace android
diff --git a/chrome/browser/download/android/chrome_duplicate_download_infobar_delegate.h b/chrome/browser/download/android/chrome_duplicate_download_infobar_delegate.h
index 22c6b57..8f39b1e 100644
--- a/chrome/browser/download/android/chrome_duplicate_download_infobar_delegate.h
+++ b/chrome/browser/download/android/chrome_duplicate_download_infobar_delegate.h
@@ -47,7 +47,7 @@
bool Cancel() override;
std::string GetFilePath() const override;
void InfoBarDismissed() override;
- base::Optional<Profile::OTRProfileID> GetOTRProfileID() const override;
+ absl::optional<Profile::OTRProfileID> GetOTRProfileID() const override;
// The download item that is requesting the infobar. Could get deleted while
// the infobar is showing.
diff --git a/chrome/browser/download/android/download_dialog_bridge.cc b/chrome/browser/download/android/download_dialog_bridge.cc
index 952db84..5d2e2543f 100644
--- a/chrome/browser/download/android/download_dialog_bridge.cc
+++ b/chrome/browser/download/android/download_dialog_bridge.cc
@@ -105,7 +105,7 @@
if (on_wifi) {
dialog_result.download_schedule =
- download::DownloadSchedule(true /*only_on_wifi*/, base::nullopt);
+ download::DownloadSchedule(true /*only_on_wifi*/, absl::nullopt);
}
if (start_time > 0) {
dialog_result.download_schedule = download::DownloadSchedule(
diff --git a/chrome/browser/download/android/download_dialog_bridge.h b/chrome/browser/download/android/download_dialog_bridge.h
index 402b61ad..a8eb069 100644
--- a/chrome/browser/download/android/download_dialog_bridge.h
+++ b/chrome/browser/download/android/download_dialog_bridge.h
@@ -9,10 +9,10 @@
#include "base/android/scoped_java_ref.h"
#include "base/callback.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "chrome/browser/download/download_dialog_types.h"
#include "components/download/public/common/download_schedule.h"
#include "net/base/network_change_notifier.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/native_widget_types.h"
// Contains all the user selection from download dialogs.
@@ -22,7 +22,7 @@
~DownloadDialogResult();
// Results from download later dialog.
- base::Optional<download::DownloadSchedule> download_schedule;
+ absl::optional<download::DownloadSchedule> download_schedule;
// Results from download location dialog.
DownloadLocationDialogResult location_result =
diff --git a/chrome/browser/download/android/download_manager_service.cc b/chrome/browser/download/android/download_manager_service.cc
index 7826eaa..40986b43 100644
--- a/chrome/browser/download/android/download_manager_service.cc
+++ b/chrome/browser/download/android/download_manager_service.cc
@@ -13,7 +13,6 @@
#include "base/containers/contains.h"
#include "base/location.h"
#include "base/metrics/field_trial_params.h"
-#include "base/optional.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -50,6 +49,7 @@
#include "content/public/browser/download_item_utils.h"
#include "content/public/browser/download_request_utils.h"
#include "net/url_request/referrer_policy.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/mime_util/mime_util.h"
#include "url/origin.h"
@@ -160,10 +160,10 @@
otr_profile_id = profile->GetOTRProfileID().ConvertToJavaOTRProfileID(env);
}
- base::Optional<OfflineItemSchedule> offline_item_schedule;
+ absl::optional<OfflineItemSchedule> offline_item_schedule;
auto download_schedule = item->GetDownloadSchedule();
if (download_schedule.has_value()) {
- offline_item_schedule = base::make_optional<OfflineItemSchedule>(
+ offline_item_schedule = absl::make_optional<OfflineItemSchedule>(
download_schedule->only_on_wifi(), download_schedule->start_time());
}
auto j_offline_item_schedule =
@@ -801,12 +801,12 @@
if (!item)
return;
- base::Optional<DownloadSchedule> download_schedule;
+ absl::optional<DownloadSchedule> download_schedule;
if (only_on_wifi) {
- download_schedule = base::make_optional<DownloadSchedule>(
- true /*only_on_wifi*/, base::nullopt);
+ download_schedule = absl::make_optional<DownloadSchedule>(
+ true /*only_on_wifi*/, absl::nullopt);
} else if (start_time > 0) {
- download_schedule = base::make_optional<DownloadSchedule>(
+ download_schedule = absl::make_optional<DownloadSchedule>(
false /*only_on_wifi*/, base::Time::FromJavaTime(start_time));
}
@@ -836,7 +836,7 @@
download::DOWNLOAD_INTERRUPT_REASON_CRASH, false, false, false,
base::Time(), false,
std::vector<download::DownloadItem::ReceivedSlice>(),
- base::nullopt /*download_schedule*/, nullptr));
+ absl::nullopt /*download_schedule*/, nullptr));
}
void DownloadManagerService::InitializeForProfile(ProfileKey* profile_key) {
diff --git a/chrome/browser/download/android/duplicate_download_infobar_delegate.cc b/chrome/browser/download/android/duplicate_download_infobar_delegate.cc
index 05bf272..ef159f06 100644
--- a/chrome/browser/download/android/duplicate_download_infobar_delegate.cc
+++ b/chrome/browser/download/android/duplicate_download_infobar_delegate.cc
@@ -14,9 +14,9 @@
return std::string();
}
-base::Optional<Profile::OTRProfileID>
+absl::optional<Profile::OTRProfileID>
DuplicateDownloadInfoBarDelegate::GetOTRProfileID() const {
- return base::nullopt;
+ return absl::nullopt;
}
bool DuplicateDownloadInfoBarDelegate::DuplicateRequestExists() const {
diff --git a/chrome/browser/download/android/duplicate_download_infobar_delegate.h b/chrome/browser/download/android/duplicate_download_infobar_delegate.h
index 866120f..2b81a8a 100644
--- a/chrome/browser/download/android/duplicate_download_infobar_delegate.h
+++ b/chrome/browser/download/android/duplicate_download_infobar_delegate.h
@@ -26,7 +26,7 @@
virtual std::string GetPageURL() const;
// The OTRProfileID of the download. Null if for regular mode.
- virtual base::Optional<Profile::OTRProfileID> GetOTRProfileID() const;
+ virtual absl::optional<Profile::OTRProfileID> GetOTRProfileID() const;
// Whether the duplicate is an in-progress request or completed download.
virtual bool DuplicateRequestExists() const;
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index 5e4181a..0e18901 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -224,7 +224,7 @@
void CheckCanDownload(const content::WebContents::Getter& web_contents_getter,
const GURL& url,
const std::string& request_method,
- base::Optional<url::Origin> request_initiator,
+ absl::optional<url::Origin> request_initiator,
bool from_download_cross_origin_redirect,
CanDownloadCallback can_download_cb) {
DownloadRequestLimiter* limiter =
@@ -244,7 +244,7 @@
const content::WebContents::Getter& web_contents_getter,
const GURL& url,
const std::string& request_method,
- base::Optional<url::Origin> request_initiator,
+ absl::optional<url::Origin> request_initiator,
CanDownloadCallback can_download_cb,
bool granted) {
if (granted) {
@@ -269,7 +269,7 @@
break;
case DownloadLocationDialogResult::USER_CANCELED:
std::move(callback).Run(DownloadConfirmationResult::CANCELED,
- base::FilePath(), base::nullopt);
+ base::FilePath(), absl::nullopt);
break;
case DownloadLocationDialogResult::DUPLICATE_DIALOG:
// TODO(xingliu): Figure out the dialog behavior on multiple downloads.
@@ -959,7 +959,7 @@
// If this is a 'Save As' download, just run without confirmation.
std::move(callback).Run(
DownloadConfirmationResult::CONTINUE_WITHOUT_CONFIRMATION,
- suggested_path, base::nullopt /*download_schedule*/);
+ suggested_path, absl::nullopt /*download_schedule*/);
return;
}
@@ -970,7 +970,7 @@
if (reason == DownloadConfirmationReason::PREFERENCE) {
std::move(callback).Run(
DownloadConfirmationResult::CONTINUE_WITHOUT_CONFIRMATION,
- suggested_path, base::nullopt /*download_schedule*/);
+ suggested_path, absl::nullopt /*download_schedule*/);
return;
}
@@ -978,7 +978,7 @@
OnDownloadCanceled(download, true /* has_no_external_storage */);
std::move(callback).Run(DownloadConfirmationResult::CANCELED,
base::FilePath(),
- base::nullopt /*download_schedule*/);
+ absl::nullopt /*download_schedule*/);
return;
}
@@ -989,7 +989,7 @@
OnDownloadCanceled(download, false /* has_no_external_storage */);
std::move(callback).Run(DownloadConfirmationResult::CANCELED,
base::FilePath(),
- base::nullopt /*download_schedule*/);
+ absl::nullopt /*download_schedule*/);
return;
}
@@ -1001,7 +1001,7 @@
if (!base::android::GetDownloadsDirectory(&download_dir)) {
std::move(callback).Run(DownloadConfirmationResult::CANCELED,
base::FilePath(),
- base::nullopt /*download_schedule*/);
+ absl::nullopt /*download_schedule*/);
return;
}
@@ -1065,7 +1065,7 @@
OnDownloadCanceled(download, true /* has_no_external_storage */);
std::move(callback).Run(DownloadConfirmationResult::CANCELED,
base::FilePath(),
- base::nullopt /*download_schedule*/);
+ absl::nullopt /*download_schedule*/);
return;
case DownloadConfirmationReason::PREFERENCE:
@@ -1082,7 +1082,7 @@
case DownloadConfirmationReason::SAVE_AS:
std::move(callback).Run(
DownloadConfirmationResult::CONTINUE_WITHOUT_CONFIRMATION,
- suggested_path, base::nullopt /*download_schedule*/);
+ suggested_path, absl::nullopt /*download_schedule*/);
return;
case DownloadConfirmationReason::TARGET_CONFLICT:
@@ -1103,7 +1103,7 @@
OnDownloadCanceled(download, false /* has_no_external_storage */);
std::move(callback).Run(DownloadConfirmationResult::CANCELED,
base::FilePath(),
- base::nullopt /*download_schedule*/);
+ absl::nullopt /*download_schedule*/);
return;
}
@@ -1127,7 +1127,7 @@
DownloadConfirmationResult result,
const base::FilePath& virtual_path) {
std::move(callback).Run(result, virtual_path,
- base::nullopt /*download_schedule*/);
+ absl::nullopt /*download_schedule*/);
if (!file_picker_callbacks_.empty()) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, std::move(file_picker_callbacks_.front()));
@@ -1187,12 +1187,12 @@
// target path.
std::move(callback).Run(
DownloadConfirmationResult::CONTINUE_WITHOUT_CONFIRMATION, target_path,
- base::nullopt /*download_schedule*/);
+ absl::nullopt /*download_schedule*/);
} else {
// If the name generation failed, fail the download.
std::move(callback).Run(DownloadConfirmationResult::FAILED,
base::FilePath(),
- base::nullopt /*download_schedule*/);
+ absl::nullopt /*download_schedule*/);
}
}
@@ -1582,7 +1582,7 @@
const content::WebContents::Getter& web_contents_getter,
const GURL& url,
const std::string& request_method,
- base::Optional<url::Origin> request_initiator,
+ absl::optional<url::Origin> request_initiator,
bool from_download_cross_origin_redirect,
bool content_initiated,
content::CheckDownloadAllowedCallback check_download_allowed_cb) {
diff --git a/chrome/browser/download/chrome_download_manager_delegate.h b/chrome/browser/download/chrome_download_manager_delegate.h
index 6df16aff..16c7e30 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.h
+++ b/chrome/browser/download/chrome_download_manager_delegate.h
@@ -124,7 +124,7 @@
const content::WebContents::Getter& web_contents_getter,
const GURL& url,
const std::string& request_method,
- base::Optional<url::Origin> request_initiator,
+ absl::optional<url::Origin> request_initiator,
bool from_download_cross_origin_redirect,
bool content_initiated,
content::CheckDownloadAllowedCallback check_download_allowed_cb) override;
diff --git a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
index f938b68..3de152d 100644
--- a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
@@ -18,7 +18,6 @@
#include "base/files/file_util.h"
#include "base/guid.h"
#include "base/location.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
@@ -59,6 +58,7 @@
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
#if BUILDFLAG(FULL_SAFE_BROWSING)
@@ -119,7 +119,7 @@
download::DownloadItem::MixedContentStatus mixed_content_status;
base::FilePath intermediate_path;
download::DownloadInterruptReason interrupt_reason;
- base::Optional<download::DownloadSchedule> download_schedule;
+ absl::optional<download::DownloadSchedule> download_schedule;
};
DetermineDownloadTargetResult::DetermineDownloadTargetResult()
@@ -279,8 +279,8 @@
std::unique_ptr<download::MockDownloadItem>
PrepareDownloadItemForMixedContent(
const GURL& download_url,
- const base::Optional<url::Origin>& request_initiator,
- const base::Optional<GURL>& redirect_url);
+ const absl::optional<url::Origin>& request_initiator,
+ const absl::optional<GURL>& redirect_url);
const std::vector<uint32_t>& download_ids() const { return download_ids_; }
void GetNextId(uint32_t next_id) { download_ids_.emplace_back(next_id); }
@@ -368,7 +368,7 @@
ON_CALL(*item, GetReferrerUrl())
.WillByDefault(ReturnRefOfCopy(GURL()));
ON_CALL(*item, GetRequestInitiator())
- .WillByDefault(ReturnRefOfCopy(base::Optional<Origin>()));
+ .WillByDefault(ReturnRefOfCopy(absl::optional<Origin>()));
ON_CALL(*item, GetState())
.WillByDefault(Return(DownloadItem::IN_PROGRESS));
ON_CALL(*item, GetTargetFilePath())
@@ -405,7 +405,7 @@
download::DownloadDangerType danger_type,
download::DownloadItem::MixedContentStatus mixed_content_status,
const base::FilePath& intermediate_path,
- base::Optional<download::DownloadSchedule> download_schedule,
+ absl::optional<download::DownloadSchedule> download_schedule,
download::DownloadInterruptReason interrupt_reason) {
result->target_path = target_path;
result->disposition = target_disposition;
@@ -457,8 +457,8 @@
std::unique_ptr<download::MockDownloadItem>
ChromeDownloadManagerDelegateTest::PrepareDownloadItemForMixedContent(
const GURL& download_url,
- const base::Optional<Origin>& request_initiator,
- const base::Optional<GURL>& redirect_url) {
+ const absl::optional<Origin>& request_initiator,
+ const absl::optional<GURL>& redirect_url) {
std::vector<GURL> url_chain;
if (redirect_url.has_value())
url_chain.push_back(redirect_url.value());
@@ -570,7 +570,7 @@
expected_prompt_path, _, _))
.WillOnce(
WithArg<3>(ScheduleCallback3(DownloadConfirmationResult::CONFIRMED,
- user_selected_path, base::nullopt)));
+ user_selected_path, absl::nullopt)));
DetermineDownloadTarget(save_as_download.get(), &result);
EXPECT_EQ(user_selected_path, result.target_path);
VerifyAndClearExpectations();
@@ -585,7 +585,7 @@
expected_prompt_path, _, _))
.WillOnce(
WithArg<3>(ScheduleCallback3(DownloadConfirmationResult::CANCELED,
- base::FilePath(), base::nullopt)));
+ base::FilePath(), absl::nullopt)));
DetermineDownloadTarget(save_as_download.get(), &result);
VerifyAndClearExpectations();
}
@@ -609,7 +609,7 @@
expected_prompt_path, _, _))
.WillOnce(
WithArg<3>(ScheduleCallback3(DownloadConfirmationResult::CANCELED,
- base::FilePath(), base::nullopt)));
+ base::FilePath(), absl::nullopt)));
DetermineDownloadTarget(save_as_download.get(), &result);
VerifyAndClearExpectations();
}
@@ -637,7 +637,7 @@
_, _, DownloadConfirmationReason::TARGET_CONFLICT, _))
.WillOnce(
WithArg<3>(ScheduleCallback3(DownloadConfirmationResult::CONFIRMED,
- kExpectedPath, base::nullopt)));
+ kExpectedPath, absl::nullopt)));
DetermineDownloadTarget(download_item.get(), &result);
EXPECT_EQ(download::DownloadItem::TARGET_DISPOSITION_PROMPT,
result.disposition);
@@ -725,7 +725,7 @@
_, _, DownloadConfirmationReason::TARGET_CONFLICT, _))
.WillOnce(
WithArg<3>(ScheduleCallback3(DownloadConfirmationResult::CONFIRMED,
- kExpectedPath, base::nullopt)));
+ kExpectedPath, absl::nullopt)));
pref_service()->SetInteger(
prefs::kDownloadRestrictions,
@@ -784,7 +784,7 @@
base::HistogramTester histograms;
std::unique_ptr<download::MockDownloadItem> download_item =
PrepareDownloadItemForMixedContent(kHttpsUrl, kInsecureOrigin,
- base::nullopt);
+ absl::nullopt);
DetermineDownloadTarget(download_item.get(), &result);
EXPECT_EQ(download::DOWNLOAD_INTERRUPT_REASON_NONE,
@@ -802,7 +802,7 @@
base::HistogramTester histograms;
std::unique_ptr<download::MockDownloadItem> download_item =
PrepareDownloadItemForMixedContent(kHttpUrl, kInsecureOrigin,
- base::nullopt);
+ absl::nullopt);
DetermineDownloadTarget(download_item.get(), &result);
EXPECT_EQ(download::DOWNLOAD_INTERRUPT_REASON_NONE,
@@ -830,7 +830,7 @@
std::unique_ptr<download::MockDownloadItem> download_item =
PrepareDownloadItemForMixedContent(kInsecureSilentlyBlockableFile,
- base::nullopt, base::nullopt);
+ absl::nullopt, absl::nullopt);
ON_CALL(*download_item, GetTabUrl())
.WillByDefault(ReturnRefOfCopy(kSecureOrigin.GetURL()));
ON_CALL(*download_item, GetDownloadSource())
@@ -919,7 +919,7 @@
#endif
std::unique_ptr<download::MockDownloadItem> foo_download_item =
- PrepareDownloadItemForMixedContent(kFooUrl, kSecureOrigin, base::nullopt);
+ PrepareDownloadItemForMixedContent(kFooUrl, kSecureOrigin, absl::nullopt);
VerifyMixedContentExtensionOverride(
foo_download_item.get(),
@@ -979,7 +979,7 @@
#endif
std::unique_ptr<download::MockDownloadItem> foo_download_item =
- PrepareDownloadItemForMixedContent(kFooUrl, kSecureOrigin, base::nullopt);
+ PrepareDownloadItemForMixedContent(kFooUrl, kSecureOrigin, absl::nullopt);
// Test everything is blocked normally.
VerifyMixedContentExtensionOverride(
@@ -1031,7 +1031,7 @@
#endif
std::unique_ptr<download::MockDownloadItem> foo_download_item =
- PrepareDownloadItemForMixedContent(kFooUrl, kSecureOrigin, base::nullopt);
+ PrepareDownloadItemForMixedContent(kFooUrl, kSecureOrigin, absl::nullopt);
// By default, nothing is warned on since everything is silently blocked.
VerifyMixedContentExtensionOverride(
@@ -1099,11 +1099,11 @@
std::unique_ptr<download::MockDownloadItem> blocked_download_item =
PrepareDownloadItemForMixedContent(kInsecureBlockableFile, kSecureOrigin,
- base::nullopt);
+ absl::nullopt);
std::unique_ptr<download::MockDownloadItem> foo_download_item =
- PrepareDownloadItemForMixedContent(kFooUrl, kSecureOrigin, base::nullopt);
+ PrepareDownloadItemForMixedContent(kFooUrl, kSecureOrigin, absl::nullopt);
std::unique_ptr<download::MockDownloadItem> bar_download_item =
- PrepareDownloadItemForMixedContent(kBarUrl, kSecureOrigin, base::nullopt);
+ PrepareDownloadItemForMixedContent(kBarUrl, kSecureOrigin, absl::nullopt);
// Test that toggling the allowlist parameter impacts blocking.
VerifyMixedContentExtensionOverride(
@@ -1176,13 +1176,13 @@
std::unique_ptr<download::MockDownloadItem> warned_download_item =
PrepareDownloadItemForMixedContent(kInsecureWarnableFile, kSecureOrigin,
- base::nullopt);
+ absl::nullopt);
std::unique_ptr<download::MockDownloadItem> blocked_download_item =
PrepareDownloadItemForMixedContent(kInsecureBlockableFile, kSecureOrigin,
- base::nullopt);
+ absl::nullopt);
std::unique_ptr<download::MockDownloadItem> silent_blocked_download_item =
PrepareDownloadItemForMixedContent(kInsecureSilentlyBlockableFile,
- kSecureOrigin, base::nullopt);
+ kSecureOrigin, absl::nullopt);
HostContentSettingsMapFactory::GetForProfile(profile())
->SetContentSettingDefaultScope(kSecureOrigin.GetURL(), GURL(),
@@ -1257,7 +1257,7 @@
base::RepeatingClosure completion_closure,
DownloadConfirmationResult result,
const base::FilePath& virtual_path,
- base::Optional<download::DownloadSchedule> download_schedule) {
+ absl::optional<download::DownloadSchedule> download_schedule) {
ASSERT_EQ(result, expected_result);
ASSERT_FALSE(download_schedule)
<< "DownloadSchedule is only used on Android.";
@@ -1771,7 +1771,7 @@
WebContents web_contents;
DownloadLocationDialogType dialog_type;
ExpectPath path;
- base::Optional<download::DownloadSchedule> download_schedule;
+ absl::optional<download::DownloadSchedule> download_schedule;
} kTestCases[] = {
// SAVE_AS
{DownloadConfirmationReason::SAVE_AS,
@@ -1851,10 +1851,10 @@
[](const base::RepeatingClosure& quit_closure,
DownloadConfirmationResult expected_result,
const base::FilePath& expected_path,
- base::Optional<download::DownloadSchedule> expected_schedule,
+ absl::optional<download::DownloadSchedule> expected_schedule,
DownloadConfirmationResult actual_result,
const base::FilePath& actual_path,
- base::Optional<download::DownloadSchedule> download_schedule) {
+ absl::optional<download::DownloadSchedule> download_schedule) {
EXPECT_EQ(expected_result, actual_result);
EXPECT_EQ(expected_path, actual_path);
EXPECT_EQ(expected_schedule, download_schedule);
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index 78cf3a1..256c6b2b 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -2703,7 +2703,7 @@
// the download request.
ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete());
- base::Optional<network::ResourceRequest::TrustedParams> trusted_params;
+ absl::optional<network::ResourceRequest::TrustedParams> trusted_params;
net::SiteForCookies site_for_cookies;
base::RunLoop request_waiter;
@@ -2791,7 +2791,7 @@
// the download request.
ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete());
- base::Optional<network::ResourceRequest::TrustedParams> trusted_params;
+ absl::optional<network::ResourceRequest::TrustedParams> trusted_params;
net::SiteForCookies site_for_cookies;
base::RunLoop request_waiter;
@@ -2863,7 +2863,7 @@
// the download request.
ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete());
- base::Optional<network::ResourceRequest::TrustedParams> trusted_params;
+ absl::optional<network::ResourceRequest::TrustedParams> trusted_params;
net::SiteForCookies site_for_cookies;
base::RunLoop request_waiter;
@@ -2953,7 +2953,7 @@
// the download request.
ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete());
- base::Optional<network::ResourceRequest::TrustedParams> trusted_params;
+ absl::optional<network::ResourceRequest::TrustedParams> trusted_params;
net::SiteForCookies site_for_cookies;
base::RunLoop request_waiter;
@@ -4735,7 +4735,7 @@
false /* allow_metered */, false /* opened */, current_time,
false /* transient */,
std::vector<download::DownloadItem::ReceivedSlice>(),
- base::nullopt /*download_schedule*/, nullptr /* download_entry */));
+ absl::nullopt /*download_schedule*/, nullptr /* download_entry */));
download::DownloadItem* download = coordinator->GetDownloadByGuid(guid);
content::DownloadManager* manager = DownloadManagerForBrowser(browser());
diff --git a/chrome/browser/download/download_history.cc b/chrome/browser/download/download_history.cc
index 6c25f2d..67b3335 100644
--- a/chrome/browser/download/download_history.cc
+++ b/chrome/browser/download/download_history.cc
@@ -36,7 +36,6 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/browser/download/download_crx_util.h"
#include "chrome/browser/profiles/profile.h"
@@ -51,6 +50,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_manager.h"
#include "extensions/buildflags/buildflags.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/api/downloads/downloads_api.h"
@@ -382,7 +382,7 @@
download::DownloadItem* item = notifier_.GetManager()->CreateDownloadItem(
row.guid, loading_id_, row.current_path, row.target_path, url_chain,
row.referrer_url, row.site_url, row.tab_url, row.tab_referrer_url,
- base::nullopt, row.mime_type, row.original_mime_type, row.start_time,
+ absl::nullopt, row.mime_type, row.original_mime_type, row.start_time,
row.end_time, row.etag, row.last_modified, row.received_bytes,
row.total_bytes,
std::string(), // TODO(asanka): Need to persist and restore hash of
diff --git a/chrome/browser/download/download_history_unittest.cc b/chrome/browser/download/download_history_unittest.cc
index 6234818b..8fb01a2 100644
--- a/chrome/browser/download/download_history_unittest.cc
+++ b/chrome/browser/download/download_history_unittest.cc
@@ -15,7 +15,6 @@
#include "base/guid.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/rand_util.h"
#include "base/stl_util.h"
#include "base/test/scoped_feature_list.h"
@@ -33,6 +32,7 @@
#include "content/public/test/test_utils.h"
#include "extensions/buildflags/buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/api/downloads/downloads_api.h"
@@ -85,11 +85,11 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
CHECK(expect_query_downloads_.has_value());
- // Use swap to reset the base::Optional<...> to a known state before
- // moving the value (moving the value out of a base::Optional<...>
- // does not reset it to base::nullopt).
+ // Use swap to reset the absl::optional<...> to a known state before
+ // moving the value (moving the value out of a absl::optional<...>
+ // does not reset it to absl::nullopt).
using std::swap;
- base::Optional<std::vector<history::DownloadRow>> rows;
+ absl::optional<std::vector<history::DownloadRow>> rows;
swap(rows, expect_query_downloads_);
std::move(callback).Run(std::move(*rows));
@@ -195,7 +195,7 @@
bool should_commit_immediately_ = false;
base::OnceClosure create_download_callback_;
history::DownloadRow update_download_;
- base::Optional<std::vector<history::DownloadRow>> expect_query_downloads_;
+ absl::optional<std::vector<history::DownloadRow>> expect_query_downloads_;
IdSet remove_downloads_;
history::DownloadRow create_download_row_;
@@ -235,7 +235,7 @@
return content::MockDownloadManager::CreateDownloadItemAdapter(
row.guid, history::ToContentDownloadId(row.id), row.current_path,
row.target_path, row.url_chain, row.referrer_url, row.site_url,
- row.tab_url, row.tab_referrer_url, base::nullopt, row.mime_type,
+ row.tab_url, row.tab_referrer_url, absl::nullopt, row.mime_type,
row.original_mime_type, row.start_time, row.end_time, row.etag,
row.last_modified, row.received_bytes, row.total_bytes, std::string(),
history::ToContentDownloadState(row.state),
diff --git a/chrome/browser/download/download_offline_content_provider.cc b/chrome/browser/download/download_offline_content_provider.cc
index 74982cb..b67ce6ee 100644
--- a/chrome/browser/download/download_offline_content_provider.cc
+++ b/chrome/browser/download/download_offline_content_provider.cc
@@ -283,9 +283,9 @@
DownloadItem* item = GetDownload(id.id);
auto offline_item =
item && ShouldShowDownloadItem(item)
- ? base::make_optional(
+ ? absl::make_optional(
OfflineItemUtils::CreateOfflineItem(name_space_, item))
- : base::nullopt;
+ : absl::nullopt;
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback), offline_item));
@@ -403,7 +403,7 @@
void DownloadOfflineContentProvider::ChangeSchedule(
const ContentId& id,
- base::Optional<OfflineItemSchedule> schedule) {
+ absl::optional<OfflineItemSchedule> schedule) {
EnsureDownloadCoreServiceStarted();
if (state_ != State::HISTORY_LOADED) {
pending_actions_for_full_browser_.push_back(base::BindOnce(
@@ -550,7 +550,7 @@
void DownloadOfflineContentProvider::UpdateObservers(
const OfflineItem& item,
- const base::Optional<UpdateDelta>& update_delta) {
+ const absl::optional<UpdateDelta>& update_delta) {
NotifyItemUpdated(item, update_delta);
}
diff --git a/chrome/browser/download/download_offline_content_provider.h b/chrome/browser/download/download_offline_content_provider.h
index 79d245f..3b8d090 100644
--- a/chrome/browser/download/download_offline_content_provider.h
+++ b/chrome/browser/download/download_offline_content_provider.h
@@ -78,7 +78,7 @@
RenameCallback callback) override;
void ChangeSchedule(
const offline_items_collection::ContentId& id,
- base::Optional<offline_items_collection::OfflineItemSchedule> schedule)
+ absl::optional<offline_items_collection::OfflineItemSchedule> schedule)
override;
// Methods that can be run in reduced mode.
@@ -125,7 +125,7 @@
DownloadItem* item,
DownloadItem::DownloadRenameResult result);
void UpdateObservers(const OfflineItem& item,
- const base::Optional<UpdateDelta>& update_delta);
+ const absl::optional<UpdateDelta>& update_delta);
void CheckForExternallyRemovedDownloads();
// Ensure that download core service is started.
diff --git a/chrome/browser/download/download_request_limiter.cc b/chrome/browser/download/download_request_limiter.cc
index 19862877..a793212d 100644
--- a/chrome/browser/download/download_request_limiter.cc
+++ b/chrome/browser/download/download_request_limiter.cc
@@ -516,7 +516,7 @@
const content::WebContents::Getter& web_contents_getter,
const GURL& url,
const std::string& request_method,
- base::Optional<url::Origin> request_initiator,
+ absl::optional<url::Origin> request_initiator,
bool from_download_cross_origin_redirect,
Callback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -548,7 +548,7 @@
void DownloadRequestLimiter::OnCanDownloadDecided(
const content::WebContents::Getter& web_contents_getter,
const std::string& request_method,
- base::Optional<url::Origin> request_initiator,
+ absl::optional<url::Origin> request_initiator,
bool from_download_cross_origin_redirect,
Callback orig_callback,
bool allow) {
@@ -586,7 +586,7 @@
void DownloadRequestLimiter::CanDownloadImpl(
content::WebContents* originating_contents,
const std::string& request_method,
- base::Optional<url::Origin> request_initiator,
+ absl::optional<url::Origin> request_initiator,
bool from_download_cross_origin_redirect,
Callback callback) {
DCHECK(originating_contents);
diff --git a/chrome/browser/download/download_request_limiter.h b/chrome/browser/download/download_request_limiter.h
index 68451d0..c4d718d 100644
--- a/chrome/browser/download/download_request_limiter.h
+++ b/chrome/browser/download/download_request_limiter.h
@@ -245,7 +245,7 @@
void CanDownload(const content::WebContents::Getter& web_contents_getter,
const GURL& url,
const std::string& request_method,
- base::Optional<url::Origin> request_initiator,
+ absl::optional<url::Origin> request_initiator,
bool from_download_cross_origin_redirect,
Callback callback);
@@ -284,7 +284,7 @@
// potentially prompting the user.
void CanDownloadImpl(content::WebContents* originating_contents,
const std::string& request_method,
- base::Optional<url::Origin> request_initiator,
+ absl::optional<url::Origin> request_initiator,
bool from_download_cross_origin_redirect,
Callback callback);
@@ -292,7 +292,7 @@
void OnCanDownloadDecided(
const content::WebContents::Getter& web_contents_getter,
const std::string& request_method,
- base::Optional<url::Origin> request_initiator,
+ absl::optional<url::Origin> request_initiator,
bool from_download_cross_origin_redirect,
Callback orig_callback,
bool allow);
diff --git a/chrome/browser/download/download_request_limiter_unittest.cc b/chrome/browser/download/download_request_limiter_unittest.cc
index 3ea0c43..bd1e584 100644
--- a/chrome/browser/download/download_request_limiter_unittest.cc
+++ b/chrome/browser/download/download_request_limiter_unittest.cc
@@ -72,11 +72,11 @@
}
void CanDownloadFor(WebContents* web_contents) {
- CanDownloadFor(web_contents, base::nullopt);
+ CanDownloadFor(web_contents, absl::nullopt);
}
void CanDownloadFor(WebContents* web_contents,
- base::Optional<url::Origin> origin) {
+ absl::optional<url::Origin> origin) {
download_request_limiter_->CanDownloadImpl(
web_contents,
"GET", // request method
diff --git a/chrome/browser/download/download_shelf.cc b/chrome/browser/download/download_shelf.cc
index d3adfe9..4c8ec54 100644
--- a/chrome/browser/download/download_shelf.cc
+++ b/chrome/browser/download/download_shelf.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/location.h"
-#include "base/optional.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "chrome/browser/download/download_core_service.h"
@@ -31,6 +30,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/animation/animation.h"
DownloadShelf::DownloadShelf(Browser* browser, Profile* profile)
@@ -144,7 +144,7 @@
}
void DownloadShelf::OnGetDownloadDoneForOfflineItem(
- const base::Optional<offline_items_collection::OfflineItem>& item) {
+ const absl::optional<offline_items_collection::OfflineItem>& item) {
if (item.has_value()) {
auto* const manager =
OfflineItemModelManagerFactory::GetForBrowserContext(profile());
diff --git a/chrome/browser/download/download_shelf.h b/chrome/browser/download/download_shelf.h
index c176217..24a286e 100644
--- a/chrome/browser/download/download_shelf.h
+++ b/chrome/browser/download/download_shelf.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/download/download_ui_model.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Browser;
class Profile;
@@ -93,7 +93,7 @@
// Callback used by ShowDownloadById() to trigger ShowDownload() once |item|
// has been fetched.
void OnGetDownloadDoneForOfflineItem(
- const base::Optional<offline_items_collection::OfflineItem>& item);
+ const absl::optional<offline_items_collection::OfflineItem>& item);
Browser* const browser_;
Profile* const profile_;
diff --git a/chrome/browser/download/download_shelf_controller.cc b/chrome/browser/download/download_shelf_controller.cc
index fa6d7a6..262c31c 100644
--- a/chrome/browser/download/download_shelf_controller.cc
+++ b/chrome/browser/download/download_shelf_controller.cc
@@ -34,7 +34,7 @@
void DownloadShelfController::OnItemsAdded(
const OfflineContentProvider::OfflineItemList& items) {
for (const auto& item : items)
- OnItemUpdated(item, base::nullopt);
+ OnItemUpdated(item, absl::nullopt);
}
void DownloadShelfController::OnItemRemoved(const ContentId& id) {
@@ -47,7 +47,7 @@
void DownloadShelfController::OnItemUpdated(
const OfflineItem& item,
- const base::Optional<UpdateDelta>& update_delta) {
+ const absl::optional<UpdateDelta>& update_delta) {
if (profile_->IsOffTheRecord() != item.is_off_the_record)
return;
diff --git a/chrome/browser/download/download_shelf_controller.h b/chrome/browser/download/download_shelf_controller.h
index b730888..8b75e1c 100644
--- a/chrome/browser/download/download_shelf_controller.h
+++ b/chrome/browser/download/download_shelf_controller.h
@@ -32,7 +32,7 @@
const OfflineContentProvider::OfflineItemList& items) override;
void OnItemRemoved(const ContentId& id) override;
void OnItemUpdated(const OfflineItem& item,
- const base::Optional<UpdateDelta>& update_delta) override;
+ const absl::optional<UpdateDelta>& update_delta) override;
void OnContentProviderGoingDown() override;
// Called when a new OfflineItem is to be displayed on UI.
diff --git a/chrome/browser/download/download_target_determiner.cc b/chrome/browser/download/download_target_determiner.cc
index f920f30..181732fa 100644
--- a/chrome/browser/download/download_target_determiner.cc
+++ b/chrome/browser/download/download_target_determiner.cc
@@ -542,7 +542,7 @@
void DownloadTargetDeterminer::RequestConfirmationDone(
DownloadConfirmationResult result,
const base::FilePath& virtual_path,
- base::Optional<download::DownloadSchedule> download_schedule) {
+ absl::optional<download::DownloadSchedule> download_schedule) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!download_->IsTransient());
DVLOG(20) << "User selected path:" << virtual_path.AsUTF8Unsafe();
diff --git a/chrome/browser/download/download_target_determiner.h b/chrome/browser/download/download_target_determiner.h
index 3dc27593..a0e623c 100644
--- a/chrome/browser/download/download_target_determiner.h
+++ b/chrome/browser/download/download_target_determiner.h
@@ -209,7 +209,7 @@
void RequestConfirmationDone(
DownloadConfirmationResult result,
const base::FilePath& virtual_path,
- base::Optional<download::DownloadSchedule> download_schedule);
+ absl::optional<download::DownloadSchedule> download_schedule);
// Up until this point, the path that was used is considered to be a virtual
// path. This step determines the local file system path corresponding to this
@@ -358,7 +358,7 @@
DownloadTargetDeterminerDelegate* delegate_;
CompletionCallback completion_callback_;
base::CancelableTaskTracker history_tracker_;
- base::Optional<download::DownloadSchedule> download_schedule_;
+ absl::optional<download::DownloadSchedule> download_schedule_;
base::WeakPtrFactory<DownloadTargetDeterminer> weak_ptr_factory_{this};
diff --git a/chrome/browser/download/download_target_determiner_delegate.h b/chrome/browser/download/download_target_determiner_delegate.h
index 46862cb7..dc1f526 100644
--- a/chrome/browser/download/download_target_determiner_delegate.h
+++ b/chrome/browser/download/download_target_determiner_delegate.h
@@ -8,13 +8,13 @@
#include <string>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/download/download_confirmation_reason.h"
#include "chrome/browser/download/download_confirmation_result.h"
#include "components/download/public/common/download_danger_type.h"
#include "components/download/public/common/download_item.h"
#include "components/download/public/common/download_path_reservation_tracker.h"
#include "components/download/public/common/download_schedule.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class FilePath;
@@ -53,7 +53,7 @@
using ConfirmationCallback = base::OnceCallback<void(
DownloadConfirmationResult,
const base::FilePath& virtual_path,
- base::Optional<download::DownloadSchedule> download_schedule)>;
+ absl::optional<download::DownloadSchedule> download_schedule)>;
// Callback to be invoked when DetermineLocalPath() completes. The argument
// should be the determined local path. It should be non-empty on success. If
diff --git a/chrome/browser/download/download_target_determiner_unittest.cc b/chrome/browser/download/download_target_determiner_unittest.cc
index 418edf2..095cf5d 100644
--- a/chrome/browser/download/download_target_determiner_unittest.cc
+++ b/chrome/browser/download/download_target_determiner_unittest.cc
@@ -12,7 +12,6 @@
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
@@ -55,6 +54,7 @@
#include "ppapi/buildflags/buildflags.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
#if BUILDFLAG(ENABLE_PLUGINS)
@@ -606,7 +606,7 @@
DownloadConfirmationReason reason,
ConfirmationCallback& callback) {
std::move(callback).Run(DownloadConfirmationResult::CONFIRMED, suggested_path,
- base::nullopt);
+ absl::nullopt);
}
// static
@@ -695,7 +695,7 @@
ON_CALL(*delegate(), RequestConfirmation_(_, _, _, _))
.WillByDefault(
WithArg<3>(ScheduleCallback3(DownloadConfirmationResult::CANCELED,
- base::FilePath(), base::nullopt)));
+ base::FilePath(), absl::nullopt)));
RunTestCasesWithActiveItem(kCancelSaveAsTestCases,
base::size(kCancelSaveAsTestCases));
}
@@ -968,7 +968,7 @@
DownloadConfirmationReason::SAVE_AS, _))
.WillOnce(WithArg<3>(ScheduleCallback3(
DownloadConfirmationResult::CONFIRMED,
- test_virtual_dir().AppendASCII("prompted.txt"), base::nullopt)));
+ test_virtual_dir().AppendASCII("prompted.txt"), absl::nullopt)));
RunTestCasesWithActiveItem(&kSaveAsToVirtualDir, 1);
}
@@ -993,7 +993,7 @@
.WillOnce(WithArg<3>(ScheduleCallback3(
DownloadConfirmationResult::CONFIRMED,
GetPathInDownloadDir(FILE_PATH_LITERAL("foo-x.txt")),
- base::nullopt)));
+ absl::nullopt)));
RunTestCasesWithActiveItem(&kSaveAsToLocalDir, 1);
}
@@ -1440,7 +1440,7 @@
.WillOnce(WithArg<3>(ScheduleCallback3(
DownloadConfirmationResult::CONTINUE_WITHOUT_CONFIRMATION,
GetPathInDownloadDir(FILE_PATH_LITERAL("foo.kindabad")),
- base::nullopt)));
+ absl::nullopt)));
RunTestCasesWithActiveItem(&kTestCase, 1);
}
@@ -1467,7 +1467,7 @@
.WillOnce(WithArg<3>(ScheduleCallback3(
DownloadConfirmationResult::CONFIRMED,
GetPathInDownloadDir(FILE_PATH_LITERAL("foo.kindabad")),
- base::nullopt)));
+ absl::nullopt)));
RunTestCasesWithActiveItem(&kTestCase, 1);
}
diff --git a/chrome/browser/download/download_target_info.h b/chrome/browser/download/download_target_info.h
index 87a5cf3b..cb34d8f 100644
--- a/chrome/browser/download/download_target_info.h
+++ b/chrome/browser/download/download_target_info.h
@@ -8,12 +8,12 @@
#include <string>
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "components/download/public/common/download_danger_type.h"
#include "components/download/public/common/download_interrupt_reasons.h"
#include "components/download/public/common/download_item.h"
#include "components/download/public/common/download_schedule.h"
#include "components/safe_browsing/core/proto/download_file_types.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
struct DownloadTargetInfo {
DownloadTargetInfo();
@@ -84,7 +84,7 @@
download::DownloadItem::MixedContentStatus mixed_content_status;
// Defines when to start the download, used by download later feature.
- base::Optional<download::DownloadSchedule> download_schedule;
+ absl::optional<download::DownloadSchedule> download_schedule;
};
#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_
diff --git a/chrome/browser/download/mixed_content_download_blocking.cc b/chrome/browser/download/mixed_content_download_blocking.cc
index 67e75d6..ff6f0b69 100644
--- a/chrome/browser/download/mixed_content_download_blocking.cc
+++ b/chrome/browser/download/mixed_content_download_blocking.cc
@@ -8,7 +8,6 @@
#include "base/debug/dump_without_crashing.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -21,6 +20,7 @@
#include "content/public/browser/download_item_utils.h"
#include "content/public/browser/web_contents.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -144,7 +144,7 @@
// for histogram reporting. |dl_secure| signifies whether the download was
// a secure source. |inferred| is whether the initiator value is our best guess.
InsecureDownloadSecurityStatus GetDownloadBlockingEnum(
- base::Optional<url::Origin> initiator,
+ absl::optional<url::Origin> initiator,
bool dl_secure,
bool inferred) {
if (inferred) {
@@ -278,7 +278,7 @@
}
}
- base::Optional<url::Origin> initiator_;
+ absl::optional<url::Origin> initiator_;
std::string extension_;
const download::DownloadItem* item_;
bool is_redirect_chain_secure_;
@@ -335,7 +335,7 @@
bool IsDownloadPermittedByContentSettings(
Profile* profile,
- const base::Optional<url::Origin>& initiator) {
+ const absl::optional<url::Origin>& initiator) {
// TODO(crbug.com/1048957): Checking content settings crashes unit tests on
// Android. It shouldn't.
#if !defined(OS_ANDROID)
diff --git a/chrome/browser/download/notification/download_item_notification.cc b/chrome/browser/download/notification/download_item_notification.cc
index 42ab7ca..b62f40a 100644
--- a/chrome/browser/download/notification/download_item_notification.cc
+++ b/chrome/browser/download/notification/download_item_notification.cc
@@ -303,8 +303,8 @@
}
void DownloadItemNotification::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
if (!item_)
return;
diff --git a/chrome/browser/download/notification/download_item_notification.h b/chrome/browser/download/notification/download_item_notification.h
index 6f9de05..caf324b 100644
--- a/chrome/browser/download/notification/download_item_notification.h
+++ b/chrome/browser/download/notification/download_item_notification.h
@@ -62,8 +62,8 @@
// NotificationObserver:
void Close(bool by_user) override;
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
void ShutDown();
diff --git a/chrome/browser/download/notification/download_item_notification_unittest.cc b/chrome/browser/download/notification/download_item_notification_unittest.cc
index 870a2040..bb1fd63 100644
--- a/chrome/browser/download/notification/download_item_notification_unittest.cc
+++ b/chrome/browser/download/notification/download_item_notification_unittest.cc
@@ -179,13 +179,13 @@
// Pauses and makes sure the DownloadItem::Pause() is called.
EXPECT_CALL(*download_item_, Pause()).Times(1);
EXPECT_CALL(*download_item_, IsPaused()).WillRepeatedly(Return(true));
- download_item_notification_->Click(0, base::nullopt);
+ download_item_notification_->Click(0, absl::nullopt);
download_item_->NotifyObserversDownloadUpdated();
// Resumes and makes sure the DownloadItem::Resume() is called.
EXPECT_CALL(*download_item_, Resume(true)).Times(1);
EXPECT_CALL(*download_item_, IsPaused()).WillRepeatedly(Return(false));
- download_item_notification_->Click(0, base::nullopt);
+ download_item_notification_->Click(0, absl::nullopt);
download_item_->NotifyObserversDownloadUpdated();
}
@@ -202,7 +202,7 @@
// Clicks and confirms that the OpenDownload() is called.
EXPECT_CALL(*download_item_, OpenDownload()).Times(1);
EXPECT_CALL(*download_item_, SetOpenWhenComplete(_)).Times(0);
- download_item_notification_->Click(base::nullopt, base::nullopt);
+ download_item_notification_->Click(absl::nullopt, absl::nullopt);
}
TEST_F(DownloadItemNotificationTest, OpenWhenComplete) {
@@ -216,7 +216,7 @@
EXPECT_CALL(*download_item_, SetOpenWhenComplete(true))
.Times(1)
.WillOnce(Return());
- download_item_notification_->Click(base::nullopt, base::nullopt);
+ download_item_notification_->Click(absl::nullopt, absl::nullopt);
EXPECT_CALL(*download_item_, GetOpenWhenComplete())
.WillRepeatedly(Return(true));
@@ -224,7 +224,7 @@
EXPECT_CALL(*download_item_, SetOpenWhenComplete(false))
.Times(1)
.WillOnce(Return());
- download_item_notification_->Click(base::nullopt, base::nullopt);
+ download_item_notification_->Click(absl::nullopt, absl::nullopt);
EXPECT_CALL(*download_item_, GetOpenWhenComplete())
.WillRepeatedly(Return(false));
@@ -232,7 +232,7 @@
EXPECT_CALL(*download_item_, SetOpenWhenComplete(true))
.Times(1)
.WillOnce(Return());
- download_item_notification_->Click(base::nullopt, base::nullopt);
+ download_item_notification_->Click(absl::nullopt, absl::nullopt);
EXPECT_CALL(*download_item_, GetOpenWhenComplete())
.WillRepeatedly(Return(true));
@@ -289,7 +289,7 @@
)");
EXPECT_CALL(*download_item_, OpenDownload()).Times(0);
EXPECT_CALL(*download_item_, SetOpenWhenComplete(true)).Times(1);
- download_item_notification_->Click(base::nullopt, base::nullopt);
+ download_item_notification_->Click(absl::nullopt, absl::nullopt);
// Can be opened while scanning.
safe_browsing::SetAnalysisConnector(profile_->GetPrefs(),
@@ -302,7 +302,7 @@
}
)");
EXPECT_CALL(*download_item_, OpenDownload()).Times(1);
- download_item_notification_->Click(base::nullopt, base::nullopt);
+ download_item_notification_->Click(absl::nullopt, absl::nullopt);
// Scanning finished, warning.
EXPECT_CALL(*download_item_, IsDangerous()).WillRepeatedly(Return(true));
@@ -311,7 +311,7 @@
Return(download::DOWNLOAD_DANGER_TYPE_SENSITIVE_CONTENT_WARNING));
EXPECT_CALL(*download_item_, OpenDownload()).Times(0);
EXPECT_CALL(*download_item_, SetOpenWhenComplete(true)).Times(0);
- download_item_notification_->Click(base::nullopt, base::nullopt);
+ download_item_notification_->Click(absl::nullopt, absl::nullopt);
// Scanning finished, blocked.
EXPECT_CALL(*download_item_, IsDangerous()).WillRepeatedly(Return(true));
@@ -320,7 +320,7 @@
Return(download::DOWNLOAD_DANGER_TYPE_SENSITIVE_CONTENT_BLOCK));
EXPECT_CALL(*download_item_, OpenDownload()).Times(0);
EXPECT_CALL(*download_item_, SetOpenWhenComplete(true)).Times(0);
- download_item_notification_->Click(base::nullopt, base::nullopt);
+ download_item_notification_->Click(absl::nullopt, absl::nullopt);
// Scanning finished, safe.
EXPECT_CALL(*download_item_, IsDangerous()).WillRepeatedly(Return(false));
@@ -329,7 +329,7 @@
EXPECT_CALL(*download_item_, GetState())
.WillRepeatedly(Return(download::DownloadItem::COMPLETE));
EXPECT_CALL(*download_item_, OpenDownload()).Times(1);
- download_item_notification_->Click(base::nullopt, base::nullopt);
+ download_item_notification_->Click(absl::nullopt, absl::nullopt);
}
} // namespace test
diff --git a/chrome/browser/download/notification/download_notification_browsertest.cc b/chrome/browser/download/notification/download_notification_browsertest.cc
index 3020f36de..2dafa51 100644
--- a/chrome/browser/download/notification/download_notification_browsertest.cc
+++ b/chrome/browser/download/notification/download_notification_browsertest.cc
@@ -256,7 +256,7 @@
// Utility method to retrieve a notification object by id. Warning: this will
// check the last display service that was created. If there's a normal and an
// incognito one, you may want to be explicit.
-base::Optional<message_center::Notification> GetNotification(
+absl::optional<message_center::Notification> GetNotification(
const std::string& id) {
return NotificationDisplayServiceTester::Get()->GetNotification(id);
}
@@ -446,7 +446,7 @@
download::DownloadItem* download_item() const { return download_item_; }
std::string notification_id() const { return notification_id_; }
- base::Optional<message_center::Notification> notification() const {
+ absl::optional<message_center::Notification> notification() const {
return GetNotification(notification_id_);
}
Browser* incognito_browser() const { return incognito_browser_; }
@@ -497,8 +497,8 @@
// Try to open the downloaded item by clicking the notification.
EXPECT_FALSE(GetDownloadManagerDelegate()->opened());
display_service_->SimulateClick(NotificationHandler::Type::TRANSIENT,
- notification_id(), base::nullopt,
- base::nullopt);
+ notification_id(), absl::nullopt,
+ absl::nullopt);
EXPECT_TRUE(GetDownloadManagerDelegate()->opened());
EXPECT_FALSE(GetNotification(notification_id()));
@@ -526,7 +526,7 @@
// Clicks the "keep" button.
display_service_->SimulateClick(NotificationHandler::Type::TRANSIENT,
notification_id(), 1, // 2nd button: "Keep"
- base::nullopt);
+ absl::nullopt);
// The notification is closed and re-shown.
EXPECT_TRUE(notification());
@@ -573,7 +573,7 @@
display_service_->SimulateClick(NotificationHandler::Type::TRANSIENT,
notification_id(),
0, // 1st button: "Discard"
- base::nullopt);
+ absl::nullopt);
EXPECT_FALSE(notification());
@@ -832,7 +832,7 @@
// Cancels the notification by clicking the "cancel" button.
display_service_->SimulateClick(NotificationHandler::Type::TRANSIENT,
- notification_id(), 1, base::nullopt);
+ notification_id(), 1, absl::nullopt);
EXPECT_FALSE(notification());
EXPECT_EQ(0u, GetDownloadNotifications().size());
@@ -895,8 +895,8 @@
EXPECT_TRUE(incognito_display_service_->GetNotification(notification_id()));
EXPECT_FALSE(GetIncognitoDownloadManagerDelegate()->opened());
incognito_display_service_->SimulateClick(
- NotificationHandler::Type::TRANSIENT, notification_id(), base::nullopt,
- base::nullopt);
+ NotificationHandler::Type::TRANSIENT, notification_id(), absl::nullopt,
+ absl::nullopt);
EXPECT_TRUE(GetIncognitoDownloadManagerDelegate()->opened());
EXPECT_FALSE(GetDownloadManagerDelegate()->opened());
diff --git a/chrome/browser/download/offline_item_model.cc b/chrome/browser/download/offline_item_model.cc
index 196c686..a7fa508 100644
--- a/chrome/browser/download/offline_item_model.cc
+++ b/chrome/browser/download/offline_item_model.cc
@@ -233,7 +233,7 @@
void OfflineItemModel::OnItemUpdated(
const OfflineItem& item,
- const base::Optional<UpdateDelta>& update_delta) {
+ const absl::optional<UpdateDelta>& update_delta) {
offline_item_ = std::make_unique<OfflineItem>(item);
for (auto& obs : observers_)
obs.OnDownloadUpdated();
diff --git a/chrome/browser/download/offline_item_model.h b/chrome/browser/download/offline_item_model.h
index 9e9fad1..d2b261d 100644
--- a/chrome/browser/download/offline_item_model.h
+++ b/chrome/browser/download/offline_item_model.h
@@ -76,7 +76,7 @@
// FilteredOfflineItemObserver::Observer overrides.
void OnItemRemoved(const ContentId& id) override;
void OnItemUpdated(const OfflineItem& item,
- const base::Optional<UpdateDelta>& update_delta) override;
+ const absl::optional<UpdateDelta>& update_delta) override;
// DownloadUIModel implementation.
std::string GetMimeType() const override;
diff --git a/chrome/browser/download/offline_item_utils.cc b/chrome/browser/download/offline_item_utils.cc
index 351fa17..fdbf1a1 100644
--- a/chrome/browser/download/offline_item_utils.cc
+++ b/chrome/browser/download/offline_item_utils.cc
@@ -45,12 +45,12 @@
// The remaining time for a download item if it cannot be calculated.
constexpr int64_t kUnknownRemainingTime = -1;
-base::Optional<OfflineItemFilter> FilterForSpecialMimeTypes(
+absl::optional<OfflineItemFilter> FilterForSpecialMimeTypes(
const std::string& mime_type) {
if (base::EqualsCaseInsensitiveASCII(mime_type, "application/ogg"))
return OfflineItemFilter::FILTER_AUDIO;
- return base::nullopt;
+ return absl::nullopt;
}
OfflineItemFilter MimeTypeToOfflineItemFilter(const std::string& mime_type) {
@@ -351,21 +351,21 @@
}
// static
-base::Optional<DownloadSchedule> OfflineItemUtils::ToDownloadSchedule(
- base::Optional<OfflineItemSchedule> offline_item_schedule) {
+absl::optional<DownloadSchedule> OfflineItemUtils::ToDownloadSchedule(
+ absl::optional<OfflineItemSchedule> offline_item_schedule) {
if (!offline_item_schedule)
- return base::nullopt;
+ return absl::nullopt;
- return base::make_optional<DownloadSchedule>(
+ return absl::make_optional<DownloadSchedule>(
offline_item_schedule->only_on_wifi, offline_item_schedule->start_time);
}
// static
-base::Optional<OfflineItemSchedule> OfflineItemUtils::ToOfflineItemSchedule(
- base::Optional<DownloadSchedule> download_schedule) {
+absl::optional<OfflineItemSchedule> OfflineItemUtils::ToOfflineItemSchedule(
+ absl::optional<DownloadSchedule> download_schedule) {
if (!download_schedule)
- return base::nullopt;
+ return absl::nullopt;
- return base::make_optional<OfflineItemSchedule>(
+ return absl::make_optional<OfflineItemSchedule>(
download_schedule->only_on_wifi(), download_schedule->start_time());
}
diff --git a/chrome/browser/download/offline_item_utils.h b/chrome/browser/download/offline_item_utils.h
index 9a4e4b7..ad5c1f3 100644
--- a/chrome/browser/download/offline_item_utils.h
+++ b/chrome/browser/download/offline_item_utils.h
@@ -9,10 +9,10 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
#include "components/download/public/common/download_item.h"
#include "components/offline_items_collection/core/offline_item.h"
#include "components/offline_items_collection/core/rename_result.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Contains various utility methods for conversions between DownloadItem and
// OfflineItem.
@@ -48,14 +48,14 @@
DownloadRenameResult download_rename_result);
// Converts OfflineItemSchedule to DownloadSchedule.
- static base::Optional<download::DownloadSchedule> ToDownloadSchedule(
- base::Optional<offline_items_collection::OfflineItemSchedule>
+ static absl::optional<download::DownloadSchedule> ToDownloadSchedule(
+ absl::optional<offline_items_collection::OfflineItemSchedule>
offline_item_schedule);
// Converts DownloadSchedule to OfflineItemSchedule.
- static base::Optional<offline_items_collection::OfflineItemSchedule>
+ static absl::optional<offline_items_collection::OfflineItemSchedule>
ToOfflineItemSchedule(
- base::Optional<download::DownloadSchedule> download_schedule);
+ absl::optional<download::DownloadSchedule> download_schedule);
private:
DISALLOW_COPY_AND_ASSIGN(OfflineItemUtils);
diff --git a/chrome/browser/download/offline_item_utils_unittest.cc b/chrome/browser/download/offline_item_utils_unittest.cc
index 6ceb5d47..d026826 100644
--- a/chrome/browser/download/offline_item_utils_unittest.cc
+++ b/chrome/browser/download/offline_item_utils_unittest.cc
@@ -106,7 +106,7 @@
ON_CALL(*item, GetTotalBytes()).WillByDefault(Return(total_bytes));
ON_CALL(*item, IsDone()).WillByDefault(Return(IsDownloadDone(item.get())));
ON_CALL(*item, GetDownloadSchedule())
- .WillByDefault(ReturnRefOfCopy(base::Optional<DownloadSchedule>()));
+ .WillByDefault(ReturnRefOfCopy(absl::optional<DownloadSchedule>()));
return item;
}
@@ -357,18 +357,18 @@
TEST_F(OfflineItemUtilsTest, OfflineItemSchedule) {
auto time = base::Time::Now();
std::vector<DownloadSchedule> download_schedules = {{false, time},
- {true, base::nullopt}};
+ {true, absl::nullopt}};
for (const auto& download_schedule : download_schedules) {
auto download =
CreateDownloadItem(DownloadItem::IN_PROGRESS, false,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
- base::Optional<DownloadSchedule> copy = download_schedule;
+ absl::optional<DownloadSchedule> copy = download_schedule;
ON_CALL(*download, GetDownloadSchedule())
.WillByDefault(ReturnRefOfCopy(copy));
OfflineItem offline_item =
OfflineItemUtils::CreateOfflineItem(kNameSpace, download.get());
- auto offline_item_schedule = base::make_optional<OfflineItemSchedule>(
+ auto offline_item_schedule = absl::make_optional<OfflineItemSchedule>(
download_schedule.only_on_wifi(), download_schedule.start_time());
EXPECT_EQ(offline_item.schedule, offline_item.schedule);
}
diff --git a/chrome/browser/engagement/important_sites_util.cc b/chrome/browser/engagement/important_sites_util.cc
index 990d94f..e89f28ad 100644
--- a/chrome/browser/engagement/important_sites_util.cc
+++ b/chrome/browser/engagement/important_sites_util.cc
@@ -111,7 +111,7 @@
// If we should suppress the item with the given dictionary ignored record.
bool ShouldSuppressItem(base::Value* dict) {
- base::Optional<double> last_ignored_time =
+ absl::optional<double> last_ignored_time =
dict->FindDoubleKey(kTimeLastIgnored);
if (last_ignored_time) {
base::TimeDelta diff =
@@ -123,7 +123,7 @@
}
}
- base::Optional<int> times_ignored = dict->FindIntKey(kNumTimesIgnoredName);
+ absl::optional<int> times_ignored = dict->FindIntKey(kNumTimesIgnoredName);
return times_ignored && *times_ignored >= kTimesIgnoredForSuppression;
}
@@ -153,7 +153,7 @@
const GURL& origin,
std::set<GURL>* visited_origins,
ImportantReason reason,
- base::Optional<std::string> app_name,
+ absl::optional<std::string> app_name,
std::map<std::string, ImportantDomainInfo>* output) {
if (!origin.is_valid() || !visited_origins->insert(origin).second)
return;
@@ -254,7 +254,7 @@
if (detail.installed_bonus > 0) {
MaybePopulateImportantInfoForReason(detail.origin, &content_origins,
ImportantReason::HOME_SCREEN,
- base::nullopt, output);
+ absl::nullopt, output);
}
(*engagement_map)[detail.origin] = detail.total_score;
@@ -306,7 +306,7 @@
#endif
MaybePopulateImportantInfoForReason(url, &content_origins, reason,
- base::nullopt, output);
+ absl::nullopt, output);
}
}
@@ -354,7 +354,7 @@
for (const UrlAndTitle& bookmark : result_bookmarks) {
MaybePopulateImportantInfoForReason(bookmark.url, &content_origins,
ImportantReason::BOOKMARKS,
- base::nullopt, output);
+ absl::nullopt, output);
}
}
diff --git a/chrome/browser/engagement/important_sites_util.h b/chrome/browser/engagement/important_sites_util.h
index 4e0b493..e390544 100644
--- a/chrome/browser/engagement/important_sites_util.h
+++ b/chrome/browser/engagement/important_sites_util.h
@@ -9,9 +9,9 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "components/browsing_data/core/browsing_data_utils.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class Profile;
@@ -44,7 +44,7 @@
double engagement_score = 0;
int32_t reason_bitfield = 0;
// Only set if the domain belongs to an installed app.
- base::Optional<std::string> app_name;
+ absl::optional<std::string> app_name;
};
// Do not change the values here, as they are used for UMA histograms.
diff --git a/chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc b/chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc
index c4471f8..32caa55 100644
--- a/chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc
+++ b/chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc
@@ -87,7 +87,7 @@
}
// static
-base::Optional<AnalysisServiceSettings::URLPatternSettings>
+absl::optional<AnalysisServiceSettings::URLPatternSettings>
AnalysisServiceSettings::GetPatternSettings(
const PatternSettings& patterns,
url_matcher::URLMatcherConditionSet::ID match) {
@@ -104,22 +104,22 @@
if (next != patterns.end())
return next->second;
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<AnalysisSettings> AnalysisServiceSettings::GetAnalysisSettings(
+absl::optional<AnalysisSettings> AnalysisServiceSettings::GetAnalysisSettings(
const GURL& url) const {
if (!IsValid())
- return base::nullopt;
+ return absl::nullopt;
DCHECK(matcher_);
auto matches = matcher_->MatchURL(url);
if (matches.empty())
- return base::nullopt;
+ return absl::nullopt;
auto tags = GetTags(matches);
if (tags.empty())
- return base::nullopt;
+ return absl::nullopt;
AnalysisSettings settings;
diff --git a/chrome/browser/enterprise/connectors/analysis/analysis_service_settings.h b/chrome/browser/enterprise/connectors/analysis/analysis_service_settings.h
index 181c849..f38911ff 100644
--- a/chrome/browser/enterprise/connectors/analysis/analysis_service_settings.h
+++ b/chrome/browser/enterprise/connectors/analysis/analysis_service_settings.h
@@ -8,11 +8,11 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/enterprise/connectors/common.h"
#include "chrome/browser/enterprise/connectors/service_provider_config.h"
#include "components/url_matcher/url_matcher.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace enterprise_connectors {
@@ -25,9 +25,9 @@
AnalysisServiceSettings(AnalysisServiceSettings&&);
~AnalysisServiceSettings();
- // Get the settings to apply to a specific analysis. base::nullopt implies no
+ // Get the settings to apply to a specific analysis. absl::nullopt implies no
// analysis should take place.
- base::Optional<AnalysisSettings> GetAnalysisSettings(const GURL& url) const;
+ absl::optional<AnalysisSettings> GetAnalysisSettings(const GURL& url) const;
// Get the block_until_verdict setting if the settings are valid.
bool ShouldBlockUntilVerdict() const;
@@ -53,12 +53,12 @@
std::map<url_matcher::URLMatcherConditionSet::ID, URLPatternSettings>;
// Accessors for the pattern setting maps.
- static base::Optional<URLPatternSettings> GetPatternSettings(
+ static absl::optional<URLPatternSettings> GetPatternSettings(
const PatternSettings& patterns,
url_matcher::URLMatcherConditionSet::ID match);
// Returns true if the settings were initialized correctly. If this returns
- // false, then GetAnalysisSettings will always return base::nullopt.
+ // false, then GetAnalysisSettings will always return absl::nullopt.
bool IsValid() const;
// Updates the states of |matcher_|, |enabled_patterns_settings_| and/or
diff --git a/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_browsertest.cc b/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_browsertest.cc
index bacb159..b709720 100644
--- a/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_browsertest.cc
+++ b/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_browsertest.cc
@@ -1112,7 +1112,7 @@
bool called = false;
base::RunLoop run_loop;
- base::Optional<base::RepeatingClosure> quit_closure = base::nullopt;
+ absl::optional<base::RepeatingClosure> quit_closure = absl::nullopt;
// If the scan is blocking, we can call the quit closure when the dialog
// closes. If it's not, call it at the end of the result callback.
diff --git a/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_unittest.cc b/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_unittest.cc
index 79ae017..d9065ca 100644
--- a/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_unittest.cc
+++ b/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_unittest.cc
@@ -674,7 +674,7 @@
std::set<base::FilePath> encrypted_;
// DLP response to ovewrite in the callback if present.
- base::Optional<ContentAnalysisResponse> dlp_response_ = base::nullopt;
+ absl::optional<ContentAnalysisResponse> dlp_response_ = absl::nullopt;
};
TEST_F(ContentAnalysisDelegateAuditOnlyTest, Empty) {
@@ -1626,7 +1626,7 @@
const char* bool_setting() const { return GetParam() ? "true" : "false"; }
AnalysisSettings settings() {
- base::Optional<AnalysisSettings> settings =
+ absl::optional<AnalysisSettings> settings =
ConnectorsServiceFactory::GetForBrowserContext(profile())
->GetAnalysisSettings(GURL(kTestUrl), FILE_ATTACHED);
EXPECT_TRUE(settings.has_value());
diff --git a/chrome/browser/enterprise/connectors/analysis/content_analysis_dialog_browsertest.cc b/chrome/browser/enterprise/connectors/analysis/content_analysis_dialog_browsertest.cc
index dd71da2..3d51d47 100644
--- a/chrome/browser/enterprise/connectors/analysis/content_analysis_dialog_browsertest.cc
+++ b/chrome/browser/enterprise/connectors/analysis/content_analysis_dialog_browsertest.cc
@@ -532,7 +532,7 @@
FILE_ATTACHED, kBlockingScansForDlp);
SetStatusCallbackResponse(
safe_browsing::SimpleContentAnalysisResponseForTesting(
- /*dlp=*/true, /*malware=*/base::nullopt));
+ /*dlp=*/true, /*malware=*/absl::nullopt));
// Set up delegate test values. An unresponsive delegate is set up to avoid
// a race between the file responses and the "Cancel" button being clicked.
diff --git a/chrome/browser/enterprise/connectors/connectors_manager.cc b/chrome/browser/enterprise/connectors/connectors_manager.cc
index 1d2d1a2..420e555a 100644
--- a/chrome/browser/enterprise/connectors/connectors_manager.cc
+++ b/chrome/browser/enterprise/connectors/connectors_manager.cc
@@ -54,10 +54,10 @@
return pref && pref_change_registrar_.prefs()->HasPrefPath(pref);
}
-base::Optional<ReportingSettings> ConnectorsManager::GetReportingSettings(
+absl::optional<ReportingSettings> ConnectorsManager::GetReportingSettings(
ReportingConnector connector) {
if (!IsConnectorEnabled(connector))
- return base::nullopt;
+ return absl::nullopt;
if (reporting_connector_settings_.count(connector) == 0)
CacheReportingConnectorPolicy(connector);
@@ -65,18 +65,18 @@
// If the connector is still not in memory, it means the pref is set to an
// empty list or that it is not a list.
if (reporting_connector_settings_.count(connector) == 0)
- return base::nullopt;
+ return absl::nullopt;
// While multiple services can be set by the connector policies, only the
// first one is considered for now.
return reporting_connector_settings_[connector][0].GetReportingSettings();
}
-base::Optional<AnalysisSettings> ConnectorsManager::GetAnalysisSettings(
+absl::optional<AnalysisSettings> ConnectorsManager::GetAnalysisSettings(
const GURL& url,
AnalysisConnector connector) {
if (!IsConnectorEnabled(connector))
- return base::nullopt;
+ return absl::nullopt;
if (analysis_connector_settings_.count(connector) == 0)
CacheAnalysisConnectorPolicy(connector);
@@ -84,14 +84,14 @@
// If the connector is still not in memory, it means the pref is set to an
// empty list or that it is not a list.
if (analysis_connector_settings_.count(connector) == 0)
- return base::nullopt;
+ return absl::nullopt;
// While multiple services can be set by the connector policies, only the
// first one is considered for now.
return analysis_connector_settings_[connector][0].GetAnalysisSettings(url);
}
-base::Optional<AnalysisSettings>
+absl::optional<AnalysisSettings>
ConnectorsManager::GetAnalysisSettingsFromConnectorPolicy(
const GURL& url,
AnalysisConnector connector) {
@@ -101,18 +101,18 @@
// If the connector is still not in memory, it means the pref is set to an
// empty list or that it is not a list.
if (analysis_connector_settings_.count(connector) == 0)
- return base::nullopt;
+ return absl::nullopt;
// While multiple services can be set by the connector policies, only the
// first one is considered for now.
return analysis_connector_settings_[connector][0].GetAnalysisSettings(url);
}
-base::Optional<FileSystemSettings> ConnectorsManager::GetFileSystemSettings(
+absl::optional<FileSystemSettings> ConnectorsManager::GetFileSystemSettings(
const GURL& url,
FileSystemConnector connector) {
if (!IsConnectorEnabled(connector))
- return base::nullopt;
+ return absl::nullopt;
if (file_system_connector_settings_.count(connector) == 0)
CacheFileSystemConnectorPolicy(connector);
@@ -120,7 +120,7 @@
// If the connector is still not in memory, it means the pref is set to an
// empty list or that it is not a list.
if (file_system_connector_settings_.count(connector) == 0)
- return base::nullopt;
+ return absl::nullopt;
// While multiple services can be set by the connector policies, only the
// first one is considered for now.
diff --git a/chrome/browser/enterprise/connectors/connectors_manager.h b/chrome/browser/enterprise/connectors/connectors_manager.h
index ebd51e6..ae25ee03 100644
--- a/chrome/browser/enterprise/connectors/connectors_manager.h
+++ b/chrome/browser/enterprise/connectors/connectors_manager.h
@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_ENTERPRISE_CONNECTORS_CONNECTORS_MANAGER_H_
#define CHROME_BROWSER_ENTERPRISE_CONNECTORS_CONNECTORS_MANAGER_H_
-#include "base/optional.h"
#include "chrome/browser/enterprise/connectors/analysis/analysis_service_settings.h"
#include "chrome/browser/enterprise/connectors/common.h"
#include "chrome/browser/enterprise/connectors/file_system/service_settings.h"
@@ -13,6 +12,7 @@
#include "chrome/browser/enterprise/connectors/service_provider_config.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace enterprise_connectors {
@@ -38,20 +38,20 @@
// Validates which settings should be applied to a reporting event
// against cached policies. Cache the policy value the first time this is
// called for every different connector.
- base::Optional<ReportingSettings> GetReportingSettings(
+ absl::optional<ReportingSettings> GetReportingSettings(
ReportingConnector connector);
// Validates which settings should be applied to an analysis connector event
// against cached policies. This function will prioritize new connector
// policies over legacy ones if they are set.
- base::Optional<AnalysisSettings> GetAnalysisSettings(
+ absl::optional<AnalysisSettings> GetAnalysisSettings(
const GURL& url,
AnalysisConnector connector);
// Validates which settings should be applied to a file system connector
// against cached policies. Cache the policy value the first time this is
// called for every different connector.
- base::Optional<FileSystemSettings> GetFileSystemSettings(
+ absl::optional<FileSystemSettings> GetFileSystemSettings(
const GURL& url,
FileSystemConnector connector);
@@ -79,7 +79,7 @@
// Validates which settings should be applied to an analysis connector event
// against connector policies. Cache the policy value the first time this is
// called for every different connector.
- base::Optional<AnalysisSettings> GetAnalysisSettingsFromConnectorPolicy(
+ absl::optional<AnalysisSettings> GetAnalysisSettingsFromConnectorPolicy(
const GURL& url,
AnalysisConnector connector);
@@ -98,7 +98,7 @@
// Validates which settings should be applied to an analysis connector event
// against connector policies. Cache the policy value the first time this is
// called for every different connector.
- base::Optional<ReportingSettings> GetReportingSettingsFromConnectorPolicy(
+ absl::optional<ReportingSettings> GetReportingSettingsFromConnectorPolicy(
ReportingConnector connector);
// Cached values of available service providers. This information validates
diff --git a/chrome/browser/enterprise/connectors/connectors_manager_unittest.cc b/chrome/browser/enterprise/connectors/connectors_manager_unittest.cc
index 23578320..9c540d7c 100644
--- a/chrome/browser/enterprise/connectors/connectors_manager_unittest.cc
+++ b/chrome/browser/enterprise/connectors/connectors_manager_unittest.cc
@@ -7,7 +7,6 @@
#include "chrome/browser/enterprise/connectors/connectors_manager.h"
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
@@ -23,6 +22,7 @@
#include "components/prefs/scoped_user_pref_update.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace enterprise_connectors {
@@ -195,10 +195,10 @@
}
protected:
- base::Optional<AnalysisSettings> ExpectedAnalysisSettings(const char* pref,
+ absl::optional<AnalysisSettings> ExpectedAnalysisSettings(const char* pref,
const char* url) {
if (pref == kEmptySettingsPref || url == kNoTagsUrl)
- return base::nullopt;
+ return absl::nullopt;
AnalysisSettings settings;
diff --git a/chrome/browser/enterprise/connectors/connectors_service.cc b/chrome/browser/enterprise/connectors/connectors_service.cc
index a682d6a..f6418c9 100644
--- a/chrome/browser/enterprise/connectors/connectors_service.cc
+++ b/chrome/browser/enterprise/connectors/connectors_service.cc
@@ -234,19 +234,19 @@
ConnectorsService::~ConnectorsService() = default;
-base::Optional<ReportingSettings> ConnectorsService::GetReportingSettings(
+absl::optional<ReportingSettings> ConnectorsService::GetReportingSettings(
ReportingConnector connector) {
if (!ConnectorsEnabled())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<ReportingSettings> settings =
+ absl::optional<ReportingSettings> settings =
connectors_manager_->GetReportingSettings(connector);
if (!settings.has_value())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<DmToken> dm_token = GetDmToken(ConnectorScopePref(connector));
+ absl::optional<DmToken> dm_token = GetDmToken(ConnectorScopePref(connector));
if (!dm_token.has_value())
- return base::nullopt;
+ return absl::nullopt;
settings.value().dm_token = dm_token.value().value;
settings.value().per_profile =
@@ -255,20 +255,20 @@
return settings;
}
-base::Optional<AnalysisSettings> ConnectorsService::GetAnalysisSettings(
+absl::optional<AnalysisSettings> ConnectorsService::GetAnalysisSettings(
const GURL& url,
AnalysisConnector connector) {
if (!ConnectorsEnabled())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<AnalysisSettings> settings =
+ absl::optional<AnalysisSettings> settings =
connectors_manager_->GetAnalysisSettings(url, connector);
if (!settings.has_value())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<DmToken> dm_token = GetDmToken(ConnectorScopePref(connector));
+ absl::optional<DmToken> dm_token = GetDmToken(ConnectorScopePref(connector));
if (!dm_token.has_value())
- return base::nullopt;
+ return absl::nullopt;
settings.value().dm_token = dm_token.value().value;
settings.value().per_profile =
@@ -278,16 +278,16 @@
return settings;
}
-base::Optional<FileSystemSettings> ConnectorsService::GetFileSystemSettings(
+absl::optional<FileSystemSettings> ConnectorsService::GetFileSystemSettings(
const GURL& url,
FileSystemConnector connector) {
if (!ConnectorsEnabled())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<FileSystemSettings> settings =
+ absl::optional<FileSystemSettings> settings =
connectors_manager_->GetFileSystemSettings(url, connector);
if (!settings.has_value())
- return base::nullopt;
+ return absl::nullopt;
return settings;
}
@@ -343,23 +343,23 @@
return connectors_manager_->GetAnalysisServiceProviderNames(connector);
}
-base::Optional<std::string> ConnectorsService::GetDMTokenForRealTimeUrlCheck()
+absl::optional<std::string> ConnectorsService::GetDMTokenForRealTimeUrlCheck()
const {
if (!ConnectorsEnabled())
- return base::nullopt;
+ return absl::nullopt;
if (Profile::FromBrowserContext(context_)->GetPrefs()->GetInteger(
prefs::kSafeBrowsingEnterpriseRealTimeUrlCheckMode) ==
safe_browsing::REAL_TIME_CHECK_DISABLED) {
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<DmToken> dm_token =
+ absl::optional<DmToken> dm_token =
GetDmToken(prefs::kSafeBrowsingEnterpriseRealTimeUrlCheckScope);
if (dm_token.has_value())
return dm_token.value().value;
- return base::nullopt;
+ return absl::nullopt;
}
safe_browsing::EnterpriseRealTimeUrlCheckMode
@@ -387,7 +387,7 @@
default;
ConnectorsService::DmToken::~DmToken() = default;
-base::Optional<ConnectorsService::DmToken> ConnectorsService::GetDmToken(
+absl::optional<ConnectorsService::DmToken> ConnectorsService::GetDmToken(
const char* scope_pref) const {
#if BUILDFLAG(IS_CHROMEOS_ASH)
// On CrOS, the device must be affiliated to use the DM token for
@@ -400,30 +400,30 @@
#endif
}
-base::Optional<ConnectorsService::DmToken>
+absl::optional<ConnectorsService::DmToken>
ConnectorsService::GetBrowserDmToken() const {
policy::DMToken dm_token =
policy::GetDMToken(Profile::FromBrowserContext(context_));
if (!dm_token.is_valid())
- return base::nullopt;
+ return absl::nullopt;
return DmToken(dm_token.value(), policy::POLICY_SCOPE_MACHINE);
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
-base::Optional<ConnectorsService::DmToken>
+absl::optional<ConnectorsService::DmToken>
ConnectorsService::GetProfileDmToken() const {
if (!base::FeatureList::IsEnabled(kPerProfileConnectorsEnabled))
- return base::nullopt;
+ return absl::nullopt;
if (!CanUseProfileDmToken())
- return base::nullopt;
+ return absl::nullopt;
policy::UserCloudPolicyManager* policy_manager =
Profile::FromBrowserContext(context_)->GetUserCloudPolicyManager();
if (!policy_manager || !policy_manager->IsClientRegistered())
- return base::nullopt;
+ return absl::nullopt;
return DmToken(policy_manager->core()->client()->dm_token(),
policy::POLICY_SCOPE_USER);
diff --git a/chrome/browser/enterprise/connectors/connectors_service.h b/chrome/browser/enterprise/connectors/connectors_service.h
index b318586..afa0482 100644
--- a/chrome/browser/enterprise/connectors/connectors_service.h
+++ b/chrome/browser/enterprise/connectors/connectors_service.h
@@ -49,12 +49,12 @@
// Accessors that check kEnterpriseConnectorsEnabled is enabled, and then call
// the corresponding method in ConnectorsManager.
- base::Optional<ReportingSettings> GetReportingSettings(
+ absl::optional<ReportingSettings> GetReportingSettings(
ReportingConnector connector);
- base::Optional<AnalysisSettings> GetAnalysisSettings(
+ absl::optional<AnalysisSettings> GetAnalysisSettings(
const GURL& url,
AnalysisConnector connector);
- base::Optional<FileSystemSettings> GetFileSystemSettings(
+ absl::optional<FileSystemSettings> GetFileSystemSettings(
const GURL& url,
FileSystemConnector connector);
@@ -70,9 +70,9 @@
ReportingConnector connector);
// DM token accessor function for real-time URL checks. Returns a profile or
- // browser DM token depending on the policy scope, and base::nullopt if there
+ // browser DM token depending on the policy scope, and absl::nullopt if there
// is no token to use.
- base::Optional<std::string> GetDMTokenForRealTimeUrlCheck() const;
+ absl::optional<std::string> GetDMTokenForRealTimeUrlCheck() const;
// Returns the value to used by the enterprise real-time URL check Connector
// if it is set and if the scope it's set at has a valid browser-profile
@@ -100,10 +100,10 @@
// Returns the DM token to use with the given |scope_pref|. That pref should
// contain either POLICY_SCOPE_MACHINE or POLICY_SCOPE_USER.
- base::Optional<DmToken> GetDmToken(const char* scope_pref) const;
- base::Optional<DmToken> GetBrowserDmToken() const;
+ absl::optional<DmToken> GetDmToken(const char* scope_pref) const;
+ absl::optional<DmToken> GetBrowserDmToken() const;
#if !BUILDFLAG(IS_CHROMEOS_ASH)
- base::Optional<DmToken> GetProfileDmToken() const;
+ absl::optional<DmToken> GetProfileDmToken() const;
// Returns true if the browser isn't managed by CBCM, otherwise this checks if
// the affiliations IDs from the profile and browser policy fetching responses
diff --git a/chrome/browser/enterprise/connectors/connectors_service_unittest.cc b/chrome/browser/enterprise/connectors/connectors_service_unittest.cc
index 2c8142f..47518943 100644
--- a/chrome/browser/enterprise/connectors/connectors_service_unittest.cc
+++ b/chrome/browser/enterprise/connectors/connectors_service_unittest.cc
@@ -111,7 +111,7 @@
auto* service = ConnectorsServiceFactory::GetForBrowserContext(profile_);
for (const char* url :
{kDlpAndMalwareUrl, kOnlyDlpUrl, kOnlyMalwareUrl, kNoTagsUrl}) {
- // Only base::nullopt should be returned when the feature is disabled,
+ // Only absl::nullopt should be returned when the feature is disabled,
// regardless of what Connector or URL is used.
auto settings = service->GetAnalysisSettings(GURL(url), connector());
ASSERT_FALSE(settings.has_value());
diff --git a/chrome/browser/enterprise/connectors/device_trust/attestation_service.cc b/chrome/browser/enterprise/connectors/device_trust/attestation_service.cc
index 854bb941..c852b57 100644
--- a/chrome/browser/enterprise/connectors/device_trust/attestation_service.cc
+++ b/chrome/browser/enterprise/connectors/device_trust/attestation_service.cc
@@ -27,7 +27,7 @@
const std::string& challenge) {
attestation::SignedData signed_challenge;
// Get challenge and decode it.
- base::Optional<base::Value> data = base::JSONReader::Read(
+ absl::optional<base::Value> data = base::JSONReader::Read(
challenge, base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS);
// If json is malformed or it doesn't include the needed fields return
diff --git a/chrome/browser/enterprise/connectors/device_trust/attestation_service_unittest.cc b/chrome/browser/enterprise/connectors/device_trust/attestation_service_unittest.cc
index 3ffb9bd..2ec5e3b4 100644
--- a/chrome/browser/enterprise/connectors/device_trust/attestation_service_unittest.cc
+++ b/chrome/browser/enterprise/connectors/device_trust/attestation_service_unittest.cc
@@ -69,7 +69,7 @@
// `JsonChallengeToProtobufChallenge()` failed.
EXPECT_NE(result.challenge_response(), std::string());
- base::Optional<base::Value> challenge_response = base::JSONReader::Read(
+ absl::optional<base::Value> challenge_response = base::JSONReader::Read(
attestation_service_.ProtobufChallengeToJsonChallenge(
result.challenge_response()),
base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS);
diff --git a/chrome/browser/enterprise/connectors/device_trust/signal_reporter_unittest.cc b/chrome/browser/enterprise/connectors/device_trust/signal_reporter_unittest.cc
index ded597f..a955282 100644
--- a/chrome/browser/enterprise/connectors/device_trust/signal_reporter_unittest.cc
+++ b/chrome/browser/enterprise/connectors/device_trust/signal_reporter_unittest.cc
@@ -7,7 +7,6 @@
#include "chrome/browser/enterprise/connectors/device_trust/signal_reporter.h"
#include "base/json/json_writer.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/enterprise/connectors/device_trust/mock_signal_reporter.h"
@@ -17,6 +16,7 @@
#include "components/reporting/client/report_queue.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using testing::_;
using testing::Invoke;
diff --git a/chrome/browser/enterprise/connectors/enterprise_connectors_policy_handler_unittest.cc b/chrome/browser/enterprise/connectors/enterprise_connectors_policy_handler_unittest.cc
index bb2877a..1be6cdd 100644
--- a/chrome/browser/enterprise/connectors/enterprise_connectors_policy_handler_unittest.cc
+++ b/chrome/browser/enterprise/connectors/enterprise_connectors_policy_handler_unittest.cc
@@ -8,7 +8,6 @@
#include <tuple>
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "base/values.h"
#include "components/policy/core/browser/policy_error_map.h"
#include "components/policy/core/common/policy_map.h"
@@ -16,6 +15,7 @@
#include "components/policy/core/common/schema.h"
#include "components/prefs/pref_value_map.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace enterprise_connectors {
@@ -92,7 +92,7 @@
source() == policy::PolicySource::POLICY_SOURCE_PRIORITY_CLOUD);
}
- base::Optional<base::Value> policy_value() const {
+ absl::optional<base::Value> policy_value() const {
return base::JSONReader::Read(policy(), base::JSON_ALLOW_TRAILING_COMMAS);
}
};
diff --git a/chrome/browser/enterprise/connectors/file_system/box_api_call_flow.cc b/chrome/browser/enterprise/connectors/file_system/box_api_call_flow.cc
index 42ae478..83760c6 100644
--- a/chrome/browser/enterprise/connectors/file_system/box_api_call_flow.cc
+++ b/chrome/browser/enterprise/connectors/file_system/box_api_call_flow.cc
@@ -431,19 +431,19 @@
std::move(read_file_task), std::move(read_file_reply));
}
-base::Optional<std::string> BoxWholeFileUploadApiCallFlow::ReadFile(
+absl::optional<std::string> BoxWholeFileUploadApiCallFlow::ReadFile(
const base::FilePath& path) {
std::string content;
return base::ReadFileToStringWithMaxSize(path, &content,
kWholeFileUploadMaxSize)
- ? base::Optional<std::string>(std::move(content))
- : base::nullopt;
+ ? absl::optional<std::string>(std::move(content))
+ : absl::nullopt;
}
void BoxWholeFileUploadApiCallFlow::OnFileRead(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const std::string& access_token,
- base::Optional<std::string> file_read) {
+ absl::optional<std::string> file_read) {
if (!file_read) {
DLOG(ERROR) << "[BoxApiCallFlow] WholeFileUpload read file failed";
// TODO(https://crbug.com/1165972): error handling
diff --git a/chrome/browser/enterprise/connectors/file_system/box_api_call_flow.h b/chrome/browser/enterprise/connectors/file_system/box_api_call_flow.h
index 7306586..add472e 100644
--- a/chrome/browser/enterprise/connectors/file_system/box_api_call_flow.h
+++ b/chrome/browser/enterprise/connectors/file_system/box_api_call_flow.h
@@ -167,15 +167,15 @@
// Helper functions to read and delete the local file.
// Task posted to ThreadPool to read the local file. Return type is
- // base::Optional in case file is read successfully but the file content is
+ // absl::optional in case file is read successfully but the file content is
// really empty.
- static base::Optional<std::string> ReadFile(const base::FilePath& path);
+ static absl::optional<std::string> ReadFile(const base::FilePath& path);
// Callback attached in PostReadFileTask(). Take in read file content and
// kick off OAuth2CallFlow::Start().
void OnFileRead(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const std::string& access_token,
- base::Optional<std::string> content);
+ absl::optional<std::string> content);
const std::string folder_id_;
const base::FilePath target_file_name_;
diff --git a/chrome/browser/enterprise/connectors/file_system/rename_handler.cc b/chrome/browser/enterprise/connectors/file_system/rename_handler.cc
index 8cb54f6d..99294fbe 100644
--- a/chrome/browser/enterprise/connectors/file_system/rename_handler.cc
+++ b/chrome/browser/enterprise/connectors/file_system/rename_handler.cc
@@ -46,10 +46,10 @@
"FileSystemConnectorsEnabled", base::FEATURE_DISABLED_BY_DEFAULT};
// static
-base::Optional<FileSystemSettings> FileSystemRenameHandler::IsEnabled(
+absl::optional<FileSystemSettings> FileSystemRenameHandler::IsEnabled(
download::DownloadItem* download_item) {
if (!base::FeatureList::IsEnabled(kFileSystemConnectorEnabled))
- return base::nullopt;
+ return absl::nullopt;
// Check to see if the download item matches any rules. If the URL of the
// download itself does not match then check the URL of site on which the
@@ -70,7 +70,7 @@
return settings;
}
- return base::nullopt;
+ return absl::nullopt;
}
// static
diff --git a/chrome/browser/enterprise/connectors/file_system/rename_handler.h b/chrome/browser/enterprise/connectors/file_system/rename_handler.h
index 6686cdeb..1d11aeaa 100644
--- a/chrome/browser/enterprise/connectors/file_system/rename_handler.h
+++ b/chrome/browser/enterprise/connectors/file_system/rename_handler.h
@@ -8,12 +8,12 @@
#include "base/callback.h"
#include "base/feature_list.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/enterprise/connectors/common.h"
#include "components/download/public/common/download_interrupt_reasons.h"
#include "components/download/public/common/download_item_rename_handler.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefService;
namespace content {
@@ -66,7 +66,7 @@
const std::string& refresh_token);
private:
- static base::Optional<FileSystemSettings> IsEnabled(
+ static absl::optional<FileSystemSettings> IsEnabled(
download::DownloadItem* download_item);
static std::unique_ptr<download::DownloadItemRenameHandler> Create(
diff --git a/chrome/browser/enterprise/connectors/file_system/service_settings.cc b/chrome/browser/enterprise/connectors/file_system/service_settings.cc
index d6170dc..f9426df 100644
--- a/chrome/browser/enterprise/connectors/file_system/service_settings.cc
+++ b/chrome/browser/enterprise/connectors/file_system/service_settings.cc
@@ -79,19 +79,19 @@
FileSystemServiceSettings&&) = default;
FileSystemServiceSettings::~FileSystemServiceSettings() = default;
-base::Optional<FileSystemSettings> FileSystemServiceSettings::GetSettings(
+absl::optional<FileSystemSettings> FileSystemServiceSettings::GetSettings(
const GURL& url) const {
if (!IsValid())
- return base::nullopt;
+ return absl::nullopt;
DCHECK(matcher_);
auto matches = matcher_->MatchURL(url);
if (matches.empty())
- return base::nullopt;
+ return absl::nullopt;
auto mime_types = GetMimeTypes(matches);
if (mime_types.empty())
- return base::nullopt;
+ return absl::nullopt;
FileSystemSettings settings;
settings.service_provider = service_provider_name_;
@@ -111,7 +111,7 @@
}
// static
-base::Optional<FileSystemServiceSettings::URLPatternSettings>
+absl::optional<FileSystemServiceSettings::URLPatternSettings>
FileSystemServiceSettings::GetPatternSettings(
const PatternSettings& patterns,
url_matcher::URLMatcherConditionSet::ID match) {
@@ -128,7 +128,7 @@
if (next != patterns.end())
return next->second;
- return base::nullopt;
+ return absl::nullopt;
}
bool FileSystemServiceSettings::IsValid() const {
diff --git a/chrome/browser/enterprise/connectors/file_system/service_settings.h b/chrome/browser/enterprise/connectors/file_system/service_settings.h
index 29919a20..335afe4 100644
--- a/chrome/browser/enterprise/connectors/file_system/service_settings.h
+++ b/chrome/browser/enterprise/connectors/file_system/service_settings.h
@@ -8,11 +8,11 @@
#include <set>
#include <string>
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/enterprise/connectors/common.h"
#include "chrome/browser/enterprise/connectors/service_provider_config.h"
#include "components/url_matcher/url_matcher.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace enterprise_connectors {
@@ -25,8 +25,8 @@
FileSystemServiceSettings(FileSystemServiceSettings&&);
~FileSystemServiceSettings();
- // Get the settings to apply. base::nullopt implies no file system settings.
- base::Optional<FileSystemSettings> GetSettings(const GURL& url) const;
+ // Get the settings to apply. absl::nullopt implies no file system settings.
+ absl::optional<FileSystemSettings> GetSettings(const GURL& url) const;
private:
// The setting to apply when a specific URL pattern is matched.
@@ -47,12 +47,12 @@
std::map<url_matcher::URLMatcherConditionSet::ID, URLPatternSettings>;
// Accessors for the pattern setting maps.
- static base::Optional<URLPatternSettings> GetPatternSettings(
+ static absl::optional<URLPatternSettings> GetPatternSettings(
const PatternSettings& patterns,
url_matcher::URLMatcherConditionSet::ID match);
// Returns true if the settings were initialized correctly. If this returns
- // false, then GetSettings will always return base::nullopt.
+ // false, then GetSettings will always return absl::nullopt.
bool IsValid() const;
// Updates the states of |matcher_|, |enabled_patterns_settings_| and/or
diff --git a/chrome/browser/enterprise/connectors/file_system/signin_dialog_delegate.cc b/chrome/browser/enterprise/connectors/file_system/signin_dialog_delegate.cc
index 0fd9935..0e776db 100644
--- a/chrome/browser/enterprise/connectors/file_system/signin_dialog_delegate.cc
+++ b/chrome/browser/enterprise/connectors/file_system/signin_dialog_delegate.cc
@@ -7,7 +7,6 @@
#include <utility>
#include <vector>
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/enterprise/connectors/file_system/box_api_call_endpoints.h"
#include "chrome/grit/generated_resources.h"
@@ -22,6 +21,7 @@
#include "google_apis/gaia/oauth2_api_call_flow.h"
#include "net/base/url_util.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/views/layout/fill_layout.h"
#include "url/gurl.h"
diff --git a/chrome/browser/enterprise/connectors/reporting/reporting_service_settings.cc b/chrome/browser/enterprise/connectors/reporting/reporting_service_settings.cc
index bc666655..6bcbc3d 100644
--- a/chrome/browser/enterprise/connectors/reporting/reporting_service_settings.cc
+++ b/chrome/browser/enterprise/connectors/reporting/reporting_service_settings.cc
@@ -17,11 +17,11 @@
constexpr char kReportingConnectorUrlFlag[] = "reporting-connector-url";
-base::Optional<GURL> GetUrlOverride() {
+absl::optional<GURL> GetUrlOverride() {
// Ignore this flag on Stable and Beta to avoid abuse.
if (!g_browser_process || !g_browser_process->browser_policy_connector()
->IsCommandLineSwitchSupported()) {
- return base::nullopt;
+ return absl::nullopt;
}
base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
@@ -33,7 +33,7 @@
VLOG(1) << "--reporting-connector-url is set to an invalid URL";
}
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace
@@ -78,10 +78,10 @@
}
}
-base::Optional<ReportingSettings>
+absl::optional<ReportingSettings>
ReportingServiceSettings::GetReportingSettings() const {
if (!IsValid())
- return base::nullopt;
+ return absl::nullopt;
ReportingSettings settings;
diff --git a/chrome/browser/enterprise/connectors/reporting/reporting_service_settings.h b/chrome/browser/enterprise/connectors/reporting/reporting_service_settings.h
index a157d839..ddd9d09 100644
--- a/chrome/browser/enterprise/connectors/reporting/reporting_service_settings.h
+++ b/chrome/browser/enterprise/connectors/reporting/reporting_service_settings.h
@@ -8,10 +8,10 @@
#include <set>
#include <string>
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/enterprise/connectors/common.h"
#include "chrome/browser/enterprise/connectors/service_provider_config.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace enterprise_connectors {
@@ -24,15 +24,15 @@
ReportingServiceSettings(ReportingServiceSettings&&);
~ReportingServiceSettings();
- // Get the settings to apply to a specific report. base::nullopt implies no
+ // Get the settings to apply to a specific report. absl::nullopt implies no
// report should take place.
- base::Optional<ReportingSettings> GetReportingSettings() const;
+ absl::optional<ReportingSettings> GetReportingSettings() const;
std::string service_provider_name() const { return service_provider_name_; }
private:
// Returns true if the settings were initialized correctly. If this returns
- // false, then GetAnalysisSettings will always return base::nullopt.
+ // false, then GetAnalysisSettings will always return absl::nullopt.
bool IsValid() const;
// The service provider matching the name given in a Connector policy. nullptr
diff --git a/chrome/browser/enterprise/remote_commands/clear_browsing_data_job.cc b/chrome/browser/enterprise/remote_commands/clear_browsing_data_job.cc
index b1b2523..9a7488f 100644
--- a/chrome/browser/enterprise/remote_commands/clear_browsing_data_job.cc
+++ b/chrome/browser/enterprise/remote_commands/clear_browsing_data_job.cc
@@ -7,13 +7,13 @@
#include "base/bind.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
-#include "base/optional.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace enterprise_commands {
@@ -57,7 +57,7 @@
bool ClearBrowsingDataJob::ParseCommandPayload(
const std::string& command_payload) {
- base::Optional<base::Value> root(base::JSONReader::Read(command_payload));
+ absl::optional<base::Value> root(base::JSONReader::Read(command_payload));
if (!root)
return false;
diff --git a/chrome/browser/enterprise/reporting/android_app_info_generator_unittest.cc b/chrome/browser/enterprise/reporting/android_app_info_generator_unittest.cc
index 9b29e35..e6a8032 100644
--- a/chrome/browser/enterprise/reporting/android_app_info_generator_unittest.cc
+++ b/chrome/browser/enterprise/reporting/android_app_info_generator_unittest.cc
@@ -52,7 +52,7 @@
return am::ArcPackageInfo::New(
package_name, package_version, 1 /* last_backup_android_id */,
1 /* last_backup_time */, true /* sync */, false /* system */,
- false /* vpn_provider */, nullptr /* web_app_info */, base::nullopt,
+ false /* vpn_provider */, nullptr /* web_app_info */, absl::nullopt,
std::move(permissions) /* permission states */);
}
diff --git a/chrome/browser/enterprise/reporting/browser_report_generator_unittest.cc b/chrome/browser/enterprise/reporting/browser_report_generator_unittest.cc
index 4f95795e..8ebc4ad9 100644
--- a/chrome/browser/enterprise/reporting/browser_report_generator_unittest.cc
+++ b/chrome/browser/enterprise/reporting/browser_report_generator_unittest.cc
@@ -75,7 +75,7 @@
void InitializeUpdate() {
auto* build_state = g_browser_process->GetBuildState();
build_state->SetUpdate(BuildState::UpdateType::kNormalUpdate,
- base::Version("1.2.3.4"), base::nullopt);
+ base::Version("1.2.3.4"), absl::nullopt);
}
void InitializeProfile() {
diff --git a/chrome/browser/enterprise/reporting/extension_request/extension_request_notification.cc b/chrome/browser/enterprise/reporting/extension_request/extension_request_notification.cc
index 1f06ccb..94a7f4d 100644
--- a/chrome/browser/enterprise/reporting/extension_request/extension_request_notification.cc
+++ b/chrome/browser/enterprise/reporting/extension_request/extension_request_notification.cc
@@ -97,8 +97,8 @@
}
void ExtensionRequestNotification::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
for (const std::string& extension_id : extension_ids_) {
NavigateParams params(profile_, GURL(kChromeWebstoreUrl + extension_id),
ui::PAGE_TRANSITION_LINK);
diff --git a/chrome/browser/enterprise/reporting/extension_request/extension_request_notification.h b/chrome/browser/enterprise/reporting/extension_request/extension_request_notification.h
index 948471b2..68b8509 100644
--- a/chrome/browser/enterprise/reporting/extension_request/extension_request_notification.h
+++ b/chrome/browser/enterprise/reporting/extension_request/extension_request_notification.h
@@ -41,8 +41,8 @@
private:
// message_center::NotificationObserver
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
void Close(bool by_user) override;
std::unique_ptr<message_center::Notification> notification_;
diff --git a/chrome/browser/enterprise/reporting/extension_request/extension_request_notification_unittest.cc b/chrome/browser/enterprise/reporting/extension_request/extension_request_notification_unittest.cc
index a90ca2b..b570517 100644
--- a/chrome/browser/enterprise/reporting/extension_request/extension_request_notification_unittest.cc
+++ b/chrome/browser/enterprise/reporting/extension_request/extension_request_notification_unittest.cc
@@ -56,7 +56,7 @@
return GetParam();
}
- base::Optional<message_center::Notification> GetNotification() {
+ absl::optional<message_center::Notification> GetNotification() {
return display_service_tester_->GetNotification(
kNotificationIds[GetNotifyType()]);
}
@@ -92,7 +92,7 @@
request_notification.Show(base::BindOnce(&OnNotificationClosed, true));
show_run_loop.Run();
- base::Optional<message_center::Notification> notification = GetNotification();
+ absl::optional<message_center::Notification> notification = GetNotification();
ASSERT_TRUE(notification.has_value());
EXPECT_THAT(base::UTF16ToUTF8(notification->title()),
@@ -105,7 +105,7 @@
close_run_loop.QuitClosure());
display_service_tester_->SimulateClick(
NotificationHandler::Type::TRANSIENT, kNotificationIds[GetNotifyType()],
- base::Optional<int>(), base::Optional<std::u16string>());
+ absl::optional<int>(), absl::optional<std::u16string>());
close_run_loop.Run();
EXPECT_FALSE(GetNotification().has_value());
@@ -125,7 +125,7 @@
request_notification.Show(base::BindOnce(&OnNotificationClosed, false));
show_run_loop.Run();
- base::Optional<message_center::Notification> notification = GetNotification();
+ absl::optional<message_center::Notification> notification = GetNotification();
ASSERT_TRUE(notification.has_value());
base::RunLoop close_run_loop;
diff --git a/chrome/browser/enterprise/reporting/extension_request/extension_request_observer_unittest.cc b/chrome/browser/enterprise/reporting/extension_request/extension_request_observer_unittest.cc
index 9c322a3..34edbe07 100644
--- a/chrome/browser/enterprise/reporting/extension_request/extension_request_observer_unittest.cc
+++ b/chrome/browser/enterprise/reporting/extension_request/extension_request_observer_unittest.cc
@@ -102,7 +102,7 @@
prefs::kCloudExtensionRequestIds, std::move(id_values));
}
- std::vector<base::Optional<message_center::Notification>>
+ std::vector<absl::optional<message_center::Notification>>
GetAllNotifications() {
return {display_service_tester_->GetNotification(kApprovedNotificationId),
display_service_tester_->GetNotification(kRejectedNotificationId),
@@ -118,7 +118,7 @@
//
void SetExtensionSettings(const std::string& settings_string) {
- base::Optional<base::Value> settings =
+ absl::optional<base::Value> settings =
base::JSONReader::Read(settings_string);
ASSERT_TRUE(settings.has_value());
profile()->GetTestingPrefService()->SetManagedPref(
@@ -142,7 +142,7 @@
close_run_loop.QuitClosure());
display_service_tester_->SimulateClick(
NotificationHandler::Type::TRANSIENT, notification_id,
- base::Optional<int>(), base::Optional<std::u16string>());
+ absl::optional<int>(), absl::optional<std::u16string>());
close_run_loop.Run();
// Verify that only |expected_removed_requests| are removed from the pref.
diff --git a/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator.cc b/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator.cc
index 96ec657..23f26cb2 100644
--- a/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator.cc
+++ b/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator.cc
@@ -41,7 +41,7 @@
report->set_id(extension_id);
if (request_data) {
if (request_data->is_dict()) {
- base::Optional<base::Time> timestamp = ::util::ValueToTime(
+ absl::optional<base::Time> timestamp = ::util::ValueToTime(
request_data->FindKey(extension_misc::kExtensionRequestTimestamp));
if (timestamp)
report->set_request_timestamp_millis(timestamp->ToJavaTime());
diff --git a/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator_unittest.cc b/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator_unittest.cc
index 0347141..81fb668 100644
--- a/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator_unittest.cc
+++ b/chrome/browser/enterprise/reporting/extension_request/extension_request_report_generator_unittest.cc
@@ -62,7 +62,7 @@
void SetExtensionSettings(const std::string& settings_string,
TestingProfile* profile) {
- base::Optional<base::Value> settings =
+ absl::optional<base::Value> settings =
base::JSONReader::Read(settings_string);
ASSERT_TRUE(settings.has_value());
profile->GetTestingPrefService()->SetManagedPref(
diff --git a/chrome/browser/enterprise/reporting/policy_info_unittest.cc b/chrome/browser/enterprise/reporting/policy_info_unittest.cc
index ab2a63e..99184ac 100644
--- a/chrome/browser/enterprise/reporting/policy_info_unittest.cc
+++ b/chrome/browser/enterprise/reporting/policy_info_unittest.cc
@@ -51,7 +51,7 @@
test_profile_name,
std::unique_ptr<sync_preferences::PrefServiceSyncable>(),
base::UTF8ToUTF16(test_profile_name), 0, std::string(),
- TestingProfile::TestingFactories(), base::Optional<bool>(),
+ TestingProfile::TestingFactories(), absl::optional<bool>(),
GetPolicyService());
profile_manager_->CreateTestingProfile(chrome::kInitialProfile);
}
diff --git a/chrome/browser/enterprise/reporting/profile_report_generator_desktop.cc b/chrome/browser/enterprise/reporting/profile_report_generator_desktop.cc
index 4346b1e..a53cd76 100644
--- a/chrome/browser/enterprise/reporting/profile_report_generator_desktop.cc
+++ b/chrome/browser/enterprise/reporting/profile_report_generator_desktop.cc
@@ -100,7 +100,7 @@
auto* request = report->add_extension_requests();
request->set_id(it.first);
- base::Optional<base::Time> timestamp = ::util::ValueToTime(
+ absl::optional<base::Time> timestamp = ::util::ValueToTime(
it.second.FindKey(extension_misc::kExtensionRequestTimestamp));
if (timestamp)
request->set_request_timestamp(timestamp->ToJavaTime());
diff --git a/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc b/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc
index 7ac9ec0..b62074d 100644
--- a/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc
+++ b/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc
@@ -72,7 +72,7 @@
kProfile, {}, kProfile16, 0, {},
IdentityTestEnvironmentProfileAdaptor::
GetIdentityTestEnvironmentFactories(),
- base::nullopt, std::move(policy_service_));
+ absl::nullopt, std::move(policy_service_));
}
void InitMockPolicyService() {
@@ -127,7 +127,7 @@
}
void SetExtensionSettings(const std::string& settings_string) {
- base::Optional<base::Value> settings =
+ absl::optional<base::Value> settings =
base::JSONReader::Read(settings_string);
ASSERT_TRUE(settings.has_value());
profile()->GetTestingPrefService()->SetManagedPref(
diff --git a/chrome/browser/enterprise/reporting/report_request_queue_generator_unittest.cc b/chrome/browser/enterprise/reporting/report_request_queue_generator_unittest.cc
index d9b90aef..5a02d71 100644
--- a/chrome/browser/enterprise/reporting/report_request_queue_generator_unittest.cc
+++ b/chrome/browser/enterprise/reporting/report_request_queue_generator_unittest.cc
@@ -102,7 +102,7 @@
std::unique_ptr<policy::PolicyService> policy_service) {
return profile_manager_.CreateTestingProfile(
profile_name, {}, base::UTF8ToUTF16(profile_name), 0, {},
- TestingProfile::TestingFactories(), base::nullopt,
+ TestingProfile::TestingFactories(), absl::nullopt,
std::move(policy_service));
}
diff --git a/chrome/browser/enterprise/reporting/report_scheduler_desktop_unittest.cc b/chrome/browser/enterprise/reporting/report_scheduler_desktop_unittest.cc
index 0c15820..c39515c 100644
--- a/chrome/browser/enterprise/reporting/report_scheduler_desktop_unittest.cc
+++ b/chrome/browser/enterprise/reporting/report_scheduler_desktop_unittest.cc
@@ -495,7 +495,7 @@
CreateScheduler();
g_browser_process->GetBuildState()->SetUpdate(
BuildState::UpdateType::kNormalUpdate,
- base::Version("1" + version_info::GetVersionNumber()), base::nullopt);
+ base::Version("1" + version_info::GetVersionNumber()), absl::nullopt);
task_environment_.RunUntilIdle();
// The timestamp should not have been updated, since a periodic report was not
@@ -518,7 +518,7 @@
CreateScheduler();
g_browser_process->GetBuildState()->SetUpdate(
BuildState::UpdateType::kNormalUpdate,
- base::Version("1" + version_info::GetVersionNumber()), base::nullopt);
+ base::Version("1" + version_info::GetVersionNumber()), absl::nullopt);
task_environment_.RunUntilIdle();
// The timestamp should not have been updated, since a periodic report was not
@@ -530,7 +530,7 @@
// The report should be stopped in case of persistent error.
g_browser_process->GetBuildState()->SetUpdate(
BuildState::UpdateType::kNormalUpdate,
- base::Version("2" + version_info::GetVersionNumber()), base::nullopt);
+ base::Version("2" + version_info::GetVersionNumber()), absl::nullopt);
histogram_tester_.ExpectUniqueSample(kUploadTriggerMetricName, 2, 1);
}
@@ -554,7 +554,7 @@
g_browser_process->GetBuildState()->SetUpdate(
BuildState::UpdateType::kNormalUpdate,
- base::Version("1" + version_info::GetVersionNumber()), base::nullopt);
+ base::Version("1" + version_info::GetVersionNumber()), absl::nullopt);
task_environment_.RunUntilIdle();
::testing::Mock::VerifyAndClearExpectations(generator_);
::testing::Mock::VerifyAndClearExpectations(uploader_);
@@ -727,7 +727,7 @@
g_browser_process->GetBuildState()->SetUpdate(
BuildState::UpdateType::kNormalUpdate,
- base::Version("1" + version_info::GetVersionNumber()), base::nullopt);
+ base::Version("1" + version_info::GetVersionNumber()), absl::nullopt);
TriggerExtensionRequestReport();
task_environment_.RunUntilIdle();
diff --git a/chrome/browser/enterprise/signals/device_info_fetcher_win.cc b/chrome/browser/enterprise/signals/device_info_fetcher_win.cc
index 4d93e2a..30b3a34 100644
--- a/chrome/browser/enterprise/signals/device_info_fetcher_win.cc
+++ b/chrome/browser/enterprise/signals/device_info_fetcher_win.cc
@@ -67,8 +67,8 @@
// Retrieves the state of the screen locking feature from the screen saver
// settings.
-base::Optional<bool> GetScreenLockStatus() {
- base::Optional<bool> status;
+absl::optional<bool> GetScreenLockStatus() {
+ absl::optional<bool> status;
BOOL value = FALSE;
if (::SystemParametersInfo(SPI_GETSCREENSAVESECURE, 0, &value, 0))
status = static_cast<bool>(value);
@@ -76,8 +76,8 @@
}
// Checks if locking is enabled at the currently active power scheme.
-base::Optional<bool> GetConsoleLockStatus() {
- base::Optional<bool> status;
+absl::optional<bool> GetConsoleLockStatus() {
+ absl::optional<bool> status;
SYSTEM_POWER_STATUS sps;
// https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getsystempowerstatus
// Retrieves the power status of the system. The status indicates whether the
@@ -122,11 +122,11 @@
// Gets cumulative screen locking policy based on the screen saver and console
// lock status.
SettingValue GetScreenlockSecured() {
- const base::Optional<bool> screen_lock_status = GetScreenLockStatus();
+ const absl::optional<bool> screen_lock_status = GetScreenLockStatus();
if (screen_lock_status.value_or(false))
return SettingValue::ENABLED;
- const base::Optional<bool> console_lock_status = GetConsoleLockStatus();
+ const absl::optional<bool> console_lock_status = GetConsoleLockStatus();
if (console_lock_status.value_or(false))
return SettingValue::ENABLED;
@@ -138,8 +138,8 @@
}
// Returns the volume where the Windows OS is installed.
-base::Optional<std::wstring> GetOsVolume() {
- base::Optional<std::wstring> volume;
+absl::optional<std::wstring> GetOsVolume() {
+ absl::optional<std::wstring> volume;
base::FilePath windows_dir;
if (base::PathService::Get(base::DIR_WINDOWS, &windows_dir) &&
windows_dir.IsAbsolute()) {
@@ -194,7 +194,7 @@
SettingValue GetDiskEncrypted() {
// |volume| has to be a |wstring| because SHCreateItemFromParsingName() only
// accepts |PCWSTR| which is |wchar_t*|.
- base::Optional<std::wstring> volume = GetOsVolume();
+ absl::optional<std::wstring> volume = GetOsVolume();
if (!volume.has_value())
return SettingValue::UNKNOWN;
diff --git a/chrome/browser/enterprise/util/android_enterprise_info_unittest.cc b/chrome/browser/enterprise/util/android_enterprise_info_unittest.cc
index 9c721ad..8bee385ba 100644
--- a/chrome/browser/enterprise/util/android_enterprise_info_unittest.cc
+++ b/chrome/browser/enterprise/util/android_enterprise_info_unittest.cc
@@ -5,9 +5,9 @@
#include "chrome/browser/enterprise/util/android_enterprise_info.h"
#include "base/bind.h"
-#include "base/optional.h"
#include "base/test/bind.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class AndroidEnterpriseInfoTest : public ::testing::Test {
protected:
@@ -22,7 +22,7 @@
class EnterpriseInfoCallbackHelper {
public:
- base::Optional<bool> is_profile_owned, is_device_owned;
+ absl::optional<bool> is_profile_owned, is_device_owned;
int num_times_called = 0;
void OnResult(bool profile_owned, bool device_owned) {
diff --git a/chrome/browser/error_reporting/chrome_js_error_report_processor.cc b/chrome/browser/error_reporting/chrome_js_error_report_processor.cc
index 4b67a02..60f68d4d 100644
--- a/chrome/browser/error_reporting/chrome_js_error_report_processor.cc
+++ b/chrome/browser/error_reporting/chrome_js_error_report_processor.cc
@@ -85,16 +85,16 @@
ChromeJsErrorReportProcessor::~ChromeJsErrorReportProcessor() = default;
// Returns the redacted, fixed-up error report if the user consented to have it
-// sent. Returns base::nullopt if the user did not consent or we otherwise
+// sent. Returns absl::nullopt if the user did not consent or we otherwise
// should not send the report. All the MayBlock work should be done in here.
-base::Optional<JavaScriptErrorReport>
+absl::optional<JavaScriptErrorReport>
ChromeJsErrorReportProcessor::CheckConsentAndRedact(
JavaScriptErrorReport error_report) {
// Consent is handled at the OS level by crash_reporter so we don't need to
// check it here for Chrome OS.
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS)
if (!crash_reporter::GetClientCollectStatsConsent()) {
- return base::nullopt;
+ return absl::nullopt;
}
#endif
@@ -149,7 +149,7 @@
scoped_refptr<network::SharedURLLoaderFactory> loader_factory,
base::TimeDelta browser_process_uptime,
base::Time report_time,
- base::Optional<JavaScriptErrorReport> error_report) {
+ absl::optional<JavaScriptErrorReport> error_report) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!error_report) {
// User didn't consent. This isn't an error so don't log an error.
diff --git a/chrome/browser/error_reporting/chrome_js_error_report_processor.h b/chrome/browser/error_reporting/chrome_js_error_report_processor.h
index 3a51df19..006a85d6 100644
--- a/chrome/browser/error_reporting/chrome_js_error_report_processor.h
+++ b/chrome/browser/error_reporting/chrome_js_error_report_processor.h
@@ -15,11 +15,11 @@
#include "base/callback_forward.h"
#include "base/callback_helpers.h"
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "base/time/clock.h"
#include "base/time/time.h"
#include "build/chromeos_buildflags.h"
#include "components/crash/content/browser/error_reporting/js_error_report_processor.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class BrowserContext;
@@ -104,7 +104,7 @@
struct PlatformInfo;
using ParameterMap = std::map<std::string, std::string>;
- base::Optional<JavaScriptErrorReport> CheckConsentAndRedact(
+ absl::optional<JavaScriptErrorReport> CheckConsentAndRedact(
JavaScriptErrorReport error_report);
PlatformInfo GetPlatformInfo();
@@ -120,7 +120,7 @@
scoped_refptr<network::SharedURLLoaderFactory> loader_factory,
base::TimeDelta browser_process_uptime,
base::Time report_time,
- base::Optional<JavaScriptErrorReport> error_report);
+ absl::optional<JavaScriptErrorReport> error_report);
// To avoid spamming the error collection system, do not send duplicate
// error reports more than once per hour. Otherwise, if we get an error
@@ -135,7 +135,7 @@
void SendReport(
ParameterMap params,
- base::Optional<std::string> stack_trace,
+ absl::optional<std::string> stack_trace,
bool send_to_production_servers,
base::ScopedClosureRunner callback_runner,
base::Time report_time,
@@ -153,10 +153,10 @@
// value1:5:abcdevalue2:10:hellothere
static std::string ParamsToCrashReporterString(
const ParameterMap& params,
- const base::Optional<std::string>& stack_trace);
+ const absl::optional<std::string>& stack_trace);
void SendReportViaCrashReporter(ParameterMap params,
- base::Optional<std::string> stack_trace);
+ absl::optional<std::string> stack_trace);
bool force_non_memfd_for_test_ = false;
#else
diff --git a/chrome/browser/error_reporting/chrome_js_error_report_processor_chromeos.cc b/chrome/browser/error_reporting/chrome_js_error_report_processor_chromeos.cc
index dc41a5d..3d1fa39e 100644
--- a/chrome/browser/error_reporting/chrome_js_error_report_processor_chromeos.cc
+++ b/chrome/browser/error_reporting/chrome_js_error_report_processor_chromeos.cc
@@ -91,7 +91,7 @@
std::string ChromeJsErrorReportProcessor::ParamsToCrashReporterString(
const ParameterMap& params,
- const base::Optional<std::string>& stack_trace) {
+ const absl::optional<std::string>& stack_trace) {
std::string result;
for (const auto& param : params) {
std::string key = param.first;
@@ -113,7 +113,7 @@
void ChromeJsErrorReportProcessor::SendReportViaCrashReporter(
ParameterMap params,
- base::Optional<std::string> stack_trace) {
+ absl::optional<std::string> stack_trace) {
base::ScopedClosureRunner cleanup;
base::File output(GetMemfdOrTempFile(cleanup, force_non_memfd_for_test_));
if (!output.IsValid()) {
@@ -171,7 +171,7 @@
void ChromeJsErrorReportProcessor::SendReport(
ParameterMap params,
- base::Optional<std::string> stack_trace,
+ absl::optional<std::string> stack_trace,
bool send_to_production_servers,
base::ScopedClosureRunner callback_runner,
base::Time report_time,
diff --git a/chrome/browser/error_reporting/chrome_js_error_report_processor_nonchromeos.cc b/chrome/browser/error_reporting/chrome_js_error_report_processor_nonchromeos.cc
index 7bfa4012..2271aa8 100644
--- a/chrome/browser/error_reporting/chrome_js_error_report_processor_nonchromeos.cc
+++ b/chrome/browser/error_reporting/chrome_js_error_report_processor_nonchromeos.cc
@@ -100,7 +100,7 @@
// On non-Chrome OS platforms, send the report directly.
void ChromeJsErrorReportProcessor::SendReport(
ParameterMap params,
- base::Optional<std::string> stack_trace,
+ absl::optional<std::string> stack_trace,
bool send_to_production_servers,
base::ScopedClosureRunner callback_runner,
base::Time report_time,
diff --git a/chrome/browser/error_reporting/chrome_js_error_report_processor_unittest.cc b/chrome/browser/error_reporting/chrome_js_error_report_processor_unittest.cc
index 770df6a..2fe4efc 100644
--- a/chrome/browser/error_reporting/chrome_js_error_report_processor_unittest.cc
+++ b/chrome/browser/error_reporting/chrome_js_error_report_processor_unittest.cc
@@ -115,7 +115,7 @@
SendErrorReport(std::move(report));
EXPECT_TRUE(finish_callback_was_called_);
- const base::Optional<MockCrashEndpoint::Report>& actual_report =
+ const absl::optional<MockCrashEndpoint::Report>& actual_report =
endpoint_->last_report();
ASSERT_TRUE(actual_report);
EXPECT_THAT(actual_report->query, HasSubstr("error_message=Hello%20World"));
@@ -169,7 +169,7 @@
SendErrorReport(std::move(report));
EXPECT_TRUE(finish_callback_was_called_);
- const base::Optional<MockCrashEndpoint::Report>& actual_report =
+ const absl::optional<MockCrashEndpoint::Report>& actual_report =
endpoint_->last_report();
ASSERT_TRUE(actual_report);
EXPECT_THAT(actual_report->query, HasSubstr("error_message=Hello%20World"));
@@ -244,7 +244,7 @@
SendErrorReport(std::move(report));
EXPECT_TRUE(finish_callback_was_called_);
- const base::Optional<MockCrashEndpoint::Report>& actual_report =
+ const absl::optional<MockCrashEndpoint::Report>& actual_report =
endpoint_->last_report();
ASSERT_TRUE(actual_report);
EXPECT_THAT(actual_report->query, HasSubstr("error_message=Hello%20World"));
@@ -261,7 +261,7 @@
SendErrorReport(std::move(report));
EXPECT_TRUE(finish_callback_was_called_);
- const base::Optional<MockCrashEndpoint::Report>& actual_report =
+ const absl::optional<MockCrashEndpoint::Report>& actual_report =
endpoint_->last_report();
ASSERT_TRUE(actual_report);
// Escaped version of "<email: 1> says hi to <email: 2>"
diff --git a/chrome/browser/extensions/api/automation/automation_apitest.cc b/chrome/browser/extensions/api/automation/automation_apitest.cc
index b25995d5..ad6dff2 100644
--- a/chrome/browser/extensions/api/automation/automation_apitest.cc
+++ b/chrome/browser/extensions/api/automation/automation_apitest.cc
@@ -590,7 +590,7 @@
wait_for_tracing.Run();
}
- base::Optional<base::Value> trace_data = base::JSONReader::Read(trace_output);
+ absl::optional<base::Value> trace_data = base::JSONReader::Read(trace_output);
ASSERT_TRUE(trace_data);
const base::Value* trace_events = trace_data->FindListKey("traceEvents");
@@ -607,7 +607,7 @@
if (!name)
continue;
- base::Optional<int> dur = event.FindIntKey("dur");
+ absl::optional<int> dur = event.FindIntKey("dur");
if (!dur)
continue;
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
index 37ca7ecb..eeb14b2 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
@@ -715,7 +715,7 @@
.WillOnce(
InvokeCallbackArgument<0>(BluetoothGattService::GATT_ERROR_FAILED,
/*value=*/std::vector<uint8_t>()))
- .WillOnce(InvokeCallbackArgument<0>(base::nullopt, value));
+ .WillOnce(InvokeCallbackArgument<0>(absl::nullopt, value));
ExtensionTestMessageListener listener("ready", true);
listener.set_failure_message("fail");
@@ -999,7 +999,7 @@
.WillOnce(InvokeCallbackArgument<0>(
BluetoothGattService::GATT_ERROR_IN_PROGRESS,
/*value=*/std::vector<uint8_t>()))
- .WillOnce(InvokeCallbackArgument<0>(/*error_code=*/base::nullopt, value));
+ .WillOnce(InvokeCallbackArgument<0>(/*error_code=*/absl::nullopt, value));
ExtensionTestMessageListener listener("ready", true);
listener.set_failure_message("fail");
diff --git a/chrome/browser/extensions/api/cookies/cookies_unittest.cc b/chrome/browser/extensions/api/cookies/cookies_unittest.cc
index a08c4be..467211f 100644
--- a/chrome/browser/extensions/api/cookies/cookies_unittest.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_unittest.cc
@@ -10,7 +10,6 @@
#include <memory>
#include <utility>
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/cookies/cookies_api_constants.h"
@@ -21,6 +20,7 @@
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
using extensions::api::cookies::Cookie;
@@ -195,7 +195,7 @@
std::unique_ptr<net::CanonicalCookie> canonical_cookie(
net::CanonicalCookie::Create(
GURL("http://test.com"), "=011Q255bNX_1!yd\203e+;path=/path\203",
- base::Time::Now(), base::nullopt /* server_time */));
+ base::Time::Now(), absl::nullopt /* server_time */));
ASSERT_NE(nullptr, canonical_cookie.get());
Cookie cookie =
cookies_helpers::CreateCookie(*canonical_cookie, "some cookie store");
diff --git a/chrome/browser/extensions/api/crash_report_private/crash_report_private_apitest.cc b/chrome/browser/extensions/api/crash_report_private/crash_report_private_apitest.cc
index 214ad01..3f9826fb 100644
--- a/chrome/browser/extensions/api/crash_report_private/crash_report_private_apitest.cc
+++ b/chrome/browser/extensions/api/crash_report_private/crash_report_private_apitest.cc
@@ -81,7 +81,7 @@
}
protected:
- const base::Optional<MockCrashEndpoint::Report>& last_report() {
+ const absl::optional<MockCrashEndpoint::Report>& last_report() {
return crash_endpoint_->last_report();
}
const Extension* extension_;
@@ -102,7 +102,7 @@
)";
ExecuteScriptInBackgroundPage(extension_->id(), kTestScript);
- const base::Optional<MockCrashEndpoint::Report>& report = last_report();
+ const absl::optional<MockCrashEndpoint::Report>& report = last_report();
ASSERT_TRUE(report);
EXPECT_THAT(
report->query,
@@ -136,7 +136,7 @@
)-";
ExecuteScriptInBackgroundPage(extension_->id(), kTestScript);
- const base::Optional<MockCrashEndpoint::Report>& report = last_report();
+ const absl::optional<MockCrashEndpoint::Report>& report = last_report();
ASSERT_TRUE(report);
// The product name is escaped twice. The first time, it becomes
// "Chrome%20(Chrome%20OS)" and then the second escapes the '%' into '%25'.
@@ -173,7 +173,7 @@
)";
ExecuteScriptInBackgroundPage(extension_->id(), kTestScript);
- const base::Optional<MockCrashEndpoint::Report>& report = last_report();
+ const absl::optional<MockCrashEndpoint::Report>& report = last_report();
ASSERT_TRUE(report);
EXPECT_THAT(
report->query,
@@ -208,7 +208,7 @@
)";
ExecuteScriptInBackgroundPage(extension_->id(), kTestScript);
- const base::Optional<MockCrashEndpoint::Report>& report = last_report();
+ const absl::optional<MockCrashEndpoint::Report>& report = last_report();
ASSERT_TRUE(report);
EXPECT_THAT(
report->query,
@@ -248,7 +248,7 @@
chrome.runtime.lastError.message : "")
});
)";
- const base::Optional<MockCrashEndpoint::Report>& report = last_report();
+ const absl::optional<MockCrashEndpoint::Report>& report = last_report();
// Ensure error is not reported since devtools is open.
EXPECT_EQ("", ExecuteScriptInBackgroundPage(extension_->id(), kTestScript));
diff --git a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc
index 127a3500..4190dc3 100644
--- a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc
+++ b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc
@@ -201,7 +201,7 @@
// If the origin is blocked, reject attestation.
if (device::fido_filter::Evaluate(
device::fido_filter::Operation::MAKE_CREDENTIAL, origin.Serialize(),
- /*device=*/base::nullopt, /*id=*/base::nullopt) ==
+ /*device=*/absl::nullopt, /*id=*/absl::nullopt) ==
device::fido_filter::Action::NO_ATTESTATION) {
return RespondNow(OneArgument(base::Value(false)));
}
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
index 676bdd6..49c40fc 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc
@@ -439,14 +439,14 @@
ParameterizedShowActionDeclarativeContentApiTest() {}
~ParameterizedShowActionDeclarativeContentApiTest() override {}
- void TestShowAction(base::Optional<ActionInfo::Type> action_type);
+ void TestShowAction(absl::optional<ActionInfo::Type> action_type);
private:
DISALLOW_COPY_AND_ASSIGN(ParameterizedShowActionDeclarativeContentApiTest);
};
void ParameterizedShowActionDeclarativeContentApiTest::TestShowAction(
- base::Optional<ActionInfo::Type> action_type) {
+ absl::optional<ActionInfo::Type> action_type) {
constexpr char kManifestTemplate[] =
R"({
"name": "Declarative Content Show Action",
@@ -526,7 +526,7 @@
IN_PROC_BROWSER_TEST_P(ParameterizedShowActionDeclarativeContentApiTest,
NoActionInManifest) {
- TestShowAction(base::nullopt);
+ TestShowAction(absl::nullopt);
}
IN_PROC_BROWSER_TEST_P(ParameterizedShowActionDeclarativeContentApiTest,
diff --git a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc
index ee426997..bb7c818 100644
--- a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc
+++ b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc
@@ -18,7 +18,6 @@
#include "base/json/json_string_value_serializer.h"
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/rand_util.h"
#include "base/run_loop.h"
@@ -126,6 +125,7 @@
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/features.h"
namespace extensions {
@@ -467,7 +467,7 @@
// and ties are resolved by the tabId (in ascending order.)
// E.g. "<rule_1>,<tab_1>|<rule_2>,<tab_2>|<rule_3>,<tab_3>"
std::string GetRuleAndTabIdsMatched(const ExtensionId& extension_id,
- base::Optional<int> tab_id) {
+ absl::optional<int> tab_id) {
const char kGetMatchedRulesScript[] = R"(
chrome.declarativeNetRequest.getMatchedRules({%s}, (rules) => {
// |ruleAndTabIds| is a list of `${ruleId},${tabId}`
@@ -500,8 +500,8 @@
// error if the call fails.
std::string GetMatchedRuleCount(
const ExtensionId& extension_id,
- base::Optional<int> tab_id,
- base::Optional<base::Time> timestamp,
+ absl::optional<int> tab_id,
+ absl::optional<base::Time> timestamp,
browsertest_util::ScriptUserActivation script_user_activation =
browsertest_util::ScriptUserActivation::kDontActivate) {
const char kGetMatchedRulesScript[] = R"(
@@ -579,8 +579,8 @@
int id,
int priority,
const std::string& url_filter,
- base::Optional<std::vector<TestHeaderInfo>> request_headers,
- base::Optional<std::vector<TestHeaderInfo>> response_headers) {
+ absl::optional<std::vector<TestHeaderInfo>> request_headers,
+ absl::optional<std::vector<TestHeaderInfo>> response_headers) {
TestRule rule = CreateGenericRule();
rule.id = id;
rule.priority = priority;
@@ -1098,11 +1098,11 @@
struct {
std::string url_filter;
size_t id;
- base::Optional<std::string> domain_type;
+ absl::optional<std::string> domain_type;
} rules_data[] = {
{"child_frame.html?case=1", 1, std::string("firstParty")},
{"child_frame.html?case=2", 2, std::string("thirdParty")},
- {"child_frame.html?case=3", 3, base::nullopt},
+ {"child_frame.html?case=3", 3, absl::nullopt},
};
std::vector<TestRule> rules;
@@ -1218,12 +1218,12 @@
int id;
int priority;
std::string action_type;
- base::Optional<std::string> redirect_url;
+ absl::optional<std::string> redirect_url;
} rules_data[] = {
{"google.com", 1, 1, "redirect", static_redirect_url.spec()},
- {"num=1|", 2, 3, "allow", base::nullopt},
+ {"num=1|", 2, 3, "allow", absl::nullopt},
{"1|", 3, 4, "redirect", dynamic_redirect_url.spec()},
- {"num=3|", 4, 2, "allow", base::nullopt},
+ {"num=3|", 4, 2, "allow", absl::nullopt},
};
std::vector<TestRule> rules;
@@ -1501,12 +1501,12 @@
int id;
int priority;
std::string action_type;
- base::Optional<std::string> redirect_url;
+ absl::optional<std::string> redirect_url;
} rules_data[] = {
{"example.com", 1, 1, "redirect", get_url_for_host("yahoo.com")},
{"yahoo.com", 2, 1, "redirect", get_url_for_host("google.com")},
{"abc.com", 3, 1, "redirect", get_url_for_host("def.com")},
- {"def.com", 4, 2, "block", base::nullopt},
+ {"def.com", 4, 2, "block", absl::nullopt},
{"def.com", 5, 1, "redirect", get_url_for_host("xyz.com")},
{"ghi*", 6, 1, "redirect", get_url_for_host("ghijk.com")},
};
@@ -1530,8 +1530,8 @@
struct {
std::string hostname;
bool expected_main_frame_loaded;
- base::Optional<GURL> expected_final_url;
- base::Optional<size_t> expected_redirect_chain_length;
+ absl::optional<GURL> expected_final_url;
+ absl::optional<size_t> expected_redirect_chain_length;
} test_cases[] = {
// example.com -> yahoo.com -> google.com.
{"example.com", true, GURL(get_url_for_host("google.com")), 3},
@@ -1540,9 +1540,9 @@
// abc.com -> def.com (blocked).
// Note def.com won't be redirected since blocking rules are given
// priority over redirect rules.
- {"abc.com", false, base::nullopt, base::nullopt},
+ {"abc.com", false, absl::nullopt, absl::nullopt},
// def.com (blocked).
- {"def.com", false, base::nullopt, base::nullopt},
+ {"def.com", false, absl::nullopt, absl::nullopt},
// ghi.com -> ghijk.com.
// Though ghijk.com still matches the redirect rule for |ghi*|, it will
// not redirect to itself.
@@ -1657,16 +1657,16 @@
int id;
int priority;
std::string action_type;
- base::Optional<std::string> redirect_url;
+ absl::optional<std::string> redirect_url;
} rules_data[] = {
- {"exa*", 1, 4, "upgradeScheme", base::nullopt},
+ {"exa*", 1, 4, "upgradeScheme", absl::nullopt},
{"|http:*yahoo", 2, 100, "redirect", "http://other.com"},
// Since the test server can only display http requests, redirect all
// https requests to google.com in the end.
// TODO(crbug.com/985104): Add a https test server to display https pages
// so this redirect rule can be removed.
{"|https*", 3, 6, "redirect", google_url.spec()},
- {"exact.com", 4, 5, "block", base::nullopt},
+ {"exact.com", 4, 5, "block", absl::nullopt},
};
// Load the extension.
@@ -1703,9 +1703,9 @@
std::string hostname;
const char* scheme;
// |expected_final_url| is null if the request is expected to be blocked.
- base::Optional<GURL> expected_final_url;
+ absl::optional<GURL> expected_final_url;
} test_cases[] = {
- {"exact.com", url::kHttpScheme, base::nullopt},
+ {"exact.com", url::kHttpScheme, absl::nullopt},
// http://example.com -> https://example.com/ -> http://google.com
{"example.com", url::kHttpScheme, google_url},
// test_extension_2 should upgrade the scheme for http://yahoo.com
@@ -2929,16 +2929,16 @@
int id;
int priority;
std::string action_type;
- base::Optional<std::string> redirect_url;
- base::Optional<std::vector<TestHeaderInfo>> request_headers;
+ absl::optional<std::string> redirect_url;
+ absl::optional<std::vector<TestHeaderInfo>> request_headers;
} rules_data[] = {
- {"abc.com", 1, 1, "block", base::nullopt, base::nullopt},
- {"def.com", 2, 1, "redirect", "http://zzz.com", base::nullopt},
- {"jkl.com", 3, 1, "modifyHeaders", base::nullopt,
+ {"abc.com", 1, 1, "block", absl::nullopt, absl::nullopt},
+ {"def.com", 2, 1, "redirect", "http://zzz.com", absl::nullopt},
+ {"jkl.com", 3, 1, "modifyHeaders", absl::nullopt,
std::vector<TestHeaderInfo>(
- {TestHeaderInfo("referer", "remove", base::nullopt)})},
- {"abcd.com", 4, 1, "block", base::nullopt, base::nullopt},
- {"abcd", 5, 1, "allow", base::nullopt, base::nullopt},
+ {TestHeaderInfo("referer", "remove", absl::nullopt)})},
+ {"abcd.com", 4, 1, "block", absl::nullopt, absl::nullopt},
+ {"abcd", 5, 1, "allow", absl::nullopt, absl::nullopt},
};
// Load the extension.
@@ -3229,7 +3229,7 @@
TestRule rule3 = create_redirect_rule(rule_id++, "rule3.com");
rule3.condition->excluded_tab_ids =
std::vector<int>({first_tab_id, second_tab_id, -1});
- rule3.condition->url_filter = base::nullopt;
+ rule3.condition->url_filter = absl::nullopt;
rule3.condition->regex_filter = std::string(kHost);
ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules(
@@ -3577,25 +3577,25 @@
int priority;
std::string action_type;
std::vector<std::string> resource_types;
- base::Optional<std::string> redirect_url;
- base::Optional<std::vector<TestHeaderInfo>> response_headers;
+ absl::optional<std::string> redirect_url;
+ absl::optional<std::vector<TestHeaderInfo>> response_headers;
} rules_data[] = {
{"abc.com", 1, 1, "block", std::vector<std::string>({"script"}),
- base::nullopt, base::nullopt},
+ absl::nullopt, absl::nullopt},
{"||def.com", 2, 1, "redirect", std::vector<std::string>({"main_frame"}),
- get_url_for_host("abc.com").spec(), base::nullopt},
+ get_url_for_host("abc.com").spec(), absl::nullopt},
{"gotodef.com", 3, 1, "redirect",
std::vector<std::string>({"main_frame"}),
- get_url_for_host("def.com").spec(), base::nullopt},
+ get_url_for_host("def.com").spec(), absl::nullopt},
{"ghi.com", 4, 1, "block", std::vector<std::string>({"main_frame"}),
- base::nullopt, base::nullopt},
+ absl::nullopt, absl::nullopt},
{"gotosetcookie.com", 5, 1, "redirect",
std::vector<std::string>({"main_frame"}),
- get_set_cookie_url("setcookie.com").spec(), base::nullopt},
+ get_set_cookie_url("setcookie.com").spec(), absl::nullopt},
{"setcookie.com", 6, 1, "modifyHeaders",
- std::vector<std::string>({"main_frame"}), base::nullopt,
+ std::vector<std::string>({"main_frame"}), absl::nullopt,
std::vector<TestHeaderInfo>(
- {TestHeaderInfo("set-cookie", "remove", base::nullopt)})},
+ {TestHeaderInfo("set-cookie", "remove", absl::nullopt)})},
};
// Load the extension.
@@ -3681,35 +3681,35 @@
// Create an extension with rules and get the ExtensionAction for it.
TestRule example_set_cookie_rule = CreateModifyHeadersRule(
- kMinValidID, kMinValidPriority, "example.com", base::nullopt,
+ kMinValidID, kMinValidPriority, "example.com", absl::nullopt,
std::vector<TestHeaderInfo>(
- {TestHeaderInfo("set-cookie", "remove", base::nullopt)}));
+ {TestHeaderInfo("set-cookie", "remove", absl::nullopt)}));
TestRule both_headers_rule = CreateModifyHeadersRule(
kMinValidID + 1, kMinValidPriority, "google.com",
std::vector<TestHeaderInfo>(
- {TestHeaderInfo("referer", "remove", base::nullopt)}),
+ {TestHeaderInfo("referer", "remove", absl::nullopt)}),
std::vector<TestHeaderInfo>(
- {TestHeaderInfo("set-cookie", "remove", base::nullopt)}));
+ {TestHeaderInfo("set-cookie", "remove", absl::nullopt)}));
TestRule abc_set_cookie_rule = CreateModifyHeadersRule(
- kMinValidID + 2, kMinValidPriority, "abc.com", base::nullopt,
+ kMinValidID + 2, kMinValidPriority, "abc.com", absl::nullopt,
std::vector<TestHeaderInfo>(
- {TestHeaderInfo("set-cookie", "remove", base::nullopt)}));
+ {TestHeaderInfo("set-cookie", "remove", absl::nullopt)}));
TestRule abc_referer_rule = CreateModifyHeadersRule(
kMinValidID + 3, kMinValidPriority, "abc.com",
std::vector<TestHeaderInfo>(
- {TestHeaderInfo("referer", "remove", base::nullopt)}),
- base::nullopt);
+ {TestHeaderInfo("referer", "remove", absl::nullopt)}),
+ absl::nullopt);
TestRule ext1_set_custom_request_header_rule = CreateModifyHeadersRule(
kMinValidID + 4, kMinValidPriority, "def.com",
std::vector<TestHeaderInfo>({TestHeaderInfo("header1", "set", "ext_1")}),
- base::nullopt);
+ absl::nullopt);
TestRule ext1_add_custom_response_header_rule = CreateModifyHeadersRule(
- kMinValidID + 5, kMinValidPriority, "ghi.com", base::nullopt,
+ kMinValidID + 5, kMinValidPriority, "ghi.com", absl::nullopt,
std::vector<TestHeaderInfo>(
{TestHeaderInfo("header2", "append", "ext_1")}));
@@ -3733,16 +3733,16 @@
TestRule example_referer_rule = CreateModifyHeadersRule(
kMinValidID, kMinValidPriority, "example.com",
std::vector<TestHeaderInfo>(
- {TestHeaderInfo("referer", "remove", base::nullopt)}),
- base::nullopt);
+ {TestHeaderInfo("referer", "remove", absl::nullopt)}),
+ absl::nullopt);
TestRule ext2_set_custom_request_header_rule = CreateModifyHeadersRule(
kMinValidID + 4, kMinValidPriority, "def.com",
std::vector<TestHeaderInfo>({TestHeaderInfo("header1", "set", "ext_2")}),
- base::nullopt);
+ absl::nullopt);
TestRule ext2_add_custom_response_header_rule = CreateModifyHeadersRule(
- kMinValidID + 5, kMinValidPriority, "ghi.com", base::nullopt,
+ kMinValidID + 5, kMinValidPriority, "ghi.com", absl::nullopt,
std::vector<TestHeaderInfo>(
{TestHeaderInfo("header2", "append", "ext_2")}));
@@ -3984,13 +3984,13 @@
TestRule abc_referer_rule = CreateModifyHeadersRule(
kMinValidID, kMinValidPriority, sub_frame_host,
std::vector<TestHeaderInfo>(
- {TestHeaderInfo("referer", "remove", base::nullopt)}),
- base::nullopt);
+ {TestHeaderInfo("referer", "remove", absl::nullopt)}),
+ absl::nullopt);
TestRule abc_set_cookie_rule = CreateModifyHeadersRule(
- kMinValidID + 1, kMinValidPriority, sub_frame_host, base::nullopt,
+ kMinValidID + 1, kMinValidPriority, sub_frame_host, absl::nullopt,
std::vector<TestHeaderInfo>(
- {TestHeaderInfo("set-cookie", "remove", base::nullopt)}));
+ {TestHeaderInfo("set-cookie", "remove", absl::nullopt)}));
// Load an extension with removeHeaders rules for the Referer and Set-Cookie
// headers.
@@ -4115,7 +4115,7 @@
struct {
ExtensionId extension_id;
- base::Optional<int> tab_id;
+ absl::optional<int> tab_id;
std::string expected_rule_and_tab_ids;
} test_cases[] = {
// No rules should be matched for |extension_1| and the unknown tab ID.
@@ -4124,7 +4124,7 @@
// No filter is specified for |extension_1|, therefore two MatchedRuleInfo
// should be returned:
// (abc_id, first_tab_id) and (abc_id, second_tab_id)
- {extension_1_id, base::nullopt,
+ {extension_1_id, absl::nullopt,
base::StringPrintf("%d,%d|%d,%d", abc_id, first_tab_id, abc_id,
second_tab_id)},
@@ -4170,7 +4170,7 @@
ASSERT_TRUE(browser()->tab_strip_model()->IsTabSelected(0));
std::string actual_rule_and_tab_ids =
- GetRuleAndTabIdsMatched(extension_1_id, base::nullopt);
+ GetRuleAndTabIdsMatched(extension_1_id, absl::nullopt);
// The matched rule info for the second tab should have its tab ID changed to
// the unknown tab ID after the second tab has been closed.
@@ -4208,7 +4208,7 @@
// Navigate to abc.com.
ui_test_utils::NavigateToURL(browser(), page_url);
std::string actual_rule_and_tab_ids =
- GetRuleAndTabIdsMatched(last_loaded_extension_id(), base::nullopt);
+ GetRuleAndTabIdsMatched(last_loaded_extension_id(), absl::nullopt);
// Since the block rule for abc.com is matched for the main-frame navigation
// request, it should be attributed to the current tab.
@@ -4221,7 +4221,7 @@
// Navigate to abc.com again.
ui_test_utils::NavigateToURL(browser(), page_url);
actual_rule_and_tab_ids =
- GetRuleAndTabIdsMatched(last_loaded_extension_id(), base::nullopt);
+ GetRuleAndTabIdsMatched(last_loaded_extension_id(), absl::nullopt);
// The same block rule is matched for this navigation request, and should be
// attributed to the current tab. Since the main-frame for which the older
@@ -4327,7 +4327,7 @@
// Two rules should be matched on |first_tab_id|.
std::string rule_count = GetMatchedRuleCount(extension_id, first_tab_id,
- base::nullopt /* timestamp */);
+ absl::nullopt /* timestamp */);
EXPECT_EQ("2", rule_count);
// Only one rule should be matched on |first_tab_id| after |timestamp_1|.
@@ -4398,19 +4398,19 @@
// Calling getMatchedRules with no tab ID specified should result in an error
// since the extension does not have the feedback permission.
EXPECT_EQ(declarative_net_request::kErrorGetMatchedRulesMissingPermissions,
- GetMatchedRuleCount(extension_id, base::nullopt /* tab_id */,
- base::nullopt /* timestamp */));
+ GetMatchedRuleCount(extension_id, absl::nullopt /* tab_id */,
+ absl::nullopt /* timestamp */));
// Calling getMatchedRules for a tab without the activeTab permission granted
// should result in an error.
EXPECT_EQ(declarative_net_request::kErrorGetMatchedRulesMissingPermissions,
GetMatchedRuleCount(extension_id, first_tab_id,
- base::nullopt /* timestamp */));
+ absl::nullopt /* timestamp */));
// Calling getMatchedRules for a tab with the activeTab permission granted
// should return the rules matched for that tab.
EXPECT_EQ("1", GetMatchedRuleCount(extension_id, second_tab_id,
- base::nullopt /* timestamp */));
+ absl::nullopt /* timestamp */));
}
// Test that getMatchedRules will not be throttled if the call is associated
@@ -4435,8 +4435,8 @@
user_gesture ? browsertest_util::ScriptUserActivation::kActivate
: browsertest_util::ScriptUserActivation::kDontActivate;
- return GetMatchedRuleCount(extension_id, base::nullopt /* tab_id */,
- base::nullopt /* timestamp */,
+ return GetMatchedRuleCount(extension_id, absl::nullopt /* tab_id */,
+ absl::nullopt /* timestamp */,
user_gesture_setting);
};
@@ -4517,7 +4517,7 @@
&checksum));
EXPECT_TRUE(
prefs->GetDNRDynamicRulesetChecksum(extension_id, &dynamic_checksum_1));
- base::Optional<std::set<RulesetID>> enabled_static_rulesets =
+ absl::optional<std::set<RulesetID>> enabled_static_rulesets =
prefs->GetDNREnabledStaticRulesets(extension_id);
ASSERT_TRUE(enabled_static_rulesets);
EXPECT_THAT(
@@ -4630,8 +4630,8 @@
std::string action_type;
std::string url_filter;
bool is_regex_rule;
- base::Optional<std::vector<std::string>> resource_types;
- base::Optional<std::vector<std::string>> request_methods;
+ absl::optional<std::vector<std::string>> resource_types;
+ absl::optional<std::vector<std::string>> request_methods;
};
DeclarativeNetRequestAllowAllRequestsBrowserTest() = default;
@@ -5128,7 +5128,7 @@
// should not be an empty list. It should either be omitted or be a non-
// empty list.
if (rule_data.resource_types.empty())
- rule.condition->resource_types = base::nullopt;
+ rule.condition->resource_types = absl::nullopt;
else
rule.condition->resource_types = rule_data.resource_types;
@@ -5137,7 +5137,7 @@
rule.id = rule_data.id;
rule.condition->domains = std::vector<std::string>({rule_data.domain});
// Don't specify the urlFilter, which should behaves the same as "*".
- rule.condition->url_filter = base::nullopt;
+ rule.condition->url_filter = absl::nullopt;
rules.push_back(rule);
}
LoadExtensionWithRules(rules);
@@ -5541,7 +5541,7 @@
protected:
void VerifyExtensionAllocationInPrefs(
const ExtensionId& extension_id,
- const base::Optional<size_t>& expected_rules_count) {
+ const absl::optional<size_t>& expected_rules_count) {
size_t actual_rules_count = 0;
const ExtensionPrefs* prefs = ExtensionPrefs::Get(profile());
@@ -5618,7 +5618,7 @@
// the global limit is reached.
VerifyExtensionAllocationInPrefs(first_extension_id, 1);
VerifyExtensionAllocationInPrefs(second_extension_id, 1);
- VerifyExtensionAllocationInPrefs(third_extension->id(), base::nullopt);
+ VerifyExtensionAllocationInPrefs(third_extension->id(), absl::nullopt);
}
IN_PROC_BROWSER_TEST_P(DeclarativeNetRequestGlobalRulesBrowserTest_Packed,
@@ -5785,7 +5785,7 @@
ASSERT_NO_FATAL_FAILURE(
UpdateEnabledRulesets(last_loaded_extension_id(), {"big_ruleset"}, {}));
VerifyPublicRulesetIds(last_loaded_extension(), {});
- VerifyExtensionAllocationInPrefs(last_loaded_extension_id(), base::nullopt);
+ VerifyExtensionAllocationInPrefs(last_loaded_extension_id(), absl::nullopt);
VerifyKeepExcessAllocation(last_loaded_extension_id(), false);
}
@@ -5979,10 +5979,10 @@
// request_headers
std::vector<TestHeaderInfo>(
{TestHeaderInfo(kAddedHeaderName, "set", kAddedHeaderValue)}),
- base::nullopt);
+ absl::nullopt);
// CreateModifyHeadersRule() applies to subframes only by default, so clear
// that.
- custom_response_header_rule.condition->resource_types = base::nullopt;
+ custom_response_header_rule.condition->resource_types = absl::nullopt;
ASSERT_NO_FATAL_FAILURE(
LoadExtensionWithRules({custom_response_header_rule}, "test_extension",
diff --git a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_unittest.cc b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_unittest.cc
index 7de7ae9..d46df6c 100644
--- a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_unittest.cc
@@ -14,7 +14,6 @@
#include "base/json/json_reader.h"
#include "base/location.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -55,6 +54,7 @@
#include "extensions/common/value_builder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
namespace declarative_net_request {
@@ -279,7 +279,7 @@
const Extension& extension,
const std::vector<std::string>& ruleset_ids_to_remove,
const std::vector<std::string>& ruleset_ids_to_add,
- base::Optional<std::string> expected_error) {
+ absl::optional<std::string> expected_error) {
std::unique_ptr<base::Value> ids_to_remove_value =
ToListValue(ruleset_ids_to_remove);
std::unique_ptr<base::Value> ids_to_add_value =
@@ -354,7 +354,7 @@
void CheckExtensionAllocationInPrefs(
const ExtensionId& extension_id,
- base::Optional<size_t> expected_rules_count) {
+ absl::optional<size_t> expected_rules_count) {
size_t actual_rules_count = 0;
bool has_allocated_rules_count =
@@ -444,7 +444,7 @@
// |expected_rules_count| refers to the count of indexed rules. When
// |expected_rules_count| is not set, it is inferred from the added rules.
void LoadAndExpectSuccess(
- const base::Optional<size_t>& expected_rules_count = base::nullopt) {
+ const absl::optional<size_t>& expected_rules_count = absl::nullopt) {
size_t rules_count = 0;
if (expected_rules_count)
rules_count = *expected_rules_count;
@@ -959,7 +959,7 @@
// Disable the sole extension ruleset.
RunUpdateEnabledRulesetsFunction(*extension, {kDefaultRulesetID}, {},
- base::nullopt);
+ absl::nullopt);
// Wait for any pending tasks. This isn't actually necessary for this test
// (there shouldn't be any pending tasks at this point). However still do this
@@ -1153,7 +1153,7 @@
EXPECT_EQ(0u, global_rules_tracker.GetAllocatedGlobalRuleCountForTesting());
// Likewise, no entry should be persisted in prefs.
- CheckExtensionAllocationInPrefs(extension()->id(), base::nullopt);
+ CheckExtensionAllocationInPrefs(extension()->id(), absl::nullopt);
}
// Tests that the rule limit is correctly shared between dynamic and session
@@ -1321,9 +1321,9 @@
// counts of indexed rules. When not set, these are inferred from the added
// rulesets.
void LoadAndExpectSuccess(
- const base::Optional<size_t>& expected_rules_count = base::nullopt,
- const base::Optional<size_t>& expected_enabled_rules_count =
- base::nullopt) {
+ const absl::optional<size_t>& expected_rules_count = absl::nullopt,
+ const absl::optional<size_t>& expected_enabled_rules_count =
+ absl::nullopt) {
size_t static_rule_limit = GetMaximumRulesPerRuleset();
size_t rules_count = 0u;
size_t rules_enabled_count = 0u;
@@ -1586,7 +1586,7 @@
ASSERT_TRUE(base::DeleteFile(static_sources[1].indexed_path()));
RunUpdateEnabledRulesetsFunction(*extension(), {kId1}, {kId2},
- base::nullopt);
+ absl::nullopt);
VerifyPublicRulesetIDs(*extension(), {kId2});
tester.ExpectBucketCount(kReindexHistogram, true /*sample*/, 1 /*count*/);
@@ -1619,23 +1619,23 @@
ruleset_waiter.WaitForExtensionsWithRulesetsCount(1);
RunUpdateEnabledRulesetsFunction(*extension(), {kId1, kId3}, {kId2},
- base::nullopt /* expected_error */);
+ absl::nullopt /* expected_error */);
VerifyPublicRulesetIDs(*extension(), {kId2});
VerifyGetEnabledRulesetsFunction(*extension(), {kId2});
RunUpdateEnabledRulesetsFunction(*extension(), {}, {kId3, kId3},
- base::nullopt /* expected_error */);
+ absl::nullopt /* expected_error */);
VerifyPublicRulesetIDs(*extension(), {kId2, kId3});
VerifyGetEnabledRulesetsFunction(*extension(), {kId2, kId3});
// Ensure no-op calls succeed.
RunUpdateEnabledRulesetsFunction(*extension(), {}, {kId2, kId3},
- base::nullopt /* expected_error */);
+ absl::nullopt /* expected_error */);
VerifyPublicRulesetIDs(*extension(), {kId2, kId3});
VerifyGetEnabledRulesetsFunction(*extension(), {kId2, kId3});
RunUpdateEnabledRulesetsFunction(*extension(), {kId1}, {},
- base::nullopt /* expected_error */);
+ absl::nullopt /* expected_error */);
VerifyPublicRulesetIDs(*extension(), {kId2, kId3});
VerifyGetEnabledRulesetsFunction(*extension(), {kId2, kId3});
@@ -1652,7 +1652,7 @@
// Ensure enabling a ruleset takes priority over disabling.
RunUpdateEnabledRulesetsFunction(*extension(), {kId1}, {kId1},
- base::nullopt /* expected_error */);
+ absl::nullopt /* expected_error */);
VerifyPublicRulesetIDs(*extension(),
{kId1, kId2, kId3, dnr_api::DYNAMIC_RULESET_ID,
dnr_api::SESSION_RULESET_ID});
@@ -1831,7 +1831,7 @@
// Check that the prefs entry (or lack thereof) for extra static rule count is
// correct for each extension.
- CheckExtensionAllocationInPrefs(first_extension.get()->id(), base::nullopt);
+ CheckExtensionAllocationInPrefs(first_extension.get()->id(), absl::nullopt);
CheckExtensionAllocationInPrefs(second_extension.get()->id(), 101);
CheckExtensionAllocationInPrefs(third_extension.get()->id(), 50);
}
@@ -1875,7 +1875,7 @@
// Only |kId2| should be enabled as |kId3| causes the global rule limit to be
// exceeded.
VerifyPublicRulesetIDs(*second_extension.get(), {kId2});
- CheckExtensionAllocationInPrefs(second_extension_id, base::nullopt);
+ CheckExtensionAllocationInPrefs(second_extension_id, absl::nullopt);
// Since the ID of the second extension is known only after it was installed,
// disable then enable the extension so the ID can be used for the
@@ -1904,8 +1904,8 @@
service()->DisableExtension(second_extension_id,
disable_reason::DISABLE_USER_ACTION);
ruleset_waiter.WaitForExtensionsWithRulesetsCount(0);
- CheckExtensionAllocationInPrefs(first_extension_id, base::nullopt);
- CheckExtensionAllocationInPrefs(second_extension_id, base::nullopt);
+ CheckExtensionAllocationInPrefs(first_extension_id, absl::nullopt);
+ CheckExtensionAllocationInPrefs(second_extension_id, absl::nullopt);
service()->EnableExtension(second_extension_id);
ruleset_waiter.WaitForExtensionsWithRulesetsCount(1);
@@ -1939,7 +1939,7 @@
// Disable |kId2|.
RunUpdateEnabledRulesetsFunction(*extension(), {kId2}, {},
- base::nullopt /* expected_error */);
+ absl::nullopt /* expected_error */);
VerifyPublicRulesetIDs(*extension(), {kId3});
VerifyGetEnabledRulesetsFunction(*extension(), {kId3});
@@ -1954,7 +1954,7 @@
// Enable |kId1|.
RunUpdateEnabledRulesetsFunction(*extension(), {}, {kId1},
- base::nullopt /* expected_error */);
+ absl::nullopt /* expected_error */);
VerifyPublicRulesetIDs(*extension(), {kId1, kId3});
VerifyGetEnabledRulesetsFunction(*extension(), {kId1, kId3});
@@ -1964,14 +1964,14 @@
// Disable |kId3|.
RunUpdateEnabledRulesetsFunction(*extension(), {kId3}, {},
- base::nullopt /* expected_error */);
+ absl::nullopt /* expected_error */);
VerifyPublicRulesetIDs(*extension(), {kId1});
VerifyGetEnabledRulesetsFunction(*extension(), {kId1});
// After |kId3| is disabled, no rules should contribute to the global pool and
// there should not be an entry for the extension in prefs.
EXPECT_EQ(0u, global_rules_tracker.GetAllocatedGlobalRuleCountForTesting());
- CheckExtensionAllocationInPrefs(extension()->id(), base::nullopt);
+ CheckExtensionAllocationInPrefs(extension()->id(), absl::nullopt);
}
TEST_P(MultipleRulesetsTest, UpdateAndGetEnabledRulesets_RuleCountExceeded) {
@@ -1994,7 +1994,7 @@
// Disable |kId2| and enable |kId3|.
RunUpdateEnabledRulesetsFunction(*extension(), {kId2}, {kId3},
- base::nullopt /* expected_error */);
+ absl::nullopt /* expected_error */);
// updateEnabledRulesets looks at the rule counts at the end of the update, so
// disabling |kId2| and enabling |kId3| works (because the total rule count is
@@ -2030,22 +2030,22 @@
// Initially, the extension should have 250 more static rules available, and
// no rules allocated from the global pool.
VerifyPublicRulesetIDs(*first_extension.get(), {kId1});
- CheckExtensionAllocationInPrefs(first_extension_id, base::nullopt);
+ CheckExtensionAllocationInPrefs(first_extension_id, absl::nullopt);
VerifyGetAvailableStaticRuleCountFunction(*first_extension.get(), 250);
// Enabling |kId2| should result in 50 rules allocated in the global pool, and
// 150 more rules available for the extension to enable.
RunUpdateEnabledRulesetsFunction(*first_extension.get(), {}, {kId2},
- base::nullopt /* expected_error */);
+ absl::nullopt /* expected_error */);
VerifyPublicRulesetIDs(*first_extension.get(), {kId1, kId2});
CheckExtensionAllocationInPrefs(first_extension_id, 50);
VerifyGetAvailableStaticRuleCountFunction(*first_extension.get(), 150);
// Disabling all rulesets should result in 300 rules available.
RunUpdateEnabledRulesetsFunction(*first_extension.get(), {kId1, kId2}, {},
- base::nullopt /* expected_error */);
+ absl::nullopt /* expected_error */);
VerifyPublicRulesetIDs(*first_extension.get(), {});
- CheckExtensionAllocationInPrefs(first_extension_id, base::nullopt);
+ CheckExtensionAllocationInPrefs(first_extension_id, absl::nullopt);
VerifyGetAvailableStaticRuleCountFunction(*first_extension.get(), 300);
// Load another extension with one ruleset with 300 rules.
@@ -2110,10 +2110,10 @@
size_t expected_tracker_allocation =
expect_allocation_released ? 0 : ext_1_allocation;
- base::Optional<size_t> expected_pref_allocation =
+ absl::optional<size_t> expected_pref_allocation =
expect_allocation_released
- ? base::nullopt
- : base::make_optional<size_t>(ext_1_allocation);
+ ? absl::nullopt
+ : absl::make_optional<size_t>(ext_1_allocation);
EXPECT_EQ(expected_tracker_allocation,
global_rules_tracker.GetAllocatedGlobalRuleCountForTesting());
CheckExtensionAllocationInPrefs(first_extension_id,
@@ -2153,7 +2153,7 @@
service()->BlocklistExtensionForTest(first_extension_id);
ruleset_waiter.WaitForExtensionsWithRulesetsCount(0);
EXPECT_EQ(0u, global_rules_tracker.GetAllocatedGlobalRuleCountForTesting());
- CheckExtensionAllocationInPrefs(first_extension_id, base::nullopt);
+ CheckExtensionAllocationInPrefs(first_extension_id, absl::nullopt);
// Load another extension, only to have it be terminated.
const size_t ext_2_allocation = 50;
diff --git a/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc b/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc
index a48eec2c..92bef0e6 100644
--- a/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_net_request/ruleset_manager_unittest.cc
@@ -6,7 +6,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/string_piece.h"
#include "base/strings/stringprintf.h"
@@ -34,6 +33,7 @@
#include "net/http/http_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -115,7 +115,7 @@
// Returns renderer-initiated request params for the given |url|.
WebRequestInfoInitParams GetRequestParamsForURL(
base::StringPiece url,
- base::Optional<url::Origin> initiator = base::nullopt) {
+ absl::optional<url::Origin> initiator = absl::nullopt) {
const int kRendererId = 1;
WebRequestInfoInitParams info;
info.url = GURL(url);
@@ -356,7 +356,7 @@
RequestActionType::REDIRECT, *rule.id, *rule.priority,
kMinValidStaticRulesetID, last_loaded_extension()->id());
expected_redirect_action.redirect_url = GURL("http://google.com");
- WebRequestInfo request_1(GetRequestParamsForURL(kExampleURL, base::nullopt));
+ WebRequestInfo request_1(GetRequestParamsForURL(kExampleURL, absl::nullopt));
manager()->EvaluateRequest(request_1, is_incognito_context);
ASSERT_EQ(1u, request_1.dnr_actions->size());
EXPECT_EQ(expected_redirect_action, (*request_1.dnr_actions)[0]);
@@ -378,7 +378,7 @@
// Ensure web-socket requests are not redirected.
WebRequestInfo request_4(
- GetRequestParamsForURL("ws://example.com", base::nullopt));
+ GetRequestParamsForURL("ws://example.com", absl::nullopt));
manager()->EvaluateRequest(request_4, is_incognito_context);
EXPECT_TRUE(request_4.dnr_actions->empty());
}
@@ -469,7 +469,7 @@
rule.condition->url_filter = std::string("*");
rule.action->type = std::string("modifyHeaders");
rule.action->request_headers = std::vector<TestHeaderInfo>(
- {TestHeaderInfo("header1", "remove", base::nullopt),
+ {TestHeaderInfo("header1", "remove", absl::nullopt),
TestHeaderInfo("header2", "set", "value2")});
ASSERT_NO_FATAL_FAILURE(CreateMatcherForRules(
@@ -485,7 +485,7 @@
rule.condition->url_filter = std::string("*");
rule.action->type = std::string("modifyHeaders");
rule.action->request_headers = std::vector<TestHeaderInfo>(
- {TestHeaderInfo("header1", "remove", base::nullopt)});
+ {TestHeaderInfo("header1", "remove", absl::nullopt)});
rule.action->response_headers = std::vector<TestHeaderInfo>(
{TestHeaderInfo("header3", "append", "value3")});
@@ -507,7 +507,7 @@
RequestActionType::MODIFY_HEADERS, kMinValidID, kDefaultPriority,
kMinValidStaticRulesetID, extension_2->id());
expected_action_1.request_headers_to_modify = {RequestAction::HeaderInfo(
- "header1", dnr_api::HEADER_OPERATION_REMOVE, base::nullopt)};
+ "header1", dnr_api::HEADER_OPERATION_REMOVE, absl::nullopt)};
expected_action_1.response_headers_to_modify = {RequestAction::HeaderInfo(
"header3", dnr_api::HEADER_OPERATION_APPEND, "value3")};
@@ -517,7 +517,7 @@
kMinValidStaticRulesetID, extension_1->id());
expected_action_2.request_headers_to_modify = {
RequestAction::HeaderInfo("header1", dnr_api::HEADER_OPERATION_REMOVE,
- base::nullopt),
+ absl::nullopt),
RequestAction::HeaderInfo("header2", dnr_api::HEADER_OPERATION_SET,
"value2")};
@@ -539,7 +539,7 @@
rule.condition->url_filter = std::string("*");
rule.action->type = std::string("modifyHeaders");
rule.action->request_headers = std::vector<TestHeaderInfo>(
- {TestHeaderInfo("header1", "remove", base::nullopt)});
+ {TestHeaderInfo("header1", "remove", absl::nullopt)});
ASSERT_NO_FATAL_FAILURE(CreateMatcherForRules(
{rule}, "test extension", &matcher, {"*://example.com/*"}));
@@ -557,7 +557,7 @@
RequestActionType::MODIFY_HEADERS, kMinValidID, kDefaultPriority,
kMinValidStaticRulesetID, extension->id());
expected_action.request_headers_to_modify = {RequestAction::HeaderInfo(
- "header1", dnr_api::HEADER_OPERATION_REMOVE, base::nullopt)};
+ "header1", dnr_api::HEADER_OPERATION_REMOVE, absl::nullopt)};
EXPECT_THAT(actual_actions, ::testing::ElementsAre(::testing::Eq(
::testing::ByRef(expected_action))));
@@ -619,12 +619,12 @@
struct TestCase {
std::string url;
- base::Optional<url::Origin> initiator;
+ absl::optional<url::Origin> initiator;
bool expected_action_redirect_extension;
bool expected_action_blocking_extension;
} cases[] = {
// Empty initiator. Has access.
- {"https://example.com", base::nullopt, true, true},
+ {"https://example.com", absl::nullopt, true, true},
// Opaque origin as initiator. Has access.
{"https://example.com", url::Origin(), true, true},
// yahoo.com as initiator. Has access.
@@ -640,7 +640,7 @@
};
auto verify_test_case = [this](const std::string& url,
- const base::Optional<url::Origin>& initiator,
+ const absl::optional<url::Origin>& initiator,
RequestAction* expected_action) {
SCOPED_TRACE(base::StringPrintf(
"Url-%s initiator-%s", url.c_str(),
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index b9c4c68e..87ac6ad 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -238,7 +238,7 @@
return response;
}
-base::Optional<URLPattern> ParseRuntimePermissionsPattern(
+absl::optional<URLPattern> ParseRuntimePermissionsPattern(
const std::string& pattern_str) {
constexpr int kValidRuntimePermissionSchemes = URLPattern::SCHEME_HTTP |
URLPattern::SCHEME_HTTPS |
@@ -246,13 +246,13 @@
URLPattern pattern(kValidRuntimePermissionSchemes);
if (pattern.Parse(pattern_str) != URLPattern::ParseResult::kSuccess)
- return base::nullopt;
+ return absl::nullopt;
// We don't allow adding paths for permissions, because they aren't meaningful
// in terms of origin access. The frontend should validate this, but there's
// a chance something can slip through, so we should fail gracefully.
if (pattern.path() != "/*")
- return base::nullopt;
+ return absl::nullopt;
return pattern;
}
@@ -2017,7 +2017,7 @@
developer::AddHostPermission::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- base::Optional<URLPattern> pattern =
+ absl::optional<URLPattern> pattern =
ParseRuntimePermissionsPattern(params->host);
if (!pattern)
return RespondNow(Error(kInvalidHost));
@@ -2060,7 +2060,7 @@
developer::RemoveHostPermission::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- base::Optional<URLPattern> pattern =
+ absl::optional<URLPattern> pattern =
ParseRuntimePermissionsPattern(params->host);
if (!pattern)
return RespondNow(Error(kInvalidHost));
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_ash.cc b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_ash.cc
index 37cbed8c..2feb8563 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_ash.cc
+++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_ash.cc
@@ -7,7 +7,6 @@
#include <utility>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/chromeos/platform_keys/extension_platform_keys_service.h"
#include "chrome/browser/chromeos/platform_keys/extension_platform_keys_service_factory.h"
@@ -22,6 +21,7 @@
#include "content/public/browser/browser_thread.h"
#include "net/cert/x509_certificate.h"
#include "net/cert/x509_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
@@ -56,7 +56,7 @@
api_epki::GenerateKey::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- base::Optional<chromeos::platform_keys::TokenId> platform_keys_token_id =
+ absl::optional<chromeos::platform_keys::TokenId> platform_keys_token_id =
platform_keys::ApiIdToPlatformKeysTokenId(params->token_id);
if (!platform_keys_token_id)
return RespondNow(Error(platform_keys::kErrorInvalidToken));
@@ -93,7 +93,7 @@
void EnterprisePlatformKeysInternalGenerateKeyFunction::OnGeneratedKey(
const std::string& public_key_der,
- base::Optional<crosapi::mojom::KeystoreError> error) {
+ absl::optional<crosapi::mojom::KeystoreError> error) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!error) {
Respond(ArgumentList(api_epki::GenerateKey::Results::Create(
@@ -112,7 +112,7 @@
std::unique_ptr<api_epk::GetCertificates::Params> params(
api_epk::GetCertificates::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- base::Optional<chromeos::platform_keys::TokenId> platform_keys_token_id =
+ absl::optional<chromeos::platform_keys::TokenId> platform_keys_token_id =
platform_keys::ApiIdToPlatformKeysTokenId(params->token_id);
if (!platform_keys_token_id)
return RespondNow(Error(platform_keys::kErrorInvalidToken));
@@ -159,7 +159,7 @@
std::unique_ptr<api_epk::ImportCertificate::Params> params(
api_epk::ImportCertificate::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- base::Optional<chromeos::platform_keys::TokenId> platform_keys_token_id =
+ absl::optional<chromeos::platform_keys::TokenId> platform_keys_token_id =
platform_keys::ApiIdToPlatformKeysTokenId(params->token_id);
if (!platform_keys_token_id)
return RespondNow(Error(platform_keys::kErrorInvalidToken));
@@ -206,7 +206,7 @@
std::unique_ptr<api_epk::RemoveCertificate::Params> params(
api_epk::RemoveCertificate::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- base::Optional<chromeos::platform_keys::TokenId> platform_keys_token_id =
+ absl::optional<chromeos::platform_keys::TokenId> platform_keys_token_id =
platform_keys::ApiIdToPlatformKeysTokenId(params->token_id);
if (!platform_keys_token_id)
return RespondNow(Error(platform_keys::kErrorInvalidToken));
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_ash.h b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_ash.h
index 93086ad1..38df60b 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_ash.h
+++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_ash.h
@@ -31,7 +31,7 @@
// Called when the key was generated. If an error occurred, |public_key_der|
// will be empty.
void OnGeneratedKey(const std::string& public_key_der,
- base::Optional<crosapi::mojom::KeystoreError> error);
+ absl::optional<crosapi::mojom::KeystoreError> error);
DECLARE_EXTENSION_FUNCTION("enterprise.platformKeysInternal.generateKey",
ENTERPRISE_PLATFORMKEYSINTERNAL_GENERATEKEY)
diff --git a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_lacros.cc b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_lacros.cc
index 08f89fe..7315629 100644
--- a/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_lacros.cc
+++ b/chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api_lacros.cc
@@ -11,13 +11,13 @@
#include "base/bind.h"
#include "base/numerics/safe_conversions.h"
-#include "base/optional.h"
#include "chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h"
#include "chrome/browser/extensions/api/platform_keys/platform_keys_api.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/enterprise_platform_keys.h"
#include "chrome/common/extensions/api/enterprise_platform_keys_internal.h"
#include "chromeos/lacros/lacros_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
@@ -35,13 +35,13 @@
return std::string(v.begin(), v.end());
}
-base::Optional<crosapi::mojom::KeystoreType> KeystoreTypeFromString(
+absl::optional<crosapi::mojom::KeystoreType> KeystoreTypeFromString(
const std::string& input) {
if (input == "user")
return crosapi::mojom::KeystoreType::kUser;
if (input == "system")
return crosapi::mojom::KeystoreType::kDevice;
- return base::nullopt;
+ return absl::nullopt;
}
const char kLacrosNotImplementedError[] = "Not implemented.";
@@ -81,7 +81,7 @@
// extension termination.
std::string ValidateInput(const std::string& token_id,
crosapi::mojom::KeystoreType* keystore) {
- base::Optional<crosapi::mojom::KeystoreType> keystore_type =
+ absl::optional<crosapi::mojom::KeystoreType> keystore_type =
KeystoreTypeFromString(token_id);
if (!keystore_type)
return kInvalidKeystoreType;
diff --git a/chrome/browser/extensions/api/file_handlers/non_native_file_system_delegate_chromeos.cc b/chrome/browser/extensions/api/file_handlers/non_native_file_system_delegate_chromeos.cc
index f0897056..1470e26 100644
--- a/chrome/browser/extensions/api/file_handlers/non_native_file_system_delegate_chromeos.cc
+++ b/chrome/browser/extensions/api/file_handlers/non_native_file_system_delegate_chromeos.cc
@@ -34,7 +34,7 @@
void NonNativeFileSystemDelegateChromeOS::GetNonNativeLocalPathMimeType(
content::BrowserContext* context,
const base::FilePath& path,
- base::OnceCallback<void(const base::Optional<std::string>&)> callback) {
+ base::OnceCallback<void(const absl::optional<std::string>&)> callback) {
return file_manager::util::GetNonNativeLocalPathMimeType(
Profile::FromBrowserContext(context), path, std::move(callback));
}
diff --git a/chrome/browser/extensions/api/file_handlers/non_native_file_system_delegate_chromeos.h b/chrome/browser/extensions/api/file_handlers/non_native_file_system_delegate_chromeos.h
index abcde24..f7fadf80 100644
--- a/chrome/browser/extensions/api/file_handlers/non_native_file_system_delegate_chromeos.h
+++ b/chrome/browser/extensions/api/file_handlers/non_native_file_system_delegate_chromeos.h
@@ -9,8 +9,8 @@
#include "base/callback.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "extensions/browser/api/file_handlers/non_native_file_system_delegate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class BrowserContext;
@@ -32,7 +32,7 @@
void GetNonNativeLocalPathMimeType(
content::BrowserContext* context,
const base::FilePath& path,
- base::OnceCallback<void(const base::Optional<std::string>&)> callback)
+ base::OnceCallback<void(const absl::optional<std::string>&)> callback)
override;
void IsNonNativeLocalPathDirectory(
content::BrowserContext* context,
diff --git a/chrome/browser/extensions/api/font_settings/font_settings_api.cc b/chrome/browser/extensions/api/font_settings/font_settings_api.cc
index 1c444caa..4a2d6ca 100644
--- a/chrome/browser/extensions/api/font_settings/font_settings_api.cc
+++ b/chrome/browser/extensions/api/font_settings/font_settings_api.cc
@@ -83,7 +83,7 @@
#if defined(OS_WIN)
// Try to get the 'us-en' font name. If it is failing, use the first name
// available.
- base::Optional<std::string> localized_font_name =
+ absl::optional<std::string> localized_font_name =
gfx::win::RetrieveLocalizedFontName(*font_name, "us-en");
if (!localized_font_name)
localized_font_name = gfx::win::RetrieveLocalizedFontName(*font_name, "");
diff --git a/chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.cc b/chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.cc
index 93e23af..f46baef 100644
--- a/chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.cc
+++ b/chrome/browser/extensions/api/force_installed_affiliated_extension_apitest.cc
@@ -6,7 +6,6 @@
#include "base/files/file_path.h"
#include "base/json/json_writer.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/policy/affiliation_test_helper.h"
@@ -19,6 +18,7 @@
#include "components/prefs/pref_service.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/test/result_catcher.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc
index 65915dc5..6f0be3ee 100644
--- a/chrome/browser/extensions/api/identity/identity_api.cc
+++ b/chrome/browser/extensions/api/identity/identity_api.cc
@@ -65,12 +65,12 @@
std::make_unique<base::Value>(gaia_id));
}
-base::Optional<std::string> IdentityAPI::GetGaiaIdForExtension(
+absl::optional<std::string> IdentityAPI::GetGaiaIdForExtension(
const std::string& extension_id) {
std::string gaia_id;
if (!extension_prefs_->ReadPrefAsString(extension_id, kIdentityGaiaIdPref,
&gaia_id)) {
- return base::nullopt;
+ return absl::nullopt;
}
return gaia_id;
}
@@ -90,7 +90,7 @@
extensions::ExtensionIdList extensions;
extension_prefs_->GetExtensions(&extensions);
for (const ExtensionId& extension_id : extensions) {
- base::Optional<std::string> gaia_id = GetGaiaIdForExtension(extension_id);
+ absl::optional<std::string> gaia_id = GetGaiaIdForExtension(extension_id);
if (!gaia_id)
continue;
auto account_it = std::find_if(accounts.begin(), accounts.end(),
diff --git a/chrome/browser/extensions/api/identity/identity_api.h b/chrome/browser/extensions/api/identity/identity_api.h
index 4144925..902c5cf 100644
--- a/chrome/browser/extensions/api/identity/identity_api.h
+++ b/chrome/browser/extensions/api/identity/identity_api.h
@@ -14,7 +14,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "chrome/browser/extensions/api/identity/identity_clear_all_cached_auth_tokens_function.h"
@@ -30,6 +29,7 @@
#include "components/signin/public/identity_manager/identity_manager.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/event_router.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class BrowserContext;
@@ -56,9 +56,9 @@
// GAIA id cache.
void SetGaiaIdForExtension(const std::string& extension_id,
const std::string& gaia_id);
- // Returns |base::nullopt| if no GAIA id is saved for |extension_id|.
+ // Returns |absl::nullopt| if no GAIA id is saved for |extension_id|.
// Otherwise, returns GAIA id previously saved via SetGaiaIdForExtension().
- base::Optional<std::string> GetGaiaIdForExtension(
+ absl::optional<std::string> GetGaiaIdForExtension(
const std::string& extension_id);
void EraseGaiaIdForExtension(const std::string& extension_id);
// If refresh tokens have been loaded, erases GAIA ids of accounts that are no
diff --git a/chrome/browser/extensions/api/identity/identity_api_unittest.cc b/chrome/browser/extensions/api/identity/identity_api_unittest.cc
index 323dab6..ff297fb 100644
--- a/chrome/browser/extensions/api/identity/identity_api_unittest.cc
+++ b/chrome/browser/extensions/api/identity/identity_api_unittest.cc
@@ -6,7 +6,6 @@
#include <memory>
-#include "base/optional.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/extensions/test_extension_prefs.h"
#include "chrome/test/base/testing_profile.h"
@@ -15,6 +14,7 @@
#include "content/public/test/browser_task_environment.h"
#include "google_apis/gaia/core_account_id.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
@@ -71,7 +71,7 @@
std::string another_extension_id =
prefs()->AddExtensionAndReturnId("another_extension");
- EXPECT_EQ(api()->GetGaiaIdForExtension(another_extension_id), base::nullopt);
+ EXPECT_EQ(api()->GetGaiaIdForExtension(another_extension_id), absl::nullopt);
}
TEST_F(IdentityAPITest, GetGaiaIdForExtension_SurvivesShutdown) {
@@ -94,7 +94,7 @@
EXPECT_EQ(api()->GetGaiaIdForExtension(extension_id), account.gaia);
api()->EraseGaiaIdForExtension(extension_id);
- EXPECT_EQ(api()->GetGaiaIdForExtension(extension_id), base::nullopt);
+ EXPECT_EQ(api()->GetGaiaIdForExtension(extension_id), absl::nullopt);
}
TEST_F(IdentityAPITest, GaiaIdErasedAfterSignOut) {
@@ -105,7 +105,7 @@
EXPECT_EQ(api()->GetGaiaIdForExtension(extension_id), account.gaia);
identity_env()->RemoveRefreshTokenForAccount(account.account_id);
- EXPECT_EQ(api()->GetGaiaIdForExtension(extension_id), base::nullopt);
+ EXPECT_EQ(api()->GetGaiaIdForExtension(extension_id), absl::nullopt);
}
TEST_F(IdentityAPITest, GaiaIdErasedAfterSignOut_TwoAccounts) {
@@ -122,7 +122,7 @@
EXPECT_EQ(api()->GetGaiaIdForExtension(extension2_id), account2.gaia);
identity_env()->RemoveRefreshTokenForAccount(account1.account_id);
- EXPECT_EQ(api()->GetGaiaIdForExtension(extension1_id), base::nullopt);
+ EXPECT_EQ(api()->GetGaiaIdForExtension(extension1_id), absl::nullopt);
EXPECT_EQ(api()->GetGaiaIdForExtension(extension2_id), account2.gaia);
}
@@ -138,7 +138,7 @@
identity_env()->RemoveRefreshTokenForAccount(account.account_id);
ResetIdentityAPI(CreateIdentityAPI());
- EXPECT_EQ(api()->GetGaiaIdForExtension(extension_id), base::nullopt);
+ EXPECT_EQ(api()->GetGaiaIdForExtension(extension_id), absl::nullopt);
}
} // namespace extensions
diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc
index f7bdce37..a4b046d 100644
--- a/chrome/browser/extensions/api/identity/identity_apitest.cc
+++ b/chrome/browser/extensions/api/identity/identity_apitest.cc
@@ -398,10 +398,10 @@
void StartTokenKeyAccountAccessTokenRequest() override {
if (auto_login_access_token_) {
- base::Optional<std::string> access_token("access_token");
+ absl::optional<std::string> access_token("access_token");
GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone();
if (!login_access_token_result_) {
- access_token = base::nullopt;
+ access_token = absl::nullopt;
error = GoogleServiceAuthError(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
}
@@ -949,7 +949,7 @@
return GetCachedToken(account_info, oauth_scopes_);
}
- base::Optional<std::string> GetCachedGaiaId() {
+ absl::optional<std::string> GetCachedGaiaId() {
return id_api()->GetGaiaIdForExtension(extension_id_);
}
@@ -3045,7 +3045,7 @@
void RunNewFunctionAndExpectSelectedUserId(
const scoped_refptr<const extensions::Extension>& extension,
const std::string& expected_selected_user_id,
- const base::Optional<std::string> requested_account = base::nullopt) {
+ const absl::optional<std::string> requested_account = absl::nullopt) {
auto func = base::MakeRefCounted<FakeGetAuthTokenFunction>();
func->set_extension(extension);
RunFunctionAndExpectSelectedUserId(func, expected_selected_user_id,
@@ -3055,7 +3055,7 @@
void RunFunctionAndExpectSelectedUserId(
const scoped_refptr<FakeGetAuthTokenFunction>& func,
const std::string& expected_selected_user_id,
- const base::Optional<std::string> requested_account = base::nullopt) {
+ const absl::optional<std::string> requested_account = absl::nullopt) {
// Stops the function right before selected_user_id would be used.
MockQueuedMintRequest queued_request;
IdentityMintRequestQueue::MintType type =
diff --git a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc
index 1adcac1..2d89213 100644
--- a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc
+++ b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.cc
@@ -730,7 +730,7 @@
DCHECK(!consent_result.empty());
remote_consent_approved_ = true;
- base::Optional<AccountInfo> account =
+ absl::optional<AccountInfo> account =
IdentityManagerFactory::GetForProfile(GetProfile())
->FindExtendedAccountInfoForAccountWithRefreshTokenByGaiaId(gaia_id);
if (!account) {
@@ -770,7 +770,7 @@
}
void IdentityGetAuthTokenFunction::OnGetAccessTokenComplete(
- const base::Optional<std::string>& access_token,
+ const absl::optional<std::string>& access_token,
base::Time expiration_time,
const GoogleServiceAuthError& error) {
// By the time we get here we should no longer have an outstanding access
@@ -811,7 +811,7 @@
const OAuth2AccessTokenManager::Request* request,
const GoogleServiceAuthError& error) {
device_access_token_request_.reset();
- OnGetAccessTokenComplete(base::nullopt, base::Time(), error);
+ OnGetAccessTokenComplete(absl::nullopt, base::Time(), error);
}
#endif
@@ -824,7 +824,7 @@
access_token_info.expiration_time,
GoogleServiceAuthError::AuthErrorNone());
} else {
- OnGetAccessTokenComplete(base::nullopt, base::Time(), error);
+ OnGetAccessTokenComplete(absl::nullopt, base::Time(), error);
}
}
@@ -912,7 +912,7 @@
}
void IdentityGetAuthTokenFunction::ShowExtensionLoginPrompt() {
- base::Optional<AccountInfo> account =
+ absl::optional<AccountInfo> account =
IdentityManagerFactory::GetForProfile(GetProfile())
->FindExtendedAccountInfoForAccountWithRefreshTokenByAccountId(
token_key_.account_info.account_id);
diff --git a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h
index d876ada..46adfad 100644
--- a/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h
+++ b/chrome/browser/extensions/api/identity/identity_get_auth_token_function.h
@@ -11,7 +11,6 @@
#include "base/callback_list.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/api/identity/gaia_remote_consent_flow.h"
@@ -22,6 +21,7 @@
#include "google_apis/gaia/google_service_auth_error.h"
#include "google_apis/gaia/oauth2_access_token_manager.h"
#include "google_apis/gaia/oauth2_mint_token_flow.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace signin {
class AccessTokenFetcher;
@@ -96,7 +96,7 @@
// Invoked on completion of the access token fetcher.
// Exposed for testing.
- void OnGetAccessTokenComplete(const base::Optional<std::string>& access_token,
+ void OnGetAccessTokenComplete(const absl::optional<std::string>& access_token,
base::Time expiration_time,
const GoogleServiceAuthError& error);
diff --git a/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc b/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc
index 0d77040..5f17e5c 100644
--- a/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc
+++ b/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc
@@ -9,13 +9,13 @@
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/location.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/browser/service_sandbox_type.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/service_process_host.h"
#include "mojo/public/cpp/bindings/receiver.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
namespace extensions {
@@ -53,7 +53,7 @@
image_writer_utility_client_->OperationProgress(progress);
}
- void Complete(const base::Optional<std::string>& error) override {
+ void Complete(const absl::optional<std::string>& error) override {
if (error) {
image_writer_utility_client_->OperationFailed(error.value());
} else {
diff --git a/chrome/browser/extensions/api/image_writer_private/test_utils.h b/chrome/browser/extensions/api/image_writer_private/test_utils.h
index c935206c..a57927ce 100644
--- a/chrome/browser/extensions/api/image_writer_private/test_utils.h
+++ b/chrome/browser/extensions/api/image_writer_private/test_utils.h
@@ -136,8 +136,8 @@
ErrorCallback error_callback_;
CancelCallback cancel_callback_;
- base::Optional<SimulateProgressInfo> simulate_on_write_;
- base::Optional<SimulateProgressInfo> simulate_on_verify_;
+ absl::optional<SimulateProgressInfo> simulate_on_write_;
+ absl::optional<SimulateProgressInfo> simulate_on_verify_;
};
class ImageWriterTestUtils {
diff --git a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api_unittest.cc b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api_unittest.cc
index e35e399..aa7d18a 100644
--- a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api_unittest.cc
+++ b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api_unittest.cc
@@ -398,7 +398,7 @@
std::string language_code = *language_code_ptr;
EXPECT_FALSE(language_code.empty());
- const base::Optional<bool> maybe_supports_spellcheck =
+ const absl::optional<bool> maybe_supports_spellcheck =
language_val.FindBoolKey("supportsSpellcheck");
const bool supports_spellcheck = maybe_supports_spellcheck.has_value()
? maybe_supports_spellcheck.value()
diff --git a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
index f0bff6b..c8479274 100644
--- a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
+++ b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
@@ -363,7 +363,7 @@
InstallOrLaunchWebAppCallback callback,
std::unique_ptr<content::WebContents> web_contents,
InstallableCheckResult result,
- base::Optional<web_app::AppId> app_id) {
+ absl::optional<web_app::AppId> app_id) {
switch (result) {
case InstallableCheckResult::kAlreadyInstalled:
DCHECK(app_id);
diff --git a/chrome/browser/extensions/api/management/management_api_unittest.cc b/chrome/browser/extensions/api/management/management_api_unittest.cc
index d11daf6..1ab1ed59 100644
--- a/chrome/browser/extensions/api/management/management_api_unittest.cc
+++ b/chrome/browser/extensions/api/management/management_api_unittest.cc
@@ -9,7 +9,6 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -37,6 +36,7 @@
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/permissions/permission_set.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
#include "base/test/metrics/histogram_tester.h"
@@ -140,8 +140,8 @@
ScopedTestDialogAutoConfirm auto_confirm(
accept_dialog ? ScopedTestDialogAutoConfirm::ACCEPT
: ScopedTestDialogAutoConfirm::CANCEL);
- base::Optional<ExtensionFunction::ScopedUserGestureForTests> gesture =
- base::nullopt;
+ absl::optional<ExtensionFunction::ScopedUserGestureForTests> gesture =
+ absl::nullopt;
if (use_user_gesture)
gesture.emplace();
scoped_refptr<ManagementSetEnabledFunction> function =
diff --git a/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc b/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc
index da42f11..e884e07 100644
--- a/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc
+++ b/chrome/browser/extensions/api/mdns/mdns_api_unittest.cc
@@ -361,7 +361,7 @@
.Times(0);
EventRouter::Get(browser_context())
->AddFilteredEventListener(api::mdns::OnServiceList::kEventName,
- render_process_host(), kExtId, base::nullopt,
+ render_process_host(), kExtId, absl::nullopt,
filter, false);
EXPECT_CALL(*dns_sd_registry(), UnregisterDnsSdListener("_trex._tcp.local"))
@@ -369,7 +369,7 @@
EventRouter::Get(browser_context())
->RemoveFilteredEventListener(api::mdns::OnServiceList::kEventName,
render_process_host(), kExtId,
- base::nullopt, filter, false);
+ absl::nullopt, filter, false);
}
{
base::DictionaryValue filter;
@@ -381,7 +381,7 @@
RegisterDnsSdListener("_testing._tcp.local"));
EventRouter::Get(browser_context())
->AddFilteredEventListener(api::mdns::OnServiceList::kEventName,
- render_process_host(), kExtId, base::nullopt,
+ render_process_host(), kExtId, absl::nullopt,
filter, false);
EXPECT_CALL(*dns_sd_registry(),
@@ -389,7 +389,7 @@
EventRouter::Get(browser_context())
->RemoveFilteredEventListener(api::mdns::OnServiceList::kEventName,
render_process_host(), kExtId,
- base::nullopt, filter, false);
+ absl::nullopt, filter, false);
}
}
@@ -408,14 +408,14 @@
EventRouter::Get(browser_context())
->AddFilteredEventListener(api::mdns::OnServiceList::kEventName,
- render_process_host(), kExtId, base::nullopt,
+ render_process_host(), kExtId, absl::nullopt,
filter, false);
EXPECT_CALL(*dns_sd_registry(), UnregisterDnsSdListener("_trex._tcp.local"));
EventRouter::Get(browser_context())
->RemoveFilteredEventListener(api::mdns::OnServiceList::kEventName,
render_process_host(), kExtId,
- base::nullopt, filter, false);
+ absl::nullopt, filter, false);
}
} // namespace extensions
diff --git a/chrome/browser/extensions/api/messaging/native_message_echo_host.cc b/chrome/browser/extensions/api/messaging/native_message_echo_host.cc
index 93151b21..142896c 100644
--- a/chrome/browser/extensions/api/messaging/native_message_echo_host.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_echo_host.cc
@@ -8,12 +8,12 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
-#include "base/optional.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
#include "content/public/browser/browser_context.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
@@ -44,7 +44,7 @@
}
void NativeMessageEchoHost::OnMessage(const std::string& request_string) {
- base::Optional<base::Value> request_value =
+ absl::optional<base::Value> request_value =
base::JSONReader::Read(request_string);
if (!request_value.has_value()) {
client_->CloseChannel(kHostInputOutputError);
diff --git a/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc b/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc
index 94120d1..342a7bf 100644
--- a/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc
+++ b/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc
@@ -40,7 +40,7 @@
const std::string& name,
const std::string& path,
const std::string& origin,
- base::Optional<std::string> supports_native_initiated_connections) {
+ absl::optional<std::string> supports_native_initiated_connections) {
std::string supports_native_initiated_connections_snippet;
if (supports_native_initiated_connections) {
supports_native_initiated_connections_snippet = base::StrCat({
@@ -89,7 +89,7 @@
TEST_F(NativeMessagingHostManifestTest, LoadValid) {
ASSERT_TRUE(
- WriteManifest(kTestHostName, kTestHostPath, kTestOrigin, base::nullopt));
+ WriteManifest(kTestHostName, kTestHostPath, kTestOrigin, absl::nullopt));
std::string error_message;
std::unique_ptr<NativeMessagingHostManifest> manifest =
@@ -157,7 +157,7 @@
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kOnConnectNative);
ASSERT_TRUE(
- WriteManifest(kTestHostName, kTestHostPath, kTestOrigin, base::nullopt));
+ WriteManifest(kTestHostName, kTestHostPath, kTestOrigin, absl::nullopt));
std::string error_message;
std::unique_ptr<NativeMessagingHostManifest> manifest =
NativeMessagingHostManifest::Load(manifest_path_, &error_message);
@@ -182,7 +182,7 @@
TEST_F(NativeMessagingHostManifestTest, InvalidName) {
ASSERT_TRUE(WriteManifest(".com.chrome.test.native_host", kTestHostPath,
- kTestOrigin, base::nullopt));
+ kTestOrigin, absl::nullopt));
std::string error_message;
std::unique_ptr<NativeMessagingHostManifest> manifest =
@@ -194,7 +194,7 @@
// Verify that match-all origins are rejected.
TEST_F(NativeMessagingHostManifestTest, MatchAllOrigin) {
ASSERT_TRUE(WriteManifest(kTestHostName, kTestHostPath,
- "chrome-extension://*/", base::nullopt));
+ "chrome-extension://*/", absl::nullopt));
std::string error_message;
std::unique_ptr<NativeMessagingHostManifest> manifest =
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
index 9d4366c0..045ef0c1 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
@@ -252,14 +252,14 @@
void ValueResult(const std::string& guid, PropertiesCallback callback) {
if (fail_) {
- std::move(callback).Run(base::nullopt, kFailure);
+ std::move(callback).Run(absl::nullopt, kFailure);
return;
}
base::Value result(base::Value::Type::DICTIONARY);
result.SetStringKey(::onc::network_config::kGUID, guid);
result.SetStringKey(::onc::network_config::kType,
::onc::network_config::kWiFi);
- std::move(callback).Run(std::move(result), base::nullopt);
+ std::move(callback).Run(std::move(result), absl::nullopt);
}
private:
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
index 3208054..f6dbac3 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
@@ -12,7 +12,6 @@
#include "base/command_line.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
@@ -70,6 +69,7 @@
#include "extensions/common/switches.h"
#include "extensions/common/value_builder.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
// This tests the Chrome OS implementation of the networkingPrivate API
@@ -196,7 +196,7 @@
request,
base::BindOnce(
[](std::string* out,
- base::Optional<::user_data_auth::GetSanitizedUsernameReply>
+ absl::optional<::user_data_auth::GetSanitizedUsernameReply>
result) {
CHECK(result.has_value());
*out = result->sanitized_username();
diff --git a/chrome/browser/extensions/api/notifications/extension_notification_handler.cc b/chrome/browser/extensions/api/notifications/extension_notification_handler.cc
index 64458ee..97c0834 100644
--- a/chrome/browser/extensions/api/notifications/extension_notification_handler.cc
+++ b/chrome/browser/extensions/api/notifications/extension_notification_handler.cc
@@ -85,8 +85,8 @@
Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) {
DCHECK(!reply.has_value());
diff --git a/chrome/browser/extensions/api/notifications/extension_notification_handler.h b/chrome/browser/extensions/api/notifications/extension_notification_handler.h
index cc3875e..2f0a8bc 100644
--- a/chrome/browser/extensions/api/notifications/extension_notification_handler.h
+++ b/chrome/browser/extensions/api/notifications/extension_notification_handler.h
@@ -33,8 +33,8 @@
void OnClick(Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) override;
void DisableNotifications(Profile* profile, const GURL& origin) override;
diff --git a/chrome/browser/extensions/api/notifications/extension_notification_handler_unittest.cc b/chrome/browser/extensions/api/notifications/extension_notification_handler_unittest.cc
index 1c3cde9..9c6d250 100644
--- a/chrome/browser/extensions/api/notifications/extension_notification_handler_unittest.cc
+++ b/chrome/browser/extensions/api/notifications/extension_notification_handler_unittest.cc
@@ -6,7 +6,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "chrome/browser/extensions/api/notifications/extension_notification_handler.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/test/base/testing_browser_process.h"
@@ -14,6 +13,7 @@
#include "chrome/test/base/testing_profile_manager.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
namespace {
@@ -82,8 +82,8 @@
TestExtensionNotificationHandler handler;
handler.SetTestExpectations(kChromeExtensionId, "notifications.onClicked", 1);
handler.OnClick(profile.get(), GURL(kChromeExtensionOrigin),
- kChromeNotificationId, base::nullopt /* action_index */,
- base::nullopt /* reply */, base::DoNothing());
+ kChromeNotificationId, absl::nullopt /* action_index */,
+ absl::nullopt /* reply */, base::DoNothing());
}
TEST_F(ExtensionNotificationHandlerTest, ClickHandlerButton) {
@@ -96,7 +96,7 @@
"notifications.onButtonClicked", 2);
handler.OnClick(profile.get(), GURL(kChromeExtensionOrigin),
kChromeNotificationId, 1 /* action_index */,
- base::nullopt /* reply */, base::DoNothing());
+ absl::nullopt /* reply */, base::DoNothing());
}
} // namespace extensions
diff --git a/chrome/browser/extensions/api/notifications/notifications_apitest.cc b/chrome/browser/extensions/api/notifications/notifications_apitest.cc
index 872eeda..1e6be305 100644
--- a/chrome/browser/extensions/api/notifications/notifications_apitest.cc
+++ b/chrome/browser/extensions/api/notifications/notifications_apitest.cc
@@ -410,13 +410,13 @@
// Action button event.
display_service_tester_->SimulateClick(
NotificationHandler::Type::EXTENSION, notification->id(),
- 0 /* action_index */, base::nullopt /* reply */);
+ 0 /* action_index */, absl::nullopt /* reply */);
EXPECT_TRUE(catcher.GetNextResult());
// Click event.
display_service_tester_->SimulateClick(
NotificationHandler::Type::EXTENSION, notification->id(),
- base::nullopt /* action_index */, base::nullopt /* reply */);
+ absl::nullopt /* action_index */, absl::nullopt /* reply */);
EXPECT_TRUE(catcher.GetNextResult());
// Close event.
diff --git a/chrome/browser/extensions/api/passwords_private/password_check_delegate.cc b/chrome/browser/extensions/api/passwords_private/password_check_delegate.cc
index 899960e..543a52c 100644
--- a/chrome/browser/extensions/api/passwords_private/password_check_delegate.cc
+++ b/chrome/browser/extensions/api/passwords_private/password_check_delegate.cc
@@ -17,7 +17,6 @@
#include "base/containers/flat_set.h"
#include "base/memory/ref_counted.h"
#include "base/numerics/safe_conversions.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/sequenced_task_runner_handle.h"
@@ -48,6 +47,7 @@
#include "components/url_formatter/elide_url.h"
#include "components/url_formatter/url_formatter.h"
#include "net/base/escape.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/time_format.h"
#include "url/gurl.h"
@@ -295,13 +295,13 @@
return api_credentials;
}
-base::Optional<api::passwords_private::InsecureCredential>
+absl::optional<api::passwords_private::InsecureCredential>
PasswordCheckDelegate::GetPlaintextInsecurePassword(
api::passwords_private::InsecureCredential credential) const {
const CredentialWithPassword* insecure_credential =
FindMatchingInsecureCredential(credential);
if (!insecure_credential)
- return base::nullopt;
+ return absl::nullopt;
credential.password = std::make_unique<std::string>(
base::UTF16ToUTF8(insecure_credential->password));
diff --git a/chrome/browser/extensions/api/passwords_private/password_check_delegate.h b/chrome/browser/extensions/api/passwords_private/password_check_delegate.h
index f9b559c..ef8eb5b 100644
--- a/chrome/browser/extensions/api/passwords_private/password_check_delegate.h
+++ b/chrome/browser/extensions/api/passwords_private/password_check_delegate.h
@@ -59,7 +59,7 @@
// Requests the plaintext password for |credential|. If successful, this
// returns |credential| with its |password| member set. This can fail if no
// matching insecure credential can be found in the password store.
- base::Optional<api::passwords_private::InsecureCredential>
+ absl::optional<api::passwords_private::InsecureCredential>
GetPlaintextInsecurePassword(
api::passwords_private::InsecureCredential credential) const;
diff --git a/chrome/browser/extensions/api/passwords_private/password_check_delegate_unittest.cc b/chrome/browser/extensions/api/passwords_private/password_check_delegate_unittest.cc
index f2f9767..da28295 100644
--- a/chrome/browser/extensions/api/passwords_private/password_check_delegate_unittest.cc
+++ b/chrome/browser/extensions/api/passwords_private/password_check_delegate_unittest.cc
@@ -12,7 +12,6 @@
#include "base/containers/contains.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
@@ -50,6 +49,7 @@
#include "services/network/test/test_shared_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
@@ -180,7 +180,7 @@
auto ExpectInsecureCredential(
const std::string& formatted_origin,
const std::string& detailed_origin,
- const base::Optional<std::string>& change_password_url,
+ const absl::optional<std::string>& change_password_url,
const std::u16string& username) {
auto change_password_url_field_matcher =
change_password_url.has_value()
@@ -211,7 +211,7 @@
auto ExpectCompromisedCredential(
const std::string& formatted_origin,
const std::string& detailed_origin,
- const base::Optional<std::string>& change_password_url,
+ const absl::optional<std::string>& change_password_url,
const std::u16string& username,
base::TimeDelta elapsed_time_since_compromise,
const std::string& elapsed_time_since_compromise_str,
@@ -516,7 +516,7 @@
base::TimeDelta::FromDays(3), "3 days ago",
api::passwords_private::COMPROMISE_TYPE_PHISHED),
ExpectCompromisedCredential(
- "App (com.example.app)", "com.example.app", base::nullopt,
+ "App (com.example.app)", "com.example.app", absl::nullopt,
kUsername1, base::TimeDelta::FromDays(4), "4 days ago",
api::passwords_private::COMPROMISE_TYPE_PHISHED),
ExpectCompromisedCredential(
@@ -565,7 +565,7 @@
// Purposefully set a wrong id and verify that trying to get a plaintext
// password fails.
credential.id = 1;
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
delegate().GetPlaintextInsecurePassword(std::move(credential)));
}
@@ -583,7 +583,7 @@
// Purposefully set a wrong signon realm and verify that trying to get a
// plaintext password fails.
credential.signon_realm = kExampleOrg;
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
delegate().GetPlaintextInsecurePassword(std::move(credential)));
}
@@ -601,7 +601,7 @@
// Purposefully set a wrong username and verify that trying to get a
// plaintext password fails.
credential.signon_realm = base::UTF16ToASCII(kUsername2);
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
delegate().GetPlaintextInsecurePassword(std::move(credential)));
}
@@ -619,7 +619,7 @@
EXPECT_EQ(base::UTF16ToASCII(kUsername1), credential.username);
EXPECT_EQ(nullptr, credential.password);
- base::Optional<InsecureCredential> opt_credential =
+ absl::optional<InsecureCredential> opt_credential =
delegate().GetPlaintextInsecurePassword(std::move(credential));
ASSERT_TRUE(opt_credential.has_value());
EXPECT_EQ(0, opt_credential->id);
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
index 6e6963ce..387d0ee 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
@@ -128,7 +128,7 @@
}
void PasswordsPrivateRequestPlaintextPasswordFunction::GotPassword(
- base::Optional<std::u16string> password) {
+ absl::optional<std::u16string> password) {
if (password) {
Respond(OneArgument(base::Value(std::move(*password))));
return;
@@ -296,7 +296,7 @@
}
void PasswordsPrivateGetPlaintextInsecurePasswordFunction::GotCredential(
- base::Optional<api::passwords_private::InsecureCredential> credential) {
+ absl::optional<api::passwords_private::InsecureCredential> credential) {
if (!credential) {
Respond(
Error("Could not obtain plaintext insecure password. Either the user "
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_api.h b/chrome/browser/extensions/api/passwords_private/passwords_private_api.h
index f4a91faa..006345a 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_api.h
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_api.h
@@ -7,10 +7,10 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h"
#include "components/password_manager/core/browser/bulk_leak_check_service.h"
#include "extensions/browser/extension_function.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
@@ -119,7 +119,7 @@
ResponseAction Run() override;
private:
- void GotPassword(base::Optional<std::u16string> password);
+ void GotPassword(absl::optional<std::u16string> password);
};
class PasswordsPrivateGetSavedPasswordListFunction : public ExtensionFunction {
@@ -285,7 +285,7 @@
private:
void GotCredential(
- base::Optional<api::passwords_private::InsecureCredential> credential);
+ absl::optional<api::passwords_private::InsecureCredential> credential);
};
class PasswordsPrivateChangeInsecureCredentialFunction
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
index 3956699..f418997 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
@@ -15,7 +15,6 @@
#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/string_piece_forward.h"
#include "base/strings/utf_string_conversions.h"
@@ -33,6 +32,7 @@
#include "content/public/test/browser_test.h"
#include "content/public/test/test_utils.h"
#include "extensions/common/switches.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/time_format.h"
namespace extensions {
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
index 6cc11441..bcc1286 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
@@ -12,7 +12,6 @@
#include "base/callback.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/string_piece_forward.h"
#include "chrome/browser/ui/passwords/settings/password_manager_presenter.h"
#include "chrome/browser/ui/passwords/settings/password_ui_view.h"
@@ -22,6 +21,7 @@
#include "components/password_manager/core/browser/ui/export_progress_status.h"
#include "components/password_manager/core/browser/ui/insecure_credentials_manager.h"
#include "extensions/browser/extension_function.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -35,13 +35,13 @@
class PasswordsPrivateDelegate : public KeyedService {
public:
using PlaintextPasswordCallback =
- base::OnceCallback<void(base::Optional<std::u16string>)>;
+ base::OnceCallback<void(absl::optional<std::u16string>)>;
using StartPasswordCheckCallback =
base::OnceCallback<void(password_manager::BulkLeakCheckService::State)>;
using PlaintextInsecurePasswordCallback = base::OnceCallback<void(
- base::Optional<api::passwords_private::InsecureCredential>)>;
+ absl::optional<api::passwords_private::InsecureCredential>)>;
~PasswordsPrivateDelegate() override = default;
@@ -80,7 +80,7 @@
// |id| the id created when going over the list of saved passwords.
// |reason| The reason why the plaintext password is requested.
// |callback| The callback that gets invoked with the saved password if it
- // could be obtained successfully, or base::nullopt otherwise.
+ // could be obtained successfully, or absl::nullopt otherwise.
// |web_contents| The web content object used as the UI; will be used to show
// an OS-level authentication dialog if necessary.
virtual void RequestPlaintextPassword(
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
index 1fd3868..3794a4c 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
@@ -291,14 +291,14 @@
web_contents_ = web_contents;
if (!password_access_authenticator_.EnsureUserIsAuthenticated(
GetReauthPurpose(reason))) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
// Request the password. When it is retrieved, ShowPassword() will be called.
const std::string* sort_key = password_id_generator_.TryGetKey(id);
if (!sort_key) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
@@ -308,9 +308,9 @@
// Copying occurs here so javascript doesn't need plaintext password.
callback = base::BindOnce(
[](PlaintextPasswordCallback callback,
- base::Optional<std::u16string> password) {
+ absl::optional<std::u16string> password) {
if (!password) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
ui::ScopedClipboardWriter clipboard_writer(
@@ -527,7 +527,7 @@
web_contents_ = web_contents;
if (!password_access_authenticator_.EnsureUserIsAuthenticated(
GetReauthPurpose(reason))) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl_unittest.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl_unittest.cc
index c432c8d..fe04c10 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl_unittest.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl_unittest.cc
@@ -11,7 +11,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
@@ -45,6 +44,7 @@
#include "content/public/test/web_contents_tester.h"
#include "extensions/browser/test_event_router.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/clipboard/test/test_clipboard.h"
using MockReauthCallback = base::MockCallback<
@@ -472,7 +472,7 @@
base::Time before_call = test_clipboard_->GetLastModifiedTime();
MockPlaintextPasswordCallback password_callback;
- EXPECT_CALL(password_callback, Run(Eq(base::nullopt)));
+ EXPECT_CALL(password_callback, Run(Eq(absl::nullopt)));
delegate.RequestPlaintextPassword(
0, api::passwords_private::PLAINTEXT_REASON_COPY, password_callback.Get(),
nullptr);
@@ -527,7 +527,7 @@
.WillOnce(Return(false));
MockPlaintextPasswordCallback password_callback;
- EXPECT_CALL(password_callback, Run(Eq(base::nullopt)));
+ EXPECT_CALL(password_callback, Run(Eq(absl::nullopt)));
delegate.RequestPlaintextPassword(
0, api::passwords_private::PLAINTEXT_REASON_VIEW, password_callback.Get(),
nullptr);
@@ -593,7 +593,7 @@
EXPECT_CALL(reauth_callback, Run(ReauthPurpose::VIEW_PASSWORD))
.WillOnce(Return(false));
- EXPECT_CALL(credential_callback, Run(Eq(base::nullopt)));
+ EXPECT_CALL(credential_callback, Run(Eq(absl::nullopt)));
delegate.GetPlaintextInsecurePassword(
api::passwords_private::InsecureCredential(),
@@ -625,7 +625,7 @@
PasswordsPrivateDelegate::PlaintextInsecurePasswordCallback>
credential_callback;
- base::Optional<api::passwords_private::InsecureCredential> opt_credential;
+ absl::optional<api::passwords_private::InsecureCredential> opt_credential;
EXPECT_CALL(reauth_callback, Run(ReauthPurpose::VIEW_PASSWORD))
.WillOnce(Return(true));
EXPECT_CALL(credential_callback, Run).WillOnce(MoveArg(&opt_credential));
diff --git a/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.cc b/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.cc
index cd8d3e2..b877ef7 100644
--- a/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.cc
+++ b/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.cc
@@ -225,7 +225,7 @@
PlaintextInsecurePasswordCallback callback) {
// Return a mocked password value.
if (!plaintext_password_) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
diff --git a/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h b/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h
index 77fc446..629f9bb 100644
--- a/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h
+++ b/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_TEST_PASSWORDS_PRIVATE_DELEGATE_H_
#define CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_TEST_PASSWORDS_PRIVATE_DELEGATE_H_
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h"
#include "chrome/browser/profiles/profile.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
// A test PasswordsPrivateDelegate implementation which uses mock data.
@@ -116,7 +116,7 @@
std::vector<api::passwords_private::ExceptionEntry>
last_deleted_exceptions_batch_;
- base::Optional<std::u16string> plaintext_password_ = u"plaintext";
+ absl::optional<std::u16string> plaintext_password_ = u"plaintext";
// List of insecure credentials.
std::vector<api::passwords_private::InsecureCredential> insecure_credentials_;
diff --git a/chrome/browser/extensions/api/platform_keys/platform_keys_api_ash.cc b/chrome/browser/extensions/api/platform_keys/platform_keys_api_ash.cc
index eaeb053f..582568f 100644
--- a/chrome/browser/extensions/api/platform_keys/platform_keys_api_ash.cc
+++ b/chrome/browser/extensions/api/platform_keys/platform_keys_api_ash.cc
@@ -13,7 +13,6 @@
#include "base/bind.h"
#include "base/containers/span.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/string_piece.h"
#include "base/values.h"
@@ -28,6 +27,7 @@
#include "net/base/net_errors.h"
#include "net/cert/x509_certificate.h"
#include "net/cert/x509_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using PublicKeyInfo = chromeos::platform_keys::PublicKeyInfo;
@@ -65,7 +65,7 @@
const char kTokenIdUser[] = "user";
const char kTokenIdSystem[] = "system";
-base::Optional<chromeos::platform_keys::TokenId> ApiIdToPlatformKeysTokenId(
+absl::optional<chromeos::platform_keys::TokenId> ApiIdToPlatformKeysTokenId(
const std::string& token_id) {
if (token_id == kTokenIdUser)
return chromeos::platform_keys::TokenId::kUser;
@@ -73,7 +73,7 @@
if (token_id == kTokenIdSystem)
return chromeos::platform_keys::TokenId::kSystem;
- return base::nullopt;
+ return absl::nullopt;
}
std::string PlatformKeysTokenIdToApiId(
@@ -282,7 +282,7 @@
api_pki::Sign::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
- base::Optional<chromeos::platform_keys::TokenId> platform_keys_token_id;
+ absl::optional<chromeos::platform_keys::TokenId> platform_keys_token_id;
// If |params->token_id| is not specified (empty string), the key will be
// searched for in all available tokens.
if (!params->token_id.empty()) {
diff --git a/chrome/browser/extensions/api/platform_keys/platform_keys_api_ash.h b/chrome/browser/extensions/api/platform_keys/platform_keys_api_ash.h
index 4e3ca33..f32909b 100644
--- a/chrome/browser/extensions/api/platform_keys/platform_keys_api_ash.h
+++ b/chrome/browser/extensions/api/platform_keys/platform_keys_api_ash.h
@@ -8,9 +8,9 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/chromeos/platform_keys/platform_keys.h"
#include "extensions/browser/extension_function.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace net {
class X509Certificate;
@@ -25,7 +25,7 @@
// Returns a known token if |token_id| is valid and returns nullopt for both
// empty or unknown |token_id|.
-base::Optional<chromeos::platform_keys::TokenId> ApiIdToPlatformKeysTokenId(
+absl::optional<chromeos::platform_keys::TokenId> ApiIdToPlatformKeysTokenId(
const std::string& token_id);
// Converts a token id from ::chromeos::platform_keys to the platformKeys API
diff --git a/chrome/browser/extensions/api/platform_keys/platform_keys_api_lacros.cc b/chrome/browser/extensions/api/platform_keys/platform_keys_api_lacros.cc
index d997040..d54102c 100644
--- a/chrome/browser/extensions/api/platform_keys/platform_keys_api_lacros.cc
+++ b/chrome/browser/extensions/api/platform_keys/platform_keys_api_lacros.cc
@@ -6,13 +6,13 @@
#include <string>
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/platform_keys_internal.h"
#include "chromeos/crosapi/cpp/keystore_service_util.h"
#include "chromeos/crosapi/mojom/keystore_service.mojom.h"
#include "chromeos/lacros/lacros_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
@@ -32,31 +32,31 @@
using crosapi::keystore_service_util::kWebCryptoEcdsa;
using crosapi::keystore_service_util::kWebCryptoRsassaPkcs1v15;
-base::Optional<SigningAlgorithmName> SigningAlgorithmNameFromString(
+absl::optional<SigningAlgorithmName> SigningAlgorithmNameFromString(
const std::string& input) {
if (input == kWebCryptoRsassaPkcs1v15)
return SigningAlgorithmName::kRsassaPkcs115;
if (input == kWebCryptoEcdsa)
return SigningAlgorithmName::kEcdsa;
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<crosapi::mojom::KeystoreType> KeystoreTypeFromString(
+absl::optional<crosapi::mojom::KeystoreType> KeystoreTypeFromString(
const std::string& input) {
if (input == "user")
return crosapi::mojom::KeystoreType::kUser;
if (input == "system")
return crosapi::mojom::KeystoreType::kDevice;
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<SigningScheme> SigningSchemeFromStrings(
+absl::optional<SigningScheme> SigningSchemeFromStrings(
const std::string& hashing,
const std::string& signing) {
if (hashing == "none") {
if (signing == kWebCryptoRsassaPkcs1v15)
return SigningScheme::kRsassaPkcs1V15None;
- return base::nullopt;
+ return absl::nullopt;
}
if (hashing == "SHA-1") {
if (signing == kWebCryptoRsassaPkcs1v15)
@@ -82,7 +82,7 @@
if (signing == kWebCryptoEcdsa)
return SigningScheme::kEcdsaSha512;
}
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace
@@ -117,7 +117,7 @@
if (!Profile::FromBrowserContext(browser_context())->IsMainProfile())
return RespondNow(Error(kUnsupportedProfile));
- base::Optional<SigningAlgorithmName> algorithm_name =
+ absl::optional<SigningAlgorithmName> algorithm_name =
SigningAlgorithmNameFromString(params->algorithm_name);
if (!algorithm_name) {
return RespondNow(Error(kErrorAlgorithmNotPermittedByCertificate));
@@ -141,7 +141,7 @@
return;
case Result::Tag::SUCCESS_RESULT:
api_pki::GetPublicKey::Results::Algorithm algorithm;
- base::Optional<base::DictionaryValue> dict =
+ absl::optional<base::DictionaryValue> dict =
crosapi::keystore_service_util::DictionaryFromSigningAlgorithm(
result->get_success_result()->algorithm_properties);
if (!dict) {
@@ -183,13 +183,13 @@
if (!Profile::FromBrowserContext(browser_context())->IsMainProfile())
return RespondNow(Error(kUnsupportedProfile));
- base::Optional<crosapi::mojom::KeystoreType> keystore_type =
+ absl::optional<crosapi::mojom::KeystoreType> keystore_type =
KeystoreTypeFromString(params->token_id);
if (!keystore_type) {
return RespondNow(Error(kErrorInvalidToken));
}
- base::Optional<SigningScheme> scheme = SigningSchemeFromStrings(
+ absl::optional<SigningScheme> scheme = SigningSchemeFromStrings(
params->hash_algorithm_name, params->algorithm_name);
if (!scheme) {
return RespondNow(Error(kErrorAlgorithmNotSupported));
diff --git a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc
index e55ba13..25b59319 100644
--- a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc
+++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc
@@ -11,7 +11,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
@@ -43,6 +42,7 @@
#include "content/public/browser/browser_context.h"
#include "extensions/browser/event_router.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
@@ -934,7 +934,7 @@
VLOG(1) << "Ready for safe browsing real-time event reporting.";
}
-base::Optional<enterprise_connectors::ReportingSettings>
+absl::optional<enterprise_connectors::ReportingSettings>
SafeBrowsingPrivateEventRouter::GetReportingSettings() {
return enterprise_connectors::ConnectorsServiceFactory::GetForBrowserContext(
context_)
diff --git a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h
index ee7fdb5..2939379 100644
--- a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h
+++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h
@@ -260,8 +260,8 @@
// Determines if the real-time reporting feature is enabled.
// Obtain settings to apply to a reporting event from ConnectorsService.
- // base::nullopt represents that reporting should not be done.
- base::Optional<enterprise_connectors::ReportingSettings>
+ // absl::nullopt represents that reporting should not be done.
+ absl::optional<enterprise_connectors::ReportingSettings>
GetReportingSettings();
// Called whenever the real-time reporting policy changes.
diff --git a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc
index ea53b32..27f729ef 100644
--- a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc
+++ b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc
@@ -28,7 +28,7 @@
"model", "full_hardware_class", base::Time(),
syncer::DeviceInfoUtil::GetPulseInterval(),
/*send_tab_to_self_receiving_enabled=*/true,
- /*sharing_info=*/base::nullopt, /*paask_info=*/base::nullopt,
+ /*sharing_info=*/absl::nullopt, /*paask_info=*/absl::nullopt,
/*fcm_registration_token=*/std::string(),
/*interested_data_types=*/syncer::ModelTypeSet());
}
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
index 62366f6..14458922 100644
--- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
+++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc
@@ -37,8 +37,8 @@
"model", "full_hardware_class", base::Time(),
syncer::DeviceInfoUtil::GetPulseInterval(),
/*send_tab_to_self_receiving_enabled=*/true,
- /*sharing_info=*/base::nullopt,
- /*passk_info=*/base::nullopt,
+ /*sharing_info=*/absl::nullopt,
+ /*passk_info=*/absl::nullopt,
/*fcm_registration_token=*/std::string(),
/*interested_data_types=*/syncer::ModelTypeSet());
}
diff --git a/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc b/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
index 8344815..5c18498 100644
--- a/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
+++ b/chrome/browser/extensions/api/socket/tcp_socket_unittest.cc
@@ -641,7 +641,7 @@
[&](int result,
mojo::PendingRemote<network::mojom::TCPConnectedSocket>
accepted_socket,
- const base::Optional<net::IPEndPoint>& remote_addr,
+ const absl::optional<net::IPEndPoint>& remote_addr,
mojo::ScopedDataPipeConsumerHandle receive_handle,
mojo::ScopedDataPipeProducerHandle send_handle) {
EXPECT_EQ(net::OK, result);
@@ -698,7 +698,7 @@
[&](int result,
mojo::PendingRemote<network::mojom::TCPConnectedSocket>
connected_socket,
- const base::Optional<net::IPEndPoint>& remote_addr,
+ const absl::optional<net::IPEndPoint>& remote_addr,
mojo::ScopedDataPipeConsumerHandle receive_handle,
mojo::ScopedDataPipeProducerHandle send_handle) {
EXPECT_EQ(net::OK, result);
diff --git a/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc b/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc
index 690b95d9..6ceb7b0f9 100644
--- a/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc
+++ b/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc
@@ -193,7 +193,7 @@
const base::Value value("111");
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange("aaa", base::nullopt, value.Clone()));
+ changes.push_back(ValueStoreChange("aaa", absl::nullopt, value.Clone()));
EXPECT_CALL(observer_, OnSettingsChangedJSON(
kTestExtensionId, StorageAreaNamespace::kManaged,
ValueStoreChangeToJson(std::move(changes))));
@@ -208,7 +208,7 @@
// Notify when new policies are added.
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange("bbb", base::nullopt, value.Clone()));
+ changes.push_back(ValueStoreChange("bbb", absl::nullopt, value.Clone()));
EXPECT_CALL(observer_, OnSettingsChangedJSON(
kTestExtensionId, StorageAreaNamespace::kManaged,
ValueStoreChangeToJson(std::move(changes))));
@@ -239,7 +239,7 @@
{
ValueStoreChangeList changes;
changes.push_back(
- ValueStoreChange("bbb", new_value.Clone(), base::nullopt));
+ ValueStoreChange("bbb", new_value.Clone(), absl::nullopt));
EXPECT_CALL(observer_, OnSettingsChangedJSON(
kTestExtensionId, StorageAreaNamespace::kManaged,
ValueStoreChangeToJson(std::move(changes))));
diff --git a/chrome/browser/extensions/api/storage/setting_sync_data.cc b/chrome/browser/extensions/api/storage/setting_sync_data.cc
index d2e24e2..88817b3 100644
--- a/chrome/browser/extensions/api/storage/setting_sync_data.cc
+++ b/chrome/browser/extensions/api/storage/setting_sync_data.cc
@@ -23,7 +23,7 @@
}
SettingSyncData::SettingSyncData(const syncer::SyncData& sync_data)
- : change_type_(base::nullopt) {
+ : change_type_(absl::nullopt) {
ExtractSyncData(sync_data);
}
diff --git a/chrome/browser/extensions/api/storage/setting_sync_data.h b/chrome/browser/extensions/api/storage/setting_sync_data.h
index fca45377..21f1c2a 100644
--- a/chrome/browser/extensions/api/storage/setting_sync_data.h
+++ b/chrome/browser/extensions/api/storage/setting_sync_data.h
@@ -9,9 +9,9 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/values.h"
#include "components/sync/model/sync_change.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace syncer {
class SyncData;
@@ -26,7 +26,7 @@
// Creates from a sync change.
explicit SettingSyncData(const syncer::SyncChange& sync_change);
- // Creates from sync data. |change_type| will be base::nullopt.
+ // Creates from sync data. |change_type| will be absl::nullopt.
explicit SettingSyncData(const syncer::SyncData& sync_data);
// Creates explicitly.
@@ -37,9 +37,9 @@
~SettingSyncData();
- // May return base::nullopt if this object represents sync data that isn't
+ // May return absl::nullopt if this object represents sync data that isn't
// associated with a sync operation.
- const base::Optional<syncer::SyncChange::SyncChangeType>& change_type()
+ const absl::optional<syncer::SyncChange::SyncChangeType>& change_type()
const {
return change_type_;
}
@@ -57,7 +57,7 @@
// either an extension or app settings data type.
void ExtractSyncData(const syncer::SyncData& sync_data);
- base::Optional<syncer::SyncChange::SyncChangeType> change_type_;
+ absl::optional<syncer::SyncChange::SyncChangeType> change_type_;
std::string extension_id_;
std::string key_;
std::unique_ptr<base::Value> value_;
diff --git a/chrome/browser/extensions/api/storage/settings_sync_processor.cc b/chrome/browser/extensions/api/storage/settings_sync_processor.cc
index 8674d0c..c517a24 100644
--- a/chrome/browser/extensions/api/storage/settings_sync_processor.cc
+++ b/chrome/browser/extensions/api/storage/settings_sync_processor.cc
@@ -43,7 +43,7 @@
initialized_ = true;
}
-base::Optional<syncer::ModelError> SettingsSyncProcessor::SendChanges(
+absl::optional<syncer::ModelError> SettingsSyncProcessor::SendChanges(
const ValueStoreChangeList& changes) {
DCHECK(IsOnBackendSequence());
CHECK(initialized_) << "Init not called";
@@ -79,9 +79,9 @@
}
if (sync_changes.empty())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
sync_processor_->ProcessSyncChanges(FROM_HERE, sync_changes);
if (error.has_value())
return error;
@@ -91,7 +91,7 @@
synced_keys_.erase(*i);
}
- return base::nullopt;
+ return absl::nullopt;
}
void SettingsSyncProcessor::NotifyChanges(const ValueStoreChangeList& changes) {
diff --git a/chrome/browser/extensions/api/storage/settings_sync_processor.h b/chrome/browser/extensions/api/storage/settings_sync_processor.h
index 2455553..03a4dec 100644
--- a/chrome/browser/extensions/api/storage/settings_sync_processor.h
+++ b/chrome/browser/extensions/api/storage/settings_sync_processor.h
@@ -36,7 +36,7 @@
void Init(const base::DictionaryValue& initial_state);
// Sends |changes| to sync.
- base::Optional<syncer::ModelError> SendChanges(
+ absl::optional<syncer::ModelError> SendChanges(
const ValueStoreChangeList& changes);
// Informs this that |changes| have been receieved from sync. No action will
diff --git a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc
index 0a06240..f9320a7 100644
--- a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc
+++ b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc
@@ -104,7 +104,7 @@
MockSyncChangeProcessor() : fail_all_requests_(false) {}
// syncer::SyncChangeProcessor implementation.
- base::Optional<syncer::ModelError> ProcessSyncChanges(
+ absl::optional<syncer::ModelError> ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) override {
if (fail_all_requests_) {
@@ -114,7 +114,7 @@
for (auto it = change_list.cbegin(); it != change_list.cend(); ++it) {
changes_.push_back(std::make_unique<SettingSyncData>(*it));
}
- return base::nullopt;
+ return absl::nullopt;
}
syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override {
diff --git a/chrome/browser/extensions/api/storage/sync_storage_backend.cc b/chrome/browser/extensions/api/storage/sync_storage_backend.cc
index 542cb66..6de4467 100644
--- a/chrome/browser/extensions/api/storage/sync_storage_backend.cc
+++ b/chrome/browser/extensions/api/storage/sync_storage_backend.cc
@@ -97,7 +97,7 @@
storage_objs_[extension_id] = std::move(syncable_storage);
if (sync_processor_.get()) {
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
raw_syncable_storage->StartSyncing(
std::move(sync_data), CreateSettingsSyncProcessor(extension_id));
if (error.has_value())
@@ -166,7 +166,7 @@
return all_sync_data;
}
-base::Optional<syncer::ModelError> SyncStorageBackend::MergeDataAndStartSyncing(
+absl::optional<syncer::ModelError> SyncStorageBackend::MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
@@ -204,7 +204,7 @@
SyncableSettingsStorage* storage = storage_obj.second.get();
auto group = grouped_sync_data.find(extension_id);
- base::Optional<syncer::ModelError> error;
+ absl::optional<syncer::ModelError> error;
if (group != grouped_sync_data.end()) {
error = storage->StartSyncing(base::WrapUnique(group->second),
CreateSettingsSyncProcessor(extension_id));
@@ -225,10 +225,10 @@
GetOrCreateStorageWithSyncData(group.first, base::WrapUnique(group.second));
}
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<syncer::ModelError> SyncStorageBackend::ProcessSyncChanges(
+absl::optional<syncer::ModelError> SyncStorageBackend::ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& sync_changes) {
DCHECK(IsOnBackendSequence());
@@ -251,13 +251,13 @@
for (const auto& group : grouped_sync_data) {
SyncableSettingsStorage* storage =
GetOrCreateStorageWithSyncData(group.first, EmptyDictionaryValue());
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
storage->ProcessSyncChanges(base::WrapUnique(group.second));
if (error.has_value())
storage->StopSyncing();
}
- return base::nullopt;
+ return absl::nullopt;
}
void SyncStorageBackend::StopSyncing(syncer::ModelType type) {
diff --git a/chrome/browser/extensions/api/storage/sync_storage_backend.h b/chrome/browser/extensions/api/storage/sync_storage_backend.h
index 81cbed3..236b44e 100644
--- a/chrome/browser/extensions/api/storage/sync_storage_backend.h
+++ b/chrome/browser/extensions/api/storage/sync_storage_backend.h
@@ -49,12 +49,12 @@
// syncer::SyncableService implementation.
void WaitUntilReadyToSync(base::OnceClosure done) override;
syncer::SyncDataList GetAllSyncDataForTesting(syncer::ModelType type) const;
- base::Optional<syncer::ModelError> MergeDataAndStartSyncing(
+ absl::optional<syncer::ModelError> MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory) override;
- base::Optional<syncer::ModelError> ProcessSyncChanges(
+ absl::optional<syncer::ModelError> ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) override;
void StopSyncing(syncer::ModelType type) override;
diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
index 5af1f61..2becc1b 100644
--- a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
+++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
@@ -139,7 +139,7 @@
return;
if (sync_processor_.get()) {
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
sync_processor_->SendChanges(result.changes());
if (error.has_value())
StopSyncing();
@@ -153,7 +153,7 @@
// Sync-related methods.
-base::Optional<syncer::ModelError> SyncableSettingsStorage::StartSyncing(
+absl::optional<syncer::ModelError> SyncableSettingsStorage::StartSyncing(
std::unique_ptr<base::DictionaryValue> sync_state,
std::unique_ptr<SettingsSyncProcessor> sync_processor) {
DCHECK(IsOnBackendSequence());
@@ -178,13 +178,13 @@
std::move(current_settings));
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
SyncableSettingsStorage::SendLocalSettingsToSync(
std::unique_ptr<base::DictionaryValue> local_state) {
DCHECK(IsOnBackendSequence());
if (local_state->DictEmpty())
- return base::nullopt;
+ return absl::nullopt;
// Transform the current settings into a list of sync changes.
ValueStoreChangeList changes;
@@ -194,17 +194,17 @@
std::string key = base::DictionaryValue::Iterator(*local_state).key();
std::unique_ptr<base::Value> value;
local_state->RemoveWithoutPathExpansion(key, &value);
- changes.push_back(ValueStoreChange(key, base::nullopt, std::move(*value)));
+ changes.push_back(ValueStoreChange(key, absl::nullopt, std::move(*value)));
}
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
sync_processor_->SendChanges(std::move(changes));
if (error.has_value())
StopSyncing();
return error;
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
SyncableSettingsStorage::OverwriteLocalSettingsWithSync(
std::unique_ptr<base::DictionaryValue> sync_state,
std::unique_ptr<base::DictionaryValue> local_state) {
@@ -245,7 +245,7 @@
}
if (changes->empty())
- return base::nullopt;
+ return absl::nullopt;
return ProcessSyncChanges(std::move(changes));
}
@@ -254,7 +254,7 @@
sync_processor_.reset();
}
-base::Optional<syncer::ModelError> SyncableSettingsStorage::ProcessSyncChanges(
+absl::optional<syncer::ModelError> SyncableSettingsStorage::ProcessSyncChanges(
std::unique_ptr<SettingSyncDataList> sync_changes) {
DCHECK(IsOnBackendSequence());
DCHECK(!sync_changes->empty()) << "No sync changes for " << extension_id_;
@@ -341,7 +341,7 @@
// TODO(kalman): Something sensible with multiple errors.
if (errors.empty())
- return base::nullopt;
+ return absl::nullopt;
return syncer::ConvertToModelError(errors[0]);
}
@@ -360,7 +360,7 @@
sync_processor_->type());
}
changes->push_back(
- ValueStoreChange(key, base::nullopt, std::move(*new_value)));
+ ValueStoreChange(key, absl::nullopt, std::move(*new_value)));
return syncer::SyncError();
}
@@ -399,7 +399,7 @@
sync_processor_->type());
}
changes->push_back(
- ValueStoreChange(key, std::move(*old_value), base::nullopt));
+ ValueStoreChange(key, std::move(*old_value), absl::nullopt));
return syncer::SyncError();
}
diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.h b/chrome/browser/extensions/api/storage/syncable_settings_storage.h
index 2efda906..5914c83 100644
--- a/chrome/browser/extensions/api/storage/syncable_settings_storage.h
+++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.h
@@ -66,8 +66,8 @@
// already active.
// |sync_state| is the current state of the extension settings in sync.
// |sync_processor| is used to write out any changes.
- // Returns any error when trying to sync, or base::nullopt on success.
- base::Optional<syncer::ModelError> StartSyncing(
+ // Returns any error when trying to sync, or absl::nullopt on success.
+ absl::optional<syncer::ModelError> StartSyncing(
std::unique_ptr<base::DictionaryValue> sync_state,
std::unique_ptr<SettingsSyncProcessor> sync_processor);
@@ -76,8 +76,8 @@
// Pushes a list of sync changes into this storage area. May be called at any
// time, changes will be ignored if sync isn't active.
- // Returns any error when trying to sync, or base::nullopt on success.
- base::Optional<syncer::ModelError> ProcessSyncChanges(
+ // Returns any error when trying to sync, or absl::nullopt on success.
+ absl::optional<syncer::ModelError> ProcessSyncChanges(
std::unique_ptr<SettingSyncDataList> sync_changes);
private:
@@ -91,13 +91,13 @@
// Sends all local settings to sync. This assumes that there are no settings
// in sync yet.
- // Returns any error when trying to sync, or base::nullopt on success.
- base::Optional<syncer::ModelError> SendLocalSettingsToSync(
+ // Returns any error when trying to sync, or absl::nullopt on success.
+ absl::optional<syncer::ModelError> SendLocalSettingsToSync(
std::unique_ptr<base::DictionaryValue> local_state);
// Overwrites local state with sync state.
- // Returns any error when trying to sync, or base::nullopt on success.
- base::Optional<syncer::ModelError> OverwriteLocalSettingsWithSync(
+ // Returns any error when trying to sync, or absl::nullopt on success.
+ absl::optional<syncer::ModelError> OverwriteLocalSettingsWithSync(
std::unique_ptr<base::DictionaryValue> sync_state,
std::unique_ptr<base::DictionaryValue> local_state);
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.h b/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.h
index 4099fa31..47f2e10 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.h
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.h
@@ -10,12 +10,12 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/trace_event_analyzer.h"
#include "chrome/test/base/in_process_browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class CommandLine;
@@ -132,7 +132,7 @@
// that would also preempt BEST_EFFORT tasks in utility processes, and
// TabCapturePerformanceTest.Performance relies on BEST_EFFORT tasks in
// utility process for tracing.
- base::Optional<base::ThreadPoolInstance::ScopedBestEffortExecutionFence>
+ absl::optional<base::ThreadPoolInstance::ScopedBestEffortExecutionFence>
best_effort_fence_;
bool is_full_performance_run_ = false;
diff --git a/chrome/browser/extensions/api/tab_groups/tab_groups_api.cc b/chrome/browser/extensions/api/tab_groups/tab_groups_api.cc
index 60f24aa..772743a 100644
--- a/chrome/browser/extensions/api/tab_groups/tab_groups_api.cc
+++ b/chrome/browser/extensions/api/tab_groups/tab_groups_api.cc
@@ -52,9 +52,9 @@
return false;
}
- base::Optional<tab_groups::TabGroupId> target_group =
+ absl::optional<tab_groups::TabGroupId> target_group =
tab_strip->GetTabGroupForTab(target_index);
- base::Optional<tab_groups::TabGroupId> adjacent_group =
+ absl::optional<tab_groups::TabGroupId> adjacent_group =
tab_strip->GetTabGroupForTab(target_index - 1);
if (target_group.has_value() && target_group == adjacent_group) {
diff --git a/chrome/browser/extensions/api/tab_groups/tab_groups_api_unittest.cc b/chrome/browser/extensions/api/tab_groups/tab_groups_api_unittest.cc
index ae054c8..ed0024e 100644
--- a/chrome/browser/extensions/api/tab_groups/tab_groups_api_unittest.cc
+++ b/chrome/browser/extensions/api/tab_groups/tab_groups_api_unittest.cc
@@ -10,7 +10,6 @@
#include <vector>
#include "base/containers/contains.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/api/tab_groups/tab_groups_constants.h"
@@ -42,6 +41,7 @@
#include "extensions/common/constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension_builder.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index 4dc04bc..3fa004a 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -20,7 +20,6 @@
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/pattern.h"
@@ -102,6 +101,7 @@
#include "net/base/escape.h"
#include "skia/ext/image_operations.h"
#include "skia/ext/platform_canvas.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/page/page_zoom.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/models/list_selection_model.h"
@@ -988,7 +988,7 @@
if (params->query_info.window_id.get())
window_id = *params->query_info.window_id;
- base::Optional<int> group_id = base::nullopt;
+ absl::optional<int> group_id = absl::nullopt;
if (params->query_info.group_id.get())
group_id = *params->query_info.group_id;
@@ -1071,7 +1071,7 @@
}
if (group_id.has_value()) {
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_strip->GetTabGroupForTab(index);
if (group_id.value() == -1) {
if (group.has_value())
diff --git a/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc b/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc
index 38e3772..a4c47db9c 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include "base/containers/contains.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -33,6 +32,7 @@
#include "extensions/browser/api_test_utils.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_builder.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/display/test/scoped_screen_override.h"
#include "ui/display/test/test_screen.h"
@@ -585,7 +585,7 @@
EXPECT_EQ(tab_strip_model->GetWebContentsAt(3), web_contentses[1]);
EXPECT_EQ(tab_strip_model->GetWebContentsAt(4), web_contentses[3]);
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_strip_model->GetTabGroupForTab(0);
EXPECT_TRUE(group.has_value());
EXPECT_EQ(group, tab_strip_model->GetTabGroupForTab(1));
@@ -637,7 +637,7 @@
EXPECT_EQ(tab_strip_model->GetWebContentsAt(3), web_contentses[3]);
EXPECT_EQ(tab_strip_model->GetWebContentsAt(4), web_contentses[4]);
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_strip_model->GetTabGroupForTab(1);
EXPECT_TRUE(group.has_value());
EXPECT_FALSE(tab_strip_model->GetTabGroupForTab(0));
diff --git a/chrome/browser/extensions/api/tabs/tabs_event_router.cc b/chrome/browser/extensions/api/tabs/tabs_event_router.cc
index 4a50c322..fe6486e 100644
--- a/chrome/browser/extensions/api/tabs/tabs_event_router.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_event_router.cc
@@ -261,7 +261,7 @@
}
void TabsEventRouter::TabGroupedStateChanged(
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
content::WebContents* contents,
int index) {
std::set<std::string> changed_property_names;
diff --git a/chrome/browser/extensions/api/tabs/tabs_event_router.h b/chrome/browser/extensions/api/tabs/tabs_event_router.h
index c8a795b..3dd45a2 100644
--- a/chrome/browser/extensions/api/tabs/tabs_event_router.h
+++ b/chrome/browser/extensions/api/tabs/tabs_event_router.h
@@ -63,7 +63,7 @@
void TabPinnedStateChanged(TabStripModel* tab_strip_model,
content::WebContents* contents,
int index) override;
- void TabGroupedStateChanged(base::Optional<tab_groups::TabGroupId> group,
+ void TabGroupedStateChanged(absl::optional<tab_groups::TabGroupId> group,
content::WebContents* contents,
int index) override;
diff --git a/chrome/browser/extensions/api/tabs/tabs_test.cc b/chrome/browser/extensions/api/tabs/tabs_test.cc
index 4e912ae..0ccbbee 100644
--- a/chrome/browser/extensions/api/tabs/tabs_test.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_test.cc
@@ -2283,7 +2283,7 @@
// The url to use in chrome.windows.create().
std::string url;
// If set, its value will be used to specify |setSelfAsOpener|.
- base::Optional<bool> set_self_as_opener;
+ absl::optional<bool> set_self_as_opener;
// The origin we expect the new tab to be in, opaque origins will be "null".
std::string expected_origin_str;
} test_cases[] = {
@@ -2293,20 +2293,20 @@
// origin.
{url::kAboutBlankURL, true, extension_origin_str},
{url::kAboutBlankURL, false, "null"},
- {url::kAboutBlankURL, base::nullopt, "null"},
+ {url::kAboutBlankURL, absl::nullopt, "null"},
// data:... URLs.
// With opener relationship or not, "data:..." URLs always gets unique
// origin, so origin will always be "null" in these cases.
{kDataURL, true, "null"},
{kDataURL, false, "null"},
- {kDataURL, base::nullopt, "null"},
+ {kDataURL, absl::nullopt, "null"},
// chrome-extension:// URLs.
// These always get extension origin.
{extension_url_str, true, extension_origin_str},
{extension_url_str, false, extension_origin_str},
- {extension_url_str, base::nullopt, extension_origin_str},
+ {extension_url_str, absl::nullopt, extension_origin_str},
};
auto run_test_case = [&web_contents](const TestCase& test_case) {
diff --git a/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc b/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc
index 8fc2612e..b5afc30c 100644
--- a/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc
+++ b/chrome/browser/extensions/api/vpn_provider/vpn_provider_apitest.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
@@ -30,6 +29,7 @@
#include "extensions/common/extension.h"
#include "extensions/test/result_catcher.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
using testing::_;
@@ -187,7 +187,7 @@
void TriggerInternalRemove() {
NetworkHandler::Get()->network_configuration_handler()->RemoveConfiguration(
- GetSingleServicePath(), /*remove_confirmer=*/base::nullopt,
+ GetSingleServicePath(), /*remove_confirmer=*/absl::nullopt,
base::DoNothing(), base::BindOnce(DoNothingFailureCallback));
}
diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
index e51d5357..dd89ad3 100644
--- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
@@ -489,7 +489,7 @@
TEST(ExtensionWebRequestHelpersTest, TestMergeCancelOfResponses) {
EventResponseDeltas deltas;
- base::Optional<extensions::ExtensionId> canceled_by_extension;
+ absl::optional<extensions::ExtensionId> canceled_by_extension;
// Single event that does not cancel.
{
@@ -845,7 +845,7 @@
modify_headers_action.request_headers_to_modify = {
DNRRequestAction::HeaderInfo(
"key5", api::declarative_net_request::HEADER_OPERATION_REMOVE,
- base::nullopt)};
+ absl::nullopt)};
info.dnr_actions = std::vector<DNRRequestAction>();
info.dnr_actions->push_back(std::move(modify_headers_action));
@@ -936,14 +936,14 @@
"dnr_action_1"),
DNRRequestAction::HeaderInfo(
"key3", api::declarative_net_request::HEADER_OPERATION_REMOVE,
- base::nullopt)};
+ absl::nullopt)};
DNRRequestAction action_2 =
CreateRequestActionForTesting(DNRRequestAction::Type::MODIFY_HEADERS);
action_2.request_headers_to_modify = {
DNRRequestAction::HeaderInfo(
"referer", api::declarative_net_request::HEADER_OPERATION_REMOVE,
- base::nullopt),
+ absl::nullopt),
DNRRequestAction::HeaderInfo(
"cookie", api::declarative_net_request::HEADER_OPERATION_SET,
"dnr_action_2"),
@@ -1456,7 +1456,7 @@
modify_headers_action.response_headers_to_modify = {
DNRRequestAction::HeaderInfo(
"key3", api::declarative_net_request::HEADER_OPERATION_REMOVE,
- base::nullopt)};
+ absl::nullopt)};
info.dnr_actions = std::vector<DNRRequestAction>();
info.dnr_actions->push_back(std::move(modify_headers_action));
@@ -1697,9 +1697,9 @@
"dnr_action_1"),
HeaderInfo("key7", api::declarative_net_request::HEADER_OPERATION_REMOVE,
- base::nullopt),
+ absl::nullopt),
HeaderInfo("key8", api::declarative_net_request::HEADER_OPERATION_REMOVE,
- base::nullopt),
+ absl::nullopt),
HeaderInfo("same_ext_key",
api::declarative_net_request::HEADER_OPERATION_SET,
@@ -1721,14 +1721,14 @@
HeaderInfo("key2", api::declarative_net_request::HEADER_OPERATION_SET,
"dnr_action_3"),
HeaderInfo("key3", api::declarative_net_request::HEADER_OPERATION_REMOVE,
- base::nullopt),
+ absl::nullopt),
HeaderInfo("key4", api::declarative_net_request::HEADER_OPERATION_APPEND,
"dnr_action_3"),
HeaderInfo("key5", api::declarative_net_request::HEADER_OPERATION_SET,
"dnr_action_3"),
HeaderInfo("key6", api::declarative_net_request::HEADER_OPERATION_REMOVE,
- base::nullopt),
+ absl::nullopt),
HeaderInfo("key7", api::declarative_net_request::HEADER_OPERATION_APPEND,
"dnr_action_3"),
@@ -1828,10 +1828,10 @@
"dnr_action_1"),
HeaderInfo("set-cookie",
api::declarative_net_request::HEADER_OPERATION_REMOVE,
- base::nullopt),
+ absl::nullopt),
HeaderInfo("warning",
api::declarative_net_request::HEADER_OPERATION_REMOVE,
- base::nullopt)};
+ absl::nullopt)};
DNRRequestAction action_2 =
CreateRequestActionForTesting(DNRRequestAction::Type::MODIFY_HEADERS);
diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
index e93b726..ca978f0 100644
--- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
@@ -12,7 +12,6 @@
#include "base/json/json_reader.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
@@ -122,6 +121,7 @@
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/fetch_api.mojom.h"
#include "services/network/test/test_url_loader_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/base/ui_base_features.h"
#include "url/origin.h"
@@ -192,7 +192,7 @@
DCHECK_EQ(NOTIFICATION_EXTENSION_TEST_MESSAGE, type);
const auto message =
content::Details<std::pair<std::string, bool*>>(details)->first;
- base::Optional<base::Value> command = base::JSONReader::Read(message);
+ absl::optional<base::Value> command = base::JSONReader::Read(message);
if (command && command->is_dict()) { // Check the message decoded from JSON
base::Value* data = command->FindDictKey("navigate");
if (data && data->is_dict()) {
@@ -1645,7 +1645,7 @@
// and given content.
auto make_browser_request =
[](network::mojom::URLLoaderFactory* url_loader_factory, const GURL& url,
- const base::Optional<std::string>& expected_response,
+ const absl::optional<std::string>& expected_response,
int expected_net_code) {
auto request = std::make_unique<network::ResourceRequest>();
request->url = url;
@@ -1837,7 +1837,7 @@
frame->GetProcess()->GetBrowserContext(), frame,
frame->GetProcess()->GetID(),
content::ContentBrowserClient::URLLoaderFactoryType::kDocumentSubResource,
- base::nullopt, ukm::kInvalidSourceIdObj, &pending_receiver, nullptr));
+ absl::nullopt, ukm::kInvalidSourceIdObj, &pending_receiver, nullptr));
temp_web_contents.reset();
auto params = network::mojom::URLLoaderFactoryParams::New();
params->process_id = 0;
@@ -2627,7 +2627,7 @@
}
void RegisterServiceWorker(const std::string& worker_path,
- const base::Optional<std::string>& scope) {
+ const absl::optional<std::string>& scope) {
GURL url = embedded_test_server()->GetURL(
"/service_worker/create_service_worker.html");
EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), url));
@@ -2648,7 +2648,7 @@
InstallRequestHeaderModifyingExtension();
// Register a service worker and navigate to a page it controls.
- RegisterServiceWorker(worker_script_name, base::nullopt);
+ RegisterServiceWorker(worker_script_name, absl::nullopt);
EXPECT_TRUE(ui_test_utils::NavigateToURL(
browser(), embedded_test_server()->GetURL(
"/service_worker/fetch_from_page.html")));
@@ -4112,7 +4112,7 @@
EXPECT_EQ(redirected_url, web_contents->GetLastCommittedURL());
// Check the parameters passed to the URLLoaderFactory.
- base::Optional<network::ResourceRequest> resource_request =
+ absl::optional<network::ResourceRequest> resource_request =
monitor.GetRequestInfo(redirected_url);
ASSERT_TRUE(resource_request.has_value());
EXPECT_TRUE(resource_request->site_for_cookies.IsFirstParty(redirected_url));
@@ -4161,7 +4161,7 @@
ASSERT_EQ(redirected_url, all_frames[1]->GetLastCommittedURL());
// Check the parameters passed to the URLLoaderFactory.
- base::Optional<network::ResourceRequest> resource_request =
+ absl::optional<network::ResourceRequest> resource_request =
monitor.GetRequestInfo(redirected_url);
ASSERT_TRUE(resource_request.has_value());
EXPECT_TRUE(
diff --git a/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
index 4a95a87..238b782c 100644
--- a/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc
@@ -154,7 +154,7 @@
permission_helper_, permissionless_extension_->id(), url,
-1, // No tab id.
false, // crosses_incognito
- WebRequestPermissions::DO_NOT_CHECK_HOST, base::nullopt,
+ WebRequestPermissions::DO_NOT_CHECK_HOST, absl::nullopt,
kWebRequestType));
EXPECT_EQ(PermissionsData::PageAccess::kDenied,
WebRequestPermissions::CanExtensionAccessURL(
@@ -162,14 +162,14 @@
-1, // No tab id.
false, // crosses_incognito
WebRequestPermissions::REQUIRE_HOST_PERMISSION_FOR_URL,
- base::nullopt, kWebRequestType));
+ absl::nullopt, kWebRequestType));
EXPECT_EQ(PermissionsData::PageAccess::kAllowed,
WebRequestPermissions::CanExtensionAccessURL(
permission_helper_, com_extension_->id(), url,
-1, // No tab id.
false, // crosses_incognito
WebRequestPermissions::REQUIRE_HOST_PERMISSION_FOR_URL,
- base::nullopt, kWebRequestType));
+ absl::nullopt, kWebRequestType));
EXPECT_EQ(
PermissionsData::PageAccess::kAllowed,
WebRequestPermissions::CanExtensionAccessURL(
@@ -177,16 +177,16 @@
-1, // No tab id.
false, // crosses_incognito
WebRequestPermissions::REQUIRE_HOST_PERMISSION_FOR_URL_AND_INITIATOR,
- base::nullopt, kWebRequestType));
+ absl::nullopt, kWebRequestType));
EXPECT_EQ(PermissionsData::PageAccess::kDenied,
WebRequestPermissions::CanExtensionAccessURL(
permission_helper_, com_extension_->id(), url,
-1, // No tab id.
false, // crosses_incognito
- WebRequestPermissions::REQUIRE_ALL_URLS, base::nullopt,
+ WebRequestPermissions::REQUIRE_ALL_URLS, absl::nullopt,
kWebRequestType));
- base::Optional<url::Origin> initiator(
+ absl::optional<url::Origin> initiator(
url::Origin::Create(GURL("http://www.example.org")));
EXPECT_EQ(PermissionsData::PageAccess::kAllowed,
@@ -248,7 +248,7 @@
-1, // No tab id.
false, // crosses_incognito
WebRequestPermissions::REQUIRE_HOST_PERMISSION_FOR_URL,
- base::nullopt, kWebRequestType));
+ absl::nullopt, kWebRequestType));
chromeos::ScopedTestPublicSessionLoginState login_state;
@@ -260,14 +260,14 @@
-1, // No tab id.
false, // crosses_incognito
WebRequestPermissions::REQUIRE_HOST_PERMISSION_FOR_URL,
- base::nullopt, kWebRequestType));
+ absl::nullopt, kWebRequestType));
EXPECT_EQ(PermissionsData::PageAccess::kAllowed,
WebRequestPermissions::CanExtensionAccessURL(
permission_helper_, com_policy_extension_->id(), org_url,
-1, // No tab id.
false, // crosses_incognito
- WebRequestPermissions::REQUIRE_ALL_URLS, base::nullopt,
+ WebRequestPermissions::REQUIRE_ALL_URLS, absl::nullopt,
kWebRequestType));
// Make sure that chrome:// URLs cannot be accessed.
@@ -279,6 +279,6 @@
-1, // No tab id.
false, // crosses_incognito
WebRequestPermissions::REQUIRE_HOST_PERMISSION_FOR_URL,
- base::nullopt, kWebRequestType));
+ absl::nullopt, kWebRequestType));
#endif
}
diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
index 9fe9232..dafc0a9 100644
--- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
+++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc
@@ -202,7 +202,7 @@
}
}
if (raw_source_id.empty()) {
- CalculateHMACAndReply(base::nullopt);
+ CalculateHMACAndReply(absl::nullopt);
return;
}
GetAudioSystem()->GetAssociatedOutputDeviceID(
@@ -213,7 +213,7 @@
}
void WebrtcAudioPrivateGetAssociatedSinkFunction::CalculateHMACAndReply(
- const base::Optional<std::string>& raw_sink_id) {
+ const absl::optional<std::string>& raw_sink_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!raw_sink_id || !raw_sink_id->empty());
// If no |raw_sink_id| is provided, the default device is used.
diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
index 69ccc11..a994de2 100644
--- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
+++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.h
@@ -117,7 +117,7 @@
media::AudioDeviceDescriptions source_devices);
// Receives the raw sink ID, calculates HMAC and calls Reply().
- void CalculateHMACAndReply(const base::Optional<std::string>& raw_sink_id);
+ void CalculateHMACAndReply(const absl::optional<std::string>& raw_sink_id);
// Receives the associated sink ID as HMAC and sends the response.
void Reply(const std::string& hmac);
diff --git a/chrome/browser/extensions/api/webstore_private/extension_install_status_unittest.cc b/chrome/browser/extensions/api/webstore_private/extension_install_status_unittest.cc
index ae9f5ce9..194b7fe 100644
--- a/chrome/browser/extensions/api/webstore_private/extension_install_status_unittest.cc
+++ b/chrome/browser/extensions/api/webstore_private/extension_install_status_unittest.cc
@@ -61,7 +61,7 @@
}
void SetExtensionSettings(const std::string& settings_string) {
- base::Optional<base::Value> settings =
+ absl::optional<base::Value> settings =
base::JSONReader::Read(settings_string);
ASSERT_TRUE(settings);
SetPolicy(pref_names::kExtensionManagement,
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
index dcc8090..a0ff5f8 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc
@@ -473,7 +473,7 @@
// Create another embedded test server to avoid starting the same one twice.
std::unique_ptr<net::EmbeddedTestServer> embedded_test_server_;
chromeos::LoggedInUserMixin logged_in_user_mixin_;
- base::Optional<NextDialogAction> next_dialog_action_;
+ absl::optional<NextDialogAction> next_dialog_action_;
};
// Tests install for a child when parent permission is granted.
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_unittest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_unittest.cc
index bd81fca..b010ac4 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_unittest.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_unittest.cc
@@ -108,7 +108,7 @@
void SetExtensionSettings(const std::string& settings_string,
TestingProfile* profile) {
- base::Optional<base::Value> settings =
+ absl::optional<base::Value> settings =
base::JSONReader::Read(settings_string);
ASSERT_TRUE(settings.has_value());
profile->GetTestingPrefService()->SetManagedPref(
@@ -339,7 +339,7 @@
}
void SetExtensionSettings(const std::string& settings_string) {
- base::Optional<base::Value> settings =
+ absl::optional<base::Value> settings =
base::JSONReader::Read(settings_string);
ASSERT_TRUE(settings);
profile()->GetTestingPrefService()->SetManagedPref(
diff --git a/chrome/browser/extensions/background_header_browsertest.cc b/chrome/browser/extensions/background_header_browsertest.cc
index 334717e..95b1352 100644
--- a/chrome/browser/extensions/background_header_browsertest.cc
+++ b/chrome/browser/extensions/background_header_browsertest.cc
@@ -69,7 +69,7 @@
content::JsReplace("executeFetch($1);", url));
std::string json;
EXPECT_TRUE(message_queue.WaitForMessage(&json));
- base::Optional<base::Value> value =
+ absl::optional<base::Value> value =
base::JSONReader::Read(json, base::JSON_ALLOW_TRAILING_COMMAS);
std::string result;
if (!value) {
diff --git a/chrome/browser/extensions/background_xhr_browsertest.cc b/chrome/browser/extensions/background_xhr_browsertest.cc
index 2ed6bc6..569313f 100644
--- a/chrome/browser/extensions/background_xhr_browsertest.cc
+++ b/chrome/browser/extensions/background_xhr_browsertest.cc
@@ -131,7 +131,7 @@
content::JsReplace("executeFetch($1);", url));
std::string json;
EXPECT_TRUE(message_queue.WaitForMessage(&json));
- base::Optional<base::Value> value =
+ absl::optional<base::Value> value =
base::JSONReader::Read(json, base::JSON_ALLOW_TRAILING_COMMAS);
std::string result;
EXPECT_TRUE(value->GetAsString(&result));
diff --git a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
index aafbd94..2c9b9e9 100644
--- a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
+++ b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
@@ -421,8 +421,8 @@
if (is_guest &&
url_request_util::AllowSpecialCaseExtensionURLInGuest(
extension, url_path.length() > 1
- ? base::make_optional<base::StringPiece>(url_path)
- : base::nullopt)) {
+ ? absl::make_optional<base::StringPiece>(url_path)
+ : absl::nullopt)) {
return true;
}
diff --git a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.h b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.h
index 7ecab5c..eefa114 100644
--- a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.h
+++ b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.h
@@ -9,13 +9,13 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/chrome_content_browser_client_parts.h"
#include "components/download/public/common/quarantine_connection.h"
#include "content/public/browser/browser_or_resource_context.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "services/network/public/mojom/network_context.mojom-forward.h"
#include "services/network/public/mojom/url_loader_factory.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
namespace content {
diff --git a/chrome/browser/extensions/chrome_content_verifier_delegate.cc b/chrome/browser/extensions/chrome_content_verifier_delegate.cc
index fa008ff..564fd0f 100644
--- a/chrome/browser/extensions/chrome_content_verifier_delegate.cc
+++ b/chrome/browser/extensions/chrome_content_verifier_delegate.cc
@@ -49,10 +49,10 @@
namespace {
-base::Optional<ChromeContentVerifierDelegate::VerifyInfo::Mode>&
+absl::optional<ChromeContentVerifierDelegate::VerifyInfo::Mode>&
GetModeForTesting() {
static base::NoDestructor<
- base::Optional<ChromeContentVerifierDelegate::VerifyInfo::Mode>>
+ absl::optional<ChromeContentVerifierDelegate::VerifyInfo::Mode>>
testing_mode;
return *testing_mode;
}
@@ -132,7 +132,7 @@
// static
void ChromeContentVerifierDelegate::SetDefaultModeForTesting(
- base::Optional<VerifyInfo::Mode> mode) {
+ absl::optional<VerifyInfo::Mode> mode) {
DCHECK(!GetModeForTesting() || !mode)
<< "Verification mode already overridden, unset it first.";
GetModeForTesting() = mode;
diff --git a/chrome/browser/extensions/chrome_content_verifier_delegate.h b/chrome/browser/extensions/chrome_content_verifier_delegate.h
index 8c99a698..351a04e 100644
--- a/chrome/browser/extensions/chrome_content_verifier_delegate.h
+++ b/chrome/browser/extensions/chrome_content_verifier_delegate.h
@@ -11,8 +11,8 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
#include "extensions/browser/content_verifier_delegate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class BrowserContext;
@@ -65,7 +65,7 @@
};
static VerifyInfo::Mode GetDefaultMode();
- static void SetDefaultModeForTesting(base::Optional<VerifyInfo::Mode> mode);
+ static void SetDefaultModeForTesting(absl::optional<VerifyInfo::Mode> mode);
explicit ChromeContentVerifierDelegate(content::BrowserContext* context);
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc
index 3da82c8..bd6c9c3 100644
--- a/chrome/browser/extensions/chrome_extensions_browser_client.cc
+++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc
@@ -9,7 +9,6 @@
#include "base/command_line.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/version.h"
#include "build/build_config.h"
@@ -67,6 +66,7 @@
#include "extensions/browser/url_request_util.h"
#include "extensions/common/extension_urls.h"
#include "extensions/common/features/feature_channel.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_switches.h"
@@ -452,7 +452,7 @@
scoped_refptr<update_client::UpdateClient>
ChromeExtensionsBrowserClient::CreateUpdateClient(
content::BrowserContext* context) {
- base::Optional<GURL> override_url;
+ absl::optional<GURL> override_url;
GURL update_url = extension_urls::GetWebstoreUpdateUrl();
if (update_url != extension_urls::GetDefaultWebstoreUpdateUrl()) {
if (update_url.path() == kCrxUrlPath) {
diff --git a/chrome/browser/extensions/chrome_test_extension_loader.h b/chrome/browser/extensions/chrome_test_extension_loader.h
index 57109b78..5383c40 100644
--- a/chrome/browser/extensions/chrome_test_extension_loader.h
+++ b/chrome/browser/extensions/chrome_test_extension_loader.h
@@ -10,10 +10,10 @@
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest.h"
#include "extensions/common/mojom/manifest.mojom-shared.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class FilePath;
@@ -129,7 +129,7 @@
std::string expected_id_;
// An install param to use with the loaded extension.
- base::Optional<std::string> install_param_;
+ absl::optional<std::string> install_param_;
// Any creation flags (see Extension::InitFromValueFlags) to use for the
// extension. Only used for crx installs.
@@ -155,10 +155,10 @@
bool grant_permissions_ = true;
// Whether or not to allow file access by default to the extension.
- base::Optional<bool> allow_file_access_;
+ absl::optional<bool> allow_file_access_;
// Whether or not to allow incognito access by default to the extension.
- base::Optional<bool> allow_incognito_access_;
+ absl::optional<bool> allow_incognito_access_;
// Whether or not to ignore manifest warnings during installation.
bool ignore_manifest_warnings_ = false;
@@ -170,7 +170,7 @@
// If unspecified, this will default to true if there is at least one existent
// renderer and false otherwise (this roughly maps to "true in browser tests,
// false in unit tests").
- base::Optional<bool> wait_for_renderers_;
+ absl::optional<bool> wait_for_renderers_;
DISALLOW_COPY_AND_ASSIGN(ChromeTestExtensionLoader);
};
diff --git a/chrome/browser/extensions/chrome_url_request_util.cc b/chrome/browser/extensions/chrome_url_request_util.cc
index 8447586..9e1269d 100644
--- a/chrome/browser/extensions/chrome_url_request_util.cc
+++ b/chrome/browser/extensions/chrome_url_request_util.cc
@@ -103,7 +103,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) override {
+ const absl::optional<GURL>& new_url) override {
NOTREACHED() << "No redirects for local file loads.";
}
// Current implementation reads all resource data at start of resource
diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc
index 7006f7e..95d3448 100644
--- a/chrome/browser/extensions/component_loader.cc
+++ b/chrome/browser/extensions/component_loader.cc
@@ -656,7 +656,7 @@
manifest_filename, true),
base::BindOnce(&ComponentLoader::FinishAddComponentFromDir,
weak_factory_.GetWeakPtr(), root_directory, extension_id,
- base::nullopt, base::nullopt, std::move(done_cb)));
+ absl::nullopt, absl::nullopt, std::move(done_cb)));
}
void ComponentLoader::AddWithNameAndDescriptionFromDir(
@@ -699,8 +699,8 @@
void ComponentLoader::FinishAddComponentFromDir(
const base::FilePath& root_directory,
const char* extension_id,
- const base::Optional<std::string>& name_string,
- const base::Optional<std::string>& description_string,
+ const absl::optional<std::string>& name_string,
+ const absl::optional<std::string>& description_string,
base::OnceClosure done_cb,
std::unique_ptr<base::DictionaryValue> manifest) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h
index 88782f2..a00e537 100644
--- a/chrome/browser/extensions/component_loader.h
+++ b/chrome/browser/extensions/component_loader.h
@@ -17,11 +17,11 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/common/buildflags.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -209,8 +209,8 @@
void FinishAddComponentFromDir(
const base::FilePath& root_directory,
const char* extension_id,
- const base::Optional<std::string>& name_string,
- const base::Optional<std::string>& description_string,
+ const absl::optional<std::string>& name_string,
+ const absl::optional<std::string>& description_string,
base::OnceClosure done_cb,
std::unique_ptr<base::DictionaryValue> manifest);
diff --git a/chrome/browser/extensions/content_verifier_browsertest.cc b/chrome/browser/extensions/content_verifier_browsertest.cc
index 63a68c6..16f60f7 100644
--- a/chrome/browser/extensions/content_verifier_browsertest.cc
+++ b/chrome/browser/extensions/content_verifier_browsertest.cc
@@ -69,7 +69,7 @@
};
void ExtensionUpdateComplete(base::OnceClosure callback,
- const base::Optional<CrxInstallError>& error) {
+ const absl::optional<CrxInstallError>& error) {
// Expect success (no CrxInstallError). Assert on an error to put the error
// message into the test log to aid debugging.
ASSERT_FALSE(error.has_value()) << error->message();
@@ -98,7 +98,7 @@
void TearDown() override {
ExtensionBrowserTest::TearDown();
- ChromeContentVerifierDelegate::SetDefaultModeForTesting(base::nullopt);
+ ChromeContentVerifierDelegate::SetDefaultModeForTesting(absl::nullopt);
}
bool ShouldEnableContentVerification() override { return true; }
diff --git a/chrome/browser/extensions/content_verifier_hash_fetch_behavior_browsertest.cc b/chrome/browser/extensions/content_verifier_hash_fetch_behavior_browsertest.cc
index 445a54f..daf0d04 100644
--- a/chrome/browser/extensions/content_verifier_hash_fetch_behavior_browsertest.cc
+++ b/chrome/browser/extensions/content_verifier_hash_fetch_behavior_browsertest.cc
@@ -73,7 +73,7 @@
void TearDown() override {
ExtensionBrowserTest::TearDown();
- ChromeContentVerifierDelegate::SetDefaultModeForTesting(base::nullopt);
+ ChromeContentVerifierDelegate::SetDefaultModeForTesting(absl::nullopt);
}
void TearDownOnMainThread() override {
@@ -243,7 +243,7 @@
ComputedHashes::Status computed_hashes_status;
return ComputedHashes::CreateFromFile(
file_util::GetComputedHashesPath(info_->extension_root),
- &computed_hashes_status) != base::nullopt;
+ &computed_hashes_status) != absl::nullopt;
}
bool HasValidVerifiedContents() {
diff --git a/chrome/browser/extensions/content_verifier_test_utils.h b/chrome/browser/extensions/content_verifier_test_utils.h
index 34fe20d..782cb11 100644
--- a/chrome/browser/extensions/content_verifier_test_utils.h
+++ b/chrome/browser/extensions/content_verifier_test_utils.h
@@ -14,7 +14,6 @@
#include "base/callback_helpers.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "chrome/browser/extensions/policy_extension_reinstaller.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/content_verifier.h"
@@ -22,6 +21,7 @@
#include "extensions/browser/external_provider_interface.h"
#include "extensions/browser/management_policy.h"
#include "extensions/browser/updater/extension_downloader_test_delegate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
@@ -99,7 +99,7 @@
private:
std::vector<base::TimeDelta> calls_;
- base::Optional<base::OnceClosure> saved_callback_;
+ absl::optional<base::OnceClosure> saved_callback_;
PolicyExtensionReinstaller::ReinstallCallback action_;
DISALLOW_COPY_AND_ASSIGN(DelayTracker);
diff --git a/chrome/browser/extensions/corb_and_cors_extension_browsertest.cc b/chrome/browser/extensions/corb_and_cors_extension_browsertest.cc
index 83d7fe4..3bb5932 100644
--- a/chrome/browser/extensions/corb_and_cors_extension_browsertest.cc
+++ b/chrome/browser/extensions/corb_and_cors_extension_browsertest.cc
@@ -109,8 +109,8 @@
std::string CreateFetchScript(
const GURL& resource,
- base::Optional<base::Value> request_init = base::nullopt) {
- CHECK(request_init == base::nullopt || request_init->is_dict());
+ absl::optional<base::Value> request_init = absl::nullopt) {
+ CHECK(request_init == absl::nullopt || request_init->is_dict());
const char kFetchScriptTemplate[] = R"(
fetch($1, $2)
@@ -127,7 +127,7 @@
std::string PopString(content::DOMMessageQueue* message_queue) {
std::string json;
EXPECT_TRUE(message_queue->WaitForMessage(&json));
- base::Optional<base::Value> value =
+ absl::optional<base::Value> value =
base::JSONReader::Read(json, base::JSON_ALLOW_TRAILING_COMMAS);
std::string result;
EXPECT_TRUE(value->GetAsString(&result));
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index ea397a6..07b53d1f 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -326,7 +326,7 @@
{} /* ruleset_install_prefs */);
}
-base::Optional<CrxInstallError> CrxInstaller::CheckExpectations(
+absl::optional<CrxInstallError> CrxInstaller::CheckExpectations(
const Extension* extension) {
DCHECK(shared_file_task_runner_->RunsTasksInCurrentSequence());
@@ -351,10 +351,10 @@
base::ASCIIToUTF16(extension->version().GetString())));
}
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<CrxInstallError> CrxInstaller::AllowInstall(
+absl::optional<CrxInstallError> CrxInstaller::AllowInstall(
const Extension* extension) {
DCHECK(shared_file_task_runner_->RunsTasksInCurrentSequence());
@@ -409,7 +409,7 @@
// SandboxedUnpacker sets extension->location.
if (extension->is_theme() || extension->from_bookmark() ||
Manifest::IsExternalLocation(install_source_)) {
- return base::nullopt;
+ return absl::nullopt;
}
if (!extensions_enabled_) {
@@ -487,7 +487,7 @@
}
}
- return base::nullopt;
+ return absl::nullopt;
}
void CrxInstaller::ShouldComputeHashesOnUI(
@@ -567,7 +567,7 @@
unpacked_extension_root_ = extension_dir;
// Check whether the crx matches the set expectations.
- base::Optional<CrxInstallError> expectations_error =
+ absl::optional<CrxInstallError> expectations_error =
CheckExpectations(extension.get());
if (expectations_error) {
DCHECK_NE(CrxInstallErrorType::NONE, expectations_error->type());
@@ -592,7 +592,7 @@
}
}
- base::Optional<CrxInstallError> error = AllowInstall(extension.get());
+ absl::optional<CrxInstallError> error = AllowInstall(extension.get());
if (error) {
DCHECK_NE(CrxInstallErrorType::NONE, error->type());
ReportFailureFromSharedFileThread(*error);
@@ -1057,7 +1057,7 @@
service_weak_->OnExtensionInstalled(extension(), page_ordinal_,
install_flags_, ruleset_install_prefs_);
- NotifyCrxInstallComplete(base::nullopt);
+ NotifyCrxInstallComplete(absl::nullopt);
}
void CrxInstaller::ReportInstallationStage(InstallationStage stage) {
@@ -1089,7 +1089,7 @@
}
void CrxInstaller::NotifyCrxInstallComplete(
- const base::Optional<CrxInstallError>& error) {
+ const absl::optional<CrxInstallError>& error) {
ReportInstallationStage(InstallationStage::kComplete);
const std::string extension_id =
expected_id_.empty() && extension() ? extension()->id() : expected_id_;
diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h
index 4e41be4..c337780 100644
--- a/chrome/browser/extensions/crx_installer.h
+++ b/chrome/browser/extensions/crx_installer.h
@@ -15,7 +15,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/version.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -29,6 +28,7 @@
#include "extensions/browser/sandboxed_unpacker.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class ExtensionServiceTest;
class SkBitmap;
@@ -276,11 +276,11 @@
// Called after OnUnpackSuccess check to see whether the install expectations
// are met and the install process should continue.
- base::Optional<CrxInstallError> CheckExpectations(const Extension* extension);
+ absl::optional<CrxInstallError> CheckExpectations(const Extension* extension);
// Called after OnUnpackSuccess as a last check to see whether the install
// should complete.
- base::Optional<CrxInstallError> AllowInstall(const Extension* extension);
+ absl::optional<CrxInstallError> AllowInstall(const Extension* extension);
// To check whether we need to compute hashes or not, we have to make a query
// to ContentVerifier, and that should be done on the UI thread.
@@ -332,7 +332,7 @@
// Always report from the UI thread.
void ReportInstallationStage(InstallationStage stage);
void NotifyCrxInstallBegin();
- void NotifyCrxInstallComplete(const base::Optional<CrxInstallError>& error);
+ void NotifyCrxInstallComplete(const absl::optional<CrxInstallError>& error);
// Deletes temporary directory and crx file if needed.
void CleanupTempFiles();
diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc
index 3a4759e4..77ee1f97 100644
--- a/chrome/browser/extensions/crx_installer_browsertest.cc
+++ b/chrome/browser/extensions/crx_installer_browsertest.cc
@@ -16,7 +16,6 @@
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -67,6 +66,7 @@
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/switches.h"
#include "extensions/test/test_extension_dir.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h"
@@ -320,7 +320,7 @@
static void InstallerCallback(base::OnceClosure quit_closure,
CrxInstaller::InstallerResultCallback callback,
- const base::Optional<CrxInstallError>& error) {
+ const absl::optional<CrxInstallError>& error) {
if (!callback.is_null())
std::move(callback).Run(error);
std::move(quit_closure).Run();
@@ -573,8 +573,8 @@
GrantScopes_WithCallback) {
EXPECT_NO_FATAL_FAILURE(CheckHasEmptyScopesAfterInstall(
"browsertest/scopes",
- base::BindOnce([](const base::Optional<CrxInstallError>& error) {
- EXPECT_EQ(base::nullopt, error);
+ base::BindOnce([](const absl::optional<CrxInstallError>& error) {
+ EXPECT_EQ(absl::nullopt, error);
}),
true));
}
@@ -589,8 +589,8 @@
DoNotGrantScopes_WithCallback) {
EXPECT_NO_FATAL_FAILURE(CheckHasEmptyScopesAfterInstall(
"browsertest/scopes",
- base::BindOnce([](const base::Optional<CrxInstallError>& error) {
- EXPECT_EQ(base::nullopt, error);
+ base::BindOnce([](const absl::optional<CrxInstallError>& error) {
+ EXPECT_EQ(absl::nullopt, error);
}),
false));
}
@@ -767,8 +767,8 @@
RunCrxInstaller(
approval.get(), mock_prompt->CreatePrompt(),
- base::BindOnce([](const base::Optional<CrxInstallError>& error) {
- EXPECT_EQ(base::nullopt, error);
+ base::BindOnce([](const absl::optional<CrxInstallError>& error) {
+ EXPECT_EQ(absl::nullopt, error);
}),
test_data_dir_.AppendASCII("crx_installer/v1.crx"));
@@ -790,8 +790,8 @@
const std::string public_key = "123456";
RunCrxInstallerFromUnpackedDirectory(
mock_prompt->CreatePrompt(),
- base::BindOnce([](const base::Optional<CrxInstallError>& error) {
- ASSERT_NE(base::nullopt, error);
+ base::BindOnce([](const absl::optional<CrxInstallError>& error) {
+ ASSERT_NE(absl::nullopt, error);
ASSERT_EQ(CrxInstallErrorType::SANDBOXED_UNPACKER_FAILURE,
error->type());
EXPECT_EQ(SandboxedUnpackerFailureReason::DIRECTORY_MOVE_FAILED,
@@ -815,8 +815,8 @@
const std::string public_key = "123456";
RunCrxInstallerFromUnpackedDirectory(
mock_prompt->CreatePrompt(),
- base::BindOnce([](const base::Optional<CrxInstallError>& error) {
- ASSERT_NE(base::nullopt, error);
+ base::BindOnce([](const absl::optional<CrxInstallError>& error) {
+ ASSERT_NE(absl::nullopt, error);
ASSERT_EQ(CrxInstallErrorType::SANDBOXED_UNPACKER_FAILURE,
error->type());
EXPECT_EQ(SandboxedUnpackerFailureReason::UNPACKER_CLIENT_FAILED,
@@ -846,8 +846,8 @@
const std::string public_key = "123456";
RunCrxInstallerFromUnpackedDirectory(
mock_prompt->CreatePrompt(),
- base::BindOnce([](const base::Optional<CrxInstallError>& error) {
- ASSERT_NE(base::nullopt, error);
+ base::BindOnce([](const absl::optional<CrxInstallError>& error) {
+ ASSERT_NE(absl::nullopt, error);
ASSERT_EQ(CrxInstallErrorType::SANDBOXED_UNPACKER_FAILURE,
error->type());
EXPECT_EQ(SandboxedUnpackerFailureReason::INVALID_MANIFEST,
@@ -880,8 +880,8 @@
"y0ury28n8jbN0PnInKKWcxpIXXmNQyC19HBuO3QIeUq9Dqc+7YFQIDAQAB";
RunCrxInstallerFromUnpackedDirectory(
mock_prompt->CreatePrompt(),
- base::BindOnce([](const base::Optional<CrxInstallError>& error) {
- EXPECT_EQ(base::nullopt, error);
+ base::BindOnce([](const absl::optional<CrxInstallError>& error) {
+ EXPECT_EQ(absl::nullopt, error);
}),
std::string(), public_key, temp_dir.GetPath());
@@ -907,8 +907,8 @@
RunUpdateExtension(
mock_prompt->CreatePrompt(), extension_id, public_key,
temp_dir->GetPath(),
- base::BindOnce([](const base::Optional<CrxInstallError>& error) {
- ASSERT_NE(base::nullopt, error);
+ base::BindOnce([](const absl::optional<CrxInstallError>& error) {
+ ASSERT_NE(absl::nullopt, error);
EXPECT_EQ(CrxInstallErrorType::OTHER, error->type());
EXPECT_EQ(CrxInstallErrorDetail::UPDATE_NON_EXISTING_EXTENSION,
error->detail());
@@ -940,8 +940,8 @@
RunUpdateExtension(
mock_prompt->CreatePrompt(), extension_id, public_key,
temp_dir->GetPath(),
- base::BindOnce([](const base::Optional<CrxInstallError>& error) {
- EXPECT_EQ(base::nullopt, error);
+ base::BindOnce([](const absl::optional<CrxInstallError>& error) {
+ EXPECT_EQ(absl::nullopt, error);
}));
EXPECT_TRUE(mock_prompt->did_succeed());
@@ -970,8 +970,8 @@
RunUpdateExtension(
mock_prompt->CreatePrompt(), extension_id, public_key,
temp_dir->GetPath(),
- base::BindOnce([](const base::Optional<CrxInstallError>& error) {
- ASSERT_NE(base::nullopt, error);
+ base::BindOnce([](const absl::optional<CrxInstallError>& error) {
+ ASSERT_NE(absl::nullopt, error);
ASSERT_EQ(CrxInstallErrorType::SANDBOXED_UNPACKER_FAILURE,
error->type());
EXPECT_EQ(SandboxedUnpackerFailureReason::INVALID_MANIFEST,
@@ -992,7 +992,7 @@
EXPECT_EQ(InstallStageTracker::FailureReason::
CRX_INSTALL_ERROR_SANDBOXED_UNPACKER_FAILURE,
installation_failure.failure_reason);
- EXPECT_EQ(base::nullopt, installation_failure.install_error_detail);
+ EXPECT_EQ(absl::nullopt, installation_failure.install_error_detail);
}
IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest,
@@ -1015,8 +1015,8 @@
RunUpdateExtension(
mock_prompt->CreatePrompt(), extension_id, public_key,
temp_dir->GetPath(),
- base::BindOnce([](const base::Optional<CrxInstallError>& error) {
- ASSERT_NE(base::nullopt, error);
+ base::BindOnce([](const absl::optional<CrxInstallError>& error) {
+ ASSERT_NE(absl::nullopt, error);
EXPECT_EQ(CrxInstallErrorType::OTHER, error->type());
EXPECT_EQ(CrxInstallErrorDetail::UNEXPECTED_ID, error->detail());
}));
diff --git a/chrome/browser/extensions/extension_allowlist_unittest.cc b/chrome/browser/extensions/extension_allowlist_unittest.cc
index cc4bc84..a200fa51 100644
--- a/chrome/browser/extensions/extension_allowlist_unittest.cc
+++ b/chrome/browser/extensions/extension_allowlist_unittest.cc
@@ -603,7 +603,7 @@
base::RunLoop run_loop;
installer->set_installer_callback(base::BindOnce(
[](base::OnceClosure quit_closure,
- const base::Optional<CrxInstallError>& error) {
+ const absl::optional<CrxInstallError>& error) {
ASSERT_FALSE(error) << error->message();
std::move(quit_closure).Run();
},
diff --git a/chrome/browser/extensions/extension_context_menu_model.cc b/chrome/browser/extensions/extension_context_menu_model.cc
index ae34e56..2cc0cf3 100644
--- a/chrome/browser/extensions/extension_context_menu_model.cc
+++ b/chrome/browser/extensions/extension_context_menu_model.cc
@@ -62,7 +62,7 @@
namespace {
// Returns true if the given |item| is of the given |type|.
-bool MenuItemMatchesAction(const base::Optional<ActionInfo::Type> action_type,
+bool MenuItemMatchesAction(const absl::optional<ActionInfo::Type> action_type,
const MenuItem* item) {
if (!action_type)
return false;
@@ -366,7 +366,7 @@
if (action_taken_) {
ContextMenuAction action = *action_taken_;
UMA_HISTOGRAM_ENUMERATION("Extensions.ContextMenuAction", action);
- action_taken_ = base::nullopt;
+ action_taken_ = absl::nullopt;
}
}
@@ -376,7 +376,7 @@
ButtonVisibility button_visibility) {
DCHECK(extension);
- base::Optional<ActionInfo::Type> action_type;
+ absl::optional<ActionInfo::Type> action_type;
extension_action_ =
ExtensionActionManager::Get(profile_)->GetExtensionAction(*extension);
if (extension_action_)
diff --git a/chrome/browser/extensions/extension_context_menu_model.h b/chrome/browser/extensions/extension_context_menu_model.h
index 5be0c52d..7a74892 100644
--- a/chrome/browser/extensions/extension_context_menu_model.h
+++ b/chrome/browser/extensions/extension_context_menu_model.h
@@ -9,7 +9,7 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/models/simple_menu_model.h"
class Browser;
@@ -177,7 +177,7 @@
// The action taken by the menu. Has a valid value when the menu is being
// shown.
- base::Optional<ContextMenuAction> action_taken_;
+ absl::optional<ContextMenuAction> action_taken_;
DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModel);
};
diff --git a/chrome/browser/extensions/extension_context_menu_model_unittest.cc b/chrome/browser/extensions/extension_context_menu_model_unittest.cc
index 3be3a8a8..786ed61 100644
--- a/chrome/browser/extensions/extension_context_menu_model_unittest.cc
+++ b/chrome/browser/extensions/extension_context_menu_model_unittest.cc
@@ -640,7 +640,7 @@
}
})",
force_pinned_extension->id().c_str());
- base::Optional<base::Value> parsed = base::JSONReader::Read(json);
+ absl::optional<base::Value> parsed = base::JSONReader::Read(json);
policy::PolicyMap map;
map.Set("ExtensionSettings", policy::POLICY_LEVEL_MANDATORY,
policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_PLATFORM,
@@ -928,7 +928,7 @@
std::string requested_pattern;
// The pattern that's granted to the extension, if any. This may be
// significantly different than the requested pattern.
- base::Optional<std::string> granted_pattern;
+ absl::optional<std::string> granted_pattern;
// The current URL the context menu will be used on.
GURL current_url;
// The set of page access menu entries that should be present.
@@ -936,7 +936,7 @@
// The set of page access menu entries that should be enabled.
std::set<Entries> enabled_entries;
// The selected page access menu entry.
- base::Optional<Entries> selected_entry;
+ absl::optional<Entries> selected_entry;
} test_cases[] = {
// Easy cases: site the extension wants to run on, with or without
// permission granted.
@@ -947,7 +947,7 @@
{kOnClick, kOnSite},
kOnSite},
{"https://google.com/maps",
- base::nullopt,
+ absl::nullopt,
GURL("https://google.com/maps"),
{kOnClick, kOnSite, kOnAllSites},
{kOnClick, kOnSite},
@@ -982,7 +982,7 @@
{kOnClick, kOnSite},
kOnSite},
{"https://*.google.com/*",
- base::nullopt,
+ absl::nullopt,
GURL("https://google.com"),
{kOnClick, kOnSite, kOnAllSites},
{kOnClick, kOnSite},
@@ -1002,7 +1002,7 @@
// On sites the extension doesn't want to run on, no controls should be
// shown...
{"https://*.google.com/*",
- base::nullopt,
+ absl::nullopt,
GURL("https://example.com"),
{}},
// ...unless the extension has access to the page, in which case we should
diff --git a/chrome/browser/extensions/extension_cookies_browsertest.cc b/chrome/browser/extensions/extension_cookies_browsertest.cc
index 7140492a..f45e890b 100644
--- a/chrome/browser/extensions/extension_cookies_browsertest.cc
+++ b/chrome/browser/extensions/extension_cookies_browsertest.cc
@@ -821,7 +821,7 @@
// Read back the response reported by the extension service worker.
std::string json;
EXPECT_TRUE(queue.WaitForMessage(&json));
- base::Optional<base::Value> value =
+ absl::optional<base::Value> value =
base::JSONReader::Read(json, base::JSON_ALLOW_TRAILING_COMMAS);
std::string result;
EXPECT_TRUE(value->GetAsString(&result));
diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
index aea0d58..8c028c9b 100644
--- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
+++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
@@ -128,7 +128,7 @@
extensions::TestExtensionRegistryObserver observer(GetExtensionRegistry());
display_service_->SimulateClick(NotificationHandler::Type::TRANSIENT,
"app.background.crashed." + extension_id,
- base::nullopt, base::nullopt);
+ absl::nullopt, absl::nullopt);
scoped_refptr<const Extension> extension =
observer.WaitForExtensionLoaded();
extensions::BackgroundPageWatcher(GetProcessManager(), extension.get())
diff --git a/chrome/browser/extensions/extension_management_internal.cc b/chrome/browser/extensions/extension_management_internal.cc
index 601e45fc..23935d0 100644
--- a/chrome/browser/extensions/extension_management_internal.cc
+++ b/chrome/browser/extensions/extension_management_internal.cc
@@ -94,7 +94,7 @@
// the webstore.
if (is_policy_installed &&
!extension_urls::IsWebstoreUpdateUrl(GURL(update_url))) {
- const base::Optional<bool> is_update_url_overridden =
+ const absl::optional<bool> is_update_url_overridden =
dict->FindBoolKey(schema_constants::kOverrideUpdateUrl);
if (is_update_url_overridden)
override_update_url = is_update_url_overridden.value();
diff --git a/chrome/browser/extensions/extension_protocols_unittest.cc b/chrome/browser/extensions/extension_protocols_unittest.cc
index 431f2f2..1d88b3b 100644
--- a/chrome/browser/extensions/extension_protocols_unittest.cc
+++ b/chrome/browser/extensions/extension_protocols_unittest.cc
@@ -10,7 +10,6 @@
#include "base/command_line.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
@@ -56,6 +55,7 @@
#include "services/network/test/test_url_loader_client.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/loader/previews_state.h"
#include "third_party/blink/public/common/loader/referrer_utils.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_metrics.h"
@@ -382,7 +382,7 @@
const bool force_incognito_;
const ukm::SourceIdObj test_ukm_id_;
- base::Optional<base::test::ScopedPowerMonitorTestSource>
+ absl::optional<base::test::ScopedPowerMonitorTestSource>
power_monitor_source_;
};
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index d272afc2..65c387c6 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1952,8 +1952,8 @@
void ExtensionService::InstallationFromExternalFileFinished(
const std::string& extension_id,
- const base::Optional<CrxInstallError>& error) {
- if (error != base::nullopt) {
+ const absl::optional<CrxInstallError>& error) {
+ if (error != absl::nullopt) {
// When installation is finished, the extension should not remain in the
// pending extension manager. For successful installations this is done in
// OnExtensionInstalled handler.
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index 6cd67ff..b123bc4 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -17,7 +17,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/blocklist.h"
@@ -49,6 +48,7 @@
#include "extensions/common/extension_id.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if !BUILDFLAG(ENABLE_EXTENSIONS)
#error "Extensions must be enabled"
@@ -607,7 +607,7 @@
// the manager and retried later.
void InstallationFromExternalFileFinished(
const std::string& extension_id,
- const base::Optional<CrxInstallError>& error);
+ const absl::optional<CrxInstallError>& error);
const base::CommandLine* command_line_ = nullptr;
diff --git a/chrome/browser/extensions/extension_service_sync_unittest.cc b/chrome/browser/extensions/extension_service_sync_unittest.cc
index cfb3c0ee..1a9b912 100644
--- a/chrome/browser/extensions/extension_service_sync_unittest.cc
+++ b/chrome/browser/extensions/extension_service_sync_unittest.cc
@@ -125,7 +125,7 @@
// changes for us, but in addition we "apply" these changes by treating
// the FakeSyncChangeProcessor's SyncDataList as a map keyed by extension
// id.
- base::Optional<syncer::ModelError> ProcessSyncChanges(
+ absl::optional<syncer::ModelError> ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) override {
syncer::FakeSyncChangeProcessor::ProcessSyncChanges(from_here, change_list);
@@ -155,7 +155,7 @@
ADD_FAILURE() << "Unexpected change type " << change.change_type();
}
}
- return base::nullopt;
+ return absl::nullopt;
}
// We override this to help catch the error of trying to use a single
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index 6641655..105512a3 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -1305,7 +1305,7 @@
base::RunLoop run_loop;
installer->set_installer_callback(base::BindOnce(
[](base::OnceClosure quit_closure,
- const base::Optional<CrxInstallError>& result) {
+ const absl::optional<CrxInstallError>& result) {
ASSERT_FALSE(result) << result->message();
std::move(quit_closure).Run();
},
@@ -1349,7 +1349,7 @@
base::RunLoop run_loop;
installer->set_installer_callback(base::BindOnce(
[](base::OnceClosure quit_closure,
- const base::Optional<CrxInstallError>& result) {
+ const absl::optional<CrxInstallError>& result) {
ASSERT_FALSE(result) << result->message();
std::move(quit_closure).Run();
},
@@ -5077,7 +5077,7 @@
ASSERT_TRUE(cookie_store);
auto cookie =
net::CanonicalCookie::Create(ext_url, "dummy=value", base::Time::Now(),
- base::nullopt /* server_time */);
+ absl::nullopt /* server_time */);
cookie_store->SetCanonicalCookieAsync(
std::move(cookie), ext_url, net::CookieOptions::MakeAllInclusive(),
base::BindOnce(&ExtensionCookieCallback::SetCookieCallback,
@@ -5225,7 +5225,7 @@
std::unique_ptr<net::CanonicalCookie> cc(
net::CanonicalCookie::Create(origin1, "dummy=value", base::Time::Now(),
- base::nullopt /* server_time */));
+ absl::nullopt /* server_time */));
ASSERT_TRUE(cc.get());
{
diff --git a/chrome/browser/extensions/extension_sync_data.h b/chrome/browser/extensions/extension_sync_data.h
index a57049b0..c755706e 100644
--- a/chrome/browser/extensions/extension_sync_data.h
+++ b/chrome/browser/extensions/extension_sync_data.h
@@ -9,11 +9,11 @@
#include <string>
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "base/version.h"
#include "components/sync/model/string_ordinal.h"
#include "components/sync/model/sync_change.h"
#include "extensions/common/constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "url/gurl.h"
@@ -114,7 +114,7 @@
const std::string& bookmark_app_icon_color() const {
return bookmark_app_icon_color_;
}
- base::Optional<SkColor> bookmark_app_theme_color() const {
+ absl::optional<SkColor> bookmark_app_theme_color() const {
return bookmark_app_theme_color_;
}
const std::vector<LinkedAppIconInfo>& linked_icons() const {
@@ -164,7 +164,7 @@
std::string bookmark_app_description_;
std::string bookmark_app_scope_;
std::string bookmark_app_icon_color_;
- base::Optional<SkColor> bookmark_app_theme_color_;
+ absl::optional<SkColor> bookmark_app_theme_color_;
std::vector<LinkedAppIconInfo> linked_icons_;
};
diff --git a/chrome/browser/extensions/extension_sync_service.cc b/chrome/browser/extensions/extension_sync_service.cc
index c4e2e5f..8b0ce02 100644
--- a/chrome/browser/extensions/extension_sync_service.cc
+++ b/chrome/browser/extensions/extension_sync_service.cc
@@ -152,7 +152,7 @@
system_->ready().Post(FROM_HERE, std::move(done));
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
ExtensionSyncService::MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
@@ -193,7 +193,7 @@
if (type == syncer::APPS)
system_->app_sorting()->FixNTPOrdinalCollisions();
- return base::nullopt;
+ return absl::nullopt;
}
void ExtensionSyncService::StopSyncing(syncer::ModelType type) {
@@ -218,7 +218,7 @@
return ToSyncerSyncDataList(sync_data_list);
}
-base::Optional<syncer::ModelError> ExtensionSyncService::ProcessSyncChanges(
+absl::optional<syncer::ModelError> ExtensionSyncService::ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) {
for (const syncer::SyncChange& sync_change : change_list) {
@@ -230,7 +230,7 @@
system_->app_sorting()->FixNTPOrdinalCollisions();
- return base::nullopt;
+ return absl::nullopt;
}
ExtensionSyncData ExtensionSyncService::CreateSyncData(
diff --git a/chrome/browser/extensions/extension_sync_service.h b/chrome/browser/extensions/extension_sync_service.h
index 0cc32bf..6bac0d4 100644
--- a/chrome/browser/extensions/extension_sync_service.h
+++ b/chrome/browser/extensions/extension_sync_service.h
@@ -53,14 +53,14 @@
// syncer::SyncableService implementation.
void WaitUntilReadyToSync(base::OnceClosure done) override;
- base::Optional<syncer::ModelError> MergeDataAndStartSyncing(
+ absl::optional<syncer::ModelError> MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory) override;
void StopSyncing(syncer::ModelType type) override;
syncer::SyncDataList GetAllSyncDataForTesting(syncer::ModelType type) const;
- base::Optional<syncer::ModelError> ProcessSyncChanges(
+ absl::optional<syncer::ModelError> ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) override;
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index f46d826c4..13ebaf9 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -13,7 +13,6 @@
#include "base/containers/contains.h"
#include "base/no_destructor.h"
#include "base/numerics/ranges.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -58,6 +57,7 @@
#include "extensions/common/manifest_handlers/options_page_info.h"
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/permissions_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
using content::NavigationEntry;
@@ -427,7 +427,7 @@
tab_object->group_id = -1;
if (tab_strip) {
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_strip->GetTabGroupForTab(tab_index);
if (group.has_value())
tab_object->group_id = tab_groups_util::GetGroupId(group.value());
diff --git a/chrome/browser/extensions/extension_user_script_loader_unittest.cc b/chrome/browser/extensions/extension_user_script_loader_unittest.cc
index b599e82..7f5f0f4 100644
--- a/chrome/browser/extensions/extension_user_script_loader_unittest.cc
+++ b/chrome/browser/extensions/extension_user_script_loader_unittest.cc
@@ -15,7 +15,6 @@
#include "base/files/scoped_temp_dir.h"
#include "base/location.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/string_piece.h"
@@ -29,6 +28,7 @@
#include "extensions/browser/content_verifier.h"
#include "extensions/common/extension_builder.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using extensions::URLPatternSet;
@@ -71,7 +71,7 @@
base::RunLoop run_loop;
auto on_load_complete = [&run_loop](
UserScriptLoader* loader,
- const base::Optional<std::string>& error) {
+ const absl::optional<std::string>& error) {
EXPECT_FALSE(error.has_value()) << *error;
run_loop.Quit();
};
@@ -93,7 +93,7 @@
// synchronously.
bool callback_called = false;
auto callback = [&callback_called](UserScriptLoader* loader,
- const base::Optional<std::string>& error) {
+ const absl::optional<std::string>& error) {
// Check that there is at least an error message.
EXPECT_TRUE(error.has_value());
EXPECT_THAT(*error, testing::HasSubstr("No changes to loaded scripts"));
@@ -125,7 +125,7 @@
// otherwise completes the test.
auto on_load_complete = [&run_loop, &first_callback_fired](
UserScriptLoader* loader,
- const base::Optional<std::string>& error) {
+ const absl::optional<std::string>& error) {
EXPECT_FALSE(error.has_value()) << *error;
EXPECT_TRUE(loader->initial_load_complete());
if (first_callback_fired)
diff --git a/chrome/browser/extensions/extension_util.h b/chrome/browser/extensions/extension_util.h
index 1b7b43abe..7d83f59d 100644
--- a/chrome/browser/extensions/extension_util.h
+++ b/chrome/browser/extensions/extension_util.h
@@ -8,8 +8,8 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "extensions/common/constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class DictionaryValue;
diff --git a/chrome/browser/extensions/external_provider_impl_unittest.cc b/chrome/browser/extensions/external_provider_impl_unittest.cc
index 0d59af54..a833a6a 100644
--- a/chrome/browser/extensions/external_provider_impl_unittest.cc
+++ b/chrome/browser/extensions/external_provider_impl_unittest.cc
@@ -13,7 +13,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
@@ -42,6 +41,7 @@
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/customization/customization_document.h"
@@ -115,7 +115,7 @@
}
void InitServiceWithExternalProviders(
- const base::Optional<bool> block_external = base::nullopt) {
+ const absl::optional<bool> block_external = absl::nullopt) {
InitService();
if (block_external.has_value())
diff --git a/chrome/browser/extensions/forced_extensions/force_installed_metrics_unittest.cc b/chrome/browser/extensions/forced_extensions/force_installed_metrics_unittest.cc
index 203b5ed..daae5ffc 100644
--- a/chrome/browser/extensions/forced_extensions/force_installed_metrics_unittest.cc
+++ b/chrome/browser/extensions/forced_extensions/force_installed_metrics_unittest.cc
@@ -6,7 +6,6 @@
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/time/time.h"
#include "base/timer/mock_timer.h"
@@ -35,6 +34,7 @@
#include "net/base/net_errors.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
@@ -212,7 +212,7 @@
ExtensionDownloaderDelegate::Stage::DOWNLOADING_MANIFEST);
}
- void ReportInstallationStarted(base::Optional<base::TimeDelta> install_time) {
+ void ReportInstallationStarted(absl::optional<base::TimeDelta> install_time) {
install_stage_tracker()->ReportDownloadingStage(
kExtensionId1, ExtensionDownloaderDelegate::Stage::MANIFEST_LOADED);
install_stage_tracker()->ReportDownloadingStage(
@@ -374,7 +374,7 @@
TEST_F(ForceInstalledMetricsTest, ExtensionsReportInstallationStageTimes) {
SetupForceList(/*is_from_store=*/true);
ReportDownloadingManifestStage();
- ReportInstallationStarted(base::nullopt);
+ ReportInstallationStarted(absl::nullopt);
install_stage_tracker()->ReportCRXInstallationStage(
kExtensionId1, InstallationStage::kVerification);
diff --git a/chrome/browser/extensions/forced_extensions/force_installed_test_base.cc b/chrome/browser/extensions/forced_extensions/force_installed_test_base.cc
index 0006190..ae80677 100644
--- a/chrome/browser/extensions/forced_extensions/force_installed_test_base.cc
+++ b/chrome/browser/extensions/forced_extensions/force_installed_test_base.cc
@@ -49,7 +49,7 @@
ASSERT_TRUE(profile_manager_->SetUp());
profile_ = profile_manager_->CreateTestingProfile(
"p1", nullptr, u"p1", 0, "", TestingProfile::TestingFactories(),
- base::nullopt, std::move(policy_service));
+ absl::nullopt, std::move(policy_service));
prefs_ = profile_->GetTestingPrefService();
registry_ = ExtensionRegistry::Get(profile_);
diff --git a/chrome/browser/extensions/forced_extensions/force_installed_tracker.cc b/chrome/browser/extensions/forced_extensions/force_installed_tracker.cc
index 73bfd09..1cb8c4e 100644
--- a/chrome/browser/extensions/forced_extensions/force_installed_tracker.cc
+++ b/chrome/browser/extensions/forced_extensions/force_installed_tracker.cc
@@ -275,7 +275,7 @@
// static
bool ForceInstalledTracker::IsExtensionFetchedFromCache(
- const base::Optional<ExtensionDownloaderDelegate::CacheStatus>& status) {
+ const absl::optional<ExtensionDownloaderDelegate::CacheStatus>& status) {
if (!status)
return false;
return status.value() == ExtensionDownloaderDelegate::CacheStatus::
diff --git a/chrome/browser/extensions/forced_extensions/force_installed_tracker.h b/chrome/browser/extensions/forced_extensions/force_installed_tracker.h
index 93cb77d..4e8d1a8 100644
--- a/chrome/browser/extensions/forced_extensions/force_installed_tracker.h
+++ b/chrome/browser/extensions/forced_extensions/force_installed_tracker.h
@@ -136,7 +136,7 @@
const ExtensionId& id) const;
static bool IsExtensionFetchedFromCache(
- const base::Optional<ExtensionDownloaderDelegate::CacheStatus>& status);
+ const absl::optional<ExtensionDownloaderDelegate::CacheStatus>& status);
private:
policy::PolicyService* policy_service();
diff --git a/chrome/browser/extensions/forced_extensions/install_stage_tracker.cc b/chrome/browser/extensions/forced_extensions/install_stage_tracker.cc
index 27b6a2c..d555f9b 100644
--- a/chrome/browser/extensions/forced_extensions/install_stage_tracker.cc
+++ b/chrome/browser/extensions/forced_extensions/install_stage_tracker.cc
@@ -21,7 +21,7 @@
// Returns true if the |current_stage| should be overridden by the
// |new_stage|.
bool ShouldOverrideCurrentStage(
- base::Optional<InstallStageTracker::Stage> current_stage,
+ absl::optional<InstallStageTracker::Stage> current_stage,
InstallStageTracker::Stage new_stage) {
if (!current_stage)
return true;
@@ -320,7 +320,7 @@
void InstallStageTracker::ReportSandboxedUnpackerFailureReason(
const ExtensionId& id,
const CrxInstallError& crx_install_error) {
- base::Optional<SandboxedUnpackerFailureReason> unpacker_failure_reason =
+ absl::optional<SandboxedUnpackerFailureReason> unpacker_failure_reason =
crx_install_error.sandbox_failure_detail();
DCHECK(unpacker_failure_reason);
InstallationData& data = installation_data_map_[id];
diff --git a/chrome/browser/extensions/forced_extensions/install_stage_tracker.h b/chrome/browser/extensions/forced_extensions/install_stage_tracker.h
index 559fee4..c610f227 100644
--- a/chrome/browser/extensions/forced_extensions/install_stage_tracker.h
+++ b/chrome/browser/extensions/forced_extensions/install_stage_tracker.h
@@ -11,7 +11,6 @@
#include "base/observer_list.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "build/chromeos_buildflags.h"
#include "components/keyed_service/core/keyed_service.h"
#include "extensions/browser/install/crx_install_error.h"
@@ -19,6 +18,7 @@
#include "extensions/browser/updater/extension_downloader_delegate.h"
#include "extensions/browser/updater/safe_manifest_parser.h"
#include "extensions/common/extension_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "components/user_manager/user_manager.h"
@@ -300,63 +300,63 @@
~InstallationData();
InstallationData(const InstallationData&);
- base::Optional<Stage> install_stage;
- base::Optional<InstallCreationStage> install_creation_stage;
- base::Optional<ExtensionDownloaderDelegate::Stage> downloading_stage;
- base::Optional<ExtensionDownloaderDelegate::CacheStatus>
+ absl::optional<Stage> install_stage;
+ absl::optional<InstallCreationStage> install_creation_stage;
+ absl::optional<ExtensionDownloaderDelegate::Stage> downloading_stage;
+ absl::optional<ExtensionDownloaderDelegate::CacheStatus>
downloading_cache_status;
- base::Optional<FailureReason> failure_reason;
- base::Optional<CrxInstallErrorDetail> install_error_detail;
+ absl::optional<FailureReason> failure_reason;
+ absl::optional<CrxInstallErrorDetail> install_error_detail;
// Network error codes and fetch tries when applicable:
// * failure_reason is CRX_FETCH_FAILED or MANIFEST_FETCH_FAILED
// * `downloading_stage` is DOWNLOAD_MANIFEST_RETRY or DOWNLOAD_CRX_RETRY.
- base::Optional<int> network_error_code;
- base::Optional<int> response_code;
- base::Optional<int> fetch_tries;
+ absl::optional<int> network_error_code;
+ absl::optional<int> response_code;
+ absl::optional<int> fetch_tries;
// Unpack failure reason in case of
// CRX_INSTALL_ERROR_SANDBOXED_UNPACKER_FAILURE.
- base::Optional<SandboxedUnpackerFailureReason> unpacker_failure_reason;
+ absl::optional<SandboxedUnpackerFailureReason> unpacker_failure_reason;
// Type of extension, assigned during CRX installation process.
- base::Optional<Manifest::Type> extension_type;
+ absl::optional<Manifest::Type> extension_type;
// Error detail when the fetched manifest was invalid. This includes errors
// occurred while parsing the manifest and errors occurred due to the
// internal details of the parsed manifest.
- base::Optional<ManifestInvalidError> manifest_invalid_error;
+ absl::optional<ManifestInvalidError> manifest_invalid_error;
// Info field in the update manifest returned by the server when no update
// is available.
- base::Optional<NoUpdatesInfo> no_updates_info;
+ absl::optional<NoUpdatesInfo> no_updates_info;
// Type of app status error received from update server when manifest was
// fetched.
- base::Optional<AppStatusError> app_status_error;
+ absl::optional<AppStatusError> app_status_error;
// Time at which the download is started.
- base::Optional<base::TimeTicks> download_manifest_started_time;
+ absl::optional<base::TimeTicks> download_manifest_started_time;
// Time at which the update manifest is downloaded and successfully parsed
// from the server.
- base::Optional<base::TimeTicks> download_manifest_finish_time;
+ absl::optional<base::TimeTicks> download_manifest_finish_time;
// See InstallationStage enum.
- base::Optional<InstallationStage> installation_stage;
+ absl::optional<InstallationStage> installation_stage;
// Time at which the download of CRX is started.
- base::Optional<base::TimeTicks> download_CRX_started_time;
+ absl::optional<base::TimeTicks> download_CRX_started_time;
// Time at which CRX is downloaded.
- base::Optional<base::TimeTicks> download_CRX_finish_time;
+ absl::optional<base::TimeTicks> download_CRX_finish_time;
// Time at which signature verification of CRX is started.
- base::Optional<base::TimeTicks> verification_started_time;
+ absl::optional<base::TimeTicks> verification_started_time;
// Time at which copying of extension archive into the working directory is
// started.
- base::Optional<base::TimeTicks> copying_started_time;
+ absl::optional<base::TimeTicks> copying_started_time;
// Time at which unpacking of the extension archive is started.
- base::Optional<base::TimeTicks> unpacking_started_time;
+ absl::optional<base::TimeTicks> unpacking_started_time;
// Time at which the extension archive has been successfully unpacked and
// the expectation checks before extension installation are started.
- base::Optional<base::TimeTicks> checking_expectations_started_time;
+ absl::optional<base::TimeTicks> checking_expectations_started_time;
// Time at which the extension has passed the expectation checks and the
// installation is started.
- base::Optional<base::TimeTicks> finalizing_started_time;
+ absl::optional<base::TimeTicks> finalizing_started_time;
// Time at which the installation process is complete.
- base::Optional<base::TimeTicks> installation_complete_time;
+ absl::optional<base::TimeTicks> installation_complete_time;
// Detailed error description when extension failed to install with
// SandboxedUnpackerFailureReason equal to UNPACKER_CLIENT FAILED.
- base::Optional<std::u16string> unpacker_client_failed_error;
+ absl::optional<std::u16string> unpacker_client_failed_error;
};
class Observer : public base::CheckedObserver {
diff --git a/chrome/browser/extensions/install_verifier_unittest.cc b/chrome/browser/extensions/install_verifier_unittest.cc
index e3e99d26..c7dc3a0 100644
--- a/chrome/browser/extensions/install_verifier_unittest.cc
+++ b/chrome/browser/extensions/install_verifier_unittest.cc
@@ -71,7 +71,7 @@
struct {
const char* test_name;
ManifestLocation location;
- base::Optional<GURL> update_url;
+ absl::optional<GURL> update_url;
FromStoreStatus expected_from_store_status;
MustRemainDisabledStatus expected_must_remain_disabled_status;
} test_cases[] = {
@@ -79,13 +79,13 @@
FROM_STORE, CAN_BE_ENABLED},
{"internal non-store update url", ManifestLocation::kInternal,
non_store_update_url, NOT_FROM_STORE, MUST_REMAIN_DISABLED},
- {"internal no update url", ManifestLocation::kInternal, base::nullopt,
+ {"internal no update url", ManifestLocation::kInternal, absl::nullopt,
NOT_FROM_STORE, MUST_REMAIN_DISABLED},
{"unpacked from store", ManifestLocation::kUnpacked, store_update_url,
FROM_STORE, CAN_BE_ENABLED},
{"unpacked non-store update url", ManifestLocation::kUnpacked,
non_store_update_url, NOT_FROM_STORE, CAN_BE_ENABLED},
- {"unpacked no update url", ManifestLocation::kUnpacked, base::nullopt,
+ {"unpacked no update url", ManifestLocation::kUnpacked, absl::nullopt,
NOT_FROM_STORE, CAN_BE_ENABLED},
{"external from store", ManifestLocation::kExternalPolicyDownload,
store_update_url, FROM_STORE, CAN_BE_ENABLED},
diff --git a/chrome/browser/extensions/launch_util.cc b/chrome/browser/extensions/launch_util.cc
index fa9d4d93..22a01d8a 100644
--- a/chrome/browser/extensions/launch_util.cc
+++ b/chrome/browser/extensions/launch_util.cc
@@ -79,7 +79,7 @@
LaunchContainer manifest_launch_container =
AppLaunchInfo::GetLaunchContainer(extension);
- base::Optional<LaunchContainer> result;
+ absl::optional<LaunchContainer> result;
if (manifest_launch_container ==
LaunchContainer::kLaunchContainerPanelDeprecated) {
diff --git a/chrome/browser/extensions/media_router_extension_access_logger_impl.cc b/chrome/browser/extensions/media_router_extension_access_logger_impl.cc
index 36e50bf..7ebf35b 100644
--- a/chrome/browser/extensions/media_router_extension_access_logger_impl.cc
+++ b/chrome/browser/extensions/media_router_extension_access_logger_impl.cc
@@ -20,7 +20,7 @@
namespace {
void DidGetBackgroundSourceIdForCastExtensionMetric(
- base::Optional<ukm::SourceId> source_id) {
+ absl::optional<ukm::SourceId> source_id) {
if (!source_id.has_value())
return; // Can't record as it wasn't found in the history.
diff --git a/chrome/browser/extensions/policy_extension_reinstaller_unittest.cc b/chrome/browser/extensions/policy_extension_reinstaller_unittest.cc
index 7d64691..563f734 100644
--- a/chrome/browser/extensions/policy_extension_reinstaller_unittest.cc
+++ b/chrome/browser/extensions/policy_extension_reinstaller_unittest.cc
@@ -47,7 +47,7 @@
private:
int call_count_ = 0;
- base::Optional<base::OnceClosure> saved_callback_;
+ absl::optional<base::OnceClosure> saved_callback_;
PolicyExtensionReinstaller::ReinstallCallback action_;
DISALLOW_COPY_AND_ASSIGN(TestReinstallerTracker);
diff --git a/chrome/browser/extensions/policy_handlers_unittest.cc b/chrome/browser/extensions/policy_handlers_unittest.cc
index 039e684..cee17ba4 100644
--- a/chrome/browser/extensions/policy_handlers_unittest.cc
+++ b/chrome/browser/extensions/policy_handlers_unittest.cc
@@ -114,7 +114,7 @@
auto url_parses_successfully = [](const char* policy_template,
const std::string& url) {
std::string policy = base::StringPrintf(policy_template, url.c_str());
- base::Optional<base::Value> policy_value = base::JSONReader::Read(
+ absl::optional<base::Value> policy_value = base::JSONReader::Read(
policy, base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS);
if (!policy_value)
return false;
diff --git a/chrome/browser/extensions/preinstalled_apps.cc b/chrome/browser/extensions/preinstalled_apps.cc
index 3294fe5..c3e068bf 100644
--- a/chrome/browser/extensions/preinstalled_apps.cc
+++ b/chrome/browser/extensions/preinstalled_apps.cc
@@ -83,7 +83,7 @@
InstallState state = static_cast<InstallState>(
profile_->GetPrefs()->GetInteger(prefs::kPreinstalledAppsInstallState));
- base::Optional<InstallState> new_install_state;
+ absl::optional<InstallState> new_install_state;
switch (state) {
case kUnknown: {
diff --git a/chrome/browser/extensions/process_manager_browsertest.cc b/chrome/browser/extensions/process_manager_browsertest.cc
index 374a11b..70e35cb0 100644
--- a/chrome/browser/extensions/process_manager_browsertest.cc
+++ b/chrome/browser/extensions/process_manager_browsertest.cc
@@ -1426,7 +1426,7 @@
// Navigate to the "extension 1" page with two iframes.
auto url = extension1->url().Resolve("two_iframes.html");
NavigateToURL(url);
- auto initiator_origin = base::Optional<url::Origin>(url::Origin::Create(url));
+ auto initiator_origin = absl::optional<url::Origin>(url::Origin::Create(url));
ProcessManager* pm = ProcessManager::Get(profile());
content::WebContents* tab =
diff --git a/chrome/browser/extensions/service_worker_apitest.cc b/chrome/browser/extensions/service_worker_apitest.cc
index ef7123d..4e358e8 100644
--- a/chrome/browser/extensions/service_worker_apitest.cc
+++ b/chrome/browser/extensions/service_worker_apitest.cc
@@ -8,7 +8,6 @@
#include "base/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/strings/stringprintf.h"
@@ -80,6 +79,7 @@
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/message_center/public/cpp/notification.h"
#include "url/url_constants.h"
@@ -254,18 +254,18 @@
}
// Returns the only running worker id for |extension_id|.
- // Returns base::nullopt if there isn't any worker running or more than one
+ // Returns absl::nullopt if there isn't any worker running or more than one
// worker is running for |extension_id|.
- base::Optional<WorkerId> GetUniqueRunningWorkerId(
+ absl::optional<WorkerId> GetUniqueRunningWorkerId(
const ExtensionId& extension_id) {
ProcessManager* process_manager = ProcessManager::Get(profile());
std::vector<WorkerId> all_workers =
process_manager->GetAllWorkersIdsForTesting();
- base::Optional<WorkerId> running_worker_id;
+ absl::optional<WorkerId> running_worker_id;
for (const WorkerId& worker_id : all_workers) {
if (worker_id.extension_id == extension_id) {
if (running_worker_id) // More than one worker present.
- return base::nullopt;
+ return absl::nullopt;
running_worker_id = worker_id;
}
}
@@ -611,7 +611,7 @@
private:
bool extension_activated_ = false;
- base::Optional<bool> will_register_service_worker_;
+ absl::optional<bool> will_register_service_worker_;
std::unique_ptr<base::RunLoop> run_loop_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistrationAtStartupTest);
@@ -653,18 +653,18 @@
}
}
- base::Optional<blink::ServiceWorkerStatusCode> status_code() {
+ absl::optional<blink::ServiceWorkerStatusCode> status_code() {
return status_code_;
}
private:
// Holds number of pending tasks for worker at the time DidStartWorkerFail is
// observed.
- base::Optional<size_t> pending_tasks_count_at_worker_failure_;
+ absl::optional<size_t> pending_tasks_count_at_worker_failure_;
ExtensionId extension_id_;
base::RunLoop run_loop_;
- base::Optional<blink::ServiceWorkerStatusCode> status_code_;
+ absl::optional<blink::ServiceWorkerStatusCode> status_code_;
};
// Test extension id at
@@ -1730,7 +1730,7 @@
base::RunLoop stopped_run_loop_;
// Holds version id of an extension worker once OnVersionStartedRunning is
// observed.
- base::Optional<int64_t> running_version_id_;
+ absl::optional<int64_t> running_version_id_;
content::ServiceWorkerContext* context_ = nullptr;
GURL extension_url_;
};
@@ -2100,7 +2100,7 @@
ASSERT_TRUE(extension);
EXPECT_TRUE(activated_listener.WaitUntilSatisfied());
- base::Optional<WorkerId> worker_id =
+ absl::optional<WorkerId> worker_id =
GetUniqueRunningWorkerId(extension->id());
ASSERT_TRUE(worker_id);
{
@@ -2132,7 +2132,7 @@
ASSERT_TRUE(extension);
EXPECT_TRUE(activated_listener.WaitUntilSatisfied());
- base::Optional<WorkerId> worker_id =
+ absl::optional<WorkerId> worker_id =
GetUniqueRunningWorkerId(extension->id());
ASSERT_TRUE(worker_id);
{
@@ -2377,7 +2377,7 @@
ASSERT_EQ(1u, notifications.size());
display_service_tester_->SimulateClick(
NotificationHandler::Type::WEB_PERSISTENT, notifications[0].id(),
- base::nullopt, base::nullopt);
+ absl::nullopt, absl::nullopt);
}
EXPECT_TRUE(catcher.GetNextResult()) << message_;
diff --git a/chrome/browser/extensions/system_display/display_info_provider_chromeos.cc b/chrome/browser/extensions/system_display/display_info_provider_chromeos.cc
index 7f14a78..91759126 100644
--- a/chrome/browser/extensions/system_display/display_info_provider_chromeos.cc
+++ b/chrome/browser/extensions/system_display/display_info_provider_chromeos.cc
@@ -121,7 +121,7 @@
// Validates the DisplayProperties input. Does not perform any tests with
// DisplayManager dependencies. Returns an error string on failure or nullopt
// on success.
-base::Optional<std::string> ValidateDisplayPropertiesInput(
+absl::optional<std::string> ValidateDisplayPropertiesInput(
const std::string& display_id_str,
const system_display::DisplayProperties& info) {
int64_t id = GetDisplayId(display_id_str);
@@ -144,7 +144,7 @@
LOG(WARNING)
<< "Unified mode set with other properties which will be ignored.";
}
- return base::nullopt;
+ return absl::nullopt;
}
// If mirroring source parameter is specified, no other properties should be
@@ -160,7 +160,7 @@
if (info.rotation && !IsValidRotation(*info.rotation))
return "Invalid rotation.";
- return base::nullopt;
+ return absl::nullopt;
}
system_display::DisplayMode GetDisplayModeFromMojo(
@@ -254,18 +254,18 @@
}
void RunResultCallback(DisplayInfoProvider::ErrorCallback callback,
- base::Optional<std::string> error) {
+ absl::optional<std::string> error) {
if (error)
LOG(ERROR) << "API call failed: " << *error;
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback), std::move(error)));
}
-base::Optional<std::string> GetStringResult(
+absl::optional<std::string> GetStringResult(
ash::mojom::DisplayConfigResult result) {
switch (result) {
case ash::mojom::DisplayConfigResult::kSuccess:
- return base::nullopt;
+ return absl::nullopt;
case ash::mojom::DisplayConfigResult::kInvalidOperationError:
return "Invalid operation";
case ash::mojom::DisplayConfigResult::kInvalidDisplayIdError:
@@ -303,7 +303,7 @@
}
void LogErrorResult(ash::mojom::DisplayConfigResult result) {
- base::Optional<std::string> str_result = GetStringResult(result);
+ absl::optional<std::string> str_result = GetStringResult(result);
if (!str_result)
return;
LOG(ERROR) << *str_result;
@@ -321,7 +321,7 @@
const std::string& display_id_str,
const api::system_display::DisplayProperties& properties,
ErrorCallback callback) {
- base::Optional<std::string> error =
+ absl::optional<std::string> error =
ValidateDisplayPropertiesInput(display_id_str, properties);
if (error) {
RunResultCallback(std::move(callback), std::move(*error));
@@ -522,7 +522,7 @@
bool DisplayInfoProviderChromeOS::OverscanCalibrationStart(
const std::string& id) {
cros_display_config_->OverscanCalibration(
- id, ash::mojom::DisplayConfigOperation::kStart, base::nullopt,
+ id, ash::mojom::DisplayConfigOperation::kStart, absl::nullopt,
base::BindOnce(&LogErrorResult));
return true;
}
@@ -539,7 +539,7 @@
bool DisplayInfoProviderChromeOS::OverscanCalibrationReset(
const std::string& id) {
cros_display_config_->OverscanCalibration(
- id, ash::mojom::DisplayConfigOperation::kReset, base::nullopt,
+ id, ash::mojom::DisplayConfigOperation::kReset, absl::nullopt,
base::BindOnce(&LogErrorResult));
return true;
}
@@ -547,7 +547,7 @@
bool DisplayInfoProviderChromeOS::OverscanCalibrationComplete(
const std::string& id) {
cros_display_config_->OverscanCalibration(
- id, ash::mojom::DisplayConfigOperation::kComplete, base::nullopt,
+ id, ash::mojom::DisplayConfigOperation::kComplete, absl::nullopt,
base::BindOnce(&LogErrorResult));
return true;
}
@@ -601,7 +601,7 @@
return;
std::move(callback).Run(
result == ash::mojom::DisplayConfigResult::kSuccess
- ? base::nullopt
+ ? absl::nullopt
: GetStringResult(result));
},
std::move(callback)));
@@ -627,7 +627,7 @@
}
display_layout_info->mirror_source_id = *info.mirroring_source_id;
display_layout_info->mirror_destination_ids =
- base::make_optional<std::vector<std::string>>(
+ absl::make_optional<std::vector<std::string>>(
*info.mirroring_destination_ids);
}
}
diff --git a/chrome/browser/extensions/system_display/display_info_provider_chromeos_unittest.cc b/chrome/browser/extensions/system_display/display_info_provider_chromeos_unittest.cc
index 2fff7535..9ea7bf3 100644
--- a/chrome/browser/extensions/system_display/display_info_provider_chromeos_unittest.cc
+++ b/chrome/browser/extensions/system_display/display_info_provider_chromeos_unittest.cc
@@ -43,7 +43,7 @@
void ErrorCallback(std::string* result,
base::OnceClosure callback,
- base::Optional<std::string> error) {
+ absl::optional<std::string> error) {
*result = error ? *error : "";
std::move(callback).Run();
}
@@ -605,7 +605,7 @@
EXPECT_TRUE(result[1].mirroring_source_id.empty());
GetDisplayManager()->SetMirrorMode(display::MirrorMode::kNormal,
- base::nullopt);
+ absl::nullopt);
ASSERT_TRUE(GetDisplayManager()->IsInMirrorMode());
result = GetAllDisplaysInfo();
@@ -615,7 +615,7 @@
EXPECT_EQ(base::NumberToString(display_id_primary),
result[0].mirroring_source_id);
- GetDisplayManager()->SetMirrorMode(display::MirrorMode::kOff, base::nullopt);
+ GetDisplayManager()->SetMirrorMode(display::MirrorMode::kOff, absl::nullopt);
ASSERT_FALSE(GetDisplayManager()->IsInMirrorMode());
result = GetAllDisplaysInfo();
@@ -860,7 +860,7 @@
UpdateDisplay("500x400,500x400");
GetDisplayManager()->SetMirrorMode(display::MirrorMode::kNormal,
- base::nullopt);
+ absl::nullopt);
EXPECT_TRUE(GetDisplayManager()->IsInMirrorMode());
EXPECT_FALSE(GetDisplayManager()->unified_desktop_enabled());
@@ -875,7 +875,7 @@
EXPECT_FALSE(GetDisplayManager()->IsInUnifiedMode());
// Turning off mirroring should set unified mode.
- GetDisplayManager()->SetMirrorMode(display::MirrorMode::kOff, base::nullopt);
+ GetDisplayManager()->SetMirrorMode(display::MirrorMode::kOff, absl::nullopt);
EXPECT_TRUE(GetDisplayManager()->IsInUnifiedMode());
// Restore extended mode.
diff --git a/chrome/browser/extensions/test_resources_browsertest.cc b/chrome/browser/extensions/test_resources_browsertest.cc
index 93a4e84..a72e2bd 100644
--- a/chrome/browser/extensions/test_resources_browsertest.cc
+++ b/chrome/browser/extensions/test_resources_browsertest.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/extension_browsertest.h"
@@ -15,6 +14,7 @@
#include "extensions/common/extension.h"
#include "extensions/common/manifest.h"
#include "extensions/test/test_extension_dir.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
@@ -26,7 +26,7 @@
// Returns the value of window.injectedSentinel from the active web contents of
// |browser|.
-base::Optional<int> RetrieveSentinelValue(Browser* browser) {
+absl::optional<int> RetrieveSentinelValue(Browser* browser) {
int result = 0;
content::WebContents* web_contents =
browser->tab_strip_model()->GetActiveWebContents();
@@ -34,7 +34,7 @@
web_contents,
"domAutomationController.send(window.injectedSentinel);", &result)) {
ADD_FAILURE() << "Failed to execute script.";
- return base::nullopt;
+ return absl::nullopt;
}
return result;
@@ -83,7 +83,7 @@
ui_test_utils::NavigateToURL(browser(),
extension->GetResourceURL("page.html"));
- base::Optional<int> sentinel = RetrieveSentinelValue(browser());
+ absl::optional<int> sentinel = RetrieveSentinelValue(browser());
ASSERT_TRUE(sentinel);
EXPECT_EQ(kSentinelValue, *sentinel);
}
@@ -122,7 +122,7 @@
ui_test_utils::NavigateToURL(browser(),
extension->GetResourceURL("page.html"));
- base::Optional<int> sentinel = RetrieveSentinelValue(browser());
+ absl::optional<int> sentinel = RetrieveSentinelValue(browser());
ASSERT_TRUE(sentinel);
EXPECT_EQ(kSentinelValue, *sentinel);
}
@@ -154,7 +154,7 @@
ui_test_utils::NavigateToURL(browser(),
extension->GetResourceURL("page.html"));
- base::Optional<int> sentinel = RetrieveSentinelValue(browser());
+ absl::optional<int> sentinel = RetrieveSentinelValue(browser());
ASSERT_TRUE(sentinel);
EXPECT_EQ(kSentinelValue, *sentinel);
}
diff --git a/chrome/browser/extensions/unpacked_installer.h b/chrome/browser/extensions/unpacked_installer.h
index aef21e4..69ecea2 100644
--- a/chrome/browser/extensions/unpacked_installer.h
+++ b/chrome/browser/extensions/unpacked_installer.h
@@ -15,10 +15,10 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "extensions/browser/api/declarative_net_request/ruleset_install_pref.h"
#include "extensions/browser/preload_check.h"
#include "extensions/common/manifest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -174,13 +174,13 @@
CompletionCallback callback_;
// Override default file access.
- base::Optional<bool> allow_file_access_;
+ absl::optional<bool> allow_file_access_;
// Override default incognito access.
- base::Optional<bool> allow_incognito_access_;
+ absl::optional<bool> allow_incognito_access_;
// Specify an install param.
- base::Optional<std::string> install_param_;
+ absl::optional<std::string> install_param_;
DISALLOW_COPY_AND_ASSIGN(UnpackedInstaller);
};
diff --git a/chrome/browser/extensions/updater/chrome_update_client_config.cc b/chrome/browser/extensions/updater/chrome_update_client_config.cc
index cc268666..5111bf57 100644
--- a/chrome/browser/extensions/updater/chrome_update_client_config.cc
+++ b/chrome/browser/extensions/updater/chrome_update_client_config.cc
@@ -129,7 +129,7 @@
// communication with the update backend.
ChromeUpdateClientConfig::ChromeUpdateClientConfig(
content::BrowserContext* context,
- base::Optional<GURL> url_override)
+ absl::optional<GURL> url_override)
: context_(context),
impl_(ExtensionUpdateClientCommandLineConfigPolicy(
base::CommandLine::ForCurrentProcess()),
@@ -292,7 +292,7 @@
// static
scoped_refptr<ChromeUpdateClientConfig> ChromeUpdateClientConfig::Create(
content::BrowserContext* context,
- base::Optional<GURL> update_url_override) {
+ absl::optional<GURL> update_url_override) {
FactoryCallback& factory = GetFactoryCallback();
return factory.is_null() ? base::MakeRefCounted<ChromeUpdateClientConfig>(
context, update_url_override)
diff --git a/chrome/browser/extensions/updater/chrome_update_client_config.h b/chrome/browser/extensions/updater/chrome_update_client_config.h
index 63354b1..9702d41 100644
--- a/chrome/browser/extensions/updater/chrome_update_client_config.h
+++ b/chrome/browser/extensions/updater/chrome_update_client_config.h
@@ -13,9 +13,9 @@
#include "base/containers/flat_map.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "components/component_updater/configurator_impl.h"
#include "components/update_client/configurator.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
@@ -42,10 +42,10 @@
static scoped_refptr<ChromeUpdateClientConfig> Create(
content::BrowserContext* context,
- base::Optional<GURL> url_override);
+ absl::optional<GURL> url_override);
ChromeUpdateClientConfig(content::BrowserContext* context,
- base::Optional<GURL> url_override);
+ absl::optional<GURL> url_override);
double InitialDelay() const override;
int NextCheckDelay() const override;
@@ -97,7 +97,7 @@
scoped_refptr<update_client::CrxDownloaderFactory> crx_downloader_factory_;
scoped_refptr<update_client::UnzipperFactory> unzip_factory_;
scoped_refptr<update_client::PatcherFactory> patch_factory_;
- base::Optional<GURL> url_override_;
+ absl::optional<GURL> url_override_;
DISALLOW_COPY_AND_ASSIGN(ChromeUpdateClientConfig);
};
diff --git a/chrome/browser/extensions/updater/extension_update_client_base_browsertest.cc b/chrome/browser/extensions/updater/extension_update_client_base_browsertest.cc
index 077ccd2..95b5365 100644
--- a/chrome/browser/extensions/updater/extension_update_client_base_browsertest.cc
+++ b/chrome/browser/extensions/updater/extension_update_client_base_browsertest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/task/post_task.h"
@@ -20,6 +19,7 @@
#include "extensions/browser/updater/update_service.h"
#include "extensions/browser/updater/update_service_factory.h"
#include "extensions/common/extension_features.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace extensions {
@@ -34,7 +34,7 @@
TestChromeUpdateClientConfig(content::BrowserContext* context,
const std::vector<GURL>& update_url,
const std::vector<GURL>& ping_url)
- : extensions::ChromeUpdateClientConfig(context, base::nullopt),
+ : extensions::ChromeUpdateClientConfig(context, absl::nullopt),
update_url_(update_url),
ping_url_(ping_url) {}
diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc
index d6bf88c..f5567585 100644
--- a/chrome/browser/extensions/updater/extension_updater_unittest.cc
+++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc
@@ -1537,7 +1537,7 @@
std::make_unique<ExtensionDownloader::ExtensionFetch>(
id, test_url, hash, version.GetString(), requests, fetch_priority);
- updater.downloader_->FetchUpdatedExtension(std::move(fetch), base::nullopt);
+ updater.downloader_->FetchUpdatedExtension(std::move(fetch), absl::nullopt);
auto* request = helper.GetPendingRequest(0);
if (fetch_priority == ManifestFetchData::FetchPriority::FOREGROUND) {
@@ -1580,7 +1580,7 @@
std::make_unique<ExtensionDownloader::ExtensionFetch>(
id, test_url, hash, version.GetString(), requests,
ManifestFetchData::FetchPriority::BACKGROUND);
- updater.downloader_->FetchUpdatedExtension(std::move(fetch), base::nullopt);
+ updater.downloader_->FetchUpdatedExtension(std::move(fetch), absl::nullopt);
if (pending) {
const bool kIsFromSync = true;
@@ -1855,7 +1855,7 @@
std::make_unique<ExtensionDownloader::ExtensionFetch>(
id, test_url, hash, version.GetString(), requests,
ManifestFetchData::FetchPriority::BACKGROUND);
- updater.downloader_->FetchUpdatedExtension(std::move(fetch), base::nullopt);
+ updater.downloader_->FetchUpdatedExtension(std::move(fetch), absl::nullopt);
EXPECT_EQ(
kExpectedLoadFlags,
@@ -2081,9 +2081,9 @@
id2, url2, hash2, version2, requests,
ManifestFetchData::FetchPriority::BACKGROUND);
updater.downloader_->FetchUpdatedExtension(std::move(fetch1),
- base::Optional<std::string>());
+ absl::optional<std::string>());
updater.downloader_->FetchUpdatedExtension(std::move(fetch2),
- base::Optional<std::string>());
+ absl::optional<std::string>());
// Make the first fetch complete.
EXPECT_TRUE(updater.downloader_->extension_loader_);
@@ -2363,7 +2363,7 @@
updater.downloader_->HandleManifestResults(std::move(fetch_data),
std::move(results),
- /*error=*/base::nullopt);
+ /*error=*/absl::nullopt);
Time last_ping_day =
service.extension_prefs()->LastPingDay(extension->id());
EXPECT_FALSE(last_ping_day.is_null());
diff --git a/chrome/browser/external_protocol/external_protocol_handler.cc b/chrome/browser/external_protocol/external_protocol_handler.cc
index 7f01180d..f928df6f 100644
--- a/chrome/browser/external_protocol/external_protocol_handler.cc
+++ b/chrome/browser/external_protocol/external_protocol_handler.cc
@@ -109,7 +109,7 @@
content::WebContents* web_contents,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
ExternalProtocolHandler::Delegate* delegate) {
DCHECK(web_contents);
if (delegate) {
@@ -180,7 +180,7 @@
bool prompt_user,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
ExternalProtocolHandler::Delegate* delegate,
shell_integration::DefaultWebClientState state) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -332,7 +332,7 @@
allowed_origin_protocol_pairs->FindDictKey(
initiating_origin->Serialize());
if (allowed_protocols_for_origin) {
- base::Optional<bool> allow =
+ absl::optional<bool> allow =
allowed_protocols_for_origin->FindBoolKey(scheme);
if (allow.has_value() && allow.value())
return DONT_BLOCK;
@@ -395,7 +395,7 @@
int render_view_routing_id,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin) {
+ const absl::optional<url::Origin>& initiating_origin) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// Disable anti-flood protection if the user is invoking a bookmark or
@@ -437,7 +437,7 @@
g_accept_requests = false;
- base::Optional<url::Origin> initiating_origin_or_precursor;
+ absl::optional<url::Origin> initiating_origin_or_precursor;
if (initiating_origin) {
// Transform the initiating origin to its precursor origin if it is
// opaque. |initiating_origin| is shown in the UI to attribute the external
diff --git a/chrome/browser/external_protocol/external_protocol_handler.h b/chrome/browser/external_protocol/external_protocol_handler.h
index 996c916..afaa605 100644
--- a/chrome/browser/external_protocol/external_protocol_handler.h
+++ b/chrome/browser/external_protocol/external_protocol_handler.h
@@ -56,7 +56,7 @@
content::WebContents* web_contents,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin) = 0;
+ const absl::optional<url::Origin>& initiating_origin) = 0;
virtual void LaunchUrlWithoutSecurityCheck(
const GURL& url,
content::WebContents* web_contents) = 0;
@@ -108,7 +108,7 @@
int render_view_routing_id,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin);
+ const absl::optional<url::Origin>& initiating_origin);
// Starts a url using the external protocol handler with the help
// of shellexecute. Should only be called if the protocol is allowlisted
@@ -159,7 +159,7 @@
content::WebContents* web_contents,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin);
+ const absl::optional<url::Origin>& initiating_origin);
// Clears the external protocol handling data.
static void ClearData(Profile* profile);
diff --git a/chrome/browser/external_protocol/external_protocol_handler_unittest.cc b/chrome/browser/external_protocol/external_protocol_handler_unittest.cc
index 556876f..1fe584a 100644
--- a/chrome/browser/external_protocol/external_protocol_handler_unittest.cc
+++ b/chrome/browser/external_protocol/external_protocol_handler_unittest.cc
@@ -81,7 +81,7 @@
content::WebContents* web_contents,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin) override {
+ const absl::optional<url::Origin>& initiating_origin) override {
EXPECT_EQ(block_state_, ExternalProtocolHandler::UNKNOWN);
EXPECT_NE(os_state_, shell_integration::IS_DEFAULT);
has_prompted_ = true;
@@ -121,7 +121,7 @@
bool has_launched() { return has_launched_; }
bool has_prompted() { return has_prompted_; }
bool has_blocked() { return has_blocked_; }
- const base::Optional<url::Origin>& initiating_origin() {
+ const absl::optional<url::Origin>& initiating_origin() {
return initiating_origin_;
}
@@ -137,7 +137,7 @@
bool has_prompted_;
bool has_blocked_;
GURL launch_or_prompt_url_;
- base::Optional<url::Origin> initiating_origin_;
+ absl::optional<url::Origin> initiating_origin_;
base::OnceClosure on_complete_;
};
diff --git a/chrome/browser/favicon/content_favicon_driver_browsertest.cc b/chrome/browser/favicon/content_favicon_driver_browsertest.cc
index f1c78969..90a5f13 100644
--- a/chrome/browser/favicon/content_favicon_driver_browsertest.cc
+++ b/chrome/browser/favicon/content_favicon_driver_browsertest.cc
@@ -12,7 +12,6 @@
#include "base/location.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/pattern.h"
#include "base/strings/utf_string_conversions.h"
@@ -46,6 +45,7 @@
#include "net/test/embedded_test_server/http_response.h"
#include "net/url_request/url_request.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
#include "ui/gfx/image/image_unittest_util.h"
@@ -184,7 +184,7 @@
base::RepeatingClosure quit_closure_;
GURL required_url_;
- base::Optional<std::u16string> required_title_;
+ absl::optional<std::u16string> required_title_;
base::WeakPtrFactory<PendingTaskWaiter> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(PendingTaskWaiter);
diff --git a/chrome/browser/federated_learning/floc_eligibility_browsertest.cc b/chrome/browser/federated_learning/floc_eligibility_browsertest.cc
index 55632121..cb89a7b 100644
--- a/chrome/browser/federated_learning/floc_eligibility_browsertest.cc
+++ b/chrome/browser/federated_learning/floc_eligibility_browsertest.cc
@@ -37,7 +37,7 @@
blink::mojom::InterestCohortPtr GetInterestCohortForJsApi(
const GURL& url,
- const base::Optional<url::Origin>& top_frame_origin) const override {
+ const absl::optional<url::Origin>& top_frame_origin) const override {
blink::mojom::InterestCohortPtr cohort =
blink::mojom::InterestCohort::New();
cohort->id = "12345";
@@ -101,11 +101,11 @@
.ExtractString();
}
- // Returns base::nullopt if there's no matching result in the history query.
- // Otherwise, the returned base::Optional contains a bit representing whether
+ // Returns absl::nullopt if there's no matching result in the history query.
+ // Otherwise, the returned absl::optional contains a bit representing whether
// the entry is eligible in floc computation.
- base::Optional<bool> QueryFlocEligibleForURL(const GURL& url) {
- base::Optional<bool> query_result;
+ absl::optional<bool> QueryFlocEligibleForURL(const GURL& url) {
+ absl::optional<bool> query_result;
history::QueryOptions options;
options.duplicate_policy = history::QueryOptions::KEEP_ALL_DUPLICATES;
@@ -201,7 +201,7 @@
NavigateAndWaitForResourcesCompeletion(main_page_url, 4);
// Expect that the navigation history is not eligible for floc computation.
- base::Optional<bool> query_floc_eligible =
+ absl::optional<bool> query_floc_eligible =
QueryFlocEligibleForURL(main_page_url);
EXPECT_TRUE(query_floc_eligible);
EXPECT_FALSE(query_floc_eligible.value());
@@ -221,7 +221,7 @@
NavigateAndWaitForResourcesCompeletion(main_page_url, 4);
// Expect that the navigation history is not eligible for floc computation.
- base::Optional<bool> query_floc_eligible =
+ absl::optional<bool> query_floc_eligible =
QueryFlocEligibleForURL(main_page_url);
EXPECT_TRUE(query_floc_eligible);
EXPECT_FALSE(query_floc_eligible.value());
@@ -242,7 +242,7 @@
EXPECT_EQ("{\"id\":\"12345\",\"version\":\"chrome.6.7.8.9\"}",
InvokeInterestCohortJsApi(web_contents()));
- base::Optional<bool> query_floc_eligible =
+ absl::optional<bool> query_floc_eligible =
QueryFlocEligibleForURL(main_page_url);
EXPECT_TRUE(query_floc_eligible);
EXPECT_TRUE(query_floc_eligible.value());
@@ -264,7 +264,7 @@
// Expect that the navigation history is not eligible for floc computation as
// the permissions policy disallows it.
- base::Optional<bool> query_floc_eligible =
+ absl::optional<bool> query_floc_eligible =
QueryFlocEligibleForURL(main_page_url);
EXPECT_TRUE(query_floc_eligible);
EXPECT_FALSE(query_floc_eligible.value());
@@ -285,7 +285,7 @@
// Expect that the navigation history is not eligible for floc computation as
// the permissions policy disallows it.
- base::Optional<bool> query_floc_eligible =
+ absl::optional<bool> query_floc_eligible =
QueryFlocEligibleForURL(main_page_url);
EXPECT_TRUE(query_floc_eligible);
EXPECT_FALSE(query_floc_eligible.value());
@@ -303,7 +303,7 @@
// Expect that the navigation history is not eligible for floc computation as
// the IP was not publicly routable.
- base::Optional<bool> query_floc_eligible =
+ absl::optional<bool> query_floc_eligible =
QueryFlocEligibleForURL(main_page_url);
EXPECT_TRUE(query_floc_eligible);
EXPECT_FALSE(query_floc_eligible.value());
@@ -499,7 +499,7 @@
InvokeInterestCohortJsApi(web_contents());
// Expect that the navigation history is eligible for floc computation.
- base::Optional<bool> query_floc_eligible =
+ absl::optional<bool> query_floc_eligible =
QueryFlocEligibleForURL(main_page_url);
EXPECT_TRUE(query_floc_eligible);
EXPECT_TRUE(query_floc_eligible.value());
@@ -534,7 +534,7 @@
// Expect that the navigation history is eligible for floc computation as the
// page contains an ad resource.
- base::Optional<bool> query_floc_eligible =
+ absl::optional<bool> query_floc_eligible =
QueryFlocEligibleForURL(main_page_url);
EXPECT_TRUE(query_floc_eligible);
EXPECT_TRUE(query_floc_eligible.value());
@@ -552,7 +552,7 @@
NavigateAndWaitForResourcesCompeletion(main_page_url, 4);
// Expect that the navigation history is not eligible for floc computation.
- base::Optional<bool> query_floc_eligible =
+ absl::optional<bool> query_floc_eligible =
QueryFlocEligibleForURL(main_page_url);
EXPECT_TRUE(query_floc_eligible);
EXPECT_FALSE(query_floc_eligible.value());
@@ -610,7 +610,7 @@
InvokeInterestCohortJsApi(child));
// Expect that the navigation history is eligible for floc computation.
- base::Optional<bool> query_floc_eligible =
+ absl::optional<bool> query_floc_eligible =
QueryFlocEligibleForURL(main_page_url);
EXPECT_TRUE(query_floc_eligible);
EXPECT_TRUE(query_floc_eligible.value());
diff --git a/chrome/browser/federated_learning/floc_id_provider.h b/chrome/browser/federated_learning/floc_id_provider.h
index 5ac00a2..ce4a6991 100644
--- a/chrome/browser/federated_learning/floc_id_provider.h
+++ b/chrome/browser/federated_learning/floc_id_provider.h
@@ -25,7 +25,7 @@
// access permission check.
virtual blink::mojom::InterestCohortPtr GetInterestCohortForJsApi(
const GURL& url,
- const base::Optional<url::Origin>& top_frame_origin) const = 0;
+ const absl::optional<url::Origin>& top_frame_origin) const = 0;
// Record the floc id to UKM if this is the first recording attempt after each
// time the floc is (re-)computed. No-op if the existing floc was already
diff --git a/chrome/browser/federated_learning/floc_id_provider_browsertest.cc b/chrome/browser/federated_learning/floc_id_provider_browsertest.cc
index 12949093..12bac328 100644
--- a/chrome/browser/federated_learning/floc_id_provider_browsertest.cc
+++ b/chrome/browser/federated_learning/floc_id_provider_browsertest.cc
@@ -289,7 +289,7 @@
g_browser_process->floc_sorting_lsh_clusters_service()->ApplySortingLsh(
dummy_sim_hash,
base::BindLambdaForTesting(
- [&](base::Optional<uint64_t>, base::Version) { run_loop.Quit(); }));
+ [&](absl::optional<uint64_t>, base::Version) { run_loop.Quit(); }));
run_loop.Run();
}
diff --git a/chrome/browser/federated_learning/floc_id_provider_impl.cc b/chrome/browser/federated_learning/floc_id_provider_impl.cc
index 2218737..568a5c5 100644
--- a/chrome/browser/federated_learning/floc_id_provider_impl.cc
+++ b/chrome/browser/federated_learning/floc_id_provider_impl.cc
@@ -25,8 +25,8 @@
struct StartupComputeDecision {
bool invalidate_existing_floc = true;
- // Will be base::nullopt if should recompute immediately.
- base::Optional<base::TimeDelta> next_compute_delay;
+ // Will be absl::nullopt if should recompute immediately.
+ absl::optional<base::TimeDelta> next_compute_delay;
};
// Determine whether we can keep using the previous floc and/or when should the
@@ -39,7 +39,7 @@
// never been ready).
if (last_floc.compute_time().is_null()) {
return StartupComputeDecision{.invalidate_existing_floc = true,
- .next_compute_delay = base::nullopt};
+ .next_compute_delay = absl::nullopt};
}
// The browser started with a kFlocIdFinchConfigVersion param different from
@@ -53,7 +53,7 @@
if (last_floc.finch_config_version() !=
static_cast<uint32_t>(kFlocIdFinchConfigVersion.Get())) {
return StartupComputeDecision{.invalidate_existing_floc = true,
- .next_compute_delay = base::nullopt};
+ .next_compute_delay = absl::nullopt};
}
base::TimeDelta presumed_next_compute_delay =
@@ -63,7 +63,7 @@
// The last floc has expired.
if (presumed_next_compute_delay <= base::TimeDelta()) {
return StartupComputeDecision{.invalidate_existing_floc = true,
- .next_compute_delay = base::nullopt};
+ .next_compute_delay = absl::nullopt};
}
// This could happen if the machine time has changed since the last
@@ -71,7 +71,7 @@
// rather than potentially stop computing for a very long time.
if (presumed_next_compute_delay >= 2 * kFlocIdScheduledUpdateInterval.Get()) {
return StartupComputeDecision{.invalidate_existing_floc = true,
- .next_compute_delay = base::nullopt};
+ .next_compute_delay = absl::nullopt};
}
// Normally "floc_accessible_since <= last_floc.history_begin_time()" is an
@@ -132,7 +132,7 @@
blink::mojom::InterestCohortPtr FlocIdProviderImpl::GetInterestCohortForJsApi(
const GURL& url,
- const base::Optional<url::Origin>& top_frame_origin) const {
+ const absl::optional<url::Origin>& top_frame_origin) const {
// Check the general floc setting.
if (!IsFlocAllowed())
return blink::mojom::InterestCohort::New();
@@ -381,7 +381,7 @@
uint64_t sim_hash,
base::Time history_begin_time,
base::Time history_end_time,
- base::Optional<uint64_t> final_hash,
+ absl::optional<uint64_t> final_hash,
base::Version version) {
if (!final_hash) {
std::move(callback).Run(ComputeFlocResult(sim_hash, FlocId()));
diff --git a/chrome/browser/federated_learning/floc_id_provider_impl.h b/chrome/browser/federated_learning/floc_id_provider_impl.h
index 5649912..9b0c25788 100644
--- a/chrome/browser/federated_learning/floc_id_provider_impl.h
+++ b/chrome/browser/federated_learning/floc_id_provider_impl.h
@@ -92,7 +92,7 @@
blink::mojom::InterestCohortPtr GetInterestCohortForJsApi(
const GURL& url,
- const base::Optional<url::Origin>& top_frame_origin) const override;
+ const absl::optional<url::Origin>& top_frame_origin) const override;
void MaybeRecordFlocToUkm(ukm::SourceId source_id) override;
@@ -144,7 +144,7 @@
uint64_t sim_hash,
base::Time history_begin_time,
base::Time history_end_time,
- base::Optional<uint64_t> final_hash,
+ absl::optional<uint64_t> final_hash,
base::Version version);
// Abandon any scheduled task, and schedule a new compute-floc task with
diff --git a/chrome/browser/federated_learning/floc_id_provider_unittest.cc b/chrome/browser/federated_learning/floc_id_provider_unittest.cc
index 48035436..67af0b5 100644
--- a/chrome/browser/federated_learning/floc_id_provider_unittest.cc
+++ b/chrome/browser/federated_learning/floc_id_provider_unittest.cc
@@ -45,7 +45,7 @@
public:
using FlocSortingLshClustersService::FlocSortingLshClustersService;
using MappingFunction =
- base::RepeatingCallback<base::Optional<uint64_t>(uint64_t)>;
+ base::RepeatingCallback<absl::optional<uint64_t>(uint64_t)>;
// Configure the version and the mapping function and trigger the file-ready
// event. If |mapping_function| is not provided, it will map any input
@@ -53,7 +53,7 @@
void ConfigureSortingLsh(base::Version version,
MappingFunction mapping_function =
base::BindRepeating([](uint64_t sim_hash) {
- return base::Optional<uint64_t>(sim_hash);
+ return absl::optional<uint64_t>(sim_hash);
})) {
version_ = version;
mapping_function_ = mapping_function;
@@ -173,7 +173,7 @@
// compute_time.
class FlocIdTester {
public:
- static FlocId Create(base::Optional<uint64_t> id,
+ static FlocId Create(absl::optional<uint64_t> id,
base::Time history_begin_time,
base::Time history_end_time,
uint32_t finch_config_version,
@@ -234,7 +234,7 @@
base::Version version,
MockFlocSortingLshService::MappingFunction mapping_function =
base::BindRepeating([](uint64_t sim_hash) {
- return base::Optional<uint64_t>(sim_hash);
+ return absl::optional<uint64_t>(sim_hash);
})) {
InitializeFlocIdProvider();
sorting_lsh_service_->ConfigureSortingLsh(version, mapping_function);
@@ -845,7 +845,7 @@
history::DeletionInfo deletion_info(
history::DeletionTimeRange(kTime3, kTime4),
/*is_from_expiration=*/false, /*deleted_rows=*/{}, /*favicon_urls=*/{},
- /*restrict_urls=*/base::nullopt);
+ /*restrict_urls=*/absl::nullopt);
OnURLsDeleted(history_service_.get(), deletion_info);
EXPECT_EQ(expected_floc, floc_id());
@@ -868,7 +868,7 @@
history::DeletionInfo deletion_info(
history::DeletionTimeRange(kTime2, kTime3),
/*is_from_expiration=*/false, /*deleted_rows=*/{}, /*favicon_urls=*/{},
- /*restrict_urls=*/base::nullopt);
+ /*restrict_urls=*/absl::nullopt);
OnURLsDeleted(history_service_.get(), deletion_info);
EXPECT_FALSE(floc_id().IsValid());
@@ -890,7 +890,7 @@
history::DeletionInfo deletion_info(
history::DeletionTimeRange(kTime1, kTime2),
/*is_from_expiration=*/false, /*deleted_rows=*/{}, /*favicon_urls=*/{},
- /*restrict_urls=*/base::nullopt);
+ /*restrict_urls=*/absl::nullopt);
OnURLsDeleted(history_service_.get(), deletion_info);
EXPECT_FALSE(floc_id().IsValid());
@@ -1177,8 +1177,8 @@
InitializeFlocIdProviderAndSortingLsh(
base::Version("99.0.0"), base::BindRepeating([](uint64_t sim_hash) {
if (sim_hash == FlocId::SimHashHistory({"foo.com"}))
- return base::Optional<uint64_t>(2);
- return base::Optional<uint64_t>();
+ return absl::optional<uint64_t>(2);
+ return absl::optional<uint64_t>();
}));
task_environment_.RunUntilIdle();
@@ -1195,7 +1195,7 @@
// Block the sim-hash.
InitializeFlocIdProviderAndSortingLsh(
base::Version("999.0.0"), base::BindRepeating([](uint64_t sim_hash) {
- return base::Optional<uint64_t>();
+ return absl::optional<uint64_t>();
}));
task_environment_.RunUntilIdle();
@@ -1222,7 +1222,7 @@
// Configure the |sorting_lsh_service_| to block any input sim-hash.
sorting_lsh_service_->ConfigureSortingLsh(
base::Version("3.4.5"), base::BindRepeating([](uint64_t sim_hash) {
- return base::Optional<uint64_t>();
+ return absl::optional<uint64_t>();
}));
task_environment_.FastForwardBy(base::TimeDelta::FromDays(1));
@@ -1242,8 +1242,8 @@
sorting_lsh_service_->ConfigureSortingLsh(
base::Version("999.0"), base::BindRepeating([](uint64_t sim_hash) {
if (sim_hash == FlocId::SimHashHistory({"foo.com"}))
- return base::Optional<uint64_t>(6789);
- return base::Optional<uint64_t>();
+ return absl::optional<uint64_t>(6789);
+ return absl::optional<uint64_t>();
}));
task_environment_.FastForwardBy(base::TimeDelta::FromDays(1));
@@ -1374,7 +1374,7 @@
InitializeFlocIdProvider();
FlocId initial_invalid_floc_id =
- FlocIdTester::Create(base::nullopt, kTwentyDaysBeforeStart,
+ FlocIdTester::Create(absl::nullopt, kTwentyDaysBeforeStart,
kNineteenDaysBeforeStart, 1, 888, kLastComputeTime);
// Initially the floc is invalidated as the last floc has expired, but other
@@ -1424,7 +1424,7 @@
InitializeFlocIdProvider();
FlocId initial_invalid_floc_id =
- FlocIdTester::Create(base::nullopt, kFourDaysBeforeStart,
+ FlocIdTester::Create(absl::nullopt, kFourDaysBeforeStart,
kThreeDaysBeforeStart, 1, 999, kLastComputeTime);
// Initially the floc is invalidated as the "presumed next computation delay"
@@ -1477,7 +1477,7 @@
InitializeFlocIdProvider();
FlocId initial_invalid_floc_id =
- FlocIdTester::Create(base::nullopt, kFourDaysBeforeStart,
+ FlocIdTester::Create(absl::nullopt, kFourDaysBeforeStart,
kThreeDaysBeforeStart, 0, 999, kLastComputeTime);
// Initially the floc is invalidated as the version mismatches, but other
diff --git a/chrome/browser/federated_learning/floc_remote_permission_service_unittest.cc b/chrome/browser/federated_learning/floc_remote_permission_service_unittest.cc
index 0ea4748..5c3d1bd9 100644
--- a/chrome/browser/federated_learning/floc_remote_permission_service_unittest.cc
+++ b/chrome/browser/federated_learning/floc_remote_permission_service_unittest.cc
@@ -67,8 +67,8 @@
private:
GURL expected_url_;
bool expected_floc_permission_;
- base::Optional<int> response_code_override_;
- base::Optional<std::string> response_body_override_;
+ absl::optional<int> response_code_override_;
+ absl::optional<std::string> response_body_override_;
DISALLOW_COPY_AND_ASSIGN(TestingFlocRemotePermissionService);
};
diff --git a/chrome/browser/feedback/show_feedback_page.cc b/chrome/browser/feedback/show_feedback_page.cc
index 4a4acbd..249a87c 100644
--- a/chrome/browser/feedback/show_feedback_page.cc
+++ b/chrome/browser/feedback/show_feedback_page.cc
@@ -76,7 +76,7 @@
const std::string& description_placeholder_text,
const std::string& category_tag,
const std::string& extra_diagnostics,
- const base::Optional<GURL>& active_tab_url) {
+ const absl::optional<GURL>& active_tab_url) {
GURL page_url;
if (active_tab_url)
page_url = *active_tab_url;
diff --git a/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc b/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
index 9038976..ea67c3b0 100644
--- a/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
+++ b/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
@@ -541,7 +541,7 @@
void ChromeInternalLogSource::PopulateLastUpdateState(
SystemLogsResponse* response) {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
- const base::Optional<UpdateState> update_state = GetLastUpdateState();
+ const absl::optional<UpdateState> update_state = GetLastUpdateState();
if (!update_state)
return; // There is nothing to include if no update check has completed.
diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
index 9e5da3a1..9eaaccf7 100644
--- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
+++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
@@ -17,7 +17,6 @@
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
@@ -47,6 +46,7 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
#if !defined(OS_ANDROID)
@@ -1496,20 +1496,20 @@
}
}
-base::Optional<base::Value>
+absl::optional<base::Value>
ChromeFileSystemAccessPermissionContext::GetPersistedPermission(
const url::Origin& origin,
const base::FilePath& path) {
if (!base::FeatureList::IsEnabled(
features::kFileSystemAccessPersistentPermissions)) {
- return base::nullopt;
+ return absl::nullopt;
}
// Don't persist permissions when the origin is allowlisted or blocked.
auto content_setting = GetWriteGuardContentSetting(origin);
if (content_setting == CONTENT_SETTING_ALLOW ||
content_setting == CONTENT_SETTING_BLOCK) {
- return base::nullopt;
+ return absl::nullopt;
}
// TODO(https://crbug.com/984772): If a parent directory has a persisted
@@ -1518,7 +1518,7 @@
const std::unique_ptr<Object> object =
GetGrantedObject(origin, PathAsPermissionKey(path));
if (!object)
- return base::nullopt;
+ return absl::nullopt;
return std::move(object->value);
}
diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
index 6d698cf..7396550 100644
--- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
+++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
@@ -218,7 +218,7 @@
bool AncestorHasActivePermission(const url::Origin& origin,
const base::FilePath& path,
GrantType grant_type);
- base::Optional<base::Value> GetPersistedPermission(
+ absl::optional<base::Value> GetPersistedPermission(
const url::Origin& origin,
const base::FilePath& path);
bool HasPersistedPermission(const url::Origin& origin,
diff --git a/chrome/browser/file_system_access/file_system_access_permission_request_manager.h b/chrome/browser/file_system_access/file_system_access_permission_request_manager.h
index d8e9f96..941df8e 100644
--- a/chrome/browser/file_system_access/file_system_access_permission_request_manager.h
+++ b/chrome/browser/file_system_access/file_system_access_permission_request_manager.h
@@ -76,7 +76,7 @@
// and then the bubble will proceed as desired as soon as it would have been
// shown.
void set_auto_response_for_test(
- base::Optional<permissions::PermissionAction> response) {
+ absl::optional<permissions::PermissionAction> response) {
auto_response_for_test_ = response;
}
@@ -107,7 +107,7 @@
// We only show new prompts when this is true.
bool main_frame_has_fully_loaded_ = false;
- base::Optional<permissions::PermissionAction> auto_response_for_test_;
+ absl::optional<permissions::PermissionAction> auto_response_for_test_;
base::WeakPtrFactory<FileSystemAccessPermissionRequestManager> weak_factory_{
this};
diff --git a/chrome/browser/google/google_brand.cc b/chrome/browser/google/google_brand.cc
index fd4fa31..bec54e8 100644
--- a/chrome/browser/google/google_brand.cc
+++ b/chrome/browser/google/google_brand.cc
@@ -9,12 +9,12 @@
#include "base/containers/contains.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/installer/util/google_update_settings.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if defined(OS_MAC)
#include "chrome/browser/mac/keystone_glue.h"
@@ -47,11 +47,11 @@
// Cache brand code value, since it is queried a lot and registry queries are
// slow enough to actually affect top-level metrics like
// Omnibox.CharTypedToRepaintLatency.
- static const base::NoDestructor<base::Optional<std::string>> brand_code(
- []() -> base::Optional<std::string> {
+ static const base::NoDestructor<absl::optional<std::string>> brand_code(
+ []() -> absl::optional<std::string> {
std::wstring brandw;
if (!GoogleUpdateSettings::GetBrand(&brandw))
- return base::nullopt;
+ return absl::nullopt;
return base::WideToASCII(brandw);
}());
if (!brand_code->has_value())
diff --git a/chrome/browser/google/google_brand.h b/chrome/browser/google/google_brand.h
index 1ed6f0b..72a9862 100644
--- a/chrome/browser/google/google_brand.h
+++ b/chrome/browser/google/google_brand.h
@@ -18,7 +18,7 @@
// Returns in |brand| the brand code or distribution tag that has been
// assigned to a partner. Returns false if the information is not available.
-// TODO(asvitkine): These APIs should return base::Optional<std::string>.
+// TODO(asvitkine): These APIs should return absl::optional<std::string>.
bool GetBrand(std::string* brand);
// Returns in |brand| the reactivation brand code or distribution tag
diff --git a/chrome/browser/google/google_brand_chromeos.cc b/chrome/browser/google/google_brand_chromeos.cc
index ad1f9a6..4e7dad2 100644
--- a/chrome/browser/google/google_brand_chromeos.cc
+++ b/chrome/browser/google/google_brand_chromeos.cc
@@ -77,7 +77,7 @@
std::string GetRlzBrand() {
policy::BrowserPolicyConnectorChromeOS* connector =
g_browser_process->platform_part()->browser_policy_connector_chromeos();
- base::Optional<policy::MarketSegment> market_segment;
+ absl::optional<policy::MarketSegment> market_segment;
if (connector->IsEnterpriseManaged())
market_segment = connector->GetEnterpriseMarketSegment();
// The rlz brand code may change over time (e.g. when device goes from
diff --git a/chrome/browser/google/google_brand_code_map_chromeos.cc b/chrome/browser/google/google_brand_code_map_chromeos.cc
index 6d7a3de3..051689a55 100644
--- a/chrome/browser/google/google_brand_code_map_chromeos.cc
+++ b/chrome/browser/google/google_brand_code_map_chromeos.cc
@@ -15,7 +15,7 @@
std::string GetRlzBrandCode(
const std::string& static_brand_code,
- base::Optional<policy::MarketSegment> market_segment) {
+ absl::optional<policy::MarketSegment> market_segment) {
struct BrandCodeValueEntry {
const char* unenrolled_brand_code;
const char* education_enrolled_brand_code;
diff --git a/chrome/browser/google/google_brand_code_map_chromeos.h b/chrome/browser/google/google_brand_code_map_chromeos.h
index 32fbc0a..0d538fa 100644
--- a/chrome/browser/google/google_brand_code_map_chromeos.h
+++ b/chrome/browser/google/google_brand_code_map_chromeos.h
@@ -7,8 +7,8 @@
#include <string>
-#include "base/optional.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace google_brand {
namespace chromeos {
@@ -18,7 +18,7 @@
// indicates the device is not enrolled).
std::string GetRlzBrandCode(
const std::string& static_brand_code,
- base::Optional<policy::MarketSegment> market_segment);
+ absl::optional<policy::MarketSegment> market_segment);
} // namespace chromeos
} // namespace google_brand
diff --git a/chrome/browser/google/google_brand_code_map_chromeos_unittest.cc b/chrome/browser/google/google_brand_code_map_chromeos_unittest.cc
index ec9bf4d..ecf5f84d 100644
--- a/chrome/browser/google/google_brand_code_map_chromeos_unittest.cc
+++ b/chrome/browser/google/google_brand_code_map_chromeos_unittest.cc
@@ -11,14 +11,14 @@
TEST(GoogleBrandCodeMapTest, GetRlzBrandCode) {
// If the static brand code is in the map, |GetRlzBrandCode| returns a
// variation based on the enrollment status and market segment.
- EXPECT_EQ("BMGD", GetRlzBrandCode("NPEC", base::nullopt));
+ EXPECT_EQ("BMGD", GetRlzBrandCode("NPEC", absl::nullopt));
EXPECT_EQ("YETH", GetRlzBrandCode("NPEC", policy::MarketSegment::EDUCATION));
EXPECT_EQ("XAWJ", GetRlzBrandCode("NPEC", policy::MarketSegment::ENTERPRISE));
EXPECT_EQ("XAWJ", GetRlzBrandCode("NPEC", policy::MarketSegment::UNKNOWN));
// If the static brand code is not in the map, |GetRlzBrandCode| always
// returns the static brand code.
- EXPECT_EQ("AAAA", GetRlzBrandCode("AAAA", base::nullopt));
+ EXPECT_EQ("AAAA", GetRlzBrandCode("AAAA", absl::nullopt));
EXPECT_EQ("AAAA", GetRlzBrandCode("AAAA", policy::MarketSegment::UNKNOWN));
EXPECT_EQ("AAAA", GetRlzBrandCode("AAAA", policy::MarketSegment::EDUCATION));
EXPECT_EQ("AAAA", GetRlzBrandCode("AAAA", policy::MarketSegment::ENTERPRISE));
diff --git a/chrome/browser/google/google_update_win.cc b/chrome/browser/google/google_update_win.cc
index ed72548..8e32195 100644
--- a/chrome/browser/google/google_update_win.cc
+++ b/chrome/browser/google/google_update_win.cc
@@ -203,8 +203,8 @@
}
// Returns the process-wide storage for the state of the last update check.
-base::Optional<UpdateState>* GetLastUpdateStateStorage() {
- static base::NoDestructor<base::Optional<UpdateState>> storage;
+absl::optional<UpdateState>* GetLastUpdateStateStorage() {
+ static base::NoDestructor<absl::optional<UpdateState>> storage;
return storage.get();
}
@@ -213,10 +213,10 @@
// was present without the value, or the value of the switch as an HRESULT.
// Additionally the returned structure contains the default error code
// GOOGLE_UPDATE_ERROR_UPDATING or the value of --simulate-update-error-code.
-base::Optional<UpdateCheckResult> GetSimulatedErrorForDebugging() {
+absl::optional<UpdateCheckResult> GetSimulatedErrorForDebugging() {
const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess();
if (!cmd_line.HasSwitch(switches::kSimulateUpdateHresult))
- return base::nullopt;
+ return absl::nullopt;
uint32_t error_from_string = 0;
std::string error_switch_value =
@@ -288,7 +288,7 @@
// to the user. This call should be followed by deletion of the driver, which
// will result in callers being notified via their delegates.
void OnUpgradeError(UpdateCheckResult check_result,
- base::Optional<int> installer_exit_code,
+ absl::optional<int> installer_exit_code,
const std::u16string& error_string);
// Returns true if |current_state| and |state_value| can be obtained from the
@@ -312,7 +312,7 @@
CurrentState state_value,
GoogleUpdateErrorCode* error_code,
HRESULT* hresult,
- base::Optional<int>* installer_exit_code,
+ absl::optional<int>* installer_exit_code,
std::u16string* error_string) const;
// Returns true if |current_state| and |state_value| constitute a final state
@@ -518,7 +518,7 @@
}
DCHECK(FAILED(result.hresult));
- OnUpgradeError(result, base::nullopt, std::u16string());
+ OnUpgradeError(result, absl::nullopt, std::u16string());
result_runner_->DeleteSoon(FROM_HERE, this);
}
@@ -652,7 +652,7 @@
CurrentState state_value,
GoogleUpdateErrorCode* error_code,
HRESULT* hresult,
- base::Optional<int>* installer_exit_code,
+ absl::optional<int>* installer_exit_code,
std::u16string* error_string) const {
if (state_value == STATE_ERROR) {
// In general, errors reported by Google Update fall under this category
@@ -808,7 +808,7 @@
CurrentState state_value = STATE_INIT;
HRESULT hresult = S_OK;
GoogleUpdateErrorCode error_code = GOOGLE_UPDATE_NO_ERROR;
- base::Optional<int> installer_exit_code;
+ absl::optional<int> installer_exit_code;
std::u16string error_string;
GoogleUpdateUpgradeStatus upgrade_status = UPGRADE_ERROR;
std::u16string new_version;
@@ -816,7 +816,7 @@
if (!GetCurrentState(&state, &state_value, &hresult)) {
OnUpgradeError({GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR, hresult},
- base::nullopt, std::u16string());
+ absl::nullopt, std::u16string());
} else if (IsErrorState(state, state_value, &error_code, &hresult,
&installer_exit_code, &error_string)) {
OnUpgradeError({error_code, hresult}, installer_exit_code, error_string);
@@ -867,7 +867,7 @@
}
void UpdateCheckDriver::OnUpgradeError(UpdateCheckResult check_result,
- base::Optional<int> installer_exit_code,
+ absl::optional<int> installer_exit_code,
const std::u16string& error_string) {
status_ = UPGRADE_ERROR;
update_state_.error_code = check_result.error_code;
@@ -922,7 +922,7 @@
UpdateState& UpdateState::operator=(UpdateState&&) = default;
UpdateState::~UpdateState() = default;
-base::Optional<UpdateState> GetLastUpdateState() {
+absl::optional<UpdateState> GetLastUpdateState() {
return *GetLastUpdateStateStorage();
}
diff --git a/chrome/browser/google/google_update_win.h b/chrome/browser/google/google_update_win.h
index 7e6fde0..f4793ee 100644
--- a/chrome/browser/google/google_update_win.h
+++ b/chrome/browser/google/google_update_win.h
@@ -12,8 +12,8 @@
#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "google_update/google_update_idl.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/native_widget_types.h"
namespace base {
@@ -123,12 +123,12 @@
HRESULT hresult = S_OK;
// If present, the process exit code from the failed run of the installer.
- base::Optional<int> installer_exit_code;
+ absl::optional<int> installer_exit_code;
};
// Returns the state from the most recent completed update check or no value if
// no such check has taken place.
-base::Optional<UpdateState> GetLastUpdateState();
+absl::optional<UpdateState> GetLastUpdateState();
// A type of callback supplied by tests to provide a custom IGoogleUpdate3Web
// implementation (see src/google_update/google_update_idl.idl).
diff --git a/chrome/browser/hid/hid_chooser_context_unittest.cc b/chrome/browser/hid/hid_chooser_context_unittest.cc
index 70f7b32..c643429 100644
--- a/chrome/browser/hid/hid_chooser_context_unittest.cc
+++ b/chrome/browser/hid/hid_chooser_context_unittest.cc
@@ -123,7 +123,7 @@
base::RunLoop permission_granted_loop;
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::HID_GUARD),
+ absl::make_optional(ContentSettingsType::HID_GUARD),
ContentSettingsType::HID_CHOOSER_DATA))
.WillOnce(RunClosure(permission_granted_loop.QuitClosure()))
.WillOnce([]() {
@@ -182,7 +182,7 @@
base::RunLoop permission_granted_loop;
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::HID_GUARD),
+ absl::make_optional(ContentSettingsType::HID_GUARD),
ContentSettingsType::HID_CHOOSER_DATA))
.WillOnce(RunClosure(permission_granted_loop.QuitClosure()))
.WillOnce([]() {
@@ -244,7 +244,7 @@
base::RunLoop permission_granted_loop;
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::HID_GUARD),
+ absl::make_optional(ContentSettingsType::HID_GUARD),
ContentSettingsType::HID_CHOOSER_DATA))
.WillOnce(RunClosure(permission_granted_loop.QuitClosure()))
.WillOnce([]() {
@@ -307,7 +307,7 @@
base::RunLoop permission_granted_loop;
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::HID_GUARD),
+ absl::make_optional(ContentSettingsType::HID_GUARD),
ContentSettingsType::HID_CHOOSER_DATA))
.WillOnce(RunClosure(permission_granted_loop.QuitClosure()));
@@ -349,7 +349,7 @@
base::RunLoop permission_granted_loop;
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::HID_GUARD),
+ absl::make_optional(ContentSettingsType::HID_GUARD),
ContentSettingsType::HID_CHOOSER_DATA))
.WillOnce(RunClosure(permission_granted_loop.QuitClosure()))
.WillOnce([]() {
@@ -389,7 +389,7 @@
base::RunLoop permission_granted_loop;
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::HID_GUARD),
+ absl::make_optional(ContentSettingsType::HID_GUARD),
ContentSettingsType::HID_CHOOSER_DATA))
.WillOnce(RunClosure(permission_granted_loop.QuitClosure()))
.WillOnce([]() {
diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc
index 6d65d6892..fbe626d 100644
--- a/chrome/browser/history/history_tab_helper.cc
+++ b/chrome/browser/history/history_tab_helper.cc
@@ -6,7 +6,6 @@
#include <string>
-#include "base/optional.h"
#include "base/stl_util.h"
#include "build/build_config.h"
#include "chrome/browser/history/history_service_factory.h"
@@ -22,6 +21,7 @@
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
#if defined(OS_ANDROID)
@@ -132,9 +132,9 @@
ShouldConsiderForNtpMostVisited(*web_contents(), navigation_handle),
/*floc_allowed=*/false,
navigation_handle->IsSameDocument()
- ? base::Optional<std::u16string>(
+ ? absl::optional<std::u16string>(
navigation_handle->GetWebContents()->GetTitle())
- : base::nullopt);
+ : absl::nullopt);
if (ui::PageTransitionIsMainFrame(page_transition) &&
virtual_url != navigation_handle->GetURL()) {
diff --git a/chrome/browser/infobars/infobars_browsertest.cc b/chrome/browser/infobars/infobars_browsertest.cc
index bd3284c..e58d96d 100644
--- a/chrome/browser/infobars/infobars_browsertest.cc
+++ b/chrome/browser/infobars/infobars_browsertest.cc
@@ -7,7 +7,6 @@
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/buildflag.h"
@@ -55,6 +54,7 @@
#include "extensions/browser/test_extension_registry_observer.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "sandbox/policy/switches.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#if !BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/installable/installable_manager_browsertest.cc b/chrome/browser/installable/installable_manager_browsertest.cc
index 23ffa93..9b2f0e0 100644
--- a/chrome/browser/installable/installable_manager_browsertest.cc
+++ b/chrome/browser/installable/installable_manager_browsertest.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
@@ -29,6 +28,7 @@
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/features.h"
namespace webapps {
@@ -1892,7 +1892,7 @@
"/banners/manifest_test_page.html");
// Simulate a manifest URL update by just calling the observer function.
static_cast<content::WebContentsObserver*>(manager)->DidUpdateWebManifestURL(
- nullptr, base::nullopt);
+ nullptr, absl::nullopt);
run_loop.Run();
ASSERT_EQ(tester->errors().size(), 1u);
diff --git a/chrome/browser/installable/quality_enforcer.cc b/chrome/browser/installable/quality_enforcer.cc
index a34149b..c2e8908 100644
--- a/chrome/browser/installable/quality_enforcer.cc
+++ b/chrome/browser/installable/quality_enforcer.cc
@@ -8,9 +8,9 @@
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/android/jni_utils.h"
-#include "base/optional.h"
#include "chrome/android/chrome_jni_headers/QualityEnforcer_jni.h"
#include "content/public/browser/render_frame_host.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom.h"
#include "third_party/blink/public/mojom/devtools/inspector_issue.mojom.h"
#include "url/gurl.h"
@@ -61,15 +61,15 @@
return;
std::string url = base::android::ConvertJavaStringToUTF8(env, jurl);
- base::Optional<std::string> package_name =
+ absl::optional<std::string> package_name =
jpackage_name
- ? base::make_optional(
+ ? absl::make_optional(
base::android::ConvertJavaStringToUTF8(env, jpackage_name))
- : base::nullopt;
- base::Optional<std::string> signature =
- jsignature ? base::make_optional(
+ : absl::nullopt;
+ absl::optional<std::string> signature =
+ jsignature ? absl::make_optional(
base::android::ConvertJavaStringToUTF8(env, jsignature))
- : base::nullopt;
+ : absl::nullopt;
auto details = blink::mojom::InspectorIssueDetails::New();
auto twa_issue = blink::mojom::TrustedWebActivityIssueDetails::New(
diff --git a/chrome/browser/lacros/automation_manager_lacros.cc b/chrome/browser/lacros/automation_manager_lacros.cc
index 171ee72..4a7eac7b 100644
--- a/chrome/browser/lacros/automation_manager_lacros.cc
+++ b/chrome/browser/lacros/automation_manager_lacros.cc
@@ -82,7 +82,7 @@
}
void AutomationManagerLacros::DispatchGetTextLocationDataResult(
const ui::AXActionData& data,
- const base::Optional<gfx::Rect>& rect) {
+ const absl::optional<gfx::Rect>& rect) {
// TODO(https://crbug.com/1185764): Implement me.
}
diff --git a/chrome/browser/lacros/automation_manager_lacros.h b/chrome/browser/lacros/automation_manager_lacros.h
index bd1f8974..4159d25 100644
--- a/chrome/browser/lacros/automation_manager_lacros.h
+++ b/chrome/browser/lacros/automation_manager_lacros.h
@@ -39,7 +39,7 @@
content::BrowserContext* browser_context) override;
void DispatchGetTextLocationDataResult(
const ui::AXActionData& data,
- const base::Optional<gfx::Rect>& rect) override;
+ const absl::optional<gfx::Rect>& rect) override;
// AutomationClient:
void Enable() override;
diff --git a/chrome/browser/lacros/cert_db_initializer_impl.h b/chrome/browser/lacros/cert_db_initializer_impl.h
index 9baf6f67..83e1f09 100644
--- a/chrome/browser/lacros/cert_db_initializer_impl.h
+++ b/chrome/browser/lacros/cert_db_initializer_impl.h
@@ -54,7 +54,7 @@
// created together with a new profile and never outlives it.`
Profile* profile_ = nullptr;
std::unique_ptr<IdentityManagerObserver> identity_manager_observer_;
- base::Optional<bool> is_ready_;
+ absl::optional<bool> is_ready_;
base::OnceCallbackList<ReadyCallback::RunType> callbacks_;
base::WeakPtrFactory<CertDbInitializerImpl> weak_factory_{this};
diff --git a/chrome/browser/lacros/metrics_reporting_lacros_browsertest.cc b/chrome/browser/lacros/metrics_reporting_lacros_browsertest.cc
index a4564892..9e2df78 100644
--- a/chrome/browser/lacros/metrics_reporting_lacros_browsertest.cc
+++ b/chrome/browser/lacros/metrics_reporting_lacros_browsertest.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/optional.h"
#include "base/run_loop.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chromeos/crosapi/mojom/metrics_reporting.mojom.h"
@@ -10,6 +9,7 @@
#include "content/public/test/browser_test.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crosapi {
namespace {
@@ -29,7 +29,7 @@
}
// Public because this is test code.
- base::Optional<bool> metrics_enabled_;
+ absl::optional<bool> metrics_enabled_;
base::RunLoop* on_changed_run_loop_ = nullptr;
mojo::Receiver<mojom::MetricsReportingObserver> receiver_{this};
};
diff --git a/chrome/browser/lacros/metrics_reporting_observer_unittest.cc b/chrome/browser/lacros/metrics_reporting_observer_unittest.cc
index ea67d235..b87c137 100644
--- a/chrome/browser/lacros/metrics_reporting_observer_unittest.cc
+++ b/chrome/browser/lacros/metrics_reporting_observer_unittest.cc
@@ -26,7 +26,7 @@
++change_metrics_reporting_count_;
}
- base::Optional<bool> metrics_reporting_enabled_;
+ absl::optional<bool> metrics_reporting_enabled_;
int change_metrics_reporting_count_ = 0;
};
diff --git a/chrome/browser/lacros/popup_lacros_browsertest.cc b/chrome/browser/lacros/popup_lacros_browsertest.cc
index 4959f76..18d9b28 100644
--- a/chrome/browser/lacros/popup_lacros_browsertest.cc
+++ b/chrome/browser/lacros/popup_lacros_browsertest.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/optional.h"
#include "base/test/bind.h"
#include "base/timer/timer.h"
#include "chrome/browser/lacros/browser_test_util.h"
@@ -17,6 +16,7 @@
#include "chromeos/crosapi/mojom/test_controller.mojom.h"
#include "chromeos/lacros/lacros_service.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/aura/window.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point_f.h"
@@ -32,11 +32,11 @@
base::RunLoop outer_loop;
auto wait_for_position = base::BindLambdaForTesting([&]() {
base::RunLoop inner_loop(base::RunLoop::Type::kNestableTasksAllowed);
- base::Optional<gfx::Point> position;
+ absl::optional<gfx::Point> position;
lacros_service->GetRemote<crosapi::mojom::TestController>()
->GetWindowPositionInScreen(
window_id, base::BindLambdaForTesting(
- [&](const base::Optional<gfx::Point>& p) {
+ [&](const absl::optional<gfx::Point>& p) {
position = p;
inner_loop.Quit();
}));
diff --git a/chrome/browser/lifetime/browser_close_manager_browsertest.cc b/chrome/browser/lifetime/browser_close_manager_browsertest.cc
index 8efd01c..ff42e1c 100644
--- a/chrome/browser/lifetime/browser_close_manager_browsertest.cc
+++ b/chrome/browser/lifetime/browser_close_manager_browsertest.cc
@@ -14,7 +14,6 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
@@ -64,6 +63,7 @@
#include "content/public/test/slow_download_http_response.h"
#include "content/public/test/test_navigation_observer.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_switches.h"
@@ -226,7 +226,7 @@
download::DownloadDangerType danger_type,
download::DownloadItem::MixedContentStatus mcs,
const base::FilePath& intermediate_path,
- base::Optional<download::DownloadSchedule> download_schedule,
+ absl::optional<download::DownloadSchedule> download_schedule,
download::DownloadInterruptReason reason) {
std::move(callback).Run(target_path, disp,
download::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL, mcs,
diff --git a/chrome/browser/lite_video/lite_video_decider.cc b/chrome/browser/lite_video/lite_video_decider.cc
index 0f91fa3..55f5253 100644
--- a/chrome/browser/lite_video/lite_video_decider.cc
+++ b/chrome/browser/lite_video/lite_video_decider.cc
@@ -7,7 +7,6 @@
#include "base/callback_helpers.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/histogram_macros_local.h"
-#include "base/optional.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/lite_video/lite_video_features.h"
#include "chrome/browser/lite_video/lite_video_hint.h"
@@ -23,6 +22,7 @@
#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/web_contents.h"
#include "net/nqe/effective_connection_type.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
namespace {
@@ -130,7 +130,7 @@
if (!IsLiteVideoAllowedForUser(Profile::FromBrowserContext(
navigation_handle->GetWebContents()->GetBrowserContext()))) {
std::move(callback).Run(
- base::nullopt, blocklist_reason,
+ absl::nullopt, blocklist_reason,
optimization_guide::OptimizationGuideDecision::kFalse);
return;
}
@@ -149,7 +149,7 @@
if (!CanApplyOnCurrentNetworkConditions(is_cellular_network_,
current_effective_connection_type_)) {
std::move(callback).Run(
- base::nullopt, blocklist_reason,
+ absl::nullopt, blocklist_reason,
optimization_guide::OptimizationGuideDecision::kFalse);
return;
}
@@ -158,7 +158,7 @@
if (!url.SchemeIsHTTPOrHTTPS()) {
std::move(callback).Run(
- base::nullopt, blocklist_reason,
+ absl::nullopt, blocklist_reason,
optimization_guide::OptimizationGuideDecision::kFalse);
return;
}
@@ -168,7 +168,7 @@
ScopedLiteVideoDecisionRecorder scoped_decision_recorder(
blocklist_reason, navigation_handle->IsInMainFrame());
std::move(callback).Run(
- base::nullopt, blocklist_reason,
+ absl::nullopt, blocklist_reason,
optimization_guide::OptimizationGuideDecision::kFalse);
return;
}
@@ -187,7 +187,7 @@
ScopedLiteVideoDecisionRecorder scoped_decision_recorder(
blocklist_reason, navigation_handle->IsInMainFrame());
std::move(callback).Run(
- base::nullopt, blocklist_reason,
+ absl::nullopt, blocklist_reason,
optimization_guide::OptimizationGuideDecision::kFalse);
return;
}
@@ -212,7 +212,7 @@
// For subframes, check if a hint is cached that can be used
// immediately. Otherwise, the callback from the optimization guide
// will trigger subframes to get the supplied hint.
- base::Optional<LiteVideoHint> hint;
+ absl::optional<LiteVideoHint> hint;
optimization_guide::OptimizationGuideDecision opt_guide_decision =
optimization_guide::OptimizationGuideDecision::kUnknown;
GURL mainframe_url =
@@ -238,7 +238,7 @@
return;
}
- base::Optional<LiteVideoHint> hint =
+ absl::optional<LiteVideoHint> hint =
hint_cache_->GetHintForNavigationURL(url);
ScopedLiteVideoDecisionRecorder scoped_decision_recorder(
blocklist_reason, navigation_handle->IsInMainFrame());
@@ -248,7 +248,7 @@
if (blocklist_reason != LiteVideoBlocklistReason::kAllowed || !hint) {
std::move(callback).Run(
- base::nullopt, blocklist_reason,
+ absl::nullopt, blocklist_reason,
optimization_guide::OptimizationGuideDecision::kFalse);
return;
}
@@ -271,7 +271,7 @@
user_blocklist_->AddNavigationToBlocklist(navigation_handle, false);
navigation_handle->IsInMainFrame()
- ? DidMediaRebuffer(navigation_handle->GetURL(), base::nullopt, false)
+ ? DidMediaRebuffer(navigation_handle->GetURL(), absl::nullopt, false)
: DidMediaRebuffer(
navigation_handle->GetWebContents()->GetLastCommittedURL(),
navigation_handle->GetURL(), false);
@@ -296,14 +296,14 @@
// If the decision is false, then add an empty entry into the hint cache
// so that subframes with this mainframe host will return false.
if (decision == optimization_guide::OptimizationGuideDecision::kFalse) {
- cached_opt_guide_hints_.Put(mainframe_url.host(), base::nullopt);
+ cached_opt_guide_hints_.Put(mainframe_url.host(), absl::nullopt);
UMA_HISTOGRAM_COUNTS_100("LiteVideo.LiteVideoDecider.OptGuideHintCacheSize",
cached_opt_guide_hints_.size());
}
if (blocklist_reason != LiteVideoBlocklistReason::kAllowed ||
decision != optimization_guide::OptimizationGuideDecision::kTrue) {
- std::move(callback).Run(base::nullopt, blocklist_reason, decision);
+ std::move(callback).Run(absl::nullopt, blocklist_reason, decision);
return;
}
@@ -313,7 +313,7 @@
features::LiteVideoKilobytesToBufferBeforeThrottle(),
features::LiteVideoMaxThrottlingDelay());
- base::Optional<optimization_guide::proto::LiteVideoMetadata>
+ absl::optional<optimization_guide::proto::LiteVideoMetadata>
lite_video_metadata =
metadata
.ParsedMetadata<optimization_guide::proto::LiteVideoMetadata>();
@@ -369,7 +369,7 @@
}
void LiteVideoDecider::DidMediaRebuffer(const GURL& mainframe_url,
- base::Optional<GURL> subframe_url,
+ absl::optional<GURL> subframe_url,
bool opt_out) {
if (user_blocklist_) {
user_blocklist_->AddRebufferToBlocklist(mainframe_url, subframe_url,
diff --git a/chrome/browser/lite_video/lite_video_decider.h b/chrome/browser/lite_video/lite_video_decider.h
index 8f2b8d07..b2c36ba 100644
--- a/chrome/browser/lite_video/lite_video_decider.h
+++ b/chrome/browser/lite_video/lite_video_decider.h
@@ -9,13 +9,13 @@
#include "base/containers/flat_set.h"
#include "base/containers/mru_cache.h"
-#include "base/optional.h"
#include "base/time/clock.h"
#include "chrome/browser/lite_video/lite_video_hint_cache.h"
#include "chrome/browser/lite_video/lite_video_user_blocklist.h"
#include "components/blocklist/opt_out_blocklist/opt_out_blocklist_delegate.h"
#include "services/network/public/cpp/network_connection_tracker.h"
#include "services/network/public/cpp/network_quality_tracker.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace blocklist {
@@ -31,7 +31,7 @@
namespace lite_video {
using LiteVideoHintCallback = base::OnceCallback<void(
- base::Optional<LiteVideoHint> hint,
+ absl::optional<LiteVideoHint> hint,
LiteVideoBlocklistReason blocklist_reason,
optimization_guide::OptimizationGuideDecision opt_guide_decision)>;
@@ -86,7 +86,7 @@
// Update |user_blocklist_| that a rebuffer event consided an opt-out on the
// mainframe and subframe URLs occurred.
void DidMediaRebuffer(const GURL& mainframe_url,
- base::Optional<GURL> subframe_url,
+ absl::optional<GURL> subframe_url,
bool opt_out);
// Set the optimization guide decider used by |this| for testing only.
@@ -144,7 +144,7 @@
// The store of hints provided by the optimization guide keyed by mainframe
// host. If the hint is empty, then the optimization guide returned kFalse.
- base::HashingMRUCache<std::string, base::Optional<LiteVideoHint>>
+ base::HashingMRUCache<std::string, absl::optional<LiteVideoHint>>
cached_opt_guide_hints_;
// The set of hosts that are permanently blocked from having LiteVideos
diff --git a/chrome/browser/lite_video/lite_video_decider_unittest.cc b/chrome/browser/lite_video/lite_video_decider_unittest.cc
index fc29c10..9e079be 100644
--- a/chrome/browser/lite_video/lite_video_decider_unittest.cc
+++ b/chrome/browser/lite_video/lite_video_decider_unittest.cc
@@ -8,7 +8,6 @@
#include <utility>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
@@ -31,6 +30,7 @@
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
#include "url/gurl.h"
@@ -65,12 +65,12 @@
public:
TestLiteVideoHintCache() = default;
~TestLiteVideoHintCache() override = default;
- base::Optional<lite_video::LiteVideoHint> GetHintForNavigationURL(
+ absl::optional<lite_video::LiteVideoHint> GetHintForNavigationURL(
const GURL& url) const override {
auto it = hint_cache_.find(url);
if (it != hint_cache_.end())
return it->second;
- return base::nullopt;
+ return absl::nullopt;
}
void AddHintForTesting(const GURL& url,
@@ -206,7 +206,7 @@
}
void SeedLiteVideoHintCache(const GURL& gurl,
- base::Optional<lite_video::LiteVideoHint> hint,
+ absl::optional<lite_video::LiteVideoHint> hint,
bool use_opt_guide) {
if (use_opt_guide) {
optimization_guide::OptimizationMetadata default_metadata;
@@ -264,7 +264,7 @@
}
void OnHintAvailable(
- base::Optional<lite_video::LiteVideoHint> hint,
+ absl::optional<lite_video::LiteVideoHint> hint,
lite_video::LiteVideoBlocklistReason blocklist_reason,
optimization_guide::OptimizationGuideDecision opt_guide_decision) {
opt_guide_decision_ = opt_guide_decision;
@@ -272,7 +272,7 @@
blocklist_reason_ = blocklist_reason;
}
- base::Optional<lite_video::LiteVideoHint> hint() { return hint_; }
+ absl::optional<lite_video::LiteVideoHint> hint() { return hint_; }
optimization_guide::OptimizationGuideDecision opt_guide_decision() {
return opt_guide_decision_;
@@ -294,7 +294,7 @@
base::SimpleTestClock test_clock_;
std::unique_ptr<lite_video::LiteVideoDecider> lite_video_decider_;
lite_video::LiteVideoBlocklistReason blocklist_reason_;
- base::Optional<lite_video::LiteVideoHint> hint_;
+ absl::optional<lite_video::LiteVideoHint> hint_;
std::unique_ptr<TestOptimizationGuideDecider> optimization_guide_decider_;
optimization_guide::OptimizationGuideDecision opt_guide_decision_;
bool allow_on_forward_back_;
@@ -595,7 +595,7 @@
content::MockNavigationHandle navigation_handle(web_contents());
navigation_handle.set_url(url);
navigation_handle.set_page_transition(ui::PAGE_TRANSITION_TYPED);
- SeedLiteVideoHintCache(url, /*hint=*/base::nullopt, /*use_opt_guide=*/true);
+ SeedLiteVideoHintCache(url, /*hint=*/absl::nullopt, /*use_opt_guide=*/true);
lite_video_decider()->CanApplyLiteVideo(
&navigation_handle, base::BindOnce(&LiteVideoDeciderTest::OnHintAvailable,
@@ -684,7 +684,7 @@
navigation_handle.set_url(mainframe_url);
navigation_handle.set_page_transition(ui::PAGE_TRANSITION_TYPED);
- SeedLiteVideoHintCache(mainframe_url, base::nullopt, /*use_opt_guide=*/true);
+ SeedLiteVideoHintCache(mainframe_url, absl::nullopt, /*use_opt_guide=*/true);
CanApplyOnSubframeNavigation(mainframe_url, url);
RunUntilIdle();
@@ -717,7 +717,7 @@
navigation_handle.set_url(mainframe_url);
navigation_handle.set_page_transition(ui::PAGE_TRANSITION_TYPED);
- SeedLiteVideoHintCache(subframe_url, base::nullopt, /*use_opt_guide=*/true);
+ SeedLiteVideoHintCache(subframe_url, absl::nullopt, /*use_opt_guide=*/true);
// Force a check on the mainframe, otherwise no hint will be set for the
// subframe.
@@ -759,7 +759,7 @@
navigation_handle.set_url(mainframe_url);
navigation_handle.set_page_transition(ui::PAGE_TRANSITION_TYPED);
- SeedLiteVideoHintCache(mainframe_url, base::nullopt, /*use_opt_guide=*/true);
+ SeedLiteVideoHintCache(mainframe_url, absl::nullopt, /*use_opt_guide=*/true);
lite_video_decider()->CanApplyLiteVideo(
&navigation_handle, base::BindOnce(&LiteVideoDeciderTest::OnHintAvailable,
@@ -790,7 +790,7 @@
navigation_handle.set_url(mainframe_url);
navigation_handle.set_page_transition(ui::PAGE_TRANSITION_TYPED);
- SeedLiteVideoHintCache(mainframe_url, base::nullopt, /*use_opt_guide=*/true);
+ SeedLiteVideoHintCache(mainframe_url, absl::nullopt, /*use_opt_guide=*/true);
lite_video_decider()->CanApplyLiteVideo(
&navigation_handle, base::BindOnce(&LiteVideoDeciderTest::OnHintAvailable,
@@ -819,7 +819,7 @@
navigation_handle.set_url(mainframe_url);
navigation_handle.set_page_transition(ui::PAGE_TRANSITION_TYPED);
- SeedLiteVideoHintCache(mainframe_url, base::nullopt, /*use_opt_guide=*/true);
+ SeedLiteVideoHintCache(mainframe_url, absl::nullopt, /*use_opt_guide=*/true);
lite_video_decider()->CanApplyLiteVideo(
&navigation_handle, base::BindOnce(&LiteVideoDeciderTest::OnHintAvailable,
diff --git a/chrome/browser/lite_video/lite_video_features.cc b/chrome/browser/lite_video/lite_video_features.cc
index 95c045d1..53eeaae 100644
--- a/chrome/browser/lite_video/lite_video_features.cc
+++ b/chrome/browser/lite_video/lite_video_features.cc
@@ -9,10 +9,10 @@
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/common/chrome_features.h"
#include "net/nqe/effective_connection_type.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace lite_video {
namespace features {
@@ -31,17 +31,17 @@
::features::kLiteVideo, "use_optimization_guide", false);
}
-base::Optional<base::Value> GetLiteVideoOriginHintsFromFieldTrial() {
+absl::optional<base::Value> GetLiteVideoOriginHintsFromFieldTrial() {
if (!IsLiteVideoEnabled())
- return base::nullopt;
+ return absl::nullopt;
const std::string lite_video_origin_hints_json =
base::GetFieldTrialParamValueByFeature(::features::kLiteVideo,
"lite_video_origin_hints");
if (lite_video_origin_hints_json.empty())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<base::Value> lite_video_origin_hints =
+ absl::optional<base::Value> lite_video_origin_hints =
base::JSONReader::Read(lite_video_origin_hints_json);
UMA_HISTOGRAM_BOOLEAN(
@@ -109,7 +109,7 @@
if (permanent_host_blocklist_json.empty())
return {};
- base::Optional<base::Value> permanent_host_blocklist_parsed =
+ absl::optional<base::Value> permanent_host_blocklist_parsed =
base::JSONReader::Read(permanent_host_blocklist_json);
if (!permanent_host_blocklist_parsed ||
diff --git a/chrome/browser/lite_video/lite_video_features.h b/chrome/browser/lite_video/lite_video_features.h
index d2da3e2..0470aac 100644
--- a/chrome/browser/lite_video/lite_video_features.h
+++ b/chrome/browser/lite_video/lite_video_features.h
@@ -7,8 +7,8 @@
#include "base/containers/flat_set.h"
#include "base/feature_list.h"
-#include "base/optional.h"
#include "net/nqe/effective_connection_type.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
namespace base {
@@ -32,7 +32,7 @@
// Return the origins that are whitelisted for using the LiteVideo optimization
// and the parameters needed to throttle media requests for that origin.
-base::Optional<base::Value> GetLiteVideoOriginHintsFromFieldTrial();
+absl::optional<base::Value> GetLiteVideoOriginHintsFromFieldTrial();
// The target for of the round-trip time for media requests used when
// throttling media requests.
diff --git a/chrome/browser/lite_video/lite_video_hint_cache.cc b/chrome/browser/lite_video/lite_video_hint_cache.cc
index 1115cd09..9b3531d 100644
--- a/chrome/browser/lite_video/lite_video_hint_cache.cc
+++ b/chrome/browser/lite_video/lite_video_hint_cache.cc
@@ -14,17 +14,17 @@
LiteVideoHintCache::~LiteVideoHintCache() = default;
-base::Optional<LiteVideoHint> LiteVideoHintCache::GetHintForNavigationURL(
+absl::optional<LiteVideoHint> LiteVideoHintCache::GetHintForNavigationURL(
const GURL& url) const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!origin_hints_ || !origin_hints_->is_dict())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<int> target_downlink_bandwidth_kbps =
+ absl::optional<int> target_downlink_bandwidth_kbps =
origin_hints_->FindIntKey(url.host());
if (!target_downlink_bandwidth_kbps)
- return base::nullopt;
+ return absl::nullopt;
return LiteVideoHint(*target_downlink_bandwidth_kbps,
features::LiteVideoTargetDownlinkRTTLatency(),
diff --git a/chrome/browser/lite_video/lite_video_hint_cache.h b/chrome/browser/lite_video/lite_video_hint_cache.h
index 4c7abda..2386e69 100644
--- a/chrome/browser/lite_video/lite_video_hint_cache.h
+++ b/chrome/browser/lite_video/lite_video_hint_cache.h
@@ -7,9 +7,9 @@
#include <stdint.h>
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/values.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace lite_video {
@@ -25,12 +25,12 @@
// Returns a LiteVideoHint if one exists for the navigation URL.
// Virtual for testing.
- virtual base::Optional<LiteVideoHint> GetHintForNavigationURL(
+ virtual absl::optional<LiteVideoHint> GetHintForNavigationURL(
const GURL& url) const;
private:
// The set of hints, keyed by origin, available to the hint cache.
- const base::Optional<base::Value> origin_hints_;
+ const absl::optional<base::Value> origin_hints_;
SEQUENCE_CHECKER(sequence_checker_);
};
diff --git a/chrome/browser/lite_video/lite_video_hint_cache_unittest.cc b/chrome/browser/lite_video/lite_video_hint_cache_unittest.cc
index 1878628..325a492 100644
--- a/chrome/browser/lite_video/lite_video_hint_cache_unittest.cc
+++ b/chrome/browser/lite_video/lite_video_hint_cache_unittest.cc
@@ -44,7 +44,7 @@
GURL url("https://LiteVideo.com");
ConfigHintCacheWithParams(
{{"lite_video_origin_hints", "{\"litevideo.com\": 123}"}});
- base::Optional<lite_video::LiteVideoHint> hint =
+ absl::optional<lite_video::LiteVideoHint> hint =
hint_cache()->GetHintForNavigationURL(url);
ASSERT_TRUE(hint);
EXPECT_EQ(123, hint->target_downlink_bandwidth_kbps());
diff --git a/chrome/browser/lite_video/lite_video_observer.cc b/chrome/browser/lite_video/lite_video_observer.cc
index 2a3a2f6..85b4d18 100644
--- a/chrome/browser/lite_video/lite_video_observer.cc
+++ b/chrome/browser/lite_video/lite_video_observer.cc
@@ -6,7 +6,6 @@
#include "base/bind.h"
#include "base/metrics/histogram_macros_local.h"
-#include "base/optional.h"
#include "base/rand_util.h"
#include "chrome/browser/lite_video/lite_video_decider.h"
#include "chrome/browser/lite_video/lite_video_features.h"
@@ -32,6 +31,7 @@
#include "services/metrics/public/cpp/ukm_source.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/service_manager/public/cpp/interface_provider.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/features.h"
@@ -115,7 +115,7 @@
void LiteVideoObserver::OnHintAvailable(
const content::GlobalFrameRoutingId& render_frame_host_routing_id,
- base::Optional<lite_video::LiteVideoHint> hint,
+ absl::optional<lite_video::LiteVideoHint> hint,
lite_video::LiteVideoBlocklistReason blocklist_reason,
optimization_guide::OptimizationGuideDecision opt_guide_decision) {
auto* render_frame_host =
@@ -203,7 +203,7 @@
}
lite_video::LiteVideoDecision LiteVideoObserver::MakeLiteVideoDecision(
- base::Optional<lite_video::LiteVideoHint> hint) const {
+ absl::optional<lite_video::LiteVideoHint> hint) const {
if (hint) {
return is_coinflip_holdback_ ? lite_video::LiteVideoDecision::kHoldback
: lite_video::LiteVideoDecision::kAllowed;
@@ -271,7 +271,7 @@
// Determine and log if the rebuffer happened in the mainframe.
render_frame_host->GetMainFrame() == render_frame_host
? lite_video_decider_->DidMediaRebuffer(
- render_frame_host->GetLastCommittedURL(), base::nullopt, true)
+ render_frame_host->GetLastCommittedURL(), absl::nullopt, true)
: lite_video_decider_->DidMediaRebuffer(
render_frame_host->GetMainFrame()->GetLastCommittedURL(),
render_frame_host->GetLastCommittedURL(), true);
diff --git a/chrome/browser/lite_video/lite_video_observer.h b/chrome/browser/lite_video/lite_video_observer.h
index 911389f..1ceef9f9 100644
--- a/chrome/browser/lite_video/lite_video_observer.h
+++ b/chrome/browser/lite_video/lite_video_observer.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_LITE_VIDEO_LITE_VIDEO_OBSERVER_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/lite_video/lite_video_navigation_metrics.h"
#include "chrome/browser/lite_video/lite_video_user_blocklist.h"
#include "chrome/common/lite_video_service.mojom.h"
@@ -14,6 +13,7 @@
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_receiver_set.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class NavigationHandle;
@@ -57,7 +57,7 @@
// Determines the LiteVideoDecision based on |hint| and the coinflip
// holdback state.
lite_video::LiteVideoDecision MakeLiteVideoDecision(
- base::Optional<lite_video::LiteVideoHint> hint) const;
+ absl::optional<lite_video::LiteVideoHint> hint) const;
// Records the metrics for LiteVideos applied to any frames associated with
// the current mainframe navigation id. Called once per mainframe.
@@ -72,7 +72,7 @@
// within the agent associated with |render_frame_host_routing_id|.
void OnHintAvailable(
const content::GlobalFrameRoutingId& render_frame_host_routing_id,
- base::Optional<lite_video::LiteVideoHint> hint,
+ absl::optional<lite_video::LiteVideoHint> hint,
lite_video::LiteVideoBlocklistReason blocklist_reason,
optimization_guide::OptimizationGuideDecision opt_guide_decision);
@@ -88,7 +88,7 @@
// The current metrics about the navigation |this| is observing. Reset
// after each time the metrics being held are recorded as a UKM event.
- base::Optional<lite_video::LiteVideoNavigationMetrics> nav_metrics_;
+ absl::optional<lite_video::LiteVideoNavigationMetrics> nav_metrics_;
// Whether the navigations currently being observed should have the LiteVideo
// optimization heldback due to a coinflip, counterfactual experiment.
diff --git a/chrome/browser/lite_video/lite_video_user_blocklist.cc b/chrome/browser/lite_video/lite_video_user_blocklist.cc
index afc9f2a..ad868b5a 100644
--- a/chrome/browser/lite_video/lite_video_user_blocklist.cc
+++ b/chrome/browser/lite_video/lite_video_user_blocklist.cc
@@ -4,11 +4,11 @@
#include "chrome/browser/lite_video/lite_video_user_blocklist.h"
-#include "base/optional.h"
#include "chrome/browser/lite_video/lite_video_features.h"
#include "components/blocklist/opt_out_blocklist/opt_out_store.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -24,17 +24,17 @@
// Returns the key for a navigation used for the rebuffer blocklist type.
// The key format is "mainframe.com_subframe.com", if the navigation is the
// mainframe navigation, the key omits subframe.com, e.g., "mainframe.com_"
-base::Optional<std::string> GetRebufferBlocklistKey(
+absl::optional<std::string> GetRebufferBlocklistKey(
const GURL& mainframe_url,
- base::Optional<GURL> subframe_url) {
+ absl::optional<GURL> subframe_url) {
if (!IsURLValidForBlocklist(mainframe_url))
- return base::nullopt;
+ return absl::nullopt;
if (!subframe_url)
return mainframe_url.host() + kLiteVideoBlocklistKeySeparator;
if (!IsURLValidForBlocklist(*subframe_url))
- return base::nullopt;
+ return absl::nullopt;
return mainframe_url.host() + kLiteVideoBlocklistKeySeparator +
subframe_url->host();
}
@@ -68,9 +68,9 @@
if (blocklist_reason != blocklist::BlocklistReason::kAllowed)
return LiteVideoBlocklistReason::kNavigationBlocklisted;
- base::Optional<std::string> rebuffer_key =
+ absl::optional<std::string> rebuffer_key =
navigation_handle->IsInMainFrame()
- ? GetRebufferBlocklistKey(navigation_url, base::nullopt)
+ ? GetRebufferBlocklistKey(navigation_url, absl::nullopt)
: GetRebufferBlocklistKey(
navigation_handle->GetWebContents()->GetLastCommittedURL(),
navigation_url);
@@ -141,10 +141,10 @@
void LiteVideoUserBlocklist::AddRebufferToBlocklist(
const GURL& mainframe_url,
- base::Optional<GURL> subframe_url,
+ absl::optional<GURL> subframe_url,
bool opt_out) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- base::Optional<std::string> rebuffer_key =
+ absl::optional<std::string> rebuffer_key =
GetRebufferBlocklistKey(mainframe_url, subframe_url);
if (rebuffer_key) {
AddEntry(*rebuffer_key, opt_out,
diff --git a/chrome/browser/lite_video/lite_video_user_blocklist.h b/chrome/browser/lite_video/lite_video_user_blocklist.h
index 1a9c833..c5e9f0b 100644
--- a/chrome/browser/lite_video/lite_video_user_blocklist.h
+++ b/chrome/browser/lite_video/lite_video_user_blocklist.h
@@ -91,7 +91,7 @@
// Update the entry within the RebufferBlocklistType for the
// mainframe and subframe urls based on whether it was an opt-out or not.
void AddRebufferToBlocklist(const GURL& mainframe_url,
- base::Optional<GURL> subframe_url,
+ absl::optional<GURL> subframe_url,
bool opt_out);
protected:
diff --git a/chrome/browser/lite_video/lite_video_user_blocklist_unittest.cc b/chrome/browser/lite_video/lite_video_user_blocklist_unittest.cc
index d1d6748..faa8db5 100644
--- a/chrome/browser/lite_video/lite_video_user_blocklist_unittest.cc
+++ b/chrome/browser/lite_video/lite_video_user_blocklist_unittest.cc
@@ -182,7 +182,7 @@
MainframeNavigationBlocklistedByRebufferBlocklist) {
ConfigBlocklistParamsForTesting();
GURL url("https://test.com");
- blocklist()->AddRebufferToBlocklist(url, base::nullopt, true);
+ blocklist()->AddRebufferToBlocklist(url, absl::nullopt, true);
EXPECT_EQ(CheckBlocklistForMainframeNavigation(url),
LiteVideoBlocklistReason::kRebufferingBlocklisted);
}
diff --git a/chrome/browser/login_detection/login_detection_browsertest.cc b/chrome/browser/login_detection/login_detection_browsertest.cc
index aedeb44..30a8a8f 100644
--- a/chrome/browser/login_detection/login_detection_browsertest.cc
+++ b/chrome/browser/login_detection/login_detection_browsertest.cc
@@ -43,7 +43,7 @@
browser()->profile());
optimization_guide_decider->AddHintForTesting(
GURL("https://www.optguideloggedin.com/page.html"),
- optimization_guide::proto::LOGIN_DETECTION, base::nullopt);
+ optimization_guide::proto::LOGIN_DETECTION, absl::nullopt);
https_test_server_.ServeFilesFromSourceDirectory("chrome/test/data");
ASSERT_TRUE(https_test_server_.Start());
diff --git a/chrome/browser/login_detection/login_detection_prefs.cc b/chrome/browser/login_detection/login_detection_prefs.cc
index 88858a5..daf9ea1 100644
--- a/chrome/browser/login_detection/login_detection_prefs.cc
+++ b/chrome/browser/login_detection/login_detection_prefs.cc
@@ -59,7 +59,7 @@
while (dict->DictSize() > GetOauthLoggedInSitesMaxSize()) {
// Holds the pair of site name, its last login time for the site that was
// least recently signed-in to be removed.
- base::Optional<std::pair<std::string, base::Time>> site_entry_to_remove;
+ absl::optional<std::pair<std::string, base::Time>> site_entry_to_remove;
for (const auto& site_entry : dict->DictItems()) {
base::Time signin_time = *util::ValueToTime(site_entry.second);
if (!site_entry_to_remove || signin_time < site_entry_to_remove->second) {
diff --git a/chrome/browser/login_detection/oauth_login_detector.cc b/chrome/browser/login_detection/oauth_login_detector.cc
index 5abee39e5..b6c09e4 100644
--- a/chrome/browser/login_detection/oauth_login_detector.cc
+++ b/chrome/browser/login_detection/oauth_login_detector.cc
@@ -45,7 +45,7 @@
OAuthLoginDetector::~OAuthLoginDetector() = default;
-base::Optional<GURL> OAuthLoginDetector::GetSuccessfulLoginFlowSite(
+absl::optional<GURL> OAuthLoginDetector::GetSuccessfulLoginFlowSite(
const GURL& prev_navigation_url,
const std::vector<GURL>& redirect_chain) {
for (size_t i = 0; i < redirect_chain.size(); i++) {
@@ -53,7 +53,7 @@
// Allow login flows to be detected only on HTTPS pages.
if (!navigation_url.SchemeIs(url::kHttpsScheme)) {
login_flow_info_.reset();
- return base::nullopt;
+ return absl::nullopt;
}
// Check for OAuth login completion.
@@ -86,7 +86,7 @@
}
if (login_flow_info_)
login_flow_info_->count_navigations_since_login_flow_start++;
- return base::nullopt;
+ return absl::nullopt;
}
void OAuthLoginDetector::DidOpenAsPopUp(const GURL& opener_navigation_url) {
@@ -96,14 +96,14 @@
}
}
-base::Optional<GURL> OAuthLoginDetector::GetPopUpLoginFlowSite() const {
+absl::optional<GURL> OAuthLoginDetector::GetPopUpLoginFlowSite() const {
// OAuth has never started.
if (!login_flow_info_)
- return base::nullopt;
+ return absl::nullopt;
// Only consider OAuth completion when this is a popup window.
if (!popup_opener_navigation_site_)
- return base::nullopt;
+ return absl::nullopt;
return login_flow_info_->oauth_requestor_site;
}
diff --git a/chrome/browser/login_detection/oauth_login_detector.h b/chrome/browser/login_detection/oauth_login_detector.h
index b036bd1..6844529 100644
--- a/chrome/browser/login_detection/oauth_login_detector.h
+++ b/chrome/browser/login_detection/oauth_login_detector.h
@@ -8,7 +8,7 @@
#include <set>
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace login_detection {
@@ -45,17 +45,17 @@
OAuthLoginDetector& operator=(const OAuthLoginDetector&) = delete;
// Processes the navigation |redirect_chain| and returns the site that started
- // the OAuth login flow and completed. base::nullopt is returned when there is
+ // the OAuth login flow and completed. absl::nullopt is returned when there is
// no login flow detected or it has not yet completed. |prev_navigation_url|
// is the URL of the previous navigation on this detector, and can be invalid
// when no previous navigation happened.
- base::Optional<GURL> GetSuccessfulLoginFlowSite(
+ absl::optional<GURL> GetSuccessfulLoginFlowSite(
const GURL& prev_navigation_url,
const std::vector<GURL>& redirect_chain);
// Returns the OAuth requestor site when popup based login flow is detected,
- // otherwise base::nullopt is returned.
- base::Optional<GURL> GetPopUpLoginFlowSite() const;
+ // otherwise absl::nullopt is returned.
+ absl::optional<GURL> GetPopUpLoginFlowSite() const;
// Indicates this detector is opened for a popup window, and the opener window
// had the |opener_navigation_url|.
@@ -94,11 +94,11 @@
// Info about the current login flow. Exists only when there is an ongoing
// OAuth login flow. Created on the start of login flow, and destroyed when
// the flow completes successfully or navigation limit is reached.
- base::Optional<OAuthLoginFlowInfo> login_flow_info_;
+ absl::optional<OAuthLoginFlowInfo> login_flow_info_;
- // The site that opened this detector window as a popup. base::nullopt when
+ // The site that opened this detector window as a popup. absl::nullopt when
// this detector is not opened as a popup.
- base::Optional<GURL> popup_opener_navigation_site_;
+ absl::optional<GURL> popup_opener_navigation_site_;
};
} // namespace login_detection
diff --git a/chrome/browser/login_detection/password_store_sites.h b/chrome/browser/login_detection/password_store_sites.h
index 96caf37f..158c6c2 100644
--- a/chrome/browser/login_detection/password_store_sites.h
+++ b/chrome/browser/login_detection/password_store_sites.h
@@ -8,10 +8,10 @@
#include <set>
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "chrome/browser/password_manager/password_store_factory.h"
#include "components/password_manager/core/browser/password_store.h"
#include "components/password_manager/core/browser/password_store_consumer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace login_detection {
@@ -42,9 +42,9 @@
// The password store |this| is observing site entries from.
scoped_refptr<password_manager::PasswordStore> password_store_;
- // Set of sites saved in the password store. Will be base::nullopt until the
+ // Set of sites saved in the password store. Will be absl::nullopt until the
// sites are retrieved the fist time.
- base::Optional<std::set<std::string>> password_sites_;
+ absl::optional<std::set<std::string>> password_sites_;
SEQUENCE_CHECKER(sequence_checker_);
};
diff --git a/chrome/browser/long_screenshots/long_screenshots_tab_service.cc b/chrome/browser/long_screenshots/long_screenshots_tab_service.cc
index 694c4087..338100c 100644
--- a/chrome/browser/long_screenshots/long_screenshots_tab_service.cc
+++ b/chrome/browser/long_screenshots/long_screenshots_tab_service.cc
@@ -99,7 +99,7 @@
int clipY,
int clipWidth,
int clipHeight,
- const base::Optional<base::FilePath>& file_path) {
+ const absl::optional<base::FilePath>& file_path) {
if (!file_path.has_value()) {
JNIEnv* env = base::android::AttachCurrentThread();
Java_LongScreenshotsTabService_processCaptureTabStatus(
diff --git a/chrome/browser/long_screenshots/long_screenshots_tab_service.h b/chrome/browser/long_screenshots/long_screenshots_tab_service.h
index facfea3..4a96ab22 100644
--- a/chrome/browser/long_screenshots/long_screenshots_tab_service.h
+++ b/chrome/browser/long_screenshots/long_screenshots_tab_service.h
@@ -107,7 +107,7 @@
int clipY,
int clipWidth,
int clipHeight,
- const base::Optional<base::FilePath>& file_path);
+ const absl::optional<base::FilePath>& file_path);
void OnCaptured(paint_preview::PaintPreviewBaseService::CaptureStatus status,
std::unique_ptr<paint_preview::CaptureResult> result);
diff --git a/chrome/browser/long_screenshots/long_screenshots_tab_service_unittest.cc b/chrome/browser/long_screenshots/long_screenshots_tab_service_unittest.cc
index 29f6d8a..101b391 100644
--- a/chrome/browser/long_screenshots/long_screenshots_tab_service_unittest.cc
+++ b/chrome/browser/long_screenshots/long_screenshots_tab_service_unittest.cc
@@ -181,7 +181,7 @@
base::BindOnce(&FileManager::CreateOrGetDirectory, file_manager, key,
false),
base::BindOnce(
- [](base::FilePath* out, const base::Optional<base::FilePath>& path) {
+ [](base::FilePath* out, const absl::optional<base::FilePath>& path) {
EXPECT_TRUE(path.has_value());
*out = path.value();
},
@@ -203,7 +203,7 @@
base::BindOnce(&FileManager::CreateOrGetDirectory, file_manager, key,
false),
base::BindOnce(
- [](base::FilePath* out, const base::Optional<base::FilePath>& path) {
+ [](base::FilePath* out, const absl::optional<base::FilePath>& path) {
EXPECT_TRUE(path.has_value());
*out = path.value();
},
diff --git a/chrome/browser/lookalikes/digital_asset_links_cross_validator.cc b/chrome/browser/lookalikes/digital_asset_links_cross_validator.cc
index c081c5f..a2d77232 100644
--- a/chrome/browser/lookalikes/digital_asset_links_cross_validator.cc
+++ b/chrome/browser/lookalikes/digital_asset_links_cross_validator.cc
@@ -63,7 +63,7 @@
start_time_ = clock_->Now();
asset_link_handler_->SetTimeoutDuration(timeout_);
asset_link_handler_->CheckDigitalAssetLinkRelationship(
- lookalike_domain_.Serialize(), kDigitalAssetLinkRecordType, base::nullopt,
+ lookalike_domain_.Serialize(), kDigitalAssetLinkRecordType, absl::nullopt,
{{"namespace", {"web"}}, {"site", {target_domain_.Serialize()}}},
base::BindOnce(
&DigitalAssetLinkCrossValidator::OnFetchLookalikeManifestComplete,
@@ -100,7 +100,7 @@
target_manifest_timeout_ = timeout_ - elapsed;
asset_link_handler_->SetTimeoutDuration(target_manifest_timeout_);
asset_link_handler_->CheckDigitalAssetLinkRelationship(
- target_domain_.Serialize(), kDigitalAssetLinkRecordType, base::nullopt,
+ target_domain_.Serialize(), kDigitalAssetLinkRecordType, absl::nullopt,
{{"namespace", {"web"}},
{"site", GetLookalikeOrigins(lookalike_domain_)}},
base::BindOnce(
diff --git a/chrome/browser/lookalikes/lookalike_url_navigation_throttle.cc b/chrome/browser/lookalikes/lookalike_url_navigation_throttle.cc
index 0232b42..a4fb98e 100644
--- a/chrome/browser/lookalikes/lookalike_url_navigation_throttle.cc
+++ b/chrome/browser/lookalikes/lookalike_url_navigation_throttle.cc
@@ -149,7 +149,7 @@
handle->IsSignedExchangeInnerResponse(), triggered_by_initial_url,
std::move(controller)));
- base::Optional<std::string> error_page_contents =
+ absl::optional<std::string> error_page_contents =
blocking_page->GetHTMLContents();
security_interstitials::SecurityInterstitialTabHelper::AssociateBlockingPage(
diff --git a/chrome/browser/media/android/cdm/media_drm_origin_id_manager.cc b/chrome/browser/media/android/cdm/media_drm_origin_id_manager.cc
index da199dc6..fa20307 100644
--- a/chrome/browser/media/android/cdm/media_drm_origin_id_manager.cc
+++ b/chrome/browser/media/android/cdm/media_drm_origin_id_manager.cc
@@ -118,7 +118,7 @@
if (!token_value)
return false;
- base::Optional<base::Time> expiration_time = util::ValueToTime(token_value);
+ absl::optional<base::Time> expiration_time = util::ValueToTime(token_value);
if (!expiration_time) {
RemoveExpirableToken(origin_id_dict);
return false;
@@ -163,7 +163,7 @@
return base::UnguessableToken::Null();
auto first_entry = origin_ids->GetList().begin();
- base::Optional<base::UnguessableToken> result =
+ absl::optional<base::UnguessableToken> result =
util::ValueToUnguessableToken(*first_entry);
if (!result)
return base::UnguessableToken::Null();
@@ -207,7 +207,7 @@
// system_network_context_manager() returns nullptr in unit tests.
DLOG(WARNING) << "Failed to provision origin ID as no "
"system_network_context_manager";
- std::move(callback).Run(false, base::nullopt);
+ std::move(callback).Run(false, absl::nullopt);
return;
}
@@ -271,7 +271,7 @@
LOG_IF(WARNING, !success) << "Failed to provision origin ID";
std::move(complete_callback_)
.Run(success,
- success ? base::make_optional(origin_id_) : base::nullopt);
+ success ? absl::make_optional(origin_id_) : absl::nullopt);
delete this;
}
@@ -367,7 +367,7 @@
// Reject any pending requests.
while (!pending_provisioned_origin_id_cbs_.empty()) {
std::move(pending_provisioned_origin_id_cbs_.front())
- .Run(GetOriginIdStatus::kFailure, base::nullopt);
+ .Run(GetOriginIdStatus::kFailure, absl::nullopt);
pending_provisioned_origin_id_cbs_.pop();
}
}
@@ -491,7 +491,7 @@
pending_requests.swap(pending_provisioned_origin_id_cbs_);
while (!pending_requests.empty()) {
std::move(pending_requests.front())
- .Run(GetOriginIdStatus::kFailure, base::nullopt);
+ .Run(GetOriginIdStatus::kFailure, absl::nullopt);
pending_requests.pop();
}
}
diff --git a/chrome/browser/media/android/cdm/media_drm_origin_id_manager.h b/chrome/browser/media/android/cdm/media_drm_origin_id_manager.h
index 9dd30acf..1b6da2d 100644
--- a/chrome/browser/media/android/cdm/media_drm_origin_id_manager.h
+++ b/chrome/browser/media/android/cdm/media_drm_origin_id_manager.h
@@ -10,11 +10,11 @@
#include "base/callback.h"
#include "base/containers/queue.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/threading/thread_checker.h"
#include "base/unguessable_token.h"
#include "components/keyed_service/core/keyed_service.h"
#include "media/base/media_drm_storage.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class MediaDrmOriginIdManagerFactory;
class PrefRegistrySimple;
diff --git a/chrome/browser/media/android/cdm/media_drm_origin_id_manager_unittest.cc b/chrome/browser/media/android/cdm/media_drm_origin_id_manager_unittest.cc
index f059443b..5e2d1fc 100644
--- a/chrome/browser/media/android/cdm/media_drm_origin_id_manager_unittest.cc
+++ b/chrome/browser/media/android/cdm/media_drm_origin_id_manager_unittest.cc
@@ -12,7 +12,6 @@
#include "base/callback_helpers.h"
#include "base/containers/contains.h"
#include "base/json/json_string_value_serializer.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
@@ -27,6 +26,7 @@
#include "services/network/test/test_network_connection_tracker.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
diff --git a/chrome/browser/media/android/cdm/media_drm_storage_factory.cc b/chrome/browser/media/android/cdm/media_drm_storage_factory.cc
index 86365bc..a16e1510 100644
--- a/chrome/browser/media/android/cdm/media_drm_storage_factory.cc
+++ b/chrome/browser/media/android/cdm/media_drm_storage_factory.cc
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "chrome/browser/media/android/cdm/media_drm_origin_id_manager.h"
#include "chrome/browser/media/android/cdm/media_drm_origin_id_manager_factory.h"
#include "chrome/browser/media/android/cdm/per_device_provisioning_permission.h"
@@ -23,6 +22,7 @@
#include "content/public/browser/web_contents.h"
#include "media/base/android/media_drm_bridge.h"
#include "media/base/media_switches.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -80,7 +80,7 @@
MediaDrmOriginIdManagerFactory::GetForProfile(profile);
if (!origin_id_manager) {
ReportResultToUma(GetOriginIdResult::kFailureWithNoFactory);
- std::move(callback).Run(false, base::nullopt);
+ std::move(callback).Run(false, absl::nullopt);
return;
}
diff --git a/chrome/browser/media/audio_service_util.cc b/chrome/browser/media/audio_service_util.cc
index afd64480..b66a7d7 100644
--- a/chrome/browser/media/audio_service_util.cc
+++ b/chrome/browser/media/audio_service_util.cc
@@ -7,7 +7,6 @@
#include <string>
#include "base/feature_list.h"
-#include "base/optional.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
@@ -17,6 +16,7 @@
#include "components/policy/core/common/policy_service.h"
#include "components/policy/policy_constants.h"
#include "content/public/common/content_features.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -28,7 +28,7 @@
->GetPolicyService()
->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME,
std::string()));
- base::Optional<bool> policy_value;
+ absl::optional<bool> policy_value;
if (const base::Value* value = policies.GetValue(policy_name))
policy_value = value->GetIfBool();
return policy_value.value_or(base::FeatureList::IsEnabled(feature));
diff --git a/chrome/browser/media/cast_mirroring_performance_browsertest.cc b/chrome/browser/media/cast_mirroring_performance_browsertest.cc
index 661df1d..5be63ba 100644
--- a/chrome/browser/media/cast_mirroring_performance_browsertest.cc
+++ b/chrome/browser/media/cast_mirroring_performance_browsertest.cc
@@ -835,7 +835,7 @@
protected:
// Ensure best effort tasks are not required for this test to pass.
- base::Optional<base::ThreadPoolInstance::ScopedBestEffortExecutionFence>
+ absl::optional<base::ThreadPoolInstance::ScopedBestEffortExecutionFence>
best_effort_fence_;
// HTTPS server for loading pages from the test data dir.
diff --git a/chrome/browser/media/cast_mirroring_service_host.cc b/chrome/browser/media/cast_mirroring_service_host.cc
index 251a9dc..4f58382 100644
--- a/chrome/browser/media/cast_mirroring_service_host.cc
+++ b/chrome/browser/media/cast_mirroring_service_host.cc
@@ -12,7 +12,6 @@
#include "base/logging.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -40,6 +39,7 @@
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/network_service.mojom.h"
#include "services/viz/public/mojom/gpu.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "url/origin.h"
@@ -112,13 +112,13 @@
return media_id;
}
-// Returns the size of the primary display in pixels, or base::nullopt if it
+// Returns the size of the primary display in pixels, or absl::nullopt if it
// cannot be determined.
-base::Optional<gfx::Size> GetScreenResolution() {
+absl::optional<gfx::Size> GetScreenResolution() {
display::Screen* screen = display::Screen::GetScreen();
if (!screen) {
DVLOG(1) << "Cannot get the Screen object.";
- return base::nullopt;
+ return absl::nullopt;
}
return screen->GetPrimaryDisplay().GetSizeInPixel();
}
@@ -224,7 +224,7 @@
// static
gfx::Size CastMirroringServiceHost::GetCaptureResolutionConstraint() {
- base::Optional<gfx::Size> screen_resolution = GetScreenResolution();
+ absl::optional<gfx::Size> screen_resolution = GetScreenResolution();
if (screen_resolution) {
return GetClampedResolution(screen_resolution.value());
} else {
@@ -412,7 +412,7 @@
mojo::PendingRemote<AudioInputStream> stream,
mojo::PendingReceiver<AudioInputStreamClient> client,
media::mojom::ReadOnlyAudioDataPipePtr data_pipe, bool,
- const base::Optional<base::UnguessableToken>&) {
+ const absl::optional<base::UnguessableToken>&) {
mojo::Remote<mojom::AudioStreamCreatorClient>(std::move(requestor))
->StreamCreated(std::move(stream), std::move(client),
std::move(data_pipe));
diff --git a/chrome/browser/media/cast_remoting_connector.h b/chrome/browser/media/cast_remoting_connector.h
index a60e150a..3f58c318 100644
--- a/chrome/browser/media/cast_remoting_connector.h
+++ b/chrome/browser/media/cast_remoting_connector.h
@@ -9,7 +9,6 @@
#include <vector>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/supports_user_data.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/sessions/core/session_id.h"
@@ -19,6 +18,7 @@
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class RenderFrameHost;
@@ -226,7 +226,7 @@
// Permission is checked the first time remoting requested to start for each
// casting session.
- base::Optional<bool> remoting_allowed_;
+ absl::optional<bool> remoting_allowed_;
// This callback is non-null when a dialog is showing to get user's
// permission, and is reset when the dialog closes.
diff --git a/chrome/browser/media/history/media_history_browsertest.cc b/chrome/browser/media/history/media_history_browsertest.cc
index 04dbf8b..54654ba 100644
--- a/chrome/browser/media/history/media_history_browsertest.cc
+++ b/chrome/browser/media/history/media_history_browsertest.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/media/history/media_history_store.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -36,6 +35,7 @@
#include "net/dns/mock_host_resolver.h"
#include "services/media_session/public/cpp/media_metadata.h"
#include "services/media_session/public/cpp/test/mock_media_session.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/features.h"
namespace media_history {
diff --git a/chrome/browser/media/history/media_history_contents_observer.cc b/chrome/browser/media/history/media_history_contents_observer.cc
index 3d8481e4..2f3c59d 100644
--- a/chrome/browser/media/history/media_history_contents_observer.cc
+++ b/chrome/browser/media/history/media_history_contents_observer.cc
@@ -78,7 +78,7 @@
}
void MediaHistoryContentsObserver::MediaSessionMetadataChanged(
- const base::Optional<media_session::MediaMetadata>& metadata) {
+ const absl::optional<media_session::MediaMetadata>& metadata) {
if (!metadata.has_value() || frozen_)
return;
@@ -101,7 +101,7 @@
}
void MediaHistoryContentsObserver::MediaSessionPositionChanged(
- const base::Optional<media_session::MediaPosition>& position) {
+ const absl::optional<media_session::MediaPosition>& position) {
if (!position.has_value() || frozen_)
return;
diff --git a/chrome/browser/media/history/media_history_contents_observer.h b/chrome/browser/media/history/media_history_contents_observer.h
index 9d156d7..bad413a1 100644
--- a/chrome/browser/media/history/media_history_contents_observer.h
+++ b/chrome/browser/media/history/media_history_contents_observer.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_MEDIA_HISTORY_MEDIA_HISTORY_CONTENTS_OBSERVER_H_
#define CHROME_BROWSER_MEDIA_HISTORY_MEDIA_HISTORY_CONTENTS_OBSERVER_H_
-#include "base/optional.h"
#include "chrome/browser/media/history/media_history_keyed_service.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "services/media_session/public/mojom/media_session.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class MediaHistoryContentsObserver
@@ -31,7 +31,7 @@
void MediaSessionInfoChanged(
media_session::mojom::MediaSessionInfoPtr session_info) override;
void MediaSessionMetadataChanged(
- const base::Optional<media_session::MediaMetadata>&) override;
+ const absl::optional<media_session::MediaMetadata>&) override;
void MediaSessionActionsChanged(
const std::vector<media_session::mojom::MediaSessionAction>& action)
override {}
@@ -40,7 +40,7 @@
std::vector<media_session::MediaImage>>& images)
override;
void MediaSessionPositionChanged(
- const base::Optional<media_session::MediaPosition>& position) override;
+ const absl::optional<media_session::MediaPosition>& position) override;
private:
friend class content::WebContentsUserData<MediaHistoryContentsObserver>;
@@ -51,8 +51,8 @@
// Stores the current media session metadata, position, artwork urls and URL
// that might be committed to media history.
- base::Optional<media_session::MediaMetadata> cached_metadata_;
- base::Optional<media_session::MediaPosition> cached_position_;
+ absl::optional<media_session::MediaMetadata> cached_metadata_;
+ absl::optional<media_session::MediaPosition> cached_position_;
std::vector<media_session::MediaImage> cached_artwork_;
GURL current_url_;
diff --git a/chrome/browser/media/history/media_history_images_table.cc b/chrome/browser/media/history/media_history_images_table.cc
index 635726a..681ac3cc 100644
--- a/chrome/browser/media/history/media_history_images_table.cc
+++ b/chrome/browser/media/history/media_history_images_table.cc
@@ -65,13 +65,13 @@
return sql::INIT_OK;
}
-base::Optional<int64_t> MediaHistoryImagesTable::SaveOrGetImage(
+absl::optional<int64_t> MediaHistoryImagesTable::SaveOrGetImage(
const GURL& url,
const url::Origin& playback_origin,
const std::u16string& mime_type) {
DCHECK_LT(0, DB()->transaction_nesting());
if (!CanAccessDatabase())
- return base::nullopt;
+ return absl::nullopt;
{
// First we should try and save the image in the database. It will not save
@@ -89,7 +89,7 @@
statement.BindString16(2, mime_type);
if (!statement.Run())
- return base::nullopt;
+ return absl::nullopt;
}
// If the insert is successful and we have store an image row then we should
@@ -123,7 +123,7 @@
}
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace media_history
diff --git a/chrome/browser/media/history/media_history_images_table.h b/chrome/browser/media/history/media_history_images_table.h
index 0ddec10..a20396ff 100644
--- a/chrome/browser/media/history/media_history_images_table.h
+++ b/chrome/browser/media/history/media_history_images_table.h
@@ -37,7 +37,7 @@
sql::InitStatus CreateTableIfNonExistent() override;
// Saves the image or gets the image ID if it is already in the database.
- base::Optional<int64_t> SaveOrGetImage(const GURL& url,
+ absl::optional<int64_t> SaveOrGetImage(const GURL& url,
const url::Origin& playback_origin,
const std::u16string& mime_type);
};
diff --git a/chrome/browser/media/history/media_history_keyed_service.cc b/chrome/browser/media/history/media_history_keyed_service.cc
index f279b58..4a0e51d 100644
--- a/chrome/browser/media/history/media_history_keyed_service.cc
+++ b/chrome/browser/media/history/media_history_keyed_service.cc
@@ -231,8 +231,8 @@
}
void MediaHistoryKeyedService::GetPlaybackSessions(
- base::Optional<unsigned int> num_sessions,
- base::Optional<GetPlaybackSessionsFilter> filter,
+ absl::optional<unsigned int> num_sessions,
+ absl::optional<GetPlaybackSessionsFilter> filter,
base::OnceCallback<
void(std::vector<mojom::MediaHistoryPlaybackSessionRowPtr>)> callback) {
base::PostTaskAndReplyWithResult(
@@ -245,7 +245,7 @@
void MediaHistoryKeyedService::SavePlaybackSession(
const GURL& url,
const media_session::MediaMetadata& metadata,
- const base::Optional<media_session::MediaPosition>& position,
+ const absl::optional<media_session::MediaPosition>& position,
const std::vector<media_session::MediaImage>& artwork) {
if (auto* store = store_->GetForWrite()) {
store->db_task_runner_->PostTask(
diff --git a/chrome/browser/media/history/media_history_keyed_service.h b/chrome/browser/media/history/media_history_keyed_service.h
index 47b6ba3..8b6a1d74 100644
--- a/chrome/browser/media/history/media_history_keyed_service.h
+++ b/chrome/browser/media/history/media_history_keyed_service.h
@@ -71,8 +71,8 @@
base::RepeatingCallback<bool(const base::TimeDelta& duration,
const base::TimeDelta& position)>;
void GetPlaybackSessions(
- base::Optional<unsigned int> num_sessions,
- base::Optional<GetPlaybackSessionsFilter> filter,
+ absl::optional<unsigned int> num_sessions,
+ absl::optional<GetPlaybackSessionsFilter> filter,
base::OnceCallback<void(
std::vector<mojom::MediaHistoryPlaybackSessionRowPtr>)> callback);
@@ -80,7 +80,7 @@
void SavePlaybackSession(
const GURL& url,
const media_session::MediaMetadata& metadata,
- const base::Optional<media_session::MediaPosition>& position,
+ const absl::optional<media_session::MediaPosition>& position,
const std::vector<media_session::MediaImage>& artwork);
// Get origins from the origins table that have watchtime above the given
diff --git a/chrome/browser/media/history/media_history_keyed_service_unittest.cc b/chrome/browser/media/history/media_history_keyed_service_unittest.cc
index d0ae9e8..2fa1e7b 100644
--- a/chrome/browser/media/history/media_history_keyed_service_unittest.cc
+++ b/chrome/browser/media/history/media_history_keyed_service_unittest.cc
@@ -317,7 +317,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url1a, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(url1a_image));
}
@@ -331,7 +331,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url1b, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(url1b_image));
}
@@ -345,7 +345,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url1c, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(shared_image));
}
@@ -359,7 +359,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url2a, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(url2a_image));
}
@@ -373,7 +373,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url2b, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(shared_image));
}
@@ -511,7 +511,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url1a, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(url1a_image));
}
@@ -525,7 +525,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url1b, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(url1b_image));
}
@@ -539,7 +539,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url1c, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(shared_image));
}
@@ -553,7 +553,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url2a, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(url2a_image));
}
@@ -567,7 +567,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url2b, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(shared_image));
}
@@ -705,7 +705,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url1a, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(url1a_image));
}
@@ -719,7 +719,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url1b, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(shared_image));
}
@@ -733,7 +733,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url1c, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(url1c_image));
}
@@ -747,7 +747,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url2a, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(url2a_image));
}
@@ -761,7 +761,7 @@
service()->SavePlayback(watch_time);
service()->SavePlaybackSession(url2b, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
CreateImageVector(shared_image));
}
diff --git a/chrome/browser/media/history/media_history_origin_table.cc b/chrome/browser/media/history/media_history_origin_table.cc
index d6f740b..7033ab2 100644
--- a/chrome/browser/media/history/media_history_origin_table.cc
+++ b/chrome/browser/media/history/media_history_origin_table.cc
@@ -122,7 +122,7 @@
if (!CanAccessDatabase())
return false;
- base::Optional<int64_t> origin_id;
+ absl::optional<int64_t> origin_id;
{
// Get the ID for the origin.
sql::Statement statement(DB()->GetCachedStatement(
diff --git a/chrome/browser/media/history/media_history_session_images_table.cc b/chrome/browser/media/history/media_history_session_images_table.cc
index f65f7f3..02530ef1 100644
--- a/chrome/browser/media/history/media_history_session_images_table.cc
+++ b/chrome/browser/media/history/media_history_session_images_table.cc
@@ -85,7 +85,7 @@
bool MediaHistorySessionImagesTable::LinkImage(
const int64_t session_id,
const int64_t image_id,
- const base::Optional<gfx::Size> size) {
+ const absl::optional<gfx::Size> size) {
DCHECK_LT(0, DB()->transaction_nesting());
if (!CanAccessDatabase())
return false;
@@ -131,7 +131,7 @@
.c_str()));
statement.BindInt64(0, session_id);
- base::Optional<media_session::MediaImage> current;
+ absl::optional<media_session::MediaImage> current;
while (statement.Step()) {
GURL url(statement.ColumnString(2));
diff --git a/chrome/browser/media/history/media_history_session_images_table.h b/chrome/browser/media/history/media_history_session_images_table.h
index 50fe0e9..89162c8 100644
--- a/chrome/browser/media/history/media_history_session_images_table.h
+++ b/chrome/browser/media/history/media_history_session_images_table.h
@@ -47,7 +47,7 @@
// Saves the link and returns whether it was successful.
bool LinkImage(const int64_t session_id,
const int64_t image_id,
- const base::Optional<gfx::Size> size);
+ const absl::optional<gfx::Size> size);
// Gets all the images for a session.
std::vector<media_session::MediaImage> GetImagesForSession(
diff --git a/chrome/browser/media/history/media_history_session_table.cc b/chrome/browser/media/history/media_history_session_table.cc
index c44437ae..a9fcdcd 100644
--- a/chrome/browser/media/history/media_history_session_table.cc
+++ b/chrome/browser/media/history/media_history_session_table.cc
@@ -67,14 +67,14 @@
return sql::INIT_OK;
}
-base::Optional<int64_t> MediaHistorySessionTable::SavePlaybackSession(
+absl::optional<int64_t> MediaHistorySessionTable::SavePlaybackSession(
const GURL& url,
const url::Origin& origin,
const media_session::MediaMetadata& metadata,
- const base::Optional<media_session::MediaPosition>& position) {
+ const absl::optional<media_session::MediaPosition>& position) {
DCHECK_LT(0, DB()->transaction_nesting());
if (!CanAccessDatabase())
- return base::nullopt;
+ return absl::nullopt;
sql::Statement statement(DB()->GetCachedStatement(
SQL_FROM_HERE,
@@ -111,13 +111,13 @@
return DB()->GetLastInsertRowId();
}
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<mojom::MediaHistoryPlaybackSessionRowPtr>
MediaHistorySessionTable::GetPlaybackSessions(
- base::Optional<unsigned int> num_sessions,
- base::Optional<MediaHistoryStore::GetPlaybackSessionsFilter> filter) {
+ absl::optional<unsigned int> num_sessions,
+ absl::optional<MediaHistoryStore::GetPlaybackSessionsFilter> filter) {
std::vector<mojom::MediaHistoryPlaybackSessionRowPtr> sessions;
if (!CanAccessDatabase())
return sessions;
diff --git a/chrome/browser/media/history/media_history_session_table.h b/chrome/browser/media/history/media_history_session_table.h
index 6b639214..3b3b9c5 100644
--- a/chrome/browser/media/history/media_history_session_table.h
+++ b/chrome/browser/media/history/media_history_session_table.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_MEDIA_HISTORY_MEDIA_HISTORY_SESSION_TABLE_H_
#define CHROME_BROWSER_MEDIA_HISTORY_MEDIA_HISTORY_SESSION_TABLE_H_
-#include "base/optional.h"
#include "chrome/browser/media/history/media_history_store.h"
#include "chrome/browser/media/history/media_history_table_base.h"
#include "sql/init_status.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace base {
@@ -45,15 +45,15 @@
sql::InitStatus CreateTableIfNonExistent() override;
// Returns the ID of the session if it was created successfully.
- base::Optional<int64_t> SavePlaybackSession(
+ absl::optional<int64_t> SavePlaybackSession(
const GURL& url,
const url::Origin& origin,
const media_session::MediaMetadata& metadata,
- const base::Optional<media_session::MediaPosition>& position);
+ const absl::optional<media_session::MediaPosition>& position);
std::vector<mojom::MediaHistoryPlaybackSessionRowPtr> GetPlaybackSessions(
- base::Optional<unsigned int> num_sessions,
- base::Optional<MediaHistoryStore::GetPlaybackSessionsFilter> filter);
+ absl::optional<unsigned int> num_sessions,
+ absl::optional<MediaHistoryStore::GetPlaybackSessionsFilter> filter);
};
} // namespace media_history
diff --git a/chrome/browser/media/history/media_history_store.cc b/chrome/browser/media/history/media_history_store.cc
index 4d1ba1a..f9a7598 100644
--- a/chrome/browser/media/history/media_history_store.cc
+++ b/chrome/browser/media/history/media_history_store.cc
@@ -528,7 +528,7 @@
void MediaHistoryStore::SavePlaybackSession(
const GURL& url,
const media_session::MediaMetadata& metadata,
- const base::Optional<media_session::MediaPosition>& position,
+ const absl::optional<media_session::MediaPosition>& position,
const std::vector<media_session::MediaImage>& artwork) {
DCHECK(db_task_runner_->RunsTasksInCurrentSequence());
if (!CanAccessDatabase())
@@ -580,7 +580,7 @@
// If we do not have any sizes associated with the image we should save a
// link with a null size. Otherwise, we should save a link for each size.
if (image.sizes.empty()) {
- session_images_table_->LinkImage(*session_id, *image_id, base::nullopt);
+ session_images_table_->LinkImage(*session_id, *image_id, absl::nullopt);
} else {
for (auto& size : image.sizes) {
session_images_table_->LinkImage(*session_id, *image_id, size);
@@ -597,8 +597,8 @@
std::vector<mojom::MediaHistoryPlaybackSessionRowPtr>
MediaHistoryStore::GetPlaybackSessions(
- base::Optional<unsigned int> num_sessions,
- base::Optional<MediaHistoryStore::GetPlaybackSessionsFilter> filter) {
+ absl::optional<unsigned int> num_sessions,
+ absl::optional<MediaHistoryStore::GetPlaybackSessionsFilter> filter) {
DCHECK(db_task_runner_->RunsTasksInCurrentSequence());
if (!CanAccessDatabase())
diff --git a/chrome/browser/media/history/media_history_store.h b/chrome/browser/media/history/media_history_store.h
index b1a6b6a..8a53db6e 100644
--- a/chrome/browser/media/history/media_history_store.h
+++ b/chrome/browser/media/history/media_history_store.h
@@ -11,7 +11,6 @@
#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/synchronization/atomic_flag.h"
#include "base/updateable_sequenced_task_runner.h"
#include "chrome/browser/media/history/media_history_keyed_service.h"
@@ -20,6 +19,7 @@
#include "content/public/browser/media_player_watch_time.h"
#include "sql/init_status.h"
#include "sql/meta_table.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
namespace media_session {
@@ -136,12 +136,12 @@
void SavePlaybackSession(
const GURL& url,
const media_session::MediaMetadata& metadata,
- const base::Optional<media_session::MediaPosition>& position,
+ const absl::optional<media_session::MediaPosition>& position,
const std::vector<media_session::MediaImage>& artwork);
std::vector<mojom::MediaHistoryPlaybackSessionRowPtr> GetPlaybackSessions(
- base::Optional<unsigned int> num_sessions,
- base::Optional<MediaHistoryStore::GetPlaybackSessionsFilter> filter);
+ absl::optional<unsigned int> num_sessions,
+ absl::optional<MediaHistoryStore::GetPlaybackSessionsFilter> filter);
void DeleteAllOriginData(const std::set<url::Origin>& origins);
void DeleteAllURLData(const std::set<GURL>& urls);
diff --git a/chrome/browser/media/history/media_history_store_unittest.cc b/chrome/browser/media/history/media_history_store_unittest.cc
index 679a30c..12c44407 100644
--- a/chrome/browser/media/history/media_history_store_unittest.cc
+++ b/chrome/browser/media/history/media_history_store_unittest.cc
@@ -8,7 +8,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
@@ -41,6 +40,7 @@
#include "services/media_session/public/cpp/media_position.h"
#include "sql/statement.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media_history {
@@ -384,10 +384,10 @@
// Save a couple of sessions on different URLs.
service()->SavePlaybackSession(url_a, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
std::vector<media_session::MediaImage>());
service()->SavePlaybackSession(url_b, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
std::vector<media_session::MediaImage>());
// Wait until the sessions have finished saving.
@@ -413,7 +413,7 @@
// Save a session on the first URL.
service()->SavePlaybackSession(url_a, media_session::MediaMetadata(),
- base::nullopt,
+ absl::nullopt,
std::vector<media_session::MediaImage>());
// Wait until the sessions have finished saving.
diff --git a/chrome/browser/media/media_engagement_contents_observer.h b/chrome/browser/media/media_engagement_contents_observer.h
index fd0df07..e1f32cc 100644
--- a/chrome/browser/media/media_engagement_contents_observer.h
+++ b/chrome/browser/media/media_engagement_contents_observer.h
@@ -153,7 +153,7 @@
// The clock is owned by |service_| which already owns |this|.
base::Clock* clock_;
- base::Optional<base::Time> start_time_;
+ absl::optional<base::Time> start_time_;
base::TimeDelta recorded_time_;
};
@@ -163,12 +163,12 @@
~PlayerState();
PlayerState(PlayerState&&);
- base::Optional<bool> muted;
- base::Optional<bool> playing; // Currently playing.
- base::Optional<bool> significant_size; // The video track has at least
+ absl::optional<bool> muted;
+ absl::optional<bool> playing; // Currently playing.
+ absl::optional<bool> significant_size; // The video track has at least
// a certain frame size.
- base::Optional<bool> has_audio; // The media has an audio track.
- base::Optional<bool> has_video; // The media has a video track.
+ absl::optional<bool> has_audio; // The media has an audio track.
+ absl::optional<bool> has_video; // The media has a video track.
// The engagement score of the origin at playback has been recorded
// to a histogram.
diff --git a/chrome/browser/media/media_engagement_contents_observer_unittest.cc b/chrome/browser/media/media_engagement_contents_observer_unittest.cc
index 3ac0007f..4c58f8d18 100644
--- a/chrome/browser/media/media_engagement_contents_observer_unittest.cc
+++ b/chrome/browser/media/media_engagement_contents_observer_unittest.cc
@@ -10,7 +10,6 @@
#include <vector>
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
@@ -33,6 +32,7 @@
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(crbug/1004580) All these tests crash on Android
#if !defined(OS_ANDROID)
diff --git a/chrome/browser/media/media_engagement_service_unittest.cc b/chrome/browser/media/media_engagement_service_unittest.cc
index e97ebfa..c3db78ee 100644
--- a/chrome/browser/media/media_engagement_service_unittest.cc
+++ b/chrome/browser/media/media_engagement_service_unittest.cc
@@ -761,7 +761,7 @@
service()->OnURLsDeleted(
history, history::DeletionInfo(history::DeletionTimeRange::Invalid(),
true, history::URLRows(),
- std::set<GURL>(), base::nullopt));
+ std::set<GURL>(), absl::nullopt));
// Same as above, nothing should have changed.
ExpectScores(origin1, 7.0 / 11.0,
diff --git a/chrome/browser/media/output_protection_proxy.cc b/chrome/browser/media/output_protection_proxy.cc
index 8c1dbea1..1758e83 100644
--- a/chrome/browser/media/output_protection_proxy.cc
+++ b/chrome/browser/media/output_protection_proxy.cc
@@ -7,12 +7,12 @@
#include <utility>
#include "base/bind.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/display/types/display_constants.h"
#if BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -31,16 +31,16 @@
}
#if BUILDFLAG(IS_CHROMEOS_LACROS)
-base::Optional<std::string> GetWindowId(int render_process_id,
+absl::optional<std::string> GetWindowId(int render_process_id,
int render_frame_id) {
gfx::NativeView native_view =
GetRenderFrameView(render_process_id, render_frame_id);
if (!native_view)
- return base::nullopt;
+ return absl::nullopt;
aura::Window* root_window = native_view->GetRootWindow();
if (!root_window)
- return base::nullopt;
+ return absl::nullopt;
aura::WindowTreeHost* window_tree_host = root_window->GetHost();
DCHECK(window_tree_host);
@@ -80,7 +80,7 @@
base::BindOnce(&OutputProtectionProxy::ProcessQueryStatusResult,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
- base::Optional<std::string> window_id =
+ absl::optional<std::string> window_id =
GetWindowId(render_process_id_, render_frame_id_);
auto* lacros_service = chromeos::LacrosService::Get();
if (window_id &&
@@ -109,7 +109,7 @@
output_protection_delegate_.SetProtection(desired_method_mask,
std::move(callback));
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
- base::Optional<std::string> window_id =
+ absl::optional<std::string> window_id =
GetWindowId(render_process_id_, render_frame_id_);
auto* lacros_service = chromeos::LacrosService::Get();
if (window_id &&
diff --git a/chrome/browser/media/protected_media_identifier_permission_context.cc b/chrome/browser/media/protected_media_identifier_permission_context.cc
index 05af9087..837e4fa 100644
--- a/chrome/browser/media/protected_media_identifier_permission_context.cc
+++ b/chrome/browser/media/protected_media_identifier_permission_context.cc
@@ -239,8 +239,8 @@
{permission_request.get()}, web_contents, permission_action,
base::Time::Now() - dialog_show_time,
permissions::PermissionPromptDisposition::CUSTOM_MODAL_DIALOG,
- /*ui_reason=*/base::nullopt,
- /*predicted_grant_likelihood=*/base::nullopt);
+ /*ui_reason=*/absl::nullopt,
+ /*predicted_grant_likelihood=*/absl::nullopt);
};
// The request may have been canceled. Drop the callback in that case.
diff --git a/chrome/browser/media/router/discovery/dial/device_description_fetcher.cc b/chrome/browser/media/router/discovery/dial/device_description_fetcher.cc
index 64f416ef..35c7459 100644
--- a/chrome/browser/media/router/discovery/dial/device_description_fetcher.cc
+++ b/chrome/browser/media/router/discovery/dial/device_description_fetcher.cc
@@ -87,7 +87,7 @@
}
void DeviceDescriptionFetcher::ReportError(const std::string& message,
- base::Optional<int> response_code) {
+ absl::optional<int> response_code) {
std::move(error_cb_).Run(message);
}
diff --git a/chrome/browser/media/router/discovery/dial/device_description_fetcher.h b/chrome/browser/media/router/discovery/dial/device_description_fetcher.h
index db09b218..3fd1e3a 100644
--- a/chrome/browser/media/router/discovery/dial/device_description_fetcher.h
+++ b/chrome/browser/media/router/discovery/dial/device_description_fetcher.h
@@ -9,9 +9,9 @@
#include <string>
#include "base/callback.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "chrome/browser/media/router/discovery/dial/dial_url_fetcher.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace media_router {
@@ -46,7 +46,7 @@
// Runs |error_cb_| with |message| and clears it.
void ReportError(const std::string& message,
- base::Optional<int> response_code = base::nullopt);
+ absl::optional<int> response_code = absl::nullopt);
const GURL device_description_url_;
diff --git a/chrome/browser/media/router/discovery/dial/dial_app_discovery_service.cc b/chrome/browser/media/router/discovery/dial/dial_app_discovery_service.cc
index 299f0f17..45bf9e6d 100644
--- a/chrome/browser/media/router/discovery/dial/dial_app_discovery_service.cc
+++ b/chrome/browser/media/router/discovery/dial/dial_app_discovery_service.cc
@@ -36,7 +36,7 @@
std::unique_ptr<ParsedDialAppInfo> app_info,
DialAppInfoResultCode result_code,
const std::string& error_message,
- base::Optional<int> http_error_code)
+ absl::optional<int> http_error_code)
: app_info(std::move(app_info)),
result_code(result_code),
error_message(error_message),
@@ -118,7 +118,7 @@
void DialAppDiscoveryService::PendingRequest::OnDialAppInfoFetchError(
const std::string& error_message,
- base::Optional<int> http_response_code) {
+ absl::optional<int> http_response_code) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
auto result_code = DialAppInfoResultCode::kNetworkError;
if (http_response_code) {
diff --git a/chrome/browser/media/router/discovery/dial/dial_app_discovery_service.h b/chrome/browser/media/router/discovery/dial/dial_app_discovery_service.h
index ae2c682..0f6be99 100644
--- a/chrome/browser/media/router/discovery/dial/dial_app_discovery_service.h
+++ b/chrome/browser/media/router/discovery/dial/dial_app_discovery_service.h
@@ -38,7 +38,7 @@
DialAppInfoResult(std::unique_ptr<ParsedDialAppInfo> app_info,
DialAppInfoResultCode result_code,
const std::string& error_message = "",
- base::Optional<int> http_error_code = base::nullopt);
+ absl::optional<int> http_error_code = absl::nullopt);
DialAppInfoResult(DialAppInfoResult&& other);
~DialAppInfoResult();
@@ -50,7 +50,7 @@
// Optionally set to provide additional information for an error.
std::string error_message;
// Set when |result_code| is |kHttpError|.
- base::Optional<int> http_error_code;
+ absl::optional<int> http_error_code;
};
// This class provides an API to fetch DIAL app info XML from an app URL and
@@ -105,7 +105,7 @@
// Invoked when HTTP GET request fails.
void OnDialAppInfoFetchError(const std::string& error_message,
- base::Optional<int> http_response_code);
+ absl::optional<int> http_response_code);
// Invoked when SafeDialAppInfoParser finishes parsing app info XML.
// |app_info|: Parsed app info from utility process, or nullptr if parsing
diff --git a/chrome/browser/media/router/discovery/dial/dial_app_discovery_service_unittest.cc b/chrome/browser/media/router/discovery/dial/dial_app_discovery_service_unittest.cc
index 343a4aa2..eef4641 100644
--- a/chrome/browser/media/router/discovery/dial/dial_app_discovery_service_unittest.cc
+++ b/chrome/browser/media/router/discovery/dial/dial_app_discovery_service_unittest.cc
@@ -100,7 +100,7 @@
}
void OnDialAppInfoFetchError(DialAppDiscoveryService::PendingRequest* request,
- base::Optional<int> response_code,
+ absl::optional<int> response_code,
const std::string& error_text) {
request->OnDialAppInfoFetchError(error_text, response_code);
}
@@ -140,7 +140,7 @@
EXPECT_CALL(*this, OnAppInfoFailure(sink_id, _,
DialAppInfoResultCode::kNetworkError));
- OnDialAppInfoFetchError(request, base::nullopt, "Temporarily throttled");
+ OnDialAppInfoFetchError(request, absl::nullopt, "Temporarily throttled");
}
TEST_F(DialAppDiscoveryServiceTest, TestFetchDialAppInfoFetchURLError) {
diff --git a/chrome/browser/media/router/discovery/dial/dial_service.cc b/chrome/browser/media/router/discovery/dial/dial_service.cc
index 424dab9..52f457e29 100644
--- a/chrome/browser/media/router/discovery/dial/dial_service.cc
+++ b/chrome/browser/media/router/discovery/dial/dial_service.cc
@@ -60,7 +60,7 @@
#if !BUILDFLAG(IS_CHROMEOS_ASH)
void PostSendNetworkList(
base::WeakPtr<DialServiceImpl> impl,
- const base::Optional<net::NetworkInterfaceList>& networks) {
+ const absl::optional<net::NetworkInterfaceList>& networks) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::GetIOThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(&DialServiceImpl::SendNetworkList,
@@ -446,7 +446,7 @@
}
void DialServiceImpl::SendNetworkList(
- const base::Optional<NetworkInterfaceList>& networks) {
+ const absl::optional<NetworkInterfaceList>& networks) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
using InterfaceIndexAddressFamily = std::pair<uint32_t, net::AddressFamily>;
diff --git a/chrome/browser/media/router/discovery/dial/dial_service.h b/chrome/browser/media/router/discovery/dial/dial_service.h
index 140a568..d32d5908 100644
--- a/chrome/browser/media/router/discovery/dial/dial_service.h
+++ b/chrome/browser/media/router/discovery/dial/dial_service.h
@@ -107,7 +107,7 @@
private:
friend void PostSendNetworkList(
base::WeakPtr<DialServiceImpl> impl,
- const base::Optional<net::NetworkInterfaceList>& networks);
+ const absl::optional<net::NetworkInterfaceList>& networks);
// Represents a socket binding to a single network interface.
// DialSocket lives on the IO thread.
@@ -190,7 +190,7 @@
// For each network interface in |list|, finds all unqiue IPv4 network
// interfaces and call |DiscoverOnAddresses()| with their IP addresses.
- void SendNetworkList(const base::Optional<net::NetworkInterfaceList>& list);
+ void SendNetworkList(const absl::optional<net::NetworkInterfaceList>& list);
// Calls |BindAndAddSocket()| for each address in |ip_addresses|, calls
// |SendOneRequest()|, and start the timer to finish discovery if needed.
diff --git a/chrome/browser/media/router/discovery/dial/dial_url_fetcher.cc b/chrome/browser/media/router/discovery/dial/dial_url_fetcher.cc
index b4ab274..a5a9640 100644
--- a/chrome/browser/media/router/discovery/dial/dial_url_fetcher.cc
+++ b/chrome/browser/media/router/discovery/dial/dial_url_fetcher.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/media/router/discovery/dial/dial_url_fetcher.h"
#include "base/bind.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -25,6 +24,7 @@
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// The maximum number of retries allowed for GET requests.
constexpr int kMaxRetries = 2;
@@ -102,23 +102,23 @@
void DialURLFetcher::Get(const GURL& url, bool set_origin_header) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- Start(url, "GET", base::nullopt, kMaxRetries, set_origin_header);
+ Start(url, "GET", absl::nullopt, kMaxRetries, set_origin_header);
}
void DialURLFetcher::Delete(const GURL& url) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- Start(url, "DELETE", base::nullopt, 0, true);
+ Start(url, "DELETE", absl::nullopt, 0, true);
}
void DialURLFetcher::Post(const GURL& url,
- const base::Optional<std::string>& post_data) {
+ const absl::optional<std::string>& post_data) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
Start(url, "POST", post_data, 0, true);
}
void DialURLFetcher::Start(const GURL& url,
const std::string& method,
- const base::Optional<std::string>& post_data,
+ const absl::optional<std::string>& post_data,
int max_retries,
bool set_origin_header) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -177,12 +177,12 @@
std::move(error_cb_).Run(message, GetHttpResponseCode());
}
-base::Optional<int> DialURLFetcher::GetHttpResponseCode() const {
+absl::optional<int> DialURLFetcher::GetHttpResponseCode() const {
if (GetResponseHead() && GetResponseHead()->headers) {
int code = GetResponseHead()->headers->response_code();
- return code == -1 ? base::nullopt : base::Optional<int>(code);
+ return code == -1 ? absl::nullopt : absl::optional<int>(code);
}
- return base::nullopt;
+ return absl::nullopt;
}
void DialURLFetcher::ReportRedirectError(
diff --git a/chrome/browser/media/router/discovery/dial/dial_url_fetcher.h b/chrome/browser/media/router/discovery/dial/dial_url_fetcher.h
index 8d8cf20..7a310c39 100644
--- a/chrome/browser/media/router/discovery/dial/dial_url_fetcher.h
+++ b/chrome/browser/media/router/discovery/dial/dial_url_fetcher.h
@@ -10,8 +10,8 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "services/network/public/mojom/url_response_head.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace net {
@@ -38,7 +38,7 @@
// e.g. if it was unexpectedly empty.
using ErrorCallback =
base::OnceCallback<void(const std::string& error_message,
- base::Optional<int> http_response_code)>;
+ absl::optional<int> http_response_code)>;
// |success_cb|: Invoked when HTTP request to |url| succeeds.
// |error_cb|: Invoked when HTTP request to |url| fails.
@@ -53,7 +53,7 @@
void Delete(const GURL& url);
// Starts a HTTP POST request.
- void Post(const GURL& url, const base::Optional<std::string>& post_data);
+ void Post(const GURL& url, const absl::optional<std::string>& post_data);
// Returns the response header of an HTTP request. The response header is
// owned by underlying |loader_| object and is reset per HTTP request. Returns
@@ -80,7 +80,7 @@
// |set_origin_header|: whether to set an Origin: header on the request.
virtual void Start(const GURL& url,
const std::string& method,
- const base::Optional<std::string>& post_data,
+ const absl::optional<std::string>& post_data,
int max_retries,
bool set_origin_header);
@@ -99,7 +99,7 @@
void ReportError(const std::string& message);
// Returns the HTTP code in the response header, if exists.
- virtual base::Optional<int> GetHttpResponseCode() const;
+ virtual absl::optional<int> GetHttpResponseCode() const;
SuccessCallback success_cb_;
ErrorCallback error_cb_;
diff --git a/chrome/browser/media/router/discovery/dial/dial_url_fetcher_unittest.cc b/chrome/browser/media/router/discovery/dial/dial_url_fetcher_unittest.cc
index ebc6db2..d1f6887 100644
--- a/chrome/browser/media/router/discovery/dial/dial_url_fetcher_unittest.cc
+++ b/chrome/browser/media/router/discovery/dial/dial_url_fetcher_unittest.cc
@@ -46,7 +46,7 @@
protected:
MOCK_METHOD(void, OnSuccess, (const std::string&));
- MOCK_METHOD(void, OnError, (const std::string&, base::Optional<int>));
+ MOCK_METHOD(void, OnError, (const std::string&, absl::optional<int>));
base::test::TaskEnvironment environment_;
network::TestURLLoaderFactory loader_factory_;
@@ -86,7 +86,7 @@
EXPECT_CALL(*this, OnError(HasSubstr(base::NumberToString(
net::ERR_HTTP_RESPONSE_CODE_FAILURE)),
- base::Optional<int>(404)));
+ absl::optional<int>(404)));
loader_factory_.AddResponse(
url_, std::move(head), "",
network::URLLoaderCompletionStatus(net::ERR_HTTP_RESPONSE_CODE_FAILURE),
diff --git a/chrome/browser/media/router/discovery/dial/safe_dial_app_info_parser.h b/chrome/browser/media/router/discovery/dial/safe_dial_app_info_parser.h
index 7044fda..76ff2d11 100644
--- a/chrome/browser/media/router/discovery/dial/safe_dial_app_info_parser.h
+++ b/chrome/browser/media/router/discovery/dial/safe_dial_app_info_parser.h
@@ -11,9 +11,9 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/media/router/discovery/dial/parsed_dial_app_info.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media_router {
diff --git a/chrome/browser/media/router/discovery/dial/safe_dial_device_description_parser.h b/chrome/browser/media/router/discovery/dial/safe_dial_device_description_parser.h
index bdf4eec..fe31d64 100644
--- a/chrome/browser/media/router/discovery/dial/safe_dial_device_description_parser.h
+++ b/chrome/browser/media/router/discovery/dial/safe_dial_device_description_parser.h
@@ -11,9 +11,9 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/media/router/discovery/dial/parsed_dial_device_description.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
diff --git a/chrome/browser/media/router/mojo/media_router_desktop.cc b/chrome/browser/media/router/mojo/media_router_desktop.cc
index 88ce0eb2..6fcfc79 100644
--- a/chrome/browser/media/router/mojo/media_router_desktop.cc
+++ b/chrome/browser/media/router/mojo/media_router_desktop.cc
@@ -90,7 +90,7 @@
}
}
-base::Optional<MediaRouteProviderId>
+absl::optional<MediaRouteProviderId>
MediaRouterDesktop::GetProviderIdForPresentation(
const std::string& presentation_id) {
// TODO(takumif): Once the Android Media Router also uses MediaRouterMojoImpl,
diff --git a/chrome/browser/media/router/mojo/media_router_desktop.h b/chrome/browser/media/router/mojo/media_router_desktop.h
index 0781b5e..472f1a7 100644
--- a/chrome/browser/media/router/mojo/media_router_desktop.h
+++ b/chrome/browser/media/router/mojo/media_router_desktop.h
@@ -65,7 +65,7 @@
protected:
// MediaRouterMojoImpl override:
- base::Optional<MediaRouteProviderId> GetProviderIdForPresentation(
+ absl::optional<MediaRouteProviderId> GetProviderIdForPresentation(
const std::string& presentation_id) override;
private:
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
index 3f28647..c3d26a0d 100644
--- a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
+++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
@@ -188,9 +188,9 @@
bool is_off_the_record,
MediaRouteResponseCallback callback,
bool is_join,
- const base::Optional<MediaRoute>& media_route,
+ const absl::optional<MediaRoute>& media_route,
mojom::RoutePresentationConnectionPtr connection,
- const base::Optional<std::string>& error_text,
+ const absl::optional<std::string>& error_text,
RouteRequestResult::ResultCode result_code) {
DCHECK(!connection ||
(connection->connection_remote && connection->connection_receiver));
@@ -300,7 +300,7 @@
base::TimeDelta timeout,
bool off_the_record) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<MediaRouteProviderId> provider_id =
+ absl::optional<MediaRouteProviderId> provider_id =
GetProviderIdForPresentation(presentation_id);
if (!provider_id || !HasJoinableRoute()) {
std::unique_ptr<RouteRequestResult> result = RouteRequestResult::FromError(
@@ -332,7 +332,7 @@
base::TimeDelta timeout,
bool off_the_record) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<MediaRouteProviderId> provider_id =
+ absl::optional<MediaRouteProviderId> provider_id =
GetProviderIdForRoute(route_id);
if (!provider_id) {
std::unique_ptr<RouteRequestResult> result = RouteRequestResult::FromError(
@@ -353,7 +353,7 @@
void MediaRouterMojoImpl::TerminateRoute(const MediaRoute::Id& route_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<MediaRouteProviderId> provider_id =
+ absl::optional<MediaRouteProviderId> provider_id =
GetProviderIdForRoute(route_id);
if (!provider_id) {
MediaRouterMetrics::RecordJoinRouteResultCode(
@@ -369,7 +369,7 @@
void MediaRouterMojoImpl::DetachRoute(const MediaRoute::Id& route_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<MediaRouteProviderId> provider_id =
+ absl::optional<MediaRouteProviderId> provider_id =
GetProviderIdForRoute(route_id);
if (!provider_id) {
return;
@@ -380,7 +380,7 @@
void MediaRouterMojoImpl::SendRouteMessage(const MediaRoute::Id& route_id,
const std::string& message) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<MediaRouteProviderId> provider_id =
+ absl::optional<MediaRouteProviderId> provider_id =
GetProviderIdForRoute(route_id);
if (!provider_id) {
return;
@@ -392,7 +392,7 @@
const MediaRoute::Id& route_id,
std::unique_ptr<std::vector<uint8_t>> data) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<MediaRouteProviderId> provider_id =
+ absl::optional<MediaRouteProviderId> provider_id =
GetProviderIdForRoute(route_id);
if (!provider_id) {
return;
@@ -407,7 +407,7 @@
mojo::PendingReceiver<mojom::MediaController> controller,
mojo::PendingRemote<mojom::MediaStatusObserver> observer) {
auto* route = GetRoute(route_id);
- base::Optional<MediaRouteProviderId> provider_id =
+ absl::optional<MediaRouteProviderId> provider_id =
GetProviderIdForRoute(route_id);
if (!route || !provider_id ||
route->controller_type() == RouteControllerType::kNone) {
@@ -758,7 +758,7 @@
bool should_listen = observer_list->empty();
observer_list->AddObserver(observer);
if (should_listen) {
- base::Optional<MediaRouteProviderId> provider_id =
+ absl::optional<MediaRouteProviderId> provider_id =
GetProviderIdForRoute(route_id);
if (provider_id) {
media_route_providers_[*provider_id]->StartListeningForRouteMessages(
@@ -780,7 +780,7 @@
it->second->RemoveObserver(observer);
if (it->second->empty()) {
message_observers_.erase(route_id);
- base::Optional<MediaRouteProviderId> provider_id =
+ absl::optional<MediaRouteProviderId> provider_id =
GetProviderIdForRoute(route_id);
if (provider_id) {
media_route_providers_[*provider_id]->StopListeningForRouteMessages(
@@ -849,7 +849,7 @@
void MediaRouterMojoImpl::OnTerminateRouteResult(
const MediaRoute::Id& route_id,
MediaRouteProviderId provider_id,
- const base::Optional<std::string>& error_text,
+ const absl::optional<std::string>& error_text,
RouteRequestResult::ResultCode result_code) {
MediaRouterMetrics::RecordMediaRouteProviderTerminateRoute(provider_id,
result_code);
@@ -985,7 +985,7 @@
receivers_.Add(this, std::move(receiver));
}
-base::Optional<MediaRouteProviderId> MediaRouterMojoImpl::GetProviderIdForRoute(
+absl::optional<MediaRouteProviderId> MediaRouterMojoImpl::GetProviderIdForRoute(
const MediaRoute::Id& route_id) {
for (const auto& routes_query : routes_queries_) {
MediaRoutesQuery* query = routes_query.second.get();
@@ -1000,17 +1000,17 @@
}
}
}
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<MediaRouteProviderId> MediaRouterMojoImpl::GetProviderIdForSink(
+absl::optional<MediaRouteProviderId> MediaRouterMojoImpl::GetProviderIdForSink(
const MediaSink::Id& sink_id) {
const MediaSink* sink = GetSinkById(sink_id);
- return sink ? base::make_optional<MediaRouteProviderId>(sink->provider_id())
- : base::nullopt;
+ return sink ? absl::make_optional<MediaRouteProviderId>(sink->provider_id())
+ : absl::nullopt;
}
-base::Optional<MediaRouteProviderId>
+absl::optional<MediaRouteProviderId>
MediaRouterMojoImpl::GetProviderIdForPresentation(
const std::string& presentation_id) {
for (const auto& routes_query : routes_queries_) {
@@ -1027,7 +1027,7 @@
}
}
}
- return base::nullopt;
+ return absl::nullopt;
}
const MediaSink* MediaRouterMojoImpl::GetSinkById(
@@ -1108,14 +1108,14 @@
content::DesktopMediaID media_id) {
if (!err.empty()) {
std::move(mr_callback)
- .Run(base::nullopt, nullptr, err,
+ .Run(absl::nullopt, nullptr, err,
RouteRequestResult::DESKTOP_PICKER_FAILED);
return;
}
if (media_id.is_null()) {
std::move(mr_callback)
- .Run(base::nullopt, nullptr, "User canceled capture dialog",
+ .Run(absl::nullopt, nullptr, "User canceled capture dialog",
RouteRequestResult::CANCELLED);
return;
}
@@ -1152,9 +1152,9 @@
[](mojom::MediaRouteProvider::CreateRouteCallback inner_callback,
base::WeakPtr<MediaRouterMojoImpl> self,
const std::string& stream_id,
- const base::Optional<media_router::MediaRoute>& route,
+ const absl::optional<media_router::MediaRoute>& route,
mojom::RoutePresentationConnectionPtr connection,
- const base::Optional<std::string>& error_text,
+ const absl::optional<std::string>& error_text,
RouteRequestResult::ResultCode result_code) {
if (self)
self->pending_stream_request_.reset();
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl.h b/chrome/browser/media/router/mojo/media_router_mojo_impl.h
index fd72c28..a520800 100644
--- a/chrome/browser/media/router/mojo/media_router_mojo_impl.h
+++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.h
@@ -18,7 +18,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/media/webrtc/desktop_media_picker_controller.h"
#include "components/media_router/browser/issue_manager.h"
@@ -34,6 +33,7 @@
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/presentation/presentation.mojom.h"
namespace content {
@@ -118,9 +118,9 @@
// Methods for obtaining a pointer to the provider associated with the given
// object. They return a nullopt when such a provider is not found.
- virtual base::Optional<MediaRouteProviderId> GetProviderIdForPresentation(
+ virtual absl::optional<MediaRouteProviderId> GetProviderIdForPresentation(
const std::string& presentation_id);
- base::Optional<MediaRouteProviderId> GetProviderIdForRoute(
+ absl::optional<MediaRouteProviderId> GetProviderIdForRoute(
const MediaRoute::Id& route_id);
void CreateRouteWithSelectedDesktop(
@@ -244,7 +244,7 @@
bool HasObserver(MediaRoutesObserver* observer) const;
bool HasObservers() const;
- const base::Optional<std::vector<MediaRoute>>& cached_route_list() const {
+ const absl::optional<std::vector<MediaRoute>>& cached_route_list() const {
return cached_route_list_;
}
const std::vector<MediaRoute::Id>& joinable_route_ids() const {
@@ -257,7 +257,7 @@
private:
// Cached list of routes and joinable route IDs for the query.
- base::Optional<std::vector<MediaRoute>> cached_route_list_;
+ absl::optional<std::vector<MediaRoute>> cached_route_list_;
std::vector<MediaRoute::Id> joinable_route_ids_;
// Per-MRP lists of routes and joinable route IDs for the query.
@@ -363,7 +363,7 @@
// |result_code|: The result of the request.
void OnTerminateRouteResult(const MediaRoute::Id& route_id,
MediaRouteProviderId provider_id,
- const base::Optional<std::string>& error_text,
+ const absl::optional<std::string>& error_text,
RouteRequestResult::ResultCode result_code);
// Adds |route| to the list of routes. Called in the callback for
@@ -378,9 +378,9 @@
bool is_off_the_record,
MediaRouteResponseCallback callback,
bool is_join,
- const base::Optional<MediaRoute>& media_route,
+ const absl::optional<MediaRoute>& media_route,
mojom::RoutePresentationConnectionPtr connection,
- const base::Optional<std::string>& error_text,
+ const absl::optional<std::string>& error_text,
RouteRequestResult::ResultCode result_code);
// Callback called by MRP's CreateMediaRouteController().
@@ -388,7 +388,7 @@
// Method for obtaining a pointer to the provider associated with the given
// object. Returns a nullopt when such a provider is not found.
- base::Optional<MediaRouteProviderId> GetProviderIdForSink(
+ absl::optional<MediaRouteProviderId> GetProviderIdForSink(
const MediaSink::Id& sink_id);
// Gets the sink with the given ID from lists of sinks held by sink queries.
@@ -443,7 +443,7 @@
DesktopMediaPickerController desktop_picker_;
- base::Optional<PendingStreamRequest> pending_stream_request_;
+ absl::optional<PendingStreamRequest> pending_stream_request_;
// Collects logs from the Media Router and the native Media Route Providers.
// TODO(crbug.com/1077138): Limit logging before Media Router usage.
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
index 12f3608f..f51fed8 100644
--- a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
+++ b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
@@ -281,7 +281,7 @@
const url::Origin& origin, int tab_id,
base::TimeDelta timeout, bool off_the_record,
mojom::MediaRouteProvider::CreateRouteCallback& cb) {
- std::move(cb).Run(base::nullopt, nullptr, std::string(kError),
+ std::move(cb).Run(absl::nullopt, nullptr, std::string(kError),
RouteRequestResult::TIMED_OUT);
}));
@@ -368,7 +368,7 @@
.WillOnce(
Invoke([](const std::string& route_id,
mojom::MediaRouteProvider::TerminateRouteCallback& cb) {
- std::move(cb).Run(base::nullopt, RouteRequestResult::OK);
+ std::move(cb).Run(absl::nullopt, RouteRequestResult::OK);
}));
base::RunLoop run_loop2;
@@ -414,7 +414,7 @@
const url::Origin& origin, int tab_id,
base::TimeDelta timeout, bool off_the_record,
mojom::MediaRouteProvider::JoinRouteCallback& cb) {
- std::move(cb).Run(base::nullopt, nullptr, std::string(kError),
+ std::move(cb).Run(absl::nullopt, nullptr, std::string(kError),
RouteRequestResult::TIMED_OUT);
}));
@@ -494,7 +494,7 @@
const std::string& presentation_id, const url::Origin& origin,
int tab_id, base::TimeDelta timeout, bool off_the_record,
mojom::MediaRouteProvider::JoinRouteCallback& cb) {
- std::move(cb).Run(base::nullopt, nullptr, std::string(kError),
+ std::move(cb).Run(absl::nullopt, nullptr, std::string(kError),
RouteRequestResult::TIMED_OUT);
}));
diff --git a/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc b/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc
index 7a4899c..335366a 100644
--- a/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc
+++ b/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc
@@ -755,7 +755,7 @@
});
std::vector<mojom::RouteMessagePtr> messages;
messages.emplace_back(mojom::RouteMessage::New(
- mojom::RouteMessage::Type::TEXT, "beta", base::nullopt));
+ mojom::RouteMessage::Type::TEXT, "beta", absl::nullopt));
proxy_message_observer->OnMessagesReceived(std::move(messages));
base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/media/router/providers/cast/app_activity.cc b/chrome/browser/media/router/providers/cast/app_activity.cc
index 93551ba..492450b 100644
--- a/chrome/browser/media/router/providers/cast/app_activity.cc
+++ b/chrome/browser/media/router/providers/cast/app_activity.cc
@@ -10,10 +10,10 @@
#include "base/bind.h"
#include "base/containers/contains.h"
-#include "base/optional.h"
#include "chrome/browser/media/router/providers/cast/cast_activity_manager.h"
#include "chrome/browser/media/router/providers/cast/cast_session_client.h"
#include "components/cast_channel/enum_table.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
using blink::mojom::PresentationConnectionCloseReason;
@@ -76,11 +76,11 @@
cast_message.client_id(), session->transport_id()));
}
-base::Optional<int> AppActivity::SendMediaRequestToReceiver(
+absl::optional<int> AppActivity::SendMediaRequestToReceiver(
const CastInternalMessage& cast_message) {
CastSession* session = GetSession();
if (!session)
- return base::nullopt;
+ return absl::nullopt;
return message_handler_->SendMediaRequest(
cast_channel_id(), cast_message.v2_message_body(),
cast_message.client_id(), session->transport_id());
@@ -95,7 +95,7 @@
}
void AppActivity::SendMediaStatusToClients(const base::Value& media_status,
- base::Optional<int> request_id) {
+ absl::optional<int> request_id) {
CastActivity::SendMediaStatusToClients(media_status, request_id);
if (media_controller_)
media_controller_->SetMediaStatus(media_status);
diff --git a/chrome/browser/media/router/providers/cast/app_activity.h b/chrome/browser/media/router/providers/cast/app_activity.h
index 1728a828..06f2005e 100644
--- a/chrome/browser/media/router/providers/cast/app_activity.h
+++ b/chrome/browser/media/router/providers/cast/app_activity.h
@@ -9,7 +9,6 @@
#include <string>
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "chrome/browser/media/router/providers/cast/cast_activity.h"
#include "chrome/browser/media/router/providers/cast/cast_media_controller.h"
#include "components/cast_channel/cast_message_handler.h"
@@ -17,6 +16,7 @@
#include "components/media_router/common/providers/cast/cast_media_source.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/openscreen/src/cast/common/channel/proto/cast_channel.pb.h"
namespace url {
@@ -40,13 +40,13 @@
~AppActivity() override;
void SendMediaStatusToClients(const base::Value& media_status,
- base::Optional<int> request_id) override;
+ absl::optional<int> request_id) override;
void OnAppMessage(const cast::channel::CastMessage& message) override;
void OnInternalMessage(const cast_channel::InternalMessage& message) override;
void CreateMediaController(
mojo::PendingReceiver<mojom::MediaController> media_controller,
mojo::PendingRemote<mojom::MediaStatusObserver> observer) override;
- base::Optional<int> SendMediaRequestToReceiver(
+ absl::optional<int> SendMediaRequestToReceiver(
const CastInternalMessage& cast_message) override;
cast_channel::Result SendAppMessageToReceiver(
const CastInternalMessage& cast_message) override;
diff --git a/chrome/browser/media/router/providers/cast/app_activity_unittest.cc b/chrome/browser/media/router/providers/cast/app_activity_unittest.cc
index ae1656a..67e8309a 100644
--- a/chrome/browser/media/router/providers/cast/app_activity_unittest.cc
+++ b/chrome/browser/media/router/providers/cast/app_activity_unittest.cc
@@ -11,7 +11,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
@@ -29,6 +28,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using base::test::IsJson;
using base::test::ParseJson;
@@ -110,7 +110,7 @@
TEST_F(AppActivityTest, SendMediaRequestToReceiver) {
// TODO(crbug.com/954797): Test case where there is no session.
- const base::Optional<int> request_id = 1234;
+ const absl::optional<int> request_id = 1234;
EXPECT_CALL(
message_handler_,
@@ -119,7 +119,7 @@
IsJson(
R"({"sessionId": "theSessionId", "type": "theV2MessageType"})"),
"theClientId", "theTransportId"))
- .WillOnce(Return(base::nullopt))
+ .WillOnce(Return(absl::nullopt))
.WillOnce(Return(request_id));
std::unique_ptr<CastInternalMessage> message =
@@ -170,7 +170,7 @@
}
TEST_F(AppActivityTest, StopSessionOnReceiver) {
- const base::Optional<std::string> client_id("theClientId");
+ const absl::optional<std::string> client_id("theClientId");
base::MockCallback<cast_channel::ResultCallback> callback;
SetUpSession();
@@ -267,7 +267,7 @@
AddMockClient("theClientId1");
AddMockClient("theClientId2");
- ASSERT_EQ(base::nullopt, activity_->session_id());
+ ASSERT_EQ(absl::nullopt, activity_->session_id());
route().set_description("");
for (auto* client : MockCastSessionClient::instances()) {
EXPECT_CALL(*client, SendMessageToClient).Times(0);
diff --git a/chrome/browser/media/router/providers/cast/cast_activity.cc b/chrome/browser/media/router/providers/cast/cast_activity.cc
index 320dc42..626e24b 100644
--- a/chrome/browser/media/router/providers/cast/cast_activity.cc
+++ b/chrome/browser/media/router/providers/cast/cast_activity.cc
@@ -102,7 +102,7 @@
}
void CastActivity::SendMediaStatusToClients(const base::Value& media_status,
- base::Optional<int> request_id) {
+ absl::optional<int> request_id) {
for (auto& client : connected_clients_)
client.second->SendMediaStatusToClient(media_status, request_id);
}
@@ -118,10 +118,10 @@
client.second->TerminateConnection();
}
-base::Optional<int> CastActivity::SendMediaRequestToReceiver(
+absl::optional<int> CastActivity::SendMediaRequestToReceiver(
const CastInternalMessage& cast_message) {
NOTIMPLEMENTED();
- return base::nullopt;
+ return absl::nullopt;
}
cast_channel::Result CastActivity::SendAppMessageToReceiver(
diff --git a/chrome/browser/media/router/providers/cast/cast_activity.h b/chrome/browser/media/router/providers/cast/cast_activity.h
index 4c53545..f583435 100644
--- a/chrome/browser/media/router/providers/cast/cast_activity.h
+++ b/chrome/browser/media/router/providers/cast/cast_activity.h
@@ -9,7 +9,6 @@
#include <string>
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "chrome/browser/media/router/providers/cast/cast_internal_message_util.h"
#include "chrome/browser/media/router/providers/cast/cast_session_client.h"
#include "chrome/browser/media/router/providers/cast/cast_session_tracker.h"
@@ -19,6 +18,7 @@
#include "components/media_router/common/providers/cast/cast_media_source.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cast_channel {
class CastMessageHandler;
@@ -53,8 +53,8 @@
const MediaRoute& route() const { return route_; }
const std::string& app_id() const { return app_id_; }
- const base::Optional<std::string>& session_id() const { return session_id_; }
- base::Optional<int> mirroring_tab_id() const { return mirroring_tab_id_; }
+ const absl::optional<std::string>& session_id() const { return session_id_; }
+ absl::optional<int> mirroring_tab_id() const { return mirroring_tab_id_; }
const MediaSinkInternal sink() const { return sink_; }
// Adds a new client |client_id| to this session and returns the handles of
@@ -86,7 +86,7 @@
blink::mojom::PresentationConnectionMessagePtr message);
virtual void SendMediaStatusToClients(const base::Value& media_status,
- base::Optional<int> request_id);
+ absl::optional<int> request_id);
// Handles a message forwarded by CastActivityManager.
virtual void OnAppMessage(const cast::channel::CastMessage& message) = 0;
@@ -106,7 +106,7 @@
// Sends media command |cast_message|, which came from the SDK client, to the
// receiver hosting this session. Returns the locally-assigned request ID of
// the message sent to the receiver.
- virtual base::Optional<int> SendMediaRequestToReceiver(
+ virtual absl::optional<int> SendMediaRequestToReceiver(
const CastInternalMessage& cast_message);
// Sends app message |cast_message|, which came from the SDK client, to the
@@ -171,7 +171,7 @@
MediaRoute route_;
std::string app_id_;
- base::Optional<int> mirroring_tab_id_;
+ absl::optional<int> mirroring_tab_id_;
// TODO(https://crbug.com/809249): Consider wrapping CastMessageHandler with
// known parameters (sink, client ID, session transport ID) and passing them
@@ -181,7 +181,7 @@
CastSessionTracker* const session_tracker_;
// Set by CastActivityManager after the session is launched successfully.
- base::Optional<std::string> session_id_;
+ absl::optional<std::string> session_id_;
MediaSinkInternal sink_;
ClientMap connected_clients_;
diff --git a/chrome/browser/media/router/providers/cast/cast_activity_manager.cc b/chrome/browser/media/router/providers/cast/cast_activity_manager.cc
index 850d68a7..f2980a8 100644
--- a/chrome/browser/media/router/providers/cast/cast_activity_manager.cc
+++ b/chrome/browser/media/router/providers/cast/cast_activity_manager.cc
@@ -13,7 +13,6 @@
#include "base/containers/contains.h"
#include "base/json/json_reader.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "chrome/browser/media/router/data_decoder_util.h"
#include "chrome/browser/media/router/providers/cast/app_activity.h"
@@ -26,6 +25,7 @@
#include "components/media_router/common/media_source.h"
#include "components/media_router/common/mojom/media_router.mojom.h"
#include "components/media_router/common/route_request_result.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
using blink::mojom::PresentationConnectionCloseReason;
@@ -132,7 +132,7 @@
base::StrCat({"Error parsing JSON data in appParams: ", *result.error}),
sink.id(), cast_source.source_id(), presentation_id);
std::move(callback).Run(
- base::nullopt, nullptr, std::string("Invalid JSON Format of appParams"),
+ absl::nullopt, nullptr, std::string("Invalid JSON Format of appParams"),
RouteRequestResult::ResultCode::NO_SUPPORTED_PROVIDER);
return;
}
@@ -242,13 +242,13 @@
std::move(params.callback)
.Run(route, std::move(presentation_connection),
- /* error_text */ base::nullopt, RouteRequestResult::ResultCode::OK);
+ /* error_text */ absl::nullopt, RouteRequestResult::ResultCode::OK);
}
void CastActivityManager::SetPendingLaunch(DoLaunchSessionParams params) {
if (pending_launch_ && pending_launch_->callback) {
std::move(pending_launch_->callback)
- .Run(base::nullopt, nullptr, "Pending launch session params destroyed",
+ .Run(absl::nullopt, nullptr, "Pending launch session params destroyed",
RouteRequestResult::CANCELLED);
}
pending_launch_ = std::move(params);
@@ -329,7 +329,7 @@
}
if (!activity || !activity->CanJoinSession(cast_source, off_the_record)) {
- std::move(callback).Run(base::nullopt, nullptr,
+ std::move(callback).Run(absl::nullopt, nullptr,
std::string("No matching route"),
RouteRequestResult::ResultCode::ROUTE_NOT_FOUND);
return;
@@ -348,7 +348,7 @@
"Cannot find the sink to join with sink_id.",
activity->route().media_sink_id(),
cast_source.source_id(), presentation_id);
- std::move(callback).Run(base::nullopt, nullptr,
+ std::move(callback).Run(absl::nullopt, nullptr,
std::string("Sink not found"),
RouteRequestResult::ResultCode::SINK_NOT_FOUND);
return;
@@ -372,7 +372,7 @@
logger_->LogError(mojom::LogCategory::kRoute, kLoggerComponent,
kErrorMessage, "", "", "");
}
- std::move(callback).Run(base::nullopt, nullptr, kErrorMessage,
+ std::move(callback).Run(absl::nullopt, nullptr, kErrorMessage,
RouteRequestResult::ResultCode::UNKNOWN_ERROR);
return;
}
@@ -390,7 +390,7 @@
// Route is now local; update route queries.
NotifyAllOnRoutesUpdated();
std::move(callback).Run(activity->route(), std::move(presentation_connection),
- base::nullopt, RouteRequestResult::ResultCode::OK);
+ absl::nullopt, RouteRequestResult::ResultCode::OK);
logger_->LogInfo(mojom::LogCategory::kRoute, kLoggerComponent,
"Successfully joined session", sink->id(),
cast_source.source_id(), presentation_id);
@@ -472,7 +472,7 @@
"Terminated session has no session ID.", "",
MediaRoute::GetMediaSourceIdFromMediaRouteId(route_id),
MediaRoute::GetPresentationIdFromMediaRouteId(route_id));
- std::move(callback).Run(base::nullopt, RouteRequestResult::OK);
+ std::move(callback).Run(absl::nullopt, RouteRequestResult::OK);
return;
}
@@ -480,7 +480,7 @@
CHECK(sink);
// TODO(jrw): Get the real client ID.
- base::Optional<std::string> client_id = base::nullopt;
+ absl::optional<std::string> client_id = absl::nullopt;
activity->SendStopSessionMessageToClients(hash_token_);
message_handler_->StopSession(
@@ -648,7 +648,7 @@
void CastActivityManager::OnMediaStatusUpdated(const MediaSinkInternal& sink,
const base::Value& media_status,
- base::Optional<int> request_id) {
+ absl::optional<int> request_id) {
auto it = FindActivityBySink(sink);
if (it != activities_.end()) {
it->second->SendMediaStatusToClients(media_status, request_id);
@@ -897,14 +897,14 @@
auto activity_it = activities_.find(route_id);
if (activity_it == activities_.end()) {
// The activity could've been removed via RECEIVER_STATUS message.
- std::move(callback).Run(base::nullopt, RouteRequestResult::OK);
+ std::move(callback).Run(absl::nullopt, RouteRequestResult::OK);
return;
}
if (result == cast_channel::Result::kOk) {
RemoveActivity(activity_it, PresentationConnectionState::TERMINATED,
PresentationConnectionCloseReason::CLOSED);
- std::move(callback).Run(base::nullopt, RouteRequestResult::OK);
+ std::move(callback).Run(absl::nullopt, RouteRequestResult::OK);
logger_->LogInfo(mojom::LogCategory::kRoute, kLoggerComponent,
"Terminated a route successfully after receiving "
@@ -933,7 +933,7 @@
media_router_->OnIssue(info);
}
-base::Optional<MediaSinkInternal> CastActivityManager::ConvertMirrorToCast(
+absl::optional<MediaSinkInternal> CastActivityManager::ConvertMirrorToCast(
int tab_id) {
for (const auto& pair : activities_) {
if (pair.second->mirroring_tab_id() == tab_id) {
@@ -941,7 +941,7 @@
}
}
- return base::nullopt;
+ return absl::nullopt;
}
std::string CastActivityManager::ChooseAppId(
@@ -982,7 +982,7 @@
const MediaSinkInternal& sink,
const url::Origin& origin,
int tab_id,
- const base::Optional<base::Value> app_params,
+ const absl::optional<base::Value> app_params,
mojom::MediaRouteProvider::CreateRouteCallback callback)
: route(route),
cast_source(cast_source),
diff --git a/chrome/browser/media/router/providers/cast/cast_activity_manager.h b/chrome/browser/media/router/providers/cast/cast_activity_manager.h
index 6d0386a..27ea70a8 100644
--- a/chrome/browser/media/router/providers/cast/cast_activity_manager.h
+++ b/chrome/browser/media/router/providers/cast/cast_activity_manager.h
@@ -12,7 +12,6 @@
#include "base/containers/flat_map.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/values.h"
#include "chrome/browser/media/router/providers/cast/cast_activity.h"
@@ -25,6 +24,7 @@
#include "components/media_router/common/providers/cast/cast_media_source.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/openscreen/src/cast/common/channel/proto/cast_channel.pb.h"
#include "url/origin.h"
@@ -123,7 +123,7 @@
void OnSessionRemoved(const MediaSinkInternal& sink) override;
void OnMediaStatusUpdated(const MediaSinkInternal& sink,
const base::Value& media_status,
- base::Optional<int> request_id) override;
+ absl::optional<int> request_id) override;
static void SetActitityFactoryForTest(CastActivityFactoryForTest* factory) {
cast_activity_factory_for_test_ = factory;
@@ -175,7 +175,7 @@
const MediaSinkInternal& sink,
const url::Origin& origin,
int tab_id,
- const base::Optional<base::Value> app_params,
+ const absl::optional<base::Value> app_params,
mojom::MediaRouteProvider::CreateRouteCallback callback);
DoLaunchSessionParams(const DoLaunchSessionParams& other) = delete;
DoLaunchSessionParams(DoLaunchSessionParams&& other);
@@ -199,7 +199,7 @@
int tab_id;
// The JSON object sent from the Cast SDK.
- base::Optional<base::Value> app_params;
+ absl::optional<base::Value> app_params;
// Callback to execute after the launch request has been sent.
mojom::MediaRouteProvider::CreateRouteCallback callback;
@@ -268,8 +268,8 @@
const CastSinkExtraData& cast_data);
// Returns a sink used to convert a mirroring activity to a cast activity.
- // If no conversion should occur, returns base::nullopt.
- base::Optional<MediaSinkInternal> ConvertMirrorToCast(int tab_id);
+ // If no conversion should occur, returns absl::nullopt.
+ absl::optional<MediaSinkInternal> ConvertMirrorToCast(int tab_id);
std::string ChooseAppId(const CastMediaSource& source,
const MediaSinkInternal& sink) const;
@@ -299,7 +299,7 @@
// that the existing session on the receiver has been removed. We only store
// one pending launch at a time so that we don't accumulate orphaned pending
// launches over time.
- base::Optional<DoLaunchSessionParams> pending_launch_;
+ absl::optional<DoLaunchSessionParams> pending_launch_;
// The following raw pointer fields are assumed to outlive |this|.
MediaSinkServiceBase* const media_sink_service_;
diff --git a/chrome/browser/media/router/providers/cast/cast_activity_manager_unittest.cc b/chrome/browser/media/router/providers/cast/cast_activity_manager_unittest.cc
index cb920ad5..6de1b18 100644
--- a/chrome/browser/media/router/providers/cast/cast_activity_manager_unittest.cc
+++ b/chrome/browser/media/router/providers/cast/cast_activity_manager_unittest.cc
@@ -13,7 +13,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/test/bind.h"
@@ -40,6 +39,7 @@
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using base::test::IsJson;
using base::test::ParseJson;
@@ -111,9 +111,9 @@
public:
MOCK_METHOD(void,
Run,
- (const base::Optional<MediaRoute>& route,
+ (const absl::optional<MediaRoute>& route,
mojom::RoutePresentationConnectionPtr presentation_connections,
- const base::Optional<std::string>& error_message,
+ const absl::optional<std::string>& error_message,
media_router::RouteRequestResult::ResultCode result_code));
};
@@ -218,9 +218,9 @@
}
void ExpectLaunchSessionSuccess(
- const base::Optional<MediaRoute>& route,
+ const absl::optional<MediaRoute>& route,
mojom::RoutePresentationConnectionPtr presentation_connections,
- const base::Optional<std::string>&,
+ const absl::optional<std::string>&,
media_router::RouteRequestResult::ResultCode) {
ASSERT_TRUE(route);
route_ = std::make_unique<MediaRoute>(*route);
@@ -228,9 +228,9 @@
}
void ExpectLaunchSessionFailure(
- const base::Optional<MediaRoute>& route,
+ const absl::optional<MediaRoute>& route,
mojom::RoutePresentationConnectionPtr presentation_connections,
- const base::Optional<std::string>& error_message,
+ const absl::optional<std::string>& error_message,
media_router::RouteRequestResult::ResultCode result_code) {
ASSERT_FALSE(route);
DLOG(ERROR) << error_message.value();
@@ -244,7 +244,7 @@
// A launch session request is sent to the sink.
std::vector<std::string> supported_app_types = {"WEB"};
- const base::Optional<base::Value> json = base::JSONReader::Read(app_params);
+ const absl::optional<base::Value> json = base::JSONReader::Read(app_params);
EXPECT_CALL(message_handler_,
LaunchSession(kChannelId, app_id, kDefaultLaunchTimeout,
supported_app_types,
@@ -387,7 +387,7 @@
mojom::MediaRouteProvider::TerminateRouteCallback MakeTerminateRouteCallback(
bool expect_success) {
return base::BindLambdaForTesting(
- [expect_success](const base::Optional<std::string>& error_text,
+ [expect_success](const absl::optional<std::string>& error_text,
RouteRequestResult::ResultCode result_code) {
if (expect_success) {
EXPECT_FALSE(error_text.has_value());
@@ -402,7 +402,7 @@
// Expect a call to OnRoutesUpdated() with a single route, which will
// optionally be saved in the variable pointed to by |route_ptr|.
void ExpectSingleRouteUpdate() {
- updated_route_ = base::nullopt;
+ updated_route_ = absl::nullopt;
EXPECT_CALL(mock_router_,
OnRoutesUpdated(MediaRouteProviderId::CAST, ElementsAre(_),
route_query_, IsEmpty()))
@@ -412,7 +412,7 @@
// Expect a call to OnRoutesUpdated() with no routes.
void ExpectEmptyRouteUpdate() {
- updated_route_ = base::nullopt;
+ updated_route_ = absl::nullopt;
EXPECT_CALL(mock_router_,
OnRoutesUpdated(MediaRouteProviderId::CAST, IsEmpty(),
route_query_, IsEmpty()))
@@ -421,7 +421,7 @@
// Expect that OnRoutesUpdated() will not be called.
void ExpectNoRouteUpdate() {
- updated_route_ = base::nullopt;
+ updated_route_ = absl::nullopt;
EXPECT_CALL(mock_router_, OnRoutesUpdated).Times(0);
}
@@ -459,7 +459,7 @@
MockAppActivityCallback app_activity_callback_ = base::DoNothing();
const url::Origin origin_ = url::Origin::Create(GURL(kOrigin));
const MediaSource::Id route_query_ = "theRouteQuery";
- base::Optional<MediaRoute> updated_route_;
+ absl::optional<MediaRoute> updated_route_;
cast_channel::Result stop_session_callback_arg_ = cast_channel::Result::kOk;
MockLogger logger_;
mojom::RoutePresentationConnectionPtr presentation_connections_;
@@ -571,8 +571,8 @@
EXPECT_CALL(message_handler_,
LaunchSession(kChannelId, "BBBBBBBB", kDefaultLaunchTimeout,
supported_app_types,
- /* base::Optional<base::Value> appParams */
- testing::Eq(base::nullopt), _));
+ /* absl::optional<base::Value> appParams */
+ testing::Eq(absl::nullopt), _));
manager_->OnSessionRemoved(sink_);
}
@@ -708,7 +708,7 @@
LaunchAppSession();
const char status[] = R"({"foo": "bar"})";
- base::Optional<int> request_id(345);
+ absl::optional<int> request_id(345);
EXPECT_CALL(*app_activity_,
SendMediaStatusToClients(IsJson(status), request_id));
diff --git a/chrome/browser/media/router/providers/cast/cast_activity_test_base.cc b/chrome/browser/media/router/providers/cast/cast_activity_test_base.cc
index a192223..3683088 100644
--- a/chrome/browser/media/router/providers/cast/cast_activity_test_base.cc
+++ b/chrome/browser/media/router/providers/cast/cast_activity_test_base.cc
@@ -12,7 +12,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/test/bind.h"
@@ -30,6 +29,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using base::test::ParseJson;
diff --git a/chrome/browser/media/router/providers/cast/cast_activity_test_base.h b/chrome/browser/media/router/providers/cast/cast_activity_test_base.h
index cc74733..55b68be 100644
--- a/chrome/browser/media/router/providers/cast/cast_activity_test_base.h
+++ b/chrome/browser/media/router/providers/cast/cast_activity_test_base.h
@@ -38,7 +38,7 @@
void(blink::mojom::PresentationConnectionMessagePtr message));
MOCK_METHOD2(SendMediaStatusToClient,
void(const base::Value& media_status,
- base::Optional<int> request_id));
+ absl::optional<int> request_id));
MOCK_METHOD1(
CloseConnection,
void(blink::mojom::PresentationConnectionCloseReason close_reason));
@@ -48,7 +48,7 @@
MOCK_METHOD3(SendErrorCodeToClient,
void(int sequence_number,
CastInternalMessage::ErrorCode error_code,
- base::Optional<std::string> description));
+ absl::optional<std::string> description));
MOCK_METHOD2(SendErrorToClient, void(int sequence_number, base::Value error));
MOCK_METHOD1(OnMessage,
void(blink::mojom::PresentationConnectionMessagePtr message));
diff --git a/chrome/browser/media/router/providers/cast/cast_internal_message_util.cc b/chrome/browser/media/router/providers/cast/cast_internal_message_util.cc
index 6e56fae..9af8e5d 100644
--- a/chrome/browser/media/router/providers/cast/cast_internal_message_util.cc
+++ b/chrome/browser/media/router/providers/cast/cast_internal_message_util.cc
@@ -167,7 +167,7 @@
CastInternalMessage::Type type,
base::Value payload,
const std::string& client_id,
- base::Optional<int> sequence_number = base::nullopt) {
+ absl::optional<int> sequence_number = absl::nullopt) {
base::Value message(base::Value::Type::DICTIONARY);
message.SetKey("type", base::Value(CastInternalMessageTypeToString(type)));
message.SetKey("message", std::move(payload));
@@ -323,7 +323,7 @@
return base::WrapUnique(new CastInternalMessage(
message_type, client_id,
sequence_number_value ? sequence_number_value->GetInt()
- : base::Optional<int>(),
+ : absl::optional<int>(),
session_id, namespace_or_v2_type, std::move(new_message_body)));
}
@@ -332,7 +332,7 @@
CastInternalMessage::CastInternalMessage(
Type type,
const std::string& client_id,
- base::Optional<int> sequence_number,
+ absl::optional<int> sequence_number,
const std::string& session_id,
const std::string& namespace_or_v2_type,
base::Value message_body)
@@ -506,14 +506,14 @@
blink::mojom::PresentationConnectionMessagePtr CreateV2Message(
const std::string& client_id,
const base::Value& payload,
- base::Optional<int> sequence_number) {
+ absl::optional<int> sequence_number) {
return CreateMessageCommon(CastInternalMessage::Type::kV2Message,
payload.Clone(), client_id, sequence_number);
}
blink::mojom::PresentationConnectionMessagePtr CreateLeaveSessionAckMessage(
const std::string& client_id,
- base::Optional<int> sequence_number) {
+ absl::optional<int> sequence_number) {
return CreateMessageCommon(CastInternalMessage::Type::kLeaveSession,
base::Value(), client_id, sequence_number);
}
@@ -521,7 +521,7 @@
blink::mojom::PresentationConnectionMessagePtr CreateErrorMessage(
const std::string& client_id,
base::Value error,
- base::Optional<int> sequence_number) {
+ absl::optional<int> sequence_number) {
return CreateMessageCommon(CastInternalMessage::Type::kError,
std::move(error), client_id, sequence_number);
}
diff --git a/chrome/browser/media/router/providers/cast/cast_internal_message_util.h b/chrome/browser/media/router/providers/cast/cast_internal_message_util.h
index 468787e..3d3c117 100644
--- a/chrome/browser/media/router/providers/cast/cast_internal_message_util.h
+++ b/chrome/browser/media/router/providers/cast/cast_internal_message_util.h
@@ -87,7 +87,7 @@
Type type() const { return type_; }
const std::string& client_id() const { return client_id_; }
- base::Optional<int> sequence_number() const { return sequence_number_; }
+ absl::optional<int> sequence_number() const { return sequence_number_; }
bool has_session_id() const {
return type_ == Type::kAppMessage || type_ == Type::kV2Message;
@@ -121,14 +121,14 @@
private:
CastInternalMessage(Type type,
const std::string& client_id,
- base::Optional<int> sequence_number,
+ absl::optional<int> sequence_number,
const std::string& session_id,
const std::string& namespace_or_v2_type_,
base::Value message_body);
const Type type_;
const std::string client_id_;
- const base::Optional<int> sequence_number_;
+ const absl::optional<int> sequence_number_;
// Set if |type| is |kAppMessage| or |kV2Message|.
const std::string session_id_;
@@ -228,17 +228,17 @@
blink::mojom::PresentationConnectionMessagePtr CreateV2Message(
const std::string& client_id,
const base::Value& payload,
- base::Optional<int> sequence_number);
+ absl::optional<int> sequence_number);
blink::mojom::PresentationConnectionMessagePtr CreateErrorMessage(
const std::string& client_id,
base::Value error,
- base::Optional<int> sequence_number);
+ absl::optional<int> sequence_number);
blink::mojom::PresentationConnectionMessagePtr CreateLeaveSessionAckMessage(
const std::string& client_id,
- base::Optional<int> sequence_number);
+ absl::optional<int> sequence_number);
blink::mojom::PresentationConnectionMessagePtr CreateLeaveSessionAckMessage(
const std::string& client_id,
- base::Optional<int> sequence_number);
+ absl::optional<int> sequence_number);
base::Value SupportedMediaCommandsToListValue(int media_commands);
diff --git a/chrome/browser/media/router/providers/cast/cast_internal_message_util_unittest.cc b/chrome/browser/media/router/providers/cast/cast_internal_message_util_unittest.cc
index d331691..eb1151cb 100644
--- a/chrome/browser/media/router/providers/cast/cast_internal_message_util_unittest.cc
+++ b/chrome/browser/media/router/providers/cast/cast_internal_message_util_unittest.cc
@@ -20,7 +20,7 @@
static constexpr char kReceiverIdToken[] = "token";
-base::Optional<base::Value> ReceiverStatus() {
+absl::optional<base::Value> ReceiverStatus() {
std::string receiver_status_str = R"({
"applications": [{
"appId": "ABCDEFGH",
@@ -40,7 +40,7 @@
// appId: native app ID
// universalAppId: web receiver app ID, which is appId in ReceiverStatus without
// universalAppId or appType
-base::Optional<base::Value> ReceiverStatusWithUniversalAppId() {
+absl::optional<base::Value> ReceiverStatusWithUniversalAppId() {
std::string receiver_status_str = R"({
"applications": [{
"appId": "AD9AF8E0",
@@ -369,7 +369,7 @@
TEST(CastInternalMessageUtilTest, CreateNewSessionMessage) {
MediaSinkInternal sink = CreateCastSink(1);
std::string client_id = "clientId";
- base::Optional<base::Value> receiver_status = ReceiverStatus();
+ absl::optional<base::Value> receiver_status = ReceiverStatus();
ASSERT_TRUE(receiver_status);
auto session = CastSession::From(sink, receiver_status.value());
ASSERT_TRUE(session);
@@ -409,7 +409,7 @@
TEST(CastInternalMessageUtilTest, CreateNewSessionMessageWithUniversalAppId) {
MediaSinkInternal sink = CreateCastSink(1);
std::string client_id = "clientId";
- base::Optional<base::Value> receiver_status =
+ absl::optional<base::Value> receiver_status =
ReceiverStatusWithUniversalAppId();
ASSERT_TRUE(receiver_status);
auto session = CastSession::From(sink, receiver_status.value());
@@ -452,7 +452,7 @@
TEST(CastInternalMessageUtilTest, CreateUpdateSessionMessage) {
MediaSinkInternal sink = CreateCastSink(1);
std::string client_id = "clientId";
- base::Optional<base::Value> receiver_status = ReceiverStatus();
+ absl::optional<base::Value> receiver_status = ReceiverStatus();
ASSERT_TRUE(receiver_status);
auto session = CastSession::From(sink, receiver_status.value());
ASSERT_TRUE(session);
diff --git a/chrome/browser/media/router/providers/cast/cast_media_controller.cc b/chrome/browser/media/router/providers/cast/cast_media_controller.cc
index a8319c4..23257cf2 100644
--- a/chrome/browser/media/router/providers/cast/cast_media_controller.cc
+++ b/chrome/browser/media/router/providers/cast/cast_media_controller.cc
@@ -55,17 +55,17 @@
}
// If |value| has "width" and "height" fields with positive values, it gets
-// converted into gfx::Size. Otherwise base::nullopt is returned.
-base::Optional<gfx::Size> GetValidSize(const base::Value* value) {
+// converted into gfx::Size. Otherwise absl::nullopt is returned.
+absl::optional<gfx::Size> GetValidSize(const base::Value* value) {
if (!value || !value->is_dict())
- return base::nullopt;
+ return absl::nullopt;
int width = 0;
int height = 0;
SetIfValid(&width, value->FindPath("width"));
SetIfValid(&height, value->FindPath("height"));
if (width <= 0 || height <= 0)
- return base::nullopt;
- return base::make_optional<gfx::Size>(width, height);
+ return absl::nullopt;
+ return absl::make_optional<gfx::Size>(width, height);
}
} // namespace
diff --git a/chrome/browser/media/router/providers/cast/cast_media_controller_unittest.cc b/chrome/browser/media/router/providers/cast/cast_media_controller_unittest.cc
index 39698a4..6b06fc8 100644
--- a/chrome/browser/media/router/providers/cast/cast_media_controller_unittest.cc
+++ b/chrome/browser/media/router/providers/cast/cast_media_controller_unittest.cc
@@ -125,7 +125,7 @@
std::unique_ptr<CastSession> CreateSampleSession() {
MediaSinkInternal sink(MediaSink("sinkId123", "name", SinkIconType::CAST),
CastSinkExtraData());
- base::Optional<Value> receiver_status = base::JSONReader::Read(R"({
+ absl::optional<Value> receiver_status = base::JSONReader::Read(R"({
"applications": [{
"appId": "ABCD1234",
"displayName": "My App",
@@ -347,7 +347,7 @@
EXPECT_EQ(image1.size->width(), status->images.at(0)->size->width());
EXPECT_EQ(image1.size->height(), status->images.at(0)->size->height());
EXPECT_EQ(image2.url.spec(), status->images.at(1)->url.spec());
- EXPECT_EQ(base::nullopt, status->images.at(1)->size);
+ EXPECT_EQ(absl::nullopt, status->images.at(1)->size);
});
SetMediaStatus(*expected_status);
VerifyAndClearExpectations();
diff --git a/chrome/browser/media/router/providers/cast/cast_media_route_provider.cc b/chrome/browser/media/router/providers/cast/cast_media_route_provider.cc
index 978285a..84583692 100644
--- a/chrome/browser/media/router/providers/cast/cast_media_route_provider.cc
+++ b/chrome/browser/media/router/providers/cast/cast_media_route_provider.cc
@@ -125,7 +125,7 @@
logger_->LogError(mojom::LogCategory::kRoute, kLoggerComponent,
"Attempted to create a route with an invalid sink ID",
sink_id, source_id, presentation_id);
- std::move(callback).Run(base::nullopt, nullptr,
+ std::move(callback).Run(absl::nullopt, nullptr,
std::string("Sink not found"),
RouteRequestResult::ResultCode::SINK_NOT_FOUND);
return;
@@ -138,7 +138,7 @@
"Attempted to create a route with an invalid source",
sink_id, source_id, presentation_id);
std::move(callback).Run(
- base::nullopt, nullptr, std::string("Invalid source"),
+ absl::nullopt, nullptr, std::string("Invalid source"),
RouteRequestResult::ResultCode::NO_SUPPORTED_PROVIDER);
return;
}
@@ -158,7 +158,7 @@
CastMediaSource::FromMediaSourceId(media_source);
if (!cast_source) {
std::move(callback).Run(
- base::nullopt, nullptr, std::string("Invalid source"),
+ absl::nullopt, nullptr, std::string("Invalid source"),
RouteRequestResult::ResultCode::NO_SUPPORTED_PROVIDER);
logger_->LogError(mojom::LogCategory::kRoute, kLoggerComponent,
"Attempted to join a route with an invalid source", "",
@@ -176,7 +176,7 @@
// but it's initialized in the same place as |activity_manager_|, so it's
// almost certainly not available here.
LOG(ERROR) << "missing activity manager";
- std::move(callback).Run(base::nullopt, nullptr,
+ std::move(callback).Run(absl::nullopt, nullptr,
"Internal error: missing activity manager",
RouteRequestResult::ResultCode::UNKNOWN_ERROR);
return;
@@ -199,7 +199,7 @@
// the dialog.
NOTIMPLEMENTED();
std::move(callback).Run(
- base::nullopt, nullptr, std::string("Not implemented"),
+ absl::nullopt, nullptr, std::string("Not implemented"),
RouteRequestResult::ResultCode::NO_SUPPORTED_PROVIDER);
}
diff --git a/chrome/browser/media/router/providers/cast/cast_media_route_provider_metrics.cc b/chrome/browser/media/router/providers/cast/cast_media_route_provider_metrics.cc
index f8c2b1fc..7b0849d 100644
--- a/chrome/browser/media/router/providers/cast/cast_media_route_provider_metrics.cc
+++ b/chrome/browser/media/router/providers/cast/cast_media_route_provider_metrics.cc
@@ -44,7 +44,7 @@
if (!app_type) {
return;
}
- base::Optional<ReceiverAppType> type =
+ absl::optional<ReceiverAppType> type =
cast_util::StringToEnum<ReceiverAppType>(app_type->GetString());
if (type) {
base::UmaHistogramEnumeration(kHistogramCastAppType, *type);
diff --git a/chrome/browser/media/router/providers/cast/cast_media_route_provider_unittest.cc b/chrome/browser/media/router/providers/cast/cast_media_route_provider_unittest.cc
index ab1f204..f602282 100644
--- a/chrome/browser/media/router/providers/cast/cast_media_route_provider_unittest.cc
+++ b/chrome/browser/media/router/providers/cast/cast_media_route_provider_unittest.cc
@@ -73,9 +73,9 @@
}
void ExpectCreateRouteSuccessAndSetRoute(
- const base::Optional<MediaRoute>& route,
+ const absl::optional<MediaRoute>& route,
mojom::RoutePresentationConnectionPtr presentation_connections,
- const base::Optional<std::string>& error,
+ const absl::optional<std::string>& error,
RouteRequestResult::ResultCode result) {
EXPECT_TRUE(route);
EXPECT_TRUE(presentation_connections);
@@ -86,9 +86,9 @@
void ExpectCreateRouteFailure(
RouteRequestResult::ResultCode expected_result,
- const base::Optional<MediaRoute>& route,
+ const absl::optional<MediaRoute>& route,
mojom::RoutePresentationConnectionPtr presentation_connections,
- const base::Optional<std::string>& error,
+ const absl::optional<std::string>& error,
RouteRequestResult::ResultCode result) {
EXPECT_FALSE(route);
EXPECT_FALSE(presentation_connections);
@@ -96,7 +96,7 @@
EXPECT_EQ(expected_result, result);
}
- void ExpectTerminateRouteSuccess(const base::Optional<std::string>& error,
+ void ExpectTerminateRouteSuccess(const absl::optional<std::string>& error,
RouteRequestResult::ResultCode result) {
EXPECT_FALSE(error);
EXPECT_EQ(RouteRequestResult::ResultCode::OK, result);
diff --git a/chrome/browser/media/router/providers/cast/cast_session_client.h b/chrome/browser/media/router/providers/cast/cast_session_client.h
index 383ff54..fd6a775 100644
--- a/chrome/browser/media/router/providers/cast/cast_session_client.h
+++ b/chrome/browser/media/router/providers/cast/cast_session_client.h
@@ -9,12 +9,12 @@
#include <string>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/media/router/providers/cast/cast_internal_message_util.h"
#include "components/media_router/common/mojom/media_router.mojom.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/presentation/presentation.mojom.h"
namespace media_router {
@@ -33,7 +33,7 @@
virtual ~CastSessionClient();
const std::string& client_id() const { return client_id_; }
- const base::Optional<std::string>& session_id() const { return session_id_; }
+ const absl::optional<std::string>& session_id() const { return session_id_; }
const url::Origin& origin() const { return origin_; }
int tab_id() const { return tab_id_; }
@@ -51,7 +51,7 @@
// is used to look up the sequence number of a previous request, which is
// included in the outgoing message.
virtual void SendMediaStatusToClient(const base::Value& media_status,
- base::Optional<int> request_id) = 0;
+ absl::optional<int> request_id) = 0;
// Changes the PresentationConnection state to CLOSED/TERMINATED and resets
// PresentationConnection message pipes.
@@ -76,7 +76,7 @@
virtual void SendErrorCodeToClient(
int sequence_number,
CastInternalMessage::ErrorCode error_code,
- base::Optional<std::string> description) = 0;
+ absl::optional<std::string> description) = 0;
// NOTE: This is current only called from SendErrorCodeToClient, but based on
// the old code this method based on, it seems likely it will have other
@@ -85,7 +85,7 @@
private:
std::string client_id_;
- base::Optional<std::string> session_id_;
+ absl::optional<std::string> session_id_;
// The origin and tab ID parameters originally passed to the CreateRoute
// method of the MediaRouteProvider Mojo interface.
diff --git a/chrome/browser/media/router/providers/cast/cast_session_client_impl.cc b/chrome/browser/media/router/providers/cast/cast_session_client_impl.cc
index 7193f2e..2561f00 100644
--- a/chrome/browser/media/router/providers/cast/cast_session_client_impl.cc
+++ b/chrome/browser/media/router/providers/cast/cast_session_client_impl.cc
@@ -79,11 +79,11 @@
void CastSessionClientImpl::SendMediaStatusToClient(
const base::Value& media_status,
- base::Optional<int> request_id) {
+ absl::optional<int> request_id) {
// Look up if there is a pending request from this client associated with this
// message. If so, send the media status message as a response by setting the
// sequence number.
- base::Optional<int> sequence_number;
+ absl::optional<int> sequence_number;
if (request_id) {
auto it = pending_media_requests_.find(*request_id);
if (it != pending_media_requests_.end()) {
@@ -128,7 +128,7 @@
void CastSessionClientImpl::SendErrorCodeToClient(
int sequence_number,
CastInternalMessage::ErrorCode error_code,
- base::Optional<std::string> description) {
+ absl::optional<std::string> description) {
base::Value message(base::Value::Type::DICTIONARY);
message.SetKey("code", base::Value(*cast_util::EnumToString(error_code)));
message.SetKey("description",
@@ -222,7 +222,7 @@
cast_channel::V2MessageTypeFromString(type_str);
if (cast_channel::IsMediaRequestMessageType(type)) {
DVLOG(2) << "Got media command from client: " << type_str;
- base::Optional<int> request_id =
+ absl::optional<int> request_id =
activity_->SendMediaRequestToReceiver(cast_message);
if (request_id) {
DCHECK(cast_message.sequence_number());
diff --git a/chrome/browser/media/router/providers/cast/cast_session_client_impl.h b/chrome/browser/media/router/providers/cast/cast_session_client_impl.h
index 3a55e7e..ccb2157 100644
--- a/chrome/browser/media/router/providers/cast/cast_session_client_impl.h
+++ b/chrome/browser/media/router/providers/cast/cast_session_client_impl.h
@@ -31,14 +31,14 @@
void SendMessageToClient(
blink::mojom::PresentationConnectionMessagePtr message) override;
void SendMediaStatusToClient(const base::Value& media_status,
- base::Optional<int> request_id) override;
+ absl::optional<int> request_id) override;
void CloseConnection(
blink::mojom::PresentationConnectionCloseReason close_reason) override;
void TerminateConnection() override;
bool MatchesAutoJoinPolicy(url::Origin origin, int tab_id) const override;
void SendErrorCodeToClient(int sequence_number,
CastInternalMessage::ErrorCode error_code,
- base::Optional<std::string> description) override;
+ absl::optional<std::string> description) override;
void SendErrorToClient(int sequence_number, base::Value error) override;
// blink::mojom::PresentationConnection implementation
diff --git a/chrome/browser/media/router/providers/cast/cast_session_tracker.cc b/chrome/browser/media/router/providers/cast/cast_session_tracker.cc
index f540484..03a0e8b6 100644
--- a/chrome/browser/media/router/providers/cast/cast_session_tracker.cc
+++ b/chrome/browser/media/router/providers/cast/cast_session_tracker.cc
@@ -152,7 +152,7 @@
DVLOG(2) << "Final updated MEDIA_STATUS: " << *updated_status;
session->UpdateMedia(*updated_status);
- base::Optional<int> request_id =
+ absl::optional<int> request_id =
cast_channel::GetRequestIdFromResponse(updated_message);
// Notify observers of media update.
diff --git a/chrome/browser/media/router/providers/cast/cast_session_tracker.h b/chrome/browser/media/router/providers/cast/cast_session_tracker.h
index f288853..40199402 100644
--- a/chrome/browser/media/router/providers/cast/cast_session_tracker.h
+++ b/chrome/browser/media/router/providers/cast/cast_session_tracker.h
@@ -36,7 +36,7 @@
virtual void OnSessionRemoved(const MediaSinkInternal& sink) = 0;
virtual void OnMediaStatusUpdated(const MediaSinkInternal& sink,
const base::Value& media_status,
- base::Optional<int> request_id) = 0;
+ absl::optional<int> request_id) = 0;
};
~CastSessionTracker() override;
diff --git a/chrome/browser/media/router/providers/cast/cast_session_tracker_unittest.cc b/chrome/browser/media/router/providers/cast/cast_session_tracker_unittest.cc
index 49c0c35..83ba026 100644
--- a/chrome/browser/media/router/providers/cast/cast_session_tracker_unittest.cc
+++ b/chrome/browser/media/router/providers/cast/cast_session_tracker_unittest.cc
@@ -73,7 +73,7 @@
MOCK_METHOD3(OnMediaStatusUpdated,
void(const MediaSinkInternal& sink,
const base::Value& media_status,
- base::Optional<int> request_id));
+ absl::optional<int> request_id));
};
class CastSessionTrackerTest : public testing::Test {
@@ -187,7 +187,7 @@
"playerState": "IDLE",
"sessionId": "theSessionId"
}]})"),
- base::Optional<int>()));
+ absl::optional<int>()));
// This should call session_tracker_.HandleMediaStatusMessage(...).
session_tracker_.OnInternalMessage(
@@ -247,7 +247,7 @@
}],
"xyzzy": "xyzzyValue2",
})"),
- base::make_optional(12345)));
+ absl::make_optional(12345)));
// This should call session_tracker_.HandleMediaStatusMessage(...).
session_tracker_.OnInternalMessage(
diff --git a/chrome/browser/media/router/providers/cast/mirroring_activity.cc b/chrome/browser/media/router/providers/cast/mirroring_activity.cc
index 40ecf85..ba2f7ac 100644
--- a/chrome/browser/media/router/providers/cast/mirroring_activity.cc
+++ b/chrome/browser/media/router/providers/cast/mirroring_activity.cc
@@ -15,7 +15,6 @@
#include "base/metrics/histogram_functions.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -35,6 +34,7 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "net/base/ip_address.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/openscreen/src/cast/common/channel/proto/cast_channel.pb.h"
#include "ui/base/l10n/l10n_util.h"
@@ -89,11 +89,11 @@
// usually ignored here, because mirroring typically only happens with a special
// URL that includes the tab ID it needs, which should be the same as the tab ID
// selected by the media router.
-base::Optional<MirroringActivity::MirroringType> GetMirroringType(
+absl::optional<MirroringActivity::MirroringType> GetMirroringType(
const MediaRoute& route,
int target_tab_id) {
if (!route.is_local())
- return base::nullopt;
+ return absl::nullopt;
const auto source = route.media_source();
if (source.IsTabMirroringSource() || source.IsLocalFileSource())
@@ -118,7 +118,7 @@
return MirroringActivity::MirroringType::kTab;
} else {
NOTREACHED() << "Non-mirroring Cast app: " << source;
- return base::nullopt;
+ return absl::nullopt;
}
} else if (source.url().SchemeIsHTTPOrHTTPS()) {
return MirroringActivity::MirroringType::kOffscreenTab;
@@ -126,7 +126,7 @@
}
NOTREACHED() << "Invalid source: " << source;
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace
diff --git a/chrome/browser/media/router/providers/cast/mirroring_activity.h b/chrome/browser/media/router/providers/cast/mirroring_activity.h
index 8c0b281..a04436e 100644
--- a/chrome/browser/media/router/providers/cast/mirroring_activity.h
+++ b/chrome/browser/media/router/providers/cast/mirroring_activity.h
@@ -9,7 +9,6 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/media/router/providers/cast/cast_activity.h"
#include "chrome/browser/media/router/providers/cast/cast_session_tracker.h"
@@ -23,6 +22,7 @@
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/openscreen/src/cast/common/channel/proto/cast_channel.pb.h"
namespace media_router {
@@ -108,10 +108,10 @@
mojo::Receiver<mirroring::mojom::CastMessageChannel> channel_receiver_{this};
// Set before and after a mirroring session is established, for metrics.
- base::Optional<base::Time> will_start_mirroring_timestamp_;
- base::Optional<base::Time> did_start_mirroring_timestamp_;
+ absl::optional<base::Time> will_start_mirroring_timestamp_;
+ absl::optional<base::Time> did_start_mirroring_timestamp_;
- const base::Optional<MirroringType> mirroring_type_;
+ const absl::optional<MirroringType> mirroring_type_;
const CastSinkExtraData cast_data_;
OnStopCallback on_stop_;
base::WeakPtrFactory<MirroringActivity> weak_ptr_factory_{this};
diff --git a/chrome/browser/media/router/providers/cast/mirroring_activity_unittest.cc b/chrome/browser/media/router/providers/cast/mirroring_activity_unittest.cc
index f822fcf..ebb0048 100644
--- a/chrome/browser/media/router/providers/cast/mirroring_activity_unittest.cc
+++ b/chrome/browser/media/router/providers/cast/mirroring_activity_unittest.cc
@@ -366,7 +366,7 @@
"type": "OFFER"
})";
- base::Optional<base::Value> message_json = base::JSONReader::Read(message);
+ absl::optional<base::Value> message_json = base::JSONReader::Read(message);
EXPECT_TRUE(message_json);
EXPECT_THAT(scrubbed_message,
base::test::IsJson(MirroringActivity::GetScrubbedLogMessage(
diff --git a/chrome/browser/media/router/providers/cast/mock_app_activity.h b/chrome/browser/media/router/providers/cast/mock_app_activity.h
index beba9fe..a4a47aae 100644
--- a/chrome/browser/media/router/providers/cast/mock_app_activity.h
+++ b/chrome/browser/media/router/providers/cast/mock_app_activity.h
@@ -24,7 +24,7 @@
MOCK_METHOD1(SendAppMessageToReceiver,
cast_channel::Result(const CastInternalMessage& cast_message));
MOCK_METHOD1(SendMediaRequestToReceiver,
- base::Optional<int>(const CastInternalMessage& cast_message));
+ absl::optional<int>(const CastInternalMessage& cast_message));
MOCK_METHOD2(SendSetVolumeRequestToReceiver,
void(const CastInternalMessage& cast_message,
cast_channel::ResultCallback callback));
@@ -49,7 +49,7 @@
blink::mojom::PresentationConnectionMessagePtr message));
MOCK_METHOD2(SendMediaStatusToClients,
void(const base::Value& media_status,
- base::Optional<int> request_id));
+ absl::optional<int> request_id));
MOCK_METHOD1(
ClosePresentationConnections,
void(blink::mojom::PresentationConnectionCloseReason close_reason));
diff --git a/chrome/browser/media/router/providers/dial/dial_activity_manager.cc b/chrome/browser/media/router/providers/dial/dial_activity_manager.cc
index 4bb4b05e..146f482 100644
--- a/chrome/browser/media/router/providers/dial/dial_activity_manager.cc
+++ b/chrome/browser/media/router/providers/dial/dial_activity_manager.cc
@@ -54,7 +54,7 @@
} // namespace
DialLaunchInfo::DialLaunchInfo(const std::string& app_name,
- const base::Optional<std::string>& post_data,
+ const absl::optional<std::string>& post_data,
const std::string& client_id,
const GURL& app_launch_url)
: app_name(app_name),
@@ -83,7 +83,7 @@
return nullptr;
std::string client_id;
- base::Optional<std::string> post_data;
+ absl::optional<std::string> post_data;
// Note: QueryIterator stores the URL by reference, so we must not give it a
// temporary object.
for (net::QueryIterator query_it(url); !query_it.IsAtEnd();
@@ -203,7 +203,7 @@
const DialLaunchInfo& launch_info = record->activity.launch_info;
// |launch_parameter| overrides original POST data, if it exists.
- const base::Optional<std::string>& post_data = message.launch_parameter
+ const absl::optional<std::string>& post_data = message.launch_parameter
? message.launch_parameter
: launch_info.post_data;
auto fetcher =
@@ -217,7 +217,7 @@
std::move(fetcher), std::move(callback));
}
-std::pair<base::Optional<std::string>, RouteRequestResult::ResultCode>
+std::pair<absl::optional<std::string>, RouteRequestResult::ResultCode>
DialActivityManager::CanStopApp(const MediaRoute::Id& route_id) const {
auto record_it = records_.find(route_id);
if (record_it == records_.end())
@@ -227,7 +227,7 @@
return {"A pending request already exists",
RouteRequestResult::UNKNOWN_ERROR};
}
- return {base::nullopt, RouteRequestResult::OK};
+ return {absl::nullopt, RouteRequestResult::OK};
}
void DialActivityManager::StopApp(
@@ -244,7 +244,7 @@
// as if it never launched.
if (record->state != DialActivityManager::Record::State::kLaunched) {
records_.erase(record_it);
- std::move(callback).Run(base::nullopt, RouteRequestResult::OK);
+ std::move(callback).Run(absl::nullopt, RouteRequestResult::OK);
return;
}
@@ -303,7 +303,7 @@
void DialActivityManager::OnLaunchError(const MediaRoute::Id& route_id,
const std::string& message,
- base::Optional<int> response_code) {
+ absl::optional<int> response_code) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
auto record_it = records_.find(route_id);
if (record_it == records_.end())
@@ -326,12 +326,12 @@
auto& record = record_it->second;
auto cb = std::move(record->pending_stop_request->callback);
records_.erase(record_it);
- std::move(cb).Run(base::nullopt, RouteRequestResult::OK);
+ std::move(cb).Run(absl::nullopt, RouteRequestResult::OK);
}
void DialActivityManager::OnStopError(const MediaRoute::Id& route_id,
const std::string& message,
- base::Optional<int> response_code) {
+ absl::optional<int> response_code) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
auto record_it = records_.find(route_id);
if (record_it == records_.end())
diff --git a/chrome/browser/media/router/providers/dial/dial_activity_manager.h b/chrome/browser/media/router/providers/dial/dial_activity_manager.h
index b0ba1523..2940e6b1 100644
--- a/chrome/browser/media/router/providers/dial/dial_activity_manager.h
+++ b/chrome/browser/media/router/providers/dial/dial_activity_manager.h
@@ -27,7 +27,7 @@
// Represents parameters used to complete a custom DIAL launch sequence.
struct DialLaunchInfo {
DialLaunchInfo(const std::string& app_name,
- const base::Optional<std::string>& post_data,
+ const absl::optional<std::string>& post_data,
const std::string& client_id,
const GURL& app_launch_url);
DialLaunchInfo(const DialLaunchInfo& other);
@@ -37,7 +37,7 @@
// The data to include with the app launch POST request. Note this may be
// overridden by the launchParameter in the CUSTOM_DIAL_LAUNCH response.
- base::Optional<std::string> post_data;
+ absl::optional<std::string> post_data;
// Cast SDK client ID.
std::string client_id;
@@ -146,7 +146,7 @@
// to fail, such as |route_id| being invalid or there already being a pending
// stop request. If so, returns the error message and error code. Returns
// nullopt and RouteRequestResult::OK otherwise.
- std::pair<base::Optional<std::string>, RouteRequestResult::ResultCode>
+ std::pair<absl::optional<std::string>, RouteRequestResult::ResultCode>
CanStopApp(const MediaRoute::Id& route_id) const;
// Stops the app that is currently active on |route_id|. Assumes that
@@ -189,12 +189,12 @@
const std::string& response);
void OnLaunchError(const MediaRoute::Id& route_id,
const std::string& message,
- base::Optional<int> http_response_code);
+ absl::optional<int> http_response_code);
void OnStopSuccess(const MediaRoute::Id& route_id,
const std::string& response);
void OnStopError(const MediaRoute::Id& route_id,
const std::string& message,
- base::Optional<int> http_response_code);
+ absl::optional<int> http_response_code);
void OnInfoFetchedAfterStopError(const MediaRoute::Id& route_id,
const std::string& message,
diff --git a/chrome/browser/media/router/providers/dial/dial_activity_manager_unittest.cc b/chrome/browser/media/router/providers/dial/dial_activity_manager_unittest.cc
index 7b467dcb..4b5717c 100644
--- a/chrome/browser/media/router/providers/dial/dial_activity_manager_unittest.cc
+++ b/chrome/browser/media/router/providers/dial/dial_activity_manager_unittest.cc
@@ -55,8 +55,8 @@
~DialActivityManagerTest() override = default;
void TestLaunchApp(const DialActivity& activity,
- const base::Optional<std::string>& launch_parameter,
- const base::Optional<GURL>& app_instance_url) {
+ const absl::optional<std::string>& launch_parameter,
+ const absl::optional<GURL>& app_instance_url) {
manager_.SetExpectedRequest(activity.launch_info.app_launch_url, "POST",
launch_parameter ? *launch_parameter : "foo");
LaunchApp(activity.route.media_route_id(), launch_parameter);
@@ -66,7 +66,7 @@
// Pending launch request, no-op.
EXPECT_CALL(manager_, OnFetcherCreated()).Times(0);
- LaunchApp(activity.route.media_route_id(), base::nullopt);
+ LaunchApp(activity.route.media_route_id(), absl::nullopt);
LaunchApp(activity.route.media_route_id(), "bar");
auto response_head = network::mojom::URLResponseHead::New();
@@ -87,11 +87,11 @@
// App already launched, no-op.
EXPECT_CALL(manager_, OnFetcherCreated()).Times(0);
- LaunchApp(activity.route.media_route_id(), base::nullopt);
+ LaunchApp(activity.route.media_route_id(), absl::nullopt);
}
void LaunchApp(const MediaRoute::Id& route_id,
- const base::Optional<std::string>& launch_parameter) {
+ const absl::optional<std::string>& launch_parameter) {
CustomDialLaunchMessageBody message(true, launch_parameter);
manager_.LaunchApp(
route_id, message,
@@ -108,7 +108,7 @@
}
MOCK_METHOD2(OnStopAppResult,
- void(const base::Optional<std::string>&,
+ void(const absl::optional<std::string>&,
RouteRequestResult::ResultCode));
std::unique_ptr<DialActivity> FailToStopApp() {
@@ -118,11 +118,11 @@
CHECK(activity);
manager_.AddActivity(*activity);
- TestLaunchApp(*activity, base::nullopt, base::nullopt);
+ TestLaunchApp(*activity, absl::nullopt, absl::nullopt);
GURL app_instance_url =
GURL(activity->launch_info.app_launch_url.spec() + "/run");
- manager_.SetExpectedRequest(app_instance_url, "DELETE", base::nullopt);
+ manager_.SetExpectedRequest(app_instance_url, "DELETE", absl::nullopt);
StopApp(activity->route.media_route_id());
loader_factory_.AddResponse(
@@ -194,7 +194,7 @@
GURL app_instance_url =
GURL(sink_.dial_data().app_url.spec() + "/YouTube/app_instance");
- TestLaunchApp(*activity, base::nullopt, app_instance_url);
+ TestLaunchApp(*activity, absl::nullopt, app_instance_url);
}
TEST_F(DialActivityManagerTest, LaunchAppLaunchParameter) {
@@ -218,7 +218,7 @@
manager_.SetExpectedRequest(activity->launch_info.app_launch_url, "POST",
"foo");
- LaunchApp(activity->route.media_route_id(), base::nullopt);
+ LaunchApp(activity->route.media_route_id(), absl::nullopt);
loader_factory_.AddResponse(
activity->launch_info.app_launch_url,
@@ -241,11 +241,11 @@
GURL app_instance_url =
GURL(sink_.dial_data().app_url.spec() + "/YouTube/app_instance");
- TestLaunchApp(*activity, base::nullopt, app_instance_url);
+ TestLaunchApp(*activity, absl::nullopt, app_instance_url);
auto can_stop = manager_.CanStopApp(activity->route.media_route_id());
EXPECT_EQ(can_stop.second, RouteRequestResult::OK);
- manager_.SetExpectedRequest(app_instance_url, "DELETE", base::nullopt);
+ manager_.SetExpectedRequest(app_instance_url, "DELETE", absl::nullopt);
StopApp(activity->route.media_route_id());
testing::Mock::VerifyAndClearExpectations(this);
@@ -256,7 +256,7 @@
loader_factory_.AddResponse(app_instance_url,
network::mojom::URLResponseHead::New(), "",
network::URLLoaderCompletionStatus());
- EXPECT_CALL(*this, OnStopAppResult(testing::Eq(base::nullopt),
+ EXPECT_CALL(*this, OnStopAppResult(testing::Eq(absl::nullopt),
RouteRequestResult::OK));
base::RunLoop().RunUntilIdle();
@@ -270,17 +270,17 @@
ASSERT_TRUE(activity);
manager_.AddActivity(*activity);
- TestLaunchApp(*activity, base::nullopt, base::nullopt);
+ TestLaunchApp(*activity, absl::nullopt, absl::nullopt);
GURL app_instance_url =
GURL(activity->launch_info.app_launch_url.spec() + "/run");
- manager_.SetExpectedRequest(app_instance_url, "DELETE", base::nullopt);
+ manager_.SetExpectedRequest(app_instance_url, "DELETE", absl::nullopt);
StopApp(activity->route.media_route_id());
loader_factory_.AddResponse(app_instance_url,
network::mojom::URLResponseHead::New(), "",
network::URLLoaderCompletionStatus());
- EXPECT_CALL(*this, OnStopAppResult(testing::Eq(base::nullopt),
+ EXPECT_CALL(*this, OnStopAppResult(testing::Eq(absl::nullopt),
RouteRequestResult::OK));
base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/media/router/providers/dial/dial_internal_message_fuzzer.cc b/chrome/browser/media/router/providers/dial/dial_internal_message_fuzzer.cc
index 4b857db..650e209 100644
--- a/chrome/browser/media/router/providers/dial/dial_internal_message_fuzzer.cc
+++ b/chrome/browser/media/router/providers/dial/dial_internal_message_fuzzer.cc
@@ -16,7 +16,7 @@
if (size > 16 * 1024)
return 0;
- base::Optional<base::Value> input = base::JSONReader::Read(
+ absl::optional<base::Value> input = base::JSONReader::Read(
std::string(reinterpret_cast<const char*>(data), size));
if (!input)
return 0;
diff --git a/chrome/browser/media/router/providers/dial/dial_internal_message_util.cc b/chrome/browser/media/router/providers/dial/dial_internal_message_util.cc
index da88fb1b..8d556a9 100644
--- a/chrome/browser/media/router/providers/dial/dial_internal_message_util.cc
+++ b/chrome/browser/media/router/providers/dial/dial_internal_message_util.cc
@@ -143,7 +143,7 @@
return nullptr;
}
- base::Optional<base::Value> message_body;
+ absl::optional<base::Value> message_body;
base::Value* message_body_value = message.FindKey("message");
if (message_body_value)
message_body = std::move(*message_body_value);
@@ -160,7 +160,7 @@
}
DialInternalMessage::DialInternalMessage(DialInternalMessageType type,
- base::Optional<base::Value> body,
+ absl::optional<base::Value> body,
const std::string& client_id,
int sequence_number)
: type(type),
@@ -174,7 +174,7 @@
const DialInternalMessage& message) {
DCHECK(message.type == DialInternalMessageType::kCustomDialLaunch);
- const base::Optional<base::Value>& body = message.body;
+ const absl::optional<base::Value>& body = message.body;
if (!body || !body->is_dict())
return CustomDialLaunchMessageBody();
@@ -185,7 +185,7 @@
bool do_launch = do_launch_value->GetBool();
- base::Optional<std::string> launch_parameter;
+ absl::optional<std::string> launch_parameter;
const base::Value* launch_parameter_value =
body->FindKeyOfType("launchParameter", base::Value::Type::STRING);
if (launch_parameter_value)
@@ -197,7 +197,7 @@
CustomDialLaunchMessageBody::CustomDialLaunchMessageBody() = default;
CustomDialLaunchMessageBody::CustomDialLaunchMessageBody(
bool do_launch,
- const base::Optional<std::string>& launch_parameter)
+ const absl::optional<std::string>& launch_parameter)
: do_launch(do_launch), launch_parameter(launch_parameter) {}
CustomDialLaunchMessageBody::CustomDialLaunchMessageBody(
const CustomDialLaunchMessageBody& other) = default;
@@ -213,7 +213,7 @@
if (message.type != DialInternalMessageType::kV2Message)
return false;
- const base::Optional<base::Value>& body = message.body;
+ const absl::optional<base::Value>& body = message.body;
if (!body || !body->is_dict())
return false;
@@ -279,7 +279,7 @@
const std::string& client_id,
int sequence_number,
const std::string& error_message,
- base::Optional<int> http_error_code) const {
+ absl::optional<int> http_error_code) const {
// The structure of an error message body is defined as chrome.cast.Error in
// the Cast SDK.
base::Value body(base::Value::Type::DICTIONARY);
diff --git a/chrome/browser/media/router/providers/dial/dial_internal_message_util.h b/chrome/browser/media/router/providers/dial/dial_internal_message_util.h
index 65fc5e7b..54bda74 100644
--- a/chrome/browser/media/router/providers/dial/dial_internal_message_util.h
+++ b/chrome/browser/media/router/providers/dial/dial_internal_message_util.h
@@ -55,13 +55,13 @@
std::string* error);
DialInternalMessage(DialInternalMessageType type,
- base::Optional<base::Value> body,
+ absl::optional<base::Value> body,
const std::string& client_id,
int sequence_number);
~DialInternalMessage();
DialInternalMessageType type;
- base::Optional<base::Value> body;
+ absl::optional<base::Value> body;
std::string client_id;
int sequence_number;
@@ -77,7 +77,7 @@
CustomDialLaunchMessageBody();
CustomDialLaunchMessageBody(
bool do_launch,
- const base::Optional<std::string>& launch_parameter);
+ const absl::optional<std::string>& launch_parameter);
CustomDialLaunchMessageBody(const CustomDialLaunchMessageBody& other);
~CustomDialLaunchMessageBody();
@@ -87,7 +87,7 @@
// If |do_launch| is |true|, optional launch parameter to include with the
// launch (POST) request. This overrides the launch parameter that was
// specified in the MediaSource (if any).
- base::Optional<std::string> launch_parameter;
+ absl::optional<std::string> launch_parameter;
};
class DialInternalMessageUtil final {
@@ -141,7 +141,7 @@
const std::string& client_id,
int sequence_number,
const std::string& error_message,
- base::Optional<int> http_error_code = base::nullopt) const;
+ absl::optional<int> http_error_code = absl::nullopt) const;
private:
base::Value CreateReceiver(const MediaSinkInternal& sink) const;
diff --git a/chrome/browser/media/router/providers/dial/dial_internal_message_util_unittest.cc b/chrome/browser/media/router/providers/dial/dial_internal_message_util_unittest.cc
index 1c17df5e..86a6950 100644
--- a/chrome/browser/media/router/providers/dial/dial_internal_message_util_unittest.cc
+++ b/chrome/browser/media/router/providers/dial/dial_internal_message_util_unittest.cc
@@ -18,7 +18,7 @@
public:
DialInternalMessageUtilTest()
: launch_info_("YouTube",
- base::nullopt,
+ absl::nullopt,
"152127444812943594",
GURL("http://172.17.32.151/app/YouTube")),
util_("hash-token") {
diff --git a/chrome/browser/media/router/providers/dial/dial_media_route_provider.cc b/chrome/browser/media/router/providers/dial/dial_media_route_provider.cc
index dadd21a..6e748d7 100644
--- a/chrome/browser/media/router/providers/dial/dial_media_route_provider.cc
+++ b/chrome/browser/media/router/providers/dial/dial_media_route_provider.cc
@@ -101,7 +101,7 @@
mojom::LogCategory::kRoute, kLoggerComponent,
"Failed to create route. Cannot find sink with the sink id", sink_id,
media_source, presentation_id);
- std::move(callback).Run(base::nullopt, nullptr, "Unknown sink " + sink_id,
+ std::move(callback).Run(absl::nullopt, nullptr, "Unknown sink " + sink_id,
RouteRequestResult::SINK_NOT_FOUND);
DialMediaRouteProviderMetrics::RecordCreateRouteResult(
DialCreateRouteResult::kSinkNotFound);
@@ -114,7 +114,7 @@
logger_->LogError(mojom::LogCategory::kRoute, kLoggerComponent,
"Failed to create route. Unsupported source.", sink_id,
media_source, presentation_id);
- std::move(callback).Run(base::nullopt, nullptr,
+ std::move(callback).Run(absl::nullopt, nullptr,
"Unsupported source " + media_source,
RouteRequestResult::NO_SUPPORTED_PROVIDER);
DialMediaRouteProviderMetrics::RecordCreateRouteResult(
@@ -128,7 +128,7 @@
logger_->LogError(mojom::LogCategory::kRoute, kLoggerComponent,
"Failed to create route. Route already exists.", sink_id,
media_source, presentation_id);
- std::move(callback).Run(base::nullopt, nullptr, "Activity already exists",
+ std::move(callback).Run(absl::nullopt, nullptr, "Activity already exists",
RouteRequestResult::ROUTE_ALREADY_EXISTS);
DialMediaRouteProviderMetrics::RecordCreateRouteResult(
DialCreateRouteResult::kRouteAlreadyExists);
@@ -140,7 +140,7 @@
"Successfully created a new route.", sink_id, media_source,
presentation_id);
std::move(callback).Run(activity->route, /*presentation_connection*/ nullptr,
- /*error_text*/ base::nullopt, RouteRequestResult::OK);
+ /*error_text*/ absl::nullopt, RouteRequestResult::OK);
// When a custom DIAL launch request is received, DialMediaRouteProvider will
// create a MediaRoute immediately in order to start exchanging messages with
@@ -166,9 +166,9 @@
if (activity) {
std::move(callback).Run(
activity->route, /*presentation_connection*/ nullptr,
- /*error_text*/ base::nullopt, RouteRequestResult::OK);
+ /*error_text*/ absl::nullopt, RouteRequestResult::OK);
} else {
- std::move(callback).Run(base::nullopt, /*presentation_connection*/ nullptr,
+ std::move(callback).Run(absl::nullopt, /*presentation_connection*/ nullptr,
"DIAL activity not found",
RouteRequestResult::ROUTE_NOT_FOUND);
}
@@ -185,7 +185,7 @@
ConnectRouteByRouteIdCallback callback) {
NOTIMPLEMENTED();
std::move(callback).Run(
- base::nullopt, nullptr, std::string("Not implemented"),
+ absl::nullopt, nullptr, std::string("Not implemented"),
RouteRequestResult::ResultCode::NO_SUPPORTED_PROVIDER);
}
@@ -458,7 +458,7 @@
const MediaSinkInternal& sink,
TerminateRouteCallback callback) {
const MediaRoute::Id& route_id = activity.route.media_route_id();
- std::pair<base::Optional<std::string>, RouteRequestResult::ResultCode>
+ std::pair<absl::optional<std::string>, RouteRequestResult::ResultCode>
can_stop_app = activity_manager_->CanStopApp(route_id);
if (can_stop_app.second == RouteRequestResult::OK) {
std::vector<mojom::RouteMessagePtr> messages;
@@ -485,7 +485,7 @@
void DialMediaRouteProvider::HandleStopAppResult(
const MediaRoute::Id& route_id,
TerminateRouteCallback callback,
- const base::Optional<std::string>& message,
+ const absl::optional<std::string>& message,
RouteRequestResult::ResultCode result_code) {
switch (result_code) {
case RouteRequestResult::OK:
diff --git a/chrome/browser/media/router/providers/dial/dial_media_route_provider.h b/chrome/browser/media/router/providers/dial/dial_media_route_provider.h
index 47cba0e..a759059 100644
--- a/chrome/browser/media/router/providers/dial/dial_media_route_provider.h
+++ b/chrome/browser/media/router/providers/dial/dial_media_route_provider.h
@@ -170,7 +170,7 @@
TerminateRouteCallback callback);
void HandleStopAppResult(const MediaRoute::Id& route_id,
TerminateRouteCallback callback,
- const base::Optional<std::string>& message,
+ const absl::optional<std::string>& message,
RouteRequestResult::ResultCode result_code);
void NotifyAllOnRoutesUpdated();
void NotifyOnRoutesUpdated(const MediaSource::Id& source_id,
diff --git a/chrome/browser/media/router/providers/dial/dial_media_route_provider_unittest.cc b/chrome/browser/media/router/providers/dial/dial_media_route_provider_unittest.cc
index 5b1e0660..77361253 100644
--- a/chrome/browser/media/router/providers/dial/dial_media_route_provider_unittest.cc
+++ b/chrome/browser/media/router/providers/dial/dial_media_route_provider_unittest.cc
@@ -114,9 +114,9 @@
void TearDown() override { provider_.reset(); }
void ExpectRouteResult(RouteRequestResult::ResultCode expected_result_code,
- const base::Optional<MediaRoute>& media_route,
+ const absl::optional<MediaRoute>& media_route,
mojom::RoutePresentationConnectionPtr,
- const base::Optional<std::string>& error_text,
+ const absl::optional<std::string>& error_text,
RouteRequestResult::ResultCode result_code) {
EXPECT_EQ(expected_result_code, result_code);
if (result_code == RouteRequestResult::OK) {
@@ -181,10 +181,10 @@
void TestJoinRoute(
RouteRequestResult::ResultCode expected_result,
- base::Optional<std::string> source_to_join = base::nullopt,
- base::Optional<std::string> presentation_to_join = base::nullopt,
- base::Optional<url::Origin> client_origin = base::nullopt,
- base::Optional<bool> client_incognito = base::nullopt) {
+ absl::optional<std::string> source_to_join = absl::nullopt,
+ absl::optional<std::string> presentation_to_join = absl::nullopt,
+ absl::optional<url::Origin> client_origin = absl::nullopt,
+ absl::optional<bool> client_incognito = absl::nullopt) {
CreateRoute();
ASSERT_TRUE(route_);
@@ -296,7 +296,7 @@
const MediaRoute::Id& route_id = route_->media_route_id();
ASSERT_TRUE(app_instance_url_.is_valid());
activity_manager_->SetExpectedRequest(app_instance_url_, "DELETE",
- base::nullopt);
+ absl::nullopt);
loader_factory_.AddResponse(app_instance_url_,
network::mojom::URLResponseHead::New(), "",
network::URLLoaderCompletionStatus());
@@ -336,7 +336,7 @@
ASSERT_TRUE(app_instance_url_.is_valid());
activity_manager_->SetExpectedRequest(app_instance_url_, "DELETE",
- base::nullopt);
+ absl::nullopt);
loader_factory_.AddResponse(app_instance_url_,
network::mojom::URLResponseHead::New(), "",
network::URLLoaderCompletionStatus());
@@ -372,7 +372,7 @@
const MediaRoute::Id& route_id = route_->media_route_id();
ASSERT_TRUE(app_instance_url_.is_valid());
activity_manager_->SetExpectedRequest(app_instance_url_, "DELETE",
- base::nullopt);
+ absl::nullopt);
loader_factory_.AddResponse(
app_instance_url_, network::mojom::URLResponseHead::New(), "",
network::URLLoaderCompletionStatus(net::HTTP_SERVICE_UNAVAILABLE));
@@ -401,7 +401,7 @@
}
MOCK_METHOD2(OnTerminateRoute,
- void(const base::Optional<std::string>&,
+ void(const absl::optional<std::string>&,
RouteRequestResult::ResultCode));
protected:
@@ -622,19 +622,19 @@
}
TEST_F(DialMediaRouteProviderTest, JoinRouteFailsForWrongPresentationId) {
- TestJoinRoute(RouteRequestResult::ROUTE_NOT_FOUND, base::nullopt,
+ TestJoinRoute(RouteRequestResult::ROUTE_NOT_FOUND, absl::nullopt,
"wrong-presentation-id");
}
TEST_F(DialMediaRouteProviderTest, JoinRouteFailsForWrongOrigin) {
- TestJoinRoute(RouteRequestResult::ROUTE_NOT_FOUND, base::nullopt,
- base::nullopt,
+ TestJoinRoute(RouteRequestResult::ROUTE_NOT_FOUND, absl::nullopt,
+ absl::nullopt,
url::Origin::Create(GURL("https://wrong-origin.com")));
}
TEST_F(DialMediaRouteProviderTest, JoinRouteFailsForIncognitoMismatch) {
- TestJoinRoute(RouteRequestResult::ROUTE_NOT_FOUND, base::nullopt,
- base::nullopt, base::nullopt, true);
+ TestJoinRoute(RouteRequestResult::ROUTE_NOT_FOUND, absl::nullopt,
+ absl::nullopt, absl::nullopt, true);
}
TEST_F(DialMediaRouteProviderTest, TerminateRoute) {
diff --git a/chrome/browser/media/router/providers/openscreen/network_service_async_packet_sender.h b/chrome/browser/media/router/providers/openscreen/network_service_async_packet_sender.h
index 70c6ede..4ee2f7f 100644
--- a/chrome/browser/media/router/providers/openscreen/network_service_async_packet_sender.h
+++ b/chrome/browser/media/router/providers/openscreen/network_service_async_packet_sender.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_MEDIA_ROUTER_PROVIDERS_OPENSCREEN_NETWORK_SERVICE_ASYNC_PACKET_SENDER_H_
#include "base/callback.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/net_errors.h"
diff --git a/chrome/browser/media/router/providers/test/test_media_route_provider.cc b/chrome/browser/media/router/providers/test/test_media_route_provider.cc
index 7487286..ed39991 100644
--- a/chrome/browser/media/router/providers/test/test_media_route_provider.cc
+++ b/chrome/browser/media/router/providers/test/test_media_route_provider.cc
@@ -79,7 +79,7 @@
bool incognito,
CreateRouteCallback callback) {
if (!route_error_message_.empty()) {
- std::move(callback).Run(base::nullopt, nullptr, route_error_message_,
+ std::move(callback).Run(absl::nullopt, nullptr, route_error_message_,
RouteRequestResult::ResultCode::UNKNOWN_ERROR);
} else if (!delay_.is_zero()) {
base::ThreadPool::PostDelayedTask(
@@ -106,13 +106,13 @@
route_id, blink::mojom::PresentationConnectionState::CONNECTED);
media_router_->OnRoutesUpdated(kProviderId, GetMediaRoutes(), media_source,
{});
- std::move(callback).Run(routes_[route_id], nullptr, base::nullopt,
+ std::move(callback).Run(routes_[route_id], nullptr, absl::nullopt,
RouteRequestResult::ResultCode::OK);
}
}
void TestMediaRouteProvider::CreateRouteTimeOut(CreateRouteCallback callback) {
- std::move(callback).Run(base::nullopt, nullptr, base::nullopt,
+ std::move(callback).Run(absl::nullopt, nullptr, absl::nullopt,
RouteRequestResult::ResultCode::TIMED_OUT);
}
@@ -124,23 +124,23 @@
bool incognito,
JoinRouteCallback callback) {
if (!route_error_message_.empty()) {
- std::move(callback).Run(base::nullopt, nullptr, route_error_message_,
+ std::move(callback).Run(absl::nullopt, nullptr, route_error_message_,
RouteRequestResult::UNKNOWN_ERROR);
return;
}
if (!IsValidSource(media_source)) {
- std::move(callback).Run(base::nullopt, nullptr,
+ std::move(callback).Run(absl::nullopt, nullptr,
std::string("The media source is invalid."),
RouteRequestResult::UNKNOWN_ERROR);
return;
}
auto pos = presentation_ids_to_routes_.find(presentation_id);
if (pos == presentation_ids_to_routes_.end()) {
- std::move(callback).Run(base::nullopt, nullptr,
+ std::move(callback).Run(absl::nullopt, nullptr,
std::string("Presentation does not exist."),
RouteRequestResult::UNKNOWN_ERROR);
} else if (pos->second.is_off_the_record() != incognito) {
- std::move(callback).Run(base::nullopt, nullptr,
+ std::move(callback).Run(absl::nullopt, nullptr,
std::string("Off-the-record mismatch."),
RouteRequestResult::UNKNOWN_ERROR);
} else {
@@ -161,14 +161,14 @@
bool incognito,
ConnectRouteByRouteIdCallback callback) {
if (!IsValidSource(media_source)) {
- std::move(callback).Run(base::nullopt, nullptr,
+ std::move(callback).Run(absl::nullopt, nullptr,
std::string("The media source is invalid."),
RouteRequestResult::UNKNOWN_ERROR);
return;
}
auto pos = routes_.find(route_id);
if (pos == presentation_ids_to_routes_.end()) {
- std::move(callback).Run(base::nullopt, nullptr,
+ std::move(callback).Run(absl::nullopt, nullptr,
std::string("Presentation does not exist."),
RouteRequestResult::UNKNOWN_ERROR);
} else {
@@ -194,7 +194,7 @@
media_router_->OnRoutesUpdated(
kProviderId, GetMediaRoutes(),
MediaRoute::GetMediaSourceIdFromMediaRouteId(route_id), {});
- std::move(callback).Run(base::nullopt, RouteRequestResult::OK);
+ std::move(callback).Run(absl::nullopt, RouteRequestResult::OK);
}
void TestMediaRouteProvider::SendRouteMessage(const std::string& media_route_id,
@@ -214,7 +214,7 @@
std::string response = "Pong: " + message;
std::vector<mojom::RouteMessagePtr> messages;
messages.emplace_back(mojom::RouteMessage::New(
- mojom::RouteMessage::Type::TEXT, response, base::nullopt));
+ mojom::RouteMessage::Type::TEXT, response, absl::nullopt));
media_router_->OnRouteMessagesReceived(media_route_id, std::move(messages));
}
}
diff --git a/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.cc b/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.cc
index 97d1ca77..6bcf632 100644
--- a/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.cc
+++ b/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.cc
@@ -106,9 +106,9 @@
bool off_the_record,
CreateRouteCallback callback) {
DCHECK(!base::Contains(presentations_, presentation_id));
- base::Optional<Display> display = GetDisplayBySinkId(sink_id);
+ absl::optional<Display> display = GetDisplayBySinkId(sink_id);
if (!display) {
- std::move(callback).Run(base::nullopt, nullptr,
+ std::move(callback).Run(absl::nullopt, nullptr,
std::string("Display not found"),
RouteRequestResult::SINK_NOT_FOUND);
return;
@@ -129,7 +129,7 @@
presentation.set_receiver(
CreatePresentationReceiver(presentation_id, &presentation, *display));
presentation.receiver()->Start(presentation_id, GURL(media_source));
- std::move(callback).Run(route, nullptr, base::nullopt,
+ std::move(callback).Run(route, nullptr, absl::nullopt,
RouteRequestResult::OK);
NotifyRouteObservers();
}
@@ -143,7 +143,7 @@
bool off_the_record,
JoinRouteCallback callback) {
std::move(callback).Run(
- base::nullopt, nullptr,
+ absl::nullopt, nullptr,
std::string("Join should be handled by the presentation manager"),
RouteRequestResult::UNKNOWN_ERROR);
}
@@ -158,7 +158,7 @@
bool off_the_record,
ConnectRouteByRouteIdCallback callback) {
std::move(callback).Run(
- base::nullopt, nullptr,
+ absl::nullopt, nullptr,
std::string("Connect should be handled by the presentation manager"),
RouteRequestResult::UNKNOWN_ERROR);
}
@@ -176,7 +176,7 @@
// The presentation will be removed from |presentations_| in the termination
// callback of its receiver.
it->second.receiver()->Terminate();
- std::move(callback).Run(base::nullopt, RouteRequestResult::OK);
+ std::move(callback).Run(absl::nullopt, RouteRequestResult::OK);
}
void WiredDisplayMediaRouteProvider::SendRouteMessage(
@@ -449,15 +449,15 @@
presentation_to_terminate->Terminate();
}
-base::Optional<Display> WiredDisplayMediaRouteProvider::GetDisplayBySinkId(
+absl::optional<Display> WiredDisplayMediaRouteProvider::GetDisplayBySinkId(
const std::string& sink_id) const {
std::vector<Display> displays = GetAllDisplays();
auto it = std::find_if(displays.begin(), displays.end(),
[&sink_id](const Display& display) {
return GetSinkIdForDisplay(display) == sink_id;
});
- return it == displays.end() ? base::nullopt
- : base::make_optional<Display>(std::move(*it));
+ return it == displays.end() ? absl::nullopt
+ : absl::make_optional<Display>(std::move(*it));
}
} // namespace media_router
diff --git a/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.h b/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.h
index 6c46682..7a98c5d6 100644
--- a/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.h
+++ b/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.h
@@ -174,7 +174,7 @@
void TerminatePresentationsOnDisplay(const display::Display& display);
// Returns a display associated with |sink_id|, or a nullopt if not found.
- base::Optional<display::Display> GetDisplayBySinkId(
+ absl::optional<display::Display> GetDisplayBySinkId(
const std::string& sink_id) const;
// Returns a list of available sinks.
diff --git a/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider_unittest.cc b/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider_unittest.cc
index 8409d99..4a6094e6 100644
--- a/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider_unittest.cc
+++ b/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider_unittest.cc
@@ -35,12 +35,12 @@
class MockCallback {
public:
MOCK_METHOD4(CreateRoute,
- void(const base::Optional<MediaRoute>& route,
+ void(const absl::optional<MediaRoute>& route,
mojom::RoutePresentationConnectionPtr connection,
- const base::Optional<std::string>& error,
+ const absl::optional<std::string>& error,
RouteRequestResult::ResultCode result));
MOCK_METHOD2(TerminateRoute,
- void(const base::Optional<std::string>& error,
+ void(const absl::optional<std::string>& error,
RouteRequestResult::ResultCode result));
};
@@ -315,10 +315,10 @@
base::RunLoop().RunUntilIdle();
// Create a route for |presentation_id|.
- EXPECT_CALL(callback, CreateRoute(_, _, base::Optional<std::string>(),
+ EXPECT_CALL(callback, CreateRoute(_, _, absl::optional<std::string>(),
RouteRequestResult::OK))
.WillOnce(WithArg<0>(
- Invoke([&presentation_id](const base::Optional<MediaRoute>& route) {
+ Invoke([&presentation_id](const absl::optional<MediaRoute>& route) {
EXPECT_TRUE(route.has_value());
EXPECT_EQ(route->media_route_id(), presentation_id);
EXPECT_EQ(route->description(), "Presenting (www.example.com)");
@@ -341,7 +341,7 @@
base::RunLoop().RunUntilIdle();
// Terminate the route.
- EXPECT_CALL(callback, TerminateRoute(base::Optional<std::string>(),
+ EXPECT_CALL(callback, TerminateRoute(absl::optional<std::string>(),
RouteRequestResult::OK));
EXPECT_CALL(*receiver_creator_.receiver(), Terminate());
EXPECT_CALL(router_,
diff --git a/chrome/browser/media/router/test/media_router_mojo_test.cc b/chrome/browser/media/router/test/media_router_mojo_test.cc
index 7c8c9d0..8f514c2 100644
--- a/chrome/browser/media/router/test/media_router_mojo_test.cc
+++ b/chrome/browser/media/router/test/media_router_mojo_test.cc
@@ -69,7 +69,7 @@
}
void MockMediaRouteProvider::RouteRequestTimeout(RouteCallback& cb) const {
- std::move(cb).Run(base::nullopt, nullptr, std::string("error"),
+ std::move(cb).Run(absl::nullopt, nullptr, std::string("error"),
RouteRequestResult::TIMED_OUT);
}
@@ -323,7 +323,7 @@
.WillOnce(
Invoke([](const std::string& route_id,
mojom::MediaRouteProvider::TerminateRouteCallback& cb) {
- std::move(cb).Run(base::nullopt, RouteRequestResult::OK);
+ std::move(cb).Run(absl::nullopt, RouteRequestResult::OK);
}));
router()->TerminateRoute(kRouteId);
base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/media/router/test/media_router_mojo_test.h b/chrome/browser/media/router/test/media_router_mojo_test.h
index 4918a11d..828d3eb 100644
--- a/chrome/browser/media/router/test/media_router_mojo_test.h
+++ b/chrome/browser/media/router/test/media_router_mojo_test.h
@@ -36,9 +36,9 @@
class MockMediaRouteProvider : public mojom::MediaRouteProvider {
public:
using RouteCallback =
- base::OnceCallback<void(const base::Optional<MediaRoute>&,
+ base::OnceCallback<void(const absl::optional<MediaRoute>&,
mojom::RoutePresentationConnectionPtr,
- const base::Optional<std::string>&,
+ const absl::optional<std::string>&,
RouteRequestResult::ResultCode)>;
MockMediaRouteProvider();
@@ -161,7 +161,7 @@
private:
// The route that is passed into callbacks.
- base::Optional<MediaRoute> route_;
+ absl::optional<MediaRoute> route_;
DISALLOW_COPY_AND_ASSIGN(MockMediaRouteProvider);
};
diff --git a/chrome/browser/media/router/test/provider_test_helpers.cc b/chrome/browser/media/router/test/provider_test_helpers.cc
index bd2b63c4..258668c 100644
--- a/chrome/browser/media/router/test/provider_test_helpers.cc
+++ b/chrome/browser/media/router/test/provider_test_helpers.cc
@@ -65,7 +65,7 @@
void TestDialURLFetcher::Start(const GURL& url,
const std::string& method,
- const base::Optional<std::string>& post_data,
+ const absl::optional<std::string>& post_data,
int max_retries,
bool set_origin_header) {
DoStart(url, method, post_data, max_retries);
@@ -99,7 +99,7 @@
void TestDialActivityManager::SetExpectedRequest(
const GURL& url,
const std::string& method,
- const base::Optional<std::string>& post_data) {
+ const absl::optional<std::string>& post_data) {
EXPECT_CALL(*this, OnFetcherCreated());
expected_url_ = url;
expected_method_ = method;
diff --git a/chrome/browser/media/router/test/provider_test_helpers.h b/chrome/browser/media/router/test/provider_test_helpers.h
index 6564536..62555e0c 100644
--- a/chrome/browser/media/router/test/provider_test_helpers.h
+++ b/chrome/browser/media/router/test/provider_test_helpers.h
@@ -99,13 +99,13 @@
~TestDialURLFetcher() override;
void Start(const GURL& url,
const std::string& method,
- const base::Optional<std::string>& post_data,
+ const absl::optional<std::string>& post_data,
int max_retries,
bool set_origin_header) override;
MOCK_METHOD4(DoStart,
void(const GURL&,
const std::string&,
- const base::Optional<std::string>&,
+ const absl::optional<std::string>&,
int));
void StartDownload() override;
@@ -125,7 +125,7 @@
void SetExpectedRequest(const GURL& url,
const std::string& method,
- const base::Optional<std::string>& post_data);
+ const absl::optional<std::string>& post_data);
MOCK_METHOD0(OnFetcherCreated, void());
@@ -134,7 +134,7 @@
GURL expected_url_;
std::string expected_method_;
- base::Optional<std::string> expected_post_data_;
+ absl::optional<std::string> expected_post_data_;
DISALLOW_COPY_AND_ASSIGN(TestDialActivityManager);
};
diff --git a/chrome/browser/media/test_license_server.cc b/chrome/browser/media/test_license_server.cc
index 4bf278f..f86102f 100644
--- a/chrome/browser/media/test_license_server.cc
+++ b/chrome/browser/media/test_license_server.cc
@@ -10,10 +10,10 @@
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/process/launch.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/media/test_license_server_config.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
TestLicenseServer::TestLicenseServer(
std::unique_ptr<TestLicenseServerConfig> server_config)
@@ -38,7 +38,7 @@
return false;
}
- base::Optional<base::EnvironmentMap> env =
+ absl::optional<base::EnvironmentMap> env =
server_config_->GetServerEnvironment();
if (!env) {
LOG(WARNING) << "Could not get server environment variables.";
diff --git a/chrome/browser/media/test_license_server_config.h b/chrome/browser/media/test_license_server_config.h
index 7a145a21..651564b 100644
--- a/chrome/browser/media/test_license_server_config.h
+++ b/chrome/browser/media/test_license_server_config.h
@@ -10,7 +10,7 @@
#include "base/environment.h"
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class CommandLine;
@@ -31,9 +31,9 @@
// server with needed args and switches.
virtual bool GetServerCommandLine(base::CommandLine* command_line) = 0;
- // Returns the environment map to apply to the server, or base::nullopt on
+ // Returns the environment map to apply to the server, or absl::nullopt on
// error.
- virtual base::Optional<base::EnvironmentMap> GetServerEnvironment() = 0;
+ virtual absl::optional<base::EnvironmentMap> GetServerEnvironment() = 0;
// Returns true if the server is supported on current platform.
virtual bool IsPlatformSupported() = 0;
diff --git a/chrome/browser/media/webrtc/current_tab_desktop_media_list.cc b/chrome/browser/media/webrtc/current_tab_desktop_media_list.cc
index baa4c3e7..36d3dc54 100644
--- a/chrome/browser/media/webrtc/current_tab_desktop_media_list.cc
+++ b/chrome/browser/media/webrtc/current_tab_desktop_media_list.cc
@@ -54,14 +54,14 @@
}
void HandleCapturedBitmap(
- base::OnceCallback<void(uint32_t, const base::Optional<gfx::ImageSkia>&)>
+ base::OnceCallback<void(uint32_t, const absl::optional<gfx::ImageSkia>&)>
reply,
- base::Optional<uint32_t> last_hash,
+ absl::optional<uint32_t> last_hash,
gfx::Size thumbnail_size,
const SkBitmap& bitmap) {
DCHECK(!thumbnail_size.IsEmpty());
- base::Optional<gfx::ImageSkia> image;
+ absl::optional<gfx::ImageSkia> image;
// Only scale and update if the frame appears to be new.
const uint32_t hash = base::FastHash(base::make_span(
@@ -140,7 +140,7 @@
void CurrentTabDesktopMediaList::OnCaptureHandled(
uint32_t hash,
- const base::Optional<gfx::ImageSkia>& image) {
+ const absl::optional<gfx::ImageSkia>& image) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK((hash != last_hash_) == image.has_value()); // Only new frames passed.
diff --git a/chrome/browser/media/webrtc/current_tab_desktop_media_list.h b/chrome/browser/media/webrtc/current_tab_desktop_media_list.h
index 61fb2b5..f3d18ae 100644
--- a/chrome/browser/media/webrtc/current_tab_desktop_media_list.h
+++ b/chrome/browser/media/webrtc/current_tab_desktop_media_list.h
@@ -30,7 +30,7 @@
// Otherwise, an empty Optional is sent back. In either case, |hash| is the
// hash value of the frame that was handled.
void OnCaptureHandled(uint32_t hash,
- const base::Optional<gfx::ImageSkia>& image);
+ const absl::optional<gfx::ImageSkia>& image);
// It's hard for tests to control what kind of image is given by the mock.
// Normally it just returns the same thing again and again. To simulate a
@@ -45,7 +45,7 @@
// The hash of the last captured frame. Used to detect identical frames
// and prevent needless rescaling.
- base::Optional<uint32_t> last_hash_;
+ absl::optional<uint32_t> last_hash_;
// The heavy lifting involved with rescaling images into thumbnails is
// moved off of the UI thread and onto this task runner.
diff --git a/chrome/browser/media/webrtc/desktop_media_picker.h b/chrome/browser/media/webrtc/desktop_media_picker.h
index d2e56e0..5a6386b 100644
--- a/chrome/browser/media/webrtc/desktop_media_picker.h
+++ b/chrome/browser/media/webrtc/desktop_media_picker.h
@@ -12,10 +12,10 @@
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "content/public/browser/desktop_media_id.h"
#include "content/public/browser/media_stream_request.h"
#include "content/public/browser/web_contents_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/native_widget_types.h"
diff --git a/chrome/browser/media/webrtc/desktop_media_picker_factory.h b/chrome/browser/media/webrtc/desktop_media_picker_factory.h
index 5491c93..de05553 100644
--- a/chrome/browser/media/webrtc/desktop_media_picker_factory.h
+++ b/chrome/browser/media/webrtc/desktop_media_picker_factory.h
@@ -8,12 +8,12 @@
#include <memory>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/media/webrtc/desktop_media_list.h"
#include "chrome/browser/media/webrtc/desktop_media_picker.h"
#include "content/public/browser/desktop_media_id.h"
#include "content/public/browser/media_stream_request.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Interface for factory creating DesktopMediaList and DesktopMediaPicker
// instances.
diff --git a/chrome/browser/media/webrtc/fake_desktop_media_picker_factory.h b/chrome/browser/media/webrtc/fake_desktop_media_picker_factory.h
index c00c8af..6451a2f 100644
--- a/chrome/browser/media/webrtc/fake_desktop_media_picker_factory.h
+++ b/chrome/browser/media/webrtc/fake_desktop_media_picker_factory.h
@@ -8,11 +8,11 @@
#include <memory>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/media/webrtc/desktop_media_list.h"
#include "chrome/browser/media/webrtc/desktop_media_picker.h"
#include "chrome/browser/media/webrtc/desktop_media_picker_factory.h"
#include "content/public/browser/desktop_media_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class FakeDesktopMediaPicker;
diff --git a/chrome/browser/media/webrtc/media_stream_capture_indicator_unittest.cc b/chrome/browser/media/webrtc/media_stream_capture_indicator_unittest.cc
index 3ff9163..c99b3e9 100644
--- a/chrome/browser/media/webrtc/media_stream_capture_indicator_unittest.cc
+++ b/chrome/browser/media/webrtc/media_stream_capture_indicator_unittest.cc
@@ -116,26 +116,26 @@
struct ObserverMethodTestParam {
blink::mojom::MediaStreamType stream_type;
- base::Optional<media::mojom::DisplayMediaInformation> display_media_info;
+ absl::optional<media::mojom::DisplayMediaInformation> display_media_info;
MockObserverSetExpectationsMethod observer_method;
AccessorMethod accessor_method;
};
ObserverMethodTestParam kObserverMethodTestParams[] = {
{blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE,
- /*display_media_info=*/base::nullopt,
+ /*display_media_info=*/absl::nullopt,
&MockObserver::SetOnIsCapturingVideoChangedExpectation,
&MediaStreamCaptureIndicator::IsCapturingVideo},
{blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE,
- /*display_media_info=*/base::nullopt,
+ /*display_media_info=*/absl::nullopt,
&MockObserver::SetOnIsCapturingAudioChangedExpectation,
&MediaStreamCaptureIndicator::IsCapturingAudio},
{blink::mojom::MediaStreamType::GUM_TAB_VIDEO_CAPTURE,
- /*display_media_info=*/base::nullopt,
+ /*display_media_info=*/absl::nullopt,
&MockObserver::SetOnIsBeingMirroredChangedExpectation,
&MediaStreamCaptureIndicator::IsBeingMirrored},
{blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE,
- /*display_media_info=*/base::nullopt,
+ /*display_media_info=*/absl::nullopt,
&MockObserver::SetOnIsCapturingWindowChangedExpectation,
&MediaStreamCaptureIndicator::IsCapturingWindow},
{blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE,
diff --git a/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc b/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc
index b475087d..cb8fd87 100644
--- a/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc
+++ b/chrome/browser/media/webrtc/media_stream_devices_controller_browsertest.cc
@@ -236,7 +236,7 @@
blink::MediaStreamDevice fake_video_device(
blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE, example_video_id_,
"Fake Video Device", GetControlSupport(),
- media::MEDIA_VIDEO_FACING_NONE, base::nullopt);
+ media::MEDIA_VIDEO_FACING_NONE, absl::nullopt);
video_devices.push_back(fake_video_device);
MediaCaptureDevicesDispatcher::GetInstance()->SetTestVideoCaptureDevices(
video_devices);
diff --git a/chrome/browser/media/webrtc/webrtc_browsertest_base.cc b/chrome/browser/media/webrtc/webrtc_browsertest_base.cc
index 27819d1..5a80978 100644
--- a/chrome/browser/media/webrtc/webrtc_browsertest_base.cc
+++ b/chrome/browser/media/webrtc/webrtc_browsertest_base.cc
@@ -609,8 +609,8 @@
return ExecuteJavascript("openDesktopMediaStream()", tab);
}
-base::Optional<std::string> WebRtcTestBase::LoadDesktopCaptureExtension() {
- base::Optional<std::string> extension_id;
+absl::optional<std::string> WebRtcTestBase::LoadDesktopCaptureExtension() {
+ absl::optional<std::string> extension_id;
if (!desktop_capture_extension_.get()) {
extensions::ChromeTestExtensionLoader loader(browser()->profile());
base::FilePath extension_path;
diff --git a/chrome/browser/media/webrtc/webrtc_browsertest_base.h b/chrome/browser/media/webrtc/webrtc_browsertest_base.h
index 3c98df5..f190d7c 100644
--- a/chrome/browser/media/webrtc/webrtc_browsertest_base.h
+++ b/chrome/browser/media/webrtc/webrtc_browsertest_base.h
@@ -10,9 +10,9 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "chrome/browser/media/webrtc/test_stats_dictionary.h"
#include "chrome/test/base/in_process_browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace infobars {
class InfoBar;
@@ -230,7 +230,7 @@
// Try to open a dekstop media stream, and return the stream id.
// On failure, will return empty string.
std::string GetDesktopMediaStream(content::WebContents* tab);
- base::Optional<std::string> LoadDesktopCaptureExtension();
+ absl::optional<std::string> LoadDesktopCaptureExtension();
private:
void CloseInfoBarInTab(content::WebContents* tab_contents,
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_common.cc b/chrome/browser/media/webrtc/webrtc_event_log_manager_common.cc
index 5620030..323e36a 100644
--- a/chrome/browser/media/webrtc/webrtc_event_log_manager_common.cc
+++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_common.cc
@@ -105,7 +105,7 @@
class Budget {
public:
// If !max.has_value(), the budget is unlimited.
- explicit Budget(base::Optional<size_t> max) : max_(max), current_(0) {}
+ explicit Budget(absl::optional<size_t> max) : max_(max), current_(0) {}
// Check whether the budget allows consuming an additional |consumed| of
// the resource.
@@ -137,7 +137,7 @@
}
private:
- const base::Optional<size_t> max_;
+ const absl::optional<size_t> max_;
size_t current_;
};
@@ -147,7 +147,7 @@
// If !max_file_size_bytes.has_value(), an unlimited writer is created.
// If it has a value, it must be at least MinFileSizeBytes().
BaseLogFileWriter(const base::FilePath& path,
- base::Optional<size_t> max_file_size_bytes);
+ absl::optional<size_t> max_file_size_bytes);
~BaseLogFileWriter() override;
@@ -207,7 +207,7 @@
};
BaseLogFileWriter::BaseLogFileWriter(const base::FilePath& path,
- base::Optional<size_t> max_file_size_bytes)
+ absl::optional<size_t> max_file_size_bytes)
: task_runner_(base::SequencedTaskRunnerHandle::Get()),
path_(path),
state_(State::PRE_INIT),
@@ -365,7 +365,7 @@
class GzippedLogFileWriter : public BaseLogFileWriter {
public:
GzippedLogFileWriter(const base::FilePath& path,
- base::Optional<size_t> max_file_size_bytes,
+ absl::optional<size_t> max_file_size_bytes,
std::unique_ptr<LogCompressor> compressor);
~GzippedLogFileWriter() override = default;
@@ -385,7 +385,7 @@
GzippedLogFileWriter::GzippedLogFileWriter(
const base::FilePath& path,
- base::Optional<size_t> max_file_size_bytes,
+ absl::optional<size_t> max_file_size_bytes,
std::unique_ptr<LogCompressor> compressor)
: BaseLogFileWriter(path, max_file_size_bytes),
compressor_(std::move(compressor)) {
@@ -479,7 +479,7 @@
class GzipLogCompressor : public LogCompressor {
public:
GzipLogCompressor(
- base::Optional<size_t> max_size_bytes,
+ absl::optional<size_t> max_size_bytes,
std::unique_ptr<CompressedSizeEstimator> compressed_size_estimator);
~GzipLogCompressor() override;
@@ -505,8 +505,8 @@
// Returns the budget left after reserving the GZIP overhead.
// Optionals without a value, both in the parameters as well as in the
// return value of the function, signal an unlimited amount.
- static base::Optional<size_t> SizeAfterOverheadReservation(
- base::Optional<size_t> max_size_bytes);
+ static absl::optional<size_t> SizeAfterOverheadReservation(
+ absl::optional<size_t> max_size_bytes);
// Compresses |input| into |output|, while observing the budget (unless
// !budgeted). If |last|, also closes the stream.
@@ -525,7 +525,7 @@
};
GzipLogCompressor::GzipLogCompressor(
- base::Optional<size_t> max_size_bytes,
+ absl::optional<size_t> max_size_bytes,
std::unique_ptr<CompressedSizeEstimator> compressed_size_estimator)
: state_(State::PRE_HEADER),
budget_(SizeAfterOverheadReservation(max_size_bytes)),
@@ -611,10 +611,10 @@
return true;
}
-base::Optional<size_t> GzipLogCompressor::SizeAfterOverheadReservation(
- base::Optional<size_t> max_size_bytes) {
+absl::optional<size_t> GzipLogCompressor::SizeAfterOverheadReservation(
+ absl::optional<size_t> max_size_bytes) {
if (!max_size_bytes.has_value()) {
- return base::Optional<size_t>();
+ return absl::optional<size_t>();
} else {
DCHECK_GE(max_size_bytes.value(), kGzipHeaderBytes + kGzipFooterBytes);
return max_size_bytes.value() - (kGzipHeaderBytes + kGzipFooterBytes);
@@ -776,7 +776,7 @@
std::unique_ptr<LogFileWriter> BaseLogFileWriterFactory::Create(
const base::FilePath& path,
- base::Optional<size_t> max_file_size_bytes) const {
+ absl::optional<size_t> max_file_size_bytes) const {
if (max_file_size_bytes.has_value() &&
max_file_size_bytes.value() < MinFileSizeBytes()) {
LOG(WARNING) << "Max size (" << max_file_size_bytes.value()
@@ -819,7 +819,7 @@
}
std::unique_ptr<LogCompressor> GzipLogCompressorFactory::Create(
- base::Optional<size_t> max_size_bytes) const {
+ absl::optional<size_t> max_size_bytes) const {
if (max_size_bytes.has_value() && max_size_bytes.value() < MinSizeBytes()) {
LOG(WARNING) << "Max size (" << max_size_bytes.value()
<< ") below minimum size (" << MinSizeBytes() << ").";
@@ -846,7 +846,7 @@
std::unique_ptr<LogFileWriter> GzippedLogFileWriterFactory::Create(
const base::FilePath& path,
- base::Optional<size_t> max_file_size_bytes) const {
+ absl::optional<size_t> max_file_size_bytes) const {
if (max_file_size_bytes.has_value() &&
max_file_size_bytes.value() < MinFileSizeBytes()) {
LOG(WARNING) << "Size below allowed minimum.";
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_common.h b/chrome/browser/media/webrtc/webrtc_event_log_manager_common.h
index b823fde..5972da3 100644
--- a/chrome/browser/media/webrtc/webrtc_event_log_manager_common.h
+++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_common.h
@@ -9,10 +9,10 @@
#include <string>
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "ipc/ipc_message.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -318,7 +318,7 @@
// If !max_file_size_bytes.has_value(), the LogFileWriter is unlimited.
virtual std::unique_ptr<LogFileWriter> Create(
const base::FilePath& path,
- base::Optional<size_t> max_file_size_bytes) const = 0;
+ absl::optional<size_t> max_file_size_bytes) const = 0;
};
virtual ~LogFileWriter() = default;
@@ -363,7 +363,7 @@
std::unique_ptr<LogFileWriter> Create(
const base::FilePath& path,
- base::Optional<size_t> max_file_size_bytes) const override;
+ absl::optional<size_t> max_file_size_bytes) const override;
};
// Interface for a class that provides compression of a stream, while attempting
@@ -396,7 +396,7 @@
// initializations are successful; en empty unique_ptr otherwise.
// If !max_size_bytes.has_value(), an unlimited compressor is created.
virtual std::unique_ptr<LogCompressor> Create(
- base::Optional<size_t> max_size_bytes) const = 0;
+ absl::optional<size_t> max_size_bytes) const = 0;
};
// Result of a call to Compress().
@@ -482,7 +482,7 @@
size_t MinSizeBytes() const override;
std::unique_ptr<LogCompressor> Create(
- base::Optional<size_t> max_size_bytes) const override;
+ absl::optional<size_t> max_size_bytes) const override;
private:
std::unique_ptr<CompressedSizeEstimator::Factory> estimator_factory_;
@@ -502,7 +502,7 @@
std::unique_ptr<LogFileWriter> Create(
const base::FilePath& path,
- base::Optional<size_t> max_file_size_bytes) const override;
+ absl::optional<size_t> max_file_size_bytes) const override;
private:
std::unique_ptr<GzipLogCompressorFactory> gzip_compressor_factory_;
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_common_unittest.cc b/chrome/browser/media/webrtc/webrtc_event_log_manager_common_unittest.cc
index 5409366..57040a22 100644
--- a/chrome/browser/media/webrtc/webrtc_event_log_manager_common_unittest.cc
+++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_common_unittest.cc
@@ -11,13 +11,13 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "base/rand_util.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/media/webrtc/webrtc_event_log_manager_unittest_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/zlib/google/compression_utils.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
@@ -164,7 +164,7 @@
TEST_F(GzipLogCompressorTest, UnlimitedBudgetSanity) {
Init(std::make_unique<PerfectGzipEstimator::Factory>());
- auto compressor = compressor_factory_->Create(base::Optional<size_t>());
+ auto compressor = compressor_factory_->Create(absl::optional<size_t>());
ASSERT_TRUE(compressor);
std::string header;
@@ -306,7 +306,7 @@
.AddExtension(log_file_writer_factory_->Extension());
}
- std::unique_ptr<LogFileWriter> CreateWriter(base::Optional<size_t> max_size) {
+ std::unique_ptr<LogFileWriter> CreateWriter(absl::optional<size_t> max_size) {
return log_file_writer_factory_->Create(path_, max_size);
}
@@ -334,7 +334,7 @@
}
base::test::TaskEnvironment task_environment_;
- base::Optional<WebRtcEventLogCompression> compression_; // Set in Init().
+ absl::optional<WebRtcEventLogCompression> compression_; // Set in Init().
base::ScopedTempDir temp_dir_;
base::FilePath path_;
std::unique_ptr<LogFileWriter::Factory> log_file_writer_factory_;
@@ -394,7 +394,7 @@
TEST_P(LogFileWriterTest, UnlimitedBudgetSanity) {
Init(GetParam());
- auto writer = CreateWriter(base::Optional<size_t>());
+ auto writer = CreateWriter(absl::optional<size_t>());
ASSERT_TRUE(writer);
const std::string log = "log";
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_local.cc b/chrome/browser/media/webrtc/webrtc_event_log_manager_local.cc
index 3e079a74..9bc8978 100644
--- a/chrome/browser/media/webrtc/webrtc_event_log_manager_local.cc
+++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_local.cc
@@ -96,8 +96,8 @@
max_log_file_size_bytes_ =
(max_file_size_bytes == kWebRtcEventLogManagerUnlimitedFileSize)
- ? base::Optional<size_t>()
- : base::Optional<size_t>(max_file_size_bytes);
+ ? absl::optional<size_t>()
+ : absl::optional<size_t>(max_file_size_bytes);
for (const PeerConnectionKey& peer_connection : active_peer_connections_) {
if (log_files_.size() >= kMaxNumberLocalWebRtcEventLogFiles) {
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_local.h b/chrome/browser/media/webrtc/webrtc_event_log_manager_local.h
index 8294b2a..40de613 100644
--- a/chrome/browser/media/webrtc/webrtc_event_log_manager_local.h
+++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_local.h
@@ -10,10 +10,10 @@
#include <string>
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/clock.h"
#include "chrome/browser/media/webrtc/webrtc_event_log_manager_common.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace webrtc_event_logging {
@@ -88,7 +88,7 @@
// The maximum size for local logs, in bytes.
// If !has_value(), the value is unlimited.
- base::Optional<size_t> max_log_file_size_bytes_;
+ absl::optional<size_t> max_log_file_size_bytes_;
DISALLOW_COPY_AND_ASSIGN(WebRtcLocalEventLogManager);
};
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_remote.cc b/chrome/browser/media/webrtc/webrtc_event_log_manager_remote.cc
index d08a5a09..e9e4c6bb 100644
--- a/chrome/browser/media/webrtc/webrtc_event_log_manager_remote.cc
+++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_remote.cc
@@ -1063,7 +1063,7 @@
}
void WebRtcRemoteEventLogManager::PrunePendingLogs(
- base::Optional<BrowserContextId> browser_context_id) {
+ absl::optional<BrowserContextId> browser_context_id) {
DCHECK(task_runner_->RunsTasksInCurrentSequence());
MaybeRemovePendingLogs(
base::Time::Min(),
@@ -1130,7 +1130,7 @@
void WebRtcRemoteEventLogManager::MaybeRemovePendingLogs(
const base::Time& delete_begin,
const base::Time& delete_end,
- base::Optional<BrowserContextId> browser_context_id,
+ absl::optional<BrowserContextId> browser_context_id,
bool is_cache_clear) {
DCHECK(task_runner_->RunsTasksInCurrentSequence());
@@ -1197,7 +1197,7 @@
bool WebRtcRemoteEventLogManager::MatchesFilter(
BrowserContextId log_browser_context_id,
const base::Time& log_last_modification,
- base::Optional<BrowserContextId> filter_browser_context_id,
+ absl::optional<BrowserContextId> filter_browser_context_id,
const base::Time& filter_range_begin,
const base::Time& filter_range_end) const {
DCHECK(task_runner_->RunsTasksInCurrentSequence());
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_remote.h b/chrome/browser/media/webrtc/webrtc_event_log_manager_remote.h
index c472ab8..dc0d5d1 100644
--- a/chrome/browser/media/webrtc/webrtc_event_log_manager_remote.h
+++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_remote.h
@@ -11,7 +11,6 @@
#include <vector>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/time/time.h"
#include "chrome/browser/media/webrtc/webrtc_event_log_history.h"
@@ -19,6 +18,7 @@
#include "chrome/browser/media/webrtc/webrtc_event_log_uploader.h"
#include "components/upload_list/upload_list.h"
#include "services/network/public/cpp/network_connection_tracker.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace webrtc_event_logging {
@@ -279,7 +279,7 @@
// this check is not too expensive.
// If a |browser_context_id| is provided, logs are only pruned for it.
void PrunePendingLogs(
- base::Optional<BrowserContextId> browser_context_id = base::nullopt);
+ absl::optional<BrowserContextId> browser_context_id = absl::nullopt);
// PrunePendingLogs() and schedule the next proactive pending logs prune.
void RecurringlyPrunePendingLogs();
@@ -308,7 +308,7 @@
void MaybeRemovePendingLogs(
const base::Time& delete_begin,
const base::Time& delete_end,
- base::Optional<BrowserContextId> browser_context_id,
+ absl::optional<BrowserContextId> browser_context_id,
bool is_cache_clear);
// Remove all history files associated with |browser_context_id| which were
@@ -342,7 +342,7 @@
// can match the filter.
bool MatchesFilter(BrowserContextId log_browser_context_id,
const base::Time& log_last_modification,
- base::Optional<BrowserContextId> filter_browser_context_id,
+ absl::optional<BrowserContextId> filter_browser_context_id,
const base::Time& filter_range_begin,
const base::Time& filter_range_end) const;
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest.cc b/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest.cc
index 91c7b72d..b2a94d25 100644
--- a/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest.cc
+++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest.cc
@@ -23,7 +23,6 @@
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
@@ -59,6 +58,7 @@
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/zlib/google/compression_utils.h"
#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH)
@@ -98,13 +98,13 @@
#if !defined(OS_ANDROID)
-auto SaveFilePathTo(base::Optional<base::FilePath>* output) {
+auto SaveFilePathTo(absl::optional<base::FilePath>* output) {
return [output](PeerConnectionKey ignored_key, base::FilePath file_path,
int output_period_ms = 0) { *output = file_path; };
}
-auto SaveKeyAndFilePathTo(base::Optional<PeerConnectionKey>* key_output,
- base::Optional<base::FilePath>* file_path_output) {
+auto SaveKeyAndFilePathTo(absl::optional<PeerConnectionKey>* key_output,
+ absl::optional<base::FilePath>* file_path_output) {
return [key_output, file_path_output](PeerConnectionKey key,
base::FilePath file_path) {
*key_output = key;
@@ -205,7 +205,7 @@
class Factory : public WebRtcEventLogUploader::Factory {
public:
Factory(bool cancellation_expected,
- base::Optional<size_t> expected_instance_count = base::nullopt)
+ absl::optional<size_t> expected_instance_count = absl::nullopt)
: cancellation_expected_(cancellation_expected),
expected_instance_count_(expected_instance_count),
instance_count_(0) {}
@@ -228,7 +228,7 @@
private:
const bool cancellation_expected_;
- const base::Optional<size_t> expected_instance_count_;
+ const absl::optional<size_t> expected_instance_count_;
size_t instance_count_;
};
@@ -331,7 +331,7 @@
}
void CreateWebRtcEventLogManager(
- base::Optional<Compression> remote = base::nullopt) {
+ absl::optional<Compression> remote = absl::nullopt) {
DCHECK(!event_log_manager_);
event_log_manager_ = WebRtcEventLogManager::CreateSingletonInstance();
@@ -634,7 +634,7 @@
std::string profile_name,
bool is_managed_profile,
bool has_device_level_policies,
- base::Optional<bool> policy_allows_remote_logging) {
+ absl::optional<bool> policy_allows_remote_logging) {
return CreateBrowserContextWithCustomSupervision(
profile_name, is_managed_profile, has_device_level_policies,
false /* is_supervised */, policy_allows_remote_logging);
@@ -645,7 +645,7 @@
bool is_managed_profile,
bool has_device_level_policies,
bool is_supervised,
- base::Optional<bool> policy_allows_remote_logging) {
+ absl::optional<bool> policy_allows_remote_logging) {
// If profile name not specified, select a unique name.
if (profile_name.empty()) {
static size_t index = 0;
@@ -947,10 +947,10 @@
void ClearPendingLogFiles() { pending_logs_.clear(); }
- base::Optional<base::FilePath> CreateRemoteLogFile(
+ absl::optional<base::FilePath> CreateRemoteLogFile(
const PeerConnectionKey& key,
bool pending) {
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
EXPECT_TRUE(OnPeerConnectionAdded(key));
@@ -963,12 +963,12 @@
return file_path;
}
- base::Optional<base::FilePath> CreateActiveRemoteLogFile(
+ absl::optional<base::FilePath> CreateActiveRemoteLogFile(
const PeerConnectionKey& key) {
return CreateRemoteLogFile(key, false);
}
- base::Optional<base::FilePath> CreatePendingRemoteLogFile(
+ absl::optional<base::FilePath> CreatePendingRemoteLogFile(
const PeerConnectionKey& key) {
return CreateRemoteLogFile(key, true);
}
@@ -983,7 +983,7 @@
struct BrowserContextAssociatedElements {
std::vector<std::unique_ptr<MockRenderProcessHost>> rphs;
- std::vector<base::Optional<base::FilePath>> file_paths;
+ std::vector<absl::optional<base::FilePath>> file_paths;
};
std::map<const BrowserContext*,
@@ -1030,7 +1030,7 @@
std::string profile_name,
bool is_managed_profile,
bool has_device_level_policies,
- base::Optional<bool> policy_allows_remote_logging) override {
+ absl::optional<bool> policy_allows_remote_logging) override {
DCHECK_EQ(policy_enabled_, policy_allows_remote_logging.value());
return WebRtcEventLogManagerTestBase::CreateBrowserContext(
profile_name, is_managed_profile, has_device_level_policies,
@@ -1196,8 +1196,8 @@
// Defer until Init(), which will allow the test body more control.
}
- void Init(base::Optional<WebRtcEventLogCompression> remote_compression =
- base::Optional<WebRtcEventLogCompression>()) {
+ void Init(absl::optional<WebRtcEventLogCompression> remote_compression =
+ absl::optional<WebRtcEventLogCompression>()) {
CreateWebRtcEventLogManager(remote_compression);
WebRtcEventLogManagerTestBase::SetUp();
@@ -1572,7 +1572,7 @@
TEST_F(WebRtcEventLogManagerTest, LocalLogCreatesEmptyFileWhenStarted) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(local_observer_, OnLocalLogStarted(key, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -1590,7 +1590,7 @@
TEST_F(WebRtcEventLogManagerTest, LocalLogCreateAndWriteToFile) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(local_observer_, OnLocalLogStarted(key, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -1611,7 +1611,7 @@
TEST_F(WebRtcEventLogManagerTest, LocalLogMultipleWritesToSameFile) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(local_observer_, OnLocalLogStarted(key, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -1639,7 +1639,7 @@
TEST_F(WebRtcEventLogManagerTest, LocalLogFileSizeLimitNotExceeded) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(local_observer_, OnLocalLogStarted(key, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -1666,7 +1666,7 @@
TEST_F(WebRtcEventLogManagerTest, LocalLogSanityOverUnlimitedFileSizes) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(local_observer_, OnLocalLogStarted(key, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -1689,7 +1689,7 @@
TEST_F(WebRtcEventLogManagerTest, LocalLogNoWriteAfterLogStopped) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(local_observer_, OnLocalLogStarted(key, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -1720,7 +1720,7 @@
ASSERT_EQ(OnWebRtcEventLogWrite(key, log1), std::make_pair(false, false));
ASSERT_TRUE(base::IsDirectoryEmpty(local_logs_base_dir_.GetPath()));
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
EXPECT_CALL(local_observer_, OnLocalLogStarted(key, _))
.Times(1)
.WillOnce(Invoke(SaveFilePathTo(&file_path)));
@@ -1747,8 +1747,8 @@
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
const std::vector<std::string> logs = {"<setup>", "<punchline>", "<encore>"};
- std::vector<base::Optional<PeerConnectionKey>> keys(logs.size());
- std::vector<base::Optional<base::FilePath>> file_paths(logs.size());
+ std::vector<absl::optional<PeerConnectionKey>> keys(logs.size());
+ std::vector<absl::optional<base::FilePath>> file_paths(logs.size());
ASSERT_TRUE(OnPeerConnectionAdded(key));
@@ -1782,7 +1782,7 @@
keys.push_back(GetPeerConnectionKey(&rph, kLid));
}
- std::vector<base::Optional<base::FilePath>> file_paths(keys.size());
+ std::vector<absl::optional<base::FilePath>> file_paths(keys.size());
for (size_t i = 0; i < keys.size(); ++i) {
ON_CALL(local_observer_, OnLocalLogStarted(keys[i], _))
.WillByDefault(Invoke(SaveFilePathTo(&file_paths[i])));
@@ -1924,7 +1924,7 @@
// encountered, such as closing the file (an actual bug from WebRTC).
const std::vector<std::string> logs = {"<setup>", "", "<encore>"};
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(local_observer_, OnLocalLogStarted(key, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -1948,7 +1948,7 @@
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(local_observer_, OnLocalLogStarted(key, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -1993,8 +1993,8 @@
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path_1;
- base::Optional<base::FilePath> file_path_2;
+ absl::optional<base::FilePath> file_path_1;
+ absl::optional<base::FilePath> file_path_2;
EXPECT_CALL(local_observer_, OnLocalLogStarted(key, _))
.WillOnce(Invoke(SaveFilePathTo(&file_path_1)))
.WillOnce(Invoke(SaveFilePathTo(&file_path_2)));
@@ -2232,7 +2232,7 @@
StartRemoteLoggingSavesToFileWithCorrectFileNameFormat) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -2259,7 +2259,7 @@
}
TEST_F(WebRtcEventLogManagerTest, StartRemoteLoggingCreatesEmptyFile) {
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.Times(1)
@@ -2289,7 +2289,7 @@
}
// Prepare to store the logs' paths in distinct memory locations.
- base::Optional<base::FilePath> file_paths[kLogsNum];
+ absl::optional<base::FilePath> file_paths[kLogsNum];
for (size_t i = 0; i < kLogsNum; ++i) {
const auto key = GetPeerConnectionKey(rphs[i].get(), kLid);
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
@@ -2331,7 +2331,7 @@
OnPeerConnectionSessionIdSet(keys[1], id);
// Make sure the logs get written to separate files.
- base::Optional<base::FilePath> file_paths[2];
+ absl::optional<base::FilePath> file_paths[2];
for (size_t i = 0; i < 2; ++i) {
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(keys[i], _, _))
.Times(1)
@@ -2348,7 +2348,7 @@
TEST_F(WebRtcEventLogManagerTest,
OnWebRtcEventLogWriteWritesToTheRemoteBoundFile) {
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.Times(1)
@@ -2372,12 +2372,12 @@
ASSERT_TRUE(OnPeerConnectionAdded(key));
ASSERT_TRUE(OnPeerConnectionSessionIdSet(key));
- base::Optional<base::FilePath> local_path;
+ absl::optional<base::FilePath> local_path;
EXPECT_CALL(local_observer_, OnLocalLogStarted(key, _))
.Times(1)
.WillOnce(Invoke(SaveFilePathTo(&local_path)));
- base::Optional<base::FilePath> remote_path;
+ absl::optional<base::FilePath> remote_path;
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.Times(1)
.WillOnce(Invoke(SaveFilePathTo(&remote_path)));
@@ -2403,7 +2403,7 @@
TEST_F(WebRtcEventLogManagerTest, MultipleWritesToSameRemoteBoundLogfile) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -2429,7 +2429,7 @@
TEST_F(WebRtcEventLogManagerTest,
RemoteLogFileSizeLimitNotExceededSingleWrite) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -2455,7 +2455,7 @@
TEST_F(WebRtcEventLogManagerTest,
RemoteLogFileSizeLimitNotExceededMultipleWrites) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -2484,7 +2484,7 @@
GetPeerConnectionKey(rph_.get(), 0), GetPeerConnectionKey(rph_.get(), 1),
GetPeerConnectionKey(rph_.get(), 2)};
- std::vector<base::Optional<base::FilePath>> file_paths(keys.size());
+ std::vector<absl::optional<base::FilePath>> file_paths(keys.size());
for (size_t i = 0; i < keys.size(); ++i) {
ON_CALL(remote_observer_, OnRemoteLogStarted(keys[i], _, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_paths[i])));
@@ -2529,7 +2529,7 @@
keys.push_back(GetPeerConnectionKey(rph.get(), kLid));
}
- std::vector<base::Optional<base::FilePath>> file_paths(keys.size());
+ std::vector<absl::optional<base::FilePath>> file_paths(keys.size());
for (size_t i = 0; i < keys.size(); ++i) {
ON_CALL(remote_observer_, OnRemoteLogStarted(keys[i], _, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_paths[i])));
@@ -2559,7 +2559,7 @@
TEST_F(WebRtcEventLogManagerTest, DifferentRemoteLogsMayHaveDifferentMaximums) {
const std::string logs[2] = {"abra", "cadabra"};
- std::vector<base::Optional<base::FilePath>> file_paths(base::size(logs));
+ std::vector<absl::optional<base::FilePath>> file_paths(base::size(logs));
std::vector<PeerConnectionKey> keys;
for (size_t i = 0; i < base::size(logs); ++i) {
keys.push_back(GetPeerConnectionKey(rph_.get(), i));
@@ -2588,7 +2588,7 @@
TEST_F(WebRtcEventLogManagerTest, RemoteLogFileClosedWhenCapacityReached) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -2918,7 +2918,7 @@
const bool upload_result = GetParam();
const auto key = GetPeerConnectionKey(rph_.get(), 1);
- base::Optional<base::FilePath> log_file;
+ absl::optional<base::FilePath> log_file;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&log_file)));
ASSERT_TRUE(OnPeerConnectionAdded(key));
@@ -2948,7 +2948,7 @@
const bool upload_result = GetParam();
const auto key = GetPeerConnectionKey(rph_.get(), 1);
- base::Optional<base::FilePath> log_file;
+ absl::optional<base::FilePath> log_file;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&log_file)));
ASSERT_TRUE(OnPeerConnectionAdded(key));
@@ -2984,7 +2984,7 @@
// The tracked peer connection's log is not uploaded when finished, because
// another peer connection is still active.
- base::Optional<base::FilePath> log_file;
+ absl::optional<base::FilePath> log_file;
ON_CALL(remote_observer_, OnRemoteLogStarted(tracked, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&log_file)));
ASSERT_TRUE(OnPeerConnectionAdded(tracked));
@@ -3074,7 +3074,7 @@
// encountered, such as closing the file (an actual bug from WebRTC).
const std::vector<std::string> logs = {"<setup>", "", "<encore>"};
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -3337,11 +3337,11 @@
TEST_F(WebRtcEventLogManagerTest, LogAllPossibleCharacters) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> local_log_file_path;
+ absl::optional<base::FilePath> local_log_file_path;
ON_CALL(local_observer_, OnLocalLogStarted(key, _))
.WillByDefault(Invoke(SaveFilePathTo(&local_log_file_path)));
- base::Optional<base::FilePath> remote_log_file_path;
+ absl::optional<base::FilePath> remote_log_file_path;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&remote_log_file_path)));
@@ -3400,7 +3400,7 @@
SuppressUploading();
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -3583,7 +3583,7 @@
StartRemoteLoggingWebAppIdIncorporatedIntoFileName) {
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&file_path)));
@@ -3632,7 +3632,7 @@
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
ASSERT_TRUE(OnPeerConnectionAdded(key));
ASSERT_TRUE(OnPeerConnectionSessionIdSet(key));
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.Times(1)
.WillOnce(Invoke(SaveFilePathTo(&file_path)));
@@ -3659,7 +3659,7 @@
// Set up and trigger the uploading of a file.
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path = CreatePendingRemoteLogFile(key);
+ absl::optional<base::FilePath> file_path = CreatePendingRemoteLogFile(key);
ASSERT_TRUE(file_path);
ASSERT_TRUE(base::PathExists(*file_path));
@@ -3704,7 +3704,7 @@
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
ASSERT_TRUE(OnPeerConnectionAdded(key));
ASSERT_TRUE(OnPeerConnectionSessionIdSet(key));
- base::Optional<base::FilePath> file_path;
+ absl::optional<base::FilePath> file_path;
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.Times(1)
.WillOnce(Invoke(SaveFilePathTo(&file_path)));
@@ -3728,7 +3728,7 @@
// Set up and trigger the uploading of a file.
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path = CreatePendingRemoteLogFile(key);
+ absl::optional<base::FilePath> file_path = CreatePendingRemoteLogFile(key);
ASSERT_TRUE(file_path);
ASSERT_TRUE(base::PathExists(*file_path));
@@ -3781,7 +3781,7 @@
auto cleared_rph =
std::make_unique<MockRenderProcessHost>(cleared_browser_context.get());
const auto cleared_key = GetPeerConnectionKey(cleared_rph.get(), kLid);
- base::Optional<base::FilePath> cleared_file_path =
+ absl::optional<base::FilePath> cleared_file_path =
CreateActiveRemoteLogFile(cleared_key);
// Remote-bound active log file that will *not* be cleared.
@@ -3789,7 +3789,7 @@
auto uncleared_rph =
std::make_unique<MockRenderProcessHost>(uncleared_browser_context.get());
const auto uncleared_key = GetPeerConnectionKey(uncleared_rph.get(), kLid);
- base::Optional<base::FilePath> uncleared_file_path =
+ absl::optional<base::FilePath> uncleared_file_path =
CreateActiveRemoteLogFile(uncleared_key);
// Test - ClearCacheForBrowserContext() only removes the files which belong
@@ -3814,7 +3814,7 @@
// Set up and trigger the uploading of a file.
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> file_path = CreatePendingRemoteLogFile(key);
+ absl::optional<base::FilePath> file_path = CreatePendingRemoteLogFile(key);
ASSERT_TRUE(file_path);
ASSERT_TRUE(base::PathExists(*file_path));
@@ -3836,7 +3836,7 @@
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> local_log;
+ absl::optional<base::FilePath> local_log;
ON_CALL(local_observer_, OnLocalLogStarted(key, _))
.WillByDefault(Invoke(SaveFilePathTo(&local_log)));
ASSERT_TRUE(EnableLocalLogging());
@@ -3875,7 +3875,7 @@
auto other_rph =
std::make_unique<MockRenderProcessHost>(other_browser_context.get());
const auto key = GetPeerConnectionKey(other_rph.get(), kLid);
- base::Optional<base::FilePath> other_file = CreatePendingRemoteLogFile(key);
+ absl::optional<base::FilePath> other_file = CreatePendingRemoteLogFile(key);
ASSERT_TRUE(other_file);
// Switch the uploader factory to one that will allow us to ensure that the
@@ -3992,7 +3992,7 @@
const bool allow_remote_logging = false;
auto browser_context = CreateBrowserContext(
"name", false /* is_managed_profile */,
- false /* has_device_level_policies */, base::nullopt);
+ false /* has_device_level_policies */, absl::nullopt);
auto rph = std::make_unique<MockRenderProcessHost>(browser_context.get());
const auto key = GetPeerConnectionKey(rph.get(), kLid);
@@ -4035,7 +4035,7 @@
auto browser_context = CreateBrowserContext(
"name", true /* is_managed_profile */,
- false /* has_device_level_policies */, base::nullopt);
+ false /* has_device_level_policies */, absl::nullopt);
auto rph = std::make_unique<MockRenderProcessHost>(browser_context.get());
const auto key = GetPeerConnectionKey(rph.get(), kLid);
@@ -4067,7 +4067,7 @@
auto browser_context = CreateBrowserContextWithCustomSupervision(
"name", true /* is_managed_profile */,
false /* has_device_level_policies */, true /* is_supervised */,
- base::nullopt);
+ absl::nullopt);
auto rph = std::make_unique<MockRenderProcessHost>(browser_context.get());
const auto key = GetPeerConnectionKey(rph.get(), kLid);
@@ -4085,7 +4085,7 @@
const bool allow_remote_logging = false;
auto browser_context =
CreateBrowserContext("name", false /* is_managed_profile */,
- true /* has_device_level_policies */, base::nullopt);
+ true /* has_device_level_policies */, absl::nullopt);
auto rph = std::make_unique<MockRenderProcessHost>(browser_context.get());
const auto key = GetPeerConnectionKey(rph.get(), kLid);
@@ -4102,7 +4102,7 @@
auto profile = CreateBrowserContext("name", true /* is_managed_profile */,
false /* has_device_level_policies */,
- base::nullopt);
+ absl::nullopt);
auto rph = std::make_unique<MockRenderProcessHost>(profile.get());
const auto key = GetPeerConnectionKey(rph.get(), kLid);
@@ -4237,7 +4237,7 @@
profile->GetPrefs()->SetBoolean(prefs::kWebRtcEventLogCollectionAllowed,
allow_remote_logging);
- base::Optional<base::FilePath> log_file;
+ absl::optional<base::FilePath> log_file;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&log_file)));
ASSERT_TRUE(OnPeerConnectionAdded(key));
@@ -4315,7 +4315,7 @@
auto rph = std::make_unique<MockRenderProcessHost>(profile.get());
const auto key = GetPeerConnectionKey(rph.get(), kLid);
- base::Optional<base::FilePath> log_file;
+ absl::optional<base::FilePath> log_file;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&log_file)));
ASSERT_TRUE(OnPeerConnectionAdded(key));
@@ -4359,7 +4359,7 @@
auto rph = std::make_unique<MockRenderProcessHost>(profile.get());
const auto key = GetPeerConnectionKey(rph.get(), kLid);
- base::Optional<base::FilePath> log_file;
+ absl::optional<base::FilePath> log_file;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&log_file)));
ASSERT_TRUE(OnPeerConnectionAdded(key));
@@ -4482,7 +4482,7 @@
ASSERT_TRUE(OnPeerConnectionAdded(key));
ASSERT_TRUE(OnPeerConnectionSessionIdSet(key));
- base::Optional<base::FilePath> log_file;
+ absl::optional<base::FilePath> log_file;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&log_file)));
ASSERT_TRUE(StartRemoteLogging(key));
@@ -4504,7 +4504,7 @@
SetUpNetworkConnection(get_conn_type_is_sync_, unsupported_type_);
const auto key = GetPeerConnectionKey(rph_.get(), 1);
- base::Optional<base::FilePath> log_file;
+ absl::optional<base::FilePath> log_file;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&log_file)));
ASSERT_TRUE(OnPeerConnectionAdded(key));
@@ -4529,7 +4529,7 @@
SetUpNetworkConnection(get_conn_type_is_sync_, supported_type_);
const auto key = GetPeerConnectionKey(rph_.get(), 1);
- base::Optional<base::FilePath> log_file;
+ absl::optional<base::FilePath> log_file;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&log_file)));
ASSERT_TRUE(OnPeerConnectionAdded(key));
@@ -4555,7 +4555,7 @@
SetUpNetworkConnection(get_conn_type_is_sync_, unsupported_type_);
const auto key = GetPeerConnectionKey(rph_.get(), 1);
- base::Optional<base::FilePath> log_file;
+ absl::optional<base::FilePath> log_file;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&log_file)));
ASSERT_TRUE(OnPeerConnectionAdded(key));
@@ -4666,7 +4666,7 @@
SetUp(kDefaultUploadDelayMs);
const auto key = GetPeerConnectionKey(rph_.get(), 1);
- base::Optional<base::FilePath> log_file;
+ absl::optional<base::FilePath> log_file;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&log_file)));
ASSERT_TRUE(OnPeerConnectionAdded(key));
@@ -4756,7 +4756,7 @@
const std::string log = "It's better than bad; it's good.";
const auto key = GetPeerConnectionKey(rph_.get(), kLid);
- base::Optional<base::FilePath> log_file;
+ absl::optional<base::FilePath> log_file;
ON_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.WillByDefault(Invoke(SaveFilePathTo(&log_file)));
ASSERT_TRUE(OnPeerConnectionAdded(key));
@@ -4819,7 +4819,7 @@
ASSERT_TRUE(OnPeerConnectionAdded(key));
ASSERT_TRUE(OnPeerConnectionSessionIdSet(key));
- base::Optional<base::FilePath> path;
+ absl::optional<base::FilePath> path;
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.Times(1)
.WillOnce(Invoke(SaveFilePathTo(&path)));
@@ -4843,7 +4843,7 @@
ASSERT_TRUE(OnPeerConnectionAdded(key));
ASSERT_TRUE(OnPeerConnectionSessionIdSet(key));
- base::Optional<base::FilePath> path;
+ absl::optional<base::FilePath> path;
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.Times(1)
.WillOnce(Invoke(SaveFilePathTo(&path)));
@@ -4876,7 +4876,7 @@
ASSERT_TRUE(OnPeerConnectionAdded(key));
ASSERT_TRUE(OnPeerConnectionSessionIdSet(key));
- base::Optional<base::FilePath> path;
+ absl::optional<base::FilePath> path;
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.Times(1)
.WillOnce(Invoke(SaveFilePathTo(&path)));
@@ -4910,7 +4910,7 @@
ASSERT_TRUE(OnPeerConnectionAdded(key));
ASSERT_TRUE(OnPeerConnectionSessionIdSet(key));
- base::Optional<base::FilePath> log_path;
+ absl::optional<base::FilePath> log_path;
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.Times(1)
.WillOnce(Invoke(SaveFilePathTo(&log_path)));
@@ -4964,7 +4964,7 @@
ASSERT_TRUE(OnPeerConnectionAdded(key));
ASSERT_TRUE(OnPeerConnectionSessionIdSet(key));
- base::Optional<base::FilePath> log_path;
+ absl::optional<base::FilePath> log_path;
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.Times(1)
.WillOnce(Invoke(SaveFilePathTo(&log_path)));
@@ -5015,7 +5015,7 @@
ASSERT_TRUE(OnPeerConnectionAdded(key));
ASSERT_TRUE(OnPeerConnectionSessionIdSet(key));
- base::Optional<base::FilePath> log_path;
+ absl::optional<base::FilePath> log_path;
EXPECT_CALL(remote_observer_, OnRemoteLogStarted(key, _, _))
.Times(1)
.WillOnce(Invoke(SaveFilePathTo(&log_path)));
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest_helpers.cc b/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest_helpers.cc
index 9fbb6b2..f30942b9 100644
--- a/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest_helpers.cc
+++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest_helpers.cc
@@ -63,7 +63,7 @@
// will never be suppressed.
GzipLogCompressorFactory factory(std::make_unique<NullEstimator::Factory>());
- compressor_ = factory.Create(base::Optional<size_t>());
+ compressor_ = factory.Create(absl::optional<size_t>());
DCHECK(compressor_);
std::string ignored;
diff --git a/chrome/browser/media/webrtc/webrtc_log_uploader.cc b/chrome/browser/media/webrtc/webrtc_log_uploader.cc
index bb05781..ca2a089 100644
--- a/chrome/browser/media/webrtc/webrtc_log_uploader.cc
+++ b/chrome/browser/media/webrtc/webrtc_log_uploader.cc
@@ -312,7 +312,7 @@
DCHECK_CALLED_ON_VALID_SEQUENCE(main_sequence_checker_);
DCHECK(!shutdown_);
network::SimpleURLLoader* loader = it->get();
- base::Optional<int> response_code;
+ absl::optional<int> response_code;
if (loader->ResponseInfo() && loader->ResponseInfo()->headers) {
response_code = loader->ResponseInfo()->headers->response_code();
}
@@ -600,7 +600,7 @@
}
void WebRtcLogUploader::NotifyUploadDoneAndLogStats(
- base::Optional<int> response_code,
+ absl::optional<int> response_code,
int network_error_code,
const std::string& report_id,
WebRtcLogUploader::UploadDoneData upload_done_data) {
diff --git a/chrome/browser/media/webrtc/webrtc_log_uploader.h b/chrome/browser/media/webrtc/webrtc_log_uploader.h
index f70d6ad..66629d6 100644
--- a/chrome/browser/media/webrtc/webrtc_log_uploader.h
+++ b/chrome/browser/media/webrtc/webrtc_log_uploader.h
@@ -16,10 +16,10 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/sequenced_task_runner.h"
#include "chrome/browser/media/webrtc/webrtc_log_buffer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace network {
@@ -193,7 +193,7 @@
// |response_code| not having a value means that no response code could be
// retrieved, in which case |network_error_code| should be something other
// than net::OK.
- void NotifyUploadDoneAndLogStats(base::Optional<int> response_code,
+ void NotifyUploadDoneAndLogStats(absl::optional<int> response_code,
int network_error_code,
const std::string& report_id,
UploadDoneData upload_done_data);
diff --git a/chrome/browser/media/webrtc/webrtc_pan_tilt_zoom_browsertest.cc b/chrome/browser/media/webrtc/webrtc_pan_tilt_zoom_browsertest.cc
index 96030fc1..49836f2b 100644
--- a/chrome/browser/media/webrtc/webrtc_pan_tilt_zoom_browsertest.cc
+++ b/chrome/browser/media/webrtc/webrtc_pan_tilt_zoom_browsertest.cc
@@ -427,7 +427,7 @@
blink::MediaStreamDevice fake_video_device(
blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE, "fake_video_dev",
"Fake Video Device", control_support, media::MEDIA_VIDEO_FACING_NONE,
- base::nullopt);
+ absl::nullopt);
video_devices.push_back(fake_video_device);
MediaCaptureDevicesDispatcher::GetInstance()->SetTestVideoCaptureDevices(
video_devices);
@@ -477,7 +477,7 @@
blink::MediaStreamDevice fake_video_device(
blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE, "fake_video_dev",
"Fake Video Device", {pan_supported, tilt_supported, zoom_supported},
- media::MEDIA_VIDEO_FACING_NONE, base::nullopt);
+ media::MEDIA_VIDEO_FACING_NONE, absl::nullopt);
video_devices.push_back(fake_video_device);
MediaCaptureDevicesDispatcher::GetInstance()->SetTestVideoCaptureDevices(
video_devices);
diff --git a/chrome/browser/media/webrtc/webrtc_text_log_handler.cc b/chrome/browser/media/webrtc/webrtc_text_log_handler.cc
index c5dd175..46e922c 100644
--- a/chrome/browser/media/webrtc/webrtc_text_log_handler.cc
+++ b/chrome/browser/media/webrtc/webrtc_text_log_handler.cc
@@ -411,7 +411,7 @@
void WebRtcTextLogHandler::OnGetNetworkInterfaceList(
GenericDoneCallback callback,
- const base::Optional<net::NetworkInterfaceList>& networks) {
+ const absl::optional<net::NetworkInterfaceList>& networks) {
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Hop to a background thread to get the distro string, which can block.
base::ThreadPool::PostTaskAndReplyWithResult(
@@ -426,7 +426,7 @@
void WebRtcTextLogHandler::OnGetNetworkInterfaceListFinish(
GenericDoneCallback callback,
- const base::Optional<net::NetworkInterfaceList>& networks,
+ const absl::optional<net::NetworkInterfaceList>& networks,
const std::string& linux_distro) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/chrome/browser/media/webrtc/webrtc_text_log_handler.h b/chrome/browser/media/webrtc/webrtc_text_log_handler.h
index 6badf72..889446b 100644
--- a/chrome/browser/media/webrtc/webrtc_text_log_handler.h
+++ b/chrome/browser/media/webrtc/webrtc_text_log_handler.h
@@ -113,10 +113,10 @@
void OnGetNetworkInterfaceList(
GenericDoneCallback callback,
- const base::Optional<net::NetworkInterfaceList>& networks);
+ const absl::optional<net::NetworkInterfaceList>& networks);
void OnGetNetworkInterfaceListFinish(
GenericDoneCallback callback,
- const base::Optional<net::NetworkInterfaceList>& networks,
+ const absl::optional<net::NetworkInterfaceList>& networks,
const std::string& linux_distro);
SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/browser/media/wv_test_license_server_config.cc b/chrome/browser/media/wv_test_license_server_config.cc
index f7aaf53..7cd95ff 100644
--- a/chrome/browser/media/wv_test_license_server_config.cc
+++ b/chrome/browser/media/wv_test_license_server_config.cc
@@ -94,13 +94,13 @@
return true;
}
-base::Optional<base::EnvironmentMap>
+absl::optional<base::EnvironmentMap>
WVTestLicenseServerConfig::GetServerEnvironment() {
// Add the Python protocol buffers files directory to Python path.
base::FilePath pyproto_dir;
if (!GetPyProtoPath(&pyproto_dir)) {
LOG(WARNING) << "Cannot find pyproto directory required by license server.";
- return base::nullopt;
+ return absl::nullopt;
}
base::EnvironmentMap map;
diff --git a/chrome/browser/media/wv_test_license_server_config.h b/chrome/browser/media/wv_test_license_server_config.h
index 0c2e11e..274d6b3 100644
--- a/chrome/browser/media/wv_test_license_server_config.h
+++ b/chrome/browser/media/wv_test_license_server_config.h
@@ -24,7 +24,7 @@
bool GetServerCommandLine(base::CommandLine* command_line) override;
- base::Optional<base::EnvironmentMap> GetServerEnvironment() override;
+ absl::optional<base::EnvironmentMap> GetServerEnvironment() override;
bool IsPlatformSupported() override;
diff --git a/chrome/browser/media_galleries/chromeos/mtp_device_delegate_impl_chromeos.cc b/chrome/browser/media_galleries/chromeos/mtp_device_delegate_impl_chromeos.cc
index 44170d79..94e60d2e 100644
--- a/chrome/browser/media_galleries/chromeos/mtp_device_delegate_impl_chromeos.cc
+++ b/chrome/browser/media_galleries/chromeos/mtp_device_delegate_impl_chromeos.cc
@@ -878,7 +878,7 @@
ErrorCallback error_callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
- base::Optional<uint32_t> file_id = CachedPathToId(file_path);
+ absl::optional<uint32_t> file_id = CachedPathToId(file_path);
if (file_id) {
GetFileInfoSuccessCallback success_callback_wrapper = base::BindOnce(
&MTPDeviceDelegateImplLinux::OnDidGetFileInfo,
@@ -913,7 +913,7 @@
if (other_components.empty()) {
// Either we reached the last component in the recursive case, or this is
// the non-recursive case.
- base::Optional<uint32_t> parent_id =
+ absl::optional<uint32_t> parent_id =
CachedPathToId(current_component.DirName());
if (parent_id) {
base::OnceClosure closure = base::BindOnce(
@@ -928,7 +928,7 @@
}
} else {
// Ensures that parent directories are created for recursive case.
- base::Optional<uint32_t> directory_id = CachedPathToId(current_component);
+ absl::optional<uint32_t> directory_id = CachedPathToId(current_component);
if (directory_id) {
// Parent directory |current_component| already exists, continue creating
// directories.
@@ -979,7 +979,7 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(task_in_progress_);
- base::Optional<uint32_t> dir_id = CachedPathToId(root);
+ absl::optional<uint32_t> dir_id = CachedPathToId(root);
if (!dir_id) {
std::move(error_callback).Run(base::File::FILE_ERROR_NOT_FOUND);
PendingRequestDone();
@@ -1012,7 +1012,7 @@
ErrorCallback error_callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
- base::Optional<uint32_t> file_id = CachedPathToId(device_file_path);
+ absl::optional<uint32_t> file_id = CachedPathToId(device_file_path);
if (file_id) {
// In case of error, only one callback will be called.
auto split_error_callback =
@@ -1049,7 +1049,7 @@
ErrorCallback error_callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
- base::Optional<uint32_t> file_id = CachedPathToId(device_file_path);
+ absl::optional<uint32_t> file_id = CachedPathToId(device_file_path);
if (file_id) {
ReadBytesRequest request(
*file_id, buf, offset, buf_len,
@@ -1087,7 +1087,7 @@
if (source_file_path.DirName() == device_file_path.DirName()) {
// If a file is moved in a same directory, rename the file.
- base::Optional<uint32_t> file_id = CachedPathToId(source_file_path);
+ absl::optional<uint32_t> file_id = CachedPathToId(source_file_path);
if (file_id) {
MTPDeviceTaskHelper::RenameObjectSuccessCallback
success_callback_wrapper = base::BindOnce(
@@ -1145,7 +1145,7 @@
}
const int source_file_descriptor = open_fd_result.first;
- base::Optional<uint32_t> parent_id =
+ absl::optional<uint32_t> parent_id =
CachedPathToId(device_file_path.DirName());
if (!parent_id) {
HandleCopyFileFromLocalError(std::move(error_callback),
@@ -1187,7 +1187,7 @@
return;
}
- base::Optional<uint32_t> file_id = CachedPathToId(file_path);
+ absl::optional<uint32_t> file_id = CachedPathToId(file_path);
if (!file_id) {
std::move(error_callback).Run(base::File::FILE_ERROR_NOT_FOUND);
return;
@@ -1209,7 +1209,7 @@
return;
}
- base::Optional<uint32_t> directory_id = CachedPathToId(file_path);
+ absl::optional<uint32_t> directory_id = CachedPathToId(file_path);
if (!directory_id) {
std::move(error_callback).Run(base::File::FILE_ERROR_NOT_FOUND);
return;
@@ -1474,7 +1474,7 @@
return;
}
- base::Optional<uint32_t> parent_id = CachedPathToId(directory_path.DirName());
+ absl::optional<uint32_t> parent_id = CachedPathToId(directory_path.DirName());
if (!parent_id) {
std::move(error_callback).Run(base::File::FILE_ERROR_NOT_FOUND);
return;
@@ -1935,7 +1935,7 @@
std::move(error_callback));
}
-base::Optional<uint32_t> MTPDeviceDelegateImplLinux::CachedPathToId(
+absl::optional<uint32_t> MTPDeviceDelegateImplLinux::CachedPathToId(
const base::FilePath& path) const {
std::string device_relpath = GetDeviceRelativePath(device_path_, path);
if (device_relpath.empty())
diff --git a/chrome/browser/media_galleries/chromeos/mtp_device_delegate_impl_chromeos.h b/chrome/browser/media_galleries/chromeos/mtp_device_delegate_impl_chromeos.h
index 30222b6..583ae4cd 100644
--- a/chrome/browser/media_galleries/chromeos/mtp_device_delegate_impl_chromeos.h
+++ b/chrome/browser/media_galleries/chromeos/mtp_device_delegate_impl_chromeos.h
@@ -20,11 +20,11 @@
#include "base/location.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/media_galleries/chromeos/mtp_device_task_helper.h"
#include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
#include "content/public/browser/browser_thread.h"
#include "storage/browser/file_system/async_file_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
struct SnapshotRequestInfo;
@@ -452,7 +452,7 @@
void FillFileCache(const base::FilePath& uncached_path);
// Given a full path, if it exists in the cache, return the id.
- base::Optional<uint32_t> CachedPathToId(const base::FilePath& path) const;
+ absl::optional<uint32_t> CachedPathToId(const base::FilePath& path) const;
// Evict the cache of |id|.
void EvictCachedPathToId(uint32_t id);
diff --git a/chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc b/chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc
index b6dc38e31..585de44 100644
--- a/chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc
+++ b/chrome/browser/metrics/antivirus_metrics_provider_win_unittest.cc
@@ -7,7 +7,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/sys_string_conversions.h"
#include "base/test/scoped_feature_list.h"
@@ -19,6 +18,7 @@
#include "chrome/services/util_win/util_win_impl.h"
#include "components/variations/hashing.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -106,7 +106,7 @@
bool got_results_;
bool expect_unhashed_value_;
base::test::TaskEnvironment task_environment_;
- base::Optional<UtilWinImpl> util_win_impl_;
+ absl::optional<UtilWinImpl> util_win_impl_;
AntiVirusMetricsProvider provider_;
base::test::ScopedFeatureList scoped_feature_list_;
base::ThreadCheckerImpl thread_checker_;
diff --git a/chrome/browser/metrics/chrome_android_metrics_provider.cc b/chrome/browser/metrics/chrome_android_metrics_provider.cc
index 586f992..0092fc3 100644
--- a/chrome/browser/metrics/chrome_android_metrics_provider.cc
+++ b/chrome/browser/metrics/chrome_android_metrics_provider.cc
@@ -5,13 +5,13 @@
#include "chrome/browser/metrics/chrome_android_metrics_provider.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "chrome/browser/android/locale/locale_manager.h"
#include "chrome/browser/android/metrics/uma_session_stats.h"
#include "chrome/browser/flags/android/chrome_session_state.h"
#include "chrome/browser/notifications/jni_headers/NotificationSystemStatusUtil_jni.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -19,14 +19,14 @@
const char kLastActivityTypePref[] =
"user_experience_metrics.last_activity_type";
-base::Optional<chrome::android::ActivityType> GetActivityTypeFromLocalState(
+absl::optional<chrome::android::ActivityType> GetActivityTypeFromLocalState(
PrefService* local_state_) {
auto value = local_state_->GetInteger(kLastActivityTypePref);
if (value >= static_cast<int>(chrome::android::ActivityType::kTabbed) &&
value <= static_cast<int>(chrome::android::ActivityType::kMaxValue)) {
return static_cast<chrome::android::ActivityType>(value);
}
- return base::nullopt;
+ return absl::nullopt;
}
void EmitActivityTypeHistograms(chrome::android::ActivityType type) {
diff --git a/chrome/browser/metrics/chromeos_metrics_provider.cc b/chrome/browser/metrics/chromeos_metrics_provider.cc
index 8920df1..f903e45 100644
--- a/chrome/browser/metrics/chromeos_metrics_provider.cc
+++ b/chrome/browser/metrics/chromeos_metrics_provider.cc
@@ -325,7 +325,7 @@
void ChromeOSMetricsProvider::OnArcFeaturesParsed(
base::OnceClosure callback,
- base::Optional<arc::ArcFeatures> features) {
+ absl::optional<arc::ArcFeatures> features) {
base::ScopedClosureRunner runner(std::move(callback));
if (!features) {
LOG(WARNING) << "ArcFeatures not available on this build";
diff --git a/chrome/browser/metrics/chromeos_metrics_provider.h b/chrome/browser/metrics/chromeos_metrics_provider.h
index 4f16d574..a68d278 100644
--- a/chrome/browser/metrics/chromeos_metrics_provider.h
+++ b/chrome/browser/metrics/chromeos_metrics_provider.h
@@ -78,7 +78,7 @@
// Updates ARC-related system profile fields, then calls the callback.
void OnArcFeaturesParsed(base::OnceClosure callback,
- base::Optional<arc::ArcFeatures> features);
+ absl::optional<arc::ArcFeatures> features);
// Called from the ProvideCurrentSessionData(...) to record UserType.
void UpdateUserTypeUMA();
@@ -106,7 +106,7 @@
std::string full_hardware_class_;
// ARC release version obtained from build properties.
- base::Optional<std::string> arc_release_ = base::nullopt;
+ absl::optional<std::string> arc_release_ = absl::nullopt;
base::WeakPtrFactory<ChromeOSMetricsProvider> weak_ptr_factory_{this};
diff --git a/chrome/browser/metrics/family_link_user_metrics_provider.h b/chrome/browser/metrics/family_link_user_metrics_provider.h
index 7f24007..1a0b73b 100644
--- a/chrome/browser/metrics/family_link_user_metrics_provider.h
+++ b/chrome/browser/metrics/family_link_user_metrics_provider.h
@@ -7,11 +7,11 @@
#include <memory>
-#include "base/optional.h"
#include "components/metrics/metrics_provider.h"
#include "components/session_manager/core/session_manager_observer.h"
#include "components/signin/public/identity_manager/access_token_info.h"
#include "google_apis/gaia/google_service_auth_error.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace metrics {
class ChromeUserMetricsExtension;
@@ -75,7 +75,7 @@
// Cache the log segment because it won't change during the session once
// assigned.
- base::Optional<LogSegment> log_segment_;
+ absl::optional<LogSegment> log_segment_;
};
#endif // CHROME_BROWSER_METRICS_FAMILY_LINK_USER_METRICS_PROVIDER_H_
diff --git a/chrome/browser/metrics/family_user_metrics_provider.h b/chrome/browser/metrics/family_user_metrics_provider.h
index 830ca34..2ca698a 100644
--- a/chrome/browser/metrics/family_user_metrics_provider.h
+++ b/chrome/browser/metrics/family_user_metrics_provider.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_METRICS_FAMILY_USER_METRICS_PROVIDER_H_
#define CHROME_BROWSER_METRICS_FAMILY_USER_METRICS_PROVIDER_H_
-#include "base/optional.h"
#include "base/scoped_multi_source_observation.h"
#include "components/metrics/metrics_provider.h"
#include "components/session_manager/core/session_manager_observer.h"
#include "components/signin/public/identity_manager/identity_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -81,7 +81,7 @@
// The only way the |family_user_log_segment_| can change during a ChromeOS
// session is if a child user adds or removes an EDU secondary account. Since
// this action doesn't happen often, cache the log segment.
- base::Optional<FamilyUserLogSegment> family_user_log_segment_;
+ absl::optional<FamilyUserLogSegment> family_user_log_segment_;
int num_secondary_accounts_ = -1;
base::ScopedMultiSourceObservation<signin::IdentityManager,
diff --git a/chrome/browser/metrics/family_user_metrics_provider_browsertest.cc b/chrome/browser/metrics/family_user_metrics_provider_browsertest.cc
index b6c2f4e2..90ae24c 100644
--- a/chrome/browser/metrics/family_user_metrics_provider_browsertest.cc
+++ b/chrome/browser/metrics/family_user_metrics_provider_browsertest.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/metrics/family_user_metrics_provider.h"
-#include "base/optional.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
@@ -26,6 +25,7 @@
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/metrics_proto/chrome_user_metrics_extension.pb.h"
#include "third_party/metrics_proto/system_profile.pb.h"
@@ -48,7 +48,7 @@
}
// Returns the account id for the primary test account for logging in.
-base::Optional<AccountId> GetPrimaryAccountId(
+absl::optional<AccountId> GetPrimaryAccountId(
FamilyUserMetricsProvider::FamilyUserLogSegment log_segment) {
if (log_segment ==
FamilyUserMetricsProvider::FamilyUserLogSegment::kStudentAtHome) {
@@ -64,7 +64,7 @@
chromeos::FakeGaiaMixin::kEnterpriseUser1GaiaId);
}
// Use the default FakeGaiaMixin::kFakeUserEmail consumer test account id.
- return base::nullopt;
+ return absl::nullopt;
}
void ProvideCurrentSessionData() {
diff --git a/chrome/browser/metrics/oom/out_of_memory_reporter.h b/chrome/browser/metrics/oom/out_of_memory_reporter.h
index a39bc80f7..81e51e40 100644
--- a/chrome/browser/metrics/oom/out_of_memory_reporter.h
+++ b/chrome/browser/metrics/oom/out_of_memory_reporter.h
@@ -71,7 +71,7 @@
base::ObserverList<Observer>::Unchecked observers_;
- base::Optional<ukm::SourceId> last_committed_source_id_;
+ absl::optional<ukm::SourceId> last_committed_source_id_;
base::TimeTicks last_navigation_timestamp_;
std::unique_ptr<const base::TickClock> tick_clock_;
int crashed_render_process_id_ = content::ChildProcessHost::kInvalidUniqueID;
diff --git a/chrome/browser/metrics/oom/out_of_memory_reporter_browsertest.cc b/chrome/browser/metrics/oom/out_of_memory_reporter_browsertest.cc
index 80d94b3..f2158a4 100644
--- a/chrome/browser/metrics/oom/out_of_memory_reporter_browsertest.cc
+++ b/chrome/browser/metrics/oom/out_of_memory_reporter_browsertest.cc
@@ -8,7 +8,6 @@
#include <utility>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/test/test_timeouts.h"
#include "build/build_config.h"
#include "chrome/browser/ui/browser.h"
@@ -23,6 +22,7 @@
#include "content/public/test/test_navigation_observer.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/chrome_debug_urls.h"
#include "third_party/blink/public/common/features.h"
#include "url/gurl.h"
@@ -68,7 +68,7 @@
}
protected:
- base::Optional<GURL> last_oom_url_;
+ absl::optional<GURL> last_oom_url_;
private:
DISALLOW_COPY_AND_ASSIGN(MAYBE_OutOfMemoryReporterBrowserTest);
diff --git a/chrome/browser/metrics/oom/out_of_memory_reporter_unittest.cc b/chrome/browser/metrics/oom/out_of_memory_reporter_unittest.cc
index e3fe7c4..af727c8 100644
--- a/chrome/browser/metrics/oom/out_of_memory_reporter_unittest.cc
+++ b/chrome/browser/metrics/oom/out_of_memory_reporter_unittest.cc
@@ -15,7 +15,6 @@
#include "base/files/scoped_file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/process/kill.h"
#include "base/run_loop.h"
@@ -41,6 +40,7 @@
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#if defined(OS_ANDROID)
@@ -188,7 +188,7 @@
protected:
base::ShadowingAtExitManager at_exit_;
- base::Optional<GURL> last_oom_url_;
+ absl::optional<GURL> last_oom_url_;
std::unique_ptr<ukm::TestAutoSetUkmRecorder> test_ukm_recorder_;
private:
diff --git a/chrome/browser/metrics/perf/perf_output.cc b/chrome/browser/metrics/perf/perf_output.cc
index 9f1c7bc..b878a4e 100644
--- a/chrome/browser/metrics/perf/perf_output.cc
+++ b/chrome/browser/metrics/perf/perf_output.cc
@@ -63,18 +63,18 @@
StopImpl();
}
-void PerfOutputCall::OnIOComplete(base::Optional<std::string> result) {
+void PerfOutputCall::OnIOComplete(absl::optional<std::string> result) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
perf_data_pipe_reader_.reset();
- // Use the r-value variant of base::Optional::value_or() to move |result| to
+ // Use the r-value variant of absl::optional::value_or() to move |result| to
// the callback argument. Callback can safely use |result| after |this| is
// deleted.
std::move(done_callback_).Run(std::move(result).value_or(std::string()));
// NOTE: |this| may be deleted at this point!
}
-void PerfOutputCall::OnGetPerfOutput(base::Optional<uint64_t> result) {
+void PerfOutputCall::OnGetPerfOutput(absl::optional<uint64_t> result) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Signal pipe reader to shut down.
diff --git a/chrome/browser/metrics/perf/perf_output.h b/chrome/browser/metrics/perf/perf_output.h
index 0439563..53cf601 100644
--- a/chrome/browser/metrics/perf/perf_output.h
+++ b/chrome/browser/metrics/perf/perf_output.h
@@ -11,11 +11,11 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "chromeos/dbus/dbus_method_call_status.h"
#include "chromeos/dbus/pipe_reader.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
class DebugDaemonClient;
@@ -50,8 +50,8 @@
private:
// Internal callbacks.
- void OnIOComplete(base::Optional<std::string> data);
- void OnGetPerfOutput(base::Optional<uint64_t> result);
+ void OnIOComplete(absl::optional<std::string> data);
+ void OnGetPerfOutput(absl::optional<uint64_t> result);
void StopImpl();
@@ -71,7 +71,7 @@
// output), the stop request will be sent out after we have the session ID to
// stop the perf session.
bool pending_stop_;
- base::Optional<uint64_t> perf_session_id_;
+ absl::optional<uint64_t> perf_session_id_;
SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/browser/metrics/power/battery_level_provider.cc b/chrome/browser/metrics/power/battery_level_provider.cc
index cff81f7..5ad9a77 100644
--- a/chrome/browser/metrics/power/battery_level_provider.cc
+++ b/chrome/browser/metrics/power/battery_level_provider.cc
@@ -7,7 +7,7 @@
BatteryLevelProvider::BatteryState::BatteryState(
size_t interface_count,
size_t battery_count,
- base::Optional<double> charge_level,
+ absl::optional<double> charge_level,
bool on_battery,
base::TimeTicks capture_time)
: interface_count(interface_count),
@@ -62,7 +62,7 @@
total_max_capacity += interface.details->full_charged_capacity;
}
- base::Optional<double> charge_level;
+ absl::optional<double> charge_level;
// Avoid invalid division.
if (!any_capacity_invalid && total_max_capacity != 0) {
charge_level = static_cast<double>(total_current_capacity) /
diff --git a/chrome/browser/metrics/power/battery_level_provider.h b/chrome/browser/metrics/power/battery_level_provider.h
index 5c3c5fe..5f48b44 100644
--- a/chrome/browser/metrics/power/battery_level_provider.h
+++ b/chrome/browser/metrics/power/battery_level_provider.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_METRICS_POWER_BATTERY_LEVEL_PROVIDER_H_
#include "base/callback.h"
-#include "base/optional.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// BatteryLevelProvider provides an interface for querying battery state.
// A platform specific implementation is obtained with
@@ -19,7 +19,7 @@
struct BatteryState {
BatteryState(size_t interface_count,
size_t battery_count,
- base::Optional<double> charge_level,
+ absl::optional<double> charge_level,
bool on_battery,
base::TimeTicks capture_time);
BatteryState(const BatteryState&);
@@ -34,7 +34,7 @@
// [0.00, 1.00], or nullopt if no battery is present or querying charge
// level failed. This may be nullopt even if |on_battery == true|, which
// indicates a failure to grab the battery level.
- base::Optional<double> charge_level = 0;
+ absl::optional<double> charge_level = 0;
// True if the system is running on battery power, false if the system is
// drawing power from an external power source.
@@ -85,7 +85,7 @@
// Detailed power state of the battery. This may be nullopt even if
// |battery_present == true| when the details couldn't be queried.
- const base::Optional<BatteryDetails> details;
+ const absl::optional<BatteryDetails> details;
};
static BatteryState MakeBatteryState(
diff --git a/chrome/browser/metrics/power/battery_level_provider_mac.mm b/chrome/browser/metrics/power/battery_level_provider_mac.mm
index a74c5f9..1469f8d 100644
--- a/chrome/browser/metrics/power/battery_level_provider_mac.mm
+++ b/chrome/browser/metrics/power/battery_level_provider_mac.mm
@@ -17,7 +17,7 @@
// Returns the value corresponding to |key| in the dictionary |description|.
// Returns |default_value| if the dictionary does not contain |key|, the
// corresponding value is nullptr or it could not be converted to SInt64.
-base::Optional<SInt64> GetValueAsSInt64(CFDictionaryRef description,
+absl::optional<SInt64> GetValueAsSInt64(CFDictionaryRef description,
CFStringRef key) {
CFNumberRef number_ref =
base::mac::GetValueFromDictionary<CFNumberRef>(description, key);
@@ -26,15 +26,15 @@
if (number_ref && CFNumberGetValue(number_ref, kCFNumberSInt64Type, &value))
return value;
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<bool> GetValueAsBoolean(CFDictionaryRef description,
+absl::optional<bool> GetValueAsBoolean(CFDictionaryRef description,
CFStringRef key) {
CFBooleanRef boolean =
base::mac::GetValueFromDictionary<CFBooleanRef>(description, key);
if (!boolean)
- return base::nullopt;
+ return absl::nullopt;
return CFBooleanGetValue(boolean);
}
@@ -66,7 +66,7 @@
BatteryLevelProvider::BatteryInterface BatteryLevelProviderMac::GetInterface(
CFDictionaryRef description) {
- base::Optional<bool> external_connected =
+ absl::optional<bool> external_connected =
GetValueAsBoolean(description, CFSTR("ExternalConnected"));
if (!external_connected.has_value())
return BatteryInterface(true);
@@ -85,9 +85,9 @@
}
// Extract the information from the dictionary.
- base::Optional<SInt64> current_capacity =
+ absl::optional<SInt64> current_capacity =
GetValueAsSInt64(description, capacity_key);
- base::Optional<SInt64> max_capacity =
+ absl::optional<SInt64> max_capacity =
GetValueAsSInt64(description, max_capacity_key);
if (!current_capacity.has_value() || !max_capacity.has_value())
return BatteryInterface(true);
diff --git a/chrome/browser/metrics/power/battery_level_provider_win.cc b/chrome/browser/metrics/power/battery_level_provider_win.cc
index 8519ecd..79a8959 100644
--- a/chrome/browser/metrics/power/battery_level_provider_win.cc
+++ b/chrome/browser/metrics/power/battery_level_provider_win.cc
@@ -63,7 +63,7 @@
// is assigned a tag, which must be used for all queries for information. For
// more details, see
// https://docs.microsoft.com/en-us/windows/win32/power/battery-information
-base::Optional<uint64_t> GetBatteryTag(HANDLE battery) {
+absl::optional<uint64_t> GetBatteryTag(HANDLE battery) {
ULONG battery_tag = 0;
ULONG wait = 0;
DWORD bytes_returned = 0;
@@ -71,14 +71,14 @@
battery, IOCTL_BATTERY_QUERY_TAG, &wait, sizeof(wait), &battery_tag,
sizeof(battery_tag), &bytes_returned, nullptr);
if (!success)
- return base::nullopt;
+ return absl::nullopt;
return battery_tag;
}
// Returns BATTERY_INFORMATION structure containing battery information, given
// battery handle and tag, or nullopt if the request failed. Battery handle and
// tag are obtained with GetBatteryHandle() and GetBatteryTag(), respectively.
-base::Optional<BATTERY_INFORMATION> GetBatteryInformation(
+absl::optional<BATTERY_INFORMATION> GetBatteryInformation(
HANDLE battery,
uint64_t battery_tag) {
BATTERY_QUERY_INFORMATION query_information = {};
@@ -91,14 +91,14 @@
sizeof(query_information), &battery_information,
sizeof(battery_information), &bytes_returned, nullptr);
if (!success)
- return base::nullopt;
+ return absl::nullopt;
return battery_information;
}
// Returns BATTERY_STATUS structure containing battery state, given battery
// handle and tag, or nullopt if the request failed. Battery handle and tag are
// obtained with GetBatteryHandle() and GetBatteryTag(), respectively.
-base::Optional<BATTERY_STATUS> GetBatteryStatus(HANDLE battery,
+absl::optional<BATTERY_STATUS> GetBatteryStatus(HANDLE battery,
uint64_t battery_tag) {
BATTERY_WAIT_STATUS wait_status = {};
wait_status.BatteryTag = battery_tag;
@@ -108,7 +108,7 @@
battery, IOCTL_BATTERY_QUERY_STATUS, &wait_status, sizeof(wait_status),
&battery_status, sizeof(battery_status), &bytes_returned, nullptr);
if (!success)
- return base::nullopt;
+ return absl::nullopt;
return battery_status;
}
@@ -156,7 +156,7 @@
if (!battery.IsValid())
return BatteryInterface(false);
- base::Optional<uint64_t> battery_tag = GetBatteryTag(battery.Get());
+ absl::optional<uint64_t> battery_tag = GetBatteryTag(battery.Get());
if (!battery_tag)
return BatteryInterface(false);
auto battery_information = GetBatteryInformation(battery.Get(), *battery_tag);
diff --git a/chrome/browser/metrics/power/power_metrics_provider_mac.mm b/chrome/browser/metrics/power/power_metrics_provider_mac.mm
index 26e2d06..233a21a 100644
--- a/chrome/browser/metrics/power/power_metrics_provider_mac.mm
+++ b/chrome/browser/metrics/power/power_metrics_provider_mac.mm
@@ -16,7 +16,6 @@
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/power_monitor/power_monitor.h"
#include "base/process/process.h"
#include "base/sequenced_task_runner.h"
@@ -24,6 +23,7 @@
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "chrome/browser/ui/browser_finder.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
constexpr base::TimeDelta kStartupPowerMetricsCollectionDuration =
diff --git a/chrome/browser/metrics/power/power_metrics_reporter.cc b/chrome/browser/metrics/power/power_metrics_reporter.cc
index 7f043d8..0deb4c6 100644
--- a/chrome/browser/metrics/power/power_metrics_reporter.cc
+++ b/chrome/browser/metrics/power/power_metrics_reporter.cc
@@ -110,7 +110,7 @@
base::TimeDelta sampling_interval,
base::TimeDelta interval_duration,
BatteryDischargeMode discharge_mode,
- base::Optional<int64_t> discharge_rate_during_interval,
+ absl::optional<int64_t> discharge_rate_during_interval,
const std::vector<const char*>& suffixes) {
// Ratio by which the time elapsed can deviate from |recording_interval|
// without invalidating this sample.
@@ -181,7 +181,7 @@
const performance_monitor::ProcessMonitor::Metrics& metrics,
base::TimeDelta interval_duration,
BatteryDischargeMode discharge_mode,
- base::Optional<int64_t> discharge_rate_during_interval) const {
+ absl::optional<int64_t> discharge_rate_during_interval) const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(data_store_.MaybeValid());
@@ -223,7 +223,7 @@
const performance_monitor::ProcessMonitor::Metrics& metrics,
base::TimeDelta interval_duration,
BatteryDischargeMode discharge_mode,
- base::Optional<int64_t> discharge_rate_during_interval) const {
+ absl::optional<int64_t> discharge_rate_during_interval) const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(data_store_.MaybeValid());
@@ -287,7 +287,7 @@
builder.Record(ukm_recorder);
}
-std::pair<PowerMetricsReporter::BatteryDischargeMode, base::Optional<int64_t>>
+std::pair<PowerMetricsReporter::BatteryDischargeMode, absl::optional<int64_t>>
PowerMetricsReporter::GetBatteryDischargeRateDuringInterval(
const BatteryLevelProvider::BatteryState& new_battery_state,
base::TimeDelta interval_duration) {
@@ -296,17 +296,17 @@
if (previous_battery_state.battery_count == 0 ||
battery_state_.battery_count == 0) {
- return {BatteryDischargeMode::kNoBattery, base::nullopt};
+ return {BatteryDischargeMode::kNoBattery, absl::nullopt};
}
if (!previous_battery_state.on_battery && !battery_state_.on_battery) {
- return {BatteryDischargeMode::kPluggedIn, base::nullopt};
+ return {BatteryDischargeMode::kPluggedIn, absl::nullopt};
}
if (previous_battery_state.on_battery != battery_state_.on_battery) {
- return {BatteryDischargeMode::kStateChanged, base::nullopt};
+ return {BatteryDischargeMode::kStateChanged, absl::nullopt};
}
if (!previous_battery_state.charge_level.has_value() ||
!battery_state_.charge_level.has_value()) {
- return {BatteryDischargeMode::kChargeLevelUnavailable, base::nullopt};
+ return {BatteryDischargeMode::kChargeLevelUnavailable, absl::nullopt};
}
// The battery discharge rate is reported per minute with 1/10000 of full
@@ -318,6 +318,6 @@
battery_state_.charge_level.value()) *
kDischargeRateFactor / interval_duration.InSeconds();
if (discharge_rate < 0)
- return {BatteryDischargeMode::kInvalidDischargeRate, base::nullopt};
+ return {BatteryDischargeMode::kInvalidDischargeRate, absl::nullopt};
return {BatteryDischargeMode::kDischarging, discharge_rate};
}
diff --git a/chrome/browser/metrics/power/power_metrics_reporter.h b/chrome/browser/metrics/power/power_metrics_reporter.h
index 21b15c69..4d2d910 100644
--- a/chrome/browser/metrics/power/power_metrics_reporter.h
+++ b/chrome/browser/metrics/power/power_metrics_reporter.h
@@ -10,11 +10,11 @@
#include <utility>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/metrics/power/battery_level_provider.h"
#include "chrome/browser/metrics/usage_scenario/usage_scenario_data_store.h"
#include "chrome/browser/performance_monitor/process_monitor.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Reports metrics related to power (battery discharge, cpu time, etc.) to
// understand what impacts Chrome's power consumption over an interval of time.
@@ -72,7 +72,7 @@
base::TimeDelta sampling_interval,
base::TimeDelta interval_duration,
BatteryDischargeMode discharge_mode,
- base::Optional<int64_t> discharge_rate_during_interval,
+ absl::optional<int64_t> discharge_rate_during_interval,
const std::vector<const char*>& suffixes);
// Report CPU histograms based on data in |metrics| and suffixed based on
@@ -99,19 +99,19 @@
const performance_monitor::ProcessMonitor::Metrics& metrics,
base::TimeDelta interval_duration,
BatteryDischargeMode discharge_mode,
- base::Optional<int64_t> discharge_rate_during_interval) const;
+ absl::optional<int64_t> discharge_rate_during_interval) const;
void ReportUKMsAndHistograms(
const performance_monitor::ProcessMonitor::Metrics& metrics,
base::TimeDelta interval_duration,
BatteryDischargeMode discharge_mode,
- base::Optional<int64_t> discharge_rate_during_interval) const;
+ absl::optional<int64_t> discharge_rate_during_interval) const;
// Computes and returns the battery discharge mode and rate during the
// interval, and reset |battery_state_| to the current state. If the discharge
// rate isn't valid, the returned value is nullopt and the reason is indicated
// per BatteryDischargeMode.
- std::pair<BatteryDischargeMode, base::Optional<int64_t>>
+ std::pair<BatteryDischargeMode, absl::optional<int64_t>>
GetBatteryDischargeRateDuringInterval(
const BatteryLevelProvider::BatteryState& new_battery_state,
base::TimeDelta interval_duration);
@@ -125,7 +125,7 @@
// Time that should elapse between calls to OnAggregatedMetricsSampled.
base::TimeDelta desired_reporting_interval_;
- BatteryLevelProvider::BatteryState battery_state_{0, 0, base::nullopt, false,
+ BatteryLevelProvider::BatteryState battery_state_{0, 0, absl::nullopt, false,
base::TimeTicks::Now()};
base::TimeTicks interval_begin_;
diff --git a/chrome/browser/metrics/power/power_metrics_reporter_unittest.cc b/chrome/browser/metrics/power/power_metrics_reporter_unittest.cc
index 57fb9dd4..54251ef 100644
--- a/chrome/browser/metrics/power/power_metrics_reporter_unittest.cc
+++ b/chrome/browser/metrics/power/power_metrics_reporter_unittest.cc
@@ -43,7 +43,7 @@
base::TimeDelta sampling_interval,
base::TimeDelta interval_duration,
BatteryDischargeMode discharge_mode,
- base::Optional<int64_t> discharge_rate_during_interval,
+ absl::optional<int64_t> discharge_rate_during_interval,
const std::vector<const char*>& suffixes) {
PowerMetricsReporter::ReportBatteryHistograms(
interval_data, sampling_interval, interval_duration, discharge_mode,
@@ -388,7 +388,7 @@
task_environment_.FastForwardBy(kExpectedMetricsCollectionInterval);
// A nullopt battery value indicates that the battery level is unavailable.
battery_states_.push(BatteryLevelProvider::BatteryState{
- 1, 1, base::nullopt, true, base::TimeTicks::Now()});
+ 1, 1, absl::nullopt, true, base::TimeTicks::Now()});
UsageScenarioDataStore::IntervalData fake_interval_data;
fake_interval_data.source_id_for_longest_visible_origin = 42;
diff --git a/chrome/browser/metrics/process_memory_metrics_emitter.cc b/chrome/browser/metrics/process_memory_metrics_emitter.cc
index 81b272f..394627ac 100644
--- a/chrome/browser/metrics/process_memory_metrics_emitter.cc
+++ b/chrome/browser/metrics/process_memory_metrics_emitter.cc
@@ -473,11 +473,11 @@
void EmitProcessUmaAndUkm(const GlobalMemoryDump::ProcessDump& pmd,
HistogramProcessType process_type,
- const base::Optional<base::TimeDelta>& uptime,
+ const absl::optional<base::TimeDelta>& uptime,
bool record_uma,
Memory_Experimental* builder) {
for (const auto& item : kAllocatorDumpNamesForMetrics) {
- base::Optional<uint64_t> value = pmd.GetMetric(item.dump_name, item.metric);
+ absl::optional<uint64_t> value = pmd.GetMetric(item.dump_name, item.metric);
if (!value)
continue;
@@ -582,7 +582,7 @@
void EmitBrowserMemoryMetrics(const GlobalMemoryDump::ProcessDump& pmd,
ukm::SourceId ukm_source_id,
ukm::UkmRecorder* ukm_recorder,
- const base::Optional<base::TimeDelta>& uptime,
+ const absl::optional<base::TimeDelta>& uptime,
bool record_uma) {
Memory_Experimental builder(ukm_source_id);
builder.SetProcessType(static_cast<int64_t>(
@@ -599,7 +599,7 @@
const ProcessMemoryMetricsEmitter::PageInfo* page_info,
ukm::UkmRecorder* ukm_recorder,
int number_of_extensions,
- const base::Optional<base::TimeDelta>& uptime,
+ const absl::optional<base::TimeDelta>& uptime,
bool record_uma) {
ukm::SourceId ukm_source_id =
page_info ? page_info->ukm_source_id : ukm::UkmRecorder::GetNewSourceID();
@@ -627,7 +627,7 @@
void EmitGpuMemoryMetrics(const GlobalMemoryDump::ProcessDump& pmd,
ukm::SourceId ukm_source_id,
ukm::UkmRecorder* ukm_recorder,
- const base::Optional<base::TimeDelta>& uptime,
+ const absl::optional<base::TimeDelta>& uptime,
bool record_uma) {
Memory_Experimental builder(ukm_source_id);
builder.SetProcessType(
@@ -642,7 +642,7 @@
const GlobalMemoryDump::ProcessDump& pmd,
ukm::SourceId ukm_source_id,
ukm::UkmRecorder* ukm_recorder,
- const base::Optional<base::TimeDelta>& uptime,
+ const absl::optional<base::TimeDelta>& uptime,
bool record_uma) {
Memory_Experimental builder(ukm_source_id);
builder.SetProcessType(static_cast<int64_t>(
@@ -790,7 +790,7 @@
return number_of_extensions;
}
-base::Optional<base::TimeDelta> ProcessMemoryMetricsEmitter::GetProcessUptime(
+absl::optional<base::TimeDelta> ProcessMemoryMetricsEmitter::GetProcessUptime(
const base::Time& now,
base::ProcessId pid) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -800,7 +800,7 @@
if (!process_info->second.launch_time.is_null())
return now - process_info->second.launch_time;
}
- return base::Optional<base::TimeDelta>();
+ return absl::optional<base::TimeDelta>();
}
void ProcessMemoryMetricsEmitter::CollateResults() {
diff --git a/chrome/browser/metrics/process_memory_metrics_emitter.h b/chrome/browser/metrics/process_memory_metrics_emitter.h
index 30855b4a..59523f01 100644
--- a/chrome/browser/metrics/process_memory_metrics_emitter.h
+++ b/chrome/browser/metrics/process_memory_metrics_emitter.h
@@ -11,12 +11,12 @@
#include "base/callback.h"
#include "base/containers/flat_map.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/process/process_handle.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/resource_coordinator/public/cpp/memory_instrumentation/global_memory_dump.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ukm {
class UkmRecorder;
@@ -73,7 +73,7 @@
// Virtual for testing. Returns the process uptime of the given process. Does
// not return a value when the process startup time is not set.
- virtual base::Optional<base::TimeDelta> GetProcessUptime(
+ virtual absl::optional<base::TimeDelta> GetProcessUptime(
const base::Time& now,
base::ProcessId pid);
diff --git a/chrome/browser/metrics/process_memory_metrics_emitter_unittest.cc b/chrome/browser/metrics/process_memory_metrics_emitter_unittest.cc
index 5c08b2f..39929267 100644
--- a/chrome/browser/metrics/process_memory_metrics_emitter_unittest.cc
+++ b/chrome/browser/metrics/process_memory_metrics_emitter_unittest.cc
@@ -80,7 +80,7 @@
}
}
- base::Optional<base::TimeDelta> GetProcessUptime(
+ absl::optional<base::TimeDelta> GetProcessUptime(
const base::Time& now,
base::ProcessId pid) override {
switch (pid) {
diff --git a/chrome/browser/metrics/tab_stats/tab_stats_data_store.cc b/chrome/browser/metrics/tab_stats/tab_stats_data_store.cc
index c175662..2f571dd1 100644
--- a/chrome/browser/metrics/tab_stats/tab_stats_data_store.cc
+++ b/chrome/browser/metrics/tab_stats/tab_stats_data_store.cc
@@ -177,10 +177,10 @@
AddTabToIntervalMap(iter.first, GetTabID(iter.first), true, interval_map);
}
-base::Optional<TabStatsDataStore::TabID> TabStatsDataStore::GetTabIDForTesting(
+absl::optional<TabStatsDataStore::TabID> TabStatsDataStore::GetTabIDForTesting(
content::WebContents* web_contents) {
if (!base::Contains(existing_tabs_, web_contents))
- return base::nullopt;
+ return absl::nullopt;
return GetTabID(web_contents);
}
diff --git a/chrome/browser/metrics/tab_stats/tab_stats_data_store.h b/chrome/browser/metrics/tab_stats/tab_stats_data_store.h
index f04a1b7..4d49a56 100644
--- a/chrome/browser/metrics/tab_stats/tab_stats_data_store.h
+++ b/chrome/browser/metrics/tab_stats/tab_stats_data_store.h
@@ -10,12 +10,12 @@
#include "base/containers/flat_map.h"
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "base/profiler/sample_metadata.h"
#include "base/sequence_checker.h"
#include "chrome/browser/metrics/tab_stats/tab_stats_observer.h"
#include "chrome/browser/resource_coordinator/lifecycle_unit_state.mojom.h"
#include "content/public/browser/visibility.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using mojom::LifecycleUnitDiscardReason;
@@ -113,7 +113,7 @@
void ResetIntervalData(TabsStateDuringIntervalMap* interval_map);
const TabsStats& tab_stats() const { return tab_stats_; }
- base::Optional<TabID> GetTabIDForTesting(content::WebContents* web_contents);
+ absl::optional<TabID> GetTabIDForTesting(content::WebContents* web_contents);
base::flat_map<content::WebContents*, TabID>* existing_tabs_for_testing() {
return &existing_tabs_;
}
diff --git a/chrome/browser/metrics/ukm_background_recorder_browsertest.cc b/chrome/browser/metrics/ukm_background_recorder_browsertest.cc
index 56fc137..4250dbc 100644
--- a/chrome/browser/metrics/ukm_background_recorder_browsertest.cc
+++ b/chrome/browser/metrics/ukm_background_recorder_browsertest.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/metrics/ukm_background_recorder_service.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/time/time.h"
#include "chrome/browser/ui/browser.h"
@@ -13,6 +12,7 @@
#include "content/public/test/browser_test.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -21,8 +21,8 @@
constexpr char kVisitedUrl[] = "https://foobar.com/baz";
void DidGetRecordResult(base::OnceClosure quit_closure,
- base::Optional<ukm::SourceId>* out_result,
- base::Optional<ukm::SourceId> result) {
+ absl::optional<ukm::SourceId>* out_result,
+ absl::optional<ukm::SourceId> result) {
*out_result = std::move(result);
std::move(quit_closure).Run();
}
@@ -46,8 +46,8 @@
}
protected:
- base::Optional<ukm::SourceId> GetSourceId(const url::Origin& origin) {
- base::Optional<ukm::SourceId> result;
+ absl::optional<ukm::SourceId> GetSourceId(const url::Origin& origin) {
+ absl::optional<ukm::SourceId> result;
base::RunLoop run_loop;
background_recorder_service_->GetBackgroundSourceIdIfAllowed(
diff --git a/chrome/browser/metrics/ukm_background_recorder_service.cc b/chrome/browser/metrics/ukm_background_recorder_service.cc
index 138c777..8eff092a 100644
--- a/chrome/browser/metrics/ukm_background_recorder_service.cc
+++ b/chrome/browser/metrics/ukm_background_recorder_service.cc
@@ -46,7 +46,7 @@
GetBackgroundSourceIdCallback callback,
history::VisibleVisitCountToHostResult result) {
if (!result.success || !result.count) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
diff --git a/chrome/browser/metrics/ukm_background_recorder_service.h b/chrome/browser/metrics/ukm_background_recorder_service.h
index ec21e25d..08a84e1 100644
--- a/chrome/browser/metrics/ukm_background_recorder_service.h
+++ b/chrome/browser/metrics/ukm_background_recorder_service.h
@@ -9,11 +9,11 @@
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/task/cancelable_task_tracker.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "components/keyed_service/core/keyed_service.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
class UkmBackgroundRecorderBrowserTest;
@@ -40,7 +40,7 @@
class UkmBackgroundRecorderService : public KeyedService {
public:
using GetBackgroundSourceIdCallback =
- base::OnceCallback<void(base::Optional<ukm::SourceId>)>;
+ base::OnceCallback<void(absl::optional<ukm::SourceId>)>;
// |profile| is needed to access the appropriate services |this| depends on.
explicit UkmBackgroundRecorderService(Profile* profile);
diff --git a/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker_browsertest.cc b/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker_browsertest.cc
index 244a96c2..1bb060f2 100644
--- a/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker_browsertest.cc
+++ b/chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker_browsertest.cc
@@ -87,7 +87,7 @@
private:
std::unique_ptr<base::RunLoop> run_loop_;
bool playing_media_fullscreen_ = false;
- base::Optional<bool> playing_media_fullscreen_expected_value_ = false;
+ absl::optional<bool> playing_media_fullscreen_expected_value_ = false;
};
} // namespace
diff --git a/chrome/browser/metrics/usertype_by_devicetype_metrics_provider.h b/chrome/browser/metrics/usertype_by_devicetype_metrics_provider.h
index 939be12..ecb2c0327 100644
--- a/chrome/browser/metrics/usertype_by_devicetype_metrics_provider.h
+++ b/chrome/browser/metrics/usertype_by_devicetype_metrics_provider.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_METRICS_USERTYPE_BY_DEVICETYPE_METRICS_PROVIDER_H_
#include "base/feature_list.h"
-#include "base/optional.h"
#include "components/metrics/metrics_provider.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "components/session_manager/core/session_manager_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class UserTypeByDeviceTypeMetricsProvider
: public metrics::MetricsProvider,
@@ -61,8 +61,8 @@
static int ConstructUmaValue(UserSegment user, policy::MarketSegment device);
private:
- base::Optional<UserSegment> user_segment_;
- base::Optional<policy::MarketSegment> device_segment_;
+ absl::optional<UserSegment> user_segment_;
+ absl::optional<policy::MarketSegment> device_segment_;
};
#endif // CHROME_BROWSER_METRICS_USERTYPE_BY_DEVICETYPE_METRICS_PROVIDER_H_
diff --git a/chrome/browser/metrics/usertype_by_devicetype_metrics_provider_browsertest.cc b/chrome/browser/metrics/usertype_by_devicetype_metrics_provider_browsertest.cc
index eca1b71..de49317e 100644
--- a/chrome/browser/metrics/usertype_by_devicetype_metrics_provider_browsertest.cc
+++ b/chrome/browser/metrics/usertype_by_devicetype_metrics_provider_browsertest.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/metrics/usertype_by_devicetype_metrics_provider.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
@@ -29,6 +28,7 @@
#include "components/policy/core/common/cloud/policy_builder.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -39,21 +39,21 @@
const char kAccountId1[] = "[email protected]";
const char kDisplayName1[] = "display name 1";
-base::Optional<em::PolicyData::MarketSegment> GetMarketSegment(
+absl::optional<em::PolicyData::MarketSegment> GetMarketSegment(
policy::MarketSegment device_segment) {
switch (device_segment) {
case policy::MarketSegment::UNKNOWN:
- return base::nullopt;
+ return absl::nullopt;
case policy::MarketSegment::EDUCATION:
return em::PolicyData::ENROLLED_EDUCATION;
case policy::MarketSegment::ENTERPRISE:
return em::PolicyData::ENROLLED_ENTERPRISE;
}
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<em::PolicyData::MetricsLogSegment> GetMetricsLogSegment(
+absl::optional<em::PolicyData::MetricsLogSegment> GetMetricsLogSegment(
UserSegment user_segment) {
switch (user_segment) {
case UserSegment::kK12:
@@ -66,13 +66,13 @@
return em::PolicyData::ENTERPRISE;
case UserSegment::kUnmanaged:
case UserSegment::kManagedGuestSession:
- return base::nullopt;
+ return absl::nullopt;
}
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<AccountId> GetPrimaryAccountId() {
+absl::optional<AccountId> GetPrimaryAccountId() {
return AccountId::FromUserEmailGaiaId(
chromeos::FakeGaiaMixin::kEnterpriseUser1,
chromeos::FakeGaiaMixin::kEnterpriseUser1GaiaId);
@@ -151,12 +151,12 @@
policy::MarketSegment GetDeviceSegment() const { return device_segment_; }
- base::Optional<em::PolicyData::MetricsLogSegment> GetMetricsLogSegment()
+ absl::optional<em::PolicyData::MetricsLogSegment> GetMetricsLogSegment()
const {
return ::GetMetricsLogSegment(user_segment_);
}
- base::Optional<em::PolicyData::MarketSegment> GetMarketSegment() const {
+ absl::optional<em::PolicyData::MarketSegment> GetMarketSegment() const {
return ::GetMarketSegment(device_segment_);
}
@@ -247,7 +247,7 @@
// Add an account with DeviceLocalAccount::Type::TYPE_PUBLIC_SESSION.
AddPublicSessionToDevicePolicy(kAccountId1);
- base::Optional<em::PolicyData::MarketSegment> market_segment =
+ absl::optional<em::PolicyData::MarketSegment> market_segment =
GetParam().GetMarketSegment();
if (market_segment) {
device_policy()->policy_data().set_market_segment(market_segment.value());
@@ -285,7 +285,7 @@
}
void LogInUser() {
- base::Optional<em::PolicyData::MetricsLogSegment> log_segment =
+ absl::optional<em::PolicyData::MetricsLogSegment> log_segment =
GetParam().GetMetricsLogSegment();
if (log_segment) {
logged_in_user_mixin_.GetUserPolicyMixin()
diff --git a/chrome/browser/metrics/variations/variations_http_headers_browsertest.cc b/chrome/browser/metrics/variations/variations_http_headers_browsertest.cc
index 83bc1ad9..3709ec2 100644
--- a/chrome/browser/metrics/variations/variations_http_headers_browsertest.cc
+++ b/chrome/browser/metrics/variations/variations_http_headers_browsertest.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/containers/contains.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
@@ -63,6 +62,7 @@
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
@@ -173,16 +173,16 @@
// Returns the |header| received by |url| or nullopt if it hasn't been
// received. Fails an EXPECT if |url| hasn't been observed.
- base::Optional<std::string> GetReceivedHeader(
+ absl::optional<std::string> GetReceivedHeader(
const GURL& url,
const std::string& header) const {
auto it = received_headers_.find(url);
EXPECT_TRUE(it != received_headers_.end());
if (it == received_headers_.end())
- return base::nullopt;
+ return absl::nullopt;
auto it2 = it->second.find(header);
if (it2 == it->second.end())
- return base::nullopt;
+ return absl::nullopt;
return it2->second;
}
@@ -508,7 +508,7 @@
ui_test_utils::NavigateToURL(browser(), GetGoogleUrl());
- base::Optional<std::string> header =
+ absl::optional<std::string> header =
GetReceivedHeader(GetGoogleUrl(), "X-Client-Data");
ASSERT_TRUE(header);
@@ -554,7 +554,7 @@
// By default the user is not signed in.
ui_test_utils::NavigateToURL(browser(), GetGoogleUrl());
- base::Optional<std::string> header =
+ absl::optional<std::string> header =
GetReceivedHeader(GetGoogleUrl(), "X-Client-Data");
ASSERT_TRUE(header);
@@ -632,7 +632,7 @@
trial->group();
ui_test_utils::NavigateToURL(browser(), GetGoogleUrl());
- base::Optional<std::string> header =
+ absl::optional<std::string> header =
GetReceivedHeader(GetGoogleUrl(), "X-Client-Data");
ASSERT_TRUE(header);
@@ -662,7 +662,7 @@
CreateFieldTrialsWithDifferentVisibilities();
ui_test_utils::NavigateToURL(browser(), GetGoogleUrl());
- base::Optional<std::string> header =
+ absl::optional<std::string> header =
GetReceivedHeader(GetGoogleUrl(), "X-Client-Data");
ASSERT_TRUE(header);
diff --git a/chrome/browser/navigation_predictor/navigation_predictor.cc b/chrome/browser/navigation_predictor/navigation_predictor.cc
index fbfdc71..283701a 100644
--- a/chrome/browser/navigation_predictor/navigation_predictor.cc
+++ b/chrome/browser/navigation_predictor/navigation_predictor.cc
@@ -10,7 +10,6 @@
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/metrics/field_trial_params.h"
-#include "base/optional.h"
#include "base/rand_util.h"
#include "base/system/sys_info.h"
#include "chrome/browser/navigation_predictor/navigation_predictor_keyed_service.h"
@@ -27,6 +26,7 @@
#include "services/metrics/public/cpp/metrics_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/features.h"
#include "url/gurl.h"
#include "url/url_canon.h"
diff --git a/chrome/browser/navigation_predictor/navigation_predictor.h b/chrome/browser/navigation_predictor/navigation_predictor.h
index 7c9c527..07d6bd81 100644
--- a/chrome/browser/navigation_predictor/navigation_predictor.h
+++ b/chrome/browser/navigation_predictor/navigation_predictor.h
@@ -12,13 +12,13 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "content/public/browser/frame_service_base.h"
#include "content/public/browser/visibility.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/loader/navigation_predictor.mojom.h"
#include "ui/gfx/geometry/size.h"
#include "url/origin.h"
diff --git a/chrome/browser/navigation_predictor/navigation_predictor_browsertest.cc b/chrome/browser/navigation_predictor/navigation_predictor_browsertest.cc
index 2bb2384ce..162a8dc 100644
--- a/chrome/browser/navigation_predictor/navigation_predictor_browsertest.cc
+++ b/chrome/browser/navigation_predictor/navigation_predictor_browsertest.cc
@@ -120,7 +120,7 @@
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
- base::Optional<NavigationPredictorKeyedService::Prediction> last_prediction()
+ absl::optional<NavigationPredictorKeyedService::Prediction> last_prediction()
const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return last_prediction_;
@@ -148,7 +148,7 @@
private:
void OnPredictionUpdated(
- const base::Optional<NavigationPredictorKeyedService::Prediction>
+ const absl::optional<NavigationPredictorKeyedService::Prediction>
prediction) override {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++count_predictions_;
@@ -162,12 +162,12 @@
size_t count_predictions_ = 0u;
// last prediction received.
- base::Optional<NavigationPredictorKeyedService::Prediction> last_prediction_;
+ absl::optional<NavigationPredictorKeyedService::Prediction> last_prediction_;
// If |wait_loop_| is non-null, then it quits as soon as count of received
// notifications are at least |expected_notifications_count_|.
std::unique_ptr<base::RunLoop> wait_loop_;
- base::Optional<size_t> expected_notifications_count_;
+ absl::optional<size_t> expected_notifications_count_;
SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/browser/navigation_predictor/navigation_predictor_keyed_service.cc b/chrome/browser/navigation_predictor/navigation_predictor_keyed_service.cc
index 858a3d9..764e0f1 100644
--- a/chrome/browser/navigation_predictor/navigation_predictor_keyed_service.cc
+++ b/chrome/browser/navigation_predictor/navigation_predictor_keyed_service.cc
@@ -54,7 +54,7 @@
NavigationPredictorKeyedService::Prediction::Prediction(
content::WebContents* web_contents,
- const base::Optional<GURL>& source_document_url,
+ const absl::optional<GURL>& source_document_url,
PredictionSource prediction_source,
const std::vector<GURL>& sorted_predicted_urls)
: web_contents_(web_contents),
@@ -98,7 +98,7 @@
NavigationPredictorKeyedService::Prediction::~Prediction() = default;
-const base::Optional<GURL>&
+const absl::optional<GURL>&
NavigationPredictorKeyedService::Prediction::source_document_url() const {
DCHECK_EQ(PredictionSource::kAnchorElementsParsedFromWebPage,
prediction_source_);
diff --git a/chrome/browser/navigation_predictor/navigation_predictor_keyed_service.h b/chrome/browser/navigation_predictor/navigation_predictor_keyed_service.h
index 126ccbb..e840a54 100644
--- a/chrome/browser/navigation_predictor/navigation_predictor_keyed_service.h
+++ b/chrome/browser/navigation_predictor/navigation_predictor_keyed_service.h
@@ -10,10 +10,10 @@
#include "base/macros.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/single_thread_task_runner.h"
#include "chrome/browser/navigation_predictor/search_engine_preconnector.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace content {
@@ -36,13 +36,13 @@
class Prediction {
public:
Prediction(content::WebContents* web_contents,
- const base::Optional<GURL>& source_document_url,
+ const absl::optional<GURL>& source_document_url,
PredictionSource prediction_source,
const std::vector<GURL>& sorted_predicted_urls);
Prediction(const Prediction& other);
Prediction& operator=(const Prediction& other);
~Prediction();
- const base::Optional<GURL>& source_document_url() const;
+ const absl::optional<GURL>& source_document_url() const;
PredictionSource prediction_source() const { return prediction_source_; }
const std::vector<GURL>& sorted_predicted_urls() const;
@@ -59,7 +59,7 @@
// required because external app predictions didn't provide this field, but
// external predictions are no longer supported.
// Current URL of the document from where the navigtion may happen.
- base::Optional<GURL> source_document_url_;
+ absl::optional<GURL> source_document_url_;
// |prediction_source_| indicates how the prediction was generated and
// affects how the prediction should be consumed. If the
@@ -85,7 +85,7 @@
class Observer {
public:
virtual void OnPredictionUpdated(
- const base::Optional<Prediction> prediction) = 0;
+ const absl::optional<Prediction> prediction) = 0;
protected:
Observer() {}
@@ -138,7 +138,7 @@
base::ObserverList<Observer>::Unchecked observer_list_;
// Last known prediction.
- base::Optional<Prediction> last_prediction_;
+ absl::optional<Prediction> last_prediction_;
// Manages preconnecting to the user's default search engine.
SearchEnginePreconnector search_engine_preconnector_;
diff --git a/chrome/browser/navigation_predictor/navigation_predictor_preconnect_client.cc b/chrome/browser/navigation_predictor/navigation_predictor_preconnect_client.cc
index 650d957..084cdca 100644
--- a/chrome/browser/navigation_predictor/navigation_predictor_preconnect_client.cc
+++ b/chrome/browser/navigation_predictor/navigation_predictor_preconnect_client.cc
@@ -78,7 +78,7 @@
if (!navigation_handle->IsSameDocument()) {
is_publicly_routable_ = false;
- base::Optional<bool> is_publicly_routable =
+ absl::optional<bool> is_publicly_routable =
IsPubliclyRoutable(navigation_handle);
if (is_publicly_routable) {
@@ -234,7 +234,7 @@
web_contents()->GetLastCommittedURL());
}
-base::Optional<bool> NavigationPredictorPreconnectClient::IsPubliclyRoutable(
+absl::optional<bool> NavigationPredictorPreconnectClient::IsPubliclyRoutable(
content::NavigationHandle* navigation_handle) const {
net::IPEndPoint remote_endpoint = navigation_handle->GetSocketAddress();
net::IPAddress page_ip_address_ = remote_endpoint.address();
@@ -242,7 +242,7 @@
// Sometimes the IP address may not be set (e.g., if the socket is being
// reused).
if (!page_ip_address_.IsValid()) {
- return base::nullopt;
+ return absl::nullopt;
}
if (!enable_preconnects_for_local_ips_for_testing_) {
diff --git a/chrome/browser/navigation_predictor/navigation_predictor_preconnect_client.h b/chrome/browser/navigation_predictor/navigation_predictor_preconnect_client.h
index 27debed..af967750 100644
--- a/chrome/browser/navigation_predictor/navigation_predictor_preconnect_client.h
+++ b/chrome/browser/navigation_predictor/navigation_predictor_preconnect_client.h
@@ -6,12 +6,12 @@
#define CHROME_BROWSER_NAVIGATION_PREDICTOR_NAVIGATION_PREDICTOR_PRECONNECT_CLIENT_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/timer/timer.h"
#include "content/public/browser/visibility.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
namespace content {
@@ -51,14 +51,14 @@
// Returns template URL service. Guaranteed to be non-null.
bool IsSearchEnginePage() const;
- base::Optional<url::Origin> GetOriginToPreconnect(
+ absl::optional<url::Origin> GetOriginToPreconnect(
const GURL& document_url) const;
// MaybePreconnectNow preconnects to an origin server if it's allowed.
void MaybePreconnectNow(size_t preconnects_attempted);
// Returns true if the origin is publicly routable.
- base::Optional<bool> IsPubliclyRoutable(
+ absl::optional<bool> IsPubliclyRoutable(
content::NavigationHandle* navigation_handle) const;
content::WebContents* web_contents_;
diff --git a/chrome/browser/nearby_sharing/attachment_info.h b/chrome/browser/nearby_sharing/attachment_info.h
index ff3cf72a..ede9e83 100644
--- a/chrome/browser/nearby_sharing/attachment_info.h
+++ b/chrome/browser/nearby_sharing/attachment_info.h
@@ -9,7 +9,7 @@
#include <string>
#include "base/files/file.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Ties associated information to an Attachment.
struct AttachmentInfo {
@@ -19,7 +19,7 @@
AttachmentInfo(AttachmentInfo&&);
AttachmentInfo& operator=(AttachmentInfo&&);
- base::Optional<int64_t> payload_id;
+ absl::optional<int64_t> payload_id;
std::string text_body;
base::FilePath file_path;
};
diff --git a/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_manager.cc b/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_manager.cc
index b1332ff9..073c4b11 100644
--- a/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_manager.cc
+++ b/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_manager.cc
@@ -72,7 +72,7 @@
void FakeNearbyShareCertificateManager::OnStop() {}
-base::Optional<NearbySharePrivateCertificate>
+absl::optional<NearbySharePrivateCertificate>
FakeNearbyShareCertificateManager::GetValidPrivateCertificate(
nearby_share::mojom::Visibility visibility) const {
auto cert = GetNearbyShareTestPrivateCertificate(visibility);
diff --git a/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_manager.h b/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_manager.h
index 2f3889c8..8b5fefc 100644
--- a/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_manager.h
+++ b/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_manager.h
@@ -103,7 +103,7 @@
// NearbyShareCertificateManager:
void OnStart() override;
void OnStop() override;
- base::Optional<NearbySharePrivateCertificate> GetValidPrivateCertificate(
+ absl::optional<NearbySharePrivateCertificate> GetValidPrivateCertificate(
nearby_share::mojom::Visibility visibility) const override;
void UpdatePrivateCertificateInStorage(
const NearbySharePrivateCertificate& private_certificate) override;
diff --git a/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_storage.cc b/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_storage.cc
index c8166c3..0d302eb 100644
--- a/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_storage.cc
+++ b/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_storage.cc
@@ -81,12 +81,12 @@
get_public_certificates_callbacks_.push_back(std::move(callback));
}
-base::Optional<std::vector<NearbySharePrivateCertificate>>
+absl::optional<std::vector<NearbySharePrivateCertificate>>
FakeNearbyShareCertificateStorage::GetPrivateCertificates() const {
return private_certificates_;
}
-base::Optional<base::Time>
+absl::optional<base::Time>
FakeNearbyShareCertificateStorage::NextPublicCertificateExpirationTime() const {
return next_public_certificate_expiration_time_;
}
@@ -130,6 +130,6 @@
}
void FakeNearbyShareCertificateStorage::SetNextPublicCertificateExpirationTime(
- base::Optional<base::Time> time) {
+ absl::optional<base::Time> time) {
next_public_certificate_expiration_time_ = time;
}
diff --git a/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_storage.h b/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_storage.h
index 16aec9c..4dfe068 100644
--- a/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_storage.h
+++ b/chrome/browser/nearby_sharing/certificates/fake_nearby_share_certificate_storage.h
@@ -98,9 +98,9 @@
// NearbyShareCertificateStorage:
std::vector<std::string> GetPublicCertificateIds() const override;
void GetPublicCertificates(PublicCertificateCallback callback) override;
- base::Optional<std::vector<NearbySharePrivateCertificate>>
+ absl::optional<std::vector<NearbySharePrivateCertificate>>
GetPrivateCertificates() const override;
- base::Optional<base::Time> NextPublicCertificateExpirationTime()
+ absl::optional<base::Time> NextPublicCertificateExpirationTime()
const override;
void ReplacePrivateCertificates(
const std::vector<NearbySharePrivateCertificate>& private_certificates)
@@ -118,7 +118,7 @@
void ClearPublicCertificates(ResultCallback callback) override;
void SetPublicCertificateIds(const std::vector<std::string>& ids);
- void SetNextPublicCertificateExpirationTime(base::Optional<base::Time> time);
+ void SetNextPublicCertificateExpirationTime(absl::optional<base::Time> time);
std::vector<PublicCertificateCallback>& get_public_certificates_callbacks() {
return get_public_certificates_callbacks_;
@@ -143,9 +143,9 @@
}
private:
- base::Optional<base::Time> next_public_certificate_expiration_time_;
+ absl::optional<base::Time> next_public_certificate_expiration_time_;
std::vector<std::string> public_certificate_ids_;
- base::Optional<std::vector<NearbySharePrivateCertificate>>
+ absl::optional<std::vector<NearbySharePrivateCertificate>>
private_certificates_;
std::vector<PublicCertificateCallback> get_public_certificates_callbacks_;
std::vector<ReplacePublicCertificatesCall> replace_public_certificates_calls_;
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager.cc b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager.cc
index b750d74..63697b7 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager.cc
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager.cc
@@ -32,15 +32,15 @@
OnStop();
}
-base::Optional<NearbyShareEncryptedMetadataKey>
+absl::optional<NearbyShareEncryptedMetadataKey>
NearbyShareCertificateManager::EncryptPrivateCertificateMetadataKey(
nearby_share::mojom::Visibility visibility) {
- base::Optional<NearbySharePrivateCertificate> cert =
+ absl::optional<NearbySharePrivateCertificate> cert =
GetValidPrivateCertificate(visibility);
if (!cert)
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<NearbyShareEncryptedMetadataKey> encrypted_key =
+ absl::optional<NearbyShareEncryptedMetadataKey> encrypted_key =
cert->EncryptMetadataKey();
// Every salt consumed to encrypt the metadata encryption key is tracked by
@@ -51,26 +51,26 @@
return encrypted_key;
}
-base::Optional<std::vector<uint8_t>>
+absl::optional<std::vector<uint8_t>>
NearbyShareCertificateManager::SignWithPrivateCertificate(
nearby_share::mojom::Visibility visibility,
base::span<const uint8_t> payload) const {
- base::Optional<NearbySharePrivateCertificate> cert =
+ absl::optional<NearbySharePrivateCertificate> cert =
GetValidPrivateCertificate(visibility);
if (!cert)
- return base::nullopt;
+ return absl::nullopt;
return cert->Sign(payload);
}
-base::Optional<std::vector<uint8_t>>
+absl::optional<std::vector<uint8_t>>
NearbyShareCertificateManager::HashAuthenticationTokenWithPrivateCertificate(
nearby_share::mojom::Visibility visibility,
base::span<const uint8_t> authentication_token) const {
- base::Optional<NearbySharePrivateCertificate> cert =
+ absl::optional<NearbySharePrivateCertificate> cert =
GetValidPrivateCertificate(visibility);
if (!cert)
- return base::nullopt;
+ return absl::nullopt;
return cert->HashAuthenticationToken(authentication_token);
}
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager.h b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager.h
index 94b9872..735feb1 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager.h
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager.h
@@ -11,12 +11,12 @@
#include "base/containers/span.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.h"
#include "chrome/browser/nearby_sharing/certificates/nearby_share_encrypted_metadata_key.h"
#include "chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// The Nearby Share certificate manager maintains the local device's private
// certificates and contacts' public certificates. The manager communicates with
@@ -44,7 +44,7 @@
};
using CertDecryptedCallback = base::OnceCallback<void(
- base::Optional<NearbyShareDecryptedPublicCertificate>)>;
+ absl::optional<NearbyShareDecryptedPublicCertificate>)>;
NearbyShareCertificateManager();
virtual ~NearbyShareCertificateManager();
@@ -58,24 +58,24 @@
bool is_running() { return is_running_; }
// Encrypts the metadata encryption key of the currently valid private
- // certificate with |visibility|. Returns base::nullopt if there is no valid
+ // certificate with |visibility|. Returns absl::nullopt if there is no valid
// private certificate with |visibility|, if the encryption failed, or if
// there are no remaining salts.
- base::Optional<NearbyShareEncryptedMetadataKey>
+ absl::optional<NearbyShareEncryptedMetadataKey>
EncryptPrivateCertificateMetadataKey(
nearby_share::mojom::Visibility visibility);
// Signs the input |payload| using the currently valid private certificate
- // with |visibility|. Returns base::nullopt if there is no valid private
+ // with |visibility|. Returns absl::nullopt if there is no valid private
// certificate with |visibility| or if the signing was unsuccessful.
- base::Optional<std::vector<uint8_t>> SignWithPrivateCertificate(
+ absl::optional<std::vector<uint8_t>> SignWithPrivateCertificate(
nearby_share::mojom::Visibility visibility,
base::span<const uint8_t> payload) const;
// Creates a hash of the |authentication_token| using the currently valid
- // private certificate. Returns base::nullopt if there is no valid private
+ // private certificate. Returns absl::nullopt if there is no valid private
// certificate with |visibility|.
- base::Optional<std::vector<uint8_t>>
+ absl::optional<std::vector<uint8_t>>
HashAuthenticationTokenWithPrivateCertificate(
nearby_share::mojom::Visibility visibility,
base::span<const uint8_t> authentication_token) const;
@@ -91,7 +91,7 @@
nearby_share::mojom::Visibility visibility) = 0;
// Returns in |callback| the public certificate that is able to be decrypted
- // using |encrypted_metadata_key|, and returns base::nullopt if no such public
+ // using |encrypted_metadata_key|, and returns absl::nullopt if no such public
// certificate exists.
virtual void GetDecryptedPublicCertificate(
NearbyShareEncryptedMetadataKey encrypted_metadata_key,
@@ -108,8 +108,8 @@
virtual void OnStop() = 0;
// Returns the currently valid private certificate with |visibility|, or
- // returns base::nullopt if one does not exist.
- virtual base::Optional<NearbySharePrivateCertificate>
+ // returns absl::nullopt if one does not exist.
+ virtual absl::optional<NearbySharePrivateCertificate>
GetValidPrivateCertificate(
nearby_share::mojom::Visibility visibility) const = 0;
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager_impl.cc b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager_impl.cc
index 70988df..b095ee1 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager_impl.cc
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager_impl.cc
@@ -56,13 +56,13 @@
return kVisibilities.size() * kNearbyShareNumPrivateCertificates;
}
-base::Optional<std::string> GetBluetoothMacAddress(
+absl::optional<std::string> GetBluetoothMacAddress(
device::BluetoothAdapter* bluetooth_adapter) {
if (!bluetooth_adapter) {
NS_LOG(WARNING)
<< __func__
<< ": Failed to get Bluetooth MAC address; Bluetooth adapter is null.";
- return base::nullopt;
+ return absl::nullopt;
}
if (!bluetooth_adapter->IsPresent()) {
@@ -73,7 +73,7 @@
NS_LOG(WARNING) << __func__
<< ": Failed to get Bluetooth MAC address; Bluetooth "
<< "adapter is not present.";
- return base::nullopt;
+ return absl::nullopt;
}
std::array<uint8_t, 6> bytes;
@@ -81,23 +81,23 @@
NS_LOG(WARNING) << __func__
<< ": Failed to get Bluetooth MAC address; cannot parse "
<< "address: " << bluetooth_adapter->GetAddress();
- return base::nullopt;
+ return absl::nullopt;
}
return std::string(bytes.begin(), bytes.end());
}
-base::Optional<nearbyshare::proto::EncryptedMetadata> BuildMetadata(
+absl::optional<nearbyshare::proto::EncryptedMetadata> BuildMetadata(
std::string device_name,
- base::Optional<std::string> full_name,
- base::Optional<std::string> icon_url,
+ absl::optional<std::string> full_name,
+ absl::optional<std::string> icon_url,
device::BluetoothAdapter* bluetooth_adapter) {
nearbyshare::proto::EncryptedMetadata metadata;
if (device_name.empty()) {
NS_LOG(WARNING) << __func__
<< ": Failed to create private certificate metadata; "
<< "missing device name.";
- return base::nullopt;
+ return absl::nullopt;
}
metadata.set_device_name(device_name);
@@ -108,14 +108,14 @@
metadata.set_icon_url(*icon_url);
}
- base::Optional<std::string> bluetooth_mac_address =
+ absl::optional<std::string> bluetooth_mac_address =
GetBluetoothMacAddress(bluetooth_adapter);
base::UmaHistogramBoolean(
"Nearby.Share.Certificates.Manager."
"BluetoothMacAddressPresentForPrivateCertificateCreation",
bluetooth_mac_address.has_value());
if (!bluetooth_mac_address)
- return base::nullopt;
+ return absl::nullopt;
metadata.set_bluetooth_mac_address(*bluetooth_mac_address);
@@ -167,12 +167,12 @@
<< ": Failed to read public certificates from storage.";
RecordGetDecryptedPublicCertificateResultMetric(
GetDecryptedPublicCertificateResult::kStorageFailure);
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
for (const auto& cert : *public_certificates) {
- base::Optional<NearbyShareDecryptedPublicCertificate> decrypted =
+ absl::optional<NearbyShareDecryptedPublicCertificate> decrypted =
NearbyShareDecryptedPublicCertificate::DecryptPublicCertificate(
cert, encrypted_metadata_key);
if (decrypted) {
@@ -190,7 +190,7 @@
<< ": Metadata key could not decrypt any public certificates.";
RecordGetDecryptedPublicCertificateResultMetric(
GetDecryptedPublicCertificateResult::kNoMatch);
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
}
} // namespace
@@ -295,7 +295,7 @@
base::BindRepeating(&NearbyShareCertificateManagerImpl::
OnDownloadPublicCertificatesRequest,
base::Unretained(this),
- /*page_token=*/base::nullopt,
+ /*page_token=*/absl::nullopt,
/*page_number=*/1,
/*certificate_count=*/0),
clock_)) {
@@ -341,10 +341,10 @@
download_public_certificates_scheduler_->Stop();
}
-base::Optional<NearbySharePrivateCertificate>
+absl::optional<NearbySharePrivateCertificate>
NearbyShareCertificateManagerImpl::GetValidPrivateCertificate(
nearby_share::mojom::Visibility visibility) const {
- base::Optional<std::vector<NearbySharePrivateCertificate>> certs =
+ absl::optional<std::vector<NearbySharePrivateCertificate>> certs =
*certificate_storage_->GetPrivateCertificates();
for (auto& cert : *certs) {
if (IsNearbyShareCertificateWithinValidityPeriod(
@@ -358,7 +358,7 @@
NS_LOG(WARNING) << __func__
<< ": No valid private certificate found with visibility "
<< visibility;
- return base::nullopt;
+ return absl::nullopt;
}
void NearbyShareCertificateManagerImpl::UpdatePrivateCertificateInStorage(
@@ -400,7 +400,7 @@
private_certificate_expiration_scheduler_->MakeImmediateRequest();
}
-base::Optional<base::Time>
+absl::optional<base::Time>
NearbyShareCertificateManagerImpl::NextPrivateCertificateExpirationTime() {
// We enforce that a fixed number--kNearbyShareNumPrivateCertificates for each
// visibility--of private certificates be present at all times. This might not
@@ -413,7 +413,7 @@
return base::Time::Min();
}
- base::Optional<base::Time> expiration_time =
+ absl::optional<base::Time> expiration_time =
certificate_storage_->NextPrivateCertificateExpirationTime();
DCHECK(expiration_time);
@@ -458,7 +458,7 @@
std::max(latest_not_after[cert.visibility()], cert.not_after());
}
- base::Optional<nearbyshare::proto::EncryptedMetadata> metadata =
+ absl::optional<nearbyshare::proto::EncryptedMetadata> metadata =
BuildMetadata(local_device_data_manager_->GetDeviceName(),
local_device_data_manager_->GetFullName(),
local_device_data_manager_->GetIconUrl(),
@@ -522,14 +522,14 @@
upload_local_device_certificates_scheduler_->HandleResult(success);
}
-base::Optional<base::Time>
+absl::optional<base::Time>
NearbyShareCertificateManagerImpl::NextPublicCertificateExpirationTime() {
- base::Optional<base::Time> next_expiration_time =
+ absl::optional<base::Time> next_expiration_time =
certificate_storage_->NextPublicCertificateExpirationTime();
// Supposedly there are no store public certificates.
if (!next_expiration_time)
- return base::nullopt;
+ return absl::nullopt;
// To account for clock skew between devices, we accept public certificates
// that are slightly past their validity period. This conforms with the
@@ -550,7 +550,7 @@
}
void NearbyShareCertificateManagerImpl::OnDownloadPublicCertificatesRequest(
- base::Optional<std::string> page_token,
+ absl::optional<std::string> page_token,
size_t page_number,
size_t certificate_count) {
DCHECK(!client_);
@@ -594,10 +594,10 @@
response.public_certificates().begin(),
response.public_certificates().end());
- base::Optional<std::string> page_token =
+ absl::optional<std::string> page_token =
response.next_page_token().empty()
- ? base::nullopt
- : base::make_optional(response.next_page_token());
+ ? absl::nullopt
+ : absl::make_optional(response.next_page_token());
client_.reset();
@@ -633,7 +633,7 @@
}
void NearbyShareCertificateManagerImpl::OnPublicCertificatesAddedToStorage(
- base::Optional<std::string> page_token,
+ absl::optional<std::string> page_token,
size_t page_number,
size_t certificate_count,
bool success) {
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager_impl.h b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager_impl.h
index 0dd7dad..7c210ba6 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager_impl.h
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager_impl.h
@@ -12,7 +12,6 @@
#include "base/files/file_path.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
#include "base/timer/timer.h"
@@ -25,6 +24,7 @@
#include "chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class NearbyShareClient;
class NearbyShareClientFactory;
@@ -109,7 +109,7 @@
void DownloadPublicCertificates() override;
void OnStart() override;
void OnStop() override;
- base::Optional<NearbySharePrivateCertificate> GetValidPrivateCertificate(
+ absl::optional<NearbySharePrivateCertificate> GetValidPrivateCertificate(
nearby_share::mojom::Visibility visibility) const override;
void UpdatePrivateCertificateInStorage(
const NearbySharePrivateCertificate& private_certificate) override;
@@ -128,13 +128,13 @@
// Used by the private certificate expiration scheduler to determine the next
// private certificate expiration time. Returns base::Time::Min() if
- // certificates are missing. This function never returns base::nullopt.
- base::Optional<base::Time> NextPrivateCertificateExpirationTime();
+ // certificates are missing. This function never returns absl::nullopt.
+ absl::optional<base::Time> NextPrivateCertificateExpirationTime();
// Used by the public certificate expiration scheduler to determine the next
- // public certificate expiration time. Returns base::nullopt if no public
+ // public certificate expiration time. Returns absl::nullopt if no public
// certificates are present, and no expiration event is scheduled.
- base::Optional<base::Time> NextPublicCertificateExpirationTime();
+ absl::optional<base::Time> NextPublicCertificateExpirationTime();
// Invoked by the private certificate expiration scheduler when an expired
// private certificate needs to be removed or if no private certificates exist
@@ -162,7 +162,7 @@
// from trusted contacts need to be downloaded from Nearby Share server via
// the ListPublicCertificates RPC.
void OnDownloadPublicCertificatesRequest(
- base::Optional<std::string> page_token,
+ absl::optional<std::string> page_token,
size_t page_number,
size_t certificate_count);
@@ -176,7 +176,7 @@
void OnListPublicCertificatesTimeout(size_t page_number,
size_t certificate_count);
void OnPublicCertificatesAddedToStorage(
- base::Optional<std::string> page_token,
+ absl::optional<std::string> page_token,
size_t page_number,
size_t certificate_count,
bool success);
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager_impl_unittest.cc b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager_impl_unittest.cc
index c2a7248..0067e13 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager_impl_unittest.cc
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager_impl_unittest.cc
@@ -40,8 +40,8 @@
const std::vector<std::string> kPublicCertificateIds = {"id1", "id2", "id3"};
void CaptureDecryptedPublicCertificateCallback(
- base::Optional<NearbyShareDecryptedPublicCertificate>* dest,
- base::Optional<NearbyShareDecryptedPublicCertificate> src) {
+ absl::optional<NearbyShareDecryptedPublicCertificate>* dest,
+ absl::optional<NearbyShareDecryptedPublicCertificate> src) {
*dest = std::move(src);
}
@@ -442,12 +442,12 @@
kNearbyShareCertificateValidityPeriod * 0.5 - Now());
// Sanity check that the cert storage is as expected.
- base::Optional<std::vector<NearbySharePrivateCertificate>> stored_certs =
+ absl::optional<std::vector<NearbySharePrivateCertificate>> stored_certs =
cert_store_->GetPrivateCertificates();
EXPECT_EQ(stored_certs->at(0).ToDictionary(),
private_certificate.ToDictionary());
- base::Optional<NearbyShareEncryptedMetadataKey> encrypted_metadata_key =
+ absl::optional<NearbyShareEncryptedMetadataKey> encrypted_metadata_key =
cert_manager_->EncryptPrivateCertificateMetadataKey(
nearby_share::mojom::Visibility::kAllContacts);
EXPECT_EQ(GetNearbyShareTestEncryptedMetadataKey().encrypted_key(),
@@ -513,7 +513,7 @@
TEST_F(NearbyShareCertificateManagerImplTest,
GetDecryptedPublicCertificateSuccess) {
- base::Optional<NearbyShareDecryptedPublicCertificate> decrypted_pub_cert;
+ absl::optional<NearbyShareDecryptedPublicCertificate> decrypted_pub_cert;
cert_manager_->GetDecryptedPublicCertificate(
metadata_encryption_keys_[0],
base::BindOnce(&CaptureDecryptedPublicCertificateCallback,
@@ -537,7 +537,7 @@
auto metadata_key = private_cert.EncryptMetadataKey();
ASSERT_TRUE(metadata_key);
- base::Optional<NearbyShareDecryptedPublicCertificate> decrypted_pub_cert;
+ absl::optional<NearbyShareDecryptedPublicCertificate> decrypted_pub_cert;
cert_manager_->GetDecryptedPublicCertificate(
*metadata_key, base::BindOnce(&CaptureDecryptedPublicCertificateCallback,
&decrypted_pub_cert));
@@ -549,7 +549,7 @@
TEST_F(NearbyShareCertificateManagerImplTest,
GetDecryptedPublicCertificateGetPublicCertificatesFailure) {
- base::Optional<NearbyShareDecryptedPublicCertificate> decrypted_pub_cert;
+ absl::optional<NearbyShareDecryptedPublicCertificate> decrypted_pub_cert;
cert_manager_->GetDecryptedPublicCertificate(
metadata_encryption_keys_[0],
base::BindOnce(&CaptureDecryptedPublicCertificateCallback,
@@ -741,8 +741,8 @@
std::vector<NearbySharePrivateCertificate>());
// Full name and icon URL are missing in local device data manager.
- local_device_data_manager_->SetFullName(base::nullopt);
- local_device_data_manager_->SetIconUrl(base::nullopt);
+ local_device_data_manager_->SetFullName(absl::nullopt);
+ local_device_data_manager_->SetIconUrl(absl::nullopt);
cert_manager_->Start();
HandlePrivateCertificateRefresh(/*expect_private_cert_refresh=*/true,
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage.cc b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage.cc
index 90b3b1e..876c6df 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage.cc
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage.cc
@@ -9,12 +9,12 @@
#include "chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage.h"
#include "chrome/browser/nearby_sharing/logging/logging.h"
-base::Optional<base::Time>
+absl::optional<base::Time>
NearbyShareCertificateStorage::NextPrivateCertificateExpirationTime() {
- base::Optional<std::vector<NearbySharePrivateCertificate>> certs =
+ absl::optional<std::vector<NearbySharePrivateCertificate>> certs =
GetPrivateCertificates();
if (!certs || certs->empty())
- return base::nullopt;
+ return absl::nullopt;
base::Time min_time = base::Time::Max();
for (const NearbySharePrivateCertificate& cert : *certs)
@@ -25,7 +25,7 @@
void NearbyShareCertificateStorage::UpdatePrivateCertificate(
const NearbySharePrivateCertificate& private_certificate) {
- base::Optional<std::vector<NearbySharePrivateCertificate>> certs =
+ absl::optional<std::vector<NearbySharePrivateCertificate>> certs =
GetPrivateCertificates();
if (!certs) {
NS_LOG(WARNING) << __func__ << ": No private certificates to update.";
@@ -51,7 +51,7 @@
void NearbyShareCertificateStorage::RemoveExpiredPrivateCertificates(
base::Time now) {
- base::Optional<std::vector<NearbySharePrivateCertificate>> certs =
+ absl::optional<std::vector<NearbySharePrivateCertificate>> certs =
GetPrivateCertificates();
if (!certs)
return;
@@ -81,7 +81,7 @@
void NearbyShareCertificateStorage::ClearPrivateCertificatesOfVisibility(
nearby_share::mojom::Visibility visibility) {
- base::Optional<std::vector<NearbySharePrivateCertificate>> certs =
+ absl::optional<std::vector<NearbySharePrivateCertificate>> certs =
GetPrivateCertificates();
if (!certs)
return;
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage.h b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage.h
index 7ee94d3..452ee935 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage.h
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_NEARBY_SHARING_CERTIFICATES_NEARBY_SHARE_CERTIFICATE_STORAGE_H_
#include "base/callback.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Stores local-device private certificates and remote-device public
// certificates. Provides methods to help manage certificate expiration. Due to
@@ -33,15 +33,15 @@
virtual void GetPublicCertificates(PublicCertificateCallback callback) = 0;
// Returns all private certificates currently in storage. Will return
- // base::nullopt if deserialization from prefs fails -- not expected to happen
+ // absl::nullopt if deserialization from prefs fails -- not expected to happen
// under normal circumstances.
- virtual base::Optional<std::vector<NearbySharePrivateCertificate>>
+ virtual absl::optional<std::vector<NearbySharePrivateCertificate>>
GetPrivateCertificates() const = 0;
- // Returns the next time a certificate expires or base::nullopt if no
+ // Returns the next time a certificate expires or absl::nullopt if no
// certificates are present.
- base::Optional<base::Time> NextPrivateCertificateExpirationTime();
- virtual base::Optional<base::Time> NextPublicCertificateExpirationTime()
+ absl::optional<base::Time> NextPrivateCertificateExpirationTime();
+ virtual absl::optional<base::Time> NextPublicCertificateExpirationTime()
const = 0;
// Deletes existing private certificates and replaces them with
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage_impl.cc b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage_impl.cc
index 0ff92c9b..a25d9bf 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage_impl.cc
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage_impl.cc
@@ -11,7 +11,6 @@
#include "base/base64url.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
@@ -27,6 +26,7 @@
#include "components/leveldb_proto/public/proto_database_provider.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -123,12 +123,12 @@
return encoded_string;
}
-base::Optional<std::string> DecodeString(const std::string& encoded_string) {
+absl::optional<std::string> DecodeString(const std::string& encoded_string) {
std::string decoded_string;
if (!base::Base64UrlDecode(encoded_string,
base::Base64UrlDecodePolicy::REQUIRE_PADDING,
&decoded_string))
- return base::nullopt;
+ return absl::nullopt;
return decoded_string;
}
@@ -431,26 +431,26 @@
db_->LoadEntries(std::move(callback));
}
-base::Optional<std::vector<NearbySharePrivateCertificate>>
+absl::optional<std::vector<NearbySharePrivateCertificate>>
NearbyShareCertificateStorageImpl::GetPrivateCertificates() const {
const base::Value* list =
pref_service_->Get(prefs::kNearbySharingPrivateCertificateListPrefName);
std::vector<NearbySharePrivateCertificate> certs;
for (const base::Value& cert_dict : list->GetList()) {
- base::Optional<NearbySharePrivateCertificate> cert(
+ absl::optional<NearbySharePrivateCertificate> cert(
NearbySharePrivateCertificate::FromDictionary(cert_dict));
if (!cert)
- return base::nullopt;
+ return absl::nullopt;
certs.push_back(*std::move(cert));
}
return certs;
}
-base::Optional<base::Time>
+absl::optional<base::Time>
NearbyShareCertificateStorageImpl::NextPublicCertificateExpirationTime() const {
if (public_certificate_expirations_.empty())
- return base::nullopt;
+ return absl::nullopt;
// |public_certificate_expirations_| is sorted by expiration date.
return public_certificate_expirations_.front().second;
@@ -624,8 +624,8 @@
public_certificate_expirations_.reserve(dict->DictSize());
for (const std::pair<const std::string&, const base::Value&>& pair :
dict->DictItems()) {
- base::Optional<std::string> id = DecodeString(pair.first);
- base::Optional<base::Time> expiration = util::ValueToTime(pair.second);
+ absl::optional<std::string> id = DecodeString(pair.first);
+ absl::optional<base::Time> expiration = util::ValueToTime(pair.second);
if (!id || !expiration)
return false;
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage_impl.h b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage_impl.h
index 411a90f..918b84c 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage_impl.h
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage_impl.h
@@ -66,9 +66,9 @@
// NearbyShareCertificateStorage
std::vector<std::string> GetPublicCertificateIds() const override;
void GetPublicCertificates(PublicCertificateCallback callback) override;
- base::Optional<std::vector<NearbySharePrivateCertificate>>
+ absl::optional<std::vector<NearbySharePrivateCertificate>>
GetPrivateCertificates() const override;
- base::Optional<base::Time> NextPublicCertificateExpirationTime()
+ absl::optional<base::Time> NextPublicCertificateExpirationTime()
const override;
void ReplacePrivateCertificates(
const std::vector<NearbySharePrivateCertificate>& private_certificates)
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage_impl_unittest.cc b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage_impl_unittest.cc
index 74c71146..c238f9c 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage_impl_unittest.cc
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_certificate_storage_impl_unittest.cc
@@ -551,7 +551,7 @@
auto certs = CreatePrivateCertificates(
3, nearby_share::mojom::Visibility::kAllContacts);
cert_store_->ReplacePrivateCertificates(certs);
- base::Optional<base::Time> next_expiration =
+ absl::optional<base::Time> next_expiration =
cert_store_->NextPrivateCertificateExpirationTime();
ASSERT_TRUE(next_expiration.has_value());
@@ -568,7 +568,7 @@
NextPublicCertificateExpirationTime) {
db_->InitStatusCallback(leveldb_proto::Enums::InitStatus::kOK);
- base::Optional<base::Time> next_expiration =
+ absl::optional<base::Time> next_expiration =
cert_store_->NextPublicCertificateExpirationTime();
ASSERT_TRUE(next_expiration.has_value());
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.cc b/chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.cc
index 50da9e2..d1ff19d 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.cc
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.cc
@@ -33,8 +33,8 @@
}
// Attempts to decrypt |encrypted_metadata_key| using the |secret_key|.
-// Return base::nullopt if the decryption was unsuccessful.
-base::Optional<std::vector<uint8_t>> DecryptMetadataKey(
+// Return absl::nullopt if the decryption was unsuccessful.
+absl::optional<std::vector<uint8_t>> DecryptMetadataKey(
const NearbyShareEncryptedMetadataKey& encrypted_metadata_key,
const crypto::SymmetricKey* secret_key) {
std::unique_ptr<crypto::Encryptor> encryptor =
@@ -42,23 +42,23 @@
if (!encryptor) {
NS_LOG(ERROR)
<< "Cannot decrypt metadata key: Could not create CTR encryptor.";
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<uint8_t> decrypted_metadata_key;
if (!encryptor->Decrypt(base::as_bytes(base::make_span(
encrypted_metadata_key.encrypted_key())),
&decrypted_metadata_key)) {
- return base::nullopt;
+ return absl::nullopt;
}
return decrypted_metadata_key;
}
// Attempts to decrypt |encrypted_metadata| with |metadata_encryption_key|,
-// using |authentication_key| as the IV. Returns base::nullopt if the decryption
+// using |authentication_key| as the IV. Returns absl::nullopt if the decryption
// was unsuccessful.
-base::Optional<std::vector<uint8_t>> DecryptMetadataPayload(
+absl::optional<std::vector<uint8_t>> DecryptMetadataPayload(
base::span<const uint8_t> encrypted_metadata,
base::span<const uint8_t> metadata_encryption_key,
const crypto::SymmetricKey* secret_key) {
@@ -95,7 +95,7 @@
} // namespace
// static
-base::Optional<NearbyShareDecryptedPublicCertificate>
+absl::optional<NearbyShareDecryptedPublicCertificate>
NearbyShareDecryptedPublicCertificate::DecryptPublicCertificate(
const nearbyshare::proto::PublicCertificate& public_certificate,
const NearbyShareEncryptedMetadataKey& encrypted_metadata_key) {
@@ -122,7 +122,7 @@
if (!IsDataValid(not_before, not_after, public_key, secret_key.get(), id,
encrypted_metadata, metadata_encryption_key_tag)) {
- return base::nullopt;
+ return absl::nullopt;
}
// Note: Failure to decrypt the metadata key or failure to confirm that the
@@ -132,23 +132,23 @@
// potentially be calling DecryptPublicCertificate() on all of our public
// certificates with the same encrypted metadata key until we find the correct
// one.
- base::Optional<std::vector<uint8_t>> decrypted_metadata_key =
+ absl::optional<std::vector<uint8_t>> decrypted_metadata_key =
DecryptMetadataKey(encrypted_metadata_key, secret_key.get());
if (!decrypted_metadata_key ||
!VerifyMetadataEncryptionKeyTag(*decrypted_metadata_key,
metadata_encryption_key_tag)) {
- return base::nullopt;
+ return absl::nullopt;
}
// If the key was able to be decrypted, we expect the metadata to be able to
// be decrypted.
- base::Optional<std::vector<uint8_t>> decrypted_metadata_bytes =
+ absl::optional<std::vector<uint8_t>> decrypted_metadata_bytes =
DecryptMetadataPayload(encrypted_metadata, *decrypted_metadata_key,
secret_key.get());
if (!decrypted_metadata_bytes) {
NS_LOG(ERROR) << "Metadata decryption failed: Failed to decrypt metadata "
<< "payload.";
- return base::nullopt;
+ return absl::nullopt;
}
nearbyshare::proto::EncryptedMetadata unencrypted_metadata;
@@ -156,7 +156,7 @@
decrypted_metadata_bytes->size())) {
NS_LOG(ERROR) << "Metadata decryption failed: Failed to parse decrypted "
<< "metadata payload.";
- return base::nullopt;
+ return absl::nullopt;
}
return NearbyShareDecryptedPublicCertificate(
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.h b/chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.h
index 04b1499c..fc196fa 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.h
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.h
@@ -9,12 +9,12 @@
#include <vector>
#include "base/containers/span.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/certificates/nearby_share_encrypted_metadata_key.h"
#include "chrome/browser/nearby_sharing/proto/encrypted_metadata.pb.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "crypto/symmetric_key.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Stores decrypted metadata and crypto keys for the remote device that uploaded
// this certificate to the Nearby Share server. Use DecryptPublicCertificate()
@@ -24,10 +24,10 @@
public:
// Attempts to decrypt the encrypted metadata of the PublicCertificate proto
// by first decrypting the |encrypted_metadata_key| using the secret key
- // then using the decrypted key to decrypt the metadata. Returns base::nullopt
+ // then using the decrypted key to decrypt the metadata. Returns absl::nullopt
// if the metadata was not successfully decrypted or if the proto data is
// invalid.
- static base::Optional<NearbyShareDecryptedPublicCertificate>
+ static absl::optional<NearbyShareDecryptedPublicCertificate>
DecryptPublicCertificate(
const nearbyshare::proto::PublicCertificate& public_certificate,
const NearbyShareEncryptedMetadataKey& encrypted_metadata_key);
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate_unittest.cc b/chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate_unittest.cc
index 582506c3..a039b939e 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate_unittest.cc
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate_unittest.cc
@@ -4,12 +4,12 @@
#include "chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/certificates/constants.h"
#include "chrome/browser/nearby_sharing/certificates/test_util.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -26,7 +26,7 @@
nearbyshare::proto::PublicCertificate proto_cert =
GetNearbyShareTestPublicCertificate(kTestPublicCertificateVisibility);
- base::Optional<NearbyShareDecryptedPublicCertificate> cert =
+ absl::optional<NearbyShareDecryptedPublicCertificate> cert =
NearbyShareDecryptedPublicCertificate::DecryptPublicCertificate(
proto_cert, GetNearbyShareTestEncryptedMetadataKey());
EXPECT_TRUE(cert);
@@ -74,7 +74,7 @@
}
TEST(NearbyShareDecryptedPublicCertificateTest, Verify) {
- base::Optional<NearbyShareDecryptedPublicCertificate> cert =
+ absl::optional<NearbyShareDecryptedPublicCertificate> cert =
NearbyShareDecryptedPublicCertificate::DecryptPublicCertificate(
GetNearbyShareTestPublicCertificate(kTestPublicCertificateVisibility),
GetNearbyShareTestEncryptedMetadataKey());
@@ -88,7 +88,7 @@
GetNearbyShareTestPublicCertificate(kTestPublicCertificateVisibility);
proto_cert.set_public_key("invalid public key");
- base::Optional<NearbyShareDecryptedPublicCertificate> cert =
+ absl::optional<NearbyShareDecryptedPublicCertificate> cert =
NearbyShareDecryptedPublicCertificate::DecryptPublicCertificate(
proto_cert, GetNearbyShareTestEncryptedMetadataKey());
ASSERT_TRUE(cert);
@@ -97,7 +97,7 @@
}
TEST(NearbyShareDecryptedPublicCertificateTest, Verify_WrongSignature) {
- base::Optional<NearbyShareDecryptedPublicCertificate> cert =
+ absl::optional<NearbyShareDecryptedPublicCertificate> cert =
NearbyShareDecryptedPublicCertificate::DecryptPublicCertificate(
GetNearbyShareTestPublicCertificate(kTestPublicCertificateVisibility),
GetNearbyShareTestEncryptedMetadataKey());
@@ -107,7 +107,7 @@
}
TEST(NearbyShareDecryptedPublicCertificateTest, HashAuthenticationToken) {
- base::Optional<NearbyShareDecryptedPublicCertificate> cert =
+ absl::optional<NearbyShareDecryptedPublicCertificate> cert =
NearbyShareDecryptedPublicCertificate::DecryptPublicCertificate(
GetNearbyShareTestPublicCertificate(kTestPublicCertificateVisibility),
GetNearbyShareTestEncryptedMetadataKey());
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate.cc b/chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate.cc
index 5384de7..4cc5468 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate.cc
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate.cc
@@ -56,7 +56,7 @@
// Creates an HMAC from |metadata_encryption_key| to be used as a key commitment
// in certificates.
-base::Optional<std::vector<uint8_t>> CreateMetadataEncryptionKeyTag(
+absl::optional<std::vector<uint8_t>> CreateMetadataEncryptionKeyTag(
base::span<const uint8_t> metadata_encryption_key) {
// This array of 0x00 is used to conform with the GmsCore implementation.
std::vector<uint8_t> key(kNearbyShareNumBytesMetadataEncryptionKeyTag, 0x00);
@@ -64,7 +64,7 @@
std::vector<uint8_t> result(kNearbyShareNumBytesMetadataEncryptionKeyTag);
crypto::HMAC hmac(crypto::HMAC::HashAlgorithm::SHA256);
if (!hmac.Init(key) || !hmac.Sign(metadata_encryption_key, result))
- return base::nullopt;
+ return absl::nullopt;
return result;
}
@@ -78,15 +78,15 @@
return encoded_string;
}
-base::Optional<std::string> DecodeString(const std::string* encoded_string) {
+absl::optional<std::string> DecodeString(const std::string* encoded_string) {
if (!encoded_string)
- return base::nullopt;
+ return absl::nullopt;
std::string decoded_string;
if (!base::Base64UrlDecode(*encoded_string,
base::Base64UrlDecodePolicy::REQUIRE_PADDING,
&decoded_string)) {
- return base::nullopt;
+ return absl::nullopt;
}
return decoded_string;
@@ -96,12 +96,12 @@
return EncodeString(std::string(bytes.begin(), bytes.end()));
}
-base::Optional<std::vector<uint8_t>> EncodedStringToBytes(
+absl::optional<std::vector<uint8_t>> EncodedStringToBytes(
const std::string* str) {
- base::Optional<std::string> decoded_str = DecodeString(str);
- return decoded_str ? base::make_optional<std::vector<uint8_t>>(
+ absl::optional<std::string> decoded_str = DecodeString(str);
+ return decoded_str ? absl::make_optional<std::vector<uint8_t>>(
decoded_str->begin(), decoded_str->end())
- : base::nullopt;
+ : absl::nullopt;
}
std::string SaltsToString(const std::set<std::vector<uint8_t>>& salts) {
@@ -201,19 +201,19 @@
NearbySharePrivateCertificate::~NearbySharePrivateCertificate() = default;
-base::Optional<NearbyShareEncryptedMetadataKey>
+absl::optional<NearbyShareEncryptedMetadataKey>
NearbySharePrivateCertificate::EncryptMetadataKey() {
- base::Optional<std::vector<uint8_t>> salt = GenerateUnusedSalt();
+ absl::optional<std::vector<uint8_t>> salt = GenerateUnusedSalt();
if (!salt) {
NS_LOG(ERROR) << "Encryption failed: Salt generation unsuccessful.";
- return base::nullopt;
+ return absl::nullopt;
}
std::unique_ptr<crypto::Encryptor> encryptor =
CreateNearbyShareCtrEncryptor(secret_key_.get(), *salt);
if (!encryptor) {
NS_LOG(ERROR) << "Encryption failed: Could not create CTR encryptor.";
- return base::nullopt;
+ return absl::nullopt;
}
DCHECK_EQ(kNearbyShareNumBytesMetadataEncryptionKey,
@@ -221,13 +221,13 @@
std::vector<uint8_t> encrypted_metadata_key;
if (!encryptor->Encrypt(metadata_encryption_key_, &encrypted_metadata_key)) {
NS_LOG(ERROR) << "Encryption failed: Could not encrypt metadata key.";
- return base::nullopt;
+ return absl::nullopt;
}
return NearbyShareEncryptedMetadataKey(*salt, encrypted_metadata_key);
}
-base::Optional<std::vector<uint8_t>> NearbySharePrivateCertificate::Sign(
+absl::optional<std::vector<uint8_t>> NearbySharePrivateCertificate::Sign(
base::span<const uint8_t> payload) const {
std::unique_ptr<crypto::ECSignatureCreator> signer(
crypto::ECSignatureCreator::Create(key_pair_.get()));
@@ -235,7 +235,7 @@
std::vector<uint8_t> signature;
if (!signer->Sign(payload.data(), payload.size(), &signature)) {
NS_LOG(ERROR) << "Signing failed.";
- return base::nullopt;
+ return absl::nullopt;
}
return signature;
@@ -248,26 +248,26 @@
base::as_bytes(base::make_span(secret_key_->key())));
}
-base::Optional<nearbyshare::proto::PublicCertificate>
+absl::optional<nearbyshare::proto::PublicCertificate>
NearbySharePrivateCertificate::ToPublicCertificate() const {
std::vector<uint8_t> public_key;
if (!key_pair_->ExportPublicKey(&public_key)) {
NS_LOG(ERROR) << "Failed to export public key.";
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<std::vector<uint8_t>> encrypted_metadata_bytes =
+ absl::optional<std::vector<uint8_t>> encrypted_metadata_bytes =
EncryptMetadata();
if (!encrypted_metadata_bytes) {
NS_LOG(ERROR) << "Failed to encrypt metadata.";
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<std::vector<uint8_t>> metadata_encryption_key_tag =
+ absl::optional<std::vector<uint8_t>> metadata_encryption_key_tag =
CreateMetadataEncryptionKeyTag(metadata_encryption_key_);
if (!metadata_encryption_key_tag) {
NS_LOG(ERROR) << "Failed to compute metadata encryption key tag.";
- return base::nullopt;
+ return absl::nullopt;
}
base::TimeDelta not_before_offset =
@@ -319,43 +319,43 @@
return dict;
}
-base::Optional<NearbySharePrivateCertificate>
+absl::optional<NearbySharePrivateCertificate>
NearbySharePrivateCertificate::FromDictionary(const base::Value& dict) {
- base::Optional<int> int_opt;
+ absl::optional<int> int_opt;
const std::string* str_ptr;
- base::Optional<std::string> str_opt;
- base::Optional<base::Time> time_opt;
- base::Optional<std::vector<uint8_t>> bytes_opt;
+ absl::optional<std::string> str_opt;
+ absl::optional<base::Time> time_opt;
+ absl::optional<std::vector<uint8_t>> bytes_opt;
int_opt = dict.FindIntPath(kVisibility);
if (!int_opt)
- return base::nullopt;
+ return absl::nullopt;
nearby_share::mojom::Visibility visibility =
static_cast<nearby_share::mojom::Visibility>(*int_opt);
time_opt = util::ValueToTime(dict.FindPath(kNotBefore));
if (!time_opt)
- return base::nullopt;
+ return absl::nullopt;
base::Time not_before = *time_opt;
time_opt = util::ValueToTime(dict.FindPath(kNotAfter));
if (!time_opt)
- return base::nullopt;
+ return absl::nullopt;
base::Time not_after = *time_opt;
bytes_opt = EncodedStringToBytes(dict.FindStringPath(kKeyPair));
if (!bytes_opt)
- return base::nullopt;
+ return absl::nullopt;
std::unique_ptr<crypto::ECPrivateKey> key_pair =
crypto::ECPrivateKey::CreateFromPrivateKeyInfo(*bytes_opt);
str_opt = DecodeString(dict.FindStringPath(kSecretKey));
if (!str_opt)
- return base::nullopt;
+ return absl::nullopt;
std::unique_ptr<crypto::SymmetricKey> secret_key =
crypto::SymmetricKey::Import(crypto::SymmetricKey::Algorithm::AES,
@@ -363,27 +363,27 @@
bytes_opt = EncodedStringToBytes(dict.FindStringPath(kMetadataEncryptionKey));
if (!bytes_opt)
- return base::nullopt;
+ return absl::nullopt;
std::vector<uint8_t> metadata_encryption_key = *bytes_opt;
bytes_opt = EncodedStringToBytes(dict.FindStringPath(kId));
if (!bytes_opt)
- return base::nullopt;
+ return absl::nullopt;
std::vector<uint8_t> id = *bytes_opt;
str_opt = DecodeString(dict.FindStringPath(kUnencryptedMetadata));
if (!str_opt)
- return base::nullopt;
+ return absl::nullopt;
nearbyshare::proto::EncryptedMetadata unencrypted_metadata;
if (!unencrypted_metadata.ParseFromString(*str_opt))
- return base::nullopt;
+ return absl::nullopt;
str_ptr = dict.FindStringPath(kConsumedSalts);
if (!str_ptr)
- return base::nullopt;
+ return absl::nullopt;
std::set<std::vector<uint8_t>> consumed_salts = StringToSalts(*str_ptr);
@@ -393,11 +393,11 @@
std::move(unencrypted_metadata), std::move(consumed_salts));
}
-base::Optional<std::vector<uint8_t>>
+absl::optional<std::vector<uint8_t>>
NearbySharePrivateCertificate::GenerateUnusedSalt() {
if (consumed_salts_.size() >= kNearbyShareMaxNumMetadataEncryptionKeySalts) {
NS_LOG(ERROR) << "All salts exhausted for certificate.";
- return base::nullopt;
+ return absl::nullopt;
}
for (size_t attempt = 0;
@@ -420,10 +420,10 @@
NS_LOG(ERROR) << "Salt generation exceeded max number of retries. This is "
"highly improbable.";
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<std::vector<uint8_t>>
+absl::optional<std::vector<uint8_t>>
NearbySharePrivateCertificate::EncryptMetadata() const {
// Init() keeps a reference to the input key, so that reference must outlive
// the lifetime of |aead|.
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate.h b/chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate.h
index 0176d35..c21cb56 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate.h
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate.h
@@ -12,13 +12,13 @@
#include "base/containers/queue.h"
#include "base/containers/span.h"
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/nearby_sharing/certificates/nearby_share_encrypted_metadata_key.h"
#include "chrome/browser/nearby_sharing/proto/encrypted_metadata.pb.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crypto {
class ECPrivateKey;
@@ -33,9 +33,9 @@
// metadata encryption key, which can then be advertised.
class NearbySharePrivateCertificate {
public:
- // Inverse operation of ToDictionary(). Returns base::nullopt if the
+ // Inverse operation of ToDictionary(). Returns absl::nullopt if the
// conversion is not successful
- static base::Optional<NearbySharePrivateCertificate> FromDictionary(
+ static absl::optional<NearbySharePrivateCertificate> FromDictionary(
const base::Value& dict);
// Generates a random EC key pair, secret key, and metadata encryption
@@ -77,14 +77,14 @@
// Encrypts |metadata_encryption_key_| with the |secret_key_|, using a
// randomly generated 2-byte salt that has not already been consumed. Returns
- // base::nullopt if the encryption failed or if there are no remaining salts.
+ // absl::nullopt if the encryption failed or if there are no remaining salts.
// Note: Due to the generation and storage of an unconsumed salt, this method
// is not thread safe.
- base::Optional<NearbyShareEncryptedMetadataKey> EncryptMetadataKey();
+ absl::optional<NearbyShareEncryptedMetadataKey> EncryptMetadataKey();
// Signs the input |payload| with the private key from |key_pair_|. Returns
- // base::nullopt if the signing was unsuccessful.
- base::Optional<std::vector<uint8_t>> Sign(
+ // absl::nullopt if the signing was unsuccessful.
+ absl::optional<std::vector<uint8_t>> Sign(
base::span<const uint8_t> payload) const;
// Creates a hash of the |authentication_token|, using |secret_key_|. The use
@@ -94,9 +94,9 @@
base::span<const uint8_t> authentication_token) const;
// Converts this private certificate to a public certificate proto that can be
- // shared with select contacts. Returns base::nullopt if the conversion was
+ // shared with select contacts. Returns absl::nullopt if the conversion was
// unsuccessful.
- base::Optional<nearbyshare::proto::PublicCertificate> ToPublicCertificate()
+ absl::optional<nearbyshare::proto::PublicCertificate> ToPublicCertificate()
const;
// Converts this private certificate to a dictionary value for storage
@@ -107,21 +107,21 @@
base::queue<std::vector<uint8_t>>& next_salts_for_testing() {
return next_salts_for_testing_;
}
- base::Optional<base::TimeDelta>& offset_for_testing() {
+ absl::optional<base::TimeDelta>& offset_for_testing() {
return offset_for_testing_;
}
private:
// Generates a random 2-byte salt used for encrypting the metadata encryption
- // key. Adds returned salt to |consumed_salts_|. Returns base::nullopt if the
+ // key. Adds returned salt to |consumed_salts_|. Returns absl::nullopt if the
// maximum number of salts have been exhausted or if an unconsumed salt cannot
// be found in a fixed number of attempts, though this is highly improbably.
// Note: This function is not thread safe.
- base::Optional<std::vector<uint8_t>> GenerateUnusedSalt();
+ absl::optional<std::vector<uint8_t>> GenerateUnusedSalt();
// Encrypts |unencrypted_metadata_| with the |metadata_encryption_key_|, using
// the |secret_key_| as salt.
- base::Optional<std::vector<uint8_t>> EncryptMetadata() const;
+ absl::optional<std::vector<uint8_t>> EncryptMetadata() const;
// Specifies which contacts can receive the public certificate corresponding
// to this private certificate.
@@ -160,7 +160,7 @@
// For testing only.
base::queue<std::vector<uint8_t>> next_salts_for_testing_;
- base::Optional<base::TimeDelta> offset_for_testing_;
+ absl::optional<base::TimeDelta> offset_for_testing_;
FRIEND_TEST_ALL_PREFIXES(NearbySharePrivateCertificateTest, ToFromDictionary);
};
diff --git a/chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate_unittest.cc b/chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate_unittest.cc
index 7804a24..8ddd43de 100644
--- a/chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate_unittest.cc
+++ b/chrome/browser/nearby_sharing/certificates/nearby_share_private_certificate_unittest.cc
@@ -4,7 +4,6 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/certificates/constants.h"
#include "chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.h"
#include "chrome/browser/nearby_sharing/certificates/nearby_share_encrypted_metadata_key.h"
@@ -13,6 +12,7 @@
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
TEST(NearbySharePrivateCertificateTest, Construction) {
NearbySharePrivateCertificate private_certificate(
@@ -60,7 +60,7 @@
NearbySharePrivateCertificate private_certificate(
nearby_share::mojom::Visibility::kAllContacts,
GetNearbyShareTestNotBefore(), GetNearbyShareTestMetadata());
- base::Optional<NearbyShareEncryptedMetadataKey> encrypted_metadata_key =
+ absl::optional<NearbyShareEncryptedMetadataKey> encrypted_metadata_key =
private_certificate.EncryptMetadataKey();
ASSERT_TRUE(encrypted_metadata_key);
EXPECT_EQ(kNearbyShareNumBytesMetadataEncryptionKeySalt,
@@ -73,7 +73,7 @@
NearbySharePrivateCertificate private_certificate =
GetNearbyShareTestPrivateCertificate(
nearby_share::mojom::Visibility::kAllContacts);
- base::Optional<NearbyShareEncryptedMetadataKey> encrypted_metadata_key =
+ absl::optional<NearbyShareEncryptedMetadataKey> encrypted_metadata_key =
private_certificate.EncryptMetadataKey();
EXPECT_EQ(GetNearbyShareTestEncryptedMetadataKey().encrypted_key(),
encrypted_metadata_key->encrypted_key());
@@ -110,7 +110,7 @@
GetNearbyShareTestPrivateCertificate(
nearby_share::mojom::Visibility::kSelectedContacts);
private_certificate.offset_for_testing() = GetNearbyShareTestValidityOffset();
- base::Optional<nearbyshare::proto::PublicCertificate> public_certificate =
+ absl::optional<nearbyshare::proto::PublicCertificate> public_certificate =
private_certificate.ToPublicCertificate();
ASSERT_TRUE(public_certificate);
EXPECT_EQ(GetNearbyShareTestPublicCertificate(
@@ -124,7 +124,7 @@
GetNearbyShareTestPrivateCertificate(
nearby_share::mojom::Visibility::kAllContacts);
- base::Optional<NearbyShareDecryptedPublicCertificate>
+ absl::optional<NearbyShareDecryptedPublicCertificate>
decrypted_public_certificate =
NearbyShareDecryptedPublicCertificate::DecryptPublicCertificate(
*private_certificate.ToPublicCertificate(),
@@ -139,11 +139,11 @@
NearbySharePrivateCertificate private_certificate =
GetNearbyShareTestPrivateCertificate(
nearby_share::mojom::Visibility::kAllContacts);
- base::Optional<std::vector<uint8_t>> signature =
+ absl::optional<std::vector<uint8_t>> signature =
private_certificate.Sign(GetNearbyShareTestPayloadToSign());
ASSERT_TRUE(signature);
- base::Optional<NearbyShareDecryptedPublicCertificate>
+ absl::optional<NearbyShareDecryptedPublicCertificate>
decrypted_public_certificate =
NearbyShareDecryptedPublicCertificate::DecryptPublicCertificate(
*private_certificate.ToPublicCertificate(),
diff --git a/chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl.cc b/chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl.cc
index d1b3bbf..6783b2ee 100644
--- a/chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl.cc
+++ b/chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl.cc
@@ -137,7 +137,7 @@
int net_error,
const network::mojom::URLResponseHead* head,
std::unique_ptr<std::string> body) {
- base::Optional<NearbyShareHttpError> error;
+ absl::optional<NearbyShareHttpError> error;
std::string error_message;
if (net_error == net::OK) {
int response_code = -1;
diff --git a/chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl.h b/chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl.h
index 1f915a2..9ad7dc0 100644
--- a/chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl.h
+++ b/chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl.h
@@ -11,9 +11,9 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/client/nearby_share_api_call_flow.h"
#include "google_apis/gaia/oauth2_api_call_flow.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// NearbyShareApiCallFlowImpl is a wrapper around OAuth2ApiCallFlow
// that provides convenience methods StartGetRequest, StartPostRequest,
@@ -87,12 +87,12 @@
// Serialized request message proto that will be sent in the request body.
// Null if request is GET.
- base::Optional<std::string> serialized_request_;
+ absl::optional<std::string> serialized_request_;
// The request message proto represented as key-value pairs that will be sent
// as query parameters in the API GET request. Note: A key can have multiple
// values. Null if HTTP method is not GET.
- base::Optional<QueryParameters> request_as_query_parameters_;
+ absl::optional<QueryParameters> request_as_query_parameters_;
// Callback invoked with the serialized response message proto when the flow
// completes successfully.
diff --git a/chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl_unittest.cc b/chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl_unittest.cc
index 98763e1..ed48118e 100644
--- a/chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl_unittest.cc
+++ b/chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl_unittest.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/test/task_environment.h"
#include "chrome/browser/nearby_sharing/client/nearby_share_api_call_flow_impl.h"
#include "net/base/net_errors.h"
@@ -19,6 +18,7 @@
#include "services/network/test/test_url_loader_factory.h"
#include "services/network/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -46,7 +46,7 @@
// |request_as_query_parameters| is only non-null for GET requests.
GURL UrlWithQueryParameters(
const std::string& url,
- const base::Optional<NearbyShareApiCallFlow::QueryParameters>&
+ const absl::optional<NearbyShareApiCallFlow::QueryParameters>&
request_as_query_parameters) {
GURL url_with_qp(url);
@@ -153,7 +153,7 @@
CheckPlatformTypeHeader(request.headers);
EXPECT_EQ(UrlWithQueryParameters(
- kRequestUrl, base::nullopt /* request_as_query_parameters */),
+ kRequestUrl, absl::nullopt /* request_as_query_parameters */),
request.url);
EXPECT_EQ(kPost, request.method);
@@ -176,7 +176,7 @@
CheckPlatformTypeHeader(request.headers);
EXPECT_EQ(UrlWithQueryParameters(
- kRequestUrl, base::nullopt /* request_as_query_parameters */),
+ kRequestUrl, absl::nullopt /* request_as_query_parameters */),
request.url);
EXPECT_EQ(kPatch, request.method);
@@ -214,8 +214,8 @@
// then the |response_code| and |response_string| are null.
void CompleteCurrentPostRequest(
net::Error error,
- base::Optional<int> response_code = base::nullopt,
- const base::Optional<std::string>& response_string = base::nullopt) {
+ absl::optional<int> response_code = absl::nullopt,
+ const absl::optional<std::string>& response_string = absl::nullopt) {
network::URLLoaderCompletionStatus completion_status(error);
auto response_head = network::mojom::URLResponseHead::New();
std::string content;
@@ -238,8 +238,8 @@
// then the |response_code| and |response_string| are null.
void CompleteCurrentPatchRequest(
net::Error error,
- base::Optional<int> response_code = base::nullopt,
- const base::Optional<std::string>& response_string = base::nullopt) {
+ absl::optional<int> response_code = absl::nullopt,
+ const absl::optional<std::string>& response_string = absl::nullopt) {
network::URLLoaderCompletionStatus completion_status(error);
auto response_head = network::mojom::URLResponseHead::New();
std::string content;
@@ -262,8 +262,8 @@
// then the |response_code| and |response_string| are null.
void CompleteCurrentGetRequest(
net::Error error,
- base::Optional<int> response_code = base::nullopt,
- const base::Optional<std::string>& response_string = base::nullopt) {
+ absl::optional<int> response_code = absl::nullopt,
+ const absl::optional<std::string>& response_string = absl::nullopt) {
network::URLLoaderCompletionStatus completion_status(error);
auto response_head = network::mojom::URLResponseHead::New();
std::string content;
diff --git a/chrome/browser/nearby_sharing/client/nearby_share_client_impl.cc b/chrome/browser/nearby_sharing/client/nearby_share_client_impl.cc
index 90bd3090..26b8e09 100644
--- a/chrome/browser/nearby_sharing/client/nearby_share_client_impl.cc
+++ b/chrome/browser/nearby_sharing/client/nearby_share_client_impl.cc
@@ -239,7 +239,7 @@
notifier_->NotifyOfRequest(request);
MakeApiCall(CreateV1RequestUrl(request.device().name()), RequestType::kPatch,
request.SerializeAsString(),
- /*request_as_query_parameters=*/base::nullopt,
+ /*request_as_query_parameters=*/absl::nullopt,
std::move(callback), std::move(error_callback),
GetUpdateDeviceAnnotation());
}
@@ -250,7 +250,7 @@
ErrorCallback&& error_callback) {
notifier_->NotifyOfRequest(request);
MakeApiCall(CreateV1RequestUrl(kListContactPeoplePath), RequestType::kGet,
- /*serialized_request=*/base::nullopt,
+ /*serialized_request=*/absl::nullopt,
ListContactPeopleRequestToQueryParameters(request),
std::move(callback), std::move(error_callback),
GetContactsAnnotation());
@@ -263,7 +263,7 @@
notifier_->NotifyOfRequest(request);
MakeApiCall(
CreateV1RequestUrl(request.parent() + "/" + kListPublicCertificatesPath),
- RequestType::kGet, /*serialized_request=*/base::nullopt,
+ RequestType::kGet, /*serialized_request=*/absl::nullopt,
ListPublicCertificatesRequestToQueryParameters(request),
std::move(callback), std::move(error_callback),
GetListPublicCertificatesAnnotation());
@@ -277,8 +277,8 @@
void NearbyShareClientImpl::MakeApiCall(
const GURL& request_url,
RequestType request_type,
- const base::Optional<std::string>& serialized_request,
- const base::Optional<NearbyShareApiCallFlow::QueryParameters>&
+ const absl::optional<std::string>& serialized_request,
+ const absl::optional<NearbyShareApiCallFlow::QueryParameters>&
request_as_query_parameters,
base::OnceCallback<void(const ResponseProto&)>&& response_callback,
ErrorCallback&& error_callback,
@@ -311,8 +311,8 @@
template <class ResponseProto>
void NearbyShareClientImpl::OnAccessTokenFetched(
RequestType request_type,
- const base::Optional<std::string>& serialized_request,
- const base::Optional<NearbyShareApiCallFlow::QueryParameters>&
+ const absl::optional<std::string>& serialized_request,
+ const absl::optional<NearbyShareApiCallFlow::QueryParameters>&
request_as_query_parameters,
base::OnceCallback<void(const ResponseProto&)>&& response_callback,
GoogleServiceAuthError error,
diff --git a/chrome/browser/nearby_sharing/client/nearby_share_client_impl.h b/chrome/browser/nearby_sharing/client/nearby_share_client_impl.h
index acfa403..d7a14fa6 100644
--- a/chrome/browser/nearby_sharing/client/nearby_share_client_impl.h
+++ b/chrome/browser/nearby_sharing/client/nearby_share_client_impl.h
@@ -12,11 +12,11 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/client/nearby_share_api_call_flow.h"
#include "chrome/browser/nearby_sharing/client/nearby_share_client.h"
#include "chrome/browser/nearby_sharing/common/nearby_share_http_result.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace signin {
@@ -86,8 +86,8 @@
void MakeApiCall(
const GURL& request_url,
RequestType request_type,
- const base::Optional<std::string>& serialized_request,
- const base::Optional<NearbyShareApiCallFlow::QueryParameters>&
+ const absl::optional<std::string>& serialized_request,
+ const absl::optional<NearbyShareApiCallFlow::QueryParameters>&
request_as_query_parameters,
base::OnceCallback<void(const ResponseProto&)>&& response_callback,
ErrorCallback&& error_callback,
@@ -98,8 +98,8 @@
template <class ResponseProto>
void OnAccessTokenFetched(
RequestType request_type,
- const base::Optional<std::string>& serialized_request,
- const base::Optional<NearbyShareApiCallFlow::QueryParameters>&
+ const absl::optional<std::string>& serialized_request,
+ const absl::optional<NearbyShareApiCallFlow::QueryParameters>&
request_as_query_parameters,
base::OnceCallback<void(const ResponseProto&)>&& response_callback,
GoogleServiceAuthError error,
diff --git a/chrome/browser/nearby_sharing/client/nearby_share_client_impl_unittest.cc b/chrome/browser/nearby_sharing/client/nearby_share_client_impl_unittest.cc
index 6b5a6be..4580371b 100644
--- a/chrome/browser/nearby_sharing/client/nearby_share_client_impl_unittest.cc
+++ b/chrome/browser/nearby_sharing/client/nearby_share_client_impl_unittest.cc
@@ -310,17 +310,17 @@
}
protected:
- base::Optional<nearbyshare::proto::UpdateDeviceRequest>
+ absl::optional<nearbyshare::proto::UpdateDeviceRequest>
update_device_request_from_notifier_;
- base::Optional<nearbyshare::proto::UpdateDeviceResponse>
+ absl::optional<nearbyshare::proto::UpdateDeviceResponse>
update_device_response_from_notifier_;
- base::Optional<nearbyshare::proto::ListContactPeopleRequest>
+ absl::optional<nearbyshare::proto::ListContactPeopleRequest>
list_contact_people_request_from_notifier_;
- base::Optional<nearbyshare::proto::ListContactPeopleResponse>
+ absl::optional<nearbyshare::proto::ListContactPeopleResponse>
list_contact_people_response_from_notifier_;
- base::Optional<nearbyshare::proto::ListPublicCertificatesRequest>
+ absl::optional<nearbyshare::proto::ListPublicCertificatesRequest>
list_public_certificate_request_from_notifier_;
- base::Optional<nearbyshare::proto::ListPublicCertificatesResponse>
+ absl::optional<nearbyshare::proto::ListPublicCertificatesResponse>
list_public_certificate_response_from_notifier_;
base::test::TaskEnvironment task_environment_;
signin::IdentityTestEnvironment identity_test_environment_;
diff --git a/chrome/browser/nearby_sharing/common/fake_nearby_share_profile_info_provider.cc b/chrome/browser/nearby_sharing/common/fake_nearby_share_profile_info_provider.cc
index e12f123..85d5d8e 100644
--- a/chrome/browser/nearby_sharing/common/fake_nearby_share_profile_info_provider.cc
+++ b/chrome/browser/nearby_sharing/common/fake_nearby_share_profile_info_provider.cc
@@ -10,12 +10,12 @@
FakeNearbyShareProfileInfoProvider::~FakeNearbyShareProfileInfoProvider() =
default;
-base::Optional<std::u16string>
+absl::optional<std::u16string>
FakeNearbyShareProfileInfoProvider::GetGivenName() const {
return given_name_;
}
-base::Optional<std::string>
+absl::optional<std::string>
FakeNearbyShareProfileInfoProvider::GetProfileUserName() const {
return profile_user_name_;
}
diff --git a/chrome/browser/nearby_sharing/common/fake_nearby_share_profile_info_provider.h b/chrome/browser/nearby_sharing/common/fake_nearby_share_profile_info_provider.h
index 7d45d84..6c65e38 100644
--- a/chrome/browser/nearby_sharing/common/fake_nearby_share_profile_info_provider.h
+++ b/chrome/browser/nearby_sharing/common/fake_nearby_share_profile_info_provider.h
@@ -14,20 +14,20 @@
~FakeNearbyShareProfileInfoProvider() override;
// NearbyShareProfileInfoProvider:
- base::Optional<std::u16string> GetGivenName() const override;
- base::Optional<std::string> GetProfileUserName() const override;
+ absl::optional<std::u16string> GetGivenName() const override;
+ absl::optional<std::string> GetProfileUserName() const override;
- void set_given_name(const base::Optional<std::u16string>& given_name) {
+ void set_given_name(const absl::optional<std::u16string>& given_name) {
given_name_ = given_name;
}
void set_profile_user_name(
- const base::Optional<std::string>& profile_user_name) {
+ const absl::optional<std::string>& profile_user_name) {
profile_user_name_ = profile_user_name;
}
private:
- base::Optional<std::u16string> given_name_;
- base::Optional<std::string> profile_user_name_;
+ absl::optional<std::u16string> given_name_;
+ absl::optional<std::string> profile_user_name_;
};
#endif // CHROME_BROWSER_NEARBY_SHARING_COMMON_FAKE_NEARBY_SHARE_PROFILE_INFO_PROVIDER_H_
diff --git a/chrome/browser/nearby_sharing/common/nearby_share_http_result.h b/chrome/browser/nearby_sharing/common/nearby_share_http_result.h
index 80867bd..54c9934 100644
--- a/chrome/browser/nearby_sharing/common/nearby_share_http_result.h
+++ b/chrome/browser/nearby_sharing/common/nearby_share_http_result.h
@@ -8,8 +8,8 @@
#include <ostream>
#include <string>
-#include "base/optional.h"
#include "services/network/public/mojom/url_response_head.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
enum class NearbyShareHttpError {
// Request could not be completed because the device is offline or has issues
@@ -64,7 +64,7 @@
private:
enum class Status { kSuccess, kNetworkFailure, kHttpFailure } status_;
int net_error_code_;
- base::Optional<int> http_response_code_;
+ absl::optional<int> http_response_code_;
};
NearbyShareHttpError NearbyShareHttpErrorForHttpResponseCode(int response_code);
diff --git a/chrome/browser/nearby_sharing/common/nearby_share_profile_info_provider.h b/chrome/browser/nearby_sharing/common/nearby_share_profile_info_provider.h
index 6e2d399..7879377 100644
--- a/chrome/browser/nearby_sharing/common/nearby_share_profile_info_provider.h
+++ b/chrome/browser/nearby_sharing/common/nearby_share_profile_info_provider.h
@@ -7,7 +7,7 @@
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A delegate class that returns the Profile information necessary for
// browser-independent Nearby Share components, such as the local-device-data
@@ -17,13 +17,13 @@
NearbyShareProfileInfoProvider() = default;
virtual ~NearbyShareProfileInfoProvider() = default;
- // Proxy for User::GetGivenName(). Returns base::nullopt if a valid given name
+ // Proxy for User::GetGivenName(). Returns absl::nullopt if a valid given name
// cannot be returned.
- virtual base::Optional<std::u16string> GetGivenName() const = 0;
+ virtual absl::optional<std::u16string> GetGivenName() const = 0;
- // Proxy for Profile::GetProfileUserName(). Returns base::nullopt if a valid
+ // Proxy for Profile::GetProfileUserName(). Returns absl::nullopt if a valid
// user name cannot be returned.
- virtual base::Optional<std::string> GetProfileUserName() const = 0;
+ virtual absl::optional<std::string> GetProfileUserName() const = 0;
};
#endif // CHROME_BROWSER_NEARBY_SHARING_COMMON_NEARBY_SHARE_PROFILE_INFO_PROVIDER_H_
diff --git a/chrome/browser/nearby_sharing/contacts/fake_nearby_share_contact_downloader.h b/chrome/browser/nearby_sharing/contacts/fake_nearby_share_contact_downloader.h
index d33220e..79dcb64 100644
--- a/chrome/browser/nearby_sharing/contacts/fake_nearby_share_contact_downloader.h
+++ b/chrome/browser/nearby_sharing/contacts/fake_nearby_share_contact_downloader.h
@@ -9,10 +9,10 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader.h"
#include "chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class NearbyShareClientFactory;
diff --git a/chrome/browser/nearby_sharing/contacts/fake_nearby_share_contact_manager.h b/chrome/browser/nearby_sharing/contacts/fake_nearby_share_contact_manager.h
index 12ca5d53..baeadfb 100644
--- a/chrome/browser/nearby_sharing/contacts/fake_nearby_share_contact_manager.h
+++ b/chrome/browser/nearby_sharing/contacts/fake_nearby_share_contact_manager.h
@@ -10,10 +10,10 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager.h"
#include "chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class NearbyShareClientFactory;
class NearbyShareLocalDeviceDataManager;
diff --git a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader.h b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader.h
index 41241b16..3dd615aa 100644
--- a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader.h
+++ b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader.h
@@ -9,8 +9,8 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Downloads the user's contact list from the server. NOTE: An instance should
// only be used once. All necessary parameters are passed to the constructor,
diff --git a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl.cc b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl.cc
index 598ed9f2..9490247 100644
--- a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl.cc
+++ b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl.cc
@@ -135,11 +135,11 @@
void NearbyShareContactDownloaderImpl::OnRun() {
NS_LOG(VERBOSE) << __func__ << ": Starting contacts download.";
start_timestamp_ = base::TimeTicks::Now();
- CallListContactPeople(/*next_page_token=*/base::nullopt);
+ CallListContactPeople(/*next_page_token=*/absl::nullopt);
}
void NearbyShareContactDownloaderImpl::CallListContactPeople(
- const base::Optional<std::string>& next_page_token) {
+ const absl::optional<std::string>& next_page_token) {
++current_page_number_;
NS_LOG(VERBOSE) << __func__
<< ": Making ListContactPeople RPC call to fetch page number "
@@ -171,10 +171,10 @@
timer_.Stop();
contacts_.insert(contacts_.end(), response.contact_records().begin(),
response.contact_records().end());
- base::Optional<std::string> next_page_token =
+ absl::optional<std::string> next_page_token =
response.next_page_token().empty()
- ? base::nullopt
- : base::make_optional<std::string>(response.next_page_token());
+ ? absl::nullopt
+ : absl::make_optional<std::string>(response.next_page_token());
client_.reset();
RecordListContactPeopleResultMetrics(NearbyShareHttpResult::kSuccess);
diff --git a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl.h b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl.h
index 9f6dd16e..31b9e41 100644
--- a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl.h
+++ b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl.h
@@ -9,13 +9,13 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/nearby_sharing/common/nearby_share_http_result.h"
#include "chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader.h"
#include "chrome/browser/nearby_sharing/proto/contact_rpc.pb.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class NearbyShareClient;
class NearbyShareClientFactory;
@@ -65,7 +65,7 @@
void OnRun() override;
void CallListContactPeople(
- const base::Optional<std::string>& next_page_token);
+ const absl::optional<std::string>& next_page_token);
void OnListContactPeopleSuccess(
const nearbyshare::proto::ListContactPeopleResponse& response);
void OnListContactPeopleFailure(NearbyShareHttpError error);
diff --git a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl_unittest.cc b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl_unittest.cc
index bbdf50ca..455f918 100644
--- a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl_unittest.cc
+++ b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_downloader_impl_unittest.cc
@@ -8,7 +8,6 @@
#include <vector>
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/clock.h"
@@ -20,6 +19,7 @@
#include "chrome/browser/nearby_sharing/proto/contact_rpc.pb.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -65,7 +65,7 @@
nearbyshare::proto::ListContactPeopleResponse CreateListContactPeopleResponse(
const std::vector<nearbyshare::proto::ContactRecord>& contact_records,
- const base::Optional<std::string>& next_page_token) {
+ const absl::optional<std::string>& next_page_token) {
nearbyshare::proto::ListContactPeopleResponse response;
*response.mutable_contact_records() = {contact_records.begin(),
contact_records.end()};
@@ -82,8 +82,8 @@
protected:
struct Result {
bool success;
- base::Optional<std::vector<nearbyshare::proto::ContactRecord>> contacts;
- base::Optional<uint32_t> num_unreachable_contacts_filtered_out;
+ absl::optional<std::vector<nearbyshare::proto::ContactRecord>> contacts;
+ absl::optional<uint32_t> num_unreachable_contacts_filtered_out;
};
NearbyShareContactDownloaderImplTest() = default;
@@ -100,7 +100,7 @@
}
void SucceedListContactPeopleRequest(
- const base::Optional<std::string>& expected_page_token_in_request,
+ const absl::optional<std::string>& expected_page_token_in_request,
const nearbyshare::proto::ListContactPeopleResponse& response) {
VerifyListContactPeopleRequest(expected_page_token_in_request);
@@ -110,7 +110,7 @@
}
void FailListContactPeopleRequest(
- const base::Optional<std::string>& expected_page_token_in_request) {
+ const absl::optional<std::string>& expected_page_token_in_request) {
VerifyListContactPeopleRequest(expected_page_token_in_request);
EXPECT_FALSE(result_);
@@ -120,7 +120,7 @@
}
void TimeoutListContactPeopleRequest(
- const base::Optional<std::string>& expected_page_token_in_request) {
+ const absl::optional<std::string>& expected_page_token_in_request) {
VerifyListContactPeopleRequest(expected_page_token_in_request);
EXPECT_FALSE(result_);
@@ -157,7 +157,7 @@
}
void VerifyListContactPeopleRequest(
- const base::Optional<std::string>& expected_page_token) {
+ const absl::optional<std::string>& expected_page_token) {
ASSERT_FALSE(fake_client_factory_.instances().empty());
FakeNearbyShareClient* client = fake_client_factory_.instances().back();
ASSERT_EQ(1u, client->list_contact_people_requests().size());
@@ -186,7 +186,7 @@
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::TaskEnvironment::TimeSource::MOCK_TIME};
- base::Optional<Result> result_;
+ absl::optional<Result> result_;
FakeNearbyShareClientFactory fake_client_factory_;
std::unique_ptr<NearbyShareContactDownloader> downloader_;
};
@@ -196,7 +196,7 @@
// Contacts are sent in two ListContactPeople responses.
SucceedListContactPeopleRequest(
- /*expected_page_token=*/base::nullopt,
+ /*expected_page_token=*/absl::nullopt,
CreateListContactPeopleResponse(
std::vector<nearbyshare::proto::ContactRecord>(
TestContactRecordList().begin(),
@@ -208,7 +208,7 @@
std::vector<nearbyshare::proto::ContactRecord>(
TestContactRecordList().begin() + 1,
TestContactRecordList().end()),
- /*next_page_token=*/base::nullopt));
+ /*next_page_token=*/absl::nullopt));
// The last two records are filtered out because the are not reachable.
VerifySuccess(/*expected_contacts=*/
@@ -224,7 +224,7 @@
// Contacts should be sent in two ListContactPeople responses, but second
// request fails.
SucceedListContactPeopleRequest(
- /*expected_page_token=*/base::nullopt,
+ /*expected_page_token=*/absl::nullopt,
CreateListContactPeopleResponse(
std::vector<nearbyshare::proto::ContactRecord>(
TestContactRecordList().begin(),
@@ -242,7 +242,7 @@
// Contacts should be sent in two ListContactPeople responses. Timeout before
// second response.
SucceedListContactPeopleRequest(
- /*expected_page_token=*/base::nullopt,
+ /*expected_page_token=*/absl::nullopt,
CreateListContactPeopleResponse(
std::vector<nearbyshare::proto::ContactRecord>(
TestContactRecordList().begin(),
@@ -263,9 +263,9 @@
RunDownload();
SucceedListContactPeopleRequest(
- /*expected_page_token=*/base::nullopt,
+ /*expected_page_token=*/absl::nullopt,
CreateListContactPeopleResponse(TestContactRecordList(),
- /*next_page_token=*/base::nullopt));
+ /*next_page_token=*/absl::nullopt));
// The device contact is filtered out.
VerifySuccess(/*expected_contacts=*/{TestContactRecordList()[0],
diff --git a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager.h b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager.h
index 2b4f222..26f4b65 100644
--- a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager.h
+++ b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager.h
@@ -13,11 +13,11 @@
#include "base/containers/span.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// The Nearby Share contacts manager interfaces with the Nearby server in the
// following ways:
diff --git a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl.cc b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl.cc
index e274e381..23756a5 100644
--- a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl.cc
+++ b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl.cc
@@ -322,7 +322,7 @@
// Enable cross-device self-share by adding your account to the list of
// contacts. It is also marked as a selected contact.
- base::Optional<std::string> user_name =
+ absl::optional<std::string> user_name =
profile_info_provider_->GetProfileUserName();
base::UmaHistogramBoolean("Nearby.Share.Contacts.CanGetProfileUserName",
user_name.has_value());
diff --git a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl.h b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl.h
index 30baaa55..40c94326 100644
--- a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl.h
+++ b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl.h
@@ -9,13 +9,13 @@
#include <string>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote_set.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class NearbyShareClientFactory;
class NearbyShareContactDownloader;
diff --git a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl_unittest.cc b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl_unittest.cc
index 067367e..730d3b3 100644
--- a/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl_unittest.cc
+++ b/chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager_impl_unittest.cc
@@ -11,7 +11,6 @@
#include "base/containers/contains.h"
#include "base/containers/flat_set.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/nearby_sharing/client/fake_nearby_share_client.h"
#include "chrome/browser/nearby_sharing/common/fake_nearby_share_profile_info_provider.h"
@@ -32,6 +31,7 @@
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
diff --git a/chrome/browser/nearby_sharing/contacts/nearby_share_contacts_sorter.cc b/chrome/browser/nearby_sharing/contacts/nearby_share_contacts_sorter.cc
index d929ed8..3c9988c9 100644
--- a/chrome/browser/nearby_sharing/contacts/nearby_share_contacts_sorter.cc
+++ b/chrome/browser/nearby_sharing/contacts/nearby_share_contacts_sorter.cc
@@ -8,20 +8,20 @@
#include <string>
#include "base/i18n/string_compare.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
struct ContactSortingFields {
// Primary sorting key: person name if not empty; otherwise, email.
- base::Optional<std::string> person_name_or_email;
+ absl::optional<std::string> person_name_or_email;
// Secondary sorting key. Note: It is okay if email is also used as the
// primary sorting key.
- base::Optional<std::string> email;
+ absl::optional<std::string> email;
// Tertiary sorting key.
- base::Optional<std::string> phone_number;
+ absl::optional<std::string> phone_number;
// Last resort sorting key. The contact ID should be unique for each contact
// record, guaranteeing uniquely defined ordering.
std::string id;
@@ -54,7 +54,7 @@
fields.person_name_or_email =
contact.person_name().empty()
? fields.email
- : base::make_optional<std::string>(contact.person_name());
+ : absl::make_optional<std::string>(contact.person_name());
return fields;
}
@@ -101,9 +101,9 @@
}
private:
- UCollationResult CollatorCompare(const base::Optional<std::string>& a,
- const base::Optional<std::string>& b) const {
- // Sort populated strings before base::nullopt.
+ UCollationResult CollatorCompare(const absl::optional<std::string>& a,
+ const absl::optional<std::string>& b) const {
+ // Sort populated strings before absl::nullopt.
if (!a && !b)
return UCOL_EQUAL;
if (!b)
diff --git a/chrome/browser/nearby_sharing/fake_nearby_connection.cc b/chrome/browser/nearby_sharing/fake_nearby_connection.cc
index 8462a1d5..3025e24b 100644
--- a/chrome/browser/nearby_sharing/fake_nearby_connection.cc
+++ b/chrome/browser/nearby_sharing/fake_nearby_connection.cc
@@ -29,7 +29,7 @@
if (callback_) {
has_read_callback_been_run_ = true;
- std::move(callback_).Run(base::nullopt);
+ std::move(callback_).Run(absl::nullopt);
}
}
diff --git a/chrome/browser/nearby_sharing/fake_nearby_connections_manager.cc b/chrome/browser/nearby_sharing/fake_nearby_connections_manager.cc
index 7390df6..0f0ffbb0 100644
--- a/chrome/browser/nearby_sharing/fake_nearby_connections_manager.cc
+++ b/chrome/browser/nearby_sharing/fake_nearby_connections_manager.cc
@@ -73,7 +73,7 @@
void FakeNearbyConnectionsManager::Connect(
std::vector<uint8_t> endpoint_info,
const std::string& endpoint_id,
- base::Optional<std::vector<uint8_t>> bluetooth_mac_address,
+ absl::optional<std::vector<uint8_t>> bluetooth_mac_address,
DataUsage data_usage,
NearbyConnectionCallback callback) {
DCHECK(!is_shutdown());
@@ -149,7 +149,7 @@
location::nearby::connections::mojom::PayloadStatus::kCanceled,
/*total_bytes=*/0,
/*bytes_transferred=*/0),
- /*upgraded_medium=*/base::nullopt);
+ /*upgraded_medium=*/absl::nullopt);
payload_status_listeners_.erase(payload_id);
}
@@ -163,7 +163,7 @@
payload_status_listeners_.clear();
}
-base::Optional<std::vector<uint8_t>>
+absl::optional<std::vector<uint8_t>>
FakeNearbyConnectionsManager::GetRawAuthenticationToken(
const std::string& endpoint_id) {
DCHECK(!is_shutdown());
@@ -172,7 +172,7 @@
if (iter != endpoint_auth_tokens_.end())
return iter->second;
- return base::nullopt;
+ return absl::nullopt;
}
void FakeNearbyConnectionsManager::SetRawAuthenticationToken(
@@ -243,11 +243,11 @@
return base::Contains(canceled_payload_ids_, payload_id);
}
-base::Optional<base::FilePath>
+absl::optional<base::FilePath>
FakeNearbyConnectionsManager::GetRegisteredPayloadPath(int64_t payload_id) {
auto it = registered_payload_paths_.find(payload_id);
if (it == registered_payload_paths_.end())
- return base::nullopt;
+ return absl::nullopt;
return it->second;
}
diff --git a/chrome/browser/nearby_sharing/fake_nearby_connections_manager.h b/chrome/browser/nearby_sharing/fake_nearby_connections_manager.h
index ba5317d1..e9ebb16 100644
--- a/chrome/browser/nearby_sharing/fake_nearby_connections_manager.h
+++ b/chrome/browser/nearby_sharing/fake_nearby_connections_manager.h
@@ -13,9 +13,9 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/nearby_connections_manager.h"
#include "chromeos/services/nearby/public/mojom/nearby_connections.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class NearbyConnection;
@@ -41,7 +41,7 @@
void StopDiscovery() override;
void Connect(std::vector<uint8_t> endpoint_info,
const std::string& endpoint_id,
- base::Optional<std::vector<uint8_t>> bluetooth_mac_address,
+ absl::optional<std::vector<uint8_t>> bluetooth_mac_address,
DataUsage data_usage,
NearbyConnectionCallback callback) override;
void Disconnect(const std::string& endpoint_id) override;
@@ -57,7 +57,7 @@
Payload* GetIncomingPayload(int64_t payload_id) override;
void Cancel(int64_t payload_id) override;
void ClearIncomingPayloads() override;
- base::Optional<std::vector<uint8_t>> GetRawAuthenticationToken(
+ absl::optional<std::vector<uint8_t>> GetRawAuthenticationToken(
const std::string& endpoint_id) override;
void UpgradeBandwidth(const std::string& endpoint_id) override;
@@ -79,7 +79,7 @@
base::WeakPtr<PayloadStatusListener> GetRegisteredPayloadStatusListener(
int64_t payload_id);
void SetIncomingPayload(int64_t payload_id, PayloadPtr payload);
- base::Optional<base::FilePath> GetRegisteredPayloadPath(int64_t payload_id);
+ absl::optional<base::FilePath> GetRegisteredPayloadPath(int64_t payload_id);
bool WasPayloadCanceled(const int64_t& payload_id) const;
void CleanupForProcessStopped();
ConnectionsCallback GetStartAdvertisingCallback();
@@ -99,15 +99,15 @@
void(PayloadPtr, base::WeakPtr<PayloadStatusListener>)> callback) {
send_payload_callback_ = std::move(callback);
}
- const base::Optional<std::vector<uint8_t>>& advertising_endpoint_info() {
+ const absl::optional<std::vector<uint8_t>>& advertising_endpoint_info() {
return advertising_endpoint_info_;
}
- base::Optional<std::vector<uint8_t>> connection_endpoint_info(
+ absl::optional<std::vector<uint8_t>> connection_endpoint_info(
const std::string& endpoint_id) {
auto it = connection_endpoint_infos_.find(endpoint_id);
if (it == connection_endpoint_infos_.end())
- return base::nullopt;
+ return absl::nullopt;
return it->second;
}
@@ -130,7 +130,7 @@
base::RepeatingCallback<void(PayloadPtr,
base::WeakPtr<PayloadStatusListener>)>
send_payload_callback_;
- base::Optional<std::vector<uint8_t>> advertising_endpoint_info_;
+ absl::optional<std::vector<uint8_t>> advertising_endpoint_info_;
std::set<std::string> disconnected_endpoints_;
std::set<int64_t> canceled_payload_ids_;
bool capture_next_stop_advertising_callback_ = false;
diff --git a/chrome/browser/nearby_sharing/file_attachment.h b/chrome/browser/nearby_sharing/file_attachment.h
index 47fd8c9..d618e21 100644
--- a/chrome/browser/nearby_sharing/file_attachment.h
+++ b/chrome/browser/nearby_sharing/file_attachment.h
@@ -8,9 +8,9 @@
#include <string>
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/attachment.h"
#include "chromeos/services/nearby/public/mojom/nearby_decoder_types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A single attachment to be sent by / received from a |ShareTarget|, can be
// either a file or text.
@@ -33,14 +33,14 @@
const std::string& file_name() const { return file_name_; }
const std::string& mime_type() const { return mime_type_; }
Type type() const { return type_; }
- const base::Optional<base::FilePath>& file_path() const { return file_path_; }
+ const absl::optional<base::FilePath>& file_path() const { return file_path_; }
// Attachment:
void MoveToShareTarget(ShareTarget& share_target) override;
const std::string& GetDescription() const override;
nearby_share::mojom::ShareType GetShareType() const override;
- void set_file_path(base::Optional<base::FilePath> path) {
+ void set_file_path(absl::optional<base::FilePath> path) {
file_path_ = std::move(path);
}
@@ -48,7 +48,7 @@
std::string file_name_;
std::string mime_type_;
Type type_;
- base::Optional<base::FilePath> file_path_;
+ absl::optional<base::FilePath> file_path_;
};
#endif // CHROME_BROWSER_NEARBY_SHARING_FILE_ATTACHMENT_H_
diff --git a/chrome/browser/nearby_sharing/incoming_frames_reader.cc b/chrome/browser/nearby_sharing/incoming_frames_reader.cc
index 5edb025e..12b23af 100644
--- a/chrome/browser/nearby_sharing/incoming_frames_reader.cc
+++ b/chrome/browser/nearby_sharing/incoming_frames_reader.cc
@@ -33,17 +33,17 @@
IncomingFramesReader::~IncomingFramesReader() = default;
void IncomingFramesReader::ReadFrame(
- base::OnceCallback<void(base::Optional<sharing::mojom::V1FramePtr>)>
+ base::OnceCallback<void(absl::optional<sharing::mojom::V1FramePtr>)>
callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!callback_);
DCHECK(!is_process_stopped_);
callback_ = std::move(callback);
- frame_type_ = base::nullopt;
+ frame_type_ = absl::nullopt;
// Check in cache for frame.
- base::Optional<sharing::mojom::V1FramePtr> cached_frame =
+ absl::optional<sharing::mojom::V1FramePtr> cached_frame =
GetCachedFrame(frame_type_);
if (cached_frame) {
Done(std::move(cached_frame));
@@ -55,14 +55,14 @@
void IncomingFramesReader::ReadFrame(
sharing::mojom::V1Frame::Tag frame_type,
- base::OnceCallback<void(base::Optional<sharing::mojom::V1FramePtr>)>
+ base::OnceCallback<void(absl::optional<sharing::mojom::V1FramePtr>)>
callback,
base::TimeDelta timeout) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!callback_);
DCHECK(!is_process_stopped_);
if (!connection_) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
@@ -75,7 +75,7 @@
FROM_HERE, base::BindOnce(timeout_callback_.callback()), timeout);
// Check in cache for frame.
- base::Optional<sharing::mojom::V1FramePtr> cached_frame =
+ absl::optional<sharing::mojom::V1FramePtr> cached_frame =
GetCachedFrame(frame_type_);
if (cached_frame) {
Done(std::move(cached_frame));
@@ -88,7 +88,7 @@
void IncomingFramesReader::OnNearbyProcessStopped(
chromeos::nearby::NearbyProcessManager::NearbyProcessShutdownReason) {
is_process_stopped_ = true;
- Done(base::nullopt);
+ Done(absl::nullopt);
}
void IncomingFramesReader::ReadNextFrame() {
@@ -102,11 +102,11 @@
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
NS_LOG(WARNING) << __func__ << ": Timed out reading from NearbyConnection.";
- Done(base::nullopt);
+ Done(absl::nullopt);
}
void IncomingFramesReader::OnDataReadFromConnection(
- base::Optional<std::vector<uint8_t>> bytes) {
+ absl::optional<std::vector<uint8_t>> bytes) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!callback_) {
@@ -115,7 +115,7 @@
if (!bytes) {
NS_LOG(WARNING) << __func__ << ": Failed to read frame";
- Done(base::nullopt);
+ Done(absl::nullopt);
return;
}
@@ -126,7 +126,7 @@
NS_LOG(WARNING)
<< __func__
<< ": Cannot decode frame. Not currently bound to nearby process";
- Done(base::nullopt);
+ Done(absl::nullopt);
return;
}
@@ -164,18 +164,18 @@
}
void IncomingFramesReader::Done(
- base::Optional<sharing::mojom::V1FramePtr> frame) {
+ absl::optional<sharing::mojom::V1FramePtr> frame) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- frame_type_ = base::nullopt;
+ frame_type_ = absl::nullopt;
timeout_callback_.Cancel();
if (callback_) {
std::move(callback_).Run(std::move(frame));
}
}
-base::Optional<sharing::mojom::V1FramePtr> IncomingFramesReader::GetCachedFrame(
- base::Optional<sharing::mojom::V1Frame::Tag> frame_type) {
+absl::optional<sharing::mojom::V1FramePtr> IncomingFramesReader::GetCachedFrame(
+ absl::optional<sharing::mojom::V1Frame::Tag> frame_type) {
NS_LOG(VERBOSE) << __func__ << ": Fetching cached frame";
if (frame_type)
NS_LOG(VERBOSE) << __func__ << ": Requested frame type - " << *frame_type;
@@ -184,7 +184,7 @@
frame_type ? cached_frames_.find(*frame_type) : cached_frames_.begin();
if (iter == cached_frames_.end())
- return base::nullopt;
+ return absl::nullopt;
NS_LOG(VERBOSE) << __func__ << ": Successfully read cached frame";
sharing::mojom::V1FramePtr frame = std::move(iter->second);
diff --git a/chrome/browser/nearby_sharing/incoming_frames_reader.h b/chrome/browser/nearby_sharing/incoming_frames_reader.h
index cf5aa69..bb0dde9 100644
--- a/chrome/browser/nearby_sharing/incoming_frames_reader.h
+++ b/chrome/browser/nearby_sharing/incoming_frames_reader.h
@@ -11,11 +11,11 @@
#include "base/callback_forward.h"
#include "base/cancelable_callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "chromeos/services/nearby/public/cpp/nearby_process_manager.h"
#include "chromeos/services/nearby/public/mojom/nearby_decoder_types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class NearbyConnection;
@@ -35,7 +35,7 @@
// Note: Callers are expected wait for |callback| to be run before scheduling
// subsequent calls to ReadFrame(..).
virtual void ReadFrame(
- base::OnceCallback<void(base::Optional<sharing::mojom::V1FramePtr>)>
+ base::OnceCallback<void(absl::optional<sharing::mojom::V1FramePtr>)>
callback);
// Reads a frame of type |frame_type| from |connection|. |callback| is called
@@ -46,21 +46,21 @@
// subsequent calls to ReadFrame(..).
virtual void ReadFrame(
sharing::mojom::V1Frame::Tag frame_type,
- base::OnceCallback<void(base::Optional<sharing::mojom::V1FramePtr>)>
+ base::OnceCallback<void(absl::optional<sharing::mojom::V1FramePtr>)>
callback,
base::TimeDelta timeout);
private:
void ReadNextFrame();
- void OnDataReadFromConnection(base::Optional<std::vector<uint8_t>> bytes);
+ void OnDataReadFromConnection(absl::optional<std::vector<uint8_t>> bytes);
void OnFrameDecoded(sharing::mojom::FramePtr mojo_frame);
void OnTimeout();
void OnNearbyProcessStopped(
chromeos::nearby::NearbyProcessManager::NearbyProcessShutdownReason
shutdown_reason);
- void Done(base::Optional<sharing::mojom::V1FramePtr> frame);
- base::Optional<sharing::mojom::V1FramePtr> GetCachedFrame(
- base::Optional<sharing::mojom::V1Frame::Tag> frame_type);
+ void Done(absl::optional<sharing::mojom::V1FramePtr> frame);
+ absl::optional<sharing::mojom::V1FramePtr> GetCachedFrame(
+ absl::optional<sharing::mojom::V1Frame::Tag> frame_type);
sharing::mojom::NearbySharingDecoder* GetOrStartNearbySharingDecoder();
chromeos::nearby::NearbyProcessManager* process_manager_;
@@ -68,8 +68,8 @@
chromeos::nearby::NearbyProcessManager::NearbyProcessReference>
process_reference_;
NearbyConnection* connection_;
- base::Optional<sharing::mojom::V1Frame::Tag> frame_type_;
- base::OnceCallback<void(base::Optional<sharing::mojom::V1FramePtr>)>
+ absl::optional<sharing::mojom::V1Frame::Tag> frame_type_;
+ base::OnceCallback<void(absl::optional<sharing::mojom::V1FramePtr>)>
callback_;
base::CancelableOnceClosure timeout_callback_;
diff --git a/chrome/browser/nearby_sharing/incoming_frames_reader_unittest.cc b/chrome/browser/nearby_sharing/incoming_frames_reader_unittest.cc
index 9625553..a7c0ea8 100644
--- a/chrome/browser/nearby_sharing/incoming_frames_reader_unittest.cc
+++ b/chrome/browser/nearby_sharing/incoming_frames_reader_unittest.cc
@@ -47,13 +47,13 @@
}
void ExpectIntroductionFrame(
- const base::Optional<sharing::mojom::V1FramePtr>& frame) {
+ const absl::optional<sharing::mojom::V1FramePtr>& frame) {
ASSERT_TRUE(frame);
EXPECT_TRUE((*frame)->is_introduction());
}
void ExpectCancelFrame(
- const base::Optional<sharing::mojom::V1FramePtr>& frame) {
+ const absl::optional<sharing::mojom::V1FramePtr>& frame) {
ASSERT_TRUE(frame);
EXPECT_TRUE((*frame)->is_cancel_frame());
}
@@ -107,7 +107,7 @@
frames_reader().ReadFrame(
sharing::mojom::V1Frame::Tag::INTRODUCTION,
base::BindLambdaForTesting(
- [&](base::Optional<sharing::mojom::V1FramePtr> frame) {
+ [&](absl::optional<sharing::mojom::V1FramePtr> frame) {
EXPECT_FALSE(frame);
run_loop.Quit();
}),
@@ -143,7 +143,7 @@
base::RunLoop run_loop;
frames_reader().ReadFrame(base::BindLambdaForTesting(
- [&](base::Optional<sharing::mojom::V1FramePtr> frame) {
+ [&](absl::optional<sharing::mojom::V1FramePtr> frame) {
ExpectIntroductionFrame(frame);
run_loop.Quit();
}));
@@ -174,7 +174,7 @@
frames_reader().ReadFrame(
sharing::mojom::V1Frame::Tag::INTRODUCTION,
base::BindLambdaForTesting(
- [&](base::Optional<sharing::mojom::V1FramePtr> frame) {
+ [&](absl::optional<sharing::mojom::V1FramePtr> frame) {
ExpectIntroductionFrame(frame);
run_loop.Quit();
}),
@@ -222,7 +222,7 @@
frames_reader().ReadFrame(
sharing::mojom::V1Frame::Tag::INTRODUCTION,
base::BindLambdaForTesting(
- [&](base::Optional<sharing::mojom::V1FramePtr> frame) {
+ [&](absl::optional<sharing::mojom::V1FramePtr> frame) {
ExpectIntroductionFrame(frame);
run_loop_introduction.Quit();
}),
@@ -270,7 +270,7 @@
frames_reader().ReadFrame(
sharing::mojom::V1Frame::Tag::INTRODUCTION,
base::BindLambdaForTesting(
- [&](base::Optional<sharing::mojom::V1FramePtr> frame) {
+ [&](absl::optional<sharing::mojom::V1FramePtr> frame) {
ExpectIntroductionFrame(frame);
run_loop_introduction.Quit();
}),
@@ -280,7 +280,7 @@
// Reading any frame should return CancelFrame.
base::RunLoop run_loop_cancel;
frames_reader().ReadFrame(base::BindLambdaForTesting(
- [&](base::Optional<sharing::mojom::V1FramePtr> frame) {
+ [&](absl::optional<sharing::mojom::V1FramePtr> frame) {
ExpectCancelFrame(frame);
run_loop_cancel.Quit();
}));
@@ -294,7 +294,7 @@
frames_reader().ReadFrame(
sharing::mojom::V1Frame::Tag::INTRODUCTION,
base::BindLambdaForTesting(
- [&](base::Optional<sharing::mojom::V1FramePtr> frame) {
+ [&](absl::optional<sharing::mojom::V1FramePtr> frame) {
EXPECT_FALSE(frame);
run_loop_before_close.Quit();
}),
diff --git a/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.cc b/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.cc
index 56d0498..c893e90 100644
--- a/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.cc
+++ b/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express.cc
@@ -67,16 +67,16 @@
}
})");
-base::Optional<NearbyShareHttpStatus> HttpStatusFromUrlLoader(
+absl::optional<NearbyShareHttpStatus> HttpStatusFromUrlLoader(
const network::SimpleURLLoader* loader) {
if (!loader)
- return base::nullopt;
+ return absl::nullopt;
return NearbyShareHttpStatus(loader->NetError(), loader->ResponseInfo());
}
void LogReceiveResult(bool success,
- const base::Optional<NearbyShareHttpStatus>& http_status,
+ const absl::optional<NearbyShareHttpStatus>& http_status,
const std::string& request_id) {
std::stringstream ss;
ss << "Instant messaging receive express "
@@ -270,7 +270,7 @@
void ReceiveMessagesExpress::OnComplete(bool success) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
fast_path_ready_timeout_timer_.Stop();
- base::Optional<NearbyShareHttpStatus> http_status =
+ absl::optional<NearbyShareHttpStatus> http_status =
HttpStatusFromUrlLoader(url_loader_.get());
NS_LOG(VERBOSE) << __func__ << ": success? " << (success ? "yes" : "no")
@@ -302,7 +302,7 @@
NS_LOG(VERBOSE) << __func__;
fast_path_ready_timeout_timer_.Stop();
if (start_receiving_messages_callback_) {
- LogReceiveResult(/*success=*/true, /*http_status=*/base::nullopt,
+ LogReceiveResult(/*success=*/true, /*http_status=*/absl::nullopt,
request_id_);
std::move(start_receiving_messages_callback_)
.Run(true, std::move(self_pending_remote_));
diff --git a/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express_unittest.cc b/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express_unittest.cc
index 421f64f1..bf0aa5c2 100644
--- a/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express_unittest.cc
+++ b/chrome/browser/nearby_sharing/instantmessaging/receive_messages_express_unittest.cc
@@ -76,11 +76,11 @@
return messages_received_;
}
- base::Optional<bool> on_complete_result() { return on_complete_result_; }
+ absl::optional<bool> on_complete_result() { return on_complete_result_; }
private:
std::vector<std::string> messages_received_;
- base::Optional<bool> on_complete_result_;
+ absl::optional<bool> on_complete_result_;
};
class ReceiveMessagesExpressTest : public testing::Test {
@@ -116,7 +116,7 @@
return message_listener_.messages_received();
}
- base::Optional<bool> OnCompleteResult() {
+ absl::optional<bool> OnCompleteResult() {
return message_listener_.on_complete_result();
}
@@ -158,7 +158,7 @@
network::TestURLLoaderFactory test_url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_;
- base::Optional<bool> start_receive_success_;
+ absl::optional<bool> start_receive_success_;
FakeIncomingMessagesListener message_listener_;
mojo::Receiver<sharing::mojom::IncomingMessagesListener> listener_receiver_{
&message_listener_};
diff --git a/chrome/browser/nearby_sharing/instantmessaging/send_message_express.cc b/chrome/browser/nearby_sharing/instantmessaging/send_message_express.cc
index 6befb43..ce595d90 100644
--- a/chrome/browser/nearby_sharing/instantmessaging/send_message_express.cc
+++ b/chrome/browser/nearby_sharing/instantmessaging/send_message_express.cc
@@ -7,7 +7,6 @@
#include <sstream>
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/nearby_sharing/common/nearby_share_http_result.h"
#include "chrome/browser/nearby_sharing/instantmessaging/constants.h"
@@ -18,6 +17,7 @@
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
diff --git a/chrome/browser/nearby_sharing/instantmessaging/stream_parser.cc b/chrome/browser/nearby_sharing/instantmessaging/stream_parser.cc
index 7348271..6e490300 100644
--- a/chrome/browser/nearby_sharing/instantmessaging/stream_parser.cc
+++ b/chrome/browser/nearby_sharing/instantmessaging/stream_parser.cc
@@ -29,7 +29,7 @@
void StreamParser::Append(base::StringPiece data) {
data_.append(data.data(), data.size());
- base::Optional<chrome_browser_nearby_sharing_instantmessaging::StreamBody>
+ absl::optional<chrome_browser_nearby_sharing_instantmessaging::StreamBody>
stream_body = GetNextMessage();
while (stream_body) {
DelegateMessage(stream_body.value());
@@ -37,7 +37,7 @@
}
}
-base::Optional<chrome_browser_nearby_sharing_instantmessaging::StreamBody>
+absl::optional<chrome_browser_nearby_sharing_instantmessaging::StreamBody>
StreamParser::GetNextMessage() {
// The incoming stream may not be a valid StreamBody proto as it might be
// split into various OnDataReceived calls. The easy way is to append all
@@ -49,7 +49,7 @@
// TODO(crbug.com/1123172) - Add metrics to figure out which code paths are
// more used and the time taken to parse the incoming messages.
if (data_.empty())
- return base::nullopt;
+ return absl::nullopt;
// There's a good chance that the entire message is a valid proto since the
// individual messages sent by WebRTC are small, so check that first to
@@ -79,7 +79,7 @@
end_pos++;
}
- return base::nullopt;
+ return absl::nullopt;
}
void StreamParser::DelegateMessage(
diff --git a/chrome/browser/nearby_sharing/instantmessaging/stream_parser.h b/chrome/browser/nearby_sharing/instantmessaging/stream_parser.h
index fca03ca..f937489a 100644
--- a/chrome/browser/nearby_sharing/instantmessaging/stream_parser.h
+++ b/chrome/browser/nearby_sharing/instantmessaging/stream_parser.h
@@ -8,8 +8,8 @@
#include <string>
#include "base/callback.h"
-#include "base/optional.h"
#include "base/strings/string_piece.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chrome_browser_nearby_sharing_instantmessaging {
class StreamBody;
@@ -27,7 +27,7 @@
void Append(base::StringPiece data);
private:
- base::Optional<chrome_browser_nearby_sharing_instantmessaging::StreamBody>
+ absl::optional<chrome_browser_nearby_sharing_instantmessaging::StreamBody>
GetNextMessage();
void DelegateMessage(
const chrome_browser_nearby_sharing_instantmessaging::StreamBody&
diff --git a/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_device_data_updater.cc b/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_device_data_updater.cc
index 08d22b52..c3f8005 100644
--- a/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_device_data_updater.cc
+++ b/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_device_data_updater.cc
@@ -11,7 +11,7 @@
FakeNearbyShareDeviceDataUpdater::~FakeNearbyShareDeviceDataUpdater() = default;
void FakeNearbyShareDeviceDataUpdater::RunNextRequest(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
FinishAttempt(response);
}
diff --git a/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_device_data_updater.h b/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_device_data_updater.h
index ba0d24a85..d9b43160 100644
--- a/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_device_data_updater.h
+++ b/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_device_data_updater.h
@@ -10,11 +10,11 @@
#include <vector>
#include "base/containers/queue.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater.h"
#include "chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater_impl.h"
#include "chrome/browser/nearby_sharing/proto/device_rpc.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// An fake implementation of NearbyShareDeviceDataUpdater for use in unit tests.
class FakeNearbyShareDeviceDataUpdater : public NearbyShareDeviceDataUpdater {
@@ -25,7 +25,7 @@
// Advances the request queue and invokes request callback with the input
// parameter |response|.
void RunNextRequest(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response);
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response);
const std::string& device_id() const { return device_id_; }
diff --git a/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_local_device_data_manager.cc b/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_local_device_data_manager.cc
index e53e49d..0690cac 100644
--- a/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_local_device_data_manager.cc
+++ b/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_local_device_data_manager.cc
@@ -69,12 +69,12 @@
return device_name_;
}
-base::Optional<std::string> FakeNearbyShareLocalDeviceDataManager::GetFullName()
+absl::optional<std::string> FakeNearbyShareLocalDeviceDataManager::GetFullName()
const {
return full_name_;
}
-base::Optional<std::string> FakeNearbyShareLocalDeviceDataManager::GetIconUrl()
+absl::optional<std::string> FakeNearbyShareLocalDeviceDataManager::GetIconUrl()
const {
return icon_url_;
}
@@ -119,7 +119,7 @@
std::move(callback));
}
void FakeNearbyShareLocalDeviceDataManager::SetFullName(
- const base::Optional<std::string>& full_name) {
+ const absl::optional<std::string>& full_name) {
if (full_name_ == full_name)
return;
@@ -131,7 +131,7 @@
}
void FakeNearbyShareLocalDeviceDataManager::SetIconUrl(
- const base::Optional<std::string>& icon_url) {
+ const absl::optional<std::string>& icon_url) {
if (icon_url_ == icon_url)
return;
diff --git a/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_local_device_data_manager.h b/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_local_device_data_manager.h
index c94e9bf..c39c2d6 100644
--- a/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_local_device_data_manager.h
+++ b/chrome/browser/nearby_sharing/local_device_data/fake_nearby_share_local_device_data_manager.h
@@ -9,11 +9,11 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager.h"
#include "chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class NearbyShareClientFactory;
class NearbyShareProfileInfoProvider;
@@ -89,8 +89,8 @@
// NearbyShareLocalDeviceDataManager:
std::string GetId() override;
std::string GetDeviceName() const override;
- base::Optional<std::string> GetFullName() const override;
- base::Optional<std::string> GetIconUrl() const override;
+ absl::optional<std::string> GetFullName() const override;
+ absl::optional<std::string> GetIconUrl() const override;
nearby_share::mojom::DeviceNameValidationResult ValidateDeviceName(
const std::string& name) override;
nearby_share::mojom::DeviceNameValidationResult SetDeviceName(
@@ -107,8 +107,8 @@
using NearbyShareLocalDeviceDataManager::NotifyLocalDeviceDataChanged;
void SetId(const std::string& id) { id_ = id; }
- void SetFullName(const base::Optional<std::string>& full_name);
- void SetIconUrl(const base::Optional<std::string>& icon_url);
+ void SetFullName(const absl::optional<std::string>& full_name);
+ void SetIconUrl(const absl::optional<std::string>& icon_url);
size_t num_download_device_data_calls() const {
return num_download_device_data_calls_;
@@ -134,8 +134,8 @@
std::string id_;
std::string device_name_;
- base::Optional<std::string> full_name_;
- base::Optional<std::string> icon_url_;
+ absl::optional<std::string> full_name_;
+ absl::optional<std::string> icon_url_;
size_t num_download_device_data_calls_ = 0;
std::vector<UploadContactsCall> upload_contacts_calls_;
std::vector<UploadCertificatesCall> upload_certificates_calls_;
diff --git a/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater.cc b/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater.cc
index e5134b72..69ee3676 100644
--- a/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater.cc
+++ b/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater.cc
@@ -8,8 +8,8 @@
#include "chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater.h"
NearbyShareDeviceDataUpdater::Request::Request(
- base::Optional<std::vector<nearbyshare::proto::Contact>> contacts,
- base::Optional<std::vector<nearbyshare::proto::PublicCertificate>>
+ absl::optional<std::vector<nearbyshare::proto::Contact>> contacts,
+ absl::optional<std::vector<nearbyshare::proto::PublicCertificate>>
certificates,
ResultCallback callback)
: contacts(std::move(contacts)),
@@ -32,8 +32,8 @@
NearbyShareDeviceDataUpdater::~NearbyShareDeviceDataUpdater() = default;
void NearbyShareDeviceDataUpdater::UpdateDeviceData(
- base::Optional<std::vector<nearbyshare::proto::Contact>> contacts,
- base::Optional<std::vector<nearbyshare::proto::PublicCertificate>>
+ absl::optional<std::vector<nearbyshare::proto::Contact>> contacts,
+ absl::optional<std::vector<nearbyshare::proto::PublicCertificate>>
certificates,
ResultCallback callback) {
pending_requests_.emplace(std::move(contacts), std::move(certificates),
@@ -50,7 +50,7 @@
}
void NearbyShareDeviceDataUpdater::FinishAttempt(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
DCHECK(is_request_in_progress_);
DCHECK(!pending_requests_.empty());
diff --git a/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater.h b/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater.h
index 07c8941..207a063 100644
--- a/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater.h
+++ b/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater.h
@@ -9,9 +9,9 @@
#include "base/callback.h"
#include "base/containers/queue.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/proto/device_rpc.pb.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Manages a queue of data needed to make UpdateDevice RPC requests to the
// Nearby Server. Implementations should make the actual HTTP calls by
@@ -30,14 +30,14 @@
// the number of UpdateDevice RPC calls.
class NearbyShareDeviceDataUpdater {
public:
- // If the request is unsuccessful, |response| is base::nullopt.
+ // If the request is unsuccessful, |response| is absl::nullopt.
using ResultCallback = base::OnceCallback<void(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>&
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>&
response)>;
struct Request {
- Request(base::Optional<std::vector<nearbyshare::proto::Contact>> contacts,
- base::Optional<std::vector<nearbyshare::proto::PublicCertificate>>
+ Request(absl::optional<std::vector<nearbyshare::proto::Contact>> contacts,
+ absl::optional<std::vector<nearbyshare::proto::PublicCertificate>>
certificates,
ResultCallback callback);
Request(Request&& request);
@@ -46,8 +46,8 @@
Request& operator=(const Request&) = delete;
~Request();
- base::Optional<std::vector<nearbyshare::proto::Contact>> contacts;
- base::Optional<std::vector<nearbyshare::proto::PublicCertificate>>
+ absl::optional<std::vector<nearbyshare::proto::Contact>> contacts;
+ absl::optional<std::vector<nearbyshare::proto::PublicCertificate>>
certificates;
ResultCallback callback;
};
@@ -59,7 +59,7 @@
virtual ~NearbyShareDeviceDataUpdater();
// Queue up an UpdateDevice RPC request to update the following fields on the
- // Nearby server if the parameter is not base::nullopt:
+ // Nearby server if the parameter is not absl::nullopt:
//
// |contacts|: The list of contacts that the Nearby server will send
// all-contacts-visibility certificates to. Contacts marked
@@ -70,10 +70,10 @@
// distribute to the appropriate |contacts|.
//
// If only the UpdateDevice RPC response data is desired, set all
- // aforementioned parameters to base::nullopt.
+ // aforementioned parameters to absl::nullopt.
void UpdateDeviceData(
- base::Optional<std::vector<nearbyshare::proto::Contact>> contacts,
- base::Optional<std::vector<nearbyshare::proto::PublicCertificate>>
+ absl::optional<std::vector<nearbyshare::proto::Contact>> contacts,
+ absl::optional<std::vector<nearbyshare::proto::PublicCertificate>>
certificates,
ResultCallback callback);
@@ -81,9 +81,9 @@
void ProcessRequestQueue();
virtual void HandleNextRequest() = 0;
- // If the request is unsuccessful, |response| is base::nullopt.
+ // If the request is unsuccessful, |response| is absl::nullopt.
void FinishAttempt(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response);
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response);
std::string device_id_;
bool is_request_in_progress_ = false;
diff --git a/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater_impl.cc b/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater_impl.cc
index 0c979648..b15ec2a 100644
--- a/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater_impl.cc
+++ b/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater_impl.cc
@@ -100,11 +100,11 @@
timer_.Stop();
client_.reset();
RecordResultMetrics(NearbyShareHttpErrorToResult(error));
- FinishAttempt(/*response=*/base::nullopt);
+ FinishAttempt(/*response=*/absl::nullopt);
}
void NearbyShareDeviceDataUpdaterImpl::OnTimeout() {
client_.reset();
RecordResultMetrics(NearbyShareHttpResult::kTimeout);
- FinishAttempt(/*response=*/base::nullopt);
+ FinishAttempt(/*response=*/absl::nullopt);
}
diff --git a/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater_impl_unittest.cc b/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater_impl_unittest.cc
index 6ac1392..349e0fc5 100644
--- a/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater_impl_unittest.cc
+++ b/chrome/browser/nearby_sharing/local_device_data/nearby_share_device_data_updater_impl_unittest.cc
@@ -8,7 +8,6 @@
#include "base/containers/contains.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/test/task_environment.h"
#include "base/time/clock.h"
#include "base/time/time.h"
@@ -18,6 +17,7 @@
#include "chrome/browser/nearby_sharing/proto/device_rpc.pb.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -67,9 +67,9 @@
}
void VerifyRequest(
- const base::Optional<std::vector<nearbyshare::proto::Contact>>&
+ const absl::optional<std::vector<nearbyshare::proto::Contact>>&
expected_contacts,
- const base::Optional<std::vector<nearbyshare::proto::PublicCertificate>>&
+ const absl::optional<std::vector<nearbyshare::proto::PublicCertificate>>&
expected_certificates,
const nearbyshare::proto::UpdateDeviceRequest& request) {
std::vector<std::string> field_mask{request.update_mask().paths().begin(),
@@ -111,9 +111,9 @@
}
void VerifyResponse(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>&
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>&
expected_response,
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
if (expected_response) {
ASSERT_TRUE(response);
EXPECT_EQ(expected_response->SerializeAsString(),
@@ -138,8 +138,8 @@
}
void CallUpdateDeviceData(
- const base::Optional<std::vector<nearbyshare::proto::Contact>>& contacts,
- const base::Optional<std::vector<nearbyshare::proto::PublicCertificate>>&
+ const absl::optional<std::vector<nearbyshare::proto::Contact>>& contacts,
+ const absl::optional<std::vector<nearbyshare::proto::PublicCertificate>>&
certificates) {
updater_->UpdateDeviceData(
contacts, certificates,
@@ -148,9 +148,9 @@
}
void ProcessNextUpdateDeviceDataRequest(
- const base::Optional<std::vector<nearbyshare::proto::Contact>>&
+ const absl::optional<std::vector<nearbyshare::proto::Contact>>&
expected_contacts,
- const base::Optional<std::vector<nearbyshare::proto::PublicCertificate>>&
+ const absl::optional<std::vector<nearbyshare::proto::PublicCertificate>>&
expected_certificates,
UpdateDeviceRequestResult result) {
// Verify the next request.
@@ -178,8 +178,8 @@
EXPECT_EQ(num_responses + 1, responses_.size());
VerifyResponse(result == UpdateDeviceRequestResult::kSuccess
- ? base::make_optional(TestResponse())
- : base::nullopt,
+ ? absl::make_optional(TestResponse())
+ : absl::nullopt,
responses_.back());
}
@@ -190,25 +190,25 @@
}
// The callback passed into UpdateDeviceData().
- void OnResult(const base::Optional<nearbyshare::proto::UpdateDeviceResponse>&
+ void OnResult(const absl::optional<nearbyshare::proto::UpdateDeviceResponse>&
response) {
responses_.push_back(response);
}
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::TaskEnvironment::TimeSource::MOCK_TIME};
- std::vector<base::Optional<nearbyshare::proto::UpdateDeviceResponse>>
+ std::vector<absl::optional<nearbyshare::proto::UpdateDeviceResponse>>
responses_;
FakeNearbyShareClientFactory fake_client_factory_;
std::unique_ptr<NearbyShareDeviceDataUpdater> updater_;
};
TEST_F(NearbyShareDeviceDataUpdaterImplTest, Success_NoParameters) {
- CallUpdateDeviceData(/*contacts=*/base::nullopt,
- /*certificates=*/base::nullopt);
+ CallUpdateDeviceData(/*contacts=*/absl::nullopt,
+ /*certificates=*/absl::nullopt);
ProcessNextUpdateDeviceDataRequest(
- /*expected_contacts=*/base::nullopt,
- /*expected_certificates=*/base::nullopt,
+ /*expected_contacts=*/absl::nullopt,
+ /*expected_certificates=*/absl::nullopt,
UpdateDeviceRequestResult::kSuccess);
}
@@ -220,9 +220,9 @@
TEST_F(NearbyShareDeviceDataUpdaterImplTest, Success_OneParameter) {
CallUpdateDeviceData(TestContactList(),
- /*certificates=*/base::nullopt);
+ /*certificates=*/absl::nullopt);
ProcessNextUpdateDeviceDataRequest(TestContactList(),
- /*expected_certificates=*/base::nullopt,
+ /*expected_certificates=*/absl::nullopt,
UpdateDeviceRequestResult::kSuccess);
}
@@ -240,19 +240,19 @@
TEST_F(NearbyShareDeviceDataUpdaterImplTest, QueuedRequests) {
// Queue requests while waiting to process.
- CallUpdateDeviceData(/*contacts=*/base::nullopt,
- /*certificates=*/base::nullopt);
+ CallUpdateDeviceData(/*contacts=*/absl::nullopt,
+ /*certificates=*/absl::nullopt);
CallUpdateDeviceData(TestContactList(), TestCertificateList());
- CallUpdateDeviceData(/*contacts=*/base::nullopt, TestCertificateList());
+ CallUpdateDeviceData(/*contacts=*/absl::nullopt, TestCertificateList());
// Requests are processed in the order they are received.
ProcessNextUpdateDeviceDataRequest(
- /*expected_contacts=*/base::nullopt,
- /*expected_certificates=*/base::nullopt,
+ /*expected_contacts=*/absl::nullopt,
+ /*expected_certificates=*/absl::nullopt,
UpdateDeviceRequestResult::kSuccess);
ProcessNextUpdateDeviceDataRequest(TestContactList(), TestCertificateList(),
UpdateDeviceRequestResult::kTimeout);
- ProcessNextUpdateDeviceDataRequest(/*expected_contacts=*/base::nullopt,
+ ProcessNextUpdateDeviceDataRequest(/*expected_contacts=*/absl::nullopt,
TestCertificateList(),
UpdateDeviceRequestResult::kHttpFailure);
}
diff --git a/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager.h b/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager.h
index d11fc740..fd4b8142 100644
--- a/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager.h
+++ b/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager.h
@@ -11,9 +11,9 @@
#include "base/callback.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// The maximum length in bytes allowed for a device name, as encoded in UTF-8 in
// a std::string, which will not contain a null terminator.
@@ -55,13 +55,13 @@
virtual std::string GetDeviceName() const = 0;
// Returns the user's full name, for example, "Barack Obama". Returns
- // base::nullopt if the name has not yet been set from an UpdateDevice RPC
+ // absl::nullopt if the name has not yet been set from an UpdateDevice RPC
// response.
- virtual base::Optional<std::string> GetFullName() const = 0;
+ virtual absl::optional<std::string> GetFullName() const = 0;
- // Returns the URL of the user's image. Returns base::nullopt if the URL has
+ // Returns the URL of the user's image. Returns absl::nullopt if the URL has
// not yet been set from an UpdateDevice RPC response.
- virtual base::Optional<std::string> GetIconUrl() const = 0;
+ virtual absl::optional<std::string> GetIconUrl() const = 0;
// Validates the provided device name and returns an error if validation
// fails. This is just a check and the device name is not persisted.
diff --git a/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl.cc b/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl.cc
index 469a8a3..0647a23 100644
--- a/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl.cc
+++ b/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl.cc
@@ -130,22 +130,22 @@
return device_name.empty() ? GetDefaultDeviceName() : device_name;
}
-base::Optional<std::string> NearbyShareLocalDeviceDataManagerImpl::GetFullName()
+absl::optional<std::string> NearbyShareLocalDeviceDataManagerImpl::GetFullName()
const {
std::string name =
pref_service_->GetString(prefs::kNearbySharingFullNamePrefName);
if (name.empty())
- return base::nullopt;
+ return absl::nullopt;
return name;
}
-base::Optional<std::string> NearbyShareLocalDeviceDataManagerImpl::GetIconUrl()
+absl::optional<std::string> NearbyShareLocalDeviceDataManagerImpl::GetIconUrl()
const {
std::string url =
pref_service_->GetString(prefs::kNearbySharingIconUrlPrefName);
if (url.empty())
- return base::nullopt;
+ return absl::nullopt;
return url;
}
@@ -192,7 +192,7 @@
UploadCompleteCallback callback) {
device_data_updater_->UpdateDeviceData(
std::move(contacts),
- /*certificates=*/base::nullopt,
+ /*certificates=*/absl::nullopt,
base::BindOnce(
&NearbyShareLocalDeviceDataManagerImpl::OnUploadContactsFinished,
base::Unretained(this), std::move(callback)));
@@ -202,7 +202,7 @@
std::vector<nearbyshare::proto::PublicCertificate> certificates,
UploadCompleteCallback callback) {
device_data_updater_->UpdateDeviceData(
- /*contacts=*/base::nullopt, std::move(certificates),
+ /*contacts=*/absl::nullopt, std::move(certificates),
base::BindOnce(
&NearbyShareLocalDeviceDataManagerImpl::OnUploadCertificatesFinished,
base::Unretained(this), std::move(callback)));
@@ -221,7 +221,7 @@
std::string NearbyShareLocalDeviceDataManagerImpl::GetDefaultDeviceName()
const {
std::u16string device_type = ui::GetChromeOSDeviceName();
- base::Optional<std::u16string> given_name =
+ absl::optional<std::u16string> given_name =
profile_info_provider_->GetGivenName();
if (!given_name)
return base::UTF16ToUTF8(device_type);
@@ -241,15 +241,15 @@
void NearbyShareLocalDeviceDataManagerImpl::OnDownloadDeviceDataRequested() {
device_data_updater_->UpdateDeviceData(
- /*contacts=*/base::nullopt,
- /*certificates=*/base::nullopt,
+ /*contacts=*/absl::nullopt,
+ /*certificates=*/absl::nullopt,
base::BindOnce(
&NearbyShareLocalDeviceDataManagerImpl::OnDownloadDeviceDataFinished,
base::Unretained(this)));
}
void NearbyShareLocalDeviceDataManagerImpl::OnDownloadDeviceDataFinished(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
if (response)
HandleUpdateDeviceResponse(response);
@@ -259,7 +259,7 @@
void NearbyShareLocalDeviceDataManagerImpl::OnUploadContactsFinished(
UploadCompleteCallback callback,
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
if (response)
HandleUpdateDeviceResponse(response);
@@ -268,7 +268,7 @@
void NearbyShareLocalDeviceDataManagerImpl::OnUploadCertificatesFinished(
UploadCompleteCallback callback,
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
if (response)
HandleUpdateDeviceResponse(response);
@@ -276,7 +276,7 @@
}
void NearbyShareLocalDeviceDataManagerImpl::HandleUpdateDeviceResponse(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response) {
if (!response)
return;
diff --git a/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl.h b/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl.h
index e730696..3e05811 100644
--- a/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl.h
+++ b/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl.h
@@ -10,11 +10,11 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager.h"
#include "chrome/browser/nearby_sharing/proto/device_rpc.pb.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class NearbyShareClientFactory;
class NearbyShareDeviceDataUpdater;
@@ -60,8 +60,8 @@
// NearbyShareLocalDeviceDataManager:
std::string GetId() override;
std::string GetDeviceName() const override;
- base::Optional<std::string> GetFullName() const override;
- base::Optional<std::string> GetIconUrl() const override;
+ absl::optional<std::string> GetFullName() const override;
+ absl::optional<std::string> GetIconUrl() const override;
nearby_share::mojom::DeviceNameValidationResult ValidateDeviceName(
const std::string& name) override;
nearby_share::mojom::DeviceNameValidationResult SetDeviceName(
@@ -83,15 +83,15 @@
void OnDownloadDeviceDataRequested();
void OnDownloadDeviceDataFinished(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response);
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response);
void OnUploadContactsFinished(
UploadCompleteCallback callback,
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response);
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response);
void OnUploadCertificatesFinished(
UploadCompleteCallback callback,
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response);
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response);
void HandleUpdateDeviceResponse(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>& response);
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>& response);
PrefService* pref_service_ = nullptr;
NearbyShareProfileInfoProvider* profile_info_provider_ = nullptr;
diff --git a/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl_unittest.cc b/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl_unittest.cc
index bc7ddf1..c043d1e 100644
--- a/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl_unittest.cc
+++ b/chrome/browser/nearby_sharing/local_device_data/nearby_share_local_device_data_manager_impl_unittest.cc
@@ -6,7 +6,6 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "chrome/browser/nearby_sharing/client/fake_nearby_share_client.h"
@@ -23,6 +22,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/chromeos/devicetype_utils.h"
@@ -40,8 +40,8 @@
"this is a 33-...'s Chrome device";
nearbyshare::proto::UpdateDeviceResponse CreateResponse(
- const base::Optional<std::string>& full_name,
- const base::Optional<std::string>& icon_url) {
+ const absl::optional<std::string>& full_name,
+ const absl::optional<std::string>& icon_url) {
nearbyshare::proto::UpdateDeviceResponse response;
if (full_name)
response.set_person_name(*full_name);
@@ -132,7 +132,7 @@
}
void DownloadDeviceData(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>&
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>&
response) {
manager_->DownloadDeviceData();
@@ -154,12 +154,12 @@
}
void UploadContacts(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>&
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>&
response) {
- base::Optional<bool> returned_success;
+ absl::optional<bool> returned_success;
manager_->UploadContacts(
GetFakeContacts(),
- base::BindOnce([](base::Optional<bool>* returned_success,
+ base::BindOnce([](absl::optional<bool>* returned_success,
bool success) { *returned_success = success; },
&returned_success));
@@ -181,12 +181,12 @@
}
void UploadCertificates(
- const base::Optional<nearbyshare::proto::UpdateDeviceResponse>&
+ const absl::optional<nearbyshare::proto::UpdateDeviceResponse>&
response) {
- base::Optional<bool> returned_success;
+ absl::optional<bool> returned_success;
manager_->UploadCertificates(
GetFakeCertificates(),
- base::BindOnce([](base::Optional<bool>* returned_success,
+ base::BindOnce([](absl::optional<bool>* returned_success,
bool success) { *returned_success = success; },
&returned_success));
@@ -276,7 +276,7 @@
CreateManager();
// If given name is null, only return the device type.
- profile_info_provider()->set_given_name(base::nullopt);
+ profile_info_provider()->set_given_name(absl::nullopt);
EXPECT_EQ(base::UTF16ToUTF8(ui::GetChromeOSDeviceName()),
manager()->GetDeviceName());
@@ -374,11 +374,11 @@
TEST_F(NearbyShareLocalDeviceDataManagerImplTest, DownloadDeviceData_Failure) {
CreateManager();
- DownloadDeviceData(/*response=*/base::nullopt);
+ DownloadDeviceData(/*response=*/absl::nullopt);
// No full name or icon URL set because response was null.
- EXPECT_EQ(base::nullopt, manager()->GetFullName());
- EXPECT_EQ(base::nullopt, manager()->GetIconUrl());
+ EXPECT_EQ(absl::nullopt, manager()->GetFullName());
+ EXPECT_EQ(absl::nullopt, manager()->GetIconUrl());
EXPECT_TRUE(notifications().empty());
}
@@ -399,11 +399,11 @@
TEST_F(NearbyShareLocalDeviceDataManagerImplTest, UploadContacts_Failure) {
CreateManager();
- UploadContacts(/*response=*/base::nullopt);
+ UploadContacts(/*response=*/absl::nullopt);
// No full name or icon URL set because response was null.
- EXPECT_EQ(base::nullopt, manager()->GetFullName());
- EXPECT_EQ(base::nullopt, manager()->GetIconUrl());
+ EXPECT_EQ(absl::nullopt, manager()->GetFullName());
+ EXPECT_EQ(absl::nullopt, manager()->GetIconUrl());
EXPECT_TRUE(notifications().empty());
}
@@ -424,10 +424,10 @@
TEST_F(NearbyShareLocalDeviceDataManagerImplTest, UploadCertificates_Failure) {
CreateManager();
- UploadCertificates(/*response=*/base::nullopt);
+ UploadCertificates(/*response=*/absl::nullopt);
// No full name or icon URL set because response was null.
- EXPECT_EQ(base::nullopt, manager()->GetFullName());
- EXPECT_EQ(base::nullopt, manager()->GetIconUrl());
+ EXPECT_EQ(absl::nullopt, manager()->GetFullName());
+ EXPECT_EQ(absl::nullopt, manager()->GetIconUrl());
EXPECT_TRUE(notifications().empty());
}
diff --git a/chrome/browser/nearby_sharing/nearby_connection.h b/chrome/browser/nearby_sharing/nearby_connection.h
index 1450a0f..17ed2fd 100644
--- a/chrome/browser/nearby_sharing/nearby_connection.h
+++ b/chrome/browser/nearby_sharing/nearby_connection.h
@@ -10,14 +10,14 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A socket-like wrapper around Nearby Connections that allows for asynchronous
// reads and writes.
class NearbyConnection {
public:
using ReadCallback =
- base::OnceCallback<void(base::Optional<std::vector<uint8_t>> bytes)>;
+ base::OnceCallback<void(absl::optional<std::vector<uint8_t>> bytes)>;
virtual ~NearbyConnection() = default;
diff --git a/chrome/browser/nearby_sharing/nearby_connection_impl.cc b/chrome/browser/nearby_sharing/nearby_connection_impl.cc
index ab41abd..c64379c 100644
--- a/chrome/browser/nearby_sharing/nearby_connection_impl.cc
+++ b/chrome/browser/nearby_sharing/nearby_connection_impl.cc
@@ -19,7 +19,7 @@
std::move(disconnect_listener_).Run();
if (read_callback_)
- std::move(read_callback_).Run(base::nullopt);
+ std::move(read_callback_).Run(absl::nullopt);
}
void NearbyConnectionImpl::Read(ReadCallback callback) {
diff --git a/chrome/browser/nearby_sharing/nearby_connections_manager.h b/chrome/browser/nearby_sharing/nearby_connections_manager.h
index a842ca0..5b78247 100644
--- a/chrome/browser/nearby_sharing/nearby_connections_manager.h
+++ b/chrome/browser/nearby_sharing/nearby_connections_manager.h
@@ -12,10 +12,10 @@
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/common/nearby_share_enums.h"
#include "chrome/browser/nearby_sharing/nearby_connection.h"
#include "chromeos/services/nearby/public/mojom/nearby_connections_types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A wrapper around the Nearby Connections mojo API.
class NearbyConnectionsManager {
@@ -67,10 +67,10 @@
base::WeakPtr<PayloadStatusListener> GetWeakPtr() const;
// Note: |upgraded_medium| is passed in for use in metrics, and it is
- // base::nullopt if the bandwidth has not upgraded yet or if the upgrade
+ // absl::nullopt if the bandwidth has not upgraded yet or if the upgrade
// status is not known.
virtual void OnStatusUpdate(PayloadTransferUpdatePtr update,
- base::Optional<Medium> upgraded_medium) = 0;
+ absl::optional<Medium> upgraded_medium) = 0;
base::WeakPtrFactory<PayloadStatusListener> weak_ptr_factory_{this};
};
@@ -109,7 +109,7 @@
virtual void Connect(
std::vector<uint8_t> endpoint_info,
const std::string& endpoint_id,
- base::Optional<std::vector<uint8_t>> bluetooth_mac_address,
+ absl::optional<std::vector<uint8_t>> bluetooth_mac_address,
DataUsage data_usage,
NearbyConnectionCallback callback) = 0;
@@ -141,7 +141,7 @@
virtual void ClearIncomingPayloads() = 0;
// Gets the raw authentication token for the |endpoint_id|.
- virtual base::Optional<std::vector<uint8_t>> GetRawAuthenticationToken(
+ virtual absl::optional<std::vector<uint8_t>> GetRawAuthenticationToken(
const std::string& endpoint_id) = 0;
// Initiates bandwidth upgrade for |endpoint_id|.
diff --git a/chrome/browser/nearby_sharing/nearby_connections_manager_impl.cc b/chrome/browser/nearby_sharing/nearby_connections_manager_impl.cc
index d712d64..3971eb42 100644
--- a/chrome/browser/nearby_sharing/nearby_connections_manager_impl.cc
+++ b/chrome/browser/nearby_sharing/nearby_connections_manager_impl.cc
@@ -222,7 +222,7 @@
void NearbyConnectionsManagerImpl::Connect(
std::vector<uint8_t> endpoint_info,
const std::string& endpoint_id,
- base::Optional<std::vector<uint8_t>> bluetooth_mac_address,
+ absl::optional<std::vector<uint8_t>> bluetooth_mac_address,
DataUsage data_usage,
NearbyConnectionCallback callback) {
// TODO(https://crbug.com/1177088): Determine if we should attempt to bind to
@@ -397,7 +397,7 @@
PayloadTransferUpdate::New(payload_id, PayloadStatus::kCanceled,
/*total_bytes=*/0,
/*bytes_transferred=*/0),
- /*upgraded_medium=*/base::nullopt);
+ /*upgraded_medium=*/absl::nullopt);
}
}
@@ -425,12 +425,12 @@
incoming_payloads_.clear();
}
-base::Optional<std::vector<uint8_t>>
+absl::optional<std::vector<uint8_t>>
NearbyConnectionsManagerImpl::GetRawAuthenticationToken(
const std::string& endpoint_id) {
auto it = connection_info_map_.find(endpoint_id);
if (it == connection_info_map_.end())
- return base::nullopt;
+ return absl::nullopt;
return it->second->raw_authentication_token;
}
@@ -744,12 +744,12 @@
pending_outgoing_connections_.clear();
}
-base::Optional<location::nearby::connections::mojom::Medium>
+absl::optional<location::nearby::connections::mojom::Medium>
NearbyConnectionsManagerImpl::GetUpgradedMedium(
const std::string& endpoint_id) const {
const auto it = current_upgraded_mediums_.find(endpoint_id);
if (it == current_upgraded_mediums_.end())
- return base::nullopt;
+ return absl::nullopt;
return it->second;
}
diff --git a/chrome/browser/nearby_sharing/nearby_connections_manager_impl.h b/chrome/browser/nearby_sharing/nearby_connections_manager_impl.h
index 4dd6b544..2f2fa16c 100644
--- a/chrome/browser/nearby_sharing/nearby_connections_manager_impl.h
+++ b/chrome/browser/nearby_sharing/nearby_connections_manager_impl.h
@@ -48,7 +48,7 @@
void StopDiscovery() override;
void Connect(std::vector<uint8_t> endpoint_info,
const std::string& endpoint_id,
- base::Optional<std::vector<uint8_t>> bluetooth_mac_address,
+ absl::optional<std::vector<uint8_t>> bluetooth_mac_address,
DataUsage data_usage,
NearbyConnectionCallback callback) override;
void Disconnect(const std::string& endpoint_id) override;
@@ -64,7 +64,7 @@
Payload* GetIncomingPayload(int64_t payload_id) override;
void Cancel(int64_t payload_id) override;
void ClearIncomingPayloads() override;
- base::Optional<std::vector<uint8_t>> GetRawAuthenticationToken(
+ absl::optional<std::vector<uint8_t>> GetRawAuthenticationToken(
const std::string& endpoint_id) override;
void UpgradeBandwidth(const std::string& endpoint_id) override;
@@ -132,7 +132,7 @@
NearbyFileHandler::CreateFileResult result);
// For metrics.
- base::Optional<Medium> GetUpgradedMedium(
+ absl::optional<Medium> GetUpgradedMedium(
const std::string& endpoint_id) const;
chromeos::nearby::NearbyProcessManager* process_manager_;
diff --git a/chrome/browser/nearby_sharing/nearby_connections_manager_impl_unittest.cc b/chrome/browser/nearby_sharing/nearby_connections_manager_impl_unittest.cc
index a415bbab..84855df 100644
--- a/chrome/browser/nearby_sharing/nearby_connections_manager_impl_unittest.cc
+++ b/chrome/browser/nearby_sharing/nearby_connections_manager_impl_unittest.cc
@@ -126,7 +126,7 @@
MOCK_METHOD(void,
OnStatusUpdate,
(PayloadTransferUpdatePtr update,
- base::Optional<Medium> upgraded_medium),
+ absl::optional<Medium> upgraded_medium),
(override));
};
@@ -260,7 +260,7 @@
NearbyConnection* nearby_connection;
nearby_connections_manager_.Connect(
local_endpoint_info, kRemoteEndpointId,
- /*bluetooth_mac_address=*/base::nullopt, DataUsage::kOffline,
+ /*bluetooth_mac_address=*/absl::nullopt, DataUsage::kOffline,
base::BindLambdaForTesting([&](NearbyConnection* connection) {
nearby_connection = connection;
}));
@@ -571,7 +571,7 @@
});
nearby_connections_manager_.Connect(local_endpoint_info, kRemoteEndpointId,
- /*bluetooth_mac_address=*/base::nullopt,
+ /*bluetooth_mac_address=*/absl::nullopt,
data_usage, base::DoNothing());
run_loop.Run();
@@ -596,18 +596,18 @@
// Begin: NearbyConnectionsManagerImplTestConnectionBluetoothMacAddress
/******************************************************************************/
struct ConnectionBluetoothMacAddressTestData {
- base::Optional<std::vector<uint8_t>> bluetooth_mac_address;
- base::Optional<std::vector<uint8_t>> expected_bluetooth_mac_address;
+ absl::optional<std::vector<uint8_t>> bluetooth_mac_address;
+ absl::optional<std::vector<uint8_t>> expected_bluetooth_mac_address;
} kConnectionBluetoothMacAddressTestData[] = {
- {base::make_optional(std::vector<uint8_t>(std::begin(kBluetoothMacAddress),
+ {absl::make_optional(std::vector<uint8_t>(std::begin(kBluetoothMacAddress),
std::end(kBluetoothMacAddress))),
- base::make_optional(std::vector<uint8_t>(std::begin(kBluetoothMacAddress),
+ absl::make_optional(std::vector<uint8_t>(std::begin(kBluetoothMacAddress),
std::end(kBluetoothMacAddress)))},
- {base::make_optional(
+ {absl::make_optional(
std::vector<uint8_t>(std::begin(kInvalidBluetoothMacAddress),
std::end(kInvalidBluetoothMacAddress))),
- base::nullopt},
- {base::nullopt, base::nullopt}};
+ absl::nullopt},
+ {absl::nullopt, absl::nullopt}};
class NearbyConnectionsManagerImplTestConnectionBluetoothMacAddress
: public NearbyConnectionsManagerImplTest,
@@ -730,7 +730,7 @@
// Read before message is appended should also succeed.
base::RunLoop read_run_loop;
nearby_connection->Read(base::BindLambdaForTesting(
- [&](base::Optional<std::vector<uint8_t>> bytes) {
+ [&](absl::optional<std::vector<uint8_t>> bytes) {
EXPECT_EQ(byte_payload, bytes);
read_run_loop.Quit();
}));
@@ -785,7 +785,7 @@
base::RunLoop read_run_loop;
nearby_connection->Read(base::BindLambdaForTesting(
- [&](base::Optional<std::vector<uint8_t>> bytes) {
+ [&](absl::optional<std::vector<uint8_t>> bytes) {
EXPECT_EQ(byte_payload, bytes);
read_run_loop.Quit();
}));
@@ -793,7 +793,7 @@
base::RunLoop read_run_loop_2;
nearby_connection->Read(base::BindLambdaForTesting(
- [&](base::Optional<std::vector<uint8_t>> bytes) {
+ [&](absl::optional<std::vector<uint8_t>> bytes) {
EXPECT_EQ(byte_payload_2, bytes);
read_run_loop_2.Quit();
}));
@@ -857,7 +857,7 @@
base::BindLambdaForTesting([&]() { close_run_loop.Quit(); }));
base::RunLoop read_run_loop_3;
nearby_connection->Read(base::BindLambdaForTesting(
- [&](base::Optional<std::vector<uint8_t>> bytes) {
+ [&](absl::optional<std::vector<uint8_t>> bytes) {
EXPECT_FALSE(bytes);
read_run_loop_3.Quit();
}));
@@ -901,7 +901,7 @@
base::BindLambdaForTesting([&]() { close_run_loop.Quit(); }));
base::RunLoop read_run_loop;
nearby_connection->Read(base::BindLambdaForTesting(
- [&](base::Optional<std::vector<uint8_t>> bytes) {
+ [&](absl::optional<std::vector<uint8_t>> bytes) {
EXPECT_FALSE(bytes);
read_run_loop.Quit();
}));
@@ -934,7 +934,7 @@
base::BindLambdaForTesting([&]() { close_run_loop.Quit(); }));
base::RunLoop read_run_loop;
nearby_connection->Read(base::BindLambdaForTesting(
- [&](base::Optional<std::vector<uint8_t>> bytes) {
+ [&](absl::optional<std::vector<uint8_t>> bytes) {
EXPECT_FALSE(bytes);
read_run_loop.Quit();
}));
@@ -978,9 +978,9 @@
base::RunLoop payload_run_loop;
EXPECT_CALL(payload_listener, OnStatusUpdate(testing::_, testing::_))
.WillOnce([&](MockPayloadStatusListener::PayloadTransferUpdatePtr update,
- base::Optional<Medium> upgraded_medium) {
+ absl::optional<Medium> upgraded_medium) {
EXPECT_EQ(expected_update, update);
- EXPECT_EQ(base::nullopt, upgraded_medium);
+ EXPECT_EQ(absl::nullopt, upgraded_medium);
payload_run_loop.Quit();
});
@@ -1018,12 +1018,12 @@
base::RunLoop payload_run_loop;
EXPECT_CALL(payload_listener, OnStatusUpdate(testing::_, testing::_))
.WillOnce([&](MockPayloadStatusListener::PayloadTransferUpdatePtr update,
- base::Optional<Medium> upgraded_medium) {
+ absl::optional<Medium> upgraded_medium) {
EXPECT_EQ(kPayloadId, update->payload_id);
EXPECT_EQ(PayloadStatus::kCanceled, update->status);
EXPECT_EQ(0u, update->total_bytes);
EXPECT_EQ(0u, update->bytes_transferred);
- EXPECT_EQ(base::nullopt, upgraded_medium);
+ EXPECT_EQ(absl::nullopt, upgraded_medium);
payload_run_loop.Quit();
});
@@ -1081,12 +1081,12 @@
EXPECT_CALL(*payload_listener, OnStatusUpdate(testing::_, testing::_))
.Times(1)
.WillOnce([&](MockPayloadStatusListener::PayloadTransferUpdatePtr update,
- base::Optional<Medium> upgraded_medium) {
+ absl::optional<Medium> upgraded_medium) {
EXPECT_EQ(kPayloadId, update->payload_id);
EXPECT_EQ(PayloadStatus::kCanceled, update->status);
EXPECT_EQ(0u, update->total_bytes);
EXPECT_EQ(0u, update->bytes_transferred);
- EXPECT_EQ(base::nullopt, upgraded_medium);
+ EXPECT_EQ(absl::nullopt, upgraded_medium);
// Destroy the PayloadStatusListener after the first payload is
// cancelled.
@@ -1142,7 +1142,7 @@
NearbyConnection* nearby_connection = nullptr;
nearby_connections_manager_.Connect(
local_endpoint_info, kRemoteEndpointId,
- /*bluetooth_mac_address=*/base::nullopt, DataUsage::kOffline,
+ /*bluetooth_mac_address=*/absl::nullopt, DataUsage::kOffline,
base::BindLambdaForTesting([&](NearbyConnection* connection) {
nearby_connection = connection;
run_loop.Quit();
@@ -1192,9 +1192,9 @@
base::RunLoop payload_run_loop;
EXPECT_CALL(payload_listener, OnStatusUpdate(testing::_, testing::_))
.WillOnce([&](MockPayloadStatusListener::PayloadTransferUpdatePtr update,
- base::Optional<Medium> upgraded_medium) {
+ absl::optional<Medium> upgraded_medium) {
EXPECT_EQ(expected_update, update);
- EXPECT_EQ(base::nullopt, upgraded_medium);
+ EXPECT_EQ(absl::nullopt, upgraded_medium);
payload_run_loop.Quit();
});
@@ -1280,12 +1280,12 @@
EXPECT_CALL(*payload_listener, OnStatusUpdate(testing::_, testing::_))
.Times(1)
.WillOnce([&](MockPayloadStatusListener::PayloadTransferUpdatePtr update,
- base::Optional<Medium> upgraded_medium) {
+ absl::optional<Medium> upgraded_medium) {
EXPECT_EQ(kPayloadId, update->payload_id);
EXPECT_EQ(PayloadStatus::kFailure, update->status);
EXPECT_EQ(kTotalSize, update->total_bytes);
EXPECT_EQ(0u, update->bytes_transferred);
- EXPECT_EQ(base::nullopt, upgraded_medium);
+ EXPECT_EQ(absl::nullopt, upgraded_medium);
// Destroy the PayloadStatusListener after the first payload fails.
payload_listener.reset();
@@ -1313,7 +1313,7 @@
// outstanding Read() callback if there are no bytes to read.
base::RunLoop read_run_loop;
connection->Read(base::BindLambdaForTesting(
- [&](base::Optional<std::vector<uint8_t>> bytes) {
+ [&](absl::optional<std::vector<uint8_t>> bytes) {
EXPECT_FALSE(bytes);
read_run_loop.Quit();
}));
@@ -1653,7 +1653,7 @@
NearbyConnection* nearby_connection;
nearby_connections_manager_.Connect(
local_endpoint_info, kRemoteEndpointId,
- /*bluetooth_mac_address=*/base::nullopt, DataUsage::kOffline,
+ /*bluetooth_mac_address=*/absl::nullopt, DataUsage::kOffline,
base::BindLambdaForTesting([&](NearbyConnection* connection) {
nearby_connection = connection;
connect_run_loop.Quit();
diff --git a/chrome/browser/nearby_sharing/nearby_notification_delegate.h b/chrome/browser/nearby_sharing/nearby_notification_delegate.h
index f9a757d..f8688cf 100644
--- a/chrome/browser/nearby_sharing/nearby_notification_delegate.h
+++ b/chrome/browser/nearby_sharing/nearby_notification_delegate.h
@@ -7,7 +7,7 @@
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Notification delegate that handles specific click and close events.
class NearbyNotificationDelegate {
@@ -19,7 +19,7 @@
// When the click is on the notification itself |action_index| is nullopt.
// Otherwise |action_index| contains the index of the pressed button.
virtual void OnClick(const std::string& notification_id,
- const base::Optional<int>& action_index) = 0;
+ const absl::optional<int>& action_index) = 0;
// Called when the notification with |notification_id| got closed by either
// the user, the system or Chrome itself.
diff --git a/chrome/browser/nearby_sharing/nearby_notification_handler.cc b/chrome/browser/nearby_sharing/nearby_notification_handler.cc
index d6adcee..ce14dd7 100644
--- a/chrome/browser/nearby_sharing/nearby_notification_handler.cc
+++ b/chrome/browser/nearby_sharing/nearby_notification_handler.cc
@@ -49,8 +49,8 @@
Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) {
NearbyNotificationDelegate* delegate =
GetNotificationDelegate(profile, notification_id);
diff --git a/chrome/browser/nearby_sharing/nearby_notification_handler.h b/chrome/browser/nearby_sharing/nearby_notification_handler.h
index 14e9a488..c6a4206 100644
--- a/chrome/browser/nearby_sharing/nearby_notification_handler.h
+++ b/chrome/browser/nearby_sharing/nearby_notification_handler.h
@@ -8,8 +8,8 @@
#include <string>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/notifications/notification_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class Profile;
@@ -27,8 +27,8 @@
void OnClick(Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) override;
void OnClose(Profile* profile,
const GURL& origin,
diff --git a/chrome/browser/nearby_sharing/nearby_notification_manager.cc b/chrome/browser/nearby_sharing/nearby_notification_manager.cc
index 0d0d71c..b0d5333 100644
--- a/chrome/browser/nearby_sharing/nearby_notification_manager.cc
+++ b/chrome/browser/nearby_sharing/nearby_notification_manager.cc
@@ -218,7 +218,7 @@
/*use_capitalized_attachments=*/false);
}
-base::Optional<std::u16string> GetFailureNotificationMessage(
+absl::optional<std::u16string> GetFailureNotificationMessage(
TransferMetadata::Status status) {
switch (status) {
case TransferMetadata::Status::kTimedOut:
@@ -228,7 +228,7 @@
case TransferMetadata::Status::kUnsupportedAttachmentType:
return l10n_util::GetStringUTF16(IDS_NEARBY_ERROR_UNSUPPORTED_FILE_TYPE);
default:
- return base::nullopt;
+ return absl::nullopt;
}
}
@@ -293,7 +293,7 @@
// NearbyNotificationDelegate:
void OnClick(const std::string& notification_id,
- const base::Optional<int>& action_index) override {
+ const absl::optional<int>& action_index) override {
// Clicking on the notification is a noop.
if (!action_index)
return;
@@ -333,7 +333,7 @@
// NearbyNotificationDelegate:
void OnClick(const std::string& notification_id,
- const base::Optional<int>& action_index) override {
+ const absl::optional<int>& action_index) override {
// Clicking on the notification is a noop.
if (!action_index)
return;
@@ -367,7 +367,7 @@
: callback_(std::move(callback)) {}
~ReceivedImageDecoder() override = default;
- void DecodeImage(const base::Optional<base::FilePath>& image_path) {
+ void DecodeImage(const absl::optional<base::FilePath>& image_path) {
if (!image_path) {
OnDecodeImageFailed();
return;
@@ -431,7 +431,7 @@
// NearbyNotificationDelegate:
void OnClick(const std::string& notification_id,
- const base::Optional<int>& action_index) override {
+ const absl::optional<int>& action_index) override {
switch (type_) {
case NearbyNotificationManager::ReceivedContentType::kText:
if (action_index.has_value() && action_index.value() == 0) {
@@ -537,7 +537,7 @@
// NearbyNotificationDelegate:
void OnClick(const std::string& notification_id,
- const base::Optional<int>& action_index) override {
+ const absl::optional<int>& action_index) override {
manager_->OnOnboardingClicked();
}
@@ -572,7 +572,7 @@
}
bool ShouldClearNotification(
- base::Optional<TransferMetadata::Status> last_status,
+ absl::optional<TransferMetadata::Status> last_status,
TransferMetadata::Status new_status) {
if (!last_status)
return true;
@@ -713,8 +713,8 @@
*share_target_,
TransferMetadataBuilder().set_status(*last_transfer_status_).build());
}
- share_target_ = base::nullopt;
- last_transfer_status_ = base::nullopt;
+ share_target_ = absl::nullopt;
+ last_transfer_status_ = absl::nullopt;
}
void NearbyNotificationManager::ShowProgress(
@@ -900,7 +900,7 @@
CreateNearbyNotification(kNearbyNotificationId);
notification.set_title(GetFailureNotificationTitle(share_target));
- base::Optional<std::u16string> message =
+ absl::optional<std::u16string> message =
GetFailureNotificationMessage(transfer_metadata.status());
if (message) {
notification.set_message(*message);
diff --git a/chrome/browser/nearby_sharing/nearby_notification_manager.h b/chrome/browser/nearby_sharing/nearby_notification_manager.h
index ea8cad7..1bbcad5 100644
--- a/chrome/browser/nearby_sharing/nearby_notification_manager.h
+++ b/chrome/browser/nearby_sharing/nearby_notification_manager.h
@@ -7,7 +7,6 @@
#include "base/containers/flat_map.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/nearby_notification_delegate.h"
#include "chrome/browser/nearby_sharing/nearby_sharing_service.h"
@@ -16,6 +15,7 @@
#include "chrome/browser/nearby_sharing/transfer_metadata.h"
#include "chrome/browser/nearby_sharing/transfer_metadata_builder.h"
#include "chrome/browser/nearby_sharing/transfer_update_callback.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class NotificationDisplayService;
class PrefService;
@@ -143,11 +143,11 @@
delegate_map_;
// ShareTarget of the current transfer.
- base::Optional<ShareTarget> share_target_;
+ absl::optional<ShareTarget> share_target_;
// Last transfer status reported to OnTransferUpdate(). Null when no transfer
// is in progress.
- base::Optional<TransferMetadata::Status> last_transfer_status_;
+ absl::optional<TransferMetadata::Status> last_transfer_status_;
base::OnceCallback<void(SuccessNotificationAction)>
success_action_test_callback_;
diff --git a/chrome/browser/nearby_sharing/nearby_notification_manager_unittest.cc b/chrome/browser/nearby_sharing/nearby_notification_manager_unittest.cc
index 1f7dbd0..9f2fcac 100644
--- a/chrome/browser/nearby_sharing/nearby_notification_manager_unittest.cc
+++ b/chrome/browser/nearby_sharing/nearby_notification_manager_unittest.cc
@@ -70,13 +70,13 @@
}
TextAttachment CreateTextAttachment(TextAttachment::Type type) {
- return TextAttachment(type, kTextBody, /*title=*/base::nullopt,
- /*mime_type=*/base::nullopt);
+ return TextAttachment(type, kTextBody, /*title=*/absl::nullopt,
+ /*mime_type=*/absl::nullopt);
}
TextAttachment CreateUrlAttachment() {
return TextAttachment(TextAttachment::Type::kUrl, kTextUrl,
- /*title=*/base::nullopt, /*mime_type=*/base::nullopt);
+ /*title=*/absl::nullopt, /*mime_type=*/absl::nullopt);
}
FileAttachment CreateFileAttachment(FileAttachment::Type type) {
@@ -525,8 +525,8 @@
for (FileAttachment::Type type : param.file_attachments)
share_target.file_attachments.push_back(CreateFileAttachment(type));
- for (base::Optional<std::pair<TransferMetadata::Status, int>> error :
- std::vector<base::Optional<std::pair<TransferMetadata::Status, int>>>{
+ for (absl::optional<std::pair<TransferMetadata::Status, int>> error :
+ std::vector<absl::optional<std::pair<TransferMetadata::Status, int>>>{
std::make_pair(TransferMetadata::Status::kNotEnoughSpace,
IDS_NEARBY_ERROR_NOT_ENOUGH_SPACE),
std::make_pair(TransferMetadata::Status::kTimedOut,
@@ -534,7 +534,7 @@
std::make_pair(TransferMetadata::Status::kUnsupportedAttachmentType,
IDS_NEARBY_ERROR_UNSUPPORTED_FILE_TYPE),
std::make_pair(TransferMetadata::Status::kFailed, 0),
- base::nullopt,
+ absl::nullopt,
}) {
if (error) {
manager()->ShowFailure(
@@ -831,7 +831,7 @@
Cancel(MatchesTarget(share_target), testing::_));
notification_tester_->SimulateClick(NotificationHandler::Type::NEARBY_SHARE,
notifications[0].id(), /*action_index=*/0,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
// Notification should be closed on button click.
EXPECT_EQ(0u, GetDisplayedNotifications().size());
@@ -910,7 +910,7 @@
Accept(MatchesTarget(share_target), testing::_));
notification_tester_->SimulateClick(NotificationHandler::Type::NEARBY_SHARE,
notifications[0].id(), /*action_index=*/0,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
// Notification should still be present as it will soon be replaced.
EXPECT_EQ(1u, GetDisplayedNotifications().size());
@@ -940,7 +940,7 @@
Reject(MatchesTarget(share_target), testing::_));
notification_tester_->SimulateClick(NotificationHandler::Type::NEARBY_SHARE,
notifications[0].id(), /*action_index=*/1,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
// Notification should be closed on button click.
EXPECT_EQ(0u, GetDisplayedNotifications().size());
@@ -970,7 +970,7 @@
Reject(MatchesTarget(share_target), testing::_));
notification_tester_->SimulateClick(NotificationHandler::Type::NEARBY_SHARE,
notifications[0].id(), /*action_index=*/0,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
// Notification should be closed on button click.
EXPECT_EQ(0u, GetDisplayedNotifications().size());
@@ -1009,8 +1009,8 @@
notification_tester_->SimulateClick(NotificationHandler::Type::NEARBY_SHARE,
notifications[0].id(),
- /*action_index=*/base::nullopt,
- /*reply=*/base::nullopt);
+ /*action_index=*/absl::nullopt,
+ /*reply=*/absl::nullopt);
// Notification should be closed.
EXPECT_EQ(0u, GetDisplayedNotifications().size());
@@ -1078,7 +1078,7 @@
notification_tester_->SimulateClick(NotificationHandler::Type::NEARBY_SHARE,
notification.id(),
/*action_index=*/0,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
run_loop.Run();
@@ -1125,7 +1125,7 @@
notification_tester_->SimulateClick(NotificationHandler::Type::NEARBY_SHARE,
notification.id(),
/*action_index=*/1,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
run_loop.Run();
@@ -1167,7 +1167,7 @@
notification_tester_->SimulateClick(NotificationHandler::Type::NEARBY_SHARE,
notification.id(),
/*action_index=*/0,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
run_loop.Run();
@@ -1202,7 +1202,7 @@
notification_tester_->SimulateClick(NotificationHandler::Type::NEARBY_SHARE,
notification.id(),
/*action_index=*/0,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
run_loop.Run();
EXPECT_EQ(kTextBody, GetClipboardText());
@@ -1238,7 +1238,7 @@
notification_tester_->SimulateClick(NotificationHandler::Type::NEARBY_SHARE,
notification.id(),
/*action_index=*/0,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
run_loop.Run();
@@ -1274,7 +1274,7 @@
notification_tester_->SimulateClick(NotificationHandler::Type::NEARBY_SHARE,
notification.id(),
/*action_index=*/0,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
run_loop.Run();
@@ -1310,7 +1310,7 @@
notification_tester_->SimulateClick(NotificationHandler::Type::NEARBY_SHARE,
notification.id(),
/*action_index=*/0,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
run_loop.Run();
@@ -1402,8 +1402,8 @@
share_target.is_incoming = true;
TextAttachment attachment(TextAttachment::Type::kText, "Sample Text",
- /*title=*/base::nullopt,
- /*mime_type=*/base::nullopt);
+ /*title=*/absl::nullopt,
+ /*mime_type=*/absl::nullopt);
share_target.text_attachments.push_back(std::move(attachment));
manager()->ShowSuccess(share_target);
diff --git a/chrome/browser/nearby_sharing/nearby_per_session_discovery_manager.cc b/chrome/browser/nearby_sharing/nearby_per_session_discovery_manager.cc
index da2c0404..d9a642c5 100644
--- a/chrome/browser/nearby_sharing/nearby_per_session_discovery_manager.cc
+++ b/chrome/browser/nearby_sharing/nearby_per_session_discovery_manager.cc
@@ -18,7 +18,7 @@
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
namespace {
-base::Optional<nearby_share::mojom::TransferStatus> GetTransferStatus(
+absl::optional<nearby_share::mojom::TransferStatus> GetTransferStatus(
const TransferMetadata& transfer_metadata) {
switch (transfer_metadata.status()) {
case TransferMetadata::Status::kAwaitingLocalConfirmation:
@@ -80,7 +80,7 @@
case TransferMetadata::Status::kMediaDownloading:
case TransferMetadata::Status::kExternalProviderLaunched:
// Ignore all other transfer status updates.
- return base::nullopt;
+ return absl::nullopt;
}
}
@@ -131,7 +131,7 @@
<< TransferMetadata::StatusToString(
transfer_metadata.status());
- base::Optional<nearby_share::mojom::TransferStatus> status =
+ absl::optional<nearby_share::mojom::TransferStatus> status =
GetTransferStatus(transfer_metadata);
if (!status) {
diff --git a/chrome/browser/nearby_sharing/nearby_per_session_discovery_manager.h b/chrome/browser/nearby_sharing/nearby_per_session_discovery_manager.h
index f9d3d8b..7c80fc2 100644
--- a/chrome/browser/nearby_sharing/nearby_per_session_discovery_manager.h
+++ b/chrome/browser/nearby_sharing/nearby_per_session_discovery_manager.h
@@ -10,7 +10,6 @@
#include "base/containers/flat_map.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/unguessable_token.h"
#include "chrome/browser/nearby_sharing/attachment.h"
@@ -19,6 +18,7 @@
#include "chrome/browser/nearby_sharing/transfer_update_callback.h"
#include "chrome/browser/ui/webui/nearby_share/nearby_share.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Handles a single nearby device discovery session. Holds all discovered share
// targets for the user to choose from and provides callbacks for when they are
@@ -96,8 +96,8 @@
DiscoveryProgress::kDiscoveryNotAttempted;
// Used for metrics. Tracks the time when StartDiscovery() is called, or
- // base::nullopt if never called.
- base::Optional<base::TimeTicks> discovery_start_time_;
+ // absl::nullopt if never called.
+ absl::optional<base::TimeTicks> discovery_start_time_;
// Used for metrics. Tracks the total number devices discovered and lost in a
// given discovery session.
diff --git a/chrome/browser/nearby_sharing/nearby_per_session_discovery_manager_unittest.cc b/chrome/browser/nearby_sharing/nearby_per_session_discovery_manager_unittest.cc
index 7c93813..3524af9 100644
--- a/chrome/browser/nearby_sharing/nearby_per_session_discovery_manager_unittest.cc
+++ b/chrome/browser/nearby_sharing/nearby_per_session_discovery_manager_unittest.cc
@@ -7,7 +7,6 @@
#include <string>
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/mock_callback.h"
@@ -22,6 +21,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -36,8 +36,8 @@
std::vector<std::unique_ptr<Attachment>> CreateTextAttachments() {
std::vector<std::unique_ptr<Attachment>> attachments;
attachments.push_back(std::make_unique<TextAttachment>(
- TextAttachment::Type::kText, kTextAttachmentBody, /*title=*/base::nullopt,
- /*mime_type=*/base::nullopt));
+ TextAttachment::Type::kText, kTextAttachmentBody, /*title=*/absl::nullopt,
+ /*mime_type=*/absl::nullopt));
return attachments;
}
@@ -99,7 +99,7 @@
MOCK_METHOD(void,
OnTransferUpdate,
(nearby_share::mojom::TransferStatus status,
- const base::Optional<std::string>&),
+ const absl::optional<std::string>&),
(override));
private:
@@ -448,7 +448,7 @@
EXPECT_CALL(transfer_listener, OnTransferUpdate(_, _))
.WillOnce(testing::Invoke(
[&run_loop](nearby_share::mojom::TransferStatus status,
- const base::Optional<std::string>& token) {
+ const absl::optional<std::string>& token) {
EXPECT_EQ(
nearby_share::mojom::TransferStatus::kAwaitingRemoteAcceptance,
status);
@@ -504,7 +504,7 @@
EXPECT_CALL(transfer_listener, OnTransferUpdate(_, _))
.WillOnce(testing::Invoke([&run_loop, &expected_token](
nearby_share::mojom::TransferStatus status,
- const base::Optional<std::string>& token) {
+ const absl::optional<std::string>& token) {
EXPECT_EQ(
nearby_share::mojom::TransferStatus::kAwaitingLocalConfirmation,
status);
diff --git a/chrome/browser/nearby_sharing/nearby_receive_manager_unittest.cc b/chrome/browser/nearby_sharing/nearby_receive_manager_unittest.cc
index 4d0c773..22f5c52 100644
--- a/chrome/browser/nearby_sharing/nearby_receive_manager_unittest.cc
+++ b/chrome/browser/nearby_sharing/nearby_receive_manager_unittest.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/nearby_sharing/nearby_receive_manager.h"
-#include "base/optional.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
#include "chrome/browser/nearby_sharing/mock_nearby_sharing_service.h"
@@ -14,6 +13,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -38,8 +38,8 @@
on_start_advertising_failure_called_ = true;
}
- base::Optional<nearby_share::mojom::TransferMetadata> last_metadata_;
- base::Optional<bool> in_high_visibility_;
+ absl::optional<nearby_share::mojom::TransferMetadata> last_metadata_;
+ absl::optional<bool> in_high_visibility_;
ShareTarget last_share_target_;
bool on_nearby_process_stopped_called_ = false;
bool on_start_advertising_failure_called_ = false;
@@ -213,7 +213,7 @@
// Simulate the sender canceling before we accept the share target and causing
// the accept to fail before hitting the service.
TransferMetadata transfer_metadata_final(TransferMetadata::Status::kCancelled,
- 1.f, base::nullopt, true, true);
+ 1.f, absl::nullopt, true, true);
receive_manager_.OnTransferUpdate(share_target_, transfer_metadata_final);
FlushMojoMessages();
@@ -235,7 +235,7 @@
// Simulate the sender canceling before we reject the share target and causing
// the reject to fail before hitting the service.
TransferMetadata transfer_metadata_final(TransferMetadata::Status::kCancelled,
- 1.f, base::nullopt, true, true);
+ 1.f, absl::nullopt, true, true);
receive_manager_.OnTransferUpdate(share_target_, transfer_metadata_final);
FlushMojoMessages();
@@ -268,7 +268,7 @@
ASSERT_TRUE(observer_.in_high_visibility_.has_value());
EXPECT_FALSE(*observer_.in_high_visibility_);
- observer_.in_high_visibility_ = base::nullopt;
+ observer_.in_high_visibility_ = absl::nullopt;
receive_manager_.OnHighVisibilityChanged(true);
FlushMojoMessages();
diff --git a/chrome/browser/nearby_sharing/nearby_share_metrics_logger.cc b/chrome/browser/nearby_sharing/nearby_share_metrics_logger.cc
index 65b6b0d..21ac976 100644
--- a/chrome/browser/nearby_sharing/nearby_share_metrics_logger.cc
+++ b/chrome/browser/nearby_sharing/nearby_share_metrics_logger.cc
@@ -295,7 +295,7 @@
}
std::string GetUpgradedMediumSubcategoryName(
- base::Optional<location::nearby::connections::mojom::Medium>
+ absl::optional<location::nearby::connections::mojom::Medium>
last_upgraded_medium) {
if (!last_upgraded_medium) {
return ".NoMediumUpgrade";
@@ -318,7 +318,7 @@
}
UpgradedMedium GetUpgradedMediumForMetrics(
- base::Optional<location::nearby::connections::mojom::Medium>
+ absl::optional<location::nearby::connections::mojom::Medium>
last_upgraded_medium) {
if (!last_upgraded_medium) {
return UpgradedMedium::kNoUpgrade;
@@ -438,7 +438,7 @@
void RecordNearbySharePayloadFinalStatusMetric(
location::nearby::connections::mojom::PayloadStatus status,
- base::Optional<location::nearby::connections::mojom::Medium> medium) {
+ absl::optional<location::nearby::connections::mojom::Medium> medium) {
DCHECK_NE(status,
location::nearby::connections::mojom::PayloadStatus::kInProgress);
base::UmaHistogramEnumeration("Nearby.Share.Payload.FinalStatus",
@@ -449,7 +449,7 @@
}
void RecordNearbySharePayloadMediumMetric(
- base::Optional<location::nearby::connections::mojom::Medium> medium,
+ absl::optional<location::nearby::connections::mojom::Medium> medium,
nearby_share::mojom::ShareTargetType type,
uint64_t num_bytes_transferred) {
base::UmaHistogramEnumeration("Nearby.Share.Payload.Medium",
@@ -478,7 +478,7 @@
void RecordNearbySharePayloadSizeMetric(
bool is_incoming,
nearby_share::mojom::ShareTargetType type,
- base::Optional<location::nearby::connections::mojom::Medium>
+ absl::optional<location::nearby::connections::mojom::Medium>
last_upgraded_medium,
location::nearby::connections::mojom::PayloadStatus status,
uint64_t payload_size_bytes) {
@@ -504,7 +504,7 @@
void RecordNearbySharePayloadTransferRateMetric(
bool is_incoming,
nearby_share::mojom::ShareTargetType type,
- base::Optional<location::nearby::connections::mojom::Medium>
+ absl::optional<location::nearby::connections::mojom::Medium>
last_upgraded_medium,
location::nearby::connections::mojom::PayloadStatus status,
uint64_t transferred_payload_bytes,
@@ -582,7 +582,7 @@
// Log the transfer success/failure for high-level success and Critical User
// Journey (CUJ) metrics.
{
- base::Optional<bool> success;
+ absl::optional<bool> success;
switch (TransferMetadata::ToResult(status)) {
case TransferMetadata::Result::kSuccess:
success = true;
diff --git a/chrome/browser/nearby_sharing/nearby_share_metrics_logger.h b/chrome/browser/nearby_sharing/nearby_share_metrics_logger.h
index 289eae5..5c19dfb3 100644
--- a/chrome/browser/nearby_sharing/nearby_share_metrics_logger.h
+++ b/chrome/browser/nearby_sharing/nearby_share_metrics_logger.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_NEARBY_SHARING_NEARBY_SHARE_METRICS_LOGGER_H_
#define CHROME_BROWSER_NEARBY_SHARING_NEARBY_SHARE_METRICS_LOGGER_H_
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/transfer_metadata.h"
#include "chromeos/services/nearby/public/mojom/nearby_connections_types.mojom.h"
#include "chromeos/services/nearby/public/mojom/nearby_decoder_types.mojom.h"
#include "chromeos/services/nearby/public/mojom/nearby_share_target_types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefService;
@@ -39,10 +39,10 @@
void RecordNearbySharePayloadFinalStatusMetric(
location::nearby::connections::mojom::PayloadStatus status,
- base::Optional<location::nearby::connections::mojom::Medium> medium);
+ absl::optional<location::nearby::connections::mojom::Medium> medium);
void RecordNearbySharePayloadMediumMetric(
- base::Optional<location::nearby::connections::mojom::Medium> medium,
+ absl::optional<location::nearby::connections::mojom::Medium> medium,
nearby_share::mojom::ShareTargetType type,
uint64_t num_bytes_transferred);
@@ -52,7 +52,7 @@
void RecordNearbySharePayloadSizeMetric(
bool is_incoming,
nearby_share::mojom::ShareTargetType type,
- base::Optional<location::nearby::connections::mojom::Medium>
+ absl::optional<location::nearby::connections::mojom::Medium>
last_upgraded_medium,
location::nearby::connections::mojom::PayloadStatus status,
uint64_t payload_size_bytes);
@@ -60,7 +60,7 @@
void RecordNearbySharePayloadTransferRateMetric(
bool is_incoming,
nearby_share::mojom::ShareTargetType type,
- base::Optional<location::nearby::connections::mojom::Medium>
+ absl::optional<location::nearby::connections::mojom::Medium>
last_upgraded_medium,
location::nearby::connections::mojom::PayloadStatus status,
uint64_t transferred_payload_bytes,
diff --git a/chrome/browser/nearby_sharing/nearby_share_profile_info_provider_impl.cc b/chrome/browser/nearby_sharing/nearby_share_profile_info_provider_impl.cc
index 04743eb..f1c43df 100644
--- a/chrome/browser/nearby_sharing/nearby_share_profile_info_provider_impl.cc
+++ b/chrome/browser/nearby_sharing/nearby_share_profile_info_provider_impl.cc
@@ -15,19 +15,19 @@
NearbyShareProfileInfoProviderImpl::~NearbyShareProfileInfoProviderImpl() =
default;
-base::Optional<std::u16string>
+absl::optional<std::u16string>
NearbyShareProfileInfoProviderImpl::GetGivenName() const {
const user_manager::User* user =
chromeos::ProfileHelper::Get()->GetUserByProfile(profile_);
if (!user)
- return base::nullopt;
+ return absl::nullopt;
std::u16string name = user->GetGivenName();
- return name.empty() ? base::nullopt : base::make_optional(name);
+ return name.empty() ? absl::nullopt : absl::make_optional(name);
}
-base::Optional<std::string>
+absl::optional<std::string>
NearbyShareProfileInfoProviderImpl::GetProfileUserName() const {
std::string name = profile_->GetProfileUserName();
- return name.empty() ? base::nullopt : base::make_optional(name);
+ return name.empty() ? absl::nullopt : absl::make_optional(name);
}
diff --git a/chrome/browser/nearby_sharing/nearby_share_profile_info_provider_impl.h b/chrome/browser/nearby_sharing/nearby_share_profile_info_provider_impl.h
index 53fb0dad..1d55d639 100644
--- a/chrome/browser/nearby_sharing/nearby_share_profile_info_provider_impl.h
+++ b/chrome/browser/nearby_sharing/nearby_share_profile_info_provider_impl.h
@@ -22,8 +22,8 @@
~NearbyShareProfileInfoProviderImpl() override;
// NearbyShareProfileInfoProvider:
- base::Optional<std::u16string> GetGivenName() const override;
- base::Optional<std::string> GetProfileUserName() const override;
+ absl::optional<std::u16string> GetGivenName() const override;
+ absl::optional<std::string> GetProfileUserName() const override;
private:
Profile* profile_;
diff --git a/chrome/browser/nearby_sharing/nearby_share_profile_info_provider_impl_unittest.cc b/chrome/browser/nearby_sharing/nearby_share_profile_info_provider_impl_unittest.cc
index 405e45a4..0d19c5d7 100644
--- a/chrome/browser/nearby_sharing/nearby_share_profile_info_provider_impl_unittest.cc
+++ b/chrome/browser/nearby_sharing/nearby_share_profile_info_provider_impl_unittest.cc
@@ -59,10 +59,10 @@
Profile* profile = CreateProfile(kFakeProfileUserName);
NearbyShareProfileInfoProviderImpl profile_info_provider(profile);
- // If no user, return base::nullopt.
+ // If no user, return absl::nullopt.
EXPECT_FALSE(profile_info_provider.GetGivenName());
- // If given name is empty, return base::nullopt.
+ // If given name is empty, return absl::nullopt.
AddUser();
SetUserGivenName(std::u16string());
EXPECT_FALSE(profile_info_provider.GetGivenName());
@@ -73,7 +73,7 @@
TEST_F(NearbyShareProfileInfoProviderImplTest, ProfileUserName) {
{
- // If profile user name is empty, return base::nullopt.
+ // If profile user name is empty, return absl::nullopt.
Profile* profile = CreateProfile(std::string());
NearbyShareProfileInfoProviderImpl profile_info_provider(profile);
EXPECT_FALSE(profile_info_provider.GetProfileUserName());
diff --git a/chrome/browser/nearby_sharing/nearby_sharing_service_factory.cc b/chrome/browser/nearby_sharing/nearby_sharing_service_factory.cc
index 53344a5..f921c05 100644
--- a/chrome/browser/nearby_sharing/nearby_sharing_service_factory.cc
+++ b/chrome/browser/nearby_sharing/nearby_sharing_service_factory.cc
@@ -33,8 +33,8 @@
constexpr char kServiceName[] = "NearbySharingService";
-base::Optional<bool>& IsSupportedTesting() {
- static base::NoDestructor<base::Optional<bool>> is_supported;
+absl::optional<bool>& IsSupportedTesting() {
+ static base::NoDestructor<absl::optional<bool>> is_supported;
return *is_supported;
}
diff --git a/chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc b/chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc
index 515931a..03e4250 100644
--- a/chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc
+++ b/chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc
@@ -131,13 +131,13 @@
}
}
-base::Optional<std::vector<uint8_t>> GetBluetoothMacAddressFromCertificate(
+absl::optional<std::vector<uint8_t>> GetBluetoothMacAddressFromCertificate(
const NearbyShareDecryptedPublicCertificate& certificate) {
if (!certificate.unencrypted_metadata().has_bluetooth_mac_address()) {
NS_LOG(WARNING) << __func__ << ": Public certificate "
<< base::HexEncode(certificate.id()) << " did not contain "
<< "a Bluetooth mac address.";
- return base::nullopt;
+ return absl::nullopt;
}
std::string mac_address =
@@ -145,15 +145,15 @@
if (mac_address.size() != 6) {
NS_LOG(ERROR) << __func__ << ": Invalid bluetooth mac address: '"
<< mac_address << "'";
- return base::nullopt;
+ return absl::nullopt;
}
return std::vector<uint8_t>(mac_address.begin(), mac_address.end());
}
-base::Optional<std::string> GetDeviceName(
+absl::optional<std::string> GetDeviceName(
const sharing::mojom::AdvertisementPtr& advertisement,
- const base::Optional<NearbyShareDecryptedPublicCertificate>& certificate) {
+ const absl::optional<NearbyShareDecryptedPublicCertificate>& certificate) {
DCHECK(advertisement);
// Device name is always included when visible to everyone.
@@ -163,7 +163,7 @@
// For contacts only advertisements, we can't do anything without the
// certificate.
if (!certificate || !certificate->unencrypted_metadata().has_device_name())
- return base::nullopt;
+ return absl::nullopt;
return certificate->unencrypted_metadata().device_name();
}
@@ -174,11 +174,11 @@
// 3. Endpoint ID.
std::string GetDeviceId(
const std::string& endpoint_id,
- const base::Optional<NearbyShareDecryptedPublicCertificate>& certificate) {
+ const absl::optional<NearbyShareDecryptedPublicCertificate>& certificate) {
if (!certificate)
return endpoint_id;
- base::Optional<std::vector<uint8_t>> mac_address =
+ absl::optional<std::vector<uint8_t>> mac_address =
GetBluetoothMacAddressFromCertificate(*certificate);
if (mac_address)
return base::NumberToString(base::FastHash(base::make_span(*mac_address)));
@@ -189,10 +189,10 @@
return endpoint_id;
}
-base::Optional<std::string> ToFourDigitString(
- const base::Optional<std::vector<uint8_t>>& bytes) {
+absl::optional<std::string> ToFourDigitString(
+ const absl::optional<std::vector<uint8_t>>& bytes) {
if (!bytes)
- return base::nullopt;
+ return absl::nullopt;
int hash = 0;
int multiplier = 1;
@@ -207,7 +207,7 @@
bool IsOutOfStorage(base::FilePath file_path,
int64_t storage_required,
- base::Optional<int64_t> free_disk_space_for_testing) {
+ absl::optional<int64_t> free_disk_space_for_testing) {
int64_t free_space = free_disk_space_for_testing.value_or(
base::SysInfo::AmountOfFreeDiskSpace(file_path));
return free_space < storage_required;
@@ -717,7 +717,7 @@
// For sending advertisement from scanner, the request advertisement should
// always be visible to everyone.
- base::Optional<std::vector<uint8_t>> endpoint_info =
+ absl::optional<std::vector<uint8_t>> endpoint_info =
CreateEndpointInfo(local_device_data_manager_->GetDeviceName());
if (!endpoint_info) {
NS_LOG(WARNING) << __func__ << ": Could not create local endpoint info.";
@@ -757,7 +757,7 @@
return;
}
- base::Optional<std::pair<ShareTarget, TransferMetadata>> metadata =
+ absl::optional<std::pair<ShareTarget, TransferMetadata>> metadata =
share_target.is_incoming ? last_incoming_metadata_
: last_outgoing_metadata_;
if (!metadata || metadata->second.status() !=
@@ -847,7 +847,7 @@
// payload transfer, for example, if a connection has not been established
// yet.
for (int64_t attachment_id : share_target.GetAttachmentIds()) {
- base::Optional<int64_t> payload_id = GetAttachmentPayloadId(attachment_id);
+ absl::optional<int64_t> payload_id = GetAttachmentPayloadId(attachment_id);
if (payload_id) {
nearby_connections_manager_->Cancel(*payload_id);
}
@@ -1275,16 +1275,16 @@
visibility == Visibility::kSelectedContacts;
}
-const base::Optional<std::vector<uint8_t>>
+const absl::optional<std::vector<uint8_t>>
NearbySharingServiceImpl::CreateEndpointInfo(
- const base::Optional<std::string>& device_name) {
+ const absl::optional<std::string>& device_name) {
std::vector<uint8_t> salt;
std::vector<uint8_t> encrypted_key;
nearby_share::mojom::Visibility visibility = settings_.GetVisibility();
if (visibility == Visibility::kAllContacts ||
visibility == Visibility::kSelectedContacts) {
- base::Optional<NearbyShareEncryptedMetadataKey> encrypted_metadata_key =
+ absl::optional<NearbyShareEncryptedMetadataKey> encrypted_metadata_key =
certificate_manager_->EncryptPrivateCertificateMetadataKey(visibility);
if (encrypted_metadata_key) {
salt = encrypted_metadata_key->salt();
@@ -1312,7 +1312,7 @@
if (advertisement) {
return advertisement->ToEndpointInfo();
} else {
- return base::nullopt;
+ return absl::nullopt;
}
}
@@ -1510,7 +1510,7 @@
const std::string& endpoint_id,
const std::vector<uint8_t>& endpoint_info,
sharing::mojom::AdvertisementPtr advertisement,
- base::Optional<NearbyShareDecryptedPublicCertificate> certificate) {
+ absl::optional<NearbyShareDecryptedPublicCertificate> certificate) {
// Check again for this endpoint id, to avoid race conditions.
if (outgoing_share_target_map_.find(endpoint_id) !=
outgoing_share_target_map_.end()) {
@@ -1520,7 +1520,7 @@
// The certificate provides the device name, in order to create a ShareTarget
// to represent this remote device.
- base::Optional<ShareTarget> share_target = CreateShareTarget(
+ absl::optional<ShareTarget> share_target = CreateShareTarget(
endpoint_id, std::move(advertisement), std::move(certificate),
/*is_incoming=*/false);
if (!share_target) {
@@ -1898,13 +1898,13 @@
<< " and data usage preference " << data_usage;
}
- base::Optional<std::string> device_name;
+ absl::optional<std::string> device_name;
if (!foreground_receive_callbacks_.empty())
device_name = local_device_data_manager_->GetDeviceName();
// Starts advertising through Nearby Connections. Caller is expected to ensure
// |listener| remains valid until StopAdvertising is called.
- base::Optional<std::vector<uint8_t>> endpoint_info =
+ absl::optional<std::vector<uint8_t>> endpoint_info =
CreateEndpointInfo(device_name);
if (!endpoint_info) {
NS_LOG(VERBOSE) << __func__
@@ -2132,7 +2132,7 @@
// Register payload path for all valid file payloads.
base::flat_map<int64_t, base::FilePath> valid_file_payloads;
for (auto& file : share_target.file_attachments) {
- base::Optional<int64_t> payload_id = GetAttachmentPayloadId(file.id());
+ absl::optional<int64_t> payload_id = GetAttachmentPayloadId(file.id());
if (!payload_id) {
NS_LOG(WARNING)
<< __func__
@@ -2162,7 +2162,7 @@
std::move(status_codes_callback)));
for (const auto& payload : valid_file_payloads) {
- base::Optional<int64_t> payload_id = GetAttachmentPayloadId(payload.first);
+ absl::optional<int64_t> payload_id = GetAttachmentPayloadId(payload.first);
DCHECK(payload_id);
file_handler_.GetUniquePath(
@@ -2274,7 +2274,7 @@
// Register status listener for all payloads.
for (int64_t attachment_id : share_target.GetAttachmentIds()) {
- base::Optional<int64_t> payload_id = GetAttachmentPayloadId(attachment_id);
+ absl::optional<int64_t> payload_id = GetAttachmentPayloadId(attachment_id);
if (!payload_id) {
NS_LOG(WARNING) << __func__
<< ": Failed to retrieve payload for attachment id - "
@@ -2304,7 +2304,7 @@
.set_token(info->token())
.build());
- base::Optional<std::string> endpoint_id = info->endpoint_id();
+ absl::optional<std::string> endpoint_id = info->endpoint_id();
if (endpoint_id) {
// Upgrade bandwidth regardless of advertising visibility because either
// the system or the user has verified the sender's identity; the
@@ -2350,7 +2350,7 @@
&NearbySharingServiceImpl::OnOutgoingConnectionDisconnected,
weak_ptr_factory_.GetWeakPtr(), share_target));
- base::Optional<std::string> four_digit_token =
+ absl::optional<std::string> four_digit_token =
ToFourDigitString(nearby_connections_manager_->GetRawAuthenticationToken(
*info->endpoint_id()));
@@ -2364,7 +2364,7 @@
void NearbySharingServiceImpl::SendIntroduction(
const ShareTarget& share_target,
- base::Optional<std::string> four_digit_token) {
+ absl::optional<std::string> four_digit_token) {
// We successfully connected! Now lets build up Payloads for all the files we
// want to send them. We won't send any just yet, but we'll send the Payload
// IDs in our our introduction frame so that they know what to expect if they
@@ -2401,7 +2401,7 @@
// Write introduction of file payloads.
for (const auto& file : share_target.file_attachments) {
- base::Optional<int64_t> payload_id = GetAttachmentPayloadId(file.id());
+ absl::optional<int64_t> payload_id = GetAttachmentPayloadId(file.id());
if (!payload_id) {
NS_LOG(VERBOSE) << __func__ << ": Skipping unknown file attachment";
continue;
@@ -2417,7 +2417,7 @@
// Write introduction of text payloads.
for (const auto& text : share_target.text_attachments) {
- base::Optional<int64_t> payload_id = GetAttachmentPayloadId(text.id());
+ absl::optional<int64_t> payload_id = GetAttachmentPayloadId(text.id());
if (!payload_id) {
NS_LOG(VERBOSE) << __func__ << ": Skipping unknown text attachment";
continue;
@@ -2532,7 +2532,7 @@
return;
}
- base::Optional<std::vector<uint8_t>> bluetooth_mac_address =
+ absl::optional<std::vector<uint8_t>> bluetooth_mac_address =
GetBluetoothMacAddressForShareTarget(share_target);
// For metrics.
@@ -2723,7 +2723,7 @@
.set_is_original(false)
.build());
} else {
- last_incoming_metadata_ = base::nullopt;
+ last_incoming_metadata_ = absl::nullopt;
}
if (metadata.is_final_status()) {
@@ -2784,7 +2784,7 @@
callback.OnTransferUpdate(share_target, metadata);
if (has_foreground_send_surface && metadata.is_final_status()) {
- last_outgoing_metadata_ = base::nullopt;
+ last_outgoing_metadata_ = absl::nullopt;
} else {
last_outgoing_metadata_ =
std::make_pair(share_target, TransferMetadataBuilder::Clone(metadata)
@@ -2808,7 +2808,7 @@
const std::string& endpoint_id,
sharing::mojom::AdvertisementPtr advertisement,
ShareTarget placeholder_share_target,
- base::Optional<NearbyShareDecryptedPublicCertificate> certificate) {
+ absl::optional<NearbyShareDecryptedPublicCertificate> certificate) {
NearbyConnection* connection = GetConnection(placeholder_share_target);
if (!connection) {
NS_LOG(VERBOSE) << __func__ << ": Invalid connection for endpoint id - "
@@ -2820,7 +2820,7 @@
// target below.
incoming_share_target_info_map_.erase(placeholder_share_target.id);
- base::Optional<ShareTarget> share_target = CreateShareTarget(
+ absl::optional<ShareTarget> share_target = CreateShareTarget(
endpoint_id, advertisement, std::move(certificate), /*is_incoming=*/true);
if (!share_target) {
@@ -2849,7 +2849,7 @@
base::BindOnce(&NearbySharingServiceImpl::UnregisterShareTarget,
weak_ptr_factory_.GetWeakPtr(), *share_target));
- base::Optional<std::string> four_digit_token = ToFourDigitString(
+ absl::optional<std::string> four_digit_token = ToFourDigitString(
nearby_connections_manager_->GetRawAuthenticationToken(endpoint_id));
RunPairedKeyVerification(
@@ -2866,7 +2866,7 @@
base::OnceCallback<void(
PairedKeyVerificationRunner::PairedKeyVerificationResult)> callback) {
DCHECK(profile_);
- base::Optional<std::vector<uint8_t>> token =
+ absl::optional<std::vector<uint8_t>> token =
nearby_connections_manager_->GetRawAuthenticationToken(endpoint_id);
if (!token) {
NS_LOG(VERBOSE) << __func__
@@ -2897,7 +2897,7 @@
void NearbySharingServiceImpl::OnIncomingConnectionKeyVerificationDone(
ShareTarget share_target,
- base::Optional<std::string> four_digit_token,
+ absl::optional<std::string> four_digit_token,
PairedKeyVerificationRunner::PairedKeyVerificationResult result) {
ShareTargetInfo* info = GetShareTargetInfo(share_target);
if (!info || !info->connection() || !info->endpoint_id()) {
@@ -2922,7 +2922,7 @@
// potentially exposed by performing a bandwidth upgrade are no longer a
// concern.
nearby_connections_manager_->UpgradeBandwidth(*info->endpoint_id());
- ReceiveIntroduction(share_target, /*four_digit_token=*/base::nullopt);
+ ReceiveIntroduction(share_target, /*four_digit_token=*/absl::nullopt);
break;
case PairedKeyVerificationRunner::PairedKeyVerificationResult::kUnable:
@@ -2954,7 +2954,7 @@
void NearbySharingServiceImpl::OnOutgoingConnectionKeyVerificationDone(
const ShareTarget& share_target,
- base::Optional<std::string> four_digit_token,
+ absl::optional<std::string> four_digit_token,
PairedKeyVerificationRunner::PairedKeyVerificationResult result) {
ShareTargetInfo* info = GetShareTargetInfo(share_target);
if (!info || !info->connection())
@@ -2984,7 +2984,7 @@
NS_LOG(VERBOSE) << __func__
<< ": Paired key handshake succeeded for target - "
<< share_target.id;
- SendIntroduction(share_target, /*four_digit_token=*/base::nullopt);
+ SendIntroduction(share_target, /*four_digit_token=*/absl::nullopt);
SendPayloads(share_target);
return;
@@ -3002,7 +3002,7 @@
<< ": Sender-side verification is disabled. Skipping "
"token comparison with "
<< share_target.id;
- SendIntroduction(share_target, /*four_digit_token=*/base::nullopt);
+ SendIntroduction(share_target, /*four_digit_token=*/absl::nullopt);
SendPayloads(share_target);
} else {
SendIntroduction(share_target, std::move(four_digit_token));
@@ -3036,7 +3036,7 @@
void NearbySharingServiceImpl::ReceiveIntroduction(
ShareTarget share_target,
- base::Optional<std::string> four_digit_token) {
+ absl::optional<std::string> four_digit_token) {
NS_LOG(INFO) << __func__ << ": Receiving introduction from "
<< share_target.id;
ShareTargetInfo* info = GetShareTargetInfo(share_target);
@@ -3052,8 +3052,8 @@
void NearbySharingServiceImpl::OnReceivedIntroduction(
ShareTarget share_target,
- base::Optional<std::string> four_digit_token,
- base::Optional<sharing::mojom::V1FramePtr> frame) {
+ absl::optional<std::string> four_digit_token,
+ absl::optional<sharing::mojom::V1FramePtr> frame) {
ShareTargetInfo* info = GetShareTargetInfo(share_target);
if (!info || !info->connection()) {
NS_LOG(WARNING)
@@ -3172,7 +3172,7 @@
void NearbySharingServiceImpl::OnReceiveConnectionResponse(
ShareTarget share_target,
- base::Optional<sharing::mojom::V1FramePtr> frame) {
+ absl::optional<sharing::mojom::V1FramePtr> frame) {
OutgoingShareTargetInfo* info = GetOutgoingShareTargetInfo(share_target);
if (!info || !info->connection()) {
NS_LOG(WARNING) << __func__
@@ -3282,7 +3282,7 @@
void NearbySharingServiceImpl::OnStorageCheckCompleted(
ShareTarget share_target,
- base::Optional<std::string> four_digit_token,
+ absl::optional<std::string> four_digit_token,
bool is_out_of_storage) {
if (is_out_of_storage) {
Fail(share_target, TransferMetadata::Status::kNotEnoughSpace);
@@ -3351,7 +3351,7 @@
void NearbySharingServiceImpl::OnFrameRead(
ShareTarget share_target,
- base::Optional<sharing::mojom::V1FramePtr> frame) {
+ absl::optional<sharing::mojom::V1FramePtr> frame) {
if (!frame) {
// This is the case when the connection has been closed since we wait
// indefinitely for incoming frames.
@@ -3446,10 +3446,10 @@
share_target);
}
-base::Optional<ShareTarget> NearbySharingServiceImpl::CreateShareTarget(
+absl::optional<ShareTarget> NearbySharingServiceImpl::CreateShareTarget(
const std::string& endpoint_id,
const sharing::mojom::AdvertisementPtr& advertisement,
- base::Optional<NearbyShareDecryptedPublicCertificate> certificate,
+ absl::optional<NearbyShareDecryptedPublicCertificate> certificate,
bool is_incoming) {
DCHECK(advertisement);
@@ -3457,15 +3457,15 @@
NS_LOG(VERBOSE) << __func__
<< ": Failed to retrieve public certificate for contact "
"only advertisement.";
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<std::string> device_name =
+ absl::optional<std::string> device_name =
GetDeviceName(advertisement, certificate);
if (!device_name) {
NS_LOG(VERBOSE) << __func__
<< ": Failed to retrieve device name for advertisement.";
- return base::nullopt;
+ return absl::nullopt;
}
ShareTarget target;
@@ -3519,7 +3519,7 @@
// Reset file paths for file attachments.
for (auto& file : share_target.file_attachments)
- file.set_file_path(base::nullopt);
+ file.set_file_path(absl::nullopt);
// Reset body of text attachments.
for (auto& text : share_target.text_attachments)
@@ -3561,7 +3561,7 @@
for (auto& file : share_target.file_attachments) {
AttachmentInfo& attachment_info = attachment_info_map_[file.id()];
- base::Optional<int64_t> payload_id = attachment_info.payload_id;
+ absl::optional<int64_t> payload_id = attachment_info.payload_id;
if (!payload_id) {
NS_LOG(WARNING) << __func__ << ": No payload id found for file - "
<< file.id();
@@ -3582,7 +3582,7 @@
for (auto& text : share_target.text_attachments) {
AttachmentInfo& attachment_info = attachment_info_map_[text.id()];
- base::Optional<int64_t> payload_id = attachment_info.payload_id;
+ absl::optional<int64_t> payload_id = attachment_info.payload_id;
if (!payload_id) {
NS_LOG(WARNING) << __func__ << ": No payload id found for text - "
<< text.id();
@@ -3646,7 +3646,7 @@
return;
}
- base::Optional<std::string> endpoint_id = share_target_info->endpoint_id();
+ absl::optional<std::string> endpoint_id = share_target_info->endpoint_id();
if (!endpoint_id) {
NS_LOG(WARNING)
<< __func__
@@ -3764,22 +3764,22 @@
return share_target_info ? share_target_info->connection() : nullptr;
}
-base::Optional<std::vector<uint8_t>>
+absl::optional<std::vector<uint8_t>>
NearbySharingServiceImpl::GetBluetoothMacAddressForShareTarget(
const ShareTarget& share_target) {
ShareTargetInfo* info = GetShareTargetInfo(share_target);
if (!info) {
NS_LOG(ERROR) << __func__ << ": No ShareTargetInfo found for "
<< "share target id: " << share_target.id;
- return base::nullopt;
+ return absl::nullopt;
}
- const base::Optional<NearbyShareDecryptedPublicCertificate>& certificate =
+ const absl::optional<NearbyShareDecryptedPublicCertificate>& certificate =
info->certificate();
if (!certificate) {
NS_LOG(ERROR) << __func__ << ": No decrypted public certificate found for "
<< "share target id: " << share_target.id;
- return base::nullopt;
+ return absl::nullopt;
}
return GetBluetoothMacAddressFromCertificate(*certificate);
@@ -3801,11 +3801,11 @@
attachment_info_map_[attachment.id()].payload_id = payload_id;
}
-base::Optional<int64_t> NearbySharingServiceImpl::GetAttachmentPayloadId(
+absl::optional<int64_t> NearbySharingServiceImpl::GetAttachmentPayloadId(
int64_t attachment_id) {
auto it = attachment_info_map_.find(attachment_id);
if (it == attachment_info_map_.end())
- return base::nullopt;
+ return absl::nullopt;
return it->second.payload_id;
}
@@ -3833,7 +3833,7 @@
last_outgoing_metadata_.reset();
}
// Find the endpoint id that matches the given share target.
- base::Optional<std::string> endpoint_id;
+ absl::optional<std::string> endpoint_id;
auto it = outgoing_share_target_info_map_.find(share_target.id);
if (it != outgoing_share_target_info_map_.end())
endpoint_id = it->second.endpoint_id();
diff --git a/chrome/browser/nearby_sharing/nearby_sharing_service_impl.h b/chrome/browser/nearby_sharing/nearby_sharing_service_impl.h
index c10164c..3b4a19c 100644
--- a/chrome/browser/nearby_sharing/nearby_sharing_service_impl.h
+++ b/chrome/browser/nearby_sharing/nearby_sharing_service_impl.h
@@ -181,8 +181,8 @@
base::ObserverList<TransferUpdateCallback>& GetReceiveCallbacksFromState(
ReceiveSurfaceState state);
bool IsVisibleInBackground(Visibility visibility);
- const base::Optional<std::vector<uint8_t>> CreateEndpointInfo(
- const base::Optional<std::string>& device_name);
+ const absl::optional<std::vector<uint8_t>> CreateEndpointInfo(
+ const absl::optional<std::string>& device_name);
void GetBluetoothAdapter();
void OnGetBluetoothAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
void StartFastInitiationAdvertising();
@@ -210,7 +210,7 @@
const std::string& endpoint_id,
const std::vector<uint8_t>& endpoint_info,
sharing::mojom::AdvertisementPtr advertisement,
- base::Optional<NearbyShareDecryptedPublicCertificate> certificate);
+ absl::optional<NearbyShareDecryptedPublicCertificate> certificate);
void ScheduleCertificateDownloadDuringDiscovery(size_t attempt_count);
void OnCertificateDownloadDuringDiscoveryTimerFired(size_t attempt_count);
@@ -257,7 +257,7 @@
base::TimeTicks connect_start_time,
NearbyConnection* connection);
void SendIntroduction(const ShareTarget& share_target,
- base::Optional<std::string> four_digit_token);
+ absl::optional<std::string> four_digit_token);
void CreatePayloads(ShareTarget share_target,
base::OnceCallback<void(ShareTarget, bool)> callback);
@@ -288,7 +288,7 @@
const std::string& endpoint_id,
sharing::mojom::AdvertisementPtr advertisement,
ShareTarget placeholder_share_target,
- base::Optional<NearbyShareDecryptedPublicCertificate> certificate);
+ absl::optional<NearbyShareDecryptedPublicCertificate> certificate);
void RunPairedKeyVerification(
const ShareTarget& share_target,
const std::string& endpoint_id,
@@ -296,27 +296,27 @@
PairedKeyVerificationRunner::PairedKeyVerificationResult)> callback);
void OnIncomingConnectionKeyVerificationDone(
ShareTarget share_target,
- base::Optional<std::string> four_digit_token,
+ absl::optional<std::string> four_digit_token,
PairedKeyVerificationRunner::PairedKeyVerificationResult result);
void OnOutgoingConnectionKeyVerificationDone(
const ShareTarget& share_target,
- base::Optional<std::string> four_digit_token,
+ absl::optional<std::string> four_digit_token,
PairedKeyVerificationRunner::PairedKeyVerificationResult result);
void RefreshUIOnDisconnection(ShareTarget share_target);
void ReceiveIntroduction(ShareTarget share_target,
- base::Optional<std::string> four_digit_token);
+ absl::optional<std::string> four_digit_token);
void OnReceivedIntroduction(ShareTarget share_target,
- base::Optional<std::string> four_digit_token,
- base::Optional<sharing::mojom::V1FramePtr> frame);
+ absl::optional<std::string> four_digit_token,
+ absl::optional<sharing::mojom::V1FramePtr> frame);
void ReceiveConnectionResponse(ShareTarget share_target);
void OnReceiveConnectionResponse(
ShareTarget share_target,
- base::Optional<sharing::mojom::V1FramePtr> frame);
+ absl::optional<sharing::mojom::V1FramePtr> frame);
void OnStorageCheckCompleted(ShareTarget share_target,
- base::Optional<std::string> four_digit_token,
+ absl::optional<std::string> four_digit_token,
bool is_out_of_storage);
void OnFrameRead(ShareTarget share_target,
- base::Optional<sharing::mojom::V1FramePtr> frame);
+ absl::optional<sharing::mojom::V1FramePtr> frame);
void HandleCertificateInfoFrame(
const sharing::mojom::CertificateInfoFramePtr& certificate_frame);
@@ -340,10 +340,10 @@
void BindToNearbyProcess();
sharing::mojom::NearbySharingDecoder* GetNearbySharingDecoder();
- base::Optional<ShareTarget> CreateShareTarget(
+ absl::optional<ShareTarget> CreateShareTarget(
const std::string& endpoint_id,
const sharing::mojom::AdvertisementPtr& advertisement,
- base::Optional<NearbyShareDecryptedPublicCertificate> certificate,
+ absl::optional<NearbyShareDecryptedPublicCertificate> certificate,
bool is_incoming);
void OnPayloadTransferUpdate(ShareTarget share_target,
@@ -365,12 +365,12 @@
const ShareTarget& share_target);
NearbyConnection* GetConnection(const ShareTarget& share_target);
- base::Optional<std::vector<uint8_t>> GetBluetoothMacAddressForShareTarget(
+ absl::optional<std::vector<uint8_t>> GetBluetoothMacAddressForShareTarget(
const ShareTarget& share_target);
void ClearOutgoingShareTargetInfoMap();
void SetAttachmentPayloadId(const Attachment& attachment, int64_t payload_id);
- base::Optional<int64_t> GetAttachmentPayloadId(int64_t attachment_id);
+ absl::optional<int64_t> GetAttachmentPayloadId(int64_t attachment_id);
void UnregisterShareTarget(const ShareTarget& share_target);
void OnStartAdvertisingResult(
@@ -439,10 +439,10 @@
// Registers the most recent TransferMetadata and ShareTarget used for
// transitioning notifications between foreground surfaces and background
// surfaces. Empty if no metadata is available.
- base::Optional<std::pair<ShareTarget, TransferMetadata>>
+ absl::optional<std::pair<ShareTarget, TransferMetadata>>
last_incoming_metadata_;
// The most recent outgoing TransferMetadata and ShareTarget.
- base::Optional<std::pair<ShareTarget, TransferMetadata>>
+ absl::optional<std::pair<ShareTarget, TransferMetadata>>
last_outgoing_metadata_;
// A map of ShareTarget id to IncomingShareTargetInfo. This lets us know which
// Nearby Connections endpoint and public certificate are related to the
@@ -520,7 +520,7 @@
// Available free disk space for testing. Using real disk space can introduce
// flakiness in tests.
- base::Optional<int64_t> free_disk_space_for_testing_;
+ absl::optional<int64_t> free_disk_space_for_testing_;
// A queue of endpoint-discovered and endpoint-lost events that ensures the
// events are processed sequentially, in the order received from Nearby
diff --git a/chrome/browser/nearby_sharing/nearby_sharing_service_impl_unittest.cc b/chrome/browser/nearby_sharing/nearby_sharing_service_impl_unittest.cc
index dfadffe..9035dc7 100644
--- a/chrome/browser/nearby_sharing/nearby_sharing_service_impl_unittest.cc
+++ b/chrome/browser/nearby_sharing/nearby_sharing_service_impl_unittest.cc
@@ -289,7 +289,7 @@
sharing::mojom::V1FramePtr mojo_v1frame = sharing::mojom::V1Frame::New();
mojo_v1frame->set_introduction(sharing::mojom::IntroductionFrame::New(
std::move(mojo_file_metadatas), std::move(mojo_text_metadatas),
- /*required_package=*/base::nullopt,
+ /*required_package=*/absl::nullopt,
std::vector<sharing::mojom::WifiCredentialsMetadataPtr>()));
sharing::mojom::FramePtr mojo_frame = sharing::mojom::Frame::New();
@@ -331,8 +331,8 @@
std::vector<std::unique_ptr<Attachment>> attachments;
for (auto& text : texts) {
attachments.push_back(std::make_unique<TextAttachment>(
- TextAttachment::Type::kText, std::move(text), /*title=*/base::nullopt,
- /*mime_type=*/base::nullopt));
+ TextAttachment::Type::kText, std::move(text), /*title=*/absl::nullopt,
+ /*mime_type=*/absl::nullopt));
}
return attachments;
}
@@ -573,7 +573,7 @@
nearby_share::mojom::Visibility::kAllContacts),
GetNearbyShareTestEncryptedMetadataKey()));
} else {
- std::move(calls.back().callback).Run(base::nullopt);
+ std::move(calls.back().callback).Run(absl::nullopt);
}
}
@@ -645,7 +645,7 @@
return;
}
- base::Optional<std::string> device_name;
+ absl::optional<std::string> device_name;
if (!return_empty_device_name)
device_name = kDeviceName;
@@ -928,7 +928,7 @@
location::nearby::connections::mojom::PayloadStatus::kSuccess,
/*total_bytes=*/strlen(kTextPayload),
/*bytes_transferred=*/strlen(kTextPayload)),
- /*upgraded_medium=*/base::nullopt);
+ /*upgraded_medium=*/absl::nullopt);
success_run_loop.Run();
}
@@ -2360,7 +2360,7 @@
sharing::mojom::IntroductionFrame::New(
std::move(mojo_file_metadatas),
std::vector<sharing::mojom::TextMetadataPtr>(),
- /*required_package=*/base::nullopt,
+ /*required_package=*/absl::nullopt,
std::vector<sharing::mojom::WifiCredentialsMetadataPtr>()));
sharing::mojom::FramePtr mojo_frame = sharing::mojom::Frame::New();
@@ -2438,7 +2438,7 @@
sharing::mojom::IntroductionFrame::New(
std::move(mojo_file_metadatas),
std::vector<sharing::mojom::TextMetadataPtr>(),
- /*required_package=*/base::nullopt,
+ /*required_package=*/absl::nullopt,
std::vector<sharing::mojom::WifiCredentialsMetadataPtr>()));
sharing::mojom::FramePtr mojo_frame = sharing::mojom::Frame::New();
@@ -2576,7 +2576,7 @@
// TODO(https://crbug.com/1122552) - Remove cleanups after bugfix
{
base::ScopedAllowBlockingForTesting allow_blocking;
- base::Optional<base::FilePath> path =
+ absl::optional<base::FilePath> path =
fake_nearby_connections_manager_->GetRegisteredPayloadPath(
kFilePayloadId);
EXPECT_TRUE(path);
@@ -2629,7 +2629,7 @@
// TODO(https://crbug.com/1122552) - Remove cleanups after bugfix
{
base::ScopedAllowBlockingForTesting allow_blocking;
- base::Optional<base::FilePath> path =
+ absl::optional<base::FilePath> path =
fake_nearby_connections_manager_->GetRegisteredPayloadPath(
kFilePayloadId);
EXPECT_TRUE(path);
@@ -2699,7 +2699,7 @@
/*total_bytes=*/kPayloadSize,
/*bytes_transferred=*/kPayloadSize);
listener->OnStatusUpdate(std::move(payload),
- /*upgraded_medium=*/base::nullopt);
+ /*upgraded_medium=*/absl::nullopt);
run_loop_progress.Run();
task_environment_.FastForwardBy(kMinProgressUpdateFrequency);
@@ -2739,7 +2739,7 @@
/*total_bytes=*/kPayloadSize,
/*bytes_transferred=*/kPayloadSize);
listener->OnStatusUpdate(std::move(payload),
- /*upgraded_medium=*/base::nullopt);
+ /*upgraded_medium=*/absl::nullopt);
run_loop_success.Run();
EXPECT_FALSE(
@@ -2819,7 +2819,7 @@
/*total_bytes=*/kPayloadSize,
/*bytes_transferred=*/kPayloadSize);
listener->OnStatusUpdate(std::move(payload),
- /*upgraded_medium=*/base::nullopt);
+ /*upgraded_medium=*/absl::nullopt);
run_loop_progress.Run();
task_environment_.FastForwardBy(kMinProgressUpdateFrequency);
@@ -2852,7 +2852,7 @@
/*total_bytes=*/kPayloadSize,
/*bytes_transferred=*/kPayloadSize);
listener->OnStatusUpdate(std::move(payload),
- /*upgraded_medium=*/base::nullopt);
+ /*upgraded_medium=*/absl::nullopt);
run_loop_success.Run();
EXPECT_FALSE(
@@ -2862,7 +2862,7 @@
// File deletion runs in a ThreadPool.
task_environment_.RunUntilIdle();
- base::Optional<base::FilePath> file_path =
+ absl::optional<base::FilePath> file_path =
fake_nearby_connections_manager_->GetRegisteredPayloadPath(
kFilePayloadId);
ASSERT_TRUE(file_path);
@@ -2926,7 +2926,7 @@
/*total_bytes=*/kPayloadSize,
/*bytes_transferred=*/kPayloadSize);
listener->OnStatusUpdate(std::move(payload),
- /*upgraded_medium=*/base::nullopt);
+ /*upgraded_medium=*/absl::nullopt);
run_loop_failure.Run();
EXPECT_FALSE(
@@ -2936,7 +2936,7 @@
// File deletion runs in a ThreadPool.
task_environment_.RunUntilIdle();
- base::Optional<base::FilePath> file_path =
+ absl::optional<base::FilePath> file_path =
fake_nearby_connections_manager_->GetRegisteredPayloadPath(
kFilePayloadId);
ASSERT_TRUE(file_path);
@@ -3000,7 +3000,7 @@
/*total_bytes=*/kPayloadSize,
/*bytes_transferred=*/kPayloadSize);
listener->OnStatusUpdate(std::move(payload),
- /*upgraded_medium=*/base::nullopt);
+ /*upgraded_medium=*/absl::nullopt);
run_loop_failure.Run();
EXPECT_FALSE(
@@ -3010,7 +3010,7 @@
// File deletion runs in a ThreadPool.
task_environment_.RunUntilIdle();
- base::Optional<base::FilePath> file_path =
+ absl::optional<base::FilePath> file_path =
fake_nearby_connections_manager_->GetRegisteredPayloadPath(
kFilePayloadId);
ASSERT_TRUE(file_path);
diff --git a/chrome/browser/nearby_sharing/outgoing_share_target_info.h b/chrome/browser/nearby_sharing/outgoing_share_target_info.h
index 4aff6a7..e58d6a4 100644
--- a/chrome/browser/nearby_sharing/outgoing_share_target_info.h
+++ b/chrome/browser/nearby_sharing/outgoing_share_target_info.h
@@ -8,9 +8,9 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/share_target_info.h"
#include "chromeos/services/nearby/public/mojom/nearby_connections_types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A description of the outgoing connection to a remote device.
class OutgoingShareTargetInfo : public ShareTargetInfo {
@@ -22,7 +22,7 @@
OutgoingShareTargetInfo& operator=(OutgoingShareTargetInfo&&);
~OutgoingShareTargetInfo() override;
- const base::Optional<std::string>& obfuscated_gaia_id() const {
+ const absl::optional<std::string>& obfuscated_gaia_id() const {
return obfuscated_gaia_id_;
}
@@ -50,7 +50,7 @@
std::vector<PayloadPtr> ExtractFilePayloads();
private:
- base::Optional<std::string> obfuscated_gaia_id_;
+ absl::optional<std::string> obfuscated_gaia_id_;
std::vector<PayloadPtr> text_payloads_;
std::vector<PayloadPtr> file_payloads_;
};
diff --git a/chrome/browser/nearby_sharing/paired_key_verification_runner.cc b/chrome/browser/nearby_sharing/paired_key_verification_runner.cc
index fa8f223..63b29693 100644
--- a/chrome/browser/nearby_sharing/paired_key_verification_runner.cc
+++ b/chrome/browser/nearby_sharing/paired_key_verification_runner.cc
@@ -58,7 +58,7 @@
const std::string& endpoint_id,
const std::vector<uint8_t>& token,
NearbyConnection* connection,
- const base::Optional<NearbyShareDecryptedPublicCertificate>& certificate,
+ const absl::optional<NearbyShareDecryptedPublicCertificate>& certificate,
NearbyShareCertificateManager* certificate_manager,
nearby_share::mojom::Visibility visibility,
bool restrict_to_contacts,
@@ -104,7 +104,7 @@
}
void PairedKeyVerificationRunner::OnReadPairedKeyEncryptionFrame(
- base::Optional<sharing::mojom::V1FramePtr> frame) {
+ absl::optional<sharing::mojom::V1FramePtr> frame) {
if (!frame) {
NS_LOG(WARNING) << __func__
<< ": Failed to read remote paired key encrpytion";
@@ -151,7 +151,7 @@
void PairedKeyVerificationRunner::OnReadPairedKeyResultFrame(
std::vector<PairedKeyVerificationResult> verification_results,
- base::Optional<sharing::mojom::V1FramePtr> frame) {
+ absl::optional<sharing::mojom::V1FramePtr> frame) {
if (!frame) {
NS_LOG(WARNING) << __func__ << ": Failed to read remote paired key result";
std::move(callback_).Run(PairedKeyVerificationResult::kFail);
@@ -237,7 +237,7 @@
}
void PairedKeyVerificationRunner::SendPairedKeyEncryptionFrame() {
- base::Optional<std::vector<uint8_t>> signature =
+ absl::optional<std::vector<uint8_t>> signature =
certificate_manager_->SignWithPrivateCertificate(
visibility_, PadPrefix(local_prefix_, raw_token_));
if (!signature || signature->empty()) {
@@ -271,7 +271,7 @@
PairedKeyVerificationRunner::PairedKeyVerificationResult
PairedKeyVerificationRunner::VerifyRemotePublicCertificate(
const sharing::mojom::V1FramePtr& frame) {
- base::Optional<std::vector<uint8_t>> hash =
+ absl::optional<std::vector<uint8_t>> hash =
certificate_manager_->HashAuthenticationTokenWithPrivateCertificate(
visibility_, raw_token_);
if (hash && *hash == frame->get_paired_key_encryption()->secret_id_hash) {
diff --git a/chrome/browser/nearby_sharing/paired_key_verification_runner.h b/chrome/browser/nearby_sharing/paired_key_verification_runner.h
index c62ced7..60c3f34 100644
--- a/chrome/browser/nearby_sharing/paired_key_verification_runner.h
+++ b/chrome/browser/nearby_sharing/paired_key_verification_runner.h
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/certificates/nearby_share_certificate_manager.h"
#include "chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.h"
@@ -19,6 +18,7 @@
#include "chrome/browser/nearby_sharing/share_target.h"
#include "chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom.h"
#include "chromeos/services/nearby/public/mojom/nearby_decoder_types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PairedKeyVerificationRunner {
public:
@@ -38,7 +38,7 @@
const std::string& endpoint_id,
const std::vector<uint8_t>& token,
NearbyConnection* connection,
- const base::Optional<NearbyShareDecryptedPublicCertificate>& certificate,
+ const absl::optional<NearbyShareDecryptedPublicCertificate>& certificate,
NearbyShareCertificateManager* certificate_manager,
nearby_share::mojom::Visibility visibility,
bool restrict_to_contacts,
@@ -52,10 +52,10 @@
private:
void SendPairedKeyEncryptionFrame();
void OnReadPairedKeyEncryptionFrame(
- base::Optional<sharing::mojom::V1FramePtr> frame);
+ absl::optional<sharing::mojom::V1FramePtr> frame);
void OnReadPairedKeyResultFrame(
std::vector<PairedKeyVerificationResult> verification_results,
- base::Optional<sharing::mojom::V1FramePtr> frame);
+ absl::optional<sharing::mojom::V1FramePtr> frame);
void SendPairedKeyResultFrame(PairedKeyVerificationResult result);
PairedKeyVerificationResult VerifyRemotePublicCertificate(
const sharing::mojom::V1FramePtr& frame);
@@ -69,7 +69,7 @@
std::string endpoint_id_;
std::vector<uint8_t> raw_token_;
NearbyConnection* connection_;
- base::Optional<NearbyShareDecryptedPublicCertificate> certificate_;
+ absl::optional<NearbyShareDecryptedPublicCertificate> certificate_;
NearbyShareCertificateManager* certificate_manager_;
nearby_share::mojom::Visibility visibility_;
bool restrict_to_contacts_;
diff --git a/chrome/browser/nearby_sharing/paired_key_verification_runner_unittest.cc b/chrome/browser/nearby_sharing/paired_key_verification_runner_unittest.cc
index 3622dc8..e1b88ccd 100644
--- a/chrome/browser/nearby_sharing/paired_key_verification_runner_unittest.cc
+++ b/chrome/browser/nearby_sharing/paired_key_verification_runner_unittest.cc
@@ -9,7 +9,6 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/time/time.h"
@@ -24,6 +23,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -52,14 +52,14 @@
MOCK_METHOD(void,
ReadFrame,
(base::OnceCallback<
- void(base::Optional<sharing::mojom::V1FramePtr>)> callback),
+ void(absl::optional<sharing::mojom::V1FramePtr>)> callback),
(override));
MOCK_METHOD(
void,
ReadFrame,
(sharing::mojom::V1Frame::Tag frame_type,
- base::OnceCallback<void(base::Optional<sharing::mojom::V1FramePtr>)>
+ base::OnceCallback<void(absl::optional<sharing::mojom::V1FramePtr>)>
callback,
base::TimeDelta timeout),
(override));
@@ -88,7 +88,7 @@
class PairedKeyVerificationRunnerTest : public testing::Test {
public:
enum class ReturnFrameType {
- // Return base::nullopt for the frame.
+ // Return absl::nullopt for the frame.
kNull,
// Return an empty frame.
kEmpty,
@@ -105,11 +105,11 @@
bool restricted_to_contacts,
PairedKeyVerificationRunner::PairedKeyVerificationResult
expected_result) {
- base::Optional<NearbyShareDecryptedPublicCertificate> public_certificate =
+ absl::optional<NearbyShareDecryptedPublicCertificate> public_certificate =
use_valid_public_certificate
- ? base::make_optional<NearbyShareDecryptedPublicCertificate>(
+ ? absl::make_optional<NearbyShareDecryptedPublicCertificate>(
GetNearbyShareTestDecryptedPublicCertificate())
- : base::nullopt;
+ : absl::nullopt;
PairedKeyVerificationRunner runner(
share_target_, kEndpointId, kAuthToken, &connection_,
@@ -135,9 +135,9 @@
.WillOnce(testing::WithArg<1>(testing::Invoke(
[frame_type](
base::OnceCallback<void(
- base::Optional<sharing::mojom::V1FramePtr>)> callback) {
+ absl::optional<sharing::mojom::V1FramePtr>)> callback) {
if (frame_type == ReturnFrameType::kNull) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
@@ -168,9 +168,9 @@
testing::_, testing::Eq(kTimeout)))
.WillOnce(testing::WithArg<1>(testing::Invoke(
[=](base::OnceCallback<void(
- base::Optional<sharing::mojom::V1FramePtr>)> callback) {
+ absl::optional<sharing::mojom::V1FramePtr>)> callback) {
if (frame_type == ReturnFrameType::kNull) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
diff --git a/chrome/browser/nearby_sharing/payload_tracker.cc b/chrome/browser/nearby_sharing/payload_tracker.cc
index c2faeef..828f8716 100644
--- a/chrome/browser/nearby_sharing/payload_tracker.cc
+++ b/chrome/browser/nearby_sharing/payload_tracker.cc
@@ -53,7 +53,7 @@
PayloadTracker::~PayloadTracker() = default;
void PayloadTracker::OnStatusUpdate(PayloadTransferUpdatePtr update,
- base::Optional<Medium> upgraded_medium) {
+ absl::optional<Medium> upgraded_medium) {
auto it = payload_state_.find(update->payload_id);
if (it == payload_state_.end())
return;
diff --git a/chrome/browser/nearby_sharing/payload_tracker.h b/chrome/browser/nearby_sharing/payload_tracker.h
index 36417d5..0cd7914 100644
--- a/chrome/browser/nearby_sharing/payload_tracker.h
+++ b/chrome/browser/nearby_sharing/payload_tracker.h
@@ -7,13 +7,13 @@
#include "base/callback_forward.h"
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/attachment_info.h"
#include "chrome/browser/nearby_sharing/nearby_connections_manager.h"
#include "chrome/browser/nearby_sharing/share_target.h"
#include "chrome/browser/nearby_sharing/transfer_metadata.h"
#include "chromeos/services/nearby/public/mojom/nearby_connections_types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Listens for incoming or outgoing transfer updates from Nearby Connections and
// forwards the transfer progress to the |update_callback|.
@@ -28,7 +28,7 @@
// NearbyConnectionsManager::PayloadStatusListener:
void OnStatusUpdate(PayloadTransferUpdatePtr update,
- base::Optional<Medium> upgraded_medium) override;
+ absl::optional<Medium> upgraded_medium) override;
private:
struct State {
@@ -68,8 +68,8 @@
size_t num_text_attachments_ = 0;
size_t num_file_attachments_ = 0;
uint64_t num_first_update_bytes_ = 0;
- base::Optional<base::TimeTicks> first_update_timestamp_;
- base::Optional<Medium> last_upgraded_medium_;
+ absl::optional<base::TimeTicks> first_update_timestamp_;
+ absl::optional<Medium> last_upgraded_medium_;
};
#endif // CHROME_BROWSER_NEARBY_SHARING_PAYLOAD_TRACKER_H_
diff --git a/chrome/browser/nearby_sharing/payload_tracker_unittest.cc b/chrome/browser/nearby_sharing/payload_tracker_unittest.cc
index eb94bfc..74ce12d 100644
--- a/chrome/browser/nearby_sharing/payload_tracker_unittest.cc
+++ b/chrome/browser/nearby_sharing/payload_tracker_unittest.cc
@@ -50,7 +50,7 @@
for (int i = kAttachmentCount / 2; i < kAttachmentCount; i++) {
TextAttachment text(TextAttachment::Type::kText, "text body.",
- /*title=*/base::nullopt, /*mime_type=*/base::nullopt);
+ /*title=*/absl::nullopt, /*mime_type=*/absl::nullopt);
AttachmentInfo info;
info.payload_id = i;
@@ -61,7 +61,7 @@
// This attachment is not added to |attachment_info_map_|.
TextAttachment text(TextAttachment::Type::kText, "text body.",
- /*title=*/base::nullopt, /*mime_type=*/base::nullopt);
+ /*title=*/absl::nullopt, /*mime_type=*/absl::nullopt);
share_target_.text_attachments.push_back(std::move(text));
payload_tracker_ = std::make_unique<PayloadTracker>(
diff --git a/chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler.cc b/chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler.cc
index 55dc19a..71b75c9 100644
--- a/chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler.cc
+++ b/chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler.cc
@@ -23,12 +23,12 @@
++num_reschedule_calls_;
}
-base::Optional<base::Time> FakeNearbyShareScheduler::GetLastSuccessTime()
+absl::optional<base::Time> FakeNearbyShareScheduler::GetLastSuccessTime()
const {
return last_success_time_;
}
-base::Optional<base::TimeDelta>
+absl::optional<base::TimeDelta>
FakeNearbyShareScheduler::GetTimeUntilNextRequest() const {
return time_until_next_request_;
}
@@ -55,12 +55,12 @@
}
void FakeNearbyShareScheduler::SetLastSuccessTime(
- base::Optional<base::Time> time) {
+ absl::optional<base::Time> time) {
last_success_time_ = time;
}
void FakeNearbyShareScheduler::SetTimeUntilNextRequest(
- base::Optional<base::TimeDelta> time_delta) {
+ absl::optional<base::TimeDelta> time_delta) {
time_until_next_request_ = time_delta;
}
diff --git a/chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler.h b/chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler.h
index 1951ee9..bd0c16b 100644
--- a/chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler.h
+++ b/chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler.h
@@ -7,9 +7,9 @@
#include <vector>
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A fake implementation of NearbyShareScheduler that allows the user to set all
// scheduling data. It tracks the number of immediate requests and the handled
@@ -24,13 +24,13 @@
void MakeImmediateRequest() override;
void HandleResult(bool success) override;
void Reschedule() override;
- base::Optional<base::Time> GetLastSuccessTime() const override;
- base::Optional<base::TimeDelta> GetTimeUntilNextRequest() const override;
+ absl::optional<base::Time> GetLastSuccessTime() const override;
+ absl::optional<base::TimeDelta> GetTimeUntilNextRequest() const override;
bool IsWaitingForResult() const override;
size_t GetNumConsecutiveFailures() const override;
- void SetLastSuccessTime(base::Optional<base::Time> time);
- void SetTimeUntilNextRequest(base::Optional<base::TimeDelta> time_delta);
+ void SetLastSuccessTime(absl::optional<base::Time> time);
+ void SetTimeUntilNextRequest(absl::optional<base::TimeDelta> time_delta);
void SetIsWaitingForResult(bool is_waiting);
void SetNumConsecutiveFailures(size_t num_failures);
@@ -49,8 +49,8 @@
size_t num_immediate_requests_ = 0;
size_t num_reschedule_calls_ = 0;
std::vector<bool> handled_results_;
- base::Optional<base::Time> last_success_time_;
- base::Optional<base::TimeDelta> time_until_next_request_;
+ absl::optional<base::Time> last_success_time_;
+ absl::optional<base::TimeDelta> time_until_next_request_;
bool is_waiting_for_result_ = false;
size_t num_consecutive_failures_ = 0;
};
diff --git a/chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler_factory.h b/chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler_factory.h
index d8cc1ee..422ba5fa 100644
--- a/chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler_factory.h
+++ b/chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler_factory.h
@@ -9,12 +9,12 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/scheduling/fake_nearby_share_scheduler.h"
#include "chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler.h"
#include "chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler.h"
#include "chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class NearbyShareScheduler;
class PrefService;
diff --git a/chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler.cc b/chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler.cc
index ba77021a..0905620 100644
--- a/chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler.cc
+++ b/chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler.cc
@@ -24,12 +24,12 @@
NearbyShareExpirationScheduler::~NearbyShareExpirationScheduler() = default;
-base::Optional<base::TimeDelta>
+absl::optional<base::TimeDelta>
NearbyShareExpirationScheduler::TimeUntilRecurringRequest(
base::Time now) const {
- base::Optional<base::Time> expiration_time = expiration_time_functor_.Run();
+ absl::optional<base::Time> expiration_time = expiration_time_functor_.Run();
if (!expiration_time)
- return base::nullopt;
+ return absl::nullopt;
if (*expiration_time <= now)
return base::TimeDelta::FromSeconds(0);
diff --git a/chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler.h b/chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler.h
index ee527f9..0634ac6 100644
--- a/chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler.h
+++ b/chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler.h
@@ -8,16 +8,16 @@
#include <string>
#include "base/callback.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A NearbyShareSchedulerBase that schedules recurring tasks based on an
// expiration time provided by the owner.
class NearbyShareExpirationScheduler : public NearbyShareSchedulerBase {
public:
using ExpirationTimeFunctor =
- base::RepeatingCallback<base::Optional<base::Time>()>;
+ base::RepeatingCallback<absl::optional<base::Time>()>;
// |expiration_time_functor|: A function provided by the owner that returns
// the next expiration time.
@@ -33,7 +33,7 @@
~NearbyShareExpirationScheduler() override;
protected:
- base::Optional<base::TimeDelta> TimeUntilRecurringRequest(
+ absl::optional<base::TimeDelta> TimeUntilRecurringRequest(
base::Time now) const override;
ExpirationTimeFunctor expiration_time_functor_;
diff --git a/chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler_unittest.cc b/chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler_unittest.cc
index 4efa6dd8..d209dea 100644
--- a/chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler_unittest.cc
+++ b/chrome/browser/nearby_sharing/scheduling/nearby_share_expiration_scheduler_unittest.cc
@@ -6,7 +6,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/test/task_environment.h"
#include "base/time/clock.h"
#include "base/time/time.h"
@@ -15,6 +14,7 @@
#include "components/prefs/testing_pref_service.h"
#include "services/network/test/test_network_connection_tracker.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -47,7 +47,7 @@
&pref_service_, base::DoNothing(), task_environment_.GetMockClock());
}
- base::Optional<base::Time> TestExpirationTimeFunctor() {
+ absl::optional<base::Time> TestExpirationTimeFunctor() {
return expiration_time_;
}
@@ -58,7 +58,7 @@
task_environment_.FastForwardBy(delta);
}
- base::Optional<base::Time> expiration_time_;
+ absl::optional<base::Time> expiration_time_;
NearbyShareScheduler* scheduler() { return scheduler_.get(); }
private:
@@ -98,5 +98,5 @@
TEST_F(NearbyShareExpirationSchedulerTest, NullExpirationTime) {
expiration_time_.reset();
scheduler()->Start();
- EXPECT_EQ(base::nullopt, scheduler()->GetTimeUntilNextRequest());
+ EXPECT_EQ(absl::nullopt, scheduler()->GetTimeUntilNextRequest());
}
diff --git a/chrome/browser/nearby_sharing/scheduling/nearby_share_on_demand_scheduler.cc b/chrome/browser/nearby_sharing/scheduling/nearby_share_on_demand_scheduler.cc
index 0fe5fab7..bcc16f77 100644
--- a/chrome/browser/nearby_sharing/scheduling/nearby_share_on_demand_scheduler.cc
+++ b/chrome/browser/nearby_sharing/scheduling/nearby_share_on_demand_scheduler.cc
@@ -22,7 +22,7 @@
NearbyShareOnDemandScheduler::~NearbyShareOnDemandScheduler() = default;
-base::Optional<base::TimeDelta>
+absl::optional<base::TimeDelta>
NearbyShareOnDemandScheduler::TimeUntilRecurringRequest(base::Time now) const {
- return base::nullopt;
+ return absl::nullopt;
}
diff --git a/chrome/browser/nearby_sharing/scheduling/nearby_share_on_demand_scheduler.h b/chrome/browser/nearby_sharing/scheduling/nearby_share_on_demand_scheduler.h
index 4793315..e8454737 100644
--- a/chrome/browser/nearby_sharing/scheduling/nearby_share_on_demand_scheduler.h
+++ b/chrome/browser/nearby_sharing/scheduling/nearby_share_on_demand_scheduler.h
@@ -7,9 +7,9 @@
#include <string>
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A NearbyShareSchedulerBase that does not schedule recurring tasks.
class NearbyShareOnDemandScheduler : public NearbyShareSchedulerBase {
@@ -25,8 +25,8 @@
~NearbyShareOnDemandScheduler() override;
private:
- // Return base::nullopt so as not to schedule recurring requests.
- base::Optional<base::TimeDelta> TimeUntilRecurringRequest(
+ // Return absl::nullopt so as not to schedule recurring requests.
+ absl::optional<base::TimeDelta> TimeUntilRecurringRequest(
base::Time now) const override;
};
diff --git a/chrome/browser/nearby_sharing/scheduling/nearby_share_periodic_scheduler.cc b/chrome/browser/nearby_sharing/scheduling/nearby_share_periodic_scheduler.cc
index ab768f6e..cc89df0 100644
--- a/chrome/browser/nearby_sharing/scheduling/nearby_share_periodic_scheduler.cc
+++ b/chrome/browser/nearby_sharing/scheduling/nearby_share_periodic_scheduler.cc
@@ -25,9 +25,9 @@
NearbySharePeriodicScheduler::~NearbySharePeriodicScheduler() = default;
-base::Optional<base::TimeDelta>
+absl::optional<base::TimeDelta>
NearbySharePeriodicScheduler::TimeUntilRecurringRequest(base::Time now) const {
- base::Optional<base::Time> last_success_time = GetLastSuccessTime();
+ absl::optional<base::Time> last_success_time = GetLastSuccessTime();
// Immediately run a first-time request.
if (!last_success_time)
diff --git a/chrome/browser/nearby_sharing/scheduling/nearby_share_periodic_scheduler.h b/chrome/browser/nearby_sharing/scheduling/nearby_share_periodic_scheduler.h
index 05ea99b..fb10d36d 100644
--- a/chrome/browser/nearby_sharing/scheduling/nearby_share_periodic_scheduler.h
+++ b/chrome/browser/nearby_sharing/scheduling/nearby_share_periodic_scheduler.h
@@ -7,9 +7,9 @@
#include <string>
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A NearbyShareSchedulerBase that schedules periodic tasks at fixed intervals.
// Immediate requests and/or failure retries can interrupt this pattern. The
@@ -32,7 +32,7 @@
private:
// Returns the time until the next periodic request using the time since
// the last success. Immediately runs a first-time periodic request.
- base::Optional<base::TimeDelta> TimeUntilRecurringRequest(
+ absl::optional<base::TimeDelta> TimeUntilRecurringRequest(
base::Time now) const override;
base::TimeDelta request_period_;
diff --git a/chrome/browser/nearby_sharing/scheduling/nearby_share_periodic_scheduler_unittest.cc b/chrome/browser/nearby_sharing/scheduling/nearby_share_periodic_scheduler_unittest.cc
index eb73fdc..ddc36ea 100644
--- a/chrome/browser/nearby_sharing/scheduling/nearby_share_periodic_scheduler_unittest.cc
+++ b/chrome/browser/nearby_sharing/scheduling/nearby_share_periodic_scheduler_unittest.cc
@@ -59,7 +59,7 @@
// Immediately runs a first-time periodic request.
scheduler()->Start();
- base::Optional<base::TimeDelta> time_until_next_request =
+ absl::optional<base::TimeDelta> time_until_next_request =
scheduler()->GetTimeUntilNextRequest();
EXPECT_EQ(base::TimeDelta::FromSeconds(0),
scheduler()->GetTimeUntilNextRequest());
diff --git a/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler.h b/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler.h
index 63c6416d..837d6b64 100644
--- a/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler.h
+++ b/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_NEARBY_SHARING_SCHEDULING_NEARBY_SHARE_SCHEDULER_H_
#include "base/callback.h"
-#include "base/optional.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Schedules tasks and alerts the owner when a request is ready. Scheduling
// begins after Start() is called, and scheduling is stopped via Stop().
@@ -41,12 +41,12 @@
virtual void Reschedule() = 0;
// Returns the time of the last known successful request. If no request has
- // succeeded, base::nullopt is returned.
- virtual base::Optional<base::Time> GetLastSuccessTime() const = 0;
+ // succeeded, absl::nullopt is returned.
+ virtual absl::optional<base::Time> GetLastSuccessTime() const = 0;
- // Returns the time until the next scheduled request. Returns base::nullopt if
+ // Returns the time until the next scheduled request. Returns absl::nullopt if
// there is no request scheduled.
- virtual base::Optional<base::TimeDelta> GetTimeUntilNextRequest() const = 0;
+ virtual absl::optional<base::TimeDelta> GetTimeUntilNextRequest() const = 0;
// Returns true after the |callback_| has been alerted of a request but before
// HandleResult() is invoked.
diff --git a/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base.cc b/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base.cc
index d93f5bf..d550466 100644
--- a/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base.cc
+++ b/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base.cc
@@ -91,7 +91,7 @@
timer_.Stop();
- base::Optional<base::TimeDelta> delay = GetTimeUntilNextRequest();
+ absl::optional<base::TimeDelta> delay = GetTimeUntilNextRequest();
if (!delay)
return;
@@ -100,16 +100,16 @@
base::Unretained(this)));
}
-base::Optional<base::Time> NearbyShareSchedulerBase::GetLastSuccessTime()
+absl::optional<base::Time> NearbyShareSchedulerBase::GetLastSuccessTime()
const {
return util::ValueToTime(pref_service_->GetDictionary(pref_name_)
->FindKey(kLastSuccessTimeKeyName));
}
-base::Optional<base::TimeDelta>
+absl::optional<base::TimeDelta>
NearbyShareSchedulerBase::GetTimeUntilNextRequest() const {
if (!is_running() || IsWaitingForResult())
- return base::nullopt;
+ return absl::nullopt;
if (HasPendingImmediateRequest())
return kZeroTimeDelta;
@@ -117,7 +117,7 @@
base::Time now = clock_->Now();
// Recover from failures using exponential backoff strategy if necessary.
- base::Optional<base::TimeDelta> time_until_retry = TimeUntilRetry(now);
+ absl::optional<base::TimeDelta> time_until_retry = TimeUntilRetry(now);
if (time_until_retry)
return time_until_retry;
@@ -162,7 +162,7 @@
Reschedule();
}
-base::Optional<base::Time> NearbyShareSchedulerBase::GetLastAttemptTime()
+absl::optional<base::Time> NearbyShareSchedulerBase::GetLastAttemptTime()
const {
return util::ValueToTime(pref_service_->GetDictionary(pref_name_)
->FindKey(kLastAttemptTimeKeyName));
@@ -217,14 +217,14 @@
}
}
-base::Optional<base::TimeDelta> NearbyShareSchedulerBase::TimeUntilRetry(
+absl::optional<base::TimeDelta> NearbyShareSchedulerBase::TimeUntilRetry(
base::Time now) const {
if (!retry_failures_)
- return base::nullopt;
+ return absl::nullopt;
size_t num_failures = GetNumConsecutiveFailures();
if (num_failures == 0)
- return base::nullopt;
+ return absl::nullopt;
// The exponential back off is
//
@@ -252,9 +252,9 @@
}
void NearbyShareSchedulerBase::PrintSchedulerState() const {
- base::Optional<base::Time> last_attempt_time = GetLastAttemptTime();
- base::Optional<base::Time> last_success_time = GetLastSuccessTime();
- base::Optional<base::TimeDelta> time_until_next_request =
+ absl::optional<base::Time> last_attempt_time = GetLastAttemptTime();
+ absl::optional<base::Time> last_success_time = GetLastSuccessTime();
+ absl::optional<base::TimeDelta> time_until_next_request =
GetTimeUntilNextRequest();
std::stringstream ss;
diff --git a/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base.h b/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base.h
index 065239a..79d0b4f 100644
--- a/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base.h
+++ b/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base.h
@@ -8,11 +8,11 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler.h"
#include "services/network/public/cpp/network_connection_tracker.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Clock;
@@ -59,15 +59,15 @@
const base::Clock* clock);
// The time to wait until the next regularly recurring request.
- virtual base::Optional<base::TimeDelta> TimeUntilRecurringRequest(
+ virtual absl::optional<base::TimeDelta> TimeUntilRecurringRequest(
base::Time now) const = 0;
// NearbyShareScheduler:
void MakeImmediateRequest() override;
void HandleResult(bool success) override;
void Reschedule() override;
- base::Optional<base::Time> GetLastSuccessTime() const override;
- base::Optional<base::TimeDelta> GetTimeUntilNextRequest() const override;
+ absl::optional<base::Time> GetLastSuccessTime() const override;
+ absl::optional<base::TimeDelta> GetTimeUntilNextRequest() const override;
bool IsWaitingForResult() const override;
size_t GetNumConsecutiveFailures() const override;
void OnStart() override;
@@ -76,7 +76,7 @@
// network::NetworkConnectionTracker::NetworkConnectionObserver:
void OnConnectionChanged(network::mojom::ConnectionType type) override;
- base::Optional<base::Time> GetLastAttemptTime() const;
+ absl::optional<base::Time> GetLastAttemptTime() const;
bool HasPendingImmediateRequest() const;
// Set and persist scheduling data in prefs.
@@ -92,9 +92,9 @@
void InitializePersistedRequest();
// The amount of time to wait until the next automatic failure retry. Returns
- // base::nullopt if there is no failure to retry or if failure retry is not
+ // absl::nullopt if there is no failure to retry or if failure retry is not
// enabled for the scheduler.
- base::Optional<base::TimeDelta> TimeUntilRetry(base::Time now) const;
+ absl::optional<base::TimeDelta> TimeUntilRetry(base::Time now) const;
// Notifies the owner that a request is ready. Early returns if not online and
// the scheduler requires connectivity; the attempt is rescheduled when
diff --git a/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base_unittest.cc b/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base_unittest.cc
index 31ea861..83c58e3d 100644
--- a/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base_unittest.cc
+++ b/chrome/browser/nearby_sharing/scheduling/nearby_share_scheduler_base_unittest.cc
@@ -32,7 +32,7 @@
class NearbyShareSchedulerBaseForTest : public NearbyShareSchedulerBase {
public:
NearbyShareSchedulerBaseForTest(
- base::Optional<base::TimeDelta> time_until_recurring_request,
+ absl::optional<base::TimeDelta> time_until_recurring_request,
bool retry_failures,
bool require_connectivity,
const std::string& pref_name,
@@ -50,12 +50,12 @@
~NearbyShareSchedulerBaseForTest() override = default;
private:
- base::Optional<base::TimeDelta> TimeUntilRecurringRequest(
+ absl::optional<base::TimeDelta> TimeUntilRecurringRequest(
base::Time now) const override {
return time_until_recurring_request_;
}
- base::Optional<base::TimeDelta> time_until_recurring_request_;
+ absl::optional<base::TimeDelta> time_until_recurring_request_;
};
} // namespace
@@ -75,7 +75,7 @@
void CreateScheduler(
bool retry_failures,
bool require_connectivity,
- base::Optional<base::TimeDelta> time_until_recurring_request =
+ absl::optional<base::TimeDelta> time_until_recurring_request =
kTestTimeUntilRecurringRequest) {
scheduler_ = std::make_unique<NearbyShareSchedulerBaseForTest>(
time_until_recurring_request, retry_failures, require_connectivity,
@@ -106,7 +106,7 @@
void RunPendingRequest() {
EXPECT_FALSE(scheduler_->IsWaitingForResult());
- base::Optional<base::TimeDelta> time_until_next_request =
+ absl::optional<base::TimeDelta> time_until_next_request =
scheduler_->GetTimeUntilNextRequest();
ASSERT_TRUE(time_until_next_request);
FastForward(*time_until_next_request);
@@ -116,14 +116,14 @@
EXPECT_TRUE(scheduler_->IsWaitingForResult());
EXPECT_FALSE(scheduler_->GetTimeUntilNextRequest());
size_t num_failures = scheduler_->GetNumConsecutiveFailures();
- base::Optional<base::Time> last_success_time =
+ absl::optional<base::Time> last_success_time =
scheduler_->GetLastSuccessTime();
scheduler_->HandleResult(success);
EXPECT_FALSE(scheduler_->IsWaitingForResult());
EXPECT_EQ(success ? 0 : num_failures + 1,
scheduler_->GetNumConsecutiveFailures());
EXPECT_EQ(
- success ? base::make_optional<base::Time>(Now()) : last_success_time,
+ success ? absl::make_optional<base::Time>(Now()) : last_success_time,
scheduler_->GetLastSuccessTime());
}
@@ -169,7 +169,7 @@
TEST_F(NearbyShareSchedulerBaseTest, NoRecurringRequest) {
// The flavor of the schedule does not schedule recurring requests.
CreateScheduler(/*retry_failures=*/true, /*require_connectivity=*/true,
- /*time_until_recurring_request=*/base::nullopt);
+ /*time_until_recurring_request=*/absl::nullopt);
StartScheduling();
EXPECT_FALSE(scheduler()->GetTimeUntilNextRequest());
diff --git a/chrome/browser/nearby_sharing/share_target.cc b/chrome/browser/nearby_sharing/share_target.cc
index 2172cb7b..a9a25ce 100644
--- a/chrome/browser/nearby_sharing/share_target.cc
+++ b/chrome/browser/nearby_sharing/share_target.cc
@@ -14,9 +14,9 @@
std::vector<TextAttachment> text_attachments,
std::vector<FileAttachment> file_attachments,
bool is_incoming,
- base::Optional<std::string> full_name,
+ absl::optional<std::string> full_name,
bool is_known,
- base::Optional<std::string> device_id)
+ absl::optional<std::string> device_id)
: device_name(std::move(device_name)),
image_url(std::move(image_url)),
type(type),
diff --git a/chrome/browser/nearby_sharing/share_target.h b/chrome/browser/nearby_sharing/share_target.h
index de0d2886..3c3407f 100644
--- a/chrome/browser/nearby_sharing/share_target.h
+++ b/chrome/browser/nearby_sharing/share_target.h
@@ -9,11 +9,11 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "base/unguessable_token.h"
#include "chrome/browser/nearby_sharing/file_attachment.h"
#include "chrome/browser/nearby_sharing/text_attachment.h"
#include "chromeos/services/nearby/public/mojom/nearby_share_target_types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
// A remote device.
@@ -26,9 +26,9 @@
std::vector<TextAttachment> text_attachments,
std::vector<FileAttachment> file_attachments,
bool is_incoming,
- base::Optional<std::string> full_name,
+ absl::optional<std::string> full_name,
bool is_known,
- base::Optional<std::string> device_id);
+ absl::optional<std::string> device_id);
ShareTarget(const ShareTarget&);
ShareTarget(ShareTarget&&);
ShareTarget& operator=(const ShareTarget&);
@@ -44,16 +44,16 @@
base::UnguessableToken id = base::UnguessableToken::Create();
std::string device_name;
// Uri that points to an image of the ShareTarget, if one exists.
- base::Optional<GURL> image_url;
+ absl::optional<GURL> image_url;
nearby_share::mojom::ShareTargetType type =
nearby_share::mojom::ShareTargetType::kUnknown;
std::vector<TextAttachment> text_attachments;
std::vector<FileAttachment> file_attachments;
bool is_incoming = false;
- base::Optional<std::string> full_name;
+ absl::optional<std::string> full_name;
// True if local device has the PublicCertificate this target is advertising.
bool is_known = false;
- base::Optional<std::string> device_id;
+ absl::optional<std::string> device_id;
};
#endif // CHROME_BROWSER_NEARBY_SHARING_SHARE_TARGET_H_
diff --git a/chrome/browser/nearby_sharing/share_target_info.h b/chrome/browser/nearby_sharing/share_target_info.h
index 810fdf1..33a3add4 100644
--- a/chrome/browser/nearby_sharing/share_target_info.h
+++ b/chrome/browser/nearby_sharing/share_target_info.h
@@ -9,13 +9,13 @@
#include <string>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/certificates/nearby_share_decrypted_public_certificate.h"
#include "chrome/browser/nearby_sharing/incoming_frames_reader.h"
#include "chrome/browser/nearby_sharing/nearby_connections_manager.h"
#include "chrome/browser/nearby_sharing/paired_key_verification_runner.h"
#include "chrome/browser/nearby_sharing/payload_tracker.h"
#include "chrome/browser/nearby_sharing/transfer_update_callback.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class NearbyConnection;
@@ -27,7 +27,7 @@
ShareTargetInfo& operator=(ShareTargetInfo&&);
virtual ~ShareTargetInfo();
- const base::Optional<std::string>& endpoint_id() const {
+ const absl::optional<std::string>& endpoint_id() const {
return endpoint_id_;
}
@@ -35,7 +35,7 @@
endpoint_id_ = std::move(endpoint_id);
}
- const base::Optional<NearbyShareDecryptedPublicCertificate>& certificate()
+ const absl::optional<NearbyShareDecryptedPublicCertificate>& certificate()
const {
return certificate_;
}
@@ -59,7 +59,7 @@
transfer_update_callback_ = std::move(transfer_update_callback);
}
- const base::Optional<std::string>& token() const { return token_; }
+ const absl::optional<std::string>& token() const { return token_; }
void set_token(std::string token) { token_ = std::move(token); }
@@ -88,11 +88,11 @@
}
private:
- base::Optional<std::string> endpoint_id_;
- base::Optional<NearbyShareDecryptedPublicCertificate> certificate_;
+ absl::optional<std::string> endpoint_id_;
+ absl::optional<NearbyShareDecryptedPublicCertificate> certificate_;
NearbyConnection* connection_ = nullptr;
std::unique_ptr<TransferUpdateCallback> transfer_update_callback_;
- base::Optional<std::string> token_;
+ absl::optional<std::string> token_;
std::unique_ptr<IncomingFramesReader> frames_reader_;
std::unique_ptr<PairedKeyVerificationRunner> key_verification_runner_;
std::unique_ptr<PayloadTracker> payload_tracker_;
diff --git a/chrome/browser/nearby_sharing/sharesheet/nearby_share_action.cc b/chrome/browser/nearby_sharing/sharesheet/nearby_share_action.cc
index ee29a1a1..9f37cb8a 100644
--- a/chrome/browser/nearby_sharing/sharesheet/nearby_share_action.cc
+++ b/chrome/browser/nearby_sharing/sharesheet/nearby_share_action.cc
@@ -50,7 +50,7 @@
std::string GetFirstFilenameFromFileUrls(
Profile* profile,
- base::Optional<std::vector<GURL>> file_urls) {
+ absl::optional<std::vector<GURL>> file_urls) {
if (!file_urls) {
return std::string();
}
diff --git a/chrome/browser/nearby_sharing/sharesheet/nearby_share_action.h b/chrome/browser/nearby_sharing/sharesheet/nearby_share_action.h
index b49f07a..1862283 100644
--- a/chrome/browser/nearby_sharing/sharesheet/nearby_share_action.h
+++ b/chrome/browser/nearby_sharing/sharesheet/nearby_share_action.h
@@ -55,8 +55,8 @@
private:
bool IsNearbyShareDisabledByPolicy();
- base::Optional<bool> nearby_share_disabled_by_policy_for_testing_ =
- base::nullopt;
+ absl::optional<bool> nearby_share_disabled_by_policy_for_testing_ =
+ absl::nullopt;
views::WebView* web_view_;
views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
};
diff --git a/chrome/browser/nearby_sharing/sharesheet/nearby_share_action_unittest.cc b/chrome/browser/nearby_sharing/sharesheet/nearby_share_action_unittest.cc
index c34bcea0..b2dfcd73 100644
--- a/chrome/browser/nearby_sharing/sharesheet/nearby_share_action_unittest.cc
+++ b/chrome/browser/nearby_sharing/sharesheet/nearby_share_action_unittest.cc
@@ -32,7 +32,7 @@
apps::mojom::IntentPtr intent;
bool contains_hosted_document;
bool should_show_action;
- base::Optional<TextAttachment::Type> text_attachment_type;
+ absl::optional<TextAttachment::Type> text_attachment_type;
int file_count;
};
@@ -82,28 +82,28 @@
test_cases.push_back({apps_util::CreateShareIntentFromFiles(
{GURL(kImageFile)}, {kMimeTypeJPG}),
/*contains_hosted_document=*/false,
- /*should_show_action=*/true, base::nullopt,
+ /*should_show_action=*/true, absl::nullopt,
/*file_count=*/1});
// File share, two text files
test_cases.push_back({apps_util::CreateShareIntentFromFiles(
{GURL(kTextFile1), GURL(kTextFile2)},
{kMimeTypeText, kMimeTypeText}),
/*contains_hosted_document=*/false,
- /*should_show_action=*/true, base::nullopt,
+ /*should_show_action=*/true, absl::nullopt,
/*file_count=*/2});
// File share, two mixed files
test_cases.push_back({apps_util::CreateShareIntentFromFiles(
{GURL(kTextFile1), GURL(kImageFile)},
{kMimeTypeText, kMimeTypeJPG}),
/*contains_hosted_document=*/false,
- /*should_show_action=*/true, base::nullopt,
+ /*should_show_action=*/true, absl::nullopt,
/*file_count=*/2});
// File share, one file with title
test_cases.push_back(
{apps_util::CreateShareIntentFromFiles({GURL(kImageFile)},
{kMimeTypeJPG}, kEmpty, kTitle),
/*contains_hosted_document=*/false, /*should_show_action=*/true,
- base::nullopt, /*file_count=*/1});
+ absl::nullopt, /*file_count=*/1});
// Invalid: File share with text body
test_cases.push_back({apps_util::CreateShareIntentFromFiles(
{GURL(kTextFile1), GURL(kTextFile2)},
diff --git a/chrome/browser/nearby_sharing/text_attachment.cc b/chrome/browser/nearby_sharing/text_attachment.cc
index 7c0aec46..52387d47 100644
--- a/chrome/browser/nearby_sharing/text_attachment.cc
+++ b/chrome/browser/nearby_sharing/text_attachment.cc
@@ -14,10 +14,10 @@
namespace {
// Tries to get a valid host name from the |text|. Returns nullopt otherwise.
-base::Optional<std::string> GetHostFromText(const std::string& text) {
+absl::optional<std::string> GetHostFromText(const std::string& text) {
GURL url(text);
if (!url.is_valid() || !url.has_host())
- return base::nullopt;
+ return absl::nullopt;
return url.host();
}
@@ -75,7 +75,7 @@
switch (type) {
case TextAttachment::Type::kUrl: {
- base::Optional<std::string> host = GetHostFromText(text_body);
+ absl::optional<std::string> host = GetHostFromText(text_body);
if (host)
return *host;
@@ -97,8 +97,8 @@
TextAttachment::TextAttachment(Type type,
std::string text_body,
- base::Optional<std::string> text_title,
- base::Optional<std::string> mime_type)
+ absl::optional<std::string> text_title,
+ absl::optional<std::string> mime_type)
: Attachment(Attachment::Family::kText, text_body.size()),
type_(type),
text_title_(text_title && !text_title->empty()
diff --git a/chrome/browser/nearby_sharing/text_attachment.h b/chrome/browser/nearby_sharing/text_attachment.h
index 6a19738..a4e6134 100644
--- a/chrome/browser/nearby_sharing/text_attachment.h
+++ b/chrome/browser/nearby_sharing/text_attachment.h
@@ -7,9 +7,9 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/attachment.h"
#include "chromeos/services/nearby/public/mojom/nearby_decoder_types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Represents a text attachment.
class TextAttachment : public Attachment {
@@ -18,8 +18,8 @@
TextAttachment(Type type,
std::string text_body,
- base::Optional<std::string> text_title,
- base::Optional<std::string> mime_type);
+ absl::optional<std::string> text_title,
+ absl::optional<std::string> mime_type);
TextAttachment(int64_t id, Type type, std::string text_title, int64_t size);
TextAttachment(const TextAttachment&);
TextAttachment(TextAttachment&&);
diff --git a/chrome/browser/nearby_sharing/text_attachment_unittest.cc b/chrome/browser/nearby_sharing/text_attachment_unittest.cc
index ae72e56..4aa5e14 100644
--- a/chrome/browser/nearby_sharing/text_attachment_unittest.cc
+++ b/chrome/browser/nearby_sharing/text_attachment_unittest.cc
@@ -68,8 +68,8 @@
TEST_P(TextAttachmentTextTitleTest, TextTitleMatches) {
TextAttachment attachment(GetParam().type, GetParam().text_body,
- /*title=*/base::nullopt,
- /*mime_type=*/base::nullopt);
+ /*title=*/absl::nullopt,
+ /*mime_type=*/absl::nullopt);
EXPECT_EQ(GetParam().expected_text_title, attachment.text_title());
}
diff --git a/chrome/browser/nearby_sharing/transfer_metadata.cc b/chrome/browser/nearby_sharing/transfer_metadata.cc
index 1eaf4c0..f1c8336c 100644
--- a/chrome/browser/nearby_sharing/transfer_metadata.cc
+++ b/chrome/browser/nearby_sharing/transfer_metadata.cc
@@ -223,7 +223,7 @@
TransferMetadata::TransferMetadata(Status status,
float progress,
- base::Optional<std::string> token,
+ absl::optional<std::string> token,
bool is_original,
bool is_final_status)
: status_(status),
diff --git a/chrome/browser/nearby_sharing/transfer_metadata.h b/chrome/browser/nearby_sharing/transfer_metadata.h
index cbad074d..c551945 100644
--- a/chrome/browser/nearby_sharing/transfer_metadata.h
+++ b/chrome/browser/nearby_sharing/transfer_metadata.h
@@ -7,8 +7,8 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/ui/webui/nearby_share/nearby_share.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
// Metadata about an ongoing transfer. Wraps transient data like status and
@@ -65,7 +65,7 @@
TransferMetadata(Status status,
float progress,
- base::Optional<std::string> token,
+ absl::optional<std::string> token,
bool is_original,
bool is_final_status);
~TransferMetadata();
@@ -77,9 +77,9 @@
// Returns transfer progress as percentage.
float progress() const { return progress_; }
- // Represents the UKey2 token from Nearby Connection. base::nullopt if no
+ // Represents the UKey2 token from Nearby Connection. absl::nullopt if no
// UKey2 comparison is needed for this transfer.
- const base::Optional<std::string>& token() const { return token_; }
+ const absl::optional<std::string>& token() const { return token_; }
// True if this |TransferMetadata| has not been seen.
bool is_original() const { return is_original_; }
@@ -92,7 +92,7 @@
private:
Status status_;
float progress_;
- base::Optional<std::string> token_;
+ absl::optional<std::string> token_;
bool is_original_;
bool is_final_status_;
};
diff --git a/chrome/browser/nearby_sharing/transfer_metadata_builder.cc b/chrome/browser/nearby_sharing/transfer_metadata_builder.cc
index 122ab5c..f70d087 100644
--- a/chrome/browser/nearby_sharing/transfer_metadata_builder.cc
+++ b/chrome/browser/nearby_sharing/transfer_metadata_builder.cc
@@ -44,7 +44,7 @@
}
TransferMetadataBuilder& TransferMetadataBuilder::set_token(
- base::Optional<std::string> token) {
+ absl::optional<std::string> token) {
token_ = std::move(token);
return *this;
}
diff --git a/chrome/browser/nearby_sharing/transfer_metadata_builder.h b/chrome/browser/nearby_sharing/transfer_metadata_builder.h
index 125a088..40af39e 100644
--- a/chrome/browser/nearby_sharing/transfer_metadata_builder.h
+++ b/chrome/browser/nearby_sharing/transfer_metadata_builder.h
@@ -7,8 +7,8 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/nearby_sharing/transfer_metadata.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class TransferMetadataBuilder {
public:
@@ -25,7 +25,7 @@
TransferMetadataBuilder& set_status(TransferMetadata::Status status);
- TransferMetadataBuilder& set_token(base::Optional<std::string> token);
+ TransferMetadataBuilder& set_token(absl::optional<std::string> token);
TransferMetadata build() const;
@@ -33,7 +33,7 @@
bool is_original_ = false;
double progress_ = 0;
TransferMetadata::Status status_ = TransferMetadata::Status::kInProgress;
- base::Optional<std::string> token_;
+ absl::optional<std::string> token_;
};
#endif // CHROME_BROWSER_NEARBY_SHARING_TRANSFER_METADATA_BUILDER_H_
diff --git a/chrome/browser/net/cert_verify_proc_browsertest.cc b/chrome/browser/net/cert_verify_proc_browsertest.cc
index ed8a0fc..037ed28 100644
--- a/chrome/browser/net/cert_verify_proc_browsertest.cc
+++ b/chrome/browser/net/cert_verify_proc_browsertest.cc
@@ -45,7 +45,7 @@
constexpr auto kWaitInterval = base::TimeDelta::FromMilliseconds(50);
int tries_left = kMaxWaitTime / kWaitInterval;
- base::Optional<base::Value> parsed_net_log;
+ absl::optional<base::Value> parsed_net_log;
while (true) {
std::string file_contents;
ASSERT_TRUE(base::ReadFileToString(net_log_path_, &file_contents));
@@ -104,11 +104,11 @@
bool found_cert_verify_proc_event = false;
for (const auto& event : events->GetList()) {
- base::Optional<int> event_type = event.FindIntKey("type");
+ absl::optional<int> event_type = event.FindIntKey("type");
ASSERT_TRUE(event_type.has_value());
if (event_type ==
static_cast<int>(net::NetLogEventType::CERT_VERIFY_PROC)) {
- base::Optional<int> phase = event.FindIntKey("phase");
+ absl::optional<int> phase = event.FindIntKey("phase");
if (!phase.has_value() ||
*phase != static_cast<int>(net::NetLogEventPhase::BEGIN)) {
continue;
diff --git a/chrome/browser/net/chrome_mojo_proxy_resolver_factory_browsertest.cc b/chrome/browser/net/chrome_mojo_proxy_resolver_factory_browsertest.cc
index ab559eb..06ee495 100644
--- a/chrome/browser/net/chrome_mojo_proxy_resolver_factory_browsertest.cc
+++ b/chrome/browser/net/chrome_mojo_proxy_resolver_factory_browsertest.cc
@@ -9,7 +9,6 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/process/process.h"
#include "base/run_loop.h"
#include "base/synchronization/waitable_event.h"
@@ -23,6 +22,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -220,7 +220,7 @@
mojo::Remote<proxy_resolver::mojom::ProxyResolverFactory> resolver_factory(
ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver());
- base::Optional<ProxyResolverProcessObserver> observer{absl::in_place};
+ absl::optional<ProxyResolverProcessObserver> observer{absl::in_place};
// Create a resolver, this should create and start the service.
std::unique_ptr<DumbProxyResolverFactoryRequestClient> resolver_client =
diff --git a/chrome/browser/net/convert_explicitly_allowed_network_ports_pref.cc b/chrome/browser/net/convert_explicitly_allowed_network_ports_pref.cc
index 550a2853..adeb603d 100644
--- a/chrome/browser/net/convert_explicitly_allowed_network_ports_pref.cc
+++ b/chrome/browser/net/convert_explicitly_allowed_network_ports_pref.cc
@@ -24,7 +24,7 @@
}
explicitly_allowed_network_ports.reserve(list_view.size());
for (const base::Value& value : list_view) {
- const base::Optional<int> optional_int = value.GetIfInt();
+ const absl::optional<int> optional_int = value.GetIfInt();
if (!optional_int) {
// We handle this case because prefs can be corrupt, but it shouldn't
// happen normally.
diff --git a/chrome/browser/net/dns_probe_runner.cc b/chrome/browser/net/dns_probe_runner.cc
index e3aa334..b5644ef 100644
--- a/chrome/browser/net/dns_probe_runner.cc
+++ b/chrome/browser/net/dns_probe_runner.cc
@@ -7,7 +7,6 @@
#include <utility>
#include "base/bind.h"
-#include "base/optional.h"
#include "mojo/public/cpp/bindings/message.h"
#include "net/base/address_list.h"
#include "net/base/host_port_pair.h"
@@ -15,6 +14,7 @@
#include "net/base/network_isolation_key.h"
#include "net/dns/public/resolve_error_info.h"
#include "services/network/public/mojom/network_context.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chrome_browser_net {
@@ -24,7 +24,7 @@
DnsProbeRunner::Result EvaluateResponse(
int net_error,
- const base::Optional<net::AddressList>& resolved_addresses) {
+ const absl::optional<net::AddressList>& resolved_addresses) {
switch (net_error) {
case net::OK:
break;
@@ -118,7 +118,7 @@
void DnsProbeRunner::OnComplete(
int32_t result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) {
+ const absl::optional<net::AddressList>& resolved_addresses) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!callback_.is_null());
@@ -141,7 +141,7 @@
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
CreateHostResolver();
OnComplete(net::ERR_NAME_NOT_RESOLVED, net::ResolveErrorInfo(net::ERR_FAILED),
- base::nullopt);
+ absl::nullopt);
}
} // namespace chrome_browser_net
diff --git a/chrome/browser/net/dns_probe_runner.h b/chrome/browser/net/dns_probe_runner.h
index 9cea1634..61bdd9cf 100644
--- a/chrome/browser/net/dns_probe_runner.h
+++ b/chrome/browser/net/dns_probe_runner.h
@@ -70,7 +70,7 @@
void OnComplete(
int32_t result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) override;
+ const absl::optional<net::AddressList>& resolved_addresses) override;
net::DnsConfigOverrides GetConfigOverridesForTesting() {
return dns_config_overrides_;
diff --git a/chrome/browser/net/dns_probe_runner_unittest.cc b/chrome/browser/net/dns_probe_runner_unittest.cc
index b23fed2..af6ffa3 100644
--- a/chrome/browser/net/dns_probe_runner_unittest.cc
+++ b/chrome/browser/net/dns_probe_runner_unittest.cc
@@ -50,7 +50,7 @@
: result_list_(std::move(result_list)) {}
void CreateHostResolver(
- const base::Optional<net::DnsConfigOverrides>& config_overrides,
+ const absl::optional<net::DnsConfigOverrides>& config_overrides,
mojo::PendingReceiver<network::mojom::HostResolver> receiver) override {
ASSERT_FALSE(resolver_);
resolver_ = std::make_unique<FakeHostResolver>(std::move(receiver),
@@ -70,7 +70,7 @@
: result_list_(std::move(result_list)) {}
void CreateHostResolver(
- const base::Optional<net::DnsConfigOverrides>& config_overrides,
+ const absl::optional<net::DnsConfigOverrides>& config_overrides,
mojo::PendingReceiver<network::mojom::HostResolver> receiver) override {
if (call_num == 0) {
resolver_ = std::make_unique<HangingHostResolver>(std::move(receiver));
diff --git a/chrome/browser/net/dns_probe_test_util.cc b/chrome/browser/net/dns_probe_test_util.cc
index 7ca1bc2c..90c3bb7 100644
--- a/chrome/browser/net/dns_probe_test_util.cc
+++ b/chrome/browser/net/dns_probe_test_util.cc
@@ -17,9 +17,9 @@
namespace {
-static base::Optional<net::AddressList> AddressListForResponse(
+static absl::optional<net::AddressList> AddressListForResponse(
FakeHostResolver::Response response) {
- base::Optional<net::AddressList> resolved_addresses;
+ absl::optional<net::AddressList> resolved_addresses;
switch (response) {
case FakeHostResolver::kNoResponse:
break;
@@ -123,7 +123,7 @@
FakeHostResolverNetworkContext::~FakeHostResolverNetworkContext() = default;
void FakeHostResolverNetworkContext::CreateHostResolver(
- const base::Optional<net::DnsConfigOverrides>& config_overrides,
+ const absl::optional<net::DnsConfigOverrides>& config_overrides,
mojo::PendingReceiver<network::mojom::HostResolver> receiver) {
ASSERT_TRUE(config_overrides);
if (!config_overrides->nameservers) {
@@ -145,7 +145,7 @@
default;
void HangingHostResolverNetworkContext::CreateHostResolver(
- const base::Optional<net::DnsConfigOverrides>& config_overrides,
+ const absl::optional<net::DnsConfigOverrides>& config_overrides,
mojo::PendingReceiver<network::mojom::HostResolver> receiver) {
resolver_ = std::make_unique<HangingHostResolver>(std::move(receiver));
}
diff --git a/chrome/browser/net/dns_probe_test_util.h b/chrome/browser/net/dns_probe_test_util.h
index bd9d454..a3d92cb 100644
--- a/chrome/browser/net/dns_probe_test_util.h
+++ b/chrome/browser/net/dns_probe_test_util.h
@@ -98,7 +98,7 @@
~FakeHostResolverNetworkContext() override;
void CreateHostResolver(
- const base::Optional<net::DnsConfigOverrides>& config_overrides,
+ const absl::optional<net::DnsConfigOverrides>& config_overrides,
mojo::PendingReceiver<network::mojom::HostResolver> receiver) override;
private:
@@ -114,7 +114,7 @@
~HangingHostResolverNetworkContext() override;
void CreateHostResolver(
- const base::Optional<net::DnsConfigOverrides>& config_overrides,
+ const absl::optional<net::DnsConfigOverrides>& config_overrides,
mojo::PendingReceiver<network::mojom::HostResolver> receiver) override;
private:
diff --git a/chrome/browser/net/ftp_browsertest.cc b/chrome/browser/net/ftp_browsertest.cc
index ae1e805..9459367c 100644
--- a/chrome/browser/net/ftp_browsertest.cc
+++ b/chrome/browser/net/ftp_browsertest.cc
@@ -114,7 +114,7 @@
content::WebContents* web_contents,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin) override {
+ const absl::optional<url::Origin>& initiating_origin) override {
NOTREACHED();
}
diff --git a/chrome/browser/net/network_context_configuration_browsertest.cc b/chrome/browser/net/network_context_configuration_browsertest.cc
index 1139379..7201fbb 100644
--- a/chrome/browser/net/network_context_configuration_browsertest.cc
+++ b/chrome/browser/net/network_context_configuration_browsertest.cc
@@ -14,7 +14,6 @@
#include "base/files/scoped_temp_dir.h"
#include "base/guid.h"
#include "base/location.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
@@ -99,6 +98,7 @@
#include "services/network/test/test_dns_util.h"
#include "services/network/test/test_url_loader_client.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#if defined(OS_MAC)
diff --git a/chrome/browser/net/nss_service_chromeos.cc b/chrome/browser/net/nss_service_chromeos.cc
index d46f17ec..7baed7f 100644
--- a/chrome/browser/net/nss_service_chromeos.cc
+++ b/chrome/browser/net/nss_service_chromeos.cc
@@ -74,7 +74,7 @@
void DidGetTPMInfoForUserOnUIThread(
std::unique_ptr<chromeos::TPMTokenInfoGetter> getter,
const std::string& username_hash,
- base::Optional<user_data_auth::TpmTokenInfo> token_info) {
+ absl::optional<user_data_auth::TpmTokenInfo> token_info) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (token_info.has_value() && token_info->slot() != -1) {
DVLOG(1) << "Got TPM slot for " << username_hash << ": "
diff --git a/chrome/browser/net/profile_network_context_service_browsertest.cc b/chrome/browser/net/profile_network_context_service_browsertest.cc
index 627530b7..7a47d92 100644
--- a/chrome/browser/net/profile_network_context_service_browsertest.cc
+++ b/chrome/browser/net/profile_network_context_service_browsertest.cc
@@ -13,7 +13,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
@@ -69,6 +68,7 @@
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_features.h"
@@ -620,7 +620,7 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
class ProfileNetworkContextServiceMemoryPressureFeatureBrowsertest
: public ProfileNetworkContextServiceBrowsertest,
- public ::testing::WithParamInterface<base::Optional<bool>> {
+ public ::testing::WithParamInterface<absl::optional<bool>> {
public:
ProfileNetworkContextServiceMemoryPressureFeatureBrowsertest() = default;
~ProfileNetworkContextServiceMemoryPressureFeatureBrowsertest() override =
@@ -670,5 +670,5 @@
All,
ProfileNetworkContextServiceMemoryPressureFeatureBrowsertest,
/*disable_idle_sockets_close_on_memory_pressure=*/
- ::testing::Values(base::nullopt, true, false));
+ ::testing::Values(absl::nullopt, true, false));
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/net/secure_dns_config.cc b/chrome/browser/net/secure_dns_config.cc
index 350e856..256faea 100644
--- a/chrome/browser/net/secure_dns_config.cc
+++ b/chrome/browser/net/secure_dns_config.cc
@@ -21,7 +21,7 @@
SecureDnsConfig::~SecureDnsConfig() = default;
// static
-base::Optional<net::SecureDnsMode> SecureDnsConfig::ParseMode(
+absl::optional<net::SecureDnsMode> SecureDnsConfig::ParseMode(
base::StringPiece name) {
if (name == kModeSecure) {
return net::SecureDnsMode::kSecure;
@@ -30,7 +30,7 @@
} else if (name == kModeOff) {
return net::SecureDnsMode::kOff;
}
- return base::nullopt;
+ return absl::nullopt;
}
// static
diff --git a/chrome/browser/net/secure_dns_config.h b/chrome/browser/net/secure_dns_config.h
index 4e884cf..da88a16 100644
--- a/chrome/browser/net/secure_dns_config.h
+++ b/chrome/browser/net/secure_dns_config.h
@@ -7,10 +7,10 @@
#include <vector>
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "net/dns/public/dns_over_https_server_config.h"
#include "net/dns/public/secure_dns_mode.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Representation of a complete Secure DNS configuration.
class SecureDnsConfig {
@@ -44,7 +44,7 @@
// Identifies the SecureDnsMode corresponding to one of the above names, or
// returns nullopt if the name is unrecognized.
- static base::Optional<net::SecureDnsMode> ParseMode(base::StringPiece name);
+ static absl::optional<net::SecureDnsMode> ParseMode(base::StringPiece name);
// Converts a secure DNS mode to one of the above names.
static const char* ModeToString(net::SecureDnsMode mode);
diff --git a/chrome/browser/net/stub_resolver_config_reader.cc b/chrome/browser/net/stub_resolver_config_reader.cc
index d1cf055a..559edbf 100644
--- a/chrome/browser/net/stub_resolver_config_reader.cc
+++ b/chrome/browser/net/stub_resolver_config_reader.cc
@@ -358,7 +358,7 @@
local_state_->GetString(prefs::kDnsOverHttpsTemplates);
std::string server_method;
std::vector<net::DnsOverHttpsServerConfig> dns_over_https_servers;
- base::Optional<std::vector<network::mojom::DnsOverHttpsServerPtr>>
+ absl::optional<std::vector<network::mojom::DnsOverHttpsServerPtr>>
servers_mojo;
if (!doh_templates.empty() && secure_dns_mode != net::SecureDnsMode::kOff) {
for (base::StringPiece server_template :
@@ -372,7 +372,7 @@
use_post);
if (!servers_mojo.has_value()) {
- servers_mojo = base::make_optional<
+ servers_mojo = absl::make_optional<
std::vector<network::mojom::DnsOverHttpsServerPtr>>();
}
diff --git a/chrome/browser/net/stub_resolver_config_reader.h b/chrome/browser/net/stub_resolver_config_reader.h
index d69b3b3..67a33136 100644
--- a/chrome/browser/net/stub_resolver_config_reader.h
+++ b/chrome/browser/net/stub_resolver_config_reader.h
@@ -5,13 +5,13 @@
#ifndef CHROME_BROWSER_NET_STUB_RESOLVER_CONFIG_READER_H_
#define CHROME_BROWSER_NET_STUB_RESOLVER_CONFIG_READER_H_
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "components/prefs/pref_change_registrar.h"
#include "services/network/public/mojom/host_resolver.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if defined(OS_ANDROID)
#include "base/memory/weak_ptr.h"
@@ -105,7 +105,7 @@
#if defined(OS_ANDROID)
// Whether or not an Android device or profile is owned.
// A nullopt indicates this value has not been determined yet.
- base::Optional<bool> android_has_owner_ = base::nullopt;
+ absl::optional<bool> android_has_owner_ = absl::nullopt;
base::WeakPtrFactory<StubResolverConfigReader> weak_factory_{this};
#endif
};
diff --git a/chrome/browser/net/system_network_context_manager.cc b/chrome/browser/net/system_network_context_manager.cc
index 0d8158a..b3df3b2 100644
--- a/chrome/browser/net/system_network_context_manager.cc
+++ b/chrome/browser/net/system_network_context_manager.cc
@@ -737,7 +737,7 @@
}
void SystemNetworkContextManager::SetEnableCertificateTransparencyForTesting(
- base::Optional<bool> enabled) {
+ absl::optional<bool> enabled) {
g_enable_certificate_transparency =
enabled.value_or(kCertificateTransparencyEnabled);
}
diff --git a/chrome/browser/net/system_network_context_manager.h b/chrome/browser/net/system_network_context_manager.h
index 6ffe7c5..c8019b0e 100644
--- a/chrome/browser/net/system_network_context_manager.h
+++ b/chrome/browser/net/system_network_context_manager.h
@@ -12,7 +12,6 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "chrome/browser/net/proxy_config_monitor.h"
#include "chrome/browser/net/stub_resolver_config_reader.h"
#include "components/prefs/pref_change_registrar.h"
@@ -24,6 +23,7 @@
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/network_service.mojom-forward.h"
#include "services/network/public/mojom/ssl_config.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefRegistrySimple;
class PrefService;
@@ -153,10 +153,10 @@
GetHttpAuthDynamicParamsForTesting();
// Enables Certificate Transparency and enforcing the Chrome Certificate
- // Transparency Policy. For test use only. Use base::nullopt_t to reset to
+ // Transparency Policy. For test use only. Use absl::nullopt_t to reset to
// the default state.
static void SetEnableCertificateTransparencyForTesting(
- base::Optional<bool> enabled);
+ absl::optional<bool> enabled);
static void set_stub_resolver_config_reader_for_testing(
StubResolverConfigReader* reader) {
diff --git a/chrome/browser/net/system_network_context_manager_browsertest.cc b/chrome/browser/net/system_network_context_manager_browsertest.cc
index dba495c..b0bb640f 100644
--- a/chrome/browser/net/system_network_context_manager_browsertest.cc
+++ b/chrome/browser/net/system_network_context_manager_browsertest.cc
@@ -8,7 +8,6 @@
#include <vector>
#include "base/feature_list.h"
-#include "base/optional.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "build/build_config.h"
@@ -36,6 +35,7 @@
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/features.h"
#if BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED)
@@ -433,7 +433,7 @@
class SystemNetworkContextManagerCertificateTransparencyBrowsertest
: public SystemNetworkContextManagerBrowsertest,
- public testing::WithParamInterface<base::Optional<bool>> {
+ public testing::WithParamInterface<absl::optional<bool>> {
public:
SystemNetworkContextManagerCertificateTransparencyBrowsertest() {
SystemNetworkContextManager::SetEnableCertificateTransparencyForTesting(
@@ -441,7 +441,7 @@
}
~SystemNetworkContextManagerCertificateTransparencyBrowsertest() override {
SystemNetworkContextManager::SetEnableCertificateTransparencyForTesting(
- base::nullopt);
+ absl::nullopt);
}
};
@@ -481,7 +481,7 @@
INSTANTIATE_TEST_SUITE_P(
All,
SystemNetworkContextManagerCertificateTransparencyBrowsertest,
- ::testing::Values(base::nullopt, true, false));
+ ::testing::Values(absl::nullopt, true, false));
#if BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED)
class SystemNetworkContextServiceCertVerifierBuiltinPermissionsPolicyTest
diff --git a/chrome/browser/notifications/chrome_ash_message_center_client.cc b/chrome/browser/notifications/chrome_ash_message_center_client.cc
index a40a7bf..8812dac 100644
--- a/chrome/browser/notifications/chrome_ash_message_center_client.cc
+++ b/chrome/browser/notifications/chrome_ash_message_center_client.cc
@@ -73,8 +73,8 @@
delegate_->HandleNotificationClosed(notification_id_, by_user);
}
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
if (button_index) {
delegate_->HandleNotificationButtonClicked(notification_id_,
*button_index, reply);
diff --git a/chrome/browser/notifications/muted_notification_handler.cc b/chrome/browser/notifications/muted_notification_handler.cc
index 4ab0331..fb816bb1 100644
--- a/chrome/browser/notifications/muted_notification_handler.cc
+++ b/chrome/browser/notifications/muted_notification_handler.cc
@@ -27,8 +27,8 @@
Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) {
if (!action_index)
delegate_->OnAction(Action::kBodyClick);
diff --git a/chrome/browser/notifications/muted_notification_handler.h b/chrome/browser/notifications/muted_notification_handler.h
index 1d68375..28ac4e9 100644
--- a/chrome/browser/notifications/muted_notification_handler.h
+++ b/chrome/browser/notifications/muted_notification_handler.h
@@ -8,8 +8,8 @@
#include <string>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/notifications/notification_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class Profile;
@@ -45,8 +45,8 @@
void OnClick(Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) override;
void OnClose(Profile* profile,
const GURL& origin,
diff --git a/chrome/browser/notifications/muted_notification_handler_unittest.cc b/chrome/browser/notifications/muted_notification_handler_unittest.cc
index 961fbb5f..f5f91b0 100644
--- a/chrome/browser/notifications/muted_notification_handler_unittest.cc
+++ b/chrome/browser/notifications/muted_notification_handler_unittest.cc
@@ -7,10 +7,10 @@
#include <string>
#include "base/callback.h"
-#include "base/optional.h"
#include "base/test/mock_callback.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class MockMutedNotificationHandlerDelegate
@@ -67,7 +67,7 @@
OnAction(MutedNotificationHandler::Action::kBodyClick));
handler().OnClick(
/*profile=*/nullptr, GURL(), /*notification_id=*/std::string(),
- /*action_index=*/base::nullopt, /*reply=*/base::nullopt, callback.Get());
+ /*action_index=*/absl::nullopt, /*reply=*/absl::nullopt, callback.Get());
}
TEST_F(MutedNotificationHandlerTest, OnClickShow) {
@@ -77,5 +77,5 @@
OnAction(MutedNotificationHandler::Action::kShowClick));
handler().OnClick(
/*profile=*/nullptr, GURL(), /*notification_id=*/std::string(),
- /*action_index=*/0, /*reply=*/base::nullopt, callback.Get());
+ /*action_index=*/0, /*reply=*/absl::nullopt, callback.Get());
}
diff --git a/chrome/browser/notifications/non_persistent_notification_handler.cc b/chrome/browser/notifications/non_persistent_notification_handler.cc
index 082420f4..ead53d7c9 100644
--- a/chrome/browser/notifications/non_persistent_notification_handler.cc
+++ b/chrome/browser/notifications/non_persistent_notification_handler.cc
@@ -47,8 +47,8 @@
Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) {
// Non persistent notifications don't allow buttons or replies.
// https://notifications.spec.whatwg.org/#create-a-notification
diff --git a/chrome/browser/notifications/non_persistent_notification_handler.h b/chrome/browser/notifications/non_persistent_notification_handler.h
index 7b750b9..b2f46c3 100644
--- a/chrome/browser/notifications/non_persistent_notification_handler.h
+++ b/chrome/browser/notifications/non_persistent_notification_handler.h
@@ -28,8 +28,8 @@
void OnClick(Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) override;
void DisableNotifications(Profile* profile, const GURL& origin) override;
void OpenSettings(Profile* profile, const GURL& origin) override;
diff --git a/chrome/browser/notifications/notification_alert_service_bridge.mm b/chrome/browser/notifications/notification_alert_service_bridge.mm
index 923bfe1..a7796b6 100644
--- a/chrome/browser/notifications/notification_alert_service_bridge.mm
+++ b/chrome/browser/notifications/notification_alert_service_bridge.mm
@@ -175,14 +175,14 @@
std::u16string title = base::SysNSStringToUTF16(
notificationData[notification_constants::kNotificationButtonOne]);
auto button = mac_notifications::mojom::NotificationActionButton::New(
- std::move(title), /*placeholder=*/base::nullopt);
+ std::move(title), /*placeholder=*/absl::nullopt);
buttons.push_back(std::move(button));
}
if (notificationData[notification_constants::kNotificationButtonTwo]) {
std::u16string title = base::SysNSStringToUTF16(
notificationData[notification_constants::kNotificationButtonTwo]);
auto button = mac_notifications::mojom::NotificationActionButton::New(
- std::move(title), /*placeholder=*/base::nullopt);
+ std::move(title), /*placeholder=*/absl::nullopt);
buttons.push_back(std::move(button));
}
diff --git a/chrome/browser/notifications/notification_alert_service_bridge_unittest.mm b/chrome/browser/notifications/notification_alert_service_bridge_unittest.mm
index c5f74a8..bdc72c5 100644
--- a/chrome/browser/notifications/notification_alert_service_bridge_unittest.mm
+++ b/chrome/browser/notifications/notification_alert_service_bridge_unittest.mm
@@ -275,7 +275,7 @@
auto action_info = mac_notifications::mojom::NotificationActionInfo::New(
std::move(meta), NotificationOperation::NOTIFICATION_CLICK,
- /*button_index=*/-1, /*reply=*/base::nullopt);
+ /*button_index=*/-1, /*reply=*/absl::nullopt);
handler_remote_->OnNotificationAction(std::move(action_info));
// TODO(knollr): verify expected notification action data.
diff --git a/chrome/browser/notifications/notification_display_queue_unittest.cc b/chrome/browser/notifications/notification_display_queue_unittest.cc
index 8037d55..967f0e11 100644
--- a/chrome/browser/notifications/notification_display_queue_unittest.cc
+++ b/chrome/browser/notifications/notification_display_queue_unittest.cc
@@ -51,14 +51,14 @@
NotifyBlockingStateChanged();
}
- void SetBlockedOrigin(const base::Optional<GURL>& blocked_origin) {
+ void SetBlockedOrigin(const absl::optional<GURL>& blocked_origin) {
blocked_origin_ = blocked_origin;
NotifyBlockingStateChanged();
}
private:
bool should_block_ = false;
- base::Optional<GURL> blocked_origin_;
+ absl::optional<GURL> blocked_origin_;
};
class NotificationDisplayServiceMock : public NotificationDisplayService {
diff --git a/chrome/browser/notifications/notification_display_service_impl.cc b/chrome/browser/notifications/notification_display_service_impl.cc
index daec9515..d124bf17 100644
--- a/chrome/browser/notifications/notification_display_service_impl.cc
+++ b/chrome/browser/notifications/notification_display_service_impl.cc
@@ -136,9 +136,9 @@
NotificationHandler::Type notification_type,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
- const base::Optional<bool>& by_user) {
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
+ const absl::optional<bool>& by_user) {
NotificationHandler* handler = GetNotificationHandler(notification_type);
DCHECK(handler);
if (!handler) {
@@ -273,9 +273,9 @@
NotificationHandler::Type notification_type,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
- const base::Optional<bool>& by_user,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
+ const absl::optional<bool>& by_user,
Profile* profile) {
base::UmaHistogramBoolean("Notifications.LoadProfileResult",
profile != nullptr);
diff --git a/chrome/browser/notifications/notification_display_service_impl.h b/chrome/browser/notifications/notification_display_service_impl.h
index 6d45b00..434045c 100644
--- a/chrome/browser/notifications/notification_display_service_impl.h
+++ b/chrome/browser/notifications/notification_display_service_impl.h
@@ -12,12 +12,12 @@
#include "base/containers/queue.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "chrome/browser/notifications/notification_common.h"
#include "chrome/browser/notifications/notification_display_queue.h"
#include "chrome/browser/notifications/notification_display_service.h"
#include "chrome/browser/notifications/notification_handler.h"
#include "chrome/browser/notifications/notification_platform_bridge_delegator.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
class Profile;
@@ -59,9 +59,9 @@
NotificationHandler::Type notification_type,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
- const base::Optional<bool>& by_user);
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
+ const absl::optional<bool>& by_user);
// Registers an implementation object to handle notification operations
// for |notification_type|.
@@ -88,9 +88,9 @@
NotificationHandler::Type notification_type,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
- const base::Optional<bool>& by_user,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
+ const absl::optional<bool>& by_user,
Profile* profile);
// Sets the list of |blockers| to be used by the |notification_queue_|. Only
diff --git a/chrome/browser/notifications/notification_display_service_tester.cc b/chrome/browser/notifications/notification_display_service_tester.cc
index 76cc89a8..3b52ff8 100644
--- a/chrome/browser/notifications/notification_display_service_tester.cc
+++ b/chrome/browser/notifications/notification_display_service_tester.cc
@@ -119,7 +119,7 @@
return display_service_->GetDisplayedNotificationsForType(type);
}
-base::Optional<message_center::Notification>
+absl::optional<message_center::Notification>
NotificationDisplayServiceTester::GetNotification(
const std::string& notification_id) const {
return display_service_->GetNotification(notification_id);
@@ -134,8 +134,8 @@
void NotificationDisplayServiceTester::SimulateClick(
NotificationHandler::Type notification_type,
const std::string& notification_id,
- base::Optional<int> action_index,
- base::Optional<std::u16string> reply) {
+ absl::optional<int> action_index,
+ absl::optional<std::u16string> reply) {
display_service_->SimulateClick(notification_type, notification_id,
std::move(action_index), std::move(reply));
}
diff --git a/chrome/browser/notifications/notification_display_service_tester.h b/chrome/browser/notifications/notification_display_service_tester.h
index 82eeffe..c8ab7161 100644
--- a/chrome/browser/notifications/notification_display_service_tester.h
+++ b/chrome/browser/notifications/notification_display_service_tester.h
@@ -9,10 +9,10 @@
#include <vector>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/notifications/notification_common.h"
#include "chrome/browser/notifications/stub_notification_display_service.h"
#include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -54,15 +54,15 @@
const NotificationCommon::Metadata* GetMetadataForNotification(
const message_center::Notification& notification);
- base::Optional<message_center::Notification> GetNotification(
+ absl::optional<message_center::Notification> GetNotification(
const std::string& notification_id) const;
// Simulates the notification identified by |notification_id| being clicked
// on, optionally with the given |action_index| and |reply|.
void SimulateClick(NotificationHandler::Type notification_type,
const std::string& notification_id,
- base::Optional<int> action_index,
- base::Optional<std::u16string> reply);
+ absl::optional<int> action_index,
+ absl::optional<std::u16string> reply);
// Simulates a click on the settings button of the notification identified by
// |notification_id|.
diff --git a/chrome/browser/notifications/notification_handler.cc b/chrome/browser/notifications/notification_handler.cc
index eadaf8b..a47f5661 100644
--- a/chrome/browser/notifications/notification_handler.cc
+++ b/chrome/browser/notifications/notification_handler.cc
@@ -22,8 +22,8 @@
void NotificationHandler::OnClick(Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) {
std::move(completed_closure).Run();
}
diff --git a/chrome/browser/notifications/notification_handler.h b/chrome/browser/notifications/notification_handler.h
index 7380ccbe..db4c20e 100644
--- a/chrome/browser/notifications/notification_handler.h
+++ b/chrome/browser/notifications/notification_handler.h
@@ -9,7 +9,7 @@
#include <string>
#include "base/callback_forward.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
class Profile;
@@ -60,8 +60,8 @@
virtual void OnClick(Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure);
// Called when notifications of the given origin have to be disabled.
diff --git a/chrome/browser/notifications/notification_interactive_uitest_support.cc b/chrome/browser/notifications/notification_interactive_uitest_support.cc
index a192d13..0d55270e 100644
--- a/chrome/browser/notifications/notification_interactive_uitest_support.cc
+++ b/chrome/browser/notifications/notification_interactive_uitest_support.cc
@@ -61,8 +61,8 @@
void OnNotificationClicked(
const std::string& notification_id,
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
OnMessageCenterChanged();
}
diff --git a/chrome/browser/notifications/notification_platform_bridge_android.cc b/chrome/browser/notifications/notification_platform_bridge_android.cc
index 9490852..30ce39c7 100644
--- a/chrome/browser/notifications/notification_platform_bridge_android.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_android.cc
@@ -171,7 +171,7 @@
std::string webapk_package =
ConvertJavaStringToUTF8(env, java_webapk_package);
- base::Optional<std::u16string> reply;
+ absl::optional<std::u16string> reply;
if (java_reply)
reply = ConvertJavaStringToUTF16(env, java_reply);
@@ -180,7 +180,7 @@
regenerated_notification_infos_[notification_id] =
RegeneratedNotificationInfo(scope_url, webapk_package);
- base::Optional<int> action_index;
+ absl::optional<int> action_index;
if (java_action_index != kNotificationInvalidButtonIndex)
action_index = java_action_index;
@@ -195,7 +195,7 @@
base::BindOnce(&NotificationDisplayServiceImpl::ProfileLoadedCallback,
NotificationCommon::OPERATION_CLICK, notification_type,
origin, notification_id, std::move(action_index),
- std::move(reply), base::nullopt /* by_user */));
+ std::move(reply), absl::nullopt /* by_user */));
}
void NotificationPlatformBridgeAndroid::
@@ -244,8 +244,8 @@
base::BindOnce(&NotificationDisplayServiceImpl::ProfileLoadedCallback,
NotificationCommon::OPERATION_CLOSE, notification_type,
GURL(ConvertJavaStringToUTF8(env, java_origin)),
- notification_id, base::nullopt /* action index */,
- base::nullopt /* reply */, by_user));
+ notification_id, absl::nullopt /* action index */,
+ absl::nullopt /* reply */, by_user));
}
void NotificationPlatformBridgeAndroid::Display(
@@ -317,7 +317,7 @@
notification.silent(), actions);
regenerated_notification_infos_[notification.id()] =
- RegeneratedNotificationInfo(scope_url, base::nullopt);
+ RegeneratedNotificationInfo(scope_url, absl::nullopt);
}
void NotificationPlatformBridgeAndroid::Close(
@@ -383,7 +383,7 @@
NotificationPlatformBridgeAndroid::RegeneratedNotificationInfo::
RegeneratedNotificationInfo(
const GURL& service_worker_scope,
- const base::Optional<std::string>& webapk_package)
+ const absl::optional<std::string>& webapk_package)
: service_worker_scope(service_worker_scope),
webapk_package(webapk_package) {}
diff --git a/chrome/browser/notifications/notification_platform_bridge_android.h b/chrome/browser/notifications/notification_platform_bridge_android.h
index 7ff3547..73f25bf 100644
--- a/chrome/browser/notifications/notification_platform_bridge_android.h
+++ b/chrome/browser/notifications/notification_platform_bridge_android.h
@@ -11,10 +11,10 @@
#include <string>
#include "base/android/scoped_java_ref.h"
-#include "base/optional.h"
#include "chrome/browser/notifications/displayed_notifications_dispatch_callback.h"
#include "chrome/browser/notifications/notification_common.h"
#include "chrome/browser/notifications/notification_platform_bridge.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace user_prefs {
class PrefRegistrySyncable;
@@ -105,11 +105,11 @@
RegeneratedNotificationInfo();
RegeneratedNotificationInfo(
const GURL& service_worker_scope,
- const base::Optional<std::string>& webapk_package);
+ const absl::optional<std::string>& webapk_package);
~RegeneratedNotificationInfo();
GURL service_worker_scope;
- base::Optional<std::string> webapk_package;
+ absl::optional<std::string> webapk_package;
};
// Mapping of notification id to renegerated notification info.
diff --git a/chrome/browser/notifications/notification_platform_bridge_chromeos.cc b/chrome/browser/notifications/notification_platform_bridge_chromeos.cc
index 2afde53..bd23d5e 100644
--- a/chrome/browser/notifications/notification_platform_bridge_chromeos.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_chromeos.cc
@@ -124,7 +124,7 @@
->ProcessNotificationOperation(
NotificationCommon::OPERATION_CLOSE, notification->type(),
notification->notification().origin_url(),
- notification->original_id(), base::nullopt, base::nullopt, by_user);
+ notification->original_id(), absl::nullopt, absl::nullopt, by_user);
}
active_notifications_.erase(iter);
}
@@ -136,22 +136,22 @@
return;
if (notification->type() == NotificationHandler::Type::TRANSIENT) {
- notification->notification().delegate()->Click(base::nullopt,
- base::nullopt);
+ notification->notification().delegate()->Click(absl::nullopt,
+ absl::nullopt);
} else {
NotificationDisplayServiceImpl::GetForProfile(notification->profile())
->ProcessNotificationOperation(
NotificationCommon::OPERATION_CLICK, notification->type(),
notification->notification().origin_url(),
- notification->original_id(), base::nullopt, base::nullopt,
- base::nullopt);
+ notification->original_id(), absl::nullopt, absl::nullopt,
+ absl::nullopt);
}
}
void NotificationPlatformBridgeChromeOs::HandleNotificationButtonClicked(
const std::string& id,
int button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<std::u16string>& reply) {
ProfileNotification* notification = GetProfileNotification(id);
if (!notification)
return;
@@ -163,7 +163,7 @@
->ProcessNotificationOperation(
NotificationCommon::OPERATION_CLICK, notification->type(),
notification->notification().origin_url(),
- notification->original_id(), button_index, reply, base::nullopt);
+ notification->original_id(), button_index, reply, absl::nullopt);
}
}
@@ -180,8 +180,8 @@
->ProcessNotificationOperation(
NotificationCommon::OPERATION_SETTINGS, notification->type(),
notification->notification().origin_url(),
- notification->original_id(), base::nullopt, base::nullopt,
- base::nullopt);
+ notification->original_id(), absl::nullopt, absl::nullopt,
+ absl::nullopt);
}
}
@@ -196,8 +196,8 @@
->ProcessNotificationOperation(
NotificationCommon::OPERATION_DISABLE_PERMISSION,
notification->type(), notification->notification().origin_url(),
- notification->original_id(), base::nullopt, base::nullopt,
- base::nullopt);
+ notification->original_id(), absl::nullopt, absl::nullopt,
+ absl::nullopt);
}
ProfileNotification* NotificationPlatformBridgeChromeOs::GetProfileNotification(
diff --git a/chrome/browser/notifications/notification_platform_bridge_chromeos.h b/chrome/browser/notifications/notification_platform_bridge_chromeos.h
index b096e5c4..14ef531 100644
--- a/chrome/browser/notifications/notification_platform_bridge_chromeos.h
+++ b/chrome/browser/notifications/notification_platform_bridge_chromeos.h
@@ -45,7 +45,7 @@
void HandleNotificationButtonClicked(
const std::string& id,
int button_index,
- const base::Optional<std::u16string>& reply) override;
+ const absl::optional<std::u16string>& reply) override;
void HandleNotificationSettingsButtonClicked(const std::string& id) override;
void DisableNotification(const std::string& id) override;
diff --git a/chrome/browser/notifications/notification_platform_bridge_chromeos_unittest.cc b/chrome/browser/notifications/notification_platform_bridge_chromeos_unittest.cc
index 832f83b..cc3beb7 100644
--- a/chrome/browser/notifications/notification_platform_bridge_chromeos_unittest.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_chromeos_unittest.cc
@@ -27,7 +27,7 @@
auto initial_delegate =
base::MakeRefCounted<message_center::HandleNotificationClickDelegate>(
base::BindRepeating(
- [](int* clicks, base::Optional<int> button_index) { ++*clicks; },
+ [](int* clicks, absl::optional<int> button_index) { ++*clicks; },
&initial_delegate_clicks));
message_center::Notification initial_notification(
message_center::NOTIFICATION_TYPE_SIMPLE, id, std::u16string(),
@@ -46,7 +46,7 @@
auto updated_delegate =
base::MakeRefCounted<message_center::HandleNotificationClickDelegate>(
base::BindRepeating(
- [](int* clicks, base::Optional<int> button_index) { ++*clicks; },
+ [](int* clicks, absl::optional<int> button_index) { ++*clicks; },
&updated_delegate_clicks));
message_center::Notification updated_notification(
message_center::NOTIFICATION_TYPE_SIMPLE, id, std::u16string(),
diff --git a/chrome/browser/notifications/notification_platform_bridge_delegate.h b/chrome/browser/notifications/notification_platform_bridge_delegate.h
index 3ca7cef3..f0bcfe5 100644
--- a/chrome/browser/notifications/notification_platform_bridge_delegate.h
+++ b/chrome/browser/notifications/notification_platform_bridge_delegate.h
@@ -7,7 +7,7 @@
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// The interface that a NotificationPlatformBridge uses to pass back information
// and interactions from the native notification system.
@@ -28,7 +28,7 @@
virtual void HandleNotificationButtonClicked(
const std::string& id,
int button_index,
- const base::Optional<std::u16string>& reply) = 0;
+ const absl::optional<std::u16string>& reply) = 0;
// To be called when the settings button in a notification is clicked.
virtual void HandleNotificationSettingsButtonClicked(
diff --git a/chrome/browser/notifications/notification_platform_bridge_delegator.h b/chrome/browser/notifications/notification_platform_bridge_delegator.h
index 2a24123..03fb21bc 100644
--- a/chrome/browser/notifications/notification_platform_bridge_delegator.h
+++ b/chrome/browser/notifications/notification_platform_bridge_delegator.h
@@ -11,12 +11,12 @@
#include "base/callback.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/scoped_observer.h"
#include "chrome/browser/notifications/displayed_notifications_dispatch_callback.h"
#include "chrome/browser/notifications/notification_common.h"
#include "chrome/browser/notifications/notification_handler.h"
#include "chrome/browser/notifications/notification_platform_bridge.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/message_center/public/cpp/notification.h"
class Profile;
diff --git a/chrome/browser/notifications/notification_platform_bridge_lacros.cc b/chrome/browser/notifications/notification_platform_bridge_lacros.cc
index 875cf4f..0cea519 100644
--- a/chrome/browser/notifications/notification_platform_bridge_lacros.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_lacros.cc
@@ -10,10 +10,10 @@
#include "base/notreached.h"
#include "base/numerics/ranges.h"
#include "base/numerics/safe_conversions.h"
-#include "base/optional.h"
#include "chrome/browser/notifications/notification_platform_bridge_delegate.h"
#include "chromeos/crosapi/mojom/message_center.mojom.h"
#include "chromeos/crosapi/mojom/notification.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/message_center/public/cpp/notification.h"
#include "ui/message_center/public/cpp/notification_types.h"
@@ -135,7 +135,7 @@
// Chrome OS does not support inline reply.
bridge_delegate_->HandleNotificationButtonClicked(
notification_id_, base::checked_cast<int>(button_index),
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
}
void OnNotificationSettingsButtonClicked() override {
diff --git a/chrome/browser/notifications/notification_platform_bridge_lacros_unittest.cc b/chrome/browser/notifications/notification_platform_bridge_lacros_unittest.cc
index e40c3ee9..845be31 100644
--- a/chrome/browser/notifications/notification_platform_bridge_lacros_unittest.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_lacros_unittest.cc
@@ -47,7 +47,7 @@
void HandleNotificationButtonClicked(
const std::string& id,
int button_index,
- const base::Optional<std::u16string>& reply) override {
+ const absl::optional<std::u16string>& reply) override {
++button_clicked_count_;
last_button_index_ = button_index;
}
diff --git a/chrome/browser/notifications/notification_platform_bridge_linux.cc b/chrome/browser/notifications/notification_platform_bridge_linux.cc
index b071f5b1..43d9cc1 100644
--- a/chrome/browser/notifications/notification_platform_bridge_linux.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_linux.cc
@@ -201,9 +201,9 @@
NotificationHandler::Type notification_type,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<bool>& by_user,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<bool>& by_user,
+ const absl::optional<std::u16string>& reply,
const std::string& profile_id,
bool is_incognito) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -690,7 +690,7 @@
// Even-indexed elements in this vector are action IDs passed back to
// us in OnActionInvoked(). Odd-indexed ones contain the button text.
std::vector<std::string> actions;
- base::Optional<std::u16string> inline_reply_placeholder;
+ absl::optional<std::u16string> inline_reply_placeholder;
if (base::Contains(capabilities_, kCapabilityActions)) {
const bool has_support_for_inline_reply =
base::Contains(capabilities_, kCapabilityInlineReply);
@@ -895,9 +895,9 @@
const base::Location& location,
NotificationData* data,
NotificationCommon::Operation operation,
- const base::Optional<int>& action_index,
- const base::Optional<bool>& by_user,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& action_index,
+ const absl::optional<bool>& by_user,
+ const absl::optional<std::u16string>& reply) {
DCHECK(task_runner_->RunsTasksInCurrentSequence());
content::GetUIThreadTaskRunner({})->PostTask(
location,
@@ -924,18 +924,18 @@
if (action == kDefaultButtonId) {
ForwardNotificationOperation(
FROM_HERE, data, NotificationCommon::OPERATION_CLICK,
- base::nullopt /* action_index */, base::nullopt /* by_user */,
- base::nullopt /* reply */);
+ absl::nullopt /* action_index */, absl::nullopt /* by_user */,
+ absl::nullopt /* reply */);
} else if (action == kSettingsButtonId) {
ForwardNotificationOperation(
FROM_HERE, data, NotificationCommon::OPERATION_SETTINGS,
- base::nullopt /* action_index */, base::nullopt /* by_user */,
- base::nullopt /* reply */);
+ absl::nullopt /* action_index */, absl::nullopt /* by_user */,
+ absl::nullopt /* reply */);
} else if (action == kCloseButtonId) {
ForwardNotificationOperation(
FROM_HERE, data, NotificationCommon::OPERATION_CLOSE,
- base::nullopt /* action_index */, true /* by_user */,
- base::nullopt /* reply */);
+ absl::nullopt /* action_index */, true /* by_user */,
+ absl::nullopt /* reply */);
CloseOnTaskRunner(data->profile_id, data->notification_id);
} else {
size_t id;
@@ -947,7 +947,7 @@
return;
ForwardNotificationOperation(
FROM_HERE, data, NotificationCommon::OPERATION_CLICK, id_zero_based,
- base::nullopt /* by_user */, base::nullopt /* reply */);
+ absl::nullopt /* by_user */, absl::nullopt /* reply */);
}
}
@@ -967,7 +967,7 @@
ForwardNotificationOperation(
FROM_HERE, data, NotificationCommon::OPERATION_CLICK,
- base::nullopt /* action_index */, base::nullopt /* by_user */,
+ absl::nullopt /* action_index */, absl::nullopt /* by_user */,
base::UTF8ToUTF16(reply));
}
@@ -985,8 +985,8 @@
// TODO(peter): Can we support |by_user| appropriately here?
ForwardNotificationOperation(FROM_HERE, data,
NotificationCommon::OPERATION_CLOSE,
- base::nullopt /* action_index */,
- true /* by_user */, base::nullopt /* reply */);
+ absl::nullopt /* action_index */,
+ true /* by_user */, absl::nullopt /* reply */);
notifications_.erase(data);
}
@@ -1111,12 +1111,12 @@
// State necessary for OnConnectionInitializationFinished() and
// SetReadyCallback().
- base::Optional<bool> connected_;
+ absl::optional<bool> connected_;
std::vector<NotificationBridgeReadyCallback> on_connected_callbacks_;
// Notification servers very rarely have the 'body-images'
// capability, so try to avoid an image copy if possible.
- base::Optional<bool> body_images_supported_;
+ absl::optional<bool> body_images_supported_;
//////////////////////////////////////////////////////////////////////////////
// Members used only on the task runner thread.
diff --git a/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc b/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc
index d10ccbc..ed00152 100644
--- a/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc
@@ -351,9 +351,9 @@
NotificationHandler::Type notification_type,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
- const base::Optional<bool>& by_user) {
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
+ const absl::optional<bool>& by_user) {
last_operation_ = operation;
last_action_index_ = action_index;
last_reply_ = reply;
@@ -451,9 +451,9 @@
std::unique_ptr<NotificationPlatformBridgeLinux> notification_bridge_linux_;
std::unique_ptr<NotificationDisplayServiceTester> display_service_tester_;
- base::Optional<NotificationCommon::Operation> last_operation_;
- base::Optional<int> last_action_index_;
- base::Optional<std::u16string> last_reply_;
+ absl::optional<NotificationCommon::Operation> last_operation_;
+ absl::optional<int> last_action_index_;
+ absl::optional<std::u16string> last_reply_;
private:
void DoInvokeAction(uint32_t dbus_id, const std::string& action) {
diff --git a/chrome/browser/notifications/notification_platform_bridge_mac.mm b/chrome/browser/notifications/notification_platform_bridge_mac.mm
index 23884ef..7b48e6b 100644
--- a/chrome/browser/notifications/notification_platform_bridge_mac.mm
+++ b/chrome/browser/notifications/notification_platform_bridge_mac.mm
@@ -17,7 +17,6 @@
#include "base/mac/mac_util.h"
#include "base/mac/scoped_mach_port.h"
#include "base/mac/scoped_nsobject.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
@@ -36,6 +35,7 @@
#include "chrome/grit/generated_resources.h"
#include "chrome/services/mac_notifications/public/cpp/notification_constants_mac.h"
#include "chrome/services/mac_notifications/public/cpp/notification_utils_mac.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/notifications/notification_constants.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/message_center/public/cpp/notification.h"
diff --git a/chrome/browser/notifications/notification_platform_bridge_mac_utils.mm b/chrome/browser/notifications/notification_platform_bridge_mac_utils.mm
index 85bea002..2d50db6 100644
--- a/chrome/browser/notifications/notification_platform_bridge_mac_utils.mm
+++ b/chrome/browser/notifications/notification_platform_bridge_mac_utils.mm
@@ -6,7 +6,6 @@
#include "base/feature_list.h"
#include "base/i18n/number_formatting.h"
-#include "base/optional.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info.h"
@@ -20,6 +19,7 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/notifications/notification_constants.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -34,9 +34,9 @@
bool incognito,
const GURL& origin,
const std::string& notificationId,
- const base::Optional<int>& actionIndex,
- const base::Optional<std::u16string>& reply,
- const base::Optional<bool>& byUser) {
+ const absl::optional<int>& actionIndex,
+ const absl::optional<std::u16string>& reply,
+ const absl::optional<bool>& byUser) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// Profile ID can be empty for system notifications, which are not bound to a
@@ -222,7 +222,7 @@
NSNumber* notificationType =
response[notification_constants::kNotificationType];
- base::Optional<int> actionIndex;
+ absl::optional<int> actionIndex;
if (buttonIndex.intValue !=
notification_constants::kNotificationInvalidButtonIndex) {
actionIndex = buttonIndex.intValue;
@@ -237,7 +237,7 @@
notificationType.unsignedIntValue),
profileId, [isIncognito boolValue],
GURL(notificationOrigin), notificationId, actionIndex,
- base::nullopt /* reply */, true /* byUser */));
+ absl::nullopt /* reply */, true /* byUser */));
}
bool MacOSSupportsXPCAlerts() {
diff --git a/chrome/browser/notifications/notification_platform_bridge_mac_utils_unittest.mm b/chrome/browser/notifications/notification_platform_bridge_mac_utils_unittest.mm
index 15ed225..a8a362d9 100644
--- a/chrome/browser/notifications/notification_platform_bridge_mac_utils_unittest.mm
+++ b/chrome/browser/notifications/notification_platform_bridge_mac_utils_unittest.mm
@@ -7,7 +7,6 @@
#include <string>
#include "base/mac/scoped_nsobject.h"
-#include "base/optional.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/notifications/notification_platform_bridge.h"
@@ -16,6 +15,7 @@
#include "chrome/browser/ui/cocoa/notifications/notification_response_builder_mac.h"
#include "chrome/services/mac_notifications/public/cpp/notification_constants_mac.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/message_center/public/cpp/notification.h"
using message_center::Notification;
@@ -41,7 +41,7 @@
const std::string& origin,
message_center::NotificationType type,
int progress,
- const base::Optional<std::string>& contextMessage) {
+ const absl::optional<std::string>& contextMessage) {
GURL url(origin);
Notification notification(
@@ -90,7 +90,7 @@
Notification notification = CreateNotification(
"Title", "Subtitle", "https://moe.example.com",
message_center::NOTIFICATION_TYPE_SIMPLE, /*progress=*/0,
- /*contextMessage=*/base::nullopt);
+ /*contextMessage=*/absl::nullopt);
std::u16string createdTitle = CreateMacNotificationTitle(notification);
EXPECT_EQ(u"Title", createdTitle);
}
@@ -100,7 +100,7 @@
Notification notification = CreateNotification(
"Title", "Subtitle", "https://moe.example.com",
message_center::NOTIFICATION_TYPE_PROGRESS, /*progress=*/50,
- /*contextMessage=*/base::nullopt);
+ /*contextMessage=*/absl::nullopt);
std::u16string createdTitle = CreateMacNotificationTitle(notification);
EXPECT_EQ(u"50% - Title", createdTitle);
}
@@ -110,7 +110,7 @@
Notification notification = CreateNotification(
"Title", "Subtitle", "https://moe.example.com",
message_center::NOTIFICATION_TYPE_SIMPLE, /*progress=*/0,
- /*contextMessage=*/base::nullopt);
+ /*contextMessage=*/absl::nullopt);
std::u16string createdContext = CreateMacNotificationContext(
/*isPersistent=*/false, notification, /*requiresAttribution=*/true);
EXPECT_EQ(u"moe.example.com", createdContext);
@@ -121,7 +121,7 @@
Notification notification = CreateNotification(
"Title", "Subtitle", "https://moe.example.com",
message_center::NOTIFICATION_TYPE_SIMPLE, /*progress=*/0,
- /*contextMessage=*/base::nullopt);
+ /*contextMessage=*/absl::nullopt);
std::u16string createdContext = CreateMacNotificationContext(
/*isPersistent=*/true, notification, /*requiresAttribution=*/true);
EXPECT_EQ(u"moe.example.com", createdContext);
@@ -145,7 +145,7 @@
"Title", "Subtitle",
"https://thisisareallyreallyreaaalllyyylongorigin.moe.example.com/",
message_center::NOTIFICATION_TYPE_SIMPLE, /*progress=*/0,
- /*contextMessage=*/base::nullopt);
+ /*contextMessage=*/absl::nullopt);
std::u16string createdContext = CreateMacNotificationContext(
/*isPersistent=*/false, notification, /*requiresAttribution=*/true);
EXPECT_EQ(u"example.com", createdContext);
@@ -163,7 +163,7 @@
Notification notification = CreateNotification(
"Title", "Subtitle", "https://thisisalongorigin.moe.co.uk",
message_center::NOTIFICATION_TYPE_SIMPLE, /*progress=*/0,
- /*contextMessage=*/base::nullopt);
+ /*contextMessage=*/absl::nullopt);
std::u16string createdContext = CreateMacNotificationContext(
/*isPersistent=*/true, notification, /*requiresAttribution=*/true);
EXPECT_EQ(u"moe.co.uk", createdContext);
@@ -179,7 +179,7 @@
Notification notification = CreateNotification(
"Title", "Subtitle", "https://thisisareallylongorigin.moe.co.uk",
message_center::NOTIFICATION_TYPE_SIMPLE, /*progress=*/0,
- /*contextMessage=*/base::nullopt);
+ /*contextMessage=*/absl::nullopt);
std::u16string createdContext = CreateMacNotificationContext(
/*isPersistent=*/true, notification, /*requiresAttribution=*/true);
EXPECT_EQ(u"moe.co.uk", createdContext);
diff --git a/chrome/browser/notifications/notification_platform_bridge_message_center.cc b/chrome/browser/notifications/notification_platform_bridge_message_center.cc
index 73b304f..2835249 100644
--- a/chrome/browser/notifications/notification_platform_bridge_message_center.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_message_center.cc
@@ -38,8 +38,8 @@
NotificationDisplayServiceImpl::GetForProfile(profile_)
->ProcessNotificationOperation(
NotificationCommon::OPERATION_SETTINGS, notification_type_,
- notification_.origin_url(), notification_.id(), base::nullopt,
- base::nullopt, base::nullopt /* by_user */);
+ notification_.origin_url(), notification_.id(), absl::nullopt,
+ absl::nullopt, absl::nullopt /* by_user */);
}
void DisableNotification() override {
@@ -47,8 +47,8 @@
->ProcessNotificationOperation(
NotificationCommon::OPERATION_DISABLE_PERMISSION,
notification_type_, notification_.origin_url(), notification_.id(),
- base::nullopt /* action_index */, base::nullopt /* reply */,
- base::nullopt /* by_user */);
+ absl::nullopt /* action_index */, absl::nullopt /* reply */,
+ absl::nullopt /* by_user */);
}
void Close(bool by_user) override {
@@ -56,17 +56,17 @@
->ProcessNotificationOperation(
NotificationCommon::OPERATION_CLOSE, notification_type_,
notification_.origin_url(), notification_.id(),
- base::nullopt /* action_index */, base::nullopt /* reply */,
+ absl::nullopt /* action_index */, absl::nullopt /* reply */,
by_user);
}
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
NotificationDisplayServiceImpl::GetForProfile(profile_)
->ProcessNotificationOperation(
NotificationCommon::OPERATION_CLICK, notification_type_,
notification_.origin_url(), notification_.id(), button_index, reply,
- base::nullopt /* by_user */);
+ absl::nullopt /* by_user */);
}
protected:
diff --git a/chrome/browser/notifications/notification_platform_bridge_win.cc b/chrome/browser/notifications/notification_platform_bridge_win.cc
index 9902cbd..505907ec 100644
--- a/chrome/browser/notifications/notification_platform_bridge_win.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_win.cc
@@ -99,9 +99,9 @@
const std::string& notification_id,
const std::string& profile_id,
bool incognito,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
- const base::Optional<bool>& by_user) {
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
+ const absl::optional<bool>& by_user) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!g_browser_process)
return;
@@ -619,7 +619,7 @@
if (!displayed_notifications.count(notification.first)) {
HandleEvent(/*launch_id=*/notification.second,
NotificationCommon::OPERATION_CLOSE,
- /*action_index=*/base::nullopt, /*by_user=*/true);
+ /*action_index=*/absl::nullopt, /*by_user=*/true);
key_to_remove.push_back(notification.first);
}
}
@@ -724,8 +724,8 @@
void HandleEvent(NotificationLaunchId launch_id,
NotificationCommon::Operation operation,
- const base::Optional<int>& action_index,
- const base::Optional<bool>& by_user) {
+ const absl::optional<int>& action_index,
+ const absl::optional<bool>& by_user) {
if (!launch_id.is_valid()) {
LogHandleEventStatus(HandleEventStatus::kHandleEventLaunchIdInvalid);
DLOG(ERROR) << "Failed to decode launch ID for operation " << operation;
@@ -738,30 +738,30 @@
launch_id.notification_type(), launch_id.origin_url(),
launch_id.notification_id(), launch_id.profile_id(),
launch_id.incognito(), action_index,
- /*reply=*/base::nullopt, by_user));
+ /*reply=*/absl::nullopt, by_user));
LogHandleEventStatus(HandleEventStatus::kSuccess);
}
- base::Optional<int> ParseActionIndex(
+ absl::optional<int> ParseActionIndex(
winui::Notifications::IToastActivatedEventArgs* args) {
HSTRING arguments;
HRESULT hr = args->get_Arguments(&arguments);
if (FAILED(hr))
- return base::nullopt;
+ return absl::nullopt;
ScopedHString arguments_scoped(arguments);
NotificationLaunchId launch_id(arguments_scoped.GetAsUTF8());
return (launch_id.is_valid() && launch_id.button_index() >= 0)
- ? base::Optional<int>(launch_id.button_index())
- : base::nullopt;
+ ? absl::optional<int>(launch_id.button_index())
+ : absl::nullopt;
}
void ForwardHandleEventForTesting(
NotificationCommon::Operation operation,
winui::Notifications::IToastNotification* notification,
winui::Notifications::IToastActivatedEventArgs* args,
- const base::Optional<bool>& by_user) {
- base::Optional<int> action_index = ParseActionIndex(args);
+ const absl::optional<bool>& by_user) {
+ absl::optional<int> action_index = ParseActionIndex(args);
HandleEvent(GetNotificationLaunchId(notification), operation, action_index,
by_user);
}
@@ -978,7 +978,7 @@
return false;
}
- base::Optional<std::u16string> reply;
+ absl::optional<std::u16string> reply;
std::wstring inline_reply =
command_line.GetSwitchValueNative(switches::kNotificationInlineReply);
if (!inline_reply.empty())
@@ -992,7 +992,7 @@
else
operation = NotificationCommon::OPERATION_CLICK;
- base::Optional<int> action_index;
+ absl::optional<int> action_index;
if (launch_id.button_index() != -1)
action_index = launch_id.button_index();
@@ -1023,7 +1023,7 @@
NotificationCommon::Operation operation,
winui::Notifications::IToastNotification* notification,
winui::Notifications::IToastActivatedEventArgs* args,
- const base::Optional<bool>& by_user) {
+ const absl::optional<bool>& by_user) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
notification_task_runner_->PostTask(
FROM_HERE,
diff --git a/chrome/browser/notifications/notification_platform_bridge_win.h b/chrome/browser/notifications/notification_platform_bridge_win.h
index d213d221..9b9e283 100644
--- a/chrome/browser/notifications/notification_platform_bridge_win.h
+++ b/chrome/browser/notifications/notification_platform_bridge_win.h
@@ -10,9 +10,9 @@
#include <windows.ui.notifications.h>
#include <wrl/client.h>
-#include "base/optional.h"
#include "chrome/browser/notifications/notification_platform_bridge.h"
#include "chrome/browser/notifications/win/notification_launch_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class CommandLine;
@@ -86,7 +86,7 @@
NotificationCommon::Operation operation,
ABI::Windows::UI::Notifications::IToastNotification* notification,
ABI::Windows::UI::Notifications::IToastActivatedEventArgs* args,
- const base::Optional<bool>& by_user);
+ const absl::optional<bool>& by_user);
// Initializes the expected displayed notification map. For testing use only.
void SetExpectedDisplayedNotificationsForTesting(
diff --git a/chrome/browser/notifications/notification_platform_bridge_win_interactive_uitest.cc b/chrome/browser/notifications/notification_platform_bridge_win_interactive_uitest.cc
index c98f301..83c5413 100644
--- a/chrome/browser/notifications/notification_platform_bridge_win_interactive_uitest.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_win_interactive_uitest.cc
@@ -151,9 +151,9 @@
NotificationHandler::Type notification_type,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
- const base::Optional<bool>& by_user) {
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
+ const absl::optional<bool>& by_user) {
last_operation_ = operation;
last_notification_type_ = notification_type;
last_origin_ = origin;
@@ -204,9 +204,9 @@
NotificationHandler::Type notification_type,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
- const base::Optional<bool>& by_user) {
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
+ const absl::optional<bool>& by_user) {
return operation == last_operation_ &&
notification_type == last_notification_type_ &&
origin == last_origin_ && notification_id == last_notification_id_ &&
@@ -220,9 +220,9 @@
NotificationHandler::Type last_notification_type_;
GURL last_origin_;
std::string last_notification_id_;
- base::Optional<int> last_action_index_;
- base::Optional<std::u16string> last_reply_;
- base::Optional<bool> last_by_user_;
+ absl::optional<int> last_action_index_;
+ absl::optional<std::u16string> last_reply_;
+ absl::optional<bool> last_by_user_;
std::set<std::string> displayed_notifications_;
@@ -284,7 +284,7 @@
NotificationPlatformBridgeWin* bridge = GetBridge();
ASSERT_TRUE(bridge);
bridge->ForwardHandleEventForTesting(NotificationCommon::OPERATION_CLICK,
- &toast, &args, base::nullopt);
+ &toast, &args, absl::nullopt);
run_loop.Run();
// Validate the click values.
@@ -293,8 +293,8 @@
EXPECT_EQ(GURL("https://example.com/"), last_origin_);
EXPECT_EQ("notification_id", last_notification_id_);
EXPECT_EQ(1, last_action_index_);
- EXPECT_EQ(base::nullopt, last_reply_);
- EXPECT_EQ(base::nullopt, last_by_user_);
+ EXPECT_EQ(absl::nullopt, last_reply_);
+ EXPECT_EQ(absl::nullopt, last_by_user_);
}
IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, HandleActivation) {
@@ -320,7 +320,7 @@
EXPECT_EQ(GURL("https://example.com/"), last_origin_);
EXPECT_EQ("notification_id", last_notification_id_);
EXPECT_EQ(1, last_action_index_);
- EXPECT_EQ(base::nullopt, last_reply_);
+ EXPECT_EQ(absl::nullopt, last_reply_);
EXPECT_EQ(true, last_by_user_);
}
@@ -355,7 +355,7 @@
NotificationPlatformBridgeWin* bridge = GetBridge();
ASSERT_TRUE(bridge);
bridge->ForwardHandleEventForTesting(NotificationCommon::OPERATION_SETTINGS,
- &toast, &args, base::nullopt);
+ &toast, &args, absl::nullopt);
run_loop.Run();
// Validate the click values.
@@ -363,9 +363,9 @@
EXPECT_EQ(NotificationHandler::Type::WEB_PERSISTENT, last_notification_type_);
EXPECT_EQ(GURL("https://example.com/"), last_origin_);
EXPECT_EQ("notification_id", last_notification_id_);
- EXPECT_EQ(base::nullopt, last_action_index_);
- EXPECT_EQ(base::nullopt, last_reply_);
- EXPECT_EQ(base::nullopt, last_by_user_);
+ EXPECT_EQ(absl::nullopt, last_action_index_);
+ EXPECT_EQ(absl::nullopt, last_reply_);
+ EXPECT_EQ(absl::nullopt, last_by_user_);
}
IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, HandleClose) {
@@ -390,8 +390,8 @@
EXPECT_EQ(NotificationHandler::Type::WEB_PERSISTENT, last_notification_type_);
EXPECT_EQ(GURL("https://example.com/"), last_origin_);
EXPECT_EQ("notification_id", last_notification_id_);
- EXPECT_EQ(base::nullopt, last_action_index_);
- EXPECT_EQ(base::nullopt, last_reply_);
+ EXPECT_EQ(absl::nullopt, last_action_index_);
+ EXPECT_EQ(absl::nullopt, last_reply_);
EXPECT_EQ(true, last_by_user_);
}
@@ -543,8 +543,8 @@
// Validate the close event values.
EXPECT_EQ(NotificationCommon::OPERATION_CLOSE, last_operation_);
EXPECT_EQ("P2i", last_notification_id_);
- EXPECT_EQ(base::nullopt, last_action_index_);
- EXPECT_EQ(base::nullopt, last_reply_);
+ EXPECT_EQ(absl::nullopt, last_action_index_);
+ EXPECT_EQ(absl::nullopt, last_reply_);
EXPECT_EQ(true, last_by_user_);
bridge->SetDisplayedNotificationsForTesting(nullptr);
@@ -639,8 +639,8 @@
EXPECT_EQ(NotificationHandler::Type::WEB_PERSISTENT, last_notification_type_);
EXPECT_EQ(GURL("https://example.com/"), last_origin_);
EXPECT_EQ("notification_id", last_notification_id_);
- EXPECT_EQ(base::nullopt, last_action_index_);
- EXPECT_EQ(base::nullopt, last_reply_);
+ EXPECT_EQ(absl::nullopt, last_action_index_);
+ EXPECT_EQ(absl::nullopt, last_reply_);
EXPECT_TRUE(last_by_user_);
}
@@ -675,7 +675,7 @@
EXPECT_EQ(GURL("https://example.com/"), last_origin_);
EXPECT_EQ("notification_id", last_notification_id_);
EXPECT_EQ(0, last_action_index_);
- EXPECT_EQ(base::nullopt, last_reply_);
+ EXPECT_EQ(absl::nullopt, last_reply_);
EXPECT_TRUE(last_by_user_);
}
@@ -691,7 +691,7 @@
EXPECT_EQ(NotificationHandler::Type::WEB_PERSISTENT, last_notification_type_);
EXPECT_EQ(GURL("https://example.com/"), last_origin_);
EXPECT_EQ("notification_id", last_notification_id_);
- EXPECT_EQ(base::nullopt, last_action_index_);
- EXPECT_EQ(base::nullopt, last_reply_);
+ EXPECT_EQ(absl::nullopt, last_action_index_);
+ EXPECT_EQ(absl::nullopt, last_reply_);
EXPECT_TRUE(last_by_user_);
}
diff --git a/chrome/browser/notifications/notification_ui_manager_browsertest.cc b/chrome/browser/notifications/notification_ui_manager_browsertest.cc
index f26580c..572f66f 100644
--- a/chrome/browser/notifications/notification_ui_manager_browsertest.cc
+++ b/chrome/browser/notifications/notification_ui_manager_browsertest.cc
@@ -58,8 +58,8 @@
log_ += "Close_";
log_ += (by_user ? "by_user_" : "programmatically_");
}
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
if (button_index) {
log_ += "ButtonClick_";
log_ += base::NumberToString(*button_index) + "_";
diff --git a/chrome/browser/notifications/persistent_notification_handler.cc b/chrome/browser/notifications/persistent_notification_handler.cc
index f0ba4a9..93cfd94b 100644
--- a/chrome/browser/notifications/persistent_notification_handler.cc
+++ b/chrome/browser/notifications/persistent_notification_handler.cc
@@ -84,8 +84,8 @@
Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(origin.is_valid());
diff --git a/chrome/browser/notifications/persistent_notification_handler.h b/chrome/browser/notifications/persistent_notification_handler.h
index f9402102..afa79201 100644
--- a/chrome/browser/notifications/persistent_notification_handler.h
+++ b/chrome/browser/notifications/persistent_notification_handler.h
@@ -38,8 +38,8 @@
void OnClick(Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) override;
void DisableNotifications(Profile* profile, const GURL& origin) override;
void OpenSettings(Profile* profile, const GURL& origin) override;
diff --git a/chrome/browser/notifications/persistent_notification_handler_unittest.cc b/chrome/browser/notifications/persistent_notification_handler_unittest.cc
index 9b096ed..e603bbe 100644
--- a/chrome/browser/notifications/persistent_notification_handler_unittest.cc
+++ b/chrome/browser/notifications/persistent_notification_handler_unittest.cc
@@ -111,7 +111,7 @@
std::make_unique<PersistentNotificationHandler>();
handler->OnClick(&profile_, origin_, kExampleNotificationId,
- base::nullopt /* action_index */, base::nullopt /* reply */,
+ absl::nullopt /* action_index */, absl::nullopt /* reply */,
base::DoNothing());
}
@@ -147,7 +147,7 @@
display_service_tester_.SimulateClick(
NotificationHandler::Type::WEB_PERSISTENT, kExampleNotificationId,
- base::nullopt /* action_index */, base::nullopt /* reply */);
+ absl::nullopt /* action_index */, absl::nullopt /* reply */);
}
EXPECT_FALSE(display_service_tester_.GetNotification(kExampleNotificationId));
diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc
index e85e015..700bdd7 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.cc
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -11,7 +11,6 @@
#include "base/bind.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/time/time.h"
@@ -38,6 +37,7 @@
#include "content/public/browser/platform_notification_context.h"
#include "content/public/browser/storage_partition.h"
#include "services/metrics/public/cpp/ukm_builders.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/notifications/notification_resources.h"
#include "third_party/blink/public/common/notifications/platform_notification_data.h"
#include "third_party/blink/public/mojom/notifications/notification.mojom.h"
@@ -364,7 +364,7 @@
void PlatformNotificationServiceImpl::DidGetBackgroundSourceId(
base::OnceClosure recorded_closure,
const content::NotificationDatabaseData& data,
- base::Optional<ukm::SourceId> source_id) {
+ absl::optional<ukm::SourceId> source_id) {
// This background event did not meet the requirements for the UKM service.
if (!source_id)
return;
diff --git a/chrome/browser/notifications/platform_notification_service_impl.h b/chrome/browser/notifications/platform_notification_service_impl.h
index 313e754d..80b880f 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.h
+++ b/chrome/browser/notifications/platform_notification_service_impl.h
@@ -104,7 +104,7 @@
static void DidGetBackgroundSourceId(
base::OnceClosure recorded_closure,
const content::NotificationDatabaseData& data,
- base::Optional<ukm::SourceId> source_id);
+ absl::optional<ukm::SourceId> source_id);
// Creates a new Web Notification-based Notification object. Should only be
// called when the notification is first shown.
diff --git a/chrome/browser/notifications/platform_notification_service_interactive_uitest.cc b/chrome/browser/notifications/platform_notification_service_interactive_uitest.cc
index 5e311f6..a76a63c8 100644
--- a/chrome/browser/notifications/platform_notification_service_interactive_uitest.cc
+++ b/chrome/browser/notifications/platform_notification_service_interactive_uitest.cc
@@ -213,7 +213,7 @@
display_service_tester_->SimulateClick(
NotificationHandler::Type::WEB_PERSISTENT, notifications[0].id(),
- base::nullopt /* action_index */, base::nullopt /* reply */);
+ absl::nullopt /* action_index */, absl::nullopt /* reply */);
// We expect +1 engagement for the notification interaction.
EXPECT_DOUBLE_EQ(1.5, GetEngagementScore(GetLastCommittedURL()));
@@ -525,7 +525,7 @@
display_service_tester_->SimulateClick(
NotificationHandler::Type::WEB_PERSISTENT, notifications[0].id(),
- base::nullopt /* action_index */, base::nullopt /* reply */);
+ absl::nullopt /* action_index */, absl::nullopt /* reply */);
// We have interacted with the button, so expect a notification bump.
EXPECT_DOUBLE_EQ(1.5, GetEngagementScore(GetLastCommittedURL()));
@@ -618,7 +618,7 @@
display_service_tester_->SimulateClick(
NotificationHandler::Type::WEB_PERSISTENT, notifications[0].id(),
- base::nullopt /* action_index */, base::nullopt /* reply */);
+ absl::nullopt /* action_index */, absl::nullopt /* reply */);
ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
EXPECT_EQ("action_close", script_result);
@@ -747,7 +747,7 @@
display_service_tester_->SimulateClick(
NotificationHandler::Type::WEB_PERSISTENT, notification.id(),
- 0 /* action_index */, base::nullopt /* reply */);
+ 0 /* action_index */, absl::nullopt /* reply */);
ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
EXPECT_EQ("action_button_click actionId1", script_result);
@@ -761,7 +761,7 @@
display_service_tester_->SimulateClick(
NotificationHandler::Type::WEB_PERSISTENT, notification.id(),
- 1 /* action_index */, base::nullopt /* reply */);
+ 1 /* action_index */, absl::nullopt /* reply */);
ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
EXPECT_EQ("action_button_click actionId2", script_result);
@@ -901,8 +901,8 @@
{
base::RunLoop run_loop;
handler->OnClick(profile, GURL(kTestNotificationOrigin),
- kTestNotificationId, base::nullopt /* action_index */,
- base::nullopt /* reply */, run_loop.QuitClosure());
+ kTestNotificationId, absl::nullopt /* action_index */,
+ absl::nullopt /* reply */, run_loop.QuitClosure());
run_loop.Run();
}
@@ -1030,8 +1030,8 @@
base::RunLoop run_loop;
handler->OnClick(browser()->profile(), notifications[0].origin_url(),
- notifications[0].id(), base::nullopt /* action_index */,
- base::nullopt /* reply */, run_loop.QuitClosure());
+ notifications[0].id(), absl::nullopt /* action_index */,
+ absl::nullopt /* reply */, run_loop.QuitClosure());
// The asynchronous part of the click event will still be in progress, but
// the keep alive registration should have been created.
diff --git a/chrome/browser/notifications/popups_only_ui_controller.cc b/chrome/browser/notifications/popups_only_ui_controller.cc
index cc1423e..7803a3105 100644
--- a/chrome/browser/notifications/popups_only_ui_controller.cc
+++ b/chrome/browser/notifications/popups_only_ui_controller.cc
@@ -42,8 +42,8 @@
void PopupsOnlyUiController::OnNotificationClicked(
const std::string& notification_id,
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
if (popups_visible_)
ShowOrHidePopupBubbles();
}
diff --git a/chrome/browser/notifications/popups_only_ui_controller.h b/chrome/browser/notifications/popups_only_ui_controller.h
index 5b60c07..b5ffbc3c 100644
--- a/chrome/browser/notifications/popups_only_ui_controller.h
+++ b/chrome/browser/notifications/popups_only_ui_controller.h
@@ -32,8 +32,8 @@
void OnNotificationUpdated(const std::string& notification_id) override;
void OnNotificationClicked(
const std::string& notification_id,
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
void OnBlockingStateChanged(
message_center::NotificationBlocker* blocker) override;
diff --git a/chrome/browser/notifications/scheduler/display_agent_android.cc b/chrome/browser/notifications/scheduler/display_agent_android.cc
index a20c3894..220bbda 100644
--- a/chrome/browser/notifications/scheduler/display_agent_android.cc
+++ b/chrome/browser/notifications/scheduler/display_agent_android.cc
@@ -55,7 +55,7 @@
button_click_info.type =
static_cast<notifications::ActionButtonType>(j_button_type);
action_data.button_click_info =
- base::make_optional(std::move(button_click_info));
+ absl::make_optional(std::move(button_click_info));
}
GetUserActionHandler()->OnUserAction(action_data);
diff --git a/chrome/browser/notifications/scheduler/internal/background_task_coordinator.cc b/chrome/browser/notifications/scheduler/internal/background_task_coordinator.cc
index 40eed11..e9db626a 100644
--- a/chrome/browser/notifications/scheduler/internal/background_task_coordinator.cc
+++ b/chrome/browser/notifications/scheduler/internal/background_task_coordinator.cc
@@ -9,7 +9,6 @@
#include "base/command_line.h"
#include "base/numerics/ranges.h"
-#include "base/optional.h"
#include "base/time/clock.h"
#include "chrome/browser/notifications/scheduler/internal/impression_types.h"
#include "chrome/browser/notifications/scheduler/internal/notification_entry.h"
@@ -17,6 +16,7 @@
#include "chrome/browser/notifications/scheduler/internal/scheduler_utils.h"
#include "chrome/browser/notifications/scheduler/public/features.h"
#include "chrome/browser/notifications/scheduler/public/notification_background_task_scheduler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace notifications {
namespace {
@@ -170,7 +170,7 @@
NotificationBackgroundTaskScheduler* background_task_;
const SchedulerConfig* config_;
base::Clock* clock_;
- base::Optional<base::Time> background_task_time_;
+ absl::optional<base::Time> background_task_time_;
};
} // namespace
diff --git a/chrome/browser/notifications/scheduler/internal/background_task_coordinator_unittest.cc b/chrome/browser/notifications/scheduler/internal/background_task_coordinator_unittest.cc
index 476e53a..b25af6f2 100644
--- a/chrome/browser/notifications/scheduler/internal/background_task_coordinator_unittest.cc
+++ b/chrome/browser/notifications/scheduler/internal/background_task_coordinator_unittest.cc
@@ -38,10 +38,10 @@
SchedulerClientType::kTest1,
1 /* current_max_daily_show */,
{} /* impressions */,
- base::nullopt /* suppression_info */,
+ absl::nullopt /* suppression_info */,
0 /* negative_events_count */,
- base::nullopt /* negative_event_ts */,
- base::nullopt /* last_shown_ts */
+ absl::nullopt /* negative_event_ts */,
+ absl::nullopt /* last_shown_ts */
}
};
@@ -50,18 +50,18 @@
{SchedulerClientType::kTest1,
1 /* current_max_daily_show */,
{} /* impressions */,
- base::nullopt /* suppression_info */,
+ absl::nullopt /* suppression_info */,
0 /* negative_events_count */,
- base::nullopt /* negative_event_ts */,
- base::nullopt /* last_shown_ts */},
+ absl::nullopt /* negative_event_ts */,
+ absl::nullopt /* last_shown_ts */},
{
SchedulerClientType::kTest2,
2 /* current_max_daily_show */,
{} /* impressions */,
- base::nullopt /* suppression_info */,
+ absl::nullopt /* suppression_info */,
0 /* negative_events_count */,
- base::nullopt /* negative_event_ts */,
- base::nullopt /* last_shown_ts */,
+ absl::nullopt /* negative_event_ts */,
+ absl::nullopt /* last_shown_ts */,
}};
diff --git a/chrome/browser/notifications/scheduler/internal/display_decider_unittest.cc b/chrome/browser/notifications/scheduler/internal/display_decider_unittest.cc
index 8f644561..3be2aba 100644
--- a/chrome/browser/notifications/scheduler/internal/display_decider_unittest.cc
+++ b/chrome/browser/notifications/scheduler/internal/display_decider_unittest.cc
@@ -26,33 +26,33 @@
{SchedulerClientType::kTest1,
2 /* current_max_daily_show */,
{} /* impressions */,
- base::nullopt /* suppression_info */,
+ absl::nullopt /* suppression_info */,
0 /* negative_events_count */,
- base::nullopt /* negative_event_ts */,
- base::nullopt /* last_shown_ts */}};
+ absl::nullopt /* negative_event_ts */,
+ absl::nullopt /* last_shown_ts */}};
const std::vector<test::ImpressionTestData> kClientsImpressionTestData = {
{SchedulerClientType::kTest1,
2 /* current_max_daily_show */,
{} /* impressions */,
- base::nullopt /* suppression_info */,
+ absl::nullopt /* suppression_info */,
0 /* negative_events_count */,
- base::nullopt /* negative_event_ts */,
- base::nullopt /* last_shown_ts */},
+ absl::nullopt /* negative_event_ts */,
+ absl::nullopt /* last_shown_ts */},
{SchedulerClientType::kTest2,
5 /* current_max_daily_show */,
{} /* impressions */,
- base::nullopt /* suppression_info */,
+ absl::nullopt /* suppression_info */,
0 /* negative_events_count */,
- base::nullopt /* negative_event_ts */,
- base::nullopt /* last_shown_ts */},
+ absl::nullopt /* negative_event_ts */,
+ absl::nullopt /* last_shown_ts */},
{SchedulerClientType::kTest3,
1 /* current_max_daily_show */,
{} /* impressions */,
- base::nullopt /* suppression_info */,
+ absl::nullopt /* suppression_info */,
0 /* negative_events_count */,
- base::nullopt /* negative_event_ts */,
- base::nullopt /* last_shown_ts */}};
+ absl::nullopt /* negative_event_ts */,
+ absl::nullopt /* last_shown_ts */}};
struct TestData {
// Impression data as the input.
@@ -133,8 +133,8 @@
NotificationEntry CreateNotification(
SchedulerClientType type,
const std::string& guid,
- base::Optional<base::TimeDelta> deliver_time_start_delta,
- base::Optional<base::TimeDelta> deliver_time_end_delta) {
+ absl::optional<base::TimeDelta> deliver_time_start_delta,
+ absl::optional<base::TimeDelta> deliver_time_end_delta) {
NotificationEntry entry(type, guid);
if (deliver_time_start_delta.has_value())
entry.schedule_params.deliver_time_start =
@@ -188,7 +188,7 @@
base::TimeDelta() - base::TimeDelta::FromDays(2),
base::TimeDelta() - base::TimeDelta::FromDays(1));
auto entry2 = CreateNotification(SchedulerClientType::kTest2, "guid2",
- base::nullopt, base::nullopt);
+ absl::nullopt, absl::nullopt);
TestData data{kSingleClientImpressionTestData,
{entry0, entry1, entry2},
diff --git a/chrome/browser/notifications/scheduler/internal/icon_converter_result.h b/chrome/browser/notifications/scheduler/internal/icon_converter_result.h
index 86cd6c7..ba994ca 100644
--- a/chrome/browser/notifications/scheduler/internal/icon_converter_result.h
+++ b/chrome/browser/notifications/scheduler/internal/icon_converter_result.h
@@ -8,7 +8,7 @@
#include <string>
#include <vector>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace notifications {
diff --git a/chrome/browser/notifications/scheduler/internal/impression_history_tracker.cc b/chrome/browser/notifications/scheduler/internal/impression_history_tracker.cc
index 14c0d07..fb286b9 100644
--- a/chrome/browser/notifications/scheduler/internal/impression_history_tracker.cc
+++ b/chrome/browser/notifications/scheduler/internal/impression_history_tracker.cc
@@ -89,7 +89,7 @@
const std::string& guid,
const Impression::ImpressionResultMap& impression_mapping,
const Impression::CustomData& custom_data,
- base::Optional<base::TimeDelta> ignore_timeout_duration) {
+ absl::optional<base::TimeDelta> ignore_timeout_duration) {
DCHECK(initialized_);
auto it = client_states_.find(type);
if (it == client_states_.end())
diff --git a/chrome/browser/notifications/scheduler/internal/impression_history_tracker.h b/chrome/browser/notifications/scheduler/internal/impression_history_tracker.h
index 4e285350..49d1c48 100644
--- a/chrome/browser/notifications/scheduler/internal/impression_history_tracker.h
+++ b/chrome/browser/notifications/scheduler/internal/impression_history_tracker.h
@@ -57,7 +57,7 @@
const std::string& guid,
const Impression::ImpressionResultMap& impression_map,
const Impression::CustomData& custom_data,
- base::Optional<base::TimeDelta> ignore_timeout_duration) = 0;
+ absl::optional<base::TimeDelta> ignore_timeout_duration) = 0;
// Analyzes the impression history for all notification clients, and adjusts
// the |current_max_daily_show|.
@@ -105,7 +105,7 @@
const std::string& guid,
const Impression::ImpressionResultMap& impression_mapping,
const Impression::CustomData& custom_data,
- base::Optional<base::TimeDelta> ignore_timeout_duration) override;
+ absl::optional<base::TimeDelta> ignore_timeout_duration) override;
void AnalyzeImpressionHistory() override;
void GetClientStates(std::map<SchedulerClientType, const ClientState*>*
client_states) const override;
diff --git a/chrome/browser/notifications/scheduler/internal/impression_history_tracker_unittest.cc b/chrome/browser/notifications/scheduler/internal/impression_history_tracker_unittest.cc
index 315f5185..e0d4846 100644
--- a/chrome/browser/notifications/scheduler/internal/impression_history_tracker_unittest.cc
+++ b/chrome/browser/notifications/scheduler/internal/impression_history_tracker_unittest.cc
@@ -71,10 +71,10 @@
test_case.input = {{SchedulerClientType::kTest1,
2 /* current_max_daily_show */,
{} /* impressions */,
- base::nullopt /* suppression_info */,
+ absl::nullopt /* suppression_info */,
0 /* negative_events_count */,
- base::nullopt /* last_negative_event_ts */,
- base::nullopt /* last_shown_ts */}};
+ absl::nullopt /* last_negative_event_ts */,
+ absl::nullopt /* last_shown_ts */}};
test_case.registered_clients = {SchedulerClientType::kTest1};
test_case.expected = test_case.input;
return test_case;
@@ -199,7 +199,7 @@
test_case.registered_clients.emplace_back(SchedulerClientType::kTest2);
test_case.expected.emplace_back(test::ImpressionTestData(
SchedulerClientType::kTest2, config().initial_daily_shown_per_type, {},
- base::nullopt, 0, base::nullopt, base::nullopt));
+ absl::nullopt, 0, absl::nullopt, absl::nullopt));
CreateTracker(test_case);
EXPECT_CALL(*store(), Add(_, _, _));
@@ -248,7 +248,7 @@
// No-op for unregistered client.
tracker()->AddImpression(SchedulerClientType::kTest2, kGuid2,
Impression::ImpressionResultMap(),
- Impression::CustomData(), base::nullopt);
+ Impression::CustomData(), absl::nullopt);
VerifyClientStates(test_case);
clock()->SetNow(kTimeStr);
@@ -258,7 +258,7 @@
Impression::CustomData custom_data = {{"url", "https://www.example.com"}};
EXPECT_CALL(*store(), Update(_, _, _));
tracker()->AddImpression(SchedulerClientType::kTest1, kGuid1,
- impression_mapping, custom_data, base::nullopt);
+ impression_mapping, custom_data, absl::nullopt);
Impression expected_impression(SchedulerClientType::kTest1, kGuid1,
clock()->Now());
expected_impression.impression_mapping = impression_mapping;
@@ -389,7 +389,7 @@
ImpressionResult impression_result = ImpressionResult::kInvalid;
UserFeedback user_feedback = UserFeedback::kNoFeedback;
int current_max_daily_show = 0;
- base::Optional<ActionButtonType> button_type;
+ absl::optional<ActionButtonType> button_type;
bool integrated = false;
bool has_suppression = false;
std::map<UserFeedback, ImpressionResult> impression_mapping;
@@ -409,7 +409,7 @@
const UserActionTestParam kUserActionTestParams[] = {
// Suite 0: Click.
- {ImpressionResult::kPositive, UserFeedback::kClick, 3, base::nullopt,
+ {ImpressionResult::kPositive, UserFeedback::kClick, 3, absl::nullopt,
true /*integrated*/, false /*has_suppression*/},
// Suite 1: Helpful button.
@@ -423,14 +423,14 @@
true /*has_suppression*/},
// Suite 3: One dismiss.
- {ImpressionResult::kInvalid, UserFeedback::kDismiss, 2, base::nullopt,
+ {ImpressionResult::kInvalid, UserFeedback::kDismiss, 2, absl::nullopt,
false /*integrated*/, false /*has_suppression*/},
// Suite 4: Click with negative impression result from impression mapping.
{ImpressionResult::kNegative,
UserFeedback::kClick,
0,
- base::nullopt,
+ absl::nullopt,
true /*integrated*/,
true /*has_suppression*/,
{{UserFeedback::kClick,
@@ -440,7 +440,7 @@
{ImpressionResult::kNegative,
UserFeedback::kClick,
0,
- base::nullopt,
+ absl::nullopt,
true /*integrated*/,
true /*has_suppression*/,
{{UserFeedback::kClick,
@@ -492,7 +492,7 @@
UserActionData action_data(SchedulerClientType::kTest1,
UserActionType::kButtonClick, kGuid1);
action_data.button_click_info =
- base::make_optional(std::move(button_click_info));
+ absl::make_optional(std::move(button_click_info));
tracker()->OnUserAction(action_data);
} else if (GetParam().user_feedback == UserFeedback::kDismiss) {
UserActionData action_data(SchedulerClientType::kTest1,
diff --git a/chrome/browser/notifications/scheduler/internal/impression_types.h b/chrome/browser/notifications/scheduler/internal/impression_types.h
index ee5b1f4..fefdd7e1 100644
--- a/chrome/browser/notifications/scheduler/internal/impression_types.h
+++ b/chrome/browser/notifications/scheduler/internal/impression_types.h
@@ -9,9 +9,9 @@
#include <string>
#include "base/containers/circular_deque.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/notifications/scheduler/public/notification_scheduler_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace notifications {
@@ -68,7 +68,7 @@
CustomData custom_data;
// Duration to mark a notification without feedback as ignored.
- base::Optional<base::TimeDelta> ignore_timeout_duration;
+ absl::optional<base::TimeDelta> ignore_timeout_duration;
};
// Contains details about supression and recovery after suppression expired.
@@ -115,18 +115,18 @@
Impressions impressions;
// Suppression details, no value if there is currently no suppression.
- base::Optional<SuppressionInfo> suppression_info;
+ absl::optional<SuppressionInfo> suppression_info;
// The number of negative events caused by concecutive dismiss or not helpful
// button clicking in all time. Persisted in protodb.
size_t negative_events_count;
// Timestamp of last negative event occurred. Persisted in protodb.
- base::Optional<base::Time> last_negative_event_ts;
+ absl::optional<base::Time> last_negative_event_ts;
// Timestamp of last shown notification.
// Persisted in protodb.
- base::Optional<base::Time> last_shown_ts;
+ absl::optional<base::Time> last_shown_ts;
};
} // namespace notifications
diff --git a/chrome/browser/notifications/scheduler/internal/init_aware_scheduler.h b/chrome/browser/notifications/scheduler/internal/init_aware_scheduler.h
index e2612b7d..6d57fdaf 100644
--- a/chrome/browser/notifications/scheduler/internal/init_aware_scheduler.h
+++ b/chrome/browser/notifications/scheduler/internal/init_aware_scheduler.h
@@ -11,9 +11,9 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/notifications/scheduler/internal/notification_scheduler.h"
#include "chrome/browser/notifications/scheduler/public/notification_scheduler_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace notifications {
@@ -57,7 +57,7 @@
// Whether the initialization is successful. No value if initialization is not
// finished.
- base::Optional<bool> init_success_;
+ absl::optional<bool> init_success_;
// Cached calls.
std::vector<base::OnceClosure> cached_closures_;
diff --git a/chrome/browser/notifications/scheduler/internal/notification_scheduler.cc b/chrome/browser/notifications/scheduler/internal/notification_scheduler.cc
index 3dbf3cba2..eb0bfe46 100644
--- a/chrome/browser/notifications/scheduler/internal/notification_scheduler.cc
+++ b/chrome/browser/notifications/scheduler/internal/notification_scheduler.cc
@@ -13,7 +13,6 @@
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/notifications/scheduler/internal/background_task_coordinator.h"
#include "chrome/browser/notifications/scheduler/internal/display_decider.h"
@@ -29,6 +28,7 @@
#include "chrome/browser/notifications/scheduler/public/notification_scheduler_client.h"
#include "chrome/browser/notifications/scheduler/public/notification_scheduler_client_registrar.h"
#include "chrome/browser/notifications/scheduler/public/user_action_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace notifications {
namespace {
diff --git a/chrome/browser/notifications/scheduler/internal/proto_conversion_unittest.cc b/chrome/browser/notifications/scheduler/internal/proto_conversion_unittest.cc
index 81dc145..53b4d24 100644
--- a/chrome/browser/notifications/scheduler/internal/proto_conversion_unittest.cc
+++ b/chrome/browser/notifications/scheduler/internal/proto_conversion_unittest.cc
@@ -87,10 +87,10 @@
SchedulerClientType::kTest1,
3 /* current_max_daily_show */,
{} /* impressions */,
- base::nullopt /* suppression_info */,
+ absl::nullopt /* suppression_info */,
0 /* negative_events_count */,
- base::nullopt /* negative_event_ts */,
- base::nullopt /* last_shown_ts */,
+ absl::nullopt /* negative_event_ts */,
+ absl::nullopt /* last_shown_ts */,
};
test::AddImpressionTestData(test_data, &client_state);
TestClientStateConversion(&client_state);
diff --git a/chrome/browser/notifications/scheduler/public/impression_detail.cc b/chrome/browser/notifications/scheduler/public/impression_detail.cc
index 03a9fd6..b11a3b10 100644
--- a/chrome/browser/notifications/scheduler/public/impression_detail.cc
+++ b/chrome/browser/notifications/scheduler/public/impression_detail.cc
@@ -13,8 +13,8 @@
size_t current_max_daily_show,
size_t num_shown_today,
size_t num_negative_events,
- base::Optional<base::Time> last_negative_event_ts,
- base::Optional<base::Time> last_shown_ts)
+ absl::optional<base::Time> last_negative_event_ts,
+ absl::optional<base::Time> last_shown_ts)
: current_max_daily_show(current_max_daily_show),
num_shown_today(num_shown_today),
num_negative_events(num_negative_events),
diff --git a/chrome/browser/notifications/scheduler/public/impression_detail.h b/chrome/browser/notifications/scheduler/public/impression_detail.h
index 9ac3c148..c7c2835 100644
--- a/chrome/browser/notifications/scheduler/public/impression_detail.h
+++ b/chrome/browser/notifications/scheduler/public/impression_detail.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_PUBLIC_IMPRESSION_DETAIL_H_
#include "base/callback.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace notifications {
@@ -17,8 +17,8 @@
ImpressionDetail(size_t current_max_daily_show,
size_t num_shown_today,
size_t num_negative_events,
- base::Optional<base::Time> last_negative_event_ts,
- base::Optional<base::Time> last_shown_ts);
+ absl::optional<base::Time> last_negative_event_ts,
+ absl::optional<base::Time> last_shown_ts);
ImpressionDetail(const ImpressionDetail& other);
~ImpressionDetail();
bool operator==(const ImpressionDetail& other) const;
@@ -37,11 +37,11 @@
// Timestamp of last negative event.
// Persisted in protodb.
- base::Optional<base::Time> last_negative_event_ts;
+ absl::optional<base::Time> last_negative_event_ts;
// Timestamp of last shown notification.
// Persisted in protodb.
- base::Optional<base::Time> last_shown_ts;
+ absl::optional<base::Time> last_shown_ts;
};
} // namespace notifications
diff --git a/chrome/browser/notifications/scheduler/public/notification_scheduler_client.h b/chrome/browser/notifications/scheduler/public/notification_scheduler_client.h
index 20e677f..9b5c0ed 100644
--- a/chrome/browser/notifications/scheduler/public/notification_scheduler_client.h
+++ b/chrome/browser/notifications/scheduler/public/notification_scheduler_client.h
@@ -11,10 +11,10 @@
#include <string>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/notifications/scheduler/public/notification_data.h"
#include "chrome/browser/notifications/scheduler/public/notification_scheduler_types.h"
#include "chrome/browser/notifications/scheduler/public/throttle_config.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace notifications {
diff --git a/chrome/browser/notifications/scheduler/public/notification_scheduler_types.h b/chrome/browser/notifications/scheduler/public/notification_scheduler_types.h
index 3950612c..9539e19 100644
--- a/chrome/browser/notifications/scheduler/public/notification_scheduler_types.h
+++ b/chrome/browser/notifications/scheduler/public/notification_scheduler_types.h
@@ -8,7 +8,7 @@
#include <map>
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace notifications {
@@ -137,7 +137,7 @@
std::map<std::string, std::string> custom_data;
// The button click info, only available when the user clicked a button.
- base::Optional<ButtonClickInfo> button_click_info;
+ absl::optional<ButtonClickInfo> button_click_info;
};
// Categorizes type of notification icons.
diff --git a/chrome/browser/notifications/scheduler/public/schedule_params.h b/chrome/browser/notifications/scheduler/public/schedule_params.h
index 864c1eaf..a502734 100644
--- a/chrome/browser/notifications/scheduler/public/schedule_params.h
+++ b/chrome/browser/notifications/scheduler/public/schedule_params.h
@@ -7,9 +7,9 @@
#include <map>
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/notifications/scheduler/public/notification_scheduler_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace notifications {
@@ -40,15 +40,15 @@
std::map<UserFeedback, ImpressionResult> impression_mapping;
// The start time of the deliver time window of the notification.
- base::Optional<base::Time> deliver_time_start;
+ absl::optional<base::Time> deliver_time_start;
// The end time of the deliver time window of the notification. Use in pair
// with |deliver_time_start|.
- base::Optional<base::Time> deliver_time_end;
+ absl::optional<base::Time> deliver_time_end;
// Duration to mark notification without feedback as ignored.
// when try to analyze the impressions.
- base::Optional<base::TimeDelta> ignore_timeout_duration;
+ absl::optional<base::TimeDelta> ignore_timeout_duration;
};
} // namespace notifications
diff --git a/chrome/browser/notifications/scheduler/public/schedule_service_utils.h b/chrome/browser/notifications/scheduler/public/schedule_service_utils.h
index 988b867..c4b76a3 100644
--- a/chrome/browser/notifications/scheduler/public/schedule_service_utils.h
+++ b/chrome/browser/notifications/scheduler/public/schedule_service_utils.h
@@ -7,9 +7,9 @@
#include <utility>
-#include "base/optional.h"
#include "base/time/clock.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace notifications {
diff --git a/chrome/browser/notifications/scheduler/public/throttle_config.h b/chrome/browser/notifications/scheduler/public/throttle_config.h
index c9d43ca..971f0751 100644
--- a/chrome/browser/notifications/scheduler/public/throttle_config.h
+++ b/chrome/browser/notifications/scheduler/public/throttle_config.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_PUBLIC_THROTTLE_CONFIG_H_
#define CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_PUBLIC_THROTTLE_CONFIG_H_
-#include "base/optional.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace notifications {
@@ -20,13 +20,13 @@
// Support a custom suppression duration(in days) for the notification.
// If client sets this field, it will override |suppression_duration| in
// global config.
- base::Optional<base::TimeDelta> suppression_duration;
+ absl::optional<base::TimeDelta> suppression_duration;
// Maxmium number of consecutive negative actions to trigger negative
// impression event.
// If client sets this field, it will override |dismiss_count| in global
// config.
- base::Optional<int> negative_action_count_threshold;
+ absl::optional<int> negative_action_count_threshold;
};
} // namespace notifications
diff --git a/chrome/browser/notifications/scheduler/test/mock_impression_history_tracker.h b/chrome/browser/notifications/scheduler/test/mock_impression_history_tracker.h
index 0396e3e..2162f8e 100644
--- a/chrome/browser/notifications/scheduler/test/mock_impression_history_tracker.h
+++ b/chrome/browser/notifications/scheduler/test/mock_impression_history_tracker.h
@@ -25,7 +25,7 @@
const std::string&,
const Impression::ImpressionResultMap&,
const Impression::CustomData&,
- base::Optional<base::TimeDelta> ignore_timeout_duration));
+ absl::optional<base::TimeDelta> ignore_timeout_duration));
MOCK_METHOD0(AnalyzeImpressionHistory, void());
MOCK_CONST_METHOD1(GetClientStates,
void(std::map<SchedulerClientType, const ClientState*>*));
diff --git a/chrome/browser/notifications/scheduler/test/mock_notification_schedule_service.h b/chrome/browser/notifications/scheduler/test/mock_notification_schedule_service.h
index ef7ba53c..089d7ce 100644
--- a/chrome/browser/notifications/scheduler/test/mock_notification_schedule_service.h
+++ b/chrome/browser/notifications/scheduler/test/mock_notification_schedule_service.h
@@ -7,10 +7,10 @@
#include <memory>
-#include "base/optional.h"
#include "chrome/browser/notifications/scheduler/public/notification_params.h"
#include "chrome/browser/notifications/scheduler/public/notification_schedule_service.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace notifications {
namespace test {
diff --git a/chrome/browser/notifications/scheduler/test/test_utils.cc b/chrome/browser/notifications/scheduler/test/test_utils.cc
index 67a3b6e..a3b8ca6e 100644
--- a/chrome/browser/notifications/scheduler/test/test_utils.cc
+++ b/chrome/browser/notifications/scheduler/test/test_utils.cc
@@ -20,10 +20,10 @@
SchedulerClientType type,
size_t current_max_daily_show,
std::vector<Impression> impressions,
- base::Optional<SuppressionInfo> suppression_info,
+ absl::optional<SuppressionInfo> suppression_info,
size_t negative_events_count,
- base::Optional<base::Time> last_negative_event_ts,
- base::Optional<base::Time> last_shown_ts)
+ absl::optional<base::Time> last_negative_event_ts,
+ absl::optional<base::Time> last_shown_ts)
: type(type),
current_max_daily_show(current_max_daily_show),
impressions(std::move(impressions)),
diff --git a/chrome/browser/notifications/scheduler/test/test_utils.h b/chrome/browser/notifications/scheduler/test/test_utils.h
index c50658a..00a23147 100644
--- a/chrome/browser/notifications/scheduler/test/test_utils.h
+++ b/chrome/browser/notifications/scheduler/test/test_utils.h
@@ -25,10 +25,10 @@
ImpressionTestData(SchedulerClientType type,
size_t current_max_daily_show,
std::vector<Impression> impressions,
- base::Optional<SuppressionInfo> suppression_info,
+ absl::optional<SuppressionInfo> suppression_info,
size_t negative_events_count,
- base::Optional<base::Time> last_negative_event_ts,
- base::Optional<base::Time> last_shown_ts);
+ absl::optional<base::Time> last_negative_event_ts,
+ absl::optional<base::Time> last_shown_ts);
ImpressionTestData(const ImpressionTestData& other);
~ImpressionTestData();
@@ -36,10 +36,10 @@
SchedulerClientType type;
size_t current_max_daily_show;
std::vector<Impression> impressions;
- base::Optional<SuppressionInfo> suppression_info;
+ absl::optional<SuppressionInfo> suppression_info;
size_t negative_events_count;
- base::Optional<base::Time> last_negative_event_ts;
- base::Optional<base::Time> last_shown_ts;
+ absl::optional<base::Time> last_negative_event_ts;
+ absl::optional<base::Time> last_shown_ts;
};
// Add one impression test data into a client state.
diff --git a/chrome/browser/notifications/screen_capture_notification_blocker_unittest.cc b/chrome/browser/notifications/screen_capture_notification_blocker_unittest.cc
index a81a17b..b7039e0 100644
--- a/chrome/browser/notifications/screen_capture_notification_blocker_unittest.cc
+++ b/chrome/browser/notifications/screen_capture_notification_blocker_unittest.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/notifications/screen_capture_notification_blocker.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/test/metrics/histogram_tester.h"
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
@@ -20,6 +19,7 @@
#include "content/public/test/test_web_contents_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/message_center/public/cpp/notification.h"
#include "url/gurl.h"
@@ -89,7 +89,7 @@
}
void SimulateClose(bool by_user) {
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
GetMutedNotification();
ASSERT_TRUE(notification);
notification_service_->RemoveNotification(
@@ -97,17 +97,17 @@
by_user, /*silent=*/false);
}
- void SimulateClick(const base::Optional<int>& action_index) {
- base::Optional<message_center::Notification> notification =
+ void SimulateClick(const absl::optional<int>& action_index) {
+ absl::optional<message_center::Notification> notification =
GetMutedNotification();
ASSERT_TRUE(notification);
notification_service_->SimulateClick(
NotificationHandler::Type::NOTIFICATIONS_MUTED, notification->id(),
action_index,
- /*reply=*/base::nullopt);
+ /*reply=*/absl::nullopt);
}
- base::Optional<message_center::Notification> GetMutedNotification() {
+ absl::optional<message_center::Notification> GetMutedNotification() {
std::vector<message_center::Notification> notifications =
notification_service_->GetDisplayedNotificationsForType(
NotificationHandler::Type::NOTIFICATIONS_MUTED);
@@ -115,7 +115,7 @@
EXPECT_LE(notifications.size(), 1u);
if (notifications.empty())
- return base::nullopt;
+ return absl::nullopt;
return notifications[0];
}
@@ -216,7 +216,7 @@
blocker().OnBlockedNotification(
CreateNotification(GURL("https://example2.com")), /*replaced*/ false);
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
GetMutedNotification();
ASSERT_TRUE(notification);
@@ -243,7 +243,7 @@
CreateNotification(GURL("https://example2.com")), /*replaced*/ false);
}
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
GetMutedNotification();
ASSERT_TRUE(notification);
@@ -283,7 +283,7 @@
CreateNotification(GURL("https://example2.com")), /*replaced*/ false);
// Expect notification to be closed after clicking on its body.
- SimulateClick(/*action_index=*/base::nullopt);
+ SimulateClick(/*action_index=*/absl::nullopt);
EXPECT_FALSE(GetMutedNotification());
}
@@ -295,11 +295,11 @@
// Blocking another notification after closing the muted one should show a new
// one with an updated message.
- SimulateClick(/*action_index=*/base::nullopt);
+ SimulateClick(/*action_index=*/absl::nullopt);
blocker().OnBlockedNotification(
CreateNotification(GURL("https://example2.com")), /*replaced*/ false);
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
GetMutedNotification();
ASSERT_TRUE(notification);
EXPECT_EQ(l10n_util::GetPluralStringFUTF16(IDS_NOTIFICATION_MUTED_TITLE,
@@ -377,7 +377,7 @@
auto action_delay = base::TimeDelta::FromSeconds(5);
task_environment_.FastForwardBy(action_delay);
- SimulateClick(/*action_index=*/base::nullopt);
+ SimulateClick(/*action_index=*/absl::nullopt);
histogram_tester.ExpectBucketCount(kHistogram, /*sample=*/1, /*count=*/1);
histogram_tester.ExpectTotalCount(kHistogram, /*count=*/1);
@@ -386,7 +386,7 @@
/*count=*/1);
blocker().OnBlockedNotification(notification, /*replaced*/ false);
- SimulateClick(/*action_index=*/base::nullopt);
+ SimulateClick(/*action_index=*/absl::nullopt);
histogram_tester.ExpectBucketCount(kHistogram, /*sample=*/2, /*count=*/1);
histogram_tester.ExpectTotalCount(kHistogram, /*count=*/2);
}
diff --git a/chrome/browser/notifications/stub_notification_display_service.cc b/chrome/browser/notifications/stub_notification_display_service.cc
index a846c11e..0ebbf5c 100644
--- a/chrome/browser/notifications/stub_notification_display_service.cc
+++ b/chrome/browser/notifications/stub_notification_display_service.cc
@@ -48,7 +48,7 @@
return notifications;
}
-base::Optional<message_center::Notification>
+absl::optional<message_center::Notification>
StubNotificationDisplayService::GetNotification(
const std::string& notification_id) {
auto iter = std::find_if(notifications_.begin(), notifications_.end(),
@@ -57,7 +57,7 @@
});
if (iter == notifications_.end())
- return base::nullopt;
+ return absl::nullopt;
return iter->notification;
}
@@ -79,8 +79,8 @@
void StubNotificationDisplayService::SimulateClick(
NotificationHandler::Type notification_type,
const std::string& notification_id,
- base::Optional<int> action_index,
- base::Optional<std::u16string> reply) {
+ absl::optional<int> action_index,
+ absl::optional<std::u16string> reply) {
auto iter = FindNotification(notification_type, notification_id);
if (iter == notifications_.end())
return;
@@ -230,9 +230,9 @@
NotificationHandler::Type notification_type,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
- const base::Optional<bool>& by_user) {
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
+ const absl::optional<bool>& by_user) {
if (process_notification_operation_delegate_) {
process_notification_operation_delegate_.Run(operation, notification_type,
origin, notification_id,
diff --git a/chrome/browser/notifications/stub_notification_display_service.h b/chrome/browser/notifications/stub_notification_display_service.h
index d84e46f7..203f515 100644
--- a/chrome/browser/notifications/stub_notification_display_service.h
+++ b/chrome/browser/notifications/stub_notification_display_service.h
@@ -10,9 +10,9 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/notifications/notification_common.h"
#include "chrome/browser/notifications/notification_display_service_impl.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/message_center/public/cpp/notification.h"
namespace content {
@@ -36,9 +36,9 @@
NotificationHandler::Type notification_type,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
- const base::Optional<bool>& by_user)>
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
+ const absl::optional<bool>& by_user)>
ProcessNotificationOperationCallback;
explicit StubNotificationDisplayService(Profile* profile);
@@ -58,7 +58,7 @@
std::vector<message_center::Notification> GetDisplayedNotificationsForType(
NotificationHandler::Type type) const;
- base::Optional<message_center::Notification> GetNotification(
+ absl::optional<message_center::Notification> GetNotification(
const std::string& notification_id);
const NotificationCommon::Metadata* GetMetadataForNotification(
@@ -68,8 +68,8 @@
// on, optionally with the given |action_index| and |reply|.
void SimulateClick(NotificationHandler::Type notification_type,
const std::string& notification_id,
- base::Optional<int> action_index,
- base::Optional<std::u16string> reply);
+ absl::optional<int> action_index,
+ absl::optional<std::u16string> reply);
// Simulates a click on the settings button of the notification identified by
// |notification_id|.
@@ -106,9 +106,9 @@
NotificationHandler::Type notification_type,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
- const base::Optional<bool>& by_user) override;
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
+ const absl::optional<bool>& by_user) override;
private:
// Data to store for a notification that's being shown through this service.
diff --git a/chrome/browser/offline_pages/android/auto_fetch_page_load_watcher.cc b/chrome/browser/offline_pages/android/auto_fetch_page_load_watcher.cc
index 0c5f4536..ac42921d 100644
--- a/chrome/browser/offline_pages/android/auto_fetch_page_load_watcher.cc
+++ b/chrome/browser/offline_pages/android/auto_fetch_page_load_watcher.cc
@@ -64,11 +64,11 @@
return result;
}
-base::Optional<TabInfo> AndroidTabFinder::FindNavigationTab(
+absl::optional<TabInfo> AndroidTabFinder::FindNavigationTab(
content::WebContents* web_contents) {
TabAndroid* tab = TabAndroid::FromWebContents(web_contents);
if (!tab)
- return base::nullopt;
+ return absl::nullopt;
return AnroidTabInfo(*tab);
}
@@ -123,11 +123,11 @@
namespace auto_fetch_internal {
-base::Optional<RequestInfo> MakeRequestInfo(const SavePageRequest& request) {
- base::Optional<auto_fetch::ClientIdMetadata> metadata =
+absl::optional<RequestInfo> MakeRequestInfo(const SavePageRequest& request) {
+ absl::optional<auto_fetch::ClientIdMetadata> metadata =
auto_fetch::ExtractMetadata(request.client_id());
if (!metadata)
- return base::nullopt;
+ return absl::nullopt;
RequestInfo info;
info.request_id = request.request_id();
@@ -286,7 +286,7 @@
SavePageRequest::AutoFetchNotificationState::kUnknown) {
// Check that the navigation is happening on the tab from which the
// request came.
- base::Optional<TabInfo> tab =
+ absl::optional<TabInfo> tab =
tab_finder_->FindNavigationTab(web_contents);
if (tab && tab->android_tab_id == request.metadata.android_tab_id)
SetNotificationStateToShown(request.request_id);
@@ -449,7 +449,7 @@
}
void AutoFetchPageLoadWatcher::OnAdded(const SavePageRequest& request) {
- base::Optional<RequestInfo> info = MakeRequestInfo(request);
+ absl::optional<RequestInfo> info = MakeRequestInfo(request);
if (!info)
return;
@@ -459,7 +459,7 @@
void AutoFetchPageLoadWatcher::OnCompleted(
const SavePageRequest& request,
RequestNotifier::BackgroundSavePageResult status) {
- base::Optional<RequestInfo> info = MakeRequestInfo(request);
+ absl::optional<RequestInfo> info = MakeRequestInfo(request);
if (!info)
return;
@@ -470,7 +470,7 @@
std::vector<std::unique_ptr<SavePageRequest>> requests) {
std::vector<RequestInfo> request_infos;
for (const auto& request : requests) {
- base::Optional<RequestInfo> info = MakeRequestInfo(*request);
+ absl::optional<RequestInfo> info = MakeRequestInfo(*request);
if (!info)
continue;
request_infos.push_back(info.value());
diff --git a/chrome/browser/offline_pages/android/auto_fetch_page_load_watcher.h b/chrome/browser/offline_pages/android/auto_fetch_page_load_watcher.h
index 9f71a5c..30c9058b 100644
--- a/chrome/browser/offline_pages/android/auto_fetch_page_load_watcher.h
+++ b/chrome/browser/offline_pages/android/auto_fetch_page_load_watcher.h
@@ -57,7 +57,7 @@
// Returns a mapping of Android tab ID to TabInfo.
virtual std::map<int, TabInfo> FindAndroidTabs(
std::vector<int> android_tab_ids);
- virtual base::Optional<TabInfo> FindNavigationTab(
+ virtual absl::optional<TabInfo> FindNavigationTab(
content::WebContents* web_contents);
};
@@ -69,7 +69,7 @@
auto_fetch::ClientIdMetadata metadata;
};
-base::Optional<RequestInfo> MakeRequestInfo(const SavePageRequest& request);
+absl::optional<RequestInfo> MakeRequestInfo(const SavePageRequest& request);
// |AutoFetchPageLoadWatcher|'s more unit-testable internal implementation.
// This class was designed to have few dependencies to make testing more
diff --git a/chrome/browser/offline_pages/android/auto_fetch_page_load_watcher_unittest.cc b/chrome/browser/offline_pages/android/auto_fetch_page_load_watcher_unittest.cc
index 6992203..78e3bb4 100644
--- a/chrome/browser/offline_pages/android/auto_fetch_page_load_watcher_unittest.cc
+++ b/chrome/browser/offline_pages/android/auto_fetch_page_load_watcher_unittest.cc
@@ -84,10 +84,10 @@
return result;
}
- base::Optional<TabInfo> FindNavigationTab(
+ absl::optional<TabInfo> FindNavigationTab(
content::WebContents* web_contents) override {
if (!tabs_.count(current_tab_id_))
- return base::nullopt;
+ return absl::nullopt;
return TabInfo{current_tab_id_, tabs_[current_tab_id_]};
}
diff --git a/chrome/browser/offline_pages/android/offline_page_auto_fetcher_service.cc b/chrome/browser/offline_pages/android/offline_page_auto_fetcher_service.cc
index dd9f65b..5182cc8 100644
--- a/chrome/browser/offline_pages/android/offline_page_auto_fetcher_service.cc
+++ b/chrome/browser/offline_pages/android/offline_page_auto_fetcher_service.cc
@@ -8,7 +8,6 @@
#include <utility>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
@@ -23,6 +22,7 @@
#include "components/offline_pages/core/offline_page_item_utils.h"
#include "components/offline_pages/core/offline_page_model.h"
#include "components/offline_pages/core/offline_store_utils.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace offline_pages {
@@ -169,7 +169,7 @@
const OfflinePageItem* page) {
if (!page)
return;
- base::Optional<auto_fetch::ClientIdMetadata> metadata =
+ absl::optional<auto_fetch::ClientIdMetadata> metadata =
auto_fetch::ExtractMetadata(page->client_id);
if (!metadata)
return;
diff --git a/chrome/browser/offline_pages/android/prefetch_test_bridge.cc b/chrome/browser/offline_pages/android/prefetch_test_bridge.cc
index 3262bb9..0fdc74e 100644
--- a/chrome/browser/offline_pages/android/prefetch_test_bridge.cc
+++ b/chrome/browser/offline_pages/android/prefetch_test_bridge.cc
@@ -58,7 +58,7 @@
base::android::JavaByteArrayToString(env, j_image_data, &image_data);
cache->SaveImage(url, image_data, false /* needs_transcoding */,
- base::nullopt /* expiration_interval */);
+ absl::nullopt /* expiration_interval */);
}
JNI_EXPORT void JNI_PrefetchTestBridge_AddCandidatePrefetchURL(
diff --git a/chrome/browser/offline_pages/offline_page_url_loader.cc b/chrome/browser/offline_pages/offline_page_url_loader.cc
index 352d61e..048ccbf 100644
--- a/chrome/browser/offline_pages/offline_page_url_loader.cc
+++ b/chrome/browser/offline_pages/offline_page_url_loader.cc
@@ -114,7 +114,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) {
+ const absl::optional<GURL>& new_url) {
NOTREACHED();
}
diff --git a/chrome/browser/offline_pages/offline_page_url_loader.h b/chrome/browser/offline_pages/offline_page_url_loader.h
index 8862746..d720262 100644
--- a/chrome/browser/offline_pages/offline_page_url_loader.h
+++ b/chrome/browser/offline_pages/offline_page_url_loader.h
@@ -63,7 +63,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) override;
+ const absl::optional<GURL>& new_url) override;
void SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) override;
void PauseReadingBodyFromNet() override;
diff --git a/chrome/browser/offline_pages/offline_page_utils_unittest.cc b/chrome/browser/offline_pages/offline_page_utils_unittest.cc
index 18c5787e..ba0e45c0 100644
--- a/chrome/browser/offline_pages/offline_page_utils_unittest.cc
+++ b/chrome/browser/offline_pages/offline_page_utils_unittest.cc
@@ -15,7 +15,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/location.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
@@ -45,6 +44,7 @@
#include "content/public/test/browser_task_environment.h"
#include "net/base/filename_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#if defined(OS_ANDROID)
@@ -123,7 +123,7 @@
return result;
}
- base::Optional<int64_t> GetCachedOfflinePageSizeBetween(
+ absl::optional<int64_t> GetCachedOfflinePageSizeBetween(
const base::Time& begin_time,
const base::Time& end_time) {
int64_t result;
@@ -136,7 +136,7 @@
if (!OfflinePageUtils::GetCachedOfflinePageSizeBetween(
profile(), base::BindLambdaForTesting(on_done), begin_time,
end_time)) {
- return base::nullopt;
+ return absl::nullopt;
}
run_loop.Run();
return result;
diff --git a/chrome/browser/optimization_guide/android/optimization_guide_bridge.cc b/chrome/browser/optimization_guide/android/optimization_guide_bridge.cc
index d10973f1..61d9ca4 100644
--- a/chrome/browser/optimization_guide/android/optimization_guide_bridge.cc
+++ b/chrome/browser/optimization_guide/android/optimization_guide_bridge.cc
@@ -122,7 +122,7 @@
optimization_guide_keyed_service_->GetHintsManager()
->CanApplyOptimizationAsync(
*url::GURLAndroid::ToNativeGURL(env, java_gurl),
- /*navigation_id=*/base::nullopt,
+ /*navigation_id=*/absl::nullopt,
static_cast<optimization_guide::proto::OptimizationType>(
optimization_type),
base::BindOnce(&OnOptimizationGuideDecision,
diff --git a/chrome/browser/optimization_guide/android/optimization_guide_bridge_unittest.cc b/chrome/browser/optimization_guide/android/optimization_guide_bridge_unittest.cc
index beade2b..14680a7f 100644
--- a/chrome/browser/optimization_guide/android/optimization_guide_bridge_unittest.cc
+++ b/chrome/browser/optimization_guide/android/optimization_guide_bridge_unittest.cc
@@ -43,7 +43,7 @@
~MockOptimizationGuideHintsManager() override = default;
MOCK_METHOD4(CanApplyOptimizationAsync,
void(const GURL&,
- const base::Optional<int64_t>&,
+ const absl::optional<int64_t>&,
optimization_guide::proto::OptimizationType,
optimization_guide::OptimizationGuideDecisionCallback));
};
@@ -151,7 +151,7 @@
metadata.SetAnyMetadataForTesting(hints_metadata);
EXPECT_CALL(
*optimization_guide_hints_manager_,
- CanApplyOptimizationAsync(GURL("https://example.com/"), Eq(base::nullopt),
+ CanApplyOptimizationAsync(GURL("https://example.com/"), Eq(absl::nullopt),
optimization_guide::proto::PERFORMANCE_HINTS,
base::test::IsNotNullCallback()))
.WillOnce(base::test::RunOnceCallback<3>(
diff --git a/chrome/browser/optimization_guide/blink/blink_optimization_guide_browsertest.cc b/chrome/browser/optimization_guide/blink/blink_optimization_guide_browsertest.cc
index 9573d00..f8313d9 100644
--- a/chrome/browser/optimization_guide/blink/blink_optimization_guide_browsertest.cc
+++ b/chrome/browser/optimization_guide/blink/blink_optimization_guide_browsertest.cc
@@ -295,7 +295,7 @@
// Set up a fake optimization hints without metadata for simple.html.
OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile())
->AddHintForTesting(GetURLWithMockHost("/simple.html"),
- GetOptimizationType(), base::nullopt);
+ GetOptimizationType(), absl::nullopt);
// Navigation to the URL shouldn't see the hints.
ui_test_utils::NavigateToURL(browser(), GetURLWithMockHost("/simple.html"));
diff --git a/chrome/browser/optimization_guide/blink/blink_optimization_guide_inquirer.cc b/chrome/browser/optimization_guide/blink/blink_optimization_guide_inquirer.cc
index 233b164a..1751231 100644
--- a/chrome/browser/optimization_guide/blink/blink_optimization_guide_inquirer.cc
+++ b/chrome/browser/optimization_guide/blink/blink_optimization_guide_inquirer.cc
@@ -91,7 +91,7 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// Give up providing the hints when the metadata is not available.
- base::Optional<proto::DelayAsyncScriptExecutionMetadata> metadata =
+ absl::optional<proto::DelayAsyncScriptExecutionMetadata> metadata =
optimization_metadata
.ParsedMetadata<proto::DelayAsyncScriptExecutionMetadata>();
if (!metadata || !metadata->delay_type())
@@ -129,7 +129,7 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// Give up providing the hints when the metadata is not available.
- base::Optional<proto::DelayCompetingLowPriorityRequestsMetadata> metadata =
+ absl::optional<proto::DelayCompetingLowPriorityRequestsMetadata> metadata =
optimization_metadata
.ParsedMetadata<proto::DelayCompetingLowPriorityRequestsMetadata>();
if (!metadata || !metadata->delay_type() || !metadata->priority_threshold())
diff --git a/chrome/browser/optimization_guide/hints_fetcher_browsertest.cc b/chrome/browser/optimization_guide/hints_fetcher_browsertest.cc
index d73f968..c89b840 100644
--- a/chrome/browser/optimization_guide/hints_fetcher_browsertest.cc
+++ b/chrome/browser/optimization_guide/hints_fetcher_browsertest.cc
@@ -481,7 +481,7 @@
// expected to arrive. This set is verified to match with the set of hosts and
// URLs present in the hints request. If null, then the verification is not
// done.
- base::Optional<base::flat_set<std::string>>
+ absl::optional<base::flat_set<std::string>>
expect_hints_request_for_hosts_and_urls_;
std::unique_ptr<ukm::TestAutoSetUkmRecorder> ukm_recorder_;
diff --git a/chrome/browser/optimization_guide/optimization_guide_hints_manager.cc b/chrome/browser/optimization_guide/optimization_guide_hints_manager.cc
index af8e385..2dfccd893 100644
--- a/chrome/browser/optimization_guide/optimization_guide_hints_manager.cc
+++ b/chrome/browser/optimization_guide/optimization_guide_hints_manager.cc
@@ -122,9 +122,9 @@
optimization_guide::proto::Optimization>& optimizations,
optimization_guide::proto::OptimizationType optimization_type,
optimization_guide::OptimizationMetadata* optimization_metadata,
- base::Optional<uint64_t>* tuning_version) {
+ absl::optional<uint64_t>* tuning_version) {
DCHECK(tuning_version);
- *tuning_version = base::nullopt;
+ *tuning_version = absl::nullopt;
for (const auto& optimization : optimizations) {
if (optimization_type != optimization.optimization_type())
@@ -175,9 +175,9 @@
// Logs an OptimizationAutotuning event for the navigation with |navigation_id|,
// if |navigation_id| and |tuning_version| are non-null.
void MaybeLogOptimizationAutotuningUKMForNavigation(
- base::Optional<int64_t> navigation_id,
+ absl::optional<int64_t> navigation_id,
optimization_guide::proto::OptimizationType optimization_type,
- base::Optional<int64_t> tuning_version) {
+ absl::optional<int64_t> tuning_version) {
if (!navigation_id || !tuning_version) {
// Only log if we can correlate the tuning event with a navigation.
return;
@@ -697,7 +697,7 @@
void OptimizationGuideHintsManager::OnHintsForActiveTabsFetched(
const base::flat_set<std::string>& hosts_fetched,
const base::flat_set<GURL>& urls_fetched,
- base::Optional<std::unique_ptr<optimization_guide::proto::GetHintsResponse>>
+ absl::optional<std::unique_ptr<optimization_guide::proto::GetHintsResponse>>
get_hints_response) {
if (!get_hints_response)
return;
@@ -714,10 +714,10 @@
void OptimizationGuideHintsManager::OnPageNavigationHintsFetched(
base::WeakPtr<OptimizationGuideNavigationData> navigation_data_weak_ptr,
- const base::Optional<GURL>& navigation_url,
+ const absl::optional<GURL>& navigation_url,
const base::flat_set<GURL>& page_navigation_urls_requested,
const base::flat_set<std::string>& page_navigation_hosts_requested,
- base::Optional<std::unique_ptr<optimization_guide::proto::GetHintsResponse>>
+ absl::optional<std::unique_ptr<optimization_guide::proto::GetHintsResponse>>
get_hints_response) {
if (!get_hints_response.has_value() || !get_hints_response.value()) {
if (navigation_url) {
@@ -755,7 +755,7 @@
void OptimizationGuideHintsManager::OnFetchedPageNavigationHintsStored(
base::WeakPtr<OptimizationGuideNavigationData> navigation_data_weak_ptr,
- const base::Optional<GURL>& navigation_url,
+ const absl::optional<GURL>& navigation_url,
const base::flat_set<std::string>& page_navigation_hosts_requested) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -832,7 +832,7 @@
}
bool OptimizationGuideHintsManager::IsAllowedToFetchForNavigationPrediction(
- const base::Optional<NavigationPredictorKeyedService::Prediction>
+ const absl::optional<NavigationPredictorKeyedService::Prediction>
prediction) const {
if (!prediction)
return false;
@@ -843,7 +843,7 @@
// We only support predictions from page anchors.
return false;
}
- const base::Optional<GURL> source_document_url =
+ const absl::optional<GURL> source_document_url =
prediction->source_document_url();
if (!source_document_url || source_document_url->is_empty())
return false;
@@ -853,7 +853,7 @@
}
void OptimizationGuideHintsManager::OnPredictionUpdated(
- const base::Optional<NavigationPredictorKeyedService::Prediction>
+ const absl::optional<NavigationPredictorKeyedService::Prediction>
prediction) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -912,7 +912,7 @@
g_browser_process->GetApplicationLocale(),
base::BindOnce(
&OptimizationGuideHintsManager::OnPageNavigationHintsFetched,
- ui_weak_ptr_factory_.GetWeakPtr(), nullptr, base::nullopt,
+ ui_weak_ptr_factory_.GetWeakPtr(), nullptr, absl::nullopt,
target_urls, target_hosts.set()));
}
@@ -948,7 +948,7 @@
}
registered_optimization_types_.insert(optimization_type);
- base::Optional<double> value = previously_registered_opt_types->FindBoolKey(
+ absl::optional<double> value = previously_registered_opt_types->FindBoolKey(
optimization_guide::proto::OptimizationType_Name(optimization_type));
if (!value) {
if (!profile_->IsOffTheRecord() &&
@@ -1007,7 +1007,7 @@
void OptimizationGuideHintsManager::CanApplyOptimizationAsync(
const GURL& navigation_url,
- const base::Optional<int64_t>& navigation_id,
+ const absl::optional<int64_t>& navigation_id,
optimization_guide::proto::OptimizationType optimization_type,
optimization_guide::OptimizationGuideDecisionCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -1039,7 +1039,7 @@
optimization_guide::OptimizationTypeDecision
OptimizationGuideHintsManager::CanApplyOptimization(
const GURL& navigation_url,
- const base::Optional<int64_t>& navigation_id,
+ const absl::optional<int64_t>& navigation_id,
optimization_guide::proto::OptimizationType optimization_type,
optimization_guide::OptimizationMetadata* optimization_metadata) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -1096,7 +1096,7 @@
kHadOptimizationFilterButNotLoadedInTime;
}
- base::Optional<uint64_t> tuning_version;
+ absl::optional<uint64_t> tuning_version;
// First, check if the optimization type is whitelisted by a URL-keyed hint.
const optimization_guide::proto::Hint* url_keyed_hint =
@@ -1200,7 +1200,7 @@
opt_type_and_callbacks.first;
for (auto& navigation_id_and_callback : opt_type_and_callbacks.second) {
- base::Optional<int64_t> navigation_id = navigation_id_and_callback.first;
+ absl::optional<int64_t> navigation_id = navigation_id_and_callback.first;
optimization_guide::OptimizationMetadata metadata;
optimization_guide::OptimizationTypeDecision type_decision =
CanApplyOptimization(navigation_url, navigation_id, opt_type,
@@ -1252,7 +1252,7 @@
if (!url.is_valid() || !url.SchemeIsHTTPOrHTTPS())
return false;
- base::Optional<net::EffectiveConnectionType> ect_max_threshold =
+ absl::optional<net::EffectiveConnectionType> ect_max_threshold =
optimization_guide::features::
GetMaxEffectiveConnectionTypeForNavigationHintsFetch();
// If the threshold is unavailable, return early since there is no safe way to
@@ -1445,7 +1445,7 @@
void OptimizationGuideHintsManager::AddHintForTesting(
const GURL& url,
optimization_guide::proto::OptimizationType optimization_type,
- const base::Optional<optimization_guide::OptimizationMetadata>& metadata) {
+ const absl::optional<optimization_guide::OptimizationMetadata>& metadata) {
std::unique_ptr<optimization_guide::proto::Hint> hint =
std::make_unique<optimization_guide::proto::Hint>();
hint->set_key(url.spec());
diff --git a/chrome/browser/optimization_guide/optimization_guide_hints_manager.h b/chrome/browser/optimization_guide/optimization_guide_hints_manager.h
index ccd67b80..73b5dbd 100644
--- a/chrome/browser/optimization_guide/optimization_guide_hints_manager.h
+++ b/chrome/browser/optimization_guide/optimization_guide_hints_manager.h
@@ -15,7 +15,6 @@
#include "base/containers/mru_cache.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/time/clock.h"
#include "base/timer/timer.h"
@@ -28,6 +27,7 @@
#include "components/optimization_guide/proto/models.pb.h"
#include "net/nqe/effective_connection_type.h"
#include "services/network/public/cpp/network_quality_tracker.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class NavigationHandle;
@@ -110,7 +110,7 @@
// |optimization_metadata| will be populated, if applicable.
optimization_guide::OptimizationTypeDecision CanApplyOptimization(
const GURL& navigation_url,
- const base::Optional<int64_t>& navigation_id,
+ const absl::optional<int64_t>& navigation_id,
optimization_guide::proto::OptimizationType optimization_type,
optimization_guide::OptimizationMetadata* optimization_metadata);
@@ -119,7 +119,7 @@
// |this| to make the decision. Virtual for testing.
virtual void CanApplyOptimizationAsync(
const GURL& navigation_url,
- const base::Optional<int64_t>& navigation_id,
+ const absl::optional<int64_t>& navigation_id,
optimization_guide::proto::OptimizationType optimization_type,
optimization_guide::OptimizationGuideDecisionCallback callback);
@@ -169,7 +169,7 @@
void AddHintForTesting(
const GURL& url,
optimization_guide::proto::OptimizationType optimization_type,
- const base::Optional<optimization_guide::OptimizationMetadata>& metadata);
+ const absl::optional<optimization_guide::OptimizationMetadata>& metadata);
private:
FRIEND_TEST_ALL_PREFIXES(OptimizationGuideHintsManagerTest, IsGoogleURL);
@@ -241,7 +241,7 @@
void OnHintsForActiveTabsFetched(
const base::flat_set<std::string>& hosts_fetched,
const base::flat_set<GURL>& urls_fetched,
- base::Optional<
+ absl::optional<
std::unique_ptr<optimization_guide::proto::GetHintsResponse>>
get_hints_response);
@@ -254,10 +254,10 @@
// that were requested by |this| to be fetched.
void OnPageNavigationHintsFetched(
base::WeakPtr<OptimizationGuideNavigationData> navigation_data_weak_ptr,
- const base::Optional<GURL>& navigation_url,
+ const absl::optional<GURL>& navigation_url,
const base::flat_set<GURL>& page_navigation_urls_requested,
const base::flat_set<std::string>& page_navigation_hosts_requested,
- base::Optional<
+ absl::optional<
std::unique_ptr<optimization_guide::proto::GetHintsResponse>>
get_hints_response);
@@ -272,7 +272,7 @@
// whose hints should be loaded into memory when invoked.
void OnFetchedPageNavigationHintsStored(
base::WeakPtr<OptimizationGuideNavigationData> navigation_data_weak_ptr,
- const base::Optional<GURL>& navigation_url,
+ const absl::optional<GURL>& navigation_url,
const base::flat_set<std::string>& page_navigation_hosts_requested);
// Returns true if there is a fetch currently in-flight for |navigation_url|.
@@ -314,12 +314,12 @@
// Returns true if we can make a request for hints for |prediction|.
bool IsAllowedToFetchForNavigationPrediction(
- const base::Optional<NavigationPredictorKeyedService::Prediction>
+ const absl::optional<NavigationPredictorKeyedService::Prediction>
prediction) const;
// NavigationPredictorKeyedService::Observer:
void OnPredictionUpdated(
- const base::Optional<NavigationPredictorKeyedService::Prediction>
+ const absl::optional<NavigationPredictorKeyedService::Prediction>
prediction) override;
// Returns whether there is an optimization type to fetch for. Will return
@@ -349,7 +349,7 @@
// The information of the latest component delivered by
// |optimization_guide_service_|.
- base::Optional<optimization_guide::HintsComponentInfo> hints_component_info_;
+ absl::optional<optimization_guide::HintsComponentInfo> hints_component_info_;
// The set of optimization types that have been registered with the hints
// manager.
@@ -382,7 +382,7 @@
base::flat_map<
optimization_guide::proto::OptimizationType,
std::vector<std::pair<
- base::Optional<int64_t>,
+ absl::optional<int64_t>,
optimization_guide::OptimizationGuideDecisionCallback>>>>
registered_callbacks_;
diff --git a/chrome/browser/optimization_guide/optimization_guide_hints_manager_unittest.cc b/chrome/browser/optimization_guide/optimization_guide_hints_manager_unittest.cc
index 8e79f6b..c841b605 100644
--- a/chrome/browser/optimization_guide/optimization_guide_hints_manager_unittest.cc
+++ b/chrome/browser/optimization_guide/optimization_guide_hints_manager_unittest.cc
@@ -207,7 +207,7 @@
locale_requested_ = locale;
switch (fetch_state) {
case HintsFetcherEndState::kFetchFailed:
- std::move(hints_fetched_callback).Run(base::nullopt);
+ std::move(hints_fetched_callback).Run(absl::nullopt);
return false;
case HintsFetcherEndState::kFetchSuccessWithHostHints:
base::ThreadTaskRunnerHandle::Get()->PostTask(
@@ -1080,7 +1080,7 @@
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- GURL("urlwithnohost"), /*navigation_id=*/base::nullopt,
+ GURL("urlwithnohost"), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::LITE_PAGE_REDIRECT,
/*optimization_metadata=*/nullptr);
@@ -1109,7 +1109,7 @@
{optimization_guide::proto::LITE_PAGE_REDIRECT});
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- GURL("https://whatever.com/123"), /*navigation_id=*/base::nullopt,
+ GURL("https://whatever.com/123"), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::LITE_PAGE_REDIRECT,
/*optimization_metadata=*/nullptr);
@@ -1139,7 +1139,7 @@
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- GURL("https://m.host.com/123"), /*navigation_id=*/base::nullopt,
+ GURL("https://m.host.com/123"), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::LITE_PAGE_REDIRECT,
/*optimization_metadata=*/nullptr);
@@ -1165,7 +1165,7 @@
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- GURL("https://m.host.com/123"), /*navigation_id=*/base::nullopt,
+ GURL("https://m.host.com/123"), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::LITE_PAGE_REDIRECT,
/*optimization_metadata=*/nullptr);
@@ -1191,7 +1191,7 @@
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- GURL("https://whatever.com/123"), /*navigation_id=*/base::nullopt,
+ GURL("https://whatever.com/123"), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::LITE_PAGE_REDIRECT,
/*optimization_metadata=*/nullptr);
@@ -1217,7 +1217,7 @@
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- GURL("https://whatever.com/123"), /*navigation_id=*/base::nullopt,
+ GURL("https://whatever.com/123"), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::LITE_PAGE_REDIRECT,
/*optimization_metadata=*/nullptr);
@@ -1252,7 +1252,7 @@
optimization_guide::OptimizationMetadata optimization_metadata;
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::RESOURCE_LOADING, &optimization_metadata);
EXPECT_EQ(optimization_guide::OptimizationTypeDecision::kAllowedByHint,
optimization_type_decision);
@@ -1482,7 +1482,7 @@
optimization_guide::OptimizationMetadata optimization_metadata;
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::RESOURCE_LOADING, &optimization_metadata);
EXPECT_EQ(optimization_guide::OptimizationTypeDecision::kAllowedByHint,
optimization_type_decision);
@@ -1548,7 +1548,7 @@
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::DEFER_ALL_SCRIPT,
/*optimization_metadata=*/nullptr);
@@ -1589,7 +1589,7 @@
optimization_guide::OptimizationMetadata optimization_metadata;
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::PERFORMANCE_HINTS, &optimization_metadata);
// Make sure performance hints metadata is populated.
EXPECT_TRUE(optimization_metadata.performance_hints_metadata().has_value());
@@ -1626,7 +1626,7 @@
optimization_guide::OptimizationMetadata optimization_metadata;
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::COMPRESS_PUBLIC_IMAGES,
&optimization_metadata);
// Make sure public images metadata is populated.
@@ -1665,7 +1665,7 @@
optimization_guide::OptimizationMetadata optimization_metadata;
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::LOADING_PREDICTOR, &optimization_metadata);
// Make sure loading predictor metadata is populated.
EXPECT_TRUE(optimization_metadata.loading_predictor_metadata().has_value());
@@ -1768,7 +1768,7 @@
{optimization_guide::proto::NOSCRIPT});
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(navigation_handle->GetURL(),
- /*navigation_id=*/base::nullopt,
+ /*navigation_id=*/absl::nullopt,
optimization_guide::proto::NOSCRIPT,
/*optimization_metadata=*/nullptr);
@@ -1797,7 +1797,7 @@
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::NOSCRIPT, &optimization_metadata);
EXPECT_FALSE(optimization_metadata.performance_hints_metadata().has_value());
@@ -1814,7 +1814,7 @@
optimization_guide::OptimizationMetadata optimization_metadata;
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- url_with_hints(), /*navigation_id=*/base::nullopt,
+ url_with_hints(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::NOSCRIPT, &optimization_metadata);
EXPECT_EQ(
@@ -1858,7 +1858,7 @@
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::LITE_PAGE_REDIRECT,
/*optimization_metadata=*/nullptr);
@@ -1904,7 +1904,7 @@
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::LITE_PAGE_REDIRECT,
/*optimization_metadata=*/nullptr);
@@ -2713,7 +2713,7 @@
base::DoNothing());
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::DEFER_ALL_SCRIPT,
/*optimization_metadata=*/nullptr);
@@ -2746,7 +2746,7 @@
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::DEFER_ALL_SCRIPT,
/*optimization_metadata=*/nullptr);
@@ -2777,7 +2777,7 @@
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::DEFER_ALL_SCRIPT,
/*optimization_metadata=*/nullptr);
@@ -2811,7 +2811,7 @@
optimization_guide::OptimizationMetadata optimization_metadata;
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::COMPRESS_PUBLIC_IMAGES,
&optimization_metadata);
@@ -2849,7 +2849,7 @@
optimization_guide::OptimizationMetadata optimization_metadata;
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::NOSCRIPT, &optimization_metadata);
EXPECT_EQ(optimization_guide::OptimizationTypeDecision::kAllowedByHint,
@@ -2883,7 +2883,7 @@
optimization_guide::OptimizationMetadata optimization_metadata;
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::RESOURCE_LOADING, &optimization_metadata);
EXPECT_EQ(optimization_guide::OptimizationTypeDecision::kNotAllowedByHint,
@@ -2918,7 +2918,7 @@
optimization_guide::OptimizationMetadata optimization_metadata;
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::COMPRESS_PUBLIC_IMAGES,
&optimization_metadata);
@@ -2952,7 +2952,7 @@
optimization_guide::OptimizationMetadata optimization_metadata;
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::COMPRESS_PUBLIC_IMAGES,
&optimization_metadata);
@@ -3650,7 +3650,7 @@
optimization_guide::OptimizationMetadata optimization_metadata;
optimization_guide::OptimizationTypeDecision optimization_type_decision =
hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::DEFER_ALL_SCRIPT, &optimization_metadata);
EXPECT_EQ(optimization_guide::OptimizationTypeDecision::kNotAllowedByHint,
@@ -3678,7 +3678,7 @@
run_loop.Run();
optimization_type_decision = hints_manager()->CanApplyOptimization(
- navigation_handle->GetURL(), /*navigation_id=*/base::nullopt,
+ navigation_handle->GetURL(), /*navigation_id=*/absl::nullopt,
optimization_guide::proto::DEFER_ALL_SCRIPT, &optimization_metadata);
// The fetched hints should not be available after registering a new
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc b/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc
index a3fc6bc..3aef9af 100644
--- a/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc
+++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc
@@ -9,7 +9,6 @@
#include "base/files/file_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
@@ -36,6 +35,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/storage_partition.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#if defined(OS_ANDROID)
@@ -257,12 +257,12 @@
const std::vector<optimization_guide::proto::OptimizationTarget>&
optimization_targets) {
std::vector<std::pair<optimization_guide::proto::OptimizationTarget,
- base::Optional<optimization_guide::proto::Any>>>
+ absl::optional<optimization_guide::proto::Any>>>
optimization_targets_and_metadata;
for (optimization_guide::proto::OptimizationTarget optimization_target :
optimization_targets) {
optimization_targets_and_metadata.emplace_back(
- std::make_pair(optimization_target, base::nullopt));
+ std::make_pair(optimization_target, absl::nullopt));
}
prediction_manager_->RegisterOptimizationTargets(
optimization_targets_and_metadata);
@@ -284,7 +284,7 @@
void OptimizationGuideKeyedService::AddObserverForOptimizationTargetModel(
optimization_guide::proto::OptimizationTarget optimization_target,
- const base::Optional<optimization_guide::proto::Any>& model_metadata,
+ const absl::optional<optimization_guide::proto::Any>& model_metadata,
optimization_guide::OptimizationTargetModelObserver* observer) {
prediction_manager_->AddObserverForOptimizationTargetModel(
optimization_target, model_metadata, observer);
@@ -311,7 +311,7 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
optimization_guide::OptimizationTypeDecision optimization_type_decision =
- hints_manager_->CanApplyOptimization(url, /*navigation_id=*/base::nullopt,
+ hints_manager_->CanApplyOptimization(url, /*navigation_id=*/absl::nullopt,
optimization_type,
optimization_metadata);
base::UmaHistogramEnumeration(
@@ -339,7 +339,7 @@
void OptimizationGuideKeyedService::AddHintForTesting(
const GURL& url,
optimization_guide::proto::OptimizationType optimization_type,
- const base::Optional<optimization_guide::OptimizationMetadata>& metadata) {
+ const absl::optional<optimization_guide::OptimizationMetadata>& metadata) {
hints_manager_->AddHintForTesting(url, optimization_type, metadata);
}
@@ -354,7 +354,7 @@
void OptimizationGuideKeyedService::OverrideTargetModelFileForTesting(
optimization_guide::proto::OptimizationTarget optimization_target,
- const base::Optional<optimization_guide::proto::Any>& model_metadata,
+ const absl::optional<optimization_guide::proto::Any>& model_metadata,
const base::FilePath& file_path) {
prediction_manager_->OverrideTargetModelFileForTesting(
optimization_target, model_metadata, file_path);
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service.h b/chrome/browser/optimization_guide/optimization_guide_keyed_service.h
index 94507c3..f3bed1a 100644
--- a/chrome/browser/optimization_guide/optimization_guide_keyed_service.h
+++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service.h
@@ -65,7 +65,7 @@
override;
void AddObserverForOptimizationTargetModel(
optimization_guide::proto::OptimizationTarget optimization_target,
- const base::Optional<optimization_guide::proto::Any>& model_metadata,
+ const absl::optional<optimization_guide::proto::Any>& model_metadata,
optimization_guide::OptimizationTargetModelObserver* observer) override;
void RemoveObserverForOptimizationTargetModel(
optimization_guide::proto::OptimizationTarget optimization_target,
@@ -89,13 +89,13 @@
void AddHintForTesting(
const GURL& url,
optimization_guide::proto::OptimizationType optimization_type,
- const base::Optional<optimization_guide::OptimizationMetadata>& metadata);
+ const absl::optional<optimization_guide::OptimizationMetadata>& metadata);
// Override the model file sent to observers of |optimization_target|. For
// testing purposes only.
void OverrideTargetModelFileForTesting(
optimization_guide::proto::OptimizationTarget optimization_target,
- const base::Optional<optimization_guide::proto::Any>& model_metadata,
+ const absl::optional<optimization_guide::proto::Any>& model_metadata,
const base::FilePath& file_path);
private:
diff --git a/chrome/browser/optimization_guide/optimization_guide_navigation_data.cc b/chrome/browser/optimization_guide/optimization_guide_navigation_data.cc
index 46ba3b0..c61a6a7 100644
--- a/chrome/browser/optimization_guide/optimization_guide_navigation_data.cc
+++ b/chrome/browser/optimization_guide/optimization_guide_navigation_data.cc
@@ -87,18 +87,18 @@
builder.Record(ukm::UkmRecorder::Get());
}
-base::Optional<base::TimeDelta>
+absl::optional<base::TimeDelta>
OptimizationGuideNavigationData::hints_fetch_latency() const {
if (!hints_fetch_start_ || !hints_fetch_end_) {
// Either a fetch was not initiated for this navigation or the fetch did not
// completely successfully.
- return base::nullopt;
+ return absl::nullopt;
}
if (*hints_fetch_end_ < *hints_fetch_start_) {
// This can happen if a hints fetch was started for a redirect, but the
// fetch had not successfully completed yet.
- return base::nullopt;
+ return absl::nullopt;
}
return *hints_fetch_end_ - *hints_fetch_start_;
diff --git a/chrome/browser/optimization_guide/optimization_guide_navigation_data.h b/chrome/browser/optimization_guide/optimization_guide_navigation_data.h
index b464d1b..b84e250 100644
--- a/chrome/browser/optimization_guide/optimization_guide_navigation_data.h
+++ b/chrome/browser/optimization_guide/optimization_guide_navigation_data.h
@@ -13,12 +13,12 @@
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "components/optimization_guide/content/browser/optimization_guide_decider.h"
#include "components/optimization_guide/core/optimization_guide_enums.h"
#include "components/optimization_guide/proto/hints.pb.h"
#include "components/optimization_guide/proto/models.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A representation of optimization guide information related to a navigation.
// Metrics will be recorded upon this object's destruction.
@@ -71,7 +71,7 @@
// The duration between the fetch for a hint for the navigation going out to
// when it was received by the client if a fetch was initiated for the
// navigation.
- base::Optional<base::TimeDelta> hints_fetch_latency() const;
+ absl::optional<base::TimeDelta> hints_fetch_latency() const;
void set_hints_fetch_start(base::TimeTicks hints_fetch_start) {
hints_fetch_start_ = hints_fetch_start;
}
@@ -81,7 +81,7 @@
// The status for whether a hint for the page load was attempted to be fetched
// from the remote Optimization Guide Service.
- base::Optional<optimization_guide::RaceNavigationFetchAttemptStatus>
+ absl::optional<optimization_guide::RaceNavigationFetchAttemptStatus>
hints_fetch_attempt_status() const {
return hints_fetch_attempt_status_;
}
@@ -118,20 +118,20 @@
optimization_type_decisions_;
// The page hint for the navigation.
- base::Optional<std::unique_ptr<optimization_guide::proto::PageHint>>
+ absl::optional<std::unique_ptr<optimization_guide::proto::PageHint>>
page_hint_;
// The time that the hints fetch for this navigation started. Is only present
// if a fetch was initiated for this navigation.
- base::Optional<base::TimeTicks> hints_fetch_start_;
+ absl::optional<base::TimeTicks> hints_fetch_start_;
// The time that the hints fetch for the navigation ended. Is only present if
// a fetch was initiated and successfully completed for this navigation.
- base::Optional<base::TimeTicks> hints_fetch_end_;
+ absl::optional<base::TimeTicks> hints_fetch_end_;
// The status for whether a hint for the page load was attempted to be fetched
// from the remote Optimization Guide Service.
- base::Optional<optimization_guide::RaceNavigationFetchAttemptStatus>
+ absl::optional<optimization_guide::RaceNavigationFetchAttemptStatus>
hints_fetch_attempt_status_;
// Used to get |weak_ptr_| to self on the UI thread.
diff --git a/chrome/browser/optimization_guide/page_content_annotations_service_browsertest.cc b/chrome/browser/optimization_guide/page_content_annotations_service_browsertest.cc
index 78099223..aab4f73 100644
--- a/chrome/browser/optimization_guide/page_content_annotations_service_browsertest.cc
+++ b/chrome/browser/optimization_guide/page_content_annotations_service_browsertest.cc
@@ -69,7 +69,7 @@
GetContentAnnotationsTask(
const GURL& url,
base::OnceCallback<void(
- const base::Optional<history::VisitContentAnnotations>&)> callback)
+ const absl::optional<history::VisitContentAnnotations>&)> callback)
: url_(url), callback_(std::move(callback)) {}
~GetContentAnnotationsTask() override = default;
@@ -101,10 +101,10 @@
const GURL url_;
// The callback to invoke when the database call has completed.
base::OnceCallback<void(
- const base::Optional<history::VisitContentAnnotations>&)>
+ const absl::optional<history::VisitContentAnnotations>&)>
callback_;
// The content annotations that were stored for |url_|.
- base::Optional<history::VisitContentAnnotations> stored_content_annotations_;
+ absl::optional<history::VisitContentAnnotations> stored_content_annotations_;
};
class PageContentAnnotationsServiceDisabledBrowserTest
@@ -205,16 +205,16 @@
}
#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
- base::Optional<history::VisitContentAnnotations> GetContentAnnotationsForURL(
+ absl::optional<history::VisitContentAnnotations> GetContentAnnotationsForURL(
const GURL& url) {
history::HistoryService* history_service =
HistoryServiceFactory::GetForProfile(
browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS);
if (!history_service)
- return base::nullopt;
+ return absl::nullopt;
std::unique_ptr<base::RunLoop> run_loop = std::make_unique<base::RunLoop>();
- base::Optional<history::VisitContentAnnotations> got_content_annotations;
+ absl::optional<history::VisitContentAnnotations> got_content_annotations;
base::CancelableTaskTracker task_tracker;
history_service->ScheduleDBTask(
@@ -222,9 +222,9 @@
std::make_unique<GetContentAnnotationsTask>(
url, base::BindOnce(
[](base::RunLoop* run_loop,
- base::Optional<history::VisitContentAnnotations>*
+ absl::optional<history::VisitContentAnnotations>*
out_content_annotations,
- const base::Optional<history::VisitContentAnnotations>&
+ const absl::optional<history::VisitContentAnnotations>&
content_annotations) {
*out_content_annotations = content_annotations;
run_loop->Quit();
@@ -272,7 +272,7 @@
PageContentAnnotationsServiceFactory::GetForProfile(browser()->profile());
#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
- base::Optional<int64_t> model_version = service->GetPageTopicsModelVersion();
+ absl::optional<int64_t> model_version = service->GetPageTopicsModelVersion();
EXPECT_TRUE(model_version.has_value());
EXPECT_EQ(123, *model_version);
#else
@@ -291,7 +291,7 @@
"ContentAnnotationsStorageStatus",
PageContentAnnotationsStorageStatus::kSuccess, 1);
- base::Optional<history::VisitContentAnnotations> got_content_annotations =
+ absl::optional<history::VisitContentAnnotations> got_content_annotations =
GetContentAnnotationsForURL(url);
ASSERT_TRUE(got_content_annotations.has_value());
EXPECT_NE(-1.0,
@@ -428,7 +428,7 @@
PageContentAnnotationsService* service =
PageContentAnnotationsServiceFactory::GetForProfile(browser()->profile());
- base::Optional<int64_t> model_version = service->GetPageTopicsModelVersion();
+ absl::optional<int64_t> model_version = service->GetPageTopicsModelVersion();
EXPECT_TRUE(model_version.has_value());
EXPECT_EQ(123, *model_version);
@@ -443,7 +443,7 @@
"ContentAnnotationsStorageStatus",
PageContentAnnotationsStorageStatus::kSuccess, 1);
- base::Optional<history::VisitContentAnnotations> got_content_annotations =
+ absl::optional<history::VisitContentAnnotations> got_content_annotations =
GetContentAnnotationsForURL(url);
ASSERT_TRUE(got_content_annotations.has_value());
EXPECT_NE(-1.0,
diff --git a/chrome/browser/optimization_guide/page_text_observer_browsertest.cc b/chrome/browser/optimization_guide/page_text_observer_browsertest.cc
index 3a96d77..71452c1 100644
--- a/chrome/browser/optimization_guide/page_text_observer_browsertest.cc
+++ b/chrome/browser/optimization_guide/page_text_observer_browsertest.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/callback.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -32,6 +31,7 @@
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace optimization_guide {
@@ -76,7 +76,7 @@
bool was_called() const { return was_called_; }
- base::Optional<PageTextDumpResult> result() {
+ absl::optional<PageTextDumpResult> result() {
return base::OptionalFromPtr(result_.get());
}
diff --git a/chrome/browser/optimization_guide/prediction/prediction_manager.cc b/chrome/browser/optimization_guide/prediction/prediction_manager.cc
index 712cea0c..00b8786e 100644
--- a/chrome/browser/optimization_guide/prediction/prediction_manager.cc
+++ b/chrome/browser/optimization_guide/prediction/prediction_manager.cc
@@ -161,8 +161,8 @@
std::unique_ptr<optimization_guide::proto::PredictionModel>
BuildPredictionModelFromCommandLineForOptimizationTarget(
optimization_guide::proto::OptimizationTarget optimization_target) {
- base::Optional<
- std::pair<std::string, base::Optional<optimization_guide::proto::Any>>>
+ absl::optional<
+ std::pair<std::string, absl::optional<optimization_guide::proto::Any>>>
model_file_path_and_metadata =
optimization_guide::switches::GetModelOverrideForOptimizationTarget(
optimization_target);
@@ -244,7 +244,7 @@
void PredictionManager::RegisterOptimizationTargets(
const std::vector<
- std::pair<proto::OptimizationTarget, base::Optional<proto::Any>>>&
+ std::pair<proto::OptimizationTarget, absl::optional<proto::Any>>>&
optimization_targets_and_metadata) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -293,7 +293,7 @@
void PredictionManager::AddObserverForOptimizationTargetModel(
proto::OptimizationTarget optimization_target,
- const base::Optional<proto::Any>& model_metadata,
+ const absl::optional<proto::Any>& model_metadata,
OptimizationTargetModelObserver* observer) {
DCHECK(registered_observers_for_optimization_targets_.find(
optimization_target) ==
@@ -362,7 +362,7 @@
std::vector<std::pair<std::string, float>> feature_map;
feature_map.reserve(model_features.size());
for (const auto& model_feature : model_features) {
- base::Optional<float> value;
+ absl::optional<float> value;
if (host_model_features) {
const auto it = host_model_features->find(model_feature);
if (it != host_model_features->end())
@@ -565,7 +565,7 @@
}
void PredictionManager::OnModelsFetched(
- base::Optional<std::unique_ptr<proto::GetModelsResponse>>
+ absl::optional<std::unique_ptr<proto::GetModelsResponse>>
get_models_response_data) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!get_models_response_data)
@@ -690,7 +690,7 @@
void PredictionManager::NotifyObserversOfNewModelPath(
proto::OptimizationTarget optimization_target,
- const base::Optional<proto::Any>& model_metadata,
+ const absl::optional<proto::Any>& model_metadata,
const base::FilePath& file_path) const {
auto observers_it =
registered_observers_for_optimization_targets_.find(optimization_target);
@@ -1078,17 +1078,17 @@
model_and_features_store_->ClearHostModelFeaturesFromDatabase();
}
-base::Optional<base::flat_map<std::string, float>>
+absl::optional<base::flat_map<std::string, float>>
PredictionManager::GetHostModelFeaturesForHost(const std::string& host) const {
auto it = host_model_features_cache_.Peek(host);
if (it == host_model_features_cache_.end())
- return base::nullopt;
+ return absl::nullopt;
return it->second;
}
void PredictionManager::OverrideTargetModelFileForTesting(
proto::OptimizationTarget optimization_target,
- const base::Optional<proto::Any>& model_metadata,
+ const absl::optional<proto::Any>& model_metadata,
const base::FilePath& file_path) {
proto::PredictionModel prediction_model;
prediction_model.mutable_model_info()->set_version(1);
diff --git a/chrome/browser/optimization_guide/prediction/prediction_manager.h b/chrome/browser/optimization_guide/prediction/prediction_manager.h
index 2450da6..174d3350 100644
--- a/chrome/browser/optimization_guide/prediction/prediction_manager.h
+++ b/chrome/browser/optimization_guide/prediction/prediction_manager.h
@@ -74,7 +74,7 @@
// requested by consumers of the Optimization Guide.
void RegisterOptimizationTargets(
const std::vector<
- std::pair<proto::OptimizationTarget, base::Optional<proto::Any>>>&
+ std::pair<proto::OptimizationTarget, absl::optional<proto::Any>>>&
optimization_targets_and_metadata);
// Adds an observer for updates to the model for |optimization_target|.
@@ -83,7 +83,7 @@
// Machine Learning Service for inference.
void AddObserverForOptimizationTargetModel(
proto::OptimizationTarget optimization_target,
- const base::Optional<proto::Any>& model_metadata,
+ const absl::optional<proto::Any>& model_metadata,
OptimizationTargetModelObserver* observer);
// Removes an observer for updates to the model for |optimization_target|.
@@ -146,7 +146,7 @@
// For testing purposes only.
void OverrideTargetModelFileForTesting(
proto::OptimizationTarget optimization_target,
- const base::Optional<proto::Any>& model_metadata,
+ const absl::optional<proto::Any>& model_metadata,
const base::FilePath& file_path);
// PredictionModelDownloadObserver:
@@ -163,7 +163,7 @@
const HostModelFeaturesMRUCache* GetHostModelFeaturesForTesting() const;
// Returns the host model features for a host if available.
- base::Optional<base::flat_map<std::string, float>>
+ absl::optional<base::flat_map<std::string, float>>
GetHostModelFeaturesForHost(const std::string& host) const;
// Return the set of features that each host in |host_model_features_map_|
@@ -209,7 +209,7 @@
// the response and stores them for use. The metadata entry containing the
// time that updates should be fetched from the remote Optimization Guide
// Service is updated, even when the response is empty.
- void OnModelsFetched(base::Optional<std::unique_ptr<proto::GetModelsResponse>>
+ void OnModelsFetched(absl::optional<std::unique_ptr<proto::GetModelsResponse>>
get_models_response_data);
// Callback run after the model and host model features store is fully
@@ -313,7 +313,7 @@
// updated to |file_path|.
void NotifyObserversOfNewModelPath(
proto::OptimizationTarget optimization_target,
- const base::Optional<proto::Any>& model_metadata,
+ const absl::optional<proto::Any>& model_metadata,
const base::FilePath& file_path) const;
// A map of optimization target to the prediction model capable of making
@@ -329,7 +329,7 @@
// The map from optimization targets to feature-provided metadata that have
// been registered with the prediction manager.
- base::flat_map<proto::OptimizationTarget, base::Optional<proto::Any>>
+ base::flat_map<proto::OptimizationTarget, absl::optional<proto::Any>>
registered_optimization_targets_and_metadata_;
// The map from optimization target to observers that have been registered to
diff --git a/chrome/browser/optimization_guide/prediction/prediction_manager_browsertest.cc b/chrome/browser/optimization_guide/prediction/prediction_manager_browsertest.cc
index 7af274a2..7281505 100644
--- a/chrome/browser/optimization_guide/prediction/prediction_manager_browsertest.cc
+++ b/chrome/browser/optimization_guide/prediction/prediction_manager_browsertest.cc
@@ -657,7 +657,7 @@
}
void OnModelFileUpdated(proto::OptimizationTarget optimization_target,
- const base::Optional<proto::Any>& model_metadata,
+ const absl::optional<proto::Any>& model_metadata,
const base::FilePath& file_path) override {
if (file_received_callback_)
std::move(file_received_callback_).Run(optimization_target, file_path);
@@ -699,7 +699,7 @@
OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile())
->AddObserverForOptimizationTargetModel(
proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD,
- /*model_metadata=*/base::nullopt, model_file_observer_.get());
+ /*model_metadata=*/absl::nullopt, model_file_observer_.get());
}
private:
diff --git a/chrome/browser/optimization_guide/prediction/prediction_manager_unittest.cc b/chrome/browser/optimization_guide/prediction/prediction_manager_unittest.cc
index 8284fd7..a51bd3a 100644
--- a/chrome/browser/optimization_guide/prediction/prediction_manager_unittest.cc
+++ b/chrome/browser/optimization_guide/prediction/prediction_manager_unittest.cc
@@ -133,18 +133,18 @@
: public OptimizationTargetModelObserver {
public:
void OnModelFileUpdated(proto::OptimizationTarget optimization_target,
- const base::Optional<proto::Any>& model_metadata,
+ const absl::optional<proto::Any>& model_metadata,
const base::FilePath& file_path) override {
last_received_models_[optimization_target] =
std::make_pair(model_metadata, file_path);
}
- base::Optional<std::pair<base::Optional<proto::Any>, base::FilePath>>
+ absl::optional<std::pair<absl::optional<proto::Any>, base::FilePath>>
last_received_model_for_target(
proto::OptimizationTarget optimization_target) {
auto model_it = last_received_models_.find(optimization_target);
if (model_it == last_received_models_.end())
- return base::nullopt;
+ return absl::nullopt;
return model_it->second;
}
@@ -153,7 +153,7 @@
private:
base::flat_map<proto::OptimizationTarget,
- std::pair<base::Optional<proto::Any>, base::FilePath>>
+ std::pair<absl::optional<proto::Any>, base::FilePath>>
last_received_models_;
};
@@ -200,7 +200,7 @@
std::move(callback).Run(std::move(get_models_response));
return;
}
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
}
// A mock class implementation of PredictionModelFetcher.
@@ -223,7 +223,7 @@
const std::string& locale,
ModelsFetchedCallback models_fetched_callback) override {
if (!ValidateModelsInfoForFetch(models_request_info)) {
- std::move(models_fetched_callback).Run(base::nullopt);
+ std::move(models_fetched_callback).Run(absl::nullopt);
return false;
}
@@ -639,7 +639,7 @@
PredictionModelFetcherEndState::kFetchSuccessWithModels));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
SetStoreInitialized();
EXPECT_FALSE(prediction_model_fetcher()->models_fetched());
@@ -668,7 +668,7 @@
PredictionModelFetcherEndState::kFetchSuccessWithModels));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
SetStoreInitialized();
EXPECT_TRUE(prediction_model_fetcher()->models_fetched());
@@ -744,7 +744,7 @@
prediction_manager()->OnModelReady(model1);
RunUntilIdle();
- base::Optional<std::pair<base::Optional<proto::Any>, base::FilePath>>
+ absl::optional<std::pair<absl::optional<proto::Any>, base::FilePath>>
received_model = observer.last_received_model_for_target(
proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD);
EXPECT_EQ(received_model->first->type_url(), "sometypeurl");
@@ -800,7 +800,7 @@
FakeOptimizationTargetModelObserver observer1;
prediction_manager()->AddObserverForOptimizationTargetModel(
proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD,
- /*model_metadata=*/base::nullopt, &observer1);
+ /*model_metadata=*/absl::nullopt, &observer1);
SetStoreInitialized(/* load_models= */ false,
/* load_host_model_features= */ false,
/* have_models_in_store= */ false);
@@ -833,7 +833,7 @@
EXPECT_DCHECK_DEATH(
prediction_manager()->AddObserverForOptimizationTargetModel(
proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD,
- /*model_metadata=*/base::nullopt, &observer2));
+ /*model_metadata=*/absl::nullopt, &observer2));
RunUntilIdle();
#endif
}
@@ -910,7 +910,7 @@
CreatePredictionManager();
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
EXPECT_EQ(OptimizationTargetDecision::kModelNotAvailableOnClient,
prediction_manager()->ShouldTargetNavigation(
@@ -937,7 +937,7 @@
PredictionModelFetcherEndState::kFetchSuccessWithEmptyResponse));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
SetStoreInitialized();
EXPECT_TRUE(prediction_model_fetcher()->models_fetched());
@@ -984,7 +984,7 @@
PredictionModelFetcherEndState::kFetchFailed));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
std::unique_ptr<proto::GetModelsResponse> get_models_response =
BuildGetModelsResponse();
@@ -1016,7 +1016,7 @@
PredictionModelFetcherEndState::kFetchFailed));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
// Seed the PredictionManager with a prediction model with a higher version
// to try to be updated.
@@ -1058,7 +1058,7 @@
FakeOptimizationTargetModelObserver observer;
prediction_manager()->AddObserverForOptimizationTargetModel(
proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD,
- /*model_metadata=*/base::nullopt, &observer);
+ /*model_metadata=*/absl::nullopt, &observer);
proto::PredictionModel model;
model.mutable_model_info()->set_optimization_target(
@@ -1106,7 +1106,7 @@
prediction_model_download_manager()->SetAvailableForDownloads(false);
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
SetStoreInitialized();
EXPECT_FALSE(prediction_model_fetcher()->models_fetched());
@@ -1132,7 +1132,7 @@
task_environment()->GetMainThreadTaskRunner()));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
SetStoreInitialized();
EXPECT_TRUE(prediction_model_fetcher()->models_fetched());
@@ -1166,7 +1166,7 @@
PredictionModelFetcherEndState::kFetchSuccessWithEmptyResponse));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
SetStoreInitialized(/* load_models= */ false,
/* load_host_model_features= */ true,
@@ -1200,7 +1200,7 @@
PredictionModelFetcherEndState::kFetchSuccessWithEmptyResponse));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
SetStoreInitialized(/* load_models= */ false,
/* load_host_model_features= */ true,
@@ -1237,7 +1237,7 @@
PredictionModelFetcherEndState::kFetchSuccessWithEmptyResponse));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
EXPECT_EQ(OptimizationTargetDecision::kModelNotAvailableOnClient,
prediction_manager()->ShouldTargetNavigation(
@@ -1318,7 +1318,7 @@
CreatePredictionManager();
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
SetStoreInitialized();
histogram_tester.ExpectUniqueSample(
"OptimizationGuide.PredictionModelLoadedVersion.PainfulPageLoad", 1, 1);
@@ -1364,7 +1364,7 @@
PredictionModelFetcherEndState::kFetchFailed));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
EXPECT_FALSE(prediction_model_fetcher()->models_fetched());
EXPECT_FALSE(models_and_features_store()->WasModelLoaded());
@@ -1399,7 +1399,7 @@
BuildTestPredictionModelFetcher(
PredictionModelFetcherEndState::kFetchFailed));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
EXPECT_FALSE(models_and_features_store()->WasHostModelFeaturesLoaded());
EXPECT_FALSE(models_and_features_store()->WasModelLoaded());
EXPECT_FALSE(prediction_manager()->GetHostModelFeaturesForHost("foo.com"));
@@ -1428,7 +1428,7 @@
EXPECT_FALSE(models_and_features_store()->WasModelLoaded());
EXPECT_FALSE(prediction_manager()->GetHostModelFeaturesForHost("foo.com"));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
RunUntilIdle();
EXPECT_TRUE(models_and_features_store()->WasHostModelFeaturesLoaded());
@@ -1450,7 +1450,7 @@
PredictionModelFetcherEndState::kFetchFailed));
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
SetStoreInitialized();
EXPECT_FALSE(prediction_model_fetcher()->models_fetched());
@@ -1478,7 +1478,7 @@
g_browser_process->SetApplicationLocale("en-US");
prediction_manager()->RegisterOptimizationTargets(
- {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, base::nullopt}});
+ {{proto::OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD, absl::nullopt}});
SetStoreInitialized();
EXPECT_FALSE(prediction_model_fetcher()->models_fetched());
diff --git a/chrome/browser/optimization_guide/prediction/prediction_model_download_manager.cc b/chrome/browser/optimization_guide/prediction/prediction_model_download_manager.cc
index 4a40265..aafeb21 100644
--- a/chrome/browser/optimization_guide/prediction/prediction_model_download_manager.cc
+++ b/chrome/browser/optimization_guide/prediction/prediction_model_download_manager.cc
@@ -206,7 +206,7 @@
false);
}
-base::Optional<std::pair<base::FilePath, base::FilePath>>
+absl::optional<std::pair<base::FilePath, base::FilePath>>
PredictionModelDownloadManager::ProcessDownload(
const base::FilePath& file_path) {
DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
@@ -225,7 +225,7 @@
base::ThreadPool::PostTask(
FROM_HERE, {base::TaskPriority::BEST_EFFORT, base::MayBlock()},
base::BindOnce(base::GetDeleteFileCallback(), file_path));
- return base::nullopt;
+ return absl::nullopt;
}
// Verify that the CRX3 file is from a publisher we trust.
@@ -242,7 +242,7 @@
base::ThreadPool::PostTask(
FROM_HERE, {base::TaskPriority::BEST_EFFORT, base::MayBlock()},
base::BindOnce(base::GetDeleteFileCallback(), file_path));
- return base::nullopt;
+ return absl::nullopt;
}
}
@@ -255,14 +255,14 @@
base::ThreadPool::PostTask(
FROM_HERE, {base::TaskPriority::BEST_EFFORT, base::MayBlock()},
base::BindOnce(base::GetDeleteFileCallback(), file_path));
- return base::nullopt;
+ return absl::nullopt;
}
return std::make_pair(file_path, temp_dir_path);
}
void PredictionModelDownloadManager::StartUnzipping(
- const base::Optional<std::pair<base::FilePath, base::FilePath>>&
+ const absl::optional<std::pair<base::FilePath, base::FilePath>>&
unzip_paths) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -302,7 +302,7 @@
ui_weak_ptr_factory_.GetWeakPtr()));
}
-base::Optional<proto::PredictionModel>
+absl::optional<proto::PredictionModel>
PredictionModelDownloadManager::ProcessUnzippedContents(
const base::FilePath& unzipped_dir_path) {
DCHECK(background_task_runner_->RunsTasksInCurrentSequence());
@@ -318,18 +318,18 @@
if (!base::ReadFileToString(model_info_path, &binary_model_info_pb)) {
RecordPredictionModelDownloadStatus(
PredictionModelDownloadStatus::kFailedModelInfoFileRead);
- return base::nullopt;
+ return absl::nullopt;
}
proto::ModelInfo model_info;
if (!model_info.ParseFromString(binary_model_info_pb)) {
RecordPredictionModelDownloadStatus(
PredictionModelDownloadStatus::kFailedModelInfoParsing);
- return base::nullopt;
+ return absl::nullopt;
}
if (!model_info.has_version() || !model_info.has_optimization_target()) {
RecordPredictionModelDownloadStatus(
PredictionModelDownloadStatus::kFailedModelInfoInvalid);
- return base::nullopt;
+ return absl::nullopt;
}
if (!models_dir_) {
@@ -339,8 +339,8 @@
&(*models_dir_))) {
RecordPredictionModelDownloadStatus(
PredictionModelDownloadStatus::kModelDirectoryDoesNotExist);
- models_dir_ = base::nullopt;
- return base::nullopt;
+ models_dir_ = absl::nullopt;
+ return absl::nullopt;
}
}
@@ -372,11 +372,11 @@
RecordPredictionModelDownloadStatus(
PredictionModelDownloadStatus::kFailedModelFileOtherError);
- return base::nullopt;
+ return absl::nullopt;
}
void PredictionModelDownloadManager::NotifyModelReady(
- const base::Optional<proto::PredictionModel>& model) {
+ const absl::optional<proto::PredictionModel>& model) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!model)
diff --git a/chrome/browser/optimization_guide/prediction/prediction_model_download_manager.h b/chrome/browser/optimization_guide/prediction/prediction_model_download_manager.h
index c206e89..d346d0e 100644
--- a/chrome/browser/optimization_guide/prediction/prediction_model_download_manager.h
+++ b/chrome/browser/optimization_guide/prediction/prediction_model_download_manager.h
@@ -89,13 +89,13 @@
// |file_path| is successfully verified.
//
// Must be called on the background thread, as it performs file I/O.
- base::Optional<std::pair<base::FilePath, base::FilePath>> ProcessDownload(
+ absl::optional<std::pair<base::FilePath, base::FilePath>> ProcessDownload(
const base::FilePath& file_path);
// Starts unzipping the contents of |unzip_paths|, if present. |unzip_paths|
// is a pair of the form (src, dst), if present.
void StartUnzipping(
- const base::Optional<std::pair<base::FilePath, base::FilePath>>&
+ const absl::optional<std::pair<base::FilePath, base::FilePath>>&
unzip_paths);
// Invoked when the contents of |original_file_path| have been unzipped to
@@ -107,13 +107,13 @@
// Processes the contents in |unzipped_dir_path|.
//
// Must be called on the background thread, as it performs file I/O.
- base::Optional<proto::PredictionModel> ProcessUnzippedContents(
+ absl::optional<proto::PredictionModel> ProcessUnzippedContents(
const base::FilePath& unzipped_dir_path);
// Notifies |observers_| that a model is ready.
//
// Must be invoked on the UI thread.
- void NotifyModelReady(const base::Optional<proto::PredictionModel>& model);
+ void NotifyModelReady(const absl::optional<proto::PredictionModel>& model);
// The set of GUIDs that are still pending download.
std::set<std::string> pending_download_guids_;
@@ -124,7 +124,7 @@
download::DownloadService* download_service_;
// The directory to store verified models in.
- base::Optional<base::FilePath> models_dir_;
+ absl::optional<base::FilePath> models_dir_;
// Whether the download service is available.
bool is_available_for_downloads_;
diff --git a/chrome/browser/optimization_guide/prediction/prediction_model_download_manager_unittest.cc b/chrome/browser/optimization_guide/prediction/prediction_model_download_manager_unittest.cc
index 19cb40317..d9cd0a7 100644
--- a/chrome/browser/optimization_guide/prediction/prediction_model_download_manager_unittest.cc
+++ b/chrome/browser/optimization_guide/prediction/prediction_model_download_manager_unittest.cc
@@ -6,7 +6,6 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/sequence_checker.h"
#include "base/strings/utf_string_conversions.h"
@@ -25,6 +24,7 @@
#include "components/services/unzip/content/unzip_service.h"
#include "components/services/unzip/in_process_unzipper.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/zlib/google/zip.h"
namespace optimization_guide {
@@ -42,12 +42,12 @@
last_ready_model_ = model;
}
- base::Optional<proto::PredictionModel> last_ready_model() const {
+ absl::optional<proto::PredictionModel> last_ready_model() const {
return last_ready_model_;
}
private:
- base::Optional<proto::PredictionModel> last_ready_model_;
+ absl::optional<proto::PredictionModel> last_ready_model_;
};
enum class PredictionModelDownloadFileStatus {
diff --git a/chrome/browser/page_load_metrics/integration_tests/largest_contentful_paint_browsertest.cc b/chrome/browser/page_load_metrics/integration_tests/largest_contentful_paint_browsertest.cc
index b1dbd94c..3b308b1 100644
--- a/chrome/browser/page_load_metrics/integration_tests/largest_contentful_paint_browsertest.cc
+++ b/chrome/browser/page_load_metrics/integration_tests/largest_contentful_paint_browsertest.cc
@@ -24,11 +24,11 @@
std::unique_ptr<base::Value> data;
ASSERT_TRUE(event.GetArgAsValue("data", &data));
- const base::Optional<int> traced_size = data->FindIntKey("size");
+ const absl::optional<int> traced_size = data->FindIntKey("size");
ASSERT_TRUE(traced_size.has_value());
EXPECT_EQ(traced_size.value(), expected_size);
- const base::Optional<bool> traced_main_frame_flag =
+ const absl::optional<bool> traced_main_frame_flag =
data->FindBoolKey("isMainFrame");
ASSERT_TRUE(traced_main_frame_flag.has_value());
EXPECT_TRUE(traced_main_frame_flag.value());
@@ -36,7 +36,7 @@
int GetCandidateIndex(const TraceEvent& event) {
std::unique_ptr<base::Value> data = event.GetKnownArgAsValue("data");
- base::Optional<int> candidate_idx = data->FindIntKey("candidateIndex");
+ absl::optional<int> candidate_idx = data->FindIntKey("candidateIndex");
DCHECK(candidate_idx.has_value()) << "couldn't find 'candidateIndex'";
return candidate_idx.value();
@@ -89,7 +89,7 @@
const auto& list = result.value.GetList();
const std::string expected_url[3] = {
image_1_url_expected, image_2_url_expected, image_3_url_expected};
- base::Optional<double> lcp_timestamps[3];
+ absl::optional<double> lcp_timestamps[3];
for (size_t i = 0; i < 3; i++) {
const std::string* url = list[i].FindStringPath("url");
EXPECT_TRUE(url);
diff --git a/chrome/browser/page_load_metrics/integration_tests/layout_instability_browsertest.cc b/chrome/browser/page_load_metrics/integration_tests/layout_instability_browsertest.cc
index 962c8eb..eae121d 100644
--- a/chrome/browser/page_load_metrics/integration_tests/layout_instability_browsertest.cc
+++ b/chrome/browser/page_load_metrics/integration_tests/layout_instability_browsertest.cc
@@ -10,8 +10,8 @@
#include "content/public/test/browser_test.h"
#include "services/metrics/public/cpp/ukm_builders.h"
+using absl::optional;
using base::Bucket;
-using base::Optional;
using base::Value;
using trace_analyzer::Query;
using trace_analyzer::TraceAnalyzer;
@@ -67,7 +67,7 @@
size_t i = 0;
for (const Value& expectation : expectations.GetList()) {
- Optional<double> score = expectation.FindDoubleKey("score");
+ optional<double> score = expectation.FindDoubleKey("score");
if (score && *score == 0.0) {
// {score:0} expects no layout shift.
continue;
diff --git a/chrome/browser/page_load_metrics/integration_tests/metric_integration_test.h b/chrome/browser/page_load_metrics/integration_tests/metric_integration_test.h
index 85f0d28..dca7f73 100644
--- a/chrome/browser/page_load_metrics/integration_tests/metric_integration_test.h
+++ b/chrome/browser/page_load_metrics/integration_tests/metric_integration_test.h
@@ -107,8 +107,8 @@
base::TimeDelta delay,
const net::test_server::HttpRequest& request);
- base::Optional<ukm::TestAutoSetUkmRecorder> ukm_recorder_;
- base::Optional<base::HistogramTester> histogram_tester_;
+ absl::optional<ukm::TestAutoSetUkmRecorder> ukm_recorder_;
+ absl::optional<base::HistogramTester> histogram_tester_;
};
#endif // CHROME_BROWSER_PAGE_LOAD_METRICS_INTEGRATION_TESTS_METRIC_INTEGRATION_TEST_H_
diff --git a/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc b/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc
index 28747e7..fac8fe17 100644
--- a/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc
+++ b/chrome/browser/page_load_metrics/observers/ad_metrics/ads_page_load_metrics_observer_browsertest.cc
@@ -597,7 +597,7 @@
void TestCreativeOriginStatus(
std::unique_ptr<Frame> main_frame,
page_load_metrics::OriginStatus expected_status,
- base::Optional<page_load_metrics::OriginStatusWithThrottling>
+ absl::optional<page_load_metrics::OriginStatusWithThrottling>
expected_status_with_throttling) {
base::HistogramTester histogram_tester;
bool subframe_exists = main_frame->HasChild();
@@ -688,7 +688,7 @@
CreativeOriginStatusNoCreativeDesignated) {
TestCreativeOriginStatus(
MakeFrame("a", MakeFrame("b", MakeFrame("c", nullptr))),
- OriginStatus::kUnknown, base::nullopt);
+ OriginStatus::kUnknown, absl::nullopt);
}
// Test that if no iframe is created, there is no histogram set.
diff --git a/chrome/browser/page_load_metrics/observers/core/amp_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/core/amp_page_load_metrics_observer.cc
index a5afe31..2cda667 100644
--- a/chrome/browser/page_load_metrics/observers/core/amp_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/core/amp_page_load_metrics_observer.cc
@@ -9,7 +9,6 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "components/page_load_metrics/browser/observers/core/largest_contentful_paint_handler.h"
@@ -21,6 +20,7 @@
#include "services/metrics/public/cpp/metrics_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
@@ -380,7 +380,7 @@
}
}
- base::Optional<base::TimeDelta> largest_content_paint_time;
+ absl::optional<base::TimeDelta> largest_content_paint_time;
uint64_t largest_content_paint_size;
page_load_metrics::ContentfulPaintTimingInfo::LargestContentType
largest_content_type;
diff --git a/chrome/browser/page_load_metrics/observers/core/amp_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/core/amp_page_load_metrics_observer_unittest.cc
index d5b41f85..0c55916 100644
--- a/chrome/browser/page_load_metrics/observers/core/amp_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/core/amp_page_load_metrics_observer_unittest.cc
@@ -9,7 +9,6 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
#include "components/page_load_metrics/browser/page_load_tracker.h"
@@ -21,6 +20,7 @@
#include "services/metrics/public/cpp/metrics_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
using content::NavigationSimulator;
@@ -59,7 +59,7 @@
void ValidateHistogramsFor(const std::string& histogram,
const char* view_type,
- const base::Optional<base::TimeDelta>& event,
+ const absl::optional<base::TimeDelta>& event,
bool expect_histograms) {
const size_t kTypeOffset = strlen("PageLoad.Clients.AMP.");
std::string view_type_histogram = histogram;
diff --git a/chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer.cc
index f3faa4a..23c384a 100644
--- a/chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer.cc
@@ -557,7 +557,7 @@
void UkmPageLoadMetricsObserver::RecordSiteEngagement() const {
ukm::builders::PageLoad builder(GetDelegate().GetPageUkmSourceId());
- base::Optional<int64_t> rounded_site_engagement_score =
+ absl::optional<int64_t> rounded_site_engagement_score =
GetRoundedSiteEngagementScore();
if (rounded_site_engagement_score) {
builder.SetSiteEngagementScore(rounded_site_engagement_score.value());
@@ -798,7 +798,7 @@
base::TimeTicks app_background_time) {
ukm::builders::PageLoad builder(GetDelegate().GetPageUkmSourceId());
- base::Optional<bool> third_party_cookie_blocking_enabled =
+ absl::optional<bool> third_party_cookie_blocking_enabled =
GetThirdPartyCookieBlockingEnabled();
if (third_party_cookie_blocking_enabled) {
builder.SetThirdPartyCookieBlockingEnabledForSite(
@@ -807,7 +807,7 @@
third_party_cookie_blocking_enabled.value());
}
- base::Optional<base::TimeDelta> foreground_duration =
+ absl::optional<base::TimeDelta> foreground_duration =
page_load_metrics::GetInitialForegroundDuration(GetDelegate(),
app_background_time);
if (foreground_duration) {
@@ -1243,10 +1243,10 @@
builder.Record(ukm::UkmRecorder::Get());
}
-base::Optional<int64_t>
+absl::optional<int64_t>
UkmPageLoadMetricsObserver::GetRoundedSiteEngagementScore() const {
if (!browser_context_)
- return base::nullopt;
+ return absl::nullopt;
Profile* profile = Profile::FromBrowserContext(browser_context_);
site_engagement::SiteEngagementService* engagement_service =
@@ -1266,15 +1266,15 @@
return rounded_document_engagement_score;
}
-base::Optional<bool>
+absl::optional<bool>
UkmPageLoadMetricsObserver::GetThirdPartyCookieBlockingEnabled() const {
if (!browser_context_)
- return base::nullopt;
+ return absl::nullopt;
Profile* profile = Profile::FromBrowserContext(browser_context_);
auto cookie_settings = CookieSettingsFactory::GetForProfile(profile);
if (!cookie_settings->ShouldBlockThirdPartyCookies())
- return base::nullopt;
+ return absl::nullopt;
return !cookie_settings->IsThirdPartyAccessAllowed(GetDelegate().GetUrl(),
nullptr /* source */);
diff --git a/chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer.h
index b085429..ee7543f 100644
--- a/chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer.h
+++ b/chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer.h
@@ -7,13 +7,13 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "components/page_load_metrics/browser/page_load_metrics_event.h"
#include "components/page_load_metrics/browser/page_load_metrics_observer.h"
#include "content/public/browser/site_instance_process_assignment.h"
#include "net/http/http_response_info.h"
#include "services/metrics/public/cpp/ukm_source.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
namespace content {
@@ -172,12 +172,12 @@
// Captures the site engagement score for the committed URL and
// returns the score rounded to the nearest 10.
- base::Optional<int64_t> GetRoundedSiteEngagementScore() const;
+ absl::optional<int64_t> GetRoundedSiteEngagementScore() const;
// Returns whether third party cookie blocking is enabled for the committed
// URL. This is only recorded for users who have prefs::kCookieControlsEnabled
// set to true.
- base::Optional<bool> GetThirdPartyCookieBlockingEnabled() const;
+ absl::optional<bool> GetThirdPartyCookieBlockingEnabled() const;
// Records the metrics for the nostate prefetch to an event with UKM source ID
// |source_id|.
@@ -239,20 +239,20 @@
// Network quality estimates.
net::EffectiveConnectionType effective_connection_type_ =
net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN;
- base::Optional<int32_t> http_response_code_;
- base::Optional<base::TimeDelta> http_rtt_estimate_;
- base::Optional<base::TimeDelta> transport_rtt_estimate_;
- base::Optional<int32_t> downstream_kbps_estimate_;
+ absl::optional<int32_t> http_response_code_;
+ absl::optional<base::TimeDelta> http_rtt_estimate_;
+ absl::optional<base::TimeDelta> transport_rtt_estimate_;
+ absl::optional<int32_t> downstream_kbps_estimate_;
// Total CPU wall time used by the page while in the foreground.
base::TimeDelta total_foreground_cpu_time_;
// Load timing metrics of the main frame resource request.
content::NavigationHandleTiming navigation_handle_timing_;
- base::Optional<net::LoadTimingInfo> main_frame_timing_;
+ absl::optional<net::LoadTimingInfo> main_frame_timing_;
// How the SiteInstance for the committed page was assigned a renderer.
- base::Optional<content::SiteInstanceProcessAssignment>
+ absl::optional<content::SiteInstanceProcessAssignment>
render_process_assignment_;
// PAGE_TRANSITION_LINK is the default PageTransition value.
@@ -278,7 +278,7 @@
// Set to true if any main frame request in the redirect chain had cookies set
// on the request. Set to false if there were no cookies set. Not set if we
// didn't get a response from the CookieManager before recording metrics.
- base::Optional<bool> main_frame_request_had_cookies_;
+ absl::optional<bool> main_frame_request_had_cookies_;
// The browser context this navigation is operating in.
content::BrowserContext* browser_context_ = nullptr;
@@ -314,7 +314,7 @@
base::TimeDelta total_foreground_duration_;
// The connection info for the committed URL.
- base::Optional<net::HttpResponseInfo::ConnectionInfo> connection_info_;
+ absl::optional<net::HttpResponseInfo::ConnectionInfo> connection_info_;
base::ReadOnlySharedMemoryMapping ukm_smoothness_data_;
diff --git a/chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer_unittest.cc
index ac3e9b2..665b4c4 100644
--- a/chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include "base/metrics/metrics_hashes.h"
-#include "base/optional.h"
#include "base/test/simple_test_clock.h"
#include "base/test/trace_event_analyzer.h"
#include "base/time/time.h"
@@ -50,6 +49,7 @@
#include "services/metrics/public/cpp/ukm_source.h"
#include "services/network/public/cpp/network_quality_tracker.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/metrics_proto/system_profile.pb.h"
using content::NavigationSimulator;
@@ -713,7 +713,7 @@
tester()->SimulateTimingUpdate(timing);
timing.paint_timing->largest_contentful_paint->largest_text_paint =
- base::Optional<base::TimeDelta>();
+ absl::optional<base::TimeDelta>();
timing.paint_timing->largest_contentful_paint->largest_text_paint_size = 0;
PopulateRequiredTimingFields(&timing);
diff --git a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_test_utils.cc b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_test_utils.cc
index ccf3841..6a2ca738 100644
--- a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_test_utils.cc
+++ b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_test_utils.cc
@@ -85,8 +85,8 @@
// Verify that, if expected and actual are set, their values are equal.
// Otherwise, verify that both are unset.
void DataReductionProxyMetricsObserverTestBase::ExpectEqualOrUnset(
- const base::Optional<base::TimeDelta>& expected,
- const base::Optional<base::TimeDelta>& actual) {
+ const absl::optional<base::TimeDelta>& expected,
+ const absl::optional<base::TimeDelta>& actual) {
if (expected && actual) {
EXPECT_EQ(expected.value(), actual.value());
} else {
diff --git a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_test_utils.h b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_test_utils.h
index 436666ab..b89b178 100644
--- a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_test_utils.h
+++ b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_test_utils.h
@@ -12,12 +12,12 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
#include "components/page_load_metrics/common/page_load_timing.h"
#include "components/page_load_metrics/common/test/page_load_metrics_test_util.h"
#include "net/nqe/effective_connection_type.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/input/web_input_event.h"
namespace data_reduction_proxy {
@@ -56,8 +56,8 @@
// Verify that, if expected and actual are set, their values are equal.
// Otherwise, verify that both are unset.
- void ExpectEqualOrUnset(const base::Optional<base::TimeDelta>& expected,
- const base::Optional<base::TimeDelta>& actual);
+ void ExpectEqualOrUnset(const absl::optional<base::TimeDelta>& expected,
+ const absl::optional<base::TimeDelta>& actual);
// Set ups test state.
void SetUp() override;
diff --git a/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
index 7d32f708..45d5b9e 100644
--- a/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.cc
@@ -242,7 +242,7 @@
const page_load_metrics::mojom::PageLoadTiming& timing,
const page_load_metrics::PageLoadMetricsObserverDelegate& delegate,
base::TimeTicks app_background_time) {
- base::Optional<base::TimeDelta> foreground_duration =
+ absl::optional<base::TimeDelta> foreground_duration =
page_load_metrics::GetInitialForegroundDuration(delegate,
app_background_time);
if (!foreground_duration)
@@ -279,7 +279,7 @@
abort_info.reason == PageAbortReason::ABORT_NONE)
return false;
- base::Optional<base::TimeDelta> time_to_abort(abort_info.time_to_abort);
+ absl::optional<base::TimeDelta> time_to_abort(abort_info.time_to_abort);
if (page_load_metrics::WasStartedInForegroundOptionalEventInForeground(
time_to_abort, delegate))
return true;
@@ -299,7 +299,7 @@
bool WasAbortedBeforeInteraction(
const page_load_metrics::PageAbortInfo& abort_info,
- const base::Optional<base::TimeDelta>& time_to_interaction) {
+ const absl::optional<base::TimeDelta>& time_to_interaction) {
// These conditions should be guaranteed by the call to
// WasAbortedInForeground, which is called before WasAbortedBeforeInteraction
// gets invoked.
@@ -545,7 +545,7 @@
}
bool FromGWSPageLoadMetricsLogger::ShouldLogForegroundEventAfterCommit(
- const base::Optional<base::TimeDelta>& event,
+ const absl::optional<base::TimeDelta>& event,
const page_load_metrics::PageLoadMetricsObserverDelegate& delegate) {
DCHECK(delegate.DidCommit())
<< "ShouldLogForegroundEventAfterCommit called without committed URL.";
diff --git a/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.h
index 2acce08..5206711e 100644
--- a/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.h
+++ b/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_FROM_GWS_PAGE_LOAD_METRICS_OBSERVER_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "components/page_load_metrics/browser/page_load_metrics_observer.h"
#include "services/metrics/public/cpp/ukm_source.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace internal {
@@ -113,7 +113,7 @@
bool ShouldLogFailedProvisionalLoadMetrics();
bool ShouldLogPostCommitMetrics(const GURL& url);
bool ShouldLogForegroundEventAfterCommit(
- const base::Optional<base::TimeDelta>& event,
+ const absl::optional<base::TimeDelta>& event,
const page_load_metrics::PageLoadMetricsObserverDelegate& delegate);
private:
@@ -131,7 +131,7 @@
base::TimeTicks navigation_start_;
// The time of first user interaction after paint from navigation start.
- base::Optional<base::TimeDelta> first_user_interaction_after_paint_;
+ absl::optional<base::TimeDelta> first_user_interaction_after_paint_;
DISALLOW_COPY_AND_ASSIGN(FromGWSPageLoadMetricsLogger);
};
diff --git a/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc
index 9df358d..0c8998a 100644
--- a/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc
@@ -6,12 +6,12 @@
#include <memory>
-#include "base/optional.h"
#include "chrome/browser/page_load_metrics/observers/histogram_suffixes.h"
#include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
#include "components/page_load_metrics/browser/page_load_tracker.h"
#include "components/page_load_metrics/common/test/page_load_metrics_test_util.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -99,7 +99,7 @@
}
private:
- base::Optional<int> number_of_tabs_with_inflight_load_;
+ absl::optional<int> number_of_tabs_with_inflight_load_;
};
TEST_F(MultiTabLoadingPageLoadMetricsObserverTest, SingleTabLoading) {
diff --git a/chrome/browser/page_load_metrics/observers/portal_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/portal_page_load_metrics_observer.cc
index e235d2b..917927e 100644
--- a/chrome/browser/page_load_metrics/observers/portal_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/portal_page_load_metrics_observer.cc
@@ -139,7 +139,7 @@
}
void PortalPageLoadMetricsObserver::ReportPortalActivatedPaint(
- const base::Optional<base::TimeTicks>& portal_activated_paint) {
+ const absl::optional<base::TimeTicks>& portal_activated_paint) {
portal_paint_time_ = portal_activated_paint;
}
diff --git a/chrome/browser/page_load_metrics/observers/portal_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/portal_page_load_metrics_observer.h
index 08abaf6..a70b08b2 100644
--- a/chrome/browser/page_load_metrics/observers/portal_page_load_metrics_observer.h
+++ b/chrome/browser/page_load_metrics/observers/portal_page_load_metrics_observer.h
@@ -6,10 +6,10 @@
#define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PORTAL_PAGE_LOAD_METRICS_OBSERVER_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "components/page_load_metrics/browser/page_load_metrics_observer.h"
#include "services/metrics/public/cpp/ukm_source.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PortalPageLoadMetricsObserver
: public page_load_metrics::PageLoadMetricsObserver {
@@ -47,17 +47,17 @@
// Reports the time that a portal painted after being activated.
void ReportPortalActivatedPaint(
- const base::Optional<base::TimeTicks>& portal_activated_paint);
+ const absl::optional<base::TimeTicks>& portal_activated_paint);
// Navigation start time in wall time.
base::TimeTicks navigation_start_;
// Time that the portal host requested that the portal should be activated.
- base::Optional<base::TimeTicks> portal_activation_time_;
+ absl::optional<base::TimeTicks> portal_activation_time_;
// Time between portal actithat the portal has painted after a portal
// activation.
- base::Optional<base::TimeTicks> portal_paint_time_;
+ absl::optional<base::TimeTicks> portal_paint_time_;
// True if the page started hidden, or ever became hidden.
bool was_hidden_ = false;
@@ -66,7 +66,7 @@
bool is_portal_ = false;
// The connection info for the committed URL.
- base::Optional<net::HttpResponseInfo::ConnectionInfo> connection_info_;
+ absl::optional<net::HttpResponseInfo::ConnectionInfo> connection_info_;
};
#endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PORTAL_PAGE_LOAD_METRICS_OBSERVER_H_
diff --git a/chrome/browser/page_load_metrics/observers/prefetch_proxy_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/prefetch_proxy_page_load_metrics_observer.h
index 2851469..19b2f54 100644
--- a/chrome/browser/page_load_metrics/observers/prefetch_proxy_page_load_metrics_observer.h
+++ b/chrome/browser/page_load_metrics/observers/prefetch_proxy_page_load_metrics_observer.h
@@ -11,7 +11,6 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/task/cancelable_task_tracker.h"
#include "base/time/time.h"
@@ -20,6 +19,7 @@
#include "components/page_load_metrics/browser/page_load_metrics_event.h"
#include "components/page_load_metrics/browser/page_load_metrics_observer.h"
#include "net/cookies/canonical_cookie.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace content {
@@ -86,7 +86,7 @@
// The minimum number of days since the last visit, as reported by
// HistoryService, to any origin in the redirect chain. Set to -1 if there is
// a response from the history service but was no previous visit.
- base::Optional<int> min_days_since_last_visit_to_origin_;
+ absl::optional<int> min_days_since_last_visit_to_origin_;
// Metrics related to Prefetch Proxy prefetching on a SRP, for plumbing
// into UKM.
@@ -94,7 +94,7 @@
// Metrics for the page load after a Google SRP where NavigationPredictor
// passed parsed SRP links to the TabHelper. Not set if that isn't true.
- base::Optional<PrefetchProxyTabHelper::AfterSRPMetrics> after_srp_metrics_;
+ absl::optional<PrefetchProxyTabHelper::AfterSRPMetrics> after_srp_metrics_;
// Task tracker for calls for the history service.
base::CancelableTaskTracker task_tracker_;
diff --git a/chrome/browser/page_load_metrics/observers/prefetch_proxy_page_load_metrics_observer_browsertest.cc b/chrome/browser/page_load_metrics/observers/prefetch_proxy_page_load_metrics_observer_browsertest.cc
index 5cb0aac..819aa68 100644
--- a/chrome/browser/page_load_metrics/observers/prefetch_proxy_page_load_metrics_observer_browsertest.cc
+++ b/chrome/browser/page_load_metrics/observers/prefetch_proxy_page_load_metrics_observer_browsertest.cc
@@ -72,7 +72,7 @@
}
void VerifyUKMEntry(const std::string& metric_name,
- base::Optional<int64_t> expected_value) {
+ absl::optional<int64_t> expected_value) {
auto entries = ukm_recorder_->GetEntriesByName(
ukm::builders::PrefetchProxy::kEntryName);
ASSERT_EQ(1U, entries.size());
diff --git a/chrome/browser/page_load_metrics/observers/prefetch_proxy_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/prefetch_proxy_page_load_metrics_observer_unittest.cc
index 5ded724..878314b 100644
--- a/chrome/browser/page_load_metrics/observers/prefetch_proxy_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/prefetch_proxy_page_load_metrics_observer_unittest.cc
@@ -73,7 +73,7 @@
}
void VerifyUKMEntry(const std::string& metric_name,
- base::Optional<int64_t> expected_value) {
+ absl::optional<int64_t> expected_value) {
auto entries = tester()->test_ukm_recorder().GetEntriesByName(
ukm::builders::PrefetchProxy::kEntryName);
ASSERT_EQ(1U, entries.size());
@@ -493,7 +493,7 @@
"PageLoad.Clients.SubresourceLoading.DaysSinceLastVisitToOrigin", 0);
using UkmEntry = ukm::builders::PrefetchProxy;
- VerifyUKMEntry(UkmEntry::kdays_since_last_visit_to_originName, base::nullopt);
+ VerifyUKMEntry(UkmEntry::kdays_since_last_visit_to_originName, absl::nullopt);
}
TEST_F(PrefetchProxyPageLoadMetricsObserverTest, LastVisitToHost_Fail) {
@@ -508,7 +508,7 @@
"PageLoad.Clients.SubresourceLoading.DaysSinceLastVisitToOrigin", 0);
using UkmEntry = ukm::builders::PrefetchProxy;
- VerifyUKMEntry(UkmEntry::kdays_since_last_visit_to_originName, base::nullopt);
+ VerifyUKMEntry(UkmEntry::kdays_since_last_visit_to_originName, absl::nullopt);
}
TEST_F(PrefetchProxyPageLoadMetricsObserverTest, LastVisitToHost_NullTime) {
diff --git a/chrome/browser/page_load_metrics/observers/previews_ukm_observer.cc b/chrome/browser/page_load_metrics/observers/previews_ukm_observer.cc
index b95451e1..7f529b1 100644
--- a/chrome/browser/page_load_metrics/observers/previews_ukm_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/previews_ukm_observer.cc
@@ -6,7 +6,6 @@
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h"
@@ -21,6 +20,7 @@
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace previews {
diff --git a/chrome/browser/page_load_metrics/observers/previews_ukm_observer.h b/chrome/browser/page_load_metrics/observers/previews_ukm_observer.h
index e1848e3..d9e6292 100644
--- a/chrome/browser/page_load_metrics/observers/previews_ukm_observer.h
+++ b/chrome/browser/page_load_metrics/observers/previews_ukm_observer.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PREVIEWS_UKM_OBSERVER_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "components/optimization_guide/proto/hints.pb.h"
#include "components/page_load_metrics/browser/page_load_metrics_event.h"
#include "components/page_load_metrics/browser/page_load_metrics_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class NavigationHandle;
diff --git a/chrome/browser/page_load_metrics/observers/previews_ukm_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/previews_ukm_observer_unittest.cc
index 15542e7..15d053c 100644
--- a/chrome/browser/page_load_metrics/observers/previews_ukm_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/previews_ukm_observer_unittest.cc
@@ -10,7 +10,6 @@
#include "base/base64.h"
#include "base/macros.h"
#include "base/metrics/metrics_hashes.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
#include "chrome/test/base/testing_browser_process.h"
@@ -25,6 +24,7 @@
#include "net/base/ip_endpoint.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class NavigationHandle;
diff --git a/chrome/browser/page_load_metrics/observers/session_restore_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/session_restore_page_load_metrics_observer_unittest.cc
index a61b492..e8530e1 100644
--- a/chrome/browser/page_load_metrics/observers/session_restore_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/session_restore_page_load_metrics_observer_unittest.cc
@@ -124,7 +124,7 @@
std::vector<std::unique_ptr<content::NavigationEntry>> entries;
std::unique_ptr<content::NavigationEntry> entry(
content::NavigationController::CreateNavigationEntry(
- GetTestURL(), content::Referrer(), base::nullopt,
+ GetTestURL(), content::Referrer(), absl::nullopt,
ui::PAGE_TRANSITION_RELOAD, false, std::string(), browser_context(),
nullptr /* blob_url_loader_factory */));
entries.emplace_back(std::move(entry));
diff --git a/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer_unittest.cc
index 30e450d7..87f52cb 100644
--- a/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer_unittest.cc
@@ -9,7 +9,6 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/time/time.h"
#include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
@@ -20,6 +19,7 @@
#include "components/page_load_metrics/common/test/page_load_metrics_test_util.h"
#include "content/public/browser/restore_type.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
@@ -102,7 +102,7 @@
int64_t cache_bytes_;
private:
- base::Optional<bool> is_restore_;
+ absl::optional<bool> is_restore_;
page_load_metrics::mojom::PageLoadTiming timing_;
DISALLOW_COPY_AND_ASSIGN(TabRestorePageLoadMetricsObserverTest);
diff --git a/chrome/browser/paint_preview/paint_preview_browsertest.cc b/chrome/browser/paint_preview/paint_preview_browsertest.cc
index 3cb75be4..bf05af7 100644
--- a/chrome/browser/paint_preview/paint_preview_browsertest.cc
+++ b/chrome/browser/paint_preview/paint_preview_browsertest.cc
@@ -7,7 +7,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/unguessable_token.h"
@@ -30,6 +29,7 @@
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "services/metrics/public/cpp/ukm_builders.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/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkStream.h"
@@ -167,7 +167,7 @@
frame_proto.embedding_token_high(), frame_proto.embedding_token_low()));
ASSERT_NE(it, recording_map->end());
- base::Optional<SkpResult> result = std::move(it->second).Deserialize();
+ absl::optional<SkpResult> result = std::move(it->second).Deserialize();
ASSERT_TRUE(result.has_value());
EXPECT_NE(result->skp, nullptr);
EXPECT_GE(result->skp->cullRect().width(), 0);
diff --git a/chrome/browser/paint_preview/services/paint_preview_tab_service.cc b/chrome/browser/paint_preview/services/paint_preview_tab_service.cc
index d4a95741..155b0ff6 100644
--- a/chrome/browser/paint_preview/services/paint_preview_tab_service.cc
+++ b/chrome/browser/paint_preview/services/paint_preview_tab_service.cc
@@ -264,7 +264,7 @@
void PaintPreviewTabService::CaptureTabInternal(
base::WeakPtr<TabServiceTask> task,
bool accessibility_enabled,
- const base::Optional<base::FilePath>& file_path) {
+ const absl::optional<base::FilePath>& file_path) {
if (!task) {
return;
}
diff --git a/chrome/browser/paint_preview/services/paint_preview_tab_service.h b/chrome/browser/paint_preview/services/paint_preview_tab_service.h
index c29721e17..5d84d0b 100644
--- a/chrome/browser/paint_preview/services/paint_preview_tab_service.h
+++ b/chrome/browser/paint_preview/services/paint_preview_tab_service.h
@@ -14,7 +14,6 @@
#include "base/files/file_path.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/strings/string_piece.h"
#include "build/build_config.h"
@@ -22,6 +21,7 @@
#include "components/paint_preview/browser/paint_preview_policy.h"
#include "components/paint_preview/common/proto/paint_preview.pb.h"
#include "content/public/browser/global_routing_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if defined(os_android)
#include "base/android/jni_android.h"
@@ -172,7 +172,7 @@
// The FTN ID is to look-up the content::WebContents.
void CaptureTabInternal(base::WeakPtr<TabServiceTask> task,
bool accessibility_enabled,
- const base::Optional<base::FilePath>& file_path);
+ const absl::optional<base::FilePath>& file_path);
void OnAXTreeWritten(base::WeakPtr<TabServiceTask> task, bool result);
diff --git a/chrome/browser/paint_preview/services/paint_preview_tab_service_file_mixin.cc b/chrome/browser/paint_preview/services/paint_preview_tab_service_file_mixin.cc
index b138729..adb5759 100644
--- a/chrome/browser/paint_preview/services/paint_preview_tab_service_file_mixin.cc
+++ b/chrome/browser/paint_preview/services/paint_preview_tab_service_file_mixin.cc
@@ -16,7 +16,7 @@
void PaintPreviewTabServiceFileMixin::GetCapturedPaintPreviewProto(
const DirectoryKey& key,
- base::Optional<base::TimeDelta> expiry_horizon,
+ absl::optional<base::TimeDelta> expiry_horizon,
OnReadProtoCallback on_read_proto_callback) {
PaintPreviewFileMixin::GetCapturedPaintPreviewProto(
key,
diff --git a/chrome/browser/paint_preview/services/paint_preview_tab_service_file_mixin.h b/chrome/browser/paint_preview/services/paint_preview_tab_service_file_mixin.h
index 9099f11..91499e85 100644
--- a/chrome/browser/paint_preview/services/paint_preview_tab_service_file_mixin.h
+++ b/chrome/browser/paint_preview/services/paint_preview_tab_service_file_mixin.h
@@ -23,7 +23,7 @@
// hrs if not specified.
void GetCapturedPaintPreviewProto(
const DirectoryKey& key,
- base::Optional<base::TimeDelta> expiry_horizon,
+ absl::optional<base::TimeDelta> expiry_horizon,
OnReadProtoCallback on_read_proto_callback) override;
// The time horizon after which unused paint previews will be deleted.
diff --git a/chrome/browser/paint_preview/services/paint_preview_tab_service_unittest.cc b/chrome/browser/paint_preview/services/paint_preview_tab_service_unittest.cc
index c2d2b048..f655e6b1 100644
--- a/chrome/browser/paint_preview/services/paint_preview_tab_service_unittest.cc
+++ b/chrome/browser/paint_preview/services/paint_preview_tab_service_unittest.cc
@@ -232,7 +232,7 @@
base::BindOnce(&FileManager::CreateOrGetDirectory, file_manager, key,
false),
base::BindOnce(
- [](base::FilePath* out, const base::Optional<base::FilePath>& path) {
+ [](base::FilePath* out, const absl::optional<base::FilePath>& path) {
EXPECT_TRUE(path.has_value());
*out = path.value();
},
@@ -257,7 +257,7 @@
base::BindOnce(&FileManager::CreateOrGetDirectory, file_manager, key,
false),
base::BindOnce(
- [](base::FilePath* out, const base::Optional<base::FilePath>& path) {
+ [](base::FilePath* out, const absl::optional<base::FilePath>& path) {
EXPECT_TRUE(path.has_value());
*out = path.value();
},
diff --git a/chrome/browser/password_check/android/password_check_manager.h b/chrome/browser/password_check/android/password_check_manager.h
index 72da8218..4e75122 100644
--- a/chrome/browser/password_check/android/password_check_manager.h
+++ b/chrome/browser/password_check/android/password_check_manager.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_PASSWORD_CHECK_ANDROID_PASSWORD_CHECK_MANAGER_H_
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/strings/string_piece_forward.h"
#include "chrome/browser/password_check/android/password_check_ui_status.h"
@@ -21,6 +20,7 @@
#include "components/password_manager/core/browser/ui/bulk_leak_check_service_adapter.h"
#include "components/password_manager/core/browser/ui/insecure_credentials_manager.h"
#include "components/password_manager/core/browser/ui/saved_passwords_presenter.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PasswordCheckManager
: public password_manager::SavedPasswordsPresenter::Observer,
@@ -262,7 +262,7 @@
// Latest number of changed compromised credentials while script fetching
// was running. If `credentials_count_to_notify_` has value, after scripts are
// fetched `onCompromisedCredentials` should be called.
- base::Optional<size_t> credentials_count_to_notify_;
+ absl::optional<size_t> credentials_count_to_notify_;
// Used to open the view/edit/delete UI.
std::unique_ptr<CredentialEditBridge> credential_edit_bridge_;
diff --git a/chrome/browser/password_check/android/password_check_manager_unittest.cc b/chrome/browser/password_check/android/password_check_manager_unittest.cc
index 8b70376..42b7c35 100644
--- a/chrome/browser/password_check/android/password_check_manager_unittest.cc
+++ b/chrome/browser/password_check/android/password_check_manager_unittest.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
@@ -36,6 +35,7 @@
#include "services/network/test/test_shared_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using password_manager::BulkLeakCheckService;
using password_manager::InsecureCredential;
@@ -178,8 +178,8 @@
const std::u16string& display_username,
const std::u16string& display_origin,
const GURL& url,
- const base::Optional<std::string>& package_name,
- const base::Optional<std::string>& change_password_url,
+ const absl::optional<std::string>& package_name,
+ const absl::optional<std::string>& change_password_url,
InsecureCredentialTypeFlags insecure_type,
bool has_startable_script,
bool has_auto_change_button) {
@@ -346,7 +346,7 @@
RunUntilIdle();
EXPECT_THAT(manager().GetCompromisedCredentials(),
ElementsAre(ExpectCompromisedCredentialForUI(
- kUsername1, u"example.com", GURL(kExampleCom), base::nullopt,
+ kUsername1, u"example.com", GURL(kExampleCom), absl::nullopt,
"https://example.com/.well-known/change-password",
InsecureCredentialTypeFlags::kCredentialLeaked,
/*has_startable_script=*/false,
@@ -372,13 +372,13 @@
UnorderedElementsAre(
ExpectCompromisedCredentialForUI(
kUsername1, u"App (com.example.app)", GURL::EmptyGURL(),
- "com.example.app", base::nullopt,
+ "com.example.app", absl::nullopt,
InsecureCredentialTypeFlags::kCredentialLeaked,
/*has_startable_script=*/false,
/*has_auto_change_button=*/false),
ExpectCompromisedCredentialForUI(
kUsername2, u"Example App", GURL(kExampleCom), "com.example.app",
- base::nullopt, InsecureCredentialTypeFlags::kCredentialLeaked,
+ absl::nullopt, InsecureCredentialTypeFlags::kCredentialLeaked,
/*has_startable_script=*/false,
/*has_auto_change_button=*/false)));
}
@@ -434,7 +434,7 @@
EXPECT_CALL(fetcher(), IsScriptAvailable).Times(0);
EXPECT_THAT(manager().GetCompromisedCredentials(),
ElementsAre(ExpectCompromisedCredentialForUI(
- kUsername1, u"example.com", GURL(kExampleCom), base::nullopt,
+ kUsername1, u"example.com", GURL(kExampleCom), absl::nullopt,
"https://example.com/.well-known/change-password",
InsecureCredentialTypeFlags::kCredentialLeaked,
/*has_startable_script=*/false,
@@ -464,7 +464,7 @@
EXPECT_CALL(fetcher(), IsScriptAvailable).WillOnce(Return(true));
EXPECT_THAT(manager().GetCompromisedCredentials(),
ElementsAre(ExpectCompromisedCredentialForUI(
- kUsername1, u"example.com", GURL(kExampleCom), base::nullopt,
+ kUsername1, u"example.com", GURL(kExampleCom), absl::nullopt,
"https://example.com/.well-known/change-password",
InsecureCredentialTypeFlags::kCredentialLeaked,
/*has_startable_script=*/true,
@@ -496,7 +496,7 @@
EXPECT_THAT(
manager().GetCompromisedCredentials(),
ElementsAre(ExpectCompromisedCredentialForUI(
- u"No username", u"example.com", GURL(kExampleCom), base::nullopt,
+ u"No username", u"example.com", GURL(kExampleCom), absl::nullopt,
"https://example.com/.well-known/change-password",
InsecureCredentialTypeFlags::kCredentialLeaked,
/*has_startable_script=*/false,
@@ -529,7 +529,7 @@
EXPECT_CALL(fetcher(), IsScriptAvailable).WillOnce(Return(true));
EXPECT_THAT(manager().GetCompromisedCredentials(),
ElementsAre(ExpectCompromisedCredentialForUI(
- kUsername1, u"example.com", GURL(kExampleCom), base::nullopt,
+ kUsername1, u"example.com", GURL(kExampleCom), absl::nullopt,
"https://example.com/.well-known/change-password",
InsecureCredentialTypeFlags::kCredentialLeaked,
/*has_startable_script=*/true,
@@ -560,7 +560,7 @@
EXPECT_CALL(fetcher(), IsScriptAvailable).WillOnce(Return(false));
EXPECT_THAT(manager().GetCompromisedCredentials(),
ElementsAre(ExpectCompromisedCredentialForUI(
- kUsername1, u"example.com", GURL(kExampleCom), base::nullopt,
+ kUsername1, u"example.com", GURL(kExampleCom), absl::nullopt,
"https://example.com/.well-known/change-password",
InsecureCredentialTypeFlags::kCredentialLeaked,
/*has_startable_script=*/false,
diff --git a/chrome/browser/password_manager/android/all_passwords_bottom_sheet_helper.h b/chrome/browser/password_manager/android/all_passwords_bottom_sheet_helper.h
index c74bfea8..d8aeb21 100644
--- a/chrome/browser/password_manager/android/all_passwords_bottom_sheet_helper.h
+++ b/chrome/browser/password_manager/android/all_passwords_bottom_sheet_helper.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_PASSWORD_MANAGER_ANDROID_ALL_PASSWORDS_BOTTOM_SHEET_HELPER_H_
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "components/autofill/core/common/mojom/autofill_types.mojom-shared.h"
#include "components/password_manager/core/browser/password_store_consumer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// This class helps to determine the visibility of the "All Passwords Sheet"
// button by requesting whether there are any passwords stored at all.
@@ -27,7 +27,7 @@
// Returns the number of found credentials only if the helper already finished
// querying the password store.
- base::Optional<size_t> available_credentials() const {
+ absl::optional<size_t> available_credentials() const {
return available_credentials_;
}
@@ -47,7 +47,7 @@
base::OnceClosure update_callback_;
// Stores whether the store returned credentials the sheet can show.
- base::Optional<size_t> available_credentials_ = base::nullopt;
+ absl::optional<size_t> available_credentials_ = absl::nullopt;
// Records the last focused field type to infer whether an update should be
// triggered if the store returns suggestions.
diff --git a/chrome/browser/password_manager/android/generated_password_saved_message_delegate_unittest.cc b/chrome/browser/password_manager/android/generated_password_saved_message_delegate_unittest.cc
index c3cedb9..31c61a7 100644
--- a/chrome/browser/password_manager/android/generated_password_saved_message_delegate_unittest.cc
+++ b/chrome/browser/password_manager/android/generated_password_saved_message_delegate_unittest.cc
@@ -88,7 +88,7 @@
void GeneratedPasswordSavedMessageDelegateTest::EnqueueMessage(
std::unique_ptr<PasswordFormManagerForUI> form_to_save) {
- base::Optional<AccountInfo> account_info;
+ absl::optional<AccountInfo> account_info;
account_info = AccountInfo();
account_info.value().email = base::UTF16ToASCII(kAccountEmail);
EXPECT_CALL(message_dispatcher_bridge_, EnqueueMessage);
diff --git a/chrome/browser/password_manager/android/password_accessory_controller_impl.cc b/chrome/browser/password_manager/android/password_accessory_controller_impl.cc
index 8ef15e0..c039226 100644
--- a/chrome/browser/password_manager/android/password_accessory_controller_impl.cc
+++ b/chrome/browser/password_manager/android/password_accessory_controller_impl.cc
@@ -14,7 +14,6 @@
#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/autofill/manual_filling_controller.h"
@@ -48,6 +47,7 @@
#include "components/strings/grit/components_strings.h"
#include "components/url_formatter/elide_url.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
using autofill::AccessorySheetData;
@@ -106,21 +106,21 @@
source_observer_ = std::move(observer);
}
-base::Optional<autofill::AccessorySheetData>
+absl::optional<autofill::AccessorySheetData>
PasswordAccessoryControllerImpl::GetSheetData() const {
// Prevent crashing by returning a nullopt if no field was focused yet or if
// the frame was (possibly temporarily) unfocused. This signals to the caller
// that no sheet is available right now.
if (web_contents_->GetFocusedFrame() == nullptr)
- return base::nullopt;
+ return absl::nullopt;
if (!last_focused_field_info_)
- return base::nullopt;
+ return absl::nullopt;
url::Origin origin = GetFocusedFrameOrigin();
// If the focused origin doesn't match the last known origin, it is not safe
// to provide any suggestions (because e.g. information about field type isn't
// reliable).
if (!last_focused_field_info_->origin.IsSameOriginWith(origin))
- return base::nullopt;
+ return absl::nullopt;
std::vector<UserInfo> info_to_add;
std::vector<FooterCommand> footer_commands_to_add;
@@ -337,7 +337,7 @@
bool is_manual_generation_available) {
// Discard all frame data. This ensures that the data is never used for an
// incorrect frame.
- last_focused_field_info_ = base::nullopt;
+ last_focused_field_info_ = absl::nullopt;
all_passwords_helper_.SetLastFocusedFieldType(focused_field_type);
// Prevent crashing by not acting at all if frame became unfocused at any
@@ -375,7 +375,7 @@
source_observer_.Run(this, IsFillingSourceAvailable(
autofill::IsFillable(focused_field_type)));
} else {
- base::Optional<AccessorySheetData> data = GetSheetData();
+ absl::optional<AccessorySheetData> data = GetSheetData();
DCHECK(data.has_value());
GetManualFillingController()->RefreshSuggestions(std::move(data.value()));
}
diff --git a/chrome/browser/password_manager/android/password_accessory_controller_impl.h b/chrome/browser/password_manager/android/password_accessory_controller_impl.h
index 74fc979..ed52e25d 100644
--- a/chrome/browser/password_manager/android/password_accessory_controller_impl.h
+++ b/chrome/browser/password_manager/android/password_accessory_controller_impl.h
@@ -43,7 +43,7 @@
// AccessoryController:
void RegisterFillingSourceObserver(FillingSourceObserver observer) override;
- base::Optional<autofill::AccessorySheetData> GetSheetData() const override;
+ absl::optional<autofill::AccessorySheetData> GetSheetData() const override;
void OnFillingTriggered(autofill::FieldGlobalId focused_field_id,
const autofill::UserInfo::Field& selection) override;
void OnOptionSelected(autofill::AccessoryAction selected_action) override;
@@ -168,9 +168,9 @@
// Information about the currently focused field. This is the only place
// allowed to store frame-specific data. If a new field is focused or focus is
- // lost, this data needs to be reset to base::nullopt to make sure that data
+ // lost, this data needs to be reset to absl::nullopt to make sure that data
// related to a former frame isn't displayed incorrectly in a different one.
- base::Optional<LastFocusedFieldInfo> last_focused_field_info_ = base::nullopt;
+ absl::optional<LastFocusedFieldInfo> last_focused_field_info_ = absl::nullopt;
// The observer to notify if available suggestions change.
FillingSourceObserver source_observer_;
diff --git a/chrome/browser/password_manager/android/password_generation_controller_impl_unittest.cc b/chrome/browser/password_manager/android/password_generation_controller_impl_unittest.cc
index 2878b5e..7e381b0 100644
--- a/chrome/browser/password_manager/android/password_generation_controller_impl_unittest.cc
+++ b/chrome/browser/password_manager/android/password_generation_controller_impl_unittest.cc
@@ -8,7 +8,6 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
@@ -28,6 +27,7 @@
#include "components/password_manager/core/browser/stub_password_manager_driver.h"
#include "content/public/browser/web_contents.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using autofill::password_generation::PasswordGenerationType;
using password_manager::metrics_util::GenerationDialogChoice;
diff --git a/chrome/browser/password_manager/android/password_infobar_utils.cc b/chrome/browser/password_manager/android/password_infobar_utils.cc
index e6d4739..91fa6c87 100644
--- a/chrome/browser/password_manager/android/password_infobar_utils.cc
+++ b/chrome/browser/password_manager/android/password_infobar_utils.cc
@@ -12,7 +12,7 @@
#include "components/signin/public/identity_manager/identity_manager.h"
namespace password_manager {
-base::Optional<AccountInfo> GetAccountInfoForPasswordInfobars(Profile* profile,
+absl::optional<AccountInfo> GetAccountInfoForPasswordInfobars(Profile* profile,
bool is_syncing) {
DCHECK(profile);
if (!base::FeatureList::IsEnabled(
@@ -22,13 +22,13 @@
!base::FeatureList::IsEnabled(
autofill::features::
kAutofillEnableInfoBarAccountIndicationFooterForSyncUsers)) {
- return base::nullopt;
+ return absl::nullopt;
}
signin::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(profile);
CoreAccountId account_id =
identity_manager->GetPrimaryAccountId(signin::ConsentLevel::kSync);
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByAccountId(
account_id);
@@ -42,14 +42,14 @@
kAutofillEnableInfoBarAccountIndicationFooterForSingleAccountUsers)) &&
account_info.has_value();
- return should_show_account_footer ? account_info : base::nullopt;
+ return should_show_account_footer ? account_info : absl::nullopt;
}
-base::Optional<AccountInfo> GetAccountInfoForPasswordMessages(Profile* profile,
+absl::optional<AccountInfo> GetAccountInfoForPasswordMessages(Profile* profile,
bool is_syncing) {
DCHECK(profile);
if (!is_syncing)
- return base::nullopt;
+ return absl::nullopt;
signin::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(profile);
diff --git a/chrome/browser/password_manager/android/password_infobar_utils.h b/chrome/browser/password_manager/android/password_infobar_utils.h
index 41acdfa8..7f6565a 100644
--- a/chrome/browser/password_manager/android/password_infobar_utils.h
+++ b/chrome/browser/password_manager/android/password_infobar_utils.h
@@ -11,10 +11,10 @@
namespace password_manager {
-base::Optional<AccountInfo> GetAccountInfoForPasswordInfobars(Profile* profile,
+absl::optional<AccountInfo> GetAccountInfoForPasswordInfobars(Profile* profile,
bool is_syncing);
-base::Optional<AccountInfo> GetAccountInfoForPasswordMessages(Profile* profile,
+absl::optional<AccountInfo> GetAccountInfoForPasswordMessages(Profile* profile,
bool is_syncing);
} // namespace password_manager
diff --git a/chrome/browser/password_manager/android/save_password_infobar_delegate_android.cc b/chrome/browser/password_manager/android/save_password_infobar_delegate_android.cc
index 45089a2..f7a0bd53 100644
--- a/chrome/browser/password_manager/android/save_password_infobar_delegate_android.cc
+++ b/chrome/browser/password_manager/android/save_password_infobar_delegate_android.cc
@@ -51,7 +51,7 @@
SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() {
password_manager::metrics_util::LogSaveUIDismissalReason(
- infobar_response_, /*user_state=*/base::nullopt);
+ infobar_response_, /*user_state=*/absl::nullopt);
if (form_to_save_->WasUnblocklisted()) {
password_manager::metrics_util::LogSaveUIDismissalReasonAfterUnblocklisting(
infobar_response_);
diff --git a/chrome/browser/password_manager/android/save_password_message_delegate.cc b/chrome/browser/password_manager/android/save_password_message_delegate.cc
index 1f6818d..8e020a3 100644
--- a/chrome/browser/password_manager/android/save_password_message_delegate.cc
+++ b/chrome/browser/password_manager/android/save_password_message_delegate.cc
@@ -51,7 +51,7 @@
password_bubble_experiment::IsSmartLockUser(
ProfileSyncServiceFactory::GetForProfile(profile));
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
password_manager::GetAccountInfoForPasswordMessages(
profile, is_saving_google_account);
DisplaySavePasswordPromptInternal(web_contents, std::move(form_to_save),
@@ -76,7 +76,7 @@
void SavePasswordMessageDelegate::DisplaySavePasswordPromptInternal(
content::WebContents* web_contents,
std::unique_ptr<password_manager::PasswordFormManagerForUI> form_to_save,
- base::Optional<AccountInfo> account_info,
+ absl::optional<AccountInfo> account_info,
bool update_password) {
// Dismiss previous message if it is displayed.
DismissSavePasswordPrompt();
@@ -292,7 +292,7 @@
void SavePasswordMessageDelegate::RecordDismissalReasonMetrics(
password_manager::metrics_util::UIDismissalReason ui_dismissal_reason) {
password_manager::metrics_util::LogSaveUIDismissalReason(
- ui_dismissal_reason, /*user_state=*/base::nullopt);
+ ui_dismissal_reason, /*user_state=*/absl::nullopt);
if (passwords_state_.form_manager()->WasUnblocklisted()) {
password_manager::metrics_util::LogSaveUIDismissalReasonAfterUnblocklisting(
ui_dismissal_reason);
diff --git a/chrome/browser/password_manager/android/save_password_message_delegate.h b/chrome/browser/password_manager/android/save_password_message_delegate.h
index aa44e8f..79df0be 100644
--- a/chrome/browser/password_manager/android/save_password_message_delegate.h
+++ b/chrome/browser/password_manager/android/save_password_message_delegate.h
@@ -8,7 +8,6 @@
#include <memory>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/password_edit_dialog/android/password_edit_dialog_bridge.h"
#include "chrome/browser/ui/passwords/manage_passwords_state.h"
#include "components/messages/android/message_enums.h"
@@ -16,6 +15,7 @@
#include "components/password_manager/core/browser/password_form_manager_for_ui.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
#include "components/signin/public/identity_manager/account_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -59,7 +59,7 @@
void DisplaySavePasswordPromptInternal(
content::WebContents* web_contents,
std::unique_ptr<password_manager::PasswordFormManagerForUI> form_to_save,
- base::Optional<AccountInfo> account_info,
+ absl::optional<AccountInfo> account_info,
bool update_password);
void CreateMessage(bool update_password);
diff --git a/chrome/browser/password_manager/android/save_password_message_delegate_unittest.cc b/chrome/browser/password_manager/android/save_password_message_delegate_unittest.cc
index b0d915e..fa434322 100644
--- a/chrome/browser/password_manager/android/save_password_message_delegate_unittest.cc
+++ b/chrome/browser/password_manager/android/save_password_message_delegate_unittest.cc
@@ -187,7 +187,7 @@
std::unique_ptr<PasswordFormManagerForUI> form_to_save,
bool user_signed_in,
bool update_password) {
- base::Optional<AccountInfo> account_info;
+ absl::optional<AccountInfo> account_info;
if (user_signed_in) {
account_info = AccountInfo();
account_info.value().email = kAccountEmail;
diff --git a/chrome/browser/password_manager/biometric_authenticator_android.cc b/chrome/browser/password_manager/biometric_authenticator_android.cc
index 5c330486..5839bca7 100644
--- a/chrome/browser/password_manager/biometric_authenticator_android.cc
+++ b/chrome/browser/password_manager/biometric_authenticator_android.cc
@@ -13,7 +13,6 @@
#include "base/callback_helpers.h"
#include "base/feature_list.h"
#include "base/location.h"
-#include "base/optional.h"
#include "chrome/browser/password_manager/android/jni_headers/BiometricAuthenticatorBridge_jni.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/password_manager/core/browser/biometric_authenticator.h"
@@ -22,6 +21,7 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/android/view_android.h"
using base::android::AttachCurrentThread;
@@ -83,7 +83,7 @@
if (!requester_.has_value() || requester != requester_.value())
return;
callback_.Reset();
- requester_ = base::nullopt;
+ requester_ = absl::nullopt;
Java_BiometricAuthenticatorBridge_cancel(AttachCurrentThread(), java_object_);
}
@@ -93,5 +93,5 @@
if (callback_.is_null())
return;
std::move(callback_).Run(success);
- requester_ = base::nullopt;
+ requester_ = absl::nullopt;
}
diff --git a/chrome/browser/password_manager/biometric_authenticator_android.h b/chrome/browser/password_manager/biometric_authenticator_android.h
index 34b9088..6c41bd7 100644
--- a/chrome/browser/password_manager/biometric_authenticator_android.h
+++ b/chrome/browser/password_manager/biometric_authenticator_android.h
@@ -6,10 +6,10 @@
#define CHROME_BROWSER_PASSWORD_MANAGER_BIOMETRIC_AUTHENTICATOR_ANDROID_H_
#include "base/android/scoped_java_ref.h"
-#include "base/optional.h"
#include "chrome/browser/password_manager/chrome_biometric_authenticator.h"
#include "components/password_manager/core/browser/biometric_authenticator.h"
#include "components/password_manager/core/browser/origin_credential_store.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/android/window_android.h"
// Android implementation of the BiometricAuthenticator interface.
@@ -42,7 +42,7 @@
// Enum value representing the filling surface that has requested the current
// authentication.
- base::Optional<password_manager::BiometricAuthRequester> requester_;
+ absl::optional<password_manager::BiometricAuthRequester> requester_;
// This object is an instance of BiometricAuthenticatorBridge, i.e. the Java
// counterpart to this class.
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc
index 412a40f1..fb7d2e8f 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -1422,7 +1422,7 @@
void ChromePasswordManagerClient::GenerationResultAvailable(
PasswordGenerationType type,
base::WeakPtr<password_manager::ContentPasswordManagerDriver> driver,
- const base::Optional<
+ const absl::optional<
autofill::password_generation::PasswordGenerationUIData>& ui_data) {
if (!ui_data || !driver)
return;
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.h b/chrome/browser/password_manager/chrome_password_manager_client.h
index f79a72f2..bc46fd7 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client.h
+++ b/chrome/browser/password_manager/chrome_password_manager_client.h
@@ -13,7 +13,6 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/autofill/content/common/mojom/autofill_driver.mojom-forward.h"
@@ -41,6 +40,7 @@
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_receiver_set.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "url/origin.h"
@@ -326,7 +326,7 @@
void GenerationResultAvailable(
autofill::password_generation::PasswordGenerationType type,
base::WeakPtr<password_manager::ContentPasswordManagerDriver> driver,
- const base::Optional<
+ const absl::optional<
autofill::password_generation::PasswordGenerationUIData>& ui_data);
void ShowPasswordGenerationPopup(
@@ -405,7 +405,7 @@
// Recorder of metrics that is associated with the last committed navigation
// of the WebContents owning this ChromePasswordManagerClient. May be unset at
// times. Sends statistics on destruction.
- base::Optional<password_manager::PasswordManagerMetricsRecorder>
+ absl::optional<password_manager::PasswordManagerMetricsRecorder>
metrics_recorder_;
// Whether navigator.credentials.store() was ever called from this
diff --git a/chrome/browser/password_manager/multi_profile_credentials_filter.cc b/chrome/browser/password_manager/multi_profile_credentials_filter.cc
index ccbc842..be31eec 100644
--- a/chrome/browser/password_manager/multi_profile_credentials_filter.cc
+++ b/chrome/browser/password_manager/multi_profile_credentials_filter.cc
@@ -5,11 +5,11 @@
#include "chrome/browser/password_manager/multi_profile_credentials_filter.h"
#include "base/feature_list.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/signin/dice_web_signin_interceptor.h"
#include "chrome/browser/signin/signin_features.h"
#include "components/password_manager/core/browser/password_sync_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
MultiProfileCredentialsFilter::MultiProfileCredentialsFilter(
password_manager::PasswordManagerClient* client,
@@ -44,7 +44,7 @@
// moved to another profile. If the interception outcome is not available,
// then signin interception is very likely, and the password bubble is
// suppressed as well.
- base::Optional<SigninInterceptionHeuristicOutcome> heuristic_outcome =
+ absl::optional<SigninInterceptionHeuristicOutcome> heuristic_outcome =
dice_web_signin_interceptor_->GetHeuristicOutcome(
// At this time, it's not possible to know whether the account is new
// (whether it's a reauth). To be conservative and avoid showing both
diff --git a/chrome/browser/password_manager/password_manager_signin_intercept_test_helper.cc b/chrome/browser/password_manager/password_manager_signin_intercept_test_helper.cc
index 27186a3..51438b8 100644
--- a/chrome/browser/password_manager/password_manager_signin_intercept_test_helper.cc
+++ b/chrome/browser/password_manager/password_manager_signin_intercept_test_helper.cc
@@ -6,7 +6,6 @@
#include "base/check.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/password_manager/password_manager_test_base.h"
@@ -30,6 +29,7 @@
#include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/gaia_switches.h"
#include "google_apis/gaia/gaia_urls.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
@@ -107,7 +107,7 @@
profile_storage->AddProfile(std::move(params));
// Check that the signin qualifies for interception.
- base::Optional<SigninInterceptionHeuristicOutcome> outcome =
+ absl::optional<SigninInterceptionHeuristicOutcome> outcome =
GetSigninInterceptor(current_profile)
->GetHeuristicOutcome(
/*is_new_account=*/true, /*is_sync_signin=*/false, kGaiaUsername);
diff --git a/chrome/browser/password_manager/password_manager_test_base.cc b/chrome/browser/password_manager/password_manager_test_base.cc
index 90e74002..f932c1d 100644
--- a/chrome/browser/password_manager/password_manager_test_base.cc
+++ b/chrome/browser/password_manager/password_manager_test_base.cc
@@ -13,7 +13,6 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/password_manager/account_password_store_factory.h"
@@ -42,6 +41,7 @@
#include "net/http/transport_security_state.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/switches.h"
namespace {
@@ -113,7 +113,7 @@
base::RunLoop* run_loop_;
// The state CustomManagePasswordsUIController is currently waiting for.
- base::Optional<password_manager::ui::State> target_state_;
+ absl::optional<password_manager::ui::State> target_state_;
// True iff showing fallback is waited.
bool wait_for_fallback_;
diff --git a/chrome/browser/password_manager/password_store_utils.cc b/chrome/browser/password_manager/password_store_utils.cc
index 0f17dee..649086b 100644
--- a/chrome/browser/password_manager/password_store_utils.cc
+++ b/chrome/browser/password_manager/password_store_utils.cc
@@ -22,7 +22,7 @@
const base::span<const std::unique_ptr<password_manager::PasswordForm>>
forms_to_change,
const std::u16string& new_username,
- const base::Optional<std::u16string>& new_password) {
+ const absl::optional<std::u16string>& new_password) {
DCHECK(!forms_to_change.empty());
const std::string signon_realm = forms_to_change[0]->signon_realm;
diff --git a/chrome/browser/password_manager/password_store_utils.h b/chrome/browser/password_manager/password_store_utils.h
index a4fdb88..a02146d5 100644
--- a/chrome/browser/password_manager/password_store_utils.h
+++ b/chrome/browser/password_manager/password_store_utils.h
@@ -11,7 +11,7 @@
#include "base/containers/span.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace password_manager {
class PasswordStore;
@@ -30,7 +30,7 @@
base::span<const std::unique_ptr<password_manager::PasswordForm>>
forms_to_change,
const std::u16string& new_username,
- const base::Optional<std::u16string>& new_password);
+ const absl::optional<std::u16string>& new_password);
// Returns the password store associated with the currently active profile.
scoped_refptr<password_manager::PasswordStore> GetPasswordStore(
diff --git a/chrome/browser/payments/chrome_payment_request_delegate.cc b/chrome/browser/payments/chrome_payment_request_delegate.cc
index 1ba576e..cddf7f07c 100644
--- a/chrome/browser/payments/chrome_payment_request_delegate.cc
+++ b/chrome/browser/payments/chrome_payment_request_delegate.cc
@@ -284,7 +284,7 @@
if (!apk_web_app_service)
return "";
- base::Optional<std::string> twa_package_name =
+ absl::optional<std::string> twa_package_name =
apk_web_app_service->GetPackageNameForWebApp(
web_contents->GetLastCommittedURL());
diff --git a/chrome/browser/pdf/pdf_extension_test.cc b/chrome/browser/pdf/pdf_extension_test.cc
index 0603762..c6510628 100644
--- a/chrome/browser/pdf/pdf_extension_test.cc
+++ b/chrome/browser/pdf/pdf_extension_test.cc
@@ -2985,11 +2985,11 @@
void RunTest(const base::FilePath& test_file_path, const char* file_dir) {
// Load the expectation file.
content::DumpAccessibilityTestHelper test_helper("content");
- base::Optional<base::FilePath> expected_file_path =
+ absl::optional<base::FilePath> expected_file_path =
test_helper.GetExpectationFilePath(test_file_path);
ASSERT_TRUE(expected_file_path) << "No expectation file present.";
- base::Optional<std::vector<std::string>> expected_lines =
+ absl::optional<std::vector<std::string>> expected_lines =
test_helper.LoadExpectationFile(*expected_file_path);
ASSERT_TRUE(expected_lines) << "Couldn't load expectation file.";
@@ -3249,7 +3249,7 @@
return;
}
- base::Optional<std::vector<std::string>> expected_lines =
+ absl::optional<std::vector<std::string>> expected_lines =
test_helper_.LoadExpectationFile(expected_file_path);
if (!expected_lines) {
LOG(INFO) << "Skipping this test on this platform.";
diff --git a/chrome/browser/performance_hints/performance_hints_observer.cc b/chrome/browser/performance_hints/performance_hints_observer.cc
index df1aab4..186bef8a 100644
--- a/chrome/browser/performance_hints/performance_hints_observer.cc
+++ b/chrome/browser/performance_hints/performance_hints_observer.cc
@@ -231,7 +231,7 @@
return result;
}
- base::Optional<GURL> maybe_rewritten;
+ absl::optional<GURL> maybe_rewritten;
if (features::ShouldHandleRewrites()) {
maybe_rewritten = rewrite_handler_.HandleRewriteIfNecessary(url);
result.rewritten = maybe_rewritten.has_value();
@@ -250,7 +250,7 @@
using LookupFn = base::OnceCallback<std::tuple<
SourceLookupStatus,
- base::Optional<optimization_guide::proto::PerformanceHint>>(const GURL&)>;
+ absl::optional<optimization_guide::proto::PerformanceHint>>(const GURL&)>;
std::vector<std::tuple<HintLookupSource, LookupFn>> sources;
sources.emplace_back(HintLookupSource::kLinkHint,
@@ -315,7 +315,7 @@
nullptr;
// Metadata variables are scoped here to share the same scope as link_hints.
optimization_guide::OptimizationMetadata metadata;
- base::Optional<LinkPerformanceMetadata> link_metadata;
+ absl::optional<LinkPerformanceMetadata> link_metadata;
if (features::AreLinkPerformanceHintsEnabled()) {
link_hints_decision_ = optimization_guide_decider_->CanApplyOptimization(
page_url_.value(), optimization_guide::proto::LINK_PERFORMANCE,
@@ -344,10 +344,10 @@
}
std::tuple<PerformanceHintsObserver::SourceLookupStatus,
- base::Optional<optimization_guide::proto::PerformanceHint>>
+ absl::optional<optimization_guide::proto::PerformanceHint>>
PerformanceHintsObserver::LinkHintForURL(const GURL& url) {
if (!optimization_guide_decider_) {
- return {SourceLookupStatus::kNoMatch, base::nullopt};
+ return {SourceLookupStatus::kNoMatch, absl::nullopt};
}
if (link_hints_decision_ == OptimizationGuideDecision::kUnknown) {
@@ -355,9 +355,9 @@
}
switch (link_hints_decision_) {
case OptimizationGuideDecision::kUnknown:
- return {SourceLookupStatus::kNotReady, base::nullopt};
+ return {SourceLookupStatus::kNotReady, absl::nullopt};
case OptimizationGuideDecision::kFalse:
- return {SourceLookupStatus::kNoMatch, base::nullopt};
+ return {SourceLookupStatus::kNoMatch, absl::nullopt};
case OptimizationGuideDecision::kTrue: {
// Link hints only contain scheme, host, and path, so remove other
// components.
@@ -374,16 +374,16 @@
return {SourceLookupStatus::kHintFound, pattern_hint.second};
}
}
- return {SourceLookupStatus::kNoMatch, base::nullopt};
+ return {SourceLookupStatus::kNoMatch, absl::nullopt};
}
}
}
std::tuple<PerformanceHintsObserver::SourceLookupStatus,
- base::Optional<optimization_guide::proto::PerformanceHint>>
+ absl::optional<optimization_guide::proto::PerformanceHint>>
PerformanceHintsObserver::PageHintForURL(const GURL& url) const {
if (!optimization_guide_decider_) {
- return {SourceLookupStatus::kNoMatch, base::nullopt};
+ return {SourceLookupStatus::kNoMatch, absl::nullopt};
}
// Check to see if there happens to be a cached hint for the site that this
@@ -394,7 +394,7 @@
optimization_guide_decider_->CanApplyOptimization(
url, optimization_guide::proto::PERFORMANCE_HINTS, &metadata);
if (decision == OptimizationGuideDecision::kUnknown) {
- return {SourceLookupStatus::kNotReady, base::nullopt};
+ return {SourceLookupStatus::kNotReady, absl::nullopt};
} else if (decision == OptimizationGuideDecision::kTrue &&
metadata.performance_hints_metadata() &&
metadata.performance_hints_metadata()->has_page_hint()) {
@@ -402,14 +402,14 @@
metadata.performance_hints_metadata()->page_hint()};
}
- return {SourceLookupStatus::kNoMatch, base::nullopt};
+ return {SourceLookupStatus::kNoMatch, absl::nullopt};
}
std::tuple<PerformanceHintsObserver::SourceLookupStatus,
- base::Optional<optimization_guide::proto::PerformanceHint>>
+ absl::optional<optimization_guide::proto::PerformanceHint>>
PerformanceHintsObserver::FastHostHintForURL(const GURL& url) const {
if (!optimization_guide_decider_) {
- return {SourceLookupStatus::kNoMatch, base::nullopt};
+ return {SourceLookupStatus::kNoMatch, absl::nullopt};
}
OptimizationGuideDecision decision =
@@ -422,9 +422,9 @@
return {SourceLookupStatus::kHintFound, hint};
}
case OptimizationGuideDecision::kFalse:
- return {SourceLookupStatus::kNoMatch, base::nullopt};
+ return {SourceLookupStatus::kNoMatch, absl::nullopt};
case OptimizationGuideDecision::kUnknown:
- return {SourceLookupStatus::kNotReady, base::nullopt};
+ return {SourceLookupStatus::kNotReady, absl::nullopt};
}
}
diff --git a/chrome/browser/performance_hints/performance_hints_observer.h b/chrome/browser/performance_hints/performance_hints_observer.h
index 16e4b3c..3e53737e 100644
--- a/chrome/browser/performance_hints/performance_hints_observer.h
+++ b/chrome/browser/performance_hints/performance_hints_observer.h
@@ -12,7 +12,6 @@
#include "base/feature_list.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "chrome/browser/performance_hints/rewrite_handler.h"
#include "components/optimization_guide/content/browser/optimization_guide_decider.h"
@@ -20,6 +19,7 @@
#include "components/optimization_guide/proto/performance_hints_metadata.pb.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class NavigationHandle;
@@ -106,19 +106,19 @@
// Attempts to retrieve a PerformanceHint for |url| from the link hints of the
// current page.
std::tuple<SourceLookupStatus,
- base::Optional<optimization_guide::proto::PerformanceHint>>
+ absl::optional<optimization_guide::proto::PerformanceHint>>
LinkHintForURL(const GURL& url);
// Attempts to retrieve a PerformanceHint for |url| from the OptimizationGuide
// metadata for that URL.
std::tuple<SourceLookupStatus,
- base::Optional<optimization_guide::proto::PerformanceHint>>
+ absl::optional<optimization_guide::proto::PerformanceHint>>
PageHintForURL(const GURL& url) const;
// Attempts to retrieve a PerformanceHint for |url| from the fast host bloom
// filter.
std::tuple<SourceLookupStatus,
- base::Optional<optimization_guide::proto::PerformanceHint>>
+ absl::optional<optimization_guide::proto::PerformanceHint>>
FastHostHintForURL(const GURL& url) const;
// HintForURLStatus represents the overall lookup result for a given URL.
@@ -152,8 +152,8 @@
// True if the URL was rewritten before lookups were done. False otherwise.
bool rewritten = false;
// If status == kHintFound, this will contain the matching hint.
- base::Optional<optimization_guide::proto::PerformanceHint> hint =
- base::nullopt;
+ absl::optional<optimization_guide::proto::PerformanceHint> hint =
+ absl::nullopt;
};
// Fetches a PerformanceHint for the given |url|.
@@ -175,7 +175,7 @@
// The URL of the main frame of the associated WebContents. This is not set if
// the current page is an error page.
- base::Optional<GURL> page_url_;
+ absl::optional<GURL> page_url_;
// Link URLs that match |first| should use the Performance hint in |second|.
std::vector<std::pair<optimization_guide::URLPatternWithWildcards,
diff --git a/chrome/browser/performance_hints/rewrite_handler.cc b/chrome/browser/performance_hints/rewrite_handler.cc
index 96c3ec82..3b812a6 100644
--- a/chrome/browser/performance_hints/rewrite_handler.cc
+++ b/chrome/browser/performance_hints/rewrite_handler.cc
@@ -17,10 +17,10 @@
RewriteHandler::RewriteHandler(const RewriteHandler&) = default;
RewriteHandler::~RewriteHandler() = default;
-base::Optional<GURL> RewriteHandler::HandleRewriteIfNecessary(
+absl::optional<GURL> RewriteHandler::HandleRewriteIfNecessary(
const GURL& url) const {
if (!url.is_valid()) {
- return base::nullopt;
+ return absl::nullopt;
}
base::StringPiece host = url.host_piece();
@@ -42,10 +42,10 @@
return GURL(unescaped);
}
}
- return base::nullopt;
+ return absl::nullopt;
}
}
- return base::nullopt;
+ return absl::nullopt;
}
RewriteHandler RewriteHandler::FromConfigString(const std::string& config) {
diff --git a/chrome/browser/performance_hints/rewrite_handler.h b/chrome/browser/performance_hints/rewrite_handler.h
index 203c0a4..913f7b3 100644
--- a/chrome/browser/performance_hints/rewrite_handler.h
+++ b/chrome/browser/performance_hints/rewrite_handler.h
@@ -9,7 +9,7 @@
#include <string>
#include <vector>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
@@ -29,7 +29,7 @@
// If |url| matches one of the configured URLs, return the inner URL included
// in the query params. If the URL is invalid or doesn't match one of the
// configured URLs, return nullopt.
- base::Optional<GURL> HandleRewriteIfNecessary(const GURL& url) const;
+ absl::optional<GURL> HandleRewriteIfNecessary(const GURL& url) const;
// Creates a RewriteHandler that handles URLs of the forms provided by the
// config. If a syntax error prevents the config from being parsed, this will
diff --git a/chrome/browser/performance_hints/rewrite_handler_unittest.cc b/chrome/browser/performance_hints/rewrite_handler_unittest.cc
index 8776b5be..288c7a23 100644
--- a/chrome/browser/performance_hints/rewrite_handler_unittest.cc
+++ b/chrome/browser/performance_hints/rewrite_handler_unittest.cc
@@ -19,7 +19,7 @@
GURL url(
"https://www.google.com/url?not=used&url=https://theactualurl.com/"
"testpath?testquerytoo=true&unusedparamfromouterurl");
- base::Optional<GURL> result = handler.HandleRewriteIfNecessary(url);
+ absl::optional<GURL> result = handler.HandleRewriteIfNecessary(url);
ASSERT_TRUE(result.has_value());
EXPECT_EQ("https://theactualurl.com/testpath?testquerytoo=true",
@@ -33,7 +33,7 @@
GURL url(
"https://www.google.com/url?url=https://theactualurl.com/"
"testpath?first=param%26second=param&unusedparamfromouterurl");
- base::Optional<GURL> result = handler.HandleRewriteIfNecessary(url);
+ absl::optional<GURL> result = handler.HandleRewriteIfNecessary(url);
ASSERT_TRUE(result.has_value());
EXPECT_EQ("https://theactualurl.com/testpath?first=param&second=param",
@@ -84,7 +84,7 @@
RewriteHandler::FromConfigString("www.google.com/?url");
GURL url("https://www.google.com?url=https://theactualurl.com/testpath");
- base::Optional<GURL> result = handler.HandleRewriteIfNecessary(url);
+ absl::optional<GURL> result = handler.HandleRewriteIfNecessary(url);
ASSERT_TRUE(result.has_value());
EXPECT_EQ("https://theactualurl.com/testpath", result.value().spec());
@@ -95,7 +95,7 @@
"www.google.com/url?url,www.googleadservices.com/pagead/aclk?adurl");
GURL url("https://www.google.com/url?url=https://theactualurl.com/testpath");
- base::Optional<GURL> result = handler.HandleRewriteIfNecessary(url);
+ absl::optional<GURL> result = handler.HandleRewriteIfNecessary(url);
ASSERT_TRUE(result.has_value());
EXPECT_EQ("https://theactualurl.com/testpath", result.value().spec());
diff --git a/chrome/browser/performance_manager/decorators/helpers/page_live_state_decorator_helper_unittest.cc b/chrome/browser/performance_manager/decorators/helpers/page_live_state_decorator_helper_unittest.cc
index ce47cdf..d8092bd1 100644
--- a/chrome/browser/performance_manager/decorators/helpers/page_live_state_decorator_helper_unittest.cc
+++ b/chrome/browser/performance_manager/decorators/helpers/page_live_state_decorator_helper_unittest.cc
@@ -52,7 +52,7 @@
void EndToEndStreamPropertyTest(
blink::mojom::MediaStreamType stream_type,
- base::Optional<media::mojom::DisplayMediaInformationPtr>
+ absl::optional<media::mojom::DisplayMediaInformationPtr>
display_media_info,
bool (PageLiveStateDecorator::Data::*pm_getter)() const);
@@ -67,7 +67,7 @@
void PageLiveStateDecoratorHelperTest::EndToEndStreamPropertyTest(
blink::mojom::MediaStreamType stream_type,
- base::Optional<media::mojom::DisplayMediaInformationPtr> display_media_info,
+ absl::optional<media::mojom::DisplayMediaInformationPtr> display_media_info,
bool (PageLiveStateDecorator::Data::*pm_getter)() const) {
// By default all properties are set to false.
testing::TestPageNodePropertyOnPMSequence(
@@ -100,28 +100,28 @@
TEST_F(PageLiveStateDecoratorHelperTest, OnIsCapturingVideoChanged) {
EndToEndStreamPropertyTest(
blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE,
- /*display_media_info=*/base::nullopt,
+ /*display_media_info=*/absl::nullopt,
&PageLiveStateDecorator::Data::IsCapturingVideo);
}
TEST_F(PageLiveStateDecoratorHelperTest, OnIsCapturingAudioChanged) {
EndToEndStreamPropertyTest(
blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE,
- /*display_media_info=*/base::nullopt,
+ /*display_media_info=*/absl::nullopt,
&PageLiveStateDecorator::Data::IsCapturingAudio);
}
TEST_F(PageLiveStateDecoratorHelperTest, OnIsBeingMirroredChanged) {
EndToEndStreamPropertyTest(
blink::mojom::MediaStreamType::GUM_TAB_VIDEO_CAPTURE,
- /*display_media_info=*/base::nullopt,
+ /*display_media_info=*/absl::nullopt,
&PageLiveStateDecorator::Data::IsBeingMirrored);
}
TEST_F(PageLiveStateDecoratorHelperTest, OnIsCapturingWindowChanged) {
EndToEndStreamPropertyTest(
blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE,
- /*display_media_info=*/base::nullopt,
+ /*display_media_info=*/absl::nullopt,
&PageLiveStateDecorator::Data::IsCapturingWindow);
}
diff --git a/chrome/browser/performance_manager/decorators/process_metrics_decorator_unittest.cc b/chrome/browser/performance_manager/decorators/process_metrics_decorator_unittest.cc
index 894e3eb..ab5638b 100644
--- a/chrome/browser/performance_manager/decorators/process_metrics_decorator_unittest.cc
+++ b/chrome/browser/performance_manager/decorators/process_metrics_decorator_unittest.cc
@@ -6,7 +6,6 @@
#include <memory>
-#include "base/optional.h"
#include "base/run_loop.h"
#include "components/performance_manager/graph/process_node_impl.h"
#include "components/performance_manager/test_support/graph_test_harness.h"
@@ -15,6 +14,7 @@
#include "services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace performance_manager {
@@ -40,7 +40,7 @@
// Mock method used to set the test expectations.
MOCK_METHOD0(
GetMemoryDump,
- base::Optional<memory_instrumentation::mojom::GlobalMemoryDumpPtr>());
+ absl::optional<memory_instrumentation::mojom::GlobalMemoryDumpPtr>());
};
using TestProcessMetricsDecorator =
::testing::StrictMock<LenientTestProcessMetricsDecorator>;
@@ -48,7 +48,7 @@
void LenientTestProcessMetricsDecorator::RequestProcessesMemoryMetrics(
memory_instrumentation::MemoryInstrumentation::RequestGlobalDumpCallback
callback) {
- base::Optional<memory_instrumentation::mojom::GlobalMemoryDumpPtr>
+ absl::optional<memory_instrumentation::mojom::GlobalMemoryDumpPtr>
global_dump = GetMemoryDump();
std::move(callback).Run(
@@ -146,7 +146,7 @@
MockSystemNodeObserver sys_node_observer;
graph()->AddSystemNodeObserver(&sys_node_observer);
- auto memory_dump = base::make_optional(
+ auto memory_dump = absl::make_optional(
GenerateMemoryDump({{mock_graph()->process->process_id(),
kFakeResidentSetKb, kFakePrivateFootprintKb},
{mock_graph()->other_process->process_id(),
@@ -177,7 +177,7 @@
TEST_F(ProcessMetricsDecoratorTest, PartialRefresh) {
// Only contains the data for one of the two processes.
- auto partial_memory_dump = base::make_optional(
+ auto partial_memory_dump = absl::make_optional(
GenerateMemoryDump({{mock_graph()->process->process_id(),
kFakeResidentSetKb, kFakePrivateFootprintKb}}));
@@ -193,7 +193,7 @@
// Do another partial refresh but this time for the other process. The data
// attached to |mock_graph()->process| shouldn't change.
- auto partial_memory_dump2 = base::make_optional(GenerateMemoryDump(
+ auto partial_memory_dump2 = absl::make_optional(GenerateMemoryDump(
{{mock_graph()->other_process->process_id(), kFakeResidentSetKb * 2,
kFakePrivateFootprintKb * 2}}));
EXPECT_CALL(*decorator(), GetMemoryDump())
@@ -214,7 +214,7 @@
TEST_F(ProcessMetricsDecoratorTest, RefreshFailure) {
EXPECT_CALL(*decorator(), GetMemoryDump())
- .WillOnce(testing::Return(testing::ByMove(base::nullopt)));
+ .WillOnce(testing::Return(testing::ByMove(absl::nullopt)));
task_env().FastForwardBy(decorator()->GetTimerDelayForTesting());
diff --git a/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade.cc b/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade.cc
index 25dbc19..8740cc6 100644
--- a/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade.cc
+++ b/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade.cc
@@ -32,7 +32,7 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
SiteDataCacheFacadeFactory::GetInstance()->OnBeforeFacadeCreated(PassKey());
- base::Optional<std::string> parent_context_id;
+ absl::optional<std::string> parent_context_id;
if (browser_context->IsOffTheRecord()) {
content::BrowserContext* parent_context =
chrome::GetBrowserContextRedirectedInIncognito(browser_context);
diff --git a/chrome/browser/performance_manager/policies/background_tab_loading_policy.h b/chrome/browser/performance_manager/policies/background_tab_loading_policy.h
index 360c22a..9ff5c9aa3 100644
--- a/chrome/browser/performance_manager/policies/background_tab_loading_policy.h
+++ b/chrome/browser/performance_manager/policies/background_tab_loading_policy.h
@@ -79,7 +79,7 @@
// Indicates whether or not the tab communicates with the user even when it
// is in the background (tab title changes, favicons, etc).
// It is initialized to nullopt and set asynchronously to the proper value.
- base::Optional<bool> used_in_bg;
+ absl::optional<bool> used_in_bg;
};
// Comparator used to sort PageNodeToLoadData.
diff --git a/chrome/browser/performance_manager/policies/high_pmf_discard_policy.h b/chrome/browser/performance_manager/policies/high_pmf_discard_policy.h
index 00612e47..f3d89e7a 100644
--- a/chrome/browser/performance_manager/policies/high_pmf_discard_policy.h
+++ b/chrome/browser/performance_manager/policies/high_pmf_discard_policy.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_PERFORMANCE_MANAGER_POLICIES_HIGH_PMF_DISCARD_POLICY_H_
#define CHROME_BROWSER_PERFORMANCE_MANAGER_POLICIES_HIGH_PMF_DISCARD_POLICY_H_
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "components/performance_manager/public/decorators/process_metrics_decorator.h"
#include "components/performance_manager/public/graph/graph.h"
#include "components/performance_manager/public/graph/system_node.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace performance_manager {
@@ -58,7 +58,7 @@
int total_pmf_kb_before_intervention = 0;
bool a_tab_has_been_discarded = false;
};
- base::Optional<InterventionDetails> intervention_details_;
+ absl::optional<InterventionDetails> intervention_details_;
size_t discard_attempts_count_while_pmf_is_high_ = 0;
size_t successful_discards_count_while_pmf_is_high_ = 0;
diff --git a/chrome/browser/performance_manager/policies/page_freezing_policy.cc b/chrome/browser/performance_manager/policies/page_freezing_policy.cc
index cb53a0e..6bcfee0 100644
--- a/chrome/browser/performance_manager/policies/page_freezing_policy.cc
+++ b/chrome/browser/performance_manager/policies/page_freezing_policy.cc
@@ -179,7 +179,7 @@
void PageFreezingPolicy::OnFreezingVoteChanged(
const PageNode* page_node,
- base::Optional<performance_manager::freezing::FreezingVote> previous_vote) {
+ absl::optional<performance_manager::freezing::FreezingVote> previous_vote) {
if (page_node == page_node_being_removed_)
return;
diff --git a/chrome/browser/performance_manager/policies/page_freezing_policy.h b/chrome/browser/performance_manager/policies/page_freezing_policy.h
index d5e699f..30efcd8 100644
--- a/chrome/browser/performance_manager/policies/page_freezing_policy.h
+++ b/chrome/browser/performance_manager/policies/page_freezing_policy.h
@@ -100,7 +100,7 @@
void OnPageIsHoldingIndexedDBLockChanged(const PageNode* page_node) override;
void OnFreezingVoteChanged(
const PageNode* page_node,
- base::Optional<performance_manager::freezing::FreezingVote> previous_vote)
+ absl::optional<performance_manager::freezing::FreezingVote> previous_vote)
override;
void OnLoadingStateChanged(const PageNode* page_node) override;
void OnPageLifecycleStateChanged(const PageNode* page_node) override;
diff --git a/chrome/browser/performance_manager/policies/page_freezing_policy_unittest.cc b/chrome/browser/performance_manager/policies/page_freezing_policy_unittest.cc
index 5600b1f..3e1cc8b 100644
--- a/chrome/browser/performance_manager/policies/page_freezing_policy_unittest.cc
+++ b/chrome/browser/performance_manager/policies/page_freezing_policy_unittest.cc
@@ -6,7 +6,6 @@
#include <memory>
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/performance_manager/mechanisms/page_freezer.h"
#include "components/performance_manager/decorators/freezing_vote_decorator.h"
@@ -17,6 +16,7 @@
#include "components/performance_manager/test_support/graph_test_harness.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace performance_manager {
namespace policies {
@@ -213,7 +213,7 @@
::testing::Mock::VerifyAndClearExpectations(page_freezer_raw);
EXPECT_CALL(*page_freezer_raw, UnfreezePageNodeImpl(page_node()));
- page_node()->set_freezing_vote(base::nullopt);
+ page_node()->set_freezing_vote(absl::nullopt);
::testing::Mock::VerifyAndClearExpectations(page_freezer_raw);
// Sending a kCannotFreezeVote shouldn't unfreeze the page as it's already
@@ -222,7 +222,7 @@
::testing::Mock::VerifyAndClearExpectations(page_freezer_raw);
// Same for removing a kCannotFreezeVote.
- page_node()->set_freezing_vote(base::nullopt);
+ page_node()->set_freezing_vote(absl::nullopt);
::testing::Mock::VerifyAndClearExpectations(page_freezer_raw);
}
diff --git a/chrome/browser/performance_manager/policies/userspace_swap_policy_chromeos.h b/chrome/browser/performance_manager/policies/userspace_swap_policy_chromeos.h
index c10fe1d..4606779 100644
--- a/chrome/browser/performance_manager/policies/userspace_swap_policy_chromeos.h
+++ b/chrome/browser/performance_manager/policies/userspace_swap_policy_chromeos.h
@@ -8,13 +8,13 @@
#include "base/macros.h"
#include "base/memory/memory_pressure_listener.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/resource_coordinator/lifecycle_unit_observer.h"
#include "components/performance_manager/public/graph/graph.h"
#include "components/performance_manager/public/graph/process_node.h"
#include "components/performance_manager/public/graph/system_node.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace memory {
diff --git a/chrome/browser/performance_manager/policies/working_set_trimmer_policy_chromeos.h b/chrome/browser/performance_manager/policies/working_set_trimmer_policy_chromeos.h
index da62baf5..c15abd5 100644
--- a/chrome/browser/performance_manager/policies/working_set_trimmer_policy_chromeos.h
+++ b/chrome/browser/performance_manager/policies/working_set_trimmer_policy_chromeos.h
@@ -9,11 +9,11 @@
#include "base/memory/memory_pressure_listener.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ash/arc/process/arc_process_service.h"
#include "chrome/browser/performance_manager/policies/policy_features.h"
#include "chrome/browser/performance_manager/policies/working_set_trimmer_policy.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace arc {
class ArcProcess;
@@ -92,7 +92,7 @@
// We keep track of the last time we fetched the ARC process list.
base::TimeTicks last_arc_process_fetch_;
- base::Optional<base::MemoryPressureListener> memory_pressure_listener_;
+ absl::optional<base::MemoryPressureListener> memory_pressure_listener_;
private:
Graph* graph_ = nullptr;
diff --git a/chrome/browser/performance_monitor/metric_evaluator_helper_posix.cc b/chrome/browser/performance_monitor/metric_evaluator_helper_posix.cc
index 1319daa..f48e6cb 100644
--- a/chrome/browser/performance_monitor/metric_evaluator_helper_posix.cc
+++ b/chrome/browser/performance_monitor/metric_evaluator_helper_posix.cc
@@ -11,9 +11,9 @@
MetricEvaluatorsHelperPosix::MetricEvaluatorsHelperPosix() = default;
MetricEvaluatorsHelperPosix::~MetricEvaluatorsHelperPosix() = default;
-base::Optional<int> MetricEvaluatorsHelperPosix::GetFreePhysicalMemoryMb() {
+absl::optional<int> MetricEvaluatorsHelperPosix::GetFreePhysicalMemoryMb() {
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace performance_monitor
diff --git a/chrome/browser/performance_monitor/metric_evaluator_helper_posix.h b/chrome/browser/performance_monitor/metric_evaluator_helper_posix.h
index 3f5febc..16b561a 100644
--- a/chrome/browser/performance_monitor/metric_evaluator_helper_posix.h
+++ b/chrome/browser/performance_monitor/metric_evaluator_helper_posix.h
@@ -15,7 +15,7 @@
~MetricEvaluatorsHelperPosix() override;
// MetricEvaluatorsHelper:
- base::Optional<int> GetFreePhysicalMemoryMb() override;
+ absl::optional<int> GetFreePhysicalMemoryMb() override;
private:
DISALLOW_COPY_AND_ASSIGN(MetricEvaluatorsHelperPosix);
diff --git a/chrome/browser/performance_monitor/metric_evaluator_helper_win.cc b/chrome/browser/performance_monitor/metric_evaluator_helper_win.cc
index 8a37044..9c6fa22f 100644
--- a/chrome/browser/performance_monitor/metric_evaluator_helper_win.cc
+++ b/chrome/browser/performance_monitor/metric_evaluator_helper_win.cc
@@ -6,8 +6,8 @@
#include <windows.h>
-#include "base/optional.h"
#include "base/task_runner_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace performance_monitor {
@@ -29,11 +29,11 @@
g_metric_evaluator_instance = nullptr;
}
-base::Optional<int> MetricEvaluatorsHelperWin::GetFreePhysicalMemoryMb() {
+absl::optional<int> MetricEvaluatorsHelperWin::GetFreePhysicalMemoryMb() {
MEMORYSTATUSEX mem_status;
mem_status.dwLength = sizeof(mem_status);
if (!::GlobalMemoryStatusEx(&mem_status))
- return base::nullopt;
+ return absl::nullopt;
return (mem_status.ullAvailPhys / kMBBytes);
}
diff --git a/chrome/browser/performance_monitor/metric_evaluator_helper_win.h b/chrome/browser/performance_monitor/metric_evaluator_helper_win.h
index a3e49e3..58bc8f4 100644
--- a/chrome/browser/performance_monitor/metric_evaluator_helper_win.h
+++ b/chrome/browser/performance_monitor/metric_evaluator_helper_win.h
@@ -7,8 +7,8 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "chrome/browser/performance_monitor/system_monitor.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace performance_monitor {
@@ -17,7 +17,7 @@
~MetricEvaluatorsHelperWin() override;
// MetricEvaluatorsHelper:
- base::Optional<int> GetFreePhysicalMemoryMb() override;
+ absl::optional<int> GetFreePhysicalMemoryMb() override;
private:
friend class MetricEvaluatorsHelperWinTest;
diff --git a/chrome/browser/performance_monitor/system_monitor.cc b/chrome/browser/performance_monitor/system_monitor.cc
index 23d6a36..4b50d80 100644
--- a/chrome/browser/performance_monitor/system_monitor.cc
+++ b/chrome/browser/performance_monitor/system_monitor.cc
@@ -257,7 +257,7 @@
template <typename T>
SystemMonitor::MetricEvaluatorImpl<T>::MetricEvaluatorImpl(
Type type,
- base::OnceCallback<base::Optional<T>()> evaluate_function,
+ base::OnceCallback<absl::optional<T>()> evaluate_function,
void (SystemObserver::*notify_function)(ObserverArgType))
: MetricEvaluator(type),
evaluate_function_(std::move(evaluate_function)),
@@ -287,7 +287,7 @@
value_ = std::move(evaluate_function_).Run();
}
-base::Optional<base::SystemMetrics>
+absl::optional<base::SystemMetrics>
MetricEvaluatorsHelper::GetSystemMetricsStruct() {
return base::SystemMetrics::Sample();
}
diff --git a/chrome/browser/performance_monitor/system_monitor.h b/chrome/browser/performance_monitor/system_monitor.h
index 9afe9b1..63669a4 100644
--- a/chrome/browser/performance_monitor/system_monitor.h
+++ b/chrome/browser/performance_monitor/system_monitor.h
@@ -13,11 +13,11 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/process/process_metrics.h"
#include "base/sequence_checker.h"
#include "base/task/post_task.h"
#include "base/timer/timer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace performance_monitor {
@@ -158,7 +158,7 @@
MetricEvaluatorImpl<T>(
Type type,
- base::OnceCallback<base::Optional<T>()> evaluate_function,
+ base::OnceCallback<absl::optional<T>()> evaluate_function,
void (SystemObserver::*notify_function)(ObserverArgType));
virtual ~MetricEvaluatorImpl();
@@ -167,7 +167,7 @@
bool has_value() const override { return value_.has_value(); }
- base::Optional<T> value() { return value_; }
+ absl::optional<T> value() { return value_; }
void set_value_for_testing(T value) { value_ = value; }
@@ -175,14 +175,14 @@
void NotifyObserver(SystemObserver* observer) override;
// The callback that should be run to evaluate the metric value.
- base::OnceCallback<base::Optional<T>()> evaluate_function_;
+ base::OnceCallback<absl::optional<T>()> evaluate_function_;
// A function pointer to the SystemObserver function that should be called
// to notify of a value refresh.
void (SystemObserver::*notify_function_)(ObserverArgType);
// The value, initialized in |Evaluate|.
- base::Optional<T> value_;
+ absl::optional<T> value_;
DISALLOW_COPY_AND_ASSIGN(MetricEvaluatorImpl);
};
@@ -306,13 +306,13 @@
virtual ~MetricEvaluatorsHelper() = default;
// Returns the free physical memory, in megabytes.
- virtual base::Optional<int> GetFreePhysicalMemoryMb() = 0;
+ virtual absl::optional<int> GetFreePhysicalMemoryMb() = 0;
// Return a |base::SystemMetrics| snapshot.
//
// NOTE: This function doesn't have to be virtual, the base::SystemMetrics
// struct is an abstraction that already has a per-platform definition.
- base::Optional<base::SystemMetrics> GetSystemMetricsStruct();
+ absl::optional<base::SystemMetrics> GetSystemMetricsStruct();
private:
DISALLOW_COPY_AND_ASSIGN(MetricEvaluatorsHelper);
diff --git a/chrome/browser/performance_monitor/system_monitor_unittest.cc b/chrome/browser/performance_monitor/system_monitor_unittest.cc
index 7f11ec8..c8ec6fd 100644
--- a/chrome/browser/performance_monitor/system_monitor_unittest.cc
+++ b/chrome/browser/performance_monitor/system_monitor_unittest.cc
@@ -34,7 +34,7 @@
TestMetricEvaluatorsHelper() = default;
~TestMetricEvaluatorsHelper() override = default;
- base::Optional<int> GetFreePhysicalMemoryMb() override {
+ absl::optional<int> GetFreePhysicalMemoryMb() override {
return kFakeFreePhysMemoryMb;
}
diff --git a/chrome/browser/permissions/abusive_origin_permission_revocation_request.h b/chrome/browser/permissions/abusive_origin_permission_revocation_request.h
index be61d52..65fb378b 100644
--- a/chrome/browser/permissions/abusive_origin_permission_revocation_request.h
+++ b/chrome/browser/permissions/abusive_origin_permission_revocation_request.h
@@ -63,14 +63,14 @@
CrowdDenySafeBrowsingRequest::Verdict verdict);
void NotifyCallback(Outcome outcome);
- base::Optional<CrowdDenySafeBrowsingRequest> safe_browsing_request_;
+ absl::optional<CrowdDenySafeBrowsingRequest> safe_browsing_request_;
Profile* profile_;
const GURL origin_;
OutcomeCallback callback_;
// The time when the Crowd Deny request starts.
- base::Optional<base::TimeTicks> crowd_deny_request_start_time_;
+ absl::optional<base::TimeTicks> crowd_deny_request_start_time_;
// The Crowd Deny component load duration.
- base::Optional<base::TimeDelta> crowd_deny_request_duration_;
+ absl::optional<base::TimeDelta> crowd_deny_request_duration_;
base::WeakPtrFactory<AbusiveOriginPermissionRevocationRequest> weak_factory_{
this};
};
diff --git a/chrome/browser/permissions/adaptive_quiet_notification_permission_ui_enabler.h b/chrome/browser/permissions/adaptive_quiet_notification_permission_ui_enabler.h
index 9aace86..5574733 100644
--- a/chrome/browser/permissions/adaptive_quiet_notification_permission_ui_enabler.h
+++ b/chrome/browser/permissions/adaptive_quiet_notification_permission_ui_enabler.h
@@ -9,10 +9,10 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/singleton.h"
-#include "base/optional.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/permissions/permission_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefChangeRegistrar;
class Profile;
diff --git a/chrome/browser/permissions/adaptive_quiet_notification_permission_ui_enabler_unittest.cc b/chrome/browser/permissions/adaptive_quiet_notification_permission_ui_enabler_unittest.cc
index 556c96f..5538ac6 100644
--- a/chrome/browser/permissions/adaptive_quiet_notification_permission_ui_enabler_unittest.cc
+++ b/chrome/browser/permissions/adaptive_quiet_notification_permission_ui_enabler_unittest.cc
@@ -46,7 +46,7 @@
BackfillEnablingMethodIfMissing) {
struct {
bool enable_quiet_ui_pref;
- base::Optional<QuietUiEnablingMethod> quiet_ui_method_pref;
+ absl::optional<QuietUiEnablingMethod> quiet_ui_method_pref;
bool should_show_promo_pref;
QuietUiEnablingMethod expected_quiet_ui_method_pref;
} kTests[] = {
@@ -68,9 +68,9 @@
{true, QuietUiEnablingMethod::kUnspecified, false,
QuietUiEnablingMethod::kManual},
// If the method is unset, it should be treated as kUnspecified.
- {false, base::nullopt, false, QuietUiEnablingMethod::kUnspecified},
- {true, base::nullopt, true, QuietUiEnablingMethod::kAdaptive},
- {true, base::nullopt, false, QuietUiEnablingMethod::kManual},
+ {false, absl::nullopt, false, QuietUiEnablingMethod::kUnspecified},
+ {true, absl::nullopt, true, QuietUiEnablingMethod::kAdaptive},
+ {true, absl::nullopt, false, QuietUiEnablingMethod::kManual},
};
base::test::ScopedFeatureList feature_list;
diff --git a/chrome/browser/permissions/chrome_permission_request_manager_unittest.cc b/chrome/browser/permissions/chrome_permission_request_manager_unittest.cc
index 98c56c3..78b61f4 100644
--- a/chrome/browser/permissions/chrome_permission_request_manager_unittest.cc
+++ b/chrome/browser/permissions/chrome_permission_request_manager_unittest.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
@@ -42,6 +41,7 @@
#include "components/ukm/test_ukm_recorder.h"
#include "components/user_manager/scoped_user_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/app_mode/web_app/web_kiosk_app_manager.h"
@@ -329,7 +329,7 @@
ASSERT_TRUE(
QuietNotificationPermissionUiConfig::IsAdaptiveActivationDryRunEnabled());
- base::Optional<bool> has_three_consecutive_denies =
+ absl::optional<bool> has_three_consecutive_denies =
permissions::PermissionsClient::Get()
->HadThreeConsecutiveNotificationPermissionDenies(profile());
ASSERT_TRUE(has_three_consecutive_denies.has_value());
diff --git a/chrome/browser/permissions/chrome_permissions_client.cc b/chrome/browser/permissions/chrome_permissions_client.cc
index 071e6e4..cad8a023 100644
--- a/chrome/browser/permissions/chrome_permissions_client.cc
+++ b/chrome/browser/permissions/chrome_permissions_client.cc
@@ -224,7 +224,7 @@
permissions::RequestType request_type,
permissions::PermissionAction action,
const GURL& origin,
- base::Optional<QuietUiReason> quiet_ui_reason) {
+ absl::optional<QuietUiReason> quiet_ui_reason) {
Profile* profile = Profile::FromBrowserContext(browser_context);
PermissionActionsHistory::GetForProfile(profile)->RecordAction(action,
@@ -246,23 +246,23 @@
}
}
-base::Optional<bool>
+absl::optional<bool>
ChromePermissionsClient::HadThreeConsecutiveNotificationPermissionDenies(
content::BrowserContext* browser_context) {
if (!QuietNotificationPermissionUiConfig::IsAdaptiveActivationDryRunEnabled())
- return base::nullopt;
+ return absl::nullopt;
return Profile::FromBrowserContext(browser_context)
->GetPrefs()
->GetBoolean(prefs::kHadThreeConsecutiveNotificationPermissionDenies);
}
-base::Optional<bool>
+absl::optional<bool>
ChromePermissionsClient::HasPreviouslyAutoRevokedPermission(
content::BrowserContext* browser_context,
const GURL& origin,
ContentSettingsType permission) {
if (permission != ContentSettingsType::NOTIFICATIONS) {
- return base::nullopt;
+ return absl::nullopt;
}
Profile* profile = Profile::FromBrowserContext(browser_context);
@@ -270,7 +270,7 @@
HasPreviouslyRevokedPermission(profile, origin);
}
-base::Optional<url::Origin> ChromePermissionsClient::GetAutoApprovalOrigin() {
+absl::optional<url::Origin> ChromePermissionsClient::GetAutoApprovalOrigin() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
// In web kiosk mode, all permission requests are auto-approved for the origin
// of the main app.
@@ -285,7 +285,7 @@
return url::Origin::Create(app_data->install_url());
}
#endif
- return base::nullopt;
+ return absl::nullopt;
}
bool ChromePermissionsClient::CanBypassEmbeddingOriginCheck(
@@ -299,7 +299,7 @@
requesting_origin.SchemeIs(extensions::kExtensionScheme);
}
-base::Optional<GURL> ChromePermissionsClient::OverrideCanonicalOrigin(
+absl::optional<GURL> ChromePermissionsClient::OverrideCanonicalOrigin(
const GURL& requesting_origin,
const GURL& embedding_origin) {
if (embedding_origin.GetOrigin() ==
@@ -319,7 +319,7 @@
return requesting_origin;
}
- return base::nullopt;
+ return absl::nullopt;
}
#if defined(OS_ANDROID)
diff --git a/chrome/browser/permissions/chrome_permissions_client.h b/chrome/browser/permissions/chrome_permissions_client.h
index 8d27ec0c..b8084e2c 100644
--- a/chrome/browser/permissions/chrome_permissions_client.h
+++ b/chrome/browser/permissions/chrome_permissions_client.h
@@ -50,17 +50,17 @@
permissions::RequestType request_type,
permissions::PermissionAction action,
const GURL& origin,
- base::Optional<QuietUiReason> quiet_ui_reason) override;
- base::Optional<bool> HadThreeConsecutiveNotificationPermissionDenies(
+ absl::optional<QuietUiReason> quiet_ui_reason) override;
+ absl::optional<bool> HadThreeConsecutiveNotificationPermissionDenies(
content::BrowserContext* browser_context) override;
- base::Optional<bool> HasPreviouslyAutoRevokedPermission(
+ absl::optional<bool> HasPreviouslyAutoRevokedPermission(
content::BrowserContext* browser_context,
const GURL& origin,
ContentSettingsType permission) override;
- base::Optional<url::Origin> GetAutoApprovalOrigin() override;
+ absl::optional<url::Origin> GetAutoApprovalOrigin() override;
bool CanBypassEmbeddingOriginCheck(const GURL& requesting_origin,
const GURL& embedding_origin) override;
- base::Optional<GURL> OverrideCanonicalOrigin(
+ absl::optional<GURL> OverrideCanonicalOrigin(
const GURL& requesting_origin,
const GURL& embedding_origin) override;
#if defined(OS_ANDROID)
diff --git a/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc b/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc
index 97ceabe..177f0291 100644
--- a/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc
+++ b/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc
@@ -48,14 +48,14 @@
}
// Attempts to decide which UI to use based on preloaded site reputation data,
-// or returns base::nullopt if not possible. |site_reputation| can be nullptr.
-base::Optional<Decision> GetDecisionBasedOnSiteReputation(
+// or returns absl::nullopt if not possible. |site_reputation| can be nullptr.
+absl::optional<Decision> GetDecisionBasedOnSiteReputation(
const CrowdDenyPreloadData::SiteReputation* site_reputation) {
using Config = QuietNotificationPermissionUiConfig;
if (!site_reputation) {
RecordNotificationUserExperienceQuality(
CrowdDenyPreloadData::SiteReputation::UNKNOWN);
- return base::nullopt;
+ return absl::nullopt;
}
RecordNotificationUserExperienceQuality(
@@ -70,7 +70,7 @@
if (site_reputation->warning_only())
return Decision::UseNormalUiAndShowNoWarning();
if (!Config::IsCrowdDenyTriggeringEnabled())
- return base::nullopt;
+ return absl::nullopt;
return Decision(QuietUiReason::kTriggeredByCrowdDeny,
Decision::ShowNoWarning());
}
@@ -82,7 +82,7 @@
WarningReason::kAbusiveRequests);
}
if (!Config::IsAbusiveRequestBlockingEnabled())
- return base::nullopt;
+ return absl::nullopt;
return Decision(QuietUiReason::kTriggeredDueToAbusiveRequests,
Decision::ShowNoWarning());
}
@@ -94,17 +94,17 @@
WarningReason::kAbusiveContent);
}
if (!Config::IsAbusiveContentTriggeredRequestBlockingEnabled())
- return base::nullopt;
+ return absl::nullopt;
return Decision(QuietUiReason::kTriggeredDueToAbusiveContent,
Decision::ShowNoWarning());
}
case CrowdDenyPreloadData::SiteReputation::UNKNOWN: {
- return base::nullopt;
+ return absl::nullopt;
}
}
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
// Roll the dice to decide whether to use the normal UI even when the preload
@@ -170,7 +170,7 @@
void ContextualNotificationPermissionUiSelector::OnSiteReputationReady(
const url::Origin& origin,
const CrowdDenyPreloadData::SiteReputation* reputation) {
- base::Optional<Decision> decision =
+ absl::optional<Decision> decision =
GetDecisionBasedOnSiteReputation(reputation);
// If the PreloadData suggests this is an unacceptable site, ping Safe
diff --git a/chrome/browser/permissions/contextual_notification_permission_ui_selector.h b/chrome/browser/permissions/contextual_notification_permission_ui_selector.h
index a940831..08e41f1 100644
--- a/chrome/browser/permissions/contextual_notification_permission_ui_selector.h
+++ b/chrome/browser/permissions/contextual_notification_permission_ui_selector.h
@@ -6,10 +6,10 @@
#define CHROME_BROWSER_PERMISSIONS_CONTEXTUAL_NOTIFICATION_PERMISSION_UI_SELECTOR_H_
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/permissions/crowd_deny_preload_data.h"
#include "chrome/browser/permissions/crowd_deny_safe_browsing_request.h"
#include "components/permissions/notification_permission_ui_selector.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace permissions {
class PermissionRequest;
@@ -56,7 +56,7 @@
const url::Origin& origin,
const CrowdDenyPreloadData::SiteReputation* reputation);
- base::Optional<CrowdDenySafeBrowsingRequest> safe_browsing_request_;
+ absl::optional<CrowdDenySafeBrowsingRequest> safe_browsing_request_;
DecisionMadeCallback callback_;
base::WeakPtrFactory<ContextualNotificationPermissionUiSelector>
weak_factory_{this};
diff --git a/chrome/browser/permissions/contextual_notification_permission_ui_selector_unittest.cc b/chrome/browser/permissions/contextual_notification_permission_ui_selector_unittest.cc
index 1457f78..a87c432 100644
--- a/chrome/browser/permissions/contextual_notification_permission_ui_selector_unittest.cc
+++ b/chrome/browser/permissions/contextual_notification_permission_ui_selector_unittest.cc
@@ -10,7 +10,6 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_feature_list.h"
@@ -29,6 +28,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -195,14 +195,14 @@
void QueryAndExpectDecisionForUrl(
const GURL& origin,
- base::Optional<QuietUiReason> quiet_ui_reason,
- base::Optional<WarningReason> warning_reason) {
+ absl::optional<QuietUiReason> quiet_ui_reason,
+ absl::optional<WarningReason> warning_reason) {
permissions::MockPermissionRequest mock_request(
std::u16string(), permissions::RequestType::kNotifications, origin);
base::MockCallback<
ContextualNotificationPermissionUiSelector::DecisionMadeCallback>
mock_callback;
- Decision actual_decison(base::nullopt, base::nullopt);
+ Decision actual_decison(absl::nullopt, absl::nullopt);
EXPECT_CALL(mock_callback, Run)
.WillRepeatedly(testing::SaveArg<0>(&actual_decison));
contextual_selector_.SelectUiToUse(&mock_request, mock_callback.Get());
@@ -268,9 +268,9 @@
const struct {
const char* origin_string;
- base::Optional<QuietUiReason> expected_ui_reason =
+ absl::optional<QuietUiReason> expected_ui_reason =
Decision::UseNormalUi();
- base::Optional<WarningReason> expected_warning_reason =
+ absl::optional<WarningReason> expected_warning_reason =
Decision::ShowNoWarning();
} kTestCases[] = {
{kTestOriginNoData},
@@ -360,8 +360,8 @@
const struct {
const char* origin_string;
- base::Optional<QuietUiReason> expected_ui_reason = Decision::UseNormalUi();
- base::Optional<WarningReason> expected_warning_reason =
+ absl::optional<QuietUiReason> expected_ui_reason = Decision::UseNormalUi();
+ absl::optional<WarningReason> expected_warning_reason =
Decision::ShowNoWarning();
} kTestCases[] = {
{kTestOriginSpammy, QuietUiReason::kTriggeredByCrowdDeny},
@@ -400,8 +400,8 @@
const struct {
const char* origin_string;
- base::Optional<QuietUiReason> expected_ui_reason = Decision::UseNormalUi();
- base::Optional<WarningReason> expected_warning_reason =
+ absl::optional<QuietUiReason> expected_ui_reason = Decision::UseNormalUi();
+ absl::optional<WarningReason> expected_warning_reason =
Decision::ShowNoWarning();
} kTestCases[] = {
{kTestOriginSpammy},
@@ -440,8 +440,8 @@
const struct {
const char* origin_string;
- base::Optional<QuietUiReason> expected_ui_reason = Decision::UseNormalUi();
- base::Optional<WarningReason> expected_warning_reason =
+ absl::optional<QuietUiReason> expected_ui_reason = Decision::UseNormalUi();
+ absl::optional<WarningReason> expected_warning_reason =
Decision::ShowNoWarning();
} kTestCases[] = {
{kTestOriginSpammy},
@@ -481,8 +481,8 @@
const struct {
const char* origin_string;
- base::Optional<QuietUiReason> expected_ui_reason = Decision::UseNormalUi();
- base::Optional<WarningReason> expected_warning_reason =
+ absl::optional<QuietUiReason> expected_ui_reason = Decision::UseNormalUi();
+ absl::optional<WarningReason> expected_warning_reason =
Decision::ShowNoWarning();
} kTestCases[] = {
{kTestOriginSpammy},
@@ -523,8 +523,8 @@
const struct {
const char* origin_string;
- base::Optional<QuietUiReason> expected_ui_reason = Decision::UseNormalUi();
- base::Optional<WarningReason> expected_warning_reason =
+ absl::optional<QuietUiReason> expected_ui_reason = Decision::UseNormalUi();
+ absl::optional<WarningReason> expected_warning_reason =
Decision::ShowNoWarning();
} kTestCases[] = {
{kTestOriginSpammy},
@@ -549,7 +549,7 @@
CrowdDenyHoldbackChance) {
const struct {
std::string holdback_chance;
- base::Optional<QuietUiReason> expected_ui_reason;
+ absl::optional<QuietUiReason> expected_ui_reason;
bool expected_histogram_bucket;
} kTestCases[] = {
// 100% chance to holdback, the UI used should be the normal UI.
diff --git a/chrome/browser/permissions/crowd_deny_preload_data.h b/chrome/browser/permissions/crowd_deny_preload_data.h
index 2070e4b..f34e697 100644
--- a/chrome/browser/permissions/crowd_deny_preload_data.h
+++ b/chrome/browser/permissions/crowd_deny_preload_data.h
@@ -13,9 +13,9 @@
#include "base/containers/flat_map.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/version.h"
#include "chrome/browser/permissions/crowd_deny.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
namespace base {
@@ -73,7 +73,7 @@
void LoadFromDisk(const base::FilePath& preload_data_path,
const base::Version& version);
- inline const base::Optional<base::Version>& version_on_disk() {
+ inline const absl::optional<base::Version>& version_on_disk() {
return version_on_disk_;
}
@@ -101,7 +101,7 @@
bool is_ready_to_use_ = true;
DomainToReputationMap domain_to_reputation_map_;
scoped_refptr<base::SequencedTaskRunner> loading_task_runner_;
- base::Optional<base::Version> version_on_disk_;
+ absl::optional<base::Version> version_on_disk_;
std::queue<PendingOrigin> origins_pending_verification_;
DISALLOW_COPY_AND_ASSIGN(CrowdDenyPreloadData);
diff --git a/chrome/browser/permissions/crowd_deny_safe_browsing_request.h b/chrome/browser/permissions/crowd_deny_safe_browsing_request.h
index 5dc2895..a363dd4 100644
--- a/chrome/browser/permissions/crowd_deny_safe_browsing_request.h
+++ b/chrome/browser/permissions/crowd_deny_safe_browsing_request.h
@@ -11,9 +11,9 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Clock;
diff --git a/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.h b/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.h
index 8554bb5..3657b43 100644
--- a/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.h
+++ b/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.h
@@ -30,7 +30,7 @@
private:
explicit LastTabStandingTrackerTabHelper(content::WebContents* webContents);
friend class content::WebContentsUserData<LastTabStandingTrackerTabHelper>;
- base::Optional<url::Origin> last_committed_origin_;
+ absl::optional<url::Origin> last_committed_origin_;
WEB_CONTENTS_USER_DATA_KEY_DECL();
};
diff --git a/chrome/browser/permissions/permission_actions_history.cc b/chrome/browser/permissions/permission_actions_history.cc
index d24eff5e..410425b 100644
--- a/chrome/browser/permissions/permission_actions_history.cc
+++ b/chrome/browser/permissions/permission_actions_history.cc
@@ -6,7 +6,6 @@
#include "base/containers/adapters.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/ranges/algorithm.h"
#include "base/util/values/values_util.h"
#include "build/build_config.h"
@@ -18,6 +17,7 @@
#include "components/permissions/request_type.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include <vector>
@@ -98,7 +98,7 @@
// Discard permission actions older than |kPermissionActionMaxAge|.
const base::Time cutoff = base::Time::Now() - kPermissionActionMaxAge;
permission_actions->EraseListValueIf([cutoff](const base::Value& entry) {
- const base::Optional<base::Time> timestamp =
+ const absl::optional<base::Time> timestamp =
util::ValueToTime(entry.FindKey(kPermissionActionEntryTimestampKey));
return !timestamp || *timestamp < cutoff;
});
@@ -125,7 +125,7 @@
for (const auto& permission_entry : update->DictItems()) {
permission_entry.second.EraseListValueIf([delete_begin,
delete_end](const auto& entry) {
- const base::Optional<base::Time> timestamp =
+ const absl::optional<base::Time> timestamp =
util::ValueToTime(entry.FindKey(kPermissionActionEntryTimestampKey));
return (!timestamp ||
(*timestamp >= delete_begin && *timestamp < delete_end));
@@ -148,7 +148,7 @@
std::vector<Entry> matching_actions;
for (const auto& entry : permission_actions->GetList()) {
- const base::Optional<base::Time> timestamp =
+ const absl::optional<base::Time> timestamp =
util::ValueToTime(entry.FindKey(kPermissionActionEntryTimestampKey));
if (timestamp >= begin) {
diff --git a/chrome/browser/permissions/permission_actions_history_unittest.cc b/chrome/browser/permissions/permission_actions_history_unittest.cc
index e163cc5..3329151b 100644
--- a/chrome/browser/permissions/permission_actions_history_unittest.cc
+++ b/chrome/browser/permissions/permission_actions_history_unittest.cc
@@ -6,7 +6,6 @@
#include <vector>
#include "base/containers/adapters.h"
-#include "base/optional.h"
#include "base/util/values/values_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_browser_process.h"
@@ -19,6 +18,7 @@
#include "components/prefs/testing_pref_service.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -66,7 +66,7 @@
}
std::vector<PermissionActionsHistory::Entry> GetHistory(
- base::Optional<permissions::RequestType> type) {
+ absl::optional<permissions::RequestType> type) {
if (type.has_value())
return GetPermissionActionsHistory()->GetHistory(base::Time(),
type.value());
@@ -98,7 +98,7 @@
};
TEST_F(PermissionActionHistoryTest, GetHistorySortedOrder) {
- auto all_entries = GetHistory(base::nullopt);
+ auto all_entries = GetHistory(absl::nullopt);
EXPECT_EQ(7u, all_entries.size());
@@ -132,7 +132,7 @@
}
TEST_F(PermissionActionHistoryTest, NotificationRecordAction) {
- size_t general_count = GetHistory(base::nullopt).size();
+ size_t general_count = GetHistory(absl::nullopt).size();
size_t notification_count =
GetHistory(permissions::RequestType::kNotifications).size();
@@ -140,7 +140,7 @@
permissions::PermissionAction::GRANTED,
permissions::RequestType::kNotifications);
- EXPECT_EQ(general_count + 1, GetHistory(base::nullopt).size());
+ EXPECT_EQ(general_count + 1, GetHistory(absl::nullopt).size());
EXPECT_EQ(notification_count + 1,
GetHistory(permissions::RequestType::kNotifications).size());
@@ -148,7 +148,7 @@
permissions::PermissionAction::GRANTED,
permissions::RequestType::kGeolocation);
- EXPECT_EQ(general_count + 2, GetHistory(base::nullopt).size());
+ EXPECT_EQ(general_count + 2, GetHistory(absl::nullopt).size());
EXPECT_EQ(notification_count + 1,
GetHistory(permissions::RequestType::kNotifications).size());
}
@@ -223,7 +223,7 @@
test.end += current_offset;
GetPermissionActionsHistory()->ClearHistory(test.begin, test.end);
- EXPECT_EQ(test.generic_count, GetHistory(base::nullopt).size());
+ EXPECT_EQ(test.generic_count, GetHistory(absl::nullopt).size());
EXPECT_EQ(test.notifications_count,
GetHistory(permissions::RequestType::kNotifications).size());
diff --git a/chrome/browser/permissions/permission_request_manager_browsertest.cc b/chrome/browser/permissions/permission_request_manager_browsertest.cc
index f9b319cb..a474bce 100644
--- a/chrome/browser/permissions/permission_request_manager_browsertest.cc
+++ b/chrome/browser/permissions/permission_request_manager_browsertest.cc
@@ -651,8 +651,8 @@
using WarningReason =
permissions::NotificationPermissionUiSelector::WarningReason;
- void SetCannedUiDecision(base::Optional<QuietUiReason> quiet_ui_reason,
- base::Optional<WarningReason> warning_reason) {
+ void SetCannedUiDecision(absl::optional<QuietUiReason> quiet_ui_reason,
+ absl::optional<WarningReason> warning_reason) {
GetPermissionRequestManager()
->set_notification_permission_ui_selector_for_testing(
std::make_unique<TestQuietNotificationPermissionUiSelector>(
@@ -709,7 +709,7 @@
bubble_factory()->WaitForPermissionBubble();
auto* manager = GetPermissionRequestManager();
- base::Optional<permissions::PermissionPromptDisposition> disposition =
+ absl::optional<permissions::PermissionPromptDisposition> disposition =
manager->current_request_prompt_disposition_for_testing();
auto disposition_from_prompt_bubble =
manager->view_for_testing()->GetPromptDisposition();
@@ -742,7 +742,7 @@
// HIDDEN.
manager->OnVisibilityChanged(content::Visibility::HIDDEN);
- base::Optional<permissions::PermissionPromptDisposition> disposition =
+ absl::optional<permissions::PermissionPromptDisposition> disposition =
manager->current_request_prompt_disposition_for_testing();
EXPECT_TRUE(disposition.has_value());
@@ -757,8 +757,8 @@
IN_PROC_BROWSER_TEST_F(PermissionRequestManagerQuietUiBrowserTest,
ConsoleMessages) {
const struct {
- base::Optional<QuietUiReason> simulated_quiet_ui_reason;
- base::Optional<WarningReason> simulated_warning_reason;
+ absl::optional<QuietUiReason> simulated_quiet_ui_reason;
+ absl::optional<WarningReason> simulated_warning_reason;
const char* expected_message;
} kTestCases[] = {
{UiDecision::UseNormalUi(), UiDecision::ShowNoWarning(), nullptr},
diff --git a/chrome/browser/permissions/prediction_based_permission_ui_selector.cc b/chrome/browser/permissions/prediction_based_permission_ui_selector.cc
index fc0f0eb..a9eb1336 100644
--- a/chrome/browser/permissions/prediction_based_permission_ui_selector.cc
+++ b/chrome/browser/permissions/prediction_based_permission_ui_selector.cc
@@ -39,7 +39,7 @@
// the particular permission type.
constexpr size_t kRequestedPermissionMinimumHistoricalActions = 4;
-base::Optional<
+absl::optional<
permissions::PermissionPrediction_Likelihood_DiscretizedLikelihood>
ParsePredictionServiceMockLikelihood(const std::string& value) {
if (value == "very-unlikely") {
@@ -59,7 +59,7 @@
PermissionPrediction_Likelihood_DiscretizedLikelihood_VERY_LIKELY;
}
- return base::nullopt;
+ return absl::nullopt;
}
bool ShouldPredictionTriggerQuietUi(
@@ -90,7 +90,7 @@
DecisionMadeCallback callback) {
VLOG(1) << "[CPSS] Selector activated";
callback_ = std::move(callback);
- last_request_grant_likelihood_ = base::nullopt;
+ last_request_grant_likelihood_ = absl::nullopt;
if (!IsAllowedToUseAssistedPrompts()) {
VLOG(1) << "[CPSS] Configuration does not allows CPSS requests";
@@ -140,7 +140,7 @@
callback_.Reset();
}
-base::Optional<permissions::PermissionUmaUtil::PredictionGrantLikelihood>
+absl::optional<permissions::PermissionUmaUtil::PredictionGrantLikelihood>
PredictionBasedPermissionUiSelector::PredictedGrantLikelihoodForUKM() {
return last_request_grant_likelihood_;
}
diff --git a/chrome/browser/permissions/prediction_based_permission_ui_selector.h b/chrome/browser/permissions/prediction_based_permission_ui_selector.h
index a08043d..b8dde80d 100644
--- a/chrome/browser/permissions/prediction_based_permission_ui_selector.h
+++ b/chrome/browser/permissions/prediction_based_permission_ui_selector.h
@@ -42,7 +42,7 @@
void Cancel() override;
- base::Optional<PredictionGrantLikelihood> PredictedGrantLikelihoodForUKM()
+ absl::optional<PredictionGrantLikelihood> PredictedGrantLikelihoodForUKM()
override;
private:
@@ -63,9 +63,9 @@
Profile* profile_;
std::unique_ptr<PredictionServiceRequest> request_;
- base::Optional<PredictionGrantLikelihood> last_request_grant_likelihood_;
+ absl::optional<PredictionGrantLikelihood> last_request_grant_likelihood_;
- base::Optional<PredictionGrantLikelihood> likelihood_override_for_testing_;
+ absl::optional<PredictionGrantLikelihood> likelihood_override_for_testing_;
DecisionMadeCallback callback_;
};
diff --git a/chrome/browser/permissions/prediction_based_permission_ui_selector_unittest.cc b/chrome/browser/permissions/prediction_based_permission_ui_selector_unittest.cc
index fef5c11..d12ea7d 100644
--- a/chrome/browser/permissions/prediction_based_permission_ui_selector_unittest.cc
+++ b/chrome/browser/permissions/prediction_based_permission_ui_selector_unittest.cc
@@ -49,7 +49,7 @@
Decision SelectUiToUseAndGetDecision(
PredictionBasedPermissionUiSelector* selector) {
- base::Optional<Decision> actual_decision;
+ absl::optional<Decision> actual_decision;
base::RunLoop run_loop;
permissions::MockPermissionRequest request(
diff --git a/chrome/browser/permissions/pref_notification_permission_ui_selector_unittest.cc b/chrome/browser/permissions/pref_notification_permission_ui_selector_unittest.cc
index c63c104..087660ea 100644
--- a/chrome/browser/permissions/pref_notification_permission_ui_selector_unittest.cc
+++ b/chrome/browser/permissions/pref_notification_permission_ui_selector_unittest.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/permissions/pref_notification_permission_ui_selector.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/mock_callback.h"
@@ -18,6 +17,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
@@ -60,7 +60,7 @@
const struct {
bool feature_enabled;
bool quiet_ui_enabled_in_prefs;
- base::Optional<QuietUiReason> expected_reason;
+ absl::optional<QuietUiReason> expected_reason;
} kTests[] = {
{true, false, Decision::UseNormalUi()},
{true, true, QuietUiReason::kEnabledInPrefs},
@@ -88,7 +88,7 @@
base::MockCallback<
PrefNotificationPermissionUiSelector::DecisionMadeCallback>
mock_callback;
- Decision actual_decison(base::nullopt, base::nullopt);
+ Decision actual_decison(absl::nullopt, absl::nullopt);
// Make a request and wait for the callback.
EXPECT_CALL(mock_callback, Run)
diff --git a/chrome/browser/persisted_state_db/persisted_state_db.h b/chrome/browser/persisted_state_db/persisted_state_db.h
index c461eda..2a796ec1 100644
--- a/chrome/browser/persisted_state_db/persisted_state_db.h
+++ b/chrome/browser/persisted_state_db/persisted_state_db.h
@@ -7,12 +7,12 @@
#include "base/android/scoped_java_ref.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "build/build_config.h"
#include "chrome/browser/persisted_state_db/persisted_state_db_content.pb.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/leveldb_proto/public/proto_database.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class BrowserContext;
diff --git a/chrome/browser/persisted_state_db/profile_proto_db.h b/chrome/browser/persisted_state_db/profile_proto_db.h
index 51fa5cd..c0fd9589 100644
--- a/chrome/browser/persisted_state_db/profile_proto_db.h
+++ b/chrome/browser/persisted_state_db/profile_proto_db.h
@@ -12,7 +12,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
@@ -22,6 +21,7 @@
#include "components/leveldb_proto/public/proto_database.h"
#include "components/leveldb_proto/public/proto_database_provider.h"
#include "content/public/browser/browser_context.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/leveldatabase/src/include/leveldb/options.h"
class ProfileProtoDBTest;
@@ -135,7 +135,7 @@
content::BrowserContext* browser_context_;
// Status of the database initialization.
- base::Optional<leveldb_proto::Enums::InitStatus> database_status_;
+ absl::optional<leveldb_proto::Enums::InitStatus> database_status_;
// The database for storing content storage information.
std::unique_ptr<leveldb_proto::ProtoDatabase<T>> storage_database_;
@@ -314,7 +314,7 @@
const base::FilePath& database_dir,
leveldb_proto::ProtoDbType proto_db_type)
: browser_context_(browser_context),
- database_status_(base::nullopt),
+ database_status_(absl::nullopt),
storage_database_(proto_database_provider->GetDB<T>(
proto_db_type,
database_dir,
@@ -331,7 +331,7 @@
ProfileProtoDB<T>::ProfileProtoDB(
std::unique_ptr<leveldb_proto::ProtoDatabase<T>> storage_database,
scoped_refptr<base::SequencedTaskRunner> task_runner)
- : database_status_(base::nullopt),
+ : database_status_(absl::nullopt),
storage_database_(std::move(storage_database)) {
static_assert(std::is_base_of<google::protobuf::MessageLite, T>::value,
"T must implement 'google::protobuf::MessageLite'");
@@ -344,7 +344,7 @@
void ProfileProtoDB<T>::OnDatabaseInitialized(
leveldb_proto::Enums::InitStatus status) {
database_status_ =
- base::make_optional<leveldb_proto::Enums::InitStatus>(status);
+ absl::make_optional<leveldb_proto::Enums::InitStatus>(status);
for (auto& deferred_operation : deferred_operations_) {
std::move(deferred_operation).Run();
}
@@ -389,7 +389,7 @@
// Returns true if initialization status of database is not yet known.
template <typename T>
bool ProfileProtoDB<T>::InitStatusUnknown() const {
- return database_status_ == base::nullopt;
+ return database_status_ == absl::nullopt;
}
// Returns true if the database failed to initialize.
diff --git a/chrome/browser/plugins/plugin_finder.cc b/chrome/browser/plugins/plugin_finder.cc
index 68c956a..9e7a17e8 100644
--- a/chrome/browser/plugins/plugin_finder.cc
+++ b/chrome/browser/plugins/plugin_finder.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
@@ -19,6 +18,7 @@
#include "chrome/browser/plugins/plugin_metadata.h"
#include "chrome/grit/browser_resources.h"
#include "content/public/common/webplugininfo.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/resource/resource_bundle.h"
#include "url/gurl.h"
@@ -148,7 +148,7 @@
base::StringPiece json_resource(
ui::ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_PLUGIN_DB_JSON));
- base::Optional<base::Value> value = base::JSONReader::Read(json_resource);
+ absl::optional<base::Value> value = base::JSONReader::Read(json_resource);
if (!value)
return nullptr;
diff --git a/chrome/browser/policy/browser_dm_token_storage_mac.mm b/chrome/browser/policy/browser_dm_token_storage_mac.mm
index 913d9e9..d2861af 100644
--- a/chrome/browser/policy/browser_dm_token_storage_mac.mm
+++ b/chrome/browser/policy/browser_dm_token_storage_mac.mm
@@ -19,7 +19,6 @@
#include "base/mac/scoped_ioobject.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
@@ -31,6 +30,7 @@
#include "base/threading/scoped_blocking_call.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "chrome/common/chrome_paths.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -121,26 +121,26 @@
return true;
}
-base::Optional<bool> IsEnrollmentMandatoryByPolicy() {
+absl::optional<bool> IsEnrollmentMandatoryByPolicy() {
base::ScopedCFTypeRef<CFPropertyListRef> value(CFPreferencesCopyAppValue(
kEnrollmentMandatoryOptionPolicyName, kBundleId));
if (!value || !CFPreferencesAppValueIsForced(
kEnrollmentMandatoryOptionPolicyName, kBundleId)) {
- return base::Optional<bool>();
+ return absl::optional<bool>();
}
CFBooleanRef value_bool = base::mac::CFCast<CFBooleanRef>(value);
if (!value_bool)
- return base::Optional<bool>();
+ return absl::optional<bool>();
return value_bool == kCFBooleanTrue;
}
-base::Optional<bool> IsEnrollmentMandatoryByFile() {
+absl::optional<bool> IsEnrollmentMandatoryByFile() {
std::string options;
if (!base::ReadFileToString(base::FilePath(kEnrollmentOptionsFilePath),
&options)) {
- return base::Optional<bool>();
+ return absl::optional<bool>();
}
return std::string(base::TrimWhitespaceASCII(options, base::TRIM_ALL)) ==
kEnrollmentMandatoryOption;
@@ -185,7 +185,7 @@
}
bool BrowserDMTokenStorageMac::InitEnrollmentErrorOption() {
- base::Optional<bool> is_mandatory = IsEnrollmentMandatoryByPolicy();
+ absl::optional<bool> is_mandatory = IsEnrollmentMandatoryByPolicy();
if (is_mandatory)
return is_mandatory.value();
diff --git a/chrome/browser/policy/chrome_browser_cloud_management_register_watcher.h b/chrome/browser/policy/chrome_browser_cloud_management_register_watcher.h
index a3efb71b..f761e8b 100644
--- a/chrome/browser/policy/chrome_browser_cloud_management_register_watcher.h
+++ b/chrome/browser/policy/chrome_browser_cloud_management_register_watcher.h
@@ -11,11 +11,11 @@
#include "base/callback_forward.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/time/time.h"
#include "chrome/browser/ui/enterprise_startup_dialog.h"
#include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class ChromeBrowserCloudManagementRegisterWatcherTest;
@@ -113,7 +113,7 @@
std::unique_ptr<EnterpriseStartupDialog> dialog_;
bool is_restart_needed_ = false;
- base::Optional<bool> register_result_;
+ absl::optional<bool> register_result_;
DialogCreationCallback dialog_creation_callback_;
diff --git a/chrome/browser/policy/chrome_browser_cloud_management_register_watcher_unittest.cc b/chrome/browser/policy/chrome_browser_cloud_management_register_watcher_unittest.cc
index 0dd2e10..32de97e 100644
--- a/chrome/browser/policy/chrome_browser_cloud_management_register_watcher_unittest.cc
+++ b/chrome/browser/policy/chrome_browser_cloud_management_register_watcher_unittest.cc
@@ -67,7 +67,7 @@
void(const std::u16string&));
MOCK_METHOD2(DisplayErrorMessage,
void(const std::u16string&,
- const base::Optional<std::u16string>&));
+ const absl::optional<std::u16string>&));
MOCK_METHOD0(IsShowing, bool());
void SetCallback(EnterpriseStartupDialog::DialogResultCallback callback) {
diff --git a/chrome/browser/policy/cloud/chrome_browser_cloud_management_browsertest.cc b/chrome/browser/policy/cloud/chrome_browser_cloud_management_browsertest.cc
index 2ae0738..7d782f0 100644
--- a/chrome/browser/policy/cloud/chrome_browser_cloud_management_browsertest.cc
+++ b/chrome/browser/policy/cloud/chrome_browser_cloud_management_browsertest.cc
@@ -251,7 +251,7 @@
!enrollment_token.empty()
? DMAuth::FromEnrollmentToken(enrollment_token)
: DMAuth::NoAuth(),
- /*oauth_token=*/base::nullopt,
+ /*oauth_token=*/absl::nullopt,
g_browser_process->system_network_context_manager()
->GetSharedURLLoaderFactory(),
base::BindOnce(
diff --git a/chrome/browser/policy/cloud/device_management_service_browsertest.cc b/chrome/browser/policy/cloud/device_management_service_browsertest.cc
index 65ddb20..fdde3d7 100644
--- a/chrome/browser/policy/cloud/device_management_service_browsertest.cc
+++ b/chrome/browser/policy/cloud/device_management_service_browsertest.cc
@@ -131,7 +131,7 @@
DeviceManagementService::JobConfiguration::JobType type,
bool critical,
DMAuth auth_data,
- base::Optional<std::string> oauth_token,
+ absl::optional<std::string> oauth_token,
const em::DeviceManagementRequest request) {
std::string payload;
request.SerializeToString(&payload);
diff --git a/chrome/browser/policy/developer_tools_policy_handler.cc b/chrome/browser/policy/developer_tools_policy_handler.cc
index 8559ca9..90db425b 100644
--- a/chrome/browser/policy/developer_tools_policy_handler.cc
+++ b/chrome/browser/policy/developer_tools_policy_handler.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/policy/developer_tools_policy_handler.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/common/pref_names.h"
@@ -15,6 +14,7 @@
#include "components/prefs/pref_service.h"
#include "components/prefs/pref_value_map.h"
#include "components/strings/grit/components_strings.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -54,7 +54,7 @@
// Returns the target value of the |kDevToolsAvailability| pref derived only
// from the legacy DeveloperToolsDisabled policy. If this policy is not set or
// does not have a valid value, returns |nullopt|.
-base::Optional<Availability> GetValueFromDeveloperToolsDisabledPolicy(
+absl::optional<Availability> GetValueFromDeveloperToolsDisabledPolicy(
const PolicyMap& policies) {
const base::Value* developer_tools_disabled =
policies.GetValue(key::kDeveloperToolsDisabled);
@@ -62,7 +62,7 @@
if (CheckDeveloperToolsDisabled(developer_tools_disabled,
nullptr /*error*/) !=
PolicyCheckResult::kValid) {
- return base::nullopt;
+ return absl::nullopt;
}
return developer_tools_disabled->GetBool() ? Availability::kDisallowed
@@ -106,7 +106,7 @@
// Returns the target value of the |kDevToolsAvailability| pref derived only
// from the DeveloperToolsAvailability policy. If this policy is not set or does
// not have a valid value, returns |nullopt|.
-base::Optional<Availability> GetValueFromDeveloperToolsAvailabilityPolicy(
+absl::optional<Availability> GetValueFromDeveloperToolsAvailabilityPolicy(
const PolicyMap& policies) {
const base::Value* developer_tools_availability =
policies.GetValue(key::kDeveloperToolsAvailability);
@@ -114,7 +114,7 @@
if (CheckDeveloperToolsAvailability(developer_tools_availability,
nullptr /*error*/) !=
PolicyCheckResult::kValid) {
- return base::nullopt;
+ return absl::nullopt;
}
return static_cast<Availability>(developer_tools_availability->GetInt());
@@ -124,9 +124,9 @@
// both the DeveloperToolsDisabled policy and the
// DeveloperToolsAvailability policy. If both policies are set,
// DeveloperToolsAvailability wins.
-base::Optional<Availability> GetValueFromBothPolicies(
+absl::optional<Availability> GetValueFromBothPolicies(
const PolicyMap& policies) {
- const base::Optional<Availability> developer_tools_availability =
+ const absl::optional<Availability> developer_tools_availability =
GetValueFromDeveloperToolsAvailabilityPolicy(policies);
if (developer_tools_availability.has_value()) {
@@ -171,7 +171,7 @@
void DeveloperToolsPolicyHandler::ApplyPolicySettings(const PolicyMap& policies,
PrefValueMap* prefs) {
- const base::Optional<Availability> value = GetValueFromBothPolicies(policies);
+ const absl::optional<Availability> value = GetValueFromBothPolicies(policies);
if (value.has_value()) {
prefs->SetInteger(prefs::kDevToolsAvailability,
diff --git a/chrome/browser/policy/device_account_initializer.h b/chrome/browser/policy/device_account_initializer.h
index b2b7b18..30ca1a01 100644
--- a/chrome/browser/policy/device_account_initializer.h
+++ b/chrome/browser/policy/device_account_initializer.h
@@ -13,12 +13,12 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "components/policy/core/common/cloud/cloud_policy_client.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/core/common/cloud/cloud_policy_store.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "google_apis/gaia/gaia_oauth_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
class DMAuth;
diff --git a/chrome/browser/policy/extension_force_install_mixin.cc b/chrome/browser/policy/extension_force_install_mixin.cc
index b02fd93..75dd743 100644
--- a/chrome/browser/policy/extension_force_install_mixin.cc
+++ b/chrome/browser/policy/extension_force_install_mixin.cc
@@ -19,7 +19,6 @@
#include "base/files/scoped_temp_dir.h"
#include "base/memory/weak_ptr.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -51,6 +50,7 @@
#include "extensions/test/test_background_page_ready_observer.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/zlib/google/zip.h"
#include "url/gurl.h"
@@ -458,7 +458,7 @@
bool ExtensionForceInstallMixin::ForceInstallFromSourceDir(
const base::FilePath& extension_dir_path,
- const base::Optional<base::FilePath>& pem_path,
+ const absl::optional<base::FilePath>& pem_path,
WaitMode wait_mode,
extensions::ExtensionId* extension_id,
base::Version* extension_version) {
@@ -564,7 +564,7 @@
bool ExtensionForceInstallMixin::CreateAndServeCrx(
const base::FilePath& extension_dir_path,
- const base::Optional<base::FilePath>& pem_path,
+ const absl::optional<base::FilePath>& pem_path,
const base::Version& extension_version,
extensions::ExtensionId* extension_id) {
base::ScopedAllowBlockingForTesting scoped_allow_blocking;
diff --git a/chrome/browser/policy/extension_force_install_mixin.h b/chrome/browser/policy/extension_force_install_mixin.h
index e884c7f0..bb3c8f3ed 100644
--- a/chrome/browser/policy/extension_force_install_mixin.h
+++ b/chrome/browser/policy/extension_force_install_mixin.h
@@ -10,11 +10,11 @@
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "build/chromeos_buildflags.h"
#include "chrome/test/base/mixin_based_in_process_browser_test.h"
#include "extensions/common/extension_id.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
class Profile;
@@ -131,7 +131,7 @@
// version.
bool ForceInstallFromSourceDir(
const base::FilePath& extension_dir_path,
- const base::Optional<base::FilePath>& pem_path,
+ const absl::optional<base::FilePath>& pem_path,
WaitMode wait_mode,
extensions::ExtensionId* extension_id = nullptr,
base::Version* extension_version = nullptr) WARN_UNUSED_RESULT;
@@ -168,7 +168,7 @@
// random key otherwise) and makes the produced CRX file served by the
// embedded test server.
bool CreateAndServeCrx(const base::FilePath& extension_dir_path,
- const base::Optional<base::FilePath>& pem_path,
+ const absl::optional<base::FilePath>& pem_path,
const base::Version& extension_version,
extensions::ExtensionId* extension_id);
// Force-installs the CRX file served by the embedded test server.
diff --git a/chrome/browser/policy/extension_policy_browsertest.cc b/chrome/browser/policy/extension_policy_browsertest.cc
index 9a73ccf..1ea17fc 100644
--- a/chrome/browser/policy/extension_policy_browsertest.cc
+++ b/chrome/browser/policy/extension_policy_browsertest.cc
@@ -2516,7 +2516,7 @@
protected:
std::string test_page_;
GURL policy_app_url_;
- base::Optional<std::string> fallback_app_name_;
+ absl::optional<std::string> fallback_app_name_;
};
IN_PROC_BROWSER_TEST_F(WebAppInstallForceListPolicyTest, StartUpInstallation) {
@@ -2524,7 +2524,7 @@
web_app::WebAppProviderBase::GetProviderBase(browser()->profile())
->registrar();
web_app::WebAppInstallObserver install_observer(browser()->profile());
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
registrar.FindAppWithUrlInScope(policy_app_url_);
if (!app_id)
app_id = install_observer.AwaitNextInstall();
@@ -2556,7 +2556,7 @@
web_app::WebAppProviderBase::GetProviderBase(browser()->profile())
->registrar();
web_app::WebAppInstallObserver install_observer(browser()->profile());
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
registrar.FindAppWithUrlInScope(policy_app_url_);
if (!app_id)
app_id = install_observer.AwaitNextInstall();
@@ -2588,7 +2588,7 @@
web_app::WebAppProviderBase::GetProviderBase(browser()->profile())
->registrar();
web_app::WebAppInstallObserver install_observer(browser()->profile());
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
registrar.FindAppWithUrlInScope(policy_app_url_);
if (!app_id)
app_id = install_observer.AwaitNextInstall();
@@ -2617,7 +2617,7 @@
web_app::WebAppProviderBase::GetProviderBase(browser()->profile())
->registrar();
web_app::WebAppInstallObserver install_observer(browser()->profile());
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
registrar.FindAppWithUrlInScope(policy_app_url_);
if (!app_id)
app_id = install_observer.AwaitNextInstall();
@@ -2650,7 +2650,7 @@
web_app::WebAppProviderBase::GetProviderBase(browser()->profile())
->registrar();
web_app::WebAppInstallObserver install_observer(browser()->profile());
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
registrar.FindAppWithUrlInScope(policy_app_url_);
if (!app_id)
app_id = install_observer.AwaitNextInstall();
diff --git a/chrome/browser/policy/messaging_layer/public/report_client_unittest.cc b/chrome/browser/policy/messaging_layer/public/report_client_unittest.cc
index b0aa2c1d..4cf6c4f 100644
--- a/chrome/browser/policy/messaging_layer/public/report_client_unittest.cc
+++ b/chrome/browser/policy/messaging_layer/public/report_client_unittest.cc
@@ -165,7 +165,7 @@
.WillOnce(WithArgs<0, 2>(Invoke(
[this](base::Value payload,
policy::CloudPolicyClient::ResponseCallback done_cb) {
- base::Optional<bool> const attach_encryption_settings =
+ absl::optional<bool> const attach_encryption_settings =
payload.FindBoolKey("attachEncryptionSettings");
ASSERT_TRUE(attach_encryption_settings.has_value());
ASSERT_TRUE(attach_encryption_settings
diff --git a/chrome/browser/policy/messaging_layer/public/report_queue_impl_unittest.cc b/chrome/browser/policy/messaging_layer/public/report_queue_impl_unittest.cc
index 698bb04..1c4cfc25 100644
--- a/chrome/browser/policy/messaging_layer/public/report_queue_impl_unittest.cc
+++ b/chrome/browser/policy/messaging_layer/public/report_queue_impl_unittest.cc
@@ -11,7 +11,6 @@
#include "base/json/json_reader.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/test/task_environment.h"
#include "base/values.h"
#include "chrome/browser/policy/messaging_layer/proto/test.pb.h"
@@ -26,6 +25,7 @@
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using ::testing::_;
using ::testing::Eq;
@@ -120,7 +120,7 @@
EXPECT_EQ(test_storage_module()->priority(), priority_);
- base::Optional<base::Value> value_result =
+ absl::optional<base::Value> value_result =
base::JSONReader::Read(test_storage_module()->record().data());
ASSERT_TRUE(value_result);
EXPECT_EQ(value_result.value(), test_dict);
diff --git a/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service.h b/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service.h
index 87bf7c6..47867b5 100644
--- a/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service.h
+++ b/chrome/browser/policy/messaging_layer/upload/dm_server_upload_service.h
@@ -151,7 +151,7 @@
EncryptionKeyAttachedCallback encryption_key_attached_cb_;
RecordHandler* handler_;
- base::Optional<SequencingInformation> highest_successful_sequence_;
+ absl::optional<SequencingInformation> highest_successful_sequence_;
SEQUENCE_CHECKER(sequence_checker_);
};
diff --git a/chrome/browser/policy/messaging_layer/upload/fake_upload_client.cc b/chrome/browser/policy/messaging_layer/upload/fake_upload_client.cc
index a358362dd..2d853e13 100644
--- a/chrome/browser/policy/messaging_layer/upload/fake_upload_client.cc
+++ b/chrome/browser/policy/messaging_layer/upload/fake_upload_client.cc
@@ -9,23 +9,23 @@
#include "base/base64.h"
#include "base/json/json_reader.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "chrome/browser/policy/messaging_layer/upload/record_upload_request_builder.h"
#include "components/reporting/proto/record.pb.h"
#include "components/reporting/proto/record_constants.pb.h"
#include "components/reporting/util/status.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace reporting {
namespace {
-base::Optional<Priority> GetPriorityFromSequencingInformationValue(
+absl::optional<Priority> GetPriorityFromSequencingInformationValue(
const base::Value& sequencing_information) {
- const base::Optional<int> priority_result =
+ const absl::optional<int> priority_result =
sequencing_information.FindIntKey("priority");
if (!priority_result.has_value() ||
!Priority_IsValid(priority_result.value())) {
- return base::nullopt;
+ return absl::nullopt;
}
return Priority(priority_result.value());
}
@@ -122,7 +122,7 @@
return Status::StatusOK();
}
-void FakeUploadClient::OnUploadComplete(base::Optional<base::Value> response) {
+void FakeUploadClient::OnUploadComplete(absl::optional<base::Value> response) {
if (!response.has_value()) {
return;
}
diff --git a/chrome/browser/policy/messaging_layer/upload/fake_upload_client.h b/chrome/browser/policy/messaging_layer/upload/fake_upload_client.h
index deb3212..ee65483 100644
--- a/chrome/browser/policy/messaging_layer/upload/fake_upload_client.h
+++ b/chrome/browser/policy/messaging_layer/upload/fake_upload_client.h
@@ -30,7 +30,7 @@
ReportSuccessfulUploadCallback report_upload_success_cb,
EncryptionKeyAttachedCallback encryption_key_attached_cb);
- void OnUploadComplete(base::Optional<base::Value> response);
+ void OnUploadComplete(absl::optional<base::Value> response);
policy::CloudPolicyClient* const cloud_policy_client_;
ReportSuccessfulUploadCallback report_upload_success_cb_;
diff --git a/chrome/browser/policy/messaging_layer/upload/record_handler_impl.cc b/chrome/browser/policy/messaging_layer/upload/record_handler_impl.cc
index f49fad9f..8e8170c 100644
--- a/chrome/browser/policy/messaging_layer/upload/record_handler_impl.cc
+++ b/chrome/browser/policy/messaging_layer/upload/record_handler_impl.cc
@@ -11,7 +11,6 @@
#include "base/callback.h"
#include "base/containers/queue.h"
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
@@ -31,15 +30,16 @@
#include "components/reporting/util/task_runner_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace reporting {
namespace {
// Priority could come back as an int or as a std::string, this function handles
// both situations.
-base::Optional<Priority> GetPriorityProtoFromSequencingInformationValue(
+absl::optional<Priority> GetPriorityProtoFromSequencingInformationValue(
const base::Value& sequencing_information) {
- const base::Optional<int> int_priority_result =
+ const absl::optional<int> int_priority_result =
sequencing_information.FindIntKey("priority");
if (int_priority_result.has_value()) {
return Priority(int_priority_result.value());
@@ -50,14 +50,14 @@
if (!str_priority_result) {
LOG(ERROR) << "Field priority is missing from SequencingInformation: "
<< sequencing_information;
- return base::nullopt;
+ return absl::nullopt;
}
Priority priority;
if (!Priority_Parse(*str_priority_result, &priority)) {
LOG(ERROR) << "Unable to parse field priority in SequencingInformation: "
<< sequencing_information;
- return base::nullopt;
+ return absl::nullopt;
}
return priority;
}
@@ -83,7 +83,7 @@
void OnStart() override;
void StartUpload();
- void OnUploadComplete(base::Optional<base::Value> response);
+ void OnUploadComplete(absl::optional<base::Value> response);
void HandleFailedUpload();
void HandleSuccessfulUpload();
void Complete(DmServerUploadService::CompletionResponse result);
@@ -95,7 +95,7 @@
// "generationId": 4321
// "priority": 3
// }
- base::Optional<EncryptedRecord> HandleFailedUploadedSequencingInformation(
+ absl::optional<EncryptedRecord> HandleFailedUploadedSequencingInformation(
const base::Value& sequencing_information);
// Helper function for converting a base::Value representation of
@@ -123,7 +123,7 @@
EncryptedRecord gap_record_;
// Set for the highest record being uploaded.
- base::Optional<SequencingInformation> highest_sequencing_information_;
+ absl::optional<SequencingInformation> highest_sequencing_information_;
// Set to |true| if force_confirm flag is present. |false| by default.
bool force_confirm_{false};
@@ -184,7 +184,7 @@
}
auto request_result = request_builder.Build();
if (!request_result.has_value()) {
- std::move(response_cb).Run(base::nullopt);
+ std::move(response_cb).Run(absl::nullopt);
return;
}
@@ -197,7 +197,7 @@
FROM_HERE,
base::BindOnce(
[](policy::CloudPolicyClient* client, base::Value request,
- base::OnceCallback<void(base::Optional<base::Value>)>
+ base::OnceCallback<void(absl::optional<base::Value>)>
response_cb) {
client->UploadEncryptedReport(
std::move(request),
@@ -208,7 +208,7 @@
}
void RecordHandlerImpl::ReportUploader::OnUploadComplete(
- base::Optional<base::Value> response) {
+ absl::optional<base::Value> response) {
if (!response.has_value()) {
Schedule(&RecordHandlerImpl::ReportUploader::HandleFailedUpload,
base::Unretained(this));
@@ -331,12 +331,12 @@
Complete(Status(error::INTERNAL, "Unable to upload any records"));
}
-base::Optional<EncryptedRecord>
+absl::optional<EncryptedRecord>
RecordHandlerImpl::ReportUploader::HandleFailedUploadedSequencingInformation(
const base::Value& sequencing_information) {
if (!highest_sequencing_information_.has_value()) {
LOG(ERROR) << "highest_sequencing_information_ has no value.";
- return base::nullopt;
+ return absl::nullopt;
}
auto seq_info_result =
@@ -345,7 +345,7 @@
LOG(ERROR) << "Server responded with an invalid SequencingInformation for "
"firstFailedUploadedRecord.failedUploadedRecord:"
<< sequencing_information;
- return base::nullopt;
+ return absl::nullopt;
}
SequencingInformation& seq_info = seq_info_result.ValueOrDie();
@@ -357,7 +357,7 @@
seq_info.priority() != highest_sequencing_information_->priority() ||
seq_info.sequencing_id() !=
highest_sequencing_information_->sequencing_id() + 1) {
- return base::nullopt;
+ return absl::nullopt;
}
// Build a gap record and return it.
diff --git a/chrome/browser/policy/messaging_layer/upload/record_handler_impl.h b/chrome/browser/policy/messaging_layer/upload/record_handler_impl.h
index d7ebce731..cc4df31f 100644
--- a/chrome/browser/policy/messaging_layer/upload/record_handler_impl.h
+++ b/chrome/browser/policy/messaging_layer/upload/record_handler_impl.h
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/task/post_task.h"
#include "base/task_runner.h"
@@ -23,6 +22,7 @@
#include "components/reporting/util/status_macros.h"
#include "components/reporting/util/statusor.h"
#include "components/reporting/util/task_runner_context.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace reporting {
diff --git a/chrome/browser/policy/messaging_layer/upload/record_handler_impl_unittest.cc b/chrome/browser/policy/messaging_layer/upload/record_handler_impl_unittest.cc
index 03e10b8c..14b58fd 100644
--- a/chrome/browser/policy/messaging_layer/upload/record_handler_impl_unittest.cc
+++ b/chrome/browser/policy/messaging_layer/upload/record_handler_impl_unittest.cc
@@ -8,7 +8,6 @@
#include "base/base64.h"
#include "base/json/json_writer.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/synchronization/waitable_event.h"
@@ -29,6 +28,7 @@
#include "components/reporting/util/test_support_callbacks.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using ::testing::_;
using ::testing::AllOf;
@@ -106,14 +106,14 @@
}
}
-base::Optional<base::Value> BuildEncryptionSettingsFromRequest(
+absl::optional<base::Value> BuildEncryptionSettingsFromRequest(
const base::Value& request) {
// If attach_encryption_settings it true, process that.
const auto attach_encryption_settings =
request.FindBoolKey("attachEncryptionSettings");
if (!attach_encryption_settings.has_value() ||
!attach_encryption_settings.value()) {
- return base::nullopt;
+ return absl::nullopt;
}
base::Value encryption_settings{base::Value::Type::DICTIONARY};
@@ -360,8 +360,8 @@
EXPECT_CALL(*client_, UploadEncryptedReport(_, _, _))
.WillOnce(WithArgs<2>(Invoke(
- [](base::OnceCallback<void(base::Optional<base::Value>)> callback) {
- std::move(callback).Run(base::nullopt);
+ [](base::OnceCallback<void(absl::optional<base::Value>)> callback) {
+ std::move(callback).Run(absl::nullopt);
})));
test::TestEvent<DmServerUploadService::CompletionResponse> response_event;
diff --git a/chrome/browser/policy/messaging_layer/upload/record_upload_request_builder.cc b/chrome/browser/policy/messaging_layer/upload/record_upload_request_builder.cc
index 462f340..05e9bee 100644
--- a/chrome/browser/policy/messaging_layer/upload/record_upload_request_builder.cc
+++ b/chrome/browser/policy/messaging_layer/upload/record_upload_request_builder.cc
@@ -72,7 +72,7 @@
auto record_result = EncryptedRecordDictionaryBuilder(record).Build();
if (!record_result.has_value()) {
// Record has errors. Stop here.
- result_ = base::nullopt;
+ result_ = absl::nullopt;
return *this;
}
@@ -80,7 +80,7 @@
return *this;
}
-base::Optional<base::Value> UploadEncryptedReportingRequestBuilder::Build() {
+absl::optional<base::Value> UploadEncryptedReportingRequestBuilder::Build() {
return std::move(result_);
}
@@ -155,7 +155,7 @@
EncryptedRecordDictionaryBuilder::~EncryptedRecordDictionaryBuilder() = default;
-base::Optional<base::Value> EncryptedRecordDictionaryBuilder::Build() {
+absl::optional<base::Value> EncryptedRecordDictionaryBuilder::Build() {
return std::move(result_);
}
@@ -206,7 +206,7 @@
SequencingInformationDictionaryBuilder::
~SequencingInformationDictionaryBuilder() = default;
-base::Optional<base::Value> SequencingInformationDictionaryBuilder::Build() {
+absl::optional<base::Value> SequencingInformationDictionaryBuilder::Build() {
return std::move(result_);
}
@@ -248,7 +248,7 @@
EncryptionInfoDictionaryBuilder::~EncryptionInfoDictionaryBuilder() = default;
-base::Optional<base::Value> EncryptionInfoDictionaryBuilder::Build() {
+absl::optional<base::Value> EncryptionInfoDictionaryBuilder::Build() {
return std::move(result_);
}
diff --git a/chrome/browser/policy/messaging_layer/upload/record_upload_request_builder.h b/chrome/browser/policy/messaging_layer/upload/record_upload_request_builder.h
index fdd750e..5e73dce0 100644
--- a/chrome/browser/policy/messaging_layer/upload/record_upload_request_builder.h
+++ b/chrome/browser/policy/messaging_layer/upload/record_upload_request_builder.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_POLICY_MESSAGING_LAYER_UPLOAD_RECORD_UPLOAD_REQUEST_BUILDER_H_
#define CHROME_BROWSER_POLICY_MESSAGING_LAYER_UPLOAD_RECORD_UPLOAD_REQUEST_BUILDER_H_
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "base/values.h"
#include "components/reporting/proto/record.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace reporting {
@@ -85,14 +85,14 @@
UploadEncryptedReportingRequestBuilder& AddRecord(
const EncryptedRecord& record);
- base::Optional<base::Value> Build();
+ absl::optional<base::Value> Build();
static base::StringPiece GetEncryptedRecordListPath();
static base::StringPiece GetAttachEncryptionSettingsPath();
static const char kEncryptedRecordListKey_[];
- base::Optional<base::Value> result_;
+ absl::optional<base::Value> result_;
};
// Builds a |base::Value| dictionary from a |EncryptedRecord|
@@ -102,7 +102,7 @@
explicit EncryptedRecordDictionaryBuilder(const EncryptedRecord& record);
~EncryptedRecordDictionaryBuilder();
- base::Optional<base::Value> Build();
+ absl::optional<base::Value> Build();
static base::StringPiece GetEncryptedWrappedRecordPath();
static base::StringPiece GetUnsignedSequencingInformationKeyPath();
@@ -110,7 +110,7 @@
static base::StringPiece GetEncryptionInfoPath();
private:
- base::Optional<base::Value> result_;
+ absl::optional<base::Value> result_;
};
// Builds a |base::Value| dictionary from a |SequencingInformation|
@@ -121,14 +121,14 @@
const SequencingInformation& sequencing_information);
~SequencingInformationDictionaryBuilder();
- base::Optional<base::Value> Build();
+ absl::optional<base::Value> Build();
static base::StringPiece GetSequencingIdPath();
static base::StringPiece GetGenerationIdPath();
static base::StringPiece GetPriorityPath();
private:
- base::Optional<base::Value> result_;
+ absl::optional<base::Value> result_;
};
// Builds a |base::Value| dictionary from a |EncryptionInfo| proto.
@@ -138,13 +138,13 @@
const EncryptionInfo& encryption_info);
~EncryptionInfoDictionaryBuilder();
- base::Optional<base::Value> Build();
+ absl::optional<base::Value> Build();
static base::StringPiece GetEncryptionKeyPath();
static base::StringPiece GetPublicKeyIdPath();
private:
- base::Optional<base::Value> result_;
+ absl::optional<base::Value> result_;
};
} // namespace reporting
diff --git a/chrome/browser/policy/messaging_layer/upload/upload_client_unittest.cc b/chrome/browser/policy/messaging_layer/upload/upload_client_unittest.cc
index 332741b..86cc85d1 100644
--- a/chrome/browser/policy/messaging_layer/upload/upload_client_unittest.cc
+++ b/chrome/browser/policy/messaging_layer/upload/upload_client_unittest.cc
@@ -62,7 +62,7 @@
// Helper function composes JSON represented as base::Value from Sequencing
// information in request.
base::Value ValueFromSucceededSequencingInfo(
- const base::Optional<base::Value> request,
+ const absl::optional<base::Value> request,
bool force_confirm_flag) {
EXPECT_TRUE(request.has_value());
EXPECT_TRUE(request.value().is_dict());
diff --git a/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.cc b/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.cc
index 090626c..77122d3 100644
--- a/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.cc
+++ b/chrome/browser/policy/messaging_layer/util/report_queue_manual_test_context.cc
@@ -6,7 +6,6 @@
#include "base/callback.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
@@ -21,6 +20,7 @@
#include "components/reporting/util/task_runner_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace reporting {
diff --git a/chrome/browser/policy/policy_test_utils.cc b/chrome/browser/policy/policy_test_utils.cc
index ef45a934..87317ab 100644
--- a/chrome/browser/policy/policy_test_utils.cc
+++ b/chrome/browser/policy/policy_test_utils.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/policy/policy_test_utils.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/current_thread.h"
@@ -39,6 +38,7 @@
#include "net/dns/mock_host_resolver.h"
#include "net/http/transport_security_state.h"
#include "services/network/public/mojom/network_service_test.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ui/snapshot/screenshot_grabber.h"
@@ -217,16 +217,16 @@
// static
void PolicyTest::SetPolicy(PolicyMap* policies,
const char* key,
- base::Optional<base::Value> value) {
+ absl::optional<base::Value> value) {
policies->Set(key, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD, std::move(value), nullptr);
}
void PolicyTest::ApplySafeSearchPolicy(
- base::Optional<base::Value> legacy_safe_search,
- base::Optional<base::Value> google_safe_search,
- base::Optional<base::Value> legacy_youtube,
- base::Optional<base::Value> youtube_restrict) {
+ absl::optional<base::Value> legacy_safe_search,
+ absl::optional<base::Value> google_safe_search,
+ absl::optional<base::Value> legacy_youtube,
+ absl::optional<base::Value> youtube_restrict) {
PolicyMap policies;
SetPolicy(&policies, key::kForceSafeSearch, std::move(legacy_safe_search));
SetPolicy(&policies, key::kForceGoogleSafeSearch,
diff --git a/chrome/browser/policy/policy_test_utils.h b/chrome/browser/policy/policy_test_utils.h
index 3af3e98..c498f34 100644
--- a/chrome/browser/policy/policy_test_utils.h
+++ b/chrome/browser/policy/policy_test_utils.h
@@ -71,12 +71,12 @@
static void SetPolicy(PolicyMap* policies,
const char* key,
- base::Optional<base::Value> value);
+ absl::optional<base::Value> value);
- void ApplySafeSearchPolicy(base::Optional<base::Value> legacy_safe_search,
- base::Optional<base::Value> google_safe_search,
- base::Optional<base::Value> legacy_youtube,
- base::Optional<base::Value> youtube_restrict);
+ void ApplySafeSearchPolicy(absl::optional<base::Value> legacy_safe_search,
+ absl::optional<base::Value> google_safe_search,
+ absl::optional<base::Value> legacy_youtube,
+ absl::optional<base::Value> youtube_restrict);
#if BUILDFLAG(IS_CHROMEOS_ASH)
void TestScreenshotFile(bool enabled);
diff --git a/chrome/browser/policy/printing_restrictions_policy_handler.cc b/chrome/browser/policy/printing_restrictions_policy_handler.cc
index de8c7e9a..007634d 100644
--- a/chrome/browser/policy/printing_restrictions_policy_handler.cc
+++ b/chrome/browser/policy/printing_restrictions_policy_handler.cc
@@ -49,7 +49,7 @@
Mode* result) {
const base::Value* value;
if (CheckAndGetValue(policies, errors, &value) && value) {
- base::Optional<Mode> mode;
+ absl::optional<Mode> mode;
auto it = policy_value_to_mode_.find(value->GetString());
if (it != policy_value_to_mode_.end())
mode = it->second;
diff --git a/chrome/browser/policy/printing_restrictions_policy_handler_unittest.cc b/chrome/browser/policy/printing_restrictions_policy_handler_unittest.cc
index ef3c1b64..3de82598 100644
--- a/chrome/browser/policy/printing_restrictions_policy_handler_unittest.cc
+++ b/chrome/browser/policy/printing_restrictions_policy_handler_unittest.cc
@@ -32,7 +32,7 @@
void ApplyPolicies() { handler_.ApplyPolicySettings(policies_, &prefs_); }
void CheckValidPolicy(const std::string& policy_value) {
- base::Optional<base::Value> printing_paper_size_default =
+ absl::optional<base::Value> printing_paper_size_default =
base::JSONReader::Read(policy_value);
ASSERT_TRUE(printing_paper_size_default.has_value());
EXPECT_TRUE(CheckPolicy(printing_paper_size_default.value().Clone()));
@@ -46,7 +46,7 @@
}
void CheckInvalidPolicy(const std::string& policy_value) {
- base::Optional<base::Value> printing_paper_size_default =
+ absl::optional<base::Value> printing_paper_size_default =
base::JSONReader::Read(policy_value);
ASSERT_TRUE(printing_paper_size_default.has_value());
EXPECT_FALSE(CheckPolicy(printing_paper_size_default.value().Clone()));
diff --git a/chrome/browser/policy/serial_allow_usb_devices_for_urls_policy_handler_unittest.cc b/chrome/browser/policy/serial_allow_usb_devices_for_urls_policy_handler_unittest.cc
index 0d709a37..a9bec5d5 100644
--- a/chrome/browser/policy/serial_allow_usb_devices_for_urls_policy_handler_unittest.cc
+++ b/chrome/browser/policy/serial_allow_usb_devices_for_urls_policy_handler_unittest.cc
@@ -19,7 +19,7 @@
namespace {
-base::Optional<base::Value> ReadJson(base::StringPiece json) {
+absl::optional<base::Value> ReadJson(base::StringPiece json) {
auto result = base::JSONReader::ReadAndReturnValueWithError(json);
EXPECT_TRUE(result.value) << result.error_message;
return std::move(result.value);
diff --git a/chrome/browser/policy/test/audio_process_high_priority_enabled_browsertest.cc b/chrome/browser/policy/test/audio_process_high_priority_enabled_browsertest.cc
index 6756266..57244cc 100644
--- a/chrome/browser/policy/test/audio_process_high_priority_enabled_browsertest.cc
+++ b/chrome/browser/policy/test/audio_process_high_priority_enabled_browsertest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/feature_list.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/media/audio_service_util.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
@@ -16,13 +15,14 @@
#include "content/public/test/browser_test.h"
#include "sandbox/policy/features.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
class AudioProcessHighPriorityEnabledTest
: public InProcessBrowserTest,
public ::testing::WithParamInterface<
- /*policy::key::kAudioProcessHighPriorityEnabled=*/base::Optional<
+ /*policy::key::kAudioProcessHighPriorityEnabled=*/absl::optional<
bool>> {
public:
// InProcessBrowserTest implementation:
@@ -48,7 +48,7 @@
};
IN_PROC_BROWSER_TEST_P(AudioProcessHighPriorityEnabledTest, IsRespected) {
- base::Optional<bool> enable_high_priority_via_policy = GetParam();
+ absl::optional<bool> enable_high_priority_via_policy = GetParam();
bool is_high_priority_enabled_by_default =
base::FeatureList::IsEnabled(features::kAudioProcessHighPriorityWin);
@@ -71,6 +71,6 @@
NotSet,
AudioProcessHighPriorityEnabledTest,
::testing::Values(
- /*policy::key::kAudioProcessHighPriorityEnabled=*/base::nullopt));
+ /*policy::key::kAudioProcessHighPriorityEnabled=*/absl::nullopt));
} // namespace policy
diff --git a/chrome/browser/policy/test/audio_sandbox_enabled_browsertest.cc b/chrome/browser/policy/test/audio_sandbox_enabled_browsertest.cc
index 19481a6..ef6fd0c 100644
--- a/chrome/browser/policy/test/audio_sandbox_enabled_browsertest.cc
+++ b/chrome/browser/policy/test/audio_sandbox_enabled_browsertest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/feature_list.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/media/audio_service_util.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
@@ -16,13 +15,14 @@
#include "content/public/test/browser_test.h"
#include "sandbox/policy/features.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
class AudioSandboxEnabledTest
: public InProcessBrowserTest,
public ::testing::WithParamInterface<
- /*policy::key::kAllowAudioSandbox=*/base::Optional<bool>> {
+ /*policy::key::kAllowAudioSandbox=*/absl::optional<bool>> {
public:
// InProcessBrowserTest implementation:
void SetUp() override {
@@ -47,7 +47,7 @@
};
IN_PROC_BROWSER_TEST_P(AudioSandboxEnabledTest, IsRespected) {
- base::Optional<bool> enable_sandbox_via_policy = GetParam();
+ absl::optional<bool> enable_sandbox_via_policy = GetParam();
bool is_sandbox_enabled_by_default =
base::FeatureList::IsEnabled(features::kAudioServiceSandbox);
@@ -68,6 +68,6 @@
INSTANTIATE_TEST_SUITE_P(
NotSet,
AudioSandboxEnabledTest,
- ::testing::Values(/*policy::key::kAudioSandboxEnabled=*/base::nullopt));
+ ::testing::Values(/*policy::key::kAudioSandboxEnabled=*/absl::nullopt));
} // namespace policy
diff --git a/chrome/browser/policy/test/certificate_transparency_policy_browsertest.cc b/chrome/browser/policy/test/certificate_transparency_policy_browsertest.cc
index 33d9a07..cda5faf 100644
--- a/chrome/browser/policy/test/certificate_transparency_policy_browsertest.cc
+++ b/chrome/browser/policy/test/certificate_transparency_policy_browsertest.cc
@@ -33,7 +33,7 @@
~CertificateTransparencyPolicyTest() override {
SystemNetworkContextManager::SetEnableCertificateTransparencyForTesting(
- base::nullopt);
+ absl::nullopt);
}
};
diff --git a/chrome/browser/policy/test/force_google_safe_search_policy_browsertest.cc b/chrome/browser/policy/test/force_google_safe_search_policy_browsertest.cc
index 09d77ffd..b5b39fcc 100644
--- a/chrome/browser/policy/test/force_google_safe_search_policy_browsertest.cc
+++ b/chrome/browser/policy/test/force_google_safe_search_policy_browsertest.cc
@@ -4,7 +4,6 @@
#include <set>
-#include "base/optional.h"
#include "base/synchronization/lock.h"
#include "base/test/bind.h"
#include "base/values.h"
@@ -22,6 +21,7 @@
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/url_loader_interceptor.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace policy {
@@ -51,18 +51,18 @@
// Override the default SafeSearch setting using policies.
ApplySafeSearchPolicy(
legacy_safe_search == 0
- ? base::nullopt
- : base::make_optional<base::Value>(legacy_safe_search == 1),
+ ? absl::nullopt
+ : absl::make_optional<base::Value>(legacy_safe_search == 1),
google_safe_search == 0
- ? base::nullopt
- : base::make_optional<base::Value>(google_safe_search == 1),
+ ? absl::nullopt
+ : absl::make_optional<base::Value>(google_safe_search == 1),
legacy_youtube == 0
- ? base::nullopt
- : base::make_optional<base::Value>(legacy_youtube == 1),
+ ? absl::nullopt
+ : absl::make_optional<base::Value>(legacy_youtube == 1),
youtube_restrict == 0
- ? base::nullopt // subtracting 1 gives
+ ? absl::nullopt // subtracting 1 gives
// 0,1,2, see above
- : base::make_optional<base::Value>(youtube_restrict - 1));
+ : absl::make_optional<base::Value>(youtube_restrict - 1));
// The legacy ForceSafeSearch policy should only have an effect if none of
// the other 3 policies are defined.
@@ -136,12 +136,12 @@
for (int safe_search = 0; safe_search < 3; safe_search++) {
// Override the Google safe search policy.
ApplySafeSearchPolicy(
- base::nullopt, // ForceSafeSearch
+ absl::nullopt, // ForceSafeSearch
safe_search == 0 // ForceGoogleSafeSearch
- ? base::nullopt
- : base::make_optional<base::Value>(safe_search == 1),
- base::nullopt, // ForceYouTubeSafetyMode
- base::nullopt); // ForceYouTubeRestrict
+ ? absl::nullopt
+ : absl::make_optional<base::Value>(safe_search == 1),
+ absl::nullopt, // ForceYouTubeSafetyMode
+ absl::nullopt); // ForceYouTubeRestrict
// Verify that the safe search pref behaves the way we expect.
PrefService* prefs = browser()->profile()->GetPrefs();
EXPECT_EQ(safe_search != 0,
diff --git a/chrome/browser/policy/test/note_taking_on_lock_screen_policy_browsertest.cc b/chrome/browser/policy/test/note_taking_on_lock_screen_policy_browsertest.cc
index 8895f3b..8f20b08 100644
--- a/chrome/browser/policy/test/note_taking_on_lock_screen_policy_browsertest.cc
+++ b/chrome/browser/policy/test/note_taking_on_lock_screen_policy_browsertest.cc
@@ -6,7 +6,6 @@
#include "ash/public/cpp/ash_switches.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/chromeos/note_taking_helper.h"
#include "chrome/browser/policy/policy_test_utils.h"
@@ -19,6 +18,7 @@
#include "content/public/test/browser_test_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/switches.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -51,7 +51,7 @@
enabled_on_lock_screen);
}
- void SetPolicyValue(base::Optional<base::Value> value) {
+ void SetPolicyValue(absl::optional<base::Value> value) {
PolicyMap policies;
if (value) {
policies.Set(key::kNoteTakingAppsLockScreenAllowlist,
@@ -93,7 +93,7 @@
EXPECT_EQ(chromeos::NoteTakingLockScreenSupport::kNotAllowedByPolicy,
GetAppLockScreenStatus(app->id()));
- SetPolicyValue(base::nullopt);
+ SetPolicyValue(absl::nullopt);
EXPECT_EQ(chromeos::NoteTakingLockScreenSupport::kEnabled,
GetAppLockScreenStatus(app->id()));
}
diff --git a/chrome/browser/policy/test/policy_browsertest.cc b/chrome/browser/policy/test/policy_browsertest.cc
index 0cf3d09..48fb5b1 100644
--- a/chrome/browser/policy/test/policy_browsertest.cc
+++ b/chrome/browser/policy/test/policy_browsertest.cc
@@ -36,7 +36,6 @@
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/strings/strcat.h"
@@ -144,6 +143,7 @@
#include "services/service_manager/public/cpp/connector.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h"
diff --git a/chrome/browser/policy/test/policy_test_google_browsertest.cc b/chrome/browser/policy/test/policy_test_google_browsertest.cc
index 7a8c200..2199c8f 100644
--- a/chrome/browser/policy/test/policy_test_google_browsertest.cc
+++ b/chrome/browser/policy/test/policy_test_google_browsertest.cc
@@ -6,7 +6,6 @@
#include <string>
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/synchronization/lock.h"
#include "base/test/bind.h"
#include "base/values.h"
@@ -24,6 +23,7 @@
#include "net/http/http_request_headers.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace policy {
@@ -78,10 +78,10 @@
};
IN_PROC_BROWSER_TEST_F(PolicyTestGoogle, ForceGoogleSafeSearch) {
- ApplySafeSearchPolicy(base::nullopt, // ForceSafeSearch
+ ApplySafeSearchPolicy(absl::nullopt, // ForceSafeSearch
base::Value(true),
- base::nullopt, // ForceYouTubeSafetyMode
- base::nullopt); // ForceYouTubeRestrict
+ absl::nullopt, // ForceYouTubeSafetyMode
+ absl::nullopt); // ForceYouTubeRestrict
GURL url = https_server()->GetURL("www.google.com",
"/server-redirect?http://google.com/");
@@ -92,9 +92,9 @@
for (int youtube_restrict_mode = safe_search_util::YOUTUBE_RESTRICT_OFF;
youtube_restrict_mode < safe_search_util::YOUTUBE_RESTRICT_COUNT;
++youtube_restrict_mode) {
- ApplySafeSearchPolicy(base::nullopt, // ForceSafeSearch
- base::nullopt, // ForceGoogleSafeSearch
- base::nullopt, // ForceYouTubeSafetyMode
+ ApplySafeSearchPolicy(absl::nullopt, // ForceSafeSearch
+ absl::nullopt, // ForceGoogleSafeSearch
+ absl::nullopt, // ForceYouTubeSafetyMode
base::Value(youtube_restrict_mode));
{
// First check frame requests.
diff --git a/chrome/browser/policy/webusb_allow_devices_for_urls_policy_handler_unittest.cc b/chrome/browser/policy/webusb_allow_devices_for_urls_policy_handler_unittest.cc
index ae91750a..525a0d7 100644
--- a/chrome/browser/policy/webusb_allow_devices_for_urls_policy_handler_unittest.cc
+++ b/chrome/browser/policy/webusb_allow_devices_for_urls_policy_handler_unittest.cc
@@ -203,7 +203,7 @@
}
])";
-base::Optional<base::Value> ReadJson(base::StringPiece json) {
+absl::optional<base::Value> ReadJson(base::StringPiece json) {
auto result = base::JSONReader::ReadAndReturnValueWithError(json);
EXPECT_TRUE(result.value) << result.error_message;
return std::move(result.value);
@@ -612,7 +612,7 @@
store_->GetValue(prefs::kManagedWebUsbAllowDevicesForUrls, &pref_value));
EXPECT_TRUE(pref_value);
- base::Optional<base::Value> expected_pref_value =
+ absl::optional<base::Value> expected_pref_value =
ReadJson(kInvalidPolicyUnknownPropertyAfterCleanup);
EXPECT_EQ(*expected_pref_value, *pref_value);
}
@@ -795,7 +795,7 @@
store_->GetValue(prefs::kManagedWebUsbAllowDevicesForUrls, &pref_value));
ASSERT_TRUE(pref_value);
- base::Optional<base::Value> expected_pref_value = ReadJson(kNormalizedPolicy);
+ absl::optional<base::Value> expected_pref_value = ReadJson(kNormalizedPolicy);
EXPECT_EQ(*expected_pref_value, *pref_value);
}
diff --git a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc
index 9dce8c3..294ff432 100644
--- a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc
+++ b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc
@@ -219,7 +219,7 @@
predictor_->OnURLsDeleted(
history_service,
history::DeletionInfo(history::DeletionTimeRange::Invalid(), expired,
- rows, std::set<GURL>(), base::nullopt));
+ rows, std::set<GURL>(), absl::nullopt));
EXPECT_EQ(expected.size(), db_cache()->size());
EXPECT_EQ(expected.size(), db_id_cache()->size());
diff --git a/chrome/browser/predictors/loading_data_collector.cc b/chrome/browser/predictors/loading_data_collector.cc
index de7250da..6897abc4 100644
--- a/chrome/browser/predictors/loading_data_collector.cc
+++ b/chrome/browser/predictors/loading_data_collector.cc
@@ -240,7 +240,7 @@
void LoadingDataCollector::RecordMainFrameLoadComplete(
NavigationId navigation_id,
- const base::Optional<OptimizationGuidePrediction>&
+ const absl::optional<OptimizationGuidePrediction>&
optimization_guide_prediction) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
diff --git a/chrome/browser/predictors/loading_data_collector.h b/chrome/browser/predictors/loading_data_collector.h
index 4288b02..4f0e900 100644
--- a/chrome/browser/predictors/loading_data_collector.h
+++ b/chrome/browser/predictors/loading_data_collector.h
@@ -77,7 +77,7 @@
// The time for which the first resource prefetch was initiated for the
// navigation.
- base::Optional<base::TimeTicks> first_prefetch_initiated;
+ absl::optional<base::TimeTicks> first_prefetch_initiated;
private:
void UpdateOrAddToOrigins(
@@ -122,7 +122,7 @@
// up to this point are the only ones considered.
virtual void RecordMainFrameLoadComplete(
NavigationId navigation_id,
- const base::Optional<OptimizationGuidePrediction>&
+ const absl::optional<OptimizationGuidePrediction>&
optimization_guide_prediction);
// Called after the main frame's first contentful paint.
diff --git a/chrome/browser/predictors/loading_data_collector_unittest.cc b/chrome/browser/predictors/loading_data_collector_unittest.cc
index fa5f03a..0d88843 100644
--- a/chrome/browser/predictors/loading_data_collector_unittest.cc
+++ b/chrome/browser/predictors/loading_data_collector_unittest.cc
@@ -286,7 +286,7 @@
EXPECT_CALL(*mock_predictor_,
RecordPageRequestSummaryProxy(testing::Pointee(summary)));
- collector_->RecordMainFrameLoadComplete(navigation_id, base::nullopt);
+ collector_->RecordMainFrameLoadComplete(navigation_id, absl::nullopt);
}
TEST_F(LoadingDataCollectorTest, SimpleRedirect) {
@@ -315,7 +315,7 @@
RecordPageRequestSummaryProxy(testing::Pointee(CreatePageRequestSummary(
"https://facebook.com/google", "http://fb.com/google", resources))));
- collector_->RecordMainFrameLoadComplete(navigation_id, base::nullopt);
+ collector_->RecordMainFrameLoadComplete(navigation_id, absl::nullopt);
}
// Tests that RecordNavigationFinish without the corresponding
diff --git a/chrome/browser/predictors/loading_predictor.cc b/chrome/browser/predictors/loading_predictor.cc
index 351959ad..96ca3eb02 100644
--- a/chrome/browser/predictors/loading_predictor.cc
+++ b/chrome/browser/predictors/loading_predictor.cc
@@ -75,7 +75,7 @@
return false;
}
- base::Optional<base::android::RadioSignalLevel> maybe_level =
+ absl::optional<base::android::RadioSignalLevel> maybe_level =
base::android::RadioUtils::GetCellSignalLevel();
return maybe_level.has_value() &&
*maybe_level <= base::android::RadioSignalLevel::kModerate;
@@ -108,7 +108,7 @@
const GURL& url,
HintOrigin origin,
bool preconnectable,
- base::Optional<PreconnectPrediction> preconnect_prediction) {
+ absl::optional<PreconnectPrediction> preconnect_prediction) {
if (shutdown_)
return true;
diff --git a/chrome/browser/predictors/loading_predictor.h b/chrome/browser/predictors/loading_predictor.h
index cb79732..b6bca5f 100644
--- a/chrome/browser/predictors/loading_predictor.h
+++ b/chrome/browser/predictors/loading_predictor.h
@@ -14,7 +14,6 @@
#include "base/gtest_prod_util.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/predictors/loading_data_collector.h"
#include "chrome/browser/predictors/preconnect_manager.h"
@@ -22,6 +21,7 @@
#include "chrome/browser/predictors/resource_prefetch_predictor.h"
#include "chrome/browser/profiles/profile.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -58,8 +58,8 @@
bool PrepareForPageLoad(const GURL& url,
HintOrigin origin,
bool preconnectable = false,
- base::Optional<PreconnectPrediction>
- preconnect_prediction = base::nullopt);
+ absl::optional<PreconnectPrediction>
+ preconnect_prediction = absl::nullopt);
// Indicates that a page load hint is no longer active.
void CancelPageLoadHint(const GURL& url);
diff --git a/chrome/browser/predictors/loading_predictor_tab_helper.cc b/chrome/browser/predictors/loading_predictor_tab_helper.cc
index 6befe2c1..67f842d 100644
--- a/chrome/browser/predictors/loading_predictor_tab_helper.cc
+++ b/chrome/browser/predictors/loading_predictor_tab_helper.cc
@@ -390,7 +390,7 @@
resource_load_info.request_priority =
GetRequestPriority(resource_load_info.request_destination);
resource_load_info.network_info =
- blink::mojom::CommonNetworkInfo::New(false, false, base::nullopt);
+ blink::mojom::CommonNetworkInfo::New(false, false, absl::nullopt);
predictor_->loading_data_collector()->RecordResourceLoadComplete(
page_data->navigation_id_, resource_load_info);
}
@@ -410,7 +410,7 @@
page_data->last_optimization_guide_prediction_);
// Clear out Optimization Guide Prediction, as it is no longer needed.
- page_data->last_optimization_guide_prediction_ = base::nullopt;
+ page_data->last_optimization_guide_prediction_ = absl::nullopt;
}
void LoadingPredictorTabHelper::RecordFirstContentfulPaint(
diff --git a/chrome/browser/predictors/loading_predictor_tab_helper.h b/chrome/browser/predictors/loading_predictor_tab_helper.h
index a562923..64cb6a6 100644
--- a/chrome/browser/predictors/loading_predictor_tab_helper.h
+++ b/chrome/browser/predictors/loading_predictor_tab_helper.h
@@ -8,13 +8,13 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/util/type_safety/id_type.h"
#include "chrome/browser/predictors/resource_prefetch_predictor.h"
#include "content/public/browser/navigation_handle_user_data.h"
#include "content/public/browser/render_document_host_user_data.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class NavigationHandle;
@@ -102,7 +102,7 @@
// The optimization guide prediction for the current navigation. If set,
// this will be cleared on |DocumentOnLoadCompletedInMainFrame|.
- base::Optional<OptimizationGuidePrediction>
+ absl::optional<OptimizationGuidePrediction>
last_optimization_guide_prediction_;
// Stores weak ptrs to the document and navigation page data holders, in
diff --git a/chrome/browser/predictors/loading_predictor_tab_helper_unittest.cc b/chrome/browser/predictors/loading_predictor_tab_helper_unittest.cc
index be64174..ce00373a5 100644
--- a/chrome/browser/predictors/loading_predictor_tab_helper_unittest.cc
+++ b/chrome/browser/predictors/loading_predictor_tab_helper_unittest.cc
@@ -50,7 +50,7 @@
void(NavigationId, const blink::mojom::ResourceLoadInfo&));
MOCK_METHOD2(RecordMainFrameLoadComplete,
void(NavigationId,
- const base::Optional<OptimizationGuidePrediction>&));
+ const absl::optional<OptimizationGuidePrediction>&));
MOCK_METHOD2(RecordFirstContentfulPaint, void(NavigationId, base::TimeTicks));
};
@@ -357,7 +357,7 @@
content::RenderFrameHostTester::For(main_rfh())->AppendChild("subframe");
NavigateAndCommitInFrame("http://sub.test.org", subframe);
- const base::Optional<OptimizationGuidePrediction>
+ const absl::optional<OptimizationGuidePrediction>
null_optimization_guide_prediction;
EXPECT_CALL(*mock_collector_, RecordMainFrameLoadComplete(
_, null_optimization_guide_prediction));
@@ -394,7 +394,7 @@
content::RenderFrameHostTester::For(main_rfh())->AppendChild("subframe");
NavigateAndCommitInFrame("http://sub.test.org", subframe);
- base::Optional<OptimizationGuidePrediction> prediction =
+ absl::optional<OptimizationGuidePrediction> prediction =
OptimizationGuidePrediction();
prediction->decision = optimization_guide::OptimizationGuideDecision::kTrue;
url::Origin main_frame_origin = url::Origin::Create(GURL("http://test.org"));
@@ -448,7 +448,7 @@
content::RenderFrameHostTester::For(main_rfh())->AppendChild("subframe");
NavigateAndCommitInFrame("http://sub.test.org", subframe);
- base::Optional<OptimizationGuidePrediction> prediction =
+ absl::optional<OptimizationGuidePrediction> prediction =
OptimizationGuidePrediction();
prediction->decision = optimization_guide::OptimizationGuideDecision::kTrue;
url::Origin main_frame_origin = url::Origin::Create(GURL("http://test.org"));
@@ -515,7 +515,7 @@
// Prediction decision should be unknown since what came in was for the wrong
// navigation ID.
- base::Optional<OptimizationGuidePrediction> optimization_guide_prediction =
+ absl::optional<OptimizationGuidePrediction> optimization_guide_prediction =
OptimizationGuidePrediction();
optimization_guide_prediction->decision =
optimization_guide::OptimizationGuideDecision::kUnknown;
@@ -545,7 +545,7 @@
content::RenderFrameHostTester::For(main_rfh())->AppendChild("subframe");
NavigateAndCommitInFrame("http://sub.test.org", subframe);
- base::Optional<OptimizationGuidePrediction> prediction =
+ absl::optional<OptimizationGuidePrediction> prediction =
OptimizationGuidePrediction();
prediction->decision =
optimization_guide::OptimizationGuideDecision::kUnknown;
@@ -589,7 +589,7 @@
content::RenderFrameHostTester::For(main_rfh())->AppendChild("subframe");
NavigateAndCommitInFrame("http://sub.test.org", subframe);
- base::Optional<OptimizationGuidePrediction> prediction =
+ absl::optional<OptimizationGuidePrediction> prediction =
OptimizationGuidePrediction();
prediction->decision =
optimization_guide::OptimizationGuideDecision::kUnknown;
@@ -632,7 +632,7 @@
content::RenderFrameHostTester::For(main_rfh())->AppendChild("subframe");
NavigateAndCommitInFrame("http://sub.test.org", subframe);
- base::Optional<OptimizationGuidePrediction> prediction =
+ absl::optional<OptimizationGuidePrediction> prediction =
OptimizationGuidePrediction();
prediction->decision = optimization_guide::OptimizationGuideDecision::kFalse;
EXPECT_CALL(*mock_collector_, RecordMainFrameLoadComplete(_, prediction));
@@ -673,7 +673,7 @@
NavigateAndCommitInFrame("http://sub.test.org", subframe);
// Decision should be unknown since we got invalid data.
- base::Optional<OptimizationGuidePrediction> optimization_guide_prediction =
+ absl::optional<OptimizationGuidePrediction> optimization_guide_prediction =
OptimizationGuidePrediction();
optimization_guide_prediction->decision =
optimization_guide::OptimizationGuideDecision::kUnknown;
@@ -734,7 +734,7 @@
content::RenderFrameHostTester::For(main_rfh())->AppendChild("subframe");
NavigateAndCommitInFrame("http://sub.test.org", subframe);
- base::Optional<OptimizationGuidePrediction> prediction =
+ absl::optional<OptimizationGuidePrediction> prediction =
OptimizationGuidePrediction();
prediction->decision = optimization_guide::OptimizationGuideDecision::kTrue;
url::Origin main_frame_origin = url::Origin::Create(GURL("http://test.org"));
@@ -785,7 +785,7 @@
void RecordMainFrameLoadComplete(
NavigationId navigation_id,
- const base::Optional<OptimizationGuidePrediction>&
+ const absl::optional<OptimizationGuidePrediction>&
optimization_guide_prediction) override {}
void RecordFirstContentfulPaint(
diff --git a/chrome/browser/predictors/loading_stats_collector.cc b/chrome/browser/predictors/loading_stats_collector.cc
index 5e781b5..947fa080 100644
--- a/chrome/browser/predictors/loading_stats_collector.cc
+++ b/chrome/browser/predictors/loading_stats_collector.cc
@@ -168,7 +168,7 @@
void LoadingStatsCollector::RecordPageRequestSummary(
const PageRequestSummary& summary,
- const base::Optional<OptimizationGuidePrediction>&
+ const absl::optional<OptimizationGuidePrediction>&
optimization_guide_prediction) {
const GURL& initial_url = summary.initial_url;
diff --git a/chrome/browser/predictors/loading_stats_collector.h b/chrome/browser/predictors/loading_stats_collector.h
index a6db3d1b..ab830900 100644
--- a/chrome/browser/predictors/loading_stats_collector.h
+++ b/chrome/browser/predictors/loading_stats_collector.h
@@ -61,7 +61,7 @@
// All results are reported to UMA and UKM.
void RecordPageRequestSummary(
const PageRequestSummary& summary,
- const base::Optional<OptimizationGuidePrediction>&
+ const absl::optional<OptimizationGuidePrediction>&
optimization_guide_prediction);
// Evicts all stale stats that are kept in memory. All speculative actions are
// reported and considered as waste.
diff --git a/chrome/browser/predictors/loading_stats_collector_unittest.cc b/chrome/browser/predictors/loading_stats_collector_unittest.cc
index 789b70b..cd90bda7 100644
--- a/chrome/browser/predictors/loading_stats_collector_unittest.cc
+++ b/chrome/browser/predictors/loading_stats_collector_unittest.cc
@@ -95,7 +95,7 @@
PageRequestSummary summary =
CreatePageRequestSummary(navigation_url, initial_url, resources);
- stats_collector_->RecordPageRequestSummary(summary, base::nullopt);
+ stats_collector_->RecordPageRequestSummary(summary, absl::nullopt);
// Histogram check.
histogram_tester_->ExpectUniqueSample(
@@ -139,7 +139,7 @@
url::Origin::Create(GURL(gen(3))),
};
- stats_collector_->RecordPageRequestSummary(summary, base::nullopt);
+ stats_collector_->RecordPageRequestSummary(summary, absl::nullopt);
histogram_tester_->ExpectUniqueSample(
"LoadingPredictor.PreconnectLearningRecall.Navigation", 66, 1);
@@ -222,7 +222,7 @@
.WillOnce(DoAll(SetArgPointee<1>(local_prediction), Return(false)));
// Optimization Guide predicts 4 origins: 2 useful, 2 useless.
- base::Optional<OptimizationGuidePrediction> optimization_guide_prediction =
+ absl::optional<OptimizationGuidePrediction> optimization_guide_prediction =
OptimizationGuidePrediction();
optimization_guide_prediction->decision =
optimization_guide::OptimizationGuideDecision::kTrue;
@@ -400,7 +400,7 @@
PageRequestSummary summary =
CreatePageRequestSummary(main_frame_url, main_frame_url, resources);
- stats_collector_->RecordPageRequestSummary(summary, base::nullopt);
+ stats_collector_->RecordPageRequestSummary(summary, absl::nullopt);
}
histogram_tester_->ExpectUniqueSample(
@@ -433,7 +433,7 @@
PageRequestSummary summary =
CreatePageRequestSummary(main_frame_url, main_frame_url, resources, now);
summary.navigation_committed = now + base::TimeDelta::FromMilliseconds(3);
- stats_collector_->RecordPageRequestSummary(summary, base::nullopt);
+ stats_collector_->RecordPageRequestSummary(summary, absl::nullopt);
// No histograms should be recorded.
histogram_tester_->ExpectTotalCount(
@@ -491,7 +491,7 @@
PageRequestSummary summary =
CreatePageRequestSummary(main_frame_url, main_frame_url, resources);
- stats_collector_->RecordPageRequestSummary(summary, base::nullopt);
+ stats_collector_->RecordPageRequestSummary(summary, absl::nullopt);
}
histogram_tester_->ExpectUniqueSample(
diff --git a/chrome/browser/predictors/loading_test_util.cc b/chrome/browser/predictors/loading_test_util.cc
index 0fd7f320..c63918eb 100644
--- a/chrome/browser/predictors/loading_test_util.cc
+++ b/chrome/browser/predictors/loading_test_util.cc
@@ -103,7 +103,7 @@
resource_load_info->method = "GET";
resource_load_info->request_destination = request_destination;
resource_load_info->network_info = blink::mojom::CommonNetworkInfo::New(
- true, always_access_network, base::nullopt);
+ true, always_access_network, absl::nullopt);
resource_load_info->request_priority = net::HIGHEST;
return resource_load_info;
}
@@ -127,7 +127,7 @@
resource_load_info->request_destination = request_destination;
resource_load_info->request_priority = net::HIGHEST;
auto common_network_info =
- blink::mojom::CommonNetworkInfo::New(true, false, base::nullopt);
+ blink::mojom::CommonNetworkInfo::New(true, false, absl::nullopt);
resource_load_info->network_info = common_network_info.Clone();
for (size_t i = 0; i + 1 < redirect_chain.size(); ++i) {
resource_load_info->redirect_info_chain.push_back(
diff --git a/chrome/browser/predictors/network_hints_handler_impl.cc b/chrome/browser/predictors/network_hints_handler_impl.cc
index 457b785..ad83e4c 100644
--- a/chrome/browser/predictors/network_hints_handler_impl.cc
+++ b/chrome/browser/predictors/network_hints_handler_impl.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/predictors/network_hints_handler_impl.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "chrome/browser/predictors/loading_predictor.h"
#include "chrome/browser/predictors/loading_predictor_factory.h"
#include "chrome/browser/predictors/preconnect_manager.h"
@@ -14,6 +13,7 @@
#include "content/public/browser/render_process_host.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "net/base/isolation_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace predictors {
diff --git a/chrome/browser/predictors/preconnect_manager_unittest.cc b/chrome/browser/predictors/preconnect_manager_unittest.cc
index 582187e..3bf3b178 100644
--- a/chrome/browser/predictors/preconnect_manager_unittest.cc
+++ b/chrome/browser/predictors/preconnect_manager_unittest.cc
@@ -98,7 +98,7 @@
.second);
if (!enabled_proxy_testing_) {
// We don't want to test proxy, return that the proxy is disabled.
- CompleteProxyLookup(url, base::nullopt);
+ CompleteProxyLookup(url, absl::nullopt);
}
}
@@ -113,14 +113,14 @@
return;
}
it->second->OnComplete(result, net::ResolveErrorInfo(result),
- base::nullopt);
+ absl::nullopt);
resolve_host_clients_.erase(it);
// Wait for OnComplete() to be executed on the UI thread.
base::RunLoop().RunUntilIdle();
}
void CompleteProxyLookup(const GURL& url,
- const base::Optional<net::ProxyInfo>& result) {
+ const absl::optional<net::ProxyInfo>& result) {
if (IsHangingHost(url))
return;
@@ -943,7 +943,7 @@
GetDirectProxyInfo());
// Second URL proxy lookup failed.
mock_network_context_->CompleteProxyLookup(origin_to_preconnect2.GetURL(),
- base::nullopt);
+ absl::nullopt);
Mock::VerifyAndClearExpectations(mock_network_context_.get());
EXPECT_CALL(
@@ -980,7 +980,7 @@
EXPECT_CALL(*mock_network_context_,
ResolveHostProxy(origin_to_preconnect.host()));
mock_network_context_->CompleteProxyLookup(origin_to_preconnect.GetURL(),
- base::nullopt);
+ absl::nullopt);
Mock::VerifyAndClearExpectations(mock_network_context_.get());
EXPECT_CALL(*mock_delegate_, PreconnectFinishedProxy(main_frame_url));
diff --git a/chrome/browser/predictors/prefetch_manager.cc b/chrome/browser/predictors/prefetch_manager.cc
index 766df0d..c5412f3 100644
--- a/chrome/browser/predictors/prefetch_manager.cc
+++ b/chrome/browser/predictors/prefetch_manager.cc
@@ -272,7 +272,7 @@
content::GlobalRequestID::MakeBrowserInitiated().request_id, options,
&request, client.get(), kPrefetchTrafficAnnotation,
base::ThreadTaskRunnerHandle::Get(),
- /*cors_exempt_header_list=*/base::nullopt);
+ /*cors_exempt_header_list=*/absl::nullopt);
delegate_->PrefetchInitiated(info.url, job->url);
diff --git a/chrome/browser/predictors/proxy_lookup_client_impl.cc b/chrome/browser/predictors/proxy_lookup_client_impl.cc
index 76cd193..08a9cc3 100644
--- a/chrome/browser/predictors/proxy_lookup_client_impl.cc
+++ b/chrome/browser/predictors/proxy_lookup_client_impl.cc
@@ -28,14 +28,14 @@
{content::BrowserTaskType::kPreconnect})));
receiver_.set_disconnect_handler(
base::BindOnce(&ProxyLookupClientImpl::OnProxyLookupComplete,
- base::Unretained(this), net::ERR_ABORTED, base::nullopt));
+ base::Unretained(this), net::ERR_ABORTED, absl::nullopt));
}
ProxyLookupClientImpl::~ProxyLookupClientImpl() = default;
void ProxyLookupClientImpl::OnProxyLookupComplete(
int32_t net_error,
- const base::Optional<net::ProxyInfo>& proxy_info) {
+ const absl::optional<net::ProxyInfo>& proxy_info) {
bool success = proxy_info.has_value() && !proxy_info->is_direct();
std::move(callback_).Run(success);
}
diff --git a/chrome/browser/predictors/proxy_lookup_client_impl.h b/chrome/browser/predictors/proxy_lookup_client_impl.h
index 7a41543..2da2825d7 100644
--- a/chrome/browser/predictors/proxy_lookup_client_impl.h
+++ b/chrome/browser/predictors/proxy_lookup_client_impl.h
@@ -7,9 +7,9 @@
#include "base/bind.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "services/network/public/mojom/proxy_lookup_client.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
@@ -43,7 +43,7 @@
// network::mojom::ProxyLookupClient:
void OnProxyLookupComplete(
int32_t net_error,
- const base::Optional<net::ProxyInfo>& proxy_info) override;
+ const absl::optional<net::ProxyInfo>& proxy_info) override;
private:
mojo::Receiver<network::mojom::ProxyLookupClient> receiver_{this};
diff --git a/chrome/browser/predictors/resolve_host_client_impl.cc b/chrome/browser/predictors/resolve_host_client_impl.cc
index 28b40c4..66596e4 100644
--- a/chrome/browser/predictors/resolve_host_client_impl.cc
+++ b/chrome/browser/predictors/resolve_host_client_impl.cc
@@ -45,7 +45,7 @@
void ResolveHostClientImpl::OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) {
+ const absl::optional<net::AddressList>& resolved_addresses) {
std::move(callback_).Run(result == net::OK);
}
diff --git a/chrome/browser/predictors/resolve_host_client_impl.h b/chrome/browser/predictors/resolve_host_client_impl.h
index 5e6309c..488d3c1 100644
--- a/chrome/browser/predictors/resolve_host_client_impl.h
+++ b/chrome/browser/predictors/resolve_host_client_impl.h
@@ -7,11 +7,11 @@
#include "base/bind.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "net/base/address_list.h"
#include "services/network/public/cpp/resolve_host_client_base.h"
#include "services/network/public/mojom/host_resolver.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
@@ -46,7 +46,7 @@
void OnComplete(
int result,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) override;
+ const absl::optional<net::AddressList>& resolved_addresses) override;
void OnConnectionError();
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.h b/chrome/browser/predictors/resource_prefetch_predictor.h
index cdf860a2..110b913 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.h
+++ b/chrome/browser/predictors/resource_prefetch_predictor.h
@@ -16,7 +16,6 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/task/cancelable_task_tracker.h"
#include "base/time/time.h"
@@ -31,6 +30,7 @@
#include "components/sqlite_proto/key_value_data.h"
#include "net/base/network_isolation_key.h"
#include "services/network/public/mojom/fetch_api.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -119,7 +119,7 @@
optimization_guide::OptimizationGuideDecision decision;
PreconnectPrediction preconnect_prediction;
std::vector<GURL> predicted_subresources;
- base::Optional<base::TimeTicks> optimization_guide_prediction_arrived;
+ absl::optional<base::TimeTicks> optimization_guide_prediction_arrived;
};
// Contains logic for learning what can be prefetched and for kicking off
diff --git a/chrome/browser/prefetch/no_state_prefetch/prerender_nostate_prefetch_browsertest.cc b/chrome/browser/prefetch/no_state_prefetch/prerender_nostate_prefetch_browsertest.cc
index 4206143..b25f2ed 100644
--- a/chrome/browser/prefetch/no_state_prefetch/prerender_nostate_prefetch_browsertest.cc
+++ b/chrome/browser/prefetch/no_state_prefetch/prerender_nostate_prefetch_browsertest.cc
@@ -943,10 +943,10 @@
test_prerender->WaitForLoads(0);
monitor.WaitForUrls();
- base::Optional<network::ResourceRequest> page_request =
+ absl::optional<network::ResourceRequest> page_request =
monitor.GetRequestInfo(prefetch_page);
EXPECT_TRUE(page_request->load_flags & net::LOAD_PREFETCH);
- base::Optional<network::ResourceRequest> script_request =
+ absl::optional<network::ResourceRequest> script_request =
monitor.GetRequestInfo(prefetch_script);
EXPECT_TRUE(script_request->load_flags & net::LOAD_PREFETCH);
}
@@ -965,7 +965,7 @@
WaitForRequestCount(prefetch_script, 1);
monitor.WaitForUrls();
for (const GURL& url : {prefetch_page, prefetch_script}) {
- base::Optional<network::ResourceRequest> request =
+ absl::optional<network::ResourceRequest> request =
monitor.GetRequestInfo(url);
EXPECT_TRUE(request->load_flags & net::LOAD_PREFETCH);
EXPECT_FALSE(request->headers.HasHeader(kExpectedPurposeHeaderOnPrefetch));
@@ -994,7 +994,7 @@
WaitForRequestCount(prefetch_script2, 1);
monitor.WaitForUrls();
for (const GURL& url : {prefetch_page, prefetch_script, prefetch_script2}) {
- base::Optional<network::ResourceRequest> request =
+ absl::optional<network::ResourceRequest> request =
monitor.GetRequestInfo(url);
EXPECT_FALSE(request->load_flags & net::LOAD_PREFETCH);
EXPECT_FALSE(request->headers.HasHeader(kExpectedPurposeHeaderOnPrefetch));
@@ -1171,7 +1171,7 @@
WaitForRequestCount(page_url, 1);
monitor.WaitForUrls();
- base::Optional<network::ResourceRequest> request =
+ absl::optional<network::ResourceRequest> request =
monitor.GetRequestInfo(redirect_url);
EXPECT_TRUE(request->load_flags & net::LOAD_PREFETCH);
}
@@ -1433,7 +1433,7 @@
#else
constexpr net::RequestPriority kExpectedPriority = net::IDLE;
#endif
- base::Optional<network::ResourceRequest> request =
+ absl::optional<network::ResourceRequest> request =
monitor.GetRequestInfo(script_url);
EXPECT_EQ(kExpectedPriority, request->priority);
}
diff --git a/chrome/browser/prefetch/no_state_prefetch/prerender_test_utils.cc b/chrome/browser/prefetch/no_state_prefetch/prerender_test_utils.cc
index ae0b8fa..aed8a91 100644
--- a/chrome/browser/prefetch/no_state_prefetch/prerender_test_utils.cc
+++ b/chrome/browser/prefetch/no_state_prefetch/prerender_test_utils.cc
@@ -76,7 +76,7 @@
content::WebContents* web_contents,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin) override {
+ const absl::optional<url::Origin>& initiating_origin) override {
NOTREACHED();
}
@@ -96,7 +96,7 @@
content::BrowserContext* browser_context,
const GURL& url,
const content::Referrer& referrer,
- const base::Optional<url::Origin>& initiator_origin,
+ const absl::optional<url::Origin>& initiator_origin,
Origin origin,
FinalStatus expected_final_status,
bool ignore_final_status)
@@ -343,7 +343,7 @@
content::BrowserContext* browser_context,
const GURL& url,
const content::Referrer& referrer,
- const base::Optional<url::Origin>& initiator_origin,
+ const absl::optional<url::Origin>& initiator_origin,
Origin origin) {
ExpectedContents expected;
if (!expected_contents_queue_.empty()) {
diff --git a/chrome/browser/prefetch/no_state_prefetch/prerender_test_utils.h b/chrome/browser/prefetch/no_state_prefetch/prerender_test_utils.h
index fc0b7a8b..9da00f7 100644
--- a/chrome/browser/prefetch/no_state_prefetch/prerender_test_utils.h
+++ b/chrome/browser/prefetch/no_state_prefetch/prerender_test_utils.h
@@ -42,7 +42,7 @@
content::BrowserContext* browser_context,
const GURL& url,
const content::Referrer& referrer,
- const base::Optional<url::Origin>& initiator_origin,
+ const absl::optional<url::Origin>& initiator_origin,
Origin origin,
FinalStatus expected_final_status,
bool ignore_final_status);
@@ -223,7 +223,7 @@
content::BrowserContext* browser_context,
const GURL& url,
const content::Referrer& referrer,
- const base::Optional<url::Origin>& initiator_origin,
+ const absl::optional<url::Origin>& initiator_origin,
Origin origin) override;
private:
diff --git a/chrome/browser/prefetch/no_state_prefetch/prerender_unittest.cc b/chrome/browser/prefetch/no_state_prefetch/prerender_unittest.cc
index fa306459..ed0e4fe 100644
--- a/chrome/browser/prefetch/no_state_prefetch/prerender_unittest.cc
+++ b/chrome/browser/prefetch/no_state_prefetch/prerender_unittest.cc
@@ -74,7 +74,7 @@
UnitTestNoStatePrefetchManager* test_no_state_prefetch_manager,
const GURL& url,
Origin origin,
- const base::Optional<url::Origin>& initiator_origin,
+ const absl::optional<url::Origin>& initiator_origin,
FinalStatus expected_final_status);
~DummyNoStatePrefetchContents() override;
@@ -187,7 +187,7 @@
DummyNoStatePrefetchContents* CreateNextNoStatePrefetchContents(
const GURL& url,
- const base::Optional<url::Origin>& initiator_origin,
+ const absl::optional<url::Origin>& initiator_origin,
Origin origin,
FinalStatus expected_final_status) {
return SetNextNoStatePrefetchContents(
@@ -259,7 +259,7 @@
std::unique_ptr<NoStatePrefetchContents> CreateNoStatePrefetchContents(
const GURL& url,
const Referrer& referrer,
- const base::Optional<url::Origin>& initiator_origin,
+ const absl::optional<url::Origin>& initiator_origin,
Origin origin) override {
CHECK(next_no_state_prefetch_contents_);
EXPECT_EQ(url, next_no_state_prefetch_contents_->prerender_url());
@@ -314,7 +314,7 @@
UnitTestNoStatePrefetchManager* test_no_state_prefetch_manager,
const GURL& url,
Origin origin,
- const base::Optional<url::Origin>& initiator_origin,
+ const absl::optional<url::Origin>& initiator_origin,
FinalStatus expected_final_status)
: NoStatePrefetchContents(
std::make_unique<ChromeNoStatePrefetchContentsDelegate>(),
@@ -419,7 +419,7 @@
attributes->view_size = kDefaultViewSize;
// This could delete an existing prefetcher as a side-effect.
- base::Optional<int> link_trigger_id =
+ absl::optional<int> link_trigger_id =
no_state_prefetch_link_manager()->OnStartLinkTrigger(
render_process_id, render_view_id, std::move(attributes),
url::Origin::Create(initiator_url));
@@ -565,7 +565,7 @@
scoped_feature_list.InitAndEnableFeature(
kNavigationPredictorPrefetchHoldback);
no_state_prefetch_manager()->CreateNextNoStatePrefetchContents(
- url, base::nullopt, ORIGIN_NAVIGATION_PREDICTOR,
+ url, absl::nullopt, ORIGIN_NAVIGATION_PREDICTOR,
FINAL_STATUS_PROFILE_DESTROYED);
EXPECT_EQ(nullptr,
no_state_prefetch_manager()->AddPrerenderFromNavigationPredictor(
@@ -605,7 +605,7 @@
scoped_feature_list.InitAndDisableFeature(
kNavigationPredictorPrefetchHoldback);
no_state_prefetch_manager()->CreateNextNoStatePrefetchContents(
- url, base::nullopt, ORIGIN_NAVIGATION_PREDICTOR,
+ url, absl::nullopt, ORIGIN_NAVIGATION_PREDICTOR,
FINAL_STATUS_PROFILE_DESTROYED);
EXPECT_NE(nullptr,
@@ -838,14 +838,14 @@
// Prefetch the url once.
no_state_prefetch_manager()->CreateNextNoStatePrefetchContents(
- kUrl, base::nullopt, ORIGIN_OMNIBOX, FINAL_STATUS_CANCELLED);
+ kUrl, absl::nullopt, ORIGIN_OMNIBOX, FINAL_STATUS_CANCELLED);
EXPECT_TRUE(no_state_prefetch_manager()->AddPrerenderFromOmnibox(
kUrl, nullptr, gfx::Size()));
// Cancel the prerender so that it is not reused.
no_state_prefetch_manager()->CancelAllPrerenders();
no_state_prefetch_manager()->CreateNextNoStatePrefetchContents(
- kUrl, base::nullopt, ORIGIN_OMNIBOX, FINAL_STATUS_PROFILE_DESTROYED);
+ kUrl, absl::nullopt, ORIGIN_OMNIBOX, FINAL_STATUS_PROFILE_DESTROYED);
// Prefetching again before time_to_live aborts, because it is a duplicate.
tick_clock()->Advance(base::TimeDelta::FromSeconds(1));
@@ -1110,7 +1110,7 @@
TEST_F(PrerenderTest, OmniboxAllowedWhenNotDisabled) {
DummyNoStatePrefetchContents* no_state_prefetch_contents =
no_state_prefetch_manager()->CreateNextNoStatePrefetchContents(
- GURL("http://www.example.com"), base::nullopt, ORIGIN_OMNIBOX,
+ GURL("http://www.example.com"), absl::nullopt, ORIGIN_OMNIBOX,
FINAL_STATUS_PROFILE_DESTROYED);
EXPECT_TRUE(no_state_prefetch_manager()->AddPrerenderFromOmnibox(
@@ -1277,7 +1277,7 @@
GURL url("http://www.google.com/");
DummyNoStatePrefetchContents* no_state_prefetch_contents =
no_state_prefetch_manager()->CreateNextNoStatePrefetchContents(
- url, base::nullopt, ORIGIN_EXTERNAL_REQUEST,
+ url, absl::nullopt, ORIGIN_EXTERNAL_REQUEST,
FINAL_STATUS_PROFILE_DESTROYED);
std::unique_ptr<NoStatePrefetchHandle> no_state_prefetch_handle(
no_state_prefetch_manager()->AddPrerenderFromExternalRequest(
@@ -1301,7 +1301,7 @@
GURL url("http://www.google.com/");
DummyNoStatePrefetchContents* no_state_prefetch_contents =
no_state_prefetch_manager()->CreateNextNoStatePrefetchContents(
- url, base::nullopt, ORIGIN_EXTERNAL_REQUEST,
+ url, absl::nullopt, ORIGIN_EXTERNAL_REQUEST,
FINAL_STATUS_PROFILE_DESTROYED);
std::unique_ptr<NoStatePrefetchHandle> no_state_prefetch_handle(
no_state_prefetch_manager()->AddPrerenderFromExternalRequest(
@@ -1325,7 +1325,7 @@
GURL url("http://www.google.com/");
DummyNoStatePrefetchContents* no_state_prefetch_contents =
no_state_prefetch_manager()->CreateNextNoStatePrefetchContents(
- url, base::nullopt, ORIGIN_EXTERNAL_REQUEST,
+ url, absl::nullopt, ORIGIN_EXTERNAL_REQUEST,
FINAL_STATUS_PROFILE_DESTROYED);
std::unique_ptr<NoStatePrefetchHandle> no_state_prefetch_handle(
no_state_prefetch_manager()->AddPrerenderFromExternalRequest(
@@ -1352,7 +1352,7 @@
GURL url("http://www.google.com/");
DummyNoStatePrefetchContents* no_state_prefetch_contents =
no_state_prefetch_manager()->CreateNextNoStatePrefetchContents(
- url, base::nullopt, ORIGIN_EXTERNAL_REQUEST, FINAL_STATUS_USED);
+ url, absl::nullopt, ORIGIN_EXTERNAL_REQUEST, FINAL_STATUS_USED);
std::unique_ptr<NoStatePrefetchHandle> no_state_prefetch_handle(
no_state_prefetch_manager()->AddPrerenderFromExternalRequest(
url, content::Referrer(), nullptr, gfx::Rect(kDefaultViewSize)));
@@ -1375,7 +1375,7 @@
std::unique_ptr<NoStatePrefetchHandle> no_state_prefetch_handle;
no_state_prefetch_contents =
no_state_prefetch_manager()->CreateNextNoStatePrefetchContents(
- url, base::nullopt, ORIGIN_EXTERNAL_REQUEST_FORCED_PRERENDER,
+ url, absl::nullopt, ORIGIN_EXTERNAL_REQUEST_FORCED_PRERENDER,
FINAL_STATUS_USED);
no_state_prefetch_handle =
no_state_prefetch_manager()->AddForcedPrerenderFromExternalRequest(
@@ -1759,7 +1759,7 @@
GURL url("http://www.google.com/");
DummyNoStatePrefetchContents* no_state_prefetch_contents =
no_state_prefetch_manager()->CreateNextNoStatePrefetchContents(
- url, base::nullopt, ORIGIN_EXTERNAL_REQUEST_FORCED_PRERENDER,
+ url, absl::nullopt, ORIGIN_EXTERNAL_REQUEST_FORCED_PRERENDER,
FINAL_STATUS_PROFILE_DESTROYED);
std::unique_ptr<NoStatePrefetchHandle> no_state_prefetch_handle =
no_state_prefetch_manager()->AddForcedPrerenderFromExternalRequest(
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc
index 6ad70ea..ed2ef6bf 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc
@@ -12,7 +12,6 @@
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/containers/unique_ptr_adapters.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
@@ -122,6 +121,7 @@
#include "services/network/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/client_hints/client_hints.h"
#include "third_party/blink/public/common/features.h"
#include "url/gurl.h"
@@ -675,7 +675,7 @@
url, net::LOAD_ONLY_FROM_CACHE);
}
- base::Optional<int64_t> GetUKMMetric(const GURL& url,
+ absl::optional<int64_t> GetUKMMetric(const GURL& url,
const std::string& event_name,
const std::string& metric_name) {
SCOPED_TRACE(metric_name);
@@ -691,9 +691,9 @@
ukm::TestUkmRecorder::GetEntryMetric(entry, metric_name);
if (value == nullptr) {
- return base::nullopt;
+ return absl::nullopt;
}
- return base::Optional<int64_t>(*value);
+ return absl::optional<int64_t>(*value);
}
void VerifyNoUKMEvent(const std::string& event_name) {
@@ -705,7 +705,7 @@
void VerifyUKMOnSRP(const GURL& url,
const std::string& metric_name,
- base::Optional<int64_t> expected) {
+ absl::optional<int64_t> expected) {
SCOPED_TRACE(metric_name);
auto actual = GetUKMMetric(url, ukm::builders::PrefetchProxy::kEntryName,
metric_name);
@@ -714,7 +714,7 @@
void VerifyUKMAfterSRP(const GURL& url,
const std::string& metric_name,
- base::Optional<int64_t> expected) {
+ absl::optional<int64_t> expected) {
SCOPED_TRACE(metric_name);
auto actual = GetUKMMetric(
url, ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
@@ -1022,7 +1022,7 @@
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
// 6 = |kPrefetchNotEligibleUserHasServiceWorker|
- EXPECT_EQ(base::Optional<int64_t>(6),
+ EXPECT_EQ(absl::optional<int64_t>(6),
GetUKMMetric(prefetch_url,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -1094,7 +1094,7 @@
ui_test_utils::NavigateToURL(browser(), error_url);
ASSERT_TRUE(tab_helper->after_srp_metrics());
EXPECT_EQ(
- base::make_optional(PrefetchProxyPrefetchStatus::kPrefetchFailedNetError),
+ absl::make_optional(PrefetchProxyPrefetchStatus::kPrefetchFailedNetError),
tab_helper->after_srp_metrics()->prefetch_status_);
// Doing this prefetch again is immediately skipped because the proxy is not
@@ -1106,7 +1106,7 @@
ui_test_utils::NavigateToURL(browser(), error_url);
ASSERT_TRUE(tab_helper->after_srp_metrics());
- EXPECT_EQ(base::make_optional(
+ EXPECT_EQ(absl::make_optional(
PrefetchProxyPrefetchStatus::kPrefetchProxyNotAvailable),
tab_helper->after_srp_metrics()->prefetch_status_);
}
@@ -1135,7 +1135,7 @@
ASSERT_TRUE(tab_helper->after_srp_metrics());
EXPECT_EQ(
- base::make_optional(
+ absl::make_optional(
PrefetchProxyPrefetchStatus::kPrefetchNotEligibleUserHasCookies),
tab_helper->after_srp_metrics()->prefetch_status_);
}
@@ -1164,7 +1164,7 @@
ASSERT_TRUE(tab_helper->after_srp_metrics());
EXPECT_EQ(
- base::make_optional(
+ absl::make_optional(
PrefetchProxyPrefetchStatus::kPrefetchNotEligibleUserHasCookies),
tab_helper->after_srp_metrics()->prefetch_status_);
}
@@ -1203,7 +1203,7 @@
ASSERT_TRUE(tab_helper->after_srp_metrics());
EXPECT_EQ(
- base::make_optional(PrefetchProxyPrefetchStatus::kPrefetchUsedNoProbe),
+ absl::make_optional(PrefetchProxyPrefetchStatus::kPrefetchUsedNoProbe),
tab_helper->after_srp_metrics()->prefetch_status_);
}
@@ -1241,7 +1241,7 @@
ASSERT_TRUE(tab_helper->after_srp_metrics());
EXPECT_EQ(
- base::make_optional(PrefetchProxyPrefetchStatus::kPrefetchUsedNoProbe),
+ absl::make_optional(PrefetchProxyPrefetchStatus::kPrefetchUsedNoProbe),
tab_helper->after_srp_metrics()->prefetch_status_);
}
@@ -1509,7 +1509,7 @@
0);
EXPECT_EQ(
- base::nullopt,
+ absl::nullopt,
GetUKMMetric(
eligible_link_2,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
@@ -1650,7 +1650,7 @@
0);
EXPECT_EQ(
- base::nullopt,
+ absl::nullopt,
GetUKMMetric(
eligible_link_204,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
@@ -1725,7 +1725,7 @@
12);
EXPECT_EQ(
- base::nullopt,
+ absl::nullopt,
GetUKMMetric(
prefetch_404_url,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
@@ -1788,7 +1788,7 @@
VerifyUKMAfterSRP(
link_not_on_srp,
ukm::builders::PrefetchProxy_AfterSRPClick::kClickedLinkSRPPositionName,
- base::nullopt);
+ absl::nullopt);
VerifyUKMAfterSRP(
link_not_on_srp,
ukm::builders::PrefetchProxy_AfterSRPClick::kSRPPrefetchEligibleCountName,
@@ -1801,7 +1801,7 @@
15);
EXPECT_EQ(
- base::nullopt,
+ absl::nullopt,
GetUKMMetric(
link_not_on_srp,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
@@ -1865,7 +1865,7 @@
7);
EXPECT_EQ(
- base::nullopt,
+ absl::nullopt,
GetUKMMetric(
ineligible_link,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
@@ -1944,7 +1944,7 @@
3);
EXPECT_EQ(
- base::nullopt,
+ absl::nullopt,
GetUKMMetric(
eligible_link_2,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
@@ -2169,7 +2169,7 @@
<< ActualHumanReadableMetricsToDebugString(actual_entries);
// 29 = |kPrefetchIsPrivacyDecoy|
- EXPECT_EQ(base::Optional<int64_t>(29),
+ EXPECT_EQ(absl::optional<int64_t>(29),
GetUKMMetric(prefetch_url,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -2183,7 +2183,7 @@
ukm::builders::PrefetchProxy_AfterSRPClick::kSRPPrefetchEligibleCountName,
0);
EXPECT_EQ(
- base::nullopt,
+ absl::nullopt,
GetUKMMetric(
prefetch_url, ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::kProbeLatencyMsName));
@@ -2252,7 +2252,7 @@
<< ActualHumanReadableMetricsToDebugString(actual_entries);
// 29 = |kPrefetchIsPrivacyDecoy|
- EXPECT_EQ(base::Optional<int64_t>(29),
+ EXPECT_EQ(absl::optional<int64_t>(29),
GetUKMMetric(prefetch_url,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -2266,7 +2266,7 @@
ukm::builders::PrefetchProxy_AfterSRPClick::kSRPPrefetchEligibleCountName,
0);
EXPECT_EQ(
- base::nullopt,
+ absl::nullopt,
GetUKMMetric(
prefetch_url, ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::kProbeLatencyMsName));
@@ -2580,7 +2580,7 @@
EXPECT_EQ(1, static_cast<int>(
tab_helper->after_srp_metrics()->prefetch_status_.value()));
- base::Optional<base::TimeDelta> probe_latency =
+ absl::optional<base::TimeDelta> probe_latency =
tab_helper->after_srp_metrics()->probe_latency_;
ASSERT_TRUE(probe_latency.has_value());
EXPECT_GT(probe_latency.value(), base::TimeDelta());
@@ -2590,17 +2590,17 @@
base::RunLoop().RunUntilIdle();
// 1 = |kPrefetchUsedProbeSuccess|.
- EXPECT_EQ(base::Optional<int64_t>(1),
+ EXPECT_EQ(absl::optional<int64_t>(1),
GetUKMMetric(eligible_link,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
kSRPClickPrefetchStatusName));
// The actual probe latency is hard to deterministically test for. Just make
// sure it is set within reasonable bounds.
- base::Optional<int64_t> probe_latency_ms = GetUKMMetric(
+ absl::optional<int64_t> probe_latency_ms = GetUKMMetric(
eligible_link, ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::kProbeLatencyMsName);
- EXPECT_NE(base::nullopt, probe_latency_ms);
+ EXPECT_NE(absl::nullopt, probe_latency_ms);
EXPECT_GT(probe_latency_ms.value(), 0);
EXPECT_LT(probe_latency_ms.value(), 1000);
}
@@ -2651,7 +2651,7 @@
EXPECT_EQ(2, static_cast<int>(
tab_helper->after_srp_metrics()->prefetch_status_.value()));
- base::Optional<base::TimeDelta> probe_latency =
+ absl::optional<base::TimeDelta> probe_latency =
tab_helper->after_srp_metrics()->probe_latency_;
ASSERT_TRUE(probe_latency.has_value());
EXPECT_GT(probe_latency.value(), base::TimeDelta());
@@ -2661,17 +2661,17 @@
base::RunLoop().RunUntilIdle();
// 1 = |kPrefetchNotUsedProbeFailed|.
- EXPECT_EQ(base::Optional<int64_t>(2),
+ EXPECT_EQ(absl::optional<int64_t>(2),
GetUKMMetric(eligible_link,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
kSRPClickPrefetchStatusName));
// The actual probe latency is hard to deterministically test for. Just make
// sure it is set within reasonable bounds.
- base::Optional<int64_t> probe_latency_ms = GetUKMMetric(
+ absl::optional<int64_t> probe_latency_ms = GetUKMMetric(
eligible_link, ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::kProbeLatencyMsName);
- EXPECT_NE(base::nullopt, probe_latency_ms);
+ EXPECT_NE(absl::nullopt, probe_latency_ms);
}
class PrefetchProxyBaseProbingBrowserTest : public PrefetchProxyBrowserTest {
@@ -2739,7 +2739,7 @@
static_cast<int>(
tab_helper->after_srp_metrics()->prefetch_status_.value()));
- base::Optional<base::TimeDelta> probe_latency =
+ absl::optional<base::TimeDelta> probe_latency =
tab_helper->after_srp_metrics()->probe_latency_;
if (expect_probe) {
ASSERT_TRUE(probe_latency.has_value());
@@ -2753,19 +2753,19 @@
base::RunLoop().RunUntilIdle();
EXPECT_EQ(
- base::Optional<int64_t>(expected_status),
+ absl::optional<int64_t>(expected_status),
GetUKMMetric(eligible_link,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
kSRPClickPrefetchStatusName));
- base::Optional<int64_t> probe_latency_ms = GetUKMMetric(
+ absl::optional<int64_t> probe_latency_ms = GetUKMMetric(
eligible_link, ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::kProbeLatencyMsName);
if (expect_probe) {
- EXPECT_NE(base::nullopt, probe_latency_ms);
+ EXPECT_NE(absl::nullopt, probe_latency_ms);
} else {
- EXPECT_EQ(base::nullopt, probe_latency_ms);
+ EXPECT_EQ(absl::nullopt, probe_latency_ms);
}
}
@@ -3126,7 +3126,7 @@
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
// 16 = |kPrefetchUsedNoProbeWithNSP|.
- EXPECT_EQ(base::Optional<int64_t>(16),
+ EXPECT_EQ(absl::optional<int64_t>(16),
GetUKMMetric(eligible_link,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -3434,7 +3434,7 @@
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
// 19 = |kPrefetchUsedNoProbeNSPAttemptDenied|.
- EXPECT_EQ(base::Optional<int64_t>(19),
+ EXPECT_EQ(absl::optional<int64_t>(19),
GetUKMMetric(eligible_link,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -3499,7 +3499,7 @@
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
// 22 = |kPrefetchUsedNoProbeNSPNotStarted|.
- EXPECT_EQ(base::Optional<int64_t>(22),
+ EXPECT_EQ(absl::optional<int64_t>(22),
GetUKMMetric(eligible_link_2,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -3641,7 +3641,7 @@
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
// 16 = |kPrefetchUsedNoProbeWithNSP|.
- EXPECT_EQ(base::Optional<int64_t>(16),
+ EXPECT_EQ(absl::optional<int64_t>(16),
GetUKMMetric(eligible_link,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -3718,7 +3718,7 @@
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
// 17 = |kPrefetchUsedProbeSuccessWithNSP|.
- EXPECT_EQ(base::Optional<int64_t>(17),
+ EXPECT_EQ(absl::optional<int64_t>(17),
GetUKMMetric(eligible_link,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -3811,7 +3811,7 @@
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
// 20 = |kPrefetchUsedProbeSuccessNSPAttemptDenied|.
- EXPECT_EQ(base::Optional<int64_t>(20),
+ EXPECT_EQ(absl::optional<int64_t>(20),
GetUKMMetric(eligible_link,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -3876,7 +3876,7 @@
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
// 23 = |kPrefetchUsedProbeSuccessNSPNotStarted|.
- EXPECT_EQ(base::Optional<int64_t>(23),
+ EXPECT_EQ(absl::optional<int64_t>(23),
GetUKMMetric(eligible_link_2,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -3954,7 +3954,7 @@
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
// 18 = |kPrefetchNotUsedProbeFailedWithNSP|.
- EXPECT_EQ(base::Optional<int64_t>(18),
+ EXPECT_EQ(absl::optional<int64_t>(18),
GetUKMMetric(eligible_link,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -4054,7 +4054,7 @@
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
// 21 = |kPrefetchNotUsedProbeFailedNSPAttemptDenied|.
- EXPECT_EQ(base::Optional<int64_t>(21),
+ EXPECT_EQ(absl::optional<int64_t>(21),
GetUKMMetric(eligible_link,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -4126,7 +4126,7 @@
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
// 24 = |kPrefetchNotUsedProbeFailedNSPNotStarted|.
- EXPECT_EQ(base::Optional<int64_t>(24),
+ EXPECT_EQ(absl::optional<int64_t>(24),
GetUKMMetric(eligible_link_2,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
@@ -4311,7 +4311,7 @@
ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
// 16 = |kPrefetchUsedNoProbeWithNSP|.
- EXPECT_EQ(base::Optional<int64_t>(16),
+ EXPECT_EQ(absl::optional<int64_t>(16),
GetUKMMetric(eligible_link,
ukm::builders::PrefetchProxy_AfterSRPClick::kEntryName,
ukm::builders::PrefetchProxy_AfterSRPClick::
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_from_string_url_loader.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_from_string_url_loader.cc
index a0b13d2..08e2b49e 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_from_string_url_loader.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_from_string_url_loader.cc
@@ -30,7 +30,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) {
+ const absl::optional<GURL>& new_url) {
NOTREACHED();
}
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_from_string_url_loader.h b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_from_string_url_loader.h
index 9e74229..2a2b2cd 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_from_string_url_loader.h
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_from_string_url_loader.h
@@ -50,7 +50,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) override;
+ const absl::optional<GURL>& new_url) override;
void SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) override;
void PauseReadingBodyFromNet() override;
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_decider.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_decider.cc
index c119fa6..9dc94df 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_decider.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_decider.cc
@@ -93,7 +93,7 @@
continue;
}
- base::Optional<base::Time> retry_after = util::ValueToTime(element.second);
+ absl::optional<base::Time> retry_after = util::ValueToTime(element.second);
if (!retry_after) {
// This may happen in the case of corrupted prefs, or otherwise. Handle
// gracefully.
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.cc
index a890f98..43782ab8 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.cc
@@ -59,7 +59,7 @@
class DNSProber : public network::mojom::ResolveHostClient {
public:
using OnDNSResultsCallback = base::OnceCallback<
- void(int, const base::Optional<net::AddressList>& resolved_addresses)>;
+ void(int, const absl::optional<net::AddressList>& resolved_addresses)>;
explicit DNSProber(OnDNSResultsCallback callback)
: callback_(std::move(callback)) {
@@ -69,7 +69,7 @@
~DNSProber() override {
if (callback_) {
// Indicates some kind of mojo error. Play it safe and return no success.
- std::move(callback_).Run(net::ERR_FAILED, base::nullopt);
+ std::move(callback_).Run(net::ERR_FAILED, absl::nullopt);
}
}
@@ -79,7 +79,7 @@
void OnComplete(
int32_t error,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) override {
+ const absl::optional<net::AddressList>& resolved_addresses) override {
if (callback_) {
std::move(callback_).Run(error, resolved_addresses);
}
@@ -118,8 +118,8 @@
private:
void OnTCPConnected(int result,
- const base::Optional<net::IPEndPoint>& local_addr,
- const base::Optional<net::IPEndPoint>& peer_addr,
+ const absl::optional<net::IPEndPoint>& local_addr,
+ const absl::optional<net::IPEndPoint>& peer_addr,
mojo::ScopedDataPipeConsumerHandle receive_stream,
mojo::ScopedDataPipeProducerHandle send_stream) {
if (result != net::OK) {
@@ -142,7 +142,7 @@
void OnUpgradeToTLS(int result,
mojo::ScopedDataPipeConsumerHandle receive_stream,
mojo::ScopedDataPipeProducerHandle send_stream,
- const base::Optional<net::SSLInfo>& ssl_info) {
+ const absl::optional<net::SSLInfo>& ssl_info) {
std::move(callback_).Run(result == net::OK
? PrefetchProxyProbeResult::kTLSProbeSuccess
: PrefetchProxyProbeResult::kTLSProbeFailure);
@@ -453,7 +453,7 @@
OnProbeResultCallback callback,
bool also_do_tls_connect,
int net_error,
- const base::Optional<net::AddressList>& resolved_addresses) {
+ const absl::optional<net::AddressList>& resolved_addresses) {
bool successful = net_error == net::OK && resolved_addresses &&
!resolved_addresses->empty();
@@ -483,7 +483,7 @@
profile_->GetDefaultStoragePartition()
->GetNetworkContext()
->CreateTCPConnectedSocket(
- /*local_addr=*/base::nullopt, addresses,
+ /*local_addr=*/absl::nullopt, addresses,
/*tcp_connected_socket_options=*/nullptr,
net::MutableNetworkTrafficAnnotationTag(
GetProbingTrafficAnnotation()),
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.h b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.h
index ff10ace..a11d9a6 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.h
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_origin_prober.h
@@ -7,9 +7,9 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_probe_result.h"
#include "net/base/address_list.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class AvailabilityProber;
@@ -78,7 +78,7 @@
OnProbeResultCallback callback,
bool also_do_tls_connect,
int net_error,
- const base::Optional<net::AddressList>& resolved_addresses);
+ const absl::optional<net::AddressList>& resolved_addresses);
// The current profile, not owned.
Profile* profile_;
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.cc
index 827cebb..db57340 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.cc
@@ -70,25 +70,25 @@
"do_no_state_prefetch", false);
}
-base::Optional<size_t> PrefetchProxyMaximumNumberOfPrefetches() {
+absl::optional<size_t> PrefetchProxyMaximumNumberOfPrefetches() {
if (!PrefetchProxyIsEnabled()) {
return 0;
}
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
"isolated-prerender-unlimited-prefetches")) {
- return base::nullopt;
+ return absl::nullopt;
}
int max = base::GetFieldTrialParamByFeatureAsInt(features::kIsolatePrerenders,
"max_srp_prefetches", 1);
if (max < 0) {
- return base::nullopt;
+ return absl::nullopt;
}
return max;
}
-base::Optional<size_t> PrefetchProxyMaximumNumberOfNoStatePrefetchAttempts() {
+absl::optional<size_t> PrefetchProxyMaximumNumberOfNoStatePrefetchAttempts() {
if (!PrefetchProxyIsEnabled() ||
!PrefetchProxyNoStatePrefetchSubresources()) {
return 0;
@@ -96,13 +96,13 @@
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
"isolated-prerender-unlimited-nsp")) {
- return base::nullopt;
+ return absl::nullopt;
}
int max = base::GetFieldTrialParamByFeatureAsInt(features::kIsolatePrerenders,
"max_nsp", 1);
if (max < 0) {
- return base::nullopt;
+ return absl::nullopt;
}
return max;
}
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.h b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.h
index 3251f8919..b66a2e9 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.h
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_params.h
@@ -7,8 +7,8 @@
#include <stdint.h>
-#include "base/optional.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
// This command line flag enables NoStatePrefetch on Prefetch Proxy.
@@ -36,7 +36,7 @@
// The maximum number of prefetches that should be done from predictions on a
// Google SRP. nullopt is returned for unlimited. Negative values given by the
// field trial return nullopt.
-base::Optional<size_t> PrefetchProxyMaximumNumberOfPrefetches();
+absl::optional<size_t> PrefetchProxyMaximumNumberOfPrefetches();
// The maximum number of mainframes allowed to be prefetched at the same time.
size_t PrefetchProxyMaximumNumberOfConcurrentPrefetches();
@@ -44,7 +44,7 @@
// The maximum number of no state prefetches to attempt, in order to prefetch
// the pages' subresources, while the user is on the SRP. nullopt is returned
// for unlimited. Negative values given by the field trial return nullopt.
-base::Optional<size_t> PrefetchProxyMaximumNumberOfNoStatePrefetchAttempts();
+absl::optional<size_t> PrefetchProxyMaximumNumberOfNoStatePrefetchAttempts();
// The maximum body length allowed to be prefetched for mainframe responses in
// bytes.
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_metrics_collector.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_metrics_collector.cc
index f7a080e1..2a858050 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_metrics_collector.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_metrics_collector.cc
@@ -96,7 +96,7 @@
}
}
-base::Optional<PrefetchProxyPrefetchStatus>
+absl::optional<PrefetchProxyPrefetchStatus>
PrefetchProxyPrefetchMetricsCollector::GetStatusOfMainframe(
const GURL& url) const {
auto mainframe_entry = resources_by_url_.find(url);
@@ -104,10 +104,10 @@
return mainframe_entry->second.status;
}
NOTREACHED() << "Unknown mainframe url";
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<size_t>
+absl::optional<size_t>
PrefetchProxyPrefetchMetricsCollector::GetLinkPositionOfMainframe(
const GURL& url) const {
auto mainframe_entry = resources_by_url_.find(url);
@@ -115,7 +115,7 @@
return mainframe_entry->second.link_position;
}
NOTREACHED() << "Unknown mainframe url";
- return base::nullopt;
+ return absl::nullopt;
}
void PrefetchProxyPrefetchMetricsCollector::OnMainframeResourceNotEligible(
@@ -288,7 +288,7 @@
return;
}
- base::Optional<PrefetchProxyPrefetchStatus> status =
+ absl::optional<PrefetchProxyPrefetchStatus> status =
GetStatusOfMainframe(mainframe_url);
if (status) {
entry_iter->second.status = *status;
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_metrics_collector.h b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_metrics_collector.h
index f5e3eba..9d6db7df 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_metrics_collector.h
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_metrics_collector.h
@@ -11,13 +11,13 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_status.h"
#include "chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_probe_result.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/network/public/cpp/url_loader_completion_status.h"
#include "services/network/public/mojom/url_response_head.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
// Collects metrics on every prefetched resource (mainframes and subresources),
@@ -87,10 +87,10 @@
const GURL& subresource_url);
// Helper method that gets the link position of the given mainframe |url|.
- base::Optional<size_t> GetLinkPositionOfMainframe(const GURL& url) const;
+ absl::optional<size_t> GetLinkPositionOfMainframe(const GURL& url) const;
// Helper method that gets the status of the given mainframe |url|.
- base::Optional<PrefetchProxyPrefetchStatus> GetStatusOfMainframe(
+ absl::optional<PrefetchProxyPrefetchStatus> GetStatusOfMainframe(
const GURL& url) const;
// Represents a single resource that was prefetched.
@@ -107,23 +107,23 @@
// The position in the navigation prediction of this resource's mainframe
// url.
- base::Optional<size_t> link_position;
+ absl::optional<size_t> link_position;
// The amount of data that transited the network for the resource.
- base::Optional<int64_t> data_length;
+ absl::optional<int64_t> data_length;
// The time between the start of the navigation and the start of the
// resource fetch.
- base::Optional<base::TimeDelta> navigation_start_to_fetch_start;
+ absl::optional<base::TimeDelta> navigation_start_to_fetch_start;
// The time duration that it took to fetch the resource.
- base::Optional<base::TimeDelta> fetch_duration;
+ absl::optional<base::TimeDelta> fetch_duration;
// Set if the mainframe link was clicked.
- base::Optional<bool> was_clicked;
+ absl::optional<bool> was_clicked;
// How this resource's page was filtered on navigation, if at all.
- base::Optional<PrefetchProxyProbeResult> filtering_result;
+ absl::optional<PrefetchProxyProbeResult> filtering_result;
};
const base::TimeTicks navigation_start_time_;
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_metrics_collector_unittest.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_metrics_collector_unittest.cc
index e5c4da11..68fdbdc3 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_metrics_collector_unittest.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_metrics_collector_unittest.cc
@@ -31,7 +31,7 @@
"ResourceType", "Status",
};
-network::mojom::URLResponseHeadPtr MakeHead(base::Optional<std::string> headers,
+network::mojom::URLResponseHeadPtr MakeHead(absl::optional<std::string> headers,
base::TimeDelta request_start) {
auto head = network::mojom::URLResponseHead::New();
head->load_timing.request_start = kNavigationStartTime + request_start;
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxy_configurator.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxy_configurator.cc
index a9b6e1cd..5d9646b5 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxy_configurator.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxy_configurator.cc
@@ -93,7 +93,7 @@
base::UmaHistogramSparse("PrefetchProxy.Proxy.Fallback.NetError",
std::abs(net_error));
- OnTunnelProxyConnectionError(base::nullopt);
+ OnTunnelProxyConnectionError(absl::nullopt);
}
void PrefetchProxyProxyConfigurator::OnTunnelHeadersReceived(
@@ -123,7 +123,7 @@
}
}
- OnTunnelProxyConnectionError(base::nullopt);
+ OnTunnelProxyConnectionError(absl::nullopt);
}
bool PrefetchProxyProxyConfigurator::IsPrefetchProxyAvailable() const {
@@ -135,7 +135,7 @@
}
void PrefetchProxyProxyConfigurator::OnTunnelProxyConnectionError(
- base::Optional<base::TimeDelta> retry_after) {
+ absl::optional<base::TimeDelta> retry_after) {
base::Time retry_proxy_at;
if (retry_after) {
retry_proxy_at = clock_->Now() + *retry_after;
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxy_configurator.h b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxy_configurator.h
index 6e242576..dfb8817e 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxy_configurator.h
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxy_configurator.h
@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_PREFETCH_PREFETCH_PROXY_PREFETCH_PROXY_PROXY_CONFIGURATOR_H_
#define CHROME_BROWSER_PREFETCH_PREFETCH_PROXY_PREFETCH_PROXY_PROXY_CONFIGURATOR_H_
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/clock.h"
#include "base/time/time.h"
@@ -16,6 +15,7 @@
#include "net/base/proxy_server.h"
#include "net/http/http_request_headers.h"
#include "services/network/public/mojom/network_context.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
// Configures the use of the IP-masking CONNECT tunnel proxy for Isolated
@@ -58,7 +58,7 @@
// Called when an error is detected by the CustomProxyConnectionObserver
// implementation so that we can throttle requests to the proxy.
void OnTunnelProxyConnectionError(
- base::Optional<base::TimeDelta> retry_after);
+ absl::optional<base::TimeDelta> retry_after);
// The headers used to setup the connect tunnel.
net::HttpRequestHeaders connect_tunnel_headers_;
@@ -70,7 +70,7 @@
const base::Clock* clock_;
// If set, the prefetch proxy should not be used until this time.
- base::Optional<base::Time> prefetch_proxy_not_available_until_;
+ absl::optional<base::Time> prefetch_proxy_not_available_until_;
// The set of clients that will get updates about changes to the proxy config.
mojo::RemoteSet<network::mojom::CustomProxyConfigClient>
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.cc
index 518270d..b3f0fec 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.cc
@@ -62,7 +62,7 @@
scoped_refptr<SuccessCount> success_count,
const GURL& url,
bool eligible,
- base::Optional<PrefetchProxyPrefetchStatus> not_used) {
+ absl::optional<PrefetchProxyPrefetchStatus> not_used) {
if (eligible) {
success_count->Increment();
}
@@ -144,7 +144,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) {
+ const absl::optional<GURL>& new_url) {
target_loader_->FollowRedirect(removed_headers, modified_headers,
modified_cors_exempt_headers, new_url);
}
@@ -296,7 +296,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) {}
+ const absl::optional<GURL>& new_url) {}
void PrefetchProxyProxyingURLLoaderFactory::AbortRequest::SetPriority(
net::RequestPriority priority,
int32_t intra_priority_value) {}
@@ -452,7 +452,7 @@
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
const GURL& url,
bool eligible,
- base::Optional<PrefetchProxyPrefetchStatus> status) {
+ absl::optional<PrefetchProxyPrefetchStatus> status) {
DCHECK_EQ(request.url, url);
DCHECK(!previously_cached_subresources_.has_value());
DCHECK(request.cors_exempt_headers.HasHeader(
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.h b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.h
index 7aa6d67..3ea6c82 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.h
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.h
@@ -13,7 +13,6 @@
#include "base/containers/unique_ptr_adapters.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_prefetch_status.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
@@ -21,6 +20,7 @@
#include "mojo/public/cpp/bindings/remote.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class Profile;
@@ -125,7 +125,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) override;
+ const absl::optional<GURL>& new_url) override;
void SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) override;
void PauseReadingBodyFromNet() override;
@@ -204,7 +204,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) override;
+ const absl::optional<GURL>& new_url) override;
void SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) override;
void PauseReadingBodyFromNet() override;
@@ -235,7 +235,7 @@
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
const GURL& url,
bool eligible,
- base::Optional<PrefetchProxyPrefetchStatus> status);
+ absl::optional<PrefetchProxyPrefetchStatus> status);
void RecordSubresourceMetricsDuringPrerender(
const GURL& url,
@@ -265,7 +265,7 @@
// When |previously_cached_subresources_| is set,
// |NotifyPageNavigatedToAfterSRP| has been called and the behavior there will
// take place using this set as the resources that can be loaded from cache.
- base::Optional<std::set<GURL>> previously_cached_subresources_;
+ absl::optional<std::set<GURL>> previously_cached_subresources_;
mojo::ReceiverSet<network::mojom::URLLoaderFactory> proxy_receivers_;
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_subresource_manager.h b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_subresource_manager.h
index bcd3d040..d5d143b8 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_subresource_manager.h
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_subresource_manager.h
@@ -12,7 +12,6 @@
#include "base/containers/unique_ptr_adapters.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.h"
#include "components/no_state_prefetch/browser/no_state_prefetch_handle.h"
#include "content/public/browser/content_browser_client.h"
@@ -21,6 +20,7 @@
#include "net/base/isolation_info.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/network_context.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -46,7 +46,7 @@
base::RepeatingCallback<void(
mojo::PendingReceiver<network::mojom::URLLoaderFactory>
pending_receiver,
- base::Optional<net::IsolationInfo> isolation_info)>;
+ absl::optional<net::IsolationInfo> isolation_info)>;
explicit PrefetchProxySubresourceManager(
const GURL& url,
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper.cc
index beaa8b26..d07389a 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper.cc
@@ -15,7 +15,6 @@
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/rand_util.h"
#include "base/time/time.h"
#include "chrome/browser/chrome_content_browser_client.h"
@@ -68,11 +67,12 @@
#include "services/network/public/mojom/cookie_manager.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/network_service.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
namespace {
-base::Optional<base::TimeDelta> GetTotalPrefetchTime(
+absl::optional<base::TimeDelta> GetTotalPrefetchTime(
network::mojom::URLResponseHead* head) {
DCHECK(head);
@@ -80,12 +80,12 @@
base::Time end = head->response_time;
if (start.is_null() || end.is_null())
- return base::nullopt;
+ return absl::nullopt;
return end - start;
}
-base::Optional<base::TimeDelta> GetPrefetchConnectTime(
+absl::optional<base::TimeDelta> GetPrefetchConnectTime(
network::mojom::URLResponseHead* head) {
DCHECK(head);
@@ -93,7 +93,7 @@
base::TimeTicks end = head->load_timing.connect_timing.connect_end;
if (start.is_null() || end.is_null())
- return base::nullopt;
+ return absl::nullopt;
return end - start;
}
@@ -146,7 +146,7 @@
return;
}
- std::move(result_callback).Run(url, true, base::nullopt);
+ std::move(result_callback).Run(url, true, absl::nullopt);
}
void CookieSetHelper(base::RepeatingClosure run_me,
@@ -308,12 +308,12 @@
return page_->isolated_network_context_.get();
}
-base::Optional<PrefetchProxyTabHelper::AfterSRPMetrics>
+absl::optional<PrefetchProxyTabHelper::AfterSRPMetrics>
PrefetchProxyTabHelper::after_srp_metrics() const {
if (page_->after_srp_metrics_) {
return *(page_->after_srp_metrics_);
}
- return base::nullopt;
+ return absl::nullopt;
}
// static
@@ -544,8 +544,8 @@
// way to the end, the status is already propagated. But if a redirect was
// not eligible then this will find its last known status.
DCHECK(!handle->GetRedirectChain().empty());
- base::Optional<PrefetchProxyPrefetchStatus> status;
- base::Optional<size_t> prediction_position;
+ absl::optional<PrefetchProxyPrefetchStatus> status;
+ absl::optional<size_t> prediction_position;
for (auto back_iter = handle->GetRedirectChain().rbegin();
back_iter != handle->GetRedirectChain().rend(); ++back_iter) {
GURL chain_url = *back_iter;
@@ -936,7 +936,7 @@
UMA_HISTOGRAM_COUNTS_10M("PrefetchProxy.Prefetch.Mainframe.BodyLength",
body->size());
- base::Optional<base::TimeDelta> total_time = GetTotalPrefetchTime(head.get());
+ absl::optional<base::TimeDelta> total_time = GetTotalPrefetchTime(head.get());
if (total_time) {
UMA_HISTOGRAM_CUSTOM_TIMES("PrefetchProxy.Prefetch.Mainframe.TotalTime",
*total_time,
@@ -944,7 +944,7 @@
base::TimeDelta::FromSeconds(30), 100);
}
- base::Optional<base::TimeDelta> connect_time =
+ absl::optional<base::TimeDelta> connect_time =
GetPrefetchConnectTime(head.get());
if (connect_time) {
UMA_HISTOGRAM_TIMES("PrefetchProxy.Prefetch.Mainframe.ConnectTime",
@@ -1027,7 +1027,7 @@
return;
}
- base::Optional<size_t> max_attempts =
+ absl::optional<size_t> max_attempts =
PrefetchProxyMaximumNumberOfNoStatePrefetchAttempts();
if (max_attempts.has_value() &&
page_->number_of_no_state_prefetch_attempts_ >= max_attempts.value()) {
@@ -1179,7 +1179,7 @@
}
void PrefetchProxyTabHelper::OnPredictionUpdated(
- const base::Optional<NavigationPredictorKeyedService::Prediction>
+ const absl::optional<NavigationPredictorKeyedService::Prediction>
prediction) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
@@ -1202,7 +1202,7 @@
return;
}
- const base::Optional<GURL>& source_document_url =
+ const absl::optional<GURL>& source_document_url =
prediction->source_document_url();
if (!source_document_url || source_document_url->is_empty())
@@ -1283,11 +1283,11 @@
}
// static
-std::pair<bool, base::Optional<PrefetchProxyPrefetchStatus>>
+std::pair<bool, absl::optional<PrefetchProxyPrefetchStatus>>
PrefetchProxyTabHelper::CheckEligibilityOfURLSansUserData(Profile* profile,
const GURL& url) {
if (!IsProfileEligible(profile)) {
- return std::make_pair(false, base::nullopt);
+ return std::make_pair(false, absl::nullopt);
}
if (!PrefetchProxyUseSpeculationRules() &&
@@ -1311,7 +1311,7 @@
PrefetchProxyService* prefetch_proxy_service =
PrefetchProxyServiceFactory::GetForProfile(profile);
if (!prefetch_proxy_service) {
- return std::make_pair(false, base::nullopt);
+ return std::make_pair(false, absl::nullopt);
}
if (!prefetch_proxy_service->proxy_configurator()
@@ -1320,7 +1320,7 @@
false, PrefetchProxyPrefetchStatus::kPrefetchProxyNotAvailable);
}
- return std::make_pair(true, base::nullopt);
+ return std::make_pair(true, absl::nullopt);
}
// static
@@ -1353,7 +1353,7 @@
PrefetchProxyService* prefetch_proxy_service =
PrefetchProxyServiceFactory::GetForProfile(profile);
if (!prefetch_proxy_service) {
- std::move(result_callback).Run(url, false, base::nullopt);
+ std::move(result_callback).Run(url, false, absl::nullopt);
return;
}
@@ -1389,7 +1389,7 @@
void PrefetchProxyTabHelper::OnGotEligibilityResult(
const GURL& url,
bool eligible,
- base::Optional<PrefetchProxyPrefetchStatus> status) {
+ absl::optional<PrefetchProxyPrefetchStatus> status) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// It is possible that this callback is being run late. That is, after the
@@ -1547,7 +1547,7 @@
void PrefetchProxyTabHelper::CreateNewURLLoaderFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory> pending_receiver,
- base::Optional<net::IsolationInfo> isolation_info) {
+ absl::optional<net::IsolationInfo> isolation_info) {
DCHECK(page_->isolated_network_context_);
auto factory_params = network::mojom::URLLoaderFactoryParams::New();
@@ -1621,7 +1621,7 @@
mojo::PendingRemote<network::mojom::URLLoaderFactory> isolated_factory_remote;
CreateNewURLLoaderFactory(
- isolated_factory_remote.InitWithNewPipeAndPassReceiver(), base::nullopt);
+ isolated_factory_remote.InitWithNewPipeAndPassReceiver(), absl::nullopt);
page_->isolated_url_loader_factory_ = network::SharedURLLoaderFactory::Create(
std::make_unique<network::WrapperPendingSharedURLLoaderFactory>(
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper.h b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper.h
index 46bc939..3ef932fc 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper.h
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper.h
@@ -14,7 +14,6 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "chrome/browser/navigation_predictor/navigation_predictor_keyed_service.h"
@@ -31,6 +30,7 @@
#include "services/network/public/cpp/url_loader_completion_status.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class PrefetchProxyPageLoadMetricsObserver;
@@ -117,7 +117,7 @@
size_t prefetch_total_redirect_count_ = 0;
// The duration between navigation start and the start of prefetching.
- base::Optional<base::TimeDelta> navigation_to_prefetch_start_;
+ absl::optional<base::TimeDelta> navigation_to_prefetch_start_;
private:
friend class base::RefCounted<PrefetchMetrics>;
@@ -140,14 +140,14 @@
// The position of the link on the SRP that was navigated to. Not set if the
// navigated page wasn't in the SRP.
- base::Optional<size_t> clicked_link_srp_position_;
+ absl::optional<size_t> clicked_link_srp_position_;
// The status of a prefetch done on the SRP that may have been used here.
- base::Optional<PrefetchProxyPrefetchStatus> prefetch_status_;
+ absl::optional<PrefetchProxyPrefetchStatus> prefetch_status_;
// The amount of time it took the probe to complete. Set only when a
// prefetch is used and a probe was required.
- base::Optional<base::TimeDelta> probe_latency_;
+ absl::optional<base::TimeDelta> probe_latency_;
};
// Checks if a |service_worker_context_for_test_| is available, and if not,
@@ -162,7 +162,7 @@
using OnEligibilityResultCallback = base::OnceCallback<void(
const GURL& url,
bool eligible,
- base::Optional<PrefetchProxyPrefetchStatus> status)>;
+ absl::optional<PrefetchProxyPrefetchStatus> status)>;
static void CheckEligibilityOfURL(
Profile* profile,
const GURL& url,
@@ -172,7 +172,7 @@
// Returns nullopt unless the previous page load was a Google SRP where |this|
// got parsed SRP links from NavigationPredictor.
- base::Optional<PrefetchProxyTabHelper::AfterSRPMetrics> after_srp_metrics()
+ absl::optional<PrefetchProxyTabHelper::AfterSRPMetrics> after_srp_metrics()
const;
// Fetches |private_prefetches| (up to a limit) and upon completion of each
@@ -303,7 +303,7 @@
// The amount of time that the probe took to complete. Kept in this class
// until commit in order to be plumbed into |AfterSRPMetrics|.
- base::Optional<base::TimeDelta> probe_latency_;
+ absl::optional<base::TimeDelta> probe_latency_;
// All prefetched responses by URL. This is cleared every time a mainframe
// navigation commits.
@@ -360,7 +360,7 @@
// Returns whether the |url| is eligible, possibly with a status, without
// considering any user data like service workers or cookies. Used to
// determine eligibility and whether to send decoy requests.
- static std::pair<bool, base::Optional<PrefetchProxyPrefetchStatus>>
+ static std::pair<bool, absl::optional<PrefetchProxyPrefetchStatus>>
CheckEligibilityOfURLSansUserData(Profile* profile, const GURL& url);
// Computes the AfterSRPMetrics that would be returned for the next
@@ -429,7 +429,7 @@
// NavigationPredictorKeyedService::Observer:
void OnPredictionUpdated(
- const base::Optional<NavigationPredictorKeyedService::Prediction>
+ const absl::optional<NavigationPredictorKeyedService::Prediction>
prediction) override;
// Fetches the |prefetch_targets|, and considers fetching subresources for
@@ -442,14 +442,14 @@
void OnGotEligibilityResult(
const GURL& url,
bool eligible,
- base::Optional<PrefetchProxyPrefetchStatus> status);
+ absl::optional<PrefetchProxyPrefetchStatus> status);
// Creates a new URL Loader Factory on |page_|'s isolated network context.
// |isolation_info| may be passed if the factory will be used in the renderer
// for subresources.
void CreateNewURLLoaderFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory> pending_receiver,
- base::Optional<net::IsolationInfo> isolation_info);
+ absl::optional<net::IsolationInfo> isolation_info);
// Starts a query for all cookies on |url| in the isolated cookie jar so that
// they can be copied to the normal profile. After this method is called,
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper_unittest.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper_unittest.cc
index dfbb316..876c2069 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper_unittest.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_tab_helper_unittest.cc
@@ -12,7 +12,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
@@ -51,6 +50,7 @@
#include "services/network/test/test_url_loader_factory.h"
#include "services/network/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -193,7 +193,7 @@
return tab_helper_->srp_metrics().predicted_urls_count_;
}
- base::Optional<base::TimeDelta> navigation_to_prefetch_start() const {
+ absl::optional<base::TimeDelta> navigation_to_prefetch_start() const {
return tab_helper_->srp_metrics().navigation_to_prefetch_start_;
}
@@ -206,7 +206,7 @@
return tab_helper_->after_srp_metrics()->prefetch_eligible_count_;
}
- base::Optional<size_t> after_srp_clicked_link_srp_position() const {
+ absl::optional<size_t> after_srp_clicked_link_srp_position() const {
DCHECK(tab_helper_->after_srp_metrics());
return tab_helper_->after_srp_metrics()->clicked_link_srp_position_;
}
@@ -335,7 +335,7 @@
->GetNetworkContext()
->GetCookieManager(cookie_manager.BindNewPipeAndPassReceiver());
std::unique_ptr<net::CanonicalCookie> cc(net::CanonicalCookie::Create(
- url, value, base::Time::Now(), base::nullopt /* server_time */));
+ url, value, base::Time::Now(), absl::nullopt /* server_time */));
EXPECT_TRUE(cc.get());
net::CookieOptions options;
@@ -589,7 +589,7 @@
prediction_url,
PrefetchProxyPrefetchStatus::kPrefetchNotEligibleSchemeIsNotHttps);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 0U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectTotalCount(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0);
@@ -624,7 +624,7 @@
prediction_url,
PrefetchProxyPrefetchStatus::kPrefetchNotEligibleGoogleDomain);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 0U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectTotalCount(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0);
@@ -659,7 +659,7 @@
prediction_url,
PrefetchProxyPrefetchStatus::kPrefetchNotEligibleHostIsIPAddress);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 0U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectTotalCount(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0);
@@ -750,7 +750,7 @@
prediction_url,
PrefetchProxyPrefetchStatus::kPrefetchNotEligibleUserHasCookies);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 0U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectTotalCount(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0);
@@ -789,7 +789,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url, PrefetchProxyPrefetchStatus::kPrefetchFailedNon2XX);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectUniqueSample(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0, 1);
@@ -829,7 +829,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url, PrefetchProxyPrefetchStatus::kPrefetchFailedNetError);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectUniqueSample(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0, 1);
@@ -869,7 +869,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url, PrefetchProxyPrefetchStatus::kPrefetchFailedNotHTML);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectUniqueSample(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0, 1);
@@ -948,7 +948,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url, PrefetchProxyPrefetchStatus::kPrefetchSuccessful);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectUniqueSample(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0, 1);
@@ -999,7 +999,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url, PrefetchProxyPrefetchStatus::kPrefetchSuccessful);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectUniqueSample(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0, 1);
@@ -1039,7 +1039,7 @@
GURL("https://wasnt-on-srp.com"),
PrefetchProxyPrefetchStatus::kNavigatedToLinkNotOnSRP);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::nullopt, after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::nullopt, after_srp_clicked_link_srp_position());
histogram_tester.ExpectUniqueSample(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0, 1);
@@ -1120,7 +1120,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url_1, PrefetchProxyPrefetchStatus::kPrefetchSuccessful);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 3U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectUniqueSample(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0, 1);
@@ -1239,7 +1239,7 @@
prediction_url,
PrefetchProxyPrefetchStatus::kPrefetchNotEligibleUserHasServiceWorker);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 0U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
}
TEST_F(PrefetchProxyTabHelperTest, ServiceWorkerNotRegistered) {
@@ -1309,7 +1309,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url, PrefetchProxyPrefetchStatus::kPrefetchIsPrivacyDecoy);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 0U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectTotalCount(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0);
@@ -1351,7 +1351,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url, PrefetchProxyPrefetchStatus::kPrefetchIsPrivacyDecoy);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 0U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectTotalCount(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0);
@@ -1402,7 +1402,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url, PrefetchProxyPrefetchStatus::kPrefetchFailedNetError);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectUniqueSample(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0, 1);
@@ -1441,7 +1441,7 @@
NavigateAndVerifyPrefetchStatus(
eligible_url, PrefetchProxyPrefetchStatus::kPrefetchPositionIneligible);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(1), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(1), after_srp_clicked_link_srp_position());
}
class PrefetchProxyTabHelperNoPrefetchesTest
@@ -1484,7 +1484,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url, PrefetchProxyPrefetchStatus::kPrefetchNotStarted);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectTotalCount(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0);
@@ -1553,7 +1553,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url_3, PrefetchProxyPrefetchStatus::kPrefetchSuccessful);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 3U);
- EXPECT_EQ(base::Optional<size_t>(2), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(2), after_srp_clicked_link_srp_position());
histogram_tester.ExpectUniqueSample(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0, 1);
@@ -1613,7 +1613,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url_2, PrefetchProxyPrefetchStatus::kPrefetchSuccessful);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 2U);
- EXPECT_EQ(base::Optional<size_t>(1), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(1), after_srp_clicked_link_srp_position());
histogram_tester.ExpectUniqueSample(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0, 1);
@@ -1816,7 +1816,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url, PrefetchProxyPrefetchStatus::kPrefetchIsPrivacyDecoy);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 0U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectTotalCount(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0);
@@ -1856,7 +1856,7 @@
NavigateAndVerifyPrefetchStatus(
prediction_url, PrefetchProxyPrefetchStatus::kPrefetchIsPrivacyDecoy);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 0U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectTotalCount(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 0);
@@ -1890,7 +1890,7 @@
site_with_cookies,
PrefetchProxyPrefetchStatus::kPrefetchNotEligibleUserHasCookies);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
}
TEST_F(PrefetchProxyTabHelperRedirectTest, NoRedirect_Insecure) {
@@ -1910,7 +1910,7 @@
NavigateAndVerifyPrefetchStatus(
url, PrefetchProxyPrefetchStatus::kPrefetchNotEligibleSchemeIsNotHttps);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
}
TEST_F(PrefetchProxyTabHelperRedirectTest, NoRedirect_Insecure_Continued) {
@@ -1946,7 +1946,7 @@
tab_helper()->after_srp_metrics()->prefetch_status_.value());
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
}
TEST_F(PrefetchProxyTabHelperRedirectTest, NoRedirect_Google) {
@@ -1966,7 +1966,7 @@
NavigateAndVerifyPrefetchStatus(
url, PrefetchProxyPrefetchStatus::kPrefetchNotEligibleGoogleDomain);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
}
TEST_F(PrefetchProxyTabHelperRedirectTest, NoRedirect_ServiceWorker) {
@@ -1990,7 +1990,7 @@
site_with_worker,
PrefetchProxyPrefetchStatus::kPrefetchNotEligibleUserHasServiceWorker);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 1U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
}
class PrefetchProxyTabHelperRedirectUnlimitedPrefetchesTest
@@ -2050,7 +2050,7 @@
NavigateAndVerifyPrefetchStatus(
redirect_url, PrefetchProxyPrefetchStatus::kPrefetchSuccessful);
EXPECT_EQ(after_srp_prefetch_eligible_count(), 2U);
- EXPECT_EQ(base::Optional<size_t>(0), after_srp_clicked_link_srp_position());
+ EXPECT_EQ(absl::optional<size_t>(0), after_srp_clicked_link_srp_position());
histogram_tester.ExpectUniqueSample(
"PrefetchProxy.Prefetch.Mainframe.TotalRedirects", 1, 1);
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_url_loader_interceptor.h b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_url_loader_interceptor.h
index d06e3eb..dfe8776 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_url_loader_interceptor.h
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_url_loader_interceptor.h
@@ -10,7 +10,6 @@
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "chrome/browser/availability/availability_prober.h"
@@ -18,6 +17,7 @@
#include "chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_probe_result.h"
#include "content/public/browser/url_loader_request_interceptor.h"
#include "services/network/public/cpp/resource_request.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace content {
@@ -76,11 +76,11 @@
// The time when probing was started. Used to calculate probe latency which is
// reported to the tab helper.
- base::Optional<base::TimeTicks> probe_start_time_;
+ absl::optional<base::TimeTicks> probe_start_time_;
// The time when we started waiting for cookies to be copied, delaying the
// navigation. Used to calculate total cookie wait time.
- base::Optional<base::TimeTicks> cookie_copy_start_time_;
+ absl::optional<base::TimeTicks> cookie_copy_start_time_;
// Set in |MaybeCreateLoader| and used in |On[DoNot]InterceptRequest|.
content::URLLoaderRequestInterceptor::LoaderCallback loader_callback_;
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_url_loader_interceptor_unittest.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_url_loader_interceptor_unittest.cc
index 725bad6..efbeba29 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_url_loader_interceptor_unittest.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_url_loader_interceptor_unittest.cc
@@ -114,10 +114,10 @@
}
}
- base::Optional<bool> was_intercepted() { return was_intercepted_; }
+ absl::optional<bool> was_intercepted() { return was_intercepted_; }
private:
- base::Optional<bool> was_intercepted_;
+ absl::optional<bool> was_intercepted_;
base::OnceClosure waiting_for_callback_closure_;
};
diff --git a/chrome/browser/prefetch/search_prefetch/back_forward_search_prefetch_url_loader.cc b/chrome/browser/prefetch/search_prefetch/back_forward_search_prefetch_url_loader.cc
index 46328dfb..80d4f477 100644
--- a/chrome/browser/prefetch/search_prefetch/back_forward_search_prefetch_url_loader.cc
+++ b/chrome/browser/prefetch/search_prefetch/back_forward_search_prefetch_url_loader.cc
@@ -203,7 +203,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) {
+ const absl::optional<GURL>& new_url) {
// This should never be called for a non-network service URLLoader.
NOTREACHED();
}
diff --git a/chrome/browser/prefetch/search_prefetch/back_forward_search_prefetch_url_loader.h b/chrome/browser/prefetch/search_prefetch/back_forward_search_prefetch_url_loader.h
index ef69d4b..216b374 100644
--- a/chrome/browser/prefetch/search_prefetch/back_forward_search_prefetch_url_loader.h
+++ b/chrome/browser/prefetch/search_prefetch/back_forward_search_prefetch_url_loader.h
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/prefetch/search_prefetch/search_prefetch_url_loader.h"
#include "chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_request.h"
#include "content/public/browser/url_loader_request_interceptor.h"
@@ -20,6 +19,7 @@
#include "mojo/public/cpp/bindings/remote.h"
#include "services/network/public/mojom/url_loader.mojom-forward.h"
#include "services/network/public/mojom/url_response_head.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// This class tries to fetch a prefetch response from cache, and if one is not
// available, it fetches the non-prefetch URL directly. This case is only
@@ -47,7 +47,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) override;
+ const absl::optional<GURL>& new_url) override;
void SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) override;
void PauseReadingBodyFromNet() override;
diff --git a/chrome/browser/prefetch/search_prefetch/base_search_prefetch_request.cc b/chrome/browser/prefetch/search_prefetch/base_search_prefetch_request.cc
index ec92cf46..b1dc0a50 100644
--- a/chrome/browser/prefetch/search_prefetch/base_search_prefetch_request.cc
+++ b/chrome/browser/prefetch/search_prefetch/base_search_prefetch_request.cc
@@ -185,7 +185,7 @@
/*is_ua_override_on=*/false, js_enabled);
#if defined(OS_ANDROID)
- base::Optional<std::string> geo_header =
+ absl::optional<std::string> geo_header =
GetGeolocationHeaderIfAllowed(resource_request->url, profile);
if (geo_header) {
resource_request->headers.AddHeaderFromString(geo_header.value());
diff --git a/chrome/browser/prefetch/search_prefetch/search_prefetch_from_string_url_loader.cc b/chrome/browser/prefetch/search_prefetch/search_prefetch_from_string_url_loader.cc
index d9fa0e8..dd2161e0 100644
--- a/chrome/browser/prefetch/search_prefetch/search_prefetch_from_string_url_loader.cc
+++ b/chrome/browser/prefetch/search_prefetch/search_prefetch_from_string_url_loader.cc
@@ -30,7 +30,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) {
+ const absl::optional<GURL>& new_url) {
NOTREACHED();
}
diff --git a/chrome/browser/prefetch/search_prefetch/search_prefetch_from_string_url_loader.h b/chrome/browser/prefetch/search_prefetch/search_prefetch_from_string_url_loader.h
index 0b95a60..ff529fa 100644
--- a/chrome/browser/prefetch/search_prefetch/search_prefetch_from_string_url_loader.h
+++ b/chrome/browser/prefetch/search_prefetch/search_prefetch_from_string_url_loader.h
@@ -52,7 +52,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) override;
+ const absl::optional<GURL>& new_url) override;
void SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) override;
void PauseReadingBodyFromNet() override;
diff --git a/chrome/browser/prefetch/search_prefetch/search_prefetch_service.cc b/chrome/browser/prefetch/search_prefetch/search_prefetch_service.cc
index 4c147f6..927c89d 100644
--- a/chrome/browser/prefetch/search_prefetch/search_prefetch_service.cc
+++ b/chrome/browser/prefetch/search_prefetch/search_prefetch_service.cc
@@ -236,11 +236,11 @@
prefetches_[match_search_terms]->MarkPrefetchAsClicked();
}
-base::Optional<SearchPrefetchStatus>
+absl::optional<SearchPrefetchStatus>
SearchPrefetchService::GetSearchPrefetchStatusForTesting(
std::u16string search_terms) {
if (prefetches_.find(search_terms) == prefetches_.end())
- return base::nullopt;
+ return absl::nullopt;
return prefetches_[search_terms]->current_status();
}
@@ -458,7 +458,7 @@
TemplateURLServiceFactory::GetForProfile(profile_);
DCHECK(template_url_service);
- base::Optional<TemplateURLData> template_url_service_data;
+ absl::optional<TemplateURLData> template_url_service_data;
const TemplateURL* template_url =
template_url_service->GetDefaultSearchProvider();
@@ -582,7 +582,7 @@
continue;
}
- base::Optional<base::Time> last_update =
+ absl::optional<base::Time> last_update =
util::ValueToTime(prefetch_url_and_time[1]);
if (!last_update) {
continue;
diff --git a/chrome/browser/prefetch/search_prefetch/search_prefetch_service.h b/chrome/browser/prefetch/search_prefetch/search_prefetch_service.h
index 65c7bbe..4a7047f67 100644
--- a/chrome/browser/prefetch/search_prefetch/search_prefetch_service.h
+++ b/chrome/browser/prefetch/search_prefetch/search_prefetch_service.h
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/callback_list.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/timer/timer.h"
#include "chrome/browser/prefetch/search_prefetch/base_search_prefetch_request.h"
@@ -18,6 +17,7 @@
#include "components/search_engines/template_url_data.h"
#include "components/search_engines/template_url_service.h"
#include "components/search_engines/template_url_service_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class AutocompleteController;
@@ -121,7 +121,7 @@
const GURL& navigation_url);
// Reports the status of a prefetch for a given search term.
- base::Optional<SearchPrefetchStatus> GetSearchPrefetchStatusForTesting(
+ absl::optional<SearchPrefetchStatus> GetSearchPrefetchStatusForTesting(
std::u16string search_terms);
// Calls |LoadFromPrefs()|.
@@ -166,7 +166,7 @@
base::TimeTicks last_error_time_ticks_;
// The current state of the DSE.
- base::Optional<TemplateURLData> template_url_service_data_;
+ absl::optional<TemplateURLData> template_url_service_data_;
// A subscription to the omnibox log service to track when a navigation is
// about to happen.
diff --git a/chrome/browser/prefetch/search_prefetch/search_prefetch_service_browsertest.cc b/chrome/browser/prefetch/search_prefetch/search_prefetch_service_browsertest.cc
index 4335223..9b89f19 100644
--- a/chrome/browser/prefetch/search_prefetch/search_prefetch_service_browsertest.cc
+++ b/chrome/browser/prefetch/search_prefetch/search_prefetch_service_browsertest.cc
@@ -4,7 +4,6 @@
#include "base/callback_helpers.h"
#include "base/containers/contains.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
@@ -56,6 +55,7 @@
#include "net/test/embedded_test_server/embedded_test_server_connection_listener.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_registration_options.mojom.h"
#include "ui/base/page_transition_types.h"
@@ -337,7 +337,7 @@
}
void WaitUntilStatusChangesTo(std::u16string search_terms,
- base::Optional<SearchPrefetchStatus> status) {
+ absl::optional<SearchPrefetchStatus> status) {
auto* search_prefetch_service =
SearchPrefetchServiceFactory::GetForProfile(browser()->profile());
while (search_prefetch_service->GetSearchPrefetchStatusForTesting(
@@ -374,7 +374,7 @@
void set_phi_is_one(bool phi_is_one) { phi_is_one_ = phi_is_one; }
- void ClearBrowsingCacheData(base::Optional<GURL> url_origin) {
+ void ClearBrowsingCacheData(absl::optional<GURL> url_origin) {
auto filter = content::BrowsingDataFilterBuilder::Create(
url_origin ? content::BrowsingDataFilterBuilder::Mode::kDelete
: content::BrowsingDataFilterBuilder::Mode::kPreserve);
@@ -1779,7 +1779,7 @@
omnibox->model()->AcceptInput(WindowOpenDisposition::CURRENT_TAB);
- WaitUntilStatusChangesTo(base::ASCIIToUTF16(search_terms), base::nullopt);
+ WaitUntilStatusChangesTo(base::ASCIIToUTF16(search_terms), absl::nullopt);
prefetch_status = search_prefetch_service->GetSearchPrefetchStatusForTesting(
base::ASCIIToUTF16(search_terms));
ASSERT_FALSE(prefetch_status.has_value());
@@ -1847,7 +1847,7 @@
base::ASCIIToUTF16(search_terms));
EXPECT_TRUE(prefetch_status.has_value());
- ClearBrowsingCacheData(base::nullopt);
+ ClearBrowsingCacheData(absl::nullopt);
prefetch_status = search_prefetch_service->GetSearchPrefetchStatusForTesting(
base::ASCIIToUTF16(search_terms));
EXPECT_FALSE(prefetch_status.has_value());
@@ -2562,7 +2562,7 @@
base::ASCIIToUTF16(search_terms));
EXPECT_TRUE(prefetch_status.has_value());
- WaitUntilStatusChangesTo(base::ASCIIToUTF16(search_terms), base::nullopt);
+ WaitUntilStatusChangesTo(base::ASCIIToUTF16(search_terms), absl::nullopt);
prefetch_status = search_prefetch_service->GetSearchPrefetchStatusForTesting(
base::ASCIIToUTF16(search_terms));
@@ -2590,7 +2590,7 @@
EXPECT_FALSE(search_prefetch_service->MaybePrefetchURL(
GetSearchServerQueryURL("prefetch_4")));
- WaitUntilStatusChangesTo(u"prefetch_1", base::nullopt);
+ WaitUntilStatusChangesTo(u"prefetch_1", absl::nullopt);
EXPECT_TRUE(search_prefetch_service->MaybePrefetchURL(
GetSearchServerQueryURL("prefetch_4")));
diff --git a/chrome/browser/prefetch/search_prefetch/search_prefetch_url_loader_interceptor.h b/chrome/browser/prefetch/search_prefetch/search_prefetch_url_loader_interceptor.h
index 2b347e6..2f3bf645 100644
--- a/chrome/browser/prefetch/search_prefetch/search_prefetch_url_loader_interceptor.h
+++ b/chrome/browser/prefetch/search_prefetch/search_prefetch_url_loader_interceptor.h
@@ -10,10 +10,10 @@
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "content/public/browser/url_loader_request_interceptor.h"
#include "services/network/public/cpp/resource_request.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace content {
diff --git a/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.cc b/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.cc
index 30490ca6..2f44299 100644
--- a/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.cc
+++ b/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.cc
@@ -309,7 +309,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) {
+ const absl::optional<GURL>& new_url) {
// This should never be called for a non-network service URLLoader.
NOTREACHED();
}
diff --git a/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.h b/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.h
index 957ed9d8..2213fb0 100644
--- a/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.h
+++ b/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.h
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/prefetch/search_prefetch/search_prefetch_url_loader.h"
#include "chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_request.h"
#include "content/public/browser/url_loader_request_interceptor.h"
@@ -22,6 +21,7 @@
#include "mojo/public/cpp/system/data_pipe_drainer.h"
#include "services/network/public/mojom/url_loader.mojom-forward.h"
#include "services/network/public/mojom/url_response_head.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// This class starts a search prefetch and is able to serve it once headers are
// received. This allows streaming the response from memory as the response
@@ -62,7 +62,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) override;
+ const absl::optional<GURL>& new_url) override;
void SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) override;
void PauseReadingBodyFromNet() override;
@@ -139,7 +139,7 @@
bool serving_from_data_ = false;
// The status returned from |network_url_loader_|.
- base::Optional<network::URLLoaderCompletionStatus> status_;
+ absl::optional<network::URLLoaderCompletionStatus> status_;
// Total amount of bytes to transfer.
int bytes_of_raw_data_to_transfer_ = 0;
diff --git a/chrome/browser/printing/cloud_print/cloud_print_printer_list_unittest.cc b/chrome/browser/printing/cloud_print/cloud_print_printer_list_unittest.cc
index c3ab3d3..b064d03 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_printer_list_unittest.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_printer_list_unittest.cc
@@ -54,7 +54,7 @@
CloudPrintPrinterList::DeviceList devices;
EXPECT_CALL(delegate, OnDeviceListReady(_)).WillOnce(SaveArg<0>(&devices));
- base::Optional<base::Value> value =
+ absl::optional<base::Value> value =
base::JSONReader::Read(kSampleSuccessResponseOAuth);
ASSERT_TRUE(value);
const base::DictionaryValue* dictionary = NULL;
diff --git a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc
index 14aba7a..4e19c034 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc
@@ -242,7 +242,7 @@
void CloudPrintProxyService::OnReadCloudPrintSetupProxyList(
PrintersCallback callback,
const std::string& printers_json) {
- base::Optional<base::Value> value = base::JSONReader::Read(printers_json);
+ absl::optional<base::Value> value = base::JSONReader::Read(printers_json);
std::vector<std::string> printers;
if (value && value->is_list()) {
for (const auto& element : value->GetList()) {
diff --git a/chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc b/chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc
index 6f41ac75..072d81c 100644
--- a/chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc
+++ b/chrome/browser/printing/cloud_print/gcd_api_flow_impl.cc
@@ -163,7 +163,7 @@
return;
}
- base::Optional<base::Value> value = base::JSONReader::Read(*response_body);
+ absl::optional<base::Value> value = base::JSONReader::Read(*response_body);
const base::DictionaryValue* dictionary_value = NULL;
if (!value || !value->GetAsDictionary(&dictionary_value)) {
diff --git a/chrome/browser/printing/cloud_print/privet_confirm_api_flow_unittest.cc b/chrome/browser/printing/cloud_print/privet_confirm_api_flow_unittest.cc
index 7480357c..108866b 100644
--- a/chrome/browser/printing/cloud_print/privet_confirm_api_flow_unittest.cc
+++ b/chrome/browser/printing/cloud_print/privet_confirm_api_flow_unittest.cc
@@ -50,7 +50,7 @@
base::BindOnce(&MockDelegate::Callback, base::Unretained(&delegate)));
EXPECT_CALL(delegate, Callback(GCDApiFlow::SUCCESS)).Times(1);
- base::Optional<base::Value> value =
+ absl::optional<base::Value> value =
base::JSONReader::Read(kSampleConfirmResponse);
ASSERT_TRUE(value);
const base::DictionaryValue* dictionary = NULL;
diff --git a/chrome/browser/printing/cloud_print/privet_http_unittest.cc b/chrome/browser/printing/cloud_print/privet_http_unittest.cc
index 4ffe200..8a9e759 100644
--- a/chrome/browser/printing/cloud_print/privet_http_unittest.cc
+++ b/chrome/browser/printing/cloud_print/privet_http_unittest.cc
@@ -267,7 +267,7 @@
// string.
std::string NormalizeJson(const std::string& json) {
std::string result = json;
- base::Optional<base::Value> value = base::JSONReader::Read(result);
+ absl::optional<base::Value> value = base::JSONReader::Read(result);
DCHECK(value) << result;
base::JSONWriter::Write(*value, &result);
return result;
@@ -770,7 +770,7 @@
local_print_operation_->SetUsername("[email protected]");
local_print_operation_->SetJobname("Sample job name");
local_print_operation_->SetData(RefCountedBytesFromString("foobar"));
- base::Optional<base::Value> ticket = base::JSONReader::Read(kSampleCJTDuplex);
+ absl::optional<base::Value> ticket = base::JSONReader::Read(kSampleCJTDuplex);
ASSERT_TRUE(ticket);
local_print_operation_->SetTicket(std::move(*ticket));
local_print_operation_->SetCapabilities(
@@ -806,7 +806,7 @@
local_print_operation_->SetUsername("[email protected]");
local_print_operation_->SetJobname("Sample job name");
local_print_operation_->SetData(RefCountedBytesFromString("foobar"));
- base::Optional<base::Value> ticket = base::JSONReader::Read(kSampleCJTMono);
+ absl::optional<base::Value> ticket = base::JSONReader::Read(kSampleCJTMono);
ASSERT_TRUE(ticket);
local_print_operation_->SetTicket(std::move(*ticket));
local_print_operation_->SetCapabilities(
@@ -840,7 +840,7 @@
local_print_operation_->SetUsername("[email protected]");
local_print_operation_->SetJobname("Sample job name");
local_print_operation_->SetData(RefCountedBytesFromString("foobar"));
- base::Optional<base::Value> ticket = base::JSONReader::Read(kSampleCJTMono);
+ absl::optional<base::Value> ticket = base::JSONReader::Read(kSampleCJTMono);
ASSERT_TRUE(ticket);
local_print_operation_->SetTicket(std::move(*ticket));
local_print_operation_->SetCapabilities(
@@ -873,7 +873,7 @@
TEST_P(PrivetLocalPrintTest, SuccessfulLocalPrintWithCreatejob) {
local_print_operation_->SetUsername("[email protected]");
local_print_operation_->SetJobname("Sample job name");
- base::Optional<base::Value> ticket = base::JSONReader::Read(kSampleCJT);
+ absl::optional<base::Value> ticket = base::JSONReader::Read(kSampleCJT);
ASSERT_TRUE(ticket);
local_print_operation_->SetTicket(std::move(*ticket));
local_print_operation_->SetData(
@@ -906,7 +906,7 @@
local_print_operation_->SetUsername("[email protected]");
local_print_operation_->SetJobname(
"123456789:123456789:123456789:123456789:123456789:123456789:123456789:");
- base::Optional<base::Value> ticket = base::JSONReader::Read(kSampleCJT);
+ absl::optional<base::Value> ticket = base::JSONReader::Read(kSampleCJT);
ASSERT_TRUE(ticket);
local_print_operation_->SetTicket(std::move(*ticket));
local_print_operation_->SetCapabilities(kSampleCapabilitiesResponse);
@@ -931,7 +931,7 @@
TEST_P(PrivetLocalPrintTest, PDFPrintInvalidDocumentTypeRetry) {
local_print_operation_->SetUsername("[email protected]");
local_print_operation_->SetJobname("Sample job name");
- base::Optional<base::Value> ticket = base::JSONReader::Read(kSampleCJT);
+ absl::optional<base::Value> ticket = base::JSONReader::Read(kSampleCJT);
ASSERT_TRUE(ticket);
local_print_operation_->SetTicket(std::move(*ticket));
local_print_operation_->SetCapabilities(kSampleCapabilitiesResponse);
@@ -960,7 +960,7 @@
TEST_P(PrivetLocalPrintTest, LocalPrintRetryOnInvalidJobID) {
local_print_operation_->SetUsername("[email protected]");
local_print_operation_->SetJobname("Sample job name");
- base::Optional<base::Value> ticket = base::JSONReader::Read(kSampleCJT);
+ absl::optional<base::Value> ticket = base::JSONReader::Read(kSampleCJT);
ASSERT_TRUE(ticket);
local_print_operation_->SetTicket(std::move(*ticket));
local_print_operation_->SetCapabilities(kSampleCapabilitiesResponse);
diff --git a/chrome/browser/printing/cloud_print/privet_notifications.cc b/chrome/browser/printing/cloud_print/privet_notifications.cc
index 64aba92..2e319f2 100644
--- a/chrome/browser/printing/cloud_print/privet_notifications.cc
+++ b/chrome/browser/printing/cloud_print/privet_notifications.cc
@@ -349,8 +349,8 @@
}
void PrivetNotificationDelegate::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
if (!button_index)
return;
diff --git a/chrome/browser/printing/cloud_print/privet_notifications.h b/chrome/browser/printing/cloud_print/privet_notifications.h
index 6383370..9a28cc9 100644
--- a/chrome/browser/printing/cloud_print/privet_notifications.h
+++ b/chrome/browser/printing/cloud_print/privet_notifications.h
@@ -157,8 +157,8 @@
explicit PrivetNotificationDelegate(Profile* profile);
// NotificationDelegate implementation.
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
protected:
// Refcounted.
diff --git a/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc b/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc
index 5cf2a83d..452c9dc0 100644
--- a/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc
+++ b/chrome/browser/printing/cloud_print/privet_notifications_unittest.cc
@@ -288,7 +288,7 @@
ASSERT_EQ(1U, notifications.size());
display_service_->SimulateClick(NotificationHandler::Type::TRANSIENT,
notifications[0].id(), 0 /* add */,
- base::nullopt);
+ absl::nullopt);
EXPECT_EQ("chrome://devices/", service.open_tab_url().spec());
EXPECT_EQ(1U, service.open_tab_count());
@@ -310,7 +310,7 @@
ASSERT_EQ(1U, notifications.size());
display_service_->SimulateClick(NotificationHandler::Type::TRANSIENT,
notifications[0].id(),
- 1 /* don't show again */, base::nullopt);
+ 1 /* don't show again */, absl::nullopt);
EXPECT_EQ("", service.open_tab_url().spec());
EXPECT_EQ(0U, service.open_tab_count());
diff --git a/chrome/browser/printing/cloud_print/privet_traffic_detector.cc b/chrome/browser/printing/cloud_print/privet_traffic_detector.cc
index 4fbcecd..433ff0d5 100644
--- a/chrome/browser/printing/cloud_print/privet_traffic_detector.cc
+++ b/chrome/browser/printing/cloud_print/privet_traffic_detector.cc
@@ -31,7 +31,7 @@
void OnGetNetworkList(
base::OnceCallback<void(net::NetworkInterfaceList)> callback,
- const base::Optional<net::NetworkInterfaceList>& networks) {
+ const absl::optional<net::NetworkInterfaceList>& networks) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!networks.has_value())
return;
@@ -168,7 +168,7 @@
void PrivetTrafficDetector::Helper::OnBindComplete(
net::IPEndPoint multicast_group_addr,
int rv,
- const base::Optional<net::IPEndPoint>& ip_endpoint) {
+ const absl::optional<net::IPEndPoint>& ip_endpoint) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (rv == net::OK) {
socket_->JoinGroup(multicast_group_addr.address(),
@@ -238,8 +238,8 @@
void PrivetTrafficDetector::Helper::OnReceived(
int32_t result,
- const base::Optional<net::IPEndPoint>& src_addr,
- base::Optional<base::span<const uint8_t>> data) {
+ const absl::optional<net::IPEndPoint>& src_addr,
+ absl::optional<base::span<const uint8_t>> data) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (result != net::OK)
return;
diff --git a/chrome/browser/printing/cloud_print/privet_traffic_detector.h b/chrome/browser/printing/cloud_print/privet_traffic_detector.h
index ebcd22a50..55a236ef 100644
--- a/chrome/browser/printing/cloud_print/privet_traffic_detector.h
+++ b/chrome/browser/printing/cloud_print/privet_traffic_detector.h
@@ -50,8 +50,8 @@
// network::mojom::UDPSocketListener:
void OnReceived(int32_t result,
- const base::Optional<net::IPEndPoint>& src_addr,
- base::Optional<base::span<const uint8_t>> data) override;
+ const absl::optional<net::IPEndPoint>& src_addr,
+ absl::optional<base::span<const uint8_t>> data) override;
void HandleConnectionChanged(network::mojom::ConnectionType type);
void ScheduleRestart();
@@ -61,7 +61,7 @@
void Bind();
void OnBindComplete(net::IPEndPoint multicast_addr,
int rv,
- const base::Optional<net::IPEndPoint>& ip_address);
+ const absl::optional<net::IPEndPoint>& ip_address);
bool IsSourceAcceptable() const;
bool IsPrivetPacket(base::span<const uint8_t> data) const;
void OnJoinGroupComplete(int rv);
diff --git a/chrome/browser/printing/cloud_print/privet_url_loader.cc b/chrome/browser/printing/cloud_print/privet_url_loader.cc
index 2e7c95f..d0b45d0 100644
--- a/chrome/browser/printing/cloud_print/privet_url_loader.cc
+++ b/chrome/browser/printing/cloud_print/privet_url_loader.cc
@@ -250,7 +250,7 @@
return;
}
- base::Optional<base::Value> value =
+ absl::optional<base::Value> value =
base::JSONReader::Read(*response_body, base::JSON_ALLOW_TRAILING_COMMAS);
if (!value || !value->is_dict()) {
delegate_->OnError(0, JSON_PARSE_ERROR);
diff --git a/chrome/browser/printing/pdf_nup_converter_client_browsertest.cc b/chrome/browser/printing/pdf_nup_converter_client_browsertest.cc
index ce6795cb..3f9f5b26 100644
--- a/chrome/browser/printing/pdf_nup_converter_client_browsertest.cc
+++ b/chrome/browser/printing/pdf_nup_converter_client_browsertest.cc
@@ -6,7 +6,6 @@
#include "base/bind.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/threading/thread_restrictions.h"
@@ -17,6 +16,7 @@
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/test/browser_test.h"
#include "pdf/pdf.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size_f.h"
namespace printing {
@@ -84,7 +84,7 @@
std::vector<gfx::SizeF> sizes;
for (int i = 0; i < num_pages; ++i) {
- base::Optional<gfx::SizeF> page_size =
+ absl::optional<gfx::SizeF> page_size =
chrome_pdf::GetPDFPageSizeByIndex(pdf_data, i);
if (!page_size.has_value())
return {};
@@ -124,7 +124,7 @@
PdfNupConverterClientBrowserTest() = default;
~PdfNupConverterClientBrowserTest() override = default;
- base::Optional<mojom::PdfNupConverter::Status> Convert(
+ absl::optional<mojom::PdfNupConverter::Status> Convert(
base::ReadOnlySharedMemoryRegion pdf_region,
int pages_per_sheet,
base::ReadOnlySharedMemoryRegion* out_nup_pdf_region) {
@@ -146,7 +146,7 @@
}
if (!called)
- return base::nullopt;
+ return absl::nullopt;
*out_nup_pdf_region = std::move(nup_pdf_region);
return status;
@@ -164,7 +164,7 @@
GetExpectedPdfSizes("pdf_converter_basic.pdf"));
base::ReadOnlySharedMemoryRegion nup_pdf_region;
- base::Optional<mojom::PdfNupConverter::Status> status = Convert(
+ absl::optional<mojom::PdfNupConverter::Status> status = Convert(
std::move(pdf_region.region), /*pages_per_sheet=*/2, &nup_pdf_region);
ASSERT_TRUE(status.has_value());
@@ -191,7 +191,7 @@
GetExpectedPdfSizes("pdf_converter_basic.pdf"));
base::ReadOnlySharedMemoryRegion nup_pdf_region;
- base::Optional<mojom::PdfNupConverter::Status> status = Convert(
+ absl::optional<mojom::PdfNupConverter::Status> status = Convert(
std::move(pdf_region.region), /*pages_per_sheet=*/4, &nup_pdf_region);
ASSERT_TRUE(status.has_value());
@@ -212,7 +212,7 @@
ASSERT_TRUE(pdf_region.IsValid());
base::ReadOnlySharedMemoryRegion nup_pdf_region;
- base::Optional<mojom::PdfNupConverter::Status> status = Convert(
+ absl::optional<mojom::PdfNupConverter::Status> status = Convert(
std::move(pdf_region.region), /*pages_per_sheet=*/2, &nup_pdf_region);
ASSERT_TRUE(status.has_value());
diff --git a/chrome/browser/printing/print_backend_browsertest.cc b/chrome/browser/printing/print_backend_browsertest.cc
index 33b46d2d..7e73a04da 100644
--- a/chrome/browser/printing/print_backend_browsertest.cc
+++ b/chrome/browser/printing/print_backend_browsertest.cc
@@ -13,7 +13,6 @@
#include "base/callback.h"
#include "base/check_op.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "chrome/browser/printing/print_backend_service_test_impl.h"
#include "chrome/services/printing/public/mojom/print_backend_service.mojom.h"
@@ -26,6 +25,7 @@
#include "printing/mojom/print.mojom.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace printing {
@@ -103,8 +103,8 @@
}
void OnDidGetDefaultPrinterName(
- base::Optional<std::string>& capture_printer_name,
- const base::Optional<std::string>& printer_name) {
+ absl::optional<std::string>& capture_printer_name,
+ const absl::optional<std::string>& printer_name) {
capture_printer_name = printer_name;
CheckForQuit();
}
@@ -166,7 +166,7 @@
// Launch the service, but without initializing to desired locale.
LaunchUninitialized();
- base::Optional<std::string> default_printer_name;
+ absl::optional<std::string> default_printer_name;
mojom::PrinterSemanticCapsAndDefaultsResultPtr printer_caps;
// Safe to use base::Unretained(this) since waiting locally on the callback
@@ -211,7 +211,7 @@
LaunchService();
AddDefaultPrinter();
- base::Optional<std::string> default_printer_name;
+ absl::optional<std::string> default_printer_name;
// Safe to use base::Unretained(this) since waiting locally on the callback
// forces a shorter lifetime than `this`.
diff --git a/chrome/browser/printing/print_browsertest.cc b/chrome/browser/printing/print_browsertest.cc
index 4be367be..f66034eb 100644
--- a/chrome/browser/printing/print_browsertest.cc
+++ b/chrome/browser/printing/print_browsertest.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
@@ -49,6 +48,7 @@
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "printing/mojom/print.mojom.h"
#include "testing/gmock/include/gmock/gmock.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/scheduler/web_scheduler_tracked_feature.h"
@@ -179,7 +179,7 @@
}
}
- base::Optional<content::DOMMessageQueue> queue_;
+ absl::optional<content::DOMMessageQueue> queue_;
uint32_t total_page_count_ = 1;
uint32_t rendered_page_count_ = 0;
content::WebContents* preview_dialog_ = nullptr;
diff --git a/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc b/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc
index a1c3bb8d..e5b6dcf 100644
--- a/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc
+++ b/chrome/browser/printing/print_preview_pdf_generated_browsertest.cc
@@ -24,7 +24,6 @@
#include "base/hash/md5.h"
#include "base/location.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
@@ -51,6 +50,7 @@
#include "printing/mojom/print.mojom.h"
#include "printing/pdf_render_settings.h"
#include "printing/units.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
@@ -343,7 +343,7 @@
.render_device_type = chrome_pdf::RenderDeviceType::kPrinter,
};
for (int i = 0; i < num_pages; ++i) {
- base::Optional<gfx::SizeF> size_in_points =
+ absl::optional<gfx::SizeF> size_in_points =
chrome_pdf::GetPDFPageSizeByIndex(pdf_span, i);
ASSERT_TRUE(size_in_points.has_value());
diff --git a/chrome/browser/printing/print_preview_sticky_settings.cc b/chrome/browser/printing/print_preview_sticky_settings.cc
index a225c14..40da6cf0 100644
--- a/chrome/browser/printing/print_preview_sticky_settings.cc
+++ b/chrome/browser/printing/print_preview_sticky_settings.cc
@@ -36,7 +36,7 @@
}
void PrintPreviewStickySettings::StoreAppState(const std::string& data) {
- printer_app_state_ = base::make_optional(data);
+ printer_app_state_ = absl::make_optional(data);
}
void PrintPreviewStickySettings::SaveInPrefs(PrefService* prefs) const {
@@ -71,7 +71,7 @@
if (!sticky_settings_state)
return {};
- base::Optional<base::Value> sticky_settings_state_value =
+ absl::optional<base::Value> sticky_settings_state_value =
base::JSONReader::Read(*sticky_settings_state);
if (!sticky_settings_state_value || !sticky_settings_state_value->is_dict())
return {};
diff --git a/chrome/browser/printing/print_preview_sticky_settings.h b/chrome/browser/printing/print_preview_sticky_settings.h
index fb6a503..db229e72 100644
--- a/chrome/browser/printing/print_preview_sticky_settings.h
+++ b/chrome/browser/printing/print_preview_sticky_settings.h
@@ -9,8 +9,8 @@
#include <vector>
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "printing/print_job_constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefService;
@@ -52,7 +52,7 @@
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
private:
- base::Optional<std::string> printer_app_state_;
+ absl::optional<std::string> printer_app_state_;
};
} // namespace printing
diff --git a/chrome/browser/printing/test_printer_query.h b/chrome/browser/printing/test_printer_query.h
index c1569c1a..88ca62b 100644
--- a/chrome/browser/printing/test_printer_query.h
+++ b/chrome/browser/printing/test_printer_query.h
@@ -75,9 +75,9 @@
void StopWorker() override;
private:
- base::Optional<gfx::Point> offsets_;
+ absl::optional<gfx::Point> offsets_;
#if defined(OS_WIN)
- base::Optional<PrintSettings::PrinterType> printer_type_;
+ absl::optional<PrintSettings::PrinterType> printer_type_;
#endif
DISALLOW_COPY_AND_ASSIGN(TestPrinterQuery);
diff --git a/chrome/browser/privacy_budget/canvas_input_key_browsertest.cc b/chrome/browser/privacy_budget/canvas_input_key_browsertest.cc
index 0dd11ae53..350f2db 100644
--- a/chrome/browser/privacy_budget/canvas_input_key_browsertest.cc
+++ b/chrome/browser/privacy_budget/canvas_input_key_browsertest.cc
@@ -90,7 +90,7 @@
// Verify that there's only one entry of type |type|, and return the the
// |input_key|, |value| pair.
template <typename MapType>
-base::Optional<MetricKeyValue> ExtractKeyOfType(IdentifiableSurface::Type type,
+absl::optional<MetricKeyValue> ExtractKeyOfType(IdentifiableSurface::Type type,
const MapType& metrics) {
MetricKeyValue last_result = {};
for (const auto& pair : metrics) {
@@ -101,7 +101,7 @@
<< static_cast<uint64_t>(type)
<< ". First input hash: " << last_result.input_key
<< " second input hash: " << surface.GetInputHash();
- return base::nullopt;
+ return absl::nullopt;
}
last_result.input_key = surface.GetInputHash();
last_result.value = pair.second;
@@ -140,7 +140,7 @@
// adjust this test to deal.
ASSERT_EQ(1u, merged_entries.size());
- base::Optional<MetricKeyValue> canvas_key_value =
+ absl::optional<MetricKeyValue> canvas_key_value =
ExtractKeyOfType(IdentifiableSurface::Type::kCanvasReadback,
merged_entries.begin()->second->metrics);
ASSERT_TRUE(canvas_key_value);
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc
index 248f4eca..376832c 100644
--- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc
+++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc
@@ -188,7 +188,7 @@
bool PrivacySandboxSettings::IsFlocAllowedForContext(
const GURL& url,
- const base::Optional<url::Origin>& top_frame_origin) const {
+ const absl::optional<url::Origin>& top_frame_origin) const {
// If FLoC is disabled completely, it is not available in any context.
if (!IsFlocAllowed())
return false;
@@ -351,7 +351,7 @@
bool PrivacySandboxSettings::IsPrivacySandboxAllowedForContext(
const GURL& url,
- const base::Optional<url::Origin>& top_frame_origin,
+ const absl::optional<url::Origin>& top_frame_origin,
const ContentSettingsForOneType& cookie_settings) const {
if (!base::FeatureList::IsEnabled(features::kPrivacySandboxSettings)) {
// Simply respect cookie settings if the UI is not available. An empty site
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h b/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h
index 5575afd..7d61c67 100644
--- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h
+++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h
@@ -7,7 +7,6 @@
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "components/content_settings/core/common/content_settings.h"
@@ -17,6 +16,7 @@
#include "components/sync/driver/sync_service.h"
#include "components/sync/driver/sync_service_observer.h"
#include "net/cookies/cookie_constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class HostContentSettingsMap;
class PrefService;
@@ -68,7 +68,7 @@
// affect 1P and 3P contexts.
bool IsFlocAllowedForContext(
const GURL& url,
- const base::Optional<url::Origin>& top_frame_origin) const;
+ const absl::optional<url::Origin>& top_frame_origin) const;
// Returns the point in time from which history is eligible to be used when
// calculating a user's FLoC ID. Reset when a user clears all cookies, or
@@ -215,7 +215,7 @@
// provided as a parameter to allow callers to cache it between calls.
bool IsPrivacySandboxAllowedForContext(
const GURL& url,
- const base::Optional<url::Origin>& top_frame_origin,
+ const absl::optional<url::Origin>& top_frame_origin,
const ContentSettingsForOneType& cookie_settings) const;
// Inspects the current sync state and settings to determine if the Privacy
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc
index a89175e..e131528 100644
--- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc
+++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc
@@ -239,7 +239,7 @@
GURL("https://embedded.com"),
url::Origin::Create(GURL("https://test.com"))));
EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext(
- GURL("https://another-test.com"), base::nullopt));
+ GURL("https://another-test.com"), absl::nullopt));
EXPECT_TRUE(privacy_sandbox_settings()->IsConversionMeasurementAllowed(
url::Origin::Create(GURL("https://test.com")),
@@ -274,7 +274,7 @@
GURL("https://embedded.com"),
url::Origin::Create(GURL("https://test.com"))));
EXPECT_TRUE(privacy_sandbox_settings()->IsFlocAllowedForContext(
- GURL("https://embedded.com"), base::nullopt));
+ GURL("https://embedded.com"), absl::nullopt));
EXPECT_FALSE(privacy_sandbox_settings()->IsConversionMeasurementAllowed(
url::Origin::Create(GURL("https://test.com")),
@@ -541,7 +541,7 @@
ContentSetting::CONTENT_SETTING_BLOCK}});
EXPECT_TRUE(privacy_sandbox_settings()->IsFlocAllowedForContext(
- GURL("https://embedded.com"), base::nullopt));
+ GURL("https://embedded.com"), absl::nullopt));
EXPECT_TRUE(privacy_sandbox_settings()->IsConversionMeasurementAllowed(
url::Origin::Create(GURL("https://another-test.com")),
@@ -573,7 +573,7 @@
/*managed_cookie_exceptions=*/{});
EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext(
- GURL("https://embedded.com"), base::nullopt));
+ GURL("https://embedded.com"), absl::nullopt));
EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext(
GURL("https://embedded.com"),
url::Origin::Create(GURL("https://test.com"))));
@@ -612,7 +612,7 @@
GURL("https://embedded.com"),
url::Origin::Create(GURL("https://embedded.com"))));
EXPECT_FALSE(privacy_sandbox_settings()->IsFlocAllowedForContext(
- GURL("https://embedded.com"), base::nullopt));
+ GURL("https://embedded.com"), absl::nullopt));
EXPECT_FALSE(privacy_sandbox_settings()->IsConversionMeasurementAllowed(
url::Origin::Create(GURL("https://embedded.com")),
diff --git a/chrome/browser/profiles/profile_attributes_entry.cc b/chrome/browser/profiles/profile_attributes_entry.cc
index c290259..dc946b1 100644
--- a/chrome/browser/profiles/profile_attributes_entry.cc
+++ b/chrome/browser/profiles/profile_attributes_entry.cc
@@ -8,7 +8,6 @@
#include "base/hash/hash.h"
#include "base/logging.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
@@ -29,6 +28,7 @@
#include "components/profile_metrics/state.h"
#include "components/signin/public/base/signin_pref_names.h"
#include "components/signin/public/identity_manager/account_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
@@ -430,13 +430,13 @@
return icon_index;
}
-base::Optional<ProfileThemeColors>
+absl::optional<ProfileThemeColors>
ProfileAttributesEntry::GetProfileThemeColorsIfSet() const {
- base::Optional<SkColor> profile_highlight_color =
+ absl::optional<SkColor> profile_highlight_color =
GetProfileThemeColor(kProfileHighlightColorKey);
- base::Optional<SkColor> default_avatar_fill_color =
+ absl::optional<SkColor> default_avatar_fill_color =
GetProfileThemeColor(kDefaultAvatarFillColorKey);
- base::Optional<SkColor> default_avatar_stroke_color =
+ absl::optional<SkColor> default_avatar_stroke_color =
GetProfileThemeColor(kDefaultAvatarStrokeColorKey);
DCHECK_EQ(profile_highlight_color.has_value(),
@@ -445,7 +445,7 @@
default_avatar_fill_color.has_value());
if (!profile_highlight_color.has_value()) {
- return base::nullopt;
+ return absl::nullopt;
}
ProfileThemeColors colors;
@@ -461,7 +461,7 @@
NOTREACHED();
return {SK_ColorRED, SK_ColorRED, SK_ColorRED};
#else
- base::Optional<ProfileThemeColors> theme_colors =
+ absl::optional<ProfileThemeColors> theme_colors =
GetProfileThemeColorsIfSet();
if (theme_colors)
return *theme_colors;
@@ -623,7 +623,7 @@
}
void ProfileAttributesEntry::SetProfileThemeColors(
- const base::Optional<ProfileThemeColors>& colors) {
+ const absl::optional<ProfileThemeColors>& colors) {
bool changed = false;
if (colors.has_value()) {
changed |=
@@ -833,11 +833,11 @@
return value->GetInt();
}
-base::Optional<SkColor> ProfileAttributesEntry::GetProfileThemeColor(
+absl::optional<SkColor> ProfileAttributesEntry::GetProfileThemeColor(
const char* key) const {
const base::Value* value = GetValue(key);
if (!value || !value->is_int())
- return base::nullopt;
+ return absl::nullopt;
return value->GetInt();
}
diff --git a/chrome/browser/profiles/profile_attributes_entry.h b/chrome/browser/profiles/profile_attributes_entry.h
index c469b38..09e5ff6 100644
--- a/chrome/browser/profiles/profile_attributes_entry.h
+++ b/chrome/browser/profiles/profile_attributes_entry.h
@@ -13,9 +13,9 @@
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/values.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/image/image.h"
@@ -140,7 +140,7 @@
ProfileThemeColors GetProfileThemeColors() const;
// Returns the colors specified by the profile theme, or empty if no theme is
// set for the profile.
- base::Optional<ProfileThemeColors> GetProfileThemeColorsIfSet() const;
+ absl::optional<ProfileThemeColors> GetProfileThemeColorsIfSet() const;
// Returns the metrics bucket this profile should be recorded in.
// Note: The bucket index is assigned once and remains the same all time. 0 is
// reserved for the guest profile.
@@ -176,8 +176,8 @@
void SetIsUsingDefaultAvatar(bool value);
void SetIsAuthError(bool value);
void SetAvatarIconIndex(size_t icon_index);
- // base::nullopt resets colors to default.
- void SetProfileThemeColors(const base::Optional<ProfileThemeColors>& colors);
+ // absl::nullopt resets colors to default.
+ void SetProfileThemeColors(const absl::optional<ProfileThemeColors>& colors);
// Unlike for other string setters, the argument is expected to be UTF8
// encoded.
@@ -285,8 +285,8 @@
int GetInteger(const char* key) const;
// Internal getter that returns one of the profile theme colors or
- // base::nullopt if the key is not present.
- base::Optional<SkColor> GetProfileThemeColor(const char* key) const;
+ // absl::nullopt if the key is not present.
+ absl::optional<SkColor> GetProfileThemeColor(const char* key) const;
// Type checking. Only IsDouble is implemented because others do not have
// callsites.
diff --git a/chrome/browser/profiles/profile_attributes_storage_unittest.cc b/chrome/browser/profiles/profile_attributes_storage_unittest.cc
index 764ba88c..77785d1 100644
--- a/chrome/browser/profiles/profile_attributes_storage_unittest.cc
+++ b/chrome/browser/profiles/profile_attributes_storage_unittest.cc
@@ -1097,10 +1097,10 @@
ui::NativeTheme::GetInstanceForNativeUi()->set_use_dark_colors(false);
EXPECT_EQ(entry->GetProfileThemeColors(), colors);
- // base::nullopt resets the colors to default.
+ // absl::nullopt resets the colors to default.
EXPECT_CALL(observer(), OnProfileAvatarChanged(profile_path)).Times(1);
EXPECT_CALL(observer(), OnProfileThemeColorsChanged(profile_path)).Times(1);
- entry->SetProfileThemeColors(base::nullopt);
+ entry->SetProfileThemeColors(absl::nullopt);
EXPECT_EQ(entry->GetProfileThemeColors(),
GetDefaultProfileThemeColors(false));
VerifyAndResetCallExpectations();
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h
index 2c95682..4b6af24 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -15,7 +15,6 @@
#include "base/files/file_path.h"
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
@@ -26,6 +25,7 @@
#include "components/prefs/pref_change_registrar.h"
#include "content/public/browser/content_browser_client.h"
#include "extensions/buildflags/buildflags.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if !defined(OS_ANDROID)
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index f5fdc5c..26c5e35 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -1107,7 +1107,7 @@
DCHECK(deleted_profiles);
for (const base::Value& value : deleted_profiles->GetList()) {
- base::Optional<base::FilePath> profile_path = util::ValueToFilePath(value);
+ absl::optional<base::FilePath> profile_path = util::ValueToFilePath(value);
// Although it should never happen, make sure this is a valid path in the
// user_data_dir, so we don't accidentally delete something else.
if (profile_path && IsAllowedProfilePath(*profile_path)) {
@@ -1868,7 +1868,7 @@
}
}
-base::Optional<base::FilePath> ProfileManager::FindLastActiveProfile(
+absl::optional<base::FilePath> ProfileManager::FindLastActiveProfile(
base::RepeatingCallback<bool(ProfileAttributesEntry*)> predicate) {
bool found_entry_loaded = false;
ProfileAttributesEntry* found_entry = nullptr;
@@ -1887,8 +1887,8 @@
found_entry_loaded = entry_loaded;
}
}
- return found_entry ? base::Optional<base::FilePath>(found_entry->GetPath())
- : base::nullopt;
+ return found_entry ? absl::optional<base::FilePath>(found_entry->GetPath())
+ : absl::nullopt;
}
// static
@@ -2263,7 +2263,7 @@
DCHECK_EQ(0u, chrome::GetBrowserCount(GetProfileByPath(profile_dir)));
DCHECK(IsRegisteredAsEphemeral(&GetProfileAttributesStorage(), profile_dir));
- base::Optional<base::FilePath> new_active_profile_dir =
+ absl::optional<base::FilePath> new_active_profile_dir =
FindLastActiveProfile(base::BindRepeating(
[](const base::FilePath& profile_dir, ProfileAttributesEntry* entry) {
return entry->GetPath() != profile_dir;
diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h
index e457f7d..635cec1 100644
--- a/chrome/browser/profiles/profile_manager.h
+++ b/chrome/browser/profiles/profile_manager.h
@@ -372,7 +372,7 @@
// Searches for the latest active profile that respects |predicate|, already
// loaded preferably. Returns nullopt if no existing profile respects all the
// conditions.
- base::Optional<base::FilePath> FindLastActiveProfile(
+ absl::optional<base::FilePath> FindLastActiveProfile(
base::RepeatingCallback<bool(ProfileAttributesEntry*)> predicate);
#endif
diff --git a/chrome/browser/profiles/profile_metrics.cc b/chrome/browser/profiles/profile_metrics.cc
index c4d5d4c..9179c79 100644
--- a/chrome/browser/profiles/profile_metrics.cc
+++ b/chrome/browser/profiles/profile_metrics.cc
@@ -80,7 +80,7 @@
size_t default_colors_count = 0;
std::set<ProfileThemeColors> used_colors;
for (ProfileAttributesEntry* entry : entries) {
- base::Optional<ProfileThemeColors> profile_colors =
+ absl::optional<ProfileThemeColors> profile_colors =
entry->GetProfileThemeColorsIfSet();
if (!profile_colors) {
default_colors_count++;
diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.cc b/chrome/browser/profiles/profile_shortcut_manager_win.cc
index a90e3d8a..df96472 100644
--- a/chrome/browser/profiles/profile_shortcut_manager_win.cc
+++ b/chrome/browser/profiles/profile_shortcut_manager_win.cc
@@ -529,7 +529,7 @@
// was deleted.
void DeleteDesktopShortcuts(
const base::FilePath& profile_path,
- const base::Optional<base::FilePath>& default_profile_path,
+ const absl::optional<base::FilePath>& default_profile_path,
bool ensure_shortcuts_remain) {
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::MAY_BLOCK);
@@ -785,7 +785,7 @@
const base::FilePath& profile_path) {
base::ThreadPool::CreateCOMSTATaskRunner({base::MayBlock()})
->PostTask(FROM_HERE, base::BindOnce(&DeleteDesktopShortcuts,
- profile_path, base::nullopt, false));
+ profile_path, absl::nullopt, false));
}
void ProfileShortcutManagerWin::HasProfileShortcuts(
diff --git a/chrome/browser/profiles/profile_theme_update_service.cc b/chrome/browser/profiles/profile_theme_update_service.cc
index 804d8bb..a7f9ec76 100644
--- a/chrome/browser/profiles/profile_theme_update_service.cc
+++ b/chrome/browser/profiles/profile_theme_update_service.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/profiles/profile_theme_update_service.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
@@ -17,6 +16,7 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/theme_provider.h"
ProfileThemeUpdateService::ProfileThemeUpdateService(
@@ -44,7 +44,7 @@
if (!theme_service_->UsingAutogeneratedTheme()) {
// Only save colors for autogenerated themes.
- entry->SetProfileThemeColors(base::nullopt);
+ entry->SetProfileThemeColors(absl::nullopt);
return;
}
diff --git a/chrome/browser/profiles/profile_theme_update_service_browsertest.cc b/chrome/browser/profiles/profile_theme_update_service_browsertest.cc
index 487a0c4..3e39626f 100644
--- a/chrome/browser/profiles/profile_theme_update_service_browsertest.cc
+++ b/chrome/browser/profiles/profile_theme_update_service_browsertest.cc
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/optional.h"
#include "chrome/browser/profiles/profile_theme_update_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/browser_process.h"
@@ -70,7 +70,7 @@
EXPECT_NE(theme_colors, GetDefaultProfileThemeColorsForLightMode());
// Reset the cached colors to test that they're recreated on the next startup.
- GetProfileAttributesEntry()->SetProfileThemeColors(base::nullopt);
+ GetProfileAttributesEntry()->SetProfileThemeColors(absl::nullopt);
EXPECT_EQ(GetProfileAttributesEntry()->GetProfileThemeColors(),
GetDefaultProfileThemeColorsForLightMode());
}
diff --git a/chrome/browser/push_messaging/push_messaging_app_identifier.cc b/chrome/browser/push_messaging/push_messaging_app_identifier.cc
index 1a4aa7e4..e935ef81 100644
--- a/chrome/browser/push_messaging/push_messaging_app_identifier.cc
+++ b/chrome/browser/push_messaging/push_messaging_app_identifier.cc
@@ -38,11 +38,11 @@
}
bool FromStringToTime(const std::string& time_string,
- base::Optional<base::Time>* time) {
+ absl::optional<base::Time>* time) {
DCHECK(!time_string.empty());
int64_t milliseconds;
if (base::StringToInt64(time_string, &milliseconds) && milliseconds > 0) {
- *time = base::make_optional(base::Time::FromDeltaSinceWindowsEpoch(
+ *time = absl::make_optional(base::Time::FromDeltaSinceWindowsEpoch(
base::TimeDelta::FromMilliseconds(milliseconds)));
return true;
}
@@ -52,7 +52,7 @@
std::string MakePrefValue(
const GURL& origin,
int64_t service_worker_registration_id,
- const base::Optional<base::Time>& expiration_time = base::nullopt) {
+ const absl::optional<base::Time>& expiration_time = absl::nullopt) {
std::string result = origin.spec() + kPrefValueSeparator +
base::NumberToString(service_worker_registration_id);
if (expiration_time)
@@ -63,7 +63,7 @@
bool DisassemblePrefValue(const std::string& pref_value,
GURL* origin,
int64_t* service_worker_registration_id,
- base::Optional<base::Time>* expiration_time) {
+ absl::optional<base::Time>* expiration_time) {
std::vector<std::string> parts =
base::SplitString(pref_value, std::string(1, kPrefValueSeparator),
base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
@@ -106,7 +106,7 @@
PushMessagingAppIdentifier PushMessagingAppIdentifier::Generate(
const GURL& origin,
int64_t service_worker_registration_id,
- const base::Optional<base::Time>& expiration_time) {
+ const absl::optional<base::Time>& expiration_time) {
// All new push subscriptions use Instance ID tokens.
return GenerateInternal(origin, service_worker_registration_id,
true /* use_instance_id */, expiration_time);
@@ -116,7 +116,7 @@
PushMessagingAppIdentifier PushMessagingAppIdentifier::LegacyGenerateForTesting(
const GURL& origin,
int64_t service_worker_registration_id,
- const base::Optional<base::Time>& expiration_time) {
+ const absl::optional<base::Time>& expiration_time) {
return GenerateInternal(origin, service_worker_registration_id,
false /* use_instance_id */, expiration_time);
}
@@ -126,7 +126,7 @@
const GURL& origin,
int64_t service_worker_registration_id,
bool use_instance_id,
- const base::Optional<base::Time>& expiration_time) {
+ const absl::optional<base::Time>& expiration_time) {
// Use uppercase GUID for consistency with GUIDs Push has already sent to GCM.
// Also allows detecting case mangling; see code commented "crbug.com/461867".
std::string guid = base::ToUpperASCII(base::GenerateGUID());
@@ -169,7 +169,7 @@
GURL origin;
int64_t service_worker_registration_id;
- base::Optional<base::Time> expiration_time;
+ absl::optional<base::Time> expiration_time;
// Try disassemble the pref value, return an invalid app identifier if the
// pref value is corrupted
if (!DisassemblePrefValue(*map_value, &origin,
@@ -245,7 +245,7 @@
const std::string& app_id,
const GURL& origin,
int64_t service_worker_registration_id,
- const base::Optional<base::Time>& expiration_time)
+ const absl::optional<base::Time>& expiration_time)
: app_id_(app_id),
origin_(origin),
service_worker_registration_id_(service_worker_registration_id),
diff --git a/chrome/browser/push_messaging/push_messaging_app_identifier.h b/chrome/browser/push_messaging/push_messaging_app_identifier.h
index 76ca595..4242c73f 100644
--- a/chrome/browser/push_messaging/push_messaging_app_identifier.h
+++ b/chrome/browser/push_messaging/push_messaging_app_identifier.h
@@ -12,8 +12,8 @@
#include "base/check.h"
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class Profile;
@@ -44,7 +44,7 @@
static PushMessagingAppIdentifier Generate(
const GURL& origin,
int64_t service_worker_registration_id,
- const base::Optional<base::Time>& expiration_time = base::nullopt);
+ const absl::optional<base::Time>& expiration_time = absl::nullopt);
// Looks up an app identifier by app_id. If not found, is_null() will be true.
static PushMessagingAppIdentifier FindByAppId(Profile* profile,
@@ -100,13 +100,13 @@
return service_worker_registration_id_;
}
- void set_expiration_time(const base::Optional<base::Time>& expiration_time) {
+ void set_expiration_time(const absl::optional<base::Time>& expiration_time) {
expiration_time_ = expiration_time;
}
bool IsExpired() const;
- base::Optional<base::Time> expiration_time() const {
+ absl::optional<base::Time> expiration_time() const {
DCHECK(!is_null());
return expiration_time_;
}
@@ -123,13 +123,13 @@
static PushMessagingAppIdentifier LegacyGenerateForTesting(
const GURL& origin,
int64_t service_worker_registration_id,
- const base::Optional<base::Time>& expiration_time = base::nullopt);
+ const absl::optional<base::Time>& expiration_time = absl::nullopt);
static PushMessagingAppIdentifier GenerateInternal(
const GURL& origin,
int64_t service_worker_registration_id,
bool use_instance_id,
- const base::Optional<base::Time>& expiration_time = base::nullopt);
+ const absl::optional<base::Time>& expiration_time = absl::nullopt);
// Constructs an invalid app identifier.
PushMessagingAppIdentifier();
@@ -138,7 +138,7 @@
const std::string& app_id,
const GURL& origin,
int64_t service_worker_registration_id,
- const base::Optional<base::Time>& expiration_time = base::nullopt);
+ const absl::optional<base::Time>& expiration_time = absl::nullopt);
// Validates that all the fields contain valid values.
void DCheckValid() const;
@@ -146,7 +146,7 @@
std::string app_id_;
GURL origin_;
int64_t service_worker_registration_id_;
- base::Optional<base::Time> expiration_time_;
+ absl::optional<base::Time> expiration_time_;
};
#endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_APP_IDENTIFIER_H_
diff --git a/chrome/browser/push_messaging/push_messaging_browsertest.cc b/chrome/browser/push_messaging/push_messaging_browsertest.cc
index fd775387..3f0b053e 100644
--- a/chrome/browser/push_messaging/push_messaging_browsertest.cc
+++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc
@@ -133,7 +133,7 @@
void DidRegister(base::OnceClosure done_callback,
const std::string& registration_id,
const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
const std::vector<uint8_t>& p256dh,
const std::vector<uint8_t>& auth,
blink::mojom::PushRegistrationStatus status) {
@@ -1676,7 +1676,7 @@
private:
base::test::ScopedFeatureList feature_list_;
- base::Optional<testing::ScopedCrowdDenyPreloadDataOverride>
+ absl::optional<testing::ScopedCrowdDenyPreloadDataOverride>
testing_preload_data_;
scoped_refptr<CrowdDenyFakeSafeBrowsingDatabaseManager>
fake_database_manager_;
diff --git a/chrome/browser/push_messaging/push_messaging_notification_manager.cc b/chrome/browser/push_messaging/push_messaging_notification_manager.cc
index b1164ff8..40a0decf 100644
--- a/chrome/browser/push_messaging/push_messaging_notification_manager.cc
+++ b/chrome/browser/push_messaging/push_messaging_notification_manager.cc
@@ -323,7 +323,7 @@
}
// Check if origin matches current messages url
- base::Optional<GURL> app_url = android_sms_app_manager->GetCurrentAppUrl();
+ absl::optional<GURL> app_url = android_sms_app_manager->GetCurrentAppUrl();
if (!app_url)
app_url = chromeos::android_sms::GetAndroidMessagesURL();
diff --git a/chrome/browser/push_messaging/push_messaging_refresher.cc b/chrome/browser/push_messaging/push_messaging_refresher.cc
index 64a6b0b..2f8bdee 100644
--- a/chrome/browser/push_messaging/push_messaging_refresher.cc
+++ b/chrome/browser/push_messaging/push_messaging_refresher.cc
@@ -94,9 +94,9 @@
}
}
-base::Optional<PushMessagingAppIdentifier>
+absl::optional<PushMessagingAppIdentifier>
PushMessagingRefresher::FindActiveAppIdentifier(const std::string& app_id) {
- base::Optional<PushMessagingAppIdentifier> app_identifier;
+ absl::optional<PushMessagingAppIdentifier> app_identifier;
RefreshMap::iterator refresh_map_it = refresh_map_.find(app_id);
if (refresh_map_it != refresh_map_.end()) {
RefreshInfo::iterator result =
diff --git a/chrome/browser/push_messaging/push_messaging_refresher.h b/chrome/browser/push_messaging/push_messaging_refresher.h
index 82f56f0..f0675930 100644
--- a/chrome/browser/push_messaging/push_messaging_refresher.h
+++ b/chrome/browser/push_messaging/push_messaging_refresher.h
@@ -11,9 +11,9 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "chrome/browser/push_messaging/push_messaging_app_identifier.h"
#include "content/public/browser/push_messaging_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/push_messaging/push_messaging.mojom-forward.h"
// This class enables push subscription refreshes as defined in the docs:
@@ -49,7 +49,7 @@
// If a subscription was refreshed, we accept the old subscription for
// a moment after refresh
- base::Optional<PushMessagingAppIdentifier> FindActiveAppIdentifier(
+ absl::optional<PushMessagingAppIdentifier> FindActiveAppIdentifier(
const std::string& app_id);
base::WeakPtr<PushMessagingRefresher> GetWeakPtr();
diff --git a/chrome/browser/push_messaging/push_messaging_refresher_unittest.cc b/chrome/browser/push_messaging/push_messaging_refresher_unittest.cc
index a9de350..63570f4 100644
--- a/chrome/browser/push_messaging/push_messaging_refresher_unittest.cc
+++ b/chrome/browser/push_messaging/push_messaging_refresher_unittest.cc
@@ -6,13 +6,13 @@
#include <stdint.h>
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/push_messaging/push_messaging_app_identifier.h"
#include "chrome/browser/push_messaging/push_messaging_refresher.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
@@ -42,8 +42,8 @@
PushMessagingRefresher* refresher() { return &refresher_; }
- base::Optional<PushMessagingAppIdentifier> old_app_identifier_;
- base::Optional<PushMessagingAppIdentifier> new_app_identifier_;
+ absl::optional<PushMessagingAppIdentifier> old_app_identifier_;
+ absl::optional<PushMessagingAppIdentifier> new_app_identifier_;
private:
content::BrowserTaskEnvironment task_environment_;
@@ -64,7 +64,7 @@
refresher()->Refresh(old_app_identifier_.value(),
new_app_identifier_.value().app_id(), kTestSenderId);
{
- base::Optional<PushMessagingAppIdentifier> found_old_app_identifier =
+ absl::optional<PushMessagingAppIdentifier> found_old_app_identifier =
refresher()->FindActiveAppIdentifier(
old_app_identifier_.value().app_id());
EXPECT_TRUE(found_old_app_identifier.has_value());
@@ -73,7 +73,7 @@
}
refresher()->OnUnsubscribed(old_app_identifier_.value().app_id());
{
- base::Optional<PushMessagingAppIdentifier> found_after_unsubscribe =
+ absl::optional<PushMessagingAppIdentifier> found_after_unsubscribe =
refresher()->FindActiveAppIdentifier(
old_app_identifier_.value().app_id());
EXPECT_FALSE(found_after_unsubscribe.has_value());
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.cc b/chrome/browser/push_messaging/push_messaging_service_impl.cc
index eb5bbc5..912dd07 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.cc
@@ -363,7 +363,7 @@
PushMessagingAppIdentifier::FindByAppId(profile_, app_id);
// Drop message and unregister if app_id was unknown (maybe recently deleted).
if (app_identifier.is_null()) {
- base::Optional<PushMessagingAppIdentifier> refresh_identifier =
+ absl::optional<PushMessagingAppIdentifier> refresh_identifier =
refresher_.FindActiveAppIdentifier(app_id);
if (!refresh_identifier) {
DeliverMessageCallback(app_id, GURL::EmptyGURL(),
@@ -448,7 +448,7 @@
IsPermissionSet(origin)) {
// The payload of a push message can be valid with content, valid with empty
// content, or null.
- base::Optional<std::string> payload;
+ absl::optional<std::string> payload;
if (message.decrypted)
payload = message.raw_data;
@@ -861,7 +861,7 @@
RegisterCallback callback,
const std::string& subscription_id,
const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
const std::vector<uint8_t>& p256dh,
const std::vector<uint8_t>& auth,
blink::mojom::PushRegistrationStatus status) {
@@ -874,7 +874,7 @@
blink::mojom::PushRegistrationStatus status) {
SubscribeEnd(std::move(callback), std::string() /* subscription_id */,
GURL::EmptyGURL() /* endpoint */,
- base::nullopt /* expiration_time */,
+ absl::nullopt /* expiration_time */,
std::vector<uint8_t>() /* p256dh */,
std::vector<uint8_t>() /* auth */, status);
}
@@ -962,14 +962,14 @@
if (app_identifier.is_null()) {
std::move(callback).Run(
false /* is_valid */, GURL::EmptyGURL() /*endpoint*/,
- base::nullopt /* expiration_time */,
+ absl::nullopt /* expiration_time */,
std::vector<uint8_t>() /* p256dh */, std::vector<uint8_t>() /* auth */);
return;
}
const GURL endpoint = push_messaging::CreateEndpoint(subscription_id);
const std::string& app_id = app_identifier.app_id();
- base::Optional<base::Time> expiration_time = app_identifier.expiration_time();
+ absl::optional<base::Time> expiration_time = app_identifier.expiration_time();
base::OnceCallback<void(bool)> validate_cb =
base::BindOnce(&PushMessagingServiceImpl::DidValidateSubscription,
@@ -991,13 +991,13 @@
const std::string& app_id,
const std::string& sender_id,
const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
SubscriptionInfoCallback callback,
bool is_valid) {
if (!is_valid) {
std::move(callback).Run(
false /* is_valid */, GURL::EmptyGURL() /* endpoint */,
- base::nullopt /* expiration_time */,
+ absl::nullopt /* expiration_time */,
std::vector<uint8_t>() /* p256dh */, std::vector<uint8_t>() /* auth */);
return;
}
@@ -1011,7 +1011,7 @@
void PushMessagingServiceImpl::DidGetEncryptionInfo(
const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
SubscriptionInfoCallback callback,
std::string p256dh,
std::string auth_secret) const {
@@ -1333,7 +1333,7 @@
const std::string& sender_id,
bool is_valid,
const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
const std::vector<uint8_t>& p256dh,
const std::vector<uint8_t>& auth) {
if (!is_valid) {
@@ -1461,7 +1461,7 @@
PushMessagingAppIdentifier::Generate(
old_app_identifier.origin(),
old_app_identifier.service_worker_registration_id(),
- base::nullopt /* expiration_time */);
+ absl::nullopt /* expiration_time */);
refresher_.Refresh(old_app_identifier, new_app_identifier.app_id(),
sender_id);
@@ -1483,7 +1483,7 @@
auto register_callback = base::BindOnce(
[](RegisterCallback cb, Profile* profile, PushMessagingAppIdentifier ai,
const std::string& registration_id, const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
const std::vector<uint8_t>& p256dh, const std::vector<uint8_t>& auth,
blink::mojom::PushRegistrationStatus status) {
base::OnceClosure closure =
@@ -1512,7 +1512,7 @@
const std::string& sender_id,
const std::string& registration_id,
const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
const std::vector<uint8_t>& p256dh,
const std::vector<uint8_t>& auth,
blink::mojom::PushRegistrationStatus status) {
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.h b/chrome/browser/push_messaging/push_messaging_service_impl.h
index 186b3a3..390f283 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.h
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.h
@@ -17,7 +17,6 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "chrome/browser/permissions/abusive_origin_permission_revocation_request.h"
@@ -36,6 +35,7 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/push_messaging_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/push_messaging/push_messaging.mojom-forward.h"
class GURL;
@@ -236,7 +236,7 @@
void SubscribeEnd(RegisterCallback callback,
const std::string& subscription_id,
const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
const std::vector<uint8_t>& p256dh,
const std::vector<uint8_t>& auth,
blink::mojom::PushRegistrationStatus status);
@@ -264,12 +264,12 @@
const std::string& app_id,
const std::string& sender_id,
const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
SubscriptionInfoCallback callback,
bool is_valid);
void DidGetEncryptionInfo(const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
SubscriptionInfoCallback callback,
std::string p256dh,
std::string auth_secret) const;
@@ -316,7 +316,7 @@
const std::string& sender_id,
bool is_valid,
const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
const std::vector<uint8_t>& p256dh,
const std::vector<uint8_t>& auth);
@@ -345,7 +345,7 @@
const std::string& sender_id,
const std::string& registration_id,
const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
const std::vector<uint8_t>& p256dh,
const std::vector<uint8_t>& auth,
blink::mojom::PushRegistrationStatus status);
@@ -396,7 +396,7 @@
base::RepeatingCallback<void(const std::string& app_id,
const GURL& origin,
int64_t service_worker_registration_id,
- base::Optional<std::string> payload)>;
+ absl::optional<std::string> payload)>;
void SetMessageDispatchedCallbackForTesting(
const MessageDispatchedCallback& callback) {
diff --git a/chrome/browser/push_messaging/push_messaging_service_unittest.cc b/chrome/browser/push_messaging/push_messaging_service_unittest.cc
index 6966e2f8..1094371 100644
--- a/chrome/browser/push_messaging/push_messaging_service_unittest.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_unittest.cc
@@ -11,7 +11,6 @@
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/test/scoped_feature_list.h"
@@ -35,6 +34,7 @@
#include "content/public/common/content_features.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/push_messaging/push_messaging_status.mojom.h"
#if defined(OS_ANDROID)
@@ -111,13 +111,13 @@
// Callback to use when the subscription may have been subscribed.
void DidRegister(std::string* subscription_id_out,
GURL* endpoint_out,
- base::Optional<base::Time>* expiration_time_out,
+ absl::optional<base::Time>* expiration_time_out,
std::vector<uint8_t>* p256dh_out,
std::vector<uint8_t>* auth_out,
base::OnceClosure done_callback,
const std::string& registration_id,
const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
const std::vector<uint8_t>& p256dh,
const std::vector<uint8_t>& auth,
blink::mojom::PushRegistrationStatus status) {
@@ -137,11 +137,11 @@
void DidDispatchMessage(std::string* app_id_out,
GURL* origin_out,
int64_t* service_worker_registration_id_out,
- base::Optional<std::string>* payload_out,
+ absl::optional<std::string>* payload_out,
const std::string& app_id,
const GURL& origin,
int64_t service_worker_registration_id,
- base::Optional<std::string> payload) {
+ absl::optional<std::string> payload) {
*app_id_out = app_id;
*origin_out = origin;
*service_worker_registration_id_out = service_worker_registration_id;
@@ -152,12 +152,12 @@
public:
std::string subscription_id_;
GURL endpoint_;
- base::Optional<base::Time> expiration_time_;
+ absl::optional<base::Time> expiration_time_;
std::vector<uint8_t> p256dh_;
std::vector<uint8_t> auth_;
TestPushSubscription(const std::string& subscription_id,
const GURL& endpoint,
- const base::Optional<base::Time>& expiration_time,
+ const absl::optional<base::Time>& expiration_time,
const std::vector<uint8_t>& p256dh,
const std::vector<uint8_t>& auth)
: subscription_id_(subscription_id),
@@ -173,7 +173,7 @@
TestPushSubscription* subscription = nullptr) {
std::string subscription_id;
GURL endpoint;
- base::Optional<base::Time> expiration_time;
+ absl::optional<base::Time> expiration_time;
std::vector<uint8_t> p256dh, auth;
base::RunLoop run_loop;
@@ -265,7 +265,7 @@
std::string app_id;
GURL dispatched_origin;
int64_t service_worker_registration_id;
- base::Optional<std::string> payload;
+ absl::optional<std::string> payload;
// (5) Observe message dispatchings from the Push Messaging service, and
// then dispatch the |message| on the GCM driver as if it had actually
diff --git a/chrome/browser/referrer_policy_browsertest.cc b/chrome/browser/referrer_policy_browsertest.cc
index 25a0e165..bc8a7b5 100644
--- a/chrome/browser/referrer_policy_browsertest.cc
+++ b/chrome/browser/referrer_policy_browsertest.cc
@@ -313,7 +313,7 @@
};
base::Lock check_on_requests_lock_;
- base::Optional<RequestCheck> check_on_requests_
+ absl::optional<RequestCheck> check_on_requests_
GUARDED_BY(check_on_requests_lock_);
};
@@ -748,7 +748,7 @@
//
// These tests assume a default policy of no-referrer-when-downgrade.
struct ReferrerOverrideParams {
- base::Optional<base::Feature> feature_to_enable;
+ absl::optional<base::Feature> feature_to_enable;
network::mojom::ReferrerPolicy baseline_policy;
network::mojom::ReferrerPolicy expected_policy;
diff --git a/chrome/browser/renderer_context_menu/link_to_text_menu_observer.h b/chrome/browser/renderer_context_menu/link_to_text_menu_observer.h
index 83bd9ce..7bd76c59 100644
--- a/chrome/browser/renderer_context_menu/link_to_text_menu_observer.h
+++ b/chrome/browser/renderer_context_menu/link_to_text_menu_observer.h
@@ -76,8 +76,8 @@
// True when the context menu was opened with text selected.
bool link_needs_generation_ = false;
- base::Optional<std::string> generated_link_;
- base::Optional<std::string> generated_selector_for_testing_;
+ absl::optional<std::string> generated_link_;
+ absl::optional<std::string> generated_selector_for_testing_;
base::WeakPtrFactory<LinkToTextMenuObserver> weak_ptr_factory_{this};
};
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index 33f8c26..2e1aebb 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -1375,7 +1375,7 @@
if (!apps::AppServiceProxyFactory::IsAppServiceAvailableForProfile(profile))
return;
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
web_app::FindInstalledAppWithUrlInScope(profile, params_.link_url);
if (!app_id)
return;
@@ -1926,7 +1926,7 @@
void RenderViewContextMenu::AppendClickToCallItem() {
SharingClickToCallEntryPoint entry_point;
- base::Optional<std::string> phone_number;
+ absl::optional<std::string> phone_number;
std::string selection_text;
if (ShouldOfferClickToCallForURL(browser_context_, params_.link_url)) {
entry_point = SharingClickToCallEntryPoint::kRightClickLink;
@@ -2915,7 +2915,7 @@
}
void RenderViewContextMenu::ExecOpenWebApp() {
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
web_app::FindInstalledAppWithUrlInScope(
Profile::FromBrowserContext(browser_context_), params_.link_url);
// |app_id| could be nullopt if it has been uninstalled since the user
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h
index 3a3d831..913d2e6d0 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h
@@ -51,7 +51,7 @@
std::vector<int> captured_command_ids_;
base::RunLoop run_loop_;
- base::Optional<int> maybe_command_to_execute_;
+ absl::optional<int> maybe_command_to_execute_;
DISALLOW_COPY_AND_ASSIGN(ContextMenuWaiter);
};
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc
index d39cbbb..bf929e939 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
#include "base/bind.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -37,6 +36,7 @@
#include "extensions/common/url_pattern.h"
#include "services/network/test/test_shared_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/navigation/impression.h"
#include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h"
#include "ui/base/clipboard/clipboard.h"
@@ -113,12 +113,12 @@
return nullptr;
}
- const base::Optional<content::OpenURLParams>& last_navigation_params() {
+ const absl::optional<content::OpenURLParams>& last_navigation_params() {
return last_navigation_params_;
}
private:
- base::Optional<content::OpenURLParams> last_navigation_params_;
+ absl::optional<content::OpenURLParams> last_navigation_params_;
};
} // namespace
diff --git a/chrome/browser/reputation/reputation_web_contents_observer.cc b/chrome/browser/reputation/reputation_web_contents_observer.cc
index e6a41578..1cdb0ba 100644
--- a/chrome/browser/reputation/reputation_web_contents_observer.cc
+++ b/chrome/browser/reputation/reputation_web_contents_observer.cc
@@ -10,7 +10,6 @@
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "chrome/browser/lookalikes/lookalike_url_service.h"
@@ -26,6 +25,7 @@
#include "content/public/common/page_visibility_state.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
@@ -159,7 +159,7 @@
// Records a histogram that embeds the safety tip status along with whether the
// navigation was initiated cross- or same-origin.
void RecordSafetyTipStatusWithInitiatorOriginInfo(
- const base::Optional<url::Origin>& committed_initiator_origin,
+ const absl::optional<url::Origin>& committed_initiator_origin,
const GURL& committed_url,
const GURL& current_url,
security_state::SafetyTipStatus status) {
diff --git a/chrome/browser/reputation/reputation_web_contents_observer.h b/chrome/browser/reputation/reputation_web_contents_observer.h
index 291e31f..3c658c2 100644
--- a/chrome/browser/reputation/reputation_web_contents_observer.h
+++ b/chrome/browser/reputation/reputation_web_contents_observer.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_REPUTATION_REPUTATION_WEB_CONTENTS_OBSERVER_H_
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/lookalikes/digital_asset_links_cross_validator.h"
#include "chrome/browser/reputation/reputation_service.h"
#include "chrome/browser/reputation/safety_tip_ui.h"
@@ -16,6 +15,7 @@
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/widget/widget.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -104,7 +104,7 @@
// The initiator origin and URL of the most recently committed navigation.
// Presently, these are used in metrics to differentiate same-origin
// navigations (i.e. when the user stays on a flagged page).
- base::Optional<url::Origin> last_committed_initiator_origin_;
+ absl::optional<url::Origin> last_committed_initiator_origin_;
GURL last_committed_url_;
base::OnceClosure reputation_check_callback_for_testing_;
diff --git a/chrome/browser/resource_coordinator/lifecycle_unit.h b/chrome/browser/resource_coordinator/lifecycle_unit.h
index e6b4e049..9894932 100644
--- a/chrome/browser/resource_coordinator/lifecycle_unit.h
+++ b/chrome/browser/resource_coordinator/lifecycle_unit.h
@@ -10,13 +10,13 @@
#include <vector>
#include "base/containers/flat_set.h"
-#include "base/optional.h"
#include "base/process/process_handle.h"
#include "base/time/time.h"
#include "chrome/browser/resource_coordinator/decision_details.h"
#include "chrome/browser/resource_coordinator/lifecycle_unit_state.mojom-forward.h"
#include "content/public/browser/visibility.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace resource_coordinator {
diff --git a/chrome/browser/resource_coordinator/session_restore_policy.h b/chrome/browser/resource_coordinator/session_restore_policy.h
index 5b379dd8..2576460c 100644
--- a/chrome/browser/resource_coordinator/session_restore_policy.h
+++ b/chrome/browser/resource_coordinator/session_restore_policy.h
@@ -12,10 +12,10 @@
#include "base/containers/flat_map.h"
#include "base/gtest_prod_util.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/resource_coordinator/tab_manager_features.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -153,7 +153,7 @@
// Indicates whether or not the tab communicates with the user even when it
// is in the background (tab title changes, favicons, etc).
// It is initialized to nullopt and set asynchronously to the proper value.
- base::Optional<bool> used_in_bg;
+ absl::optional<bool> used_in_bg;
// Indicates whether or not the tab has been pinned by the user. Only
// applicable on desktop platforms.
diff --git a/chrome/browser/resource_coordinator/tab_activity_watcher.cc b/chrome/browser/resource_coordinator/tab_activity_watcher.cc
index 019c4d4..547989e 100644
--- a/chrome/browser/resource_coordinator/tab_activity_watcher.cc
+++ b/chrome/browser/resource_coordinator/tab_activity_watcher.cc
@@ -71,14 +71,14 @@
// Calculates the tab reactivation score for a background tab. Returns nullopt
// if the score could not be calculated, e.g. because the tab is in the
// foreground.
- base::Optional<float> CalculateReactivationScore() {
+ absl::optional<float> CalculateReactivationScore() {
if (web_contents()->IsBeingDestroyed() || backgrounded_time_.is_null())
- return base::nullopt;
+ return absl::nullopt;
// No log for CalculateReactivationScore.
- base::Optional<TabFeatures> tab = GetTabFeatures();
+ absl::optional<TabFeatures> tab = GetTabFeatures();
if (!tab.has_value())
- return base::nullopt;
+ return absl::nullopt;
float score = 0.0f;
const tab_ranker::TabRankerResult result =
@@ -86,7 +86,7 @@
&score);
if (result == tab_ranker::TabRankerResult::kSuccess)
return score;
- return base::nullopt;
+ return absl::nullopt;
}
// Call when the associated WebContents has been replaced.
@@ -151,7 +151,7 @@
if (backgrounded_time_.is_null() || DisableBackgroundLogWithTabRanker())
return;
- base::Optional<TabFeatures> tab = GetTabFeatures();
+ absl::optional<TabFeatures> tab = GetTabFeatures();
if (tab.has_value()) {
// Background time logging always logged with label_id == 0, since we
// only use label_id for query time logging for now.
@@ -161,7 +161,7 @@
}
// Logs current TabFeatures; skips if current tab is null.
- void LogCurrentTabFeatures(const base::Optional<TabFeatures>& tab) {
+ void LogCurrentTabFeatures(const absl::optional<TabFeatures>& tab) {
if (!tab.has_value())
return;
// Update label_id_: a new label_id is generated for this query if the
@@ -372,11 +372,11 @@
// WindowFeatures and MRUFeatures.
// TODO(charleszhao): refactor TabMetricsLogger::GetTabFeatures to return a
// full TabFeatures instead of a partial TabFeatures.
- base::Optional<TabFeatures> GetTabFeatures() {
+ absl::optional<TabFeatures> GetTabFeatures() {
if (web_contents()->IsBeingDestroyed() || backgrounded_time_.is_null())
- return base::nullopt;
+ return absl::nullopt;
// For tab features.
- base::Optional<TabFeatures> tab =
+ absl::optional<TabFeatures> tab =
TabMetricsLogger::GetTabFeatures(page_metrics_, web_contents());
if (!tab.has_value())
return tab;
@@ -502,12 +502,12 @@
BrowserList::RemoveObserver(this);
}
-base::Optional<float> TabActivityWatcher::CalculateReactivationScore(
+absl::optional<float> TabActivityWatcher::CalculateReactivationScore(
content::WebContents* web_contents) {
WebContentsData* web_contents_data =
WebContentsData::FromWebContents(web_contents);
if (!web_contents_data)
- return base::nullopt;
+ return absl::nullopt;
return web_contents_data->CalculateReactivationScore();
}
@@ -519,14 +519,14 @@
const bool should_sort_tabs =
base::FeatureList::IsEnabled(features::kTabRanker);
- std::map<int32_t, base::Optional<TabFeatures>> tab_features;
+ std::map<int32_t, absl::optional<TabFeatures>> tab_features;
for (auto* lifecycle_unit : *tabs) {
auto* lifecycle_unit_external =
lifecycle_unit->AsTabLifecycleUnitExternal();
// the lifecycle_unit_external is nullptr in the unit test
// TabManagerDelegateTest::KillMultipleProcesses.
if (!lifecycle_unit_external) {
- tab_features[lifecycle_unit->GetID()] = base::nullopt;
+ tab_features[lifecycle_unit->GetID()] = absl::nullopt;
continue;
}
WebContentsData* web_contents_data = WebContentsData::FromWebContents(
@@ -536,11 +536,11 @@
// TODO(crbug.com/1019482): move the creation of WebContentsData to
// TabHelpers::AttachTabHelpers.
if (!web_contents_data) {
- tab_features[lifecycle_unit->GetID()] = base::nullopt;
+ tab_features[lifecycle_unit->GetID()] = absl::nullopt;
continue;
}
- const base::Optional<TabFeatures> tab = web_contents_data->GetTabFeatures();
+ const absl::optional<TabFeatures> tab = web_contents_data->GetTabFeatures();
web_contents_data->LogCurrentTabFeatures(tab);
// No reason to store TabFeatures if TabRanker is disabled.
diff --git a/chrome/browser/resource_coordinator/tab_activity_watcher.h b/chrome/browser/resource_coordinator/tab_activity_watcher.h
index 91e527e..6be15e8 100644
--- a/chrome/browser/resource_coordinator/tab_activity_watcher.h
+++ b/chrome/browser/resource_coordinator/tab_activity_watcher.h
@@ -9,12 +9,12 @@
#include "base/containers/flat_set.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor.h"
#include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/browser_tab_strip_tracker.h"
#include "chrome/browser/ui/browser_tab_strip_tracker_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class TabMetricsLogger;
@@ -36,7 +36,7 @@
// value indicates a higher likelihood of being reactivated.
// Returns the score if the tab could be scored.
// This is only used in chrome://discards and unit tests.
- base::Optional<float> CalculateReactivationScore(
+ absl::optional<float> CalculateReactivationScore(
content::WebContents* web_contents);
// Logs TabMetrics of all |tabs|; and sorts them by descending importance,
diff --git a/chrome/browser/resource_coordinator/tab_activity_watcher_browsertest.cc b/chrome/browser/resource_coordinator/tab_activity_watcher_browsertest.cc
index 48beace..1cba22b 100644
--- a/chrome/browser/resource_coordinator/tab_activity_watcher_browsertest.cc
+++ b/chrome/browser/resource_coordinator/tab_activity_watcher_browsertest.cc
@@ -213,13 +213,13 @@
test_clock.Advance(base::TimeDelta::FromMinutes(1));
// A background tab is scored successfully.
- base::Optional<float> background_score =
+ absl::optional<float> background_score =
TabActivityWatcher::GetInstance()->CalculateReactivationScore(
browser()->tab_strip_model()->GetWebContentsAt(1));
EXPECT_TRUE(background_score.has_value());
// Foreground tabs are not modeled by the tab ranker and should not be scored.
- base::Optional<float> foreground_score =
+ absl::optional<float> foreground_score =
TabActivityWatcher::GetInstance()->CalculateReactivationScore(
browser()->tab_strip_model()->GetWebContentsAt(0));
EXPECT_FALSE(foreground_score.has_value());
diff --git a/chrome/browser/resource_coordinator/tab_activity_watcher_unittest.cc b/chrome/browser/resource_coordinator/tab_activity_watcher_unittest.cc
index f2563e97..306bef2 100644
--- a/chrome/browser/resource_coordinator/tab_activity_watcher_unittest.cc
+++ b/chrome/browser/resource_coordinator/tab_activity_watcher_unittest.cc
@@ -104,7 +104,7 @@
}
// Calculate reactivation score of the |lifecycle_unit| using tab_ranker.
- base::Optional<float> GetReactivationScore(
+ absl::optional<float> GetReactivationScore(
LifecycleUnit* const lifecycle_unit) {
return TabActivityWatcher::GetInstance()->CalculateReactivationScore(
lifecycle_unit->AsTabLifecycleUnitExternal()->GetWebContents());
@@ -637,7 +637,7 @@
ui::PAGE_TRANSITION_FROM_ADDRESS_BAR));
WebContentsTester::For(test_contents)->TestSetIsLoading(false);
expected_metrics[TabManager_TabMetrics::kPageTransitionCoreTypeName] =
- base::nullopt;
+ absl::nullopt;
expected_metrics[TabManager_TabMetrics::kPageTransitionFromAddressBarName] =
true;
expected_metrics[TabManager_TabMetrics::kPageTransitionIsRedirectName] =
@@ -727,7 +727,7 @@
ui::PAGE_TRANSITION_FROM_ADDRESS_BAR));
WebContentsTester::For(test_contents)->TestSetIsLoading(false);
expected_metrics[TabManager_TabMetrics::kPageTransitionCoreTypeName] =
- base::nullopt;
+ absl::nullopt;
expected_metrics[TabManager_TabMetrics::kPageTransitionFromAddressBarName] =
true;
expected_metrics[TabManager_TabMetrics::kNavigationEntryCountName].value()++;
diff --git a/chrome/browser/resource_coordinator/tab_lifecycle_unit.cc b/chrome/browser/resource_coordinator/tab_lifecycle_unit.cc
index 8fcf90d..675253f 100644
--- a/chrome/browser/resource_coordinator/tab_lifecycle_unit.cc
+++ b/chrome/browser/resource_coordinator/tab_lifecycle_unit.cc
@@ -11,7 +11,6 @@
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/process/process_metrics.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/devtools/devtools_window.h"
@@ -43,6 +42,7 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/frame/sudden_termination_disabler_type.mojom.h"
#include "url/gurl.h"
diff --git a/chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.cc b/chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.cc
index 3e809b4..be8d0ed 100644
--- a/chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.cc
+++ b/chrome/browser/resource_coordinator/tab_manager_delegate_chromeos.cc
@@ -342,7 +342,7 @@
&TabManagerDelegate::LowMemoryKillImpl, weak_ptr_factory_.GetWeakPtr(),
now, reason, std::move(tab_discard_done)));
} else {
- LowMemoryKillImpl(now, reason, std::move(tab_discard_done), base::nullopt);
+ LowMemoryKillImpl(now, reason, std::move(tab_discard_done), absl::nullopt);
}
}
@@ -485,7 +485,7 @@
weak_ptr_factory_.GetWeakPtr()));
} else {
// Pass in nullopt if unable to get ARC processes.
- AdjustOomPrioritiesImpl(base::nullopt);
+ AdjustOomPrioritiesImpl(absl::nullopt);
}
}
diff --git a/chrome/browser/resource_coordinator/tab_metrics_logger.cc b/chrome/browser/resource_coordinator/tab_metrics_logger.cc
index 0c46381..ddebb10 100644
--- a/chrome/browser/resource_coordinator/tab_metrics_logger.cc
+++ b/chrome/browser/resource_coordinator/tab_metrics_logger.cc
@@ -159,12 +159,12 @@
}
// static
-base::Optional<tab_ranker::TabFeatures> TabMetricsLogger::GetTabFeatures(
+absl::optional<tab_ranker::TabFeatures> TabMetricsLogger::GetTabFeatures(
const PageMetrics& page_metrics,
content::WebContents* web_contents) {
Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
if (!browser)
- return base::nullopt;
+ return absl::nullopt;
tab_ranker::TabFeatures tab;
PopulateTabFeaturesFromWebContents(web_contents, &tab);
diff --git a/chrome/browser/resource_coordinator/tab_metrics_logger.h b/chrome/browser/resource_coordinator/tab_metrics_logger.h
index 6aa55c0..c5be073 100644
--- a/chrome/browser/resource_coordinator/tab_metrics_logger.h
+++ b/chrome/browser/resource_coordinator/tab_metrics_logger.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_RESOURCE_COORDINATOR_TAB_METRICS_LOGGER_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/resource_coordinator/tab_metrics_event.pb.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
class Browser;
@@ -81,7 +81,7 @@
// A common function for populating these features ensures that the same
// values are used for logging training examples to UKM and for locally
// scoring tabs.
- static base::Optional<tab_ranker::TabFeatures> GetTabFeatures(
+ static absl::optional<tab_ranker::TabFeatures> GetTabFeatures(
const PageMetrics& page_metrics,
content::WebContents* web_contents);
diff --git a/chrome/browser/resource_coordinator/tab_ranker/tab_features.h b/chrome/browser/resource_coordinator/tab_ranker/tab_features.h
index 3519211..7a7a815 100644
--- a/chrome/browser/resource_coordinator/tab_ranker/tab_features.h
+++ b/chrome/browser/resource_coordinator/tab_ranker/tab_features.h
@@ -8,7 +8,7 @@
#include <stdint.h>
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace assist_ranker {
class RankerExample;
@@ -44,11 +44,11 @@
// page. Reset to 0 when a tab navigates.
int32_t num_reactivations = 0;
// Null if the value is not one of the core values logged to UKM.
- base::Optional<int32_t> page_transition_core_type;
+ absl::optional<int32_t> page_transition_core_type;
bool page_transition_from_address_bar = false;
bool page_transition_is_redirect = false;
// Null if the SiteEngagementService is disabled.
- base::Optional<int32_t> site_engagement_score;
+ absl::optional<int32_t> site_engagement_score;
// Time since tab was backgrounded, in milliseconds.
int32_t time_from_backgrounded = 0;
int32_t total_tab_count = 0;
diff --git a/chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor.cc b/chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor.cc
index a86f53a..88637df 100644
--- a/chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor.cc
+++ b/chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor.cc
@@ -107,7 +107,7 @@
}
std::map<int32_t, float> TabScorePredictor::ScoreTabs(
- const std::map<int32_t, base::Optional<TabFeatures>>& tabs) {
+ const std::map<int32_t, absl::optional<TabFeatures>>& tabs) {
if (type_ != kPairwiseScorer) {
std::map<int32_t, float> reactivation_scores;
for (const auto& pair : tabs) {
@@ -219,7 +219,7 @@
}
std::map<int32_t, float> TabScorePredictor::ScoreTabsWithPairwiseScorer(
- const std::map<int32_t, base::Optional<TabFeatures>>& tabs) {
+ const std::map<int32_t, absl::optional<TabFeatures>>& tabs) {
const int N = tabs.size();
std::vector<int32_t> ids;
diff --git a/chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor.h b/chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor.h
index a09ccb6c..0706390 100644
--- a/chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor.h
+++ b/chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor.h
@@ -10,7 +10,7 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace assist_ranker {
class ExamplePreprocessorConfig;
@@ -66,7 +66,7 @@
// If the scoring fails at any step, it will set
// std::numeric_limits<float>::max() as the reactivation score for that tab.
std::map<int32_t, float> ScoreTabs(
- const std::map<int32_t, base::Optional<TabFeatures>>& tabs);
+ const std::map<int32_t, absl::optional<TabFeatures>>& tabs);
private:
friend class ScoreTabsWithPairwiseScorerTest;
@@ -89,7 +89,7 @@
const TabFeatures& tab2,
float* score);
std::map<int32_t, float> ScoreTabsWithPairwiseScorer(
- const std::map<int32_t, base::Optional<TabFeatures>>& tabs);
+ const std::map<int32_t, absl::optional<TabFeatures>>& tabs);
TabRankerResult ScoreTabWithFrecencyScorer(const TabFeatures& tab,
float* score);
diff --git a/chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor_unittest.cc b/chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor_unittest.cc
index cd80be30..425834bc 100644
--- a/chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor_unittest.cc
+++ b/chrome/browser/resource_coordinator/tab_ranker/tab_score_predictor_unittest.cc
@@ -113,7 +113,7 @@
class ScoreTabsWithPairwiseScorerTest : public testing::Test {
protected:
std::map<int32_t, float> ScoreTabsWithPairwiseScorer(
- const std::map<int32_t, base::Optional<TabFeatures>>& tabs) {
+ const std::map<int32_t, absl::optional<TabFeatures>>& tabs) {
return TabScorePredictor().ScoreTabsWithPairwiseScorer(tabs);
}
};
@@ -131,7 +131,7 @@
}
base::RandomShuffle(ids.begin(), ids.end());
- std::map<int32_t, base::Optional<TabFeatures>> tabs;
+ std::map<int32_t, absl::optional<TabFeatures>> tabs;
for (int i = 0; i < length; ++i) {
TabFeatures tab;
tab.mru_index = base::RandInt(0, 3000);
@@ -140,7 +140,7 @@
// Set half of the TabFeatures to be null.
if (i < length / 2) {
- tabs[ids[i]] = base::nullopt;
+ tabs[ids[i]] = absl::nullopt;
} else {
tabs[ids[i]] = tab;
}
@@ -175,7 +175,7 @@
base::RandomShuffle(ids.begin(), ids.end());
// set ids[i] to have frecency_score i*5;
- std::map<int32_t, base::Optional<TabFeatures>> tabs;
+ std::map<int32_t, absl::optional<TabFeatures>> tabs;
for (int i = 0; i < length; ++i) {
TabFeatures tab;
tab.mru_index = base::RandInt(0, 3000);
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive_minizip_unittest.cc b/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive_minizip_unittest.cc
index 4f46d3e5..91e374ca 100644
--- a/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive_minizip_unittest.cc
+++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_archive_minizip_unittest.cc
@@ -113,7 +113,7 @@
return file_offset_;
}
- base::Optional<std::string> Passphrase() override { return {}; }
+ absl::optional<std::string> Passphrase() override { return {}; }
int64_t offset() override { return file_offset_; }
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.h b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.h
index e1e1908..f96cd75 100644
--- a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.h
+++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip.h
@@ -10,9 +10,9 @@
#include <string>
#include <unordered_map>
-#include "base/optional.h"
#include "chrome/browser/resources/chromeos/zip_archiver/cpp/minizip_helpers.h"
#include "chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/minizip/src/mz_strm.h"
// Defines an implementation of VolumeArchive that wraps all minizip
@@ -151,7 +151,7 @@
bool decompressed_error_;
// The password cache to access password protected files.
- base::Optional<std::string> password_cache_;
+ absl::optional<std::string> password_cache_;
// Map of file name to zip file offset.
std::unordered_map<std::string, int64_t> file_offset_map_;
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip_unittest.cc b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip_unittest.cc
index 9d197cd26..f46493cb 100644
--- a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip_unittest.cc
+++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive_minizip_unittest.cc
@@ -18,12 +18,12 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/hash/md5.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/string_piece.h"
#include "chrome/browser/resources/chromeos/zip_archiver/cpp/volume_archive.h"
#include "chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -73,20 +73,20 @@
return file_.Seek(whence, offset);
}
- base::Optional<std::string> Passphrase() override { return passphrase_; }
+ absl::optional<std::string> Passphrase() override { return passphrase_; }
int64_t offset() override { return Seek(0, base::File::FROM_CURRENT); }
int64_t archive_size() override { return file_.GetLength(); }
- void set_passphrase(base::Optional<std::string> passphrase) {
+ void set_passphrase(absl::optional<std::string> passphrase) {
passphrase_ = std::move(passphrase);
}
private:
base::File file_;
std::vector<char> buffer_;
- base::Optional<std::string> passphrase_;
+ absl::optional<std::string> passphrase_;
};
class VolumeArchiveMinizipTest : public testing::Test {
@@ -248,7 +248,7 @@
std::unique_ptr<TestVolumeReader> reader =
std::make_unique<TestVolumeReader>(GetTestZipPath("encrypted.zip"));
reader->set_passphrase(
- base::make_optional<std::string>(kEncryptedZipPassphrase));
+ absl::make_optional<std::string>(kEncryptedZipPassphrase));
VolumeArchiveMinizip archive(std::move(reader));
ASSERT_TRUE(archive.Init(""));
@@ -267,7 +267,7 @@
std::unique_ptr<TestVolumeReader> reader =
std::make_unique<TestVolumeReader>(GetTestZipPath("encrypted_aes.zip"));
reader->set_passphrase(
- base::make_optional<std::string>(kEncryptedZipPassphrase));
+ absl::make_optional<std::string>(kEncryptedZipPassphrase));
VolumeArchiveMinizip archive(std::move(reader));
ASSERT_TRUE(archive.Init(""));
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader.h b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader.h
index a2b9e14..35ef998 100644
--- a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader.h
+++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader.h
@@ -10,7 +10,7 @@
#include <string>
#include "base/files/file.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Defines a reader for archive volumes. This class is used by minizip
// for custom reads.
@@ -37,7 +37,7 @@
// Fetches a passphrase for reading. If the passphrase is not available, the
// returned Optional will have no value.
- virtual base::Optional<std::string> Passphrase() = 0;
+ virtual absl::optional<std::string> Passphrase() = 0;
virtual int64_t offset() = 0;
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.cc b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.cc
index fe7ebe6..ebbb67e 100644
--- a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.cc
+++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.cc
@@ -97,7 +97,7 @@
const std::string& passphrase) {
base::AutoLock al(shared_state_lock_);
// Signal VolumeReaderJavaScriptStream::Passphrase to continue execution.
- available_passphrase_ = base::make_optional(passphrase);
+ available_passphrase_ = absl::make_optional(passphrase);
available_passphrase_cond_.Signal();
}
@@ -212,7 +212,7 @@
request_id_ = request_id;
}
-base::Optional<std::string> VolumeReaderJavaScriptStream::Passphrase() {
+absl::optional<std::string> VolumeReaderJavaScriptStream::Passphrase() {
// Reset the state and prompt the user for a passphrase. Assume a correct
// passphrase from a previous request has been saved by the requestor.
{
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.h b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.h
index 19540b21..72af9dd 100644
--- a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.h
+++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.h
@@ -9,11 +9,11 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
#include "chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader.h"
#include "ppapi/cpp/var_array_buffer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class JavaScriptRequestorInterface;
@@ -72,7 +72,7 @@
// See volume_reader.h for description. The method blocks on
// available_passphrase_cond_. SetPassphraseAndSignal should unblock it from
// another thread.
- base::Optional<std::string> Passphrase() override;
+ absl::optional<std::string> Passphrase() override;
int64_t offset() override;
@@ -93,9 +93,9 @@
bool available_data_; // Indicates whether any data is available.
bool read_error_; // Marks an error in reading from JavaScript.
- // Stores a passphrase from JavaScript. Stored as a base::Optional<> because
+ // Stores a passphrase from JavaScript. Stored as a absl::optional<> because
// the user could have entered an empty passphrase.
- base::Optional<std::string> available_passphrase_;
+ absl::optional<std::string> available_passphrase_;
bool passphrase_error_; // Marks an error in getting the passphrase.
// The shared_state_lock_ is used to protect members which are accessed by
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_actions_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_actions_win.cc
index 9a6ceb2..bd650eb8 100644
--- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_actions_win.cc
+++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_actions_win.cc
@@ -20,7 +20,7 @@
void ChromePromptActions::PromptUser(
const std::vector<base::FilePath>& files_to_delete,
- const base::Optional<std::vector<std::wstring>>& registry_keys,
+ const absl::optional<std::vector<std::wstring>>& registry_keys,
PromptUserReplyCallback callback) {
using FileCollection = ChromeCleanerScannerResults::FileCollection;
using RegistryKeyCollection =
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_actions_win.h b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_actions_win.h
index fa7519a..7972cce3 100644
--- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_actions_win.h
+++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_actions_win.h
@@ -10,8 +10,8 @@
#include "base/callback.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "components/chrome_cleaner/public/proto/chrome_prompt.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace safe_browsing {
@@ -45,7 +45,7 @@
// called with the user's choice.
void PromptUser(
const std::vector<base::FilePath>& files_to_delete,
- const base::Optional<std::vector<std::wstring>>& registry_keys,
+ const absl::optional<std::vector<std::wstring>>& registry_keys,
PromptUserReplyCallback reply_callback);
private:
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.cc
index dc4e88b..1efd4c2 100644
--- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.cc
+++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.cc
@@ -18,7 +18,6 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/metrics/sparse_histogram.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -30,6 +29,7 @@
#include "base/win/windows_types.h"
#include "components/chrome_cleaner/public/constants/constants.h"
#include "components/chrome_cleaner/public/constants/result_codes.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace safe_browsing {
@@ -493,7 +493,7 @@
files_to_delete.push_back(base::FilePath(file_path_wide));
}
- base::Optional<std::vector<std::wstring>> optional_registry_keys;
+ absl::optional<std::vector<std::wstring>> optional_registry_keys;
if (request.registry_keys_size()) {
std::vector<std::wstring> registry_keys;
registry_keys.reserve(request.registry_keys_size());
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.cc b/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.cc
index ebb0b4f..13e802ea 100644
--- a/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.cc
+++ b/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.cc
@@ -324,20 +324,20 @@
case ItemsReporting::kUnsupported:
// Defined as an optional object in which a registry keys vector is not
// present.
- registry_keys_ = base::Optional<std::vector<std::wstring>>();
+ registry_keys_ = absl::optional<std::vector<std::wstring>>();
break;
case ItemsReporting::kNotReported:
// Defined as an optional object in which an empty registry keys vector is
// present.
registry_keys_ =
- base::Optional<std::vector<std::wstring>>(absl::in_place);
+ absl::optional<std::vector<std::wstring>>(absl::in_place);
break;
case ItemsReporting::kReported:
// Defined as an optional object in which a non-empty registry keys vector
// is present.
- registry_keys_ = base::Optional<std::vector<std::wstring>>({
+ registry_keys_ = absl::optional<std::vector<std::wstring>>({
L"HKCU:32\\Software\\Some\\Unwanted Software",
L"HKCU:32\\Software\\Another\\Unwanted Software",
});
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.h b/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.h
index 081f634..abb71be 100644
--- a/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.h
+++ b/chrome/browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.h
@@ -10,8 +10,8 @@
#include <vector>
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_actions_win.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class CommandLine;
@@ -88,7 +88,7 @@
const std::vector<base::FilePath>& files_to_delete() const {
return files_to_delete_;
}
- const base::Optional<std::vector<std::wstring>>& registry_keys() const {
+ const absl::optional<std::vector<std::wstring>>& registry_keys() const {
return registry_keys_;
}
@@ -120,7 +120,7 @@
private:
std::vector<base::FilePath> files_to_delete_;
- base::Optional<std::vector<std::wstring>> registry_keys_;
+ absl::optional<std::vector<std::wstring>> registry_keys_;
bool reboot_required_ = false;
CrashPoint crash_point_ = CrashPoint::kNone;
ItemsReporting registry_keys_reporting_ = ItemsReporting::kUnsupported;
diff --git a/chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.cc b/chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.cc
index 492c733..ab3a8bb4 100644
--- a/chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.cc
+++ b/chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.cc
@@ -84,7 +84,7 @@
NOTREACHED() << "URL lookup with token is disabled for enterprise users.";
}
-base::Optional<std::string>
+absl::optional<std::string>
ChromeEnterpriseRealTimeUrlLookupService::GetDMTokenString() const {
DCHECK(connectors_service_);
return connectors_service_->GetDMTokenForRealTimeUrlCheck();
diff --git a/chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.h b/chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.h
index 1068b4f..4aa3dca 100644
--- a/chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.h
+++ b/chrome/browser/safe_browsing/chrome_enterprise_url_lookup_service.h
@@ -58,7 +58,7 @@
void GetAccessToken(const GURL& url,
RTLookupRequestCallback request_callback,
RTLookupResponseCallback response_callback) override;
- base::Optional<std::string> GetDMTokenString() const override;
+ absl::optional<std::string> GetDMTokenString() const override;
std::string GetMetricSuffix() const override;
bool ShouldIncludeCredentials() const override;
diff --git a/chrome/browser/safe_browsing/chrome_password_protection_service.cc b/chrome/browser/safe_browsing/chrome_password_protection_service.cc
index 9d8e175b..e14ef4a 100644
--- a/chrome/browser/safe_browsing/chrome_password_protection_service.cc
+++ b/chrome/browser/safe_browsing/chrome_password_protection_service.cc
@@ -1435,7 +1435,7 @@
password_manager::HashPasswordManager hash_password_manager;
hash_password_manager.set_prefs(profile_->GetPrefs());
- base::Optional<password_manager::PasswordHashData> sync_hash_data =
+ absl::optional<password_manager::PasswordHashData> sync_hash_data =
hash_password_manager.RetrievePasswordHash(GetAccountInfo().email,
/*is_gaia_password=*/true);
return sync_hash_data ? base::NumberToString(sync_hash_data->hash)
@@ -1660,7 +1660,7 @@
if (!identity_manager)
return AccountInfo();
- base::Optional<AccountInfo> primary_account_info =
+ absl::optional<AccountInfo> primary_account_info =
identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
identity_manager->GetPrimaryAccountInfo(signin::ConsentLevel::kSync));
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc b/chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc
index 10db0fc..98e568b 100644
--- a/chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc
+++ b/chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc
@@ -13,7 +13,6 @@
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -40,6 +39,7 @@
#include "content/public/browser/browser_thread.h"
#include "net/base/url_util.h"
#include "net/http/http_status_code.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace safe_browsing {
namespace {
@@ -90,11 +90,11 @@
constexpr char kBinaryUploadServiceUrlFlag[] = "binary-upload-service-url";
-base::Optional<GURL> GetUrlOverride() {
+absl::optional<GURL> GetUrlOverride() {
// Ignore this flag on Stable and Beta to avoid abuse.
if (!g_browser_process || !g_browser_process->browser_policy_connector()
->IsCommandLineSwitchSupported()) {
- return base::nullopt;
+ return absl::nullopt;
}
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
@@ -107,7 +107,7 @@
LOG(ERROR) << "--binary-upload-service-url is set to an invalid URL";
}
- return base::nullopt;
+ return absl::nullopt;
}
net::NetworkTrafficAnnotationTag GetTrafficAnnotationTag(bool is_app) {
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h b/chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h
index c40dc81..c554366a 100644
--- a/chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h
+++ b/chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h
@@ -17,7 +17,6 @@
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/timer/timer.h"
#include "chrome/browser/safe_browsing/cloud_content_scanning/binary_fcm_service.h"
#include "chrome/browser/safe_browsing/cloud_content_scanning/multipart_uploader.h"
@@ -25,6 +24,7 @@
#include "components/keyed_service/core/keyed_service.h"
#include "components/safe_browsing/core/proto/csd.pb.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_test_utils.cc b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_test_utils.cc
index a827089..5f3c9b1 100644
--- a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_test_utils.cc
+++ b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_test_utils.cc
@@ -108,7 +108,7 @@
int expected_content_size,
const std::string& expected_result,
const std::string& expected_username,
- const base::Optional<std::string>& expected_scan_id) {
+ const absl::optional<std::string>& expected_scan_id) {
event_key_ = SafeBrowsingPrivateEventRouter::kKeyDangerousDownloadEvent;
url_ = expected_url;
filenames_and_hashes_[expected_filename] = expected_sha256;
@@ -196,7 +196,7 @@
base::Value& report,
base::OnceCallback<void(bool)>& callback) {
event_key_ = SafeBrowsingPrivateEventRouter::kKeySensitiveDataEvent;
- threat_type_ = base::nullopt;
+ threat_type_ = absl::nullopt;
dlp_verdict_ = expected_dlp_verdict;
ValidateReport(&report);
if (!done_closure_.is_null())
@@ -240,8 +240,8 @@
base::OnceCallback<void(bool)>& callback) {
event_key_ = SafeBrowsingPrivateEventRouter::kKeyDangerousDownloadEvent;
threat_type_ = expected_threat_type;
- dlp_verdict_ = base::nullopt;
- scan_id_ = base::nullopt;
+ dlp_verdict_ = absl::nullopt;
+ scan_id_ = absl::nullopt;
ValidateReport(&report);
if (!done_closure_.is_null())
done_closure_.Run();
@@ -258,7 +258,7 @@
int expected_content_size,
const std::string& expected_result,
const std::string& expected_username,
- const base::Optional<std::string>& expected_scan_id) {
+ const absl::optional<std::string>& expected_scan_id) {
event_key_ = SafeBrowsingPrivateEventRouter::kKeyDangerousDownloadEvent;
url_ = expected_url;
filenames_and_hashes_[expected_filename] = expected_sha256;
@@ -366,7 +366,7 @@
void EventReportValidator::ValidateField(
base::Value* value,
const std::string& field_key,
- const base::Optional<std::string>& expected_value) {
+ const absl::optional<std::string>& expected_value) {
if (expected_value.has_value()) {
ASSERT_EQ(*value->FindStringKey(field_key), expected_value.value())
<< "Mismatch in field " << field_key;
@@ -379,7 +379,7 @@
void EventReportValidator::ValidateField(
base::Value* value,
const std::string& field_key,
- const base::Optional<int>& expected_value) {
+ const absl::optional<int>& expected_value) {
ASSERT_EQ(value->FindIntKey(field_key), expected_value)
<< "Mismatch in field " << field_key;
}
@@ -387,7 +387,7 @@
void EventReportValidator::ValidateField(
base::Value* value,
const std::string& field_key,
- const base::Optional<bool>& expected_value) {
+ const absl::optional<bool>& expected_value) {
ASSERT_EQ(value->FindBoolKey(field_key), expected_value)
<< "Mismatch in field " << field_key;
}
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_test_utils.h b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_test_utils.h
index 4343714..4369333 100644
--- a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_test_utils.h
+++ b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_test_utils.h
@@ -10,10 +10,10 @@
#include "base/callback.h"
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h"
#include "components/enterprise/common/proto/connectors.pb.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Value;
@@ -45,7 +45,7 @@
int expected_content_size,
const std::string& expected_result,
const std::string& expected_username,
- const base::Optional<std::string>& expected_scan_id);
+ const absl::optional<std::string>& expected_scan_id);
void ExpectSensitiveDataEvent(
const std::string& expected_url,
@@ -119,7 +119,7 @@
int expected_content_size,
const std::string& expected_result,
const std::string& expected_username,
- const base::Optional<std::string>& expected_scan_id);
+ const absl::optional<std::string>& expected_scan_id);
void ExpectNoReport();
@@ -136,28 +136,28 @@
void ValidateFilenameAndHash(base::Value* value);
void ValidateField(base::Value* value,
const std::string& field_key,
- const base::Optional<std::string>& expected_value);
+ const absl::optional<std::string>& expected_value);
void ValidateField(base::Value* value,
const std::string& field_key,
- const base::Optional<int>& expected_value);
+ const absl::optional<int>& expected_value);
void ValidateField(base::Value* value,
const std::string& field_key,
- const base::Optional<bool>& expected_value);
+ const absl::optional<bool>& expected_value);
policy::MockCloudPolicyClient* client_;
std::string event_key_;
std::string url_;
std::string trigger_;
- base::Optional<enterprise_connectors::ContentAnalysisResponse::Result>
- dlp_verdict_ = base::nullopt;
- base::Optional<std::string> threat_type_ = base::nullopt;
- base::Optional<std::string> unscanned_reason_ = base::nullopt;
- base::Optional<int> content_size_ = base::nullopt;
+ absl::optional<enterprise_connectors::ContentAnalysisResponse::Result>
+ dlp_verdict_ = absl::nullopt;
+ absl::optional<std::string> threat_type_ = absl::nullopt;
+ absl::optional<std::string> unscanned_reason_ = absl::nullopt;
+ absl::optional<int> content_size_ = absl::nullopt;
const std::set<std::string>* mimetypes_ = nullptr;
- base::Optional<std::string> result_ = base::nullopt;
+ absl::optional<std::string> result_ = absl::nullopt;
std::string username_;
- base::Optional<std::string> scan_id_ = base::nullopt;
+ absl::optional<std::string> scan_id_ = absl::nullopt;
// When multiple files generate events, we don't necessarily know in which
// order they will be reported. As such, we use a map to ensure all of them
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc
index beec64a..7cd8c51 100644
--- a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc
+++ b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc
@@ -339,8 +339,8 @@
}
enterprise_connectors::ContentAnalysisResponse
-SimpleContentAnalysisResponseForTesting(base::Optional<bool> dlp_success,
- base::Optional<bool> malware_success) {
+SimpleContentAnalysisResponseForTesting(absl::optional<bool> dlp_success,
+ absl::optional<bool> malware_success) {
enterprise_connectors::ContentAnalysisResponse response;
if (dlp_success.has_value()) {
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h
index 665e16e0..c7ddfed0 100644
--- a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h
+++ b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h
@@ -124,8 +124,8 @@
// Helper function to make ContentAnalysisResponses for tests.
enterprise_connectors::ContentAnalysisResponse
-SimpleContentAnalysisResponseForTesting(base::Optional<bool> dlp_success,
- base::Optional<bool> malware_success);
+SimpleContentAnalysisResponseForTesting(absl::optional<bool> dlp_success,
+ absl::optional<bool> malware_success);
// Helper function to convert a EventResult to a string that. The format of
// string returned is processed by the sever.
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils_unittest.cc b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils_unittest.cc
index fbf41a9..07cb3ba4 100644
--- a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils_unittest.cc
+++ b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils_unittest.cc
@@ -85,7 +85,7 @@
RecordDeepScanMetrics(access_point(), kDuration, kTotalBytes, result(),
SimpleContentAnalysisResponseForTesting(
/*dlp_success*/ true,
- /*malware_success*/ base::nullopt));
+ /*malware_success*/ absl::nullopt));
for (const std::string& verdict : {"malware", "uws", "safe"}) {
enterprise_connectors::ContentAnalysisResponse response;
auto* malware_result = response.add_results();
diff --git a/chrome/browser/safe_browsing/download_protection/check_client_download_request.cc b/chrome/browser/safe_browsing/download_protection/check_client_download_request.cc
index 836245a..2b3d1ba 100644
--- a/chrome/browser/safe_browsing/download_protection/check_client_download_request.cc
+++ b/chrome/browser/safe_browsing/download_protection/check_client_download_request.cc
@@ -227,12 +227,12 @@
result, upload_requested, item_, request_data, response_body);
}
-base::Optional<enterprise_connectors::AnalysisSettings>
+absl::optional<enterprise_connectors::AnalysisSettings>
CheckClientDownloadRequest::ShouldUploadBinary(
DownloadCheckResultReason reason) {
// If the download was destroyed, we can't upload it.
if (reason == REASON_DOWNLOAD_DESTROYED)
- return base::nullopt;
+ return absl::nullopt;
auto settings = DeepScanningRequest::ShouldUploadBinary(item_);
if (settings && (reason == REASON_DOWNLOAD_DANGEROUS ||
@@ -240,7 +240,7 @@
reason == REASON_ALLOWLISTED_URL)) {
settings->tags.erase("malware");
if (settings->tags.empty())
- return base::nullopt;
+ return absl::nullopt;
}
return settings;
diff --git a/chrome/browser/safe_browsing/download_protection/check_client_download_request.h b/chrome/browser/safe_browsing/download_protection/check_client_download_request.h
index 272f5c1..2eb8ba3 100644
--- a/chrome/browser/safe_browsing/download_protection/check_client_download_request.h
+++ b/chrome/browser/safe_browsing/download_protection/check_client_download_request.h
@@ -65,9 +65,9 @@
// Uploads the binary for deep scanning if the reason and policies indicate
// it should be. ShouldUploadBinary will returns the settings to apply for
- // deep scanning if it should occur, or base::nullopt if no scan should be
+ // deep scanning if it should occur, or absl::nullopt if no scan should be
// done.
- base::Optional<enterprise_connectors::AnalysisSettings> ShouldUploadBinary(
+ absl::optional<enterprise_connectors::AnalysisSettings> ShouldUploadBinary(
DownloadCheckResultReason reason) override;
void UploadBinary(DownloadCheckResultReason reason,
enterprise_connectors::AnalysisSettings settings) override;
diff --git a/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.h b/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.h
index 0cb8bd57..23758f5 100644
--- a/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.h
+++ b/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.h
@@ -106,8 +106,8 @@
// Returns whether or not the file should be uploaded to Safe Browsing for
// deep scanning. Returns the settings to apply for analysis if the file
- // should be uploaded for deep scanning, or base::nullopt if it should not.
- virtual base::Optional<enterprise_connectors::AnalysisSettings>
+ // should be uploaded for deep scanning, or absl::nullopt if it should not.
+ virtual absl::optional<enterprise_connectors::AnalysisSettings>
ShouldUploadBinary(DownloadCheckResultReason reason) = 0;
// If ShouldUploadBinary returns settings, actually performs the upload to
diff --git a/chrome/browser/safe_browsing/download_protection/check_file_system_access_write_request.cc b/chrome/browser/safe_browsing/download_protection/check_file_system_access_write_request.cc
index 59a4c31..beb6c69 100644
--- a/chrome/browser/safe_browsing/download_protection/check_file_system_access_write_request.cc
+++ b/chrome/browser/safe_browsing/download_protection/check_file_system_access_write_request.cc
@@ -98,10 +98,10 @@
// TODO(https://crbug.com/996797): Integrate with DownloadFeedbackService.
}
-base::Optional<enterprise_connectors::AnalysisSettings>
+absl::optional<enterprise_connectors::AnalysisSettings>
CheckFileSystemAccessWriteRequest::ShouldUploadBinary(
DownloadCheckResultReason reason) {
- return base::nullopt;
+ return absl::nullopt;
}
void CheckFileSystemAccessWriteRequest::UploadBinary(
diff --git a/chrome/browser/safe_browsing/download_protection/check_file_system_access_write_request.h b/chrome/browser/safe_browsing/download_protection/check_file_system_access_write_request.h
index 64866b49e1..5726d3a9 100644
--- a/chrome/browser/safe_browsing/download_protection/check_file_system_access_write_request.h
+++ b/chrome/browser/safe_browsing/download_protection/check_file_system_access_write_request.h
@@ -46,7 +46,7 @@
bool upload_requested,
const std::string& request_data,
const std::string& response_body) override;
- base::Optional<enterprise_connectors::AnalysisSettings> ShouldUploadBinary(
+ absl::optional<enterprise_connectors::AnalysisSettings> ShouldUploadBinary(
DownloadCheckResultReason reason) override;
void UploadBinary(DownloadCheckResultReason reason,
enterprise_connectors::AnalysisSettings settings) override;
diff --git a/chrome/browser/safe_browsing/download_protection/deep_scanning_browsertest.cc b/chrome/browser/safe_browsing/download_protection/deep_scanning_browsertest.cc
index 3ee9e21..9203859d 100644
--- a/chrome/browser/safe_browsing/download_protection/deep_scanning_browsertest.cc
+++ b/chrome/browser/safe_browsing/download_protection/deep_scanning_browsertest.cc
@@ -900,7 +900,7 @@
/*mimetypes*/ &zip_types,
/*size*/ 276,
/*result*/ EventResultToString(EventResult::BLOCKED),
- /*username*/ kUserName, /*scan_id*/ base::nullopt);
+ /*username*/ kUserName, /*scan_id*/ absl::nullopt);
WaitForDownloadToFinish();
@@ -1158,9 +1158,9 @@
// result will be reported over the metadata check one.
auto scan_id =
deep_scan_needed() && scanning_verdict() != ScanningVerdict::SAFE
- ? base::Optional<std::string>(
+ ? absl::optional<std::string>(
last_enterprise_request().request_token())
- : base::nullopt;
+ : absl::nullopt;
validator.ExpectDangerousDeepScanningResult(
/*url*/ url.spec(),
diff --git a/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc b/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc
index 355786c..5777a1e 100644
--- a/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc
+++ b/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_prefs.h"
@@ -35,6 +34,7 @@
#include "components/safe_browsing/core/proto/csd.pb.h"
#include "components/url_matcher/url_matcher.h"
#include "content/public/browser/download_item_utils.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace safe_browsing {
@@ -166,7 +166,7 @@
} // namespace
/* static */
-base::Optional<enterprise_connectors::AnalysisSettings>
+absl::optional<enterprise_connectors::AnalysisSettings>
DeepScanningRequest::ShouldUploadBinary(download::DownloadItem* item) {
auto* service =
enterprise_connectors::ConnectorsServiceFactory::GetForBrowserContext(
@@ -176,7 +176,7 @@
if (!service ||
!service->IsConnectorEnabled(
enterprise_connectors::AnalysisConnector::FILE_DOWNLOADED)) {
- return base::nullopt;
+ return absl::nullopt;
}
// Check that item->GetURL() matches the appropriate URL patterns by getting
diff --git a/chrome/browser/safe_browsing/download_protection/deep_scanning_request.h b/chrome/browser/safe_browsing/download_protection/deep_scanning_request.h
index 85d67242..b2c0ca6e 100644
--- a/chrome/browser/safe_browsing/download_protection/deep_scanning_request.h
+++ b/chrome/browser/safe_browsing/download_protection/deep_scanning_request.h
@@ -44,8 +44,8 @@
// Checks the current policies to determine whether files must be uploaded by
// policy. Returns the settings to apply to this analysis if it should happen
- // or base::nullopt if no analysis should happen.
- static base::Optional<enterprise_connectors::AnalysisSettings>
+ // or absl::nullopt if no analysis should happen.
+ static absl::optional<enterprise_connectors::AnalysisSettings>
ShouldUploadBinary(download::DownloadItem* item);
// Scan the given |item|, with the given |trigger|. The result of the scanning
diff --git a/chrome/browser/safe_browsing/download_protection/deep_scanning_request_unittest.cc b/chrome/browser/safe_browsing/download_protection/deep_scanning_request_unittest.cc
index 455c2c6..4380aaf 100644
--- a/chrome/browser/safe_browsing/download_protection/deep_scanning_request_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection/deep_scanning_request_unittest.cc
@@ -220,7 +220,7 @@
}
void ValidateDefaultSettings(
- const base::Optional<enterprise_connectors::AnalysisSettings>& settings) {
+ const absl::optional<enterprise_connectors::AnalysisSettings>& settings) {
ASSERT_TRUE(settings.has_value());
enterprise_connectors::AnalysisSettings default_settings;
@@ -242,7 +242,7 @@
void SetLastResult(DownloadCheckResult result) { last_result_ = result; }
- base::Optional<enterprise_connectors::AnalysisSettings> settings() {
+ absl::optional<enterprise_connectors::AnalysisSettings> settings() {
return DeepScanningRequest::ShouldUploadBinary(&item_);
}
diff --git a/chrome/browser/safe_browsing/incident_reporting/platform_state_store_win_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/platform_state_store_win_unittest.cc
index bf67967..90ddf1fd1 100644
--- a/chrome/browser/safe_browsing/incident_reporting/platform_state_store_win_unittest.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/platform_state_store_win_unittest.cc
@@ -57,7 +57,7 @@
profile_ = profile_manager_.CreateTestingProfile(
kProfileName_, std::move(prefs), base::UTF8ToUTF16(kProfileName_), 0,
std::string(), TestingProfile::TestingFactories(),
- base::Optional<bool>(new_profile));
+ absl::optional<bool>(new_profile));
if (new_profile)
ASSERT_TRUE(profile_->IsNewProfile());
else
diff --git a/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.cc b/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.cc
index 1dd60521..e363aae5 100644
--- a/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.cc
@@ -61,7 +61,7 @@
void PreferenceValidationDelegate::OnAtomicPreferenceValidation(
const std::string& pref_path,
- base::Optional<base::Value> value,
+ absl::optional<base::Value> value,
ValueState value_state,
ValueState external_validation_value_state,
bool is_personal) {
diff --git a/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.h b/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.h
index c7cbe220..b9f0468 100644
--- a/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.h
+++ b/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.h
@@ -9,9 +9,9 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/values.h"
#include "services/preferences/public/mojom/tracked_preference_validation_delegate.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -34,7 +34,7 @@
// TrackedPreferenceValidationDelegate methods.
void OnAtomicPreferenceValidation(
const std::string& pref_path,
- base::Optional<base::Value> value,
+ absl::optional<base::Value> value,
prefs::mojom::TrackedPreferenceValidationDelegate::ValueState value_state,
prefs::mojom::TrackedPreferenceValidationDelegate::ValueState
external_validation_value_state,
diff --git a/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate_unittest.cc
index 18d0c33c2..52c483a7 100644
--- a/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate_unittest.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate_unittest.cc
@@ -101,7 +101,7 @@
// Tests that a NULL value results in an incident with no value.
TEST_F(PreferenceValidationDelegateTest, NullValue) {
instance_->OnAtomicPreferenceValidation(
- kPrefPath, base::nullopt, ValueState::CLEARED, ValueState::UNSUPPORTED,
+ kPrefPath, absl::nullopt, ValueState::CLEARED, ValueState::UNSUPPORTED,
false /* is_personal */);
std::unique_ptr<safe_browsing::ClientIncidentReport_IncidentData> incident(
incidents_.back()->TakePayload());
@@ -208,7 +208,7 @@
TEST_P(PreferenceValidationDelegateNoIncident, Atomic) {
instance_->OnAtomicPreferenceValidation(
- kPrefPath, base::make_optional<base::Value>(), value_state_,
+ kPrefPath, absl::make_optional<base::Value>(), value_state_,
external_validation_value_state_, false /* is_personal */);
EXPECT_EQ(0U, incidents_.size());
}
@@ -251,7 +251,7 @@
TEST_P(PreferenceValidationDelegateWithIncident, Atomic) {
instance_->OnAtomicPreferenceValidation(
- kPrefPath, base::make_optional<base::Value>(), value_state_,
+ kPrefPath, absl::make_optional<base::Value>(), value_state_,
external_validation_value_state_, is_personal_);
ASSERT_EQ(1U, incidents_.size());
std::unique_ptr<safe_browsing::ClientIncidentReport_IncidentData> incident(
diff --git a/chrome/browser/safe_browsing/safe_browsing_metrics_collector.cc b/chrome/browser/safe_browsing/safe_browsing_metrics_collector.cc
index 2dd25a8..4eeaa47 100644
--- a/chrome/browser/safe_browsing/safe_browsing_metrics_collector.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_metrics_collector.cc
@@ -221,14 +221,14 @@
return state_dict->FindDictKey(UserStateToPrefKey(user_state));
}
-base::Optional<SafeBrowsingMetricsCollector::Event>
+absl::optional<SafeBrowsingMetricsCollector::Event>
SafeBrowsingMetricsCollector::GetLatestEventFromEventType(
UserState user_state,
EventType event_type) {
const base::Value* event_dict = GetSafeBrowsingEventDictionary(user_state);
if (!event_dict) {
- return base::nullopt;
+ return absl::nullopt;
}
const base::Value* timestamps =
@@ -239,7 +239,7 @@
return Event(event_type, time);
}
- return base::nullopt;
+ return absl::nullopt;
}
void SafeBrowsingMetricsCollector::LogEnhancedProtectionDisabledMetrics() {
@@ -262,7 +262,7 @@
GetEventCountSince(UserState::ENHANCED_PROTECTION, event_type,
base::Time::Now() - base::TimeDelta::FromDays(28)));
- const base::Optional<Event> latest_event =
+ const absl::optional<Event> latest_event =
GetLatestEventFromEventType(UserState::ENHANCED_PROTECTION, event_type);
if (latest_event) {
bypass_events.emplace_back(latest_event.value());
@@ -284,7 +284,7 @@
/* max */ base::TimeDelta::FromDays(1), /* buckets */ 50);
}
- const base::Optional<Event> latest_enabled_event =
+ const absl::optional<Event> latest_enabled_event =
GetLatestEventFromEventType(UserState::ENHANCED_PROTECTION,
EventType::USER_STATE_ENABLED);
if (latest_enabled_event) {
diff --git a/chrome/browser/safe_browsing/safe_browsing_metrics_collector.h b/chrome/browser/safe_browsing/safe_browsing_metrics_collector.h
index 10fd5faa..1f06a6e 100644
--- a/chrome/browser/safe_browsing/safe_browsing_metrics_collector.h
+++ b/chrome/browser/safe_browsing/safe_browsing_metrics_collector.h
@@ -118,7 +118,7 @@
// Helper functions for Safe Browsing events in pref.
void AddSafeBrowsingEventAndUserStateToPref(UserState user_state,
EventType event_type);
- base::Optional<SafeBrowsingMetricsCollector::Event>
+ absl::optional<SafeBrowsingMetricsCollector::Event>
GetLatestEventFromEventType(UserState user_state, EventType event_type);
const base::Value* GetSafeBrowsingEventDictionary(UserState user_state);
int GetEventCountSince(UserState user_state,
diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
index f2c82d0..1ee5c777 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
@@ -1047,9 +1047,9 @@
EXPECT_TRUE(ShowingInterstitialPage());
WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
auto* reloader = error_page::NetErrorAutoReloader::FromWebContents(contents);
- const base::Optional<base::OneShotTimer>& timer =
+ const absl::optional<base::OneShotTimer>& timer =
reloader->next_reload_timer_for_testing();
- EXPECT_EQ(base::nullopt, timer);
+ EXPECT_EQ(absl::nullopt, timer);
}
// Parameterised fixture to permit running the same test for Window and Worker
diff --git a/chrome/browser/search/background/ntp_background_service.cc b/chrome/browser/search/background/ntp_background_service.cc
index 66505c86..8f6e1fc 100644
--- a/chrome/browser/search/background/ntp_background_service.cc
+++ b/chrome/browser/search/background/ntp_background_service.cc
@@ -254,7 +254,7 @@
void NtpBackgroundService::FetchNextCollectionImage(
const std::string& collection_id,
- const base::Optional<std::string>& resume_token) {
+ const absl::optional<std::string>& resume_token) {
next_image_error_info_.ClearError();
if (next_image_loader_ != nullptr)
return;
diff --git a/chrome/browser/search/background/ntp_background_service.h b/chrome/browser/search/background/ntp_background_service.h
index 207afe1..a586eb7e 100644
--- a/chrome/browser/search/background/ntp_background_service.h
+++ b/chrome/browser/search/background/ntp_background_service.h
@@ -53,7 +53,7 @@
// dropped until the currently active loader completes.
void FetchNextCollectionImage(
const std::string& collection_id,
- const base::Optional<std::string>& resume_token);
+ const absl::optional<std::string>& resume_token);
// Add/remove observers. All observers must unregister themselves before the
// NtpBackgroundService is destroyed.
diff --git a/chrome/browser/search/background/ntp_background_service_factory.cc b/chrome/browser/search/background/ntp_background_service_factory.cc
index faf475fa..c12c8741 100644
--- a/chrome/browser/search/background/ntp_background_service_factory.cc
+++ b/chrome/browser/search/background/ntp_background_service_factory.cc
@@ -8,7 +8,6 @@
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
-#include "base/optional.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/background/ntp_background_service.h"
@@ -16,6 +15,7 @@
#include "components/search/ntp_features.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// static
NtpBackgroundService* NtpBackgroundServiceFactory::GetForProfile(
diff --git a/chrome/browser/search/background/ntp_background_service_unittest.cc b/chrome/browser/search/background/ntp_background_service_unittest.cc
index f450dea..a068132 100644
--- a/chrome/browser/search/background/ntp_background_service_unittest.cc
+++ b/chrome/browser/search/background/ntp_background_service_unittest.cc
@@ -265,7 +265,7 @@
TEST_F(NtpBackgroundServiceTest, NextImageNetworkError) {
SetUpResponseWithNetworkError(service()->GetNextImageURLForTesting());
- service()->FetchNextCollectionImage("shapes", base::nullopt);
+ service()->FetchNextCollectionImage("shapes", absl::nullopt);
base::RunLoop().RunUntilIdle();
EXPECT_THAT(service()->next_image_error_info().error_type,
@@ -276,7 +276,7 @@
SetUpResponseWithData(service()->GetNextImageURLForTesting(),
"bad serialized GetImageFromCollectionResponse");
- service()->FetchNextCollectionImage("shapes", base::nullopt);
+ service()->FetchNextCollectionImage("shapes", absl::nullopt);
base::RunLoop().RunUntilIdle();
EXPECT_THAT(service()->next_image_error_info().error_type,
@@ -337,7 +337,7 @@
// NOTE: the effect of the resume token in the request (i.e. prevent images
// from being repeated) cannot be verified in a unit test.
- service()->FetchNextCollectionImage("shapes", base::nullopt);
+ service()->FetchNextCollectionImage("shapes", absl::nullopt);
// Subsequent requests are ignored while the loader is in use.
service()->FetchNextCollectionImage("shapes", "resume0");
base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/search/instant_service.cc b/chrome/browser/search/instant_service.cc
index 19ea236..57145ff 100644
--- a/chrome/browser/search/instant_service.cc
+++ b/chrome/browser/search/instant_service.cc
@@ -81,9 +81,9 @@
const std::string& attribution_line_1,
const std::string& attribution_line_2,
const GURL& action_url,
- const base::Optional<std::string>& collection_id,
- const base::Optional<std::string>& resume_token,
- const base::Optional<int> refresh_timestamp) {
+ const absl::optional<std::string>& collection_id,
+ const absl::optional<std::string>& resume_token,
+ const absl::optional<int> refresh_timestamp) {
base::DictionaryValue background_info;
background_info.SetKey(kNtpCustomBackgroundURL,
base::Value(background_url.spec()));
@@ -456,7 +456,7 @@
background_updated_timestamp_ = base::TimeTicks::Now();
if (!collection_id.empty() && is_backdrop_collection) {
- background_service_->FetchNextCollectionImage(collection_id, base::nullopt);
+ background_service_->FetchNextCollectionImage(collection_id, absl::nullopt);
} else if (background_url.is_valid() && is_backdrop_url) {
const GURL& thumbnail_url =
background_service_->GetThumbnailUrl(background_url);
@@ -466,7 +466,7 @@
base::DictionaryValue background_info = GetBackgroundInfoAsDict(
background_url, attribution_line_1, attribution_line_2, action_url,
- base::nullopt, base::nullopt, base::nullopt);
+ absl::nullopt, absl::nullopt, absl::nullopt);
pref_service_->Set(prefs::kNtpCustomBackgroundDict, background_info);
} else {
pref_service_->ClearPref(prefs::kNtpCustomBackgroundDict);
diff --git a/chrome/browser/search/instant_service.h b/chrome/browser/search/instant_service.h
index da6799b8..6a87a503a 100644
--- a/chrome/browser/search/instant_service.h
+++ b/chrome/browser/search/instant_service.h
@@ -15,7 +15,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "build/build_config.h"
#include "chrome/browser/search/background/ntp_background_service.h"
@@ -30,6 +29,7 @@
#include "components/prefs/pref_registry_simple.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/native_theme/native_theme.h"
#include "ui/native_theme/native_theme_observer.h"
#include "url/gurl.h"
diff --git a/chrome/browser/search/one_google_bar/one_google_bar_loader.h b/chrome/browser/search/one_google_bar/one_google_bar_loader.h
index ab0beaf..285742bc 100644
--- a/chrome/browser/search/one_google_bar/one_google_bar_loader.h
+++ b/chrome/browser/search/one_google_bar/one_google_bar_loader.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_SEARCH_ONE_GOOGLE_BAR_ONE_GOOGLE_BAR_LOADER_H_
#include "base/callback_forward.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
struct OneGoogleBarData;
@@ -26,7 +26,7 @@
FATAL_ERROR
};
using OneGoogleCallback =
- base::OnceCallback<void(Status, const base::Optional<OneGoogleBarData>&)>;
+ base::OnceCallback<void(Status, const absl::optional<OneGoogleBarData>&)>;
virtual ~OneGoogleBarLoader() = default;
diff --git a/chrome/browser/search/one_google_bar/one_google_bar_loader_impl.cc b/chrome/browser/search/one_google_bar/one_google_bar_loader_impl.cc
index 8cd8ef0e..5eeb8347 100644
--- a/chrome/browser/search/one_google_bar/one_google_bar_loader_impl.cc
+++ b/chrome/browser/search/one_google_bar/one_google_bar_loader_impl.cc
@@ -96,17 +96,17 @@
} // namespace safe_html
-base::Optional<OneGoogleBarData> JsonToOGBData(const base::Value& value) {
+absl::optional<OneGoogleBarData> JsonToOGBData(const base::Value& value) {
const base::DictionaryValue* dict = nullptr;
if (!value.GetAsDictionary(&dict)) {
DVLOG(1) << "Parse error: top-level dictionary not found";
- return base::nullopt;
+ return absl::nullopt;
}
const base::DictionaryValue* update = nullptr;
if (!dict->GetDictionary("update", &update)) {
DVLOG(1) << "Parse error: no update";
- return base::nullopt;
+ return absl::nullopt;
}
const base::Value* language = nullptr;
@@ -118,7 +118,7 @@
const base::DictionaryValue* one_google_bar = nullptr;
if (!update->GetDictionary("ogb", &one_google_bar)) {
DVLOG(1) << "Parse error: no ogb";
- return base::nullopt;
+ return absl::nullopt;
}
OneGoogleBarData result;
@@ -126,13 +126,13 @@
if (!safe_html::GetHtml(*one_google_bar, "html", &result.bar_html)) {
DVLOG(1) << "Parse error: no html";
- return base::nullopt;
+ return absl::nullopt;
}
const base::DictionaryValue* page_hooks = nullptr;
if (!one_google_bar->GetDictionary("page_hooks", &page_hooks)) {
DVLOG(1) << "Parse error: no page_hooks";
- return base::nullopt;
+ return absl::nullopt;
}
safe_html::GetScript(*page_hooks, "in_head_script", &result.in_head_script);
@@ -227,7 +227,7 @@
/*is_header_request=*/true, api_url_,
// Gaia ID is only needed for (drive|docs).google.com.
/*gaia_id=*/std::string(),
- /* is_child_account=*/base::nullopt, profile_mode,
+ /* is_child_account=*/absl::nullopt, profile_mode,
signin::kChromeMirrorHeaderSource,
/*force_account_consistency=*/false);
if (!chrome_connected_header_value.empty()) {
@@ -362,7 +362,7 @@
// This represents network errors (i.e. the server did not provide a
// response).
DVLOG(1) << "Request failed with error: " << simple_loader->NetError();
- Respond(Status::TRANSIENT_ERROR, base::nullopt);
+ Respond(Status::TRANSIENT_ERROR, absl::nullopt);
return;
}
@@ -384,17 +384,17 @@
data_decoder::DataDecoder::ValueOrError result) {
if (!result.value) {
DVLOG(1) << "Parsing JSON failed: " << *result.error;
- Respond(Status::FATAL_ERROR, base::nullopt);
+ Respond(Status::FATAL_ERROR, absl::nullopt);
return;
}
- base::Optional<OneGoogleBarData> data = JsonToOGBData(*result.value);
+ absl::optional<OneGoogleBarData> data = JsonToOGBData(*result.value);
Respond(data.has_value() ? Status::OK : Status::FATAL_ERROR, data);
}
void OneGoogleBarLoaderImpl::Respond(
Status status,
- const base::Optional<OneGoogleBarData>& data) {
+ const absl::optional<OneGoogleBarData>& data) {
for (auto& callback : callbacks_) {
std::move(callback).Run(status, data);
}
diff --git a/chrome/browser/search/one_google_bar/one_google_bar_loader_impl.h b/chrome/browser/search/one_google_bar/one_google_bar_loader_impl.h
index c731a459..80898bc 100644
--- a/chrome/browser/search/one_google_bar/one_google_bar_loader_impl.h
+++ b/chrome/browser/search/one_google_bar/one_google_bar_loader_impl.h
@@ -11,9 +11,9 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/search/one_google_bar/one_google_bar_loader.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace network {
class SimpleURLLoader;
@@ -46,7 +46,7 @@
void JsonParsed(data_decoder::DataDecoder::ValueOrError result);
- void Respond(Status status, const base::Optional<OneGoogleBarData>& data);
+ void Respond(Status status, const absl::optional<OneGoogleBarData>& data);
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
const std::string application_locale_;
diff --git a/chrome/browser/search/one_google_bar/one_google_bar_loader_impl_unittest.cc b/chrome/browser/search/one_google_bar/one_google_bar_loader_impl_unittest.cc
index 996c62f..fd9dfe6 100644
--- a/chrome/browser/search/one_google_bar/one_google_bar_loader_impl_unittest.cc
+++ b/chrome/browser/search/one_google_bar/one_google_bar_loader_impl_unittest.cc
@@ -6,7 +6,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
@@ -25,6 +24,7 @@
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/crosapi/mojom/crosapi.mojom.h"
@@ -168,7 +168,7 @@
base::MockCallback<OneGoogleBarLoader::OneGoogleCallback> callback;
one_google_bar_loader()->Load(callback.Get());
- base::Optional<OneGoogleBarData> data;
+ absl::optional<OneGoogleBarData> data;
base::RunLoop loop;
EXPECT_CALL(callback, Run(OneGoogleBarLoader::Status::OK, _))
.WillOnce(DoAll(SaveArg<1>(&data), Quit(&loop)));
@@ -185,7 +185,7 @@
base::MockCallback<OneGoogleBarLoader::OneGoogleCallback> callback;
one_google_bar_loader()->Load(callback.Get());
- base::Optional<OneGoogleBarData> data;
+ absl::optional<OneGoogleBarData> data;
base::RunLoop loop;
EXPECT_CALL(callback, Run(OneGoogleBarLoader::Status::OK, _))
.WillOnce(DoAll(SaveArg<1>(&data), Quit(&loop)));
@@ -226,7 +226,7 @@
base::MockCallback<OneGoogleBarLoader::OneGoogleCallback> callback;
one_google_bar_loader()->Load(callback.Get());
- base::Optional<OneGoogleBarData> data;
+ absl::optional<OneGoogleBarData> data;
base::RunLoop loop;
EXPECT_CALL(callback, Run(OneGoogleBarLoader::Status::OK, _))
.WillOnce(DoAll(SaveArg<1>(&data), Quit(&loop)));
@@ -251,8 +251,8 @@
one_google_bar_loader()->Load(second_callback.Get());
// Make sure that a single response causes both callbacks to be called.
- base::Optional<OneGoogleBarData> first_data;
- base::Optional<OneGoogleBarData> second_data;
+ absl::optional<OneGoogleBarData> first_data;
+ absl::optional<OneGoogleBarData> second_data;
base::RunLoop loop;
EXPECT_CALL(first_callback, Run(OneGoogleBarLoader::Status::OK, _))
@@ -274,7 +274,7 @@
base::RunLoop loop;
EXPECT_CALL(callback, Run(OneGoogleBarLoader::Status::TRANSIENT_ERROR,
- Eq(base::nullopt)))
+ Eq(absl::nullopt)))
.WillOnce(Quit(&loop));
loop.Run();
}
@@ -287,7 +287,7 @@
base::RunLoop loop;
EXPECT_CALL(callback,
- Run(OneGoogleBarLoader::Status::FATAL_ERROR, Eq(base::nullopt)))
+ Run(OneGoogleBarLoader::Status::FATAL_ERROR, Eq(absl::nullopt)))
.WillOnce(Quit(&loop));
loop.Run();
}
@@ -303,7 +303,7 @@
base::RunLoop loop;
EXPECT_CALL(callback,
- Run(OneGoogleBarLoader::Status::FATAL_ERROR, Eq(base::nullopt)))
+ Run(OneGoogleBarLoader::Status::FATAL_ERROR, Eq(absl::nullopt)))
.WillOnce(Quit(&loop));
loop.Run();
}
@@ -408,7 +408,7 @@
base::MockCallback<OneGoogleBarLoader::OneGoogleCallback> callback;
one_google_bar_loader()->Load(callback.Get());
- base::Optional<OneGoogleBarData> data;
+ absl::optional<OneGoogleBarData> data;
base::RunLoop loop;
EXPECT_CALL(callback, Run(OneGoogleBarLoader::Status::OK, _))
.WillOnce(DoAll(SaveArg<1>(&data), Quit(&loop)));
diff --git a/chrome/browser/search/one_google_bar/one_google_bar_service.cc b/chrome/browser/search/one_google_bar/one_google_bar_service.cc
index c146742..2ee6209 100644
--- a/chrome/browser/search/one_google_bar/one_google_bar_service.cc
+++ b/chrome/browser/search/one_google_bar/one_google_bar_service.cc
@@ -82,14 +82,14 @@
void OneGoogleBarService::SigninStatusChanged() {
// If we have cached data, clear it and notify observers.
if (one_google_bar_data_.has_value()) {
- one_google_bar_data_ = base::nullopt;
+ one_google_bar_data_ = absl::nullopt;
NotifyObservers();
}
}
void OneGoogleBarService::OneGoogleBarDataLoaded(
OneGoogleBarLoader::Status status,
- const base::Optional<OneGoogleBarData>& data) {
+ const absl::optional<OneGoogleBarData>& data) {
// In case of transient errors, keep our cached data (if any), but still
// notify observers of the finished load (attempt).
if (status != OneGoogleBarLoader::Status::TRANSIENT_ERROR) {
diff --git a/chrome/browser/search/one_google_bar/one_google_bar_service.h b/chrome/browser/search/one_google_bar/one_google_bar_service.h
index aeead183..c3c93cd 100644
--- a/chrome/browser/search/one_google_bar/one_google_bar_service.h
+++ b/chrome/browser/search/one_google_bar/one_google_bar_service.h
@@ -8,11 +8,11 @@
#include <memory>
#include "base/observer_list.h"
-#include "base/optional.h"
#include "chrome/browser/search/one_google_bar/one_google_bar_data.h"
#include "chrome/browser/search/one_google_bar/one_google_bar_loader.h"
#include "chrome/browser/search/one_google_bar/one_google_bar_service_observer.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace signin {
class IdentityManager;
@@ -31,7 +31,7 @@
void Shutdown() override;
// Returns the currently cached OneGoogleBarData, if any.
- const base::Optional<OneGoogleBarData>& one_google_bar_data() const {
+ const absl::optional<OneGoogleBarData>& one_google_bar_data() const {
return one_google_bar_data_;
}
@@ -60,7 +60,7 @@
void SigninStatusChanged();
void OneGoogleBarDataLoaded(OneGoogleBarLoader::Status status,
- const base::Optional<OneGoogleBarData>& data);
+ const absl::optional<OneGoogleBarData>& data);
void NotifyObservers();
@@ -70,7 +70,7 @@
base::ObserverList<OneGoogleBarServiceObserver, true>::Unchecked observers_;
- base::Optional<OneGoogleBarData> one_google_bar_data_;
+ absl::optional<OneGoogleBarData> one_google_bar_data_;
std::string language_code_;
};
diff --git a/chrome/browser/search/one_google_bar/one_google_bar_service_factory.cc b/chrome/browser/search/one_google_bar/one_google_bar_service_factory.cc
index 8f13da6..f884bf9 100644
--- a/chrome/browser/search/one_google_bar/one_google_bar_service_factory.cc
+++ b/chrome/browser/search/one_google_bar/one_google_bar_service_factory.cc
@@ -8,7 +8,6 @@
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
-#include "base/optional.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -21,6 +20,7 @@
#include "components/signin/core/browser/cookie_settings_util.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// static
OneGoogleBarService* OneGoogleBarServiceFactory::GetForProfile(
diff --git a/chrome/browser/search/one_google_bar/one_google_bar_service_unittest.cc b/chrome/browser/search/one_google_bar/one_google_bar_service_unittest.cc
index f7e406f..a4e6239 100644
--- a/chrome/browser/search/one_google_bar/one_google_bar_service_unittest.cc
+++ b/chrome/browser/search/one_google_bar/one_google_bar_service_unittest.cc
@@ -9,7 +9,6 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/test/task_environment.h"
#include "chrome/browser/search/one_google_bar/one_google_bar_data.h"
#include "chrome/browser/search/one_google_bar/one_google_bar_loader.h"
@@ -17,6 +16,7 @@
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using testing::Eq;
using testing::InSequence;
@@ -37,7 +37,7 @@
size_t GetCallbackCount() const { return callbacks_.size(); }
void RespondToAllCallbacks(Status status,
- const base::Optional<OneGoogleBarData>& data) {
+ const absl::optional<OneGoogleBarData>& data) {
for (OneGoogleCallback& callback : callbacks_) {
std::move(callback).Run(status, data);
}
@@ -86,7 +86,7 @@
};
TEST_F(OneGoogleBarServiceTest, RefreshesOnRequest) {
- ASSERT_THAT(service()->one_google_bar_data(), Eq(base::nullopt));
+ ASSERT_THAT(service()->one_google_bar_data(), Eq(absl::nullopt));
// Request a refresh. That should arrive at the loader.
service()->Refresh();
@@ -115,7 +115,7 @@
TEST_F(OneGoogleBarServiceTest, NotifiesObserverOnChanges) {
InSequence s;
- ASSERT_THAT(service()->one_google_bar_data(), Eq(base::nullopt));
+ ASSERT_THAT(service()->one_google_bar_data(), Eq(absl::nullopt));
StrictMock<MockOneGoogleBarServiceObserver> observer;
service()->AddObserver(&observer);
@@ -124,8 +124,8 @@
service()->Refresh();
EXPECT_CALL(observer, OnOneGoogleBarDataUpdated());
loader()->RespondToAllCallbacks(OneGoogleBarLoader::Status::OK,
- base::nullopt);
- EXPECT_THAT(service()->one_google_bar_data(), Eq(base::nullopt));
+ absl::nullopt);
+ EXPECT_THAT(service()->one_google_bar_data(), Eq(absl::nullopt));
// Non-empty response should result in a notification.
service()->Refresh();
@@ -169,7 +169,7 @@
service()->Refresh();
EXPECT_CALL(observer, OnOneGoogleBarDataUpdated());
loader()->RespondToAllCallbacks(OneGoogleBarLoader::Status::TRANSIENT_ERROR,
- base::nullopt);
+ absl::nullopt);
// Cached data should still be there.
EXPECT_THAT(service()->one_google_bar_data(), Eq(data));
@@ -191,9 +191,9 @@
service()->Refresh();
EXPECT_CALL(observer, OnOneGoogleBarDataUpdated());
loader()->RespondToAllCallbacks(OneGoogleBarLoader::Status::FATAL_ERROR,
- base::nullopt);
+ absl::nullopt);
// Cached data should be gone now.
- EXPECT_THAT(service()->one_google_bar_data(), Eq(base::nullopt));
+ EXPECT_THAT(service()->one_google_bar_data(), Eq(absl::nullopt));
service()->RemoveObserver(&observer);
}
@@ -212,7 +212,7 @@
// Sign in. This should clear the cached data and notify the observer.
EXPECT_CALL(observer, OnOneGoogleBarDataUpdated());
SignIn();
- EXPECT_THAT(service()->one_google_bar_data(), Eq(base::nullopt));
+ EXPECT_THAT(service()->one_google_bar_data(), Eq(absl::nullopt));
service()->RemoveObserver(&observer);
}
@@ -233,13 +233,13 @@
// Sign in. This should clear the cached data and notify the observer.
EXPECT_CALL(observer, OnOneGoogleBarDataUpdated());
SignOut();
- EXPECT_THAT(service()->one_google_bar_data(), Eq(base::nullopt));
+ EXPECT_THAT(service()->one_google_bar_data(), Eq(absl::nullopt));
service()->RemoveObserver(&observer);
}
TEST_F(OneGoogleBarServiceTest, DoesNotNotifyObserverOnSignInIfNoCachedData) {
- ASSERT_THAT(service()->one_google_bar_data(), Eq(base::nullopt));
+ ASSERT_THAT(service()->one_google_bar_data(), Eq(absl::nullopt));
StrictMock<MockOneGoogleBarServiceObserver> observer;
service()->AddObserver(&observer);
@@ -247,13 +247,13 @@
// Sign in. This should *not* notify the observer, since there was no cached
// data before.
SignIn();
- EXPECT_THAT(service()->one_google_bar_data(), Eq(base::nullopt));
+ EXPECT_THAT(service()->one_google_bar_data(), Eq(absl::nullopt));
service()->RemoveObserver(&observer);
}
TEST_F(OneGoogleBarServiceTest, UpdatesLanguageCode) {
- ASSERT_THAT(service()->one_google_bar_data(), Eq(base::nullopt));
+ ASSERT_THAT(service()->one_google_bar_data(), Eq(absl::nullopt));
// Request a refresh. That should arrive at the loader.
service()->Refresh();
diff --git a/chrome/browser/search/promos/promo_service.cc b/chrome/browser/search/promos/promo_service.cc
index 4015c2ce..3ce88d0 100644
--- a/chrome/browser/search/promos/promo_service.cc
+++ b/chrome/browser/search/promos/promo_service.cc
@@ -61,12 +61,12 @@
// the form: {"update":{"promos":{"middle": ""}}}, and true otherwise.
// Additionally, there can be a "log_url" or "id" field in the promo. Those are
// populated if found. They're not set for emergency promos. |data| will never
-// be base::nullopt if top level dictionary keys of "update" and "promos" are
+// be absl::nullopt if top level dictionary keys of "update" and "promos" are
// present. Note: the "log_url" (if found), is resolved against
// GetGoogleBaseUrl() to form a valid GURL.
bool JsonToPromoData(const base::Value& value,
- base::Optional<PromoData>* data) {
- *data = base::nullopt;
+ absl::optional<PromoData>* data) {
+ *data = absl::nullopt;
const base::DictionaryValue* dict = nullptr;
if (!value.GetAsDictionary(&dict)) {
@@ -213,7 +213,7 @@
// This represents network errors (i.e. the server did not provide a
// response).
DVLOG(1) << "Request failed with error: " << simple_loader_->NetError();
- PromoDataLoaded(Status::TRANSIENT_ERROR, base::nullopt);
+ PromoDataLoaded(Status::TRANSIENT_ERROR, absl::nullopt);
return;
}
@@ -235,11 +235,11 @@
data_decoder::DataDecoder::ValueOrError result) {
if (!result.value) {
DVLOG(1) << "Parsing JSON failed: " << *result.error;
- PromoDataLoaded(Status::FATAL_ERROR, base::nullopt);
+ PromoDataLoaded(Status::FATAL_ERROR, absl::nullopt);
return;
}
- base::Optional<PromoData> data;
+ absl::optional<PromoData> data;
PromoService::Status status;
if (JsonToPromoData(*result.value, &data)) {
@@ -294,7 +294,7 @@
}
void PromoService::PromoDataLoaded(Status status,
- const base::Optional<PromoData>& data) {
+ const absl::optional<PromoData>& data) {
// In case of transient errors, keep our cached data (if any), but still
// notify observers of the finished load (attempt).
if (status != Status::TRANSIENT_ERROR) {
diff --git a/chrome/browser/search/promos/promo_service.h b/chrome/browser/search/promos/promo_service.h
index fd847f9..d513e164 100644
--- a/chrome/browser/search/promos/promo_service.h
+++ b/chrome/browser/search/promos/promo_service.h
@@ -8,12 +8,12 @@
#include <memory>
#include "base/observer_list.h"
-#include "base/optional.h"
#include "chrome/browser/search/promos/promo_data.h"
#include "chrome/browser/search/promos/promo_service_observer.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/prefs/pref_registry_simple.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
class Profile;
@@ -58,7 +58,7 @@
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
// Returns the currently cached middle-slot PromoData, if any.
- const base::Optional<PromoData>& promo_data() const { return promo_data_; }
+ const absl::optional<PromoData>& promo_data() const { return promo_data_; }
Status promo_status() const { return promo_status_; }
// Requests an asynchronous refresh from the network. After the update
@@ -76,7 +76,7 @@
GURL GetLoadURLForTesting() const;
protected:
- void PromoDataLoaded(Status status, const base::Optional<PromoData>& data);
+ void PromoDataLoaded(Status status, const absl::optional<PromoData>& data);
private:
void OnLoadDone(std::unique_ptr<std::string> response_body);
@@ -97,7 +97,7 @@
base::ObserverList<PromoServiceObserver, true>::Unchecked observers_;
- base::Optional<PromoData> promo_data_;
+ absl::optional<PromoData> promo_data_;
Status promo_status_;
Profile* profile_;
diff --git a/chrome/browser/search/promos/promo_service_factory.cc b/chrome/browser/search/promos/promo_service_factory.cc
index 067646d7..23b1c0a 100644
--- a/chrome/browser/search/promos/promo_service_factory.cc
+++ b/chrome/browser/search/promos/promo_service_factory.cc
@@ -8,7 +8,6 @@
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
-#include "base/optional.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -18,6 +17,7 @@
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// static
PromoService* PromoServiceFactory::GetForProfile(Profile* profile) {
diff --git a/chrome/browser/search/promos/promo_service_unittest.cc b/chrome/browser/search/promos/promo_service_unittest.cc
index 68b0add..9192e3c 100644
--- a/chrome/browser/search/promos/promo_service_unittest.cc
+++ b/chrome/browser/search/promos/promo_service_unittest.cc
@@ -100,12 +100,12 @@
TEST_F(PromoServiceTest, PromoDataNetworkError) {
SetUpResponseWithNetworkError(service()->GetLoadURLForTesting());
- ASSERT_EQ(service()->promo_data(), base::nullopt);
+ ASSERT_EQ(service()->promo_data(), absl::nullopt);
service()->Refresh();
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(service()->promo_data(), base::nullopt);
+ EXPECT_EQ(service()->promo_data(), absl::nullopt);
EXPECT_EQ(service()->promo_status(), PromoService::Status::TRANSIENT_ERROR);
}
@@ -113,12 +113,12 @@
SetUpResponseWithData(service()->GetLoadURLForTesting(),
"{\"update\":{\"promotions\":{}}}");
- ASSERT_EQ(service()->promo_data(), base::nullopt);
+ ASSERT_EQ(service()->promo_data(), absl::nullopt);
service()->Refresh();
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(service()->promo_data(), base::nullopt);
+ EXPECT_EQ(service()->promo_data(), absl::nullopt);
EXPECT_EQ(service()->promo_status(), PromoService::Status::FATAL_ERROR);
}
@@ -126,7 +126,7 @@
SetUpResponseWithData(service()->GetLoadURLForTesting(),
"{\"update\":{\"promos\":{}}}");
- ASSERT_EQ(service()->promo_data(), base::nullopt);
+ ASSERT_EQ(service()->promo_data(), absl::nullopt);
service()->Refresh();
base::RunLoop().RunUntilIdle();
@@ -141,7 +141,7 @@
"script></div>\", \"log_url\":\"/log_url?id=42\", \"id\": \"42\"}}}";
SetUpResponseWithData(service()->GetLoadURLForTesting(), response_string);
- ASSERT_EQ(service()->promo_data(), base::nullopt);
+ ASSERT_EQ(service()->promo_data(), absl::nullopt);
service()->Refresh();
base::RunLoop().RunUntilIdle();
@@ -163,7 +163,7 @@
"script></div>\", \"log_url\":\"/log_url?id=42\", \"id\": \"42\"}}}";
SetUpResponseWithData(service()->GetLoadURLForTesting(), response_string);
- ASSERT_EQ(service()->promo_data(), base::nullopt);
+ ASSERT_EQ(service()->promo_data(), absl::nullopt);
service()->Refresh();
base::RunLoop().RunUntilIdle();
@@ -186,7 +186,7 @@
"script></div>\", \"log_url\":\"/log_url?id=42\"}}}";
SetUpResponseWithData(service()->GetLoadURLForTesting(), response_string);
- ASSERT_EQ(service()->promo_data(), base::nullopt);
+ ASSERT_EQ(service()->promo_data(), absl::nullopt);
service()->Refresh();
base::RunLoop().RunUntilIdle();
@@ -209,7 +209,7 @@
"script></div>\"}}}";
SetUpResponseWithData(service()->GetLoadURLForTesting(), response_string);
- ASSERT_EQ(service()->promo_data(), base::nullopt);
+ ASSERT_EQ(service()->promo_data(), absl::nullopt);
service()->Refresh();
base::RunLoop().RunUntilIdle();
@@ -236,7 +236,7 @@
"script></div>\", \"log_url\":\"/log_url?id=42\", \"id\": \"42\"}}}";
SetUpResponseWithData(service()->GetLoadURLForTesting(), response_string);
- ASSERT_EQ(service()->promo_data(), base::nullopt);
+ ASSERT_EQ(service()->promo_data(), absl::nullopt);
service()->Refresh();
base::RunLoop().RunUntilIdle();
@@ -254,7 +254,7 @@
"script></div>\", \"log_url\":\"/log_url?id=42\", \"id\": \"42\"}}}";
SetUpResponseWithData(service()->GetLoadURLForTesting(), response_string);
- ASSERT_EQ(service()->promo_data(), base::nullopt);
+ ASSERT_EQ(service()->promo_data(), absl::nullopt);
service()->Refresh();
base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/search/search_engine_base_url_tracker.cc b/chrome/browser/search/search_engine_base_url_tracker.cc
index 37f49cf..0a2e5a425 100644
--- a/chrome/browser/search/search_engine_base_url_tracker.cc
+++ b/chrome/browser/search/search_engine_base_url_tracker.cc
@@ -45,7 +45,7 @@
if (template_url)
previous_default_search_provider_data_ = template_url->data();
else
- previous_default_search_provider_data_ = base::nullopt;
+ previous_default_search_provider_data_ = absl::nullopt;
// Also update the cached Google base URL, without separately notifying.
previous_google_base_url_ = google_base_url;
diff --git a/chrome/browser/search/search_engine_base_url_tracker.h b/chrome/browser/search/search_engine_base_url_tracker.h
index 95f8598..3c8f88c 100644
--- a/chrome/browser/search/search_engine_base_url_tracker.h
+++ b/chrome/browser/search/search_engine_base_url_tracker.h
@@ -9,11 +9,11 @@
#include "base/callback.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "components/search_engines/template_url_data.h"
#include "components/search_engines/template_url_service.h"
#include "components/search_engines/template_url_service_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class SearchTermsData;
@@ -54,7 +54,7 @@
// Used to check whether notifications from TemplateURLService indicate a
// change that affects the default search provider.
GURL previous_google_base_url_;
- base::Optional<TemplateURLData> previous_default_search_provider_data_;
+ absl::optional<TemplateURLData> previous_default_search_provider_data_;
DISALLOW_COPY_AND_ASSIGN(SearchEngineBaseURLTracker);
};
diff --git a/chrome/browser/search/search_suggest/search_suggest_loader.h b/chrome/browser/search/search_suggest/search_suggest_loader.h
index ace379c..bcb4d03 100644
--- a/chrome/browser/search/search_suggest/search_suggest_loader.h
+++ b/chrome/browser/search/search_suggest/search_suggest_loader.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/callback_forward.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
struct SearchSuggestData;
@@ -39,7 +39,7 @@
};
using SearchSuggestionsCallback =
base::OnceCallback<void(Status,
- const base::Optional<SearchSuggestData>&)>;
+ const absl::optional<SearchSuggestData>&)>;
virtual ~SearchSuggestLoader() = default;
diff --git a/chrome/browser/search/search_suggest/search_suggest_loader_impl.cc b/chrome/browser/search/search_suggest/search_suggest_loader_impl.cc
index d13a7348..67386c1 100644
--- a/chrome/browser/search/search_suggest/search_suggest_loader_impl.cc
+++ b/chrome/browser/search/search_suggest/search_suggest_loader_impl.cc
@@ -37,10 +37,10 @@
// {"update":{"query_suggestions":{"query_suggestions_with_html": "", "script":
// "", impression_cap_expire_time_ms: "", request_freeze_time_ms: "",
// max_impressions: ""}}}.
-// Additionally |data| will be base::nullopt if "query_suggestions" keys is not
+// Additionally |data| will be absl::nullopt if "query_suggestions" keys is not
// present.
bool JsonToSearchSuggestionData(const base::Value& value,
- base::Optional<SearchSuggestData>* data) {
+ absl::optional<SearchSuggestData>* data) {
data->reset();
bool all_fields_present = true;
@@ -246,7 +246,7 @@
// This represents network errors (i.e. the server did not provide a
// response).
DVLOG(1) << "Request failed with error: " << simple_loader->NetError();
- Respond(Status::TRANSIENT_ERROR, base::nullopt);
+ Respond(Status::TRANSIENT_ERROR, absl::nullopt);
return;
}
@@ -268,11 +268,11 @@
data_decoder::DataDecoder::ValueOrError result) {
if (!result.value) {
DVLOG(1) << "Parsing JSON failed: " << *result.error;
- Respond(Status::FATAL_ERROR, base::nullopt);
+ Respond(Status::FATAL_ERROR, absl::nullopt);
return;
}
- base::Optional<SearchSuggestData> data;
+ absl::optional<SearchSuggestData> data;
if (JsonToSearchSuggestionData(*result.value, &data)) {
Respond(Status::OK_WITH_SUGGESTIONS, data);
} else if (data.has_value()) {
@@ -284,7 +284,7 @@
void SearchSuggestLoaderImpl::Respond(
Status status,
- const base::Optional<SearchSuggestData>& data) {
+ const absl::optional<SearchSuggestData>& data) {
for (auto& callback : callbacks_) {
std::move(callback).Run(status, data);
}
diff --git a/chrome/browser/search/search_suggest/search_suggest_loader_impl.h b/chrome/browser/search/search_suggest/search_suggest_loader_impl.h
index 50b8ce4..e17e57d 100644
--- a/chrome/browser/search/search_suggest/search_suggest_loader_impl.h
+++ b/chrome/browser/search/search_suggest/search_suggest_loader_impl.h
@@ -11,9 +11,9 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/search/search_suggest/search_suggest_loader.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace network {
class SimpleURLLoader;
@@ -44,7 +44,7 @@
void JsonParsed(data_decoder::DataDecoder::ValueOrError result);
- void Respond(Status status, const base::Optional<SearchSuggestData>& data);
+ void Respond(Status status, const absl::optional<SearchSuggestData>& data);
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
const std::string application_locale_;
diff --git a/chrome/browser/search/search_suggest/search_suggest_loader_impl_unittest.cc b/chrome/browser/search/search_suggest/search_suggest_loader_impl_unittest.cc
index 36cf2c0..f8e2822 100644
--- a/chrome/browser/search/search_suggest/search_suggest_loader_impl_unittest.cc
+++ b/chrome/browser/search/search_suggest/search_suggest_loader_impl_unittest.cc
@@ -6,7 +6,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
@@ -23,6 +22,7 @@
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using testing::_;
using testing::DoAll;
@@ -118,7 +118,7 @@
std::string blocklist;
search_suggest_loader()->Load(blocklist, callback.Get());
- base::Optional<SearchSuggestData> data;
+ absl::optional<SearchSuggestData> data;
base::RunLoop loop;
EXPECT_CALL(callback,
Run(SearchSuggestLoader::Status::OK_WITH_SUGGESTIONS, _))
@@ -138,7 +138,7 @@
std::string blocklist;
search_suggest_loader()->Load(blocklist, callback.Get());
- base::Optional<SearchSuggestData> data;
+ absl::optional<SearchSuggestData> data;
base::RunLoop loop;
EXPECT_CALL(callback,
Run(SearchSuggestLoader::Status::OK_WITH_SUGGESTIONS, _))
@@ -155,7 +155,7 @@
std::string blocklist;
search_suggest_loader()->Load(blocklist, callback.Get());
- base::Optional<SearchSuggestData> data;
+ absl::optional<SearchSuggestData> data;
base::RunLoop loop;
EXPECT_CALL(callback,
Run(SearchSuggestLoader::Status::OK_WITH_SUGGESTIONS, _))
@@ -177,7 +177,7 @@
std::string blocklist;
search_suggest_loader()->Load(blocklist, callback.Get());
- base::Optional<SearchSuggestData> data;
+ absl::optional<SearchSuggestData> data;
base::RunLoop loop;
EXPECT_CALL(callback,
Run(SearchSuggestLoader::Status::OK_WITHOUT_SUGGESTIONS, _))
@@ -205,8 +205,8 @@
search_suggest_loader()->Load(blocklist, second_callback.Get());
// Make sure that a single response causes both callbacks to be called.
- base::Optional<SearchSuggestData> first_data;
- base::Optional<SearchSuggestData> second_data;
+ absl::optional<SearchSuggestData> first_data;
+ absl::optional<SearchSuggestData> second_data;
base::RunLoop loop;
EXPECT_CALL(first_callback,
@@ -231,7 +231,7 @@
base::RunLoop loop;
EXPECT_CALL(callback, Run(SearchSuggestLoader::Status::TRANSIENT_ERROR,
- Eq(base::nullopt)))
+ Eq(absl::nullopt)))
.WillOnce(Quit(&loop));
loop.Run();
}
@@ -247,7 +247,7 @@
base::RunLoop loop;
EXPECT_CALL(callback,
- Run(SearchSuggestLoader::Status::FATAL_ERROR, Eq(base::nullopt)))
+ Run(SearchSuggestLoader::Status::FATAL_ERROR, Eq(absl::nullopt)))
.WillOnce(Quit(&loop));
loop.Run();
}
@@ -261,7 +261,7 @@
base::RunLoop loop;
EXPECT_CALL(callback,
- Run(SearchSuggestLoader::Status::FATAL_ERROR, Eq(base::nullopt)))
+ Run(SearchSuggestLoader::Status::FATAL_ERROR, Eq(absl::nullopt)))
.WillOnce(Quit(&loop));
loop.Run();
}
diff --git a/chrome/browser/search/search_suggest/search_suggest_service.cc b/chrome/browser/search/search_suggest/search_suggest_service.cc
index f06ef656..2919755 100644
--- a/chrome/browser/search/search_suggest/search_suggest_service.cc
+++ b/chrome/browser/search/search_suggest/search_suggest_service.cc
@@ -120,7 +120,7 @@
base::BindRepeating(&SearchSuggestService::SigninStatusChanged,
base::Unretained(this)))),
profile_(profile),
- search_suggest_data_(base::nullopt),
+ search_suggest_data_(absl::nullopt),
search_suggest_status_(SearchSuggestLoader::Status::FATAL_ERROR) {}
SearchSuggestService::~SearchSuggestService() = default;
@@ -134,7 +134,7 @@
DCHECK(observers_.empty());
}
-const base::Optional<SearchSuggestData>&
+const absl::optional<SearchSuggestData>&
SearchSuggestService::search_suggest_data() const {
return search_suggest_data_;
}
@@ -153,17 +153,17 @@
const std::string& blocklist) {
if (!signin_observer_->SignedIn()) {
SearchSuggestDataLoaded(SearchSuggestLoader::Status::SIGNED_OUT,
- base::nullopt);
+ absl::nullopt);
} else if (profile_->GetPrefs()->GetBoolean(
prefs::kNtpSearchSuggestionsOptOut)) {
SearchSuggestDataLoaded(SearchSuggestLoader::Status::OPTED_OUT,
- base::nullopt);
+ absl::nullopt);
} else if (RequestsFrozen()) {
SearchSuggestDataLoaded(SearchSuggestLoader::Status::REQUESTS_FROZEN,
- base::nullopt);
+ absl::nullopt);
} else if (ImpressionCapReached()) {
SearchSuggestDataLoaded(SearchSuggestLoader::Status::IMPRESSION_CAP,
- base::nullopt);
+ absl::nullopt);
} else {
loader_->Load(blocklist,
base::BindOnce(&SearchSuggestService::SearchSuggestDataLoaded,
@@ -183,13 +183,13 @@
void SearchSuggestService::SigninStatusChanged() {
// If we have cached data, clear it.
if (search_suggest_data_.has_value()) {
- search_suggest_data_ = base::nullopt;
+ search_suggest_data_ = absl::nullopt;
}
}
void SearchSuggestService::SearchSuggestDataLoaded(
SearchSuggestLoader::Status status,
- const base::Optional<SearchSuggestData>& data) {
+ const absl::optional<SearchSuggestData>& data) {
// In case of transient errors, keep our cached data (if any), but still
// notify observers of the finished load (attempt).
if (status != SearchSuggestLoader::Status::TRANSIENT_ERROR) {
@@ -290,7 +290,7 @@
base::DictionaryValue* blocklist = update.Get();
blocklist->SetKey(task_version_id, base::ListValue());
- search_suggest_data_ = base::nullopt;
+ search_suggest_data_ = absl::nullopt;
Refresh();
}
@@ -316,7 +316,7 @@
value = blocklist->SetKey(task_version_id, base::ListValue());
value->Append(base::Value(hash_string));
- search_suggest_data_ = base::nullopt;
+ search_suggest_data_ = absl::nullopt;
Refresh();
}
@@ -339,7 +339,7 @@
blocklist += ";";
blocklist += blocklist_item;
- search_suggest_data_ = base::nullopt;
+ search_suggest_data_ = absl::nullopt;
MaybeLoadWithBlocklist(blocklist);
}
@@ -373,7 +373,7 @@
}
void SearchSuggestService::SuggestionsDisplayed() {
- search_suggest_data_ = base::nullopt;
+ search_suggest_data_ = absl::nullopt;
DictionaryPrefUpdate update(profile_->GetPrefs(),
prefs::kNtpSearchSuggestionsImpressions);
@@ -395,7 +395,7 @@
profile_->GetPrefs()->SetBoolean(prefs::kNtpSearchSuggestionsOptOut, true);
- search_suggest_data_ = base::nullopt;
+ search_suggest_data_ = absl::nullopt;
}
// static
diff --git a/chrome/browser/search/search_suggest/search_suggest_service.h b/chrome/browser/search/search_suggest/search_suggest_service.h
index 34719d3..dc0f7c3 100644
--- a/chrome/browser/search/search_suggest/search_suggest_service.h
+++ b/chrome/browser/search/search_suggest/search_suggest_service.h
@@ -9,13 +9,13 @@
#include <string>
#include "base/observer_list.h"
-#include "base/optional.h"
#include "chrome/browser/search/search_suggest/search_suggest_data.h"
#include "chrome/browser/search/search_suggest/search_suggest_loader.h"
#include "chrome/browser/search/search_suggest/search_suggest_service_observer.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -45,7 +45,7 @@
// Returns the currently cached SearchSuggestData, if any.
// Virtual for testing.
- virtual const base::Optional<SearchSuggestData>& search_suggest_data() const;
+ virtual const absl::optional<SearchSuggestData>& search_suggest_data() const;
virtual const SearchSuggestLoader::Status& search_suggest_status() const;
@@ -115,7 +115,7 @@
// If the |status|==FATAL_ERROR freeze future requests until the request
// freeze interval has elapsed.
void SearchSuggestDataLoaded(SearchSuggestLoader::Status status,
- const base::Optional<SearchSuggestData>& data);
+ const absl::optional<SearchSuggestData>& data);
private:
class SigninObserver;
@@ -147,7 +147,7 @@
base::ObserverList<SearchSuggestServiceObserver, true>::Unchecked observers_;
- base::Optional<SearchSuggestData> search_suggest_data_;
+ absl::optional<SearchSuggestData> search_suggest_data_;
SearchSuggestLoader::Status search_suggest_status_;
};
diff --git a/chrome/browser/search/search_suggest/search_suggest_service_factory.cc b/chrome/browser/search/search_suggest/search_suggest_service_factory.cc
index c6818ad..b9267f8 100644
--- a/chrome/browser/search/search_suggest/search_suggest_service_factory.cc
+++ b/chrome/browser/search/search_suggest/search_suggest_service_factory.cc
@@ -8,7 +8,6 @@
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
-#include "base/optional.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -20,6 +19,7 @@
#include "components/search/ntp_features.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// static
SearchSuggestService* SearchSuggestServiceFactory::GetForProfile(
diff --git a/chrome/browser/search/search_suggest/search_suggest_service_unittest.cc b/chrome/browser/search/search_suggest/search_suggest_service_unittest.cc
index 613f45b..ef69bcd 100644
--- a/chrome/browser/search/search_suggest/search_suggest_service_unittest.cc
+++ b/chrome/browser/search/search_suggest/search_suggest_service_unittest.cc
@@ -8,7 +8,6 @@
#include <utility>
#include <vector>
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
@@ -27,6 +26,7 @@
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using testing::InSequence;
using testing::StrictMock;
@@ -42,7 +42,7 @@
size_t GetCallbackCount() const { return callbacks_.size(); }
void RespondToAllCallbacks(Status status,
- const base::Optional<SearchSuggestData>& data) {
+ const absl::optional<SearchSuggestData>& data) {
for (SearchSuggestionsCallback& callback : callbacks_) {
std::move(callback).Run(status, data);
}
@@ -175,16 +175,16 @@
}
TEST_F(SearchSuggestServiceTest, NoRefreshOnSignedOutRequest) {
- ASSERT_EQ(base::nullopt, service()->search_suggest_data());
+ ASSERT_EQ(absl::nullopt, service()->search_suggest_data());
// Request a refresh. That should do nothing as no user is signed-in.
service()->Refresh();
EXPECT_EQ(0u, loader()->GetCallbackCount());
- EXPECT_EQ(base::nullopt, service()->search_suggest_data());
+ EXPECT_EQ(absl::nullopt, service()->search_suggest_data());
}
TEST_F(SearchSuggestServiceTest, RefreshesOnSignedInRequest) {
- ASSERT_EQ(base::nullopt, service()->search_suggest_data());
+ ASSERT_EQ(absl::nullopt, service()->search_suggest_data());
SignIn();
// Request a refresh. That should arrive at the loader.
@@ -212,7 +212,7 @@
}
TEST_F(SearchSuggestServiceTest, KeepsCacheOnTransientError) {
- ASSERT_EQ(base::nullopt, service()->search_suggest_data());
+ ASSERT_EQ(absl::nullopt, service()->search_suggest_data());
SignIn();
// Load some data.
@@ -225,13 +225,13 @@
// Request a refresh and respond with a transient error.
service()->Refresh();
loader()->RespondToAllCallbacks(SearchSuggestLoader::Status::TRANSIENT_ERROR,
- base::nullopt);
+ absl::nullopt);
// Cached data should still be there.
EXPECT_EQ(data, service()->search_suggest_data());
}
TEST_F(SearchSuggestServiceTest, ClearsCacheOnFatalError) {
- ASSERT_EQ(base::nullopt, service()->search_suggest_data());
+ ASSERT_EQ(absl::nullopt, service()->search_suggest_data());
SignIn();
// Load some data.
@@ -244,13 +244,13 @@
// Request a refresh and respond with a fatal error.
service()->Refresh();
loader()->RespondToAllCallbacks(SearchSuggestLoader::Status::FATAL_ERROR,
- base::nullopt);
+ absl::nullopt);
// Cached data should be gone now.
- EXPECT_EQ(base::nullopt, service()->search_suggest_data());
+ EXPECT_EQ(absl::nullopt, service()->search_suggest_data());
}
TEST_F(SearchSuggestServiceTest, ResetsOnSignOut) {
- ASSERT_EQ(base::nullopt, service()->search_suggest_data());
+ ASSERT_EQ(absl::nullopt, service()->search_suggest_data());
SignIn();
// Load some data.
@@ -262,7 +262,7 @@
// Sign out. This should clear the cached data and notify the observer.
SignOut();
- EXPECT_EQ(base::nullopt, service()->search_suggest_data());
+ EXPECT_EQ(absl::nullopt, service()->search_suggest_data());
}
TEST_F(SearchSuggestServiceTest, BlocklistSuggestionUpdatesBlocklistString) {
@@ -341,7 +341,7 @@
TEST_F(SearchSuggestServiceTest, BlocklistClearsCachedDataAndIssuesRequest) {
SetUserSelectedDefaultSearchProvider("{google:baseURL}");
- ASSERT_EQ(base::nullopt, service()->search_suggest_data());
+ ASSERT_EQ(absl::nullopt, service()->search_suggest_data());
SignIn();
// Request a refresh. That should arrive at the loader.
@@ -371,7 +371,7 @@
TEST_F(SearchSuggestServiceTest,
SuggestionSelectedClearsCachedDataAndIssuesRequest) {
SetUserSelectedDefaultSearchProvider("{google:baseURL}");
- ASSERT_EQ(base::nullopt, service()->search_suggest_data());
+ ASSERT_EQ(absl::nullopt, service()->search_suggest_data());
SignIn();
// Request a refresh. That should arrive at the loader.
@@ -402,7 +402,7 @@
TEST_F(SearchSuggestServiceTest, OptOutPreventsRequests) {
SetUserSelectedDefaultSearchProvider("{google:baseURL}");
- ASSERT_EQ(base::nullopt, service()->search_suggest_data());
+ ASSERT_EQ(absl::nullopt, service()->search_suggest_data());
SignIn();
service()->OptOutOfSearchSuggestions();
@@ -410,7 +410,7 @@
// Request a refresh. That should do nothing as the user opted-out.
service()->Refresh();
EXPECT_EQ(0u, loader()->GetCallbackCount());
- EXPECT_EQ(base::nullopt, service()->search_suggest_data());
+ EXPECT_EQ(absl::nullopt, service()->search_suggest_data());
}
TEST_F(SearchSuggestServiceTest, SuggestionAPIsDoNothingWithNonGoogleDSP) {
@@ -433,7 +433,7 @@
}
TEST_F(SearchSuggestServiceTest, UpdateImpressionCapParameters) {
- ASSERT_EQ(base::nullopt, service()->search_suggest_data());
+ ASSERT_EQ(absl::nullopt, service()->search_suggest_data());
SignIn();
// Request a refresh. That should arrive at the loader.
@@ -481,7 +481,7 @@
}
TEST_F(SearchSuggestServiceTest, DontRequestWhenImpressionCapped) {
- ASSERT_EQ(base::nullopt, service()->search_suggest_data());
+ ASSERT_EQ(absl::nullopt, service()->search_suggest_data());
SignIn();
const base::DictionaryValue* dict =
@@ -525,7 +525,7 @@
}
TEST_F(SearchSuggestServiceTest, ImpressionCountResetsAfterTimeout) {
- ASSERT_EQ(base::nullopt, service()->search_suggest_data());
+ ASSERT_EQ(absl::nullopt, service()->search_suggest_data());
SignIn();
const base::DictionaryValue* dict =
@@ -553,7 +553,7 @@
// The impression cap has been reached.
service()->Refresh();
- EXPECT_EQ(base::nullopt, service()->search_suggest_data());
+ EXPECT_EQ(absl::nullopt, service()->search_suggest_data());
RunFor(base::TimeDelta::FromMilliseconds(1000));
@@ -566,7 +566,7 @@
}
TEST_F(SearchSuggestServiceTest, RequestsFreezeOnEmptyResponse) {
- ASSERT_EQ(base::nullopt, service()->search_suggest_data());
+ ASSERT_EQ(absl::nullopt, service()->search_suggest_data());
SignIn();
// Request a refresh. That should arrive at the loader.
@@ -595,7 +595,7 @@
// No request should be made since they are frozen.
service()->Refresh();
- EXPECT_EQ(base::nullopt, service()->search_suggest_data());
+ EXPECT_EQ(absl::nullopt, service()->search_suggest_data());
RunFor(base::TimeDelta::FromMilliseconds(1000));
diff --git a/chrome/browser/search_engines/template_url_service_sync_unittest.cc b/chrome/browser/search_engines/template_url_service_sync_unittest.cc
index 9442e9a0..35e9d5597 100644
--- a/chrome/browser/search_engines/template_url_service_sync_unittest.cc
+++ b/chrome/browser/search_engines/template_url_service_sync_unittest.cc
@@ -100,7 +100,7 @@
~TestChangeProcessor() override;
// Store a copy of all the changes passed in so we can examine them later.
- base::Optional<syncer::ModelError> ProcessSyncChanges(
+ absl::optional<syncer::ModelError> ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) override;
@@ -135,7 +135,7 @@
TestChangeProcessor::~TestChangeProcessor() {
}
-base::Optional<syncer::ModelError> TestChangeProcessor::ProcessSyncChanges(
+absl::optional<syncer::ModelError> TestChangeProcessor::ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) {
if (erroneous_)
@@ -145,7 +145,7 @@
for (auto iter = change_list.begin(); iter != change_list.end(); ++iter)
change_map_.emplace(GetGUID(iter->sync_data()), *iter);
- return base::nullopt;
+ return absl::nullopt;
}
class TestTemplateURLServiceClient : public TemplateURLServiceClient {
@@ -219,15 +219,15 @@
// Executes MergeDataAndStartSyncing and ProcessSyncChanges respectively, and
// verifies the expected number of calls were made to notify observers. These
// will clear out previous notify call counts beforehand.
- base::Optional<syncer::ModelError> MergeAndExpectNotify(
+ absl::optional<syncer::ModelError> MergeAndExpectNotify(
syncer::SyncDataList initial_sync_data,
int expected_notify_count);
- base::Optional<syncer::ModelError> MergeAndExpectNotifyAtLeast(
+ absl::optional<syncer::ModelError> MergeAndExpectNotifyAtLeast(
syncer::SyncDataList initial_sync_data);
- base::Optional<syncer::ModelError> ProcessAndExpectNotify(
+ absl::optional<syncer::ModelError> ProcessAndExpectNotify(
syncer::SyncChangeList changes,
int expected_notify_count);
- base::Optional<syncer::ModelError> ProcessAndExpectNotifyAtLeast(
+ absl::optional<syncer::ModelError> ProcessAndExpectNotifyAtLeast(
syncer::SyncChangeList changes);
protected:
@@ -355,45 +355,45 @@
return std::make_unique<TemplateURL>(data);
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
TemplateURLServiceSyncTest::MergeAndExpectNotify(
syncer::SyncDataList initial_sync_data,
int expected_notify_count) {
test_util_a_->ResetObserverCount();
- base::Optional<syncer::ModelError> error = model()->MergeDataAndStartSyncing(
+ absl::optional<syncer::ModelError> error = model()->MergeDataAndStartSyncing(
syncer::SEARCH_ENGINES, initial_sync_data, PassProcessor(),
CreateAndPassSyncErrorFactory());
EXPECT_EQ(expected_notify_count, test_util_a_->GetObserverCount());
return error;
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
TemplateURLServiceSyncTest::MergeAndExpectNotifyAtLeast(
syncer::SyncDataList initial_sync_data) {
test_util_a_->ResetObserverCount();
- base::Optional<syncer::ModelError> error = model()->MergeDataAndStartSyncing(
+ absl::optional<syncer::ModelError> error = model()->MergeDataAndStartSyncing(
syncer::SEARCH_ENGINES, initial_sync_data, PassProcessor(),
CreateAndPassSyncErrorFactory());
EXPECT_LE(1, test_util_a_->GetObserverCount());
return error;
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
TemplateURLServiceSyncTest::ProcessAndExpectNotify(
syncer::SyncChangeList changes,
int expected_notify_count) {
test_util_a_->ResetObserverCount();
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
model()->ProcessSyncChanges(FROM_HERE, changes);
EXPECT_EQ(expected_notify_count, test_util_a_->GetObserverCount());
return error;
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
TemplateURLServiceSyncTest::ProcessAndExpectNotifyAtLeast(
syncer::SyncChangeList changes) {
test_util_a_->ResetObserverCount();
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
model()->ProcessSyncChanges(FROM_HERE, changes);
EXPECT_LE(1, test_util_a_->GetObserverCount());
return error;
@@ -1133,7 +1133,7 @@
}
TEST_F(TemplateURLServiceSyncTest, StopSyncing) {
- base::Optional<syncer::ModelError> merge_error =
+ absl::optional<syncer::ModelError> merge_error =
MergeAndExpectNotify(CreateInitialSyncData(), 1);
ASSERT_FALSE(merge_error.has_value());
model()->StopSyncing(syncer::SEARCH_ENGINES);
@@ -1144,7 +1144,7 @@
CreateTestTemplateURL(u"newkeyword", "http://new.com", "guid2")));
// Because the sync data is never applied locally, there should not be any
// notification.
- base::Optional<syncer::ModelError> process_error =
+ absl::optional<syncer::ModelError> process_error =
ProcessAndExpectNotify(changes, 0);
EXPECT_TRUE(process_error.has_value());
@@ -1156,7 +1156,7 @@
TEST_F(TemplateURLServiceSyncTest, SyncErrorOnInitialSync) {
processor()->set_erroneous(true);
// Error happens after local changes are applied, still expect a notify.
- base::Optional<syncer::ModelError> merge_error =
+ absl::optional<syncer::ModelError> merge_error =
MergeAndExpectNotify(CreateInitialSyncData(), 1);
EXPECT_TRUE(merge_error.has_value());
@@ -1168,7 +1168,7 @@
syncer::SyncChange::ACTION_UPDATE,
CreateTestTemplateURL(u"newkeyword", "http://new.com", "guid2")));
processor()->set_erroneous(false);
- base::Optional<syncer::ModelError> process_error =
+ absl::optional<syncer::ModelError> process_error =
ProcessAndExpectNotify(changes, 0);
EXPECT_TRUE(process_error.has_value());
@@ -1180,7 +1180,7 @@
TEST_F(TemplateURLServiceSyncTest, SyncErrorOnLaterSync) {
// Ensure that if the SyncProcessor succeeds in the initial merge, but fails
// in future ProcessSyncChanges, we still return an error.
- base::Optional<syncer::ModelError> merge_error =
+ absl::optional<syncer::ModelError> merge_error =
MergeAndExpectNotify(CreateInitialSyncData(), 1);
ASSERT_FALSE(merge_error.has_value());
@@ -1190,7 +1190,7 @@
CreateTestTemplateURL(u"newkeyword", "http://new.com", "guid2")));
processor()->set_erroneous(true);
// Because changes make it to local before the error, still need to notify.
- base::Optional<syncer::ModelError> process_error =
+ absl::optional<syncer::ModelError> process_error =
ProcessAndExpectNotify(changes, 1);
EXPECT_TRUE(process_error.has_value());
}
@@ -1204,7 +1204,7 @@
model()->Add(CreateTestTemplateURL(u"key1", "http://key1.com", "guid1",
base::Time::FromTimeT(10))); // earlier
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
MergeAndExpectNotify(initial_data, 1);
ASSERT_FALSE(error.has_value());
diff --git a/chrome/browser/security_events/security_event_sync_bridge_impl.cc b/chrome/browser/security_events/security_event_sync_bridge_impl.cc
index 59e87043..ac48a85 100644
--- a/chrome/browser/security_events/security_event_sync_bridge_impl.cc
+++ b/chrome/browser/security_events/security_event_sync_bridge_impl.cc
@@ -88,7 +88,7 @@
return syncer::ModelTypeStore::WriteBatch::CreateMetadataChangeList();
}
-base::Optional<syncer::ModelError> SecurityEventSyncBridgeImpl::MergeSyncData(
+absl::optional<syncer::ModelError> SecurityEventSyncBridgeImpl::MergeSyncData(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_data) {
DCHECK(entity_data.empty());
@@ -98,7 +98,7 @@
std::move(entity_data));
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
SecurityEventSyncBridgeImpl::ApplySyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) {
@@ -152,7 +152,7 @@
}
void SecurityEventSyncBridgeImpl::OnStoreCreated(
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::ModelTypeStore> store) {
if (error) {
change_processor()->ReportError(*error);
@@ -167,7 +167,7 @@
void SecurityEventSyncBridgeImpl::OnReadData(
DataCallback callback,
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::ModelTypeStore::RecordList> data_records,
std::unique_ptr<syncer::ModelTypeStore::IdList> missing_id_list) {
OnReadAllData(std::move(callback), error, std::move(data_records));
@@ -175,7 +175,7 @@
void SecurityEventSyncBridgeImpl::OnReadAllData(
DataCallback callback,
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::ModelTypeStore::RecordList> data_records) {
if (error) {
change_processor()->ReportError(*error);
@@ -199,7 +199,7 @@
}
void SecurityEventSyncBridgeImpl::OnReadAllMetadata(
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::MetadataBatch> metadata_batch) {
if (error) {
change_processor()->ReportError(*error);
@@ -209,7 +209,7 @@
}
void SecurityEventSyncBridgeImpl::OnCommit(
- const base::Optional<syncer::ModelError>& error) {
+ const absl::optional<syncer::ModelError>& error) {
if (error) {
change_processor()->ReportError(*error);
}
diff --git a/chrome/browser/security_events/security_event_sync_bridge_impl.h b/chrome/browser/security_events/security_event_sync_bridge_impl.h
index b0b38ea..3833a65 100644
--- a/chrome/browser/security_events/security_event_sync_bridge_impl.h
+++ b/chrome/browser/security_events/security_event_sync_bridge_impl.h
@@ -10,12 +10,12 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/security_events/security_event_sync_bridge.h"
#include "components/sync/model/model_type_change_processor.h"
#include "components/sync/model/model_type_store.h"
#include "components/sync/model/model_type_sync_bridge.h"
#include "components/sync/protocol/sync.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class SecurityEventSyncBridgeImpl : public SecurityEventSyncBridge,
public syncer::ModelTypeSyncBridge {
@@ -33,10 +33,10 @@
// ModelTypeSyncBridge implementation.
std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList()
override;
- base::Optional<syncer::ModelError> MergeSyncData(
+ absl::optional<syncer::ModelError> MergeSyncData(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_data) override;
- base::Optional<syncer::ModelError> ApplySyncChanges(
+ absl::optional<syncer::ModelError> ApplySyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) override;
void GetData(StorageKeyList storage_keys, DataCallback callback) override;
@@ -47,24 +47,24 @@
delete_metadata_change_list) override;
private:
- void OnStoreCreated(const base::Optional<syncer::ModelError>& error,
+ void OnStoreCreated(const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::ModelTypeStore> store);
void OnReadData(
DataCallback callback,
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::ModelTypeStore::RecordList> data_records,
std::unique_ptr<syncer::ModelTypeStore::IdList> missing_id_list);
void OnReadAllData(
DataCallback callback,
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::ModelTypeStore::RecordList> data_records);
- void OnReadAllMetadata(const base::Optional<syncer::ModelError>& error,
+ void OnReadAllMetadata(const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::MetadataBatch> metadata_batch);
- void OnCommit(const base::Optional<syncer::ModelError>& error);
+ void OnCommit(const absl::optional<syncer::ModelError>& error);
std::unique_ptr<syncer::ModelTypeStore> store_;
diff --git a/chrome/browser/send_tab_to_self/desktop_notification_handler.cc b/chrome/browser/send_tab_to_self/desktop_notification_handler.cc
index e3d4103b..8d56eb0 100644
--- a/chrome/browser/send_tab_to_self/desktop_notification_handler.cc
+++ b/chrome/browser/send_tab_to_self/desktop_notification_handler.cc
@@ -85,8 +85,8 @@
Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) {
if (notification_id.find(kDesktopNotificationSharedPrefix)) {
// Launch a new tab for the notification's |origin|,
diff --git a/chrome/browser/send_tab_to_self/desktop_notification_handler.h b/chrome/browser/send_tab_to_self/desktop_notification_handler.h
index fcc49e8..26ae617 100644
--- a/chrome/browser/send_tab_to_self/desktop_notification_handler.h
+++ b/chrome/browser/send_tab_to_self/desktop_notification_handler.h
@@ -41,8 +41,8 @@
void OnClick(Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) override;
// When the user share a tab, a confirmation notification will be shown.
diff --git a/chrome/browser/send_tab_to_self/desktop_notification_handler_unittest.cc b/chrome/browser/send_tab_to_self/desktop_notification_handler_unittest.cc
index 885c374..e50fe2c 100644
--- a/chrome/browser/send_tab_to_self/desktop_notification_handler_unittest.cc
+++ b/chrome/browser/send_tab_to_self/desktop_notification_handler_unittest.cc
@@ -205,7 +205,7 @@
handler.OnClick(profile(), GURL(kDesktopNotificationOrigin),
kDesktopNotificationId, /*action_index=*/1,
- /*reply=*/base::nullopt, base::DoNothing());
+ /*reply=*/absl::nullopt, base::DoNothing());
}
} // namespace
diff --git a/chrome/browser/serial/serial_chooser_context_unittest.cc b/chrome/browser/serial/serial_chooser_context_unittest.cc
index 24b5da1..18a8bd9 100644
--- a/chrome/browser/serial/serial_chooser_context_unittest.cc
+++ b/chrome/browser/serial/serial_chooser_context_unittest.cc
@@ -41,7 +41,7 @@
};
device::mojom::SerialPortInfoPtr CreatePersistentPort(
- base::Optional<std::string> name,
+ absl::optional<std::string> name,
const std::string& persistent_id) {
auto port = device::mojom::SerialPortInfo::New();
port->token = base::UnguessableToken::Create();
@@ -149,7 +149,7 @@
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::SERIAL_GUARD),
+ absl::make_optional(ContentSettingsType::SERIAL_GUARD),
ContentSettingsType::SERIAL_CHOOSER_DATA));
context()->GrantPortPermission(origin, *port);
@@ -170,7 +170,7 @@
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::SERIAL_GUARD),
+ absl::make_optional(ContentSettingsType::SERIAL_GUARD),
ContentSettingsType::SERIAL_CHOOSER_DATA));
EXPECT_CALL(permission_observer(), OnPermissionRevoked(origin));
@@ -198,7 +198,7 @@
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::SERIAL_GUARD),
+ absl::make_optional(ContentSettingsType::SERIAL_GUARD),
ContentSettingsType::SERIAL_CHOOSER_DATA));
context()->GrantPortPermission(origin, *port);
@@ -219,7 +219,7 @@
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::SERIAL_GUARD),
+ absl::make_optional(ContentSettingsType::SERIAL_GUARD),
ContentSettingsType::SERIAL_CHOOSER_DATA));
EXPECT_CALL(permission_observer(), OnPermissionRevoked(origin));
@@ -248,7 +248,7 @@
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::SERIAL_GUARD),
+ absl::make_optional(ContentSettingsType::SERIAL_GUARD),
ContentSettingsType::SERIAL_CHOOSER_DATA));
EXPECT_CALL(permission_observer(), OnPermissionRevoked(origin));
@@ -279,7 +279,7 @@
const auto origin = url::Origin::Create(GURL("https://google.com"));
device::mojom::SerialPortInfoPtr port =
- CreatePersistentPort(/*name=*/base::nullopt, "ABC123");
+ CreatePersistentPort(/*name=*/absl::nullopt, "ABC123");
port_manager().AddPort(port.Clone());
context()->GrantPortPermission(origin, *port);
@@ -287,7 +287,7 @@
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::SERIAL_GUARD),
+ absl::make_optional(ContentSettingsType::SERIAL_GUARD),
ContentSettingsType::SERIAL_CHOOSER_DATA));
EXPECT_CALL(permission_observer(), OnPermissionRevoked(origin));
@@ -325,7 +325,7 @@
EXPECT_CALL(permission_observer(),
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::SERIAL_GUARD),
+ absl::make_optional(ContentSettingsType::SERIAL_GUARD),
ContentSettingsType::SERIAL_CHOOSER_DATA))
.Times(0);
EXPECT_CALL(permission_observer(), OnPermissionRevoked(origin)).Times(0);
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index 954cab9d..7ca421e 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -256,7 +256,7 @@
use_new_window ? 0 : browser->tab_strip_model()->active_index() + 1;
web_contents = chrome::AddRestoredTab(
browser, tab.navigations, tab_index, selected_index,
- tab.extension_app_id, base::nullopt,
+ tab.extension_app_id, absl::nullopt,
disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB, // selected
tab.pinned, base::TimeTicks(), nullptr, tab.user_agent_override,
true /* from_session_restore */);
diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc
index f0ae419..f773fcc3 100644
--- a/chrome/browser/sessions/session_restore_browsertest.cc
+++ b/chrome/browser/sessions/session_restore_browsertest.cc
@@ -917,14 +917,14 @@
// Groups the tabs in |model| according to |specified_groups|.
void CreateTabGroups(TabStripModel* model,
- base::span<const base::Optional<int>> specified_groups) {
+ base::span<const absl::optional<int>> specified_groups) {
ASSERT_EQ(model->count(), static_cast<int>(specified_groups.size()));
// Maps |specified_groups| IDs to actual group IDs in |model|.
base::flat_map<int, tab_groups::TabGroupId> group_map;
for (int i = 0; i < model->count(); ++i) {
- if (specified_groups[i] == base::nullopt)
+ if (specified_groups[i] == absl::nullopt)
continue;
const int specified_group = specified_groups[i].value();
@@ -947,7 +947,7 @@
// Checks that the grouping of tabs in |model| is equivalent to that specified
// in |specified_groups| up to relabeling of the group IDs.
void CheckTabGrouping(TabStripModel* model,
- base::span<const base::Optional<int>> specified_groups) {
+ base::span<const absl::optional<int>> specified_groups) {
ASSERT_EQ(model->count(), static_cast<int>(specified_groups.size()));
// Maps |specified_groups| IDs to actual group IDs in |model|.
@@ -956,8 +956,8 @@
for (int i = 0; i < model->count(); ++i) {
SCOPED_TRACE(i);
- const base::Optional<int> specified_group = specified_groups[i];
- const base::Optional<tab_groups::TabGroupId> actual_group =
+ const absl::optional<int> specified_group = specified_groups[i];
+ const absl::optional<tab_groups::TabGroupId> actual_group =
model->GetTabGroupForTab(i);
// The tab should be grouped iff it's grouped in |specified_groups|.
@@ -976,9 +976,9 @@
}
// Returns the optional group ID for each tab in a vector.
-std::vector<base::Optional<tab_groups::TabGroupId>> GetTabGroups(
+std::vector<absl::optional<tab_groups::TabGroupId>> GetTabGroups(
const TabStripModel* model) {
- std::vector<base::Optional<tab_groups::TabGroupId>> result(model->count());
+ std::vector<absl::optional<tab_groups::TabGroupId>> result(model->count());
for (int i = 0; i < model->count(); ++i)
result[i] = model->GetTabGroupForTab(i);
return result;
@@ -1018,8 +1018,8 @@
IN_PROC_BROWSER_TEST_P(SessionRestoreTabGroupsTest, TabsWithGroups) {
constexpr int kNumTabs = 6;
- const std::array<base::Optional<int>, kNumTabs> group_spec = {
- 0, 0, base::nullopt, base::nullopt, 1, 1};
+ const std::array<absl::optional<int>, kNumTabs> group_spec = {
+ 0, 0, absl::nullopt, absl::nullopt, 1, 1};
// Open |kNumTabs| tabs.
ui_test_utils::NavigateToURL(browser(), GetUrl1());
diff --git a/chrome/browser/sessions/session_restore_delegate.cc b/chrome/browser/sessions/session_restore_delegate.cc
index 52771cd0..70088a5 100644
--- a/chrome/browser/sessions/session_restore_delegate.cc
+++ b/chrome/browser/sessions/session_restore_delegate.cc
@@ -47,7 +47,7 @@
bool is_active,
bool is_app,
bool is_pinned,
- const base::Optional<tab_groups::TabGroupId>& group)
+ const absl::optional<tab_groups::TabGroupId>& group)
: contents_(contents),
is_active_(is_active),
is_app_(is_app),
diff --git a/chrome/browser/sessions/session_restore_delegate.h b/chrome/browser/sessions/session_restore_delegate.h
index d089f6c..76be061 100644
--- a/chrome/browser/sessions/session_restore_delegate.h
+++ b/chrome/browser/sessions/session_restore_delegate.h
@@ -8,11 +8,11 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/token.h"
#include "components/sessions/core/session_id.h"
#include "components/tab_groups/tab_group_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -28,7 +28,7 @@
bool is_active,
bool is_app,
bool is_pinned,
- const base::Optional<tab_groups::TabGroupId>& group);
+ const absl::optional<tab_groups::TabGroupId>& group);
RestoredTab(const RestoredTab& other);
bool operator<(const RestoredTab& right) const;
@@ -38,7 +38,7 @@
bool is_app() const { return is_app_; }
bool is_internal_page() const { return is_internal_page_; }
bool is_pinned() const { return is_pinned_; }
- const base::Optional<tab_groups::TabGroupId>& group() const {
+ const absl::optional<tab_groups::TabGroupId>& group() const {
return group_;
}
@@ -50,7 +50,7 @@
bool is_pinned_;
// The ID for the tab group that this tab belonged to, if any. See
// |TabStripModel::AddToNewGroup()| for more documentation.
- base::Optional<tab_groups::TabGroupId> group_;
+ absl::optional<tab_groups::TabGroupId> group_;
};
static void RestoreTabs(const std::vector<RestoredTab>& tabs,
diff --git a/chrome/browser/sessions/session_restore_observer_unittest.cc b/chrome/browser/sessions/session_restore_observer_unittest.cc
index 0a3edb3..8869627 100644
--- a/chrome/browser/sessions/session_restore_observer_unittest.cc
+++ b/chrome/browser/sessions/session_restore_observer_unittest.cc
@@ -84,7 +84,7 @@
ChromeRenderViewHostTestHarness::SetUp();
SetContents(CreateRestoredWebContents());
restored_tabs_.emplace_back(web_contents(), false, false, false,
- base::nullopt);
+ absl::nullopt);
}
void TearDown() override {
@@ -175,7 +175,7 @@
different_test_contents.emplace_back(CreateRestoredWebContents());
content::WebContents* test_contents = different_test_contents.back().get();
std::vector<RestoredTab> restored_tabs{
- RestoredTab(test_contents, false, false, false, base::nullopt)};
+ RestoredTab(test_contents, false, false, false, absl::nullopt)};
SessionRestore::NotifySessionRestoreStartedLoadingTabs();
SessionRestore::OnWillRestoreTab(test_contents);
@@ -200,7 +200,7 @@
std::vector<RestoredTab> another_restored_tabs;
auto test_contents = CreateRestoredWebContents();
another_restored_tabs.emplace_back(test_contents.get(), false, false, false,
- base::nullopt);
+ absl::nullopt);
SessionRestore::NotifySessionRestoreStartedLoadingTabs();
SessionRestore::OnWillRestoreTab(web_contents());
@@ -228,7 +228,7 @@
std::vector<SessionRestoreDelegate::RestoredTab> restored_tabs{
SessionRestoreDelegate::RestoredTab(test_contents.get(), false, false,
- false, base::nullopt)};
+ false, absl::nullopt)};
resource_coordinator::TabManager* tab_manager =
g_browser_process->GetTabManager();
diff --git a/chrome/browser/sessions/session_restore_stats_collector_unittest.cc b/chrome/browser/sessions/session_restore_stats_collector_unittest.cc
index 1a90fdd..d635ff2 100644
--- a/chrome/browser/sessions/session_restore_stats_collector_unittest.cc
+++ b/chrome/browser/sessions/session_restore_stats_collector_unittest.cc
@@ -186,7 +186,7 @@
content::WebContentsTester::For(contents)->SetLastActiveTime(
base::TimeTicks::Now() - base::TimeDelta::FromMinutes(1));
restored_tabs_.push_back(
- RestoredTab(contents, is_active, false, false, base::nullopt));
+ RestoredTab(contents, is_active, false, false, absl::nullopt));
if (is_active)
Show(restored_tabs_.size() - 1);
}
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index 9dcd8cd..21f4e6f 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -166,7 +166,7 @@
void SessionService::SetTabGroup(const SessionID& window_id,
const SessionID& tab_id,
- base::Optional<tab_groups::TabGroupId> group) {
+ absl::optional<tab_groups::TabGroupId> group) {
if (!ShouldTrackChangesToWindow(window_id))
return;
@@ -421,7 +421,7 @@
const SessionID& window_id,
WebContents* tab,
int index_in_window,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
bool is_pinned,
IdToRange* tab_to_available_range) {
SessionServiceBase::BuildCommandsForTab(window_id, tab, index_in_window,
diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h
index ace8ec2..88c4e08c 100644
--- a/chrome/browser/sessions/session_service.h
+++ b/chrome/browser/sessions/session_service.h
@@ -12,12 +12,12 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/sessions/session_service_base.h"
#include "chrome/browser/ui/browser.h"
#include "components/sessions/core/command_storage_manager_delegate.h"
#include "components/tab_groups/tab_group_id.h"
#include "components/tab_groups/tab_group_visual_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -87,7 +87,7 @@
// multiple windows.
void SetTabGroup(const SessionID& window_id,
const SessionID& tab_id,
- base::Optional<tab_groups::TabGroupId> group);
+ absl::optional<tab_groups::TabGroupId> group);
// Updates the metadata associated with a tab group. |window_id| should be
// the window where the group currently resides. Note that a group can't be
@@ -164,7 +164,7 @@
void BuildCommandsForTab(const SessionID& window_id,
content::WebContents* tab,
int index_in_window,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
bool is_pinned,
IdToRange* tab_to_available_range) override;
diff --git a/chrome/browser/sessions/session_service_base.cc b/chrome/browser/sessions/session_service_base.cc
index 4cc73cd8..5019222 100644
--- a/chrome/browser/sessions/session_service_base.cc
+++ b/chrome/browser/sessions/session_service_base.cc
@@ -277,7 +277,7 @@
if (!ShouldTrackChangesToWindow(session_tab_helper->window_id()))
return;
- BuildCommandsForTab(session_tab_helper->window_id(), tab, -1, base::nullopt,
+ BuildCommandsForTab(session_tab_helper->window_id(), tab, -1, absl::nullopt,
pinned, nullptr);
command_storage_manager()->StartSaveTimer();
}
@@ -486,7 +486,7 @@
const SessionID& window_id,
WebContents* tab,
int index_in_window,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
bool is_pinned,
IdToRange* tab_to_available_range) {
DCHECK(tab);
@@ -606,7 +606,7 @@
for (int i = 0; i < tab_strip->count(); ++i) {
WebContents* tab = tab_strip->GetWebContentsAt(i);
DCHECK(tab);
- const base::Optional<tab_groups::TabGroupId> group_id =
+ const absl::optional<tab_groups::TabGroupId> group_id =
tab_strip->GetTabGroupForTab(i);
BuildCommandsForTab(browser->session_id(), tab, i, group_id,
tab_strip->IsTabPinned(i), tab_to_available_range);
diff --git a/chrome/browser/sessions/session_service_base.h b/chrome/browser/sessions/session_service_base.h
index f143ec7d..a425a31 100644
--- a/chrome/browser/sessions/session_service_base.h
+++ b/chrome/browser/sessions/session_service_base.h
@@ -13,7 +13,6 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/sessions/session_common_utils.h"
@@ -26,6 +25,7 @@
#include "components/sessions/core/session_service_commands.h"
#include "components/sessions/core/tab_restore_service_client.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/ui_base_types.h"
class Profile;
@@ -221,7 +221,7 @@
virtual void BuildCommandsForTab(const SessionID& window_id,
content::WebContents* tab,
int index_in_window,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
bool is_pinned,
IdToRange* tab_to_available_range);
diff --git a/chrome/browser/sessions/session_service_log_browsertest.cc b/chrome/browser/sessions/session_service_log_browsertest.cc
index 4931b3a..c6f9744 100644
--- a/chrome/browser/sessions/session_service_log_browsertest.cc
+++ b/chrome/browser/sessions/session_service_log_browsertest.cc
@@ -8,7 +8,6 @@
#include <memory>
#include "base/command_line.h"
-#include "base/optional.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/profiles/profile.h"
@@ -28,6 +27,7 @@
#include "components/keep_alive_registry/scoped_keep_alive.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
class SessionServiceLogTest : public InProcessBrowserTest {
@@ -55,14 +55,14 @@
SessionStartupPref::SetStartupPref(browser()->profile(), pref);
}
- base::Optional<SessionServiceEvent> FindMostRecentEventOfType(
+ absl::optional<SessionServiceEvent> FindMostRecentEventOfType(
SessionServiceEventLogType type) const {
auto events = GetSessionServiceEvents(profile_);
for (auto i = events.rbegin(); i != events.rend(); ++i) {
if (i->type == type)
return *i;
}
- return base::nullopt;
+ return absl::nullopt;
}
std::list<SessionServiceEvent>::reverse_iterator
diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc
index 485b490..dac080e 100644
--- a/chrome/browser/sessions/session_service_unittest.cc
+++ b/chrome/browser/sessions/session_service_unittest.cc
@@ -14,7 +14,6 @@
#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/location.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
@@ -49,6 +48,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/page_state/page_state.h"
#include "third_party/blink/public/common/user_agent/user_agent_metadata.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -81,14 +81,14 @@
BrowserWithTestWindowTest::TearDown();
}
- base::Optional<SessionServiceEvent> FindMostRecentEventOfType(
+ absl::optional<SessionServiceEvent> FindMostRecentEventOfType(
SessionServiceEventLogType type) {
auto events = GetSessionServiceEvents(browser()->profile());
for (auto i = events.rbegin(); i != events.rend(); ++i) {
if (i->type == type)
return *i;
}
- return base::nullopt;
+ return absl::nullopt;
}
void DestroySessionService() {
@@ -1171,15 +1171,15 @@
// Verify that the recorded tab has no group.
sessions::SessionTab* tab = windows[0]->tabs[0].get();
- EXPECT_EQ(base::nullopt, tab->group);
+ EXPECT_EQ(absl::nullopt, tab->group);
}
TEST_F(SessionServiceTest, TabGroupsSaved) {
const tab_groups::TabGroupId group1 = tab_groups::TabGroupId::GenerateNew();
const tab_groups::TabGroupId group2 = tab_groups::TabGroupId::GenerateNew();
constexpr int kNumTabs = 5;
- const std::array<base::Optional<tab_groups::TabGroupId>, kNumTabs> groups = {
- base::nullopt, group1, group1, base::nullopt, group2};
+ const std::array<absl::optional<tab_groups::TabGroupId>, kNumTabs> groups = {
+ absl::nullopt, group1, group1, absl::nullopt, group2};
// Create |kNumTabs| tabs with group IDs in |groups|.
for (int tab_ndx = 0; tab_ndx < kNumTabs; ++tab_ndx) {
diff --git a/chrome/browser/sessions/tab_loader_unittest.cc b/chrome/browser/sessions/tab_loader_unittest.cc
index 35a0e60..d77cced 100644
--- a/chrome/browser/sessions/tab_loader_unittest.cc
+++ b/chrome/browser/sessions/tab_loader_unittest.cc
@@ -111,7 +111,7 @@
ResourceCoordinatorTabHelper::CreateForWebContents(raw_contents);
restored_tabs_.push_back(
RestoredTab(raw_contents, is_active /* is_active */, false /* is_app */,
- false /* is_pinned */, base::nullopt /* group */));
+ false /* is_pinned */, absl::nullopt /* group */));
// Add the contents to the tab strip model, which becomes the owner.
auto* tab_strip_model = browser()->tab_strip_model();
diff --git a/chrome/browser/sessions/tab_restore_browsertest.cc b/chrome/browser/sessions/tab_restore_browsertest.cc
index 87f6186..afb4fa5a 100644
--- a/chrome/browser/sessions/tab_restore_browsertest.cc
+++ b/chrome/browser/sessions/tab_restore_browsertest.cc
@@ -1419,13 +1419,13 @@
restored_window->tab_strip_model()->group_model();
ASSERT_EQ(tab_count, restored_window->tab_strip_model()->count());
EXPECT_EQ(
- base::make_optional(group1),
+ absl::make_optional(group1),
restored_window->tab_strip_model()->GetTabGroupForTab(tab_count - 3));
EXPECT_EQ(
- base::make_optional(group1),
+ absl::make_optional(group1),
restored_window->tab_strip_model()->GetTabGroupForTab(tab_count - 2));
EXPECT_EQ(
- base::make_optional(group2),
+ absl::make_optional(group2),
restored_window->tab_strip_model()->GetTabGroupForTab(tab_count - 1));
EXPECT_EQ(group1_data,
diff --git a/chrome/browser/sessions/tab_restore_service_unittest.cc b/chrome/browser/sessions/tab_restore_service_unittest.cc
index 44e94d96..0074534 100644
--- a/chrome/browser/sessions/tab_restore_service_unittest.cc
+++ b/chrome/browser/sessions/tab_restore_service_unittest.cc
@@ -14,7 +14,6 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -49,6 +48,7 @@
#include "content/public/test/test_utils.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/user_agent/user_agent_metadata.h"
typedef sessions::TabRestoreService::Entry Entry;
@@ -160,9 +160,9 @@
// |group_visual_data| is also present, sets |group|'s visual data.
void AddWindowWithOneTabToSessionService(
bool pinned,
- base::Optional<tab_groups::TabGroupId> group = base::nullopt,
- base::Optional<tab_groups::TabGroupVisualData> group_visual_data =
- base::nullopt) {
+ absl::optional<tab_groups::TabGroupId> group = absl::nullopt,
+ absl::optional<tab_groups::TabGroupVisualData> group_visual_data =
+ absl::nullopt) {
// Create new window / tab IDs so that these remain distinct.
window_id_ = SessionID::NewUnique();
tab_id_ = SessionID::NewUnique();
@@ -270,7 +270,7 @@
EXPECT_EQ(url3_, tab->navigations[2].virtual_url());
EXPECT_EQ(user_agent_override_.ua_string_override,
tab->user_agent_override.ua_string_override);
- base::Optional<blink::UserAgentMetadata> client_hints_override =
+ absl::optional<blink::UserAgentMetadata> client_hints_override =
blink::UserAgentMetadata::Demarshal(
tab->user_agent_override.opaque_ua_metadata_override);
EXPECT_EQ(user_agent_override_.ua_metadata_override, client_hints_override);
diff --git a/chrome/browser/sharesheet/sharesheet_service.cc b/chrome/browser/sharesheet/sharesheet_service.cc
index be3ade0..72e5f117 100644
--- a/chrome/browser/sharesheet/sharesheet_service.cc
+++ b/chrome/browser/sharesheet/sharesheet_service.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
@@ -22,6 +21,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/services/app_service/public/cpp/intent_util.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/display/types/display_constants.h"
#include "ui/views/view.h"
@@ -310,9 +310,9 @@
auto iter = actions.begin();
while (iter != actions.end()) {
if ((*iter)->ShouldShowAction(intent, contains_hosted_document)) {
- targets.emplace_back(TargetType::kAction, base::nullopt,
+ targets.emplace_back(TargetType::kAction, absl::nullopt,
(*iter)->GetActionName(), (*iter)->GetActionName(),
- base::nullopt, base::nullopt);
+ absl::nullopt, absl::nullopt);
}
++iter;
}
diff --git a/chrome/browser/sharesheet/sharesheet_types.cc b/chrome/browser/sharesheet/sharesheet_types.cc
index d0b62f1..eaa48a6e 100644
--- a/chrome/browser/sharesheet/sharesheet_types.cc
+++ b/chrome/browser/sharesheet/sharesheet_types.cc
@@ -8,11 +8,11 @@
TargetInfo::TargetInfo(
TargetType type,
- const base::Optional<gfx::ImageSkia> icon,
+ const absl::optional<gfx::ImageSkia> icon,
const std::u16string& launch_name,
const std::u16string& display_name,
- const base::Optional<std::u16string>& secondary_display_name,
- const base::Optional<std::string>& activity_name)
+ const absl::optional<std::u16string>& secondary_display_name,
+ const absl::optional<std::string>& activity_name)
: type(type),
icon(icon),
launch_name(launch_name),
diff --git a/chrome/browser/sharesheet/sharesheet_types.h b/chrome/browser/sharesheet/sharesheet_types.h
index 27fa3e7..12b6071 100644
--- a/chrome/browser/sharesheet/sharesheet_types.h
+++ b/chrome/browser/sharesheet/sharesheet_types.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/callback.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/image/image_skia.h"
namespace sharesheet {
@@ -32,11 +32,11 @@
struct TargetInfo {
TargetInfo(TargetType type,
- const base::Optional<gfx::ImageSkia> icon,
+ const absl::optional<gfx::ImageSkia> icon,
const std::u16string& launch_name,
const std::u16string& display_name,
- const base::Optional<std::u16string>& secondary_display_name,
- const base::Optional<std::string>& activity_name);
+ const absl::optional<std::u16string>& secondary_display_name,
+ const absl::optional<std::string>& activity_name);
~TargetInfo();
// Allow move.
@@ -53,7 +53,7 @@
// The icon to be displayed for this target in the sharesheet bubble.
// DIP size must be kIconSize. Only apps will have icons as share actions will
// have vector_icons that get generated when the view is displayed.
- base::Optional<gfx::ImageSkia> icon;
+ absl::optional<gfx::ImageSkia> icon;
// The string used to launch this target. Represents an Android package name
// when the app type is kArc.
@@ -66,11 +66,11 @@
// A secondary string below the |display_name| shown to the user to provide
// additional information for this target. This will be populated by showing
// the activity name in ARC apps.
- base::Optional<std::u16string> secondary_display_name;
+ absl::optional<std::u16string> secondary_display_name;
// The activity of the app for the target. This only applies when the app type
// is kArc.
- base::Optional<std::string> activity_name;
+ absl::optional<std::string> activity_name;
};
using DeliveredCallback = base::OnceCallback<void(SharesheetResult success)>;
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_context_menu_observer.h b/chrome/browser/sharing/click_to_call/click_to_call_context_menu_observer.h
index 586c5143..8d58f24 100644
--- a/chrome/browser/sharing/click_to_call/click_to_call_context_menu_observer.h
+++ b/chrome/browser/sharing/click_to_call/click_to_call_context_menu_observer.h
@@ -11,9 +11,9 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/sharing/click_to_call/click_to_call_metrics.h"
#include "components/renderer_context_menu/render_view_context_menu_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/models/simple_menu_model.h"
namespace syncer {
@@ -74,7 +74,7 @@
std::string phone_number_;
std::string selection_text_;
- base::Optional<SharingClickToCallEntryPoint> entry_point_;
+ absl::optional<SharingClickToCallEntryPoint> entry_point_;
std::unique_ptr<ui::SimpleMenuModel> sub_menu_model_;
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_message_handler_android_unittest.cc b/chrome/browser/sharing/click_to_call/click_to_call_message_handler_android_unittest.cc
index fc4e62a..e6e9e5b 100644
--- a/chrome/browser/sharing/click_to_call/click_to_call_message_handler_android_unittest.cc
+++ b/chrome/browser/sharing/click_to_call/click_to_call_message_handler_android_unittest.cc
@@ -8,10 +8,10 @@
#include <string>
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "chrome/browser/sharing/proto/click_to_call_message.pb.h"
#include "chrome/browser/sharing/proto/sharing_message.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -22,7 +22,7 @@
TestClickToCallMessageHandler() = default;
~TestClickToCallMessageHandler() override = default;
- base::Optional<std::string> last_phone_number() { return last_phone_number_; }
+ absl::optional<std::string> last_phone_number() { return last_phone_number_; }
protected:
void HandlePhoneNumber(const std::string& phone_number) override {
@@ -30,7 +30,7 @@
}
private:
- base::Optional<std::string> last_phone_number_;
+ absl::optional<std::string> last_phone_number_;
};
} // namespace
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.cc b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.cc
index b8b9469..0a1477ee 100644
--- a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.cc
+++ b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.cc
@@ -40,7 +40,7 @@
// static
void ClickToCallUiController::ShowDialog(
content::WebContents* web_contents,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
const GURL& url,
bool hide_default_handler) {
auto* controller = GetOrCreateFromWebContents(web_contents);
@@ -131,9 +131,9 @@
sharing_message.mutable_click_to_call_message()->set_phone_number(
phone_number);
- SendMessageToDevice(device, /*response_timeout=*/base::nullopt,
+ SendMessageToDevice(device, /*response_timeout=*/absl::nullopt,
std::move(sharing_message),
- /*callback=*/base::nullopt);
+ /*callback=*/absl::nullopt);
}
void ClickToCallUiController::OnAppChosen(const SharingApp& app) {
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.h b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.h
index 9b3118f..1f93c771 100644
--- a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.h
+++ b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller.h
@@ -11,12 +11,12 @@
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/sharing/click_to_call/click_to_call_metrics.h"
#include "chrome/browser/sharing/sharing_service.h"
#include "chrome/browser/sharing/sharing_ui_controller.h"
#include "chrome/browser/ui/page_action/page_action_icon_type.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -31,7 +31,7 @@
static ClickToCallUiController* GetOrCreateFromWebContents(
content::WebContents* web_contents);
static void ShowDialog(content::WebContents* web_contents,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
const GURL& url,
bool hide_default_handler);
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller_unittest.cc b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller_unittest.cc
index e881aba..9cf02a5 100644
--- a/chrome/browser/sharing/click_to_call/click_to_call_ui_controller_unittest.cc
+++ b/chrome/browser/sharing/click_to_call/click_to_call_ui_controller_unittest.cc
@@ -50,7 +50,7 @@
return std::make_unique<testing::NiceMock<MockSharingService>>();
}));
ClickToCallUiController::ShowDialog(
- web_contents_.get(), /*initiating_origin=*/base::nullopt,
+ web_contents_.get(), /*initiating_origin=*/absl::nullopt,
GURL(base::StrCat({"tel:", kPhoneNumber})), false);
controller_ = ClickToCallUiController::GetOrCreateFromWebContents(
web_contents_.get());
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_utils.cc b/chrome/browser/sharing/click_to_call/click_to_call_utils.cc
index a52c792..0ae33c7 100644
--- a/chrome/browser/sharing/click_to_call/click_to_call_utils.cc
+++ b/chrome/browser/sharing/click_to_call/click_to_call_utils.cc
@@ -7,7 +7,6 @@
#include <algorithm>
#include <cctype>
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
@@ -18,6 +17,7 @@
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_context.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/re2/src/re2/re2.h"
#include "url/url_constants.h"
#include "url/url_util.h"
@@ -51,14 +51,14 @@
}
// Returns the first possible phone number in |selection_text| given the
-// |regex_variant| to be used or base::nullopt if the regex did not match.
-base::Optional<std::string> ExtractPhoneNumber(
+// |regex_variant| to be used or absl::nullopt if the regex did not match.
+absl::optional<std::string> ExtractPhoneNumber(
const std::string& selection_text) {
std::string parsed_number;
const re2::RE2& regex = GetPhoneNumberRegex();
if (!re2::RE2::PartialMatch(selection_text, regex, &parsed_number))
- return base::nullopt;
+ return absl::nullopt;
return base::UTF16ToUTF8(
base::TrimWhitespace(base::UTF8ToUTF16(parsed_number), base::TRIM_ALL));
@@ -83,21 +83,21 @@
IsUrlSafeForClickToCall(url) && IsClickToCallEnabled(browser_context);
}
-base::Optional<std::string> ExtractPhoneNumberForClickToCall(
+absl::optional<std::string> ExtractPhoneNumberForClickToCall(
content::BrowserContext* browser_context,
const std::string& selection_text) {
DCHECK(!selection_text.empty());
if (selection_text.size() > kSelectionTextMaxLength)
- return base::nullopt;
+ return absl::nullopt;
int digits = std::count_if(selection_text.begin(), selection_text.end(),
[](char c) { return std::isdigit(c); });
if (digits > kSelectionTextMaxDigits)
- return base::nullopt;
+ return absl::nullopt;
if (!IsClickToCallEnabled(browser_context))
- return base::nullopt;
+ return absl::nullopt;
return ExtractPhoneNumber(selection_text);
}
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_utils.h b/chrome/browser/sharing/click_to_call/click_to_call_utils.h
index 2edaadf..ba09eac 100644
--- a/chrome/browser/sharing/click_to_call/click_to_call_utils.h
+++ b/chrome/browser/sharing/click_to_call/click_to_call_utils.h
@@ -7,7 +7,7 @@
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace content {
@@ -19,8 +19,8 @@
const GURL& url);
// Returns the first possible phone number in |selection_text| if click to call
-// should be offered. Otherwise returns base::nullopt.
-base::Optional<std::string> ExtractPhoneNumberForClickToCall(
+// should be offered. Otherwise returns absl::nullopt.
+absl::optional<std::string> ExtractPhoneNumberForClickToCall(
content::BrowserContext* browser_context,
const std::string& selection_text);
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_utils_unittest.cc b/chrome/browser/sharing/click_to_call/click_to_call_utils_unittest.cc
index 41dba07e..ffed1b36f 100644
--- a/chrome/browser/sharing/click_to_call/click_to_call_utils_unittest.cc
+++ b/chrome/browser/sharing/click_to_call/click_to_call_utils_unittest.cc
@@ -59,7 +59,7 @@
use_incognito_profile
? profile_.GetPrimaryOTRProfile(/*create_if_needed=*/true)
: &profile_;
- base::Optional<std::string> phone_number =
+ absl::optional<std::string> phone_number =
ExtractPhoneNumberForClickToCall(profile_to_use, selection_text);
EXPECT_FALSE(phone_number.has_value())
<< " Found phone number: " << phone_number.value()
@@ -160,9 +160,9 @@
expectations.emplace("78.0.3904.108", "78.0.3904.108");
for (auto& expectation : expectations) {
- base::Optional<std::string> phone_number =
+ absl::optional<std::string> phone_number =
ExtractPhoneNumberForClickToCall(&profile_, expectation.first);
- ASSERT_NE(base::nullopt, phone_number);
+ ASSERT_NE(absl::nullopt, phone_number);
EXPECT_EQ(expectation.second, phone_number.value());
}
}
@@ -192,19 +192,19 @@
TEST_F(ClickToCallUtilsTest, SelectionText_Length) {
// Expect text length of 30 to pass.
- EXPECT_NE(base::nullopt, ExtractPhoneNumberForClickToCall(
+ EXPECT_NE(absl::nullopt, ExtractPhoneNumberForClickToCall(
&profile_, " +1 2 3 4 5 6 7 8 9 0 1 2 3 45"));
// Expect text length of 31 to fail.
- EXPECT_EQ(base::nullopt, ExtractPhoneNumberForClickToCall(
+ EXPECT_EQ(absl::nullopt, ExtractPhoneNumberForClickToCall(
&profile_, " +1 2 3 4 5 6 7 8 9 0 1 2 3 4 5"));
}
TEST_F(ClickToCallUtilsTest, SelectionText_Digits) {
// Expect text with 15 digits to pass.
- EXPECT_NE(base::nullopt,
+ EXPECT_NE(absl::nullopt,
ExtractPhoneNumberForClickToCall(&profile_, "+123456789012345"));
// Expect text with 16 digits to fail.
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
ExtractPhoneNumberForClickToCall(&profile_, "+1234567890123456"));
}
diff --git a/chrome/browser/sharing/fake_device_info.cc b/chrome/browser/sharing/fake_device_info.cc
index 9a7abb3e4..8568c09e 100644
--- a/chrome/browser/sharing/fake_device_info.cc
+++ b/chrome/browser/sharing/fake_device_info.cc
@@ -9,7 +9,7 @@
std::unique_ptr<syncer::DeviceInfo> CreateFakeDeviceInfo(
const std::string& guid,
const std::string& name,
- const base::Optional<syncer::DeviceInfo::SharingInfo>& sharing_info,
+ const absl::optional<syncer::DeviceInfo::SharingInfo>& sharing_info,
sync_pb::SyncEnums_DeviceType device_type,
const std::string& manufacturer_name,
const std::string& model_name,
@@ -20,7 +20,7 @@
manufacturer_name, model_name, full_hardware_class,
last_updated_timestamp, syncer::DeviceInfoUtil::GetPulseInterval(),
/*send_tab_to_self_receiving_enabled=*/false, sharing_info,
- /*paask_info=*/base::nullopt,
+ /*paask_info=*/absl::nullopt,
/*fcm_registration_token=*/std::string(),
/*interested_data_types=*/syncer::ModelTypeSet());
}
diff --git a/chrome/browser/sharing/fake_device_info.h b/chrome/browser/sharing/fake_device_info.h
index 8ff746eb..51ab1cd 100644
--- a/chrome/browser/sharing/fake_device_info.h
+++ b/chrome/browser/sharing/fake_device_info.h
@@ -8,10 +8,10 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "base/time/time.h"
#include "components/sync/protocol/sync_enums.pb.h"
#include "components/sync_device_info/device_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace syncer {
class DeviceInfo;
@@ -20,8 +20,8 @@
std::unique_ptr<syncer::DeviceInfo> CreateFakeDeviceInfo(
const std::string& guid,
const std::string& name = "name",
- const base::Optional<syncer::DeviceInfo::SharingInfo>& sharing_info =
- base::nullopt,
+ const absl::optional<syncer::DeviceInfo::SharingInfo>& sharing_info =
+ absl::nullopt,
sync_pb::SyncEnums_DeviceType device_type =
sync_pb::SyncEnums_DeviceType_TYPE_LINUX,
const std::string& manufacturer_name = "manufacturer",
diff --git a/chrome/browser/sharing/shared_clipboard/remote_copy_message_handler_unittest.cc b/chrome/browser/sharing/shared_clipboard/remote_copy_message_handler_unittest.cc
index 9ece03c..b1adbfa 100644
--- a/chrome/browser/sharing/shared_clipboard/remote_copy_message_handler_unittest.cc
+++ b/chrome/browser/sharing/shared_clipboard/remote_copy_message_handler_unittest.cc
@@ -133,7 +133,7 @@
content::URLLoaderInterceptor url_loader_interceptor_;
data_decoder::test::InProcessDataDecoder in_process_data_decoder_;
std::string image_url_;
- base::Optional<SkBitmap> image_;
+ absl::optional<SkBitmap> image_;
};
TEST_F(RemoteCopyMessageHandlerTest, NotificationWithoutDeviceName) {
diff --git a/chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer.h b/chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer.h
index 632d2ec..664625db 100644
--- a/chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer.h
+++ b/chrome/browser/sharing/shared_clipboard/shared_clipboard_context_menu_observer.h
@@ -11,8 +11,8 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "components/renderer_context_menu/render_view_context_menu_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/models/simple_menu_model.h"
namespace syncer {
diff --git a/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.cc b/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.cc
index ed2a47d..b80a75ff 100644
--- a/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.cc
+++ b/chrome/browser/sharing/shared_clipboard/shared_clipboard_ui_controller.cc
@@ -77,9 +77,9 @@
sharing_message.mutable_shared_clipboard_message()->set_text(
base::UTF16ToUTF8(text_));
- SendMessageToDevice(device, /*response_timeout=*/base::nullopt,
+ SendMessageToDevice(device, /*response_timeout=*/absl::nullopt,
std::move(sharing_message),
- /*callback=*/base::nullopt);
+ /*callback=*/absl::nullopt);
}
void SharedClipboardUiController::OnAppChosen(const SharingApp& app) {
diff --git a/chrome/browser/sharing/sharing_device_registration.cc b/chrome/browser/sharing/sharing_device_registration.cc
index 5b6304ff..7bf0496 100644
--- a/chrome/browser/sharing/sharing_device_registration.cc
+++ b/chrome/browser/sharing/sharing_device_registration.cc
@@ -50,12 +50,12 @@
SharingDeviceRegistration::~SharingDeviceRegistration() = default;
void SharingDeviceRegistration::RegisterDevice(RegistrationCallback callback) {
- base::Optional<std::string> authorized_entity = GetAuthorizationEntity();
+ absl::optional<std::string> authorized_entity = GetAuthorizationEntity();
if (!authorized_entity) {
OnVapidTargetInfoRetrieved(std::move(callback),
- /*authorized_entity=*/base::nullopt,
+ /*authorized_entity=*/absl::nullopt,
SharingDeviceRegistrationResult::kSuccess,
- /*vapid_target_info=*/base::nullopt);
+ /*vapid_target_info=*/absl::nullopt);
return;
}
@@ -97,13 +97,13 @@
case InstanceID::SERVER_ERROR:
case InstanceID::ASYNC_OPERATION_PENDING:
std::move(callback).Run(
- SharingDeviceRegistrationResult::kFcmTransientError, base::nullopt);
+ SharingDeviceRegistrationResult::kFcmTransientError, absl::nullopt);
break;
case InstanceID::INVALID_PARAMETER:
case InstanceID::UNKNOWN_ERROR:
case InstanceID::DISABLED:
std::move(callback).Run(SharingDeviceRegistrationResult::kFcmFatalError,
- base::nullopt);
+ absl::nullopt);
break;
}
}
@@ -115,15 +115,15 @@
std::string auth_secret) {
std::move(callback).Run(
SharingDeviceRegistrationResult::kSuccess,
- base::make_optional(syncer::DeviceInfo::SharingTargetInfo{
+ absl::make_optional(syncer::DeviceInfo::SharingTargetInfo{
fcm_token, p256dh, auth_secret}));
}
void SharingDeviceRegistration::OnVapidTargetInfoRetrieved(
RegistrationCallback callback,
- base::Optional<std::string> authorized_entity,
+ absl::optional<std::string> authorized_entity,
SharingDeviceRegistrationResult result,
- base::Optional<syncer::DeviceInfo::SharingTargetInfo> vapid_target_info) {
+ absl::optional<syncer::DeviceInfo::SharingTargetInfo> vapid_target_info) {
if (result != SharingDeviceRegistrationResult::kSuccess) {
std::move(callback).Run(result);
return;
@@ -133,7 +133,7 @@
OnSharingTargetInfoRetrieved(
std::move(callback), std::move(authorized_entity),
std::move(vapid_target_info), SharingDeviceRegistrationResult::kSuccess,
- /*sharing_target_info=*/base::nullopt);
+ /*sharing_target_info=*/absl::nullopt);
return;
}
@@ -148,10 +148,10 @@
void SharingDeviceRegistration::OnSharingTargetInfoRetrieved(
RegistrationCallback callback,
- base::Optional<std::string> authorized_entity,
- base::Optional<syncer::DeviceInfo::SharingTargetInfo> vapid_target_info,
+ absl::optional<std::string> authorized_entity,
+ absl::optional<syncer::DeviceInfo::SharingTargetInfo> vapid_target_info,
SharingDeviceRegistrationResult result,
- base::Optional<syncer::DeviceInfo::SharingTargetInfo> sharing_target_info) {
+ absl::optional<syncer::DeviceInfo::SharingTargetInfo> sharing_target_info) {
if (result != SharingDeviceRegistrationResult::kSuccess) {
std::move(callback).Run(result);
return;
@@ -247,22 +247,22 @@
NOTREACHED();
}
-base::Optional<std::string> SharingDeviceRegistration::GetAuthorizationEntity()
+absl::optional<std::string> SharingDeviceRegistration::GetAuthorizationEntity()
const {
// TODO(himanshujaju) : Extract a static function to convert ECPrivateKey* to
// Base64PublicKey in library.
crypto::ECPrivateKey* vapid_key = vapid_key_manager_->GetOrCreateKey();
if (!vapid_key)
- return base::nullopt;
+ return absl::nullopt;
std::string public_key;
if (!gcm::GetRawPublicKey(*vapid_key, &public_key))
- return base::nullopt;
+ return absl::nullopt;
std::string base64_public_key;
base::Base64UrlEncode(public_key, base::Base64UrlEncodePolicy::OMIT_PADDING,
&base64_public_key);
- return base::make_optional(std::move(base64_public_key));
+ return absl::make_optional(std::move(base64_public_key));
}
std::set<SharingSpecificFields::EnabledFeatures>
diff --git a/chrome/browser/sharing/sharing_device_registration.h b/chrome/browser/sharing/sharing_device_registration.h
index 4c8d8765..26a7961 100644
--- a/chrome/browser/sharing/sharing_device_registration.h
+++ b/chrome/browser/sharing/sharing_device_registration.h
@@ -11,10 +11,10 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "components/gcm_driver/instance_id/instance_id.h"
#include "components/sync/protocol/device_info_specifics.pb.h"
#include "components/sync_device_info/device_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefService;
@@ -38,7 +38,7 @@
base::OnceCallback<void(SharingDeviceRegistrationResult)>;
using TargetInfoCallback = base::OnceCallback<void(
SharingDeviceRegistrationResult,
- base::Optional<syncer::DeviceInfo::SharingTargetInfo>)>;
+ absl::optional<syncer::DeviceInfo::SharingTargetInfo>)>;
SharingDeviceRegistration(PrefService* pref_service,
SharingSyncPreference* prefs,
@@ -90,16 +90,16 @@
void OnVapidTargetInfoRetrieved(
RegistrationCallback callback,
- base::Optional<std::string> authorized_entity,
+ absl::optional<std::string> authorized_entity,
SharingDeviceRegistrationResult result,
- base::Optional<syncer::DeviceInfo::SharingTargetInfo> vapid_target_info);
+ absl::optional<syncer::DeviceInfo::SharingTargetInfo> vapid_target_info);
void OnSharingTargetInfoRetrieved(
RegistrationCallback callback,
- base::Optional<std::string> authorized_entity,
- base::Optional<syncer::DeviceInfo::SharingTargetInfo> vapid_target_info,
+ absl::optional<std::string> authorized_entity,
+ absl::optional<syncer::DeviceInfo::SharingTargetInfo> vapid_target_info,
SharingDeviceRegistrationResult result,
- base::Optional<syncer::DeviceInfo::SharingTargetInfo>
+ absl::optional<syncer::DeviceInfo::SharingTargetInfo>
sharing_target_info);
void OnVapidFCMTokenDeleted(RegistrationCallback callback,
@@ -112,7 +112,7 @@
instance_id::InstanceID::Result result);
// Returns the authorization entity for FCM registration.
- base::Optional<std::string> GetAuthorizationEntity() const;
+ absl::optional<std::string> GetAuthorizationEntity() const;
// Computes and returns a set of all enabled features on the device.
// |supports_vapid|: If set to true, then enabled features with VAPID suffix
@@ -126,7 +126,7 @@
VapidKeyManager* vapid_key_manager_;
instance_id::InstanceIDDriver* instance_id_driver_;
syncer::SyncService* sync_service_;
- base::Optional<std::set<sync_pb::SharingSpecificFields_EnabledFeatures>>
+ absl::optional<std::set<sync_pb::SharingSpecificFields_EnabledFeatures>>
enabled_features_testing_value_;
base::WeakPtrFactory<SharingDeviceRegistration> weak_ptr_factory_{this};
diff --git a/chrome/browser/sharing/sharing_device_registration_unittest.cc b/chrome/browser/sharing/sharing_device_registration_unittest.cc
index 587780d..b68995d 100644
--- a/chrome/browser/sharing/sharing_device_registration_unittest.cc
+++ b/chrome/browser/sharing/sharing_device_registration_unittest.cc
@@ -232,8 +232,8 @@
SharingDeviceRegistration sharing_device_registration_;
// callback results
- base::Optional<syncer::DeviceInfo::SharingInfo> local_sharing_info_;
- base::Optional<SharingSyncPreference::FCMRegistration> fcm_registration_;
+ absl::optional<syncer::DeviceInfo::SharingInfo> local_sharing_info_;
+ absl::optional<SharingSyncPreference::FCMRegistration> fcm_registration_;
SharingDeviceRegistrationResult result_;
};
diff --git a/chrome/browser/sharing/sharing_device_source_sync.h b/chrome/browser/sharing/sharing_device_source_sync.h
index 1b8597a..c4bc3fe6 100644
--- a/chrome/browser/sharing/sharing_device_source_sync.h
+++ b/chrome/browser/sharing/sharing_device_source_sync.h
@@ -65,7 +65,7 @@
// The personalized name is stored for deduplicating devices running older
// clients.
- base::Optional<std::string> personalizable_local_device_name_;
+ absl::optional<std::string> personalizable_local_device_name_;
base::WeakPtrFactory<SharingDeviceSourceSync> weak_ptr_factory_{this};
diff --git a/chrome/browser/sharing/sharing_dialog_data.h b/chrome/browser/sharing/sharing_dialog_data.h
index 074a1f1..8091f16 100644
--- a/chrome/browser/sharing/sharing_dialog_data.h
+++ b/chrome/browser/sharing/sharing_dialog_data.h
@@ -10,10 +10,10 @@
#include <vector>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/sharing/sharing_app.h"
#include "chrome/browser/sharing/sharing_metrics.h"
#include "components/sync_device_info/device_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
class SharingDialog;
@@ -47,9 +47,9 @@
std::u16string error_text;
int help_text_id = 0;
int help_text_origin_id = 0;
- base::Optional<HeaderIcons> header_icons;
+ absl::optional<HeaderIcons> header_icons;
int origin_text_id = 0;
- base::Optional<url::Origin> initiating_origin;
+ absl::optional<url::Origin> initiating_origin;
base::OnceCallback<void(const syncer::DeviceInfo&)> device_callback;
base::OnceCallback<void(const SharingApp&)> app_callback;
diff --git a/chrome/browser/sharing/sharing_fcm_handler.cc b/chrome/browser/sharing/sharing_fcm_handler.cc
index 7bc65de..55517a9 100644
--- a/chrome/browser/sharing/sharing_fcm_handler.cc
+++ b/chrome/browser/sharing/sharing_fcm_handler.cc
@@ -147,20 +147,20 @@
// TODO: Handle GCM store reset.
}
-base::Optional<chrome_browser_sharing::FCMChannelConfiguration>
+absl::optional<chrome_browser_sharing::FCMChannelConfiguration>
SharingFCMHandler::GetFCMChannel(
const chrome_browser_sharing::SharingMessage& original_message) {
if (!original_message.has_fcm_channel_configuration())
- return base::nullopt;
+ return absl::nullopt;
return original_message.fcm_channel_configuration();
}
-base::Optional<chrome_browser_sharing::ServerChannelConfiguration>
+absl::optional<chrome_browser_sharing::ServerChannelConfiguration>
SharingFCMHandler::GetServerChannel(
const chrome_browser_sharing::SharingMessage& original_message) {
if (!original_message.has_server_channel_configuration())
- return base::nullopt;
+ return absl::nullopt;
return original_message.server_channel_configuration();
}
@@ -178,8 +178,8 @@
void SharingFCMHandler::SendAckMessage(
std::string original_message_id,
chrome_browser_sharing::MessageType original_message_type,
- base::Optional<chrome_browser_sharing::FCMChannelConfiguration> fcm_channel,
- base::Optional<chrome_browser_sharing::ServerChannelConfiguration>
+ absl::optional<chrome_browser_sharing::FCMChannelConfiguration> fcm_channel,
+ absl::optional<chrome_browser_sharing::ServerChannelConfiguration>
server_channel,
SharingDevicePlatform sender_device_type,
base::TimeTicks message_received_time,
@@ -233,7 +233,7 @@
SharingDevicePlatform sender_device_type,
int trace_id,
SharingSendMessageResult result,
- base::Optional<std::string> message_id,
+ absl::optional<std::string> message_id,
SharingChannelType channel_type) {
LogSendSharingAckMessageResult(original_message_type, sender_device_type,
channel_type, result);
diff --git a/chrome/browser/sharing/sharing_fcm_handler.h b/chrome/browser/sharing/sharing_fcm_handler.h
index c2bf069..96882b2 100644
--- a/chrome/browser/sharing/sharing_fcm_handler.h
+++ b/chrome/browser/sharing/sharing_fcm_handler.h
@@ -11,12 +11,12 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/sharing/proto/sharing_message.pb.h"
#include "chrome/browser/sharing/sharing_send_message_result.h"
#include "components/gcm_driver/gcm_app_handler.h"
#include "components/sync_device_info/device_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace gcm {
class GCMDriver;
@@ -67,10 +67,10 @@
void OnMessagesDeleted(const std::string& app_id) override;
private:
- base::Optional<chrome_browser_sharing::FCMChannelConfiguration> GetFCMChannel(
+ absl::optional<chrome_browser_sharing::FCMChannelConfiguration> GetFCMChannel(
const chrome_browser_sharing::SharingMessage& original_message);
- base::Optional<chrome_browser_sharing::ServerChannelConfiguration>
+ absl::optional<chrome_browser_sharing::ServerChannelConfiguration>
GetServerChannel(
const chrome_browser_sharing::SharingMessage& original_message);
@@ -81,9 +81,9 @@
void SendAckMessage(
std::string original_message_id,
chrome_browser_sharing::MessageType original_message_type,
- base::Optional<chrome_browser_sharing::FCMChannelConfiguration>
+ absl::optional<chrome_browser_sharing::FCMChannelConfiguration>
fcm_channel,
- base::Optional<chrome_browser_sharing::ServerChannelConfiguration>
+ absl::optional<chrome_browser_sharing::ServerChannelConfiguration>
server_channel,
SharingDevicePlatform sender_device_type,
base::TimeTicks message_received_time,
@@ -95,7 +95,7 @@
SharingDevicePlatform sender_device_type,
int trace_id,
SharingSendMessageResult result,
- base::Optional<std::string> message_id,
+ absl::optional<std::string> message_id,
SharingChannelType channel_type);
gcm::GCMDriver* const gcm_driver_;
diff --git a/chrome/browser/sharing/sharing_fcm_sender.cc b/chrome/browser/sharing/sharing_fcm_sender.cc
index 8b4b797..ed0b292 100644
--- a/chrome/browser/sharing/sharing_fcm_sender.cc
+++ b/chrome/browser/sharing/sharing_fcm_sender.cc
@@ -48,14 +48,14 @@
auto fcm_configuration = GetFCMChannel(device);
if (!fcm_configuration) {
std::move(callback).Run(SharingSendMessageResult::kDeviceNotFound,
- /*message_id=*/base::nullopt,
+ /*message_id=*/absl::nullopt,
SharingChannelType::kUnknown);
return;
}
if (!SetMessageSenderInfo(&message)) {
std::move(callback).Run(SharingSendMessageResult::kInternalError,
- /*message_id=*/base::nullopt,
+ /*message_id=*/absl::nullopt,
SharingChannelType::kUnknown);
return;
}
@@ -96,12 +96,12 @@
}
if (canSendViaVapid) {
- base::Optional<SharingSyncPreference::FCMRegistration> fcm_registration =
+ absl::optional<SharingSyncPreference::FCMRegistration> fcm_registration =
sync_preference_->GetFCMRegistration();
if (!fcm_registration || !fcm_registration->authorized_entity) {
LOG(ERROR) << "Unable to retrieve FCM registration";
std::move(callback).Run(SharingSendMessageResult::kInternalError,
- /*message_id=*/base::nullopt,
+ /*message_id=*/absl::nullopt,
SharingChannelType::kUnknown);
return;
}
@@ -117,7 +117,7 @@
}
std::move(callback).Run(SharingSendMessageResult::kDeviceNotFound,
- /*message_id=*/base::nullopt,
+ /*message_id=*/absl::nullopt,
SharingChannelType::kUnknown);
}
@@ -130,7 +130,7 @@
if (!base::FeatureList::IsEnabled(kSharingSendViaSync) ||
!sync_service_->GetActiveDataTypes().Has(syncer::SHARING_MESSAGE)) {
std::move(callback).Run(SharingSendMessageResult::kInternalError,
- /*message_id=*/base::nullopt,
+ /*message_id=*/absl::nullopt,
SharingChannelType::kServer);
return;
}
@@ -168,7 +168,7 @@
if (result != gcm::GCMEncryptionResult::ENCRYPTED_DRAFT_08) {
LOG(ERROR) << "Unable to encrypt message";
std::move(callback).Run(SharingSendMessageResult::kEncryptionError,
- /*message_id=*/base::nullopt, channel_type);
+ /*message_id=*/absl::nullopt, channel_type);
return;
}
@@ -186,7 +186,7 @@
if (!vapid_key) {
LOG(ERROR) << "Unable to retrieve VAPID key";
std::move(callback).Run(SharingSendMessageResult::kInternalError,
- /*message_id=*/base::nullopt,
+ /*message_id=*/absl::nullopt,
SharingChannelType::kFcmVapid);
return;
}
@@ -205,7 +205,7 @@
void SharingFCMSender::OnMessageSentToVapidTarget(
SendMessageCallback callback,
SendWebPushMessageResult result,
- base::Optional<std::string> message_id) {
+ absl::optional<std::string> message_id) {
TRACE_EVENT1("sharing", "SharingFCMSender::OnMessageSentToVapidTarget",
"result", result);
@@ -247,7 +247,7 @@
// Double check that SHARING_MESSAGE is syncing.
if (!sync_service_->GetActiveDataTypes().Has(syncer::SHARING_MESSAGE)) {
std::move(callback).Run(SharingSendMessageResult::kInternalError,
- /*message_id=*/base::nullopt,
+ /*message_id=*/absl::nullopt,
SharingChannelType::kFcmSenderId);
return;
}
@@ -277,7 +277,7 @@
// Double check that SHARING_MESSAGE is syncing.
if (!sync_service_->GetActiveDataTypes().Has(syncer::SHARING_MESSAGE)) {
std::move(callback).Run(SharingSendMessageResult::kInternalError,
- /*message_id=*/base::nullopt,
+ /*message_id=*/absl::nullopt,
SharingChannelType::kServer);
return;
}
@@ -336,7 +336,7 @@
}
bool SharingFCMSender::SetMessageSenderInfo(SharingMessage* message) {
- base::Optional<syncer::DeviceInfo::SharingInfo> sharing_info =
+ absl::optional<syncer::DeviceInfo::SharingInfo> sharing_info =
local_device_info_provider_->GetLocalDeviceInfo()->sharing_info();
if (!sharing_info)
return false;
diff --git a/chrome/browser/sharing/sharing_fcm_sender.h b/chrome/browser/sharing/sharing_fcm_sender.h
index 2e9f338..a446e4f 100644
--- a/chrome/browser/sharing/sharing_fcm_sender.h
+++ b/chrome/browser/sharing/sharing_fcm_sender.h
@@ -11,13 +11,13 @@
#include "base/callback_forward.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/sharing/proto/sharing_message.pb.h"
#include "chrome/browser/sharing/sharing_message_sender.h"
#include "chrome/browser/sharing/sharing_send_message_result.h"
#include "chrome/browser/sharing/web_push/web_push_sender.h"
#include "components/sync_device_info/device_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace gcm {
class GCMDriver;
@@ -45,7 +45,7 @@
using SharingMessage = chrome_browser_sharing::SharingMessage;
using SendMessageCallback =
base::OnceCallback<void(SharingSendMessageResult result,
- base::Optional<std::string> message_id,
+ absl::optional<std::string> message_id,
SharingChannelType channel_type)>;
SharingFCMSender(std::unique_ptr<WebPushSender> web_push_sender,
@@ -61,7 +61,7 @@
// Sends a |message| to device identified by |fcm_configuration|, which
// expires after |time_to_live| seconds. |callback| will be invoked with
- // message_id if asynchronous operation succeeded, or base::nullopt if
+ // message_id if asynchronous operation succeeded, or absl::nullopt if
// operation failed.
virtual void SendMessageToFcmTarget(
const chrome_browser_sharing::FCMChannelConfiguration& fcm_configuration,
@@ -71,7 +71,7 @@
// Sends a |message| to device identified by |server_channel|, |callback| will
// be invoked with message_id if asynchronous operation succeeded, or
- // base::nullopt if operation failed.
+ // absl::nullopt if operation failed.
virtual void SendMessageToServerTarget(
const chrome_browser_sharing::ServerChannelConfiguration& server_channel,
SharingMessage message,
@@ -117,7 +117,7 @@
void OnMessageSentToVapidTarget(SendMessageCallback callback,
SendWebPushMessageResult result,
- base::Optional<std::string> message_id);
+ absl::optional<std::string> message_id);
void DoSendMessageToSenderIdTarget(const std::string& fcm_token,
base::TimeDelta time_to_live,
diff --git a/chrome/browser/sharing/sharing_fcm_sender_unittest.cc b/chrome/browser/sharing/sharing_fcm_sender_unittest.cc
index c9b6441..580b1eba 100644
--- a/chrome/browser/sharing/sharing_fcm_sender_unittest.cc
+++ b/chrome/browser/sharing/sharing_fcm_sender_unittest.cc
@@ -88,19 +88,19 @@
vapid_key_ = vapid_key;
message_ = std::move(message);
std::move(callback).Run(result_,
- base::make_optional<std::string>(kMessageId));
+ absl::make_optional<std::string>(kMessageId));
}
const std::string& fcm_token() { return fcm_token_; }
crypto::ECPrivateKey* vapid_key() { return vapid_key_; }
- const base::Optional<WebPushMessage>& message() { return message_; }
+ const absl::optional<WebPushMessage>& message() { return message_; }
void set_result(SendWebPushMessageResult result) { result_ = result; }
private:
std::string fcm_token_;
crypto::ECPrivateKey* vapid_key_;
- base::Optional<WebPushMessage> message_;
+ absl::optional<WebPushMessage> message_;
SendWebPushMessageResult result_;
DISALLOW_COPY_AND_ASSIGN(FakeWebPushSender);
@@ -127,7 +127,7 @@
return nullptr;
}
- const base::Optional<sync_pb::SharingMessageSpecifics>& specifics() {
+ const absl::optional<sync_pb::SharingMessageSpecifics>& specifics() {
return specifics_;
}
@@ -137,7 +137,7 @@
}
private:
- base::Optional<sync_pb::SharingMessageSpecifics> specifics_;
+ absl::optional<sync_pb::SharingMessageSpecifics> specifics_;
sync_pb::SharingMessageCommitError::ErrorCode error_code_;
DISALLOW_COPY_AND_ASSIGN(FakeSharingMessageBridge);
@@ -156,10 +156,10 @@
class SharingFCMSenderTest : public testing::Test {
public:
void OnMessageSent(SharingSendMessageResult* result_out,
- base::Optional<std::string>* message_id_out,
+ absl::optional<std::string>* message_id_out,
SharingChannelType* channel_type_out,
SharingSendMessageResult result,
- base::Optional<std::string> message_id,
+ absl::optional<std::string> message_id,
SharingChannelType channel_type) {
*result_out = result;
*message_id_out = std::move(message_id);
@@ -218,7 +218,7 @@
fcm_channel.set_sender_id_auth_secret(kSenderIdAuthSecret);
SharingSendMessageResult result;
- base::Optional<std::string> message_id;
+ absl::optional<std::string> message_id;
SharingChannelType channel_type;
chrome_browser_sharing::SharingMessage sharing_message;
sharing_message.mutable_ack_message();
@@ -252,7 +252,7 @@
fcm_channel.set_sender_id_auth_secret(kSenderIdAuthSecret);
SharingSendMessageResult result;
- base::Optional<std::string> message_id;
+ absl::optional<std::string> message_id;
SharingChannelType channel_type;
chrome_browser_sharing::SharingMessage sharing_message;
sharing_message.mutable_ack_message();
@@ -282,7 +282,7 @@
// Don't set any channels.
SharingSendMessageResult result;
- base::Optional<std::string> message_id;
+ absl::optional<std::string> message_id;
SharingChannelType channel_type;
chrome_browser_sharing::SharingMessage sharing_message;
sharing_message.mutable_ack_message();
@@ -316,7 +316,7 @@
fcm_channel.set_sender_id_auth_secret(kSenderIdAuthSecret);
SharingSendMessageResult result;
- base::Optional<std::string> message_id;
+ absl::optional<std::string> message_id;
SharingChannelType channel_type;
chrome_browser_sharing::SharingMessage sharing_message;
sharing_message.mutable_ack_message();
@@ -357,7 +357,7 @@
fcm_channel.set_sender_id_auth_secret(kSenderIdAuthSecret);
SharingSendMessageResult result;
- base::Optional<std::string> message_id;
+ absl::optional<std::string> message_id;
SharingChannelType channel_type;
chrome_browser_sharing::SharingMessage sharing_message;
sharing_message.mutable_ping_message();
@@ -403,7 +403,7 @@
fcm_channel.set_sender_id_auth_secret(kSenderIdAuthSecret);
SharingSendMessageResult result;
- base::Optional<std::string> message_id;
+ absl::optional<std::string> message_id;
SharingChannelType channel_type;
chrome_browser_sharing::SharingMessage sharing_message;
sharing_message.mutable_ping_message();
@@ -470,7 +470,7 @@
fcm_channel.set_vapid_auth_secret(kVapidAuthSecret);
SharingSendMessageResult result;
- base::Optional<std::string> message_id;
+ absl::optional<std::string> message_id;
SharingChannelType channel_type;
chrome_browser_sharing::SharingMessage sharing_message;
sharing_message.mutable_ping_message();
@@ -549,7 +549,7 @@
fcm_channel.set_sender_id_auth_secret(kSenderIdAuthSecret);
SharingSendMessageResult result;
- base::Optional<std::string> message_id;
+ absl::optional<std::string> message_id;
SharingChannelType channel_type;
chrome_browser_sharing::SharingMessage sharing_message;
sharing_message.mutable_ping_message();
@@ -600,7 +600,7 @@
server_channel.set_auth_secret(kServerAuthSecret);
SharingSendMessageResult result;
- base::Optional<std::string> message_id;
+ absl::optional<std::string> message_id;
SharingChannelType channel_type;
chrome_browser_sharing::SharingMessage sharing_message;
sharing_message.mutable_ping_message();
diff --git a/chrome/browser/sharing/sharing_message_bridge_impl.cc b/chrome/browser/sharing/sharing_message_bridge_impl.cc
index 15df59e..c39f2c8 100644
--- a/chrome/browser/sharing/sharing_message_bridge_impl.cc
+++ b/chrome/browser/sharing/sharing_message_bridge_impl.cc
@@ -118,7 +118,7 @@
return std::make_unique<syncer::DummyMetadataChangeList>();
}
-base::Optional<syncer::ModelError> SharingMessageBridgeImpl::MergeSyncData(
+absl::optional<syncer::ModelError> SharingMessageBridgeImpl::MergeSyncData(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_data) {
DCHECK(entity_data.empty());
@@ -126,7 +126,7 @@
return {};
}
-base::Optional<syncer::ModelError> SharingMessageBridgeImpl::ApplySyncChanges(
+absl::optional<syncer::ModelError> SharingMessageBridgeImpl::ApplySyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) {
sync_pb::SharingMessageCommitError no_error_message;
diff --git a/chrome/browser/sharing/sharing_message_bridge_impl.h b/chrome/browser/sharing/sharing_message_bridge_impl.h
index 0a3012e..71472d1 100644
--- a/chrome/browser/sharing/sharing_message_bridge_impl.h
+++ b/chrome/browser/sharing/sharing_message_bridge_impl.h
@@ -34,10 +34,10 @@
// ModelTypeSyncBridge implementation.
std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList()
override;
- base::Optional<syncer::ModelError> MergeSyncData(
+ absl::optional<syncer::ModelError> MergeSyncData(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_data) override;
- base::Optional<syncer::ModelError> ApplySyncChanges(
+ absl::optional<syncer::ModelError> ApplySyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) override;
void GetData(StorageKeyList storage_keys, DataCallback callback) override;
diff --git a/chrome/browser/sharing/sharing_message_sender.cc b/chrome/browser/sharing/sharing_message_sender.cc
index 5141c6e..4402f04e 100644
--- a/chrome/browser/sharing/sharing_message_sender.cc
+++ b/chrome/browser/sharing/sharing_message_sender.cc
@@ -100,7 +100,7 @@
void SharingMessageSender::OnMessageSent(const std::string& message_guid,
SharingSendMessageResult result,
- base::Optional<std::string> message_id,
+ absl::optional<std::string> message_id,
SharingChannelType channel_type) {
auto metadata_iter = message_metadata_.find(message_guid);
DCHECK(metadata_iter != message_metadata_.end());
diff --git a/chrome/browser/sharing/sharing_message_sender.h b/chrome/browser/sharing/sharing_message_sender.h
index 8e5ddf3..6878c57 100644
--- a/chrome/browser/sharing/sharing_message_sender.h
+++ b/chrome/browser/sharing/sharing_message_sender.h
@@ -11,8 +11,8 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chrome_browser_sharing {
enum MessageType : int;
@@ -41,7 +41,7 @@
public:
using SendMessageCallback =
base::OnceCallback<void(SharingSendMessageResult result,
- base::Optional<std::string> message_id,
+ absl::optional<std::string> message_id,
SharingChannelType channel_type)>;
virtual ~SendMessageDelegate() = default;
@@ -107,7 +107,7 @@
void OnMessageSent(const std::string& message_guid,
SharingSendMessageResult result,
- base::Optional<std::string> message_id,
+ absl::optional<std::string> message_id,
SharingChannelType channel_type);
void InvokeSendMessageCallback(
diff --git a/chrome/browser/sharing/sharing_message_sender_unittest.cc b/chrome/browser/sharing/sharing_message_sender_unittest.cc
index b708de1..75aa10a 100644
--- a/chrome/browser/sharing/sharing_message_sender_unittest.cc
+++ b/chrome/browser/sharing/sharing_message_sender_unittest.cc
@@ -206,7 +206,7 @@
SharingFCMSender::SendMessageCallback callback) {
// FCM message not sent successfully.
std::move(callback).Run(SharingSendMessageResult::kInternalError,
- base::nullopt, SharingChannelType::kUnknown);
+ absl::nullopt, SharingChannelType::kUnknown);
// Callback already run with result timeout, ack received for same
// message id is ignored.
diff --git a/chrome/browser/sharing/sharing_notification_handler.cc b/chrome/browser/sharing/sharing_notification_handler.cc
index 0acf154..9c4d3e5f 100644
--- a/chrome/browser/sharing/sharing_notification_handler.cc
+++ b/chrome/browser/sharing/sharing_notification_handler.cc
@@ -19,8 +19,8 @@
Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) {
auto handler = SharingServiceFactory::GetForBrowserContext(profile)
->GetNotificationActionHandler(notification_id);
@@ -42,7 +42,7 @@
auto handler = SharingServiceFactory::GetForBrowserContext(profile)
->GetNotificationActionHandler(notification_id);
if (handler)
- handler.Run(/*button=*/base::nullopt, /*closed=*/true);
+ handler.Run(/*button=*/absl::nullopt, /*closed=*/true);
std::move(completed_closure).Run();
}
diff --git a/chrome/browser/sharing/sharing_notification_handler.h b/chrome/browser/sharing/sharing_notification_handler.h
index 016b1965..e9e2b6b 100644
--- a/chrome/browser/sharing/sharing_notification_handler.h
+++ b/chrome/browser/sharing/sharing_notification_handler.h
@@ -8,8 +8,8 @@
#include <string>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/notifications/notification_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class Profile;
@@ -27,8 +27,8 @@
void OnClick(Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) override;
void OnClose(Profile* profile,
const GURL& origin,
diff --git a/chrome/browser/sharing/sharing_service.h b/chrome/browser/sharing/sharing_service.h
index 5fbb561..205f084 100644
--- a/chrome/browser/sharing/sharing_service.h
+++ b/chrome/browser/sharing/sharing_service.h
@@ -45,7 +45,7 @@
public:
using SharingDeviceList = std::vector<std::unique_ptr<syncer::DeviceInfo>>;
using NotificationActionCallback =
- base::RepeatingCallback<void(base::Optional<int> button, bool closed)>;
+ base::RepeatingCallback<void(absl::optional<int> button, bool closed)>;
enum class State {
// Device is unregistered with FCM and Sharing is unavailable.
diff --git a/chrome/browser/sharing/sharing_service_unittest.cc b/chrome/browser/sharing/sharing_service_unittest.cc
index 9ebb4189..9e4806c 100644
--- a/chrome/browser/sharing/sharing_service_unittest.cc
+++ b/chrome/browser/sharing/sharing_service_unittest.cc
@@ -9,7 +9,6 @@
#include "base/guid.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "chrome/browser/sharing/fake_device_info.h"
@@ -38,6 +37,7 @@
#include "crypto/ec_private_key.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -161,11 +161,11 @@
void OnMessageSent(
SharingSendMessageResult result,
std::unique_ptr<chrome_browser_sharing::ResponseMessage> response) {
- send_message_result_ = base::make_optional(result);
+ send_message_result_ = absl::make_optional(result);
send_message_response_ = std::move(response);
}
- const base::Optional<SharingSendMessageResult>& send_message_result() {
+ const absl::optional<SharingSendMessageResult>& send_message_result() {
return send_message_result_;
}
@@ -221,7 +221,7 @@
private:
std::unique_ptr<SharingService> sharing_service_;
- base::Optional<SharingSendMessageResult> send_message_result_;
+ absl::optional<SharingSendMessageResult> send_message_result_;
std::unique_ptr<chrome_browser_sharing::ResponseMessage>
send_message_response_;
};
diff --git a/chrome/browser/sharing/sharing_sync_preference.cc b/chrome/browser/sharing/sharing_sync_preference.cc
index 12719ee..03b80f9 100644
--- a/chrome/browser/sharing/sharing_sync_preference.cc
+++ b/chrome/browser/sharing/sharing_sync_preference.cc
@@ -49,11 +49,11 @@
return result;
}
-base::Optional<syncer::DeviceInfo::SharingTargetInfo> ValueToTargetInfo(
+absl::optional<syncer::DeviceInfo::SharingTargetInfo> ValueToTargetInfo(
const base::Value& value) {
const std::string* fcm_token = value.FindStringKey(kDeviceFcmToken);
if (!fcm_token)
- return base::nullopt;
+ return absl::nullopt;
const std::string* base64_p256dh = value.FindStringKey(kDeviceP256dh);
const std::string* base64_auth_secret =
@@ -63,7 +63,7 @@
if (!base64_p256dh || !base64_auth_secret ||
!base::Base64Decode(*base64_p256dh, &p256dh) ||
!base::Base64Decode(*base64_auth_secret, &auth_secret)) {
- return base::nullopt;
+ return absl::nullopt;
}
return syncer::DeviceInfo::SharingTargetInfo{*fcm_token, std::move(p256dh),
@@ -75,7 +75,7 @@
using sync_pb::SharingSpecificFields;
SharingSyncPreference::FCMRegistration::FCMRegistration(
- base::Optional<std::string> authorized_entity,
+ absl::optional<std::string> authorized_entity,
base::Time timestamp)
: authorized_entity(std::move(authorized_entity)), timestamp(timestamp) {}
@@ -110,19 +110,19 @@
registry->RegisterDictionaryPref(prefs::kSharingLocalSharingInfo);
}
-base::Optional<std::vector<uint8_t>> SharingSyncPreference::GetVapidKey()
+absl::optional<std::vector<uint8_t>> SharingSyncPreference::GetVapidKey()
const {
const base::DictionaryValue* vapid_key =
prefs_->GetDictionary(prefs::kSharingVapidKey);
std::string base64_private_key, private_key;
if (!vapid_key->GetString(kVapidECPrivateKey, &base64_private_key))
- return base::nullopt;
+ return absl::nullopt;
if (base::Base64Decode(base64_private_key, &private_key)) {
return std::vector<uint8_t>(private_key.begin(), private_key.end());
} else {
LOG(ERROR) << "Could not decode stored vapid keys.";
- return base::nullopt;
+ return absl::nullopt;
}
}
@@ -150,7 +150,7 @@
pref_change_registrar_.Remove(prefs::kSharingVapidKey);
}
-base::Optional<SharingSyncPreference::FCMRegistration>
+absl::optional<SharingSyncPreference::FCMRegistration>
SharingSyncPreference::GetFCMRegistration() const {
const base::DictionaryValue* registration =
prefs_->GetDictionary(prefs::kSharingFCMRegistration);
@@ -159,15 +159,15 @@
const base::Value* timestamp_value =
registration->FindKey(kRegistrationTimestamp);
if (!timestamp_value)
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<std::string> authorized_entity;
+ absl::optional<std::string> authorized_entity;
if (authorized_entity_ptr)
authorized_entity = *authorized_entity_ptr;
- base::Optional<base::Time> timestamp = util::ValueToTime(timestamp_value);
+ absl::optional<base::Time> timestamp = util::ValueToTime(timestamp_value);
if (!timestamp)
- return base::nullopt;
+ return absl::nullopt;
return FCMRegistration(authorized_entity, *timestamp);
}
@@ -235,7 +235,7 @@
}
// static
-base::Optional<syncer::DeviceInfo::SharingInfo>
+absl::optional<syncer::DeviceInfo::SharingInfo>
SharingSyncPreference::GetLocalSharingInfoForSync(PrefService* prefs) {
const base::DictionaryValue* registration =
prefs->GetDictionary(prefs::kSharingLocalSharingInfo);
@@ -248,13 +248,13 @@
registration->FindListKey(kSharingInfoEnabledFeatures);
if (!vapid_target_info_value || !sender_id_target_info_value ||
!enabled_features_value) {
- return base::nullopt;
+ return absl::nullopt;
}
auto vapid_target_info = ValueToTargetInfo(*vapid_target_info_value);
auto sender_id_target_info = ValueToTargetInfo(*sender_id_target_info_value);
if (!vapid_target_info || !sender_id_target_info)
- return base::nullopt;
+ return absl::nullopt;
std::set<SharingSpecificFields::EnabledFeatures> enabled_features;
for (auto& value : enabled_features_value->GetList()) {
diff --git a/chrome/browser/sharing/sharing_sync_preference.h b/chrome/browser/sharing/sharing_sync_preference.h
index 108e329..5c8794a 100644
--- a/chrome/browser/sharing/sharing_sync_preference.h
+++ b/chrome/browser/sharing/sharing_sync_preference.h
@@ -12,10 +12,10 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/sync_device_info/device_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace syncer {
class DeviceInfoSyncService;
@@ -37,14 +37,14 @@
public:
// FCM registration status of current device. Not synced across devices.
struct FCMRegistration {
- FCMRegistration(base::Optional<std::string> authorized_entity,
+ FCMRegistration(absl::optional<std::string> authorized_entity,
base::Time timestamp);
FCMRegistration(FCMRegistration&& other);
FCMRegistration& operator=(FCMRegistration&& other);
~FCMRegistration();
// Authorized entity registered with FCM.
- base::Optional<std::string> authorized_entity;
+ absl::optional<std::string> authorized_entity;
// Timestamp of latest registration.
base::Time timestamp;
@@ -58,14 +58,14 @@
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
// Returns local SharingInfo to be uploaded to sync.
- static base::Optional<syncer::DeviceInfo::SharingInfo>
+ static absl::optional<syncer::DeviceInfo::SharingInfo>
GetLocalSharingInfoForSync(PrefService* prefs);
// Returns VAPID key from preferences if present, otherwise returns
- // base::nullopt.
+ // absl::nullopt.
// For more information on vapid keys, please see
// https://tools.ietf.org/html/draft-thomson-webpush-vapid-02
- base::Optional<std::vector<uint8_t>> GetVapidKey() const;
+ absl::optional<std::vector<uint8_t>> GetVapidKey() const;
// Adds VAPID key to preferences for syncing across devices.
void SetVapidKey(const std::vector<uint8_t>& vapid_key) const;
@@ -76,7 +76,7 @@
// Clears previously set observer.
void ClearVapidKeyChangeObserver();
- base::Optional<FCMRegistration> GetFCMRegistration() const;
+ absl::optional<FCMRegistration> GetFCMRegistration() const;
void SetFCMRegistration(FCMRegistration registration);
diff --git a/chrome/browser/sharing/sharing_sync_preference_unittest.cc b/chrome/browser/sharing/sharing_sync_preference_unittest.cc
index 781a3c5..c36e563 100644
--- a/chrome/browser/sharing/sharing_sync_preference_unittest.cc
+++ b/chrome/browser/sharing/sharing_sync_preference_unittest.cc
@@ -75,7 +75,7 @@
};
TEST_F(SharingSyncPreferenceTest, UpdateVapidKeys) {
- EXPECT_EQ(base::nullopt, sharing_sync_preference_.GetVapidKey());
+ EXPECT_EQ(absl::nullopt, sharing_sync_preference_.GetVapidKey());
sharing_sync_preference_.SetVapidKey(kVapidKey);
EXPECT_EQ(kVapidKey, sharing_sync_preference_.GetVapidKey());
}
@@ -120,7 +120,7 @@
// Set FCM registration without authorized entity.
sharing_sync_preference_.SetFCMRegistration(
- SharingSyncPreference::FCMRegistration(base::nullopt, time_now));
+ SharingSyncPreference::FCMRegistration(absl::nullopt, time_now));
fcm_registration = sharing_sync_preference_.GetFCMRegistration();
EXPECT_TRUE(fcm_registration);
diff --git a/chrome/browser/sharing/sharing_ui_controller.cc b/chrome/browser/sharing/sharing_ui_controller.cc
index e1e0bbd0..95513ee 100644
--- a/chrome/browser/sharing/sharing_ui_controller.cc
+++ b/chrome/browser/sharing/sharing_ui_controller.cc
@@ -128,7 +128,7 @@
}
void SharingUiController::UpdateAndShowDialog(
- const base::Optional<url::Origin>& initiating_origin) {
+ const absl::optional<url::Origin>& initiating_origin) {
ClearLastDialog();
DoUpdateApps(base::BindOnce(&SharingUiController::OnAppsReceived,
weak_ptr_factory_.GetWeakPtr(), last_dialog_id_,
@@ -170,9 +170,9 @@
base::OnceClosure SharingUiController::SendMessageToDevice(
const syncer::DeviceInfo& device,
- base::Optional<base::TimeDelta> response_timeout,
+ absl::optional<base::TimeDelta> response_timeout,
chrome_browser_sharing::SharingMessage sharing_message,
- base::Optional<SharingMessageSender::ResponseCallback> custom_callback) {
+ absl::optional<SharingMessageSender::ResponseCallback> custom_callback) {
last_dialog_id_++;
is_loading_ = true;
send_result_ = SharingSendMessageResult::kSuccessful;
@@ -230,7 +230,7 @@
void SharingUiController::OnResponse(
int dialog_id,
- base::Optional<SharingMessageSender::ResponseCallback> custom_callback,
+ absl::optional<SharingMessageSender::ResponseCallback> custom_callback,
SharingSendMessageResult result,
std::unique_ptr<chrome_browser_sharing::ResponseMessage> response) {
if (custom_callback)
@@ -245,7 +245,7 @@
void SharingUiController::OnAppsReceived(
int dialog_id,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
std::vector<SharingApp> apps) {
if (dialog_id != last_dialog_id_)
return;
diff --git a/chrome/browser/sharing/sharing_ui_controller.h b/chrome/browser/sharing/sharing_ui_controller.h
index 13185dd..eef3a67 100644
--- a/chrome/browser/sharing/sharing_ui_controller.h
+++ b/chrome/browser/sharing/sharing_ui_controller.h
@@ -11,7 +11,6 @@
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/sharing/proto/sharing_message.pb.h"
#include "chrome/browser/sharing/sharing_app.h"
@@ -22,6 +21,7 @@
#include "chrome/browser/ui/page_action/page_action_icon_type.h"
#include "components/sync/protocol/device_info_specifics.pb.h"
#include "components/sync_device_info/device_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/controls/styled_label.h"
#include "url/origin.h"
@@ -73,7 +73,7 @@
// Gets the current list of apps and devices and shows a new dialog.
void UpdateAndShowDialog(
- const base::Optional<url::Origin>& initiating_origin);
+ const absl::optional<url::Origin>& initiating_origin);
// Gets the current list of devices that support the required feature.
std::vector<std::unique_ptr<syncer::DeviceInfo>> GetDevices() const;
@@ -105,9 +105,9 @@
// response or when cancelling the request by calling the returned callback.
base::OnceClosure SendMessageToDevice(
const syncer::DeviceInfo& device,
- base::Optional<base::TimeDelta> response_timeout,
+ absl::optional<base::TimeDelta> response_timeout,
chrome_browser_sharing::SharingMessage sharing_message,
- base::Optional<SharingMessageSender::ResponseCallback> callback);
+ absl::optional<SharingMessageSender::ResponseCallback> callback);
private:
// Updates the omnibox icon if available.
@@ -124,12 +124,12 @@
// response via |custom_callback|.
void OnResponse(
int dialog_id,
- base::Optional<SharingMessageSender::ResponseCallback> custom_callback,
+ absl::optional<SharingMessageSender::ResponseCallback> custom_callback,
SharingSendMessageResult result,
std::unique_ptr<chrome_browser_sharing::ResponseMessage> response);
void OnAppsReceived(int dialog_id,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
std::vector<SharingApp> apps);
SharingDialog* dialog_ = nullptr;
diff --git a/chrome/browser/sharing/sharing_utils.cc b/chrome/browser/sharing/sharing_utils.cc
index 2b098a4fa..017b692d 100644
--- a/chrome/browser/sharing/sharing_utils.cc
+++ b/chrome/browser/sharing/sharing_utils.cc
@@ -88,10 +88,10 @@
return false;
}
-base::Optional<chrome_browser_sharing::FCMChannelConfiguration> GetFCMChannel(
+absl::optional<chrome_browser_sharing::FCMChannelConfiguration> GetFCMChannel(
const syncer::DeviceInfo& device_info) {
if (!device_info.sharing_info())
- return base::nullopt;
+ return absl::nullopt;
chrome_browser_sharing::FCMChannelConfiguration fcm_configuration;
auto& vapid_target_info = device_info.sharing_info()->vapid_target_info;
diff --git a/chrome/browser/sharing/sharing_utils.h b/chrome/browser/sharing/sharing_utils.h
index 9988754..3d1fb5f 100644
--- a/chrome/browser/sharing/sharing_utils.h
+++ b/chrome/browser/sharing/sharing_utils.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_SHARING_SHARING_UTILS_H_
#define CHROME_BROWSER_SHARING_SHARING_UTILS_H_
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chrome_browser_sharing {
class FCMChannelConfiguration;
@@ -31,7 +31,7 @@
bool IsSyncDisabledForSharing(syncer::SyncService* sync_service);
// Returns the FCMChannelConfiguration of device with specified |device_info|.
-base::Optional<chrome_browser_sharing::FCMChannelConfiguration> GetFCMChannel(
+absl::optional<chrome_browser_sharing::FCMChannelConfiguration> GetFCMChannel(
const syncer::DeviceInfo& device_info);
// Returns the SharingDevicePlatform of device with specified |device_info|.
diff --git a/chrome/browser/sharing/sharing_utils_unittest.cc b/chrome/browser/sharing/sharing_utils_unittest.cc
index 73de42f7..3c047ef 100644
--- a/chrome/browser/sharing/sharing_utils_unittest.cc
+++ b/chrome/browser/sharing/sharing_utils_unittest.cc
@@ -134,53 +134,53 @@
TEST_F(SharingUtilsTest, GetDevicePlatform) {
EXPECT_EQ(GetDevicePlatform(*CreateFakeDeviceInfo(
- kDeviceGuid, kDeviceName, /*sharing_info=*/base::nullopt,
+ kDeviceGuid, kDeviceName, /*sharing_info=*/absl::nullopt,
sync_pb::SyncEnums_DeviceType_TYPE_CROS)),
SharingDevicePlatform::kChromeOS);
EXPECT_EQ(GetDevicePlatform(*CreateFakeDeviceInfo(
- kDeviceGuid, kDeviceName, /*sharing_info=*/base::nullopt,
+ kDeviceGuid, kDeviceName, /*sharing_info=*/absl::nullopt,
sync_pb::SyncEnums_DeviceType_TYPE_LINUX)),
SharingDevicePlatform::kLinux);
EXPECT_EQ(GetDevicePlatform(*CreateFakeDeviceInfo(
- kDeviceGuid, kDeviceName, /*sharing_info=*/base::nullopt,
+ kDeviceGuid, kDeviceName, /*sharing_info=*/absl::nullopt,
sync_pb::SyncEnums_DeviceType_TYPE_MAC)),
SharingDevicePlatform::kMac);
EXPECT_EQ(GetDevicePlatform(*CreateFakeDeviceInfo(
- kDeviceGuid, kDeviceName, /*sharing_info=*/base::nullopt,
+ kDeviceGuid, kDeviceName, /*sharing_info=*/absl::nullopt,
sync_pb::SyncEnums_DeviceType_TYPE_WIN)),
SharingDevicePlatform::kWindows);
EXPECT_EQ(
GetDevicePlatform(*CreateFakeDeviceInfo(
- kDeviceGuid, kDeviceName, /*sharing_info=*/base::nullopt,
+ kDeviceGuid, kDeviceName, /*sharing_info=*/absl::nullopt,
sync_pb::SyncEnums_DeviceType_TYPE_PHONE, "Apple Inc.", "iPhone 50")),
SharingDevicePlatform::kIOS);
EXPECT_EQ(
GetDevicePlatform(*CreateFakeDeviceInfo(
- kDeviceGuid, kDeviceName, /*sharing_info=*/base::nullopt,
+ kDeviceGuid, kDeviceName, /*sharing_info=*/absl::nullopt,
sync_pb::SyncEnums_DeviceType_TYPE_TABLET, "Apple Inc.", "iPad 99")),
SharingDevicePlatform::kIOS);
EXPECT_EQ(
GetDevicePlatform(*CreateFakeDeviceInfo(
- kDeviceGuid, kDeviceName, /*sharing_info=*/base::nullopt,
+ kDeviceGuid, kDeviceName, /*sharing_info=*/absl::nullopt,
sync_pb::SyncEnums_DeviceType_TYPE_PHONE, "Google", "Pixel 777")),
SharingDevicePlatform::kAndroid);
EXPECT_EQ(
GetDevicePlatform(*CreateFakeDeviceInfo(
- kDeviceGuid, kDeviceName, /*sharing_info=*/base::nullopt,
+ kDeviceGuid, kDeviceName, /*sharing_info=*/absl::nullopt,
sync_pb::SyncEnums_DeviceType_TYPE_TABLET, "Google", "Pixel Z")),
SharingDevicePlatform::kAndroid);
EXPECT_EQ(GetDevicePlatform(*CreateFakeDeviceInfo(
- kDeviceGuid, kDeviceName, /*sharing_info=*/base::nullopt,
+ kDeviceGuid, kDeviceName, /*sharing_info=*/absl::nullopt,
sync_pb::SyncEnums_DeviceType_TYPE_UNSET)),
SharingDevicePlatform::kUnknown);
EXPECT_EQ(GetDevicePlatform(*CreateFakeDeviceInfo(
- kDeviceGuid, kDeviceName, /*sharing_info=*/base::nullopt,
+ kDeviceGuid, kDeviceName, /*sharing_info=*/absl::nullopt,
sync_pb::SyncEnums_DeviceType_TYPE_OTHER)),
SharingDevicePlatform::kUnknown);
}
diff --git a/chrome/browser/sharing/sms/sms_remote_fetcher.cc b/chrome/browser/sharing/sms/sms_remote_fetcher.cc
index 7359daf..4a11f53b 100644
--- a/chrome/browser/sharing/sms/sms_remote_fetcher.cc
+++ b/chrome/browser/sharing/sms/sms_remote_fetcher.cc
@@ -15,14 +15,14 @@
base::OnceClosure FetchRemoteSms(
content::WebContents* web_contents,
const url::Origin& origin,
- base::OnceCallback<void(base::Optional<std::vector<url::Origin>>,
- base::Optional<std::string>,
- base::Optional<content::SmsFetchFailureType>)>
+ base::OnceCallback<void(absl::optional<std::vector<url::Origin>>,
+ absl::optional<std::string>,
+ absl::optional<content::SmsFetchFailureType>)>
callback) {
// TODO(crbug.com/1015645): We should have a new failure type when the feature
// is disabled or no device is available.
if (!base::FeatureList::IsEnabled(kWebOTPCrossDevice)) {
- std::move(callback).Run(base::nullopt, base::nullopt, base::nullopt);
+ std::move(callback).Run(absl::nullopt, absl::nullopt, absl::nullopt);
// kWebOTPCrossDevice will be disabled for a large number of users. There's
// no need to call any cancel callback in such case.
return base::NullCallback();
@@ -37,7 +37,7 @@
SmsRemoteFetcherUiController::GetOrCreateFromWebContents(web_contents);
return ui_controller->FetchRemoteSms(origin, std::move(callback));
#else
- std::move(callback).Run(base::nullopt, base::nullopt, base::nullopt);
+ std::move(callback).Run(absl::nullopt, absl::nullopt, absl::nullopt);
return base::NullCallback();
#endif
}
diff --git a/chrome/browser/sharing/sms/sms_remote_fetcher.h b/chrome/browser/sharing/sms/sms_remote_fetcher.h
index d98f7e4..53ef16ba 100644
--- a/chrome/browser/sharing/sms/sms_remote_fetcher.h
+++ b/chrome/browser/sharing/sms/sms_remote_fetcher.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/callback.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -27,8 +27,8 @@
base::OnceClosure FetchRemoteSms(
content::WebContents* web_contents,
const url::Origin& origin,
- base::OnceCallback<void(base::Optional<std::vector<url::Origin>>,
- base::Optional<std::string>,
- base::Optional<content::SmsFetchFailureType>)>);
+ base::OnceCallback<void(absl::optional<std::vector<url::Origin>>,
+ absl::optional<std::string>,
+ absl::optional<content::SmsFetchFailureType>)>);
#endif // CHROME_BROWSER_SHARING_SMS_SMS_REMOTE_FETCHER_H_
diff --git a/chrome/browser/sharing/sms/sms_remote_fetcher_ui_controller.cc b/chrome/browser/sharing/sms/sms_remote_fetcher_ui_controller.cc
index a3d10286..ee95456 100644
--- a/chrome/browser/sharing/sms/sms_remote_fetcher_ui_controller.cc
+++ b/chrome/browser/sharing/sms/sms_remote_fetcher_ui_controller.cc
@@ -83,14 +83,14 @@
if (result != SharingSendMessageResult::kSuccessful) {
// TODO(crbug.com/1015645): We should have a new category for remote
// failures.
- std::move(callback).Run(base::nullopt, base::nullopt, base::nullopt);
+ std::move(callback).Run(absl::nullopt, absl::nullopt, absl::nullopt);
return;
}
DCHECK(response);
DCHECK(response->has_sms_fetch_response());
if (response->sms_fetch_response().has_failure_type()) {
- std::move(callback).Run(base::nullopt, base::nullopt,
+ std::move(callback).Run(absl::nullopt, absl::nullopt,
static_cast<content::SmsFetchFailureType>(
response->sms_fetch_response().failure_type()));
return;
@@ -102,7 +102,7 @@
std::move(callback).Run(std::move(origin_list),
response->sms_fetch_response().one_time_code(),
- base::nullopt);
+ absl::nullopt);
}
base::OnceClosure SmsRemoteFetcherUiController::FetchRemoteSms(
@@ -114,7 +114,7 @@
// No devices available to call.
// TODO(crbug.com/1015645): We should have a new category for remote
// failures.
- std::move(callback).Run(base::nullopt, base::nullopt, base::nullopt);
+ std::move(callback).Run(absl::nullopt, absl::nullopt, absl::nullopt);
return base::NullCallback();
}
diff --git a/chrome/browser/sharing/sms/sms_remote_fetcher_ui_controller.h b/chrome/browser/sharing/sms/sms_remote_fetcher_ui_controller.h
index 7dd610f0..4572a0f 100644
--- a/chrome/browser/sharing/sms/sms_remote_fetcher_ui_controller.h
+++ b/chrome/browser/sharing/sms/sms_remote_fetcher_ui_controller.h
@@ -12,12 +12,12 @@
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/sharing/sharing_metrics.h"
#include "chrome/browser/sharing/sharing_service.h"
#include "chrome/browser/sharing/sharing_ui_controller.h"
#include "chrome/browser/ui/page_action/page_action_icon_type.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -33,9 +33,9 @@
public content::WebContentsUserData<SmsRemoteFetcherUiController> {
public:
using OnRemoteCallback =
- base::OnceCallback<void(base::Optional<std::vector<url::Origin>>,
- base::Optional<std::string>,
- base::Optional<content::SmsFetchFailureType>)>;
+ base::OnceCallback<void(absl::optional<std::vector<url::Origin>>,
+ absl::optional<std::string>,
+ absl::optional<content::SmsFetchFailureType>)>;
static SmsRemoteFetcherUiController* GetOrCreateFromWebContents(
content::WebContents* web_contents);
diff --git a/chrome/browser/sharing/sms/sms_remote_fetcher_unittest.cc b/chrome/browser/sharing/sms/sms_remote_fetcher_unittest.cc
index 907c8236..fde6f0a 100644
--- a/chrome/browser/sharing/sms/sms_remote_fetcher_unittest.cc
+++ b/chrome/browser/sharing/sms/sms_remote_fetcher_unittest.cc
@@ -58,9 +58,9 @@
FetchRemoteSms(
web_contents.get(), GetOriginForURL("a.com"),
BindLambdaForTesting(
- [&loop](base::Optional<std::vector<url::Origin>>,
- base::Optional<std::string> result,
- base::Optional<content::SmsFetchFailureType> failure_type) {
+ [&loop](absl::optional<std::vector<url::Origin>>,
+ absl::optional<std::string> result,
+ absl::optional<content::SmsFetchFailureType> failure_type) {
ASSERT_FALSE(result);
loop.Quit();
}));
@@ -90,9 +90,9 @@
FetchRemoteSms(
web_contents.get(), GetOriginForURL("a.com"),
BindLambdaForTesting(
- [&loop](base::Optional<std::vector<url::Origin>>,
- base::Optional<std::string> result,
- base::Optional<content::SmsFetchFailureType> failure_type) {
+ [&loop](absl::optional<std::vector<url::Origin>>,
+ absl::optional<std::string> result,
+ absl::optional<content::SmsFetchFailureType> failure_type) {
ASSERT_FALSE(result);
loop.Quit();
}));
@@ -136,9 +136,9 @@
FetchRemoteSms(
web_contents.get(), GetOriginForURL("a.com"),
BindLambdaForTesting(
- [&loop](base::Optional<std::vector<url::Origin>>,
- base::Optional<std::string> result,
- base::Optional<content::SmsFetchFailureType> failure_type) {
+ [&loop](absl::optional<std::vector<url::Origin>>,
+ absl::optional<std::string> result,
+ absl::optional<content::SmsFetchFailureType> failure_type) {
ASSERT_TRUE(result);
ASSERT_EQ("ABC", result);
loop.Quit();
@@ -181,9 +181,9 @@
FetchRemoteSms(
web_contents.get(), GetOriginForURL("a.com"),
BindLambdaForTesting(
- [&loop](base::Optional<std::vector<url::Origin>>,
- base::Optional<std::string> result,
- base::Optional<content::SmsFetchFailureType> failure_type) {
+ [&loop](absl::optional<std::vector<url::Origin>>,
+ absl::optional<std::string> result,
+ absl::optional<content::SmsFetchFailureType> failure_type) {
ASSERT_FALSE(result);
loop.Quit();
}));
@@ -226,9 +226,9 @@
base::OnceClosure cancel_callback = FetchRemoteSms(
web_contents.get(), GetOriginForURL("a.com"),
BindLambdaForTesting(
- [&loop](base::Optional<std::vector<url::Origin>>,
- base::Optional<std::string> one_time_code,
- base::Optional<content::SmsFetchFailureType> failure_type) {
+ [&loop](absl::optional<std::vector<url::Origin>>,
+ absl::optional<std::string> one_time_code,
+ absl::optional<content::SmsFetchFailureType> failure_type) {
ASSERT_FALSE(one_time_code);
loop.Quit();
}));
diff --git a/chrome/browser/sharing/vapid_key_manager.cc b/chrome/browser/sharing/vapid_key_manager.cc
index 10c83ff..39a2090 100644
--- a/chrome/browser/sharing/vapid_key_manager.cc
+++ b/chrome/browser/sharing/vapid_key_manager.cc
@@ -58,7 +58,7 @@
}
bool VapidKeyManager::InitWithPreference() {
- base::Optional<std::vector<uint8_t>> preference_key_info =
+ absl::optional<std::vector<uint8_t>> preference_key_info =
sharing_sync_preference_->GetVapidKey();
if (!preference_key_info || vapid_key_info_ == *preference_key_info)
return false;
diff --git a/chrome/browser/sharing/vapid_key_manager_unittest.cc b/chrome/browser/sharing/vapid_key_manager_unittest.cc
index 7fdf6f6..1107f6a 100644
--- a/chrome/browser/sharing/vapid_key_manager_unittest.cc
+++ b/chrome/browser/sharing/vapid_key_manager_unittest.cc
@@ -33,7 +33,7 @@
TEST_F(VapidKeyManagerTest, CreateKeyFlow) {
// No keys stored in preferences.
- EXPECT_EQ(base::nullopt, sharing_sync_preference_.GetVapidKey());
+ EXPECT_EQ(absl::nullopt, sharing_sync_preference_.GetVapidKey());
// Expected to create new keys and store in preferences.
crypto::ECPrivateKey* key_1 = vapid_key_manager_.GetOrCreateKey();
@@ -54,7 +54,7 @@
test_sync_service_.SetActiveDataTypes({});
// No keys stored in preferences.
- EXPECT_EQ(base::nullopt, sharing_sync_preference_.GetVapidKey());
+ EXPECT_EQ(absl::nullopt, sharing_sync_preference_.GetVapidKey());
// Expected to skip creating keys when sync preference is not available.
EXPECT_FALSE(vapid_key_manager_.GetOrCreateKey());
diff --git a/chrome/browser/sharing/web_push/json_web_token_util.cc b/chrome/browser/sharing/web_push/json_web_token_util.cc
index c607bad..f8c524d0 100644
--- a/chrome/browser/sharing/web_push/json_web_token_util.cc
+++ b/chrome/browser/sharing/web_push/json_web_token_util.cc
@@ -21,12 +21,12 @@
const char kTypJwt[] = "JWT";
} // namespace
-base::Optional<std::string> CreateJSONWebToken(
+absl::optional<std::string> CreateJSONWebToken(
const base::Value& claims,
crypto::ECPrivateKey* private_key) {
if (!claims.is_dict()) {
LOG(ERROR) << "claims is not a dictionary";
- return base::nullopt;
+ return absl::nullopt;
}
// Generate header.
@@ -38,7 +38,7 @@
std::string header_serialized;
if (!base::JSONWriter::Write(header, &header_serialized)) {
LOG(ERROR) << "Failed to write header as JSON";
- return base::nullopt;
+ return absl::nullopt;
}
std::string header_base64;
base::Base64UrlEncode(header_serialized,
@@ -49,7 +49,7 @@
std::string payload_serialized;
if (!base::JSONWriter::Write(claims, &payload_serialized)) {
LOG(ERROR) << "Failed to write claims as JSON";
- return base::nullopt;
+ return absl::nullopt;
}
std::string payload_base64;
base::Base64UrlEncode(payload_serialized,
@@ -62,11 +62,11 @@
std::vector<uint8_t> der_signature, raw_signature;
if (!signer->Sign((const uint8_t*)data.data(), data.size(), &der_signature)) {
LOG(ERROR) << "Failed to create DER signature";
- return base::nullopt;
+ return absl::nullopt;
}
if (!signer->DecodeSignature(der_signature, &raw_signature)) {
LOG(ERROR) << "Failed to decode DER signature";
- return base::nullopt;
+ return absl::nullopt;
}
// Serialize signature.
diff --git a/chrome/browser/sharing/web_push/json_web_token_util.h b/chrome/browser/sharing/web_push/json_web_token_util.h
index 36abe4f..ad0442b 100644
--- a/chrome/browser/sharing/web_push/json_web_token_util.h
+++ b/chrome/browser/sharing/web_push/json_web_token_util.h
@@ -7,8 +7,8 @@
#include <string>
-#include "base/optional.h"
#include "base/values.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace crypto {
class ECPrivateKey;
@@ -22,7 +22,7 @@
// NIST P-256 curve and ECSignatureCreator is hardcoded to SHA256.
//
// https://tools.ietf.org/html/rfc7519
-base::Optional<std::string> CreateJSONWebToken(
+absl::optional<std::string> CreateJSONWebToken(
const base::Value& claims,
crypto::ECPrivateKey* private_key);
diff --git a/chrome/browser/sharing/web_push/json_web_token_util_unittest.cc b/chrome/browser/sharing/web_push/json_web_token_util_unittest.cc
index d9ac5cb..31f1768 100644
--- a/chrome/browser/sharing/web_push/json_web_token_util_unittest.cc
+++ b/chrome/browser/sharing/web_push/json_web_token_util_unittest.cc
@@ -9,10 +9,10 @@
#include "base/base64.h"
#include "base/base64url.h"
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "crypto/ec_private_key.h"
#include "crypto/signature_verifier.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/boringssl/src/include/openssl/bn.h"
#include "third_party/boringssl/src/include/openssl/ecdsa.h"
@@ -37,7 +37,7 @@
// Create JWS.
base::Value claims(base::Value::Type::DICTIONARY);
claims.SetKey("aud", base::Value("https://chromium.org"));
- base::Optional<std::string> jwt =
+ absl::optional<std::string> jwt =
CreateJSONWebToken(claims, private_key.get());
ASSERT_TRUE(jwt);
@@ -85,7 +85,7 @@
ASSERT_TRUE(base::Base64UrlDecode(data.substr(0, data_dot_position),
base::Base64UrlDecodePolicy::IGNORE_PADDING,
&header_decoded));
- base::Optional<base::Value> header_value =
+ absl::optional<base::Value> header_value =
base::JSONReader::Read(header_decoded);
ASSERT_TRUE(header_value);
ASSERT_TRUE(header_value->is_dict());
diff --git a/chrome/browser/sharing/web_push/web_push_common.cc b/chrome/browser/sharing/web_push/web_push_common.cc
index 3fffd9a..b52787c 100644
--- a/chrome/browser/sharing/web_push/web_push_common.cc
+++ b/chrome/browser/sharing/web_push/web_push_common.cc
@@ -20,7 +20,7 @@
void InvokeWebPushCallback(WebPushCallback callback,
SendWebPushMessageResult result,
- base::Optional<std::string> message_id) {
+ absl::optional<std::string> message_id) {
DCHECK(message_id || result != SendWebPushMessageResult::kSuccessful);
base::UmaHistogramEnumeration("GCM.SendWebPushMessageResult", result);
std::move(callback).Run(result, std::move(message_id));
diff --git a/chrome/browser/sharing/web_push/web_push_common.h b/chrome/browser/sharing/web_push/web_push_common.h
index e391bbe..fb2672aff 100644
--- a/chrome/browser/sharing/web_push/web_push_common.h
+++ b/chrome/browser/sharing/web_push/web_push_common.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/callback.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Message to be delivered to the other party via Web Push.
struct WebPushMessage {
@@ -54,7 +54,7 @@
};
using WebPushCallback = base::OnceCallback<void(SendWebPushMessageResult,
- base::Optional<std::string>)>;
+ absl::optional<std::string>)>;
// Invoke |callback| with |result| and logs the |result| to UMA. This should be
// called when after a web push message is sent. If |result| is
@@ -62,7 +62,7 @@
void InvokeWebPushCallback(
WebPushCallback callback,
SendWebPushMessageResult result,
- base::Optional<std::string> message_id = base::nullopt);
+ absl::optional<std::string> message_id = absl::nullopt);
// Logs the size of message payload to UMA. This should be called right before a
// web push message is sent.
diff --git a/chrome/browser/sharing/web_push/web_push_sender.cc b/chrome/browser/sharing/web_push/web_push_sender.cc
index 0ce2903..261dd3a 100644
--- a/chrome/browser/sharing/web_push/web_push_sender.cc
+++ b/chrome/browser/sharing/web_push/web_push_sender.cc
@@ -46,7 +46,7 @@
// Other constants.
const char kContentEncodingOctetStream[] = "application/octet-stream";
-base::Optional<std::string> GetAuthHeader(crypto::ECPrivateKey* vapid_key) {
+absl::optional<std::string> GetAuthHeader(crypto::ECPrivateKey* vapid_key) {
base::Value claims(base::Value::Type::DICTIONARY);
claims.SetKey(kClaimsKeyAudience, base::Value(kFCMServerAudience));
@@ -55,18 +55,18 @@
.InSeconds();
// TODO: Year 2038 problem, base::Value does not support int64_t.
if (exp > INT_MAX)
- return base::nullopt;
+ return absl::nullopt;
claims.SetKey(kClaimsKeyExpirationTime,
base::Value(static_cast<int32_t>(exp)));
- base::Optional<std::string> jwt = CreateJSONWebToken(claims, vapid_key);
+ absl::optional<std::string> jwt = CreateJSONWebToken(claims, vapid_key);
if (!jwt)
- return base::nullopt;
+ return absl::nullopt;
std::string public_key;
if (!gcm::GetRawPublicKey(*vapid_key, &public_key))
- return base::nullopt;
+ return absl::nullopt;
std::string base64_public_key;
base::Base64UrlEncode(public_key, base::Base64UrlEncodePolicy::OMIT_PADDING,
@@ -153,7 +153,7 @@
DCHECK(vapid_key);
DCHECK_LE(message.time_to_live, message.kMaximumTTL);
- base::Optional<std::string> auth_header = GetAuthHeader(vapid_key);
+ absl::optional<std::string> auth_header = GetAuthHeader(vapid_key);
if (!auth_header) {
DLOG(ERROR) << "Failed to create JWT";
InvokeWebPushCallback(std::move(callback),
diff --git a/chrome/browser/sharing/web_push/web_push_sender.h b/chrome/browser/sharing/web_push/web_push_sender.h
index 731a2c2..7d7681a 100644
--- a/chrome/browser/sharing/web_push/web_push_sender.h
+++ b/chrome/browser/sharing/web_push/web_push_sender.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_SHARING_WEB_PUSH_WEB_PUSH_SENDER_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/sharing/web_push/web_push_common.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace network {
class SimpleURLLoader;
@@ -34,7 +34,7 @@
// |vapid_key|: Private key to sign VAPID header.
// |message|: WebPushMessage to be sent.
// |callback|: To be invoked with message_id if asynchronous operation
- // succeeded, or base::nullopt if operation failed.
+ // succeeded, or absl::nullopt if operation failed.
virtual void SendMessage(const std::string& fcm_token,
crypto::ECPrivateKey* vapid_key,
WebPushMessage message,
diff --git a/chrome/browser/sharing/web_push/web_push_sender_unittest.cc b/chrome/browser/sharing/web_push/web_push_sender_unittest.cc
index 6f04570..2a241e52 100644
--- a/chrome/browser/sharing/web_push/web_push_sender_unittest.cc
+++ b/chrome/browser/sharing/web_push/web_push_sender_unittest.cc
@@ -46,9 +46,9 @@
network::TestURLLoaderFactory& loader() { return test_url_loader_factory_; }
void OnMessageSent(SendWebPushMessageResult* result_out,
- base::Optional<std::string>* message_id_out,
+ absl::optional<std::string>* message_id_out,
SendWebPushMessageResult result,
- base::Optional<std::string> message_id) {
+ absl::optional<std::string> message_id) {
*result_out = result;
*message_id_out = message_id;
}
@@ -78,7 +78,7 @@
ASSERT_TRUE(private_key);
SendWebPushMessageResult result;
- base::Optional<std::string> message_id;
+ absl::optional<std::string> message_id;
sender()->SendMessage(
"fcm_token", private_key.get(), CreateMessage(),
base::BindOnce(&WebPushSenderTest::OnMessageSent, base::Unretained(this),
@@ -114,7 +114,7 @@
ASSERT_TRUE(base::Base64UrlDecode(data.substr(data_dot_position + 1),
base::Base64UrlDecodePolicy::IGNORE_PADDING,
&payload_decoded));
- base::Optional<base::Value> payload_value =
+ absl::optional<base::Value> payload_value =
base::JSONReader::Read(payload_decoded);
ASSERT_TRUE(payload_value);
ASSERT_TRUE(payload_value->is_dict());
@@ -176,7 +176,7 @@
std::unique_ptr<crypto::ECPrivateKey> private_key =
crypto::ECPrivateKey::CreateFromPrivateKeyInfo(std::vector<uint8_t>(
private_key_info.begin(), private_key_info.end()));
- base::Optional<std::string> message_id;
+ absl::optional<std::string> message_id;
std::string urgency;
WebPushMessage message = CreateMessage();
@@ -230,7 +230,7 @@
ASSERT_TRUE(private_key);
SendWebPushMessageResult result;
- base::Optional<std::string> message_id;
+ absl::optional<std::string> message_id;
sender()->SendMessage(
"fcm_token", private_key.get(), CreateMessage(),
base::BindOnce(&WebPushSenderTest::OnMessageSent, base::Unretained(this),
diff --git a/chrome/browser/sharing/webrtc/network_traversal_ice_config_fetcher.cc b/chrome/browser/sharing/webrtc/network_traversal_ice_config_fetcher.cc
index bdb407a1..bac68e2 100644
--- a/chrome/browser/sharing/webrtc/network_traversal_ice_config_fetcher.cc
+++ b/chrome/browser/sharing/webrtc/network_traversal_ice_config_fetcher.cc
@@ -6,13 +6,13 @@
#include "base/bind.h"
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "chrome/services/sharing/public/cpp/sharing_webrtc_metrics.h"
#include "google_apis/google_api_keys.h"
#include "net/base/load_flags.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -92,7 +92,7 @@
std::vector<sharing::mojom::IceServerPtr> ParseIceConfigJson(std::string json) {
std::vector<sharing::mojom::IceServerPtr> ice_servers;
- base::Optional<base::Value> response = base::JSONReader::Read(json);
+ absl::optional<base::Value> response = base::JSONReader::Read(json);
if (!response)
return ice_servers;
diff --git a/chrome/browser/sharing/webrtc/network_traversal_ice_config_fetcher.h b/chrome/browser/sharing/webrtc/network_traversal_ice_config_fetcher.h
index 2adaa866..855e1d4 100644
--- a/chrome/browser/sharing/webrtc/network_traversal_ice_config_fetcher.h
+++ b/chrome/browser/sharing/webrtc/network_traversal_ice_config_fetcher.h
@@ -8,8 +8,8 @@
#include "base/callback_forward.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chromeos/services/nearby/public/mojom/webrtc.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace network {
diff --git a/chrome/browser/sharing/webrtc/tachyon_ice_config_fetcher.cc b/chrome/browser/sharing/webrtc/tachyon_ice_config_fetcher.cc
index a70a49d..1387125 100644
--- a/chrome/browser/sharing/webrtc/tachyon_ice_config_fetcher.cc
+++ b/chrome/browser/sharing/webrtc/tachyon_ice_config_fetcher.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/sharing/webrtc/tachyon_ice_config_fetcher.h"
#include "base/bind.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
@@ -21,6 +20,7 @@
#include "net/base/load_flags.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/icu/source/common/unicode/locid.h"
#include "url/gurl.h"
diff --git a/chrome/browser/sharing/webrtc/tachyon_ice_config_fetcher.h b/chrome/browser/sharing/webrtc/tachyon_ice_config_fetcher.h
index ae5f34a..a2a410a9 100644
--- a/chrome/browser/sharing/webrtc/tachyon_ice_config_fetcher.h
+++ b/chrome/browser/sharing/webrtc/tachyon_ice_config_fetcher.h
@@ -8,11 +8,11 @@
#include "base/callback_forward.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chromeos/services/nearby/public/mojom/webrtc.mojom.h"
#include "components/signin/public/identity_manager/access_token_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "google_apis/gaia/google_service_auth_error.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace network {
class SharedURLLoaderFactory;
@@ -57,7 +57,7 @@
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
// Cache the last retrieved ICE servers.
- base::Optional<std::vector<sharing::mojom::IceServerPtr>> ice_server_cache_;
+ absl::optional<std::vector<sharing::mojom::IceServerPtr>> ice_server_cache_;
base::Time ice_server_cache_expiration_;
base::WeakPtrFactory<TachyonIceConfigFetcher> weak_ptr_factory_{this};
diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h
index 40dfe71..3413f93 100644
--- a/chrome/browser/shell_integration.h
+++ b/chrome/browser/shell_integration.h
@@ -12,8 +12,8 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "build/build_config.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/image/image_family.h"
#include "url/gurl.h"
@@ -34,10 +34,10 @@
// all OSs.
bool SetAsDefaultProtocolClient(const std::string& protocol);
-// Maps protocols to handler app ids. A protocol with no app id (base::nullopt)
+// Maps protocols to handler app ids. A protocol with no app id (absl::nullopt)
// will be handled by the browser which is useful for app protocols requiring
// disambiguation.
-using AppProtocolMap = std::map<std::string, base::Optional<std::string>>;
+using AppProtocolMap = std::map<std::string, absl::optional<std::string>>;
// Called with the outcome of an asynchronous app protocol operation.
using AppProtocolWorkerCallback = base::OnceCallback<void(bool)>;
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index 0259807..39e294a 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -595,8 +595,8 @@
for (const auto& protocol_pair : app_protocols) {
std::wstring protocol = base::UTF8ToWide(protocol_pair.first);
- const base::Optional<std::string>& app_id = protocol_pair.second;
- // A protocol with no app id (base::nullopt) will be handled by the
+ const absl::optional<std::string>& app_id = protocol_pair.second;
+ // A protocol with no app id (absl::nullopt) will be handled by the
// browser for disambiguation.
std::wstring handler_progid =
app_id.has_value()
diff --git a/chrome/browser/signin/chrome_signin_client.cc b/chrome/browser/signin/chrome_signin_client.cc
index 76ca51b..118395b 100644
--- a/chrome/browser/signin/chrome_signin_client.cc
+++ b/chrome/browser/signin/chrome_signin_client.cc
@@ -56,12 +56,12 @@
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
-#include "base/optional.h"
#include "chrome/browser/lacros/account_manager_util.h"
#include "chromeos/crosapi/mojom/account_manager.mojom.h"
#include "chromeos/lacros/lacros_chrome_service_impl.h"
#include "components/account_manager_core/account.h"
#include "components/account_manager_core/account_manager_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#endif
#if !defined(OS_ANDROID)
@@ -288,18 +288,18 @@
// Also note that this will be null for Secondary / non-Main Profiles in
// Lacros, because they do not start with the Chrome OS Device Account
// signed-in by default.
-base::Optional<account_manager::Account>
+absl::optional<account_manager::Account>
ChromeSigninClient::GetInitialPrimaryAccount() {
if (!IsAccountManagerAvailable(profile_)) {
// Secondary Profiles in Lacros do not start with the Device Account signed
// in.
- return base::nullopt;
+ return absl::nullopt;
}
const crosapi::mojom::AccountPtr& device_account =
chromeos::LacrosChromeServiceImpl::Get()->init_params()->device_account;
if (!device_account)
- return base::nullopt;
+ return absl::nullopt;
return account_manager::FromMojoAccount(device_account);
}
diff --git a/chrome/browser/signin/chrome_signin_client.h b/chrome/browser/signin/chrome_signin_client.h
index 3265827d..fe71b39 100644
--- a/chrome/browser/signin/chrome_signin_client.h
+++ b/chrome/browser/signin/chrome_signin_client.h
@@ -72,7 +72,7 @@
void SetDiceMigrationCompleted() override;
#if BUILDFLAG(IS_CHROMEOS_LACROS)
- base::Optional<account_manager::Account> GetInitialPrimaryAccount() override;
+ absl::optional<account_manager::Account> GetInitialPrimaryAccount() override;
#endif
// Used in tests to override the URLLoaderFactory returned by
diff --git a/chrome/browser/signin/chrome_signin_helper.cc b/chrome/browser/signin/chrome_signin_helper.cc
index db327750..5b4b726 100644
--- a/chrome/browser/signin/chrome_signin_helper.cc
+++ b/chrome/browser/signin/chrome_signin_helper.cc
@@ -296,7 +296,7 @@
// invalid, so that if/when this account is re-authenticated, we can force a
// reconciliation for this account instead of treating it as a no-op.
// See https://crbug.com/1012649 for details.
- base::Optional<AccountInfo> maybe_account_info =
+ absl::optional<AccountInfo> maybe_account_info =
identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByEmailAddress(
manage_accounts_params.email);
@@ -594,7 +594,7 @@
int incognito_availibility,
AccountConsistencyMethod account_consistency,
std::string gaia_id,
- const base::Optional<bool>& is_child_account,
+ const absl::optional<bool>& is_child_account,
#if BUILDFLAG(IS_CHROMEOS_ASH)
bool is_secondary_account_addition_allowed,
#endif
diff --git a/chrome/browser/signin/chrome_signin_helper.h b/chrome/browser/signin/chrome_signin_helper.h
index 8bfb852..4173297 100644
--- a/chrome/browser/signin/chrome_signin_helper.h
+++ b/chrome/browser/signin/chrome_signin_helper.h
@@ -98,7 +98,7 @@
int incognito_availibility,
AccountConsistencyMethod account_consistency,
std::string gaia_id,
- const base::Optional<bool>& is_child_account,
+ const absl::optional<bool>& is_child_account,
#if BUILDFLAG(IS_CHROMEOS_ASH)
bool is_secondary_account_addition_allowed,
#endif
diff --git a/chrome/browser/signin/chrome_signin_proxying_url_loader_factory.cc b/chrome/browser/signin/chrome_signin_proxying_url_loader_factory.cc
index 1cdc56a..e7f2099d 100644
--- a/chrome/browser/signin/chrome_signin_proxying_url_loader_factory.cc
+++ b/chrome/browser/signin/chrome_signin_proxying_url_loader_factory.cc
@@ -101,7 +101,7 @@
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
- const base::Optional<GURL>& new_url) override;
+ const absl::optional<GURL>& new_url) override;
void SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) override {
@@ -342,7 +342,7 @@
const std::vector<std::string>& removed_headers_ext,
const net::HttpRequestHeaders& modified_headers_ext,
const net::HttpRequestHeaders& modified_cors_exempt_headers_ext,
- const base::Optional<GURL>& opt_new_url) {
+ const absl::optional<GURL>& opt_new_url) {
std::vector<std::string> removed_headers = removed_headers_ext;
net::HttpRequestHeaders modified_headers = modified_headers_ext;
net::HttpRequestHeaders modified_cors_exempt_headers =
diff --git a/chrome/browser/signin/dice_signed_in_profile_creator.cc b/chrome/browser/signin/dice_signed_in_profile_creator.cc
index 887812f..7e940ff 100644
--- a/chrome/browser/signin/dice_signed_in_profile_creator.cc
+++ b/chrome/browser/signin/dice_signed_in_profile_creator.cc
@@ -94,7 +94,7 @@
Profile* source_profile,
CoreAccountId account_id,
const std::u16string& local_profile_name,
- base::Optional<size_t> icon_index,
+ absl::optional<size_t> icon_index,
bool use_guest_profile,
base::OnceCallback<void(Profile*)> callback)
: source_profile_(source_profile),
diff --git a/chrome/browser/signin/dice_signed_in_profile_creator.h b/chrome/browser/signin/dice_signed_in_profile_creator.h
index 59b65a2..a4d27d7 100644
--- a/chrome/browser/signin/dice_signed_in_profile_creator.h
+++ b/chrome/browser/signin/dice_signed_in_profile_creator.h
@@ -9,9 +9,9 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/profiles/profile.h"
#include "google_apis/gaia/core_account_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class TokensLoadedCallbackRunner;
@@ -47,7 +47,7 @@
DiceSignedInProfileCreator(Profile* source_profile,
CoreAccountId account_id,
const std::u16string& local_profile_name,
- base::Optional<size_t> icon_index,
+ absl::optional<size_t> icon_index,
bool use_guest_profile,
base::OnceCallback<void(Profile*)> callback);
diff --git a/chrome/browser/signin/dice_signed_in_profile_creator_unittest.cc b/chrome/browser/signin/dice_signed_in_profile_creator_unittest.cc
index 35974468..ccb93c275 100644
--- a/chrome/browser/signin/dice_signed_in_profile_creator_unittest.cc
+++ b/chrome/browser/signin/dice_signed_in_profile_creator_unittest.cc
@@ -215,7 +215,7 @@
set_profile_added_closure(profile_added_loop.QuitClosure());
std::unique_ptr<DiceSignedInProfileCreator> creator =
std::make_unique<DiceSignedInProfileCreator>(
- profile(), account_info.account_id, std::u16string(), base::nullopt,
+ profile(), account_info.account_id, std::u16string(), absl::nullopt,
use_guest_profile(),
base::BindOnce(&DiceSignedInProfileCreatorTest::OnProfileCreated,
base::Unretained(this), creator_loop.QuitClosure()));
@@ -251,7 +251,7 @@
identity_test_env()->MakeAccountAvailable("[email protected]");
std::unique_ptr<DiceSignedInProfileCreator> creator =
std::make_unique<DiceSignedInProfileCreator>(
- profile(), account_info.account_id, std::u16string(), base::nullopt,
+ profile(), account_info.account_id, std::u16string(), absl::nullopt,
use_guest_profile(),
base::BindOnce(&DiceSignedInProfileCreatorTest::OnProfileCreated,
base::Unretained(this), base::OnceClosure()));
@@ -271,7 +271,7 @@
set_profile_added_closure(profile_added_loop.QuitClosure());
std::unique_ptr<DiceSignedInProfileCreator> creator =
std::make_unique<DiceSignedInProfileCreator>(
- profile(), account_info.account_id, std::u16string(), base::nullopt,
+ profile(), account_info.account_id, std::u16string(), absl::nullopt,
use_guest_profile(),
base::BindOnce(&DiceSignedInProfileCreatorTest::OnProfileCreated,
base::Unretained(this), creator_loop.QuitClosure()));
diff --git a/chrome/browser/signin/dice_web_signin_interceptor.cc b/chrome/browser/signin/dice_web_signin_interceptor.cc
index a7bb679..2f664c4 100644
--- a/chrome/browser/signin/dice_web_signin_interceptor.cc
+++ b/chrome/browser/signin/dice_web_signin_interceptor.cc
@@ -11,7 +11,6 @@
#include "base/i18n/case_conversion.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -46,6 +45,7 @@
#include "components/prefs/scoped_user_pref_update.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "google_apis/gaia/gaia_auth_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
@@ -69,7 +69,7 @@
if (primary_core_account_info.IsEmpty())
return AccountInfo();
- base::Optional<AccountInfo> primary_account_info =
+ absl::optional<AccountInfo> primary_account_info =
manager->FindExtendedAccountInfoForAccountWithRefreshToken(
primary_core_account_info);
@@ -151,7 +151,7 @@
registry->RegisterBooleanPref(prefs::kSigninInterceptionEnabled, true);
}
-base::Optional<SigninInterceptionHeuristicOutcome>
+absl::optional<SigninInterceptionHeuristicOutcome>
DiceWebSigninInterceptor::GetHeuristicOutcome(
bool is_new_account,
bool is_sync_signin,
@@ -206,7 +206,7 @@
kAbortUserDeclinedProfileForAccount;
}
- return base::nullopt;
+ return absl::nullopt;
}
void DiceWebSigninInterceptor::MaybeInterceptWebSignin(
@@ -253,13 +253,13 @@
return;
}
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
identity_manager_
->FindExtendedAccountInfoForAccountWithRefreshTokenByAccountId(
account_id);
DCHECK(account_info) << "Intercepting unknown account.";
const ProfileAttributesEntry* entry = nullptr;
- base::Optional<SigninInterceptionHeuristicOutcome> heuristic_outcome =
+ absl::optional<SigninInterceptionHeuristicOutcome> heuristic_outcome =
GetHeuristicOutcome(is_new_account, is_sync_signin, account_info->email,
&entry);
account_id_ = account_id;
@@ -375,7 +375,7 @@
if (intercepted_account_info.IsManaged())
return true;
- base::Optional<AccountInfo> primary_account_info =
+ absl::optional<AccountInfo> primary_account_info =
identity_manager_->FindExtendedAccountInfoForAccountWithRefreshToken(
primary_core_account_info);
@@ -415,7 +415,7 @@
"Signin.Intercept.AccountInfoFetchDuration",
base::TimeTicks::Now() - account_info_fetch_start_time_);
- base::Optional<SigninInterceptionType> interception_type;
+ absl::optional<SigninInterceptionType> interception_type;
if (ShouldShowEnterpriseBubble(info))
interception_type = SigninInterceptionType::kEnterprise;
@@ -506,11 +506,11 @@
std::make_unique<DiceSignedInProfileCreator>(
profile_, account_id_, profile_path,
base::BindOnce(&DiceWebSigninInterceptor::OnNewSignedInProfileCreated,
- base::Unretained(this), base::nullopt));
+ base::Unretained(this), absl::nullopt));
}
void DiceWebSigninInterceptor::OnNewSignedInProfileCreated(
- base::Optional<SkColor> profile_color,
+ absl::optional<SkColor> profile_color,
Profile* new_profile) {
DCHECK(dice_signed_in_profile_creator_);
dice_signed_in_profile_creator_.reset();
@@ -586,7 +586,7 @@
DictionaryPrefUpdate update(profile_->GetPrefs(),
kProfileCreationInterceptionDeclinedPref);
std::string key = GetPersistentEmailHash(email);
- base::Optional<int> declined_count = update->FindIntKey(key);
+ absl::optional<int> declined_count = update->FindIntKey(key);
update->SetIntKey(key, declined_count.value_or(0) + 1);
}
@@ -594,7 +594,7 @@
const std::string& email) const {
const base::DictionaryValue* pref_data = profile_->GetPrefs()->GetDictionary(
kProfileCreationInterceptionDeclinedPref);
- base::Optional<int> declined_count =
+ absl::optional<int> declined_count =
pref_data->FindIntKey(GetPersistentEmailHash(email));
// Check if the user declined 2 times.
constexpr int kMaxProfileCreationDeclinedCount = 2;
@@ -607,7 +607,7 @@
DictionaryPrefUpdate update(profile_->GetPrefs(),
kProfileSwitchInterceptionDeclinedPref);
std::string key = GetPersistentEmailHash(email);
- base::Optional<int> declined_count = update->FindIntKey(key);
+ absl::optional<int> declined_count = update->FindIntKey(key);
update->SetIntKey(key, declined_count.value_or(0) + 1);
}
@@ -615,7 +615,7 @@
const std::string& email) const {
const base::DictionaryValue* pref_data = profile_->GetPrefs()->GetDictionary(
kProfileSwitchInterceptionDeclinedPref);
- base::Optional<int> declined_count =
+ absl::optional<int> declined_count =
pref_data->FindIntKey(GetPersistentEmailHash(email));
// The limit is controlled by an experiment. Zero value completely turns off
diff --git a/chrome/browser/signin/dice_web_signin_interceptor.h b/chrome/browser/signin/dice_web_signin_interceptor.h
index 6d3e997..22978f7 100644
--- a/chrome/browser/signin/dice_web_signin_interceptor.h
+++ b/chrome/browser/signin/dice_web_signin_interceptor.h
@@ -11,13 +11,13 @@
#include "base/cancelable_callback.h"
#include "base/feature_list.h"
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "content/public/browser/web_contents_observer.h"
#include "google_apis/gaia/core_account_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
namespace base {
@@ -218,7 +218,7 @@
// in |entry|.
// In some cases the outcome cannot be fully computed synchronously, when this
// happens, the signin interception is highly likely (but not guaranteed).
- base::Optional<SigninInterceptionHeuristicOutcome> GetHeuristicOutcome(
+ absl::optional<SigninInterceptionHeuristicOutcome> GetHeuristicOutcome(
bool is_new_account,
bool is_sync_signin,
const std::string& email,
@@ -278,7 +278,7 @@
// Called when the new profile is created or loaded from disk.
// `profile_color` is set as theme color for the profile ; it should be
// nullopt if the profile is not new (loaded from disk).
- void OnNewSignedInProfileCreated(base::Optional<SkColor> profile_color,
+ void OnNewSignedInProfileCreated(absl::optional<SkColor> profile_color,
Profile* new_profile);
// Called when the new browser is created after interception. Passed as
diff --git a/chrome/browser/signin/header_modification_delegate_impl.cc b/chrome/browser/signin/header_modification_delegate_impl.cc
index 4b83419..fe83bff 100644
--- a/chrome/browser/signin/header_modification_delegate_impl.cc
+++ b/chrome/browser/signin/header_modification_delegate_impl.cc
@@ -80,13 +80,13 @@
IdentityManagerFactory::GetForProfile(profile_);
CoreAccountInfo account =
identity_manager->GetPrimaryAccountInfo(consent_level);
- base::Optional<bool> is_child_account = base::nullopt;
+ absl::optional<bool> is_child_account = absl::nullopt;
if (!account.IsEmpty()) {
- base::Optional<AccountInfo> extended_account_info =
+ absl::optional<AccountInfo> extended_account_info =
identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
account);
if (extended_account_info.has_value()) {
- is_child_account = base::make_optional<bool>(
+ is_child_account = absl::make_optional<bool>(
extended_account_info.value().is_child_account);
}
}
diff --git a/chrome/browser/signin/signin_manager.cc b/chrome/browser/signin/signin_manager.cc
index 55a2d88..bba04a5 100644
--- a/chrome/browser/signin/signin_manager.cc
+++ b/chrome/browser/signin/signin_manager.cc
@@ -22,7 +22,7 @@
}
void SigninManager::UpdateUnconsentedPrimaryAccount() {
- base::Optional<CoreAccountInfo> account =
+ absl::optional<CoreAccountInfo> account =
ComputeUnconsentedPrimaryAccountInfo();
DCHECK(!account || !account->IsEmpty());
@@ -43,7 +43,7 @@
}
}
-base::Optional<CoreAccountInfo>
+absl::optional<CoreAccountInfo>
SigninManager::ComputeUnconsentedPrimaryAccountInfo() const {
// UPA is equal to the primary account with sync consent if it exists.
if (identity_manager_->HasPrimaryAccount(signin::ConsentLevel::kSync)) {
@@ -65,10 +65,10 @@
// in cookies if it exists and has a refresh token.
if (cookie_accounts.empty()) {
// Cookies are empty, the UPA is empty.
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
identity_manager_
->FindExtendedAccountInfoForAccountWithRefreshTokenByAccountId(
cookie_accounts[0].id);
@@ -79,11 +79,11 @@
identity_manager_->HasAccountWithRefreshTokenInPersistentErrorState(
account_info->account_id);
- return error_state ? base::nullopt : account_info;
+ return error_state ? absl::nullopt : account_info;
}
if (!identity_manager_->HasPrimaryAccount(signin::ConsentLevel::kSignin))
- return base::nullopt;
+ return absl::nullopt;
// If cookies or tokens are not loaded, it is not possible to fully compute
// the unconsented primary account. However, if the current unconsented
@@ -95,21 +95,21 @@
!identity_manager_->HasAccountWithRefreshToken(current_account)) {
// Tokens are loaded, but the current UPA doesn't have a refresh token.
// Clear the current UPA.
- return base::nullopt;
+ return absl::nullopt;
}
if (!are_refresh_tokens_loaded &&
unconsented_primary_account_revoked_during_load_) {
// Tokens are not loaded, but the current UPA's refresh token has been
// revoked. Clear the current UPA.
- return base::nullopt;
+ return absl::nullopt;
}
if (cookie_info.accounts_are_fresh) {
if (cookie_accounts.empty() || cookie_accounts[0].id != current_account) {
// The current UPA is not the first in fresh cookies. It needs to be
// cleared.
- return base::nullopt;
+ return absl::nullopt;
}
}
diff --git a/chrome/browser/signin/signin_manager.h b/chrome/browser/signin/signin_manager.h
index 4085b6b..f08c790 100644
--- a/chrome/browser/signin/signin_manager.h
+++ b/chrome/browser/signin/signin_manager.h
@@ -31,9 +31,9 @@
// current UPA, the other cases are if tokens are not loaded but the current
// UPA's refresh token has been rekoved or tokens are loaded but the current
// UPA does not have a refresh token. If the UPA is invalid, it needs to be
- // cleared, |base::nullopt| is returned. If it is still valid, returns the
+ // cleared, |absl::nullopt| is returned. If it is still valid, returns the
// valid UPA.
- base::Optional<CoreAccountInfo> ComputeUnconsentedPrimaryAccountInfo() const;
+ absl::optional<CoreAccountInfo> ComputeUnconsentedPrimaryAccountInfo() const;
// signin::IdentityManager::Observer implementation.
void OnPrimaryAccountChanged(
diff --git a/chrome/browser/signin/signin_status_metrics_provider_chromeos.cc b/chrome/browser/signin/signin_status_metrics_provider_chromeos.cc
index a27c717..2c67efab 100644
--- a/chrome/browser/signin/signin_status_metrics_provider_chromeos.cc
+++ b/chrome/browser/signin/signin_status_metrics_provider_chromeos.cc
@@ -66,4 +66,4 @@
guest_for_testing_ = is_guest;
}
-base::Optional<bool> SigninStatusMetricsProviderChromeOS::guest_for_testing_;
+absl::optional<bool> SigninStatusMetricsProviderChromeOS::guest_for_testing_;
diff --git a/chrome/browser/signin/signin_status_metrics_provider_chromeos.h b/chrome/browser/signin/signin_status_metrics_provider_chromeos.h
index c1d473ab..970ad4f 100644
--- a/chrome/browser/signin/signin_status_metrics_provider_chromeos.h
+++ b/chrome/browser/signin/signin_status_metrics_provider_chromeos.h
@@ -7,8 +7,8 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "components/signin/core/browser/signin_status_metrics_provider_base.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Record and report the browser sign-in status on ChromeOS during each UMA
// session. On ChromeOS, the browser can only be at unsigned-in status when
@@ -48,7 +48,7 @@
// Used only for testing.
static void SetGuestForTesting(bool is_guest);
- static base::Optional<bool> guest_for_testing_;
+ static absl::optional<bool> guest_for_testing_;
DISALLOW_COPY_AND_ASSIGN(SigninStatusMetricsProviderChromeOS);
};
diff --git a/chrome/browser/signin/signin_ui_util.cc b/chrome/browser/signin/signin_ui_util.cc
index d3be79b..afd97024 100644
--- a/chrome/browser/signin/signin_ui_util.cc
+++ b/chrome/browser/signin/signin_ui_util.cc
@@ -339,7 +339,7 @@
if (core_info.IsEmpty())
return profile_attributes_entry.GetName();
- base::Optional<AccountInfo> extended_info =
+ absl::optional<AccountInfo> extended_info =
identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByAccountId(
core_info.account_id);
diff --git a/chrome/browser/site_isolation/chrome_site_per_process_browsertest.cc b/chrome/browser/site_isolation/chrome_site_per_process_browsertest.cc
index d2a347b..33541e1 100644
--- a/chrome/browser/site_isolation/chrome_site_per_process_browsertest.cc
+++ b/chrome/browser/site_isolation/chrome_site_per_process_browsertest.cc
@@ -445,7 +445,7 @@
content::WebContents* web_contents,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin) override {}
+ const absl::optional<url::Origin>& initiating_origin) override {}
scoped_refptr<shell_integration::DefaultProtocolClientWorker>
CreateShellWorker(
diff --git a/chrome/browser/speech/chrome_speech_recognition_service.cc b/chrome/browser/speech/chrome_speech_recognition_service.cc
index d513ec6..ba1ca9e 100644
--- a/chrome/browser/speech/chrome_speech_recognition_service.cc
+++ b/chrome/browser/speech/chrome_speech_recognition_service.cc
@@ -106,7 +106,7 @@
base::FilePath ChromeSpeechRecognitionService::GetSodaConfigPath(
PrefService* prefs) {
- base::Optional<speech::SodaLanguagePackComponentConfig> language_config =
+ absl::optional<speech::SodaLanguagePackComponentConfig> language_config =
speech::GetLanguageComponentConfig(
prefs->GetString(prefs::kLiveCaptionLanguageCode));
diff --git a/chrome/browser/speech/fake_speech_recognition_service.cc b/chrome/browser/speech/fake_speech_recognition_service.cc
index e6f4943d..ca08c4f3 100644
--- a/chrome/browser/speech/fake_speech_recognition_service.cc
+++ b/chrome/browser/speech/fake_speech_recognition_service.cc
@@ -60,7 +60,7 @@
void FakeSpeechRecognitionService::Stop() {
capturing_audio_ = false;
device_id_ = "";
- audio_parameters_ = base::nullopt;
+ audio_parameters_ = absl::nullopt;
}
void FakeSpeechRecognitionService::SendAudioToSpeechRecognitionService(
@@ -102,7 +102,7 @@
recognizer_receiver_.reset();
capturing_audio_ = false;
device_id_ = "";
- audio_parameters_ = base::nullopt;
+ audio_parameters_ = absl::nullopt;
}
} // namespace speech
diff --git a/chrome/browser/speech/fake_speech_recognition_service.h b/chrome/browser/speech/fake_speech_recognition_service.h
index f0d973b..f8d4855 100644
--- a/chrome/browser/speech/fake_speech_recognition_service.h
+++ b/chrome/browser/speech/fake_speech_recognition_service.h
@@ -74,7 +74,7 @@
std::string device_id() { return device_id_; }
- const base::Optional<::media::AudioParameters>& audio_parameters() {
+ const absl::optional<::media::AudioParameters>& audio_parameters() {
return audio_parameters_;
}
@@ -96,7 +96,7 @@
// The device ID used to capture audio.
std::string device_id_;
// The audio parameters used to capture audio.
- base::Optional<::media::AudioParameters> audio_parameters_;
+ absl::optional<::media::AudioParameters> audio_parameters_;
base::OnceClosure recognition_started_closure_;
diff --git a/chrome/browser/speech/network_speech_recognizer.cc b/chrome/browser/speech/network_speech_recognizer.cc
index 3f16d20..fdb1cc5 100644
--- a/chrome/browser/speech/network_speech_recognizer.cc
+++ b/chrome/browser/speech/network_speech_recognizer.cc
@@ -225,7 +225,7 @@
FROM_HERE,
base::BindOnce(&SpeechRecognizerDelegate::OnSpeechResult, delegate_,
result_str, final_count == results.size(),
- base::nullopt /* word offsets */));
+ absl::nullopt /* word offsets */));
last_result_str_ = result_str;
}
diff --git a/chrome/browser/speech/network_speech_recognizer_browsertest.cc b/chrome/browser/speech/network_speech_recognizer_browsertest.cc
index f28da63..4ddb8557 100644
--- a/chrome/browser/speech/network_speech_recognizer_browsertest.cc
+++ b/chrome/browser/speech/network_speech_recognizer_browsertest.cc
@@ -11,7 +11,6 @@
#include "base/command_line.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
@@ -27,6 +26,7 @@
#include "content/public/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using ::testing::DoDefault;
using ::testing::InvokeWithoutArgs;
@@ -43,7 +43,7 @@
OnSpeechResult,
void(const std::u16string& text,
bool is_final,
- const base::Optional<SpeechRecognizerDelegate::TranscriptTiming>&
+ const absl::optional<SpeechRecognizerDelegate::TranscriptTiming>&
timing));
MOCK_METHOD1(OnSpeechSoundLevelChanged, void(int16_t));
MOCK_METHOD1(OnSpeechRecognitionStateChanged, void(SpeechRecognizerStatus));
diff --git a/chrome/browser/speech/on_device_speech_recognizer.cc b/chrome/browser/speech/on_device_speech_recognizer.cc
index 08faaded3..758a7ef9c 100644
--- a/chrome/browser/speech/on_device_speech_recognizer.cc
+++ b/chrome/browser/speech/on_device_speech_recognizer.cc
@@ -32,7 +32,7 @@
static constexpr int kPollingTimesPerSecond = 10;
media::AudioParameters GetAudioParameters(
- const base::Optional<media::AudioParameters>& params,
+ const absl::optional<media::AudioParameters>& params,
bool is_multichannel_supported) {
if (params) {
media::AudioParameters result = params.value();
@@ -136,7 +136,7 @@
return;
UpdateStatus(SpeechRecognizerStatus::SPEECH_RECOGNIZER_IN_SPEECH);
delegate()->OnSpeechResult(base::UTF8ToUTF16(result->transcription),
- result->is_final, base::nullopt);
+ result->is_final, absl::nullopt);
// Returning true ensures the speech recognition continues.
std::move(reply).Run(true);
}
@@ -161,7 +161,7 @@
}
void OnDeviceSpeechRecognizer::StartFetchingOnInputDeviceInfo(
- const base::Optional<media::AudioParameters>& params) {
+ const absl::optional<media::AudioParameters>& params) {
// waiting_for_params_ was set before requesting audio params from the
// AudioSystem, which returns here asynchronously. If this has changed, then
// we shouldn't start up any more.
diff --git a/chrome/browser/speech/on_device_speech_recognizer.h b/chrome/browser/speech/on_device_speech_recognizer.h
index 0fd3d2d..067610e 100644
--- a/chrome/browser/speech/on_device_speech_recognizer.h
+++ b/chrome/browser/speech/on_device_speech_recognizer.h
@@ -62,7 +62,7 @@
void OnRecognizerBound(bool success);
void OnRecognizerDisconnected();
void StartFetchingOnInputDeviceInfo(
- const base::Optional<media::AudioParameters>& params);
+ const absl::optional<media::AudioParameters>& params);
// Helper function to send the delegate updates to SpeechRecognizerStatus
// only when the status has changed.
diff --git a/chrome/browser/speech/on_device_speech_recognizer_browsertest.cc b/chrome/browser/speech/on_device_speech_recognizer_browsertest.cc
index a1cce13f..845c052 100644
--- a/chrome/browser/speech/on_device_speech_recognizer_browsertest.cc
+++ b/chrome/browser/speech/on_device_speech_recognizer_browsertest.cc
@@ -41,7 +41,7 @@
OnSpeechResult,
void(const std::u16string& text,
bool is_final,
- const base::Optional<SpeechRecognizerDelegate::TranscriptTiming>&
+ const absl::optional<SpeechRecognizerDelegate::TranscriptTiming>&
timing));
MOCK_METHOD1(OnSpeechSoundLevelChanged, void(int16_t));
MOCK_METHOD1(OnSpeechRecognitionStateChanged, void(SpeechRecognizerStatus));
@@ -79,12 +79,12 @@
void SetInputStreamParameters(
const std::string& device_id,
- const base::Optional<media::AudioParameters>& params) {
+ const absl::optional<media::AudioParameters>& params) {
params_[device_id] = params;
}
private:
- std::map<std::string, base::Optional<media::AudioParameters>> params_;
+ std::map<std::string, absl::optional<media::AudioParameters>> params_;
};
// Tests OnDeviceSpeechRecognizer plumbing with a fake SpeechRecognitionService.
@@ -148,7 +148,7 @@
}
void StartListeningWithAudioParams(
- const base::Optional<media::AudioParameters>& params) {
+ const absl::optional<media::AudioParameters>& params) {
std::unique_ptr<MockAudioSystem> mock_audio_system =
std::make_unique<MockAudioSystem>();
mock_audio_system->SetInputStreamParameters(
@@ -294,7 +294,7 @@
IN_PROC_BROWSER_TEST_F(OnDeviceSpeechRecognizerTest, DefaultParameters) {
fake_service_->set_multichannel_supported(true);
ConstructRecognizerAndWaitForReady();
- StartListeningWithAudioParams(base::nullopt);
+ StartListeningWithAudioParams(absl::nullopt);
EXPECT_EQ(media::AudioDeviceDescription::kDefaultDeviceId,
fake_service_->device_id());
diff --git a/chrome/browser/speech/speech_recognition_service_browsertest.cc b/chrome/browser/speech/speech_recognition_service_browsertest.cc
index 5736f55..ddfb8d520 100644
--- a/chrome/browser/speech/speech_recognition_service_browsertest.cc
+++ b/chrome/browser/speech/speech_recognition_service_browsertest.cc
@@ -100,7 +100,7 @@
mojo::Remote<media::mojom::AudioInputStreamClient> client_;
mojo::Receiver<media::mojom::AudioInputStream> stream_receiver_;
std::string device_id_;
- base::Optional<media::AudioParameters> params_;
+ absl::optional<media::AudioParameters> params_;
private:
void OnTimer() {
diff --git a/chrome/browser/speech/speech_recognizer_delegate.h b/chrome/browser/speech/speech_recognizer_delegate.h
index f02191f..d7c86b26 100644
--- a/chrome/browser/speech/speech_recognizer_delegate.h
+++ b/chrome/browser/speech/speech_recognizer_delegate.h
@@ -58,7 +58,7 @@
virtual void OnSpeechResult(
const std::u16string& text,
bool is_final,
- const base::Optional<TranscriptTiming>& timing) = 0;
+ const absl::optional<TranscriptTiming>& timing) = 0;
// Invoked regularly to indicate the average sound volume.
virtual void OnSpeechSoundLevelChanged(int16_t level) = 0;
diff --git a/chrome/browser/speech/tts_controller_delegate_impl.cc b/chrome/browser/speech/tts_controller_delegate_impl.cc
index a0503e8..7c789b5e 100644
--- a/chrome/browser/speech/tts_controller_delegate_impl.cc
+++ b/chrome/browser/speech/tts_controller_delegate_impl.cc
@@ -21,13 +21,13 @@
namespace {
-base::Optional<content::TtsControllerDelegate::PreferredVoiceId>
+absl::optional<content::TtsControllerDelegate::PreferredVoiceId>
PreferredVoiceIdFromString(const base::DictionaryValue* pref,
const std::string& pref_key) {
std::string voice_id;
pref->GetString(l10n_util::GetLanguage(pref_key), &voice_id);
if (voice_id.empty())
- return base::nullopt;
+ return absl::nullopt;
std::unique_ptr<base::DictionaryValue> json =
base::DictionaryValue::From(base::JSONReader::ReadDeprecated(voice_id));
@@ -35,7 +35,7 @@
std::string id;
json->GetString("name", &name);
json->GetString("extension", &id);
- return base::Optional<content::TtsControllerDelegate::PreferredVoiceId>(
+ return absl::optional<content::TtsControllerDelegate::PreferredVoiceId>(
{name, id});
}
diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
index 5d2f0c0..220ef76 100644
--- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
+++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
@@ -324,7 +324,7 @@
wait_until_ready_to_sync_cb_ = std::move(done);
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
SpellcheckCustomDictionary::MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
@@ -383,7 +383,7 @@
return data;
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
SpellcheckCustomDictionary::ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) {
@@ -414,7 +414,7 @@
Notify(*dictionary_change);
Save(std::move(dictionary_change));
- return base::nullopt;
+ return absl::nullopt;
}
SpellcheckCustomDictionary::LoadFileResult::LoadFileResult()
@@ -510,11 +510,11 @@
std::move(dictionary_change), custom_dictionary_path_));
}
-base::Optional<syncer::ModelError> SpellcheckCustomDictionary::Sync(
+absl::optional<syncer::ModelError> SpellcheckCustomDictionary::Sync(
const Change& dictionary_change) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!IsSyncing() || dictionary_change.empty())
- return base::nullopt;
+ return absl::nullopt;
// The number of words on the sync server should not exceed the limits.
int server_size = static_cast<int>(words_.size()) -
@@ -549,7 +549,7 @@
}
// Send the changes to the sync processor.
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
sync_processor_->ProcessSyncChanges(FROM_HERE, sync_change_list);
if (error.has_value())
return error;
@@ -559,7 +559,7 @@
if (words_.size() > spellcheck::kMaxSyncableDictionaryWords)
StopSyncing(syncer::DICTIONARY);
- return base::nullopt;
+ return absl::nullopt;
}
void SpellcheckCustomDictionary::Notify(const Change& dictionary_change) {
diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.h b/chrome/browser/spellchecker/spellcheck_custom_dictionary.h
index 17f726f..2aeaa72 100644
--- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.h
+++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.h
@@ -162,14 +162,14 @@
// Overridden from syncer::SyncableService:
void WaitUntilReadyToSync(base::OnceClosure done) override;
- base::Optional<syncer::ModelError> MergeDataAndStartSyncing(
+ absl::optional<syncer::ModelError> MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
std::unique_ptr<syncer::SyncErrorFactory> sync_error_handler) override;
void StopSyncing(syncer::ModelType type) override;
syncer::SyncDataList GetAllSyncDataForTesting(syncer::ModelType type) const;
- base::Optional<syncer::ModelError> ProcessSyncChanges(
+ absl::optional<syncer::ModelError> ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) override;
@@ -210,7 +210,7 @@
// Notifies the sync service of the |dictionary_change|. Syncs up to the
// maximum syncable words on the server. Disables syncing of this dictionary
// if the server contains the maximum number of syncable words.
- base::Optional<syncer::ModelError> Sync(const Change& dictionary_change);
+ absl::optional<syncer::ModelError> Sync(const Change& dictionary_change);
// Notifies observers of the dictionary change if the dictionary has been
// changed.
diff --git a/chrome/browser/ssl/chrome_expect_ct_reporter_browsertest.cc b/chrome/browser/ssl/chrome_expect_ct_reporter_browsertest.cc
index 1ee434b..cc2ecc1 100644
--- a/chrome/browser/ssl/chrome_expect_ct_reporter_browsertest.cc
+++ b/chrome/browser/ssl/chrome_expect_ct_reporter_browsertest.cc
@@ -45,7 +45,7 @@
~ExpectCTBrowserTest() override {
SystemNetworkContextManager::SetEnableCertificateTransparencyForTesting(
- base::nullopt);
+ absl::nullopt);
}
void SetUpOnMainThread() override {
diff --git a/chrome/browser/ssl/ocsp_browsertest.cc b/chrome/browser/ssl/ocsp_browsertest.cc
index 2b9c36a..f19063a 100644
--- a/chrome/browser/ssl/ocsp_browsertest.cc
+++ b/chrome/browser/ssl/ocsp_browsertest.cc
@@ -72,7 +72,7 @@
InProcessBrowserTest::TearDown();
SystemNetworkContextManager::SetEnableCertificateTransparencyForTesting(
- base::nullopt);
+ absl::nullopt);
}
void SetUpOnMainThread() override {
diff --git a/chrome/browser/ssl/sct_reporting_service_browsertest.cc b/chrome/browser/ssl/sct_reporting_service_browsertest.cc
index 7cf5473bd..247a789 100644
--- a/chrome/browser/ssl/sct_reporting_service_browsertest.cc
+++ b/chrome/browser/ssl/sct_reporting_service_browsertest.cc
@@ -104,7 +104,7 @@
}
~SCTReportingServiceBrowserTest() override {
SystemNetworkContextManager::SetEnableCertificateTransparencyForTesting(
- base::nullopt);
+ absl::nullopt);
}
SCTReportingServiceBrowserTest(const SCTReportingServiceBrowserTest&) =
@@ -616,7 +616,7 @@
void TearDownOnMainThread() override {
// Reset the retry delay override.
mojo::ScopedAllowSyncCallForTesting allow_sync_call;
- network_service_test()->SetSCTAuditingRetryDelay(base::nullopt);
+ network_service_test()->SetSCTAuditingRetryDelay(absl::nullopt);
SCTReportingServiceBrowserTest::TearDownOnMainThread();
}
diff --git a/chrome/browser/ssl/security_state_tab_helper_browsertest.cc b/chrome/browser/ssl/security_state_tab_helper_browsertest.cc
index 2867ba5c..b76635ca 100644
--- a/chrome/browser/ssl/security_state_tab_helper_browsertest.cc
+++ b/chrome/browser/ssl/security_state_tab_helper_browsertest.cc
@@ -448,7 +448,7 @@
~SecurityStateTabHelperTest() override {
SystemNetworkContextManager::SetEnableCertificateTransparencyForTesting(
- base::nullopt);
+ absl::nullopt);
}
void SetUpOnMainThread() override {
diff --git a/chrome/browser/ssl/ssl_browsertest.cc b/chrome/browser/ssl/ssl_browsertest.cc
index e8ecce6..369e1d0 100644
--- a/chrome/browser/ssl/ssl_browsertest.cc
+++ b/chrome/browser/ssl/ssl_browsertest.cc
@@ -406,7 +406,7 @@
// Basic sanity checks on the request.
EXPECT_EQ("/pkp", request.relative_url);
EXPECT_EQ("POST", request.method_string);
- base::Optional<base::Value> value = base::JSONReader::Read(request.content);
+ absl::optional<base::Value> value = base::JSONReader::Read(request.content);
EXPECT_TRUE(value);
content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE, quit_closure);
@@ -1694,7 +1694,7 @@
}
~CertificateTransparencySSLUITest() override {
SystemNetworkContextManager::SetEnableCertificateTransparencyForTesting(
- base::nullopt);
+ absl::nullopt);
}
void SetUpOnMainThread() override {
@@ -5403,7 +5403,7 @@
tab->GetController().GetLastCommittedEntry();
std::unique_ptr<content::NavigationEntry> restored_entry =
content::NavigationController::CreateNavigationEntry(
- url, content::Referrer(), base::nullopt, ui::PAGE_TRANSITION_RELOAD,
+ url, content::Referrer(), absl::nullopt, ui::PAGE_TRANSITION_RELOAD,
false, std::string(), tab->GetBrowserContext(),
nullptr /* blob_url_loader_factory */);
restored_entry->SetPageState(entry->GetPageState());
@@ -8991,9 +8991,9 @@
tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL);
auto* reloader = error_page::NetErrorAutoReloader::FromWebContents(tab);
- const base::Optional<base::OneShotTimer>& timer =
+ const absl::optional<base::OneShotTimer>& timer =
reloader->next_reload_timer_for_testing();
- EXPECT_EQ(base::nullopt, timer);
+ EXPECT_EQ(absl::nullopt, timer);
}
class SSLUITestWithEnhancedProtectionMessage : public SSLUITest {
diff --git a/chrome/browser/subresource_redirect/litepages_service_bypass_decider.h b/chrome/browser/subresource_redirect/litepages_service_bypass_decider.h
index ff36a30..cd7e4df6 100644
--- a/chrome/browser/subresource_redirect/litepages_service_bypass_decider.h
+++ b/chrome/browser/subresource_redirect/litepages_service_bypass_decider.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_SUBRESOURCE_REDIRECT_LITEPAGES_SERVICE_BYPASS_DECIDER_H_
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Interface to decide whether LitePages service should be bypassed, which is
// used for fetching compressed image and fetching robots.txt. Whenever an
@@ -34,7 +34,7 @@
// start bypassing subsequent LitePage fetches.
void NotifyFetchFailure(base::TimeDelta retry_after);
- base::Optional<base::TimeTicks> GetBypassUntilTimeForTesting() const {
+ absl::optional<base::TimeTicks> GetBypassUntilTimeForTesting() const {
return bypassed_until_time_;
}
void SetBypassUntilTimeForTesting(base::TimeTicks bypass_until) {
@@ -44,7 +44,7 @@
private:
// The time until which image compression should be bypassed. Null time
// indicates no bypass.
- base::Optional<base::TimeTicks> bypassed_until_time_;
+ absl::optional<base::TimeTicks> bypassed_until_time_;
SEQUENCE_CHECKER(sequence_checker_);
};
diff --git a/chrome/browser/subresource_redirect/origin_robots_rules.h b/chrome/browser/subresource_redirect/origin_robots_rules.h
index 3213da0b..0c55d75 100644
--- a/chrome/browser/subresource_redirect/origin_robots_rules.h
+++ b/chrome/browser/subresource_redirect/origin_robots_rules.h
@@ -12,7 +12,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
namespace network {
@@ -25,10 +25,10 @@
// Holds the robots rules for one origin. Fetches the robots rules on creation.
class OriginRobotsRules {
public:
- // The callback to send the received robots rules. base::nullopt will be sent
+ // The callback to send the received robots rules. absl::nullopt will be sent
// when rule fetch fails.
using RobotsRulesReceivedCallback =
- base::OnceCallback<void(base::Optional<std::string>)>;
+ base::OnceCallback<void(absl::optional<std::string>)>;
// The callback to notify 4xx, 5xx response codes. Sends the response code and
// retry-after response header.
@@ -67,7 +67,7 @@
void OnURLLoadComplete(std::unique_ptr<std::string> response_body);
// The received robots rules. Set when rules fetch completes successfully.
- base::Optional<std::string> robots_rules_;
+ absl::optional<std::string> robots_rules_;
// Holds the robots rules fetcher state. Exists only when fetch is in
// progress.
diff --git a/chrome/browser/subresource_redirect/origin_robots_rules_cache.cc b/chrome/browser/subresource_redirect/origin_robots_rules_cache.cc
index 0fc14fd..a99b28e0 100644
--- a/chrome/browser/subresource_redirect/origin_robots_rules_cache.cc
+++ b/chrome/browser/subresource_redirect/origin_robots_rules_cache.cc
@@ -29,7 +29,7 @@
DCHECK(!origin.opaque());
if (!litepages_service_bypass_decider_ ||
!litepages_service_bypass_decider_->ShouldAllowNow()) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
auto rules = rules_cache_.Get(origin);
diff --git a/chrome/browser/subresource_redirect/origin_robots_rules_unittest.cc b/chrome/browser/subresource_redirect/origin_robots_rules_unittest.cc
index a70e1eb..b803b09d 100644
--- a/chrome/browser/subresource_redirect/origin_robots_rules_unittest.cc
+++ b/chrome/browser/subresource_redirect/origin_robots_rules_unittest.cc
@@ -6,7 +6,6 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/test/metrics/histogram_tester.h"
@@ -21,6 +20,7 @@
#include "services/network/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/features.h"
namespace subresource_redirect {
@@ -51,12 +51,12 @@
std::pair<int, base::TimeDelta>(response_code, retry_after);
}
- void OnRobotsRulesReceived(base::Optional<std::string> rules) {
+ void OnRobotsRulesReceived(absl::optional<std::string> rules) {
robots_rules_received_.push_back(rules);
}
- base::Optional<std::pair<int, base::TimeDelta>> response_error_received_;
- std::vector<base::Optional<std::string>> robots_rules_received_;
+ absl::optional<std::pair<int, base::TimeDelta>> response_error_received_;
+ std::vector<absl::optional<std::string>> robots_rules_received_;
base::WeakPtrFactory<RobotsRulesFetcherState> weak_ptr_factory_{this};
};
@@ -108,11 +108,11 @@
url, status, std::move(head), content);
}
- base::Optional<std::pair<int, base::TimeDelta>> GetResponseErrorReceived() {
+ absl::optional<std::pair<int, base::TimeDelta>> GetResponseErrorReceived() {
return rules_fetcher_state_->response_error_received_;
}
- std::vector<base::Optional<std::string>> GetRobotsRulesReceived() {
+ std::vector<absl::optional<std::string>> GetRobotsRulesReceived() {
return rules_fetcher_state_->robots_rules_received_;
}
@@ -141,7 +141,7 @@
EXPECT_EQ(0ULL, GetRobotsRulesReceived().size());
EXPECT_TRUE(SimulateResponse(kLitePagesURL, kFooOrigin, kTestResponse));
- EXPECT_EQ(base::nullopt, GetResponseErrorReceived());
+ EXPECT_EQ(absl::nullopt, GetResponseErrorReceived());
histogram_tester_.ExpectUniqueSample(
"SubresourceRedirect.RobotsRulesFetcher.CacheHit", false, 1);
histogram_tester_.ExpectUniqueSample(
@@ -149,16 +149,16 @@
histogram_tester_.ExpectUniqueSample(
"SubresourceRedirect.RobotsRulesFetcher.ResponseCode", net::HTTP_OK, 1);
EXPECT_THAT(GetRobotsRulesReceived(),
- testing::ElementsAre(base::Optional<std::string>(kTestResponse)));
+ testing::ElementsAre(absl::optional<std::string>(kTestResponse)));
// Subsequent calls will return the response immediately.
GetRobotsRules();
GetRobotsRules();
EXPECT_THAT(GetRobotsRulesReceived(),
- testing::ElementsAre(base::Optional<std::string>(kTestResponse),
- base::Optional<std::string>(kTestResponse),
- base::Optional<std::string>(kTestResponse)));
- EXPECT_EQ(base::nullopt, GetResponseErrorReceived());
+ testing::ElementsAre(absl::optional<std::string>(kTestResponse),
+ absl::optional<std::string>(kTestResponse),
+ absl::optional<std::string>(kTestResponse)));
+ EXPECT_EQ(absl::nullopt, GetResponseErrorReceived());
}
TEST_F(SubresourceRedirectOriginRobotsRulesTest, TestSuccessfulCachedResponse) {
@@ -173,17 +173,17 @@
"SubresourceRedirect.RobotsRulesFetcher.NetErrorCode", 0, 1);
histogram_tester_.ExpectUniqueSample(
"SubresourceRedirect.RobotsRulesFetcher.ResponseCode", net::HTTP_OK, 1);
- EXPECT_EQ(base::nullopt, GetResponseErrorReceived());
+ EXPECT_EQ(absl::nullopt, GetResponseErrorReceived());
EXPECT_THAT(GetRobotsRulesReceived(),
- testing::ElementsAre(base::Optional<std::string>(kTestResponse)));
+ testing::ElementsAre(absl::optional<std::string>(kTestResponse)));
GetRobotsRules();
GetRobotsRules();
EXPECT_THAT(GetRobotsRulesReceived(),
- testing::ElementsAre(base::Optional<std::string>(kTestResponse),
- base::Optional<std::string>(kTestResponse),
- base::Optional<std::string>(kTestResponse)));
- EXPECT_EQ(base::nullopt, GetResponseErrorReceived());
+ testing::ElementsAre(absl::optional<std::string>(kTestResponse),
+ absl::optional<std::string>(kTestResponse),
+ absl::optional<std::string>(kTestResponse)));
+ EXPECT_EQ(absl::nullopt, GetResponseErrorReceived());
}
TEST_F(SubresourceRedirectOriginRobotsRulesTest, TestFailedResponse) {
@@ -202,14 +202,14 @@
EXPECT_THAT(
*GetResponseErrorReceived(),
testing::Pair(net::HTTP_INTERNAL_SERVER_ERROR, base::TimeDelta()));
- EXPECT_THAT(GetRobotsRulesReceived(), testing::ElementsAre(base::nullopt));
+ EXPECT_THAT(GetRobotsRulesReceived(), testing::ElementsAre(absl::nullopt));
// Subsequent calls will return the response immediately.
GetRobotsRules();
GetRobotsRules();
EXPECT_THAT(
GetRobotsRulesReceived(),
- testing::ElementsAre(base::nullopt, base::nullopt, base::nullopt));
+ testing::ElementsAre(absl::nullopt, absl::nullopt, absl::nullopt));
}
TEST_F(SubresourceRedirectOriginRobotsRulesTest,
@@ -230,14 +230,14 @@
EXPECT_THAT(*GetResponseErrorReceived(),
testing::Pair(net::HTTP_INTERNAL_SERVER_ERROR,
base::TimeDelta::FromSeconds(120)));
- EXPECT_THAT(GetRobotsRulesReceived(), testing::ElementsAre(base::nullopt));
+ EXPECT_THAT(GetRobotsRulesReceived(), testing::ElementsAre(absl::nullopt));
// Subsequent calls will return the response immediately.
GetRobotsRules();
GetRobotsRules();
EXPECT_THAT(
GetRobotsRulesReceived(),
- testing::ElementsAre(base::nullopt, base::nullopt, base::nullopt));
+ testing::ElementsAre(absl::nullopt, absl::nullopt, absl::nullopt));
}
TEST_F(SubresourceRedirectOriginRobotsRulesTest, TestNetErrorFailedResponse) {
@@ -253,15 +253,15 @@
-net::ERR_ADDRESS_UNREACHABLE, 1);
histogram_tester_.ExpectTotalCount(
"SubresourceRedirect.RobotsRulesFetcher.ResponseCode", 0);
- EXPECT_EQ(base::nullopt, GetResponseErrorReceived());
- EXPECT_THAT(GetRobotsRulesReceived(), testing::ElementsAre(base::nullopt));
+ EXPECT_EQ(absl::nullopt, GetResponseErrorReceived());
+ EXPECT_THAT(GetRobotsRulesReceived(), testing::ElementsAre(absl::nullopt));
// Subsequent calls will return the response immediately.
GetRobotsRules();
GetRobotsRules();
EXPECT_THAT(
GetRobotsRulesReceived(),
- testing::ElementsAre(base::nullopt, base::nullopt, base::nullopt));
+ testing::ElementsAre(absl::nullopt, absl::nullopt, absl::nullopt));
}
} // namespace subresource_redirect
diff --git a/chrome/browser/subresource_redirect/subresource_redirect_observer.cc b/chrome/browser/subresource_redirect/subresource_redirect_observer.cc
index f94cf70..6ab7444 100644
--- a/chrome/browser/subresource_redirect/subresource_redirect_observer.cc
+++ b/chrome/browser/subresource_redirect/subresource_redirect_observer.cc
@@ -64,7 +64,7 @@
void UpdateRobotsRules(
mojom::SubresourceRedirectService::GetRobotsRulesCallback callback,
- base::Optional<std::string> robots_rules_proto) {
+ absl::optional<std::string> robots_rules_proto) {
std::move(callback).Run(robots_rules_proto);
}
@@ -83,7 +83,7 @@
OriginRobotsRulesCache* rules_cache,
mojom::SubresourceRedirectService::GetRobotsRulesCallback callback) {
if (!rules_cache) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
rules_cache->GetRobotsRules(
@@ -279,7 +279,7 @@
DCHECK(ShouldEnableRobotsRulesFetching());
DCHECK(!origin.opaque());
if (!web_contents()) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
@@ -289,7 +289,7 @@
ImageCompressionAppliedDocument::GetForCurrentDocument(
web_contents()->GetMainFrame());
if (!subresource_redirect_document_host) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
diff --git a/chrome/browser/supervised_user/child_accounts/child_account_service.cc b/chrome/browser/supervised_user/child_accounts/child_account_service.cc
index 7d0bd399..12dc77c 100644
--- a/chrome/browser/supervised_user/child_accounts/child_account_service.cc
+++ b/chrome/browser/supervised_user/child_accounts/child_account_service.cc
@@ -103,7 +103,7 @@
// If we're already signed in, check the account immediately just to be sure.
// (We might have missed an update before registering as an observer.)
// "Unconsented" because this class doesn't care about browser sync consent.
- base::Optional<AccountInfo> primary_account_info =
+ absl::optional<AccountInfo> primary_account_info =
identity_manager_->FindExtendedAccountInfoForAccountWithRefreshToken(
identity_manager_->GetPrimaryAccountInfo(
signin::ConsentLevel::kSignin));
diff --git a/chrome/browser/supervised_user/kids_chrome_management/kids_chrome_management_client.cc b/chrome/browser/supervised_user/kids_chrome_management/kids_chrome_management_client.cc
index 8cc3c80..905cce3 100644
--- a/chrome/browser/supervised_user/kids_chrome_management/kids_chrome_management_client.cc
+++ b/chrome/browser/supervised_user/kids_chrome_management/kids_chrome_management_client.cc
@@ -8,7 +8,6 @@
#include "base/json/json_reader.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "chrome/browser/profiles/profile.h"
@@ -31,6 +30,7 @@
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/url_constants.h"
@@ -73,7 +73,7 @@
// ClassifyUrlResponse proto object.
std::unique_ptr<kids_chrome_management::ClassifyUrlResponse>
GetClassifyURLResponseProto(const std::string& response) {
- base::Optional<base::Value> optional_value = base::JSONReader::Read(response);
+ absl::optional<base::Value> optional_value = base::JSONReader::Read(response);
const base::DictionaryValue* dict = nullptr;
auto response_proto =
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service.cc b/chrome/browser/supervised_user/supervised_user_settings_service.cc
index d23fafd..3fd9201 100644
--- a/chrome/browser/supervised_user/supervised_user_settings_service.cc
+++ b/chrome/browser/supervised_user/supervised_user_settings_service.cc
@@ -151,7 +151,7 @@
dict->HasKey(key_suffix) ? SyncChange::ACTION_UPDATE
: SyncChange::ACTION_ADD;
change_list.push_back(SyncChange(FROM_HERE, change_type, data));
- base::Optional<ModelError> error =
+ absl::optional<ModelError> error =
sync_processor_->ProcessSyncChanges(FROM_HERE, change_list);
DCHECK(!error.has_value()) << error.value().ToString();
} else {
@@ -202,7 +202,7 @@
}
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
SupervisedUserSettingsService::MergeDataAndStartSyncing(
ModelType type,
const SyncDataList& initial_sync_data,
@@ -287,7 +287,7 @@
return sync_processor_->ProcessSyncChanges(FROM_HERE, change_list);
}
- return base::nullopt;
+ return absl::nullopt;
}
void SupervisedUserSettingsService::StopSyncing(ModelType type) {
@@ -318,7 +318,7 @@
return data;
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
SupervisedUserSettingsService::ProcessSyncChanges(
const base::Location& from_here,
const SyncChangeList& change_list) {
@@ -359,7 +359,7 @@
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
InformSubscribers();
- return base::nullopt;
+ return absl::nullopt;
}
void SupervisedUserSettingsService::OnPrefValueChanged(const std::string& key) {
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service.h b/chrome/browser/supervised_user/supervised_user_settings_service.h
index e1c031f..86ba7da 100644
--- a/chrome/browser/supervised_user/supervised_user_settings_service.h
+++ b/chrome/browser/supervised_user/supervised_user_settings_service.h
@@ -128,14 +128,14 @@
// SyncableService implementation:
void WaitUntilReadyToSync(base::OnceClosure done) override;
- base::Optional<syncer::ModelError> MergeDataAndStartSyncing(
+ absl::optional<syncer::ModelError> MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
std::unique_ptr<syncer::SyncErrorFactory> error_handler) override;
void StopSyncing(syncer::ModelType type) override;
syncer::SyncDataList GetAllSyncDataForTesting(syncer::ModelType type) const;
- base::Optional<syncer::ModelError> ProcessSyncChanges(
+ absl::optional<syncer::ModelError> ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) override;
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc b/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc
index 4318885..cb97395d 100644
--- a/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc
+++ b/chrome/browser/supervised_user/supervised_user_settings_service_unittest.cc
@@ -73,7 +73,7 @@
void StartSyncing(const syncer::SyncDataList& initial_sync_data) {
std::unique_ptr<syncer::SyncErrorFactory> error_handler(
new MockSyncErrorFactory(syncer::SUPERVISED_USER_SETTINGS));
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
settings_service_.MergeDataAndStartSyncing(
syncer::SUPERVISED_USER_SETTINGS, initial_sync_data,
CreateSyncProcessor(), std::move(error_handler));
@@ -159,7 +159,7 @@
syncer::SyncChangeList change_list;
change_list.push_back(
syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_ADD, data));
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
settings_service_.ProcessSyncChanges(FROM_HERE, change_list);
EXPECT_FALSE(error.has_value()) << error.value().ToString();
ASSERT_TRUE(settings_);
@@ -191,7 +191,7 @@
change_list.push_back(
syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_ADD, data));
}
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
settings_service_.ProcessSyncChanges(FROM_HERE, change_list);
EXPECT_FALSE(error.has_value()) << error.value().ToString();
ASSERT_TRUE(settings_);
diff --git a/chrome/browser/sync/device_info_sync_client_impl.cc b/chrome/browser/sync/device_info_sync_client_impl.cc
index 1649ab6..44d51a8d 100644
--- a/chrome/browser/sync/device_info_sync_client_impl.cc
+++ b/chrome/browser/sync/device_info_sync_client_impl.cc
@@ -56,14 +56,14 @@
}
// syncer::DeviceInfoSyncClient:
-base::Optional<syncer::DeviceInfo::SharingInfo>
+absl::optional<syncer::DeviceInfo::SharingInfo>
DeviceInfoSyncClientImpl::GetLocalSharingInfo() const {
return SharingSyncPreference::GetLocalSharingInfoForSync(
profile_->GetPrefs());
}
// syncer::DeviceInfoSyncClient:
-base::Optional<std::string> DeviceInfoSyncClientImpl::GetFCMRegistrationToken()
+absl::optional<std::string> DeviceInfoSyncClientImpl::GetFCMRegistrationToken()
const {
syncer::SyncInvalidationsService* service =
SyncInvalidationsServiceFactory::GetForProfile(profile_);
@@ -71,13 +71,13 @@
return service->GetFCMRegistrationToken();
}
// If the service is not enabled, then the registration token must be empty,
- // not unknown (base::nullopt). This is needed to reset previous token if
+ // not unknown (absl::nullopt). This is needed to reset previous token if
// the invalidations have been turned off.
return std::string();
}
// syncer::DeviceInfoSyncClient:
-base::Optional<syncer::ModelTypeSet>
+absl::optional<syncer::ModelTypeSet>
DeviceInfoSyncClientImpl::GetInterestedDataTypes() const {
syncer::SyncInvalidationsService* service =
SyncInvalidationsServiceFactory::GetForProfile(profile_);
@@ -85,17 +85,17 @@
return service->GetInterestedDataTypes();
}
// If the service is not enabled, then the list of types must be empty, not
- // unknown (base::nullopt). This is needed to reset previous types if the
+ // unknown (absl::nullopt). This is needed to reset previous types if the
// invalidations have been turned off.
return syncer::ModelTypeSet();
}
-base::Optional<syncer::DeviceInfo::PhoneAsASecurityKeyInfo>
+absl::optional<syncer::DeviceInfo::PhoneAsASecurityKeyInfo>
DeviceInfoSyncClientImpl::GetPhoneAsASecurityKeyInfo() const {
#if defined(OS_ANDROID)
return webauthn::authenticator::GetSyncDataIfRegistered();
#else
- return base::nullopt;
+ return absl::nullopt;
#endif
}
diff --git a/chrome/browser/sync/device_info_sync_client_impl.h b/chrome/browser/sync/device_info_sync_client_impl.h
index bb06147..0915929 100644
--- a/chrome/browser/sync/device_info_sync_client_impl.h
+++ b/chrome/browser/sync/device_info_sync_client_impl.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_SYNC_DEVICE_INFO_SYNC_CLIENT_IMPL_H_
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "components/sync_device_info/device_info_sync_client.h"
@@ -27,17 +27,17 @@
bool GetSendTabToSelfReceivingEnabled() const override;
// syncer::DeviceInfoSyncClient:
- base::Optional<syncer::DeviceInfo::SharingInfo> GetLocalSharingInfo()
+ absl::optional<syncer::DeviceInfo::SharingInfo> GetLocalSharingInfo()
const override;
// syncer::DeviceInfoSyncClient:
- base::Optional<std::string> GetFCMRegistrationToken() const override;
+ absl::optional<std::string> GetFCMRegistrationToken() const override;
// syncer::DeviceInfoSyncClient:
- base::Optional<syncer::ModelTypeSet> GetInterestedDataTypes() const override;
+ absl::optional<syncer::ModelTypeSet> GetInterestedDataTypes() const override;
// syncer::DeviceInfoSyncClient:
- base::Optional<syncer::DeviceInfo::PhoneAsASecurityKeyInfo>
+ absl::optional<syncer::DeviceInfo::PhoneAsASecurityKeyInfo>
GetPhoneAsASecurityKeyInfo() const override;
// syncer::DeviceInfoSyncClient:
diff --git a/chrome/browser/sync/sync_error_notifier_ash_unittest.cc b/chrome/browser/sync/sync_error_notifier_ash_unittest.cc
index d4dd2ef..00fe8db2 100644
--- a/chrome/browser/sync/sync_error_notifier_ash_unittest.cc
+++ b/chrome/browser/sync/sync_error_notifier_ash_unittest.cc
@@ -71,7 +71,7 @@
protected:
void ExpectNotificationShown(bool expected_notification) {
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(kNotificationId);
if (expected_notification) {
ASSERT_TRUE(notification);
diff --git a/chrome/browser/sync/test/integration/autofill_helper.cc b/chrome/browser/sync/test/integration/autofill_helper.cc
index b545b5f..93ccd78 100644
--- a/chrome/browser/sync/test/integration/autofill_helper.cc
+++ b/chrome/browser/sync/test/integration/autofill_helper.cc
@@ -11,7 +11,6 @@
#include "base/bind.h"
#include "base/guid.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
@@ -30,6 +29,7 @@
#include "components/autofill/core/common/form_field_data.h"
#include "components/sync/driver/profile_sync_service.h"
#include "components/webdata/common/web_database.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using autofill::AutofillChangeList;
using autofill::AutofillEntry;
@@ -118,7 +118,7 @@
}
bool ProfilesMatchImpl(
- const base::Optional<unsigned int>& expected_count,
+ const absl::optional<unsigned int>& expected_count,
int profile_a,
const std::vector<AutofillProfile*>& autofill_profiles_a,
int profile_b,
@@ -383,7 +383,7 @@
GetAllAutoFillProfiles(profile_a);
const std::vector<AutofillProfile*>& autofill_profiles_b =
GetAllAutoFillProfiles(profile_b);
- return ProfilesMatchImpl(base::nullopt, profile_a, autofill_profiles_a,
+ return ProfilesMatchImpl(absl::nullopt, profile_a, autofill_profiles_a,
profile_b, autofill_profiles_b);
}
@@ -403,7 +403,7 @@
AutofillProfileChecker::AutofillProfileChecker(
int profile_a,
int profile_b,
- base::Optional<unsigned int> expected_count)
+ absl::optional<unsigned int> expected_count)
: profile_a_(profile_a),
profile_b_(profile_b),
expected_count_(expected_count) {
diff --git a/chrome/browser/sync/test/integration/autofill_helper.h b/chrome/browser/sync/test/integration/autofill_helper.h
index 5bf16d5..2e4ef9f 100644
--- a/chrome/browser/sync/test/integration/autofill_helper.h
+++ b/chrome/browser/sync/test/integration/autofill_helper.h
@@ -127,7 +127,7 @@
public:
AutofillProfileChecker(int profile_a,
int profile_b,
- base::Optional<unsigned int> expected_count);
+ absl::optional<unsigned int> expected_count);
~AutofillProfileChecker() override;
// StatusChangeChecker implementation.
@@ -140,7 +140,7 @@
private:
const int profile_a_;
const int profile_b_;
- const base::Optional<unsigned int> expected_count_;
+ const absl::optional<unsigned int> expected_count_;
};
class PersonalDataLoadedObserverMock
diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc
index b9fedc5..169d2e9 100644
--- a/chrome/browser/sync/test/integration/bookmarks_helper.cc
+++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc
@@ -248,14 +248,14 @@
// Gets the favicon and icon URL associated with |node| in |model|. Returns
// nullopt if the favicon is still loading.
-base::Optional<FaviconData> GetFaviconData(BookmarkModel* model,
+absl::optional<FaviconData> GetFaviconData(BookmarkModel* model,
const BookmarkNode* node) {
// We may need to wait for the favicon to be loaded via
// BookmarkModel::GetFavicon(), which is an asynchronous operation.
if (!node->is_favicon_loaded()) {
model->GetFavicon(node);
// Favicon still loading, no data available just yet.
- return base::nullopt;
+ return absl::nullopt;
}
// Favicon loaded: return actual image, if there is one (the no-favicon case
@@ -343,8 +343,8 @@
DCHECK(!node_a->is_folder());
DCHECK(!node_b->is_folder());
- base::Optional<FaviconData> favicon_data_a = GetFaviconData(model_a, node_a);
- base::Optional<FaviconData> favicon_data_b = GetFaviconData(model_b, node_b);
+ absl::optional<FaviconData> favicon_data_a = GetFaviconData(model_a, node_a);
+ absl::optional<FaviconData> favicon_data_b = GetFaviconData(model_b, node_b);
// If either of the two favicons is still loading, let's return false now
// because observers will get notified when the load completes. Note that even
diff --git a/chrome/browser/sync/test/integration/committed_all_nudged_changes_checker.h b/chrome/browser/sync/test/integration/committed_all_nudged_changes_checker.h
index c6f1ced..e1446bb7 100644
--- a/chrome/browser/sync/test/integration/committed_all_nudged_changes_checker.h
+++ b/chrome/browser/sync/test/integration/committed_all_nudged_changes_checker.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_SYNC_TEST_INTEGRATION_COMMITTED_ALL_NUDGED_CHANGES_CHECKER_H_
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace syncer {
class ProfileSyncService;
@@ -32,7 +32,7 @@
private:
void GotHasUnsyncedItems(bool has_unsynced_items);
- base::Optional<bool> has_unsynced_items_;
+ absl::optional<bool> has_unsynced_items_;
base::WeakPtrFactory<CommittedAllNudgedChangesChecker> weak_ptr_factory_{
this};
};
diff --git a/chrome/browser/sync/test/integration/preferences_helper.cc b/chrome/browser/sync/test/integration/preferences_helper.cc
index efda45ef..52f021b 100644
--- a/chrome/browser/sync/test/integration/preferences_helper.cc
+++ b/chrome/browser/sync/test/integration/preferences_helper.cc
@@ -139,7 +139,7 @@
return true;
}
-base::Optional<sync_pb::PreferenceSpecifics> GetPreferenceInFakeServer(
+absl::optional<sync_pb::PreferenceSpecifics> GetPreferenceInFakeServer(
const std::string& pref_name,
fake_server::FakeServer* fake_server) {
for (const sync_pb::SyncEntity& entity :
@@ -149,7 +149,7 @@
}
}
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace preferences_helper
@@ -222,7 +222,7 @@
bool FakeServerPrefMatchesValueChecker::IsExitConditionSatisfied(
std::ostream* os) {
- const base::Optional<sync_pb::PreferenceSpecifics> actual_specifics =
+ const absl::optional<sync_pb::PreferenceSpecifics> actual_specifics =
preferences_helper::GetPreferenceInFakeServer(pref_name_, fake_server());
if (!actual_specifics.has_value()) {
*os << "No sync entity in FakeServer for pref " << pref_name_;
diff --git a/chrome/browser/sync/test/integration/preferences_helper.h b/chrome/browser/sync/test/integration/preferences_helper.h
index 32f6fdc..454ddff 100644
--- a/chrome/browser/sync/test/integration/preferences_helper.h
+++ b/chrome/browser/sync/test/integration/preferences_helper.h
@@ -7,7 +7,7 @@
#include <stdint.h>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include <memory>
#include <string>
@@ -83,7 +83,7 @@
// Returns a server-side preference in FakeServer for |pref_name| or nullopt if
// no preference exists.
-base::Optional<sync_pb::PreferenceSpecifics> GetPreferenceInFakeServer(
+absl::optional<sync_pb::PreferenceSpecifics> GetPreferenceInFakeServer(
const std::string& pref_name,
fake_server::FakeServer* fake_server);
diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc
index 8b97c76..e2860b5 100644
--- a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc
+++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc
@@ -278,7 +278,7 @@
bool ProfileSyncServiceHarness::SetupSyncNoWaitForCompletion(
syncer::UserSelectableTypeSet selected_types) {
return SetupSyncImpl(selected_types, EncryptionSetupMode::kNoEncryption,
- /*encryption_passphrase=*/base::nullopt);
+ /*encryption_passphrase=*/absl::nullopt);
}
bool ProfileSyncServiceHarness::
@@ -300,7 +300,7 @@
bool ProfileSyncServiceHarness::SetupSyncImpl(
syncer::UserSelectableTypeSet selected_types,
EncryptionSetupMode encryption_mode,
- const base::Optional<std::string>& passphrase) {
+ const absl::optional<std::string>& passphrase) {
DCHECK(encryption_mode == EncryptionSetupMode::kNoEncryption ||
passphrase.has_value());
diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.h b/chrome/browser/sync/test/integration/profile_sync_service_harness.h
index 44d7d1d..e35d30f 100644
--- a/chrome/browser/sync/test/integration/profile_sync_service_harness.h
+++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.h
@@ -11,11 +11,11 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "build/chromeos_buildflags.h"
#include "components/sync/base/user_selectable_type.h"
#include "components/sync/driver/profile_sync_service.h"
#include "components/sync/engine/cycle/sync_cycle_snapshot.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -187,7 +187,7 @@
// has to have a value which will be used to properly setup sync.
bool SetupSyncImpl(syncer::UserSelectableTypeSet selected_types,
EncryptionSetupMode encryption_mode,
- const base::Optional<std::string>& encryption_passphrase);
+ const absl::optional<std::string>& encryption_passphrase);
// Gets detailed status from |service_| in pretty-printable form.
std::string GetServiceStatus();
diff --git a/chrome/browser/sync/test/integration/secondary_account_helper.cc b/chrome/browser/sync/test/integration/secondary_account_helper.cc
index 42590e57..2a8dbfba 100644
--- a/chrome/browser/sync/test/integration/secondary_account_helper.cc
+++ b/chrome/browser/sync/test/integration/secondary_account_helper.cc
@@ -90,7 +90,7 @@
void MakeAccountPrimary(Profile* profile, const std::string& email) {
signin::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(profile);
- base::Optional<AccountInfo> maybe_account =
+ absl::optional<AccountInfo> maybe_account =
identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByEmailAddress(
email);
diff --git a/chrome/browser/sync/test/integration/single_client_sharing_message_sync_test.cc b/chrome/browser/sync/test/integration/single_client_sharing_message_sync_test.cc
index 220ab386..63f321e5 100644
--- a/chrome/browser/sync/test/integration/single_client_sharing_message_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_sharing_message_sync_test.cc
@@ -164,7 +164,7 @@
}
const sync_pb::SharingMessageCommitError::ErrorCode expected_error_code_;
- base::Optional<sync_pb::SharingMessageCommitError> last_error_code_;
+ absl::optional<sync_pb::SharingMessageCommitError> last_error_code_;
base::WeakPtrFactory<SharingMessageCallbackChecker> weak_ptr_factory_{this};
};
diff --git a/chrome/browser/sync/test/integration/single_client_web_apps_sync_test.cc b/chrome/browser/sync/test/integration/single_client_web_apps_sync_test.cc
index d58e2a2..1342e061 100644
--- a/chrome/browser/sync/test/integration/single_client_web_apps_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_web_apps_sync_test.cc
@@ -103,7 +103,7 @@
void InjectWebAppEntityToFakeServer(
const std::string& app_id,
const GURL& url,
- base::Optional<std::string> manifest_id = base::nullopt) {
+ absl::optional<std::string> manifest_id = absl::nullopt) {
web_app::WebApp app(app_id);
app.SetName(app_id);
app.SetStartUrl(url);
@@ -240,7 +240,7 @@
IN_PROC_BROWSER_TEST_F(SingleClientWebAppsSyncTest,
AppWithIdSpecifiedSyncInstalled) {
- const base::Optional<std::string> manifest_id("explicit_id");
+ const absl::optional<std::string> manifest_id("explicit_id");
GURL url("https://example.com/start");
const std::string app_id = web_app::GenerateAppId(manifest_id, url);
@@ -270,7 +270,7 @@
IN_PROC_BROWSER_TEST_F(SingleClientWebAppsSyncTest,
AppWithIdSpecifiedAsEmptyStringSyncInstalled) {
- const base::Optional<std::string> manifest_id("");
+ const absl::optional<std::string> manifest_id("");
GURL url("https://example.com/start");
const std::string app_id = web_app::GenerateAppId(manifest_id, url);
diff --git a/chrome/browser/sync/test/integration/sync_app_helper.cc b/chrome/browser/sync/test/integration/sync_app_helper.cc
index 35e42363..458de72 100644
--- a/chrome/browser/sync/test/integration/sync_app_helper.cc
+++ b/chrome/browser/sync/test/integration/sync_app_helper.cc
@@ -46,7 +46,7 @@
GURL launch_web_url;
GURL bookmark_app_scope;
std::string icon_color;
- base::Optional<SkColor> theme_color;
+ absl::optional<SkColor> theme_color;
std::string description;
std::string name;
bool from_bookmark;
diff --git a/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc b/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc
index ee525f35..804dc7f 100644
--- a/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc
+++ b/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc
@@ -424,7 +424,7 @@
UpdateProfile(1, GetAllAutoFillProfiles(1)[0]->guid(),
AutofillType(autofill::NAME_FIRST), u"Bart");
- EXPECT_TRUE(AutofillProfileChecker(0, 1, base::nullopt).Wait());
+ EXPECT_TRUE(AutofillProfileChecker(0, 1, absl::nullopt).Wait());
// The exact result is non-deterministic without a strong consistency model
// server-side, but both clients should converge (either update or delete).
EXPECT_EQ(GetAllAutoFillProfiles(0).size(), GetAllAutoFillProfiles(1).size());
@@ -530,7 +530,7 @@
// All profiles should sync same autofill profiles.
ASSERT_TRUE(
- AutofillProfileChecker(0, 1, /*expected_count=*/base::nullopt).Wait())
+ AutofillProfileChecker(0, 1, /*expected_count=*/absl::nullopt).Wait())
<< "Initial autofill profiles did not match for all profiles.";
// For clean profiles, the autofill profiles count should be zero. We are not
diff --git a/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc b/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc
index f15f0e1e..7c7f563 100644
--- a/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc
+++ b/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc
@@ -176,7 +176,7 @@
}
bool AllProfilesHaveSameWebAppIds() {
- base::Optional<base::flat_set<AppId>> app_ids;
+ absl::optional<base::flat_set<AppId>> app_ids;
for (Profile* profile : GetAllProfiles()) {
base::flat_set<AppId> profile_app_ids(GetRegistrar(profile).GetAppIds());
if (!app_ids) {
diff --git a/chrome/browser/sync/test/integration/two_client_web_apps_sync_test.cc b/chrome/browser/sync/test/integration/two_client_web_apps_sync_test.cc
index f970529..c86cc2dd2 100644
--- a/chrome/browser/sync/test/integration/two_client_web_apps_sync_test.cc
+++ b/chrome/browser/sync/test/integration/two_client_web_apps_sync_test.cc
@@ -54,7 +54,7 @@
}
bool AllProfilesHaveSameWebAppIds() {
- base::Optional<base::flat_set<AppId>> app_ids;
+ absl::optional<base::flat_set<AppId>> app_ids;
for (Profile* profile : GetAllProfiles()) {
base::flat_set<AppId> profile_app_ids(GetRegistrar(profile).GetAppIds());
if (!app_ids) {
diff --git a/chrome/browser/sync/test/integration/updated_progress_marker_checker.h b/chrome/browser/sync/test/integration/updated_progress_marker_checker.h
index 5673a36..5ad40f67 100644
--- a/chrome/browser/sync/test/integration/updated_progress_marker_checker.h
+++ b/chrome/browser/sync/test/integration/updated_progress_marker_checker.h
@@ -8,9 +8,9 @@
#include <string>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "components/sync/driver/sync_service_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Waits until all local changes have been committed and progress markers are
// updated. This includes local changes posted to the sync thread before the
@@ -35,7 +35,7 @@
private:
void GotHasUnsyncedItems(bool has_unsynced_items);
- base::Optional<bool> has_unsynced_items_;
+ absl::optional<bool> has_unsynced_items_;
base::WeakPtrFactory<UpdatedProgressMarkerChecker> weak_ptr_factory_{this};
};
diff --git a/chrome/browser/tab_contents/view_source_browsertest.cc b/chrome/browser/tab_contents/view_source_browsertest.cc
index 40f41c9b..db9e5699 100644
--- a/chrome/browser/tab_contents/view_source_browsertest.cc
+++ b/chrome/browser/tab_contents/view_source_browsertest.cc
@@ -472,7 +472,7 @@
EXPECT_EQ(view_source_url, view_source_contents->GetLastCommittedURL());
// Verify the request for the view-source tab had the correct IsolationInfo.
- base::Optional<network::ResourceRequest> request =
+ absl::optional<network::ResourceRequest> request =
loader_monitor.GetRequestInfo(url);
ASSERT_TRUE(request);
ASSERT_TRUE(request->trusted_params);
diff --git a/chrome/browser/task_manager/providers/arc/arc_process_task_provider.h b/chrome/browser/task_manager/providers/arc/arc_process_task_provider.h
index e9809b1..77b01ac 100644
--- a/chrome/browser/task_manager/providers/arc/arc_process_task_provider.h
+++ b/chrome/browser/task_manager/providers/arc/arc_process_task_provider.h
@@ -11,12 +11,12 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/process/process.h"
#include "chrome/browser/ash/arc/process/arc_process.h"
#include "chrome/browser/ash/arc/process/arc_process_service.h"
#include "chrome/browser/task_manager/providers/arc/arc_process_task.h"
#include "chrome/browser/task_manager/providers/task_provider.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace task_manager {
diff --git a/chrome/browser/task_manager/sampling/arc_shared_sampler.cc b/chrome/browser/task_manager/sampling/arc_shared_sampler.cc
index 3105ed4..95ce26a 100644
--- a/chrome/browser/task_manager/sampling/arc_shared_sampler.cc
+++ b/chrome/browser/task_manager/sampling/arc_shared_sampler.cc
@@ -88,7 +88,7 @@
if (it == callbacks_.end())
continue;
const MemoryFootprintBytes result = proc->private_footprint_kb * 1024;
- it->second.Run(base::make_optional<MemoryFootprintBytes>(result));
+ it->second.Run(absl::make_optional<MemoryFootprintBytes>(result));
}
}
diff --git a/chrome/browser/task_manager/sampling/arc_shared_sampler.h b/chrome/browser/task_manager/sampling/arc_shared_sampler.h
index a727f1d..7486480 100644
--- a/chrome/browser/task_manager/sampling/arc_shared_sampler.h
+++ b/chrome/browser/task_manager/sampling/arc_shared_sampler.h
@@ -12,9 +12,9 @@
#include "base/callback.h"
#include "base/containers/flat_map.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/process/process_handle.h"
#include "components/arc/mojom/process.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace task_manager {
@@ -30,7 +30,7 @@
using MemoryFootprintBytes = uint64_t;
using OnSamplingCompleteCallback =
- base::RepeatingCallback<void(base::Optional<MemoryFootprintBytes>)>;
+ base::RepeatingCallback<void(absl::optional<MemoryFootprintBytes>)>;
// Registers task group specific callback.
void RegisterCallback(base::ProcessId process_id,
diff --git a/chrome/browser/task_manager/sampling/shared_sampler.h b/chrome/browser/task_manager/sampling/shared_sampler.h
index 0319cf2..3b31783f 100644
--- a/chrome/browser/task_manager/sampling/shared_sampler.h
+++ b/chrome/browser/task_manager/sampling/shared_sampler.h
@@ -13,12 +13,12 @@
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/process/process_handle.h"
#include "base/sequence_checker.h"
#include "base/sequenced_task_runner.h"
#include "base/time/time.h"
#include "build/build_config.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace task_manager {
@@ -47,7 +47,7 @@
base::Time start_time;
};
using OnSamplingCompleteCallback =
- base::RepeatingCallback<void(base::Optional<SamplingResult>)>;
+ base::RepeatingCallback<void(absl::optional<SamplingResult>)>;
// Returns a combination of refresh flags supported by the shared sampler.
int64_t GetSupportedFlags() const;
diff --git a/chrome/browser/task_manager/sampling/shared_sampler_win_unittest.cc b/chrome/browser/task_manager/sampling/shared_sampler_win_unittest.cc
index 04a0046b..f5033534 100644
--- a/chrome/browser/task_manager/sampling/shared_sampler_win_unittest.cc
+++ b/chrome/browser/task_manager/sampling/shared_sampler_win_unittest.cc
@@ -76,7 +76,7 @@
}
void OnSamplerRefreshDone(
- base::Optional<SharedSampler::SamplingResult> results) {
+ absl::optional<SharedSampler::SamplingResult> results) {
if (results) {
idle_wakeups_per_second_ = results->idle_wakeups_per_second;
start_time_ = results->start_time;
diff --git a/chrome/browser/task_manager/sampling/task_group.cc b/chrome/browser/task_manager/sampling/task_group.cc
index 930acf5..67f1388 100644
--- a/chrome/browser/task_manager/sampling/task_group.cc
+++ b/chrome/browser/task_manager/sampling/task_group.cc
@@ -364,7 +364,7 @@
}
void TaskGroup::OnSamplerRefreshDone(
- base::Optional<SharedSampler::SamplingResult> results) {
+ absl::optional<SharedSampler::SamplingResult> results) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// If any of the Optional<> fields have no value then replace them with
@@ -393,7 +393,7 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
void TaskGroup::OnArcSamplerRefreshDone(
- base::Optional<ArcSharedSampler::MemoryFootprintBytes> memory_footprint) {
+ absl::optional<ArcSharedSampler::MemoryFootprintBytes> memory_footprint) {
if (memory_footprint)
set_footprint_bytes(*memory_footprint);
}
diff --git a/chrome/browser/task_manager/sampling/task_group.h b/chrome/browser/task_manager/sampling/task_group.h
index acd48e5..a2e0eb2 100644
--- a/chrome/browser/task_manager/sampling/task_group.h
+++ b/chrome/browser/task_manager/sampling/task_group.h
@@ -177,11 +177,11 @@
void OnIdleWakeupsRefreshDone(int idle_wakeups_per_second);
void OnSamplerRefreshDone(
- base::Optional<SharedSampler::SamplingResult> results);
+ absl::optional<SharedSampler::SamplingResult> results);
#if BUILDFLAG(IS_CHROMEOS_ASH)
void OnArcSamplerRefreshDone(
- base::Optional<ArcSharedSampler::MemoryFootprintBytes> results);
+ absl::optional<ArcSharedSampler::MemoryFootprintBytes> results);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
void OnBackgroundRefreshTypeFinished(int64_t finished_refresh_type);
diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc
index 3f086aa8..7f6a6cc 100644
--- a/chrome/browser/themes/browser_theme_pack.cc
+++ b/chrome/browser/themes/browser_theme_pack.cc
@@ -1526,12 +1526,12 @@
static constexpr struct FrameValues {
PersistentID prs_id;
int tint_id;
- base::Optional<int> color_id;
+ absl::optional<int> color_id;
} kFrameValues[] = {
{PRS::kFrame, TP::TINT_FRAME, TP::COLOR_FRAME_ACTIVE},
{PRS::kFrameInactive, TP::TINT_FRAME_INACTIVE, TP::COLOR_FRAME_INACTIVE},
- {PRS::kFrameOverlay, TP::TINT_FRAME, base::nullopt},
- {PRS::kFrameOverlayInactive, TP::TINT_FRAME_INACTIVE, base::nullopt},
+ {PRS::kFrameOverlay, TP::TINT_FRAME, absl::nullopt},
+ {PRS::kFrameOverlayInactive, TP::TINT_FRAME_INACTIVE, absl::nullopt},
{PRS::kFrameIncognito, TP::TINT_FRAME_INCOGNITO,
TP::COLOR_FRAME_ACTIVE_INCOGNITO},
{PRS::kFrameIncognitoInactive, TP::TINT_FRAME_INCOGNITO_INACTIVE,
@@ -1685,7 +1685,7 @@
// For inactive images, the corresponding active image. If the active
// images are customized and the inactive ones are not, the inactive ones
// will be based on the active ones.
- base::Optional<PersistentID> fallback_tab_id;
+ absl::optional<PersistentID> fallback_tab_id;
// The frame image to use as the base of this tab background image.
PersistentID frame_id;
@@ -1696,12 +1696,12 @@
// The color to compute and store for this image, if not present.
int color_id;
} kTabBackgroundMap[] = {
- {PRS::kTabBackground, base::nullopt, PRS::kFrame, TP::COLOR_FRAME_ACTIVE,
+ {PRS::kTabBackground, absl::nullopt, PRS::kFrame, TP::COLOR_FRAME_ACTIVE,
TP::COLOR_TAB_BACKGROUND_INACTIVE_FRAME_ACTIVE},
{PRS::kTabBackgroundInactive, PRS::kTabBackground, PRS::kFrameInactive,
TP::COLOR_FRAME_INACTIVE,
TP::COLOR_TAB_BACKGROUND_INACTIVE_FRAME_INACTIVE},
- {PRS::kTabBackgroundIncognito, base::nullopt, PRS::kFrameIncognito,
+ {PRS::kTabBackgroundIncognito, absl::nullopt, PRS::kFrameIncognito,
TP::COLOR_FRAME_ACTIVE_INCOGNITO,
TP::COLOR_TAB_BACKGROUND_INACTIVE_FRAME_ACTIVE_INCOGNITO},
{PRS::kTabBackgroundIncognitoInactive, PRS::kTabBackgroundIncognito,
diff --git a/chrome/browser/themes/theme_helper.cc b/chrome/browser/themes/theme_helper.cc
index 4c7f794..2b1f38d10 100644
--- a/chrome/browser/themes/theme_helper.cc
+++ b/chrome/browser/themes/theme_helper.cc
@@ -233,7 +233,7 @@
if (has_custom_color)
*has_custom_color = false;
- const base::Optional<SkColor> omnibox_color =
+ const absl::optional<SkColor> omnibox_color =
GetOmniboxColor(id, incognito, theme_supplier, has_custom_color);
if (omnibox_color.has_value())
return omnibox_color.value();
@@ -517,7 +517,7 @@
return image;
}
-base::Optional<SkColor> ThemeHelper::GetOmniboxColor(
+absl::optional<SkColor> ThemeHelper::GetOmniboxColor(
int id,
bool incognito,
const CustomThemeSupplier* theme_supplier,
@@ -525,17 +525,17 @@
// Avoid infinite loop caused by GetColor(TP::COLOR_TOOLBAR) call in
// GetOmniboxColorImpl().
if (id == TP::COLOR_TOOLBAR)
- return base::nullopt;
+ return absl::nullopt;
const auto color = GetOmniboxColorImpl(id, incognito, theme_supplier);
if (!color)
- return base::nullopt;
+ return absl::nullopt;
if (has_custom_color)
*has_custom_color = color.value().custom;
return color.value().value;
}
-base::Optional<ThemeHelper::OmniboxColor> ThemeHelper::GetOmniboxColorImpl(
+absl::optional<ThemeHelper::OmniboxColor> ThemeHelper::GetOmniboxColorImpl(
int id,
bool incognito,
const CustomThemeSupplier* theme_supplier) const {
@@ -580,9 +580,9 @@
};
const auto blend_for_min_contrast =
[&](OmniboxColor fg, OmniboxColor bg,
- base::Optional<OmniboxColor> hc_fg = base::nullopt,
- base::Optional<float> contrast_ratio = base::nullopt) {
- base::Optional<SkColor> hc_fg_arg;
+ absl::optional<OmniboxColor> hc_fg = absl::nullopt,
+ absl::optional<float> contrast_ratio = absl::nullopt) {
+ absl::optional<SkColor> hc_fg_arg;
bool custom = fg.custom || bg.custom;
if (hc_fg) {
hc_fg_arg = hc_fg.value().value;
@@ -605,7 +605,7 @@
const auto bg = get_color_with_max_contrast(fg);
const auto inverted_bg = get_color_with_max_contrast(bg);
const float contrast = color_utils::GetContrastRatio(fg.value, bg.value);
- return blend_for_min_contrast(fg, inverted_bg, base::nullopt, contrast);
+ return blend_for_min_contrast(fg, inverted_bg, absl::nullopt, contrast);
};
fg = invert_color(fg);
bg = invert_color(bg);
@@ -694,7 +694,7 @@
{dark ? gfx::kGoogleRed300 : gfx::kGoogleRed600, false},
bg_hovered_color());
default:
- return base::nullopt;
+ return absl::nullopt;
}
}
diff --git a/chrome/browser/themes/theme_helper.h b/chrome/browser/themes/theme_helper.h
index 3ae127e..278b996 100644
--- a/chrome/browser/themes/theme_helper.h
+++ b/chrome/browser/themes/theme_helper.h
@@ -149,16 +149,16 @@
const CustomThemeSupplier* theme_supplier) const;
// Given a theme property ID |id|, returns the corresponding omnibox color
- // overridden by the system theme. Returns base::nullopt if the color is not
+ // overridden by the system theme. Returns absl::nullopt if the color is not
// overridden, or if |id| does not correspond to an omnibox color.
- base::Optional<SkColor> GetOmniboxColor(
+ absl::optional<SkColor> GetOmniboxColor(
int id,
bool incognito,
const CustomThemeSupplier* theme_supplier,
bool* has_custom_color) const;
// Helper function that contains the main implementation of GetOmniboxColor().
- base::Optional<OmniboxColor> GetOmniboxColorImpl(
+ absl::optional<OmniboxColor> GetOmniboxColorImpl(
int id,
bool incognito,
const CustomThemeSupplier* theme_supplier) const;
diff --git a/chrome/browser/themes/theme_helper_win.h b/chrome/browser/themes/theme_helper_win.h
index 6978fd7d..9ad716d 100644
--- a/chrome/browser/themes/theme_helper_win.h
+++ b/chrome/browser/themes/theme_helper_win.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_THEMES_THEME_HELPER_WIN_H_
#define CHROME_BROWSER_THEMES_THEME_HELPER_WIN_H_
-#include "base/optional.h"
#include "base/win/registry.h"
#include "chrome/browser/themes/theme_helper.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Tracks updates to the native colors on Windows 10 and calcuates the values we
// should use (which are not always what Windows uses). None of the values here
@@ -46,14 +46,14 @@
std::unique_ptr<base::win::RegKey> dwm_key_;
// The frame color when active. If empty the default colors should be used.
- base::Optional<SkColor> dwm_frame_color_;
+ absl::optional<SkColor> dwm_frame_color_;
// True if we took |dwm_inactive_frame_color_| from the registry (vs
// calculating it ourselves) and thus Windows will use it too.
bool inactive_frame_color_from_registry_ = false;
// The frame color when inactive. If empty the default colors should be used.
- base::Optional<SkColor> dwm_inactive_frame_color_;
+ absl::optional<SkColor> dwm_inactive_frame_color_;
// The DWM accent border color, if available; white otherwise.
SkColor dwm_accent_border_color_;
diff --git a/chrome/browser/themes/theme_properties.cc b/chrome/browser/themes/theme_properties.cc
index 2d4ac8b..eb1e9e2 100644
--- a/chrome/browser/themes/theme_properties.cc
+++ b/chrome/browser/themes/theme_properties.cc
@@ -7,11 +7,11 @@
#include <memory>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "chrome/browser/themes/browser_theme_pack.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/color_palette.h"
#include "ui/native_theme/native_theme.h"
@@ -137,7 +137,7 @@
}
}
-base::Optional<SkColor> GetIncognitoColor(int id) {
+absl::optional<SkColor> GetIncognitoColor(int id) {
switch (id) {
case ThemeProperties::COLOR_FRAME_ACTIVE:
case ThemeProperties::COLOR_TAB_BACKGROUND_INACTIVE_FRAME_ACTIVE:
@@ -183,11 +183,11 @@
case ThemeProperties::COLOR_OMNIBOX_BACKGROUND:
return gfx::kGoogleGrey900;
default:
- return base::nullopt;
+ return absl::nullopt;
}
}
-base::Optional<SkColor> GetDarkModeColor(int id) {
+absl::optional<SkColor> GetDarkModeColor(int id) {
// Current UX thinking is to use the same colors for dark mode and incognito,
// but this is very subject to change. Additionally, dark mode incognito may
// end up having a different look. For now, just call into GetIncognitoColor
@@ -301,12 +301,12 @@
bool incognito,
bool dark_mode) {
if (incognito) {
- base::Optional<SkColor> incognito_color = GetIncognitoColor(id);
+ absl::optional<SkColor> incognito_color = GetIncognitoColor(id);
if (incognito_color.has_value())
return incognito_color.value();
}
if (dark_mode) {
- base::Optional<SkColor> dark_mode_color = GetDarkModeColor(id);
+ absl::optional<SkColor> dark_mode_color = GetDarkModeColor(id);
if (dark_mode_color.has_value())
return dark_mode_color.value();
}
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc
index 38d5cfe..ca830ce 100644
--- a/chrome/browser/themes/theme_service.cc
+++ b/chrome/browser/themes/theme_service.cc
@@ -17,7 +17,6 @@
#include "base/metrics/user_metrics.h"
#include "base/numerics/ranges.h"
#include "base/one_shot_event.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
@@ -57,6 +56,7 @@
#include "extensions/buildflags/buildflags.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/layout.h"
#if BUILDFLAG(ENABLE_EXTENSIONS)
@@ -482,7 +482,7 @@
void ThemeService::BuildAutogeneratedThemeFromColor(SkColor color,
bool store_in_prefs) {
- base::Optional<std::string> previous_theme_id;
+ absl::optional<std::string> previous_theme_id;
if (UsingExtensionTheme())
previous_theme_id = GetThemeID();
@@ -574,7 +574,7 @@
if (!ready_)
return;
- base::Optional<std::string> previous_theme_id;
+ absl::optional<std::string> previous_theme_id;
if (UsingExtensionTheme())
previous_theme_id = GetThemeID();
@@ -755,7 +755,7 @@
base::RetainedRef(pack), extension->path()));
std::unique_ptr<ThemeService::ThemeReinstaller> reinstaller =
BuildReinstallerForCurrentTheme();
- base::Optional<std::string> previous_theme_id;
+ absl::optional<std::string> previous_theme_id;
if (UsingExtensionTheme())
previous_theme_id = GetThemeID();
diff --git a/chrome/browser/themes/theme_service_unittest.cc b/chrome/browser/themes/theme_service_unittest.cc
index b292ac2a..11c5cb0 100644
--- a/chrome/browser/themes/theme_service_unittest.cc
+++ b/chrome/browser/themes/theme_service_unittest.cc
@@ -167,7 +167,7 @@
int id,
bool incognito) const {
bool has_custom_color;
- base::Optional<SkColor> color =
+ absl::optional<SkColor> color =
theme_service->theme_helper_.GetOmniboxColor(
id, incognito, theme_service->GetThemeSupplier(),
&has_custom_color);
diff --git a/chrome/browser/themes/theme_syncable_service.cc b/chrome/browser/themes/theme_syncable_service.cc
index e936747..06f885c 100644
--- a/chrome/browser/themes/theme_syncable_service.cc
+++ b/chrome/browser/themes/theme_syncable_service.cc
@@ -86,7 +86,7 @@
std::move(done));
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
ThemeSyncableService::MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
@@ -112,7 +112,7 @@
// Current theme is unsyncable - don't overwrite from sync data, and don't
// save the unsyncable theme to sync data.
NotifyOnSyncStarted();
- return base::nullopt;
+ return absl::nullopt;
}
// Find the last SyncData that has theme data and set the current theme from
@@ -125,13 +125,13 @@
HasNonDefaultTheme(sync_data->GetSpecifics().theme())) {
startup_state_ = MaybeSetTheme(current_specifics, *sync_data);
NotifyOnSyncStarted();
- return base::nullopt;
+ return absl::nullopt;
}
}
}
// No theme specifics are found. Create one according to current theme.
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
ProcessNewTheme(syncer::SyncChange::ACTION_ADD, current_specifics);
startup_state_ = ThemeSyncState::kApplied;
NotifyOnSyncStarted();
@@ -161,7 +161,7 @@
return list;
}
-base::Optional<syncer::ModelError> ThemeSyncableService::ProcessSyncChanges(
+absl::optional<syncer::ModelError> ThemeSyncableService::ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -195,7 +195,7 @@
sync_pb::ThemeSpecifics current_specifics;
if (!GetThemeSpecificsFromCurrentTheme(¤t_specifics)) {
// Current theme is unsyncable, so don't overwrite it.
- return base::nullopt;
+ return absl::nullopt;
}
// Set current theme from the theme specifics of the last change of type
@@ -206,7 +206,7 @@
(theme_change->change_type() == syncer::SyncChange::ACTION_ADD ||
theme_change->change_type() == syncer::SyncChange::ACTION_UPDATE)) {
MaybeSetTheme(current_specifics, theme_change->sync_data());
- return base::nullopt;
+ return absl::nullopt;
}
}
@@ -391,7 +391,7 @@
theme_specifics.has_autogenerated_theme();
}
-base::Optional<syncer::ModelError> ThemeSyncableService::ProcessNewTheme(
+absl::optional<syncer::ModelError> ThemeSyncableService::ProcessNewTheme(
syncer::SyncChange::SyncChangeType change_type,
const sync_pb::ThemeSpecifics& theme_specifics) {
syncer::SyncChangeList changes;
diff --git a/chrome/browser/themes/theme_syncable_service.h b/chrome/browser/themes/theme_syncable_service.h
index 1d425fcb..847f4ff 100644
--- a/chrome/browser/themes/theme_syncable_service.h
+++ b/chrome/browser/themes/theme_syncable_service.h
@@ -66,14 +66,14 @@
// syncer::SyncableService implementation.
void WaitUntilReadyToSync(base::OnceClosure done) override;
- base::Optional<syncer::ModelError> MergeDataAndStartSyncing(
+ absl::optional<syncer::ModelError> MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
std::unique_ptr<syncer::SyncErrorFactory> error_handler) override;
void StopSyncing(syncer::ModelType type) override;
syncer::SyncDataList GetAllSyncDataForTesting(syncer::ModelType type) const;
- base::Optional<syncer::ModelError> ProcessSyncChanges(
+ absl::optional<syncer::ModelError> ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) override;
@@ -107,7 +107,7 @@
sync_pb::ThemeSpecifics* theme_specifics) const;
// Updates theme specifics in sync to |theme_specifics|.
- base::Optional<syncer::ModelError> ProcessNewTheme(
+ absl::optional<syncer::ModelError> ProcessNewTheme(
syncer::SyncChange::SyncChangeType change_type,
const sync_pb::ThemeSpecifics& theme_specifics);
diff --git a/chrome/browser/themes/theme_syncable_service_unittest.cc b/chrome/browser/themes/theme_syncable_service_unittest.cc
index f2d5f4f0..f2a8aede 100644
--- a/chrome/browser/themes/theme_syncable_service_unittest.cc
+++ b/chrome/browser/themes/theme_syncable_service_unittest.cc
@@ -12,7 +12,6 @@
#include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/time/time.h"
#include "base/values.h"
@@ -42,6 +41,7 @@
#include "extensions/common/permissions/api_permission_set.h"
#include "extensions/common/permissions/permission_set.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/login/users/scoped_test_user_manager.h"
@@ -275,7 +275,7 @@
state_ = state;
}
- bool HasThemeSyncStarted() { return state_ != base::nullopt; }
+ bool HasThemeSyncStarted() { return state_ != absl::nullopt; }
bool HasThemeSyncTriggeredExtensionInstallation() {
return state_ && *state_ == ThemeSyncableService::ThemeSyncState::
@@ -295,7 +295,7 @@
scoped_refptr<extensions::Extension> theme_extension_;
std::unique_ptr<ThemeSyncableService> theme_sync_service_;
std::unique_ptr<syncer::FakeSyncChangeProcessor> fake_change_processor_;
- base::Optional<ThemeSyncableService::ThemeSyncState> state_;
+ absl::optional<ThemeSyncableService::ThemeSyncState> state_;
};
class PolicyInstalledThemeTest : public ThemeSyncableServiceTest {
@@ -386,7 +386,7 @@
// Set up theme service to use custom theme.
fake_theme_service_->SetTheme(theme_extension_.get());
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(sync_pb::ThemeSpecifics()),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -406,7 +406,7 @@
// Set up theme service to use custom theme.
fake_theme_service_->SetTheme(theme_extension_.get());
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(theme_specifics),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -429,7 +429,7 @@
// Set up theme service to use default theme.
fake_theme_service_->UseDefaultTheme();
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(theme_specifics),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -453,7 +453,7 @@
// Set up theme service to use default theme.
fake_theme_service_->UseDefaultTheme();
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(theme_specifics),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -480,7 +480,7 @@
// Set up theme service to use default theme.
fake_theme_service_->UseDefaultTheme();
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(theme_specifics),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -498,7 +498,7 @@
// Set up theme service to use default theme and expect no changes.
fake_theme_service_->UseDefaultTheme();
fake_theme_service_->MarkClean();
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(sync_pb::ThemeSpecifics()),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -515,7 +515,7 @@
// Set up theme service to use custom theme.
fake_theme_service_->SetTheme(theme_extension_.get());
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, syncer::SyncDataList(),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -546,7 +546,7 @@
fake_theme_service_->BuildAutogeneratedThemeFromColor(
SkColorSetRGB(0, 0, 100));
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, syncer::SyncDataList(),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -572,7 +572,7 @@
// Set up theme service to use policy theme.
fake_theme_service_->BuildAutogeneratedPolicyTheme();
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, syncer::SyncDataList(),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -636,7 +636,7 @@
fake_theme_service_->MarkClean();
// Start syncing.
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(sync_pb::ThemeSpecifics()),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -661,7 +661,7 @@
FROM_HERE, syncer::SyncChange::ACTION_UPDATE,
syncer::SyncData::CreateRemoteData(
entity_specifics, syncer::ClientTagHash::FromHashed("unused"))));
- base::Optional<syncer::ModelError> process_error =
+ absl::optional<syncer::ModelError> process_error =
theme_sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
EXPECT_FALSE(process_error.has_value()) << process_error.value().message();
EXPECT_EQ(fake_theme_service_->theme_extension(), theme_extension_.get());
@@ -676,7 +676,7 @@
fake_theme_service_->MarkClean();
// Start syncing.
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(sync_pb::ThemeSpecifics()),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -700,7 +700,7 @@
FROM_HERE, syncer::SyncChange::ACTION_UPDATE,
syncer::SyncData::CreateRemoteData(
entity_specifics, syncer::ClientTagHash::FromHashed("unused"))));
- base::Optional<syncer::ModelError> process_error =
+ absl::optional<syncer::ModelError> process_error =
theme_sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
EXPECT_FALSE(process_error.has_value()) << process_error.value().message();
EXPECT_EQ(fake_theme_service_->GetAutogeneratedThemeColor(),
@@ -712,7 +712,7 @@
fake_theme_service_->UseDefaultTheme();
// Start syncing.
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(sync_pb::ThemeSpecifics()),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -743,7 +743,7 @@
fake_theme_service_->UseDefaultTheme();
// Start syncing.
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(sync_pb::ThemeSpecifics()),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -772,7 +772,7 @@
fake_theme_service_->UseDefaultTheme();
// Start syncing.
- base::Optional<syncer::ModelError> merge_error =
+ absl::optional<syncer::ModelError> merge_error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(sync_pb::ThemeSpecifics()),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -794,7 +794,7 @@
EXPECT_EQ(0u, changes.size());
// ProcessSyncChanges() should return error when sync has stopped.
- base::Optional<syncer::ModelError> process_error =
+ absl::optional<syncer::ModelError> process_error =
theme_sync_service_->ProcessSyncChanges(FROM_HERE, changes);
EXPECT_TRUE(process_error.has_value());
EXPECT_EQ("Theme syncable service is not started.",
@@ -806,7 +806,7 @@
fake_theme_service_->UseDefaultTheme();
sync_pb::ThemeSpecifics theme_specifics;
theme_specifics.set_use_system_theme_by_default(true);
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(theme_specifics),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -834,7 +834,7 @@
fake_theme_service_->MarkClean();
sync_pb::ThemeSpecifics theme_specifics;
theme_specifics.set_use_system_theme_by_default(true);
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(theme_specifics),
std::unique_ptr<syncer::SyncChangeProcessor>(
@@ -882,7 +882,7 @@
theme_specifics.set_custom_theme_name(kCustomThemeName);
theme_specifics.set_custom_theme_update_url(kCustomThemeUrl);
theme_specifics.set_use_system_theme_by_default(true);
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
theme_sync_service_->MergeDataAndStartSyncing(
syncer::THEMES, MakeThemeDataList(theme_specifics),
std::unique_ptr<syncer::SyncChangeProcessor>(
diff --git a/chrome/browser/thumbnail/DEPS b/chrome/browser/thumbnail/DEPS
index 045ce02..00f797e 100644
--- a/chrome/browser/thumbnail/DEPS
+++ b/chrome/browser/thumbnail/DEPS
@@ -26,8 +26,9 @@
"+skia",
"+testing/gmock",
"+testing/gtest",
+ "+third_party/abseil-cpp/absl",
"+third_party/android_opengl/etc1",
"+third_party/skia/include",
"+ui",
"+url",
-]
\ No newline at end of file
+]
diff --git a/chrome/browser/thumbnail/generator/android/thumbnail_media_parser_impl.cc b/chrome/browser/thumbnail/generator/android/thumbnail_media_parser_impl.cc
index dc6ed18a..e8effbe2 100644
--- a/chrome/browser/thumbnail/generator/android/thumbnail_media_parser_impl.cc
+++ b/chrome/browser/thumbnail/generator/android/thumbnail_media_parser_impl.cc
@@ -169,7 +169,7 @@
void ThumbnailMediaParserImpl::OnVideoFrameRetrieved(
bool success,
chrome::mojom::VideoFrameDataPtr video_frame_data,
- const base::Optional<media::VideoDecoderConfig>& config) {
+ const absl::optional<media::VideoDecoderConfig>& config) {
if (!success) {
RecordVideoThumbnailEvent(VideoThumbnailEvent::kVideoFrameExtractionFailed);
OnError(MediaParserEvent::kVideoThumbnailFailed);
diff --git a/chrome/browser/thumbnail/generator/android/thumbnail_media_parser_impl.h b/chrome/browser/thumbnail/generator/android/thumbnail_media_parser_impl.h
index 32eb204..21f70c0 100644
--- a/chrome/browser/thumbnail/generator/android/thumbnail_media_parser_impl.h
+++ b/chrome/browser/thumbnail/generator/android/thumbnail_media_parser_impl.h
@@ -14,7 +14,6 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/timer/timer.h"
#include "chrome/browser/thumbnail/generator/android/stats.h"
@@ -23,6 +22,7 @@
#include "media/base/media_log.h"
#include "media/mojo/mojom/interface_factory.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
class GpuVideoAcceleratorFactories;
@@ -65,7 +65,7 @@
void OnVideoFrameRetrieved(
bool success,
chrome::mojom::VideoFrameDataPtr video_frame_data,
- const base::Optional<media::VideoDecoderConfig>& config);
+ const absl::optional<media::VideoDecoderConfig>& config);
// Decodes the video frame.
void OnGpuVideoAcceleratorFactoriesReady(
diff --git a/chrome/browser/translate/fake_translate_agent.h b/chrome/browser/translate/fake_translate_agent.h
index 0df0cd5..18d81c86 100644
--- a/chrome/browser/translate/fake_translate_agent.h
+++ b/chrome/browser/translate/fake_translate_agent.h
@@ -14,7 +14,6 @@
#include <utility>
#include <vector>
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/browser/translate/chrome_translate_client.h"
#include "chrome/browser/translate/translate_service.h"
@@ -39,6 +38,7 @@
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class FakeTranslateAgent : public translate::mojom::TranslateAgent {
@@ -68,8 +68,8 @@
void BindRequest(mojo::ScopedInterfaceEndpointHandle handle);
bool called_translate_;
- base::Optional<std::string> source_lang_;
- base::Optional<std::string> target_lang_;
+ absl::optional<std::string> source_lang_;
+ absl::optional<std::string> target_lang_;
bool called_revert_translation_;
std::string next_page_lang_;
bool next_page_translatable_;
diff --git a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
index fbbc8ab6..de014ea2 100644
--- a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
+++ b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
@@ -255,8 +255,8 @@
// Reset
fake_agent_.called_translate_ = false;
- fake_agent_.source_lang_ = base::nullopt;
- fake_agent_.target_lang_ = base::nullopt;
+ fake_agent_.source_lang_ = absl::nullopt;
+ fake_agent_.target_lang_ = absl::nullopt;
return true;
}
diff --git a/chrome/browser/translate/translate_model_service_browsertest.cc b/chrome/browser/translate/translate_model_service_browsertest.cc
index 3dd552c..dc119f5c 100644
--- a/chrome/browser/translate/translate_model_service_browsertest.cc
+++ b/chrome/browser/translate/translate_model_service_browsertest.cc
@@ -230,7 +230,7 @@
OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile())
->OverrideTargetModelFileForTesting(
optimization_guide::proto::OPTIMIZATION_TARGET_LANGUAGE_DETECTION,
- /*model_metadata=*/base::nullopt, model_file_path());
+ /*model_metadata=*/absl::nullopt, model_file_path());
RetryForHistogramUntilCountReached(
&histogram_tester,
@@ -265,7 +265,7 @@
OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile())
->OverrideTargetModelFileForTesting(
optimization_guide::proto::OPTIMIZATION_TARGET_LANGUAGE_DETECTION,
- /*model_metadata=*/base::nullopt, model_file_path());
+ /*model_metadata=*/absl::nullopt, model_file_path());
RetryForHistogramUntilCountReached(
&histogram_tester,
@@ -283,7 +283,7 @@
OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile())
->OverrideTargetModelFileForTesting(
optimization_guide::proto::OPTIMIZATION_TARGET_LANGUAGE_DETECTION,
- /*model_metadata=*/base::nullopt, base::FilePath());
+ /*model_metadata=*/absl::nullopt, base::FilePath());
RetryForHistogramUntilCountReached(
&histogram_tester,
@@ -309,7 +309,7 @@
OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile())
->OverrideTargetModelFileForTesting(
optimization_guide::proto::OPTIMIZATION_TARGET_LANGUAGE_DETECTION,
- /*model_metadata=*/base::nullopt, model_file_path());
+ /*model_metadata=*/absl::nullopt, model_file_path());
RetryForHistogramUntilCountReached(
&histogram_tester,
"TranslateModelService.LanguageDetectionModel.WasLoaded", 1);
@@ -341,7 +341,7 @@
OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile())
->OverrideTargetModelFileForTesting(
optimization_guide::proto::OPTIMIZATION_TARGET_LANGUAGE_DETECTION,
- /*model_metadata=*/base::nullopt, model_file_path());
+ /*model_metadata=*/absl::nullopt, model_file_path());
RetryForHistogramUntilCountReached(
&histogram_tester,
@@ -380,7 +380,7 @@
OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile())
->OverrideTargetModelFileForTesting(
optimization_guide::proto::OPTIMIZATION_TARGET_LANGUAGE_DETECTION,
- /*model_metadata=*/base::nullopt, model_file_path());
+ /*model_metadata=*/absl::nullopt, model_file_path());
RetryForHistogramUntilCountReached(
&histogram_tester,
@@ -401,7 +401,7 @@
OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile())
->OverrideTargetModelFileForTesting(
optimization_guide::proto::OPTIMIZATION_TARGET_LANGUAGE_DETECTION,
- /*model_metadata=*/base::nullopt, model_file_path());
+ /*model_metadata=*/absl::nullopt, model_file_path());
RetryForHistogramUntilCountReached(
&histogram_tester,
diff --git a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc
index 334b19e..23609ac 100644
--- a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc
+++ b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc
@@ -54,8 +54,8 @@
}
void AutofillPopupViewAndroid::OnSelectedRowChanged(
- base::Optional<int> previous_row_selection,
- base::Optional<int> current_row_selection) {}
+ absl::optional<int> previous_row_selection,
+ absl::optional<int> current_row_selection) {}
void AutofillPopupViewAndroid::OnSuggestionsChanged() {
if (java_object_.is_null())
@@ -112,9 +112,9 @@
controller_->IsRTL());
}
-base::Optional<int32_t> AutofillPopupViewAndroid::GetAxUniqueId() {
+absl::optional<int32_t> AutofillPopupViewAndroid::GetAxUniqueId() {
NOTIMPLEMENTED() << "See https://crbug.com/985927";
- return base::nullopt;
+ return absl::nullopt;
}
void AutofillPopupViewAndroid::SuggestionSelected(
diff --git a/chrome/browser/ui/android/autofill/autofill_popup_view_android.h b/chrome/browser/ui/android/autofill/autofill_popup_view_android.h
index a9a3e3b..cbf742d 100644
--- a/chrome/browser/ui/android/autofill/autofill_popup_view_android.h
+++ b/chrome/browser/ui/android/autofill/autofill_popup_view_android.h
@@ -45,10 +45,10 @@
// AutofillPopupView implementation.
void Show() override;
void Hide() override;
- void OnSelectedRowChanged(base::Optional<int> previous_row_selection,
- base::Optional<int> current_row_selection) override;
+ void OnSelectedRowChanged(absl::optional<int> previous_row_selection,
+ absl::optional<int> current_row_selection) override;
void OnSuggestionsChanged() override;
- base::Optional<int32_t> GetAxUniqueId() override;
+ absl::optional<int32_t> GetAxUniqueId() override;
private:
friend class AutofillPopupView;
diff --git a/chrome/browser/ui/android/external_protocol_dialog_android.cc b/chrome/browser/ui/android/external_protocol_dialog_android.cc
index d4202125..25eab61b 100644
--- a/chrome/browser/ui/android/external_protocol_dialog_android.cc
+++ b/chrome/browser/ui/android/external_protocol_dialog_android.cc
@@ -20,7 +20,7 @@
WebContents* web_contents,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin) {
+ const absl::optional<url::Origin>& initiating_origin) {
navigation_interception::InterceptNavigationDelegate* delegate =
navigation_interception::InterceptNavigationDelegate::Get(web_contents);
if (!delegate)
diff --git a/chrome/browser/ui/android/infobars/autofill_save_card_infobar.cc b/chrome/browser/ui/android/infobars/autofill_save_card_infobar.cc
index f7fc192a..261c7d70 100644
--- a/chrome/browser/ui/android/infobars/autofill_save_card_infobar.cc
+++ b/chrome/browser/ui/android/infobars/autofill_save_card_infobar.cc
@@ -25,7 +25,7 @@
std::unique_ptr<infobars::InfoBar> CreateSaveCardInfoBarMobile(
std::unique_ptr<AutofillSaveCardInfoBarDelegateMobile> delegate,
- base::Optional<AccountInfo> account_info) {
+ absl::optional<AccountInfo> account_info) {
return std::make_unique<AutofillSaveCardInfoBar>(std::move(delegate),
account_info);
}
@@ -34,7 +34,7 @@
AutofillSaveCardInfoBar::AutofillSaveCardInfoBar(
std::unique_ptr<autofill::AutofillSaveCardInfoBarDelegateMobile> delegate,
- base::Optional<AccountInfo> account_info)
+ absl::optional<AccountInfo> account_info)
: infobars::ConfirmInfoBar(std::move(delegate)) {
account_info_ = account_info;
}
diff --git a/chrome/browser/ui/android/infobars/autofill_save_card_infobar.h b/chrome/browser/ui/android/infobars/autofill_save_card_infobar.h
index 0415d8a5..4d5ba7b8 100644
--- a/chrome/browser/ui/android/infobars/autofill_save_card_infobar.h
+++ b/chrome/browser/ui/android/infobars/autofill_save_card_infobar.h
@@ -22,7 +22,7 @@
public:
explicit AutofillSaveCardInfoBar(
std::unique_ptr<autofill::AutofillSaveCardInfoBarDelegateMobile> delegate,
- base::Optional<AccountInfo> account_info);
+ absl::optional<AccountInfo> account_info);
~AutofillSaveCardInfoBar() override;
@@ -43,7 +43,7 @@
// are stored in /chrome and /components cannot depend on /chrome.
int GetGooglePayBrandingIconId();
- base::Optional<AccountInfo> account_info_;
+ absl::optional<AccountInfo> account_info_;
DISALLOW_COPY_AND_ASSIGN(AutofillSaveCardInfoBar);
};
diff --git a/chrome/browser/ui/android/infobars/save_password_infobar.cc b/chrome/browser/ui/android/infobars/save_password_infobar.cc
index 0dba1c22..728be05 100644
--- a/chrome/browser/ui/android/infobars/save_password_infobar.cc
+++ b/chrome/browser/ui/android/infobars/save_password_infobar.cc
@@ -18,7 +18,7 @@
SavePasswordInfoBar::SavePasswordInfoBar(
std::unique_ptr<SavePasswordInfoBarDelegate> delegate,
- base::Optional<AccountInfo> account_info)
+ absl::optional<AccountInfo> account_info)
: infobars::ConfirmInfoBar(std::move(delegate)) {
account_info_ = account_info;
}
diff --git a/chrome/browser/ui/android/infobars/save_password_infobar.h b/chrome/browser/ui/android/infobars/save_password_infobar.h
index 6fbff42..0cfd2a2 100644
--- a/chrome/browser/ui/android/infobars/save_password_infobar.h
+++ b/chrome/browser/ui/android/infobars/save_password_infobar.h
@@ -18,7 +18,7 @@
public:
explicit SavePasswordInfoBar(
std::unique_ptr<SavePasswordInfoBarDelegate> delegate,
- base::Optional<AccountInfo> account_info);
+ absl::optional<AccountInfo> account_info);
~SavePasswordInfoBar() override;
private:
@@ -31,7 +31,7 @@
base::android::ScopedJavaGlobalRef<jobject> java_infobar_;
- base::Optional<AccountInfo> account_info_;
+ absl::optional<AccountInfo> account_info_;
DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBar);
};
diff --git a/chrome/browser/ui/android/infobars/update_password_infobar.cc b/chrome/browser/ui/android/infobars/update_password_infobar.cc
index 20e844b..b3d37ad 100644
--- a/chrome/browser/ui/android/infobars/update_password_infobar.cc
+++ b/chrome/browser/ui/android/infobars/update_password_infobar.cc
@@ -20,7 +20,7 @@
UpdatePasswordInfoBar::UpdatePasswordInfoBar(
std::unique_ptr<UpdatePasswordInfoBarDelegate> delegate,
- base::Optional<AccountInfo> account_info)
+ absl::optional<AccountInfo> account_info)
: infobars::ConfirmInfoBar(std::move(delegate)) {
account_info_ = account_info;
}
diff --git a/chrome/browser/ui/android/infobars/update_password_infobar.h b/chrome/browser/ui/android/infobars/update_password_infobar.h
index e64a1ec..a128a88 100644
--- a/chrome/browser/ui/android/infobars/update_password_infobar.h
+++ b/chrome/browser/ui/android/infobars/update_password_infobar.h
@@ -16,7 +16,7 @@
class UpdatePasswordInfoBar : public infobars::ConfirmInfoBar {
public:
UpdatePasswordInfoBar(std::unique_ptr<UpdatePasswordInfoBarDelegate> delegate,
- base::Optional<AccountInfo> account_info);
+ absl::optional<AccountInfo> account_info);
~UpdatePasswordInfoBar() override;
int GetIdOfSelectedUsername() const;
@@ -31,7 +31,7 @@
base::android::ScopedJavaGlobalRef<jobject> java_infobar_;
- base::Optional<AccountInfo> account_info_;
+ absl::optional<AccountInfo> account_info_;
DISALLOW_COPY_AND_ASSIGN(UpdatePasswordInfoBar);
};
diff --git a/chrome/browser/ui/android/login_handler_android.cc b/chrome/browser/ui/android/login_handler_android.cc
index ae8c00c..f77540ab 100644
--- a/chrome/browser/ui/android/login_handler_android.cc
+++ b/chrome/browser/ui/android/login_handler_android.cc
@@ -8,7 +8,6 @@
#include <string>
#include "base/logging.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/ui/android/chrome_http_auth_handler.h"
@@ -16,6 +15,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "net/base/auth.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/android/view_android.h"
#include "ui/android/window_android.h"
diff --git a/chrome/browser/ui/android/tab_model/android_live_tab_context.cc b/chrome/browser/ui/android/tab_model/android_live_tab_context.cc
index 1923ad1..d418bc41 100644
--- a/chrome/browser/ui/android/tab_model/android_live_tab_context.cc
+++ b/chrome/browser/ui/android/tab_model/android_live_tab_context.cc
@@ -68,10 +68,10 @@
return false;
}
-base::Optional<tab_groups::TabGroupId> AndroidLiveTabContext::GetTabGroupForTab(
+absl::optional<tab_groups::TabGroupId> AndroidLiveTabContext::GetTabGroupForTab(
int index) const {
// Not applicable to android.
- return base::Optional<tab_groups::TabGroupId>();
+ return absl::optional<tab_groups::TabGroupId>();
}
const tab_groups::TabGroupVisualData*
@@ -114,7 +114,7 @@
int tab_index,
int selected_navigation,
const std::string& extension_app_id,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
const tab_groups::TabGroupVisualData& group_visual_data,
bool select,
bool pin,
@@ -145,7 +145,7 @@
// Currently does nothing.
sessions::LiveTab* AndroidLiveTabContext::ReplaceRestoredTab(
const std::vector<sessions::SerializedNavigationEntry>& navigations,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
int selected_navigation,
const std::string& extension_app_id,
const sessions::PlatformSpecificTabData* tab_platform_data,
diff --git a/chrome/browser/ui/android/tab_model/android_live_tab_context.h b/chrome/browser/ui/android/tab_model/android_live_tab_context.h
index 1d2735b..86963c2 100644
--- a/chrome/browser/ui/android/tab_model/android_live_tab_context.h
+++ b/chrome/browser/ui/android/tab_model/android_live_tab_context.h
@@ -36,7 +36,7 @@
sessions::LiveTab* GetLiveTabAt(int index) const override;
sessions::LiveTab* GetActiveLiveTab() const override;
bool IsTabPinned(int index) const override;
- base::Optional<tab_groups::TabGroupId> GetTabGroupForTab(
+ absl::optional<tab_groups::TabGroupId> GetTabGroupForTab(
int index) const override;
const tab_groups::TabGroupVisualData* GetVisualDataForGroup(
const tab_groups::TabGroupId& group) const override;
@@ -51,7 +51,7 @@
int tab_index,
int selected_navigation,
const std::string& extension_app_id,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
const tab_groups::TabGroupVisualData& group_visual_data,
bool select,
bool pin,
@@ -60,7 +60,7 @@
const SessionID* tab_id) override;
sessions::LiveTab* ReplaceRestoredTab(
const std::vector<sessions::SerializedNavigationEntry>& navigations,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
int selected_navigation,
const std::string& extension_app_id,
const sessions::PlatformSpecificTabData* tab_platform_data,
diff --git a/chrome/browser/ui/app_list/app_list_notifier_impl.cc b/chrome/browser/ui/app_list/app_list_notifier_impl.cc
index 5c04dff3..8cd7736 100644
--- a/chrome/browser/ui/app_list/app_list_notifier_impl.cc
+++ b/chrome/browser/ui/app_list/app_list_notifier_impl.cc
@@ -23,7 +23,7 @@
: app_list_controller_(app_list_controller) {
DCHECK(app_list_controller_);
app_list_controller_->AddObserver(this);
- OnAppListVisibilityWillChange(app_list_controller_->IsVisible(base::nullopt),
+ OnAppListVisibilityWillChange(app_list_controller_->IsVisible(absl::nullopt),
display::kInvalidDisplayId);
}
diff --git a/chrome/browser/ui/app_list/app_list_notifier_impl.h b/chrome/browser/ui/app_list/app_list_notifier_impl.h
index 3355b95b..7ba13b9 100644
--- a/chrome/browser/ui/app_list/app_list_notifier_impl.h
+++ b/chrome/browser/ui/app_list/app_list_notifier_impl.h
@@ -15,7 +15,7 @@
#include "base/containers/flat_map.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class OneShotTimer;
@@ -191,7 +191,7 @@
// The current search query, may be empty.
std::u16string query_;
// The most recently launched result.
- base::Optional<Result> launched_result_;
+ absl::optional<Result> launched_result_;
base::WeakPtrFactory<AppListNotifierImpl> weak_ptr_factory_{this};
};
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.cc b/chrome/browser/ui/app_list/app_list_syncable_service.cc
index d67e3275..489f411 100644
--- a/chrome/browser/ui/app_list/app_list_syncable_service.cc
+++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc
@@ -946,7 +946,7 @@
}
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
AppListSyncableService::MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
@@ -1056,7 +1056,7 @@
on_initialized_.Signal();
}
- return base::nullopt;
+ return absl::nullopt;
}
void AppListSyncableService::StopSyncing(syncer::ModelType type) {
@@ -1076,7 +1076,7 @@
return list;
}
-base::Optional<syncer::ModelError> AppListSyncableService::ProcessSyncChanges(
+absl::optional<syncer::ModelError> AppListSyncableService::ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) {
if (!sync_processor_.get()) {
@@ -1107,7 +1107,7 @@
GetModelUpdater()->NotifyProcessSyncChangesFinished();
- return base::nullopt;
+ return absl::nullopt;
}
void AppListSyncableService::Shutdown() {
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.h b/chrome/browser/ui/app_list/app_list_syncable_service.h
index e426ff45..cefc3fb 100644
--- a/chrome/browser/ui/app_list/app_list_syncable_service.h
+++ b/chrome/browser/ui/app_list/app_list_syncable_service.h
@@ -182,14 +182,14 @@
// syncer::SyncableService
void WaitUntilReadyToSync(base::OnceClosure done) override;
- base::Optional<syncer::ModelError> MergeDataAndStartSyncing(
+ absl::optional<syncer::ModelError> MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
std::unique_ptr<syncer::SyncErrorFactory> error_handler) override;
void StopSyncing(syncer::ModelType type) override;
syncer::SyncDataList GetAllSyncDataForTesting() const;
- base::Optional<syncer::ModelError> ProcessSyncChanges(
+ absl::optional<syncer::ModelError> ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) override;
diff --git a/chrome/browser/ui/app_list/arc/arc_app_launcher.h b/chrome/browser/ui/app_list/arc/arc_app_launcher.h
index 3c986a7..b644005d 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_launcher.h
+++ b/chrome/browser/ui/app_list/arc/arc_app_launcher.h
@@ -10,12 +10,12 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "components/arc/metrics/arc_metrics_constants.h"
#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class BrowserContext;
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc
index 11a98fc..e9969416 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc
@@ -1196,7 +1196,7 @@
app_list_refreshed_callback_.Reset();
}
-void ArcAppListPrefs::HandleTaskCreated(const base::Optional<std::string>& name,
+void ArcAppListPrefs::HandleTaskCreated(const absl::optional<std::string>& name,
const std::string& package_name,
const std::string& activity) {
DCHECK(IsArcAndroidEnabledForProfile(profile_));
@@ -1822,8 +1822,8 @@
void ArcAppListPrefs::OnTaskCreated(int32_t task_id,
const std::string& package_name,
const std::string& activity,
- const base::Optional<std::string>& name,
- const base::Optional<std::string>& intent,
+ const absl::optional<std::string>& name,
+ const absl::optional<std::string>& intent,
int32_t session_id) {
HandleTaskCreated(name, package_name, activity);
for (auto& observer : observer_list_) {
@@ -2035,7 +2035,7 @@
}
void ArcAppListPrefs::OnInstallationStarted(
- const base::Optional<std::string>& package_name) {
+ const absl::optional<std::string>& package_name) {
++installing_packages_count_;
if (!package_name.has_value())
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h
index a0cc2fb8..4342a26 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h
+++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h
@@ -20,7 +20,6 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/ash/arc/policy/arc_policy_bridge.h"
@@ -31,6 +30,7 @@
#include "components/arc/mojom/compatibility_mode.mojom.h"
#include "components/arc/session/connection_observer.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/layout.h"
class ArcDefaultAppList;
@@ -441,8 +441,8 @@
void OnTaskCreated(int32_t task_id,
const std::string& package_name,
const std::string& activity,
- const base::Optional<std::string>& name,
- const base::Optional<std::string>& intent,
+ const absl::optional<std::string>& name,
+ const absl::optional<std::string>& intent,
int32_t session_id) override;
// This interface is deprecated and will soon be replaced by
// OnTaskDescriptionChanged().
@@ -464,7 +464,7 @@
void OnPackageListRefreshed(
std::vector<arc::mojom::ArcPackageInfoPtr> packages) override;
void OnInstallationStarted(
- const base::Optional<std::string>& package_name) override;
+ const absl::optional<std::string>& package_name) override;
void OnInstallationFinished(
arc::mojom::InstallationResultPtr result) override;
@@ -543,7 +543,7 @@
// This checks if app is not registered yet and in this case creates
// non-launchable app entry. In case app is already registered then updates
// last launch time.
- void HandleTaskCreated(const base::Optional<std::string>& name,
+ void HandleTaskCreated(const absl::optional<std::string>& name,
const std::string& package_name,
const std::string& activity);
diff --git a/chrome/browser/ui/app_list/arc/arc_app_test.cc b/chrome/browser/ui/app_list/arc/arc_app_test.cc
index c4d5787..1c6d2db 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_test.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_test.cc
@@ -186,7 +186,7 @@
kPackageName1 /* package_name */, 1 /* package_version */,
1 /* last_backup_android_id */, 1 /* last_backup_time */,
false /* sync */, false /* system */, false /* vpn_provider */,
- nullptr /* web_app_info */, base::nullopt, std::move(permissions1)));
+ nullptr /* web_app_info */, absl::nullopt, std::move(permissions1)));
base::flat_map<arc::mojom::AppPermission, arc::mojom::PermissionStatePtr>
permissions2;
@@ -200,7 +200,7 @@
kPackageName2 /* package_name */, 2 /* package_version */,
2 /* last_backup_android_id */, 2 /* last_backup_time */, true /* sync */,
false /* system */, false /* vpn_provider */, nullptr /* web_app_info */,
- base::nullopt, std::move(permissions2)));
+ absl::nullopt, std::move(permissions2)));
base::flat_map<arc::mojom::AppPermission, arc::mojom::PermissionStatePtr>
permissions3;
@@ -217,7 +217,7 @@
kPackageName3 /* package_name */, 3 /* package_version */,
3 /* last_backup_android_id */, 3 /* last_backup_time */,
false /* sync */, false /* system */, false /* vpn_provider */,
- nullptr /* web_app_info */, base::nullopt, std::move(permissions3)));
+ nullptr /* web_app_info */, absl::nullopt, std::move(permissions3)));
for (int i = 0; i < 3; ++i) {
arc::mojom::ShortcutInfo shortcut_info;
diff --git a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
index 89969443..2eb156b 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
@@ -717,7 +717,7 @@
return arc::mojom::ArcPackageInfo::New(
package_name, package_version, 1 /* last_backup_android_id */,
1 /* last_backup_time */, true /* sync */, false /* system */,
- false /* vpn_provider */, nullptr /* web_app_info */, base::nullopt,
+ false /* vpn_provider */, nullptr /* web_app_info */, absl::nullopt,
std::move(permissions) /* permission states */);
}
diff --git a/chrome/browser/ui/app_list/arc/arc_app_utils.cc b/chrome/browser/ui/app_list/arc/arc_app_utils.cc
index a3876e2..32c7ed1 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_utils.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_utils.cc
@@ -128,7 +128,7 @@
bool Launch(content::BrowserContext* context,
const std::string& app_id,
- const base::Optional<std::string>& intent,
+ const absl::optional<std::string>& intent,
int event_flags,
arc::mojom::WindowInfoPtr window_info) {
ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context);
@@ -268,7 +268,7 @@
const std::string& app_id,
int event_flags,
arc::UserInteractionType user_action) {
- return LaunchAppWithIntent(context, app_id, base::nullopt /* launch_intent */,
+ return LaunchAppWithIntent(context, app_id, absl::nullopt /* launch_intent */,
event_flags, user_action,
MakeWindowInfo(display::kInvalidDisplayId));
}
@@ -278,13 +278,13 @@
int event_flags,
arc::UserInteractionType user_action,
arc::mojom::WindowInfoPtr window_info) {
- return LaunchAppWithIntent(context, app_id, base::nullopt /* launch_intent */,
+ return LaunchAppWithIntent(context, app_id, absl::nullopt /* launch_intent */,
event_flags, user_action, std::move(window_info));
}
bool LaunchAppWithIntent(content::BrowserContext* context,
const std::string& app_id,
- const base::Optional<std::string>& launch_intent,
+ const absl::optional<std::string>& launch_intent,
int event_flags,
arc::UserInteractionType user_action,
arc::mojom::WindowInfoPtr window_info) {
@@ -334,7 +334,7 @@
ArcAppListPrefs* prefs = ArcAppListPrefs::Get(context);
std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id);
- base::Optional<std::string> launch_intent_to_send = std::move(launch_intent);
+ absl::optional<std::string> launch_intent_to_send = std::move(launch_intent);
if (app_info && !app_info->ready) {
if (!IsArcPlayStoreEnabledForProfile(profile)) {
if (prefs->IsDefault(app_id)) {
diff --git a/chrome/browser/ui/app_list/arc/arc_app_utils.h b/chrome/browser/ui/app_list/arc/arc_app_utils.h
index af98f68a..facd509 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_utils.h
+++ b/chrome/browser/ui/app_list/arc/arc_app_utils.h
@@ -12,11 +12,11 @@
#include "base/macros.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
#include "components/arc/metrics/arc_metrics_constants.h"
#include "components/arc/mojom/app.mojom-forward.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -131,7 +131,7 @@
bool LaunchAppWithIntent(content::BrowserContext* context,
const std::string& app_id,
- const base::Optional<std::string>& launch_intent,
+ const absl::optional<std::string>& launch_intent,
int event_flags,
UserInteractionType user_action,
arc::mojom::WindowInfoPtr window_info);
diff --git a/chrome/browser/ui/app_list/arc/arc_package_syncable_service.cc b/chrome/browser/ui/app_list/arc/arc_package_syncable_service.cc
index 3cbc6bcd..49b7071 100644
--- a/chrome/browser/ui/app_list/arc/arc_package_syncable_service.cc
+++ b/chrome/browser/ui/app_list/arc/arc_package_syncable_service.cc
@@ -133,7 +133,7 @@
wait_until_ready_to_sync_cb_ = std::move(done);
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
ArcPackageSyncableService::MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
@@ -188,7 +188,7 @@
sync_items_[local_package_name] = std::move(sync_item);
}
sync_processor_->ProcessSyncChanges(FROM_HERE, change_list);
- return base::nullopt;
+ return absl::nullopt;
}
void ArcPackageSyncableService::StopSyncing(syncer::ModelType type) {
@@ -203,7 +203,7 @@
pending_uninstall_items_.clear();
}
-base::Optional<syncer::ModelError>
+absl::optional<syncer::ModelError>
ArcPackageSyncableService::ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) {
@@ -233,7 +233,7 @@
}
}
- return base::nullopt;
+ return absl::nullopt;
}
bool ArcPackageSyncableService::SyncStarted() {
diff --git a/chrome/browser/ui/app_list/arc/arc_package_syncable_service.h b/chrome/browser/ui/app_list/arc/arc_package_syncable_service.h
index a93c92a2..9c7257f3 100644
--- a/chrome/browser/ui/app_list/arc/arc_package_syncable_service.h
+++ b/chrome/browser/ui/app_list/arc/arc_package_syncable_service.h
@@ -56,13 +56,13 @@
// syncer::SyncableService:
void WaitUntilReadyToSync(base::OnceClosure done) override;
- base::Optional<syncer::ModelError> MergeDataAndStartSyncing(
+ absl::optional<syncer::ModelError> MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
std::unique_ptr<syncer::SyncErrorFactory> error_handler) override;
void StopSyncing(syncer::ModelType type) override;
- base::Optional<syncer::ModelError> ProcessSyncChanges(
+ absl::optional<syncer::ModelError> ProcessSyncChanges(
const base::Location& from_here,
const syncer::SyncChangeList& change_list) override;
diff --git a/chrome/browser/ui/app_list/arc/arc_usb_host_permission_manager.cc b/chrome/browser/ui/app_list/arc/arc_usb_host_permission_manager.cc
index 30e16ae8..c498c97 100644
--- a/chrome/browser/ui/app_list/arc/arc_usb_host_permission_manager.cc
+++ b/chrome/browser/ui/app_list/arc/arc_usb_host_permission_manager.cc
@@ -61,8 +61,8 @@
ArcUsbHostPermissionManager::UsbPermissionRequest::UsbPermissionRequest(
const std::string& package_name,
bool is_scan_request,
- base::Optional<UsbDeviceEntry> usb_device_entry,
- base::Optional<ArcUsbHostUiDelegate::RequestPermissionCallback> callback)
+ absl::optional<UsbDeviceEntry> usb_device_entry,
+ absl::optional<ArcUsbHostUiDelegate::RequestPermissionCallback> callback)
: package_name_(package_name),
is_scan_request_(is_scan_request),
usb_device_entry_(std::move(usb_device_entry)),
@@ -226,7 +226,7 @@
pending_requests_.emplace_back(
ArcUsbHostPermissionManager::UsbPermissionRequest(
package_name, true /*is_scan_request*/,
- base::nullopt /*usb_device_entry*/, base::nullopt /*callback*/));
+ absl::nullopt /*usb_device_entry*/, absl::nullopt /*callback*/));
MaybeProcessNextPermissionRequest();
}
diff --git a/chrome/browser/ui/app_list/arc/arc_usb_host_permission_manager.h b/chrome/browser/ui/app_list/arc/arc_usb_host_permission_manager.h
index dbbe4e2..1e0e064 100644
--- a/chrome/browser/ui/app_list/arc/arc_usb_host_permission_manager.h
+++ b/chrome/browser/ui/app_list/arc/arc_usb_host_permission_manager.h
@@ -64,8 +64,8 @@
UsbPermissionRequest(
const std::string& package_name,
bool is_scan_request,
- base::Optional<UsbDeviceEntry> usb_device_entry,
- base::Optional<ArcUsbHostUiDelegate::RequestPermissionCallback>
+ absl::optional<UsbDeviceEntry> usb_device_entry,
+ absl::optional<ArcUsbHostUiDelegate::RequestPermissionCallback>
callback);
UsbPermissionRequest(UsbPermissionRequest&& other);
UsbPermissionRequest& operator=(UsbPermissionRequest&& other);
@@ -73,7 +73,7 @@
const std::string& package_name() const { return package_name_; }
bool is_scan_request() const { return is_scan_request_; }
- const base::Optional<UsbDeviceEntry>& usb_device_entry() const {
+ const absl::optional<UsbDeviceEntry>& usb_device_entry() const {
return usb_device_entry_;
}
@@ -88,10 +88,10 @@
bool is_scan_request_;
// Device entry of targeting device access request. nullopt if this is a
// scan device list request.
- base::Optional<UsbDeviceEntry> usb_device_entry_;
+ absl::optional<UsbDeviceEntry> usb_device_entry_;
// Callback of the device access reqeust. nullopt if this is a scan device
// list request.
- base::Optional<RequestPermissionCallback> callback_;
+ absl::optional<RequestPermissionCallback> callback_;
DISALLOW_COPY_AND_ASSIGN(UsbPermissionRequest);
};
diff --git a/chrome/browser/ui/app_list/search/arc/arc_app_data_search_result.cc b/chrome/browser/ui/app_list/search/arc/arc_app_data_search_result.cc
index de95d6e..408a0b3 100644
--- a/chrome/browser/ui/app_list/search/arc/arc_app_data_search_result.cc
+++ b/chrome/browser/ui/app_list/search/arc/arc_app_data_search_result.cc
@@ -44,7 +44,7 @@
if (auto* app_instance =
ARC_GET_INSTANCE_FOR_METHOD(app, LaunchIntentDeprecated)) {
- app_instance->LaunchIntentDeprecated(intent_uri, base::nullopt);
+ app_instance->LaunchIntentDeprecated(intent_uri, absl::nullopt);
return true;
}
diff --git a/chrome/browser/ui/app_list/search/arc/arc_app_data_search_result.h b/chrome/browser/ui/app_list/search/arc/arc_app_data_search_result.h
index c536a9f..e70d55a1 100644
--- a/chrome/browser/ui/app_list/search/arc/arc_app_data_search_result.h
+++ b/chrome/browser/ui/app_list/search/arc/arc_app_data_search_result.h
@@ -11,9 +11,9 @@
#include "ash/public/cpp/app_list/app_list_metrics.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ui/app_list/search/chrome_search_result.h"
#include "components/arc/mojom/app.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class AppListControllerDelegate;
@@ -38,7 +38,7 @@
const std::string& launch_intent_uri() const {
return data_->launch_intent_uri;
}
- const base::Optional<std::vector<uint8_t>>& icon_png_data() const {
+ const absl::optional<std::vector<uint8_t>>& icon_png_data() const {
// TODO(crbug.com/1083331): Remove the checking, when the ARC change is
// rolled in Chrome OS.
if (!data_->icon || !data_->icon->icon_png_data ||
diff --git a/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider.cc b/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider.cc
index caca0be..d4277b9 100644
--- a/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider.cc
+++ b/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider.cc
@@ -332,7 +332,7 @@
for (const auto& candidate : results) {
// only keep candidates with icons.
- if (candidate->icon_url != base::nullopt) {
+ if (candidate->icon_url != absl::nullopt) {
loaded_value_.push_back(candidate.Clone());
}
}
diff --git a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.cc b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.cc
index bf7d39f..ebe77885 100644
--- a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.cc
+++ b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.cc
@@ -89,7 +89,7 @@
if (auto* app_instance = ARC_GET_INSTANCE_FOR_METHOD(
arc_bridge->app(), LaunchIntentDeprecated)) {
- app_instance->LaunchIntentDeprecated(intent_uri, base::nullopt);
+ app_instance->LaunchIntentDeprecated(intent_uri, absl::nullopt);
return true;
}
diff --git a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h
index 56633ef7..fc42760 100644
--- a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h
+++ b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h
@@ -11,10 +11,10 @@
#include "ash/public/cpp/app_list/app_list_metrics.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ui/app_list/app_context_menu_delegate.h"
#include "chrome/browser/ui/app_list/search/chrome_search_result.h"
#include "components/arc/mojom/app.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class AppListControllerDelegate;
class ArcPlayStoreAppContextMenu;
@@ -43,12 +43,12 @@
void ExecuteLaunchCommand(int event_flags) override;
private:
- const base::Optional<std::string>& install_intent_uri() const {
+ const absl::optional<std::string>& install_intent_uri() const {
return data_->install_intent_uri;
}
- const base::Optional<std::string>& label() const { return data_->label; }
+ const absl::optional<std::string>& label() const { return data_->label; }
bool is_instant_app() const { return data_->is_instant_app; }
- const base::Optional<std::string>& formatted_price() const {
+ const absl::optional<std::string>& formatted_price() const {
return data_->formatted_price;
}
float review_score() const { return data_->review_score; }
diff --git a/chrome/browser/ui/app_list/search/arc/recommend_apps_fetcher_impl.cc b/chrome/browser/ui/app_list/search/arc/recommend_apps_fetcher_impl.cc
index b56fb59..bdf1b91 100644
--- a/chrome/browser/ui/app_list/search/arc/recommend_apps_fetcher_impl.cc
+++ b/chrome/browser/ui/app_list/search/arc/recommend_apps_fetcher_impl.cc
@@ -174,7 +174,7 @@
base::StringPiece response_body_json(*response_body);
if (base::StartsWith(response_body_json, kJsonXssPreventionPrefix))
response_body_json.remove_prefix(kJsonXssPreventionPrefix.length());
- base::Optional<base::Value> output = ParseResponse(response_body_json);
+ absl::optional<base::Value> output = ParseResponse(response_body_json);
if (!output.has_value()) {
// TODO(thanhdng): Add a UMA histogram here.
delegate_->OnParseResponseError();
@@ -184,7 +184,7 @@
delegate_->OnLoadSuccess(std::move(output.value()));
}
-base::Optional<base::Value> RecommendAppsFetcherImpl::ParseResponse(
+absl::optional<base::Value> RecommendAppsFetcherImpl::ParseResponse(
base::StringPiece response) {
base::JSONReader::ValueWithError parsed_json =
base::JSONReader::ReadAndReturnValueWithError(response);
@@ -193,7 +193,7 @@
(!parsed_json.value->is_list() && !parsed_json.value->is_dict())) {
LOG(ERROR) << "Error parsing response JSON: " << parsed_json.error_message;
// TODO(thanhdng): Add a UMA histogram here.
- return base::nullopt;
+ return absl::nullopt;
}
// If the response is a dictionary, it is an error message in the
@@ -208,7 +208,7 @@
LOG(ERROR) << "Unable to find error code: response="
<< response.substr(0, 128);
// TODO(thanhdng): Add a UMA histogram here.
- return base::nullopt;
+ return absl::nullopt;
}
base::StringPiece response_error_code_str =
@@ -217,7 +217,7 @@
if (!base::StringToInt(response_error_code_str, &response_error_code)) {
LOG(WARNING) << "Unable to parse error code: " << response_error_code_str;
// TODO(thanhdng): Add a UMA histogram here.
- return base::nullopt;
+ return absl::nullopt;
}
if (response_error_code == kResponseErrorNotFirstTimeChromebookUser) {
@@ -229,7 +229,7 @@
// TODO(thanhdng): Add a UMA histogram here.
}
- return base::nullopt;
+ return absl::nullopt;
}
// Otherwise, the response should return a list of apps.
@@ -237,7 +237,7 @@
if (app_list.empty()) {
DVLOG(1) << "No app in the response.";
// TODO(thanhdng): Add a UMA histogram here.
- return base::nullopt;
+ return absl::nullopt;
}
base::Value output(base::Value::Type::LIST);
diff --git a/chrome/browser/ui/app_list/search/arc/recommend_apps_fetcher_impl.h b/chrome/browser/ui/app_list/search/arc/recommend_apps_fetcher_impl.h
index fa67d1e..8d0be52 100644
--- a/chrome/browser/ui/app_list/search/arc/recommend_apps_fetcher_impl.h
+++ b/chrome/browser/ui/app_list/search/arc/recommend_apps_fetcher_impl.h
@@ -52,8 +52,8 @@
// Called when SimpleURLLoader completes.
void OnDownloaded(std::unique_ptr<std::string> response_body);
- // If the response is not a valid JSON, return base::nullopt.
- // If the response contains no app, return base::nullopt;
+ // If the response is not a valid JSON, return absl::nullopt.
+ // If the response contains no app, return absl::nullopt;
// The value, if exists, is a list containing:
// 1. name: the title of the app.
// 2. package_name: name of the package, for example: com.package.name
@@ -79,7 +79,7 @@
// }
// ]
- base::Optional<base::Value> ParseResponse(base::StringPiece response);
+ absl::optional<base::Value> ParseResponse(base::StringPiece response);
RecommendAppsFetcherDelegate* delegate_;
diff --git a/chrome/browser/ui/app_list/search/chrome_search_result.h b/chrome/browser/ui/app_list/search/chrome_search_result.h
index 8944613..93f9c9d 100644
--- a/chrome/browser/ui/app_list/search/chrome_search_result.h
+++ b/chrome/browser/ui/app_list/search/chrome_search_result.h
@@ -72,8 +72,8 @@
double display_score() const { return metadata_->display_score; }
bool is_installing() const { return metadata_->is_installing; }
bool is_recommendation() const { return metadata_->is_recommendation; }
- const base::Optional<GURL>& query_url() const { return metadata_->query_url; }
- const base::Optional<std::string>& equivalent_result_id() const {
+ const absl::optional<GURL>& query_url() const { return metadata_->query_url; }
+ const absl::optional<std::string>& equivalent_result_id() const {
return metadata_->equivalent_result_id;
}
const gfx::ImageSkia& icon() const { return metadata_->icon; }
diff --git a/chrome/browser/ui/app_list/search/files/drive_search_provider.h b/chrome/browser/ui/app_list/search/files/drive_search_provider.h
index 8a96e99..bcd43294 100644
--- a/chrome/browser/ui/app_list/search/files/drive_search_provider.h
+++ b/chrome/browser/ui/app_list/search/files/drive_search_provider.h
@@ -9,7 +9,6 @@
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "chrome/browser/ui/app_list/search/files/file_result.h"
@@ -17,6 +16,7 @@
#include "chromeos/components/drivefs/mojom/drivefs.mojom-forward.h"
#include "chromeos/components/string_matching/tokenized_string.h"
#include "components/drive/file_errors.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -46,7 +46,7 @@
base::TimeTicks query_start_time_;
std::u16string last_query_;
- base::Optional<chromeos::string_matching::TokenizedString>
+ absl::optional<chromeos::string_matching::TokenizedString>
last_tokenized_query_;
Profile* const profile_;
diff --git a/chrome/browser/ui/app_list/search/files/file_result.cc b/chrome/browser/ui/app_list/search/files/file_result.cc
index 9ad74a0d..d05aef09 100644
--- a/chrome/browser/ui/app_list/search/files/file_result.cc
+++ b/chrome/browser/ui/app_list/search/files/file_result.cc
@@ -49,7 +49,7 @@
// Helper function for calculating a file's relevance score. Will return a
// default relevance score if the query is missing or the filename is empty.
-double CalculateRelevance(const base::Optional<TokenizedString>& query,
+double CalculateRelevance(const absl::optional<TokenizedString>& query,
const std::u16string& raw_title) {
const TokenizedString title(raw_title, TokenizedString::Mode::kWords);
@@ -178,7 +178,7 @@
const base::FilePath& filepath,
ResultType result_type,
const std::u16string& query,
- const base::Optional<chromeos::string_matching::TokenizedString>&
+ const absl::optional<chromeos::string_matching::TokenizedString>&
tokenized_query,
Type type,
Profile* profile)
diff --git a/chrome/browser/ui/app_list/search/files/file_result.h b/chrome/browser/ui/app_list/search/files/file_result.h
index f492ae4a..4a980e5 100644
--- a/chrome/browser/ui/app_list/search/files/file_result.h
+++ b/chrome/browser/ui/app_list/search/files/file_result.h
@@ -8,9 +8,9 @@
#include <iosfwd>
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "chrome/browser/ui/app_list/search/chrome_search_result.h"
#include "chromeos/components/string_matching/tokenized_string.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -32,7 +32,7 @@
const base::FilePath& filepath,
ResultType result_type,
const std::u16string& query,
- const base::Optional<chromeos::string_matching::TokenizedString>&
+ const absl::optional<chromeos::string_matching::TokenizedString>&
tokenized_query,
Type type,
Profile* profile);
diff --git a/chrome/browser/ui/app_list/search/files/file_search_provider.h b/chrome/browser/ui/app_list/search/files/file_search_provider.h
index c261a67..e45129e 100644
--- a/chrome/browser/ui/app_list/search/files/file_search_provider.h
+++ b/chrome/browser/ui/app_list/search/files/file_search_provider.h
@@ -10,11 +10,11 @@
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "chrome/browser/ui/app_list/search/search_provider.h"
#include "chromeos/components/string_matching/tokenized_string.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -46,7 +46,7 @@
base::TimeTicks query_start_time_;
std::u16string last_query_;
- base::Optional<chromeos::string_matching::TokenizedString>
+ absl::optional<chromeos::string_matching::TokenizedString>
last_tokenized_query_;
Profile* const profile_;
diff --git a/chrome/browser/ui/app_list/search/files/item_suggest_cache.cc b/chrome/browser/ui/app_list/search/files/item_suggest_cache.cc
index 0a5df4f..4fba17d 100644
--- a/chrome/browser/ui/app_list/search/files/item_suggest_cache.cc
+++ b/chrome/browser/ui/app_list/search/files/item_suggest_cache.cc
@@ -86,23 +86,23 @@
// JSON utilities
//---------------
-base::Optional<base::Value::ConstListView> GetList(const base::Value* value,
+absl::optional<base::Value::ConstListView> GetList(const base::Value* value,
const std::string& key) {
if (!value->is_dict())
- return base::nullopt;
+ return absl::nullopt;
const base::Value* field = value->FindListKey(key);
if (!field)
- return base::nullopt;
+ return absl::nullopt;
return field->GetList();
}
-base::Optional<std::string> GetString(const base::Value* value,
+absl::optional<std::string> GetString(const base::Value* value,
const std::string& key) {
if (!value->is_dict())
- return base::nullopt;
+ return absl::nullopt;
const std::string* field = value->FindStringKey(key);
if (!field)
- return base::nullopt;
+ return absl::nullopt;
return *field;
}
@@ -110,36 +110,36 @@
// JSON response parsing
//----------------------
-base::Optional<ItemSuggestCache::Result> ConvertResult(
+absl::optional<ItemSuggestCache::Result> ConvertResult(
const base::Value* value) {
const auto& item_id = GetString(value, "itemId");
const auto& display_text = GetString(value, "displayText");
if (!item_id || !display_text)
- return base::nullopt;
+ return absl::nullopt;
return ItemSuggestCache::Result(item_id.value(), display_text.value());
}
-base::Optional<ItemSuggestCache::Results> ConvertResults(
+absl::optional<ItemSuggestCache::Results> ConvertResults(
const base::Value* value) {
const auto& suggestion_id = GetString(value, "suggestionSessionId");
if (!suggestion_id)
- return base::nullopt;
+ return absl::nullopt;
ItemSuggestCache::Results results(suggestion_id.value());
const auto items = GetList(value, "item");
if (!items)
- return base::nullopt;
+ return absl::nullopt;
for (const auto& result_value : items.value()) {
auto result = ConvertResult(&result_value);
- // If any result fails conversion, fail completely and return base::nullopt,
+ // If any result fails conversion, fail completely and return absl::nullopt,
// rather than just skipping this result. This makes clear the distinction
// between a response format issue and the response containing no results.
if (!result)
- return base::nullopt;
+ return absl::nullopt;
results.results.push_back(std::move(result.value()));
}
@@ -187,7 +187,7 @@
ItemSuggestCache::~ItemSuggestCache() = default;
-base::Optional<ItemSuggestCache::Results> ItemSuggestCache::GetResults() {
+absl::optional<ItemSuggestCache::Results> ItemSuggestCache::GetResults() {
// Return a copy because a pointer to |results_| will become invalid whenever
// the cache is updated.
return results_;
@@ -368,7 +368,7 @@
}
// static
-base::Optional<ItemSuggestCache::Results> ItemSuggestCache::ConvertJsonForTest(
+absl::optional<ItemSuggestCache::Results> ItemSuggestCache::ConvertJsonForTest(
const base::Value* value) {
return ConvertResults(value);
}
diff --git a/chrome/browser/ui/app_list/search/files/item_suggest_cache.h b/chrome/browser/ui/app_list/search/files/item_suggest_cache.h
index 1c2de97..e952b71d 100644
--- a/chrome/browser/ui/app_list/search/files/item_suggest_cache.h
+++ b/chrome/browser/ui/app_list/search/files/item_suggest_cache.h
@@ -61,12 +61,12 @@
ItemSuggestCache& operator=(const ItemSuggestCache&) = delete;
// Returns the results currently in the cache.
- base::Optional<ItemSuggestCache::Results> GetResults();
+ absl::optional<ItemSuggestCache::Results> GetResults();
// Updates the cache by calling ItemSuggest.
void UpdateCache();
- static base::Optional<ItemSuggestCache::Results> ConvertJsonForTest(
+ static absl::optional<ItemSuggestCache::Results> ConvertJsonForTest(
const base::Value* value);
// Whether or not to override configuration of the cache with an experiment.
@@ -121,7 +121,7 @@
std::unique_ptr<network::SimpleURLLoader> MakeRequestLoader(
const std::string& token);
- base::Optional<Results> results_;
+ absl::optional<Results> results_;
// Records the time of the last call to UpdateResults(), used to limit the
// number of queries to the ItemSuggest backend.
diff --git a/chrome/browser/ui/app_list/search/files/item_suggest_cache_unittest.cc b/chrome/browser/ui/app_list/search/files/item_suggest_cache_unittest.cc
index 1d4a1e5..a05bf82 100644
--- a/chrome/browser/ui/app_list/search/files/item_suggest_cache_unittest.cc
+++ b/chrome/browser/ui/app_list/search/files/item_suggest_cache_unittest.cc
@@ -84,7 +84,7 @@
}
void ResultsMatch(
- const base::Optional<ItemSuggestCache::Results>& actual,
+ const absl::optional<ItemSuggestCache::Results>& actual,
const std::string& suggestion_id,
const std::vector<std::pair<std::string, std::string>>& results) {
EXPECT_TRUE(actual.has_value());
diff --git a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.cc b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.cc
index ba7315b..dbfa98c 100644
--- a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.cc
+++ b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.cc
@@ -176,7 +176,7 @@
}
void ZeroStateDriveProvider::OnFilePathsLocated(
- base::Optional<std::vector<drivefs::mojom::FilePathOrErrorPtr>> paths) {
+ absl::optional<std::vector<drivefs::mojom::FilePathOrErrorPtr>> paths) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!paths) {
LogStatus(Status::kPathLocationFailed);
diff --git a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.h b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.h
index 64b3f5ee..380a691 100644
--- a/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.h
+++ b/chrome/browser/ui/app_list/search/files/zero_state_drive_provider.h
@@ -10,7 +10,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/sequenced_task_runner.h"
#include "base/time/time.h"
@@ -20,6 +19,7 @@
#include "chrome/browser/ui/app_list/search/score_normalizer/score_normalizer.h"
#include "chrome/browser/ui/app_list/search/search_provider.h"
#include "chromeos/components/drivefs/mojom/drivefs.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -49,7 +49,7 @@
private:
void OnFilePathsLocated(
- base::Optional<std::vector<drivefs::mojom::FilePathOrErrorPtr>> paths);
+ absl::optional<std::vector<drivefs::mojom::FilePathOrErrorPtr>> paths);
std::unique_ptr<FileResult> MakeListResult(const base::FilePath& filepath,
const float relevance);
@@ -64,7 +64,7 @@
// The most recent results retrieved from |item_suggested_cache_|. This is
// updated on a call to Start and is used only to store the results until
// OnFilePathsLocated has finished.
- base::Optional<ItemSuggestCache::Results> cache_results_;
+ absl::optional<ItemSuggestCache::Results> cache_results_;
base::TimeTicks query_start_time_;
@@ -73,7 +73,7 @@
const bool suggested_files_enabled_;
// The normalizer normalizes the relevance scores of Results
- base::Optional<ScoreNormalizer> normalizer_;
+ absl::optional<ScoreNormalizer> normalizer_;
// Whether we have sent at least one request to ItemSuggest to warm up the
// results cache.
diff --git a/chrome/browser/ui/app_list/search/files/zero_state_file_provider.h b/chrome/browser/ui/app_list/search/files/zero_state_file_provider.h
index 40923f5..f3476fbb 100644
--- a/chrome/browser/ui/app_list/search/files/zero_state_file_provider.h
+++ b/chrome/browser/ui/app_list/search/files/zero_state_file_provider.h
@@ -14,7 +14,6 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/sequenced_task_runner.h"
#include "base/time/time.h"
@@ -22,6 +21,7 @@
#include "chrome/browser/chromeos/file_manager/file_tasks_observer.h"
#include "chrome/browser/ui/app_list/search/score_normalizer/score_normalizer.h"
#include "chrome/browser/ui/app_list/search/search_provider.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -65,7 +65,7 @@
std::unique_ptr<RecurrenceRanker> files_ranker_;
// The normalizer normalizes the relevance scores of Results
- base::Optional<ScoreNormalizer> normalizer_;
+ absl::optional<ScoreNormalizer> normalizer_;
base::TimeTicks query_start_time_;
diff --git a/chrome/browser/ui/app_list/search/launcher_search/launcher_search_provider.h b/chrome/browser/ui/app_list/search/launcher_search/launcher_search_provider.h
index c916e48c..f862d58b 100644
--- a/chrome/browser/ui/app_list/search/launcher_search/launcher_search_provider.h
+++ b/chrome/browser/ui/app_list/search/launcher_search/launcher_search_provider.h
@@ -57,7 +57,7 @@
base::TimeTicks query_start_time_;
- base::Optional<chromeos::string_matching::TokenizedString>
+ absl::optional<chromeos::string_matching::TokenizedString>
last_tokenized_query_;
// The reference to profile to get LauncherSearchProvider service.
diff --git a/chrome/browser/ui/app_list/search/omnibox_provider.h b/chrome/browser/ui/app_list/search/omnibox_provider.h
index aa9811d..b50ef58 100644
--- a/chrome/browser/ui/app_list/search/omnibox_provider.h
+++ b/chrome/browser/ui/app_list/search/omnibox_provider.h
@@ -8,11 +8,11 @@
#include <memory>
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ui/app_list/search/score_normalizer/score_normalizer.h"
#include "chrome/browser/ui/app_list/search/search_provider.h"
#include "components/omnibox/browser/autocomplete_controller.h"
#include "components/omnibox/browser/favicon_cache.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class AppListControllerDelegate;
class AutocompleteController;
@@ -56,7 +56,7 @@
FaviconCache favicon_cache_;
// The normalizer normalizes the relevance scores of Results
- base::Optional<ScoreNormalizer> normalizer_;
+ absl::optional<ScoreNormalizer> normalizer_;
DISALLOW_COPY_AND_ASSIGN(OmniboxProvider);
};
diff --git a/chrome/browser/ui/app_list/search/omnibox_result.cc b/chrome/browser/ui/app_list/search/omnibox_result.cc
index ff2596c..6de9d98 100644
--- a/chrome/browser/ui/app_list/search/omnibox_result.cc
+++ b/chrome/browser/ui/app_list/search/omnibox_result.cc
@@ -10,7 +10,6 @@
#include "ash/public/cpp/app_list/app_list_features.h"
#include "ash/public/cpp/app_list/vector_icons/vector_icons.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -29,6 +28,7 @@
#include "components/search_engines/util.h"
#include "extensions/common/image_util.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/image/image_skia_operations.h"
@@ -166,14 +166,14 @@
dimension / 2, gfx::kGoogleBlue600, icon);
}
-base::Optional<std::u16string> GetAdditionalText(
+absl::optional<std::u16string> GetAdditionalText(
const SuggestionAnswer::ImageLine& line) {
if (line.additional_text()) {
const auto additional_text = line.additional_text()->text();
if (!additional_text.empty())
return additional_text;
}
- return base::nullopt;
+ return absl::nullopt;
}
std::u16string ImageLineToString16(const SuggestionAnswer::ImageLine& line) {
diff --git a/chrome/browser/ui/app_list/search/search_metrics_observer.cc b/chrome/browser/ui/app_list/search/search_metrics_observer.cc
index 68a778ed..6711a33 100644
--- a/chrome/browser/ui/app_list/search/search_metrics_observer.cc
+++ b/chrome/browser/ui/app_list/search/search_metrics_observer.cc
@@ -7,11 +7,11 @@
#include "base/containers/flat_set.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "chrome/browser/ui/app_list/search/chrome_search_result.h"
#include "chrome/browser/ui/app_list/search/search_controller.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace app_list {
namespace {
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/frecency_store.cc b/chrome/browser/ui/app_list/search/search_result_ranker/frecency_store.cc
index b73c307..a0a9086 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/frecency_store.cc
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/frecency_store.cc
@@ -79,10 +79,10 @@
values_.erase(value);
}
-base::Optional<unsigned int> FrecencyStore::GetId(const std::string& value) {
+absl::optional<unsigned int> FrecencyStore::GetId(const std::string& value) {
auto it = values_.find(value);
if (it == values_.end())
- return base::nullopt;
+ return absl::nullopt;
return it->second.id;
}
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/frecency_store.h b/chrome/browser/ui/app_list/search/search_result_ranker/frecency_store.h
index ec8cd6bb..ff031b3 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/frecency_store.h
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/frecency_store.h
@@ -11,8 +11,8 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ui/app_list/search/search_result_ranker/frecency_store.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace app_list {
@@ -47,8 +47,8 @@
void Remove(const std::string& value);
// Returns the ID for the given value. If the value is not in the store,
- // return base::nullopt.
- base::Optional<unsigned int> GetId(const std::string& value);
+ // return absl::nullopt.
+ absl::optional<unsigned int> GetId(const std::string& value);
// Returns all stored value data. This ensures all scores have been correctly
// updated, and none of the scores are below the |min_score_| threshold.
const ScoreTable& GetAll();
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/frecency_store_unittest.cc b/chrome/browser/ui/app_list/search/search_result_ranker/frecency_store_unittest.cc
index a42fb66..e977ba2 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/frecency_store_unittest.cc
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/frecency_store_unittest.cc
@@ -235,7 +235,7 @@
TEST(FrecencyStoreTest, InvalidGetIdReturnsNullopt) {
FrecencyStore store(100, 0.5f);
- EXPECT_EQ(store.GetId("not found"), base::nullopt);
+ EXPECT_EQ(store.GetId("not found"), absl::nullopt);
}
TEST(FrecencyStoreTest, GetAllGetsAll) {
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_predictor.h b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_predictor.h
index 3fd1163..12c8df1 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_predictor.h
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_predictor.h
@@ -333,7 +333,7 @@
std::unique_ptr<ConditionalFrequencyPredictor> frequencies_;
// The most recently observed target.
- base::Optional<unsigned int> previous_target_;
+ absl::optional<unsigned int> previous_target_;
DISALLOW_COPY_AND_ASSIGN(MarkovPredictor);
};
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.cc b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.cc
index bb7b204..3c82b66 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.cc
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.cc
@@ -12,7 +12,6 @@
#include "base/files/file_util.h"
#include "base/files/important_file_writer.h"
#include "base/hash/hash.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
@@ -26,11 +25,11 @@
#include "chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.pb.h"
#include "chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_config.pb.h"
#include "chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace app_list {
namespace {
-using base::Optional;
using base::Time;
using base::TimeDelta;
@@ -280,8 +279,8 @@
if (predictor_->GetPredictorName() == DefaultPredictor::kPredictorName)
return GetScoresFromFrecencyStore(targets_->GetAll());
- base::Optional<unsigned int> condition_id = conditions_->GetId(condition);
- if (condition_id == base::nullopt)
+ absl::optional<unsigned int> condition_id = conditions_->GetId(condition);
+ if (condition_id == absl::nullopt)
return {};
const auto& targets = targets_->GetAll();
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util.cc b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util.cc
index f8475b7..4ffa65c 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util.cc
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util.cc
@@ -21,7 +21,7 @@
namespace app_list {
namespace {
-using base::Optional;
+using absl::optional;
using base::Value;
using FakePredictorConfig = RecurrencePredictorConfigProto::FakePredictorConfig;
@@ -42,40 +42,40 @@
// Conversion utilities
//---------------------
-base::Optional<const Value*> GetNestedField(const Value* value,
+absl::optional<const Value*> GetNestedField(const Value* value,
const std::string& key) {
const Value* field = value->FindKey(key);
if (!field || !field->is_dict())
- return base::nullopt;
- return base::Optional<const Value*>(field);
+ return absl::nullopt;
+ return absl::optional<const Value*>(field);
}
-Optional<const Value*> GetList(const Value* value, const std::string& key) {
+optional<const Value*> GetList(const Value* value, const std::string& key) {
const Value* field = value->FindKey(key);
if (!field || !field->is_list())
- return base::nullopt;
- return base::Optional<const Value*>(field);
+ return absl::nullopt;
+ return absl::optional<const Value*>(field);
}
-Optional<int> GetInt(const Value* value, const std::string& key) {
+optional<int> GetInt(const Value* value, const std::string& key) {
const Value* field = value->FindKey(key);
if (!field || !field->is_int())
- return base::nullopt;
+ return absl::nullopt;
return field->GetInt();
}
-base::Optional<double> GetDouble(const Value* value, const std::string& key) {
+absl::optional<double> GetDouble(const Value* value, const std::string& key) {
const Value* field = value->FindKey(key);
if (!field || !field->is_double())
- return base::nullopt;
+ return absl::nullopt;
return field->GetDouble();
}
-base::Optional<std::string> GetString(const Value* value,
+absl::optional<std::string> GetString(const Value* value,
const std::string& key) {
const Value* field = value->FindKey(key);
if (!field || !field->is_string())
- return base::nullopt;
+ return absl::nullopt;
return field->GetString();
}
@@ -257,7 +257,7 @@
if (result.value && ConvertRecurrenceRanker(&result.value.value(), &proto)) {
std::move(callback).Run(std::move(proto));
} else {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
}
}
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util.h b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util.h
index 0fb4e4f..984ba66 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util.h
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util.h
@@ -31,14 +31,14 @@
class JsonConfigConverter {
public:
using OnConfigLoadedCallback =
- base::OnceCallback<void(base::Optional<RecurrenceRankerConfigProto>)>;
+ base::OnceCallback<void(absl::optional<RecurrenceRankerConfigProto>)>;
// Creates a JsonConfigConverter and starts a conversion of |json_string|.
// |model_identifier| is used for metrics reporting in the same way as
// RecurrenceRanker's |model_identifier|.
//
// The provided |callback| will be called with the resulting proto if the
- // conversion succeeded, or base::nullopt if the parsing or conversion failed.
+ // conversion succeeded, or absl::nullopt if the parsing or conversion failed.
// If the returned JsonConfigConverter instance is destroyed before parsing is
// complete, |callback| will never be called.
//
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util_unittest.cc b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util_unittest.cc
index 1c6ea298..111e55d 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util_unittest.cc
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker_util_unittest.cc
@@ -23,14 +23,14 @@
public:
// Converts the async JsonConfigConverter::Convert call into a synchronous
// call for ease of testing.
- base::Optional<RecurrenceRankerConfigProto> Convert(const std::string& json) {
+ absl::optional<RecurrenceRankerConfigProto> Convert(const std::string& json) {
base::RunLoop run_loop;
done_callback_ = run_loop.QuitClosure();
converter_ = JsonConfigConverter::Convert(
json, "",
base::BindOnce(
[](RecurrenceRankerJsonConfigConverterTest* fixture,
- base::Optional<RecurrenceRankerConfigProto> config) {
+ absl::optional<RecurrenceRankerConfigProto> config) {
fixture->converter_.reset();
fixture->config_ = config;
std::move(fixture->done_callback_).Run();
@@ -55,7 +55,7 @@
base::OnceClosure done_callback_;
data_decoder::test::InProcessDataDecoder in_process_data_decoder_;
- base::Optional<RecurrenceRankerConfigProto> config_;
+ absl::optional<RecurrenceRankerConfigProto> config_;
};
TEST_F(RecurrenceRankerJsonConfigConverterTest, ParseFailures) {
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/search_result_ranker.cc b/chrome/browser/ui/app_list/search/search_result_ranker/search_result_ranker.cc
index 3a5de58..2e659b7 100644
--- a/chrome/browser/ui/app_list/search/search_result_ranker/search_result_ranker.cc
+++ b/chrome/browser/ui/app_list/search/search_result_ranker/search_result_ranker.cc
@@ -177,7 +177,7 @@
base::BindOnce(
[](SearchResultRanker* ranker,
const RecurrenceRankerConfigProto& default_config,
- base::Optional<RecurrenceRankerConfigProto> parsed_config) {
+ absl::optional<RecurrenceRankerConfigProto> parsed_config) {
ranker->zero_state_config_converter_.reset();
if (ranker->json_config_parsed_for_testing_)
std::move(ranker->json_config_parsed_for_testing_).Run();
diff --git a/chrome/browser/ui/ash/accessibility/accessibility_controller_client_unittest.cc b/chrome/browser/ui/ash/accessibility/accessibility_controller_client_unittest.cc
index ba62b1cb..b2a98e1 100644
--- a/chrome/browser/ui/ash/accessibility/accessibility_controller_client_unittest.cc
+++ b/chrome/browser/ui/ash/accessibility/accessibility_controller_client_unittest.cc
@@ -7,11 +7,11 @@
#include "ash/components/audio/sounds.h"
#include "ash/public/cpp/accessibility_controller_enums.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ui/ash/accessibility/fake_accessibility_controller.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/gfx/geometry/point_f.h"
@@ -62,7 +62,7 @@
}
ash::AccessibilityAlert last_a11y_alert_ = ash::AccessibilityAlert::NONE;
- base::Optional<Sound> last_sound_key_;
+ absl::optional<Sound> last_sound_key_;
ax::mojom::Gesture last_a11y_gesture_ = ax::mojom::Gesture::kNone;
gfx::PointF last_a11y_gesture_point_;
int toggle_dictation_count_ = 0;
diff --git a/chrome/browser/ui/ash/assistant/assistant_context_util.h b/chrome/browser/ui/ash/assistant/assistant_context_util.h
index 4577fcbe..70a58ae 100644
--- a/chrome/browser/ui/ash/assistant/assistant_context_util.h
+++ b/chrome/browser/ui/ash/assistant/assistant_context_util.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/callback.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/mojom/ax_assistant_structure.mojom.h"
#include "ui/gfx/geometry/rect.h"
diff --git a/chrome/browser/ui/ash/assistant/assistant_test_mixin.cc b/chrome/browser/ui/ash/assistant/assistant_test_mixin.cc
index eae0585..0961857 100644
--- a/chrome/browser/ui/ash/assistant/assistant_test_mixin.cc
+++ b/chrome/browser/ui/ash/assistant/assistant_test_mixin.cc
@@ -151,7 +151,7 @@
}
std::string GetResponseTextRecursive(views::View* view) const {
- base::Optional<std::string> response_maybe = GetResponseTextOfView(view);
+ absl::optional<std::string> response_maybe = GetResponseTextOfView(view);
if (response_maybe) {
return response_maybe.value() + "\n";
} else {
@@ -162,7 +162,7 @@
}
}
- virtual base::Optional<std::string> GetResponseTextOfView(
+ virtual absl::optional<std::string> GetResponseTextOfView(
views::View* view) const = 0;
views::View* parent_view_;
@@ -220,13 +220,13 @@
private:
// ResponseWaiter overrides:
- base::Optional<std::string> GetResponseTextOfView(
+ absl::optional<std::string> GetResponseTextOfView(
views::View* view) const override {
if (view->GetClassName() == class_name_) {
return static_cast<ash::AssistantUiElementView*>(view)
->ToStringForTesting();
}
- return base::nullopt;
+ return absl::nullopt;
}
const std::string class_name_;
@@ -248,13 +248,13 @@
private:
// ExpectedResponseWaiter overrides:
- base::Optional<std::string> GetResponseTextOfView(
+ absl::optional<std::string> GetResponseTextOfView(
views::View* view) const override {
if (view->GetClassName() == class_name_) {
return static_cast<ash::AssistantUiElementView*>(view)
->ToStringForTesting();
}
- return base::nullopt;
+ return absl::nullopt;
}
const std::string class_name_;
@@ -460,8 +460,8 @@
return result;
}
-template base::Optional<double> AssistantTestMixin::SyncCall(
- base::OnceCallback<void(base::OnceCallback<void(base::Optional<double>)>)>
+template absl::optional<double> AssistantTestMixin::SyncCall(
+ base::OnceCallback<void(base::OnceCallback<void(absl::optional<double>)>)>
func);
void AssistantTestMixin::ExpectCardResponse(
diff --git a/chrome/browser/ui/ash/assistant/conversation_starters_parser.cc b/chrome/browser/ui/ash/assistant/conversation_starters_parser.cc
index 8381386..b1701cca 100644
--- a/chrome/browser/ui/ash/assistant/conversation_starters_parser.cc
+++ b/chrome/browser/ui/ash/assistant/conversation_starters_parser.cc
@@ -41,20 +41,20 @@
.Deserialize(&error_code, error_message);
}
-base::Optional<std::string> FindLabel(const base::Value& conversation_starter) {
+absl::optional<std::string> FindLabel(const base::Value& conversation_starter) {
const std::string* label = conversation_starter.FindStringKey(kLabelKey);
- return label ? base::Optional<std::string>(*label) : base::nullopt;
+ return label ? absl::optional<std::string>(*label) : absl::nullopt;
}
-base::Optional<GURL> FindActionUrl(const base::Value& conversation_starter) {
+absl::optional<GURL> FindActionUrl(const base::Value& conversation_starter) {
const std::string* action_url =
conversation_starter.FindStringKey(kActionUrlKey);
- return action_url ? base::Optional<GURL>(*action_url) : base::nullopt;
+ return action_url ? absl::optional<GURL>(*action_url) : absl::nullopt;
}
-base::Optional<GURL> FindIconUrl(const base::Value& conversation_starter) {
+absl::optional<GURL> FindIconUrl(const base::Value& conversation_starter) {
const std::string* icon_url = conversation_starter.FindStringKey(kIconUrlKey);
- return icon_url ? base::Optional<GURL>(*icon_url) : base::nullopt;
+ return icon_url ? absl::optional<GURL>(*icon_url) : absl::nullopt;
}
uint32_t FindRequiredPermissions(const base::Value& conversation_starter) {
@@ -107,15 +107,15 @@
// Parse each |conversation_starter|.
for (auto& conversation_starter : conversation_starters_list->GetList()) {
// Parse |label|.
- base::Optional<std::string> label = FindLabel(conversation_starter);
+ absl::optional<std::string> label = FindLabel(conversation_starter);
if (!label.has_value()) {
LOG(ERROR) << "Omitting conversation starter due to missing label.";
continue;
}
// Parse |action_url|, |icon_url|, and |required_permissions|.
- base::Optional<GURL> action_url = FindActionUrl(conversation_starter);
- base::Optional<GURL> icon_url = FindIconUrl(conversation_starter);
+ absl::optional<GURL> action_url = FindActionUrl(conversation_starter);
+ absl::optional<GURL> icon_url = FindIconUrl(conversation_starter);
uint32_t required_permissions =
FindRequiredPermissions(conversation_starter);
diff --git a/chrome/browser/ui/ash/assistant/conversation_starters_parser_unittest.cc b/chrome/browser/ui/ash/assistant/conversation_starters_parser_unittest.cc
index 36f3c70..ddb3dd3 100644
--- a/chrome/browser/ui/ash/assistant/conversation_starters_parser_unittest.cc
+++ b/chrome/browser/ui/ash/assistant/conversation_starters_parser_unittest.cc
@@ -111,8 +111,8 @@
EXPECT_EQ(3u, conversation_starters.size());
ExpectEqual(conversation_starters.at(0),
- ash::ConversationStarter("Label", /*action_url=*/base::nullopt,
- /*icon_url=*/base::nullopt,
+ ash::ConversationStarter("Label", /*action_url=*/absl::nullopt,
+ /*icon_url=*/absl::nullopt,
/*required_permissions=*/0u));
ExpectEqual(
@@ -171,8 +171,8 @@
ExpectEqual(conversation_starters.at(0),
ash::ConversationStarter(
/*label=*/"Unrecognized Required Permission",
- /*action_url=*/base::nullopt,
- /*icon_url=*/base::nullopt,
+ /*action_url=*/absl::nullopt,
+ /*icon_url=*/absl::nullopt,
/*required_permissions=*/
ash::ConversationStarter::Permission::kRelatedInfo |
ash::ConversationStarter::Permission::kUnknown));
diff --git a/chrome/browser/ui/ash/assistant/device_actions.cc b/chrome/browser/ui/ash/assistant/device_actions.cc
index 5cb48fe..91d7f8e 100644
--- a/chrome/browser/ui/ash/assistant/device_actions.cc
+++ b/chrome/browser/ui/ash/assistant/device_actions.cc
@@ -41,20 +41,20 @@
constexpr char kLaunchFlags[] = "launchFlags";
constexpr char kEndSuffix[] = "end";
-base::Optional<std::string> GetActivity(const std::string& package_name) {
+absl::optional<std::string> GetActivity(const std::string& package_name) {
auto* prefs = ArcAppListPrefs::Get(ProfileManager::GetActiveUserProfile());
if (!prefs) {
LOG(ERROR) << "ArcAppListPrefs is not available.";
- return base::nullopt;
+ return absl::nullopt;
}
std::string app_id = prefs->GetAppIdByPackageName(package_name);
if (!app_id.empty()) {
std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id);
- return base::Optional<std::string>(app_info->activity);
+ return absl::optional<std::string>(app_info->activity);
}
- return base::nullopt;
+ return absl::nullopt;
}
std::string GetLaunchIntent(const AndroidAppInfo& app_info) {
@@ -130,7 +130,7 @@
void HandleScreenBrightnessCallback(
DeviceActions::GetScreenBrightnessLevelCallback callback,
- base::Optional<double> level) {
+ absl::optional<double> level) {
if (level.has_value()) {
std::move(callback).Run(true, level.value() / 100.0);
} else {
@@ -227,11 +227,11 @@
app_list_subscribers_.RemoveObserver(subscriber);
}
-base::Optional<std::string> DeviceActions::GetAndroidAppLaunchIntent(
+absl::optional<std::string> DeviceActions::GetAndroidAppLaunchIntent(
const AndroidAppInfo& app_info) {
auto status = delegate_->GetAndroidAppStatus(app_info.package_name);
if (status != AppStatus::kAvailable)
- return base::nullopt;
+ return absl::nullopt;
return GetLaunchIntent(std::move(app_info));
}
diff --git a/chrome/browser/ui/ash/assistant/device_actions.h b/chrome/browser/ui/ash/assistant/device_actions.h
index 4cc685c..bb76755 100644
--- a/chrome/browser/ui/ash/assistant/device_actions.h
+++ b/chrome/browser/ui/ash/assistant/device_actions.h
@@ -45,7 +45,7 @@
chromeos::assistant::AppListEventSubscriber* subscriber) override;
// ash::AndroidIntentHelper overrides:
- base::Optional<std::string> GetAndroidAppLaunchIntent(
+ absl::optional<std::string> GetAndroidAppLaunchIntent(
const chromeos::assistant::AndroidAppInfo& app_info) override;
private:
diff --git a/chrome/browser/ui/ash/cast_config_controller_media_router.cc b/chrome/browser/ui/ash/cast_config_controller_media_router.cc
index 28fc54a1..57640f5 100644
--- a/chrome/browser/ui/ash/cast_config_controller_media_router.cc
+++ b/chrome/browser/ui/ash/cast_config_controller_media_router.cc
@@ -27,7 +27,7 @@
namespace {
-base::Optional<media_router::MediaRouter*> media_router_for_test_;
+absl::optional<media_router::MediaRouter*> media_router_for_test_;
Profile* GetProfile() {
if (!user_manager::UserManager::IsInitialized())
diff --git a/chrome/browser/ui/ash/chrome_new_window_client.cc b/chrome/browser/ui/ash/chrome_new_window_client.cc
index 5a47b1d..a139666 100644
--- a/chrome/browser/ui/ash/chrome_new_window_client.cc
+++ b/chrome/browser/ui/ash/chrome_new_window_client.cc
@@ -542,7 +542,7 @@
if (!profile)
return;
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
web_app::FindInstalledAppWithUrlInScope(profile, url,
/*window_only=*/true);
@@ -579,7 +579,7 @@
if (!prefs)
return;
- base::Optional<std::string> package_name =
+ absl::optional<std::string> package_name =
apk_web_app_service->GetPackageNameForWebApp(app_id.value());
if (!package_name.has_value())
return;
diff --git a/chrome/browser/ui/ash/chrome_screenshot_grabber.cc b/chrome/browser/ui/ash/chrome_screenshot_grabber.cc
index ff0adad..af8c8de 100644
--- a/chrome/browser/ui/ash/chrome_screenshot_grabber.cc
+++ b/chrome/browser/ui/ash/chrome_screenshot_grabber.cc
@@ -84,8 +84,8 @@
screenshot_path_(screenshot_path) {}
// message_center::NotificationDelegate:
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
if (!button_index) {
// TODO(estade): this conditional can be a DCHECK after
// NotificationDelegate::Click() is not called for notifications that are
@@ -318,7 +318,7 @@
aura::Window* root_window = root_windows[i];
gfx::Rect rect = root_window->bounds();
- base::Optional<int> display_id;
+ absl::optional<int> display_id;
if (root_windows.size() > 1)
display_id = static_cast<int>(i + 1);
screenshot_grabber_->TakeScreenshot(
@@ -342,7 +342,7 @@
window, rect,
base::BindOnce(&ChromeScreenshotGrabber::OnTookScreenshot,
weak_factory_.GetWeakPtr(), base::Time::Now(),
- base::Optional<int>(), area));
+ absl::optional<int>(), area));
base::RecordAction(base::UserMetricsAction("Screenshot_TakePartial"));
}
@@ -356,7 +356,7 @@
window, gfx::Rect(window->bounds().size()),
base::BindOnce(&ChromeScreenshotGrabber::OnTookScreenshot,
weak_factory_.GetWeakPtr(), base::Time::Now(),
- base::Optional<int>(), area));
+ absl::optional<int>(), area));
base::RecordAction(base::UserMetricsAction("Screenshot_TakeWindow"));
}
@@ -366,7 +366,7 @@
void ChromeScreenshotGrabber::OnTookScreenshot(
const base::Time& screenshot_time,
- const base::Optional<int>& display_num,
+ const absl::optional<int>& display_num,
const ScreenshotArea& area,
ScreenshotResult result,
scoped_refptr<base::RefCountedMemory> png_data) {
diff --git a/chrome/browser/ui/ash/chrome_screenshot_grabber.h b/chrome/browser/ui/ash/chrome_screenshot_grabber.h
index 37234fe..deea728 100644
--- a/chrome/browser/ui/ash/chrome_screenshot_grabber.h
+++ b/chrome/browser/ui/ash/chrome_screenshot_grabber.h
@@ -12,9 +12,9 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/browser/ui/ash/screenshot_area.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/image/image.h"
#include "ui/message_center/public/cpp/notification.h"
#include "ui/snapshot/screenshot_grabber.h"
@@ -71,7 +71,7 @@
// a future patch. It is intended to be both mojo proxyable, and usable as a
// callback from ScreenshotGrabber.
void OnTookScreenshot(const base::Time& screenshot_time,
- const base::Optional<int>& display_num,
+ const absl::optional<int>& display_num,
const ScreenshotArea& area,
ui::ScreenshotResult result,
scoped_refptr<base::RefCountedMemory> png_data);
diff --git a/chrome/browser/ui/ash/chrome_screenshot_grabber_browsertest.cc b/chrome/browser/ui/ash/chrome_screenshot_grabber_browsertest.cc
index cb4c181..3cc61fc1 100644
--- a/chrome/browser/ui/ash/chrome_screenshot_grabber_browsertest.cc
+++ b/chrome/browser/ui/ash/chrome_screenshot_grabber_browsertest.cc
@@ -151,7 +151,7 @@
// Copy to clipboard button.
display_service_->SimulateClick(NotificationHandler::Type::TRANSIENT,
- std::string("screenshot"), 0, base::nullopt);
+ std::string("screenshot"), 0, absl::nullopt);
RunLoop();
ui::ClipboardMonitor::GetInstance()->RemoveObserver(this);
diff --git a/chrome/browser/ui/ash/chrome_shelf_prefs.cc b/chrome/browser/ui/ash/chrome_shelf_prefs.cc
index 6e171a0..041b475 100644
--- a/chrome/browser/ui/ash/chrome_shelf_prefs.cc
+++ b/chrome/browser/ui/ash/chrome_shelf_prefs.cc
@@ -264,7 +264,7 @@
// Handle Web App ids
const GURL web_app_url(*policy_entry);
if (web_app_url.is_valid()) {
- base::Optional<web_app::AppId> web_app_id =
+ absl::optional<web_app::AppId> web_app_id =
web_app::WebAppProvider::Get(helper->profile())
->registrar()
.LookupExternalAppId(web_app_url);
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc
index 70d89dd..f895d80 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -58,7 +58,7 @@
// Browser tests are always started with --disable-logging-redirect, so we need
// independent option here.
-base::Optional<bool> disable_logging_redirect_for_testing;
+absl::optional<bool> disable_logging_redirect_for_testing;
content::WebContents* GetActiveWebContentsForNativeBrowserWindow(
gfx::NativeWindow window) {
@@ -121,7 +121,7 @@
render_widget_host_view->GetRenderWidgetHost();
if (!render_widget_host)
return true;
- base::Optional<cc::TouchAction> allowed_touch_action =
+ absl::optional<cc::TouchAction> allowed_touch_action =
render_widget_host->GetAllowedTouchAction();
return allowed_touch_action.has_value()
? *allowed_touch_action != cc::TouchAction::kNone
diff --git a/chrome/browser/ui/ash/clipboard_image_model_request.cc b/chrome/browser/ui/ash/clipboard_image_model_request.cc
index 395eebeb..b764d72 100644
--- a/chrome/browser/ui/ash/clipboard_image_model_request.cc
+++ b/chrome/browser/ui/ash/clipboard_image_model_request.cc
@@ -204,7 +204,7 @@
}
bool ClipboardImageModelRequest::IsRunningRequest(
- base::Optional<base::UnguessableToken> request_id) const {
+ absl::optional<base::UnguessableToken> request_id) const {
return request_id.has_value() ? *request_id == request_id_
: !request_id_.is_empty();
}
diff --git a/chrome/browser/ui/ash/clipboard_image_model_request.h b/chrome/browser/ui/ash/clipboard_image_model_request.h
index ad07b47..2c3d502a 100644
--- a/chrome/browser/ui/ash/clipboard_image_model_request.h
+++ b/chrome/browser/ui/ash/clipboard_image_model_request.h
@@ -8,12 +8,12 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "base/unguessable_token.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/models/image_model.h"
namespace ash {
@@ -138,7 +138,7 @@
// Returns whether a request with |request_id| is running, or if any request
// is running if no |request_id| is supplied.
bool IsRunningRequest(
- base::Optional<base::UnguessableToken> request_id = base::nullopt) const;
+ absl::optional<base::UnguessableToken> request_id = absl::nullopt) const;
// content::WebContentsDelegate:
void ResizeDueToAutoResize(content::WebContents* web_contents,
@@ -192,7 +192,7 @@
bool did_stop_loading_ = false;
// Responsible for temporarily replacing contents of the clipboard.
- base::Optional<ScopedClipboardModifier> scoped_clipboard_modifier_;
+ absl::optional<ScopedClipboardModifier> scoped_clipboard_modifier_;
// Callback used to deliver the rendered ImageModel.
ImageModelCallback deliver_image_model_callback_;
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_browsertest_base.cc b/chrome/browser/ui/ash/holding_space/holding_space_browsertest_base.cc
index 4f7bdab5..01d8a235 100644
--- a/chrome/browser/ui/ash/holding_space/holding_space_browsertest_base.cc
+++ b/chrome/browser/ui/ash/holding_space/holding_space_browsertest_base.cc
@@ -204,7 +204,7 @@
}
base::FilePath HoldingSpaceBrowserTestBase::CreateFile(
- const base::Optional<std::string>& extension) {
+ const absl::optional<std::string>& extension) {
return ::ash::CreateFile(GetProfile(), extension.value_or("txt"));
}
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_browsertest_base.h b/chrome/browser/ui/ash/holding_space/holding_space_browsertest_base.h
index 50f595ba..4d85326 100644
--- a/chrome/browser/ui/ash/holding_space/holding_space_browsertest_base.h
+++ b/chrome/browser/ui/ash/holding_space/holding_space_browsertest_base.h
@@ -70,7 +70,7 @@
// extension. If extension is omitted, the created file will have an extension
// of `.txt`. Returns the file path of the created file.
base::FilePath CreateFile(
- const base::Optional<std::string>& extension = base::nullopt);
+ const absl::optional<std::string>& extension = absl::nullopt);
// Requests lock screen, waiting to return until session state is locked.
void RequestAndAwaitLockScreen();
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_client_impl.cc b/chrome/browser/ui/ash/holding_space/holding_space_client_impl.cc
index d3b544e..d03425f6 100644
--- a/chrome/browser/ui/ash/holding_space/holding_space_client_impl.cc
+++ b/chrome/browser/ui/ash/holding_space/holding_space_client_impl.cc
@@ -36,10 +36,10 @@
return HoldingSpaceKeyedServiceFactory::GetInstance()->GetService(profile);
}
-// Returns file info for the specified `file_path` or `base::nullopt` in the
+// Returns file info for the specified `file_path` or `absl::nullopt` in the
// event that file info cannot be obtained.
using GetFileInfoCallback =
- base::OnceCallback<void(const base::Optional<base::File::Info>&)>;
+ base::OnceCallback<void(const absl::optional<base::File::Info>&)>;
void GetFileInfo(Profile* profile,
const base::FilePath& file_path,
GetFileInfoCallback callback) {
@@ -52,8 +52,8 @@
[](GetFileInfoCallback callback, base::File::Error error,
const base::File::Info& info) {
std::move(callback).Run(error == base::File::FILE_OK
- ? base::make_optional<>(info)
- : base::nullopt);
+ ? absl::make_optional<>(info)
+ : absl::nullopt);
},
std::move(callback)));
}
@@ -166,7 +166,7 @@
[](const base::WeakPtr<HoldingSpaceClientImpl>& weak_ptr,
base::RepeatingClosure barrier_closure, bool* complete_success,
const base::FilePath& file_path, HoldingSpaceItem::Type type,
- const base::Optional<base::File::Info>& info) {
+ const absl::optional<base::File::Info>& info) {
if (!weak_ptr || !info.has_value()) {
holding_space_metrics::RecordItemFailureToLaunch(type,
file_path);
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_keyed_service.cc b/chrome/browser/ui/ash/holding_space/holding_space_keyed_service.cc
index 92ac373..7d9fae4 100644
--- a/chrome/browser/ui/ash/holding_space/holding_space_keyed_service.cc
+++ b/chrome/browser/ui/ash/holding_space/holding_space_keyed_service.cc
@@ -38,7 +38,7 @@
// TODO(crbug.com/1131266): Track alternative type in `HoldingSpaceItem`.
// Returns a holding space item other than the one provided which is backed by
// the same file path in the specified `model`.
-base::Optional<const HoldingSpaceItem*> GetAlternativeHoldingSpaceItem(
+absl::optional<const HoldingSpaceItem*> GetAlternativeHoldingSpaceItem(
const HoldingSpaceModel& model,
const HoldingSpaceItem* item) {
for (const auto& candidate_item : model.items()) {
@@ -47,7 +47,7 @@
if (candidate_item->file_path() == item->file_path())
return candidate_item.get();
}
- return base::nullopt;
+ return absl::nullopt;
}
// Returns the singleton profile manager for the browser process.
@@ -231,7 +231,7 @@
void HoldingSpaceKeyedService::AddDownload(
HoldingSpaceItem::Type type,
const base::FilePath& download_file,
- const base::Optional<float>& progress) {
+ const absl::optional<float>& progress) {
DCHECK(HoldingSpaceItem::IsDownload(type));
AddItemOfType(type, download_file, progress);
}
@@ -280,7 +280,7 @@
void HoldingSpaceKeyedService::AddItemOfType(
HoldingSpaceItem::Type type,
const base::FilePath& file_path,
- const base::Optional<float>& progress) {
+ const absl::optional<float>& progress) {
const GURL file_system_url =
holding_space_util::ResolveFileSystemUrl(profile_, file_path);
if (file_system_url.is_empty())
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_keyed_service.h b/chrome/browser/ui/ash/holding_space/holding_space_keyed_service.h
index 2915351..fdc775e 100644
--- a/chrome/browser/ui/ash/holding_space/holding_space_keyed_service.h
+++ b/chrome/browser/ui/ash/holding_space/holding_space_keyed_service.h
@@ -90,7 +90,7 @@
// NOTE: If present, `progress` must be >= `0.f` and <= `1.f`.
void AddDownload(HoldingSpaceItem::Type type,
const base::FilePath& download_path,
- const base::Optional<float>& progress = 1.f);
+ const absl::optional<float>& progress = 1.f);
// Adds a nearby share item backed by the provided absolute file path.
void AddNearbyShare(const base::FilePath& nearby_share_path);
@@ -112,7 +112,7 @@
// NOTE: If present, `progress` must be >= `0.f` and <= `1.f`.
void AddItemOfType(HoldingSpaceItem::Type type,
const base::FilePath& file_path,
- const base::Optional<float>& progress = 1.f);
+ const absl::optional<float>& progress = 1.f);
// Returns the `profile_` associated with this service.
Profile* profile() { return profile_; }
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_keyed_service_browsertest.cc b/chrome/browser/ui/ash/holding_space/holding_space_keyed_service_browsertest.cc
index 5f54b77..7b27c31 100644
--- a/chrome/browser/ui/ash/holding_space/holding_space_keyed_service_browsertest.cc
+++ b/chrome/browser/ui/ash/holding_space/holding_space_keyed_service_browsertest.cc
@@ -107,7 +107,7 @@
// Creates a txt file at the path of the downloads mount point for `profile`.
base::FilePath CreateTextFile(
const base::FilePath& root_path,
- const base::Optional<std::string>& relative_path) {
+ const absl::optional<std::string>& relative_path) {
const base::FilePath path =
root_path.Append(relative_path.value_or(base::StringPrintf(
"%s.txt", base::UnguessableToken::Create().ToString().c_str())));
@@ -416,12 +416,12 @@
// Verify that items are removed when their backing files are deleted.
const auto* holding_space_item_to_delete = AddHoldingSpaceItem(
browser()->profile(), CreateTextFile(GetTestMountPoint(),
- /*relative_path=*/base::nullopt));
+ /*relative_path=*/absl::nullopt));
// Verify that items are removed when their backing files are moved.
const auto* holding_space_item_to_move = AddHoldingSpaceItem(
browser()->profile(), CreateTextFile(GetTestMountPoint(),
- /*relative_path=*/base::nullopt));
+ /*relative_path=*/absl::nullopt));
RemoveHoldingSpaceItemViaClosure(
holding_space_item_to_delete, base::BindLambdaForTesting([&]() {
@@ -504,7 +504,7 @@
// Add an item to holding space.
base::FilePath src =
- CreateTextFile(GetTestMountPoint(), /*relative_path=*/base::nullopt);
+ CreateTextFile(GetTestMountPoint(), /*relative_path=*/absl::nullopt);
auto* item = AddHoldingSpaceItem(browser()->profile(), src);
// Verify the item exists in the model.
@@ -513,7 +513,7 @@
EXPECT_EQ(item->file_path(), src);
base::FilePath dst =
- CreateTextFile(GetTestMountPoint(), /*relative_path=*/base::nullopt);
+ CreateTextFile(GetTestMountPoint(), /*relative_path=*/absl::nullopt);
// Prep a batch of `changes` to indicate that `src` has moved to `dst`. Note
// the consistent `stable_id` to link the `kDelete` with the `kCreate` change.
@@ -620,7 +620,7 @@
// Add another holding space item, pointing to `src` in `src_dir`.
base::FilePath src_dir = GetTestMountPoint().Append("src/");
- src = CreateTextFile(src_dir, /*relative_path=*/base::nullopt);
+ src = CreateTextFile(src_dir, /*relative_path=*/absl::nullopt);
item = AddHoldingSpaceItem(browser()->profile(), src);
// Verify the item exists in the model.
@@ -681,7 +681,7 @@
const base::FilePath file_path =
CreateTextFile(GetTestMountPoint(),
- /*relative_path=*/base::nullopt);
+ /*relative_path=*/absl::nullopt);
const GURL url =
holding_space_util::ResolveFileSystemUrl(browser()->profile(), file_path);
storage::FileSystemURL file_system_url =
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_keyed_service_unittest.cc b/chrome/browser/ui/ash/holding_space/holding_space_keyed_service_unittest.cc
index 8bde201..e494ad74 100644
--- a/chrome/browser/ui/ash/holding_space/holding_space_keyed_service_unittest.cc
+++ b/chrome/browser/ui/ash/holding_space/holding_space_keyed_service_unittest.cc
@@ -304,7 +304,7 @@
new file_manager::FakeDiskMountManager);
SetUpDownloadManager();
BrowserWithTestWindowTest::SetUp();
- holding_space_util::SetNowForTesting(base::nullopt);
+ holding_space_util::SetNowForTesting(absl::nullopt);
}
void TearDown() override {
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_ui_browsertest.cc b/chrome/browser/ui/ash/holding_space/holding_space_ui_browsertest.cc
index 8223a5dc..79d7386 100644
--- a/chrome/browser/ui/ash/holding_space/holding_space_ui_browsertest.cc
+++ b/chrome/browser/ui/ash/holding_space/holding_space_ui_browsertest.cc
@@ -383,8 +383,8 @@
widget->Init(std::move(params));
}
- base::Optional<std::vector<ui::FileInfo>> filenames_data_;
- base::Optional<base::Pickle> file_system_sources_data_;
+ absl::optional<std::vector<ui::FileInfo>> filenames_data_;
+ absl::optional<base::Pickle> file_system_sources_data_;
};
// DropTargetView --------------------------------------------------------------
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_util.cc b/chrome/browser/ui/ash/holding_space/holding_space_util.cc
index 7514aa64..3c066c6 100644
--- a/chrome/browser/ui/ash/holding_space/holding_space_util.cc
+++ b/chrome/browser/ui/ash/holding_space/holding_space_util.cc
@@ -22,7 +22,7 @@
namespace {
-base::Optional<base::Time> now_for_testing;
+absl::optional<base::Time> now_for_testing;
} // namespace
@@ -167,7 +167,7 @@
thumbnail_loader->GetWeakPtr()));
}
-void SetNowForTesting(base::Optional<base::Time> now) {
+void SetNowForTesting(absl::optional<base::Time> now) {
now_for_testing = now;
}
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_util.h b/chrome/browser/ui/ash/holding_space/holding_space_util.h
index 692f7eb..6add61f 100644
--- a/chrome/browser/ui/ash/holding_space/holding_space_util.h
+++ b/chrome/browser/ui/ash/holding_space/holding_space_util.h
@@ -32,7 +32,7 @@
ValidityRequirement(const ValidityRequirement& other);
ValidityRequirement(ValidityRequirement&& other);
bool must_exist = true;
- base::Optional<base::TimeDelta> must_be_newer_than = base::nullopt;
+ absl::optional<base::TimeDelta> must_be_newer_than = absl::nullopt;
};
using FilePathList = std::vector<base::FilePath>;
@@ -74,7 +74,7 @@
HoldingSpaceItem::Type type,
const base::FilePath& file_path);
-void SetNowForTesting(base::Optional<base::Time> now);
+void SetNowForTesting(absl::optional<base::Time> now);
} // namespace holding_space_util
} // namespace ash
diff --git a/chrome/browser/ui/ash/in_session_auth_dialog_client.h b/chrome/browser/ui/ash/in_session_auth_dialog_client.h
index 7cf74cd..8115e14fd 100644
--- a/chrome/browser/ui/ash/in_session_auth_dialog_client.h
+++ b/chrome/browser/ui/ash/in_session_auth_dialog_client.h
@@ -9,10 +9,10 @@
#include "base/callback.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chromeos/login/auth/auth_status_consumer.h"
#include "chromeos/login/auth/extended_authenticator.h"
#include "chromeos/login/auth/user_context.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace aura {
class Window;
@@ -93,7 +93,7 @@
scoped_refptr<chromeos::ExtendedAuthenticator> extended_authenticator_;
// State associated with a pending authentication attempt.
- base::Optional<AuthState> pending_auth_state_;
+ absl::optional<AuthState> pending_auth_state_;
base::WeakPtrFactory<InSessionAuthDialogClient> weak_factory_{this};
};
diff --git a/chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h b/chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h
index 69851580..aa2ede1 100644
--- a/chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h
+++ b/chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h
@@ -17,9 +17,9 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/session_manager/core/session_manager_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class ChromeKeyboardWebContents;
@@ -188,7 +188,7 @@
std::unique_ptr<ChromeKeyboardWebContents> keyboard_contents_;
// Cached copy of the latest config provided by KeyboardController.
- base::Optional<keyboard::KeyboardConfig> cached_keyboard_config_;
+ absl::optional<keyboard::KeyboardConfig> cached_keyboard_config_;
// Cached copy of the active enabled flags provided by KeyboardController.
std::set<keyboard::KeyboardEnableFlag> keyboard_enable_flags_;
diff --git a/chrome/browser/ui/ash/media_client_impl.cc b/chrome/browser/ui/ash/media_client_impl.cc
index cca184ea..1eccaa2 100644
--- a/chrome/browser/ui/ash/media_client_impl.cc
+++ b/chrome/browser/ui/ash/media_client_impl.cc
@@ -406,7 +406,7 @@
kCameraPrivacySwitchOnToastId,
l10n_util::GetStringUTF16(IDS_CAMERA_PRIVACY_SWITCH_ON_TOAST),
kCameraPrivacySwitchToastDurationMs,
- /*dismiss_text=*/base::nullopt,
+ /*dismiss_text=*/absl::nullopt,
/*visible_on_lock_screen=*/true);
ash::ToastManager::Get()->Show(toast);
break;
@@ -442,7 +442,7 @@
kCameraPrivacySwitchOffToastId,
l10n_util::GetStringUTF16(IDS_CAMERA_PRIVACY_SWITCH_OFF_TOAST),
kCameraPrivacySwitchToastDurationMs,
- /*dismiss_text=*/base::nullopt,
+ /*dismiss_text=*/absl::nullopt,
/*visible_on_lock_screen=*/true);
ash::ToastManager::Get()->Show(toast);
break;
diff --git a/chrome/browser/ui/ash/media_client_impl_unittest.cc b/chrome/browser/ui/ash/media_client_impl_unittest.cc
index 1cb0ddb..d99feef 100644
--- a/chrome/browser/ui/ash/media_client_impl_unittest.cc
+++ b/chrome/browser/ui/ash/media_client_impl_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include "ash/public/cpp/media_controller.h"
-#include "base/optional.h"
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
#include "chrome/browser/chromeos/extensions/media_player_api.h"
#include "chrome/browser/ui/browser_list.h"
@@ -20,6 +19,7 @@
#include "components/services/app_service/public/cpp/app_registry_cache_wrapper.h"
#include "components/services/app_service/public/mojom/types.mojom-forward.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/accelerators/media_keys_listener.h"
// Gmock matchers and actions that are used below.
@@ -64,14 +64,14 @@
last_media_key_ = accelerator;
}
- base::Optional<ui::Accelerator> ConsumeLastMediaKey() {
- base::Optional<ui::Accelerator> key = last_media_key_;
+ absl::optional<ui::Accelerator> ConsumeLastMediaKey() {
+ absl::optional<ui::Accelerator> key = last_media_key_;
last_media_key_.reset();
return key;
}
private:
- base::Optional<ui::Accelerator> last_media_key_;
+ absl::optional<ui::Accelerator> last_media_key_;
DISALLOW_COPY_AND_ASSIGN(TestMediaKeysDelegate);
};
@@ -104,7 +104,7 @@
BrowserList::SetLastActive(browser());
ASSERT_FALSE(test_media_controller_->force_media_client_key_handling());
- ASSERT_EQ(base::nullopt, delegate()->ConsumeLastMediaKey());
+ ASSERT_EQ(absl::nullopt, delegate()->ConsumeLastMediaKey());
}
void TearDown() override {
@@ -253,7 +253,7 @@
// Simulate the media key and check that the delegate did not receive it.
test.client_handler.Run();
- EXPECT_EQ(base::nullopt, delegate()->ConsumeLastMediaKey());
+ EXPECT_EQ(absl::nullopt, delegate()->ConsumeLastMediaKey());
// Change the active browser back and ensure the override was enabled.
BrowserList::SetLastActive(browser());
@@ -270,7 +270,7 @@
// Simulate the media key and check the delegate did not receive it.
test.client_handler.Run();
- EXPECT_EQ(base::nullopt, delegate()->ConsumeLastMediaKey());
+ EXPECT_EQ(absl::nullopt, delegate()->ConsumeLastMediaKey());
}
}
diff --git a/chrome/browser/ui/ash/media_notification_provider_impl.h b/chrome/browser/ui/ash/media_notification_provider_impl.h
index 08a4c5d..faa01002 100644
--- a/chrome/browser/ui/ash/media_notification_provider_impl.h
+++ b/chrome/browser/ui/ash/media_notification_provider_impl.h
@@ -81,7 +81,7 @@
std::map<const std::string, MediaNotificationContainerImplView*>
observed_containers_;
- base::Optional<media_message_center::NotificationTheme> color_theme_;
+ absl::optional<media_message_center::NotificationTheme> color_theme_;
};
#endif // CHROME_BROWSER_UI_ASH_MEDIA_NOTIFICATION_PROVIDER_IMPL_H_
diff --git a/chrome/browser/ui/ash/microphone_mute_notification_delegate_impl.cc b/chrome/browser/ui/ash/microphone_mute_notification_delegate_impl.cc
index 97e9d3c6..df1ff389 100644
--- a/chrome/browser/ui/ash/microphone_mute_notification_delegate_impl.cc
+++ b/chrome/browser/ui/ash/microphone_mute_notification_delegate_impl.cc
@@ -6,7 +6,6 @@
#include "chrome/browser/ui/ash/microphone_mute_notification_delegate_impl.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
@@ -17,6 +16,7 @@
#include "components/services/app_service/public/cpp/app_capability_access_cache_wrapper.h"
#include "components/services/app_service/public/cpp/app_registry_cache.h"
#include "components/user_manager/user_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
MicrophoneMuteNotificationDelegateImpl::
@@ -24,12 +24,12 @@
MicrophoneMuteNotificationDelegateImpl::
~MicrophoneMuteNotificationDelegateImpl() = default;
-base::Optional<std::u16string>
+absl::optional<std::u16string>
MicrophoneMuteNotificationDelegateImpl::GetAppAccessingMicrophone() {
auto* manager = user_manager::UserManager::Get();
const user_manager::User* active_user = manager->GetActiveUser();
if (!active_user)
- return base::nullopt;
+ return absl::nullopt;
auto account_id = active_user->GetAccountId();
Profile* profile =
@@ -44,7 +44,7 @@
return GetAppAccessingMicrophone(cap_cache, ®_cache);
}
-base::Optional<std::u16string>
+absl::optional<std::u16string>
MicrophoneMuteNotificationDelegateImpl::GetAppAccessingMicrophone(
apps::AppCapabilityAccessCache* capability_cache,
apps::AppRegistryCache* registry_cache) {
@@ -61,11 +61,11 @@
});
if (!name.empty()) {
// We have an actual app name, so return it.
- return base::Optional<std::u16string>(name);
+ return absl::optional<std::u16string>(name);
}
}
// Returning an empty string means we found an app but no name, while
- // returning base::nullopt means no app is using the mic.
- return found_app ? base::make_optional(u"") : base::nullopt;
+ // returning absl::nullopt means no app is using the mic.
+ return found_app ? absl::make_optional(u"") : absl::nullopt;
}
diff --git a/chrome/browser/ui/ash/microphone_mute_notification_delegate_impl.h b/chrome/browser/ui/ash/microphone_mute_notification_delegate_impl.h
index 5ba9df0..7cf664e 100644
--- a/chrome/browser/ui/ash/microphone_mute_notification_delegate_impl.h
+++ b/chrome/browser/ui/ash/microphone_mute_notification_delegate_impl.h
@@ -9,7 +9,7 @@
#include "ash/public/cpp/microphone_mute_notification_delegate.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace apps {
class AppCapabilityAccessCache;
@@ -27,12 +27,12 @@
~MicrophoneMuteNotificationDelegateImpl() override;
// ash::MicrophoneMuteNotificationDelegate
- base::Optional<std::u16string> GetAppAccessingMicrophone() override;
+ absl::optional<std::u16string> GetAppAccessingMicrophone() override;
private:
friend class MicrophoneMuteNotificationDelegateTest;
- base::Optional<std::u16string> GetAppAccessingMicrophone(
+ absl::optional<std::u16string> GetAppAccessingMicrophone(
apps::AppCapabilityAccessCache* capability_cache,
apps::AppRegistryCache* registry_cache);
diff --git a/chrome/browser/ui/ash/microphone_mute_notification_delegate_impl_unittest.cc b/chrome/browser/ui/ash/microphone_mute_notification_delegate_impl_unittest.cc
index 9bc1777..0fe6cb3 100644
--- a/chrome/browser/ui/ash/microphone_mute_notification_delegate_impl_unittest.cc
+++ b/chrome/browser/ui/ash/microphone_mute_notification_delegate_impl_unittest.cc
@@ -38,7 +38,7 @@
account_id_, &capability_access_cache_);
}
- base::Optional<std::u16string> GetAppAccessingMicrophone() {
+ absl::optional<std::u16string> GetAppAccessingMicrophone() {
return media_delegate_->GetAppAccessingMicrophone(&capability_access_cache_,
®istry_cache_);
}
@@ -91,7 +91,7 @@
TEST_F(MicrophoneMuteNotificationDelegateTest, NoAppsLaunched) {
// Should return a completely value-free app_name.
- base::Optional<std::u16string> app_name = GetAppAccessingMicrophone();
+ absl::optional<std::u16string> app_name = GetAppAccessingMicrophone();
EXPECT_FALSE(app_name.has_value());
}
@@ -99,7 +99,7 @@
LaunchApp("id_rose", "name_rose", apps::mojom::OptionalBool::kFalse);
// Should return a completely value-free app_name.
- base::Optional<std::u16string> app_name = GetAppAccessingMicrophone();
+ absl::optional<std::u16string> app_name = GetAppAccessingMicrophone();
EXPECT_FALSE(app_name.has_value());
}
@@ -107,7 +107,7 @@
LaunchApp("id_rose", "name_rose", apps::mojom::OptionalBool::kTrue);
// Should return the name of our app.
- base::Optional<std::u16string> app_name = GetAppAccessingMicrophone();
+ absl::optional<std::u16string> app_name = GetAppAccessingMicrophone();
EXPECT_TRUE(app_name.has_value());
std::string app_name_utf8 = base::UTF16ToUTF8(app_name.value());
EXPECT_STREQ(app_name_utf8.c_str(), "name_rose");
@@ -124,7 +124,7 @@
// GetAppAccessingMicrophone) returns a set, we have no guarantee of
// which app will be found first. So we verify that the app name is one of
// our microphone-users.
- base::Optional<std::u16string> app_name = GetAppAccessingMicrophone();
+ absl::optional<std::u16string> app_name = GetAppAccessingMicrophone();
EXPECT_TRUE(app_name.has_value());
std::string app_name_utf8 = base::UTF16ToUTF8(app_name.value());
EXPECT_THAT(app_name_utf8, AnyOf("name_rose", "name_mars", "name_zara"));
diff --git a/chrome/browser/ui/ash/network/network_portal_notification_controller.cc b/chrome/browser/ui/ash/network/network_portal_notification_controller.cc
index 4b99df69..3df25af 100644
--- a/chrome/browser/ui/ash/network/network_portal_notification_controller.cc
+++ b/chrome/browser/ui/ash/network/network_portal_notification_controller.cc
@@ -62,8 +62,8 @@
: guid_(guid), clicked_(false), controller_(controller) {}
// Overridden from message_center::NotificationDelegate:
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
private:
~NetworkPortalNotificationControllerDelegate() override {}
@@ -79,8 +79,8 @@
};
void NetworkPortalNotificationControllerDelegate::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
clicked_ = true;
Profile* profile = ProfileManager::GetActiveUserProfile();
diff --git a/chrome/browser/ui/ash/network/network_state_notifier.cc b/chrome/browser/ui/ash/network/network_state_notifier.cc
index fb48632..95497a99 100644
--- a/chrome/browser/ui/ash/network/network_state_notifier.cc
+++ b/chrome/browser/ui/ash/network/network_state_notifier.cc
@@ -45,7 +45,7 @@
shill_error == shill::kErrorDisconnect;
}
-std::string GetStringFromDictionary(const base::Optional<base::Value>& dict,
+std::string GetStringFromDictionary(const absl::optional<base::Value>& dict,
const std::string& key) {
const base::Value* v = dict ? dict->FindKey(key) : nullptr;
return v ? v->GetString() : std::string();
@@ -374,7 +374,7 @@
if (!network) {
ShowConnectErrorNotification(error_name,
/*service_path=*/std::string(),
- /*shill_properties=*/base::nullopt);
+ /*shill_properties=*/absl::nullopt);
return;
}
// Get the up-to-date properties for the network and display the error.
@@ -420,7 +420,7 @@
void NetworkStateNotifier::OnConnectErrorGetProperties(
const std::string& error_name,
const std::string& service_path,
- base::Optional<base::Value> shill_properties) {
+ absl::optional<base::Value> shill_properties) {
if (!shill_properties) {
ShowConnectErrorNotification(error_name, service_path,
std::move(shill_properties));
@@ -443,7 +443,7 @@
void NetworkStateNotifier::ShowConnectErrorNotification(
const std::string& error_name,
const std::string& service_path,
- base::Optional<base::Value> shill_properties) {
+ absl::optional<base::Value> shill_properties) {
std::u16string error = GetConnectErrorString(error_name);
NET_LOG(DEBUG) << "Notify: " << NetworkPathId(service_path)
<< ": Connect error: " << error_name << ": "
@@ -507,7 +507,7 @@
NetworkHandler::Get()->cellular_esim_profile_handler();
std::string network_name;
if (network) {
- base::Optional<std::string> esim_name =
+ absl::optional<std::string> esim_name =
network_name_util::GetESimProfileName(cellular_esim_profile_handler,
network);
if (esim_name)
diff --git a/chrome/browser/ui/ash/network/network_state_notifier.h b/chrome/browser/ui/ash/network/network_state_notifier.h
index 6ea5b0e..97273ad485 100644
--- a/chrome/browser/ui/ash/network/network_state_notifier.h
+++ b/chrome/browser/ui/ash/network/network_state_notifier.h
@@ -13,11 +13,11 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chromeos/network/network_connection_observer.h"
#include "chromeos/network/network_state_handler_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
class SystemTrayClient;
@@ -85,12 +85,12 @@
void OnConnectErrorGetProperties(
const std::string& error_name,
const std::string& service_path,
- base::Optional<base::Value> shill_properties);
+ absl::optional<base::Value> shill_properties);
void ShowConnectErrorNotification(
const std::string& error_name,
const std::string& service_path,
- base::Optional<base::Value> shill_properties);
+ absl::optional<base::Value> shill_properties);
void ShowVpnDisconnectedNotification(VpnDetails* vpn);
diff --git a/chrome/browser/ui/ash/network/network_state_notifier_unittest.cc b/chrome/browser/ui/ash/network/network_state_notifier_unittest.cc
index 30143e3..963f327 100644
--- a/chrome/browser/ui/ash/network/network_state_notifier_unittest.cc
+++ b/chrome/browser/ui/ash/network/network_state_notifier_unittest.cc
@@ -229,7 +229,7 @@
base::RunLoop().RunUntilIdle();
// Failure should spawn a notification.
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
tester.GetNotification(
NetworkStateNotifier::kNetworkConnectNotificationId);
EXPECT_TRUE(notification);
@@ -241,8 +241,8 @@
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SIM_CARD_LOCKED)));
// Clicking the notification should open SIM unlock settings.
- notification->delegate()->Click(/*button_index=*/base::nullopt,
- /*reply=*/base::nullopt);
+ notification->delegate()->Click(/*button_index=*/absl::nullopt,
+ /*reply=*/absl::nullopt);
EXPECT_EQ(1, test_system_tray_client_.show_sim_unlock_settings_count());
}
@@ -255,7 +255,7 @@
base::RunLoop().RunUntilIdle();
// Failure should spawn a notification.
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
tester.GetNotification(
NetworkStateNotifier::kNetworkConnectNotificationId);
EXPECT_TRUE(notification);
diff --git a/chrome/browser/ui/ash/network/tether_notification_presenter.cc b/chrome/browser/ui/ash/network/tether_notification_presenter.cc
index cafa852..776ee78 100644
--- a/chrome/browser/ui/ash/network/tether_notification_presenter.cc
+++ b/chrome/browser/ui/ash/network/tether_notification_presenter.cc
@@ -237,7 +237,7 @@
void TetherNotificationPresenter::OnNotificationClicked(
const std::string& notification_id,
- base::Optional<int> button_index) {
+ absl::optional<int> button_index) {
if (button_index) {
DCHECK_EQ(kPotentialHotspotNotificationId, notification_id);
DCHECK_EQ(0, *button_index);
diff --git a/chrome/browser/ui/ash/network/tether_notification_presenter.h b/chrome/browser/ui/ash/network/tether_notification_presenter.h
index 6f21e0d..8b343a0 100644
--- a/chrome/browser/ui/ash/network/tether_notification_presenter.h
+++ b/chrome/browser/ui/ash/network/tether_notification_presenter.h
@@ -84,7 +84,7 @@
};
void OnNotificationClicked(const std::string& notification_id,
- base::Optional<int> button_index);
+ absl::optional<int> button_index);
NotificationInteractionType GetMetricValueForClickOnNotificationBody(
const std::string& clicked_notification_id) const;
void OnNotificationClosed(const std::string& notification_id);
diff --git a/chrome/browser/ui/ash/network/tether_notification_presenter_unittest.cc b/chrome/browser/ui/ash/network/tether_notification_presenter_unittest.cc
index beb5b82..f9b40e2 100644
--- a/chrome/browser/ui/ash/network/tether_notification_presenter_unittest.cc
+++ b/chrome/browser/ui/ash/network/tether_notification_presenter_unittest.cc
@@ -205,7 +205,7 @@
display_service_->GetNotification(GetActiveHostNotificationId()));
notification_presenter_->NotifyConnectionToHostFailed();
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(GetActiveHostNotificationId());
ASSERT_TRUE(notification);
EXPECT_EQ(GetActiveHostNotificationId(), notification->id());
@@ -223,14 +223,14 @@
display_service_->GetNotification(GetActiveHostNotificationId()));
notification_presenter_->NotifyConnectionToHostFailed();
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(GetActiveHostNotificationId());
ASSERT_TRUE(notification);
EXPECT_EQ(GetActiveHostNotificationId(), notification->id());
// Tap the notification.
ASSERT_TRUE(notification->delegate());
- notification->delegate()->Click(base::nullopt, base::nullopt);
+ notification->delegate()->Click(absl::nullopt, absl::nullopt);
VerifySettingsOpened(kTetherSettingsSubpage);
EXPECT_FALSE(
display_service_->GetNotification(GetActiveHostNotificationId()));
@@ -250,7 +250,7 @@
notification_presenter_->NotifySetupRequired(test_device_.name(),
kTestNetworkSignalStrength);
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(GetSetupRequiredNotificationId());
ASSERT_TRUE(notification);
EXPECT_EQ(GetSetupRequiredNotificationId(), notification->id());
@@ -269,14 +269,14 @@
notification_presenter_->NotifySetupRequired(test_device_.name(),
kTestNetworkSignalStrength);
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(GetSetupRequiredNotificationId());
ASSERT_TRUE(notification);
EXPECT_EQ(GetSetupRequiredNotificationId(), notification->id());
// Tap the notification.
ASSERT_TRUE(notification->delegate());
- notification->delegate()->Click(base::nullopt, base::nullopt);
+ notification->delegate()->Click(absl::nullopt, absl::nullopt);
VerifySettingsOpened(kTetherSettingsSubpage);
EXPECT_FALSE(
display_service_->GetNotification(GetSetupRequiredNotificationId()));
@@ -296,7 +296,7 @@
notification_presenter_->NotifyPotentialHotspotNearby(
test_device_, kTestNetworkSignalStrength);
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(GetPotentialHotspotNotificationId());
ASSERT_TRUE(notification);
EXPECT_EQ(GetPotentialHotspotNotificationId(), notification->id());
@@ -315,14 +315,14 @@
notification_presenter_->NotifyPotentialHotspotNearby(
test_device_, kTestNetworkSignalStrength);
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(GetPotentialHotspotNotificationId());
ASSERT_TRUE(notification);
EXPECT_EQ(GetPotentialHotspotNotificationId(), notification->id());
// Tap the notification.
ASSERT_TRUE(notification->delegate());
- notification->delegate()->Click(base::nullopt, base::nullopt);
+ notification->delegate()->Click(absl::nullopt, absl::nullopt);
VerifySettingsOpened(kTetherSettingsSubpage);
EXPECT_FALSE(
display_service_->GetNotification(GetPotentialHotspotNotificationId()));
@@ -341,14 +341,14 @@
notification_presenter_->NotifyPotentialHotspotNearby(
test_device_, kTestNetworkSignalStrength);
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(GetPotentialHotspotNotificationId());
ASSERT_TRUE(notification);
EXPECT_EQ(GetPotentialHotspotNotificationId(), notification->id());
// Tap the notification's button.
ASSERT_TRUE(notification->delegate());
- notification->delegate()->Click(0, base::nullopt);
+ notification->delegate()->Click(0, absl::nullopt);
EXPECT_FALSE(
display_service_->GetNotification(GetPotentialHotspotNotificationId()));
@@ -369,7 +369,7 @@
display_service_->GetNotification(GetPotentialHotspotNotificationId()));
notification_presenter_->NotifyMultiplePotentialHotspotsNearby();
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(GetPotentialHotspotNotificationId());
ASSERT_TRUE(notification);
EXPECT_EQ(GetPotentialHotspotNotificationId(), notification->id());
@@ -387,14 +387,14 @@
display_service_->GetNotification(GetPotentialHotspotNotificationId()));
notification_presenter_->NotifyMultiplePotentialHotspotsNearby();
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(GetPotentialHotspotNotificationId());
ASSERT_TRUE(notification);
EXPECT_EQ(GetPotentialHotspotNotificationId(), notification->id());
// Tap the notification.
ASSERT_TRUE(notification->delegate());
- notification->delegate()->Click(base::nullopt, base::nullopt);
+ notification->delegate()->Click(absl::nullopt, absl::nullopt);
VerifySettingsOpened(kTetherSettingsSubpage);
EXPECT_FALSE(
display_service_->GetNotification(GetPotentialHotspotNotificationId()));
@@ -414,7 +414,7 @@
notification_presenter_->NotifyPotentialHotspotNearby(
test_device_, kTestNetworkSignalStrength);
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(GetPotentialHotspotNotificationId());
ASSERT_TRUE(notification);
EXPECT_EQ(GetPotentialHotspotNotificationId(), notification->id());
@@ -462,7 +462,7 @@
SINGLE_HOTSPOT_NEARBY_SHOWN);
display_service_->GetNotification(GetPotentialHotspotNotificationId())
->delegate()
- ->Click(base::nullopt, base::nullopt);
+ ->Click(absl::nullopt, absl::nullopt);
EXPECT_EQ(notification_presenter_->GetPotentialHotspotNotificationState(),
NotificationPresenter::PotentialHotspotNotificationState::
NO_HOTSPOT_NOTIFICATION_SHOWN);
@@ -475,7 +475,7 @@
SINGLE_HOTSPOT_NEARBY_SHOWN);
display_service_->GetNotification(GetPotentialHotspotNotificationId())
->delegate()
- ->Click(0, base::nullopt);
+ ->Click(0, absl::nullopt);
EXPECT_EQ(notification_presenter_->GetPotentialHotspotNotificationState(),
NotificationPresenter::PotentialHotspotNotificationState::
NO_HOTSPOT_NOTIFICATION_SHOWN);
@@ -508,7 +508,7 @@
MULTIPLE_HOTSPOTS_NEARBY_SHOWN);
display_service_->GetNotification(GetPotentialHotspotNotificationId())
->delegate()
- ->Click(base::nullopt, base::nullopt);
+ ->Click(absl::nullopt, absl::nullopt);
EXPECT_EQ(notification_presenter_->GetPotentialHotspotNotificationState(),
NotificationPresenter::PotentialHotspotNotificationState::
NO_HOTSPOT_NOTIFICATION_SHOWN);
diff --git a/chrome/browser/ui/ash/notification_badge_color_cache.cc b/chrome/browser/ui/ash/notification_badge_color_cache.cc
index cf4d5880..467cb8bdc7 100644
--- a/chrome/browser/ui/ash/notification_badge_color_cache.cc
+++ b/chrome/browser/ui/ash/notification_badge_color_cache.cc
@@ -12,10 +12,10 @@
// Uses the icon image to calculate the light vibrant color to be used for
// the notification indicator.
-base::Optional<SkColor> CalculateNotificationBadgeColor(gfx::ImageSkia image) {
+absl::optional<SkColor> CalculateNotificationBadgeColor(gfx::ImageSkia image) {
const SkBitmap* source = image.bitmap();
if (!source || source->empty() || source->isNull())
- return base::nullopt;
+ return absl::nullopt;
std::vector<color_utils::ColorProfile> color_profiles;
color_profiles.push_back(color_utils::ColorProfile(
@@ -29,7 +29,7 @@
// If the best swatch color is transparent, then
// CalculateProminentColorsOfBitmap() failed to find a suitable color.
if (best_swatches.empty() || best_swatches[0].color == SK_ColorTRANSPARENT)
- return base::nullopt;
+ return absl::nullopt;
return best_swatches[0].color;
}
diff --git a/chrome/browser/ui/ash/projector/projector_client_impl.cc b/chrome/browser/ui/ash/projector/projector_client_impl.cc
index 208c155..6299182 100644
--- a/chrome/browser/ui/ash/projector/projector_client_impl.cc
+++ b/chrome/browser/ui/ash/projector/projector_client_impl.cc
@@ -5,11 +5,11 @@
#include "chrome/browser/ui/ash/projector/projector_client_impl.h"
#include "ash/public/cpp/projector/projector_controller.h"
-#include "base/optional.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/speech/on_device_speech_recognizer.h"
#include "components/soda/soda_installer.h"
#include "media/base/media_switches.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
// On-device speech recognition is only available in US English.
@@ -60,7 +60,7 @@
void ProjectorClientImpl::OnSpeechResult(
const std::u16string& text,
bool is_final,
- const base::Optional<SpeechRecognizerDelegate::TranscriptTiming>& timing) {
+ const absl::optional<SpeechRecognizerDelegate::TranscriptTiming>& timing) {
DCHECK(timing.has_value() || ShouldUseWebSpeechFallback());
if (timing.has_value()) {
@@ -70,7 +70,7 @@
} else {
// This is only used for development.
ash::ProjectorController::Get()->OnTranscription(
- text, base::nullopt, base::nullopt, base::nullopt, is_final);
+ text, absl::nullopt, absl::nullopt, absl::nullopt, is_final);
}
}
diff --git a/chrome/browser/ui/ash/projector/projector_client_impl.h b/chrome/browser/ui/ash/projector/projector_client_impl.h
index 16f6821..aa92c8e 100644
--- a/chrome/browser/ui/ash/projector/projector_client_impl.h
+++ b/chrome/browser/ui/ash/projector/projector_client_impl.h
@@ -36,7 +36,7 @@
void OnSpeechResult(
const std::u16string& text,
bool is_final,
- const base::Optional<SpeechRecognizerDelegate::TranscriptTiming>& timing)
+ const absl::optional<SpeechRecognizerDelegate::TranscriptTiming>& timing)
override;
// This class is not utilizing the information about sound level.
void OnSpeechSoundLevelChanged(int16_t level) override {}
diff --git a/chrome/browser/ui/ash/screenshot_area.cc b/chrome/browser/ui/ash/screenshot_area.cc
index cf973b28..b29422e 100644
--- a/chrome/browser/ui/ash/screenshot_area.cc
+++ b/chrome/browser/ui/ash/screenshot_area.cc
@@ -7,12 +7,12 @@
// static
ScreenshotArea ScreenshotArea::CreateForAllRootWindows() {
return ScreenshotArea(ScreenshotType::kAllRootWindows, nullptr,
- base::nullopt);
+ absl::nullopt);
}
// static
ScreenshotArea ScreenshotArea::CreateForWindow(const aura::Window* window) {
- return ScreenshotArea(ScreenshotType::kWindow, window, base::nullopt);
+ return ScreenshotArea(ScreenshotType::kWindow, window, absl::nullopt);
}
// static
@@ -26,5 +26,5 @@
ScreenshotArea::ScreenshotArea(ScreenshotType type,
const aura::Window* window,
- base::Optional<const gfx::Rect> rect)
+ absl::optional<const gfx::Rect> rect)
: type(type), window(window), rect(rect) {}
diff --git a/chrome/browser/ui/ash/screenshot_area.h b/chrome/browser/ui/ash/screenshot_area.h
index 0ec1b11..1d91ad2 100644
--- a/chrome/browser/ui/ash/screenshot_area.h
+++ b/chrome/browser/ui/ash/screenshot_area.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_ASH_SCREENSHOT_AREA_H_
#define CHROME_BROWSER_UI_ASH_SCREENSHOT_AREA_H_
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
namespace aura {
@@ -32,12 +32,12 @@
const ScreenshotType type;
const aura::Window* window = nullptr;
- const base::Optional<const gfx::Rect> rect;
+ const absl::optional<const gfx::Rect> rect;
private:
ScreenshotArea(ScreenshotType type,
const aura::Window* window,
- base::Optional<const gfx::Rect> rect);
+ absl::optional<const gfx::Rect> rect);
};
#endif // CHROME_BROWSER_UI_ASH_SCREENSHOT_AREA_H_
diff --git a/chrome/browser/ui/ash/sharesheet/sharesheet_bubble_view.cc b/chrome/browser/ui/ash/sharesheet/sharesheet_bubble_view.cc
index 24b5fcf..a8a84b0 100644
--- a/chrome/browser/ui/ash/sharesheet/sharesheet_bubble_view.cc
+++ b/chrome/browser/ui/ash/sharesheet/sharesheet_bubble_view.cc
@@ -343,7 +343,7 @@
std::u16string display_name = target.display_name;
std::u16string secondary_display_name =
target.secondary_display_name.value_or(std::u16string());
- base::Optional<gfx::ImageSkia> icon = target.icon;
+ absl::optional<gfx::ImageSkia> icon = target.icon;
auto target_view = std::make_unique<SharesheetTargetButton>(
base::BindRepeating(&SharesheetBubbleView::TargetButtonPressed,
diff --git a/chrome/browser/ui/ash/sharesheet/sharesheet_header_view.cc b/chrome/browser/ui/ash/sharesheet/sharesheet_header_view.cc
index 80ce42d..fdeb65a 100644
--- a/chrome/browser/ui/ash/sharesheet/sharesheet_header_view.cc
+++ b/chrome/browser/ui/ash/sharesheet/sharesheet_header_view.cc
@@ -13,7 +13,6 @@
#include "ash/public/cpp/style/color_provider.h"
#include "base/bind.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "chrome/app/vector_icons/vector_icons.h"
@@ -30,6 +29,7 @@
#include "chromeos/ui/vector_icons/vector_icons.h"
#include "storage/browser/file_system/file_system_context.h"
#include "storage/browser/file_system/file_system_url.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/compositor/layer.h"
@@ -388,7 +388,7 @@
size, file_path,
base::BindRepeating(&SharesheetHeaderView::LoadImage,
weak_ptr_factory_.GetWeakPtr()),
- base::Optional<gfx::ImageSkia>(
+ absl::optional<gfx::ImageSkia>(
CreateMimeTypeIcon(chromeos::kFiletypeImageIcon, size)));
DCHECK_GT(image_preview_->GetImageViewCount(), index);
image_preview_->GetImageViewAt(index)->SetImage(image->GetImageSkia(size));
diff --git a/chrome/browser/ui/ash/sharesheet/sharesheet_target_button.cc b/chrome/browser/ui/ash/sharesheet/sharesheet_target_button.cc
index 25fea428..694c7e6a 100644
--- a/chrome/browser/ui/ash/sharesheet/sharesheet_target_button.cc
+++ b/chrome/browser/ui/ash/sharesheet/sharesheet_target_button.cc
@@ -30,7 +30,7 @@
constexpr int kButtonPadding = 8;
std::unique_ptr<views::ImageView> CreateImageView(
- const base::Optional<gfx::ImageSkia> icon,
+ const absl::optional<gfx::ImageSkia> icon,
const gfx::VectorIcon* vector_icon) {
if (icon.has_value()) {
auto image = std::make_unique<views::ImageView>();
@@ -61,7 +61,7 @@
PressedCallback callback,
const std::u16string& display_name,
const std::u16string& secondary_display_name,
- const base::Optional<gfx::ImageSkia> icon,
+ const absl::optional<gfx::ImageSkia> icon,
const gfx::VectorIcon* vector_icon)
: Button(std::move(callback)) {
// TODO(crbug.com/1097623) Margins shouldn't be within
diff --git a/chrome/browser/ui/ash/sharesheet/sharesheet_target_button.h b/chrome/browser/ui/ash/sharesheet/sharesheet_target_button.h
index 52626649..8f60e17 100644
--- a/chrome/browser/ui/ash/sharesheet/sharesheet_target_button.h
+++ b/chrome/browser/ui/ash/sharesheet/sharesheet_target_button.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_UI_ASH_SHARESHEET_SHARESHEET_TARGET_BUTTON_H_
#define CHROME_BROWSER_UI_ASH_SHARESHEET_SHARESHEET_TARGET_BUTTON_H_
-#include "base/optional.h"
#include "chrome/browser/sharesheet/sharesheet_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/gfx/vector_icon_types.h"
#include "ui/views/controls/button/button.h"
@@ -28,7 +28,7 @@
SharesheetTargetButton(PressedCallback callback,
const std::u16string& display_name,
const std::u16string& secondary_display_name,
- const base::Optional<gfx::ImageSkia> icon,
+ const absl::optional<gfx::ImageSkia> icon,
const gfx::VectorIcon* vector_icon);
SharesheetTargetButton(const SharesheetTargetButton&) = delete;
SharesheetTargetButton& operator=(const SharesheetTargetButton&) = delete;
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_crostini_tracker.cc b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_crostini_tracker.cc
index 1b4feb0..1319bb1 100644
--- a/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_crostini_tracker.cc
+++ b/chrome/browser/ui/ash/shelf/app_service/app_service_app_window_crostini_tracker.cc
@@ -119,7 +119,7 @@
// app's name, but this may be null in the case of apps with no associated
// launcher entry (i.e. no .desktop file), in which case the app's name is
// unknown.
- base::Optional<guest_os::GuestOsRegistryService::Registration> registration =
+ absl::optional<guest_os::GuestOsRegistryService::Registration> registration =
registry_service->GetRegistration(shelf_app_id);
RegisterCrostiniWindowForForceClose(
window, registration.has_value() ? registration->Name() : "");
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu_browsertest.cc b/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu_browsertest.cc
index 57fd6cb2..a8356f8 100644
--- a/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu_browsertest.cc
+++ b/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu_browsertest.cc
@@ -37,7 +37,7 @@
int command_index = -1;
};
- base::Optional<MenuSection> GetContextMenuSectionForAppCommand(
+ absl::optional<MenuSection> GetContextMenuSectionForAppCommand(
const web_app::AppId& app_id,
int command_id) {
MenuSection result;
@@ -59,7 +59,7 @@
result.command_index = -1;
if (!ui::MenuModel::GetModelAndIndexForCommandId(
command_id, &result.sub_model, &result.command_index)) {
- return base::nullopt;
+ return absl::nullopt;
}
return result;
@@ -85,7 +85,7 @@
->FlushMojoCallsForTesting();
// Activate open in window menu item.
- base::Optional<MenuSection> menu_section =
+ absl::optional<MenuSection> menu_section =
GetContextMenuSectionForAppCommand(app_id, ash::LAUNCH_TYPE_WINDOW);
ASSERT_TRUE(menu_section);
menu_section->sub_model->ActivatedAt(menu_section->command_index);
@@ -113,7 +113,7 @@
->FlushMojoCallsForTesting();
// Set app to open in tabbed window.
- base::Optional<MenuSection> menu_section = GetContextMenuSectionForAppCommand(
+ absl::optional<MenuSection> menu_section = GetContextMenuSectionForAppCommand(
app_id, ash::LAUNCH_TYPE_TABBED_WINDOW);
ASSERT_TRUE(menu_section);
menu_section->sub_model->ActivatedAt(menu_section->command_index);
@@ -140,7 +140,7 @@
->FlushMojoCallsForTesting();
// Set app to open in browser tab.
- base::Optional<MenuSection> menu_section =
+ absl::optional<MenuSection> menu_section =
GetContextMenuSectionForAppCommand(app_id, ash::LAUNCH_TYPE_REGULAR_TAB);
ASSERT_TRUE(menu_section);
menu_section->sub_model->ActivatedAt(menu_section->command_index);
diff --git a/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.cc b/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.cc
index 802a64c..aebd225 100644
--- a/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.cc
+++ b/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.cc
@@ -76,13 +76,13 @@
// retrieves the window that is currently active, if available.
// |activate_callback| will activate the next window selected by this function.
template <class T>
-base::Optional<ash::ShelfAction> AdvanceApp(
+absl::optional<ash::ShelfAction> AdvanceApp(
const std::vector<T*>& items,
base::OnceCallback<T*(const std::vector<T*>&, aura::Window**)>
active_item_callback,
base::OnceCallback<void(T*)> activate_callback) {
if (items.empty())
- return base::nullopt;
+ return absl::nullopt;
// Get the active item and associated aura::Window if it exists.
aura::Window* active_item_window = nullptr;
@@ -216,7 +216,7 @@
// - The web app's scope gets matched.
// - The shelf controller knows that the tab got created for this web app.
const GURL tab_url = web_contents->GetURL();
- base::Optional<GURL> app_scope = registrar_->GetAppScope(app_id_);
+ absl::optional<GURL> app_scope = registrar_->GetAppScope(app_id_);
DCHECK(app_scope.has_value());
return ((!refocus_pattern_.match_all_urls() &&
@@ -509,11 +509,11 @@
return browsers;
}
-base::Optional<ash::ShelfAction>
+absl::optional<ash::ShelfAction>
AppShortcutShelfItemController::AdvanceToNextApp(
const ItemFilterPredicate& filter_predicate) {
if (!chrome::FindLastActive())
- return base::nullopt;
+ return absl::nullopt;
if (IsWindowedWebApp()) {
return AdvanceApp(GetAppBrowsers(filter_predicate),
diff --git a/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.h b/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.h
index 1e90ab2..5d1b7dc 100644
--- a/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.h
+++ b/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.h
@@ -12,9 +12,9 @@
#include "ash/public/cpp/shelf_item_delegate.h"
#include "ash/public/cpp/shelf_types.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ui/browser_list_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace content {
@@ -84,7 +84,7 @@
// action. Otherwise, it returns nullopt.
// |filter_predicate| is used to filter out unwanted options to advance to
// based on their corresponding windows.
- base::Optional<ash::ShelfAction> AdvanceToNextApp(
+ absl::optional<ash::ShelfAction> AdvanceToNextApp(
const ItemFilterPredicate& filter_predicate);
// Returns true if the application is a V2 app.
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_browsertest.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_browsertest.cc
index 86d1603..529a80179 100644
--- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_browsertest.cc
+++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_browsertest.cc
@@ -605,7 +605,7 @@
UnpinnedBrowserShortcutTest& operator=(const UnpinnedBrowserShortcutTest&) =
delete;
~UnpinnedBrowserShortcutTest() override {
- crosapi::browser_util::SetLacrosPrimaryBrowserForTest(base::nullopt);
+ crosapi::browser_util::SetLacrosPrimaryBrowserForTest(absl::nullopt);
}
ash::ShelfModel* shelf_model() { return controller_->shelf_model(); }
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_test_util.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_test_util.cc
index c87cdfb4..e9ef87d 100644
--- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_test_util.cc
+++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_test_util.cc
@@ -10,9 +10,9 @@
#include "ash/public/cpp/shelf_model.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "chrome/browser/ui/ash/shelf/chrome_shelf_controller.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc
index 4ffccc7..1f8847fb 100644
--- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc
+++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc
@@ -619,7 +619,7 @@
}
void StartPrefSyncService(const syncer::SyncDataList& init_sync_list) {
- base::Optional<syncer::ModelError> error =
+ absl::optional<syncer::ModelError> error =
GetPrefSyncService()->MergeDataAndStartSyncing(
GetPreferencesModelType(), init_sync_list,
std::make_unique<syncer::FakeSyncChangeProcessor>(),
diff --git a/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc b/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc
index 318bac46..32ae348 100644
--- a/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc
+++ b/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc
@@ -76,7 +76,7 @@
return nullptr;
}
-base::Optional<std::string> GetAppIdForTab(Profile* profile,
+absl::optional<std::string> GetAppIdForTab(Profile* profile,
content::WebContents* tab) {
if (base::FeatureList::IsEnabled(features::kDesktopPWAsWithoutExtensions)) {
if (web_app::WebAppProviderBase* provider =
@@ -91,7 +91,7 @@
return browser->app_controller()->GetAppId();
}
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
provider->registrar().FindAppWithUrlInScope(tab->GetURL());
if (app_id && provider->registrar().GetAppUserDisplayMode(*app_id) ==
web_app::DisplayMode::kBrowser) {
@@ -113,7 +113,7 @@
(!extension->from_bookmark() ||
!base::FeatureList::IsEnabled(features::kDesktopPWAsWithoutExtensions)))
return extension->id();
- return base::nullopt;
+ return absl::nullopt;
}
apps::mojom::LaunchSource ConvertLaunchSource(ash::ShelfLaunchSource source) {
@@ -212,7 +212,7 @@
std::string ShelfControllerHelper::GetAppID(content::WebContents* tab) {
DCHECK(tab);
- base::Optional<std::string> app_id = GetAppIdForTab(
+ absl::optional<std::string> app_id = GetAppIdForTab(
Profile::FromBrowserContext(tab->GetBrowserContext()), tab);
return app_id.value_or(std::string());
}
diff --git a/chrome/browser/ui/ash/test_session_controller.h b/chrome/browser/ui/ash/test_session_controller.h
index e26e019..037ca10 100644
--- a/chrome/browser/ui/ash/test_session_controller.h
+++ b/chrome/browser/ui/ash/test_session_controller.h
@@ -11,7 +11,7 @@
#include "ash/public/cpp/session/session_controller.h"
#include "base/macros.h"
#include "base/observer_list.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Test implementation of ash's SessionController interface.
class TestSessionController : public ash::SessionController {
@@ -19,7 +19,7 @@
TestSessionController();
~TestSessionController() override;
- const base::Optional<ash::SessionInfo>& last_session_info() const {
+ const absl::optional<ash::SessionInfo>& last_session_info() const {
return last_session_info_;
}
@@ -31,7 +31,7 @@
return last_session_start_time_;
}
- const base::Optional<ash::UserSession>& last_user_session() const {
+ const absl::optional<ash::UserSession>& last_user_session() const {
return last_user_session_;
}
@@ -78,8 +78,8 @@
bool IsScreenLocked() const override;
private:
- base::Optional<ash::SessionInfo> last_session_info_;
- base::Optional<ash::UserSession> last_user_session_;
+ absl::optional<ash::SessionInfo> last_session_info_;
+ absl::optional<ash::UserSession> last_user_session_;
base::TimeDelta last_session_length_limit_;
base::Time last_session_start_time_;
int update_user_session_count_ = 0;
diff --git a/chrome/browser/ui/ash/thumbnail_loader.cc b/chrome/browser/ui/ash/thumbnail_loader.cc
index 44efab4..6665690c 100644
--- a/chrome/browser/ui/ash/thumbnail_loader.cc
+++ b/chrome/browser/ui/ash/thumbnail_loader.cc
@@ -10,7 +10,6 @@
#include "base/files/file_path.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
-#include "base/optional.h"
#include "base/single_thread_task_runner.h"
#include "base/util/values/values_util.h"
#include "base/values.h"
@@ -30,6 +29,7 @@
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "storage/browser/file_system/file_system_context.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image_skia.h"
diff --git a/chrome/browser/ui/ash/wallpaper_controller_client_impl.cc b/chrome/browser/ui/ash/wallpaper_controller_client_impl.cc
index 9f76f20..194bfc2 100644
--- a/chrome/browser/ui/ash/wallpaper_controller_client_impl.cc
+++ b/chrome/browser/ui/ash/wallpaper_controller_client_impl.cc
@@ -149,7 +149,7 @@
if (!daily_refresh_info_string)
return std::string();
- const base::Optional<base::Value> daily_refresh_info =
+ const absl::optional<base::Value> daily_refresh_info =
base::JSONReader::Read(*daily_refresh_info_string);
if (!daily_refresh_info)
diff --git a/chrome/browser/ui/aura/accessibility/automation_manager_aura_browsertest.cc b/chrome/browser/ui/aura/accessibility/automation_manager_aura_browsertest.cc
index fcc5eb6d..2c87144 100644
--- a/chrome/browser/ui/aura/accessibility/automation_manager_aura_browsertest.cc
+++ b/chrome/browser/ui/aura/accessibility/automation_manager_aura_browsertest.cc
@@ -158,7 +158,7 @@
content::BrowserContext* browser_context = nullptr) override {}
void DispatchGetTextLocationDataResult(
const ui::AXActionData& data,
- const base::Optional<gfx::Rect>& rect) override {}
+ const absl::optional<gfx::Rect>& rect) override {}
ui::AXTree ax_tree_;
std::unique_ptr<base::RunLoop> run_loop_;
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller.h b/chrome/browser/ui/autofill/autofill_popup_controller.h
index 643bf13..4864b38 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller.h
+++ b/chrome/browser/ui/autofill/autofill_popup_controller.h
@@ -11,9 +11,9 @@
#include <vector>
#include "base/compiler_specific.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/native_theme/native_theme.h"
@@ -56,11 +56,11 @@
virtual bool RemoveSuggestion(int index) = 0;
// Change which line is currently selected by the user.
- virtual void SetSelectedLine(base::Optional<int> selected_line) = 0;
+ virtual void SetSelectedLine(absl::optional<int> selected_line) = 0;
// Returns the index of the selected line. A line is "selected" when it is
// hovered or has keyboard focus.
- virtual base::Optional<int> selected_line() const = 0;
+ virtual absl::optional<int> selected_line() const = 0;
// Returns the popup type corresponding to the controller.
virtual PopupType GetPopupType() const = 0;
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
index 535b907..061337f7 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
@@ -12,7 +12,6 @@
#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/accessibility/accessibility_state_utils.h"
@@ -24,6 +23,7 @@
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_active_popup.h"
#include "ui/accessibility/ax_tree_id.h"
#include "ui/accessibility/ax_tree_manager_map.h"
@@ -240,7 +240,7 @@
case ui::VKEY_PRIOR: // Page up.
// Set no line and then select the next line in case the first line is not
// selectable.
- SetSelectedLine(base::nullopt);
+ SetSelectedLine(absl::nullopt);
SelectNextLine();
return true;
case ui::VKEY_NEXT: // Page down.
@@ -280,7 +280,7 @@
}
void AutofillPopupControllerImpl::SelectionCleared() {
- SetSelectedLine(base::nullopt);
+ SetSelectedLine(absl::nullopt);
}
void AutofillPopupControllerImpl::AcceptSuggestion(int index) {
@@ -370,7 +370,7 @@
return true;
}
-base::Optional<int> AutofillPopupControllerImpl::selected_line() const {
+absl::optional<int> AutofillPopupControllerImpl::selected_line() const {
return selected_line_;
}
@@ -379,14 +379,14 @@
}
void AutofillPopupControllerImpl::SetSelectedLine(
- base::Optional<int> selected_line) {
+ absl::optional<int> selected_line) {
if (selected_line_ == selected_line)
return;
if (selected_line) {
DCHECK_LT(*selected_line, GetLineCount());
if (!CanAccept(suggestions_[*selected_line].frontend_id))
- selected_line = base::nullopt;
+ selected_line = absl::nullopt;
}
auto previous_selected_line(selected_line_);
@@ -534,7 +534,7 @@
// Now get the target node from its tree ID and node ID.
ui::AXPlatformNode* target_node =
root_platform_node_delegate->GetFromTreeIDAndNodeID(tree_id, node_id);
- base::Optional<int32_t> popup_ax_id = view_->GetAxUniqueId();
+ absl::optional<int32_t> popup_ax_id = view_->GetAxUniqueId();
if (!target_node || !popup_ax_id)
return;
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.h b/chrome/browser/ui/autofill/autofill_popup_controller_impl.h
index f2f1e505..b716b34e 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.h
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.h
@@ -14,11 +14,11 @@
#include "base/gtest_prod_util.h"
#include "base/i18n/rtl.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller.h"
#include "chrome/browser/ui/autofill/popup_controller_common.h"
#include "components/autofill/core/browser/ui/popup_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
@@ -111,8 +111,8 @@
std::u16string* title,
std::u16string* body) override;
bool RemoveSuggestion(int list_index) override;
- void SetSelectedLine(base::Optional<int> selected_line) override;
- base::Optional<int> selected_line() const override;
+ void SetSelectedLine(absl::optional<int> selected_line) override;
+ absl::optional<int> selected_line() const override;
PopupType GetPopupType() const override;
// Increase the selected line by 1, properly handling wrapping.
@@ -181,7 +181,7 @@
// The line that is currently selected by the user, null indicates that no
// line is currently selected.
- base::Optional<int> selected_line_;
+ absl::optional<int> selected_line_;
base::WeakPtrFactory<AutofillPopupControllerImpl> weak_ptr_factory_{this};
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
index 0d8d3b5..688c287 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc
@@ -8,7 +8,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
@@ -30,6 +29,7 @@
#include "content/public/browser/web_contents.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_active_popup.h"
#include "ui/accessibility/ax_node.h"
#include "ui/accessibility/ax_tree_id.h"
@@ -133,10 +133,10 @@
MOCK_METHOD0(Show, void());
MOCK_METHOD0(Hide, void());
MOCK_METHOD2(OnSelectedRowChanged,
- void(base::Optional<int> previous_row_selection,
- base::Optional<int> current_row_selection));
+ void(absl::optional<int> previous_row_selection,
+ absl::optional<int> current_row_selection));
MOCK_METHOD0(OnSuggestionsChanged, void());
- MOCK_METHOD0(GetAxUniqueId, base::Optional<int32_t>());
+ MOCK_METHOD0(GetAxUniqueId, absl::optional<int32_t>());
private:
DISALLOW_COPY_AND_ASSIGN(MockAutofillPopupView);
@@ -226,7 +226,7 @@
DISALLOW_COPY_AND_ASSIGN(MockAxPlatformNode);
};
-static constexpr base::Optional<int> kNoSelection;
+static constexpr absl::optional<int> kNoSelection;
} // namespace
@@ -351,7 +351,7 @@
// Make sure that when a new line is selected, it is invalidated so it can
// be updated to show it is selected.
- base::Optional<int> selected_line = 0;
+ absl::optional<int> selected_line = 0;
EXPECT_CALL(*autofill_popup_view_,
OnSelectedRowChanged(kNoSelection, selected_line));
@@ -387,7 +387,7 @@
EXPECT_FALSE(autofill_popup_controller_->RemoveSelectedLine());
// Select the first entry.
- base::Optional<int> selected_line(0);
+ absl::optional<int> selected_line(0);
EXPECT_CALL(*autofill_popup_view_,
OnSelectedRowChanged(kNoSelection, selected_line));
autofill_popup_controller_->SetSelectedLine(selected_line);
@@ -429,7 +429,7 @@
EXPECT_FALSE(autofill_popup_controller_->selected_line());
// Select the only line.
- base::Optional<int> selected_line(0);
+ absl::optional<int> selected_line(0);
EXPECT_CALL(*autofill_popup_view_,
OnSelectedRowChanged(kNoSelection, selected_line));
autofill_popup_controller_->SetSelectedLine(selected_line);
@@ -711,7 +711,7 @@
.WillRepeatedly(testing::Return(test_tree_id));
EXPECT_CALL(*autofill_popup_view_, GetAxUniqueId)
.Times(2)
- .WillRepeatedly(testing::Return(base::Optional<int32_t>(123)));
+ .WillRepeatedly(testing::Return(absl::optional<int32_t>(123)));
EXPECT_CALL(*autofill_popup_controller_,
GetRootAXPlatformNodeForWebContents)
.WillRepeatedly(testing::Return(&mock_ax_platform_node));
@@ -727,7 +727,7 @@
// Fire event for popup hide and active popup ax unique id is cleared.
autofill_popup_controller_->FireControlsChangedEvent(false);
- EXPECT_EQ(base::nullopt, ui::GetActivePopupAxUniqueId());
+ EXPECT_EQ(absl::nullopt, ui::GetActivePopupAxUniqueId());
}
// Test for attempting to fire controls changed event when ax tree manager
@@ -737,7 +737,7 @@
EXPECT_CALL(*autofill_driver_, GetAxTreeId())
.WillOnce(testing::Return(test_tree_id));
EXPECT_CALL(*autofill_popup_view_, GetAxUniqueId)
- .WillOnce(testing::Return(base::Optional<int32_t>(123)));
+ .WillOnce(testing::Return(absl::optional<int32_t>(123)));
EXPECT_CALL(*autofill_popup_controller_,
GetRootAXPlatformNodeForWebContents)
.WillOnce(testing::Return(&mock_ax_platform_node));
@@ -749,7 +749,7 @@
// No controls changed event is fired and active popup ax unique id is not
// set.
autofill_popup_controller_->FireControlsChangedEvent(true);
- EXPECT_EQ(base::nullopt, ui::GetActivePopupAxUniqueId());
+ EXPECT_EQ(absl::nullopt, ui::GetActivePopupAxUniqueId());
}
// Test for attempting to fire controls changed event when failing to retrieve
@@ -766,12 +766,12 @@
EXPECT_CALL(mock_ax_platform_node_delegate, GetFromTreeIDAndNodeID)
.WillOnce(testing::Return(nullptr));
EXPECT_CALL(*autofill_popup_view_, GetAxUniqueId)
- .WillOnce(testing::Return(base::Optional<int32_t>(123)));
+ .WillOnce(testing::Return(absl::optional<int32_t>(123)));
// No controls changed event is fired and active popup ax unique id is not
// set.
autofill_popup_controller_->FireControlsChangedEvent(true);
- EXPECT_EQ(base::nullopt, ui::GetActivePopupAxUniqueId());
+ EXPECT_EQ(absl::nullopt, ui::GetActivePopupAxUniqueId());
}
// Test for attempting to fire controls changed event when failing to retrieve
@@ -788,12 +788,12 @@
EXPECT_CALL(mock_ax_platform_node_delegate, GetFromTreeIDAndNodeID)
.WillOnce(testing::Return(&mock_ax_platform_node));
EXPECT_CALL(*autofill_popup_view_, GetAxUniqueId)
- .WillOnce(testing::Return(base::nullopt));
+ .WillOnce(testing::Return(absl::nullopt));
// No controls changed event is fired and active popup ax unique id is not
// set.
autofill_popup_controller_->FireControlsChangedEvent(true);
- EXPECT_EQ(base::nullopt, ui::GetActivePopupAxUniqueId());
+ EXPECT_EQ(absl::nullopt, ui::GetActivePopupAxUniqueId());
}
// This needs to happen before TearDown() because having the mode set to
// kScreenReader causes mocked functions to get called with
diff --git a/chrome/browser/ui/autofill/autofill_popup_view.h b/chrome/browser/ui/autofill/autofill_popup_view.h
index c9dfab5..2a42ca9 100644
--- a/chrome/browser/ui/autofill/autofill_popup_view.h
+++ b/chrome/browser/ui/autofill/autofill_popup_view.h
@@ -8,8 +8,8 @@
#include <stddef.h>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace autofill {
@@ -27,14 +27,14 @@
// If not null, invalidates the given rows and redraws them.
virtual void OnSelectedRowChanged(
- base::Optional<int> previous_row_selection,
- base::Optional<int> current_row_selection) = 0;
+ absl::optional<int> previous_row_selection,
+ absl::optional<int> current_row_selection) = 0;
// Refreshes the position and redraws popup when suggestions change.
virtual void OnSuggestionsChanged() = 0;
// Return the autofill popup view's ax unique id.
- virtual base::Optional<int32_t> GetAxUniqueId() = 0;
+ virtual absl::optional<int32_t> GetAxUniqueId() = 0;
// Factory function for creating the view.
static AutofillPopupView* Create(
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc
index dca4b61..0c2e0d3 100644
--- a/chrome/browser/ui/autofill/chrome_autofill_client.cc
+++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
@@ -438,7 +438,7 @@
/*upload_save_card_callback=*/
AutofillClient::UploadSaveCardPromptCallback(),
/*local_save_card_callback=*/std::move(callback), GetPrefs()),
- base::nullopt));
+ absl::nullopt));
#else
// Do lazy initialization of SaveCardBubbleControllerImpl.
SaveCardBubbleControllerImpl::CreateForWebContents(web_contents());
@@ -466,7 +466,7 @@
GetPersonalDataManager()->GetSyncSigninState() ==
autofill::AutofillSyncSigninState::kSignedInAndWalletSyncTransportEnabled;
- base::Optional<AccountInfo> account_info;
+ absl::optional<AccountInfo> account_info;
// AccountInfo data should be passed down only if the following conditions are
// satisfied:
// 1) Sync is off or the
@@ -849,7 +849,7 @@
return Profile::FromBrowserContext(web_contents()->GetBrowserContext());
}
-base::Optional<AccountInfo> ChromeAutofillClient::GetAccountInfo() {
+absl::optional<AccountInfo> ChromeAutofillClient::GetAccountInfo() {
signin::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(GetProfile());
CoreAccountId account_id =
@@ -873,7 +873,7 @@
IdentityManagerFactory::GetForProfile(profile);
if (!identity_manager)
return std::u16string();
- base::Optional<AccountInfo> primary_account_info =
+ absl::optional<AccountInfo> primary_account_info =
identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
identity_manager->GetPrimaryAccountInfo(signin::ConsentLevel::kSync));
return primary_account_info
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.h b/chrome/browser/ui/autofill/chrome_autofill_client.h
index e2f8e14..66d8d708 100644
--- a/chrome/browser/ui/autofill/chrome_autofill_client.h
+++ b/chrome/browser/ui/autofill/chrome_autofill_client.h
@@ -14,7 +14,6 @@
#include "base/i18n/rtl.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/browser/autofill/autofill_gstatic_reader.h"
#include "chrome/browser/profiles/profile.h"
@@ -25,6 +24,7 @@
#include "components/signin/public/identity_manager/account_info.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if defined(OS_ANDROID)
#include "chrome/browser/autofill/android/save_address_profile_flow_manager.h"
@@ -190,7 +190,7 @@
explicit ChromeAutofillClient(content::WebContents* web_contents);
Profile* GetProfile() const;
- base::Optional<AccountInfo> GetAccountInfo();
+ absl::optional<AccountInfo> GetAccountInfo();
bool IsMultipleAccountUser();
std::u16string GetAccountHolderName();
diff --git a/chrome/browser/ui/autofill/edit_address_profile_dialog_controller_impl.h b/chrome/browser/ui/autofill/edit_address_profile_dialog_controller_impl.h
index 500aa1d..9062deb 100644
--- a/chrome/browser/ui/autofill/edit_address_profile_dialog_controller_impl.h
+++ b/chrome/browser/ui/autofill/edit_address_profile_dialog_controller_impl.h
@@ -64,7 +64,7 @@
// If not nullptr, this dialog was opened from an update prompt. Contains the
// details of the address profile that will be updated if the user accepts
// that update prompt from which this edit dialog was opened..
- base::Optional<AutofillProfile> original_profile_;
+ absl::optional<AutofillProfile> original_profile_;
AutofillBubbleBase* edit_dialog_ = nullptr;
diff --git a/chrome/browser/ui/autofill/payments/offer_notification_bubble_controller_impl.h b/chrome/browser/ui/autofill/payments/offer_notification_bubble_controller_impl.h
index b257124..a78c0db 100644
--- a/chrome/browser/ui/autofill/payments/offer_notification_bubble_controller_impl.h
+++ b/chrome/browser/ui/autofill/payments/offer_notification_bubble_controller_impl.h
@@ -84,7 +84,7 @@
// The related credit card for a card linked offer. This can be nullopt for
// offer types other than card linked offers.
- base::Optional<CreditCard> card_;
+ absl::optional<CreditCard> card_;
// The bubble and icon are sticky over a given set of origins. This is
// populated when ShowOfferNotificationIfApplicable() is called and is cleared
diff --git a/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc b/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc
index e918a81..d47fb36a 100644
--- a/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc
+++ b/chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.cc
@@ -532,7 +532,7 @@
PersonalDataManagerFactory::GetForProfile(profile);
if (!personal_data_manager)
return;
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
personal_data_manager->GetAccountInfoForPaymentsServer());
account_info_ = account_info.value_or(AccountInfo{});
diff --git a/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.h b/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.h
index 87a6dcef..5e8693a 100644
--- a/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.h
+++ b/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.h
@@ -79,7 +79,7 @@
// Contains the details of the address profile that will be updated if the
// user accepts the prompt.
- base::Optional<AutofillProfile> original_profile_;
+ absl::optional<AutofillProfile> original_profile_;
// Whether the bubble is going to be shown upon user gesture (e.g. click on
// the page action icon) or automatically (e.g. upon detection of an address
diff --git a/chrome/browser/ui/blocked_content/chrome_popup_navigation_delegate.cc b/chrome/browser/ui/blocked_content/chrome_popup_navigation_delegate.cc
index 62e1582..8ab69ad 100644
--- a/chrome/browser/ui/blocked_content/chrome_popup_navigation_delegate.cc
+++ b/chrome/browser/ui/blocked_content/chrome_popup_navigation_delegate.cc
@@ -44,7 +44,7 @@
blocked_content::PopupNavigationDelegate::NavigateResult
ChromePopupNavigationDelegate::NavigateWithGesture(
const blink::mojom::WindowFeatures& window_features,
- base::Optional<WindowOpenDisposition> updated_disposition) {
+ absl::optional<WindowOpenDisposition> updated_disposition) {
params_.user_gesture = true;
if (updated_disposition)
params_.disposition = updated_disposition.value();
diff --git a/chrome/browser/ui/blocked_content/chrome_popup_navigation_delegate.h b/chrome/browser/ui/blocked_content/chrome_popup_navigation_delegate.h
index ab11623..71d9ea3 100644
--- a/chrome/browser/ui/blocked_content/chrome_popup_navigation_delegate.h
+++ b/chrome/browser/ui/blocked_content/chrome_popup_navigation_delegate.h
@@ -19,7 +19,7 @@
const GURL& GetURL() override;
NavigateResult NavigateWithGesture(
const blink::mojom::WindowFeatures& window_features,
- base::Optional<WindowOpenDisposition> updated_disposition) override;
+ absl::optional<WindowOpenDisposition> updated_disposition) override;
void OnPopupBlocked(content::WebContents* web_contents,
int total_popups_blocked_on_page) override;
diff --git a/chrome/browser/ui/bookmarks/bookmark_editor.h b/chrome/browser/ui/bookmarks/bookmark_editor.h
index 67baeeea..e2a5254 100644
--- a/chrome/browser/ui/bookmarks/bookmark_editor.h
+++ b/chrome/browser/ui/bookmarks/bookmark_editor.h
@@ -87,7 +87,7 @@
// If type == NEW_URL or type == NEW_FOLDER this gives the index to insert
// the new node at.
- base::Optional<size_t> index;
+ absl::optional<size_t> index;
// If type == NEW_URL this gives the URL/title.
GURL url;
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 77cb567..7c840e8 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -22,7 +22,6 @@
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
-#include "base/optional.h"
#include "base/process/process_info.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
@@ -226,6 +225,7 @@
#include "extensions/common/manifest_handlers/background_info.h"
#include "net/base/filename_util.h"
#include "ppapi/buildflags/buildflags.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/security/protocol_handler_security_level.h"
#include "third_party/blink/public/mojom/frame/blocked_navigation_types.mojom.h"
#include "third_party/blink/public/mojom/frame/frame.mojom.h"
@@ -1239,7 +1239,7 @@
}
void Browser::TabGroupedStateChanged(
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
content::WebContents* contents,
int index) {
#if BUILDFLAG(ENABLE_APP_SESSION_SERVICE)
@@ -2664,7 +2664,7 @@
session_tab_helper->session_id(),
tab_strip_model_->IsTabPinned(i));
- base::Optional<tab_groups::TabGroupId> group_id =
+ absl::optional<tab_groups::TabGroupId> group_id =
tab_strip_model_->GetTabGroupForTab(i);
session_service->SetTabGroup(session_id(),
session_tab_helper->session_id(),
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 1864b45..71ce1e2 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -594,7 +594,7 @@
void TabPinnedStateChanged(TabStripModel* tab_strip_model,
content::WebContents* contents,
int index) override;
- void TabGroupedStateChanged(base::Optional<tab_groups::TabGroupId> group,
+ void TabGroupedStateChanged(absl::optional<tab_groups::TabGroupId> group,
content::WebContents* contents,
int index) override;
void TabStripEmpty() override;
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index 82f6a0f..380f755 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -317,7 +317,7 @@
}
void BrowserCommandController::TabKeyboardFocusChangedTo(
- base::Optional<int> index) {
+ absl::optional<int> index) {
UpdateCommandsForTabKeyboardFocus(index);
}
@@ -1556,7 +1556,7 @@
}
void BrowserCommandController::UpdateCommandsForTabKeyboardFocus(
- base::Optional<int> target_index) {
+ absl::optional<int> target_index) {
command_updater_.UpdateCommandEnabled(
IDC_DUPLICATE_TARGET_TAB, !browser_->deprecated_is_app() &&
target_index.has_value() &&
diff --git a/chrome/browser/ui/browser_command_controller.h b/chrome/browser/ui/browser_command_controller.h
index 77d1d80..417d49ad 100644
--- a/chrome/browser/ui/browser_command_controller.h
+++ b/chrome/browser/ui/browser_command_controller.h
@@ -61,7 +61,7 @@
void LoadingStateChanged(bool is_loading, bool force);
void FindBarVisibilityChanged();
void ExtensionStateChanged();
- void TabKeyboardFocusChangedTo(base::Optional<int> index);
+ void TabKeyboardFocusChangedTo(absl::optional<int> index);
void WebContentsFocusChanged();
// Overriden from CommandUpdater:
@@ -192,7 +192,7 @@
// Updates commands for tab keyboard focus state. If |target_index| is
// populated, it is the index of the tab with focus; if it is not populated,
// no tab has keyboard focus.
- void UpdateCommandsForTabKeyboardFocus(base::Optional<int> target_index);
+ void UpdateCommandsForTabKeyboardFocus(absl::optional<int> target_index);
// Updates commands that depend on whether web contents is focused or not.
void UpdateCommandsForWebContentsFocus();
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index ced12ad..8604e43 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -838,7 +838,7 @@
void MoveTabsToNewWindow(Browser* browser,
const std::vector<int>& tab_indices,
- base::Optional<tab_groups::TabGroupId> group) {
+ absl::optional<tab_groups::TabGroupId> group) {
if (tab_indices.empty())
return;
@@ -1723,8 +1723,8 @@
}
#if !defined(TOOLKIT_VIEWS)
-base::Optional<int> GetKeyboardFocusedTabIndex(const Browser* browser) {
- return base::nullopt;
+absl::optional<int> GetKeyboardFocusedTabIndex(const Browser* browser) {
+ return absl::nullopt;
}
#endif
diff --git a/chrome/browser/ui/browser_commands.h b/chrome/browser/ui/browser_commands.h
index 06f281c..f9a8906 100644
--- a/chrome/browser/ui/browser_commands.h
+++ b/chrome/browser/ui/browser_commands.h
@@ -8,7 +8,6 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/devtools/devtools_toggle_action.h"
@@ -18,6 +17,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
#include "content/public/common/page_zoom.h"
#include "printing/buildflags/buildflags.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/window_open_disposition.h"
class Browser;
@@ -119,7 +119,7 @@
void MoveTabsToNewWindow(
Browser* browser,
const std::vector<int>& tab_indices,
- base::Optional<tab_groups::TabGroupId> group = base::nullopt);
+ absl::optional<tab_groups::TabGroupId> group = absl::nullopt);
bool CanCloseTabsToRight(const Browser* browser);
bool CanCloseOtherTabs(const Browser* browser);
content::WebContents* DuplicateTabAt(Browser* browser, int index);
@@ -227,7 +227,7 @@
void ToggleCommander(Browser* browser);
void ExecuteUIDebugCommand(int id, const Browser* browser);
-base::Optional<int> GetKeyboardFocusedTabIndex(const Browser* browser);
+absl::optional<int> GetKeyboardFocusedTabIndex(const Browser* browser);
} // namespace chrome
diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h
index 12979c2..692e58c 100644
--- a/chrome/browser/ui/browser_dialogs.h
+++ b/chrome/browser/ui/browser_dialogs.h
@@ -11,7 +11,6 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/ui/bookmarks/bookmark_editor.h"
@@ -19,6 +18,7 @@
#include "chrome/common/buildflags.h"
#include "content/public/browser/content_browser_client.h"
#include "extensions/buildflags/buildflags.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/native_widget_types.h"
diff --git a/chrome/browser/ui/browser_live_tab_context.cc b/chrome/browser/ui/browser_live_tab_context.cc
index d29b3486..755b90a 100644
--- a/chrome/browser/ui/browser_live_tab_context.cc
+++ b/chrome/browser/ui/browser_live_tab_context.cc
@@ -96,7 +96,7 @@
return browser_->tab_strip_model()->IsTabPinned(index);
}
-base::Optional<tab_groups::TabGroupId> BrowserLiveTabContext::GetTabGroupForTab(
+absl::optional<tab_groups::TabGroupId> BrowserLiveTabContext::GetTabGroupForTab(
int index) const {
return browser_->tab_strip_model()->GetTabGroupForTab(index);
}
@@ -134,7 +134,7 @@
int tab_index,
int selected_navigation,
const std::string& extension_app_id,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
const tab_groups::TabGroupVisualData& group_visual_data,
bool select,
bool pin,
@@ -189,7 +189,7 @@
sessions::LiveTab* BrowserLiveTabContext::ReplaceRestoredTab(
const std::vector<sessions::SerializedNavigationEntry>& navigations,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
int selected_navigation,
const std::string& extension_app_id,
const sessions::PlatformSpecificTabData* tab_platform_data,
diff --git a/chrome/browser/ui/browser_live_tab_context.h b/chrome/browser/ui/browser_live_tab_context.h
index 90663a3..1e7123d 100644
--- a/chrome/browser/ui/browser_live_tab_context.h
+++ b/chrome/browser/ui/browser_live_tab_context.h
@@ -43,7 +43,7 @@
sessions::LiveTab* GetLiveTabAt(int index) const override;
sessions::LiveTab* GetActiveLiveTab() const override;
bool IsTabPinned(int index) const override;
- base::Optional<tab_groups::TabGroupId> GetTabGroupForTab(
+ absl::optional<tab_groups::TabGroupId> GetTabGroupForTab(
int index) const override;
const tab_groups::TabGroupVisualData* GetVisualDataForGroup(
const tab_groups::TabGroupId& group) const override;
@@ -59,7 +59,7 @@
int tab_index,
int selected_navigation,
const std::string& extension_app_id,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
const tab_groups::TabGroupVisualData& group_visual_data,
bool select,
bool pin,
@@ -68,7 +68,7 @@
const SessionID* tab_id) override;
sessions::LiveTab* ReplaceRestoredTab(
const std::vector<sessions::SerializedNavigationEntry>& navigations,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
int selected_navigation,
const std::string& extension_app_id,
const sessions::PlatformSpecificTabData* tab_platform_data,
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index 4f9c2b4..77b90d5c 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -164,7 +164,7 @@
#if BUILDFLAG(ENABLE_EXTENSIONS)
if (params.open_pwa_window_if_possible) {
- base::Optional<web_app::AppId> app_id =
+ absl::optional<web_app::AppId> app_id =
web_app::FindInstalledAppWithUrlInScope(profile, params.url,
/*window_only=*/true);
if (app_id) {
@@ -493,7 +493,7 @@
// Open System Apps in their standalone window if necessary.
// TODO(crbug.com/1096345): Remove this code after we integrate with intent
// handling.
- const base::Optional<web_app::SystemAppType> capturing_system_app_type =
+ const absl::optional<web_app::SystemAppType> capturing_system_app_type =
web_app::GetCapturingSystemAppForURL(params->initiating_profile,
params->url);
if (capturing_system_app_type &&
diff --git a/chrome/browser/ui/browser_navigator_params.h b/chrome/browser/ui/browser_navigator_params.h
index c4cb87e..29f25a2 100644
--- a/chrome/browser/ui/browser_navigator_params.h
+++ b/chrome/browser/ui/browser_navigator_params.h
@@ -10,7 +10,6 @@
#include <vector>
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "content/public/browser/global_request_id.h"
#include "content/public/browser/reload_type.h"
@@ -21,6 +20,7 @@
#include "content/public/common/was_activated_option.mojom.h"
#include "services/network/public/cpp/resource_request_body.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/navigation/impression.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "ui/base/page_transition_types.h"
@@ -95,7 +95,7 @@
// drop), and the frame with the corresponding frame token may have been
// deleted before the navigation begins. It is defined if and only if
// |initiator_process_id| below is.
- base::Optional<blink::LocalFrameToken> initiator_frame_token;
+ absl::optional<blink::LocalFrameToken> initiator_frame_token;
// ID of the renderer process of the frame host that initiated the navigation.
// This is defined if and only if |initiator_frame_token| above is, and it is
@@ -103,7 +103,7 @@
int initiator_process_id = content::ChildProcessHost::kInvalidUniqueID;
// The origin of the initiator of the navigation.
- base::Optional<url::Origin> initiator_origin;
+ absl::optional<url::Origin> initiator_origin;
// The frame name to be used for the main frame.
std::string frame_name;
@@ -246,7 +246,7 @@
Browser* browser = nullptr;
// The group the caller would like the tab to be added to.
- base::Optional<tab_groups::TabGroupId> group;
+ absl::optional<tab_groups::TabGroupId> group;
// A bitmask of values defined in TabStripModel::AddTabTypes. Helps
// determine where to insert a new tab and whether or not it should be
@@ -307,7 +307,7 @@
// Optional impression associated with this navigation. Only set on
// navigations that originate from links with impression attributes. Used for
// conversion measurement.
- base::Optional<blink::Impression> impression;
+ absl::optional<blink::Impression> impression;
// True if the navigation was initiated by typing in the omnibox but the typed
// text didn't have a scheme such as http or https (e.g. google.com), and
diff --git a/chrome/browser/ui/browser_tab_strip_model_delegate.cc b/chrome/browser/ui/browser_tab_strip_model_delegate.cc
index 32a5b65..0bafdc7 100644
--- a/chrome/browser/ui/browser_tab_strip_model_delegate.cc
+++ b/chrome/browser/ui/browser_tab_strip_model_delegate.cc
@@ -50,7 +50,7 @@
const GURL& url,
int index,
bool foreground,
- base::Optional<tab_groups::TabGroupId> group) {
+ absl::optional<tab_groups::TabGroupId> group) {
chrome::AddTabAt(browser_, url, index, foreground, group);
}
@@ -180,10 +180,10 @@
chrome::MoveTabsToNewWindow(browser_, indices, group);
}
-base::Optional<SessionID> BrowserTabStripModelDelegate::CreateHistoricalTab(
+absl::optional<SessionID> BrowserTabStripModelDelegate::CreateHistoricalTab(
content::WebContents* contents) {
if (!BrowserSupportsHistoricalEntries())
- return base::nullopt;
+ return absl::nullopt;
sessions::TabRestoreService* service =
TabRestoreServiceFactory::GetForProfile(browser_->profile());
@@ -194,7 +194,7 @@
sessions::ContentLiveTab::GetForWebContents(contents),
browser_->tab_strip_model()->GetIndexOfWebContents(contents));
}
- return base::nullopt;
+ return absl::nullopt;
}
void BrowserTabStripModelDelegate::CreateHistoricalGroup(
diff --git a/chrome/browser/ui/browser_tab_strip_model_delegate.h b/chrome/browser/ui/browser_tab_strip_model_delegate.h
index c692f9d..4d7ff21 100644
--- a/chrome/browser/ui/browser_tab_strip_model_delegate.h
+++ b/chrome/browser/ui/browser_tab_strip_model_delegate.h
@@ -28,7 +28,7 @@
void AddTabAt(const GURL& url,
int index,
bool foreground,
- base::Optional<tab_groups::TabGroupId> group) override;
+ absl::optional<tab_groups::TabGroupId> group) override;
Browser* CreateNewStripWithContents(std::vector<NewStripContents> contentses,
const gfx::Rect& window_bounds,
bool maximize) override;
@@ -43,7 +43,7 @@
bool CanMoveTabsToWindow(const std::vector<int>& indices) override;
void MoveTabsToNewWindow(const std::vector<int>& indices) override;
void MoveGroupToNewWindow(const tab_groups::TabGroupId& group) override;
- base::Optional<SessionID> CreateHistoricalTab(
+ absl::optional<SessionID> CreateHistoricalTab(
content::WebContents* contents) override;
void CreateHistoricalGroup(const tab_groups::TabGroupId& group) override;
void GroupCloseStopped(const tab_groups::TabGroupId& group) override;
diff --git a/chrome/browser/ui/browser_tabrestore.cc b/chrome/browser/ui/browser_tabrestore.cc
index fdfbb85..d69662d 100644
--- a/chrome/browser/ui/browser_tabrestore.cc
+++ b/chrome/browser/ui/browser_tabrestore.cc
@@ -123,7 +123,7 @@
int tab_index,
int selected_navigation,
const std::string& extension_app_id,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
bool select,
bool pin,
base::TimeTicks last_active_time,
@@ -145,7 +145,7 @@
add_types |= TabStripModel::ADD_PINNED;
}
- const base::Optional<tab_groups::TabGroupId> surrounding_group =
+ const absl::optional<tab_groups::TabGroupId> surrounding_group =
tab_strip_model->GetSurroundingTabGroup(tab_index);
// If inserting at |tab_index| would put the tab within a different
diff --git a/chrome/browser/ui/browser_tabrestore.h b/chrome/browser/ui/browser_tabrestore.h
index 25ef980..47431136 100644
--- a/chrome/browser/ui/browser_tabrestore.h
+++ b/chrome/browser/ui/browser_tabrestore.h
@@ -45,7 +45,7 @@
int tab_index,
int selected_navigation,
const std::string& extension_app_id,
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
bool select,
bool pin,
base::TimeTicks last_active_time,
diff --git a/chrome/browser/ui/browser_tabrestore_browsertest.cc b/chrome/browser/ui/browser_tabrestore_browsertest.cc
index 2e47493..a9e5f7c 100644
--- a/chrome/browser/ui/browser_tabrestore_browsertest.cc
+++ b/chrome/browser/ui/browser_tabrestore_browsertest.cc
@@ -134,7 +134,7 @@
content::WebContents* web_contents = chrome::AddRestoredTab(
browser(), navigations, /* tab_index=*/1, /* selected_navigation=*/0,
- /* extension_app_id=*/std::string(), /* raw_group_id=*/base::nullopt,
+ /* extension_app_id=*/std::string(), /* raw_group_id=*/absl::nullopt,
/* select=*/true, /* pin=*/false,
/* last_active_time=*/base::TimeTicks::Now(),
/* storage_namespace=*/nullptr,
@@ -156,7 +156,7 @@
content::WebContents* web_contents = chrome::AddRestoredTab(
browser(), navigations, /* tab_index=*/1, /* selected_navigation=*/0,
- /* extension_app_id=*/std::string(), /* raw_group_id=*/base::nullopt,
+ /* extension_app_id=*/std::string(), /* raw_group_id=*/absl::nullopt,
/* select=*/false, /* pin=*/false,
/* last_active_time=*/base::TimeTicks::Now(),
/* storage_namespace=*/nullptr,
diff --git a/chrome/browser/ui/browser_tabstrip.cc b/chrome/browser/ui/browser_tabstrip.cc
index 899b0e5..72ad7346 100644
--- a/chrome/browser/ui/browser_tabstrip.cc
+++ b/chrome/browser/ui/browser_tabstrip.cc
@@ -26,7 +26,7 @@
const GURL& url,
int idx,
bool foreground,
- base::Optional<tab_groups::TabGroupId> group) {
+ absl::optional<tab_groups::TabGroupId> group) {
// Time new tab page creation time. We keep track of the timing data in
// WebContents, but we want to include the time it takes to create the
// WebContents object too.
diff --git a/chrome/browser/ui/browser_tabstrip.h b/chrome/browser/ui/browser_tabstrip.h
index b965bac..3ae6ad7a 100644
--- a/chrome/browser/ui/browser_tabstrip.h
+++ b/chrome/browser/ui/browser_tabstrip.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_UI_BROWSER_TABSTRIP_H_
#define CHROME_BROWSER_UI_BROWSER_TABSTRIP_H_
-#include "base/optional.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "components/tab_groups/tab_group_id.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
#include "ui/base/window_open_disposition.h"
@@ -29,7 +29,7 @@
const GURL& url,
int index,
bool foreground,
- base::Optional<tab_groups::TabGroupId> group = base::nullopt);
+ absl::optional<tab_groups::TabGroupId> group = absl::nullopt);
// Adds a selected tab with the specified URL and transition, returns the
// created WebContents.
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h
index 49aee0bf..e1581f7e 100644
--- a/chrome/browser/ui/browser_window.h
+++ b/chrome/browser/ui/browser_window.h
@@ -10,7 +10,6 @@
#include <vector>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/browser/apps/intent_helper/apps_navigation_types.h"
#include "chrome/browser/lifetime/browser_close_manager.h"
@@ -26,6 +25,7 @@
#include "chrome/common/buildflags.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/translate/core/common/translate_errors.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/base_window.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/native_widget_types.h"
@@ -373,7 +373,7 @@
bool show_stay_in_chrome,
bool show_remember_selection,
PageActionIconType icon_type,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
IntentPickerResponse callback) = 0;
// Shows the Bookmark bubble. |url| is the URL being bookmarked,
diff --git a/chrome/browser/ui/caption_bubble_controller.h b/chrome/browser/ui/caption_bubble_controller.h
index 91eb471..183ffcc 100644
--- a/chrome/browser/ui/caption_bubble_controller.h
+++ b/chrome/browser/ui/caption_bubble_controller.h
@@ -48,7 +48,7 @@
// Called when the caption style changes.
virtual void UpdateCaptionStyle(
- base::Optional<ui::CaptionStyle> caption_style) = 0;
+ absl::optional<ui::CaptionStyle> caption_style) = 0;
private:
friend class CaptionControllerTest;
diff --git a/chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.cc b/chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.cc
index 9a2ec8e..3ecd9cd 100644
--- a/chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.cc
+++ b/chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.cc
@@ -93,8 +93,8 @@
}
void QuitWithAppsController::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
CloseNotification(notification_profile_);
if (!button_index)
diff --git a/chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h b/chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h
index bc22b96..bec59363 100644
--- a/chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h
+++ b/chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h
@@ -27,8 +27,8 @@
// NotificationDelegate interface.
void Close(bool by_user) override;
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
// Attempt to quit Chrome. This will display a notification and return false
// if there are apps running.
diff --git a/chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac_interactive_uitest.mm b/chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac_interactive_uitest.mm
index a23a036..8d00162 100644
--- a/chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac_interactive_uitest.mm
+++ b/chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac_interactive_uitest.mm
@@ -87,8 +87,8 @@
// If notification was dismissed by click, show again on next quit.
display_service.SimulateClick(
NotificationHandler::Type::TRANSIENT,
- QuitWithAppsController::kQuitWithAppsNotificationID, base::nullopt,
- base::nullopt);
+ QuitWithAppsController::kQuitWithAppsNotificationID, absl::nullopt,
+ absl::nullopt);
EXPECT_FALSE(display_service.GetNotification(
QuitWithAppsController::kQuitWithAppsNotificationID));
EXPECT_FALSE(controller->ShouldQuit());
@@ -138,7 +138,7 @@
display_service.SimulateClick(
NotificationHandler::Type::TRANSIENT,
QuitWithAppsController::kQuitWithAppsNotificationID,
- 0 /* kQuitAllAppsButtonIndex */, base::nullopt);
+ 0 /* kQuitAllAppsButtonIndex */, absl::nullopt);
destroyed_watcher.Wait();
EXPECT_FALSE(AppWindowRegistryUtil::IsAppWindowVisibleInAnyProfile(0));
quit_observer.Wait();
diff --git a/chrome/browser/ui/cocoa/browser_window_mac_browsertest.mm b/chrome/browser/ui/cocoa/browser_window_mac_browsertest.mm
index 099d8df..28b6013 100644
--- a/chrome/browser/ui/cocoa/browser_window_mac_browsertest.mm
+++ b/chrome/browser/ui/cocoa/browser_window_mac_browsertest.mm
@@ -77,7 +77,7 @@
IN_PROC_BROWSER_TEST_F(BrowserWindowMacA11yTest, A11yTreeIsWellFormed) {
NSWindow* window = browser()->window()->GetNativeWindow().GetNativeNSWindow();
size_t nodes_visited = 0;
- base::Optional<ui::NSAXTreeProblemDetails> details =
+ absl::optional<ui::NSAXTreeProblemDetails> details =
ui::ValidateNSAXTree(window, &nodes_visited);
EXPECT_FALSE(details.has_value()) << details->ToString();
diff --git a/chrome/browser/ui/cocoa/first_run_dialog_controller_unittest.mm b/chrome/browser/ui/cocoa/first_run_dialog_controller_unittest.mm
index 5a6abc76..b6274ac 100644
--- a/chrome/browser/ui/cocoa/first_run_dialog_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/first_run_dialog_controller_unittest.mm
@@ -70,7 +70,7 @@
// Ensure that the mangled strings actually do change the height!
EXPECT_NE(defaultView.frame.size.height, longView.frame.size.height);
- base::Optional<ui::ViewTreeProblemDetails> details =
+ absl::optional<ui::ViewTreeProblemDetails> details =
ui::ValidateViewTree(longView);
EXPECT_FALSE(details.has_value()) << details->ToString();
diff --git a/chrome/browser/ui/cocoa/main_menu_builder.h b/chrome/browser/ui/cocoa/main_menu_builder.h
index d4ce9e7..d2d2c44 100644
--- a/chrome/browser/ui/cocoa/main_menu_builder.h
+++ b/chrome/browser/ui/cocoa/main_menu_builder.h
@@ -13,7 +13,7 @@
#include "base/check_op.h"
#include "base/mac/scoped_nsobject.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chrome {
@@ -140,7 +140,7 @@
bool is_removed_ = false;
- base::Optional<std::vector<MenuItemBuilder>> submenu_;
+ absl::optional<std::vector<MenuItemBuilder>> submenu_;
// Copy and assign allowed.
};
diff --git a/chrome/browser/ui/cocoa/screentime/history_bridge_unittest.cc b/chrome/browser/ui/cocoa/screentime/history_bridge_unittest.cc
index c50d400f..f0a7bab 100644
--- a/chrome/browser/ui/cocoa/screentime/history_bridge_unittest.cc
+++ b/chrome/browser/ui/cocoa/screentime/history_bridge_unittest.cc
@@ -23,7 +23,7 @@
~TestHistoryDeleter() override {}
bool deleted_all() const { return deleted_all_; }
- base::Optional<TimeInterval> deleted_interval() const {
+ absl::optional<TimeInterval> deleted_interval() const {
return deleted_interval_;
}
const std::set<GURL>& deleted_urls() const { return deleted_urls_; }
@@ -46,7 +46,7 @@
private:
bool deleted_all_ = false;
- base::Optional<TimeInterval> deleted_interval_ = base::nullopt;
+ absl::optional<TimeInterval> deleted_interval_ = absl::nullopt;
std::set<GURL> deleted_urls_;
base::RunLoop wait_loop_;
};
diff --git a/chrome/browser/ui/cocoa/touchbar/credit_card_autofill_touch_bar_controller_unittest.mm b/chrome/browser/ui/cocoa/touchbar/credit_card_autofill_touch_bar_controller_unittest.mm
index aeaeded..46bf1ba5 100644
--- a/chrome/browser/ui/cocoa/touchbar/credit_card_autofill_touch_bar_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/touchbar/credit_card_autofill_touch_bar_controller_unittest.mm
@@ -77,8 +77,8 @@
MOCK_METHOD3(GetRemovalConfirmationText,
bool(int index, std::u16string* title, std::u16string* body));
MOCK_METHOD1(RemoveSuggestion, bool(int index));
- MOCK_METHOD1(SetSelectedLine, void(base::Optional<int> selected_line));
- MOCK_CONST_METHOD0(selected_line, base::Optional<int>());
+ MOCK_METHOD1(SetSelectedLine, void(absl::optional<int> selected_line));
+ MOCK_CONST_METHOD0(selected_line, absl::optional<int>());
MOCK_CONST_METHOD0(GetPopupType, autofill::PopupType());
void set_line_count(int line_count) {
diff --git a/chrome/browser/ui/color/omnibox_color_mixers.cc b/chrome/browser/ui/color/omnibox_color_mixers.cc
index bfb50a65..21ea534 100644
--- a/chrome/browser/ui/color/omnibox_color_mixers.cc
+++ b/chrome/browser/ui/color/omnibox_color_mixers.cc
@@ -56,7 +56,7 @@
const auto results_icon = [minimum_contrast](ui::ColorId text_id,
ui::ColorId background_id) {
return ui::BlendForMinContrast(ui::DeriveDefaultIconColor(text_id),
- background_id, base::nullopt,
+ background_id, absl::nullopt,
minimum_contrast);
};
mixer[kColorOmniboxResultsIcon] =
@@ -73,7 +73,7 @@
ui::ColorId background_id) {
return ui::BlendForMinContrast(
foreground_id, foreground_id,
- ui::BlendForMinContrast(background_id, background_id, base::nullopt,
+ ui::BlendForMinContrast(background_id, background_id, absl::nullopt,
minimum_contrast),
minimum_contrast);
};
@@ -110,7 +110,7 @@
ui::BlendTowardMaxContrast(kColorOmniboxText, 0x18),
ui::BlendForMinContrast(std::move(transform),
kColorOmniboxBackgroundHovered,
- base::nullopt, minimum_contrast));
+ absl::nullopt, minimum_contrast));
};
mixer[kColorOmniboxSecurityChipDangerous] =
security_chip_color(gfx::kGoogleRed600);
diff --git a/chrome/browser/ui/commander/bookmark_command_source.cc b/chrome/browser/ui/commander/bookmark_command_source.cc
index 4936399..fbb076f 100644
--- a/chrome/browser/ui/commander/bookmark_command_source.cc
+++ b/chrome/browser/ui/commander/bookmark_command_source.cc
@@ -34,7 +34,7 @@
// base::Unretained is safe because commands are reset when a browser is
// closed.
item->command = base::BindOnce(&chrome::AddTabAt, base::Unretained(browser),
- GURL(bookmark.url), -1, true, base::nullopt);
+ GURL(bookmark.url), -1, true, absl::nullopt);
return item;
}
diff --git a/chrome/browser/ui/commander/entity_match.cc b/chrome/browser/ui/commander/entity_match.cc
index a06ddd3..b0be80f 100644
--- a/chrome/browser/ui/commander/entity_match.cc
+++ b/chrome/browser/ui/commander/entity_match.cc
@@ -152,7 +152,7 @@
std::vector<GroupMatch> GroupsMatchingInput(
const Browser* browser,
const std::u16string& input,
- base::Optional<tab_groups::TabGroupId> group_to_exclude) {
+ absl::optional<tab_groups::TabGroupId> group_to_exclude) {
DCHECK(browser);
std::vector<GroupMatch> results;
FuzzyFinder finder(input);
diff --git a/chrome/browser/ui/commander/entity_match.h b/chrome/browser/ui/commander/entity_match.h
index 1bb54ba4..3bca902 100644
--- a/chrome/browser/ui/commander/entity_match.h
+++ b/chrome/browser/ui/commander/entity_match.h
@@ -91,7 +91,7 @@
std::vector<GroupMatch> GroupsMatchingInput(
const Browser* browser,
const std::u16string& input,
- base::Optional<tab_groups::TabGroupId> group_to_exclude = base::nullopt);
+ absl::optional<tab_groups::TabGroupId> group_to_exclude = absl::nullopt);
// Options for narrowing results from `TabsMatchingInput`.
struct TabSearchOptions {
@@ -107,10 +107,10 @@
bool only_muted = false;
// Exclude tabs that belong to this group. Explicitly setting this to the
// same value as `only_tab_group` is invalid.
- base::Optional<tab_groups::TabGroupId> exclude_tab_group = base::nullopt;
+ absl::optional<tab_groups::TabGroupId> exclude_tab_group = absl::nullopt;
// Exclude tabs that do not belong to this group. Explicitly setting this to
// the same value as `exclude_tab_group` is invalid.
- base::Optional<tab_groups::TabGroupId> only_tab_group = base::nullopt;
+ absl::optional<tab_groups::TabGroupId> only_tab_group = absl::nullopt;
};
// Returns tabs in `browser` whose titles fuzzy match `input`. If input is
diff --git a/chrome/browser/ui/commander/open_url_command_source.cc b/chrome/browser/ui/commander/open_url_command_source.cc
index 1550552..d0e3a81 100644
--- a/chrome/browser/ui/commander/open_url_command_source.cc
+++ b/chrome/browser/ui/commander/open_url_command_source.cc
@@ -59,7 +59,7 @@
// closed.
item->command =
base::BindOnce(&chrome::AddTabAt, base::Unretained(browser),
- command_spec.second, -1, true, base::nullopt);
+ command_spec.second, -1, true, absl::nullopt);
results.push_back(std::move(item));
}
return results;
diff --git a/chrome/browser/ui/commander/tab_command_source.cc b/chrome/browser/ui/commander/tab_command_source.cc
index 3c0390a..6d89a72 100644
--- a/chrome/browser/ui/commander/tab_command_source.cc
+++ b/chrome/browser/ui/commander/tab_command_source.cc
@@ -43,9 +43,9 @@
// In practice, this is the tab group that *all* selected tabs belong to, if
// any. In the common special case of single selection, this will return that
// tab's group if it has one.
-base::Optional<tab_groups::TabGroupId> IneligibleGroupForSelected(
+absl::optional<tab_groups::TabGroupId> IneligibleGroupForSelected(
TabStripModel* tab_strip_model) {
- base::Optional<tab_groups::TabGroupId> excluded_group = base::nullopt;
+ absl::optional<tab_groups::TabGroupId> excluded_group = absl::nullopt;
for (int index : tab_strip_model->selection_model().selected_indices()) {
auto group = tab_strip_model->GetTabGroupForTab(index);
if (group.has_value()) {
@@ -53,7 +53,7 @@
excluded_group = group;
} else if (group != excluded_group) {
// More than one group in the selection, so don't exclude anything.
- return base::nullopt;
+ return absl::nullopt;
}
}
}
diff --git a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
index 64734b7..74e53c8 100644
--- a/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
+++ b/chrome/browser/ui/content_settings/content_setting_image_model_unittest.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
@@ -46,6 +45,7 @@
#include "net/cookies/cookie_options.h"
#include "services/device/public/cpp/device_features.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/color_palette.h"
@@ -72,7 +72,7 @@
void SelectUiToUse(permissions::PermissionRequest* request,
DecisionMadeCallback callback) override {
std::move(callback).Run(
- Decision(simulated_reason_for_quiet_ui_, base::nullopt));
+ Decision(simulated_reason_for_quiet_ui_, absl::nullopt));
}
private:
@@ -177,7 +177,7 @@
GURL origin("http://google.com");
std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create(
- origin, "A=B", base::Time::Now(), base::nullopt /* server_time */));
+ origin, "A=B", base::Time::Now(), absl::nullopt /* server_time */));
ASSERT_TRUE(cookie);
PageSpecificContentSettings::GetForFrame(web_contents()->GetMainFrame())
->OnCookiesAccessed({content::CookieAccessDetails::Type::kChange,
diff --git a/chrome/browser/ui/content_settings/framebust_block_browsertest.cc b/chrome/browser/ui/content_settings/framebust_block_browsertest.cc
index c5471745..428f3bb 100644
--- a/chrome/browser/ui/content_settings/framebust_block_browsertest.cc
+++ b/chrome/browser/ui/content_settings/framebust_block_browsertest.cc
@@ -8,7 +8,6 @@
#include "base/callback_helpers.h"
#include "base/containers/contains.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -38,6 +37,7 @@
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "url/gurl.h"
@@ -111,8 +111,8 @@
}
protected:
- base::Optional<GURL> clicked_url_;
- base::Optional<size_t> clicked_index_;
+ absl::optional<GURL> clicked_url_;
+ absl::optional<size_t> clicked_index_;
base::OnceClosure blocked_url_added_closure_;
Browser* current_browser_;
diff --git a/chrome/browser/ui/enterprise_startup_dialog.h b/chrome/browser/ui/enterprise_startup_dialog.h
index fc8fde4..d7487efd 100644
--- a/chrome/browser/ui/enterprise_startup_dialog.h
+++ b/chrome/browser/ui/enterprise_startup_dialog.h
@@ -9,7 +9,7 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace policy {
@@ -45,7 +45,7 @@
// re-opening it.
virtual void DisplayErrorMessage(
const std::u16string& error_message,
- const base::Optional<std::u16string>& accept_button) = 0;
+ const absl::optional<std::u16string>& accept_button) = 0;
// Return true if dialog is being displayed.
virtual bool IsShowing() = 0;
diff --git a/chrome/browser/ui/exclusive_access/exclusive_access_test.cc b/chrome/browser/ui/exclusive_access/exclusive_access_test.cc
index 60796dda..e530e55 100644
--- a/chrome/browser/ui/exclusive_access/exclusive_access_test.cc
+++ b/chrome/browser/ui/exclusive_access/exclusive_access_test.cc
@@ -11,7 +11,6 @@
#include "base/callback.h"
#include "base/command_line.h"
#include "base/containers/flat_set.h"
-#include "base/optional.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_window.h"
@@ -26,6 +25,7 @@
#include "content/public/common/content_features.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/frame/fullscreen.mojom.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/base_event_utils.h"
@@ -103,7 +103,7 @@
// then we create a set of keys that does not include escape (we arbitrarily
// chose the 'a' key) which means the user/test can just press escape to exit
// fullscreen.
- base::Optional<base::flat_set<ui::DomCode>> codes;
+ absl::optional<base::flat_set<ui::DomCode>> codes;
if (esc_key_locked)
codes = base::flat_set<ui::DomCode>({ui::DomCode::ESCAPE});
else
diff --git a/chrome/browser/ui/extensions/extension_enable_flow_test_delegate.h b/chrome/browser/ui/extensions/extension_enable_flow_test_delegate.h
index 9a16d0a..745859b4 100644
--- a/chrome/browser/ui/extensions/extension_enable_flow_test_delegate.h
+++ b/chrome/browser/ui/extensions/extension_enable_flow_test_delegate.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ENABLE_FLOW_TEST_DELEGATE_H_
#define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ENABLE_FLOW_TEST_DELEGATE_H_
-#include "base/optional.h"
#include "base/run_loop.h"
#include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class ExtensionEnableFlowTestDelegate : public ExtensionEnableFlowDelegate {
public:
@@ -30,10 +30,10 @@
// Wait for the extension enable flow to complete.
void Wait();
- const base::Optional<Result>& result() const { return result_; }
+ const absl::optional<Result>& result() const { return result_; }
private:
- base::Optional<Result> result_;
+ absl::optional<Result> result_;
base::RunLoop run_loop_;
};
diff --git a/chrome/browser/ui/extensions/extension_installed_bubble_model.cc b/chrome/browser/ui/extensions/extension_installed_bubble_model.cc
index e9c2edd..48cb3ba 100644
--- a/chrome/browser/ui/extensions/extension_installed_bubble_model.cc
+++ b/chrome/browser/ui/extensions/extension_installed_bubble_model.cc
@@ -21,13 +21,13 @@
namespace {
-base::Optional<extensions::Command> CommandForExtensionAction(
+absl::optional<extensions::Command> CommandForExtensionAction(
const extensions::Extension* extension,
Profile* profile) {
const auto* info = extensions::ActionInfo::GetExtensionActionInfo(extension);
if (!info)
- return base::nullopt;
+ return absl::nullopt;
auto* service = extensions::CommandService::Get(profile);
extensions::Command command;
@@ -38,11 +38,11 @@
return command;
}
- return base::nullopt;
+ return absl::nullopt;
}
std::u16string MakeHowToUseText(const extensions::ActionInfo* action,
- base::Optional<extensions::Command> command,
+ absl::optional<extensions::Command> command,
const std::string& keyword) {
std::u16string extra;
if (command.has_value())
@@ -80,7 +80,7 @@
extension_id_(extension->id()),
extension_name_(extension->name()) {
const std::string& keyword = extensions::OmniboxInfo::GetKeyword(extension);
- base::Optional<extensions::Command> command =
+ absl::optional<extensions::Command> command =
CommandForExtensionAction(extension, profile);
const auto* action_info =
extensions::ActionInfo::GetExtensionActionInfo(extension);
diff --git a/chrome/browser/ui/extensions/extension_installed_notification.cc b/chrome/browser/ui/extensions/extension_installed_notification.cc
index b7bc77a..77c642a 100644
--- a/chrome/browser/ui/extensions/extension_installed_notification.cc
+++ b/chrome/browser/ui/extensions/extension_installed_notification.cc
@@ -63,8 +63,8 @@
ExtensionInstalledNotification::~ExtensionInstalledNotification() {}
void ExtensionInstalledNotification::Click(
- const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) {
+ const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) {
if (!extensions::util::IsAppLaunchable(extension_id_, profile_))
return;
diff --git a/chrome/browser/ui/extensions/extension_installed_notification.h b/chrome/browser/ui/extensions/extension_installed_notification.h
index 7c8f61a9..f73f5c8 100644
--- a/chrome/browser/ui/extensions/extension_installed_notification.h
+++ b/chrome/browser/ui/extensions/extension_installed_notification.h
@@ -20,8 +20,8 @@
Profile* profile);
// NotificationDelegate override:
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override;
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override;
protected:
// This class is ref-counted.
diff --git a/chrome/browser/ui/extensions/hosted_app_browser_controller.cc b/chrome/browser/ui/extensions/hosted_app_browser_controller.cc
index ce1ac48..bf618dd9 100644
--- a/chrome/browser/ui/extensions/hosted_app_browser_controller.cc
+++ b/chrome/browser/ui/extensions/hosted_app_browser_controller.cc
@@ -114,22 +114,22 @@
return browser()->GetCurrentPageIcon().AsImageSkia();
}
-base::Optional<SkColor> HostedAppBrowserController::GetThemeColor() const {
- base::Optional<SkColor> web_theme_color =
+absl::optional<SkColor> HostedAppBrowserController::GetThemeColor() const {
+ absl::optional<SkColor> web_theme_color =
AppBrowserController::GetThemeColor();
if (web_theme_color)
return web_theme_color;
const Extension* extension = GetExtension();
if (!extension)
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<SkColor> extension_theme_color =
+ absl::optional<SkColor> extension_theme_color =
AppThemeColorInfo::GetThemeColor(extension);
if (extension_theme_color)
return SkColorSetA(*extension_theme_color, SK_AlphaOPAQUE);
- return base::nullopt;
+ return absl::nullopt;
}
std::u16string HostedAppBrowserController::GetTitle() const {
diff --git a/chrome/browser/ui/extensions/hosted_app_browser_controller.h b/chrome/browser/ui/extensions/hosted_app_browser_controller.h
index 99727a8a..0c4976e5e 100644
--- a/chrome/browser/ui/extensions/hosted_app_browser_controller.h
+++ b/chrome/browser/ui/extensions/hosted_app_browser_controller.h
@@ -9,11 +9,11 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "components/services/app_service/public/mojom/types.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
class Browser;
@@ -38,7 +38,7 @@
bool HasMinimalUiButtons() const override;
gfx::ImageSkia GetWindowAppIcon() const override;
gfx::ImageSkia GetWindowIcon() const override;
- base::Optional<SkColor> GetThemeColor() const override;
+ absl::optional<SkColor> GetThemeColor() const override;
std::u16string GetTitle() const override;
std::u16string GetAppShortName() const override;
std::u16string GetFormattedUrlOrigin() const override;
diff --git a/chrome/browser/ui/extensions/hosted_app_browsertest.cc b/chrome/browser/ui/extensions/hosted_app_browsertest.cc
index e3fbfe6..e8f466b3 100644
--- a/chrome/browser/ui/extensions/hosted_app_browsertest.cc
+++ b/chrome/browser/ui/extensions/hosted_app_browsertest.cc
@@ -11,7 +11,6 @@
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
@@ -84,6 +83,7 @@
#include "net/test/embedded_test_server/request_handler_util.h"
#include "testing/gtest/include/gtest/gtest-param-test.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h"
#include "third_party/blink/public/common/switches.h"
@@ -1886,7 +1886,7 @@
nested_origin_url.spec().c_str());
content::URLLoaderInterceptor::WriteResponse(
headers, body, params->client.get(),
- base::Optional<net::SSLInfo>());
+ absl::optional<net::SSLInfo>());
return true;
} else if (params->url_request.url.host() ==
nested_origin_url.host()) {
@@ -1897,7 +1897,7 @@
nested_origin_url.spec().c_str());
content::URLLoaderInterceptor::WriteResponse(
headers, body, params->client.get(),
- base::Optional<net::SSLInfo>());
+ absl::optional<net::SSLInfo>());
return true;
}
// Not handled by us.
diff --git a/chrome/browser/ui/extensions/settings_api_bubble_helpers.cc b/chrome/browser/ui/extensions/settings_api_bubble_helpers.cc
index cffa1da6..4cdc08e 100644
--- a/chrome/browser/ui/extensions/settings_api_bubble_helpers.cc
+++ b/chrome/browser/ui/extensions/settings_api_bubble_helpers.cc
@@ -143,7 +143,7 @@
if (!browser)
return;
- base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
+ absl::optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetSearchOverriddenParams(browser->profile());
if (!params)
return;
@@ -191,7 +191,7 @@
if (model->has_active_bubble())
return;
- base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
+ absl::optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetNtpOverriddenParams(profile);
if (!params)
return;
diff --git a/chrome/browser/ui/extensions/settings_overridden_params_providers.cc b/chrome/browser/ui/extensions/settings_overridden_params_providers.cc
index 7a4f135..ed8eaf9 100644
--- a/chrome/browser/ui/extensions/settings_overridden_params_providers.cc
+++ b/chrome/browser/ui/extensions/settings_overridden_params_providers.cc
@@ -138,13 +138,13 @@
} // namespace
-base::Optional<ExtensionSettingsOverriddenDialog::Params>
+absl::optional<ExtensionSettingsOverriddenDialog::Params>
GetNtpOverriddenParams(Profile* profile) {
const GURL ntp_url(chrome::kChromeUINewTabURL);
const extensions::Extension* extension =
ExtensionWebUI::GetExtensionControllingURL(ntp_url, profile);
if (!extension)
- return base::nullopt;
+ return absl::nullopt;
// This preference tracks whether users have acknowledged the extension's
// control, so that they are not warned twice about the same extension.
@@ -211,12 +211,12 @@
std::move(dialog_message), icon);
}
-base::Optional<ExtensionSettingsOverriddenDialog::Params>
+absl::optional<ExtensionSettingsOverriddenDialog::Params>
GetSearchOverriddenParams(Profile* profile) {
const extensions::Extension* extension =
extensions::GetExtensionOverridingSearchEngine(profile);
if (!extension)
- return base::nullopt;
+ return absl::nullopt;
// We deliberately re-use the same preference that the bubble UI uses. This
// way, users won't see the bubble or dialog UI if they've already
@@ -251,7 +251,7 @@
// as crazy as using filesystem: URLs as a search engine.
if (!secondary_search.origin.is_empty() &&
secondary_search.origin == search_url.GetOrigin()) {
- return base::nullopt;
+ return absl::nullopt;
}
// Format the URL for display.
diff --git a/chrome/browser/ui/extensions/settings_overridden_params_providers.h b/chrome/browser/ui/extensions/settings_overridden_params_providers.h
index 38ba84cc..a90df81 100644
--- a/chrome/browser/ui/extensions/settings_overridden_params_providers.h
+++ b/chrome/browser/ui/extensions/settings_overridden_params_providers.h
@@ -5,20 +5,20 @@
#ifndef CHROME_BROWSER_UI_EXTENSIONS_SETTINGS_OVERRIDDEN_PARAMS_PROVIDERS_H_
#define CHROME_BROWSER_UI_EXTENSIONS_SETTINGS_OVERRIDDEN_PARAMS_PROVIDERS_H_
-#include "base/optional.h"
#include "chrome/browser/ui/extensions/extension_settings_overridden_dialog.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace settings_overridden_params {
// Retrieves the params for displaying the NTP setting overridden dialog, if
// there is a controlling extension. Otherwise, returns an empty optional.
-base::Optional<ExtensionSettingsOverriddenDialog::Params>
+absl::optional<ExtensionSettingsOverriddenDialog::Params>
GetNtpOverriddenParams(Profile* profile);
// Retrieves the params for displaying the dialog indicating that the default
// search engine has been overridden, if there is a controlling extension.
// Otherwise, returns an empty optional.
-base::Optional<ExtensionSettingsOverriddenDialog::Params>
+absl::optional<ExtensionSettingsOverriddenDialog::Params>
GetSearchOverriddenParams(Profile* profile);
} // namespace settings_overridden_params
diff --git a/chrome/browser/ui/extensions/settings_overridden_params_providers_browsertest.cc b/chrome/browser/ui/extensions/settings_overridden_params_providers_browsertest.cc
index a097126..8cb0e0d 100644
--- a/chrome/browser/ui/extensions/settings_overridden_params_providers_browsertest.cc
+++ b/chrome/browser/ui/extensions/settings_overridden_params_providers_browsertest.cc
@@ -95,21 +95,21 @@
IN_PROC_BROWSER_TEST_F(SettingsOverriddenParamsProvidersBrowserTest,
GetExtensionControllingSearch) {
// With no extensions installed, there should be no controlling extension.
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
settings_overridden_params::GetSearchOverriddenParams(profile()));
// Install an extension, but not one that overrides the default search engine.
// There should still be no controlling extension.
InstallExtensionWithPermissionsGranted(
test_data_dir_.AppendASCII("simple_with_icon"), 1);
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
settings_overridden_params::GetSearchOverriddenParams(profile()));
// Finally, install an extension that overrides the default search engine.
// It should be the controlling extension.
const extensions::Extension* search_extension =
AddExtensionControllingSearch();
- base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
+ absl::optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetSearchOverriddenParams(profile());
ASSERT_TRUE(params);
EXPECT_EQ(search_extension->id(), params->controlling_extension_id);
@@ -135,7 +135,7 @@
const extensions::Extension* extension = AddExtensionControllingSearch();
ASSERT_TRUE(extension);
- base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
+ absl::optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetSearchOverriddenParams(profile());
ASSERT_TRUE(params);
EXPECT_EQ(base::StringPrintf("Change back to %s?", new_search_name.c_str()),
@@ -156,7 +156,7 @@
const extensions::Extension* extension = AddExtensionControllingSearch();
ASSERT_TRUE(extension);
- base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
+ absl::optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetSearchOverriddenParams(profile());
ASSERT_TRUE(params);
EXPECT_EQ("Did you mean to change your search provider?",
@@ -173,7 +173,7 @@
AddExtensionControllingSearch("search_provider_override2");
ASSERT_TRUE(second);
- base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
+ absl::optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetSearchOverriddenParams(profile());
ASSERT_TRUE(params);
EXPECT_EQ("Did you mean to change your search provider?",
@@ -220,7 +220,7 @@
EXPECT_EQ(extension,
extensions::GetExtensionOverridingSearchEngine(profile()));
- base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
+ absl::optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetSearchOverriddenParams(profile());
EXPECT_FALSE(params) << "Unexpected params: " << params->dialog_title;
}
@@ -268,7 +268,7 @@
EXPECT_EQ(extension,
extensions::GetExtensionOverridingSearchEngine(profile()));
- base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
+ absl::optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetSearchOverriddenParams(profile());
EXPECT_FALSE(params) << "Unexpected params: " << params->dialog_title;
}
@@ -298,7 +298,7 @@
// The dialog should be the generic version, rather than prompting to go back
// to the default.
- base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
+ absl::optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetNtpOverriddenParams(profile());
ASSERT_TRUE(params);
EXPECT_EQ(extension->id(), params->controlling_extension_id);
diff --git a/chrome/browser/ui/extensions/settings_overridden_params_providers_unittest.cc b/chrome/browser/ui/extensions/settings_overridden_params_providers_unittest.cc
index d6eb602f8..a0dbd01 100644
--- a/chrome/browser/ui/extensions/settings_overridden_params_providers_unittest.cc
+++ b/chrome/browser/ui/extensions/settings_overridden_params_providers_unittest.cc
@@ -63,7 +63,7 @@
TEST_F(SettingsOverriddenParamsProvidersUnitTest,
GetExtensionControllingNewTab) {
// With no extensions installed, there should be no controlling extension.
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
settings_overridden_params::GetNtpOverriddenParams(profile()));
// Install an extension, but not one that overrides the NTP. There should
@@ -71,13 +71,13 @@
scoped_refptr<const extensions::Extension> regular_extension =
extensions::ExtensionBuilder("regular").Build();
service()->AddExtension(regular_extension.get());
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
settings_overridden_params::GetNtpOverriddenParams(profile()));
// Finally, install an extension that overrides the NTP. It should be the
// controlling extension.
const extensions::Extension* ntp_extension = AddExtensionControllingNewTab();
- base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
+ absl::optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetNtpOverriddenParams(profile());
ASSERT_TRUE(params);
EXPECT_EQ(ntp_extension->id(), params->controlling_extension_id);
@@ -98,7 +98,7 @@
// When there are multiple extensions that could override the NTP, we should
// show a generic dialog (rather than prompting to go back to the default
// NTP), because the other extension would just take over.
- base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
+ absl::optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetNtpOverriddenParams(profile());
ASSERT_TRUE(params);
EXPECT_EQ(extension2->id(), params->controlling_extension_id);
diff --git a/chrome/browser/ui/global_media_controls/media_notification_service.h b/chrome/browser/ui/global_media_controls/media_notification_service.h
index fbb14fa5..b7d6286 100644
--- a/chrome/browser/ui/global_media_controls/media_notification_service.h
+++ b/chrome/browser/ui/global_media_controls/media_notification_service.h
@@ -12,7 +12,6 @@
#include "base/containers/flat_map.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ui/global_media_controls/cast_media_notification_producer.h"
#include "chrome/browser/ui/global_media_controls/media_notification_container_observer.h"
#include "chrome/browser/ui/global_media_controls/media_notification_device_provider.h"
@@ -28,6 +27,7 @@
#include "mojo/public/cpp/bindings/remote.h"
#include "services/media_session/public/mojom/media_controller.mojom-forward.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class StartPresentationContext;
diff --git a/chrome/browser/ui/global_media_controls/media_notification_service_unittest.cc b/chrome/browser/ui/global_media_controls/media_notification_service_unittest.cc
index 8c93600..d3bea20a 100644
--- a/chrome/browser/ui/global_media_controls/media_notification_service_unittest.cc
+++ b/chrome/browser/ui/global_media_controls/media_notification_service_unittest.cc
@@ -309,7 +309,7 @@
void SimulateMediaSeeked(const base::UnguessableToken& id) {
auto item_itr = sessions().find(id.ToString());
EXPECT_NE(sessions().end(), item_itr);
- item_itr->second.MediaSessionPositionChanged(base::nullopt);
+ item_itr->second.MediaSessionPositionChanged(absl::nullopt);
}
void SimulateNotificationClicked(const base::UnguessableToken& id) {
diff --git a/chrome/browser/ui/global_media_controls/media_session_notification_producer.cc b/chrome/browser/ui/global_media_controls/media_session_notification_producer.cc
index cedd279c..b85e3ce 100644
--- a/chrome/browser/ui/global_media_controls/media_session_notification_producer.cc
+++ b/chrome/browser/ui/global_media_controls/media_session_notification_producer.cc
@@ -178,7 +178,7 @@
}
void MediaSessionNotificationProducer::Session::MediaSessionPositionChanged(
- const base::Optional<media_session::MediaPosition>& position) {
+ const absl::optional<media_session::MediaPosition>& position) {
OnSessionInteractedWith();
}
diff --git a/chrome/browser/ui/global_media_controls/media_session_notification_producer.h b/chrome/browser/ui/global_media_controls/media_session_notification_producer.h
index fd6ad47..99d374a3 100644
--- a/chrome/browser/ui/global_media_controls/media_session_notification_producer.h
+++ b/chrome/browser/ui/global_media_controls/media_session_notification_producer.h
@@ -127,15 +127,15 @@
void MediaSessionInfoChanged(
media_session::mojom::MediaSessionInfoPtr session_info) override;
void MediaSessionMetadataChanged(
- const base::Optional<media_session::MediaMetadata>& metadata) override {
+ const absl::optional<media_session::MediaMetadata>& metadata) override {
}
void MediaSessionActionsChanged(
const std::vector<media_session::mojom::MediaSessionAction>& actions)
override;
void MediaSessionChanged(
- const base::Optional<base::UnguessableToken>& request_id) override {}
+ const absl::optional<base::UnguessableToken>& request_id) override {}
void MediaSessionPositionChanged(
- const base::Optional<media_session::MediaPosition>& position) override;
+ const absl::optional<media_session::MediaPosition>& position) override;
// media_router::WebContentsPresentationManager::Observer:
void OnMediaRoutesChanged(
@@ -194,7 +194,7 @@
base::TimeTicks last_interaction_time_ = base::TimeTicks::Now();
// The reason why this session was dismissed/removed.
- base::Optional<GlobalMediaControlsDismissReason> dismiss_reason_;
+ absl::optional<GlobalMediaControlsDismissReason> dismiss_reason_;
// True if the session's playback state is "playing".
bool is_playing_ = false;
diff --git a/chrome/browser/ui/global_media_controls/presentation_request_notification_producer.h b/chrome/browser/ui/global_media_controls/presentation_request_notification_producer.h
index 624c03137..7c5e3770 100644
--- a/chrome/browser/ui/global_media_controls/presentation_request_notification_producer.h
+++ b/chrome/browser/ui/global_media_controls/presentation_request_notification_producer.h
@@ -9,13 +9,13 @@
#include <string>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ui/global_media_controls/media_notification_container_observer.h"
#include "chrome/browser/ui/global_media_controls/media_notification_container_observer_set.h"
#include "chrome/browser/ui/global_media_controls/media_notification_producer.h"
#include "chrome/browser/ui/global_media_controls/media_notification_service_observer.h"
#include "chrome/browser/ui/global_media_controls/presentation_request_notification_item.h"
#include "components/media_router/browser/presentation/web_contents_presentation_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// An object that creates and manages media notifications related to
// presentation requests.
@@ -119,7 +119,7 @@
presentation_manager_ = nullptr;
// The notification managed by this producer, if there is one.
- base::Optional<PresentationRequestNotificationItem> item_;
+ absl::optional<PresentationRequestNotificationItem> item_;
// True if |notification_service_| should hide |item_| because there are
// active notifications on WebContents managed by this producer.
diff --git a/chrome/browser/ui/hats/hats_service.cc b/chrome/browser/ui/hats/hats_service.cc
index d5953f1..5fefd5f 100644
--- a/chrome/browser/ui/hats/hats_service.cc
+++ b/chrome/browser/ui/hats/hats_service.cc
@@ -122,13 +122,13 @@
survey_configs.emplace_back(
&features::kHappinessTrackingSurveysForDesktopSettingsPrivacy,
kHatsSurveyTriggerSettingsPrivacy,
- /*presupplied_trigger_id=*/base::nullopt,
+ /*presupplied_trigger_id=*/absl::nullopt,
std::vector<std::string>{"3P cookies blocked",
"Privacy Sandbox enabled"});
survey_configs.emplace_back(
&features::kHappinessTrackingSurveysForDesktopPrivacySandbox,
kHatsSurveyTriggerPrivacySandbox,
- /*presupplied_trigger_id=*/base::nullopt,
+ /*presupplied_trigger_id=*/absl::nullopt,
std::vector<std::string>{"3P cookies blocked",
"Privacy Sandbox enabled"});
@@ -145,7 +145,7 @@
HatsService::SurveyConfig::SurveyConfig(
const base::Feature* feature,
const std::string& trigger,
- const base::Optional<std::string>& presupplied_trigger_id,
+ const absl::optional<std::string>& presupplied_trigger_id,
const std::vector<std::string>& product_specific_data_fields)
: trigger(trigger),
product_specific_data_fields(product_specific_data_fields) {
@@ -393,27 +393,27 @@
DictionaryPrefUpdate update(profile_->GetPrefs(), prefs::kHatsSurveyMetadata);
base::DictionaryValue* pref_data = update.Get();
- base::Optional<int> last_major_version =
+ absl::optional<int> last_major_version =
pref_data->FindIntPath(GetMajorVersionPath(trigger));
if (last_major_version.has_value())
metadata->last_major_version = last_major_version;
- base::Optional<base::Time> last_survey_started_time =
+ absl::optional<base::Time> last_survey_started_time =
util::ValueToTime(pref_data->FindPath(GetLastSurveyStartedTime(trigger)));
if (last_survey_started_time.has_value())
metadata->last_survey_started_time = last_survey_started_time;
- base::Optional<base::Time> any_last_survey_started_time =
+ absl::optional<base::Time> any_last_survey_started_time =
util::ValueToTime(pref_data->FindPath(kAnyLastSurveyStartedTimePath));
if (any_last_survey_started_time.has_value())
metadata->any_last_survey_started_time = any_last_survey_started_time;
- base::Optional<bool> is_survey_full =
+ absl::optional<bool> is_survey_full =
pref_data->FindBoolPath(GetIsSurveyFull(trigger));
if (is_survey_full.has_value())
metadata->is_survey_full = is_survey_full;
- base::Optional<base::Time> last_survey_check_time =
+ absl::optional<base::Time> last_survey_check_time =
util::ValueToTime(pref_data->FindPath(GetLastSurveyCheckTime(trigger)));
if (last_survey_check_time.has_value())
metadata->last_survey_check_time = last_survey_check_time;
@@ -516,7 +516,7 @@
const base::DictionaryValue* pref_data =
profile_->GetPrefs()->GetDictionary(prefs::kHatsSurveyMetadata);
- base::Optional<int> last_major_version =
+ absl::optional<int> last_major_version =
pref_data->FindIntPath(GetMajorVersionPath(trigger));
if (last_major_version.has_value() &&
static_cast<uint32_t>(*last_major_version) ==
@@ -536,7 +536,7 @@
return false;
}
- base::Optional<base::Time> last_survey_started_time = util::ValueToTime(
+ absl::optional<base::Time> last_survey_started_time = util::ValueToTime(
pref_data->FindPath(GetLastSurveyStartedTime(trigger)));
if (last_survey_started_time.has_value()) {
base::TimeDelta elapsed_time_since_last_start =
@@ -552,7 +552,7 @@
// The time any survey was started will always be equal or more recent than
// the time a particular survey was started, so it is checked afterwards to
// improve UMA logging.
- base::Optional<base::Time> last_any_started_time =
+ absl::optional<base::Time> last_any_started_time =
util::ValueToTime(pref_data->FindPath(kAnyLastSurveyStartedTimePath));
if (last_any_started_time.has_value()) {
base::TimeDelta elapsed_time_any_started = now - *last_any_started_time;
@@ -567,7 +567,7 @@
// If an attempt to check with the HaTS servers whether a survey should be
// delivered was made too recently, another survey cannot be shown.
- base::Optional<base::Time> last_survey_check_time =
+ absl::optional<base::Time> last_survey_check_time =
util::ValueToTime(pref_data->FindPath(GetLastSurveyCheckTime(trigger)));
if (last_survey_check_time.has_value()) {
base::TimeDelta elapsed_time_since_last_check =
@@ -605,7 +605,7 @@
// duplicated checks since the survey won't change once it is full.
const base::DictionaryValue* pref_data =
profile_->GetPrefs()->GetDictionary(prefs::kHatsSurveyMetadata);
- base::Optional<int> is_full =
+ absl::optional<int> is_full =
pref_data->FindBoolPath(GetIsSurveyFull(trigger));
if (is_full.has_value() && is_full) {
std::move(failure_callback).Run();
diff --git a/chrome/browser/ui/hats/hats_service.h b/chrome/browser/ui/hats/hats_service.h
index 1f4619f..e56c35f3 100644
--- a/chrome/browser/ui/hats/hats_service.h
+++ b/chrome/browser/ui/hats/hats_service.h
@@ -14,10 +14,10 @@
#include "base/containers/flat_map.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/web_contents_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -63,8 +63,8 @@
SurveyConfig(
const base::Feature* feature,
const std::string& trigger,
- const base::Optional<std::string>& presupplied_trigger_id =
- base::nullopt,
+ const absl::optional<std::string>& presupplied_trigger_id =
+ absl::nullopt,
const std::vector<std::string>& product_specific_data_fields = {});
SurveyConfig();
SurveyConfig(const SurveyConfig&);
@@ -96,13 +96,13 @@
~SurveyMetadata();
// Trigger specific metadata.
- base::Optional<int> last_major_version;
- base::Optional<base::Time> last_survey_started_time;
- base::Optional<bool> is_survey_full;
- base::Optional<base::Time> last_survey_check_time;
+ absl::optional<int> last_major_version;
+ absl::optional<base::Time> last_survey_started_time;
+ absl::optional<bool> is_survey_full;
+ absl::optional<base::Time> last_survey_check_time;
// Metadata affecting all triggers.
- base::Optional<base::Time> any_last_survey_started_time;
+ absl::optional<base::Time> any_last_survey_started_time;
};
class DelayedSurveyTask : public content::WebContentsObserver {
diff --git a/chrome/browser/ui/hats/hats_service_browsertest.cc b/chrome/browser/ui/hats/hats_service_browsertest.cc
index 1611d0d..563245c5 100644
--- a/chrome/browser/ui/hats/hats_service_browsertest.cc
+++ b/chrome/browser/ui/hats/hats_service_browsertest.cc
@@ -6,7 +6,6 @@
#include "base/feature_list.h"
#include "base/macros.h"
#include "base/metrics/user_metrics.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
@@ -30,6 +29,7 @@
#include "components/version_info/version_info.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -94,7 +94,7 @@
}
private:
- base::Optional<ScopedSetMetricsConsent> scoped_metrics_consent_;
+ absl::optional<ScopedSetMetricsConsent> scoped_metrics_consent_;
base::test::ScopedFeatureList scoped_feature_list_;
diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog_browsertest.cc b/chrome/browser/ui/javascript_dialogs/javascript_dialog_browsertest.cc
index 30d0ad8..bd60687 100644
--- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_browsertest.cc
+++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_browsertest.cc
@@ -251,7 +251,7 @@
js_helper_->CancelDialogs(tab_, reset_state);
}
- base::Optional<DismissalCause> GetLastDismissalCause() {
+ absl::optional<DismissalCause> GetLastDismissalCause() {
return dismissal_cause_;
}
@@ -262,7 +262,7 @@
content::RenderFrameHost* frame_;
javascript_dialogs::TabModalDialogManager* js_helper_;
- base::Optional<DismissalCause> dismissal_cause_;
+ absl::optional<DismissalCause> dismissal_cause_;
base::WeakPtrFactory<JavaScriptDialogDismissalCauseTester> weak_factory_{
this};
@@ -354,7 +354,7 @@
JavaScriptDialogDismissalCauseTester tester(this);
tester.PopupDialog(content::JAVASCRIPT_DIALOG_TYPE_ALERT);
chrome::NewTab(browser());
- EXPECT_EQ(base::nullopt, tester.GetLastDismissalCause());
+ EXPECT_EQ(absl::nullopt, tester.GetLastDismissalCause());
}
IN_PROC_BROWSER_TEST_F(JavaScriptDialogTest, DismissalCauseUkm) {
diff --git a/chrome/browser/ui/login/login_handler.cc b/chrome/browser/ui/login/login_handler.cc
index 57a6eb0..24aada2 100644
--- a/chrome/browser/ui/login/login_handler.cc
+++ b/chrome/browser/ui/login/login_handler.cc
@@ -205,7 +205,7 @@
NotifyAuthCancelled();
CloseContents();
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
}
void LoginHandler::Observe(int type,
@@ -296,7 +296,7 @@
FROM_HERE,
base::BindOnce(&LoginHandler::MaybeSetUpLoginPromptBeforeCommit,
weak_factory_.GetWeakPtr(), request_url, request_id,
- is_main_frame, base::nullopt, false /* should_cancel */));
+ is_main_frame, absl::nullopt, false /* should_cancel */));
}
void LoginHandler::NotifyAuthNeeded() {
@@ -454,7 +454,7 @@
const GURL& request_url,
const content::GlobalRequestID& request_id,
bool is_request_for_main_frame,
- const base::Optional<net::AuthCredentials>& credentials,
+ const absl::optional<net::AuthCredentials>& credentials,
bool cancelled_by_extension) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
diff --git a/chrome/browser/ui/login/login_handler.h b/chrome/browser/ui/login/login_handler.h
index 8027df4..c4fc5a446 100644
--- a/chrome/browser/ui/login/login_handler.h
+++ b/chrome/browser/ui/login/login_handler.h
@@ -13,7 +13,6 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/synchronization/lock.h"
#include "components/password_manager/core/browser/http_auth_manager.h"
#include "components/password_manager/core/browser/password_form.h"
@@ -24,6 +23,7 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
#include "net/base/auth.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
@@ -187,7 +187,7 @@
const GURL& request_url,
const content::GlobalRequestID& request_id,
bool is_main_frame,
- const base::Optional<net::AuthCredentials>& credentials,
+ const absl::optional<net::AuthCredentials>& credentials,
bool cancelled_by_extension);
void ShowLoginPrompt(const GURL& request_url);
diff --git a/chrome/browser/ui/login/login_tab_helper.cc b/chrome/browser/ui/login/login_tab_helper.cc
index f7f8a1ef..10a0180d 100644
--- a/chrome/browser/ui/login/login_tab_helper.cc
+++ b/chrome/browser/ui/login/login_tab_helper.cc
@@ -217,7 +217,7 @@
: content::WebContentsObserver(web_contents) {}
void LoginTabHelper::HandleCredentials(
- const base::Optional<net::AuthCredentials>& credentials) {
+ const absl::optional<net::AuthCredentials>& credentials) {
login_handler_.reset();
url_for_login_handler_ = GURL();
diff --git a/chrome/browser/ui/login/login_tab_helper.h b/chrome/browser/ui/login/login_tab_helper.h
index d7a1872..336daf6 100644
--- a/chrome/browser/ui/login/login_tab_helper.h
+++ b/chrome/browser/ui/login/login_tab_helper.h
@@ -73,7 +73,7 @@
explicit LoginTabHelper(content::WebContents* web_contents);
void HandleCredentials(
- const base::Optional<net::AuthCredentials>& credentials);
+ const absl::optional<net::AuthCredentials>& credentials);
void RegisterExtensionCancelledNavigation(
const content::GlobalRequestID& request_id);
diff --git a/chrome/browser/ui/managed_ui.cc b/chrome/browser/ui/managed_ui.cc
index ac4e476..dfde562 100644
--- a/chrome/browser/ui/managed_ui.cc
+++ b/chrome/browser/ui/managed_ui.cc
@@ -53,12 +53,12 @@
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
}
-base::Optional<std::string> GetEnterpriseAccountDomain(Profile* profile) {
+absl::optional<std::string> GetEnterpriseAccountDomain(Profile* profile) {
const std::string domain =
enterprise_util::GetDomainFromEmail(profile->GetProfileUserName());
// Heuristic for most common consumer Google domains -- these are not managed.
if (domain.empty() || domain == "gmail.com" || domain == "googlemail.com")
- return base::nullopt;
+ return absl::nullopt;
return domain;
}
@@ -79,7 +79,7 @@
}
std::u16string GetManagedUiMenuItemLabel(Profile* profile) {
- base::Optional<std::string> account_manager =
+ absl::optional<std::string> account_manager =
GetAccountManagerIdentity(profile);
int string_id = IDS_MANAGED;
@@ -93,7 +93,7 @@
}
std::u16string GetManagedUiWebUILabel(Profile* profile) {
- base::Optional<std::string> account_manager =
+ absl::optional<std::string> account_manager =
GetAccountManagerIdentity(profile);
int string_id = IDS_MANAGED_WITH_HYPERLINK;
@@ -114,7 +114,7 @@
replacements.push_back(base::UTF8ToUTF16(chrome::kChromeUIManagementURL));
replacements.push_back(ui::GetChromeOSDeviceName());
- const base::Optional<std::string> device_manager = GetDeviceManagerIdentity();
+ const absl::optional<std::string> device_manager = GetDeviceManagerIdentity();
if (device_manager && !device_manager->empty()) {
string_id = IDS_DEVICE_MANAGED_BY_WITH_HYPERLINK;
replacements.push_back(base::UTF8ToUTF16(*device_manager));
@@ -124,9 +124,9 @@
}
#endif
-base::Optional<std::string> GetDeviceManagerIdentity() {
+absl::optional<std::string> GetDeviceManagerIdentity() {
if (!policy::PlatformManagementService::GetInstance().IsManaged())
- return base::nullopt;
+ return absl::nullopt;
#if BUILDFLAG(IS_CHROMEOS_ASH)
policy::BrowserPolicyConnectorChromeOS* connector =
@@ -140,12 +140,12 @@
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
}
-base::Optional<std::string> GetAccountManagerIdentity(Profile* profile) {
+absl::optional<std::string> GetAccountManagerIdentity(Profile* profile) {
// TODO(crbug.com/1188594): Replace the check with
// !policy::BrowserManagementService(profile).IsManaged() once this bug is
// fixed (it still needs a lot of test fixture changes).
if (!profile->GetProfilePolicyConnector()->IsManaged())
- return base::nullopt;
+ return absl::nullopt;
const std::string managed_by =
GetManagedBy(GetUserCloudPolicyManager(profile));
diff --git a/chrome/browser/ui/managed_ui.h b/chrome/browser/ui/managed_ui.h
index 6813850d..e17695c 100644
--- a/chrome/browser/ui/managed_ui.h
+++ b/chrome/browser/ui/managed_ui.h
@@ -7,8 +7,8 @@
#include <string>
-#include "base/optional.h"
#include "build/chromeos_buildflags.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -42,7 +42,7 @@
// Returns nullopt if the device is not managed, the UTF8-encoded string
// representation of the manager identity if available and an empty string if
// the device is managed but the manager is not known.
-base::Optional<std::string> GetDeviceManagerIdentity();
+absl::optional<std::string> GetDeviceManagerIdentity();
// Returns the UTF8-encoded string representation of the the entity that manages
// `profile` or nullopt if unmanaged. For standard dasher domains, this will be
@@ -51,7 +51,7 @@
// information, this function defaults to the domain of the account.
// TODO(crbug.com/1081272): Refactor localization hints for all strings that
// depend on this function.
-base::Optional<std::string> GetAccountManagerIdentity(Profile* profile);
+absl::optional<std::string> GetAccountManagerIdentity(Profile* profile);
} // namespace chrome
diff --git a/chrome/browser/ui/manifest_web_app_browser_controller.cc b/chrome/browser/ui/manifest_web_app_browser_controller.cc
index 4f8ec588..cc94834 100644
--- a/chrome/browser/ui/manifest_web_app_browser_controller.cc
+++ b/chrome/browser/ui/manifest_web_app_browser_controller.cc
@@ -19,7 +19,7 @@
ManifestWebAppBrowserController::ManifestWebAppBrowserController(
Browser* browser)
- : AppBrowserController(browser, /*app_id=*/base::nullopt) {}
+ : AppBrowserController(browser, /*app_id=*/absl::nullopt) {}
ManifestWebAppBrowserController::~ManifestWebAppBrowserController() = default;
diff --git a/chrome/browser/ui/manifest_web_app_browser_controller.h b/chrome/browser/ui/manifest_web_app_browser_controller.h
index 85740c2..8cc0471 100644
--- a/chrome/browser/ui/manifest_web_app_browser_controller.h
+++ b/chrome/browser/ui/manifest_web_app_browser_controller.h
@@ -9,11 +9,11 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "content/public/browser/web_contents_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
class Browser;
diff --git a/chrome/browser/ui/media_router/cast_dialog_model.cc b/chrome/browser/ui/media_router/cast_dialog_model.cc
index 0453d17..a98eab140 100644
--- a/chrome/browser/ui/media_router/cast_dialog_model.cc
+++ b/chrome/browser/ui/media_router/cast_dialog_model.cc
@@ -12,12 +12,12 @@
CastDialogModel::~CastDialogModel() = default;
-base::Optional<size_t> CastDialogModel::GetFirstActiveSinkIndex() const {
+absl::optional<size_t> CastDialogModel::GetFirstActiveSinkIndex() const {
for (size_t i = 0; i < media_sinks_.size(); i++) {
if (!media_sinks_.at(i).route)
return i;
}
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace media_router
diff --git a/chrome/browser/ui/media_router/cast_dialog_model.h b/chrome/browser/ui/media_router/cast_dialog_model.h
index a9974884..a123bb0 100644
--- a/chrome/browser/ui/media_router/cast_dialog_model.h
+++ b/chrome/browser/ui/media_router/cast_dialog_model.h
@@ -7,8 +7,8 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/ui/media_router/ui_media_sink.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media_router {
@@ -21,7 +21,7 @@
// Returns the index of the first sink with an active route, or nullopt if
// there is no such sink.
- base::Optional<size_t> GetFirstActiveSinkIndex() const;
+ absl::optional<size_t> GetFirstActiveSinkIndex() const;
void set_dialog_header(const std::u16string& dialog_header) {
dialog_header_ = dialog_header;
diff --git a/chrome/browser/ui/media_router/media_router_file_dialog.h b/chrome/browser/ui/media_router/media_router_file_dialog.h
index 61d20e1..020c3dc 100644
--- a/chrome/browser/ui/media_router/media_router_file_dialog.h
+++ b/chrome/browser/ui/media_router/media_router_file_dialog.h
@@ -128,7 +128,7 @@
void* params) override;
void FileSelectionCanceled(void* params) override;
- // Returns a reason for failure if the file is not valid, or base::nullopt if
+ // Returns a reason for failure if the file is not valid, or absl::nullopt if
// it passes validation. Has to be run on seperate thread.
ValidationResult ValidateFile(const ui::SelectedFileInfo& file_info);
@@ -148,7 +148,7 @@
scoped_refptr<base::TaskRunner> task_runner_;
// Pointer to the file last indicated by the system.
- base::Optional<ui::SelectedFileInfo> selected_file_;
+ absl::optional<ui::SelectedFileInfo> selected_file_;
// The object which all file system calls go through.
std::unique_ptr<FileSystemDelegate> file_system_delegate_;
diff --git a/chrome/browser/ui/media_router/media_router_ui.cc b/chrome/browser/ui/media_router/media_router_ui.cc
index 4305c7a8..811645f 100644
--- a/chrome/browser/ui/media_router/media_router_ui.cc
+++ b/chrome/browser/ui/media_router/media_router_ui.cc
@@ -400,7 +400,7 @@
// necessary.
content::WebContents* tab_contents = initiator_;
- base::Optional<RouteParameters> params;
+ absl::optional<RouteParameters> params;
if (cast_mode == MediaCastMode::LOCAL_FILE) {
GURL url = media_router_file_dialog_->GetLastSelectedFileUrl();
tab_contents = OpenTabWithUrl(url);
@@ -699,7 +699,7 @@
observer.OnModelUpdated(model_);
}
-base::Optional<RouteParameters> MediaRouterUI::GetRouteParameters(
+absl::optional<RouteParameters> MediaRouterUI::GetRouteParameters(
const MediaSink::Id& sink_id,
MediaCastMode cast_mode) {
DCHECK(query_result_manager_);
@@ -720,7 +720,7 @@
base::StringPrintf("No corresponding MediaSource for cast mode %d.",
static_cast<int>(cast_mode)),
sink_id, "", "");
- return base::nullopt;
+ return absl::nullopt;
}
params.source_id = source->id();
@@ -730,10 +730,10 @@
"Requested to create a route for presentation, but "
"presentation request is missing.",
sink_id, source->id(), "");
- return base::nullopt;
+ return absl::nullopt;
}
- current_route_request_ = base::make_optional<RouteRequest>(sink_id);
+ current_route_request_ = absl::make_optional<RouteRequest>(sink_id);
params.origin = for_presentation_source ? presentation_request_->frame_origin
: url::Origin::Create(GURL());
@@ -778,7 +778,7 @@
params.timeout = GetRouteRequestTimeout(cast_mode);
params.off_the_record = initiator_->GetBrowserContext()->IsOffTheRecord();
- return base::make_optional(std::move(params));
+ return absl::make_optional(std::move(params));
}
GURL MediaRouterUI::GetFrameURL() const {
@@ -871,7 +871,7 @@
}
void MediaRouterUI::OnIssueCleared() {
- issue_ = base::nullopt;
+ issue_ = absl::nullopt;
UpdateSinks();
}
@@ -963,7 +963,7 @@
UIMediaSink MediaRouterUI::ConvertToUISink(const MediaSinkWithCastModes& sink,
const MediaRoute* route,
- const base::Optional<Issue>& issue) {
+ const absl::optional<Issue>& issue) {
UIMediaSink ui_sink;
ui_sink.id = sink.sink.id();
ui_sink.friendly_name = GetSinkFriendlyName(sink.sink);
@@ -1003,7 +1003,7 @@
std::move(file_selection_callback_).Run(nullptr);
}
-base::Optional<RouteParameters> MediaRouterUI::GetLocalFileRouteParameters(
+absl::optional<RouteParameters> MediaRouterUI::GetLocalFileRouteParameters(
const MediaSink::Id& sink_id,
const GURL& file_url,
content::WebContents* tab_contents) {
@@ -1033,7 +1033,7 @@
CHECK(initiator_);
params.off_the_record = initiator_->GetBrowserContext()->IsOffTheRecord();
- return base::make_optional(std::move(params));
+ return absl::make_optional(std::move(params));
}
// TODO(crbug.com/792547): Refactor FullScreenFirstVideoElement() and
diff --git a/chrome/browser/ui/media_router/media_router_ui.h b/chrome/browser/ui/media_router/media_router_ui.h
index 2606f687..4d6cc6f3 100644
--- a/chrome/browser/ui/media_router/media_router_ui.h
+++ b/chrome/browser/ui/media_router/media_router_ui.h
@@ -233,7 +233,7 @@
void UpdateSinks();
// Populates common route-related parameters for calls to MediaRouter.
- base::Optional<RouteParameters> GetRouteParameters(
+ absl::optional<RouteParameters> GetRouteParameters(
const MediaSink::Id& sink_id,
MediaCastMode cast_mode);
@@ -293,7 +293,7 @@
UIMediaSink ConvertToUISink(const MediaSinkWithCastModes& sink,
const MediaRoute* route,
- const base::Optional<Issue>& issue);
+ const absl::optional<Issue>& issue);
// MediaRouterFileDialogDelegate:
void FileDialogFileSelected(const ui::SelectedFileInfo& file_info) override;
@@ -302,7 +302,7 @@
// Populates route-related parameters for CreateRoute() when doing file
// casting.
- base::Optional<RouteParameters> GetLocalFileRouteParameters(
+ absl::optional<RouteParameters> GetLocalFileRouteParameters(
const MediaSink::Id& sink_id,
const GURL& file_url,
content::WebContents* tab_contents);
@@ -326,7 +326,7 @@
// Retrieves the browser associated with this UI.
Browser* GetBrowser();
- const base::Optional<RouteRequest> current_route_request() const {
+ const absl::optional<RouteRequest> current_route_request() const {
return current_route_request_;
}
@@ -351,18 +351,18 @@
content::WebContentsObserver* web_contents_observer_for_test_ = nullptr;
// This value is set whenever there is an outstanding issue.
- base::Optional<Issue> issue_;
+ absl::optional<Issue> issue_;
// Contains up-to-date data to show in the dialog.
CastDialogModel model_;
// This value is set when the user opens a file picker, and used when a file
// is selected and casting starts.
- base::Optional<MediaSink::Id> local_file_sink_id_;
+ absl::optional<MediaSink::Id> local_file_sink_id_;
// This value is set when the UI requests a route to be terminated, and gets
// reset when the route is removed.
- base::Optional<MediaRoute::Id> terminating_route_id_;
+ absl::optional<MediaRoute::Id> terminating_route_id_;
// Observers for dialog model updates.
// TODO(takumif): CastDialogModel should manage the observers.
@@ -376,7 +376,7 @@
std::unique_ptr<MediaRoutesObserver> routes_observer_;
// This contains a value only when tracking a pending route request.
- base::Optional<RouteRequest> current_route_request_;
+ absl::optional<RouteRequest> current_route_request_;
// Used for locale-aware sorting of sinks by name. Set during
// InitCommon() using the current locale.
@@ -394,7 +394,7 @@
// Set to the presentation request corresponding to the presentation cast
// mode, if supported. Otherwise set to nullopt.
- base::Optional<content::PresentationRequest> presentation_request_;
+ absl::optional<content::PresentationRequest> presentation_request_;
// |presentation_manager_| notifies |this| whenever there is an update to the
// default PresentationRequest or MediaRoutes associated with |initiator_|.
@@ -415,7 +415,7 @@
std::unique_ptr<WebContentsDisplayObserver> display_observer_;
#if defined(OS_MAC)
- base::Optional<bool> screen_capture_allowed_for_testing_;
+ absl::optional<bool> screen_capture_allowed_for_testing_;
#endif
LoggerImpl* logger_;
diff --git a/chrome/browser/ui/media_router/ui_media_sink.h b/chrome/browser/ui/media_router/ui_media_sink.h
index ca19cc9..a70ac902 100644
--- a/chrome/browser/ui/media_router/ui_media_sink.h
+++ b/chrome/browser/ui/media_router/ui_media_sink.h
@@ -54,7 +54,7 @@
GURL presentation_url;
// Active route associated with the sink.
- base::Optional<MediaRoute> route;
+ absl::optional<MediaRoute> route;
// The icon to use for the sink.
SinkIconType icon_type = SinkIconType::GENERIC;
@@ -67,7 +67,7 @@
// An issue the sink is having. This is a nullopt when there are no issues
// with the sink.
- base::Optional<Issue> issue;
+ absl::optional<Issue> issue;
// Set of Cast Modes (e.g. presentation, desktop mirroring) supported by the
// sink.
diff --git a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer_unittest.cc b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer_unittest.cc
index 6e54b2c..e2c87ac7 100644
--- a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer_unittest.cc
+++ b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer_unittest.cc
@@ -147,7 +147,7 @@
std::unique_ptr<content::NavigationEntry> entry =
content::NavigationController::CreateNavigationEntry(
- GURL(), content::Referrer(), base::nullopt,
+ GURL(), content::Referrer(), absl::nullopt,
ui::PAGE_TRANSITION_FROM_ADDRESS_BAR, false, std::string(), profile(),
nullptr /* blob_url_loader_factory */);
@@ -190,7 +190,7 @@
match, AutocompleteMatch());
auto navigation_entry =
content::NavigationController::CreateNavigationEntry(
- GURL(), content::Referrer(), base::nullopt,
+ GURL(), content::Referrer(), absl::nullopt,
ui::PAGE_TRANSITION_FROM_ADDRESS_BAR, false, std::string(),
profile(), nullptr /* blob_url_loader_factory */);
content::LoadCommittedDetails details;
@@ -209,7 +209,7 @@
AutocompleteMatch(),
AutocompleteMatch());
auto navigation_entry = content::NavigationController::CreateNavigationEntry(
- GURL(), content::Referrer(), base::nullopt,
+ GURL(), content::Referrer(), absl::nullopt,
ui::PAGE_TRANSITION_FROM_ADDRESS_BAR, false, std::string(), profile(),
nullptr /* blob_url_loader_factory */);
content::LoadCommittedDetails details;
@@ -334,7 +334,7 @@
// Send the observer NAV_ENTRY_PENDING to get the URL fetcher to start.
auto navigation_entry =
content::NavigationController::CreateNavigationEntry(
- GURL(), content::Referrer(), base::nullopt,
+ GURL(), content::Referrer(), absl::nullopt,
ui::PAGE_TRANSITION_FROM_ADDRESS_BAR, false, std::string(),
profile(), nullptr /* blob_url_loader_factory */);
content::NotificationService::current()->Notify(
diff --git a/chrome/browser/ui/passwords/bubble_controllers/move_to_account_store_bubble_controller.cc b/chrome/browser/ui/passwords/bubble_controllers/move_to_account_store_bubble_controller.cc
index 078c559..a8f6c18 100644
--- a/chrome/browser/ui/passwords/bubble_controllers/move_to_account_store_bubble_controller.cc
+++ b/chrome/browser/ui/passwords/bubble_controllers/move_to_account_store_bubble_controller.cc
@@ -85,7 +85,7 @@
IdentityManagerFactory::GetForProfile(GetProfile());
if (!identity_manager)
return gfx::Image();
- base::Optional<AccountInfo> primary_account_info =
+ absl::optional<AccountInfo> primary_account_info =
identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
identity_manager->GetPrimaryAccountInfo(
signin::ConsentLevel::kSignin));
diff --git a/chrome/browser/ui/passwords/bubble_controllers/save_update_bubble_controller.cc b/chrome/browser/ui/passwords/bubble_controllers/save_update_bubble_controller.cc
index c45075c..c04309a 100644
--- a/chrome/browser/ui/passwords/bubble_controllers/save_update_bubble_controller.cc
+++ b/chrome/browser/ui/passwords/bubble_controllers/save_update_bubble_controller.cc
@@ -275,8 +275,8 @@
if (state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) {
metrics_util::LogUpdateUIDismissalReason(dismissal_reason_);
} else if (state_ == password_manager::ui::PENDING_PASSWORD_STATE) {
- base::Optional<metrics_util::PasswordAccountStorageUserState> user_state =
- base::nullopt;
+ absl::optional<metrics_util::PasswordAccountStorageUserState> user_state =
+ absl::nullopt;
Profile* profile = GetProfile();
if (profile) {
user_state = password_manager::features_util::
diff --git a/chrome/browser/ui/passwords/bubble_controllers/save_update_with_account_store_bubble_controller.cc b/chrome/browser/ui/passwords/bubble_controllers/save_update_with_account_store_bubble_controller.cc
index bdf97357..d0d907c1 100644
--- a/chrome/browser/ui/passwords/bubble_controllers/save_update_with_account_store_bubble_controller.cc
+++ b/chrome/browser/ui/passwords/bubble_controllers/save_update_with_account_store_bubble_controller.cc
@@ -284,7 +284,7 @@
IdentityManagerFactory::GetForProfile(profile);
if (!identity_manager)
return ui::ImageModel();
- base::Optional<AccountInfo> primary_account_info =
+ absl::optional<AccountInfo> primary_account_info =
identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
identity_manager->GetPrimaryAccountInfo(
signin::ConsentLevel::kSignin));
@@ -343,8 +343,8 @@
if (state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) {
metrics_util::LogUpdateUIDismissalReason(dismissal_reason_);
} else if (state_ == password_manager::ui::PENDING_PASSWORD_STATE) {
- base::Optional<metrics_util::PasswordAccountStorageUserState> user_state =
- base::nullopt;
+ absl::optional<metrics_util::PasswordAccountStorageUserState> user_state =
+ absl::nullopt;
Profile* profile = GetProfile();
if (profile) {
user_state = password_manager::features_util::
diff --git a/chrome/browser/ui/passwords/settings/password_manager_presenter.cc b/chrome/browser/ui/passwords/settings/password_manager_presenter.cc
index ac937a8..dbb67b7 100644
--- a/chrome/browser/ui/passwords/settings/password_manager_presenter.cc
+++ b/chrome/browser/ui/passwords/settings/password_manager_presenter.cc
@@ -417,10 +417,10 @@
void PasswordManagerPresenter::RequestPlaintextPassword(
const std::string& sort_key,
password_manager::PlaintextReason reason,
- base::OnceCallback<void(base::Optional<std::u16string>)> callback) const {
+ base::OnceCallback<void(absl::optional<std::u16string>)> callback) const {
auto it = password_map_.find(sort_key);
if (it == password_map_.end()) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
diff --git a/chrome/browser/ui/passwords/settings/password_manager_presenter.h b/chrome/browser/ui/passwords/settings/password_manager_presenter.h
index 9685cad..cf7b08201 100644
--- a/chrome/browser/ui/passwords/settings/password_manager_presenter.h
+++ b/chrome/browser/ui/passwords/settings/password_manager_presenter.h
@@ -15,7 +15,6 @@
#include "base/callback_forward.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "components/password_manager/core/browser/form_fetcher.h"
#include "components/password_manager/core/browser/password_store.h"
@@ -24,6 +23,7 @@
#include "components/password_manager/core/browser/ui/plaintext_reason.h"
#include "components/prefs/pref_member.h"
#include "components/undo/undo_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/shell_dialogs/select_file_dialog.h"
namespace password_manager {
@@ -113,7 +113,7 @@
void RequestPlaintextPassword(
const std::string& sort_key,
password_manager::PlaintextReason reason,
- base::OnceCallback<void(base::Optional<std::u16string>)> callback) const;
+ base::OnceCallback<void(absl::optional<std::u16string>)> callback) const;
#endif
// Wrapper around |PasswordStore::AddLogin| that adds the corresponding undo
diff --git a/chrome/browser/ui/passwords/settings/password_manager_presenter_unittest.cc b/chrome/browser/ui/passwords/settings/password_manager_presenter_unittest.cc
index 2fb06b99..4a00ebed 100644
--- a/chrome/browser/ui/passwords/settings/password_manager_presenter_unittest.cc
+++ b/chrome/browser/ui/passwords/settings/password_manager_presenter_unittest.cc
@@ -349,7 +349,7 @@
EXPECT_CALL(GetUIController(), SetPasswordList(SizeIs(1)));
EXPECT_CALL(GetUIController(), SetPasswordExceptionList(IsEmpty()));
UpdatePasswordLists();
- base::MockOnceCallback<void(base::Optional<std::u16string>)>
+ base::MockOnceCallback<void(absl::optional<std::u16string>)>
password_callback;
EXPECT_CALL(password_callback, Run(testing::Eq(kPassword16)));
std::string sort_key = password_manager::CreateSortKey(form);
@@ -370,7 +370,7 @@
EXPECT_CALL(GetUIController(), SetPasswordList(SizeIs(1)));
EXPECT_CALL(GetUIController(), SetPasswordExceptionList(IsEmpty()));
UpdatePasswordLists();
- base::MockOnceCallback<void(base::Optional<std::u16string>)>
+ base::MockOnceCallback<void(absl::optional<std::u16string>)>
password_callback;
EXPECT_CALL(password_callback, Run(testing::Eq(kPassword16)));
std::string sort_key = password_manager::CreateSortKey(form);
diff --git a/chrome/browser/ui/passwords/well_known_change_password_navigation_throttle_browsertest.cc b/chrome/browser/ui/passwords/well_known_change_password_navigation_throttle_browsertest.cc
index 99b6cddc..e64e605 100644
--- a/chrome/browser/ui/passwords/well_known_change_password_navigation_throttle_browsertest.cc
+++ b/chrome/browser/ui/passwords/well_known_change_password_navigation_throttle_browsertest.cc
@@ -7,7 +7,6 @@
#include <map>
#include <utility>
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
@@ -45,6 +44,7 @@
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -132,7 +132,7 @@
void TestNavigationThrottle(
const GURL& navigate_url,
const GURL& expected_url,
- base::Optional<url::Origin> initiator_origin = base::nullopt);
+ absl::optional<url::Origin> initiator_origin = absl::nullopt);
// Whitelist all https certs for the |test_server_|.
void AddHttpsCertificate() {
@@ -179,7 +179,7 @@
void ChangePasswordNavigationThrottleBrowserTestBase::TestNavigationThrottle(
const GURL& navigate_url,
const GURL& expected_url,
- base::Optional<url::Origin> initiator_origin) {
+ absl::optional<url::Origin> initiator_origin) {
AddHttpsCertificate();
NavigateParams params(browser(), navigate_url, page_transition());
diff --git a/chrome/browser/ui/passwords/well_known_change_password_navigation_throttle_unittest.cc b/chrome/browser/ui/passwords/well_known_change_password_navigation_throttle_unittest.cc
index 90d0706..c6f4644 100644
--- a/chrome/browser/ui/passwords/well_known_change_password_navigation_throttle_unittest.cc
+++ b/chrome/browser/ui/passwords/well_known_change_password_navigation_throttle_unittest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "chrome/browser/ui/passwords/well_known_change_password_navigation_throttle.h"
-#include "base/optional.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/render_frame_host.h"
@@ -11,6 +10,7 @@
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_renderer_host.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -22,7 +22,7 @@
GURL url;
content::RenderFrameHost* rfh = nullptr;
ui::PageTransition page_transition = ui::PAGE_TRANSITION_FROM_API;
- base::Optional<url::Origin> initiator_origin;
+ absl::optional<url::Origin> initiator_origin;
};
} // namespace
diff --git a/chrome/browser/ui/search/ntp_user_data_logger.cc b/chrome/browser/ui/search/ntp_user_data_logger.cc
index bc38204..9612e47 100644
--- a/chrome/browser/ui/search/ntp_user_data_logger.cc
+++ b/chrome/browser/ui/search/ntp_user_data_logger.cc
@@ -478,7 +478,7 @@
bool has_server_side_suggestions = false;
int tiles_count = 0;
- for (const base::Optional<ntp_tiles::NTPTileImpression>& impression :
+ for (const absl::optional<ntp_tiles::NTPTileImpression>& impression :
logged_impressions_) {
if (!impression.has_value()) {
break;
diff --git a/chrome/browser/ui/search/ntp_user_data_logger.h b/chrome/browser/ui/search/ntp_user_data_logger.h
index 9501278..4245fbb0 100644
--- a/chrome/browser/ui/search/ntp_user_data_logger.h
+++ b/chrome/browser/ui/search/ntp_user_data_logger.h
@@ -10,13 +10,13 @@
#include <array>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/search/ntp_logging_events.h"
#include "components/ntp_tiles/constants.h"
#include "components/ntp_tiles/ntp_tile_impression.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if defined(OS_ANDROID)
#error "Instant is only used on desktop";
@@ -92,7 +92,7 @@
// sources, such as signing in (switching from client to server tiles), then
// only the impressions for the first source will be logged, leaving the
// number of impressions for a source slightly out-of-sync with navigations.
- std::array<base::Optional<ntp_tiles::NTPTileImpression>,
+ std::array<absl::optional<ntp_tiles::NTPTileImpression>,
ntp_tiles::kMaxNumTiles>
logged_impressions_;
diff --git a/chrome/browser/ui/serial/serial_chooser_controller_unittest.cc b/chrome/browser/ui/serial/serial_chooser_controller_unittest.cc
index 9be8eb2..771a4f33 100644
--- a/chrome/browser/ui/serial/serial_chooser_controller_unittest.cc
+++ b/chrome/browser/ui/serial/serial_chooser_controller_unittest.cc
@@ -53,8 +53,8 @@
base::UnguessableToken AddPort(
const std::string& display_name,
const base::FilePath& path,
- base::Optional<uint16_t> vendor_id = base::nullopt,
- base::Optional<uint16_t> product_id = base::nullopt) {
+ absl::optional<uint16_t> vendor_id = absl::nullopt,
+ absl::optional<uint16_t> product_id = absl::nullopt) {
auto port = device::mojom::SerialPortInfo::New();
port->token = base::UnguessableToken::Create();
port->display_name = display_name;
diff --git a/chrome/browser/ui/settings_window_manager_chromeos.cc b/chrome/browser/ui/settings_window_manager_chromeos.cc
index 68771e6e..19e0325 100644
--- a/chrome/browser/ui/settings_window_manager_chromeos.cc
+++ b/chrome/browser/ui/settings_window_manager_chromeos.cc
@@ -179,7 +179,7 @@
// TODO(calamity): Determine whether, during startup, we need to wait for
// app install and then provide a valid answer here.
- base::Optional<std::string> settings_app_id =
+ absl::optional<std::string> settings_app_id =
web_app::GetAppIdForSystemWebApp(profile,
web_app::SystemAppType::SETTINGS);
return settings_app_id &&
diff --git a/chrome/browser/ui/signin/profile_colors_util.cc b/chrome/browser/ui/signin/profile_colors_util.cc
index d46dc04..a8aba30 100644
--- a/chrome/browser/ui/signin/profile_colors_util.cc
+++ b/chrome/browser/ui/signin/profile_colors_util.cc
@@ -53,7 +53,7 @@
std::vector<int> GetAvailableColorIndices(
const std::set<ProfileThemeColors>& used_theme_colors,
- base::Optional<double> current_color_lightness) {
+ absl::optional<double> current_color_lightness) {
std::vector<int> available_color_indices;
for (size_t i = 0; i < base::size(chrome_colors::kGeneratedColorsInfo); ++i) {
ProfileThemeColors theme_colors =
@@ -170,7 +170,7 @@
// needed.
std::set<ProfileThemeColors> used_theme_colors;
for (ProfileAttributesEntry* entry : storage.GetAllProfilesAttributes()) {
- base::Optional<ProfileThemeColors> current_colors =
+ absl::optional<ProfileThemeColors> current_colors =
entry->GetProfileThemeColorsIfSet();
if (current_colors)
used_theme_colors.insert(*current_colors);
@@ -185,13 +185,13 @@
// Relax the constraints until some colors become available.
if (available_color_indices.empty()) {
available_color_indices =
- GetAvailableColorIndices(used_theme_colors, base::nullopt);
+ GetAvailableColorIndices(used_theme_colors, absl::nullopt);
}
if (available_color_indices.empty()) {
// If needed, we could allow unsaturated colors (shades of grey) before
// allowing a duplicate color.
available_color_indices =
- GetAvailableColorIndices(std::set<ProfileThemeColors>(), base::nullopt);
+ GetAvailableColorIndices(std::set<ProfileThemeColors>(), absl::nullopt);
}
DCHECK(!available_color_indices.empty());
diff --git a/chrome/browser/ui/signin/profile_colors_util_unittest.cc b/chrome/browser/ui/signin/profile_colors_util_unittest.cc
index 84b5270..7442345 100644
--- a/chrome/browser/ui/signin/profile_colors_util_unittest.cc
+++ b/chrome/browser/ui/signin/profile_colors_util_unittest.cc
@@ -74,7 +74,7 @@
protected:
void SetUp() override { ASSERT_TRUE(testing_profile_manager_.SetUp()); }
- ProfileAttributesEntry* AddProfile(base::Optional<SkColor> color) {
+ ProfileAttributesEntry* AddProfile(absl::optional<SkColor> color) {
size_t number_of_profiles = storage()->GetNumberOfProfiles();
base::FilePath profile_path =
@@ -221,8 +221,8 @@
ExpectAllSaturatedColorsMatchingColorSchemeAvailable(should_use_dark_colors);
// Add some profiles with the default theme.
- AddProfile(base::nullopt);
- AddProfile(base::nullopt);
+ AddProfile(absl::nullopt);
+ AddProfile(absl::nullopt);
// Add a profile with a custom color.
AddProfile(SK_ColorRED);
diff --git a/chrome/browser/ui/signin_reauth_view_controller.cc b/chrome/browser/ui/signin_reauth_view_controller.cc
index 8488f37..3cdf0f4 100644
--- a/chrome/browser/ui/signin_reauth_view_controller.cc
+++ b/chrome/browser/ui/signin_reauth_view_controller.cc
@@ -10,7 +10,6 @@
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/task_runner.h"
#include "base/time/time.h"
#include "chrome/browser/consent_auditor/consent_auditor_factory.h"
@@ -29,6 +28,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "google_apis/gaia/gaia_urls.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -177,7 +177,7 @@
if (ui_state_ == UIState::kGaiaReauthDialog ||
ui_state_ == UIState::kGaiaReauthTab) {
- base::Optional<UserAction> action;
+ absl::optional<UserAction> action;
if (gaia_reauth_page_result_ == signin::ReauthResult::kSuccess) {
action = UserAction::kPassGaiaReauth;
}
diff --git a/chrome/browser/ui/signin_reauth_view_controller.h b/chrome/browser/ui/signin_reauth_view_controller.h
index 9a6fb84..f610c55d 100644
--- a/chrome/browser/ui/signin_reauth_view_controller.h
+++ b/chrome/browser/ui/signin_reauth_view_controller.h
@@ -8,13 +8,13 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list_types.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "chrome/browser/ui/signin_view_controller_delegate.h"
#include "components/signin/public/base/signin_metrics.h"
#include "components/sync/protocol/user_consent_types.pb.h"
#include "google_apis/gaia/core_account_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Browser;
@@ -201,9 +201,9 @@
// The state of the reauth flow.
bool user_confirmed_reauth_ = false;
- base::Optional<sync_pb::UserConsentTypes::AccountPasswordsConsent> consent_;
+ absl::optional<sync_pb::UserConsentTypes::AccountPasswordsConsent> consent_;
GaiaReauthPageState gaia_reauth_page_state_ = GaiaReauthPageState::kStarted;
- base::Optional<signin::ReauthResult> gaia_reauth_page_result_;
+ absl::optional<signin::ReauthResult> gaia_reauth_page_result_;
base::ObserverList<Observer, true> observer_list_;
diff --git a/chrome/browser/ui/signin_reauth_view_controller_browsertest.cc b/chrome/browser/ui/signin_reauth_view_controller_browsertest.cc
index 3e665fe..22086b0 100644
--- a/chrome/browser/ui/signin_reauth_view_controller_browsertest.cc
+++ b/chrome/browser/ui/signin_reauth_view_controller_browsertest.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
@@ -40,6 +39,7 @@
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_response.h"
#include "net/test/embedded_test_server/request_handler_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/ui_base_switches.h"
using ::testing::ElementsAre;
@@ -202,7 +202,7 @@
reauth_result_loop_->Quit();
}
- base::Optional<signin::ReauthResult> WaitForReauthResult() {
+ absl::optional<signin::ReauthResult> WaitForReauthResult() {
reauth_result_loop_->Run();
return reauth_result_;
}
@@ -242,7 +242,7 @@
std::unique_ptr<SigninViewController::ReauthAbortHandle> abort_handle_;
std::unique_ptr<base::RunLoop> reauth_result_loop_;
- base::Optional<signin::ReauthResult> reauth_result_;
+ absl::optional<signin::ReauthResult> reauth_result_;
};
// Tests that the abort handle cancels an ongoing reauth flow.
diff --git a/chrome/browser/ui/signin_view_controller_interactive_uitest.cc b/chrome/browser/ui/signin_view_controller_interactive_uitest.cc
index fa39b9ca..0caf9dbb 100644
--- a/chrome/browser/ui/signin_view_controller_interactive_uitest.cc
+++ b/chrome/browser/ui/signin_view_controller_interactive_uitest.cc
@@ -5,7 +5,6 @@
#include <utility>
#include "base/callback.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "build/build_config.h"
@@ -32,6 +31,7 @@
#include "content/public/test/test_utils.h"
#include "google_apis/gaia/core_account_id.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/events/keycodes/keyboard_codes.h"
namespace {
@@ -53,7 +53,7 @@
}
base::RunLoop run_loop_;
- base::Optional<LoginUIService::SyncConfirmationUIClosedResult> result_;
+ absl::optional<LoginUIService::SyncConfirmationUIClosedResult> result_;
};
class SigninDialogClosedObserver
diff --git a/chrome/browser/ui/startup/launch_mode_recorder.cc b/chrome/browser/ui/startup/launch_mode_recorder.cc
index 2530e34..dfd0a1b8 100644
--- a/chrome/browser/ui/startup/launch_mode_recorder.cc
+++ b/chrome/browser/ui/startup/launch_mode_recorder.cc
@@ -40,12 +40,12 @@
#if defined(OS_WIN)
// Returns the path to the shortcut from which Chrome was launched, or null if
// not launched via a shortcut.
-base::Optional<const wchar_t*> GetShortcutPath() {
+absl::optional<const wchar_t*> GetShortcutPath() {
STARTUPINFOW si = {sizeof(si)};
GetStartupInfoW(&si);
if (!(si.dwFlags & STARTF_TITLEISLINKNAME))
- return base::nullopt;
- return base::Optional<const wchar_t*>(si.lpTitle);
+ return absl::nullopt;
+ return absl::optional<const wchar_t*>(si.lpTitle);
}
LaunchMode GetLaunchModeFast() {
diff --git a/chrome/browser/ui/startup/launch_mode_recorder.h b/chrome/browser/ui/startup/launch_mode_recorder.h
index 372d016b..789ea94 100644
--- a/chrome/browser/ui/startup/launch_mode_recorder.h
+++ b/chrome/browser/ui/startup/launch_mode_recorder.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_STARTUP_LAUNCH_MODE_RECORDER_H_
#define CHROME_BROWSER_UI_STARTUP_LAUNCH_MODE_RECORDER_H_
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// This enum is used to define the buckets for an enumerated UMA histogram.
// Hence,
@@ -54,7 +54,7 @@
void SetLaunchMode(LaunchMode mode);
private:
- base::Optional<LaunchMode> mode_;
+ absl::optional<LaunchMode> mode_;
};
#endif // CHROME_BROWSER_UI_STARTUP_LAUNCH_MODE_RECORDER_H_
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc
index 0142645..559ed878 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -24,7 +24,6 @@
#include "base/metrics/histogram_base.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/statistics_recorder.h"
-#include "base/optional.h"
#include "base/scoped_multi_source_observation.h"
#include "base/strings/string_tokenizer.h"
#include "base/task/thread_pool.h"
@@ -83,6 +82,7 @@
#include "content/public/common/content_switches.h"
#include "extensions/common/switches.h"
#include "printing/buildflags/buildflags.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_switches.h"
@@ -469,7 +469,7 @@
->BrowserAppLauncher()
->LaunchAppWithCallback(
app_id, command_line, cur_dir,
- /*url_handler_launch_url=*/base::nullopt, protocol_url,
+ /*url_handler_launch_url=*/absl::nullopt, protocol_url,
base::BindOnce(&FinalizeWebAppLaunch,
std::move(launch_mode_recorder)));
} // else allow the process to exit without opening a browser.
@@ -524,8 +524,8 @@
->BrowserAppLauncher()
->LaunchAppWithCallback(
app_id, command_line, cur_dir,
- /*url_handler_launch_url=*/base::nullopt,
- /*protocol_handler_launch_url=*/base::nullopt,
+ /*url_handler_launch_url=*/absl::nullopt,
+ /*protocol_handler_launch_url=*/absl::nullopt,
base::BindOnce(&FinalizeWebAppLaunch,
std::move(launch_mode_recorder)));
return true;
@@ -591,7 +591,7 @@
->BrowserAppLauncher()
->LaunchAppWithCallback(
match.app_id, command_line, cur_dir, match.url,
- /*protocol_handler_launch_url=*/base::nullopt,
+ /*protocol_handler_launch_url=*/absl::nullopt,
base::BindOnce(&FinalizeWebAppLaunch,
std::move(launch_mode_recorder)));
return true;
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
index c29d1a2..e8d8cd5 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -195,7 +195,7 @@
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
-typedef base::Optional<policy::PolicyLevel> PolicyVariant;
+typedef absl::optional<policy::PolicyLevel> PolicyVariant;
// This class waits until all browser windows are closed, and then runs
// a quit closure.
@@ -2486,9 +2486,9 @@
struct ProfilePickerSetup {
bool expected_to_show;
- base::Optional<std::string> switch_name;
- base::Optional<std::string> switch_value_ascii;
- base::Optional<GURL> url_arg;
+ absl::optional<std::string> switch_name;
+ absl::optional<std::string> switch_value_ascii;
+ absl::optional<GURL> url_arg;
bool session_restore = false;
};
@@ -2570,15 +2570,15 @@
// OS when Chrome is the default web browser) and use the last used
// profile, instead.
ProfilePickerSetup{/*expected_to_show=*/false,
- /*switch_name=*/base::nullopt,
- /*switch_value_ascii=*/base::nullopt,
+ /*switch_name=*/absl::nullopt,
+ /*switch_value_ascii=*/absl::nullopt,
/*url_arg=*/GURL("https://www.foo.com/")},
// Regression test for http://crbug.com/1166192
// Picker should be shown even in case of session restore.
ProfilePickerSetup{/*expected_to_show=*/true,
- /*switch_name=*/base::nullopt,
- /*switch_value_ascii=*/base::nullopt,
- /*url_arg=*/base::nullopt,
+ /*switch_name=*/absl::nullopt,
+ /*switch_value_ascii=*/absl::nullopt,
+ /*url_arg=*/absl::nullopt,
/*session_restore=*/true}));
class GuestStartupBrowserCreatorPickerTest
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl_unittest.cc b/chrome/browser/ui/startup/startup_browser_creator_impl_unittest.cc
index b1473f8..963329f 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_impl_unittest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_impl_unittest.cc
@@ -421,6 +421,6 @@
base::CommandLine(base::CommandLine::NO_PROGRAM)));
// Restore the global testing set up.
- crosapi::browser_util::SetLacrosPrimaryBrowserForTest(base::nullopt);
+ crosapi::browser_util::SetLacrosPrimaryBrowserForTest(absl::nullopt);
#endif
}
diff --git a/chrome/browser/ui/tab_contents/chrome_web_contents_menu_helper_unittest.cc b/chrome/browser/ui/tab_contents/chrome_web_contents_menu_helper_unittest.cc
index 20e4ed1..7e84dbc 100644
--- a/chrome/browser/ui/tab_contents/chrome_web_contents_menu_helper_unittest.cc
+++ b/chrome/browser/ui/tab_contents/chrome_web_contents_menu_helper_unittest.cc
@@ -31,7 +31,7 @@
return profile_manager()->CreateTestingProfile(
"test_profile", std::move(prefs), std::u16string(), 0, std::string(),
- TestingProfile::TestingFactories(), base::Optional<bool>());
+ TestingProfile::TestingFactories(), absl::optional<bool>());
}
sync_preferences::PrefServiceSyncable* pref_service() {
diff --git a/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop.cc b/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop.cc
index 27a192e..d225d2f 100644
--- a/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop.cc
+++ b/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop.cc
@@ -6,7 +6,6 @@
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
@@ -17,6 +16,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view_delegate.h"
#include "content/public/common/drop_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
diff --git a/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop_unittest.cc b/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop_unittest.cc
index eeb910a..4f566b9 100644
--- a/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop_unittest.cc
+++ b/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop_unittest.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
@@ -30,6 +29,7 @@
#include "content/public/common/drop_data.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class ChromeWebContentsViewDelegateHandleOnPerformDrop : public testing::Test {
public:
diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
index 8822c6e..2b75afd 100644
--- a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
+++ b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
@@ -118,12 +118,12 @@
close_delegate_->CloseDialog();
}
-base::Optional<int> TabModalConfirmDialogDelegate::GetDefaultDialogButton() {
+absl::optional<int> TabModalConfirmDialogDelegate::GetDefaultDialogButton() {
// Use the default, don't override.
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<int> TabModalConfirmDialogDelegate::GetInitiallyFocusedButton() {
+absl::optional<int> TabModalConfirmDialogDelegate::GetInitiallyFocusedButton() {
// Use the default, don't override.
- return base::nullopt;
+ return absl::nullopt;
}
diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h
index 4fe25cc2..7deb4e7 100644
--- a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h
+++ b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h
@@ -10,9 +10,9 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/window_open_disposition.h"
namespace content {
@@ -97,10 +97,10 @@
virtual const char* GetCancelButtonIcon();
// Allow the delegate to customize which button is default, and which is
- // initially focused. If returning base::nullopt, the dialog uses default
+ // initially focused. If returning absl::nullopt, the dialog uses default
// behavior.
- virtual base::Optional<int> GetDefaultDialogButton();
- virtual base::Optional<int> GetInitiallyFocusedButton();
+ virtual absl::optional<int> GetDefaultDialogButton();
+ virtual absl::optional<int> GetInitiallyFocusedButton();
protected:
TabModalConfirmDialogCloseDelegate* close_delegate() {
diff --git a/chrome/browser/ui/tabs/existing_base_sub_menu_model.cc b/chrome/browser/ui/tabs/existing_base_sub_menu_model.cc
index 3c3a20d..18190e9 100644
--- a/chrome/browser/ui/tabs/existing_base_sub_menu_model.cc
+++ b/chrome/browser/ui/tabs/existing_base_sub_menu_model.cc
@@ -47,14 +47,14 @@
ExistingBaseSubMenuModel::MenuItemInfo::MenuItemInfo(
const std::u16string menu_text)
: text(menu_text) {
- image = base::nullopt;
+ image = absl::nullopt;
}
ExistingBaseSubMenuModel::MenuItemInfo::MenuItemInfo(
const std::u16string& menu_text,
ui::ImageModel menu_image)
: text(menu_text) {
- image = base::Optional<ui::ImageModel>{menu_image};
+ image = absl::optional<ui::ImageModel>{menu_image};
}
ExistingBaseSubMenuModel::MenuItemInfo::MenuItemInfo(
diff --git a/chrome/browser/ui/tabs/existing_base_sub_menu_model.h b/chrome/browser/ui/tabs/existing_base_sub_menu_model.h
index 0e431b7..692bb1d 100644
--- a/chrome/browser/ui/tabs/existing_base_sub_menu_model.h
+++ b/chrome/browser/ui/tabs/existing_base_sub_menu_model.h
@@ -8,7 +8,7 @@
#include <stddef.h>
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/models/simple_menu_model.h"
class TabStripModel;
@@ -59,7 +59,7 @@
const std::u16string text;
// The optional image for an entry in the sub menu.
- base::Optional<ui::ImageModel> image;
+ absl::optional<ui::ImageModel> image;
bool may_have_mnemonics = true;
};
diff --git a/chrome/browser/ui/tabs/existing_tab_group_sub_menu_model.cc b/chrome/browser/ui/tabs/existing_tab_group_sub_menu_model.cc
index c06e31a..9637b69 100644
--- a/chrome/browser/ui/tabs/existing_tab_group_sub_menu_model.cc
+++ b/chrome/browser/ui/tabs/existing_tab_group_sub_menu_model.cc
@@ -56,9 +56,9 @@
std::vector<tab_groups::TabGroupId>
ExistingTabGroupSubMenuModel::GetOrderedTabGroupsInSubMenu() {
std::vector<tab_groups::TabGroupId> ordered_groups;
- base::Optional<tab_groups::TabGroupId> current_group = base::nullopt;
+ absl::optional<tab_groups::TabGroupId> current_group = absl::nullopt;
for (int i = 0; i < model()->count(); ++i) {
- base::Optional<tab_groups::TabGroupId> new_group =
+ absl::optional<tab_groups::TabGroupId> new_group =
model()->GetTabGroupForTab(i);
if (new_group.has_value() && new_group != current_group &&
ShouldShowGroup(model(), GetContextIndex(), new_group.value())) {
diff --git a/chrome/browser/ui/tabs/tab_group.cc b/chrome/browser/ui/tabs/tab_group.cc
index 3777d9fb..be6cdd94 100644
--- a/chrome/browser/ui/tabs/tab_group.cc
+++ b/chrome/browser/ui/tabs/tab_group.cc
@@ -11,13 +11,13 @@
#include <vector>
#include "base/check_op.h"
-#include "base/optional.h"
#include "chrome/browser/ui/tab_ui_helper.h"
#include "chrome/browser/ui/tabs/tab_group_controller.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/grit/generated_resources.h"
#include "components/tab_groups/tab_group_id.h"
#include "components/tab_groups/tab_group_visual_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/text_elider.h"
@@ -88,26 +88,26 @@
return is_customized_;
}
-base::Optional<int> TabGroup::GetFirstTab() const {
+absl::optional<int> TabGroup::GetFirstTab() const {
for (int i = 0; i < controller_->GetTabCount(); ++i) {
if (controller_->GetTabGroupForTab(i) == id_)
return i;
}
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<int> TabGroup::GetLastTab() const {
+absl::optional<int> TabGroup::GetLastTab() const {
for (int i = controller_->GetTabCount() - 1; i >= 0; --i) {
if (controller_->GetTabGroupForTab(i) == id_)
return i;
}
- return base::nullopt;
+ return absl::nullopt;
}
gfx::Range TabGroup::ListTabs() const {
- base::Optional<int> maybe_first_tab = GetFirstTab();
+ absl::optional<int> maybe_first_tab = GetFirstTab();
if (!maybe_first_tab)
return gfx::Range();
diff --git a/chrome/browser/ui/tabs/tab_group.h b/chrome/browser/ui/tabs/tab_group.h
index c3b2bee1..649ac90 100644
--- a/chrome/browser/ui/tabs/tab_group.h
+++ b/chrome/browser/ui/tabs/tab_group.h
@@ -70,12 +70,12 @@
// Gets the model index of this group's first tab, or nullopt if it is
// empty. Similar to ListTabs() it traverses through TabStripModel's
// tabs. Unlike ListTabs() this is always safe to call.
- base::Optional<int> GetFirstTab() const;
+ absl::optional<int> GetFirstTab() const;
// Gets the model index of this group's last tab, or nullopt if it is
// empty. Similar to ListTabs() it traverses through TabStripModel's
// tabs. Unlike ListTabs() this is always safe to call.
- base::Optional<int> GetLastTab() const;
+ absl::optional<int> GetLastTab() const;
// Returns the range of tab model indices this group contains. Notably
// does not rely on the TabGroup's internal metadata, but rather
diff --git a/chrome/browser/ui/tabs/tab_group_controller.h b/chrome/browser/ui/tabs/tab_group_controller.h
index ec91d9e..a7e934a 100644
--- a/chrome/browser/ui/tabs/tab_group_controller.h
+++ b/chrome/browser/ui/tabs/tab_group_controller.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_UI_TABS_TAB_GROUP_CONTROLLER_H_
#define CHROME_BROWSER_UI_TABS_TAB_GROUP_CONTROLLER_H_
-#include "base/optional.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace tab_groups {
class TabGroupId;
@@ -28,7 +28,7 @@
virtual void CloseTabGroup(const tab_groups::TabGroupId& group) = 0;
// Methods from TabStipModel that are exposed to TabGroup.
- virtual base::Optional<tab_groups::TabGroupId> GetTabGroupForTab(
+ virtual absl::optional<tab_groups::TabGroupId> GetTabGroupForTab(
int index) const = 0;
virtual content::WebContents* GetWebContentsAt(int index) const = 0;
virtual int GetTabCount() const = 0;
diff --git a/chrome/browser/ui/tabs/tab_group_model.cc b/chrome/browser/ui/tabs/tab_group_model.cc
index 6decfd4..8e3712b 100644
--- a/chrome/browser/ui/tabs/tab_group_model.cc
+++ b/chrome/browser/ui/tabs/tab_group_model.cc
@@ -10,12 +10,12 @@
#include <vector>
#include "base/containers/contains.h"
-#include "base/optional.h"
#include "chrome/browser/ui/tabs/tab_group.h"
#include "chrome/browser/ui/tabs/tab_group_controller.h"
#include "components/tab_groups/tab_group_color.h"
#include "components/tab_groups/tab_group_id.h"
#include "components/tab_groups/tab_group_visual_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
TabGroupModel::TabGroupModel(TabGroupController* controller)
: controller_(controller) {}
@@ -24,7 +24,7 @@
TabGroup* TabGroupModel::AddTabGroup(
const tab_groups::TabGroupId& id,
- base::Optional<tab_groups::TabGroupVisualData> visual_data) {
+ absl::optional<tab_groups::TabGroupVisualData> visual_data) {
auto tab_group = std::make_unique<TabGroup>(
controller_, id,
visual_data.value_or(
diff --git a/chrome/browser/ui/tabs/tab_group_model.h b/chrome/browser/ui/tabs/tab_group_model.h
index 24facab..19e2ddd 100644
--- a/chrome/browser/ui/tabs/tab_group_model.h
+++ b/chrome/browser/ui/tabs/tab_group_model.h
@@ -12,7 +12,7 @@
#include <memory>
#include <vector>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class TabGroup;
class TabGroupController;
@@ -39,7 +39,7 @@
// added to it immediately.
TabGroup* AddTabGroup(
const tab_groups::TabGroupId& id,
- base::Optional<tab_groups::TabGroupVisualData> visual_data);
+ absl::optional<tab_groups::TabGroupVisualData> visual_data);
// Returns whether a tab group with the given |id| exists.
bool ContainsTabGroup(const tab_groups::TabGroupId& id) const;
diff --git a/chrome/browser/ui/tabs/tab_renderer_data.h b/chrome/browser/ui/tabs/tab_renderer_data.h
index 5d3d8f13..9f4f9ecd 100644
--- a/chrome/browser/ui/tabs/tab_renderer_data.h
+++ b/chrome/browser/ui/tabs/tab_renderer_data.h
@@ -7,10 +7,10 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/ui/tabs/tab_network_state.h"
#include "chrome/browser/ui/tabs/tab_utils.h"
#include "chrome/browser/ui/thumbnails/thumbnail_image.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/image/image_skia.h"
#include "url/gurl.h"
diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc
index e5d570e9..46094830 100644
--- a/chrome/browser/ui/tabs/tab_strip_model.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model.cc
@@ -201,8 +201,8 @@
void set_pinned(bool value) { pinned_ = value; }
bool blocked() const { return blocked_; }
void set_blocked(bool value) { blocked_ = value; }
- base::Optional<tab_groups::TabGroupId> group() const { return group_; }
- void set_group(base::Optional<tab_groups::TabGroupId> value) {
+ absl::optional<tab_groups::TabGroupId> group() const { return group_; }
+ void set_group(absl::optional<tab_groups::TabGroupId> value) {
group_ = value;
}
@@ -238,7 +238,7 @@
bool blocked_ = false;
// The group that contains this tab, if any.
- base::Optional<tab_groups::TabGroupId> group_ = base::nullopt;
+ absl::optional<tab_groups::TabGroupId> group_ = absl::nullopt;
};
TabStripModel::WebContentsData::WebContentsData(
@@ -391,7 +391,7 @@
int index,
std::unique_ptr<WebContents> contents,
int add_types,
- base::Optional<tab_groups::TabGroupId> group) {
+ absl::optional<tab_groups::TabGroupId> group) {
ReentrancyCheck reentrancy_check(&reentrancy_guard_);
return InsertWebContentsAtImpl(index, std::move(contents), add_types, group);
}
@@ -468,7 +468,7 @@
if (create_historical_tab)
delegate_->CreateHistoricalTab(raw_web_contents);
- base::Optional<int> next_selected_index =
+ absl::optional<int> next_selected_index =
order_controller_->DetermineNewSelectedIndex(index);
UngroupTab(index);
@@ -850,7 +850,7 @@
}
bool TabStripModel::IsTabCollapsed(int index) const {
- base::Optional<tab_groups::TabGroupId> group = GetTabGroupForTab(index);
+ absl::optional<tab_groups::TabGroupId> group = GetTabGroupForTab(index);
return group.has_value() && IsGroupCollapsed(group.value());
}
@@ -864,26 +864,26 @@
return contents_data_[index]->blocked();
}
-base::Optional<tab_groups::TabGroupId> TabStripModel::GetTabGroupForTab(
+absl::optional<tab_groups::TabGroupId> TabStripModel::GetTabGroupForTab(
int index) const {
- return ContainsIndex(index) ? contents_data_[index]->group() : base::nullopt;
+ return ContainsIndex(index) ? contents_data_[index]->group() : absl::nullopt;
}
-base::Optional<tab_groups::TabGroupId> TabStripModel::GetSurroundingTabGroup(
+absl::optional<tab_groups::TabGroupId> TabStripModel::GetSurroundingTabGroup(
int index) const {
if (!ContainsIndex(index - 1) || !ContainsIndex(index))
- return base::nullopt;
+ return absl::nullopt;
// If the tab before is not in a group, a tab inserted at |index|
// wouldn't be surrounded by one group.
- base::Optional<tab_groups::TabGroupId> group = GetTabGroupForTab(index - 1);
+ absl::optional<tab_groups::TabGroupId> group = GetTabGroupForTab(index - 1);
if (!group)
- return base::nullopt;
+ return absl::nullopt;
// If the tab after is in a different (or no) group, a new tab at
// |index| isn't surrounded.
if (group != GetTabGroupForTab(index))
- return base::nullopt;
+ return absl::nullopt;
return group;
}
@@ -957,7 +957,7 @@
int index,
ui::PageTransition transition,
int add_types,
- base::Optional<tab_groups::TabGroupId> group) {
+ absl::optional<tab_groups::TabGroupId> group) {
ReentrancyCheck reentrancy_check(&reentrancy_guard_);
// If the newly-opened tab is part of the same task as the parent tab, we want
@@ -1110,7 +1110,7 @@
void TabStripModel::MoveTabsAndSetGroup(
const std::vector<int>& indices,
int destination_index,
- base::Optional<tab_groups::TabGroupId> group) {
+ absl::optional<tab_groups::TabGroupId> group) {
ReentrancyCheck reentrancy_check(&reentrancy_guard_);
MoveTabsAndSetGroupImpl(indices, destination_index, group);
@@ -1129,8 +1129,8 @@
void TabStripModel::UpdateGroupForDragRevert(
int index,
- base::Optional<tab_groups::TabGroupId> group_id,
- base::Optional<tab_groups::TabGroupVisualData> group_data) {
+ absl::optional<tab_groups::TabGroupId> group_id,
+ absl::optional<tab_groups::TabGroupVisualData> group_data) {
ReentrancyCheck reentrancy_check(&reentrancy_guard_);
if (group_id.has_value()) {
const bool group_exists = group_model_->ContainsTabGroup(group_id.value());
@@ -1148,7 +1148,7 @@
std::map<tab_groups::TabGroupId, std::vector<int>> indices_per_tab_group;
for (int index : indices) {
- base::Optional<tab_groups::TabGroupId> old_group = GetTabGroupForTab(index);
+ absl::optional<tab_groups::TabGroupId> old_group = GetTabGroupForTab(index);
if (old_group.has_value())
indices_per_tab_group[old_group.value()].push_back(index);
}
@@ -1175,9 +1175,9 @@
right_of_group.push_back(index);
}
}
- MoveTabsAndSetGroupImpl(left_of_group, first_tab_in_group, base::nullopt);
+ MoveTabsAndSetGroupImpl(left_of_group, first_tab_in_group, absl::nullopt);
MoveTabsAndSetGroupImpl(right_of_group, last_tab_in_group + 1,
- base::nullopt);
+ absl::nullopt);
}
}
@@ -1551,7 +1551,7 @@
DCHECK(!indices.empty());
// If all tabs are in the same group, then we ungroup, otherwise we group.
- base::Optional<tab_groups::TabGroupId> group = GetTabGroupForTab(indices[0]);
+ absl::optional<tab_groups::TabGroupId> group = GetTabGroupForTab(indices[0]);
if (!group.has_value())
return true;
@@ -1610,12 +1610,12 @@
return kNoTab;
}
-base::Optional<int> TabStripModel::GetNextExpandedActiveTab(
+absl::optional<int> TabStripModel::GetNextExpandedActiveTab(
int start_index,
- base::Optional<tab_groups::TabGroupId> collapsing_group) const {
+ absl::optional<tab_groups::TabGroupId> collapsing_group) const {
// Check tabs from the start_index first.
for (int i = start_index + 1; i < count(); ++i) {
- base::Optional<tab_groups::TabGroupId> current_group = GetTabGroupForTab(i);
+ absl::optional<tab_groups::TabGroupId> current_group = GetTabGroupForTab(i);
if (!current_group.has_value() ||
(!IsGroupCollapsed(current_group.value()) &&
current_group != collapsing_group)) {
@@ -1624,14 +1624,14 @@
}
// Then check tabs before start_index, iterating backwards.
for (int i = start_index - 1; i >= 0; --i) {
- base::Optional<tab_groups::TabGroupId> current_group = GetTabGroupForTab(i);
+ absl::optional<tab_groups::TabGroupId> current_group = GetTabGroupForTab(i);
if (!current_group.has_value() ||
(!IsGroupCollapsed(current_group.value()) &&
current_group != collapsing_group)) {
return i;
}
}
- return base::nullopt;
+ return absl::nullopt;
}
void TabStripModel::ForgetAllOpeners() {
@@ -1735,7 +1735,7 @@
int index,
std::unique_ptr<content::WebContents> contents,
int add_types,
- base::Optional<tab_groups::TabGroupId> group) {
+ absl::optional<tab_groups::TabGroupId> group) {
delegate()->WillAddWebContents(contents.get());
bool active = (add_types & ADD_ACTIVE) != 0;
@@ -1964,7 +1964,7 @@
return;
const int start_index = active_index();
- base::Optional<tab_groups::TabGroupId> start_group =
+ absl::optional<tab_groups::TabGroupId> start_group =
GetTabGroupForTab(start_index);
// Ensure the active tab is not in a collapsed group so the while loop can
@@ -1972,7 +1972,7 @@
DCHECK(!start_group.has_value() || !IsGroupCollapsed(start_group.value()));
const int delta = next ? 1 : -1;
int index = (start_index + count() + delta) % count();
- base::Optional<tab_groups::TabGroupId> group = GetTabGroupForTab(index);
+ absl::optional<tab_groups::TabGroupId> group = GetTabGroupForTab(index);
while (group.has_value() && IsGroupCollapsed(group.value())) {
index = (index + count() + delta) % count();
group = GetTabGroupForTab(index);
@@ -1985,11 +1985,11 @@
// TODO: this needs to be updated for multi-selection.
const int current_index = active_index();
- base::Optional<tab_groups::TabGroupId> current_group =
+ absl::optional<tab_groups::TabGroupId> current_group =
GetTabGroupForTab(current_index);
int target_index = std::max(std::min(current_index + offset, count() - 1), 0);
- base::Optional<tab_groups::TabGroupId> target_group =
+ absl::optional<tab_groups::TabGroupId> target_group =
GetTabGroupForTab(target_index);
// If the tab is at a group boundary and the group is expanded, instead of
@@ -2090,7 +2090,7 @@
contents_data_.cbegin(), contents_data_.cend(),
[new_group](const auto& datum) { return datum->group() == new_group; }));
- group_model_->AddTabGroup(new_group, base::nullopt);
+ group_model_->AddTabGroup(new_group, absl::nullopt);
// Find a destination for the first tab that's not pinned or inside another
// group. We will stack the rest of the tabs up to its right.
@@ -2110,7 +2110,7 @@
// Otherwise, grouping is valid if the destination is not in the middle of a
// different group.
- base::Optional<tab_groups::TabGroupId> destination_group =
+ absl::optional<tab_groups::TabGroupId> destination_group =
GetTabGroupForTab(destination_candidate);
if (!destination_group.has_value() ||
destination_group != GetTabGroupForTab(indices[0])) {
@@ -2162,7 +2162,7 @@
void TabStripModel::MoveTabsAndSetGroupImpl(
const std::vector<int>& indices,
int destination_index,
- base::Optional<tab_groups::TabGroupId> group) {
+ absl::optional<tab_groups::TabGroupId> group) {
// Some tabs will need to be moved to the right, some to the left. We need to
// handle those separately. First, move tabs to the right, starting with the
// rightmost tab so we don't cause other tabs we are about to move to shift.
@@ -2190,7 +2190,7 @@
void TabStripModel::MoveAndSetGroup(
int index,
int new_index,
- base::Optional<tab_groups::TabGroupId> new_group) {
+ absl::optional<tab_groups::TabGroupId> new_group) {
if (new_group.has_value()) {
// Unpin tabs when grouping -- the states should be mutually exclusive.
// Here we manually unpin the tab to avoid moving the tab twice, which can
@@ -2225,16 +2225,16 @@
}
}
-base::Optional<tab_groups::TabGroupId> TabStripModel::UngroupTab(int index) {
- base::Optional<tab_groups::TabGroupId> group = GetTabGroupForTab(index);
+absl::optional<tab_groups::TabGroupId> TabStripModel::UngroupTab(int index) {
+ absl::optional<tab_groups::TabGroupId> group = GetTabGroupForTab(index);
if (!group.has_value())
- return base::nullopt;
+ return absl::nullopt;
// Update the tab.
- contents_data_[index]->set_group(base::nullopt);
+ contents_data_[index]->set_group(absl::nullopt);
for (auto& observer : observers_) {
observer.TabGroupedStateChanged(
- base::nullopt, contents_data_[index]->web_contents(), index);
+ absl::nullopt, contents_data_[index]->web_contents(), index);
}
// Update the group model.
@@ -2249,7 +2249,7 @@
void TabStripModel::GroupTab(int index, const tab_groups::TabGroupId& group) {
// Check for an old group first, so that any groups that are changed can be
// notified appropriately.
- base::Optional<tab_groups::TabGroupId> old_group = GetTabGroupForTab(index);
+ absl::optional<tab_groups::TabGroupId> old_group = GetTabGroupForTab(index);
if (old_group.has_value()) {
if (old_group.value() == group)
return;
diff --git a/chrome/browser/ui/tabs/tab_strip_model.h b/chrome/browser/ui/tabs/tab_strip_model.h
index de83d5f..3ef161f 100644
--- a/chrome/browser/ui/tabs/tab_strip_model.h
+++ b/chrome/browser/ui/tabs/tab_strip_model.h
@@ -18,7 +18,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observer.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -28,6 +27,7 @@
#include "chrome/browser/ui/tabs/tab_switch_event_latency_recorder.h"
#include "components/tab_groups/tab_group_id.h"
#include "components/tab_groups/tab_group_visual_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"
#include "ui/base/models/list_selection_model.h"
#include "ui/base/page_transition_types.h"
@@ -201,7 +201,7 @@
int index,
std::unique_ptr<content::WebContents> contents,
int add_types,
- base::Optional<tab_groups::TabGroupId> group = base::nullopt);
+ absl::optional<tab_groups::TabGroupId> group = absl::nullopt);
// Closes the WebContents at the specified index. This causes the
// WebContents to be destroyed, but it may not happen immediately.
// |close_types| is a bitmask of CloseTypes. Returns true if the
@@ -361,14 +361,14 @@
// Returns the group that contains the tab at |index|, or nullopt if the tab
// index is invalid or not grouped.
- base::Optional<tab_groups::TabGroupId> GetTabGroupForTab(
+ absl::optional<tab_groups::TabGroupId> GetTabGroupForTab(
int index) const override;
// If a tab inserted at |index| would be within a tab group, return that
// group's ID. Otherwise, return nullopt. If |index| points to the first tab
// in a group, it will return nullopt since a new tab would be either between
// two different groups or just after a non-grouped tab.
- base::Optional<tab_groups::TabGroupId> GetSurroundingTabGroup(
+ absl::optional<tab_groups::TabGroupId> GetSurroundingTabGroup(
int index) const;
// Returns the index of the first tab that is not a pinned tab. This returns
@@ -407,7 +407,7 @@
int index,
ui::PageTransition transition,
int add_types,
- base::Optional<tab_groups::TabGroupId> group = base::nullopt);
+ absl::optional<tab_groups::TabGroupId> group = absl::nullopt);
// Closes the selected tabs.
void CloseSelectedTabs();
@@ -444,7 +444,7 @@
// being moved, and adds them to the tab group |group|.
void MoveTabsAndSetGroup(const std::vector<int>& indices,
int destination_index,
- base::Optional<tab_groups::TabGroupId> group);
+ absl::optional<tab_groups::TabGroupId> group);
// Similar to AddToExistingGroup(), but creates a group with id |group| if it
// doesn't exist. This is only intended to be called from session restore
@@ -457,8 +457,8 @@
// create the group then add the tab to the group.
void UpdateGroupForDragRevert(
int index,
- base::Optional<tab_groups::TabGroupId> group_id,
- base::Optional<tab_groups::TabGroupVisualData> group_data);
+ absl::optional<tab_groups::TabGroupId> group_id,
+ absl::optional<tab_groups::TabGroupVisualData> group_data);
// Removes the set of tabs pointed to by |indices| from the the groups they
// are in, if any. The tabs are moved out of the group if necessary. |indices|
@@ -566,11 +566,11 @@
// |index|. This method will check the indices to the right of |index| before
// checking the indices to the left of |index|. |index| cannot be returned.
// |collapsing_group| is optional and used in cases where the group is
- // collapsing but not yet reflected in the model. Returns base::nullopt if
+ // collapsing but not yet reflected in the model. Returns absl::nullopt if
// there are no valid tabs.
- base::Optional<int> GetNextExpandedActiveTab(
+ absl::optional<int> GetNextExpandedActiveTab(
int index,
- base::Optional<tab_groups::TabGroupId> collapsing_group) const;
+ absl::optional<tab_groups::TabGroupId> collapsing_group) const;
// Forget all opener relationships, to reduce unpredictable tab switching
// behavior in complex session states. The exact circumstances under which
@@ -655,7 +655,7 @@
int InsertWebContentsAtImpl(int index,
std::unique_ptr<content::WebContents> contents,
int add_types,
- base::Optional<tab_groups::TabGroupId> group);
+ absl::optional<tab_groups::TabGroupId> group);
// Closes the WebContentses at the specified indices. This causes the
// WebContentses to be destroyed, but it may not happen immediately. If
@@ -734,20 +734,20 @@
// appropriate |group|.
void MoveTabsAndSetGroupImpl(const std::vector<int>& indices,
int destination_index,
- base::Optional<tab_groups::TabGroupId> group);
+ absl::optional<tab_groups::TabGroupId> group);
// Moves the tab at |index| to |new_index| and sets its group to |new_group|.
// Notifies any observers that group affiliation has changed for the tab.
void MoveAndSetGroup(int index,
int new_index,
- base::Optional<tab_groups::TabGroupId> new_group);
+ absl::optional<tab_groups::TabGroupId> new_group);
void AddToReadLaterImpl(const std::vector<int>& indices);
// Helper function for MoveAndSetGroup. Removes the tab at |index| from the
// group that contains it, if any. Also deletes that group, if it now contains
// no tabs. Returns that group.
- base::Optional<tab_groups::TabGroupId> UngroupTab(int index);
+ absl::optional<tab_groups::TabGroupId> UngroupTab(int index);
// Helper function for MoveAndSetGroup. Adds the tab at |index| to |group|.
void GroupTab(int index, const tab_groups::TabGroupId& group);
diff --git a/chrome/browser/ui/tabs/tab_strip_model_delegate.h b/chrome/browser/ui/tabs/tab_strip_model_delegate.h
index 11ca774..0deef10 100644
--- a/chrome/browser/ui/tabs/tab_strip_model_delegate.h
+++ b/chrome/browser/ui/tabs/tab_strip_model_delegate.h
@@ -8,9 +8,9 @@
#include <memory>
#include <vector>
-#include "base/optional.h"
#include "components/sessions/core/session_id.h"
#include "components/tab_groups/tab_group_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Browser;
class GURL;
@@ -55,7 +55,7 @@
const GURL& url,
int index,
bool foreground,
- base::Optional<tab_groups::TabGroupId> group = base::nullopt) = 0;
+ absl::optional<tab_groups::TabGroupId> group = absl::nullopt) = 0;
// Asks for a new TabStripModel to be created and the given web contentses to
// be added to it. Its size and position are reflected in |window_bounds|.
@@ -122,7 +122,7 @@
// Creates an entry in the historical tab database for the specified
// WebContents. Returns the tab's unique SessionID if a historical tab was
// created.
- virtual base::Optional<SessionID> CreateHistoricalTab(
+ virtual absl::optional<SessionID> CreateHistoricalTab(
content::WebContents* contents) = 0;
// Creates an entry in the historical group database for the specified
diff --git a/chrome/browser/ui/tabs/tab_strip_model_observer.cc b/chrome/browser/ui/tabs/tab_strip_model_observer.cc
index 34c417d..1c07c907 100644
--- a/chrome/browser/ui/tabs/tab_strip_model_observer.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model_observer.cc
@@ -198,7 +198,7 @@
}
void TabStripModelObserver::TabGroupedStateChanged(
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
content::WebContents* contents,
int index) {}
diff --git a/chrome/browser/ui/tabs/tab_strip_model_observer.h b/chrome/browser/ui/tabs/tab_strip_model_observer.h
index 10a61a7..bbd7a6f 100644
--- a/chrome/browser/ui/tabs/tab_strip_model_observer.h
+++ b/chrome/browser/ui/tabs/tab_strip_model_observer.h
@@ -8,10 +8,10 @@
#include <memory>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/ui/tabs/tab_change_type.h"
#include "components/tab_groups/tab_group_id.h"
#include "components/tab_groups/tab_group_visual_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"
#include "ui/base/models/list_selection_model.h"
@@ -336,7 +336,7 @@
// Called when the tab at |index| is added to the group with id |group|.
virtual void TabGroupedStateChanged(
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
content::WebContents* contents,
int index);
diff --git a/chrome/browser/ui/tabs/tab_strip_model_order_controller.cc b/chrome/browser/ui/tabs/tab_strip_model_order_controller.cc
index a97ca8cb..fc98a7a3 100644
--- a/chrome/browser/ui/tabs/tab_strip_model_order_controller.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model_order_controller.cc
@@ -47,19 +47,19 @@
return model_->count();
}
-base::Optional<int> TabStripModelOrderController::DetermineNewSelectedIndex(
+absl::optional<int> TabStripModelOrderController::DetermineNewSelectedIndex(
int removing_index) const {
DCHECK(model_->ContainsIndex(removing_index));
// The case where the closed tab is inactive is handled directly in
// TabStripModel.
if (removing_index != model_->active_index())
- return base::nullopt;
+ return absl::nullopt;
// The case where multiple tabs are selected is handled directly in
// TabStripModel.
if (model_->selection_model().size() > 1)
- return base::nullopt;
+ return absl::nullopt;
content::WebContents* parent_opener =
model_->GetOpenerOfWebContentsAt(removing_index);
@@ -91,16 +91,16 @@
}
// If closing a grouped tab, return a tab that is still in the group, if any.
- const base::Optional<tab_groups::TabGroupId> current_group =
+ const absl::optional<tab_groups::TabGroupId> current_group =
model_->GetTabGroupForTab(removing_index);
if (current_group.has_value()) {
// Match the default behavior below: prefer the tab to the right.
- const base::Optional<tab_groups::TabGroupId> right_group =
+ const absl::optional<tab_groups::TabGroupId> right_group =
model_->GetTabGroupForTab(removing_index + 1);
if (current_group == right_group)
return removing_index;
- const base::Optional<tab_groups::TabGroupId> left_group =
+ const absl::optional<tab_groups::TabGroupId> left_group =
model_->GetTabGroupForTab(removing_index - 1);
if (current_group == left_group)
return removing_index - 1;
@@ -109,8 +109,8 @@
// At this point, the tab detaching is either not inside a group, or the last
// tab in the group. If there are any tabs in a not collapsed group,
// |GetNextExpandedActiveTab()| will return the index of that tab.
- base::Optional<int> next_available =
- model_->GetNextExpandedActiveTab(removing_index, base::nullopt);
+ absl::optional<int> next_available =
+ model_->GetNextExpandedActiveTab(removing_index, absl::nullopt);
if (next_available.has_value())
return GetValidIndex(next_available.value(), removing_index);
diff --git a/chrome/browser/ui/tabs/tab_strip_model_order_controller.h b/chrome/browser/ui/tabs/tab_strip_model_order_controller.h
index c7beebb8..6a3c4dc 100644
--- a/chrome/browser/ui/tabs/tab_strip_model_order_controller.h
+++ b/chrome/browser/ui/tabs/tab_strip_model_order_controller.h
@@ -30,7 +30,7 @@
bool foreground);
// Determine where to shift selection after a tab is closed.
- base::Optional<int> DetermineNewSelectedIndex(int removed_index) const;
+ absl::optional<int> DetermineNewSelectedIndex(int removed_index) const;
// Overridden from TabStripModelObserver:
void OnTabStripModelChanged(
diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
index e1e5411..37cd304 100644
--- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
@@ -15,7 +15,6 @@
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
@@ -47,6 +46,7 @@
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
using content::WebContents;
@@ -1126,7 +1126,7 @@
tabstrip.ActivateTabAt(1, {TabStripModel::GestureType::kOther});
ASSERT_EQ(1, tabstrip.active_index());
- base::Optional<int> next_active =
+ absl::optional<int> next_active =
tabstrip.GetNextExpandedActiveTab(tabstrip.active_index(), group);
EXPECT_EQ(2, next_active);
@@ -1153,7 +1153,7 @@
tabstrip.ActivateTabAt(2, {TabStripModel::GestureType::kOther});
ASSERT_EQ(2, tabstrip.active_index());
- base::Optional<int> next_active =
+ absl::optional<int> next_active =
tabstrip.GetNextExpandedActiveTab(tabstrip.active_index(), group);
EXPECT_EQ(1, next_active);
@@ -1180,10 +1180,10 @@
tabstrip.ActivateTabAt(1, {TabStripModel::GestureType::kOther});
ASSERT_EQ(1, tabstrip.active_index());
- base::Optional<int> next_active =
+ absl::optional<int> next_active =
tabstrip.GetNextExpandedActiveTab(tabstrip.active_index(), group);
- EXPECT_EQ(base::nullopt, next_active);
+ EXPECT_EQ(absl::nullopt, next_active);
tabstrip.CloseAllTabs();
ASSERT_TRUE(tabstrip.empty());
@@ -2547,7 +2547,7 @@
EXPECT_EQ("0 1 2 3", GetTabStripStateString(strip));
tab_groups::TabGroupId group = strip.AddToNewGroup({1, 2});
- EXPECT_EQ(strip.GetTabGroupForTab(0), base::nullopt);
+ EXPECT_EQ(strip.GetTabGroupForTab(0), absl::nullopt);
strip.MoveTabNext();
EXPECT_EQ("0 1 2 3", GetTabStripStateString(strip));
@@ -2563,7 +2563,7 @@
strip.MoveTabNext();
EXPECT_EQ("1 2 0 3", GetTabStripStateString(strip));
- EXPECT_EQ(strip.GetTabGroupForTab(2), base::nullopt);
+ EXPECT_EQ(strip.GetTabGroupForTab(2), absl::nullopt);
strip.CloseAllTabs();
}
@@ -2611,7 +2611,7 @@
EXPECT_EQ("0 1 2 3", GetTabStripStateString(strip));
tab_groups::TabGroupId group = strip.AddToNewGroup({1, 2});
- EXPECT_EQ(strip.GetTabGroupForTab(3), base::nullopt);
+ EXPECT_EQ(strip.GetTabGroupForTab(3), absl::nullopt);
strip.MoveTabPrevious();
EXPECT_EQ("0 1 2 3", GetTabStripStateString(strip));
@@ -2627,7 +2627,7 @@
strip.MoveTabPrevious();
EXPECT_EQ("0 3 1 2", GetTabStripStateString(strip));
- EXPECT_EQ(strip.GetTabGroupForTab(1), base::nullopt);
+ EXPECT_EQ(strip.GetTabGroupForTab(1), absl::nullopt);
strip.CloseAllTabs();
}
@@ -3150,7 +3150,7 @@
TabStripModel strip(&delegate, profile());
PrepareTabs(&strip, 4);
strip.AddToNewGroup({0, 1, 2, 3});
- base::Optional<tab_groups::TabGroupId> first_group =
+ absl::optional<tab_groups::TabGroupId> first_group =
strip.GetTabGroupForTab(0);
strip.AddToNewGroup({1, 2});
@@ -3245,7 +3245,7 @@
strip.AppendWebContents(CreateWebContents(), true);
strip.AddToNewGroup({0});
- base::Optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(0);
+ absl::optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(0);
strip.AddToExistingGroup({0}, group.value());
observer.ClearStates();
@@ -3261,7 +3261,7 @@
PrepareTabs(&strip, 2);
strip.AddToNewGroup({0});
- base::Optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(0);
+ absl::optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(0);
strip.AddToExistingGroup({1}, group.value());
@@ -3294,7 +3294,7 @@
PrepareTabs(&strip, 3);
strip.AddToNewGroup({2});
- base::Optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(2);
+ absl::optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(2);
strip.AddToExistingGroup({0}, group.value());
EXPECT_EQ(strip.GetTabGroupForTab(1), group);
@@ -3310,7 +3310,7 @@
PrepareTabs(&strip, 3);
strip.AddToNewGroup({0});
- base::Optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(0);
+ absl::optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(0);
strip.AddToExistingGroup({2}, group.value());
EXPECT_EQ(strip.GetTabGroupForTab(0), group);
@@ -3327,7 +3327,7 @@
PrepareTabs(&strip, 4);
strip.AddToNewGroup({1});
- base::Optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(1);
+ absl::optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(1);
strip.AddToExistingGroup({0, 3}, group.value());
EXPECT_EQ(strip.GetTabGroupForTab(0), group);
@@ -3346,7 +3346,7 @@
strip.SetTabPinned(0, true);
strip.AddToNewGroup({1});
- base::Optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(1);
+ absl::optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(1);
strip.AddToExistingGroup({0}, group.value());
EXPECT_FALSE(strip.IsTabPinned(0));
@@ -3501,7 +3501,7 @@
strip.AppendWebContents(CreateWebContents(), true);
strip.AddToNewGroup({0});
EXPECT_EQ(strip.group_model()->ListTabGroups().size(), 1U);
- base::Optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(0);
+ absl::optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(0);
strip.AddToNewGroup({0});
@@ -3519,7 +3519,7 @@
strip.AddToNewGroup({0});
strip.AddToNewGroup({1});
EXPECT_EQ(strip.group_model()->ListTabGroups().size(), 2U);
- base::Optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(1);
+ absl::optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(1);
strip.AddToExistingGroup({1}, strip.GetTabGroupForTab(0).value());
@@ -3607,7 +3607,7 @@
strip.AppendWebContents(CreateWebContentsWithID(0), true);
strip.AppendWebContents(CreateWebContentsWithID(1), false);
strip.AddToNewGroup({0, 1});
- base::Optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(0);
+ absl::optional<tab_groups::TabGroupId> group = strip.GetTabGroupForTab(0);
strip.InsertWebContentsAt(1, CreateWebContentsWithID(2),
TabStripModel::ADD_NONE, group);
@@ -3818,8 +3818,8 @@
strip.MoveWebContentsAt(1, 0, false);
EXPECT_EQ("1 0 2 3 4", GetTabStripStateString(strip));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(0));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(1));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(0));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(1));
EXPECT_EQ(group, strip.GetTabGroupForTab(2));
strip.CloseAllTabs();
@@ -3834,8 +3834,8 @@
strip.MoveWebContentsAt(3, 4, false);
EXPECT_EQ("0 1 2 4 3", GetTabStripStateString(strip));
EXPECT_EQ(group, strip.GetTabGroupForTab(2));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(3));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(4));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(3));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(4));
strip.CloseAllTabs();
}
@@ -3848,9 +3848,9 @@
strip.MoveWebContentsAt(1, 3, false);
EXPECT_EQ("0 2 3 1 4", GetTabStripStateString(strip));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(2));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(3));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(4));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(2));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(3));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(4));
strip.CloseAllTabs();
}
@@ -3865,7 +3865,7 @@
strip.MoveWebContentsAt(0, 2, false);
EXPECT_EQ("1 2 0 3 4", GetTabStripStateString(strip));
EXPECT_EQ(group1, strip.GetTabGroupForTab(1));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(2));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(2));
EXPECT_EQ(group2, strip.GetTabGroupForTab(3));
strip.CloseAllTabs();
@@ -3881,8 +3881,8 @@
strip.MoveWebContentsAt(0, 2, false);
EXPECT_EQ("1 2 0 3", GetTabStripStateString(strip));
EXPECT_EQ(group, strip.GetTabGroupForTab(1));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(2));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(3));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(2));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(3));
strip.CloseAllTabs();
}
@@ -3896,8 +3896,8 @@
strip.MoveWebContentsAt(0, 1, false);
EXPECT_EQ("1 0 2 3", GetTabStripStateString(strip));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(0));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(1));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(0));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(1));
EXPECT_EQ(group, strip.GetTabGroupForTab(2));
strip.CloseAllTabs();
@@ -3916,7 +3916,7 @@
EXPECT_EQ("1 2 3 0 4 5", GetTabStripStateString(strip));
EXPECT_EQ(group1, strip.GetTabGroupForTab(0));
EXPECT_EQ(group2, strip.GetTabGroupForTab(2));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(3));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(3));
EXPECT_EQ(group3, strip.GetTabGroupForTab(4));
strip.CloseAllTabs();
@@ -4030,7 +4030,7 @@
strip.MoveWebContentsAt(0, 2, false);
EXPECT_EQ("1 2 0", GetTabStripStateString(strip));
- EXPECT_EQ(base::nullopt, strip.GetTabGroupForTab(2));
+ EXPECT_EQ(absl::nullopt, strip.GetTabGroupForTab(2));
// The tab should be removed from group1 but not added to group2.
EXPECT_EQ(2u, observer.group_updates().size());
@@ -4136,11 +4136,11 @@
auto group1 = strip.AddToNewGroup({1, 2});
strip.AddToNewGroup({3});
- EXPECT_EQ(base::nullopt, strip.GetSurroundingTabGroup(0));
- EXPECT_EQ(base::nullopt, strip.GetSurroundingTabGroup(1));
+ EXPECT_EQ(absl::nullopt, strip.GetSurroundingTabGroup(0));
+ EXPECT_EQ(absl::nullopt, strip.GetSurroundingTabGroup(1));
EXPECT_EQ(group1, strip.GetSurroundingTabGroup(2));
- EXPECT_EQ(base::nullopt, strip.GetSurroundingTabGroup(3));
- EXPECT_EQ(base::nullopt, strip.GetSurroundingTabGroup(4));
+ EXPECT_EQ(absl::nullopt, strip.GetSurroundingTabGroup(3));
+ EXPECT_EQ(absl::nullopt, strip.GetSurroundingTabGroup(4));
strip.CloseAllTabs();
}
diff --git a/chrome/browser/ui/tabs/tab_switch_event_latency_recorder.cc b/chrome/browser/ui/tabs/tab_switch_event_latency_recorder.cc
index 49f324c..9fd30db 100644
--- a/chrome/browser/ui/tabs/tab_switch_event_latency_recorder.cc
+++ b/chrome/browser/ui/tabs/tab_switch_event_latency_recorder.cc
@@ -51,6 +51,6 @@
case EventType::kOther:
break;
}
- event_type_ = base::nullopt;
+ event_type_ = absl::nullopt;
input_event_timestamp_ = base::TimeTicks();
}
diff --git a/chrome/browser/ui/tabs/tab_switch_event_latency_recorder.h b/chrome/browser/ui/tabs/tab_switch_event_latency_recorder.h
index fb8c229..4256915f 100644
--- a/chrome/browser/ui/tabs/tab_switch_event_latency_recorder.h
+++ b/chrome/browser/ui/tabs/tab_switch_event_latency_recorder.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_UI_TABS_TAB_SWITCH_EVENT_LATENCY_RECORDER_H_
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Store the timestamps related to switching tabs, and generate UMA metrics to
// track the latency between the input event timestamp and the time when the
@@ -38,7 +38,7 @@
private:
base::TimeTicks input_event_timestamp_ = base::TimeTicks();
- base::Optional<EventType> event_type_ = base::nullopt;
+ absl::optional<EventType> event_type_ = absl::nullopt;
};
#endif // CHROME_BROWSER_UI_TABS_TAB_SWITCH_EVENT_LATENCY_RECORDER_H_
diff --git a/chrome/browser/ui/tabs/tab_ukm_test_helper.h b/chrome/browser/ui/tabs/tab_ukm_test_helper.h
index 571183e4..d224f4a 100644
--- a/chrome/browser/ui/tabs/tab_ukm_test_helper.h
+++ b/chrome/browser/ui/tabs/tab_ukm_test_helper.h
@@ -7,14 +7,14 @@
#include <map>
-#include "base/optional.h"
#include "components/ukm/test_ukm_recorder.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A UKM entry consists of named metrics with int64_t values. Use a map to
// specify expected metrics to test against an actual entry for tests.
// A value of |nullopt| implies a value shouldn't exist for the given metric
// name.
-using UkmMetricMap = std::map<const char*, base::Optional<int64_t>>;
+using UkmMetricMap = std::map<const char*, absl::optional<int64_t>>;
using SourceUkmMetricMap =
std::map<ukm::SourceId, std::pair<GURL, UkmMetricMap>>;
diff --git a/chrome/browser/ui/tabs/test_tab_strip_model_delegate.cc b/chrome/browser/ui/tabs/test_tab_strip_model_delegate.cc
index f6da54e..b5d64f5 100644
--- a/chrome/browser/ui/tabs/test_tab_strip_model_delegate.cc
+++ b/chrome/browser/ui/tabs/test_tab_strip_model_delegate.cc
@@ -18,7 +18,7 @@
const GURL& url,
int index,
bool foreground,
- base::Optional<tab_groups::TabGroupId> group) {}
+ absl::optional<tab_groups::TabGroupId> group) {}
Browser* TestTabStripModelDelegate::CreateNewStripWithContents(
std::vector<NewStripContents> contentses,
@@ -71,9 +71,9 @@
void TestTabStripModelDelegate::MoveGroupToNewWindow(
const tab_groups::TabGroupId& group) {}
-base::Optional<SessionID> TestTabStripModelDelegate::CreateHistoricalTab(
+absl::optional<SessionID> TestTabStripModelDelegate::CreateHistoricalTab(
content::WebContents* contents) {
- return base::nullopt;
+ return absl::nullopt;
}
void TestTabStripModelDelegate::CreateHistoricalGroup(
diff --git a/chrome/browser/ui/tabs/test_tab_strip_model_delegate.h b/chrome/browser/ui/tabs/test_tab_strip_model_delegate.h
index 1806b1b..c6038d4 100644
--- a/chrome/browser/ui/tabs/test_tab_strip_model_delegate.h
+++ b/chrome/browser/ui/tabs/test_tab_strip_model_delegate.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_UI_TABS_TEST_TAB_STRIP_MODEL_DELEGATE_H_
#include "base/compiler_specific.h"
-#include "base/optional.h"
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
#include "components/tab_groups/tab_group_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -27,7 +27,7 @@
void AddTabAt(const GURL& url,
int index,
bool foregroud,
- base::Optional<tab_groups::TabGroupId> group) override;
+ absl::optional<tab_groups::TabGroupId> group) override;
Browser* CreateNewStripWithContents(std::vector<NewStripContents> contentses,
const gfx::Rect& window_bounds,
bool maximize) override;
@@ -42,7 +42,7 @@
bool CanMoveTabsToWindow(const std::vector<int>& indices) override;
void MoveTabsToNewWindow(const std::vector<int>& indices) override;
void MoveGroupToNewWindow(const tab_groups::TabGroupId& group) override;
- base::Optional<SessionID> CreateHistoricalTab(
+ absl::optional<SessionID> CreateHistoricalTab(
content::WebContents* contents) override;
void CreateHistoricalGroup(const tab_groups::TabGroupId& group) override;
void GroupCloseStopped(const tab_groups::TabGroupId& group) override;
diff --git a/chrome/browser/ui/test/test_infobar.cc b/chrome/browser/ui/test/test_infobar.cc
index 6ff8b27e..d077058b 100644
--- a/chrome/browser/ui/test/test_infobar.cc
+++ b/chrome/browser/ui/test/test_infobar.cc
@@ -21,7 +21,7 @@
}
bool TestInfoBar::VerifyUi() {
- base::Optional<InfoBars> infobars = GetNewInfoBars();
+ absl::optional<InfoBars> infobars = GetNewInfoBars();
if (!infobars || infobars->empty()) {
ADD_FAILURE() << "No new infobars were displayed.";
return false;
@@ -73,15 +73,15 @@
: nullptr;
}
-base::Optional<TestInfoBar::InfoBars> TestInfoBar::GetNewInfoBars() const {
+absl::optional<TestInfoBar::InfoBars> TestInfoBar::GetNewInfoBars() const {
const infobars::ContentInfoBarManager* infobar_manager = GetInfoBarManager();
if (!infobar_manager)
- return base::nullopt;
+ return absl::nullopt;
const InfoBars& infobars = infobar_manager->infobars_;
if ((infobars.size() < starting_infobars_.size()) ||
!std::equal(starting_infobars_.begin(), starting_infobars_.end(),
infobars.begin()))
- return base::nullopt;
+ return absl::nullopt;
return InfoBars(std::next(infobars.begin(), starting_infobars_.size()),
infobars.end());
}
diff --git a/chrome/browser/ui/test/test_infobar.h b/chrome/browser/ui/test/test_infobar.h
index fe7f725..aebdc81f 100644
--- a/chrome/browser/ui/test/test_infobar.h
+++ b/chrome/browser/ui/test/test_infobar.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_UI_TEST_TEST_INFOBAR_H_
#define CHROME_BROWSER_UI_TEST_TEST_INFOBAR_H_
-#include "base/optional.h"
#include "chrome/browser/ui/test/test_browser_ui.h"
#include "components/infobars/core/infobar_delegate.h"
#include "components/infobars/core/infobar_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -49,7 +49,7 @@
// Returns the current infobars that are not already in |starting_infobars_|.
// Fails (i.e. returns nullopt) if the current set of infobars does not begin
// with |starting_infobars_|.
- base::Optional<InfoBars> GetNewInfoBars() const;
+ absl::optional<InfoBars> GetNewInfoBars() const;
InfoBars starting_infobars_;
std::vector<InfoBarDelegateIdentifier> expected_identifiers_;
diff --git a/chrome/browser/ui/thumbnails/thumbnail_image.cc b/chrome/browser/ui/thumbnails/thumbnail_image.cc
index 706b05f..914a337 100644
--- a/chrome/browser/ui/thumbnails/thumbnail_image.cc
+++ b/chrome/browser/ui/thumbnails/thumbnail_image.cc
@@ -70,7 +70,7 @@
}
void ThumbnailImage::AssignSkBitmap(SkBitmap bitmap,
- base::Optional<uint64_t> frame_id) {
+ absl::optional<uint64_t> frame_id) {
thumbnail_id_ = base::Token::CreateRandom();
base::ThreadPool::PostTaskAndReplyWithResult(
@@ -123,7 +123,7 @@
void ThumbnailImage::AssignJPEGData(base::Token thumbnail_id,
base::TimeTicks assign_sk_bitmap_time,
- base::Optional<uint64_t> frame_id_for_trace,
+ absl::optional<uint64_t> frame_id_for_trace,
std::vector<uint8_t> data) {
// If the image is stale (a new thumbnail was assigned or the
// thumbnail was cleared after AssignSkBitmap), ignore it.
@@ -212,7 +212,7 @@
// static
std::vector<uint8_t> ThumbnailImage::CompressBitmap(
SkBitmap bitmap,
- base::Optional<uint64_t> frame_id) {
+ absl::optional<uint64_t> frame_id) {
constexpr int kCompressionQuality = 97;
std::vector<uint8_t> data;
diff --git a/chrome/browser/ui/thumbnails/thumbnail_image.h b/chrome/browser/ui/thumbnails/thumbnail_image.h
index bbff6117..edf845d 100644
--- a/chrome/browser/ui/thumbnails/thumbnail_image.h
+++ b/chrome/browser/ui/thumbnails/thumbnail_image.h
@@ -15,9 +15,9 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/token.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/image/image_skia.h"
namespace base {
@@ -83,7 +83,7 @@
// image passed to OnThumbnailImageAvailable fits the needs of the observer
// for display purposes, without the observer having to further crop the
// image. The default is unspecified.
- void SetSizeHint(const base::Optional<gfx::Size>& size_hint) {
+ void SetSizeHint(const absl::optional<gfx::Size>& size_hint) {
size_hint_ = size_hint;
}
@@ -93,7 +93,7 @@
explicit Subscription(scoped_refptr<ThumbnailImage> thumbnail);
scoped_refptr<ThumbnailImage> thumbnail_;
- base::Optional<gfx::Size> size_hint_;
+ absl::optional<gfx::Size> size_hint_;
UncompressedImageCallback uncompressed_image_callback_;
CompressedImageCallback compressed_image_callback_;
@@ -131,13 +131,13 @@
//
// Even if a callback is not set, the subscription influences
// thumbnail capture. It should be destroyed when updates are not
- // needed. It is designed to be stored in base::Optional, created and
+ // needed. It is designed to be stored in absl::optional, created and
// destroyed as needed.
std::unique_ptr<Subscription> Subscribe();
// Sets the SkBitmap data and notifies observers with the resulting image.
void AssignSkBitmap(SkBitmap bitmap,
- base::Optional<uint64_t> frame_id = base::nullopt);
+ absl::optional<uint64_t> frame_id = absl::nullopt);
// Clears the currently set |data_|, for when the current thumbnail is no
// longer valid to display.
@@ -173,7 +173,7 @@
void AssignJPEGData(base::Token thumbnail_id,
base::TimeTicks assign_sk_bitmap_time,
- base::Optional<uint64_t> frame_id_for_trace,
+ absl::optional<uint64_t> frame_id_for_trace,
std::vector<uint8_t> data);
bool ConvertJPEGDataToImageSkiaAndNotifyObservers();
void NotifyUncompressedDataObservers(base::Token thumbnail_id,
@@ -181,7 +181,7 @@
void NotifyCompressedDataObservers(CompressedThumbnailData data);
static std::vector<uint8_t> CompressBitmap(SkBitmap bitmap,
- base::Optional<uint64_t> frame_id);
+ absl::optional<uint64_t> frame_id);
static gfx::ImageSkia UncompressImage(CompressedThumbnailData compressed);
// Crops and returns a preview from a thumbnail of an entire web page. Uses
diff --git a/chrome/browser/ui/thumbnails/thumbnail_image_unittest.cc b/chrome/browser/ui/thumbnails/thumbnail_image_unittest.cc
index c8be0eb..a9f201f 100644
--- a/chrome/browser/ui/thumbnails/thumbnail_image_unittest.cc
+++ b/chrome/browser/ui/thumbnails/thumbnail_image_unittest.cc
@@ -10,11 +10,11 @@
#include "base/bind.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/scoped_observer.h"
#include "base/test/task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/image/image_skia.h"
namespace {
@@ -90,7 +90,7 @@
}
std::vector<uint8_t> Compress(SkBitmap bitmap) const {
- return ThumbnailImage::CompressBitmap(bitmap, base::nullopt);
+ return ThumbnailImage::CompressBitmap(bitmap, absl::nullopt);
}
bool is_being_observed() const { return is_being_observed_; }
@@ -150,7 +150,7 @@
IgnoreArgs<gfx::ImageSkia>(waiter2.callback()));
SkBitmap bitmap = CreateBitmap(kTestBitmapWidth, kTestBitmapHeight);
- image->AssignSkBitmap(bitmap, base::nullopt);
+ image->AssignSkBitmap(bitmap, absl::nullopt);
waiter1.Wait();
waiter2.Wait();
@@ -173,7 +173,7 @@
IgnoreArgs<gfx::ImageSkia>(waiter2.callback()));
SkBitmap bitmap = CreateBitmap(kTestBitmapWidth, kTestBitmapHeight);
- image->AssignSkBitmap(bitmap, base::nullopt);
+ image->AssignSkBitmap(bitmap, absl::nullopt);
waiter1.Wait();
waiter2.Wait();
@@ -183,7 +183,7 @@
waiter1.Reset();
waiter2.Reset();
- image->AssignSkBitmap(bitmap, base::nullopt);
+ image->AssignSkBitmap(bitmap, absl::nullopt);
waiter1.Wait();
waiter2.Wait();
@@ -206,7 +206,7 @@
IgnoreArgs<ThumbnailImage::CompressedThumbnailData>(waiter2.callback()));
SkBitmap bitmap = CreateBitmap(kTestBitmapWidth, kTestBitmapHeight);
- image->AssignSkBitmap(bitmap, base::nullopt);
+ image->AssignSkBitmap(bitmap, absl::nullopt);
waiter1.Wait();
waiter2.Wait();
@@ -229,7 +229,7 @@
IgnoreArgs<ThumbnailImage::CompressedThumbnailData>(waiter2.callback()));
SkBitmap bitmap = CreateBitmap(kTestBitmapWidth, kTestBitmapHeight);
- image->AssignSkBitmap(bitmap, base::nullopt);
+ image->AssignSkBitmap(bitmap, absl::nullopt);
waiter1.Wait();
waiter2.Wait();
@@ -239,7 +239,7 @@
waiter1.Reset();
waiter2.Reset();
- image->AssignSkBitmap(bitmap, base::nullopt);
+ image->AssignSkBitmap(bitmap, absl::nullopt);
waiter1.Wait();
waiter2.Wait();
@@ -257,7 +257,7 @@
IgnoreArgs<gfx::ImageSkia>(waiter1.callback()));
SkBitmap bitmap = CreateBitmap(kTestBitmapWidth, kTestBitmapHeight);
- image->AssignSkBitmap(bitmap, base::nullopt);
+ image->AssignSkBitmap(bitmap, absl::nullopt);
waiter1.Wait();
EXPECT_TRUE(waiter1.called());
waiter1.Reset();
@@ -285,7 +285,7 @@
IgnoreArgs<ThumbnailImage::CompressedThumbnailData>(waiter.callback()));
SkBitmap bitmap = CreateBitmap(kTestBitmapWidth, kTestBitmapHeight);
- image->AssignSkBitmap(bitmap, base::nullopt);
+ image->AssignSkBitmap(bitmap, absl::nullopt);
waiter.Wait();
EXPECT_TRUE(waiter.called());
waiter.Reset();
@@ -316,7 +316,7 @@
// No observers should be notified if the thumbnail is cleared just
// after assigning a bitmap.
SkBitmap bitmap = CreateBitmap(kTestBitmapWidth, kTestBitmapHeight);
- image->AssignSkBitmap(bitmap, base::nullopt);
+ image->AssignSkBitmap(bitmap, absl::nullopt);
image->ClearData();
async_operation_finished_waiter.Wait();
EXPECT_TRUE(async_operation_finished_waiter.called());
@@ -339,7 +339,7 @@
compressed_image_waiter.callback()));
SkBitmap bitmap = CreateBitmap(kTestBitmapWidth, kTestBitmapHeight);
- image->AssignSkBitmap(bitmap, base::nullopt);
+ image->AssignSkBitmap(bitmap, absl::nullopt);
compressed_image_waiter.Wait();
uncompressed_image_waiter.Wait();
EXPECT_TRUE(compressed_image_waiter.called());
@@ -385,7 +385,7 @@
IgnoreArgs<gfx::ImageSkia>(uncompressed_image_waiter.callback()));
SkBitmap bitmap = CreateBitmap(kTestBitmapWidth, kTestBitmapHeight);
- image->AssignSkBitmap(bitmap, base::nullopt);
+ image->AssignSkBitmap(bitmap, absl::nullopt);
uncompressed_image_waiter.Wait();
EXPECT_TRUE(uncompressed_image_waiter.called());
uncompressed_image_waiter.Reset();
diff --git a/chrome/browser/ui/thumbnails/thumbnail_tab_helper.cc b/chrome/browser/ui/thumbnails/thumbnail_tab_helper.cc
index 34d71ac3..0706611 100644
--- a/chrome/browser/ui/thumbnails/thumbnail_tab_helper.cc
+++ b/chrome/browser/ui/thumbnails/thumbnail_tab_helper.cc
@@ -13,7 +13,6 @@
#include "base/check_op.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
@@ -30,6 +29,7 @@
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/geometry/size_f.h"
#include "ui/gfx/scrollbar_size.h"
@@ -254,7 +254,7 @@
base::TimeTicks::Now() - start_time,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromSeconds(1), 50);
- StoreThumbnail(CaptureType::kCopyFromView, bitmap, base::nullopt);
+ StoreThumbnail(CaptureType::kCopyFromView, bitmap, absl::nullopt);
}
void ThumbnailTabHelper::StoreThumbnailForBackgroundCapture(
@@ -265,7 +265,7 @@
void ThumbnailTabHelper::StoreThumbnail(CaptureType type,
const SkBitmap& bitmap,
- base::Optional<uint64_t> frame_id) {
+ absl::optional<uint64_t> frame_id) {
// Failed requests will return an empty bitmap. In tests this can be triggered
// on threads other than the UI thread.
if (bitmap.drawsNothing())
diff --git a/chrome/browser/ui/thumbnails/thumbnail_tab_helper.h b/chrome/browser/ui/thumbnails/thumbnail_tab_helper.h
index 0c04b03..287c351 100644
--- a/chrome/browser/ui/thumbnails/thumbnail_tab_helper.h
+++ b/chrome/browser/ui/thumbnails/thumbnail_tab_helper.h
@@ -9,7 +9,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observer.h"
#include "base/time/time.h"
#include "chrome/browser/ui/thumbnails/thumbnail_capture_info.h"
@@ -18,6 +17,7 @@
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class BackgroundThumbnailCapturer;
class ThumbnailScheduler;
@@ -56,7 +56,7 @@
uint64_t frame_id);
void StoreThumbnail(CaptureType type,
const SkBitmap& bitmap,
- base::Optional<uint64_t> frame_id);
+ absl::optional<uint64_t> frame_id);
// Clears the data associated to the currently set thumbnail. For when the
// thumbnail is no longer valid.
diff --git a/chrome/browser/ui/thumbnails/thumbnail_tab_helper_browsertest.cc b/chrome/browser/ui/thumbnails/thumbnail_tab_helper_browsertest.cc
index 6ecc30d0..2a4809e 100644
--- a/chrome/browser/ui/thumbnails/thumbnail_tab_helper_browsertest.cc
+++ b/chrome/browser/ui/thumbnails/thumbnail_tab_helper_browsertest.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/optional.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "chrome/browser/resource_coordinator/session_restore_policy.h"
@@ -21,6 +20,7 @@
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#if BUILDFLAG(ENABLE_SESSION_SERVICE)
@@ -34,7 +34,7 @@
ThumbnailWaiter() = default;
~ThumbnailWaiter() = default;
- base::Optional<gfx::ImageSkia> WaitForThumbnail(ThumbnailImage* thumbnail) {
+ absl::optional<gfx::ImageSkia> WaitForThumbnail(ThumbnailImage* thumbnail) {
std::unique_ptr<ThumbnailImage::Subscription> subscription =
thumbnail->Subscribe();
subscription->SetUncompressedImageCallback(base::BindRepeating(
@@ -52,7 +52,7 @@
private:
base::RunLoop run_loop_;
- base::Optional<gfx::ImageSkia> image_;
+ absl::optional<gfx::ImageSkia> image_;
};
} // anonymous namespace
@@ -132,7 +132,7 @@
<< " tab at index " << tab_index << " already has data.";
ThumbnailWaiter waiter;
- const base::Optional<gfx::ImageSkia> data =
+ const absl::optional<gfx::ImageSkia> data =
waiter.WaitForThumbnail(thumbnail.get());
EXPECT_TRUE(thumbnail->has_data())
<< " tab at index " << tab_index << " thumbnail has no data.";
diff --git a/chrome/browser/ui/toolbar/app_menu_icon_controller.cc b/chrome/browser/ui/toolbar/app_menu_icon_controller.cc
index f58fe74..4283d2a 100644
--- a/chrome/browser/ui/toolbar/app_menu_icon_controller.cc
+++ b/chrome/browser/ui/toolbar/app_menu_icon_controller.cc
@@ -122,7 +122,7 @@
}
SkColor AppMenuIconController::GetIconColor(
- const base::Optional<SkColor>& severity_none_color) const {
+ const absl::optional<SkColor>& severity_none_color) const {
const Severity severity = GetTypeAndSeverity().severity;
return ((severity == AppMenuIconController::Severity::NONE) &&
severity_none_color.has_value())
diff --git a/chrome/browser/ui/toolbar/app_menu_icon_controller.h b/chrome/browser/ui/toolbar/app_menu_icon_controller.h
index ca08f5b5..cda6611 100644
--- a/chrome/browser/ui/toolbar/app_menu_icon_controller.h
+++ b/chrome/browser/ui/toolbar/app_menu_icon_controller.h
@@ -8,12 +8,12 @@
#include <stdint.h>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "build/build_config.h"
#include "chrome/browser/ui/global_error/global_error_observer.h"
#include "chrome/browser/ui/global_error/global_error_service.h"
#include "chrome/browser/upgrade_detector/upgrade_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/models/image_model.h"
@@ -78,7 +78,7 @@
// |severity_none_color|, if provided, will be used when the Severity is NONE.
// Otherwise the basic toolbar button icon color will be used.
SkColor GetIconColor(
- const base::Optional<SkColor>& severity_none_color) const;
+ const absl::optional<SkColor>& severity_none_color) const;
private:
// GlobalErrorObserver:
diff --git a/chrome/browser/ui/toolbar/app_menu_model.cc b/chrome/browser/ui/toolbar/app_menu_model.cc
index 80ca3f3..0bcb521 100644
--- a/chrome/browser/ui/toolbar/app_menu_model.cc
+++ b/chrome/browser/ui/toolbar/app_menu_model.cc
@@ -128,15 +128,15 @@
// Returns the appropriate menu label for the IDC_INSTALL_PWA command if
// available.
-base::Optional<std::u16string> GetInstallPWAAppMenuItemName(Browser* browser) {
+absl::optional<std::u16string> GetInstallPWAAppMenuItemName(Browser* browser) {
WebContents* web_contents =
browser->tab_strip_model()->GetActiveWebContents();
if (!web_contents)
- return base::nullopt;
+ return absl::nullopt;
std::u16string app_name =
webapps::AppBannerManager::GetInstallableWebAppName(web_contents);
if (app_name.empty())
- return base::nullopt;
+ return absl::nullopt;
return l10n_util::GetStringFUTF16(IDS_INSTALL_TO_OS_LAUNCH_SURFACE,
ui::EscapeMenuLabelAmpersands(app_name));
}
@@ -347,7 +347,7 @@
DCHECK(app_menu_icon_controller_);
return ui::ImageModel::FromVectorIcon(
kBrowserToolsUpdateIcon,
- app_menu_icon_controller_->GetIconColor(base::nullopt));
+ app_menu_icon_controller_->GetIconColor(absl::nullopt));
}
return ui::ImageModel();
}
@@ -823,10 +823,10 @@
AddItemWithStringId(IDC_FIND, IDS_FIND);
- if (base::Optional<std::u16string> name =
+ if (absl::optional<std::u16string> name =
GetInstallPWAAppMenuItemName(browser_)) {
AddItem(IDC_INSTALL_PWA, *name);
- } else if (base::Optional<web_app::AppId> app_id =
+ } else if (absl::optional<web_app::AppId> app_id =
web_app::GetWebAppForActiveTab(browser_)) {
auto* provider = web_app::WebAppProvider::Get(browser_->profile());
const std::u16string short_name =
@@ -850,7 +850,7 @@
} else if (dom_distiller::ShowReaderModeOption(
browser_->profile()->GetPrefs())) {
// Show the menu option if the page is distillable.
- base::Optional<dom_distiller::DistillabilityResult> distillability =
+ absl::optional<dom_distiller::DistillabilityResult> distillability =
dom_distiller::GetLatestResult(
browser()->tab_strip_model()->GetActiveWebContents());
if (distillability && distillability.value().is_distillable)
diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
index 9423ce9..84b8122 100644
--- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
+++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
@@ -531,7 +531,7 @@
void RecentTabsSubMenuModel::BuildLocalTabItem(
SessionID session_id,
- base::Optional<tab_groups::TabGroupVisualData> visual_data,
+ absl::optional<tab_groups::TabGroupVisualData> visual_data,
const std::u16string& title,
const GURL& url,
int curr_model_index) {
diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h
index e717b599..064e38f 100644
--- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h
+++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h
@@ -99,7 +99,7 @@
// add it to the menumodel at |curr_model_index|.
void BuildLocalTabItem(
SessionID session_id,
- base::Optional<tab_groups::TabGroupVisualData> visual_data,
+ absl::optional<tab_groups::TabGroupVisualData> visual_data,
const std::u16string& title,
const GURL& url,
int curr_model_index);
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc b/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc
index e9cc512..e5eafa5 100644
--- a/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc
+++ b/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc
@@ -1009,7 +1009,7 @@
}
})",
extension_id.c_str());
- base::Optional<base::Value> parsed = base::JSONReader::Read(json);
+ absl::optional<base::Value> parsed = base::JSONReader::Read(json);
policy::PolicyMap map;
map.Set("ExtensionSettings", policy::POLICY_LEVEL_MANDATORY,
policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_PLATFORM,
diff --git a/chrome/browser/ui/uma_browsing_activity_observer.cc b/chrome/browser/ui/uma_browsing_activity_observer.cc
index d8a0c1f..5079dc1 100644
--- a/chrome/browser/ui/uma_browsing_activity_observer.cc
+++ b/chrome/browser/ui/uma_browsing_activity_observer.cc
@@ -195,7 +195,7 @@
const Browser* current_browser = BrowserList::GetInstance()->GetLastActive();
if (current_browser) {
TabStripModel* const tab_strip_model = current_browser->tab_strip_model();
- const base::Optional<tab_groups::TabGroupId> active_group =
+ const absl::optional<tab_groups::TabGroupId> active_group =
tab_strip_model->GetTabGroupForTab(tab_strip_model->active_index());
UMA_HISTOGRAM_COUNTS_100("Tabs.TabCountInGroupPerLoad",
active_group.has_value()
diff --git a/chrome/browser/ui/unload_controller.cc b/chrome/browser/ui/unload_controller.cc
index b7e45c3d..19fb47b 100644
--- a/chrome/browser/ui/unload_controller.cc
+++ b/chrome/browser/ui/unload_controller.cc
@@ -102,7 +102,7 @@
bool proceed) {
if (!proceed) {
DevToolsWindow::OnPageCloseCanceled(contents);
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
browser_->tab_strip_model()->GetTabGroupForTab(
browser_->tab_strip_model()->GetIndexOfWebContents(contents));
if (group.has_value())
diff --git a/chrome/browser/ui/user_education/feature_promo_snooze_service.cc b/chrome/browser/ui/user_education/feature_promo_snooze_service.cc
index e30b3204..e12f6002 100644
--- a/chrome/browser/ui/user_education/feature_promo_snooze_service.cc
+++ b/chrome/browser/ui/user_education/feature_promo_snooze_service.cc
@@ -9,7 +9,6 @@
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/util/values/values_util.h"
#include "base/values.h"
@@ -17,6 +16,7 @@
#include "components/feature_engagement/public/feature_constants.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/scoped_user_pref_update.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
// Snooze data will be saved as a dictionary in the PrefService of a profile.
@@ -182,30 +182,30 @@
int FeaturePromoSnoozeService::GetSnoozeCount(
const base::Feature& iph_feature) {
- base::Optional<SnoozeData> snooze_data = ReadSnoozeData(iph_feature);
+ absl::optional<SnoozeData> snooze_data = ReadSnoozeData(iph_feature);
return snooze_data ? snooze_data->snooze_count : 0;
}
-base::Optional<FeaturePromoSnoozeService::SnoozeData>
+absl::optional<FeaturePromoSnoozeService::SnoozeData>
FeaturePromoSnoozeService::ReadSnoozeData(const base::Feature& iph_feature) {
std::string path_prefix = std::string(iph_feature.name) + ".";
const base::DictionaryValue* pref_data =
profile_->GetPrefs()->GetDictionary(kIPHSnoozeDataPath);
- base::Optional<bool> is_dismissed =
+ absl::optional<bool> is_dismissed =
pref_data->FindBoolPath(path_prefix + kIPHIsDismissedPath);
- base::Optional<base::Time> show_time = util::ValueToTime(
+ absl::optional<base::Time> show_time = util::ValueToTime(
pref_data->FindPath(path_prefix + kIPHLastShowTimePath));
- base::Optional<base::Time> snooze_time = util::ValueToTime(
+ absl::optional<base::Time> snooze_time = util::ValueToTime(
pref_data->FindPath(path_prefix + kIPHLastSnoozeTimePath));
- base::Optional<base::TimeDelta> snooze_duration = util::ValueToTimeDelta(
+ absl::optional<base::TimeDelta> snooze_duration = util::ValueToTimeDelta(
pref_data->FindPath(path_prefix + kIPHLastSnoozeDurationPath));
- base::Optional<int> snooze_count =
+ absl::optional<int> snooze_count =
pref_data->FindIntPath(path_prefix + kIPHSnoozeCountPath);
- base::Optional<int> show_count =
+ absl::optional<int> show_count =
pref_data->FindIntPath(path_prefix + kIPHShowCountPath);
- base::Optional<SnoozeData> snooze_data;
+ absl::optional<SnoozeData> snooze_data;
if (!is_dismissed)
return snooze_data;
diff --git a/chrome/browser/ui/user_education/feature_promo_snooze_service.h b/chrome/browser/ui/user_education/feature_promo_snooze_service.h
index 85ec2d74..5f8c11d 100644
--- a/chrome/browser/ui/user_education/feature_promo_snooze_service.h
+++ b/chrome/browser/ui/user_education/feature_promo_snooze_service.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_SNOOZE_SERVICE_H_
#define CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_SNOOZE_SERVICE_H_
-#include "base/optional.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
struct Feature;
@@ -85,7 +85,7 @@
int show_count = 0;
};
- base::Optional<SnoozeData> ReadSnoozeData(const base::Feature& iph_feature);
+ absl::optional<SnoozeData> ReadSnoozeData(const base::Feature& iph_feature);
void SaveSnoozeData(const base::Feature& iph_feature,
const SnoozeData& snooze_data);
diff --git a/chrome/browser/ui/user_education/feature_promo_text_replacements.h b/chrome/browser/ui/user_education/feature_promo_text_replacements.h
index 43962f5..ab805b4 100644
--- a/chrome/browser/ui/user_education/feature_promo_text_replacements.h
+++ b/chrome/browser/ui/user_education/feature_promo_text_replacements.h
@@ -7,7 +7,7 @@
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Context-specific text replacements for an in-product help bubble's
// body text.
@@ -37,7 +37,7 @@
std::u16string ApplyTo(int string_specifier) const;
private:
- base::Optional<std::u16string> string_replacement_;
+ absl::optional<std::u16string> string_replacement_;
};
#endif // CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_TEXT_REPLACEMENTS_H_
diff --git a/chrome/browser/ui/user_education/feature_tutorials.cc b/chrome/browser/ui/user_education/feature_tutorials.cc
index 741f5c8..9404310 100644
--- a/chrome/browser/ui/user_education/feature_tutorials.cc
+++ b/chrome/browser/ui/user_education/feature_tutorials.cc
@@ -7,8 +7,8 @@
#include <utility>
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/strings/string_piece.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -28,14 +28,14 @@
return "";
}
-base::Optional<FeatureTutorial> GetFeatureTutorialFromStringId(
+absl::optional<FeatureTutorial> GetFeatureTutorialFromStringId(
base::StringPiece id) {
for (const auto& p : kTutorialIds) {
if (p.second == id)
return p.first;
}
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<base::StringPiece> GetAllFeatureTutorialStringIds() {
diff --git a/chrome/browser/ui/user_education/feature_tutorials.h b/chrome/browser/ui/user_education/feature_tutorials.h
index c096226..858eb5d 100644
--- a/chrome/browser/ui/user_education/feature_tutorials.h
+++ b/chrome/browser/ui/user_education/feature_tutorials.h
@@ -7,8 +7,8 @@
#include <vector>
-#include "base/optional.h"
#include "base/strings/string_piece_forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// A tutorial's identifier. Each defined tutorial has a FeatureTutorial enum
// value.
@@ -23,7 +23,7 @@
// Translate a string ID GetStringIdForFeatureTutorial() back to a
// FeatureTutorial.
-base::Optional<FeatureTutorial> GetFeatureTutorialFromStringId(
+absl::optional<FeatureTutorial> GetFeatureTutorialFromStringId(
base::StringPiece id);
// Get the string IDs of all defined tutorials.
diff --git a/chrome/browser/ui/user_education/reopen_tab_in_product_help_trigger.cc b/chrome/browser/ui/user_education/reopen_tab_in_product_help_trigger.cc
index c8b6d258..0b3c40a5 100644
--- a/chrome/browser/ui/user_education/reopen_tab_in_product_help_trigger.cc
+++ b/chrome/browser/ui/user_education/reopen_tab_in_product_help_trigger.cc
@@ -7,11 +7,11 @@
#include <utility>
#include "base/metrics/field_trial_params.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "components/feature_engagement/public/event_constants.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/feature_engagement/public/tracker.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -28,7 +28,7 @@
const base::TimeDelta kDefaultNewTabOpenedTimeout =
base::TimeDelta::FromSeconds(10);
-base::Optional<base::TimeDelta> GetTimeoutFromFieldTrialParam(
+absl::optional<base::TimeDelta> GetTimeoutFromFieldTrialParam(
const std::string& name) {
std::string str = base::GetFieldTrialParamValueByFeature(
feature_engagement::kIPHReopenTabFeature, name);
@@ -39,7 +39,7 @@
return base::TimeDelta::FromSeconds(timeout_seconds);
}
- return base::Optional<base::TimeDelta>();
+ return absl::optional<base::TimeDelta>();
}
} // namespace
diff --git a/chrome/browser/ui/views/accessibility/accessibility_focus_highlight.h b/chrome/browser/ui/views/accessibility/accessibility_focus_highlight.h
index 72adfbd..acba5f53 100644
--- a/chrome/browser/ui/views/accessibility/accessibility_focus_highlight.h
+++ b/chrome/browser/ui/views/accessibility/accessibility_focus_highlight.h
@@ -132,7 +132,7 @@
PrefChangeRegistrar profile_pref_registrar_;
// For observing focus notifications.
- base::Optional<base::CallbackListSubscription> focus_changed_subscription_;
+ absl::optional<base::CallbackListSubscription> focus_changed_subscription_;
};
#endif // CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_ACCESSIBILITY_FOCUS_HIGHLIGHT_H_
diff --git a/chrome/browser/ui/views/accessibility/browser_accessibility_uitest_auralinux.cc b/chrome/browser/ui/views/accessibility/browser_accessibility_uitest_auralinux.cc
index e5c47569..f97be3e 100644
--- a/chrome/browser/ui/views/accessibility/browser_accessibility_uitest_auralinux.cc
+++ b/chrome/browser/ui/views/accessibility/browser_accessibility_uitest_auralinux.cc
@@ -234,7 +234,7 @@
webview->GetViewAccessibility().GetNativeObject();
// Gets the index in its parents for the WebView.
- base::Optional<int> index =
+ absl::optional<int> index =
static_cast<ui::AXPlatformNodeBase*>(
ui::AXPlatformNode::FromNativeViewAccessible(accessible))
->GetIndexInParent();
diff --git a/chrome/browser/ui/views/accessibility/caption_bubble_controller_views.cc b/chrome/browser/ui/views/accessibility/caption_bubble_controller_views.cc
index a914025..acfcad9 100644
--- a/chrome/browser/ui/views/accessibility/caption_bubble_controller_views.cc
+++ b/chrome/browser/ui/views/accessibility/caption_bubble_controller_views.cc
@@ -93,7 +93,7 @@
}
void CaptionBubbleControllerViews::UpdateCaptionStyle(
- base::Optional<ui::CaptionStyle> caption_style) {
+ absl::optional<ui::CaptionStyle> caption_style) {
caption_bubble_->UpdateCaptionStyle(caption_style);
}
@@ -105,7 +105,7 @@
web_contents ? views::Widget::GetTopLevelWidgetForNativeView(
web_contents->GetNativeView())
: nullptr;
- base::Optional<gfx::Rect> context_bounds = base::nullopt;
+ absl::optional<gfx::Rect> context_bounds = absl::nullopt;
if (context_widget)
context_bounds = context_widget->GetClientAreaBoundsInScreen();
caption_bubble_models_.emplace(
diff --git a/chrome/browser/ui/views/accessibility/caption_bubble_controller_views.h b/chrome/browser/ui/views/accessibility/caption_bubble_controller_views.h
index 427a918..62e9239 100644
--- a/chrome/browser/ui/views/accessibility/caption_bubble_controller_views.h
+++ b/chrome/browser/ui/views/accessibility/caption_bubble_controller_views.h
@@ -52,7 +52,7 @@
// Called when the caption style changes.
void UpdateCaptionStyle(
- base::Optional<ui::CaptionStyle> caption_style) override;
+ absl::optional<ui::CaptionStyle> caption_style) override;
private:
friend class CaptionBubbleControllerViewsTest;
diff --git a/chrome/browser/ui/views/accessibility/caption_bubble_controller_views_browsertest.cc b/chrome/browser/ui/views/accessibility/caption_bubble_controller_views_browsertest.cc
index d455386..45dadd3 100644
--- a/chrome/browser/ui/views/accessibility/caption_bubble_controller_views_browsertest.cc
+++ b/chrome/browser/ui/views/accessibility/caption_bubble_controller_views_browsertest.cc
@@ -446,7 +446,7 @@
int error_icon_height = 20;
ui::CaptionStyle caption_style;
- GetController()->UpdateCaptionStyle(base::nullopt);
+ GetController()->UpdateCaptionStyle(absl::nullopt);
OnPartialTranscription("Hamsters' teeth never stop growing");
EXPECT_EQ(text_size, GetLabel()->font_list().GetFontSize());
EXPECT_EQ(text_size, GetTitle()->font_list().GetFontSize());
@@ -526,7 +526,7 @@
ui::CaptionStyle caption_style;
- GetController()->UpdateCaptionStyle(base::nullopt);
+ GetController()->UpdateCaptionStyle(absl::nullopt);
OnPartialTranscription("Koalas aren't bears: they are marsupials.");
EXPECT_EQ(default_font,
GetLabel()->font_list().GetPrimaryFont().GetFontName());
@@ -571,7 +571,7 @@
SkColor default_color = SK_ColorWHITE;
ui::CaptionStyle caption_style;
- GetController()->UpdateCaptionStyle(base::nullopt);
+ GetController()->UpdateCaptionStyle(absl::nullopt);
OnPartialTranscription(
"Marsupials first evolved in South America about 100 million years ago.");
EXPECT_EQ(default_color, GetLabel()->GetEnabledColor());
@@ -635,7 +635,7 @@
SkColor default_color = SkColorSetA(gfx::kGoogleGrey900, 230);
ui::CaptionStyle caption_style;
- GetController()->UpdateCaptionStyle(base::nullopt);
+ GetController()->UpdateCaptionStyle(absl::nullopt);
OnPartialTranscription("Most marsupials are nocturnal.");
EXPECT_EQ(default_color, GetBubble()->color());
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc
index 372d6ee..2d1e09e 100644
--- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc
+++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc
@@ -112,7 +112,7 @@
widget);
// Some windows need to be placed in special containers, for example to make
// them visible at the login or lock screen.
- base::Optional<int> container_id;
+ absl::optional<int> container_id;
if (IsLoginFeedbackModalDialog(app_window()))
container_id = ash::kShellWindowId_LockSystemModalContainer;
else if (create_params.is_ime_window)
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc
index a29cf53..8939362 100644
--- a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc
@@ -1133,8 +1133,8 @@
}
void AutofillPopupViewNativeViews::OnSelectedRowChanged(
- base::Optional<int> previous_row_selection,
- base::Optional<int> current_row_selection) {
+ absl::optional<int> previous_row_selection,
+ absl::optional<int> current_row_selection) {
if (previous_row_selection) {
rows_[*previous_row_selection]->SetSelected(false);
}
@@ -1148,8 +1148,8 @@
DoUpdateBoundsAndRedrawPopup();
}
-base::Optional<int32_t> AutofillPopupViewNativeViews::GetAxUniqueId() {
- return base::Optional<int32_t>(
+absl::optional<int32_t> AutofillPopupViewNativeViews::GetAxUniqueId() {
+ return absl::optional<int32_t>(
AutofillPopupBaseView::GetViewAccessibility().GetUniqueId());
}
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.h b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.h
index 3789e6c..c548888 100644
--- a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.h
+++ b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.h
@@ -8,9 +8,9 @@
#include <memory>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/ui/autofill/autofill_popup_view.h"
#include "chrome/browser/ui/views/autofill/autofill_popup_base_view.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_action_data.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/gfx/color_palette.h"
@@ -92,7 +92,7 @@
// AutofillPopupView:
void Show() override;
void Hide() override;
- base::Optional<int32_t> GetAxUniqueId() override;
+ absl::optional<int32_t> GetAxUniqueId() override;
// AutofillPopupBaseView:
// TODO(crbug.com/831603): Remove these overrides and the corresponding
@@ -102,8 +102,8 @@
AutofillPopupController* controller() { return controller_; }
private:
- void OnSelectedRowChanged(base::Optional<int> previous_row_selection,
- base::Optional<int> current_row_selection) override;
+ void OnSelectedRowChanged(absl::optional<int> previous_row_selection,
+ absl::optional<int> current_row_selection) override;
void OnSuggestionsChanged() override;
// Creates child views based on the suggestions given by |controller_|.
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
index d5dc119..b302e40 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -407,7 +407,7 @@
}
// Index into the model the drop is over. This is relative to the root node.
- base::Optional<size_t> index;
+ absl::optional<size_t> index;
// Drop constants.
DragOperation operation = DragOperation::kNone;
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_browsertest.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_browsertest.cc
index 00a2ca0..fc3cf17 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_browsertest.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_browsertest.cc
@@ -119,7 +119,7 @@
// All bookmark navigations should have a null initiator, as there's no
// web origin from which the navigation is triggered.
- ASSERT_EQ(base::nullopt, observer.last_initiator_origin());
+ ASSERT_EQ(absl::nullopt, observer.last_initiator_origin());
}
private:
@@ -258,7 +258,7 @@
content::WebContents* web_contents,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin) override {
+ const absl::optional<url::Origin>& initiating_origin) override {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
EXPECT_TRUE(url_invoked_.is_empty());
diff --git a/chrome/browser/ui/views/borealis/borealis_installer_view.cc b/chrome/browser/ui/views/borealis/borealis_installer_view.cc
index 2d7efe9..5078f39 100644
--- a/chrome/browser/ui/views/borealis/borealis_installer_view.cc
+++ b/chrome/browser/ui/views/borealis/borealis_installer_view.cc
@@ -10,7 +10,6 @@
#include "ash/public/cpp/window_properties.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ash/borealis/borealis_context_manager.h"
@@ -24,6 +23,7 @@
#include "chrome/grit/chrome_unscaled_resources.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/aura/window.h"
diff --git a/chrome/browser/ui/views/borealis/borealis_installer_view.h b/chrome/browser/ui/views/borealis/borealis_installer_view.h
index 703c6b0..441a69b 100644
--- a/chrome/browser/ui/views/borealis/borealis_installer_view.h
+++ b/chrome/browser/ui/views/borealis/borealis_installer_view.h
@@ -99,7 +99,7 @@
State state_ = State::kConfirmInstall;
InstallingState installing_state_ = InstallingState::kInactive;
- base::Optional<borealis::BorealisInstallResult> result_;
+ absl::optional<borealis::BorealisInstallResult> result_;
};
#endif // CHROME_BROWSER_UI_VIEWS_BOREALIS_BOREALIS_INSTALLER_VIEW_H_
diff --git a/chrome/browser/ui/views/browser_commands_views.cc b/chrome/browser/ui/views/browser_commands_views.cc
index be720cd..5689088 100644
--- a/chrome/browser/ui/views/browser_commands_views.cc
+++ b/chrome/browser/ui/views/browser_commands_views.cc
@@ -44,11 +44,11 @@
namespace chrome {
-base::Optional<int> GetKeyboardFocusedTabIndex(const Browser* browser) {
+absl::optional<int> GetKeyboardFocusedTabIndex(const Browser* browser) {
BrowserView* view = BrowserView::GetBrowserViewForBrowser(browser);
if (view && view->tabstrip())
return view->tabstrip()->GetFocusedTabIndex();
- return base::nullopt;
+ return absl::nullopt;
}
void ExecuteUIDebugCommand(int id, const Browser* browser) {
diff --git a/chrome/browser/ui/views/chooser_bubble_testapi_views.cc b/chrome/browser/ui/views/chooser_bubble_testapi_views.cc
index 06e778a..c922abb 100644
--- a/chrome/browser/ui/views/chooser_bubble_testapi_views.cc
+++ b/chrome/browser/ui/views/chooser_bubble_testapi_views.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/ui/chooser_bubble_testapi.h"
-#include "base/optional.h"
#include "base/test/bind.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/widget/any_widget_observer.h"
#include "ui/views/widget/widget.h"
@@ -41,7 +41,7 @@
}
private:
- base::Optional<base::RunLoop> run_loop_;
+ absl::optional<base::RunLoop> run_loop_;
views::AnyWidgetObserver observer_;
};
diff --git a/chrome/browser/ui/views/chrome_web_dialog_view.cc b/chrome/browser/ui/views/chrome_web_dialog_view.cc
index a6faff5..61323fa 100644
--- a/chrome/browser/ui/views/chrome_web_dialog_view.cc
+++ b/chrome/browser/ui/views/chrome_web_dialog_view.cc
@@ -51,7 +51,7 @@
content::BrowserContext* context,
ui::WebDialogDelegate* delegate,
bool show) {
- return ShowWebDialogWithParams(parent, context, delegate, base::nullopt,
+ return ShowWebDialogWithParams(parent, context, delegate, absl::nullopt,
show);
}
@@ -59,7 +59,7 @@
gfx::NativeView parent,
content::BrowserContext* context,
ui::WebDialogDelegate* delegate,
- base::Optional<views::Widget::InitParams> extra_params,
+ absl::optional<views::Widget::InitParams> extra_params,
bool show) {
views::WebDialogView* view = new views::WebDialogView(
context, delegate, std::make_unique<ChromeWebContentsHandler>());
diff --git a/chrome/browser/ui/views/chrome_web_dialog_view.h b/chrome/browser/ui/views/chrome_web_dialog_view.h
index 305567ee..926fea60 100644
--- a/chrome/browser/ui/views/chrome_web_dialog_view.h
+++ b/chrome/browser/ui/views/chrome_web_dialog_view.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_VIEWS_CHROME_WEB_DIALOG_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_CHROME_WEB_DIALOG_VIEW_H_
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/widget/widget.h"
@@ -24,7 +24,7 @@
gfx::NativeView parent,
content::BrowserContext* context,
ui::WebDialogDelegate* delegate,
- base::Optional<views::Widget::InitParams> extra_params,
+ absl::optional<views::Widget::InitParams> extra_params,
bool show = true);
} // namespace chrome
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_list_controller.cc b/chrome/browser/ui/views/desktop_capture/desktop_media_list_controller.cc
index 509712f..1afd384d 100644
--- a/chrome/browser/ui/views/desktop_capture/desktop_media_list_controller.cc
+++ b/chrome/browser/ui/views/desktop_capture/desktop_media_list_controller.cc
@@ -69,9 +69,9 @@
view_->RequestFocus();
}
-base::Optional<content::DesktopMediaID>
+absl::optional<content::DesktopMediaID>
DesktopMediaListController::GetSelection() const {
- return view_ ? view_->GetSelection() : base::nullopt;
+ return view_ ? view_->GetSelection() : absl::nullopt;
}
void DesktopMediaListController::OnSourceListLayoutChanged() {
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_list_controller.h b/chrome/browser/ui/views/desktop_capture/desktop_media_list_controller.h
index 64acf32..f6636c40 100644
--- a/chrome/browser/ui/views/desktop_capture/desktop_media_list_controller.h
+++ b/chrome/browser/ui/views/desktop_capture/desktop_media_list_controller.h
@@ -46,7 +46,7 @@
// Returns the DesktopMediaID of the selected element of this list, or
// nullopt if no element is selected.
- virtual base::Optional<content::DesktopMediaID> GetSelection() = 0;
+ virtual absl::optional<content::DesktopMediaID> GetSelection() = 0;
// Returns the SourceListListener to use to notify this ListView of changes
// to the backing DesktopMediaList.
@@ -81,7 +81,7 @@
// Returns the DesktopMediaID corresponding to the current selection in this
// controller's view, if there is one.
- base::Optional<content::DesktopMediaID> GetSelection() const;
+ absl::optional<content::DesktopMediaID> GetSelection() const;
// These three methods are called by the view to inform the controller of
// events. The first two indicate changes in the visual state of the view; the
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_list_view.cc b/chrome/browser/ui/views/desktop_capture/desktop_media_list_view.cc
index 604e163..91a6ec6 100644
--- a/chrome/browser/ui/views/desktop_capture/desktop_media_list_view.cc
+++ b/chrome/browser/ui/views/desktop_capture/desktop_media_list_view.cc
@@ -144,10 +144,10 @@
return true;
}
-base::Optional<content::DesktopMediaID> DesktopMediaListView::GetSelection() {
+absl::optional<content::DesktopMediaID> DesktopMediaListView::GetSelection() {
DesktopMediaSourceView* view = GetSelectedView();
- return view ? base::Optional<content::DesktopMediaID>(view->source_id())
- : base::nullopt;
+ return view ? absl::optional<content::DesktopMediaID>(view->source_id())
+ : absl::nullopt;
}
DesktopMediaListController::SourceListListener*
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_list_view.h b/chrome/browser/ui/views/desktop_capture/desktop_media_list_view.h
index 8ed5636..161e591 100644
--- a/chrome/browser/ui/views/desktop_capture/desktop_media_list_view.h
+++ b/chrome/browser/ui/views/desktop_capture/desktop_media_list_view.h
@@ -38,7 +38,7 @@
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
// DesktopMediaListController::ListView:
- base::Optional<content::DesktopMediaID> GetSelection() override;
+ absl::optional<content::DesktopMediaID> GetSelection() override;
DesktopMediaListController::SourceListListener* GetSourceListListener()
override;
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc
index f7d6209..d7b74f5 100644
--- a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc
+++ b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc
@@ -522,7 +522,7 @@
bool DesktopMediaPickerDialogView::Accept() {
DCHECK(IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
// Ok button should only be enabled when a source is selected.
- base::Optional<DesktopMediaID> source_optional =
+ absl::optional<DesktopMediaID> source_optional =
accepted_source_.has_value() ? accepted_source_
: GetSelectedController()->GetSelection();
DesktopMediaID source = source_optional.value();
@@ -592,7 +592,7 @@
}
void DesktopMediaPickerDialogView::AcceptSpecificSource(DesktopMediaID source) {
- accepted_source_ = base::Optional<DesktopMediaID>(source);
+ accepted_source_ = absl::optional<DesktopMediaID>(source);
AcceptSource();
}
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.h b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.h
index 21a7edd..23ae5a8 100644
--- a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.h
+++ b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.h
@@ -92,7 +92,7 @@
DialogSource dialog_source_;
- base::Optional<content::DesktopMediaID> accepted_source_;
+ absl::optional<content::DesktopMediaID> accepted_source_;
};
// Implementation of DesktopMediaPicker for Views.
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.cc b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.cc
index 9f7664ec..45a3bd1c 100644
--- a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.cc
+++ b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.cc
@@ -98,13 +98,13 @@
}
}
-base::Optional<int> DesktopMediaPickerViewsTestApi::GetSelectedSourceId()
+absl::optional<int> DesktopMediaPickerViewsTestApi::GetSelectedSourceId()
const {
DesktopMediaListController* controller =
picker_->dialog_->GetSelectedController();
- base::Optional<content::DesktopMediaID> source = controller->GetSelection();
- return source.has_value() ? base::Optional<int>(source.value().id)
- : base::nullopt;
+ absl::optional<content::DesktopMediaID> source = controller->GetSelection();
+ return source.has_value() ? absl::optional<int>(source.value().id)
+ : absl::nullopt;
}
bool DesktopMediaPickerViewsTestApi::HasSourceAtIndex(size_t index) const {
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.h b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.h
index 1983125..966b0cc 100644
--- a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.h
+++ b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_test_api.h
@@ -40,7 +40,7 @@
bool HasSourceAtIndex(size_t index) const;
void FocusSourceAtIndex(size_t index, bool select = true);
void DoubleTapSourceAtIndex(size_t index);
- base::Optional<int> GetSelectedSourceId() const;
+ absl::optional<int> GetSelectedSourceId() const;
views::View* GetSelectedListView();
private:
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_unittest.cc b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_unittest.cc
index 8c834064..a661dd4 100644
--- a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_unittest.cc
+++ b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views_unittest.cc
@@ -133,12 +133,12 @@
run_loop_.Quit();
}
- base::Optional<content::DesktopMediaID> WaitForPickerDone() {
+ absl::optional<content::DesktopMediaID> WaitForPickerDone() {
run_loop_.Run();
return picked_id_;
}
- base::Optional<content::DesktopMediaID> picked_id() const {
+ absl::optional<content::DesktopMediaID> picked_id() const {
return picked_id_;
}
@@ -153,7 +153,7 @@
const std::vector<DesktopMediaList::Type> source_types_;
base::RunLoop run_loop_;
- base::Optional<content::DesktopMediaID> picked_id_;
+ absl::optional<content::DesktopMediaID> picked_id_;
std::unique_ptr<views::test::WidgetDestroyedWaiter> widget_destroyed_waiter_;
};
@@ -446,7 +446,7 @@
AddTabSource();
test_api_.FocusSourceAtIndex(0, false);
- EXPECT_EQ(base::nullopt, test_api_.GetSelectedSourceId());
+ EXPECT_EQ(absl::nullopt, test_api_.GetSelectedSourceId());
EXPECT_FALSE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_tab_list.cc b/chrome/browser/ui/views/desktop_capture/desktop_media_tab_list.cc
index d927c93..e6393ef 100644
--- a/chrome/browser/ui/views/desktop_capture/desktop_media_tab_list.cc
+++ b/chrome/browser/ui/views/desktop_capture/desktop_media_tab_list.cc
@@ -162,10 +162,10 @@
return CalculatePreferredSize().height();
}
-base::Optional<content::DesktopMediaID> DesktopMediaTabList::GetSelection() {
+absl::optional<content::DesktopMediaID> DesktopMediaTabList::GetSelection() {
int row = child_->GetFirstSelectedRow();
if (row == -1)
- return base::nullopt;
+ return absl::nullopt;
return controller_->GetSource(row).id;
}
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_tab_list.h b/chrome/browser/ui/views/desktop_capture/desktop_media_tab_list.h
index 22886b4..fe291ae 100644
--- a/chrome/browser/ui/views/desktop_capture/desktop_media_tab_list.h
+++ b/chrome/browser/ui/views/desktop_capture/desktop_media_tab_list.h
@@ -50,7 +50,7 @@
int GetHeightForWidth(int width) const override;
// DesktopMediaListController::ListView:
- base::Optional<content::DesktopMediaID> GetSelection() override;
+ absl::optional<content::DesktopMediaID> GetSelection() override;
DesktopMediaListController::SourceListListener* GetSourceListListener()
override;
diff --git a/chrome/browser/ui/views/desktop_capture/get_current_browsing_context_media_dialog_unittest.cc b/chrome/browser/ui/views/desktop_capture/get_current_browsing_context_media_dialog_unittest.cc
index 64df3f6..b4f0058 100644
--- a/chrome/browser/ui/views/desktop_capture/get_current_browsing_context_media_dialog_unittest.cc
+++ b/chrome/browser/ui/views/desktop_capture/get_current_browsing_context_media_dialog_unittest.cc
@@ -128,7 +128,7 @@
BrowserWithTestWindowTest::TearDown();
}
- base::Optional<content::DesktopMediaID> WaitForDialogDone() {
+ absl::optional<content::DesktopMediaID> WaitForDialogDone() {
run_loop_.Run();
return dialog_id_;
}
@@ -152,7 +152,7 @@
}
protected:
- base::Optional<content::DesktopMediaID> dialog_id_;
+ absl::optional<content::DesktopMediaID> dialog_id_;
int render_process_id_ = MSG_ROUTING_NONE;
int render_frame_id_ = MSG_ROUTING_NONE;
std::unique_ptr<content::WebContents> web_contents_;
diff --git a/chrome/browser/ui/views/download/download_in_progress_dialog_view_unittest.cc b/chrome/browser/ui/views/download/download_in_progress_dialog_view_unittest.cc
index 65d2e92..dfb2f8bf 100644
--- a/chrome/browser/ui/views/download/download_in_progress_dialog_view_unittest.cc
+++ b/chrome/browser/ui/views/download/download_in_progress_dialog_view_unittest.cc
@@ -4,12 +4,12 @@
#include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h"
-#include "base/optional.h"
#include "base/test/bind.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
#include "chrome/test/views/chrome_views_test_base.h"
#include "components/constrained_window/constrained_window_views.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/widget/any_widget_observer.h"
using DownloadInProgressDialogTest = ChromeViewsTestBase;
@@ -23,7 +23,7 @@
auto parent = CreateTestWidget();
parent->Show();
- base::Optional<bool> result;
+ absl::optional<bool> result;
views::NamedWidgetShownWaiter waiter(views::test::AnyWidgetTestPasskey(),
"DownloadInProgressDialogView");
DownloadInProgressDialogView::Show(
diff --git a/chrome/browser/ui/views/download/download_item_view.h b/chrome/browser/ui/views/download/download_item_view.h
index 8b2c74eb..c41a92a 100644
--- a/chrome/browser/ui/views/download/download_item_view.h
+++ b/chrome/browser/ui/views/download/download_item_view.h
@@ -12,7 +12,6 @@
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/task/cancelable_task_tracker.h"
#include "base/time/time.h"
@@ -22,6 +21,7 @@
#include "chrome/browser/icon_loader.h"
#include "chrome/browser/ui/download/download_item_mode.h"
#include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/models/image_model.h"
#include "ui/base/resource/resource_bundle.h"
@@ -251,7 +251,7 @@
bool dragging_ = false;
// Position that a possible drag started at.
- base::Optional<gfx::Point> drag_start_point_;
+ absl::optional<gfx::Point> drag_start_point_;
gfx::ImageSkia file_icon_;
diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc
index a191965..aa3229bb 100644
--- a/chrome/browser/ui/views/download/download_shelf_view.cc
+++ b/chrome/browser/ui/views/download/download_shelf_view.cc
@@ -11,7 +11,6 @@
#include "base/check.h"
#include "base/containers/adapters.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/download/download_ui_model.h"
#include "chrome/browser/themes/theme_properties.h"
@@ -26,6 +25,7 @@
#include "components/download/public/common/download_item.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
@@ -273,8 +273,8 @@
// If COLOR_DOWNLOAD_SHELF is not customized, just use the default button bg
// and text colors.
- base::Optional<SkColor> bg_color;
- base::Optional<SkColor> text_color;
+ absl::optional<SkColor> bg_color;
+ absl::optional<SkColor> text_color;
if (tp->HasCustomColor(ThemeProperties::COLOR_DOWNLOAD_SHELF)) {
// For custom themes, we have to make up a background color for the
// button. Use a slight tint of the shelf background.
diff --git a/chrome/browser/ui/views/extensions/extension_dialog.h b/chrome/browser/ui/views/extensions/extension_dialog.h
index 707c8c9..a8ac874 100644
--- a/chrome/browser/ui/views/extensions/extension_dialog.h
+++ b/chrome/browser/ui/views/extensions/extension_dialog.h
@@ -11,13 +11,13 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "build/chromeos_buildflags.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_host_observer.h"
#include "extensions/browser/process_manager.h"
#include "extensions/browser/process_manager_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/window/dialog_delegate.h"
@@ -63,10 +63,10 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
// |title_color| customizes the color of the window title.
- base::Optional<SkColor> title_color;
+ absl::optional<SkColor> title_color;
// |title_inactive_color| customizes the color of the window title when
// window is inactive.
- base::Optional<SkColor> title_inactive_color;
+ absl::optional<SkColor> title_inactive_color;
#endif
};
// Create and show a dialog with |url| centered over the provided window.
diff --git a/chrome/browser/ui/views/extensions/extension_install_blocked_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_blocked_dialog_view.cc
index 01387ef..a73dca0 100644
--- a/chrome/browser/ui/views/extensions/extension_install_blocked_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_install_blocked_dialog_view.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/i18n/message_formatter.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
@@ -20,6 +19,7 @@
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/common/constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/resource/resource_bundle.h"
diff --git a/chrome/browser/ui/views/extensions/extension_install_blocked_dialog_view.h b/chrome/browser/ui/views/extensions/extension_install_blocked_dialog_view.h
index 7e271a6..5488d98c 100644
--- a/chrome/browser/ui/views/extensions/extension_install_blocked_dialog_view.h
+++ b/chrome/browser/ui/views/extensions/extension_install_blocked_dialog_view.h
@@ -9,7 +9,7 @@
#include <vector>
#include "base/callback_forward.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.h b/chrome/browser/ui/views/extensions/extension_install_dialog_view.h
index 3863db78..1367093 100644
--- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.h
+++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.h
@@ -7,7 +7,6 @@
#include <vector>
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/timer/elapsed_timer.h"
#include "base/timer/timer.h"
@@ -15,6 +14,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/browser/uninstall_reason.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/controls/button/button.h"
@@ -102,7 +102,7 @@
// Used to record time between dialog creation and acceptance, cancellation,
// or dismissal.
- base::Optional<base::ElapsedTimer> install_result_timer_;
+ absl::optional<base::ElapsedTimer> install_result_timer_;
// Used to delay the activation of the install button.
base::OneShotTimer enable_install_timer_;
diff --git a/chrome/browser/ui/views/extensions/extension_view_views.h b/chrome/browser/ui/views/extensions/extension_view_views.h
index d1c927f..0a85af44 100644
--- a/chrome/browser/ui/views/extensions/extension_view_views.h
+++ b/chrome/browser/ui/views/extensions/extension_view_views.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_VIEW_VIEWS_H_
#include "base/compiler_specific.h"
-#include "base/optional.h"
#include "chrome/browser/extensions/extension_view.h"
#include "content/public/browser/native_web_keyboard_event.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
#include "ui/views/controls/webview/webview.h"
@@ -71,7 +71,7 @@
// loaded.
gfx::Size pending_preferred_size_;
- base::Optional<gfx::Size> minimum_size_;
+ absl::optional<gfx::Size> minimum_size_;
// The container this view is in (not necessarily its direct superview).
// Note: the view does not own its container.
diff --git a/chrome/browser/ui/views/extensions/extensions_menu_view_browsertest.cc b/chrome/browser/ui/views/extensions/extensions_menu_view_browsertest.cc
index ebb495d..d01a6f6 100644
--- a/chrome/browser/ui/views/extensions/extensions_menu_view_browsertest.cc
+++ b/chrome/browser/ui/views/extensions/extensions_menu_view_browsertest.cc
@@ -452,7 +452,7 @@
// action and show the view.
auto visible_icons = GetVisibleToolbarActionViews();
EXPECT_NE(nullptr, extensions_container->GetPoppedOutAction());
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
extensions_container->GetExtensionWithOpenContextMenuForTesting());
ASSERT_EQ(1u, visible_icons.size());
EXPECT_EQ(extensions_container->GetPoppedOutAction(),
@@ -468,7 +468,7 @@
visible_icons = GetVisibleToolbarActionViews();
ASSERT_EQ(1u, visible_icons.size());
EXPECT_EQ(nullptr, extensions_container->GetPoppedOutAction());
- EXPECT_NE(base::nullopt,
+ EXPECT_NE(absl::nullopt,
extensions_container->GetExtensionWithOpenContextMenuForTesting());
EXPECT_EQ(extensions_container->GetExtensionWithOpenContextMenuForTesting(),
visible_icons[0]->view_controller()->GetId());
diff --git a/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc b/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc
index 534a577..d0a682c 100644
--- a/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc
+++ b/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc
@@ -279,7 +279,7 @@
// |extension_with_open_context_menu_id_| does not have a value when a context
// menu is being shown from within the extensions menu.
if (extension_with_open_context_menu_id_.has_value()) {
- base::Optional<extensions::ExtensionId> const
+ absl::optional<extensions::ExtensionId> const
extension_with_open_context_menu = extension_with_open_context_menu_id_;
extension_with_open_context_menu_id_.reset();
UpdateIconVisibility(extension_with_open_context_menu.value());
diff --git a/chrome/browser/ui/views/extensions/extensions_toolbar_container.h b/chrome/browser/ui/views/extensions/extensions_toolbar_container.h
index c721669..7c9b303 100644
--- a/chrome/browser/ui/views/extensions/extensions_toolbar_container.h
+++ b/chrome/browser/ui/views/extensions/extensions_toolbar_container.h
@@ -12,13 +12,13 @@
#include <vector>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/ui/extensions/extensions_container.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/toolbar/toolbar_actions_model.h"
#include "chrome/browser/ui/views/toolbar/toolbar_action_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_icon_container_view.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/widget/widget_observer.h"
@@ -100,7 +100,7 @@
views::Widget* GetAnchoredWidgetForExtensionForTesting(
const std::string& extension_id);
- base::Optional<extensions::ExtensionId>
+ absl::optional<extensions::ExtensionId>
GetExtensionWithOpenContextMenuForTesting() {
return extension_with_open_context_menu_id_;
}
@@ -252,7 +252,7 @@
// The action that triggered the current popup, if any.
ToolbarActionViewController* popup_owner_ = nullptr;
// Extension with an open context menu, if any.
- base::Optional<extensions::ExtensionId> extension_with_open_context_menu_id_;
+ absl::optional<extensions::ExtensionId> extension_with_open_context_menu_id_;
// The widgets currently popped out and, for each, the extension it is
// associated with. See AnchoredWidget.
diff --git a/chrome/browser/ui/views/extensions/settings_overridden_dialog_view.h b/chrome/browser/ui/views/extensions/settings_overridden_dialog_view.h
index 1aa147bf..3c0faf92 100644
--- a/chrome/browser/ui/views/extensions/settings_overridden_dialog_view.h
+++ b/chrome/browser/ui/views/extensions/settings_overridden_dialog_view.h
@@ -7,8 +7,8 @@
#include <memory>
-#include "base/optional.h"
#include "chrome/browser/ui/extensions/settings_overridden_dialog_controller.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/window/dialog_delegate.h"
@@ -34,7 +34,7 @@
SettingsOverriddenDialogController::DialogResult result);
// The result of the dialog; set when notifying the controller.
- base::Optional<SettingsOverriddenDialogController::DialogResult> result_;
+ absl::optional<SettingsOverriddenDialogController::DialogResult> result_;
std::unique_ptr<SettingsOverriddenDialogController> controller_;
};
diff --git a/chrome/browser/ui/views/extensions/settings_overridden_dialog_view_browsertest.cc b/chrome/browser/ui/views/extensions/settings_overridden_dialog_view_browsertest.cc
index d9868cef..3461b1af 100644
--- a/chrome/browser/ui/views/extensions/settings_overridden_dialog_view_browsertest.cc
+++ b/chrome/browser/ui/views/extensions/settings_overridden_dialog_view_browsertest.cc
@@ -35,7 +35,7 @@
class TestDialogController : public SettingsOverriddenDialogController {
public:
TestDialogController(ShowParams show_params,
- base::Optional<DialogResult>* dialog_result_out)
+ absl::optional<DialogResult>* dialog_result_out)
: show_params_(std::move(show_params)),
dialog_result_out_(dialog_result_out) {
DCHECK(dialog_result_out_);
@@ -56,7 +56,7 @@
const ShowParams show_params_;
// The result to populate. Must outlive this object.
- base::Optional<DialogResult>* const dialog_result_out_;
+ absl::optional<DialogResult>* const dialog_result_out_;
};
} // namespace
@@ -155,7 +155,7 @@
return true;
}
- base::Optional<SettingsOverriddenDialogController::DialogResult>
+ absl::optional<SettingsOverriddenDialogController::DialogResult>
dialog_result() const {
return dialog_result_;
}
@@ -231,7 +231,7 @@
std::string test_name_;
- base::Optional<SettingsOverriddenDialogController::DialogResult>
+ absl::optional<SettingsOverriddenDialogController::DialogResult>
dialog_result_;
};
diff --git a/chrome/browser/ui/views/extensions/settings_overridden_dialog_view_unittest.cc b/chrome/browser/ui/views/extensions/settings_overridden_dialog_view_unittest.cc
index 5343469..638cb70 100644
--- a/chrome/browser/ui/views/extensions/settings_overridden_dialog_view_unittest.cc
+++ b/chrome/browser/ui/views/extensions/settings_overridden_dialog_view_unittest.cc
@@ -4,19 +4,19 @@
#include "chrome/browser/ui/views/extensions/settings_overridden_dialog_view.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/extensions/settings_overridden_dialog_controller.h"
#include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
#include "chrome/test/views/chrome_views_test_base.h"
#include "components/constrained_window/constrained_window_views.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/test/widget_test.h"
namespace {
struct DialogState {
bool shown = false;
- base::Optional<SettingsOverriddenDialogController::DialogResult> result;
+ absl::optional<SettingsOverriddenDialogController::DialogResult> result;
};
// A dialog controller that updates the provided DialogState when the dialog
diff --git a/chrome/browser/ui/views/external_protocol_dialog.cc b/chrome/browser/ui/views/external_protocol_dialog.cc
index e7535b9..24cd56e3 100644
--- a/chrome/browser/ui/views/external_protocol_dialog.cc
+++ b/chrome/browser/ui/views/external_protocol_dialog.cc
@@ -36,7 +36,7 @@
namespace {
std::u16string GetMessageTextForOrigin(
- const base::Optional<url::Origin>& origin) {
+ const absl::optional<url::Origin>& origin) {
if (!origin || origin->opaque())
return l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_MESSAGE);
return l10n_util::GetStringFUTF16(
@@ -53,7 +53,7 @@
WebContents* web_contents,
ui::PageTransition ignored_page_transition,
bool ignored_has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin) {
+ const absl::optional<url::Origin>& initiating_origin) {
DCHECK(web_contents);
std::u16string program_name =
@@ -73,7 +73,7 @@
WebContents* web_contents,
const GURL& url,
const std::u16string& program_name,
- const base::Optional<url::Origin>& initiating_origin)
+ const absl::optional<url::Origin>& initiating_origin)
: content::WebContentsObserver(web_contents),
url_(url),
program_name_(program_name),
diff --git a/chrome/browser/ui/views/external_protocol_dialog.h b/chrome/browser/ui/views/external_protocol_dialog.h
index 290dc4f..b2e0cf3f 100644
--- a/chrome/browser/ui/views/external_protocol_dialog.h
+++ b/chrome/browser/ui/views/external_protocol_dialog.h
@@ -33,7 +33,7 @@
ExternalProtocolDialog(content::WebContents* web_contents,
const GURL& url,
const std::u16string& program_name,
- const base::Optional<url::Origin>& initiating_origin);
+ const absl::optional<url::Origin>& initiating_origin);
ExternalProtocolDialog(const ExternalProtocolDialog&) = delete;
ExternalProtocolDialog& operator=(const ExternalProtocolDialog&) = delete;
~ExternalProtocolDialog() override;
@@ -54,7 +54,7 @@
const GURL url_;
const std::u16string program_name_;
- const base::Optional<url::Origin> initiating_origin_;
+ const absl::optional<url::Origin> initiating_origin_;
// The message box whose commands we handle.
views::MessageBoxView* message_box_view_ = nullptr;
diff --git a/chrome/browser/ui/views/external_protocol_dialog_browsertest.cc b/chrome/browser/ui/views/external_protocol_dialog_browsertest.cc
index 6e2a4e64..7e953fe 100644
--- a/chrome/browser/ui/views/external_protocol_dialog_browsertest.cc
+++ b/chrome/browser/ui/views/external_protocol_dialog_browsertest.cc
@@ -83,7 +83,7 @@
content::WebContents* web_contents,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin>& initiating_origin) override {}
+ const absl::optional<url::Origin>& initiating_origin) override {}
void LaunchUrlWithoutSecurityCheck(
const GURL& url,
content::WebContents* web_contents) override {
diff --git a/chrome/browser/ui/views/eye_dropper/eye_dropper_view.h b/chrome/browser/ui/views/eye_dropper/eye_dropper_view.h
index eafbda0..e192c705 100644
--- a/chrome/browser/ui/views/eye_dropper/eye_dropper_view.h
+++ b/chrome/browser/ui/views/eye_dropper/eye_dropper_view.h
@@ -7,12 +7,12 @@
#include <memory>
-#include "base/optional.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "content/public/browser/eye_dropper.h"
#include "content/public/browser/eye_dropper_listener.h"
#include "content/public/browser/render_frame_host.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/gfx/geometry/point.h"
#include "ui/views/widget/widget_delegate.h"
@@ -81,7 +81,7 @@
std::unique_ptr<PreEventDispatchHandler> pre_dispatch_handler_;
std::unique_ptr<ViewPositionHandler> view_position_handler_;
std::unique_ptr<ScreenCapturer> screen_capturer_;
- base::Optional<SkColor> selected_color_;
+ absl::optional<SkColor> selected_color_;
base::TimeTicks ignore_selection_time_;
};
diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc
index 39649f7..dfc249c 100644
--- a/chrome/browser/ui/views/find_bar_view.cc
+++ b/chrome/browser/ui/views/find_bar_view.cc
@@ -113,7 +113,7 @@
}
private:
- base::Optional<find_in_page::FindNotificationDetails> last_result_;
+ absl::optional<find_in_page::FindNotificationDetails> last_result_;
DISALLOW_COPY_AND_ASSIGN(FindBarMatchCountLabel);
};
diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
index 0eefe006..43b14918 100644
--- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
+++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc
@@ -94,7 +94,7 @@
// last we checked. This is used to tell if the window has moved to a
// different desktop, and notify listeners. It will only be set if
// we created |virtual_desktop_helper_|.
- base::Optional<std::string> workspace_;
+ absl::optional<std::string> workspace_;
bool initial_workspace_remembered_ = false;
diff --git a/chrome/browser/ui/views/frame/browser_frame_mac.mm b/chrome/browser/ui/views/frame/browser_frame_mac.mm
index f3af27ec..d0c66db 100644
--- a/chrome/browser/ui/views/frame/browser_frame_mac.mm
+++ b/chrome/browser/ui/views/frame/browser_frame_mac.mm
@@ -197,7 +197,7 @@
// or if the page is distillable.
content::WebContents* web_contents =
browser->tab_strip_model()->GetActiveWebContents();
- base::Optional<dom_distiller::DistillabilityResult> distillability =
+ absl::optional<dom_distiller::DistillabilityResult> distillability =
dom_distiller::GetLatestResult(web_contents);
bool distillable =
distillability && distillability.value().is_distillable;
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
index 3337528..717384e 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
@@ -109,7 +109,7 @@
TabStrip* const tab_strip = browser_view_->tabstrip();
const bool active = ShouldPaintAsActive(active_state);
- const base::Optional<int> bg_id =
+ const absl::optional<int> bg_id =
tab_strip->GetCustomBackgroundId(active_state);
if (bg_id.has_value()) {
// If the theme has a custom tab background image, assume tab shapes are
@@ -185,7 +185,7 @@
GetFrameThemeProvider()->GetColor(color_id), GetFrameColor());
}
-base::Optional<int> BrowserNonClientFrameView::GetCustomBackgroundId(
+absl::optional<int> BrowserNonClientFrameView::GetCustomBackgroundId(
BrowserFrameActiveState active_state) const {
const ui::ThemeProvider* tp = GetThemeProvider();
const bool incognito = browser_view_->GetIncognito();
@@ -207,7 +207,7 @@
tp->HasCustomImage(id) || (!active && tp->HasCustomImage(active_id)) ||
tp->HasCustomImage(IDR_THEME_FRAME) ||
(incognito && tp->HasCustomImage(IDR_THEME_FRAME_INCOGNITO));
- return has_custom_image ? base::make_optional(id) : base::nullopt;
+ return has_custom_image ? absl::make_optional(id) : absl::nullopt;
}
void BrowserNonClientFrameView::UpdateMinimumSize() {}
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.h b/chrome/browser/ui/views/frame/browser_non_client_frame_view.h
index b98f9ae..b55d59d 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view.h
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.h
@@ -120,7 +120,7 @@
// For non-transparent windows, returns the background tab image resource ID
// if the image has been customized, directly or indirectly, by the theme.
- base::Optional<int> GetCustomBackgroundId(
+ absl::optional<int> GetCustomBackgroundId(
BrowserFrameActiveState active_state) const;
// Updates the throbber.
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_browsertest.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_browsertest.cc
index 761068a..63a50575 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_browsertest.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_browsertest.cc
@@ -51,7 +51,7 @@
// TODO: Add tests for non-bookmark hosted apps, as bookmark apps will no
// longer be hosted apps when BMO ships.
void InstallAndLaunchBookmarkApp(
- base::Optional<GURL> app_url = base::nullopt) {
+ absl::optional<GURL> app_url = absl::nullopt) {
blink::Manifest manifest;
manifest.start_url = app_url.value_or(GetAppURL());
manifest.scope = manifest.start_url.GetWithoutFilename();
@@ -74,7 +74,7 @@
}
protected:
- base::Optional<SkColor> app_theme_color_ = SK_ColorBLUE;
+ absl::optional<SkColor> app_theme_color_ = SK_ColorBLUE;
Browser* app_browser_ = nullptr;
BrowserView* app_browser_view_ = nullptr;
content::WebContents* web_contents_ = nullptr;
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc
index f0f8174..a429110 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc
@@ -232,7 +232,7 @@
// Web apps apply a theme color if specified by the extension.
Browser* browser = browser_view()->browser();
- base::Optional<SkColor> theme_color =
+ absl::optional<SkColor> theme_color =
browser->app_controller()->GetThemeColor();
if (theme_color)
active_color = views::FrameCaptionButton::GetButtonColor(*theme_color);
@@ -778,7 +778,7 @@
void BrowserNonClientFrameViewChromeOS::OnUpdateFrameColor() {
aura::Window* window = frame()->GetNativeWindow();
- base::Optional<SkColor> active_color, inactive_color;
+ absl::optional<SkColor> active_color, inactive_color;
if (!UsePackagedAppHeaderStyle(browser_view()->browser())) {
active_color = GetFrameColor(BrowserFrameActiveState::kActive);
inactive_color = GetFrameColor(BrowserFrameActiveState::kInactive);
diff --git a/chrome/browser/ui/views/frame/browser_root_view.h b/chrome/browser/ui/views/frame/browser_root_view.h
index e0bc780..f3d7ef9 100644
--- a/chrome/browser/ui/views/frame/browser_root_view.h
+++ b/chrome/browser/ui/views/frame/browser_root_view.h
@@ -54,7 +54,7 @@
virtual DropIndex GetDropIndex(const ui::DropTargetEvent& event) = 0;
virtual views::View* GetViewForDrop() = 0;
- virtual void HandleDragUpdate(const base::Optional<DropIndex>& index) {}
+ virtual void HandleDragUpdate(const absl::optional<DropIndex>& index) {}
virtual void HandleDragExited() {}
protected:
@@ -96,7 +96,7 @@
DropTarget* target = nullptr;
// Where to drop the url.
- base::Optional<DropIndex> index;
+ absl::optional<DropIndex> index;
// The URL for the drop event.
GURL url;
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 0566076..cd14d1f 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1791,7 +1791,7 @@
bool show_stay_in_chrome,
bool show_remember_selection,
PageActionIconType icon_type,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
IntentPickerResponse callback) {
toolbar_->ShowIntentPickerBubble(std::move(app_info), show_stay_in_chrome,
show_remember_selection, icon_type,
@@ -2331,7 +2331,7 @@
std::u16string title =
browser_->GetWindowTitleForTab(include_app_name, index);
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tabstrip_->tab_at(index)->group();
if (group.has_value()) {
std::u16string group_title = tabstrip_->GetGroupTitle(group.value());
@@ -2362,7 +2362,7 @@
}
// Alert tab states.
- base::Optional<TabAlertState> alert = tabstrip_->GetTabAlertState(index);
+ absl::optional<TabAlertState> alert = tabstrip_->GetTabAlertState(index);
if (!alert.has_value())
return title;
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index d2a00a0..f6db8a6 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -13,7 +13,6 @@
#include "base/callback_list.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -40,6 +39,7 @@
#include "chrome/common/buildflags.h"
#include "components/infobars/core/infobar_container.h"
#include "components/webapps/browser/banners/app_banner_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/models/simple_menu_model.h"
@@ -435,7 +435,7 @@
bool show_stay_in_chrome,
bool show_remember_selection,
PageActionIconType icon_type,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
IntentPickerResponse callback) override;
void ShowBookmarkBubble(const GURL& url, bool already_bookmarked) override;
qrcode_generator::QRCodeGeneratorBubbleView* ShowQRCodeGeneratorBubble(
@@ -940,7 +940,7 @@
// is true, OnWidgetActivationChanged will call RestoreFocus. This is set
// to true when not set in Show() so that RestoreFocus on activation only
// happens for very first Show() calls.
- base::Optional<bool> restore_focus_on_activation_;
+ absl::optional<bool> restore_focus_on_activation_;
// This is non-null on Chrome OS only.
std::unique_ptr<TopControlsSlideController> top_controls_slide_controller_;
@@ -994,7 +994,7 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
// |loading_animation_tracker_| is used to measure animation smoothness for
// tab loading animation.
- base::Optional<ui::ThroughputTracker> loading_animation_tracker_;
+ absl::optional<ui::ThroughputTracker> loading_animation_tracker_;
#endif
mutable base::WeakPtrFactory<BrowserView> weak_ptr_factory_{this};
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view_browsertest_win.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view_browsertest_win.cc
index 2031fd9..446ef33 100644
--- a/chrome/browser/ui/views/frame/glass_browser_frame_view_browsertest_win.cc
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view_browsertest_win.cc
@@ -75,7 +75,7 @@
return true;
}
- base::Optional<SkColor> theme_color_ = SK_ColorBLUE;
+ absl::optional<SkColor> theme_color_ = SK_ColorBLUE;
Browser* app_browser_ = nullptr;
BrowserView* browser_view_ = nullptr;
GlassBrowserFrameView* glass_frame_view_ = nullptr;
@@ -90,7 +90,7 @@
}
IN_PROC_BROWSER_TEST_F(WebAppGlassBrowserFrameViewTest, NoThemeColor) {
- theme_color_ = base::nullopt;
+ theme_color_ = absl::nullopt;
if (!InstallAndLaunchWebApp())
return;
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_browsertest.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_browsertest.cc
index 764d6c4..e0bddb7 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_browsertest.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_browsertest.cc
@@ -34,7 +34,7 @@
void SetUpOnMainThread() override { SetThemeMode(ThemeMode::kDefault); }
bool InstallAndLaunchWebApp(
- base::Optional<SkColor> theme_color = base::nullopt) {
+ absl::optional<SkColor> theme_color = absl::nullopt) {
auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info->start_url = GetAppURL();
web_app_info->scope = GetAppURL().GetWithoutFilename();
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
index 04a50cf..3b07f6e 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
@@ -288,7 +288,7 @@
// non-null.
bool should_show_toolbar =
!delegate_->IsFullscreen() && web_app_frame_toolbar_;
- base::Optional<int> icon_spacing;
+ absl::optional<int> icon_spacing;
if (should_show_icon || should_show_title || should_show_toolbar) {
use_hidden_icon_location = false;
diff --git a/chrome/browser/ui/views/frame/tab_strip_region_view.cc b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
index 6dd1bc05..d0571d6 100644
--- a/chrome/browser/ui/views/frame/tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
@@ -166,7 +166,7 @@
views::ScrollView* tab_strip_scroll_container =
AddChildView(std::make_unique<views::ScrollView>(
views::ScrollView::ScrollWithLayers::kEnabled));
- tab_strip_scroll_container->SetBackgroundColor(base::nullopt);
+ tab_strip_scroll_container->SetBackgroundColor(absl::nullopt);
tab_strip_scroll_container->SetHorizontalScrollBarMode(
views::ScrollView::ScrollBarMode::kHiddenButEnabled);
tab_strip_scroll_container->SetTreatAllScrollEventsAsHorizontal(true);
diff --git a/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.cc b/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.cc
index 4370442..a6a9e4c 100644
--- a/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.cc
+++ b/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.cc
@@ -298,7 +298,7 @@
}
#endif
- OnEnabledStateChanged(CanEnable(base::nullopt));
+ OnEnabledStateChanged(CanEnable(absl::nullopt));
}
TopControlsSlideControllerChromeOS::~TopControlsSlideControllerChromeOS() {
@@ -374,7 +374,7 @@
defer_disabling_ = false;
// Don't just set |is_enabled_| to false. Make sure it's a correct value.
- OnEnabledStateChanged(CanEnable(base::nullopt));
+ OnEnabledStateChanged(CanEnable(absl::nullopt));
}
}
@@ -402,7 +402,7 @@
if (update_state_after_gesture_scrolling_ends_) {
DCHECK(!is_gesture_scrolling_in_progress_);
DCHECK(pause_updates_);
- OnEnabledStateChanged(CanEnable(base::nullopt));
+ OnEnabledStateChanged(CanEnable(absl::nullopt));
update_state_after_gesture_scrolling_ends_ = false;
pause_updates_ = false;
}
@@ -455,7 +455,7 @@
switch (state) {
case display::TabletState::kInTabletMode:
case display::TabletState::kInClamshellMode:
- OnEnabledStateChanged(CanEnable(base::nullopt));
+ OnEnabledStateChanged(CanEnable(absl::nullopt));
return;
case display::TabletState::kEnteringTabletMode:
case display::TabletState::kExitingTabletMode:
@@ -597,7 +597,7 @@
}
bool TopControlsSlideControllerChromeOS::CanEnable(
- base::Optional<bool> fullscreen_state) const {
+ absl::optional<bool> fullscreen_state) const {
return IsTabletModeEnabled() &&
!(fullscreen_state.value_or(browser_view_->IsFullscreen()));
}
diff --git a/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.h b/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.h
index 96c254f..87317ba 100644
--- a/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.h
+++ b/chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.h
@@ -9,9 +9,9 @@
#include "base/containers/flat_map.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/views/frame/top_controls_slide_controller.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/display/display_observer.h"
#include "ui/views/view_observer.h"
@@ -92,7 +92,7 @@
// BrowserView informs us with fullscreen state changes before they happen
// (See OnBrowserFullscreenStateWillChange()) so that we can disable the
// sliding behavior *before* immersive mode is entered.
- bool CanEnable(base::Optional<bool> fullscreen_state) const;
+ bool CanEnable(absl::optional<bool> fullscreen_state) const;
#if BUILDFLAG(IS_CHROMEOS_ASH)
// Called back from the ash::AccessibilityManager so that we're updated by the
diff --git a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc
index fd7e536..3cb7a62 100644
--- a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc
+++ b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc
@@ -168,13 +168,13 @@
// Converts a swipe gesture to a drag direction, or none if the swipe is neither
// up nor down.
-base::Optional<WebUITabStripDragDirection> DragDirectionFromSwipe(
+absl::optional<WebUITabStripDragDirection> DragDirectionFromSwipe(
const ui::GestureEvent* event) {
if (event->details().swipe_down())
return WebUITabStripDragDirection::kDown;
if (event->details().swipe_up())
return WebUITabStripDragDirection::kUp;
- return base::nullopt;
+ return absl::nullopt;
}
bool EventTypeCanCloseTabStrip(const ui::EventType& type) {
@@ -682,12 +682,12 @@
}
void WebUITabStripContainerView::EndDragToOpen(
- base::Optional<WebUITabStripDragDirection> fling_direction) {
+ absl::optional<WebUITabStripDragDirection> fling_direction) {
if (!current_drag_height_)
return;
const int final_drag_height = *current_drag_height_;
- current_drag_height_ = base::nullopt;
+ current_drag_height_ = absl::nullopt;
// If this wasn't a fling, determine whether to open or close based on
// final height.
@@ -785,7 +785,7 @@
if (time_at_open_) {
RecordTabStripUIOpenDurationHistogram(base::TimeTicks::Now() -
time_at_open_.value());
- time_at_open_ = base::nullopt;
+ time_at_open_ = absl::nullopt;
}
const double current_value = animation_.GetCurrentValue();
diff --git a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.h b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.h
index b55bf53..4eff88a 100644
--- a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.h
+++ b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.h
@@ -8,7 +8,6 @@
#include <memory>
#include <set>
-#include "base/optional.h"
#include "base/scoped_multi_source_observation.h"
#include "base/time/time.h"
#include "build/build_config.h"
@@ -17,6 +16,7 @@
#include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_metrics.h"
#include "chrome/common/buildflags.h"
#include "components/tab_groups/tab_group_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/events/event_handler.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/animation/slide_animation.h"
@@ -96,8 +96,8 @@
// Called when drag-to-open finishes. If |fling_direction| is present,
// the user released their touch with a high velocity. We should use
// just this direction to animate open or closed.
- void EndDragToOpen(base::Optional<WebUITabStripDragDirection>
- fling_direction = base::nullopt);
+ void EndDragToOpen(absl::optional<WebUITabStripDragDirection>
+ fling_direction = absl::nullopt);
void NewTabButtonPressed(const ui::Event& event);
@@ -159,11 +159,11 @@
int old_top_container_width_ = 0;
#endif // defined(OS_WIN)
- base::Optional<float> current_drag_height_;
+ absl::optional<float> current_drag_height_;
// When opened, if currently open. Used to calculate metric for how
// long the tab strip is kept open.
- base::Optional<base::TimeTicks> time_at_open_;
+ absl::optional<base::TimeTicks> time_at_open_;
// Used to keep the toolbar revealed while the tab strip is open.
std::unique_ptr<ImmersiveRevealedLock> immersive_revealed_lock_;
diff --git a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view_interactive_uitest.cc b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view_interactive_uitest.cc
index 7089f535..1460a67 100644
--- a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view_interactive_uitest.cc
+++ b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view_interactive_uitest.cc
@@ -8,7 +8,6 @@
#include "base/callback.h"
#include "base/containers/flat_set.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/test/scoped_feature_list.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
@@ -27,6 +26,7 @@
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/frame/fullscreen.mojom.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/base_event_utils.h"
@@ -138,7 +138,7 @@
}
bool EnableKeyboardLock() {
- base::Optional<base::flat_set<ui::DomCode>> codes({ui::DomCode::ESCAPE});
+ absl::optional<base::flat_set<ui::DomCode>> codes({ui::DomCode::ESCAPE});
return content::RequestKeyboardLock(GetActiveWebContents(),
std::move(codes));
}
diff --git a/chrome/browser/ui/views/global_media_controls/media_dialog_view.h b/chrome/browser/ui/views/global_media_controls/media_dialog_view.h
index 67d49a5..d600ae2 100644
--- a/chrome/browser/ui/views/global_media_controls/media_dialog_view.h
+++ b/chrome/browser/ui/views/global_media_controls/media_dialog_view.h
@@ -10,12 +10,12 @@
#include <string>
#include "base/observer_list.h"
-#include "base/optional.h"
#include "chrome/browser/ui/global_media_controls/media_dialog_delegate.h"
#include "chrome/browser/ui/global_media_controls/media_notification_container_observer.h"
#include "chrome/browser/ui/views/global_media_controls/global_media_controls_types.h"
#include "components/soda/constants.h"
#include "components/soda/soda_installer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
diff --git a/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.cc b/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.cc
index c61fa3dc..4135ab6 100644
--- a/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.cc
+++ b/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.cc
@@ -99,7 +99,7 @@
base::WeakPtr<media_message_center::MediaNotificationItem> item,
MediaNotificationService* service,
GlobalMediaControlsEntryPoint entry_point,
- base::Optional<media_message_center::NotificationTheme> theme)
+ absl::optional<media_message_center::NotificationTheme> theme)
: views::Button(base::BindRepeating(
[](MediaNotificationContainerImplView* view) {
// If |is_dragging_| is set, this click should be treated as a drag
diff --git a/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.h b/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.h
index 3fda2bb..6c1548e 100644
--- a/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.h
+++ b/chrome/browser/ui/views/global_media_controls/media_notification_container_impl_view.h
@@ -55,8 +55,8 @@
base::WeakPtr<media_message_center::MediaNotificationItem> item,
MediaNotificationService* service,
GlobalMediaControlsEntryPoint entry_point,
- base::Optional<media_message_center::NotificationTheme> theme =
- base::nullopt);
+ absl::optional<media_message_center::NotificationTheme> theme =
+ absl::nullopt);
MediaNotificationContainerImplView(
const MediaNotificationContainerImplView&) = delete;
MediaNotificationContainerImplView& operator=(
diff --git a/chrome/browser/ui/views/global_media_controls/media_notification_list_view.cc b/chrome/browser/ui/views/global_media_controls/media_notification_list_view.cc
index aafd55e..6d33568c 100644
--- a/chrome/browser/ui/views/global_media_controls/media_notification_list_view.cc
+++ b/chrome/browser/ui/views/global_media_controls/media_notification_list_view.cc
@@ -37,12 +37,12 @@
separator_thickness(separator_thickness) {}
MediaNotificationListView::MediaNotificationListView()
- : MediaNotificationListView(base::nullopt) {}
+ : MediaNotificationListView(absl::nullopt) {}
MediaNotificationListView::MediaNotificationListView(
- const base::Optional<SeparatorStyle>& separator_style)
+ const absl::optional<SeparatorStyle>& separator_style)
: separator_style_(separator_style) {
- SetBackgroundColor(base::nullopt);
+ SetBackgroundColor(absl::nullopt);
SetContents(std::make_unique<views::View>());
contents()->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical));
diff --git a/chrome/browser/ui/views/global_media_controls/media_notification_list_view.h b/chrome/browser/ui/views/global_media_controls/media_notification_list_view.h
index faeed30..6d8efd6 100644
--- a/chrome/browser/ui/views/global_media_controls/media_notification_list_view.h
+++ b/chrome/browser/ui/views/global_media_controls/media_notification_list_view.h
@@ -8,7 +8,7 @@
#include <map>
#include <memory>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/controls/scroll_view.h"
@@ -28,7 +28,7 @@
};
explicit MediaNotificationListView(
- const base::Optional<SeparatorStyle>& separator_style);
+ const absl::optional<SeparatorStyle>& separator_style);
MediaNotificationListView();
MediaNotificationListView(const MediaNotificationListView&) = delete;
MediaNotificationListView& operator=(const MediaNotificationListView&) =
@@ -62,7 +62,7 @@
std::map<const std::string, MediaNotificationContainerImplView*>
notifications_;
- base::Optional<SeparatorStyle> separator_style_;
+ absl::optional<SeparatorStyle> separator_style_;
};
#endif // CHROME_BROWSER_UI_VIEWS_GLOBAL_MEDIA_CONTROLS_MEDIA_NOTIFICATION_LIST_VIEW_H_
diff --git a/chrome/browser/ui/views/hats/hats_browsertest.cc b/chrome/browser/ui/views/hats/hats_browsertest.cc
index 31a93662..cc07cf3 100644
--- a/chrome/browser/ui/views/hats/hats_browsertest.cc
+++ b/chrome/browser/ui/views/hats/hats_browsertest.cc
@@ -141,9 +141,9 @@
const base::DictionaryValue* pref_data =
browser()->profile()->GetPrefs()->GetDictionary(
prefs::kHatsSurveyMetadata);
- base::Optional<base::Time> last_survey_started_time =
+ absl::optional<base::Time> last_survey_started_time =
util::ValueToTime(pref_data->FindPath(kLastSurveyStartedTime));
- base::Optional<int> last_major_version =
+ absl::optional<int> last_major_version =
pref_data->FindIntPath(kLastMajorVersion);
ASSERT_FALSE(last_survey_started_time.has_value());
ASSERT_FALSE(last_major_version.has_value());
diff --git a/chrome/browser/ui/views/hover_button.h b/chrome/browser/ui/views/hover_button.h
index 97e7be7..68f22604 100644
--- a/chrome/browser/ui/views/hover_button.h
+++ b/chrome/browser/ui/views/hover_button.h
@@ -8,8 +8,8 @@
#include <string>
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/menu_button.h"
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view.cc b/chrome/browser/ui/views/intent_picker_bubble_view.cc
index 1ae444a..81b7eae 100644
--- a/chrome/browser/ui/views/intent_picker_bubble_view.cc
+++ b/chrome/browser/ui/views/intent_picker_bubble_view.cc
@@ -147,7 +147,7 @@
std::vector<AppInfo> app_info,
bool show_stay_in_chrome,
bool show_remember_selection,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
IntentPickerResponse intent_picker_cb) {
if (intent_picker_bubble_) {
intent_picker_bubble_->CloseBubble();
@@ -203,7 +203,7 @@
std::vector<AppInfo> app_info,
bool show_stay_in_chrome,
bool show_remember_selection,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
IntentPickerResponse intent_picker_cb,
content::WebContents* web_contents) {
auto bubble = std::make_unique<IntentPickerBubbleView>(
@@ -274,7 +274,7 @@
content::WebContents* web_contents,
bool show_stay_in_chrome,
bool show_remember_selection,
- const base::Optional<url::Origin>& initiating_origin)
+ const absl::optional<url::Origin>& initiating_origin)
: LocationBarBubbleDelegateView(anchor_view, web_contents),
intent_picker_cb_(std::move(intent_picker_cb)),
selected_app_tag_(0),
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view.h b/chrome/browser/ui/views/intent_picker_bubble_view.h
index e72135f..93b6d98 100644
--- a/chrome/browser/ui/views/intent_picker_bubble_view.h
+++ b/chrome/browser/ui/views/intent_picker_bubble_view.h
@@ -10,12 +10,12 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/apps/intent_helper/apps_navigation_types.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/page_action/page_action_icon_type.h"
#include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.h"
#include "components/services/app_service/public/mojom/types.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/gfx/image/image.h"
#include "ui/views/animation/ink_drop_state.h"
@@ -73,7 +73,7 @@
content::WebContents* web_contents,
bool show_stay_in_chrome,
bool show_remember_selection,
- const base::Optional<url::Origin>& initiating_origin);
+ const absl::optional<url::Origin>& initiating_origin);
~IntentPickerBubbleView() override;
static views::Widget* ShowBubble(
@@ -84,7 +84,7 @@
std::vector<AppInfo> app_info,
bool show_stay_in_chrome,
bool show_remember_selection,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
IntentPickerResponse intent_picker_cb);
static IntentPickerBubbleView* intent_picker_bubble() {
return intent_picker_bubble_;
@@ -144,7 +144,7 @@
std::vector<AppInfo> app_info,
bool show_stay_in_chrome,
bool show_remember_selection,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
IntentPickerResponse intent_picker_cb,
content::WebContents* web_contents);
@@ -234,7 +234,7 @@
const PageActionIconType icon_type_;
// The origin initiating this picker.
- const base::Optional<url::Origin> initiating_origin_;
+ const absl::optional<url::Origin> initiating_origin_;
DISALLOW_COPY_AND_ASSIGN(IntentPickerBubbleView);
};
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view_browsertest_chromeos.cc b/chrome/browser/ui/views/intent_picker_bubble_view_browsertest_chromeos.cc
index 0fddd994..487ffc4 100644
--- a/chrome/browser/ui/views/intent_picker_bubble_view_browsertest_chromeos.cc
+++ b/chrome/browser/ui/views/intent_picker_bubble_view_browsertest_chromeos.cc
@@ -226,7 +226,7 @@
browser()->window()->ShowIntentPickerBubble(
std::move(app_info), /*show_stay_in_chrome=*/true,
/*show_remember_selection=*/true, PageActionIconType::kIntentPicker,
- base::nullopt,
+ absl::nullopt,
base::BindOnce(
&IntentPickerBubbleViewBrowserTestChromeOS::OnBubbleClosed,
base::Unretained(this)));
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view_unittest.cc b/chrome/browser/ui/views/intent_picker_bubble_view_unittest.cc
index 41cbbfd..78e0cb5 100644
--- a/chrome/browser/ui/views/intent_picker_bubble_view_unittest.cc
+++ b/chrome/browser/ui/views/intent_picker_bubble_view_unittest.cc
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/apps/intent_helper/apps_navigation_types.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
@@ -19,6 +18,7 @@
#include "chrome/grit/generated_resources.h"
#include "chrome/test/views/chrome_views_test_base.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/image_model.h"
#include "ui/base/resource/resource_bundle.h"
@@ -73,7 +73,7 @@
void CreateBubbleView(bool use_icons,
bool show_stay_in_chrome,
PageActionIconType icon_type,
- const base::Optional<url::Origin>& initiating_origin) {
+ const absl::optional<url::Origin>& initiating_origin) {
BrowserView* browser_view =
BrowserView::GetBrowserViewForBrowser(browser());
anchor_view_ =
@@ -146,7 +146,7 @@
TEST_F(IntentPickerBubbleViewTest, NullIcons) {
CreateBubbleView(/*use_icons=*/false, /*show_stay_in_chrome=*/true,
PageActionIconType::kIntentPicker,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
size_t size = bubble_->GetScrollViewSize();
for (size_t i = 0; i < size; ++i) {
gfx::ImageSkia image = bubble_->GetAppImageForTesting(i);
@@ -158,7 +158,7 @@
TEST_F(IntentPickerBubbleViewTest, NonNullIcons) {
CreateBubbleView(/*use_icons=*/true, /*show_stay_in_chrome=*/true,
PageActionIconType::kIntentPicker,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
size_t size = bubble_->GetScrollViewSize();
for (size_t i = 0; i < size; ++i) {
gfx::ImageSkia image = bubble_->GetAppImageForTesting(i);
@@ -173,7 +173,7 @@
TEST_F(IntentPickerBubbleViewTest, LabelsPtrVectorSize) {
CreateBubbleView(/*use_icons=*/true, /*show_stay_in_chrome=*/true,
PageActionIconType::kIntentPicker,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
size_t size = app_info_.size();
size_t chrome_package_repetitions = 0;
for (const AppInfo& app_info : app_info_) {
@@ -188,7 +188,7 @@
TEST_F(IntentPickerBubbleViewTest, VerifyStartingInkDrop) {
CreateBubbleView(/*use_icons=*/true, /*show_stay_in_chrome=*/true,
PageActionIconType::kIntentPicker,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
size_t size = bubble_->GetScrollViewSize();
for (size_t i = 0; i < size; ++i) {
EXPECT_EQ(bubble_->GetInkDropStateForTesting(i),
@@ -201,7 +201,7 @@
TEST_F(IntentPickerBubbleViewTest, InkDropStateTransition) {
CreateBubbleView(/*use_icons=*/true, /*show_stay_in_chrome=*/true,
PageActionIconType::kIntentPicker,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), 0, 0);
size_t size = bubble_->GetScrollViewSize();
@@ -219,7 +219,7 @@
TEST_F(IntentPickerBubbleViewTest, PressButtonTwice) {
CreateBubbleView(/*use_icons=*/true, /*show_stay_in_chrome=*/true,
PageActionIconType::kIntentPicker,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), 0, 0);
EXPECT_EQ(bubble_->GetInkDropStateForTesting(0), views::InkDropState::HIDDEN);
@@ -236,7 +236,7 @@
TEST_F(IntentPickerBubbleViewTest, ChromeNotInCandidates) {
CreateBubbleView(/*use_icons=*/false, /*show_stay_in_chrome=*/true,
PageActionIconType::kIntentPicker,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
size_t size = bubble_->GetScrollViewSize();
for (size_t i = 0; i < size; ++i) {
EXPECT_FALSE(
@@ -248,12 +248,12 @@
TEST_F(IntentPickerBubbleViewTest, WebContentsTiedToBubble) {
CreateBubbleView(/*use_icons=*/false, /*show_stay_in_chrome=*/false,
PageActionIconType::kIntentPicker,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
EXPECT_TRUE(bubble_->web_contents());
CreateBubbleView(/*use_icons=*/false, /*show_stay_in_chrome=*/true,
PageActionIconType::kIntentPicker,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
EXPECT_TRUE(bubble_->web_contents());
}
@@ -261,13 +261,13 @@
TEST_F(IntentPickerBubbleViewTest, WindowTitle) {
CreateBubbleView(/*use_icons=*/false, /*show_stay_in_chrome=*/false,
PageActionIconType::kIntentPicker,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
EXPECT_EQ(l10n_util::GetStringUTF16(IDS_INTENT_PICKER_BUBBLE_VIEW_OPEN_WITH),
bubble_->GetWindowTitle());
CreateBubbleView(/*use_icons=*/false, /*show_stay_in_chrome=*/false,
PageActionIconType::kClickToCall,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
EXPECT_EQ(l10n_util::GetStringUTF16(
IDS_BROWSER_SHARING_CLICK_TO_CALL_DIALOG_TITLE_LABEL),
bubble_->GetWindowTitle());
@@ -277,7 +277,7 @@
TEST_F(IntentPickerBubbleViewTest, ButtonLabels) {
CreateBubbleView(/*use_icons=*/false, /*show_stay_in_chrome=*/false,
PageActionIconType::kIntentPicker,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
EXPECT_EQ(l10n_util::GetStringUTF16(IDS_INTENT_PICKER_BUBBLE_VIEW_OPEN),
bubble_->GetDialogButtonLabel(ui::DIALOG_BUTTON_OK));
EXPECT_EQ(
@@ -286,7 +286,7 @@
CreateBubbleView(/*use_icons=*/false, /*show_stay_in_chrome=*/false,
PageActionIconType::kClickToCall,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
EXPECT_EQ(l10n_util::GetStringUTF16(
IDS_BROWSER_SHARING_CLICK_TO_CALL_DIALOG_CALL_BUTTON_LABEL),
bubble_->GetDialogButtonLabel(ui::DIALOG_BUTTON_OK));
@@ -298,7 +298,7 @@
TEST_F(IntentPickerBubbleViewTest, InitiatingOriginView) {
CreateBubbleView(/*use_icons=*/false, /*show_stay_in_chrome=*/false,
PageActionIconType::kIntentPicker,
- /*initiating_origin=*/base::nullopt);
+ /*initiating_origin=*/absl::nullopt);
const int children_without_origin = bubble_->children().size();
CreateBubbleView(/*use_icons=*/false, /*show_stay_in_chrome=*/false,
diff --git a/chrome/browser/ui/views/location_bar/content_setting_bubble_dialog_browsertest.cc b/chrome/browser/ui/views/location_bar/content_setting_bubble_dialog_browsertest.cc
index 3d2e0b3..936fa9a 100644
--- a/chrome/browser/ui/views/location_bar/content_setting_bubble_dialog_browsertest.cc
+++ b/chrome/browser/ui/views/location_bar/content_setting_bubble_dialog_browsertest.cc
@@ -58,7 +58,7 @@
void SelectUiToUse(permissions::PermissionRequest* request,
DecisionMadeCallback callback) override {
std::move(callback).Run(
- Decision(simulated_reason_for_quiet_ui_, base::nullopt));
+ Decision(simulated_reason_for_quiet_ui_, absl::nullopt));
}
private:
@@ -89,7 +89,7 @@
private:
base::test::ScopedFeatureList scoped_feature_list_;
- base::Optional<permissions::MockPermissionRequest>
+ absl::optional<permissions::MockPermissionRequest>
notification_permission_request_;
DISALLOW_COPY_AND_ASSIGN(ContentSettingBubbleDialogTest);
diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
index e9b86fc..cb45c14 100644
--- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
+++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
@@ -6,7 +6,6 @@
#include <utility>
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
@@ -16,6 +15,7 @@
#include "chrome/browser/ui/views/user_education/feature_promo_bubble_params.h"
#include "chrome/browser/ui/views/user_education/feature_promo_controller_views.h"
#include "chrome/grit/generated_resources.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/theme_provider.h"
@@ -31,7 +31,7 @@
namespace {
-base::Optional<ViewID> GetViewID(
+absl::optional<ViewID> GetViewID(
ContentSettingImageModel::ImageType image_type) {
using ImageType = ContentSettingImageModel::ImageType;
switch (image_type) {
@@ -55,13 +55,13 @@
case ImageType::CLIPBOARD_READ_WRITE:
case ImageType::SENSORS:
case ImageType::NOTIFICATIONS_QUIET_PROMPT:
- return base::nullopt;
+ return absl::nullopt;
case ImageType::NUM_IMAGE_TYPES:
break;
}
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
// The preferred max width for the promo to be shown.
@@ -82,7 +82,7 @@
SetUpForInOutAnimation();
image()->SetFlipCanvasOnPaintForRTLUI(true);
- base::Optional<ViewID> view_id =
+ absl::optional<ViewID> view_id =
GetViewID(content_setting_image_model_->image_type());
if (view_id)
SetID(*view_id);
@@ -136,7 +136,7 @@
content_setting_image_model_->SetAnimationHasRun(web_contents);
}
-void ContentSettingImageView::SetIconColor(base::Optional<SkColor> color) {
+void ContentSettingImageView::SetIconColor(absl::optional<SkColor> color) {
if (icon_color_ == color)
return;
icon_color_ = color;
@@ -145,7 +145,7 @@
OnPropertyChanged(&icon_color_, views::kPropertyEffectsNone);
}
-base::Optional<SkColor> ContentSettingImageView::GetIconColor() const {
+absl::optional<SkColor> ContentSettingImageView::GetIconColor() const {
return icon_color_;
}
@@ -252,5 +252,5 @@
}
BEGIN_METADATA(ContentSettingImageView, IconLabelBubbleView)
-ADD_PROPERTY_METADATA(base::Optional<SkColor>, IconColor)
+ADD_PROPERTY_METADATA(absl::optional<SkColor>, IconColor)
END_METADATA
diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.h b/chrome/browser/ui/views/location_bar/content_setting_image_view.h
index 7e3cefe7..3f7709f 100644
--- a/chrome/browser/ui/views/location_bar/content_setting_image_view.h
+++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.h
@@ -70,8 +70,8 @@
void Update();
// Set the color of the button icon. Based on the text color by default.
- void SetIconColor(base::Optional<SkColor> color);
- base::Optional<SkColor> GetIconColor() const;
+ void SetIconColor(absl::optional<SkColor> color);
+ absl::optional<SkColor> GetIconColor() const;
void disable_animation() { can_animate_ = false; }
@@ -98,7 +98,7 @@
Delegate* delegate_; // Weak.
std::unique_ptr<ContentSettingImageModel> content_setting_image_model_;
views::BubbleDialogDelegateView* bubble_view_;
- base::Optional<SkColor> icon_color_;
+ absl::optional<SkColor> icon_color_;
// Observes destruction of bubble's Widgets spawned by this ImageView.
base::ScopedObservation<views::Widget, views::WidgetObserver> observation_{
diff --git a/chrome/browser/ui/views/location_bar/cookie_controls_bubble_view.h b/chrome/browser/ui/views/location_bar/cookie_controls_bubble_view.h
index 89397fe..fc136841 100644
--- a/chrome/browser/ui/views/location_bar/cookie_controls_bubble_view.h
+++ b/chrome/browser/ui/views/location_bar/cookie_controls_bubble_view.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_COOKIE_CONTROLS_BUBBLE_VIEW_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ui/cookie_controls/cookie_controls_service.h"
#include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.h"
#include "components/content_settings/browser/ui/cookie_controls_controller.h"
@@ -14,6 +13,7 @@
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/common/cookie_controls_enforcement.h"
#include "components/content_settings/core/common/cookie_controls_status.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/bubble/tooltip_icon.h"
#include "ui/views/controls/button/button.h"
@@ -86,7 +86,7 @@
IntermediateStep intermediate_step_ = IntermediateStep::kNone;
- base::Optional<int> blocked_cookies_;
+ absl::optional<int> blocked_cookies_;
views::ImageView* header_view_ = nullptr;
views::Label* text_ = nullptr;
diff --git a/chrome/browser/ui/views/location_bar/custom_tab_bar_view.cc b/chrome/browser/ui/views/location_bar/custom_tab_bar_view.cc
index 4818c0b..e6a401a 100644
--- a/chrome/browser/ui/views/location_bar/custom_tab_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/custom_tab_bar_view.cc
@@ -321,7 +321,7 @@
void CustomTabBarView::OnThemeChanged() {
views::AccessiblePaneView::OnThemeChanged();
- base::Optional<SkColor> optional_theme_color = GetThemeColor();
+ absl::optional<SkColor> optional_theme_color = GetThemeColor();
title_bar_color_ = optional_theme_color.value_or(GetDefaultFrameColor());
@@ -533,10 +533,10 @@
views::MenuAnchorPosition::kTopLeft, source_type);
}
-base::Optional<SkColor> CustomTabBarView::GetThemeColor() const {
+absl::optional<SkColor> CustomTabBarView::GetThemeColor() const {
web_app::AppBrowserController* application_controller = app_controller();
return application_controller ? application_controller->GetThemeColor()
- : base::nullopt;
+ : absl::nullopt;
}
bool CustomTabBarView::GetShowTitle() const {
@@ -547,6 +547,6 @@
ADD_READONLY_PROPERTY_METADATA(SkColor,
DefaultFrameColor,
ui::metadata::SkColorConverter)
-ADD_READONLY_PROPERTY_METADATA(base::Optional<SkColor>, ThemeColor)
+ADD_READONLY_PROPERTY_METADATA(absl::optional<SkColor>, ThemeColor)
ADD_READONLY_PROPERTY_METADATA(bool, ShowTitle)
END_METADATA
diff --git a/chrome/browser/ui/views/location_bar/custom_tab_bar_view.h b/chrome/browser/ui/views/location_bar/custom_tab_bar_view.h
index a36abdd..b7e1d143 100644
--- a/chrome/browser/ui/views/location_bar/custom_tab_bar_view.h
+++ b/chrome/browser/ui/views/location_bar/custom_tab_bar_view.h
@@ -116,7 +116,7 @@
}
// Convenience method to return the theme color from |app_controller_|.
- base::Optional<SkColor> GetThemeColor() const;
+ absl::optional<SkColor> GetThemeColor() const;
// Populates child elements with page details from the current WebContents.
void UpdateContents();
diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
index 4a5c5b8..f08cd04d 100644
--- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
+++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
@@ -474,7 +474,7 @@
open_state_fraction_ = 0.2;
}
-void IconLabelBubbleView::AnimateIn(base::Optional<int> string_id) {
+void IconLabelBubbleView::AnimateIn(absl::optional<int> string_id) {
if (!label()->GetVisible()) {
// Start animation from the current width, otherwise the icon will also be
// included if visible.
diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
index aa9adb2..24273e57 100644
--- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
+++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.h
@@ -9,8 +9,8 @@
#include <string>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/pointer/touch_ui_controller.h"
@@ -177,7 +177,7 @@
// TODO(bruthig): See https://crbug.com/669253. Since the ink drop highlight
// currently cannot handle host resizes, the highlight needs to be disabled
// when the animation is running.
- void AnimateIn(base::Optional<int> string_id);
+ void AnimateIn(absl::optional<int> string_id);
// Animates the view out.
void AnimateOut();
diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view_unittest.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view_unittest.cc
index de2c04c..603883c 100644
--- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view_unittest.cc
+++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view_unittest.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/ui/layout_constants.h"
@@ -13,6 +12,7 @@
#include "chrome/test/views/chrome_views_test_base.h"
#include "components/strings/grit/components_strings.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/events/base_event_utils.h"
@@ -392,12 +392,12 @@
#endif
TEST_F(IconLabelBubbleViewTest, LabelVisibilityAfterAnimation) {
- view()->AnimateIn(base::nullopt);
+ view()->AnimateIn(absl::nullopt);
EXPECT_TRUE(view()->IsLabelVisible());
view()->AnimateOut();
EXPECT_FALSE(view()->IsLabelVisible());
// Label should reappear if animated in after being animated out.
- view()->AnimateIn(base::nullopt);
+ view()->AnimateIn(absl::nullopt);
EXPECT_TRUE(view()->IsLabelVisible());
}
@@ -407,7 +407,7 @@
view()->ResetSlideAnimation(false);
EXPECT_FALSE(view()->IsLabelVisible());
// Label should reappear if animated in after being reset out.
- view()->AnimateIn(base::nullopt);
+ view()->AnimateIn(absl::nullopt);
EXPECT_TRUE(view()->IsLabelVisible());
}
diff --git a/chrome/browser/ui/views/location_bar/location_icon_view.cc b/chrome/browser/ui/views/location_bar/location_icon_view.cc
index 24f2235..4b3aa25 100644
--- a/chrome/browser/ui/views/location_bar/location_icon_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_icon_view.cc
@@ -200,7 +200,7 @@
if (!GetAnimateTextVisibilityChange() || suppress_animations)
ResetSlideAnimation(should_show);
else if (should_show)
- AnimateIn(base::nullopt);
+ AnimateIn(absl::nullopt);
else
AnimateOut();
}
diff --git a/chrome/browser/ui/views/location_bar/star_view.h b/chrome/browser/ui/views/location_bar/star_view.h
index b36e760..2b758b19 100644
--- a/chrome/browser/ui/views/location_bar/star_view.h
+++ b/chrome/browser/ui/views/location_bar/star_view.h
@@ -64,7 +64,7 @@
BooleanPrefMember edit_bookmarks_enabled_;
- base::Optional<FeaturePromoController::PromoHandle>
+ absl::optional<FeaturePromoController::PromoHandle>
reading_list_entry_point_promo_handle_;
};
diff --git a/chrome/browser/ui/views/media_router/cast_dialog_sink_button.h b/chrome/browser/ui/views/media_router/cast_dialog_sink_button.h
index ce79a04..ba72599 100644
--- a/chrome/browser/ui/views/media_router/cast_dialog_sink_button.h
+++ b/chrome/browser/ui/views/media_router/cast_dialog_sink_button.h
@@ -58,7 +58,7 @@
void OnEnabledChanged();
const UIMediaSink sink_;
- base::Optional<std::u16string> saved_status_text_;
+ absl::optional<std::u16string> saved_status_text_;
base::CallbackListSubscription enabled_changed_subscription_ =
AddEnabledChangedCallback(
base::BindRepeating(&CastDialogSinkButton::OnEnabledChanged,
diff --git a/chrome/browser/ui/views/media_router/cast_dialog_view.cc b/chrome/browser/ui/views/media_router/cast_dialog_view.cc
index 5caa4c7..13a5a9ea 100644
--- a/chrome/browser/ui/views/media_router/cast_dialog_view.cc
+++ b/chrome/browser/ui/views/media_router/cast_dialog_view.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/containers/contains.h"
#include "base/location.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "build/build_config.h"
@@ -30,6 +29,7 @@
#include "components/media_router/common/media_sink.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/gfx/geometry/rect.h"
@@ -377,7 +377,7 @@
// |sink| may get invalidated during CastDialogController::StartCasting()
// due to a model update, so we must use a copy of its |id| field.
const std::string sink_id = sink.id;
- base::Optional<MediaCastMode> cast_mode = GetCastModeToUse(sink);
+ absl::optional<MediaCastMode> cast_mode = GetCastModeToUse(sink);
if (cast_mode) {
// Starting local file casting may open a new tab synchronously on the UI
// thread, which deactivates the dialog. So we must prevent it from
@@ -400,27 +400,27 @@
SizeToContents();
}
-base::Optional<MediaCastMode> CastDialogView::GetCastModeToUse(
+absl::optional<MediaCastMode> CastDialogView::GetCastModeToUse(
const UIMediaSink& sink) const {
// Go through cast modes in the order of preference to find one that is
// supported and selected.
switch (selected_source_) {
case SourceType::kTab:
if (base::Contains(sink.cast_modes, PRESENTATION))
- return base::make_optional<MediaCastMode>(PRESENTATION);
+ return absl::make_optional<MediaCastMode>(PRESENTATION);
if (base::Contains(sink.cast_modes, TAB_MIRROR))
- return base::make_optional<MediaCastMode>(TAB_MIRROR);
+ return absl::make_optional<MediaCastMode>(TAB_MIRROR);
break;
case SourceType::kDesktop:
if (base::Contains(sink.cast_modes, DESKTOP_MIRROR))
- return base::make_optional<MediaCastMode>(DESKTOP_MIRROR);
+ return absl::make_optional<MediaCastMode>(DESKTOP_MIRROR);
break;
case SourceType::kLocalFile:
if (base::Contains(sink.cast_modes, LOCAL_FILE))
- return base::make_optional<MediaCastMode>(LOCAL_FILE);
+ return absl::make_optional<MediaCastMode>(LOCAL_FILE);
break;
}
- return base::nullopt;
+ return absl::nullopt;
}
void CastDialogView::DisableUnsupportedSinks() {
diff --git a/chrome/browser/ui/views/media_router/cast_dialog_view.h b/chrome/browser/ui/views/media_router/cast_dialog_view.h
index 5b9ae9f..8d15038 100644
--- a/chrome/browser/ui/views/media_router/cast_dialog_view.h
+++ b/chrome/browser/ui/views/media_router/cast_dialog_view.h
@@ -176,7 +176,7 @@
// Returns the cast mode that is selected in the sources menu and supported by
// |sink|. Returns nullopt if no such cast mode exists.
- base::Optional<MediaCastMode> GetCastModeToUse(const UIMediaSink& sink) const;
+ absl::optional<MediaCastMode> GetCastModeToUse(const UIMediaSink& sink) const;
// Disables sink buttons for sinks that do not support the currently selected
// source.
@@ -232,10 +232,10 @@
// The sink that the user has selected to cast to. If the user is using
// multiple sinks at the same time, the last activated sink is used.
- base::Optional<size_t> selected_sink_index_;
+ absl::optional<size_t> selected_sink_index_;
// This value is set if the user has chosen a local file to cast.
- base::Optional<std::u16string> local_file_name_;
+ absl::optional<std::u16string> local_file_name_;
base::ObserverList<Observer> observers_;
diff --git a/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc b/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc
index 0dacd473..6599c60 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_match_cell_view.cc
@@ -8,7 +8,6 @@
#include "base/macros.h"
#include "base/metrics/field_trial_params.h"
-#include "base/optional.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/omnibox/omnibox_theme.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
@@ -18,6 +17,7 @@
#include "chrome/grit/theme_resources.h"
#include "components/omnibox/browser/vector_icons.h"
#include "extensions/common/image_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
index 773c878..c60e826c 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
@@ -10,7 +10,6 @@
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/feature_list.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
@@ -23,6 +22,7 @@
#include "chrome/browser/ui/webui/omnibox/omnibox_popup_handler.h"
#include "components/omnibox/browser/omnibox_prefs.h"
#include "components/omnibox/common/omnibox_features.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/compositor/closure_animation_observer.h"
@@ -357,7 +357,7 @@
location_bar_view_->profile()));
}
} else {
- base::Optional<int> previous_row_group_id = base::nullopt;
+ absl::optional<int> previous_row_group_id = absl::nullopt;
PrefService* const pref_service = GetPrefService();
for (size_t i = 0; i < result_size; ++i) {
// Create child views lazily. Since especially the first result view may
diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view_browsertest.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view_browsertest.cc
index 29c32ad..f62d80ba 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view_browsertest.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view_browsertest.cc
@@ -63,10 +63,10 @@
last_click_ = event->location();
}
- base::Optional<gfx::Point> last_click() const { return last_click_; }
+ absl::optional<gfx::Point> last_click() const { return last_click_; }
private:
- base::Optional<gfx::Point> last_click_;
+ absl::optional<gfx::Point> last_click_;
};
// Helper to wait for theme changes. The wait is triggered when an instance of
diff --git a/chrome/browser/ui/views/omnibox/omnibox_row_view.cc b/chrome/browser/ui/views/omnibox/omnibox_row_view.cc
index 1b93872f..847a2b1 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_row_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_row_view.cc
@@ -274,7 +274,7 @@
: public ui::metadata::BaseTypeConverter<true> {
static std::u16string ToString(
ui::metadata::ArgType<OmniboxPopupModel::Selection> source_value);
- static base::Optional<OmniboxPopupModel::Selection> FromString(
+ static absl::optional<OmniboxPopupModel::Selection> FromString(
const std::u16string& source_value);
static ui::metadata::ValidStrings GetValidStrings() { return {}; }
};
@@ -290,23 +290,23 @@
}
// static
-base::Optional<OmniboxPopupModel::Selection>
+absl::optional<OmniboxPopupModel::Selection>
ui::metadata::TypeConverter<OmniboxPopupModel::Selection>::FromString(
const std::u16string& source_value) {
const auto values = base::SplitString(
source_value, u"{,}", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
if (values.size() != 2)
- return base::nullopt;
+ return absl::nullopt;
// TODO(pkasting): This should be size_t, but for some reason that won't link
// on Mac.
- const base::Optional<uint32_t> line =
+ const absl::optional<uint32_t> line =
TypeConverter<uint32_t>::FromString(values[0]);
- const base::Optional<OmniboxPopupModel::LineState> state =
+ const absl::optional<OmniboxPopupModel::LineState> state =
TypeConverter<OmniboxPopupModel::LineState>::FromString(values[1]);
return (line.has_value() && state.has_value())
- ? base::make_optional<OmniboxPopupModel::Selection>(line.value(),
+ ? absl::make_optional<OmniboxPopupModel::Selection>(line.value(),
state.value())
- : base::nullopt;
+ : absl::nullopt;
}
BEGIN_METADATA(OmniboxRowView, HeaderView, views::View)
diff --git a/chrome/browser/ui/views/omnibox/omnibox_row_view.h b/chrome/browser/ui/views/omnibox/omnibox_row_view.h
index a20ce1c8..2fbe77a 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_row_view.h
+++ b/chrome/browser/ui/views/omnibox/omnibox_row_view.h
@@ -7,7 +7,7 @@
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/view.h"
diff --git a/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc b/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc
index 592c7a60..37d7fdc 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc
@@ -130,7 +130,7 @@
const gfx::VectorIcon* icon_;
OmniboxPopupContentsView* popup_contents_view_;
OmniboxPopupModel::Selection selection_;
- base::Optional<SkColor> omnibox_bg_color_;
+ absl::optional<SkColor> omnibox_bg_color_;
};
BEGIN_METADATA(OmniboxSuggestionRowButton, views::MdTextButton)
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
index eaa12d8371..7f13620 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
@@ -105,8 +105,8 @@
bool base_text_emphasis() const { return base_text_emphasis_; }
// Returns the latest color applied to |range| via ApplyColor(), or
- // base::nullopt if no color has been applied to |range|.
- base::Optional<SkColor> GetLatestColorForRange(const gfx::Range& range);
+ // absl::nullopt if no color has been applied to |range|.
+ absl::optional<SkColor> GetLatestColorForRange(const gfx::Range& range);
// OmniboxViewViews:
void GetAccessibleNodeData(ui::AXNodeData* node_data) override {}
@@ -201,7 +201,7 @@
EXPECT_EQ(update_popup_call_count_, 0U);
}
-base::Optional<SkColor> TestingOmniboxView::GetLatestColorForRange(
+absl::optional<SkColor> TestingOmniboxView::GetLatestColorForRange(
const gfx::Range& range) {
// Iterate backwards to get the most recently applied color for |range|.
for (auto range_color = range_colors_.rbegin();
@@ -209,7 +209,7 @@
if (range == range_color->second)
return range_color->first;
}
- return base::nullopt;
+ return absl::nullopt;
}
void TestingOmniboxView::OnThemeChanged() {
diff --git a/chrome/browser/ui/views/overlay/back_to_tab_label_button.h b/chrome/browser/ui/views/overlay/back_to_tab_label_button.h
index 5cf9fdd1..1b581b0 100644
--- a/chrome/browser/ui/views/overlay/back_to_tab_label_button.h
+++ b/chrome/browser/ui/views/overlay/back_to_tab_label_button.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_VIEWS_OVERLAY_BACK_TO_TAB_LABEL_BUTTON_H_
#define CHROME_BROWSER_UI_VIEWS_OVERLAY_BACK_TO_TAB_LABEL_BUTTON_H_
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/controls/button/label_button.h"
@@ -31,7 +31,7 @@
private:
void UpdateSizingAndPosition();
- base::Optional<gfx::Size> window_size_;
+ absl::optional<gfx::Size> window_size_;
};
#endif // CHROME_BROWSER_UI_VIEWS_OVERLAY_BACK_TO_TAB_LABEL_BUTTON_H_
diff --git a/chrome/browser/ui/views/overlay/overlay_window_views.h b/chrome/browser/ui/views/overlay/overlay_window_views.h
index 8739e7f..37fcb0e 100644
--- a/chrome/browser/ui/views/overlay/overlay_window_views.h
+++ b/chrome/browser/ui/views/overlay/overlay_window_views.h
@@ -7,9 +7,9 @@
#include "content/public/browser/overlay_window.h"
-#include "base/optional.h"
#include "base/timer/timer.h"
#include "build/chromeos_buildflags.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/widget/widget.h"
@@ -285,7 +285,7 @@
// If set, controls will always either be shown or hidden, instead of showing
// and hiding automatically. Only used for testing via
// ForceControlsVisibleForTesting().
- base::Optional<bool> force_controls_visible_;
+ absl::optional<bool> force_controls_visible_;
DISALLOW_COPY_AND_ASSIGN(OverlayWindowViews);
};
diff --git a/chrome/browser/ui/views/overlay/resize_handle_button.h b/chrome/browser/ui/views/overlay/resize_handle_button.h
index 1e58cea..162dac6 100644
--- a/chrome/browser/ui/views/overlay/resize_handle_button.h
+++ b/chrome/browser/ui/views/overlay/resize_handle_button.h
@@ -28,7 +28,7 @@
private:
void SetImageForQuadrant(OverlayWindowViews::WindowQuadrant quadrant);
- base::Optional<OverlayWindowViews::WindowQuadrant> current_quadrant_;
+ absl::optional<OverlayWindowViews::WindowQuadrant> current_quadrant_;
};
} // namespace views
diff --git a/chrome/browser/ui/views/page_action/page_action_icon_loading_indicator_view.h b/chrome/browser/ui/views/page_action/page_action_icon_loading_indicator_view.h
index 0aac425a..c447eb8 100644
--- a/chrome/browser/ui/views/page_action/page_action_icon_loading_indicator_view.h
+++ b/chrome/browser/ui/views/page_action/page_action_icon_loading_indicator_view.h
@@ -43,7 +43,7 @@
void AnimationProgressed(const gfx::Animation* animation) override;
private:
- base::Optional<base::TimeTicks> throbber_start_time_;
+ absl::optional<base::TimeTicks> throbber_start_time_;
gfx::ThrobAnimation animation_{this};
diff --git a/chrome/browser/ui/views/page_action/page_action_icon_params.h b/chrome/browser/ui/views/page_action/page_action_icon_params.h
index 95320624..f11237ee 100644
--- a/chrome/browser/ui/views/page_action/page_action_icon_params.h
+++ b/chrome/browser/ui/views/page_action/page_action_icon_params.h
@@ -8,9 +8,9 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ui/page_action/page_action_icon_type.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
class Browser;
@@ -31,7 +31,7 @@
// Leaving these params unset will leave the icon default values untouched.
// TODO(crbug.com/1061634): Make these fields non-optional.
- base::Optional<SkColor> icon_color;
+ absl::optional<SkColor> icon_color;
const gfx::FontList* font_list = nullptr;
int between_icon_spacing = 0;
diff --git a/chrome/browser/ui/views/page_action/page_action_icon_view_unittest.cc b/chrome/browser/ui/views/page_action/page_action_icon_view_unittest.cc
index 5dadd68d..2bd0c050 100644
--- a/chrome/browser/ui/views/page_action/page_action_icon_view_unittest.cc
+++ b/chrome/browser/ui/views/page_action/page_action_icon_view_unittest.cc
@@ -113,7 +113,7 @@
};
TEST_F(PageActionIconViewTest, ShouldResetSlideAnimationWhenHideIcons) {
- view()->AnimateIn(base::nullopt);
+ view()->AnimateIn(absl::nullopt);
EXPECT_TRUE(view()->IsLabelVisible());
EXPECT_TRUE(view()->is_animating_label());
@@ -126,7 +126,7 @@
TEST_F(PageActionIconViewTest, ShouldNotResetSlideAnimationWhenShowIcons) {
delegate()->set_should_hide_page_action_icons(true);
- view()->AnimateIn(base::nullopt);
+ view()->AnimateIn(absl::nullopt);
EXPECT_TRUE(view()->IsLabelVisible());
EXPECT_TRUE(view()->is_animating_label());
diff --git a/chrome/browser/ui/views/page_action/pwa_install_view.cc b/chrome/browser/ui/views/page_action/pwa_install_view.cc
index 781b4dd..354178f 100644
--- a/chrome/browser/ui/views/page_action/pwa_install_view.cc
+++ b/chrome/browser/ui/views/page_action/pwa_install_view.cc
@@ -111,7 +111,7 @@
bool is_probably_promotable = manager->IsProbablyPromotableWebApp();
if (is_probably_promotable && manager->MaybeConsumeInstallAnimation())
- AnimateIn(base::nullopt);
+ AnimateIn(absl::nullopt);
else
ResetSlideAnimation(false);
diff --git a/chrome/browser/ui/views/page_action/pwa_install_view_browsertest.cc b/chrome/browser/ui/views/page_action/pwa_install_view_browsertest.cc
index 0d69987..ec50f0fc 100644
--- a/chrome/browser/ui/views/page_action/pwa_install_view_browsertest.cc
+++ b/chrome/browser/ui/views/page_action/pwa_install_view_browsertest.cc
@@ -259,7 +259,7 @@
}));
run_loop.Run();
- web_app::SetInstallBounceMetricTimeForTesting(base::nullopt);
+ web_app::SetInstallBounceMetricTimeForTesting(absl::nullopt);
std::vector<base::Bucket> expected_buckets;
if (expected_count > 0) {
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc
index ad7d7d8..b049562 100644
--- a/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc
+++ b/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc
@@ -162,8 +162,8 @@
Profile* profile_;
content::WebContents* web_contents_;
base::RunLoop run_loop_;
- base::Optional<bool> reload_prompt_;
- base::Optional<views::Widget::ClosedReason> closed_reason_;
+ absl::optional<bool> reload_prompt_;
+ absl::optional<views::Widget::ClosedReason> closed_reason_;
DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleViewTestApi);
};
diff --git a/chrome/browser/ui/views/page_info/page_info_hover_button.cc b/chrome/browser/ui/views/page_info/page_info_hover_button.cc
index 09e47745..161cfeb 100644
--- a/chrome/browser/ui/views/page_info/page_info_hover_button.cc
+++ b/chrome/browser/ui/views/page_info/page_info_hover_button.cc
@@ -46,7 +46,7 @@
int click_target_id,
const std::u16string& tooltip_text,
const std::u16string& subtitle_text,
- base::Optional<ui::ImageModel> action_image_icon)
+ absl::optional<ui::ImageModel> action_image_icon)
: HoverButton(std::move(callback), std::u16string()) {
label()->SetHandlesTooltips(false);
diff --git a/chrome/browser/ui/views/page_info/page_info_hover_button.h b/chrome/browser/ui/views/page_info/page_info_hover_button.h
index ea4a2d4..324e8af 100644
--- a/chrome/browser/ui/views/page_info/page_info_hover_button.h
+++ b/chrome/browser/ui/views/page_info/page_info_hover_button.h
@@ -60,7 +60,7 @@
int click_target_id,
const std::u16string& tooltip_text,
const std::u16string& subtitle_text,
- base::Optional<ui::ImageModel> action_image_icon = base::nullopt);
+ absl::optional<ui::ImageModel> action_image_icon = absl::nullopt);
~PageInfoHoverButton() override = default;
// Updates the title text, and applies the secondary style to the secondary
diff --git a/chrome/browser/ui/views/passwords/move_to_account_store_bubble_view.cc b/chrome/browser/ui/views/passwords/move_to_account_store_bubble_view.cc
index 0a0e47e..919d329 100644
--- a/chrome/browser/ui/views/passwords/move_to_account_store_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/move_to_account_store_bubble_view.cc
@@ -45,7 +45,7 @@
public:
BackgroundBorderAdderImageSource(const gfx::ImageSkia& image,
bool add_background,
- base::Optional<SkColor> background_color,
+ absl::optional<SkColor> background_color,
SkColor border_color,
int radius)
: gfx::CanvasImageSource(gfx::Size(radius, radius)),
@@ -60,7 +60,7 @@
private:
const gfx::ImageSkia image_;
const bool add_background_;
- const base::Optional<SkColor> background_color_;
+ const absl::optional<SkColor> background_color_;
const SkColor border_color_;
};
@@ -114,8 +114,8 @@
void Render();
const gfx::VectorIcon* main_vector_icon_ = nullptr;
- base::Optional<gfx::ImageSkia> main_image_skia_;
- base::Optional<gfx::ImageSkia> badge_image_skia_;
+ absl::optional<gfx::ImageSkia> main_image_skia_;
+ absl::optional<gfx::ImageSkia> badge_image_skia_;
};
ImageWithBadge::ImageWithBadge(const gfx::ImageSkia& main_image)
@@ -175,7 +175,7 @@
gfx::ImageSkia main_image_with_border =
gfx::CanvasImageSource::MakeImageSkia<BackgroundBorderAdderImageSource>(
GetMainImage(), /*add_background=*/false,
- /*background_color=*/base::nullopt, kBorderColor, kImageSize);
+ /*background_color=*/absl::nullopt, kBorderColor, kImageSize);
gfx::ImageSkia badged_image = gfx::ImageSkiaOperations::CreateIconWithBadge(
main_image_with_border, rounded_badge_with_background_and_border);
diff --git a/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view.cc b/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view.cc
index 84e09fb..805f53b 100644
--- a/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view.cc
+++ b/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view.cc
@@ -691,7 +691,7 @@
// If the regular promo was shown, the failed reauth promo is
// definitely finished. If not, we can't be confident it hasn't
// finished.
- failed_reauth_promo_id_ = base::nullopt;
+ failed_reauth_promo_id_ = absl::nullopt;
}
} else {
bubble_params.body_string_specifier =
@@ -720,7 +720,7 @@
// IDs, and we reset ours when showing a normal IPH bubble.
promo_controller_->CloseBubbleForCriticalPromo(
failed_reauth_promo_id_.value());
- failed_reauth_promo_id_ = base::nullopt;
+ failed_reauth_promo_id_ = absl::nullopt;
}
void PasswordSaveUpdateWithAccountStoreView::AnnounceSaveUpdateChange() {
diff --git a/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view.h b/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view.h
index 1d0bf82..c96167cb 100644
--- a/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view.h
+++ b/chrome/browser/ui/views/passwords/password_save_update_with_account_store_view.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_SAVE_UPDATE_WITH_ACCOUNT_STORE_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_PASSWORDS_PASSWORD_SAVE_UPDATE_WITH_ACCOUNT_STORE_VIEW_H_
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/token.h"
#include "chrome/browser/ui/passwords/bubble_controllers/save_update_with_account_store_bubble_controller.h"
#include "chrome/browser/ui/views/passwords/password_bubble_view_base.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/layout/animating_layout_manager.h"
#include "ui/views/view.h"
@@ -116,7 +116,7 @@
// When showing kReauthFailure IPH, |promo_controller_| gives back an
// ID. This is used to close the bubble later.
- base::Optional<base::Token> failed_reauth_promo_id_;
+ absl::optional<base::Token> failed_reauth_promo_id_;
// Hidden view that will contain status text for immediate output by
// screen readers when the bubble changes state between Save and Update.
diff --git a/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view.cc b/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view.cc
index 882edbb..eafc260 100644
--- a/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view.cc
+++ b/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view.cc
@@ -136,7 +136,7 @@
for (permissions::PermissionRequest* request : GetVisibleRequests())
AddRequestLine(request);
- base::Optional<std::u16string> extra_text = GetExtraText();
+ absl::optional<std::u16string> extra_text = GetExtraText();
if (extra_text.has_value()) {
auto* extra_text_label =
AddChildView(std::make_unique<views::Label>(extra_text.value()));
@@ -336,7 +336,7 @@
!origin_url.SchemeIsFile();
}
-base::Optional<std::u16string> PermissionPromptBubbleView::GetExtraText()
+absl::optional<std::u16string> PermissionPromptBubbleView::GetExtraText()
const {
switch (delegate_->Requests()[0]->GetRequestType()) {
case permissions::RequestType::kStorageAccess:
@@ -349,7 +349,7 @@
delegate_->GetEmbeddingOrigin(),
url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC));
default:
- return base::nullopt;
+ return absl::nullopt;
}
}
diff --git a/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view.h b/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view.h
index 30a6b1e..0084f90 100644
--- a/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view.h
+++ b/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view.h
@@ -66,7 +66,7 @@
bool GetDisplayNameIsOrigin() const;
// Get extra information to display for the permission, if any.
- base::Optional<std::u16string> GetExtraText() const;
+ absl::optional<std::u16string> GetExtraText() const;
// Record UMA Permissions.*.TimeToDecision.|action| metric. Can be
// Permissions.Prompt.TimeToDecision.* or Permissions.Chip.TimeToDecision.*,
diff --git a/chrome/browser/ui/views/plugin_vm/plugin_vm_installer_view.cc b/chrome/browser/ui/views/plugin_vm/plugin_vm_installer_view.cc
index e4ac632..acad11e 100644
--- a/chrome/browser/ui/views/plugin_vm/plugin_vm_installer_view.cc
+++ b/chrome/browser/ui/views/plugin_vm/plugin_vm_installer_view.cc
@@ -10,7 +10,6 @@
#include "ash/public/cpp/window_properties.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ash/plugin_vm/plugin_vm_installer_factory.h"
@@ -24,6 +23,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
@@ -604,7 +604,7 @@
OnStateUpdated();
plugin_vm_installer_->SetObserver(this);
- base::Optional<plugin_vm::PluginVmInstaller::FailureReason> failure_reason =
+ absl::optional<plugin_vm::PluginVmInstaller::FailureReason> failure_reason =
plugin_vm_installer_->Start();
if (failure_reason)
OnError(failure_reason.value());
diff --git a/chrome/browser/ui/views/plugin_vm/plugin_vm_installer_view.h b/chrome/browser/ui/views/plugin_vm/plugin_vm_installer_view.h
index 97d2536..25af4b9 100644
--- a/chrome/browser/ui/views/plugin_vm/plugin_vm_installer_view.h
+++ b/chrome/browser/ui/views/plugin_vm/plugin_vm_installer_view.h
@@ -98,7 +98,7 @@
State state_ = State::kConfirmInstall;
InstallingState installing_state_ = InstallingState::kInactive;
- base::Optional<plugin_vm::PluginVmInstaller::FailureReason> reason_;
+ absl::optional<plugin_vm::PluginVmInstaller::FailureReason> reason_;
base::OnceCallback<void(bool success)> finished_callback_for_testing_;
diff --git a/chrome/browser/ui/views/policy/enterprise_startup_dialog_view.cc b/chrome/browser/ui/views/policy/enterprise_startup_dialog_view.cc
index e27a6986..69fd503d 100644
--- a/chrome/browser/ui/views/policy/enterprise_startup_dialog_view.cc
+++ b/chrome/browser/ui/views/policy/enterprise_startup_dialog_view.cc
@@ -132,7 +132,7 @@
void EnterpriseStartupDialogView::DisplayErrorMessage(
const std::u16string& error_message,
- const base::Optional<std::u16string>& accept_button) {
+ const absl::optional<std::u16string>& accept_button) {
ResetDialog(accept_button.has_value());
std::unique_ptr<views::Label> text = CreateText(error_message);
auto error_icon = std::make_unique<views::ImageView>();
@@ -264,7 +264,7 @@
void EnterpriseStartupDialogImpl::DisplayErrorMessage(
const std::u16string& error_message,
- const base::Optional<std::u16string>& accept_button) {
+ const absl::optional<std::u16string>& accept_button) {
if (dialog_view_)
dialog_view_->DisplayErrorMessage(error_message, accept_button);
}
diff --git a/chrome/browser/ui/views/policy/enterprise_startup_dialog_view.h b/chrome/browser/ui/views/policy/enterprise_startup_dialog_view.h
index 4736413f..1fefc98 100644
--- a/chrome/browser/ui/views/policy/enterprise_startup_dialog_view.h
+++ b/chrome/browser/ui/views/policy/enterprise_startup_dialog_view.h
@@ -32,7 +32,7 @@
void DisplayLaunchingInformationWithThrobber(
const std::u16string& information);
void DisplayErrorMessage(const std::u16string& error_message,
- const base::Optional<std::u16string>& accept_button);
+ const absl::optional<std::u16string>& accept_button);
void CloseDialog();
void AddWidgetObserver(views::WidgetObserver* observer);
@@ -78,7 +78,7 @@
const std::u16string& information) override;
void DisplayErrorMessage(
const std::u16string& error_message,
- const base::Optional<std::u16string>& accept_button) override;
+ const absl::optional<std::u16string>& accept_button) override;
bool IsShowing() override;
// views::WidgetObserver:
diff --git a/chrome/browser/ui/views/profiles/avatar_toolbar_button.cc b/chrome/browser/ui/views/profiles/avatar_toolbar_button.cc
index 0fe7f9b6..17257c4 100644
--- a/chrome/browser/ui/views/profiles/avatar_toolbar_button.cc
+++ b/chrome/browser/ui/views/profiles/avatar_toolbar_button.cc
@@ -133,7 +133,7 @@
}
void AvatarToolbarButton::UpdateText() {
- base::Optional<SkColor> color;
+ absl::optional<SkColor> color;
std::u16string text;
switch (delegate_->GetState()) {
diff --git a/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.cc b/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.cc
index e2a1f3b7..ae88a4e 100644
--- a/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.cc
+++ b/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.cc
@@ -139,7 +139,7 @@
IdentityManagerFactory::GetForProfile(profile_);
if (identity_manager &&
identity_manager->HasPrimaryAccount(signin::ConsentLevel::kSignin)) {
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByAccountId(
identity_manager->GetPrimaryAccountId(
diff --git a/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view_browsertest.cc b/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view_browsertest.cc
index d9493cef..ac10cd6 100644
--- a/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view_browsertest.cc
+++ b/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view_browsertest.cc
@@ -7,7 +7,6 @@
#include <string>
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/test/metrics/histogram_tester.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/test/test_browser_dialog.h"
@@ -17,6 +16,7 @@
#include "chrome/test/base/testing_profile.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/test/widget_test.h"
#include "ui/views/widget/widget.h"
@@ -64,7 +64,7 @@
}
base::test::ScopedFeatureList scoped_feature_list_;
- base::Optional<SigninInterceptionResult> callback_result_;
+ absl::optional<SigninInterceptionResult> callback_result_;
std::unique_ptr<ScopedDiceWebSigninInterceptionBubbleHandle> bubble_handle_;
};
diff --git a/chrome/browser/ui/views/profiles/incognito_menu_view.cc b/chrome/browser/ui/views/profiles/incognito_menu_view.cc
index b6ce61c8..ae41e10 100644
--- a/chrome/browser/ui/views/profiles/incognito_menu_view.cc
+++ b/chrome/browser/ui/views/profiles/incognito_menu_view.cc
@@ -58,7 +58,7 @@
SetProfileIdentityInfo(
/*profile_name=*/std::u16string(),
/*background_color=*/SK_ColorTRANSPARENT,
- /*edit_button=*/base::nullopt,
+ /*edit_button=*/absl::nullopt,
ui::ImageModel::FromVectorIcon(
kIncognitoProfileIcon, ui::NativeTheme::kColorId_AvatarIconIncognito),
l10n_util::GetStringUTF16(IDS_INCOGNITO_PROFILE_MENU_TITLE),
diff --git a/chrome/browser/ui/views/profiles/profile_customization_bubble_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_customization_bubble_view_browsertest.cc
index 5dced09..5fb715a 100644
--- a/chrome/browser/ui/views/profiles/profile_customization_bubble_view_browsertest.cc
+++ b/chrome/browser/ui/views/profiles/profile_customization_bubble_view_browsertest.cc
@@ -7,7 +7,6 @@
#include <string>
#include "base/callback_list.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
@@ -23,6 +22,7 @@
#include "components/feature_engagement/test/test_tracker.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
namespace {
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view.cc b/chrome/browser/ui/views/profiles/profile_menu_view.cc
index 810913f..5a6f183 100644
--- a/chrome/browser/ui/views/profiles/profile_menu_view.cc
+++ b/chrome/browser/ui/views/profiles/profile_menu_view.cc
@@ -477,14 +477,14 @@
IdentityManagerFactory::GetForProfile(profile);
CoreAccountInfo account =
identity_manager->GetPrimaryAccountInfo(signin::ConsentLevel::kSignin);
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
account);
ProfileAttributesEntry* profile_attributes =
GetProfileAttributesEntry(profile);
std::u16string profile_name;
- base::Optional<EditButtonParams> edit_button_params;
+ absl::optional<EditButtonParams> edit_button_params;
// Profile names are not supported on ChromeOS.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
size_t num_of_profiles =
@@ -542,7 +542,7 @@
SetProfileIdentityInfo(
/*profile_name=*/std::u16string(),
/*background_color=*/SK_ColorTRANSPARENT,
- /*edit_button=*/base::nullopt, profiles::GetGuestAvatar(), menu_title_,
+ /*edit_button=*/absl::nullopt, profiles::GetGuestAvatar(), menu_title_,
menu_subtitle_, header_art_icon);
}
@@ -596,7 +596,7 @@
// Show sync promos.
CoreAccountInfo unconsented_account =
identity_manager->GetPrimaryAccountInfo(signin::ConsentLevel::kSignin);
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
unconsented_account);
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc
index c1357da..c4fd3861 100644
--- a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc
+++ b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc
@@ -580,7 +580,7 @@
void ProfileMenuViewBase::SetProfileIdentityInfo(
const std::u16string& profile_name,
SkColor profile_background_color,
- base::Optional<EditButtonParams> edit_button_params,
+ absl::optional<EditButtonParams> edit_button_params,
const ui::ImageModel& image_model,
const std::u16string& title,
const std::u16string& subtitle,
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_base.h b/chrome/browser/ui/views/profiles/profile_menu_view_base.h
index 9cd5dba..713c106 100644
--- a/chrome/browser/ui/views/profiles/profile_menu_view_base.h
+++ b/chrome/browser/ui/views/profiles/profile_menu_view_base.h
@@ -127,7 +127,7 @@
void SetProfileIdentityInfo(
const std::u16string& profile_name,
SkColor profile_background_color,
- base::Optional<EditButtonParams> edit_button_params,
+ absl::optional<EditButtonParams> edit_button_params,
const ui::ImageModel& image_model,
const std::u16string& title,
const std::u16string& subtitle = std::u16string(),
diff --git a/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.cc b/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.cc
index ec3b33e..aaddd4a 100644
--- a/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.cc
+++ b/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.cc
@@ -29,7 +29,7 @@
std::move(callback).Run(choice);
}
-base::Optional<ProfileMetrics::ProfileAddSignInFlowOutcome> GetSyncOutcome(
+absl::optional<ProfileMetrics::ProfileAddSignInFlowOutcome> GetSyncOutcome(
bool enterprise_account,
bool sync_disabled,
LoginUIService::SyncConfirmationUIClosedResult result) {
@@ -57,7 +57,7 @@
break;
case LoginUIService::UI_CLOSED:
// The metric is recorded elsewhere.
- return base::nullopt;
+ return absl::nullopt;
}
}
@@ -263,7 +263,7 @@
void ProfilePickerTurnSyncOnDelegate::FinishSyncConfirmation(
LoginUIService::SyncConfirmationUIClosedResult result,
- base::Optional<ProfileMetrics::ProfileAddSignInFlowOutcome> outcome) {
+ absl::optional<ProfileMetrics::ProfileAddSignInFlowOutcome> outcome) {
DCHECK(sync_confirmation_callback_);
if (outcome)
ProfileMetrics::LogProfileAddSignInFlowOutcome(*outcome);
diff --git a/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.h b/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.h
index 0f9c69b..55f574fc 100644
--- a/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.h
+++ b/chrome/browser/ui/views/profiles/profile_picker_turn_sync_on_delegate.h
@@ -63,7 +63,7 @@
// the metrics.
void FinishSyncConfirmation(
LoginUIService::SyncConfirmationUIClosedResult result,
- base::Optional<ProfileMetrics::ProfileAddSignInFlowOutcome> outcome);
+ absl::optional<ProfileMetrics::ProfileAddSignInFlowOutcome> outcome);
// Shows the enterprise welcome screen.
void ShowEnterpriseWelcome(EnterpriseProfileWelcomeUI::ScreenType type);
diff --git a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc
index ee43cd2744..1091130 100644
--- a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc
+++ b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc
@@ -70,7 +70,7 @@
std::unique_ptr<views::WebView>
SigninViewControllerDelegateViews::CreateSigninErrorWebView(Browser* browser) {
return CreateDialogWebView(browser, GURL(chrome::kChromeUISigninErrorURL),
- kSigninErrorDialogHeight, base::nullopt);
+ kSigninErrorDialogHeight, absl::nullopt);
}
// static
@@ -212,7 +212,7 @@
Browser* browser,
const GURL& url,
int dialog_height,
- base::Optional<int> opt_width) {
+ absl::optional<int> opt_width) {
int dialog_width = opt_width.value_or(kModalDialogWidth);
views::WebView* web_view = new views::WebView(browser->profile());
web_view->LoadInitialURL(url);
diff --git a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h
index 72b9b7c..4d07f90 100644
--- a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h
+++ b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h
@@ -106,7 +106,7 @@
Browser* browser,
const GURL& url,
int dialog_height,
- base::Optional<int> dialog_width);
+ absl::optional<int> dialog_width);
// Displays the modal dialog.
void DisplayModal();
diff --git a/chrome/browser/ui/views/read_later/read_later_button.cc b/chrome/browser/ui/views/read_later/read_later_button.cc
index a549385c..1056287b 100644
--- a/chrome/browser/ui/views/read_later/read_later_button.cc
+++ b/chrome/browser/ui/views/read_later/read_later_button.cc
@@ -242,7 +242,7 @@
views::Button::STATE_NORMAL,
ui::ImageModel::FromVectorIcon(
kReadLaterIcon, highlight_color_animation_->GetIconColor()));
- base::Optional<SkColor> background_color =
+ absl::optional<SkColor> background_color =
highlight_color_animation_->GetBackgroundColor();
if (background_color) {
SetBackground(views::CreateBackgroundFromPainter(
@@ -299,10 +299,10 @@
return FadeWithAnimation(highlight_color_, original_text_color);
}
-base::Optional<SkColor>
+absl::optional<SkColor>
ReadLaterButton::HighlightColorAnimation::GetBackgroundColor() const {
if (!highlight_color_animation_.is_animating())
- return base::nullopt;
+ return absl::nullopt;
SkColor original_bg_color = SkColorSetA(
ToolbarButton::GetDefaultBackgroundColor(parent_->GetThemeProvider()),
kBackgroundBaseLayerAlpha);
diff --git a/chrome/browser/ui/views/read_later/read_later_button.h b/chrome/browser/ui/views/read_later/read_later_button.h
index 17e5fbdb..677c7a6 100644
--- a/chrome/browser/ui/views/read_later/read_later_button.h
+++ b/chrome/browser/ui/views/read_later/read_later_button.h
@@ -57,7 +57,7 @@
// |highlight_color_| and on the current animation state (which
// influences the alpha channel).
SkColor GetTextColor() const;
- base::Optional<SkColor> GetBackgroundColor() const;
+ absl::optional<SkColor> GetBackgroundColor() const;
SkColor GetIconColor() const;
void AnimationEnded(const gfx::Animation* animation) override;
diff --git a/chrome/browser/ui/views/reader_mode/reader_mode_icon_view.cc b/chrome/browser/ui/views/reader_mode/reader_mode_icon_view.cc
index a6c2dc0..2b18e55 100644
--- a/chrome/browser/ui/views/reader_mode/reader_mode_icon_view.cc
+++ b/chrome/browser/ui/views/reader_mode/reader_mode_icon_view.cc
@@ -31,7 +31,7 @@
if (IsDistilledPage(contents->GetLastCommittedURL())) {
page_type = UMAHelper::ReaderModePageType::kDistilled;
} else {
- base::Optional<dom_distiller::DistillabilityResult> distillability =
+ absl::optional<dom_distiller::DistillabilityResult> distillability =
dom_distiller::GetLatestResult(contents);
if (distillability && distillability.value().is_distillable)
page_type = UMAHelper::ReaderModePageType::kDistillable;
diff --git a/chrome/browser/ui/views/relaunch_notification/relaunch_notification_controller_unittest.cc b/chrome/browser/ui/views/relaunch_notification/relaunch_notification_controller_unittest.cc
index 0804ac0..18ba44a7 100644
--- a/chrome/browser/ui/views/relaunch_notification/relaunch_notification_controller_unittest.cc
+++ b/chrome/browser/ui/views/relaunch_notification/relaunch_notification_controller_unittest.cc
@@ -11,7 +11,6 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
-#include "base/optional.h"
#include "base/test/mock_callback.h"
#include "base/test/power_monitor_test.h"
#include "base/test/task_environment.h"
@@ -26,6 +25,7 @@
#include "chrome/test/base/testing_browser_process.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/shell.h"
@@ -976,7 +976,7 @@
RelaunchNotificationControllerPlatformImpl& platform_impl() { return *impl_; }
private:
- base::Optional<RelaunchNotificationControllerPlatformImpl> impl_;
+ absl::optional<RelaunchNotificationControllerPlatformImpl> impl_;
};
TEST_F(RelaunchNotificationControllerPlatformImplTest,
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.h b/chrome/browser/ui/views/select_file_dialog_extension.h
index c24eb19..5da439b 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension.h
+++ b/chrome/browser/ui/views/select_file_dialog_extension.h
@@ -11,8 +11,8 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "chrome/browser/ui/views/extensions/extension_dialog_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/native_widget_types.h" // gfx::NativeWindow
#include "ui/shell_dialogs/select_file_dialog.h"
@@ -78,9 +78,9 @@
// The native window that opened the dialog.
aura::Window* window = nullptr;
// Android task ID if the owner window is an Android app.
- base::Optional<int> android_task_id;
+ absl::optional<int> android_task_id;
// Lacros window ID if the owner window is a Lacros browser.
- base::Optional<std::string> lacros_window_id;
+ absl::optional<std::string> lacros_window_id;
};
void SelectFileWithFileManagerParams(Type type,
const std::u16string& title,
diff --git a/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_bubble_view_impl.h b/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_bubble_view_impl.h
index 9d50c61..5f924a6 100644
--- a/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_bubble_view_impl.h
+++ b/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_bubble_view_impl.h
@@ -83,7 +83,7 @@
views::ScrollView* scroll_view_ = nullptr;
// The device that the user has selected to share tab to.
- base::Optional<size_t> selected_device_index_;
+ absl::optional<size_t> selected_device_index_;
base::WeakPtrFactory<SendTabToSelfBubbleViewImpl> weak_factory_{this};
diff --git a/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_icon_view.cc b/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_icon_view.cc
index 17765cc..3a12e72 100644
--- a/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_icon_view.cc
+++ b/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_icon_view.cc
@@ -94,7 +94,7 @@
// Set label ahead of time to avoid announcing a useless alert (i.e.
// "alert Send") to screenreaders.
SetLabel(l10n_util::GetStringUTF16(IDS_OMNIBOX_ICON_SEND_TAB_TO_SELF));
- AnimateIn(base::nullopt);
+ AnimateIn(absl::nullopt);
initial_animation_state_ = AnimationState::kShowing;
controller->SetInitialSendAnimationShown(true);
}
diff --git a/chrome/browser/ui/views/sharing/click_to_call_browsertest.cc b/chrome/browser/ui/views/sharing/click_to_call_browsertest.cc
index 5c40bd5..d1b1e50 100644
--- a/chrome/browser/ui/views/sharing/click_to_call_browsertest.cc
+++ b/chrome/browser/ui/views/sharing/click_to_call_browsertest.cc
@@ -250,7 +250,7 @@
sub_menu_model->ActivatedAt(device_id);
CheckLastReceiver(*device);
- base::Optional<std::string> expected_number =
+ absl::optional<std::string> expected_number =
ExtractPhoneNumberForClickToCall(GetProfile(0), kTextWithPhoneNumber);
ASSERT_TRUE(expected_number.has_value());
CheckLastSharingMessageSent(expected_number.value());
@@ -539,7 +539,7 @@
EXPECT_EQ(expected_enabled, ShouldOfferClickToCallForURL(browser()->profile(),
GURL(kPhoneLink)));
- base::Optional<std::string> extracted =
+ absl::optional<std::string> extracted =
ExtractPhoneNumberForClickToCall(browser()->profile(), kPhoneNumber);
if (expected_enabled)
EXPECT_EQ(kPhoneNumber, extracted.value());
diff --git a/chrome/browser/ui/views/sharing/remote_copy_browsertest.cc b/chrome/browser/ui/views/sharing/remote_copy_browsertest.cc
index 1f3eb78..112615c 100644
--- a/chrome/browser/ui/views/sharing/remote_copy_browsertest.cc
+++ b/chrome/browser/ui/views/sharing/remote_copy_browsertest.cc
@@ -8,7 +8,6 @@
#include "base/guid.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
@@ -26,6 +25,7 @@
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/test/browser_test.h"
#include "net/http/http_status_code.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/clipboard_constants.h"
#include "ui/base/clipboard/clipboard_monitor.h"
@@ -96,8 +96,8 @@
}
gcm::IncomingMessage CreateMessage(const std::string& device_name,
- base::Optional<std::string> text,
- base::Optional<GURL> image_url) {
+ absl::optional<std::string> text,
+ absl::optional<GURL> image_url) {
chrome_browser_sharing::SharingMessage sharing_message;
sharing_message.set_sender_guid(base::GenerateGUID());
sharing_message.set_sender_device_name(device_name);
@@ -119,7 +119,7 @@
const std::string& text) {
sharing_service_->GetFCMHandlerForTesting()->OnMessage(
kSharingFCMAppID,
- CreateMessage(device_name, text, /*image_url=*/base::nullopt));
+ CreateMessage(device_name, text, /*image_url=*/absl::nullopt));
}
void SendImageMessage(const std::string& device_name, const GURL& image_url) {
@@ -128,7 +128,7 @@
ui::ClipboardMonitor::GetInstance()->AddObserver(&observer);
sharing_service_->GetFCMHandlerForTesting()->OnMessage(
kSharingFCMAppID,
- CreateMessage(device_name, /*text*/ base::nullopt, image_url));
+ CreateMessage(device_name, /*text*/ absl::nullopt, image_url));
run_loop.Run();
ui::ClipboardMonitor::GetInstance()->RemoveObserver(&observer);
}
diff --git a/chrome/browser/ui/views/sharing/sharing_dialog_view.cc b/chrome/browser/ui/views/sharing/sharing_dialog_view.cc
index c6457473..31f5ecb 100644
--- a/chrome/browser/ui/views/sharing/sharing_dialog_view.cc
+++ b/chrome/browser/ui/views/sharing/sharing_dialog_view.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/views/sharing/sharing_dialog_view.h"
#include "base/bind.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
@@ -22,6 +21,7 @@
#include "components/sync/protocol/sync_enums.pb.h"
#include "components/sync_device_info/device_info.h"
#include "components/url_formatter/elide_url.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/color_utils.h"
diff --git a/chrome/browser/ui/views/supervised_user/parent_permission_dialog_view_browsertest.cc b/chrome/browser/ui/views/supervised_user/parent_permission_dialog_view_browsertest.cc
index 237afff..95bf045 100644
--- a/chrome/browser/ui/views/supervised_user/parent_permission_dialog_view_browsertest.cc
+++ b/chrome/browser/ui/views/supervised_user/parent_permission_dialog_view_browsertest.cc
@@ -271,7 +271,7 @@
scoped_refptr<const extensions::Extension> test_extension_;
std::unique_ptr<signin::IdentityTestEnvironment> identity_test_env_;
- base::Optional<NextDialogAction> next_dialog_action_;
+ absl::optional<NextDialogAction> next_dialog_action_;
};
// Tests that a plain dialog widget is shown using the TestBrowserUi
diff --git a/chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.cc b/chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.cc
index eea1a4a8..14219b0 100644
--- a/chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.cc
+++ b/chrome/browser/ui/views/sync/dice_bubble_sync_promo_view.cc
@@ -84,7 +84,7 @@
}
void DiceBubbleSyncPromoView::EnableSync() {
- base::Optional<AccountInfo> account = signin_button_view_->account();
+ absl::optional<AccountInfo> account = signin_button_view_->account();
delegate_->OnEnableSync(account.value_or(AccountInfo()));
}
diff --git a/chrome/browser/ui/views/sync/dice_signin_button_view.cc b/chrome/browser/ui/views/sync/dice_signin_button_view.cc
index fcc4b40f..efadec2 100644
--- a/chrome/browser/ui/views/sync/dice_signin_button_view.cc
+++ b/chrome/browser/ui/views/sync/dice_signin_button_view.cc
@@ -26,7 +26,7 @@
DiceSigninButtonView::DiceSigninButtonView(
views::Button::PressedCallback callback,
bool prominent)
- : account_(base::nullopt) {
+ : account_(absl::nullopt) {
SetLayoutManager(std::make_unique<views::FillLayout>());
// Regular MD text button when there is no account.
auto button = std::make_unique<views::MdTextButton>(
diff --git a/chrome/browser/ui/views/sync/dice_signin_button_view.h b/chrome/browser/ui/views/sync/dice_signin_button_view.h
index cf26571..c19c8011 100644
--- a/chrome/browser/ui/views/sync/dice_signin_button_view.h
+++ b/chrome/browser/ui/views/sync/dice_signin_button_view.h
@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_UI_VIEWS_SYNC_DICE_SIGNIN_BUTTON_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_SYNC_DICE_SIGNIN_BUTTON_VIEW_H_
-#include "base/optional.h"
#include "chrome/browser/ui/views/hover_button.h"
#include "components/signin/public/identity_manager/account_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/view.h"
@@ -39,13 +39,13 @@
~DiceSigninButtonView() override;
views::LabelButton* signin_button() const { return signin_button_; }
- base::Optional<AccountInfo> account() const { return account_; }
+ absl::optional<AccountInfo> account() const { return account_; }
private:
views::LabelButton* signin_button_ = nullptr;
- const base::Optional<AccountInfo> account_;
+ const absl::optional<AccountInfo> account_;
};
#endif // CHROME_BROWSER_UI_VIEWS_SYNC_DICE_SIGNIN_BUTTON_VIEW_H_
diff --git a/chrome/browser/ui/views/tab_modal_confirm_dialog_views.cc b/chrome/browser/ui/views/tab_modal_confirm_dialog_views.cc
index bf3e083..a66759c 100644
--- a/chrome/browser/ui/views/tab_modal_confirm_dialog_views.cc
+++ b/chrome/browser/ui/views/tab_modal_confirm_dialog_views.cc
@@ -45,7 +45,7 @@
SetModalType(ui::MODAL_TYPE_CHILD);
SetOwnedByWidget(true);
- base::Optional<int> default_button = delegate_->GetDefaultDialogButton();
+ absl::optional<int> default_button = delegate_->GetDefaultDialogButton();
if (bool(default_button))
SetDefaultButton(*default_button);
@@ -107,7 +107,7 @@
}
views::View* TabModalConfirmDialogViews::GetInitiallyFocusedView() {
- base::Optional<int> focused_button = delegate_->GetInitiallyFocusedButton();
+ absl::optional<int> focused_button = delegate_->GetInitiallyFocusedButton();
if (!focused_button) {
return DialogDelegate::GetInitiallyFocusedView();
}
diff --git a/chrome/browser/ui/views/tabs/alert_indicator.cc b/chrome/browser/ui/views/tabs/alert_indicator.cc
index 4ed92ee..4a6f6c5 100644
--- a/chrome/browser/ui/views/tabs/alert_indicator.cc
+++ b/chrome/browser/ui/views/tabs/alert_indicator.cc
@@ -116,7 +116,7 @@
// indicator to alert the user that recording, tab capture, or audio playback
// has started/stopped.
std::unique_ptr<gfx::Animation> CreateTabAlertIndicatorFadeAnimation(
- base::Optional<TabAlertState> alert_state) {
+ absl::optional<TabAlertState> alert_state) {
if (alert_state == TabAlertState::MEDIA_RECORDING ||
alert_state == TabAlertState::TAB_CAPTURING ||
alert_state == TabAlertState::DESKTOP_CAPTURING) {
@@ -191,11 +191,11 @@
}
void AlertIndicator::TransitionToAlertState(
- base::Optional<TabAlertState> next_state) {
+ absl::optional<TabAlertState> next_state) {
if (next_state == alert_state_)
return;
- base::Optional<TabAlertState> previous_alert_showing_state =
+ absl::optional<TabAlertState> previous_alert_showing_state =
showing_alert_state_;
if (next_state)
diff --git a/chrome/browser/ui/views/tabs/alert_indicator.h b/chrome/browser/ui/views/tabs/alert_indicator.h
index b582f83..4d6da06 100644
--- a/chrome/browser/ui/views/tabs/alert_indicator.h
+++ b/chrome/browser/ui/views/tabs/alert_indicator.h
@@ -7,8 +7,8 @@
#include <memory>
-#include "base/optional.h"
#include "chrome/browser/ui/tabs/tab_utils.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/controls/image_view.h"
@@ -35,12 +35,12 @@
// Returns the current TabAlertState except, while the indicator image is
// fading out, returns the prior TabAlertState.
- base::Optional<TabAlertState> showing_alert_state() const {
+ absl::optional<TabAlertState> showing_alert_state() const {
return showing_alert_state_;
}
// Calls ResetImages() and starts fade animations as appropriate.
- void TransitionToAlertState(base::Optional<TabAlertState> next_state);
+ void TransitionToAlertState(absl::optional<TabAlertState> next_state);
// Called when the parent tab's button color changes. Determines whether
// ResetImages() needs to be called.
@@ -59,10 +59,10 @@
void ResetImage(TabAlertState state);
Tab* const parent_tab_;
- base::Optional<TabAlertState> alert_state_;
+ absl::optional<TabAlertState> alert_state_;
std::unique_ptr<gfx::AnimationDelegate> fade_animation_delegate_;
std::unique_ptr<gfx::Animation> fade_animation_;
- base::Optional<TabAlertState> showing_alert_state_;
+ absl::optional<TabAlertState> showing_alert_state_;
};
#endif // CHROME_BROWSER_UI_VIEWS_TABS_ALERT_INDICATOR_H_
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index 5d5e8b28..bec396590 100644
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -197,7 +197,7 @@
FeaturePromoController* const feature_promo_controller_;
// Handle we keep if showing menu IPH for tab groups.
- base::Optional<FeaturePromoController::PromoHandle> tab_groups_promo_handle_;
+ absl::optional<FeaturePromoController::PromoHandle> tab_groups_promo_handle_;
};
////////////////////////////////////////////////////////////////////////////////
@@ -410,7 +410,7 @@
// active tab should switch to the next available tab. If there are no
// available tabs for the active tab to switch to, the group will not
// toggle to collapse.
- const base::Optional<int> next_active =
+ const absl::optional<int> next_active =
model_->GetNextExpandedActiveTab(GetActiveIndex(), group);
if (!next_active.has_value()) {
base::RecordAction(base::UserMetricsAction("TabGroups_CannotCollapse"));
@@ -530,7 +530,7 @@
}
void BrowserTabStripController::OnKeyboardFocusedTabChanged(
- base::Optional<int> index) {
+ absl::optional<int> index) {
browser_view_->browser()->command_controller()->TabKeyboardFocusChangedTo(
index);
}
@@ -565,12 +565,12 @@
model_->group_model()->GetTabGroup(group)->SetVisualData(visual_data);
}
-base::Optional<int> BrowserTabStripController::GetFirstTabInGroup(
+absl::optional<int> BrowserTabStripController::GetFirstTabInGroup(
const tab_groups::TabGroupId& group) const {
return model_->group_model()->GetTabGroup(group)->GetFirstTab();
}
-base::Optional<int> BrowserTabStripController::GetLastTabInGroup(
+absl::optional<int> BrowserTabStripController::GetLastTabInGroup(
const tab_groups::TabGroupId& group) const {
return model_->group_model()->GetTabGroup(group)->GetLastTab();
}
@@ -610,7 +610,7 @@
return GetFrameView()->GetToolbarTopSeparatorColor();
}
-base::Optional<int> BrowserTabStripController::GetCustomBackgroundId(
+absl::optional<int> BrowserTabStripController::GetCustomBackgroundId(
BrowserFrameActiveState active_state) const {
return GetFrameView()->GetCustomBackgroundId(active_state);
}
@@ -770,7 +770,7 @@
}
void BrowserTabStripController::TabGroupedStateChanged(
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
content::WebContents* contents,
int index) {
tabstrip_->AddTabToGroup(std::move(group), index);
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h
index 08daadd..1d7adb1 100644
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h
@@ -94,7 +94,7 @@
void StackedLayoutMaybeChanged() override;
void OnStartedDragging(bool dragging_window) override;
void OnStoppedDragging() override;
- void OnKeyboardFocusedTabChanged(base::Optional<int> index) override;
+ void OnKeyboardFocusedTabChanged(absl::optional<int> index) override;
std::u16string GetGroupTitle(
const tab_groups::TabGroupId& group_id) const override;
std::u16string GetGroupContentString(
@@ -106,9 +106,9 @@
void SetVisualDataForGroup(
const tab_groups::TabGroupId& group,
const tab_groups::TabGroupVisualData& visual_data) override;
- base::Optional<int> GetFirstTabInGroup(
+ absl::optional<int> GetFirstTabInGroup(
const tab_groups::TabGroupId& group) const override;
- base::Optional<int> GetLastTabInGroup(
+ absl::optional<int> GetLastTabInGroup(
const tab_groups::TabGroupId& group) const override;
gfx::Range ListTabsInGroup(
const tab_groups::TabGroupId& group_id) const override;
@@ -119,7 +119,7 @@
bool CanDrawStrokes() const override;
SkColor GetFrameColor(BrowserFrameActiveState active_state) const override;
SkColor GetToolbarTopSeparatorColor() const override;
- base::Optional<int> GetCustomBackgroundId(
+ absl::optional<int> GetCustomBackgroundId(
BrowserFrameActiveState active_state) const override;
std::u16string GetAccessibleTabName(const Tab* tab) const override;
Profile* GetProfile() const override;
@@ -139,7 +139,7 @@
int model_index) override;
void TabBlockedStateChanged(content::WebContents* contents,
int model_index) override;
- void TabGroupedStateChanged(base::Optional<tab_groups::TabGroupId> group,
+ void TabGroupedStateChanged(absl::optional<tab_groups::TabGroupId> group,
content::WebContents* contents,
int index) override;
void SetTabNeedsAttentionAt(int index, bool attention) override;
diff --git a/chrome/browser/ui/views/tabs/color_picker_view.cc b/chrome/browser/ui/views/tabs/color_picker_view.cc
index ccac3f2..7e58ec9 100644
--- a/chrome/browser/ui/views/tabs/color_picker_view.cc
+++ b/chrome/browser/ui/views/tabs/color_picker_view.cc
@@ -255,12 +255,12 @@
RemoveAllChildViews(true);
}
-base::Optional<int> ColorPickerView::GetSelectedElement() const {
+absl::optional<int> ColorPickerView::GetSelectedElement() const {
for (size_t i = 0; i < elements_.size(); ++i) {
if (elements_[i]->GetSelected())
return static_cast<int>(i);
}
- return base::nullopt;
+ return absl::nullopt;
}
views::View* ColorPickerView::GetSelectedViewForGroup(int group) {
@@ -289,5 +289,5 @@
}
BEGIN_METADATA(ColorPickerView, views::View)
-ADD_READONLY_PROPERTY_METADATA(base::Optional<int>, SelectedElement)
+ADD_READONLY_PROPERTY_METADATA(absl::optional<int>, SelectedElement)
END_METADATA
diff --git a/chrome/browser/ui/views/tabs/color_picker_view.h b/chrome/browser/ui/views/tabs/color_picker_view.h
index 4c1dd2b..075db36 100644
--- a/chrome/browser/ui/views/tabs/color_picker_view.h
+++ b/chrome/browser/ui/views/tabs/color_picker_view.h
@@ -10,9 +10,9 @@
#include "base/callback.h"
#include "base/containers/span.h"
-#include "base/optional.h"
#include "chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.h"
#include "components/tab_groups/tab_group_color.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/view.h"
@@ -44,7 +44,7 @@
// Returns the index of the selected element, if any.
// After the callback is called, this is guaranteed to never return nullopt.
- base::Optional<int> GetSelectedElement() const;
+ absl::optional<int> GetSelectedElement() const;
// views::View:
views::View* GetSelectedViewForGroup(int group) override;
diff --git a/chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.cc
index 8f522dd8c..c25d65f 100644
--- a/chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.cc
@@ -23,7 +23,7 @@
void FakeBaseTabStripController::AddTab(int index, bool is_active) {
num_tabs_++;
- tab_groups_.insert(tab_groups_.begin() + index, base::nullopt);
+ tab_groups_.insert(tab_groups_.begin() + index, absl::nullopt);
tab_strip_->AddTabAt(index, TabRendererData(), is_active);
if (is_active) {
@@ -35,7 +35,7 @@
void FakeBaseTabStripController::AddPinnedTab(int index, bool is_active) {
num_tabs_++;
- tab_groups_.insert(tab_groups_.begin() + index, base::nullopt);
+ tab_groups_.insert(tab_groups_.begin() + index, absl::nullopt);
TabRendererData data;
data.pinned = true;
@@ -45,7 +45,7 @@
}
void FakeBaseTabStripController::MoveTab(int from_index, int to_index) {
- base::Optional<tab_groups::TabGroupId> prev_group = tab_groups_[from_index];
+ absl::optional<tab_groups::TabGroupId> prev_group = tab_groups_[from_index];
tab_groups_.erase(tab_groups_.begin() + from_index);
tab_groups_.insert(tab_groups_.begin() + to_index, prev_group);
tab_strip_->MoveTab(from_index, to_index, TabRendererData());
@@ -112,19 +112,19 @@
}
void FakeBaseTabStripController::RemoveTabFromGroup(int model_index) {
- MoveTabIntoGroup(model_index, base::nullopt);
+ MoveTabIntoGroup(model_index, absl::nullopt);
}
void FakeBaseTabStripController::MoveTabIntoGroup(
int index,
- base::Optional<tab_groups::TabGroupId> new_group) {
+ absl::optional<tab_groups::TabGroupId> new_group) {
bool group_exists = base::Contains(tab_groups_, new_group);
- base::Optional<tab_groups::TabGroupId> old_group = tab_groups_[index];
+ absl::optional<tab_groups::TabGroupId> old_group = tab_groups_[index];
tab_groups_[index] = new_group;
if (old_group.has_value()) {
- tab_strip_->AddTabToGroup(base::nullopt, index);
+ tab_strip_->AddTabToGroup(absl::nullopt, index);
if (!base::Contains(tab_groups_, old_group))
tab_strip_->OnGroupClosed(old_group.value());
else
@@ -138,24 +138,24 @@
}
}
-base::Optional<int> FakeBaseTabStripController::GetFirstTabInGroup(
+absl::optional<int> FakeBaseTabStripController::GetFirstTabInGroup(
const tab_groups::TabGroupId& group) const {
for (size_t i = 0; i < tab_groups_.size(); ++i) {
if (tab_groups_[i] == group)
return i;
}
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<int> FakeBaseTabStripController::GetLastTabInGroup(
+absl::optional<int> FakeBaseTabStripController::GetLastTabInGroup(
const tab_groups::TabGroupId& group) const {
for (size_t i = tab_groups_.size(); i > 0; --i) {
if (tab_groups_[i - 1] == group)
return i - 1;
}
- return base::nullopt;
+ return absl::nullopt;
}
gfx::Range FakeBaseTabStripController::ListTabsInGroup(
@@ -264,7 +264,7 @@
void FakeBaseTabStripController::OnStoppedDragging() {}
void FakeBaseTabStripController::OnKeyboardFocusedTabChanged(
- base::Optional<int> index) {}
+ absl::optional<int> index) {}
bool FakeBaseTabStripController::IsFrameCondensed() const {
return false;
@@ -295,9 +295,9 @@
return gfx::kPlaceholderColor;
}
-base::Optional<int> FakeBaseTabStripController::GetCustomBackgroundId(
+absl::optional<int> FakeBaseTabStripController::GetCustomBackgroundId(
BrowserFrameActiveState active_state) const {
- return base::nullopt;
+ return absl::nullopt;
}
std::u16string FakeBaseTabStripController::GetAccessibleTabName(
diff --git a/chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h b/chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h
index 49a3f478..56bf735 100644
--- a/chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h
+++ b/chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h
@@ -9,11 +9,11 @@
#include <vector>
#include "base/compiler_specific.h"
-#include "base/optional.h"
#include "chrome/browser/ui/views/tabs/tab_strip_controller.h"
#include "chrome/browser/ui/views/tabs/tab_strip_types.h"
#include "components/tab_groups/tab_group_id.h"
#include "components/tab_groups/tab_group_visual_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/models/list_selection_model.h"
class FakeBaseTabStripController : public TabStripController {
@@ -29,7 +29,7 @@
void RemoveTab(int index);
void MoveTabIntoGroup(int index,
- base::Optional<tab_groups::TabGroupId> new_group);
+ absl::optional<tab_groups::TabGroupId> new_group);
ui::ListSelectionModel* selection_model() { return &selection_model_; }
@@ -64,7 +64,7 @@
void StackedLayoutMaybeChanged() override;
void OnStartedDragging(bool dragging_window) override;
void OnStoppedDragging() override;
- void OnKeyboardFocusedTabChanged(base::Optional<int> index) override;
+ void OnKeyboardFocusedTabChanged(absl::optional<int> index) override;
std::u16string GetGroupTitle(
const tab_groups::TabGroupId& group_id) const override;
std::u16string GetGroupContentString(
@@ -75,9 +75,9 @@
void SetVisualDataForGroup(
const tab_groups::TabGroupId& group,
const tab_groups::TabGroupVisualData& visual_data) override;
- base::Optional<int> GetFirstTabInGroup(
+ absl::optional<int> GetFirstTabInGroup(
const tab_groups::TabGroupId& group) const override;
- base::Optional<int> GetLastTabInGroup(
+ absl::optional<int> GetLastTabInGroup(
const tab_groups::TabGroupId& group) const override;
gfx::Range ListTabsInGroup(
const tab_groups::TabGroupId& group) const override;
@@ -91,7 +91,7 @@
bool CanDrawStrokes() const override;
SkColor GetFrameColor(BrowserFrameActiveState active_state) const override;
SkColor GetToolbarTopSeparatorColor() const override;
- base::Optional<int> GetCustomBackgroundId(
+ absl::optional<int> GetCustomBackgroundId(
BrowserFrameActiveState active_state) const override;
std::u16string GetAccessibleTabName(const Tab* tab) const override;
Profile* GetProfile() const override;
@@ -106,7 +106,7 @@
int active_index_ = -1;
tab_groups::TabGroupVisualData fake_group_data_;
- std::vector<base::Optional<tab_groups::TabGroupId>> tab_groups_;
+ std::vector<absl::optional<tab_groups::TabGroupId>> tab_groups_;
ui::ListSelectionModel selection_model_;
};
diff --git a/chrome/browser/ui/views/tabs/new_tab_button.cc b/chrome/browser/ui/views/tabs/new_tab_button.cc
index 5bc9e0b..dcd5d279 100644
--- a/chrome/browser/ui/views/tabs/new_tab_button.cc
+++ b/chrome/browser/ui/views/tabs/new_tab_button.cc
@@ -181,7 +181,7 @@
flags.setAntiAlias(true);
const float scale = canvas->image_scale();
- const base::Optional<int> bg_id =
+ const absl::optional<int> bg_id =
tab_strip_->GetCustomBackgroundId(BrowserFrameActiveState::kUseCurrent);
if (bg_id.has_value()) {
float x_scale = scale;
diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc
index 2fbb322..ddbbf57 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -733,9 +733,9 @@
}
}
-base::Optional<SkColor> Tab::GetGroupColor() const {
+absl::optional<SkColor> Tab::GetGroupColor() const {
if (closing_ || !group().has_value())
- return base::nullopt;
+ return absl::nullopt;
return controller_->GetPaintedGroupColor(
controller_->GetGroupColorId(group().value()));
@@ -881,7 +881,7 @@
// static
std::u16string Tab::GetTooltipText(const std::u16string& title,
- base::Optional<TabAlertState> alert_state) {
+ absl::optional<TabAlertState> alert_state) {
if (!alert_state)
return title;
@@ -893,10 +893,10 @@
}
// static
-base::Optional<TabAlertState> Tab::GetAlertStateToShow(
+absl::optional<TabAlertState> Tab::GetAlertStateToShow(
const std::vector<TabAlertState>& alert_states) {
if (alert_states.empty())
- return base::nullopt;
+ return absl::nullopt;
return alert_states[0];
}
diff --git a/chrome/browser/ui/views/tabs/tab.h b/chrome/browser/ui/views/tabs/tab.h
index 70c0dbdc..a80a401 100644
--- a/chrome/browser/ui/views/tabs/tab.h
+++ b/chrome/browser/ui/views/tabs/tab.h
@@ -11,11 +11,11 @@
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "chrome/browser/ui/tabs/tab_renderer_data.h"
#include "chrome/browser/ui/views/tabs/tab_slot_view.h"
#include "components/performance_manager/public/freezing/freezing.h"
#include "components/tab_groups/tab_group_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/layout.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/gfx/animation/animation_delegate.h"
@@ -109,7 +109,7 @@
bool closing() const { return closing_; }
// Returns the color for the tab's group, if any.
- base::Optional<SkColor> GetGroupColor() const;
+ absl::optional<SkColor> GetGroupColor() const;
// Returns the color used for the alert indicator icon.
SkColor GetAlertIndicatorColor(TabAlertState state) const;
@@ -171,10 +171,10 @@
// Exposed publicly for tests.
static std::u16string GetTooltipText(
const std::u16string& title,
- base::Optional<TabAlertState> alert_state);
+ absl::optional<TabAlertState> alert_state);
// Returns an alert state to be shown among given alert states.
- static base::Optional<TabAlertState> GetAlertStateToShow(
+ static absl::optional<TabAlertState> GetAlertStateToShow(
const std::vector<TabAlertState>& alert_states);
bool showing_close_button_for_testing() const {
diff --git a/chrome/browser/ui/views/tabs/tab_controller.h b/chrome/browser/ui/views/tabs/tab_controller.h
index 267becf8..9829eb4 100644
--- a/chrome/browser/ui/views/tabs/tab_controller.h
+++ b/chrome/browser/ui/views/tabs/tab_controller.h
@@ -7,9 +7,9 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/ui/tabs/tab_types.h"
#include "chrome/browser/ui/views/tabs/tab_strip_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/ui_base_types.h"
@@ -186,7 +186,7 @@
// Returns the background tab image resource ID if the image has been
// customized, directly or indirectly, by the theme.
- virtual base::Optional<int> GetCustomBackgroundId(
+ virtual absl::optional<int> GetCustomBackgroundId(
BrowserFrameActiveState active_state) const = 0;
// If the given tab is animating to its target destination, this returns the
diff --git a/chrome/browser/ui/views/tabs/tab_drag_context.h b/chrome/browser/ui/views/tabs/tab_drag_context.h
index 328df22..be57fc9 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_context.h
+++ b/chrome/browser/ui/views/tabs/tab_drag_context.h
@@ -9,7 +9,7 @@
#include <vector>
#include "base/compiler_specific.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/models/list_selection_model.h"
#include "ui/gfx/geometry/rect.h"
@@ -43,7 +43,7 @@
// Returns the index of the active tab in touch mode, or no value if not in
// touch mode.
- virtual base::Optional<int> GetActiveTouchIndex() const = 0;
+ virtual absl::optional<int> GetActiveTouchIndex() const = 0;
// Returns the tab drag controller owned by this delegate, or null if none.
virtual TabDragController* GetDragController() = 0;
@@ -102,7 +102,7 @@
int num_dragged_tabs,
bool mouse_has_ever_moved_left,
bool mouse_has_ever_moved_right,
- base::Optional<tab_groups::TabGroupId> group) const = 0;
+ absl::optional<tab_groups::TabGroupId> group) const = 0;
// Returns true if |dragged_bounds| is close enough to the next stacked tab
// so that the active tab should be dragged there.
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
index 445214e..66eb538 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
@@ -670,7 +670,7 @@
drag_data->source_model_index);
drag_data->pinned = source_context_->IsTabPinned(static_cast<Tab*>(view));
}
- base::Optional<tab_groups::TabGroupId> tab_group_id = view->group();
+ absl::optional<tab_groups::TabGroupId> tab_group_id = view->group();
if (tab_group_id.has_value()) {
drag_data->tab_group_data = TabDragData::TabGroupData{
tab_group_id.value(), *source_context_->GetTabStripModel()
@@ -1095,7 +1095,7 @@
base::TimeDelta delay) {
DCHECK(attached_context_);
- base::Optional<int> touch_index = attached_context_->GetActiveTouchIndex();
+ absl::optional<int> touch_index = attached_context_->GetActiveTouchIndex();
if (!touch_index)
return;
@@ -1808,14 +1808,14 @@
source_model->UpdateGroupForDragRevert(
source_model->GetIndexOfWebContents(data->contents),
data->tab_group_data.has_value()
- ? base::Optional<tab_groups::TabGroupId>{data->tab_group_data.value()
+ ? absl::optional<tab_groups::TabGroupId>{data->tab_group_data.value()
.group_id}
- : base::nullopt,
+ : absl::nullopt,
data->tab_group_data.has_value()
- ? base::Optional<
+ ? absl::optional<
tab_groups::TabGroupVisualData>{data->tab_group_data.value()
.group_visual_data}
- : base::nullopt);
+ : absl::nullopt);
}
void TabDragController::CompleteDrag() {
@@ -2260,7 +2260,7 @@
if (selected_unpinned.empty())
return;
- const base::Optional<tab_groups::TabGroupId> updated_group =
+ const absl::optional<tab_groups::TabGroupId> updated_group =
GetTabGroupForTargetIndex(selected_unpinned);
if (updated_group == attached_model->GetTabGroupForTab(selected_unpinned[0]))
@@ -2270,7 +2270,7 @@
updated_group);
}
-base::Optional<tab_groups::TabGroupId>
+absl::optional<tab_groups::TabGroupId>
TabDragController::GetTabGroupForTargetIndex(const std::vector<int>& selected) {
// Indices in {selected} are always ordered in ascending order and should all
// be consecutive.
@@ -2279,11 +2279,11 @@
const int left_tab_index = selected.front() - 1;
- const base::Optional<tab_groups::TabGroupId> left_group =
+ const absl::optional<tab_groups::TabGroupId> left_group =
attached_model->GetTabGroupForTab(left_tab_index);
- const base::Optional<tab_groups::TabGroupId> right_group =
+ const absl::optional<tab_groups::TabGroupId> right_group =
attached_model->GetTabGroupForTab(selected.back() + 1);
- const base::Optional<tab_groups::TabGroupId> current_group =
+ const absl::optional<tab_groups::TabGroupId> current_group =
attached_model->GetTabGroupForTab(selected[0]);
if (left_group == right_group)
@@ -2337,7 +2337,7 @@
!attached_model->IsGroupCollapsed(right_group.value())) {
return right_group;
}
- return base::nullopt;
+ return absl::nullopt;
}
bool TabDragController::CanAttachTo(gfx::NativeWindow window) {
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.h b/chrome/browser/ui/views/tabs/tab_drag_controller.h
index 2766e1d..ef8d13d 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.h
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.h
@@ -133,7 +133,7 @@
// Returns the tab group being dragged, if any. Will only return a value if
// the user is dragging a tab group header, not an individual tab or tabs from
// a group.
- const base::Optional<tab_groups::TabGroupId>& group() const { return group_; }
+ const absl::optional<tab_groups::TabGroupId>& group() const { return group_; }
// Returns true if currently dragging a tab with |contents|.
bool IsDraggingTab(content::WebContents* contents);
@@ -259,7 +259,7 @@
// Stores the information of the group the tab is in, or nullopt if tab is
// not grouped.
- base::Optional<TabGroupData> tab_group_data;
+ absl::optional<TabGroupData> tab_group_data;
};
typedef std::vector<TabDragData> DragData;
@@ -549,10 +549,10 @@
void UpdateGroupForDraggedTabs();
// Helper method for TabDragController::UpdateGroupForDraggedTabs to decide if
- // a dragged tab should stay in the tab group. Returns base::nullopt if the
+ // a dragged tab should stay in the tab group. Returns absl::nullopt if the
// tab should not be in a group. Otherwise returns tab_groups::TabGroupId of
// the group the selected tabs should join.
- base::Optional<tab_groups::TabGroupId> GetTabGroupForTargetIndex(
+ absl::optional<tab_groups::TabGroupId> GetTabGroupForTargetIndex(
const std::vector<int>& selected);
EventSource event_source_;
@@ -635,7 +635,7 @@
// The group that is being dragged. Only set if the drag originated from a
// group header, indicating that the entire group is being dragged together.
- base::Optional<tab_groups::TabGroupId> group_;
+ absl::optional<tab_groups::TabGroupId> group_;
// True until MoveAttached() is first invoked.
bool initial_move_;
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
index 98671f0e..cf21a73 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
@@ -19,7 +19,6 @@
#include "base/dcheck_is_on.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
@@ -63,6 +62,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/aura/env.h"
#include "ui/base/test/ui_controls.h"
#include "ui/compositor/layer.h"
@@ -689,7 +689,7 @@
aura::Window* root_ = nullptr;
#endif
base::test::ScopedFeatureList scoped_feature_list_;
- base::Optional<web_app::AppId> tabbed_app_id_;
+ absl::optional<web_app::AppId> tabbed_app_id_;
};
// Creates a browser with four tabs. The first three belong in the same Tab
@@ -719,8 +719,8 @@
EXPECT_EQ("0 1 3 2", IDString(model));
EXPECT_EQ(model->group_model()->GetTabGroup(group)->ListTabs(),
gfx::Range(0, 2));
- EXPECT_EQ(base::nullopt, model->GetTabGroupForTab(2));
- EXPECT_EQ(base::nullopt, model->GetTabGroupForTab(3));
+ EXPECT_EQ(absl::nullopt, model->GetTabGroupForTab(2));
+ EXPECT_EQ(absl::nullopt, model->GetTabGroupForTab(3));
ASSERT_TRUE(PressInput(GetCenterInScreenCoordinates(tab_strip->tab_at(1))));
ASSERT_TRUE(DragInputTo(GetCenterInScreenCoordinates(tab_strip->tab_at(2))));
@@ -732,7 +732,7 @@
EXPECT_EQ("0 3 1 2", IDString(model));
EXPECT_EQ(model->group_model()->GetTabGroup(group)->ListTabs(),
gfx::Range(0, 1));
- EXPECT_EQ(base::nullopt, model->GetTabGroupForTab(1));
+ EXPECT_EQ(absl::nullopt, model->GetTabGroupForTab(1));
}
// Creates a browser with four tabs. The last three belong in the same Tab
@@ -763,8 +763,8 @@
EXPECT_EQ("1 0 2 3", IDString(model));
EXPECT_EQ(model->group_model()->GetTabGroup(group)->ListTabs(),
gfx::Range(2, 4));
- EXPECT_EQ(base::nullopt, model->GetTabGroupForTab(0));
- EXPECT_EQ(base::nullopt, model->GetTabGroupForTab(1));
+ EXPECT_EQ(absl::nullopt, model->GetTabGroupForTab(0));
+ EXPECT_EQ(absl::nullopt, model->GetTabGroupForTab(1));
ASSERT_TRUE(PressInput(GetCenterInScreenCoordinates(tab_strip->tab_at(2))));
ASSERT_TRUE(DragInputTo(GetCenterInScreenCoordinates(tab_strip->tab_at(1))));
@@ -776,7 +776,7 @@
EXPECT_EQ("1 2 0 3", IDString(model));
EXPECT_EQ(model->group_model()->GetTabGroup(group)->ListTabs(),
gfx::Range(3, 4));
- EXPECT_EQ(base::nullopt, model->GetTabGroupForTab(2));
+ EXPECT_EQ(absl::nullopt, model->GetTabGroupForTab(2));
}
// Creates a browser with four tabs. The first three belong in the same Tab
@@ -1145,8 +1145,8 @@
EXPECT_EQ("0 3 1 2", IDString(model));
EXPECT_EQ(group_model->GetTabGroup(group)->ListTabs(), gfx::Range(2, 4));
- EXPECT_EQ(base::nullopt, model->GetTabGroupForTab(0));
- EXPECT_EQ(base::nullopt, model->GetTabGroupForTab(1));
+ EXPECT_EQ(absl::nullopt, model->GetTabGroupForTab(0));
+ EXPECT_EQ(absl::nullopt, model->GetTabGroupForTab(1));
// Drag the entire group left by its header.
ASSERT_TRUE(
@@ -1157,8 +1157,8 @@
EXPECT_EQ("1 2 0 3", IDString(model));
EXPECT_EQ(group_model->GetTabGroup(group)->ListTabs(), gfx::Range(0, 2));
- EXPECT_EQ(base::nullopt, model->GetTabGroupForTab(2));
- EXPECT_EQ(base::nullopt, model->GetTabGroupForTab(3));
+ EXPECT_EQ(absl::nullopt, model->GetTabGroupForTab(2));
+ EXPECT_EQ(absl::nullopt, model->GetTabGroupForTab(3));
}
// Creates a browser with four tabs. The first two belong in Tab Group 1, and
@@ -1275,7 +1275,7 @@
EXPECT_EQ("0 1 2 3", IDString(model));
EXPECT_EQ(model->group_model()->GetTabGroup(group)->ListTabs(),
gfx::Range(1, 4));
- EXPECT_EQ(base::nullopt, model->GetTabGroupForTab(0));
+ EXPECT_EQ(absl::nullopt, model->GetTabGroupForTab(0));
}
// Drags a tab within the window (without dragging the whole window) then
diff --git a/chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.cc b/chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.cc
index 934174e..3c98a7c 100644
--- a/chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.cc
+++ b/chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.cc
@@ -17,7 +17,6 @@
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/chrome_pages.h"
@@ -35,6 +34,7 @@
#include "components/tab_groups/tab_group_color.h"
#include "components/tab_groups/tab_group_id.h"
#include "components/tab_groups/tab_group_visual_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
@@ -58,7 +58,7 @@
const Browser* browser,
const tab_groups::TabGroupId& group,
TabGroupHeader* header_view,
- base::Optional<gfx::Rect> anchor_rect,
+ absl::optional<gfx::Rect> anchor_rect,
views::View* anchor_view,
bool stop_context_menu_propagation) {
// If |header_view| is not null, use |header_view| as the |anchor_view|.
@@ -96,7 +96,7 @@
const Browser* browser,
const tab_groups::TabGroupId& group,
views::View* anchor_view,
- base::Optional<gfx::Rect> anchor_rect,
+ absl::optional<gfx::Rect> anchor_rect,
TabGroupHeader* header_view,
bool stop_context_menu_propagation)
: browser_(browser),
@@ -270,7 +270,7 @@
}
void TabGroupEditorBubbleView::UpdateGroup() {
- base::Optional<int> selected_element = color_selector_->GetSelectedElement();
+ absl::optional<int> selected_element = color_selector_->GetSelectedElement();
TabGroup* tab_group =
browser_->tab_strip_model()->group_model()->GetTabGroup(group_);
diff --git a/chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.h b/chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.h
index 704d40d..eeb8012 100644
--- a/chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.h
+++ b/chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.h
@@ -7,9 +7,9 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/ui/views/tabs/tab_group_header.h"
#include "components/tab_groups/tab_group_color.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/controls/textfield/textfield.h"
@@ -45,7 +45,7 @@
const Browser* browser,
const tab_groups::TabGroupId& group,
TabGroupHeader* header_view,
- base::Optional<gfx::Rect> anchor_rect = base::nullopt,
+ absl::optional<gfx::Rect> anchor_rect = absl::nullopt,
// If not provided, will be set to |header_view|.
views::View* anchor_view = nullptr,
bool stop_context_menu_propagation = false);
@@ -58,7 +58,7 @@
TabGroupEditorBubbleView(const Browser* browser,
const tab_groups::TabGroupId& group,
views::View* anchor_view,
- base::Optional<gfx::Rect> anchor_rect,
+ absl::optional<gfx::Rect> anchor_rect,
TabGroupHeader* header_view,
bool stop_context_menu_propagation);
~TabGroupEditorBubbleView() override;
diff --git a/chrome/browser/ui/views/tabs/tab_group_header.cc b/chrome/browser/ui/views/tabs/tab_group_header.cc
index 855cad4..a6133dd 100644
--- a/chrome/browser/ui/views/tabs/tab_group_header.cc
+++ b/chrome/browser/ui/views/tabs/tab_group_header.cc
@@ -330,7 +330,7 @@
editor_bubble_tracker_.Opened(TabGroupEditorBubbleView::Show(
tab_strip_->controller()->GetBrowser(), group().value(), this,
- base::nullopt, nullptr, kStopContextMenuPropagation));
+ absl::nullopt, nullptr, kStopContextMenuPropagation));
}
bool TabGroupHeader::DoesIntersectRect(const views::View* target,
diff --git a/chrome/browser/ui/views/tabs/tab_group_views.cc b/chrome/browser/ui/views/tabs/tab_group_views.cc
index 96d7f9f..ac4683b 100644
--- a/chrome/browser/ui/views/tabs/tab_group_views.cc
+++ b/chrome/browser/ui/views/tabs/tab_group_views.cc
@@ -67,7 +67,7 @@
}
const Tab* TabGroupViews::GetLastTabInGroup() const {
- const base::Optional<int> last_tab =
+ const absl::optional<int> last_tab =
tab_strip_->controller()->GetLastTabInGroup(group_);
return last_tab.has_value() ? tab_strip_->tab_at(last_tab.value()) : nullptr;
}
diff --git a/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc b/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc
index 66300591..b67d76bb 100644
--- a/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc
+++ b/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc
@@ -286,7 +286,7 @@
preview_image_->SetVisible(!tab->IsActive());
std::u16string title;
- base::Optional<TabAlertState> old_alert_state = alert_state_;
+ absl::optional<TabAlertState> old_alert_state = alert_state_;
GURL domain_url;
// Use committed URL to determine if no page has yet loaded, since the title
// can be blank for some web pages.
@@ -295,7 +295,7 @@
title = tab->data().IsCrashed()
? l10n_util::GetStringUTF16(IDS_HOVER_CARD_CRASHED_TITLE)
: l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE);
- alert_state_ = base::nullopt;
+ alert_state_ = absl::nullopt;
} else {
domain_url = tab->data().last_committed_url;
title = tab->data().title;
diff --git a/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.h b/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.h
index 6a5f1d7..031fbda6 100644
--- a/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.h
+++ b/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.h
@@ -14,7 +14,7 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/public/cpp/metrics_util.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#endif
namespace gfx {
@@ -59,7 +59,7 @@
views::Label* title_label_ = nullptr;
FadeLabel* title_fade_label_ = nullptr;
- base::Optional<TabAlertState> alert_state_;
+ absl::optional<TabAlertState> alert_state_;
views::Label* domain_label_ = nullptr;
FadeLabel* domain_fade_label_ = nullptr;
views::ImageView* preview_image_ = nullptr;
diff --git a/chrome/browser/ui/views/tabs/tab_hover_card_metrics.h b/chrome/browser/ui/views/tabs/tab_hover_card_metrics.h
index 2e6b7f7..90958b5 100644
--- a/chrome/browser/ui/views/tabs/tab_hover_card_metrics.h
+++ b/chrome/browser/ui/views/tabs/tab_hover_card_metrics.h
@@ -10,7 +10,7 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/public/cpp/metrics_util.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/compositor/throughput_tracker.h"
#endif
@@ -114,7 +114,7 @@
TabHandle times_for_last_tab_ = TabHandle();
#if BUILDFLAG(IS_CHROMEOS_ASH)
- base::Optional<ui::ThroughputTracker> throughput_tracker_;
+ absl::optional<ui::ThroughputTracker> throughput_tracker_;
#endif
// TOOD(dfried): in future, change this to a delegate object in order to be
diff --git a/chrome/browser/ui/views/tabs/tab_search_button.h b/chrome/browser/ui/views/tabs/tab_search_button.h
index 818ab99c..8b09d5d 100644
--- a/chrome/browser/ui/views/tabs/tab_search_button.h
+++ b/chrome/browser/ui/views/tabs/tab_search_button.h
@@ -57,7 +57,7 @@
WebUIBubbleManager* webui_bubble_manager_for_testing() {
return &webui_bubble_manager_;
}
- const base::Optional<base::TimeTicks>& bubble_created_time_for_testing()
+ const absl::optional<base::TimeTicks>& bubble_created_time_for_testing()
const {
return bubble_created_time_;
}
@@ -74,7 +74,7 @@
views::WidgetOpenTimer widget_open_timer_;
// Timestamp for when the current bubble was created.
- base::Optional<base::TimeTicks> bubble_created_time_;
+ absl::optional<base::TimeTicks> bubble_created_time_;
views::MenuButtonController* menu_button_controller_ = nullptr;
diff --git a/chrome/browser/ui/views/tabs/tab_slot_view.h b/chrome/browser/ui/views/tabs/tab_slot_view.h
index 48acfbba..a509d80 100644
--- a/chrome/browser/ui/views/tabs/tab_slot_view.h
+++ b/chrome/browser/ui/views/tabs/tab_slot_view.h
@@ -32,10 +32,10 @@
virtual TabSizeInfo GetTabSizeInfo() const = 0;
// Used to set the tab group that this view belongs to.
- void set_group(base::Optional<tab_groups::TabGroupId> group) {
+ void set_group(absl::optional<tab_groups::TabGroupId> group) {
group_ = group;
}
- base::Optional<tab_groups::TabGroupId> group() const { return group_; }
+ absl::optional<tab_groups::TabGroupId> group() const { return group_; }
// Used to mark the view as having been detached. Once this has happened, the
// view should be invisibly closed. This is irreversible.
@@ -53,7 +53,7 @@
gfx::Rect GetAnchorBoundsInScreen() const override;
private:
- base::Optional<tab_groups::TabGroupId> group_;
+ absl::optional<tab_groups::TabGroupId> group_;
// True if the view has been detached.
bool detached_ = false;
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 1aa4eb27..4def0e2 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -504,9 +504,9 @@
->model();
}
- base::Optional<int> GetActiveTouchIndex() const override {
+ absl::optional<int> GetActiveTouchIndex() const override {
if (!tab_strip_->touch_layout_)
- return base::nullopt;
+ return absl::nullopt;
return tab_strip_->touch_layout_->active_index();
}
@@ -594,13 +594,13 @@
int num_dragged_tabs,
bool mouse_has_ever_moved_left,
bool mouse_has_ever_moved_right,
- base::Optional<tab_groups::TabGroupId> group) const override {
+ absl::optional<tab_groups::TabGroupId> group) const override {
// If the strip has no tabs, the only position to insert at is 0.
if (!GetTabCount())
return 0;
- base::Optional<int> index;
- base::Optional<int> touch_index = GetActiveTouchIndex();
+ absl::optional<int> index;
+ absl::optional<int> touch_index = GetActiveTouchIndex();
if (touch_index) {
index = GetInsertionIndexForDraggedBoundsStacked(
dragged_bounds, mouse_has_ever_moved_left,
@@ -839,7 +839,7 @@
const gfx::Rect& dragged_bounds,
int first_dragged_tab_index,
int num_dragged_tabs,
- base::Optional<tab_groups::TabGroupId> dragged_group) const {
+ absl::optional<tab_groups::TabGroupId> dragged_group) const {
// This method assumes that the dragged tabs and group are already in the
// tabstrip (i.e. it doesn't support attaching a drag to a new tabstrip).
// This assumption is critical because it means that tab width won't change
@@ -904,7 +904,7 @@
int candidate_index,
int first_dragged_tab_index,
int num_dragged_tabs,
- base::Optional<tab_groups::TabGroupId> dragged_group) const {
+ absl::optional<tab_groups::TabGroupId> dragged_group) const {
if (candidate_index == 0)
return true;
@@ -917,12 +917,12 @@
}
// This might be in the middle of a group, which may or may not be fine.
- base::Optional<tab_groups::TabGroupId> left_group =
+ absl::optional<tab_groups::TabGroupId> left_group =
GetTabAt(candidate_index - 1)->group();
- base::Optional<tab_groups::TabGroupId> right_group =
+ absl::optional<tab_groups::TabGroupId> right_group =
tab_strip_->IsValidModelIndex(candidate_index)
? GetTabAt(candidate_index)->group()
- : base::nullopt;
+ : absl::nullopt;
if (left_group.has_value() && left_group == right_group) {
// Can't drag a group into another group.
if (dragged_group.has_value())
@@ -965,18 +965,18 @@
// added to that group, thereby moving them to that header's right.
int CalculateIdealXAdjustmentIfAddedToGroup(
int candidate_index,
- base::Optional<tab_groups::TabGroupId> dragged_group) const {
+ absl::optional<tab_groups::TabGroupId> dragged_group) const {
// If the tab to the right of |candidate_index| is the first tab in a
// (non-collapsed) group, we are sharing this model index with a group
// header. We might end up on either side of it, so we need to check
// both positions.
if (!dragged_group.has_value() &&
tab_strip_->IsValidModelIndex(candidate_index)) {
- base::Optional<tab_groups::TabGroupId> left_group =
+ absl::optional<tab_groups::TabGroupId> left_group =
tab_strip_->IsValidModelIndex(candidate_index - 1)
? GetTabAt(candidate_index - 1)->group()
- : base::nullopt;
- base::Optional<tab_groups::TabGroupId> right_group =
+ : absl::nullopt;
+ absl::optional<tab_groups::TabGroupId> right_group =
GetTabAt(candidate_index)->group();
if (right_group.has_value() && left_group != right_group) {
if (tab_strip_->controller()->IsGroupCollapsed(right_group.value()))
@@ -992,14 +992,14 @@
}
// Used by GetInsertionIndexForDraggedBounds() when the tabstrip is stacked.
- base::Optional<int> GetInsertionIndexForDraggedBoundsStacked(
+ absl::optional<int> GetInsertionIndexForDraggedBoundsStacked(
const gfx::Rect& dragged_bounds,
bool mouse_has_ever_moved_left,
bool mouse_has_ever_moved_right) const {
int active_index = *GetActiveTouchIndex();
// Search from the active index to the front of the tabstrip. Do this as
// tabs overlap each other from the active index.
- base::Optional<int> index =
+ absl::optional<int> index =
GetInsertionIndexFromReversedStacked(dragged_bounds, active_index);
if (index != active_index)
return index;
@@ -1029,20 +1029,20 @@
// Determines the index to insert tabs at. |dragged_bounds| is the bounds of
// the tab being dragged and |start| is the index of the tab to start looking
// from. The search proceeds to the end of the strip.
- base::Optional<int> GetInsertionIndexFromStacked(
+ absl::optional<int> GetInsertionIndexFromStacked(
const gfx::Rect& dragged_bounds,
int start) const {
const int last_tab = GetTabCount() - 1;
if (start < 0 || start > last_tab)
- return base::nullopt;
+ return absl::nullopt;
const int dragged_x = GetDraggedX(dragged_bounds);
if (dragged_x < ideal_bounds(start).x() ||
dragged_x > ideal_bounds(last_tab).right()) {
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<int> insertion_index;
+ absl::optional<int> insertion_index;
for (int i = start; i <= last_tab; ++i) {
const gfx::Rect current_bounds = ideal_bounds(i);
int current_center = current_bounds.CenterPoint().x();
@@ -1066,14 +1066,14 @@
// Like GetInsertionIndexFrom(), but searches backwards from |start| to the
// beginning of the strip.
- base::Optional<int> GetInsertionIndexFromReversedStacked(
+ absl::optional<int> GetInsertionIndexFromReversedStacked(
const gfx::Rect& dragged_bounds,
int start) const {
const int dragged_x = GetDraggedX(dragged_bounds);
if (start < 0 || start >= GetTabCount() ||
dragged_x >= ideal_bounds(start).right() ||
dragged_x < ideal_bounds(0).x())
- return base::nullopt;
+ return absl::nullopt;
for (int i = start; i >= 0; --i) {
if (dragged_x >= ideal_bounds(i).CenterPoint().x())
@@ -1237,7 +1237,7 @@
return tab_at(tab_index)->data().network_state == TabNetworkState::kError;
}
-base::Optional<TabAlertState> TabStrip::GetTabAlertState(int tab_index) const {
+absl::optional<TabAlertState> TabStrip::GetTabAlertState(int tab_index) const {
return Tab::GetAlertStateToShow(tab_at(tab_index)->data().alert_state);
}
@@ -1269,7 +1269,7 @@
Tab* tab = new Tab(this);
tab->set_context_menu_controller(&context_menu_controller_);
tab->AddObserver(this);
- AddChildViewAt(tab, GetViewInsertionIndex(tab, base::nullopt, model_index));
+ AddChildViewAt(tab, GetViewInsertionIndex(tab, absl::nullopt, model_index));
const bool pinned = data.pinned;
tabs_.Add(tab, model_index);
selected_tabs_.IncrementFrom(model_index);
@@ -1460,7 +1460,7 @@
SwapLayoutIfNecessary();
}
-void TabStrip::AddTabToGroup(base::Optional<tab_groups::TabGroupId> group,
+void TabStrip::AddTabToGroup(absl::optional<tab_groups::TabGroupId> group,
int model_index) {
tab_at(model_index)->set_group(group);
@@ -1839,12 +1839,12 @@
CompleteAnimationAndLayout();
}
-base::Optional<int> TabStrip::GetFocusedTabIndex() const {
+absl::optional<int> TabStrip::GetFocusedTabIndex() const {
for (int i = 0; i < tabs_.view_size(); ++i) {
if (tabs_.view_at(i)->HasFocus())
return i;
}
- return base::nullopt;
+ return absl::nullopt;
}
views::View* TabStrip::GetTabViewForPromoAnchor(int index_hint) {
@@ -2249,15 +2249,15 @@
: std::u16string();
}
-base::Optional<int> TabStrip::GetCustomBackgroundId(
+absl::optional<int> TabStrip::GetCustomBackgroundId(
BrowserFrameActiveState active_state) const {
if (!TitlebarBackgroundIsTransparent())
return controller_->GetCustomBackgroundId(active_state);
constexpr int kBackgroundIdGlass = IDR_THEME_TAB_BACKGROUND_V;
return GetThemeProvider()->HasCustomImage(kBackgroundIdGlass)
- ? base::make_optional(kBackgroundIdGlass)
- : base::nullopt;
+ ? absl::make_optional(kBackgroundIdGlass)
+ : absl::nullopt;
}
gfx::Rect TabStrip::GetTabAnimationTargetBounds(const Tab* tab) {
@@ -2400,8 +2400,8 @@
// Keep track of the dragging group if dragging by the group header, or
// the current group if just dragging tabs into a group. At most one of these
// will have a value, since a drag is either a group drag or a tab drag.
- base::Optional<tab_groups::TabGroupId> dragging_group = base::nullopt;
- base::Optional<tab_groups::TabGroupId> current_group = base::nullopt;
+ absl::optional<tab_groups::TabGroupId> dragging_group = absl::nullopt;
+ absl::optional<tab_groups::TabGroupId> current_group = absl::nullopt;
// Paint group headers and underlines.
for (const auto& group_view_pair : group_views_) {
@@ -2589,7 +2589,7 @@
}
void TabStrip::HandleDragUpdate(
- const base::Optional<BrowserRootView::DropIndex>& index) {
+ const absl::optional<BrowserRootView::DropIndex>& index) {
SetDropArrow(index);
}
@@ -2898,15 +2898,15 @@
void TabStrip::SetTabSlotVisibility() {
bool last_tab_visible = false;
- base::Optional<tab_groups::TabGroupId> last_tab_group = base::nullopt;
+ absl::optional<tab_groups::TabGroupId> last_tab_group = absl::nullopt;
std::vector<Tab*> tabs = layout_helper_->GetTabs();
for (std::vector<Tab*>::reverse_iterator tab = tabs.rbegin();
tab != tabs.rend(); ++tab) {
- base::Optional<tab_groups::TabGroupId> current_group = (*tab)->group();
+ absl::optional<tab_groups::TabGroupId> current_group = (*tab)->group();
if (current_group != last_tab_group && last_tab_group.has_value())
group_header(last_tab_group.value())->SetVisible(last_tab_visible);
last_tab_visible = ShouldTabBeVisible(*tab);
- last_tab_group = (*tab)->closing() ? base::nullopt : current_group;
+ last_tab_group = (*tab)->closing() ? absl::nullopt : current_group;
// Collapsed tabs disappear once they've reached their minimum size. This
// is different than very small non-collapsed tabs, because in that case
@@ -2951,7 +2951,7 @@
}
int TabStrip::GetViewInsertionIndex(Tab* tab,
- base::Optional<int> from_model_index,
+ absl::optional<int> from_model_index,
int to_model_index) const {
// -1 is treated a sentinel value to indicate a tab is newly added to the
// beginning of the tab strip.
@@ -3229,7 +3229,7 @@
// If the tab is at a group boundary and the group is expanded, instead of
// actually moving the tab just change its group membership.
- base::Optional<tab_groups::TabGroupId> target_group =
+ absl::optional<tab_groups::TabGroupId> target_group =
tab_at(target_index)->group();
if (old_group != target_group) {
if (old_group.has_value()) {
@@ -3282,7 +3282,7 @@
return;
// Avoid moving into the middle of another group by accounting for its size.
- base::Optional<tab_groups::TabGroupId> target_group =
+ absl::optional<tab_groups::TabGroupId> target_group =
tab_at(target_index)->group();
if (target_group.has_value()) {
target_index +=
@@ -3420,7 +3420,7 @@
}
void TabStrip::SetDropArrow(
- const base::Optional<BrowserRootView::DropIndex>& index) {
+ const absl::optional<BrowserRootView::DropIndex>& index) {
if (!index) {
controller_->OnDropIndexUpdate(-1, false);
drop_arrow_.reset();
@@ -3857,7 +3857,7 @@
}
void TabStrip::OnViewBlurred(views::View* observed_view) {
- controller_->OnKeyboardFocusedTabChanged(base::nullopt);
+ controller_->OnKeyboardFocusedTabChanged(absl::nullopt);
}
void TabStrip::OnTouchUiChanged() {
@@ -3897,7 +3897,7 @@
ADD_READONLY_PROPERTY_METADATA(int, TabCount)
ADD_READONLY_PROPERTY_METADATA(int, ModelCount)
ADD_READONLY_PROPERTY_METADATA(int, PinnedTabCount)
-ADD_READONLY_PROPERTY_METADATA(base::Optional<int>, FocusedTabIndex)
+ADD_READONLY_PROPERTY_METADATA(absl::optional<int>, FocusedTabIndex)
ADD_READONLY_PROPERTY_METADATA(int, StrokeThickness)
ADD_READONLY_PROPERTY_METADATA(SkColor,
ToolbarTopSeparatorColor,
diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h
index 8049075..afc1700 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.h
+++ b/chrome/browser/ui/views/tabs/tab_strip.h
@@ -14,7 +14,6 @@
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
@@ -28,6 +27,7 @@
#include "chrome/browser/ui/views/tabs/tab_group_header.h"
#include "chrome/browser/ui/views/tabs/tab_group_views.h"
#include "components/tab_groups/tab_group_visual_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/pointer/touch_ui_controller.h"
#include "ui/gfx/color_palette.h"
@@ -128,7 +128,7 @@
// Returns information about tabs at given indices.
bool IsTabCrashed(int tab_index) const;
bool TabHasNetworkError(int tab_index) const;
- base::Optional<TabAlertState> GetTabAlertState(int tab_index) const;
+ absl::optional<TabAlertState> GetTabAlertState(int tab_index) const;
// Updates the loading animations displayed by tabs in the tabstrip to the
// next frame. The |elapsed_time| parameter is shared between tabs and used to
@@ -168,7 +168,7 @@
void SetTabData(int model_index, TabRendererData data);
// Sets the tab group at the specified model index.
- void AddTabToGroup(base::Optional<tab_groups::TabGroupId> group,
+ void AddTabToGroup(absl::optional<tab_groups::TabGroupId> group,
int model_index);
// Creates the views associated with a newly-created tab group.
@@ -270,7 +270,7 @@
void StopAnimating(bool layout);
// Returns the index of the focused tab, if any.
- base::Optional<int> GetFocusedTabIndex() const;
+ absl::optional<int> GetFocusedTabIndex() const;
// Returns a view for anchoring an in-product help promo. |index_hint|
// indicates at which tab the promo should be displayed, but is not
@@ -327,7 +327,7 @@
SkColor GetTabForegroundColor(TabActive active,
SkColor background_color) const override;
std::u16string GetAccessibleTabName(const Tab* tab) const override;
- base::Optional<int> GetCustomBackgroundId(
+ absl::optional<int> GetCustomBackgroundId(
BrowserFrameActiveState active_state) const override;
gfx::Rect GetTabAnimationTargetBounds(const Tab* tab) override;
float GetHoverOpacityForTab(float range_parameter) const override;
@@ -354,7 +354,7 @@
const ui::DropTargetEvent& event) override;
views::View* GetViewForDrop() override;
void HandleDragUpdate(
- const base::Optional<BrowserRootView::DropIndex>& index) override;
+ const absl::optional<BrowserRootView::DropIndex>& index) override;
void HandleDragExited() override;
private:
@@ -486,7 +486,7 @@
// given |tab| based on its model index when it moves. Used to reorder the
// child views of the tabstrip so that focus order stays consistent.
int GetViewInsertionIndex(Tab* tab,
- base::Optional<int> from_model_index,
+ absl::optional<int> from_model_index,
int to_model_index) const;
// Closes the tab at |model_index|.
@@ -548,7 +548,7 @@
// Show drop arrow with passed |tab_data_index| and |drop_before|.
// If |tab_data_index| is negative, the arrow will disappear.
- void SetDropArrow(const base::Optional<BrowserRootView::DropIndex>& index);
+ void SetDropArrow(const absl::optional<BrowserRootView::DropIndex>& index);
// Returns the image to use for indicating a drop on a tab. If is_down is
// true, this returns an arrow pointing down.
@@ -684,7 +684,7 @@
// (instead of GetAvailableWidthForTabStrip()). It is defined when closing
// tabs with the mouse, and is used to control which tab will end up under the
// cursor after the close animation completes.
- base::Optional<int> override_available_width_for_tabs_;
+ absl::optional<int> override_available_width_for_tabs_;
// The background offset used by inactive tabs to match the frame image.
int background_offset_ = 0;
@@ -728,7 +728,7 @@
base::TimeTicks last_mouse_move_time_;
// Used for seek time metrics from the time the mouse enters the tabstrip.
- base::Optional<base::TimeTicks> mouse_entered_tabstrip_time_;
+ absl::optional<base::TimeTicks> mouse_entered_tabstrip_time_;
// Number of mouse moves.
int mouse_move_count_ = 0;
diff --git a/chrome/browser/ui/views/tabs/tab_strip_browsertest.cc b/chrome/browser/ui/views/tabs/tab_strip_browsertest.cc
index 3ff6a07..352c4aa 100644
--- a/chrome/browser/ui/views/tabs/tab_strip_browsertest.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip_browsertest.cc
@@ -126,7 +126,7 @@
tab_strip()->ShiftTabPrevious(tab_strip()->tab_at(2));
EXPECT_EQ(expected, GetWebContentses());
EXPECT_TRUE(tab_strip()->controller()->IsGroupCollapsed(group));
- EXPECT_EQ(tab_strip()->tab_at(0)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(0)->group(), absl::nullopt);
EXPECT_EQ(tab_strip()->tab_at(1)->group().value(), group);
EXPECT_EQ(tab_strip()->tab_at(2)->group().value(), group);
}
@@ -157,7 +157,7 @@
EXPECT_TRUE(tab_strip()->controller()->IsGroupCollapsed(group2));
EXPECT_EQ(tab_strip()->tab_at(0)->group().value(), group1);
EXPECT_EQ(tab_strip()->tab_at(1)->group().value(), group1);
- EXPECT_EQ(tab_strip()->tab_at(2)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(2)->group(), absl::nullopt);
EXPECT_EQ(tab_strip()->tab_at(3)->group().value(), group2);
EXPECT_EQ(tab_strip()->tab_at(4)->group().value(), group2);
}
@@ -172,7 +172,7 @@
const auto expected = GetWebContentsesInOrder({0, 1, 2});
tab_strip()->ShiftTabPrevious(tab_strip()->tab_at(1));
EXPECT_EQ(expected, GetWebContentses());
- EXPECT_EQ(tab_strip()->tab_at(1)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(1)->group(), absl::nullopt);
}
IN_PROC_BROWSER_TEST_F(TabStripBrowsertest,
@@ -188,7 +188,7 @@
const auto expected = GetWebContentsesInOrder({0, 1, 2});
tab_strip()->ShiftTabPrevious(tab_strip()->tab_at(1));
EXPECT_EQ(expected, GetWebContentses());
- EXPECT_EQ(tab_strip()->tab_at(1)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(1)->group(), absl::nullopt);
tab_strip()->ShiftTabPrevious(tab_strip()->tab_at(1));
EXPECT_EQ(expected, GetWebContentses());
EXPECT_EQ(tab_strip()->tab_at(1)->group().value(), group);
@@ -255,7 +255,7 @@
EXPECT_TRUE(tab_strip()->controller()->IsGroupCollapsed(group));
EXPECT_EQ(tab_strip()->tab_at(0)->group().value(), group);
EXPECT_EQ(tab_strip()->tab_at(1)->group().value(), group);
- EXPECT_EQ(tab_strip()->tab_at(2)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(2)->group(), absl::nullopt);
}
IN_PROC_BROWSER_TEST_F(TabStripBrowsertest,
@@ -284,7 +284,7 @@
EXPECT_TRUE(tab_strip()->controller()->IsGroupCollapsed(group2));
EXPECT_EQ(tab_strip()->tab_at(0)->group().value(), group1);
EXPECT_EQ(tab_strip()->tab_at(1)->group().value(), group1);
- EXPECT_EQ(tab_strip()->tab_at(2)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(2)->group(), absl::nullopt);
EXPECT_EQ(tab_strip()->tab_at(3)->group().value(), group2);
EXPECT_EQ(tab_strip()->tab_at(4)->group().value(), group2);
}
@@ -299,7 +299,7 @@
const auto expected = GetWebContentsesInOrder({0, 1, 2});
tab_strip()->ShiftTabNext(tab_strip()->tab_at(1));
EXPECT_EQ(expected, GetWebContentses());
- EXPECT_EQ(tab_strip()->tab_at(1)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(1)->group(), absl::nullopt);
}
IN_PROC_BROWSER_TEST_F(TabStripBrowsertest, ShiftTabNext_ShiftsBetweenGroups) {
@@ -314,7 +314,7 @@
const auto expected = GetWebContentsesInOrder({0, 1, 2});
tab_strip()->ShiftTabNext(tab_strip()->tab_at(0));
EXPECT_EQ(expected, GetWebContentses());
- EXPECT_EQ(tab_strip()->tab_at(0)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(0)->group(), absl::nullopt);
tab_strip()->ShiftTabNext(tab_strip()->tab_at(0));
EXPECT_EQ(expected, GetWebContentses());
EXPECT_EQ(tab_strip()->tab_at(0)->group().value(), group);
@@ -370,7 +370,7 @@
AddTabToNewGroup(0);
tab_strip()->MoveTabFirst(tab_strip()->tab_at(1));
- EXPECT_EQ(tab_strip()->tab_at(0)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(0)->group(), absl::nullopt);
}
IN_PROC_BROWSER_TEST_F(TabStripBrowsertest, MoveTabFirst_RemovesFromGroup) {
@@ -381,10 +381,10 @@
AddTabToNewGroup(1);
tab_strip()->MoveTabFirst(tab_strip()->tab_at(0));
- EXPECT_EQ(tab_strip()->tab_at(0)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(0)->group(), absl::nullopt);
tab_strip()->MoveTabFirst(tab_strip()->tab_at(1));
- EXPECT_EQ(tab_strip()->tab_at(0)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(0)->group(), absl::nullopt);
}
IN_PROC_BROWSER_TEST_F(TabStripBrowsertest, MoveTabFirst_NoPinnedTabs_Failure) {
@@ -465,7 +465,7 @@
AddTabToNewGroup(2);
tab_strip()->MoveTabLast(tab_strip()->tab_at(1));
- EXPECT_EQ(tab_strip()->tab_at(2)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(2)->group(), absl::nullopt);
}
IN_PROC_BROWSER_TEST_F(TabStripBrowsertest, MoveTabLast_RemovesFromGroup) {
@@ -476,10 +476,10 @@
AddTabToNewGroup(2);
tab_strip()->MoveTabLast(tab_strip()->tab_at(2));
- EXPECT_EQ(tab_strip()->tab_at(2)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(2)->group(), absl::nullopt);
tab_strip()->MoveTabLast(tab_strip()->tab_at(1));
- EXPECT_EQ(tab_strip()->tab_at(2)->group(), base::nullopt);
+ EXPECT_EQ(tab_strip()->tab_at(2)->group(), absl::nullopt);
}
IN_PROC_BROWSER_TEST_F(TabStripBrowsertest, MoveTabLast_NoPinnedTabs_Failure) {
diff --git a/chrome/browser/ui/views/tabs/tab_strip_controller.h b/chrome/browser/ui/views/tabs/tab_strip_controller.h
index f6b1b99..dd025a6f 100644
--- a/chrome/browser/ui/views/tabs/tab_strip_controller.h
+++ b/chrome/browser/ui/views/tabs/tab_strip_controller.h
@@ -8,10 +8,10 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
#include "chrome/browser/ui/views/tabs/tab_strip_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/range/range.h"
@@ -144,7 +144,7 @@
// Notifies controller that the index of the tab with keyboard focus changed
// to |index|.
- virtual void OnKeyboardFocusedTabChanged(base::Optional<int> index) = 0;
+ virtual void OnKeyboardFocusedTabChanged(absl::optional<int> index) = 0;
// Returns the title of the given |group|.
virtual std::u16string GetGroupTitle(
@@ -170,13 +170,13 @@
// Gets the first tab index in |group|, or nullopt if the group is
// currently empty. This is always safe to call unlike
// ListTabsInGroup().
- virtual base::Optional<int> GetFirstTabInGroup(
+ virtual absl::optional<int> GetFirstTabInGroup(
const tab_groups::TabGroupId& group) const = 0;
// Gets the last tab index in |group|, or nullopt if the group is
// currently empty. This is always safe to call unlike
// ListTabsInGroup().
- virtual base::Optional<int> GetLastTabInGroup(
+ virtual absl::optional<int> GetLastTabInGroup(
const tab_groups::TabGroupId& group) const = 0;
// Returns the range of tabs in the given |group|. This must not be
@@ -218,7 +218,7 @@
// For non-transparent windows, returns the background tab image resource ID
// if the image has been customized, directly or indirectly, by the theme.
- virtual base::Optional<int> GetCustomBackgroundId(
+ virtual absl::optional<int> GetCustomBackgroundId(
BrowserFrameActiveState active_state) const = 0;
// Returns the accessible tab name.
diff --git a/chrome/browser/ui/views/tabs/tab_strip_layout.cc b/chrome/browser/ui/views/tabs/tab_strip_layout.cc
index 2c50a23..4003ed7c 100644
--- a/chrome/browser/ui/views/tabs/tab_strip_layout.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip_layout.cc
@@ -20,7 +20,7 @@
TabSizer CalculateSpaceFractionAvailable(
const TabLayoutConstants& layout_constants,
const std::vector<TabWidthConstraints>& tabs,
- base::Optional<int> width) {
+ absl::optional<int> width) {
if (!width.has_value())
return TabSizer(LayoutDomain::kInactiveWidthEqualsActiveWidth, 1);
@@ -99,7 +99,7 @@
// use up that width.
void AllocateExtraSpace(std::vector<gfx::Rect>* bounds,
const std::vector<TabWidthConstraints>& tabs,
- base::Optional<int> extra_space,
+ absl::optional<int> extra_space,
TabSizer tab_sizer) {
// Don't expand tabs if they are already at their preferred width.
if (tab_sizer.IsAlreadyPreferredWidth() || !extra_space.has_value())
@@ -139,8 +139,8 @@
std::vector<gfx::Rect> CalculateTabBounds(
const TabLayoutConstants& layout_constants,
const std::vector<TabWidthConstraints>& tabs,
- base::Optional<int> width,
- base::Optional<TabWidthOverride> tab_width_override) {
+ absl::optional<int> width,
+ absl::optional<TabWidthOverride> tab_width_override) {
if (tabs.empty())
return std::vector<gfx::Rect>();
@@ -158,11 +158,11 @@
next_x += tab_width - layout_constants.tab_overlap;
}
- const base::Optional<int> calculated_extra_space =
+ const absl::optional<int> calculated_extra_space =
width.has_value()
- ? base::make_optional(width.value() - bounds.back().right())
- : base::nullopt;
- const base::Optional<int> extra_space = tab_width_override.has_value()
+ ? absl::make_optional(width.value() - bounds.back().right())
+ : absl::nullopt;
+ const absl::optional<int> extra_space = tab_width_override.has_value()
? tab_width_override->extra_space
: calculated_extra_space;
AllocateExtraSpace(&bounds, tabs, extra_space, tab_sizer);
@@ -174,5 +174,5 @@
const TabLayoutConstants& layout_constants,
const std::vector<TabWidthConstraints>& pinned_tabs) {
// Pinned tabs are always the same size regardless of the available width.
- return CalculateTabBounds(layout_constants, pinned_tabs, 0, base::nullopt);
+ return CalculateTabBounds(layout_constants, pinned_tabs, 0, absl::nullopt);
}
diff --git a/chrome/browser/ui/views/tabs/tab_strip_layout.h b/chrome/browser/ui/views/tabs/tab_strip_layout.h
index 958c3b7..1563b07 100644
--- a/chrome/browser/ui/views/tabs/tab_strip_layout.h
+++ b/chrome/browser/ui/views/tabs/tab_strip_layout.h
@@ -7,9 +7,9 @@
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/ui/views/tabs/tab_strip_layout_types.h"
#include "chrome/browser/ui/views/tabs/tab_width_constraints.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace gfx {
class Rect;
@@ -60,8 +60,8 @@
std::vector<gfx::Rect> CalculateTabBounds(
const TabLayoutConstants& layout_constants,
const std::vector<TabWidthConstraints>& tabs,
- base::Optional<int> width,
- base::Optional<TabWidthOverride> tab_width_override);
+ absl::optional<int> width,
+ absl::optional<TabWidthOverride> tab_width_override);
std::vector<gfx::Rect> CalculatePinnedTabBounds(
const TabLayoutConstants& layout_constants,
diff --git a/chrome/browser/ui/views/tabs/tab_strip_layout_helper.cc b/chrome/browser/ui/views/tabs/tab_strip_layout_helper.cc
index 07e37f66..1ee5f83c 100644
--- a/chrome/browser/ui/views/tabs/tab_strip_layout_helper.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip_layout_helper.cc
@@ -132,11 +132,11 @@
}
}
-base::Optional<int> TabStripLayoutHelper::ExitTabClosingMode() {
+absl::optional<int> TabStripLayoutHelper::ExitTabClosingMode() {
if (!WidthsConstrainedForClosingMode())
- return base::nullopt;
+ return absl::nullopt;
- int available_width = CalculateIdealBounds(base::nullopt).back().right();
+ int available_width = CalculateIdealBounds(absl::nullopt).back().right();
tab_width_override_.reset();
tabstrip_width_override_.reset();
@@ -153,7 +153,7 @@
}
void TabStripLayoutHelper::MoveTab(
- base::Optional<tab_groups::TabGroupId> moving_tab_group,
+ absl::optional<tab_groups::TabGroupId> moving_tab_group,
int prev_index,
int new_index) {
const int prev_slot_index = GetSlotIndexForExistingTab(prev_index);
@@ -201,7 +201,7 @@
TabSlot header_slot = std::move(slots_[slot_index]);
slots_.erase(slots_.begin() + slot_index);
- base::Optional<int> first_tab = controller_->GetFirstTabInGroup(group);
+ absl::optional<int> first_tab = controller_->GetFirstTabInGroup(group);
DCHECK(first_tab);
const int first_tab_slot_index =
GetSlotInsertionIndexForNewTab(first_tab.value(), group);
@@ -232,7 +232,7 @@
}
int TabStripLayoutHelper::CalculatePreferredWidth() {
- const std::vector<gfx::Rect> bounds = CalculateIdealBounds(base::nullopt);
+ const std::vector<gfx::Rect> bounds = CalculateIdealBounds(absl::nullopt);
return bounds.empty() ? 0 : bounds.back().right();
}
@@ -297,8 +297,8 @@
}
std::vector<gfx::Rect> TabStripLayoutHelper::CalculateIdealBounds(
- base::Optional<int> available_width) {
- base::Optional<int> tabstrip_width = tabstrip_width_override_.has_value()
+ absl::optional<int> available_width) {
+ absl::optional<int> tabstrip_width = tabstrip_width_override_.has_value()
? tabstrip_width_override_
: available_width;
@@ -372,7 +372,7 @@
int TabStripLayoutHelper::GetSlotInsertionIndexForNewTab(
int new_model_index,
- base::Optional<tab_groups::TabGroupId> group) const {
+ absl::optional<tab_groups::TabGroupId> group) const {
int slot_index = GetFirstSlotIndexForTabModelIndex(new_model_index);
if (slot_index == static_cast<int>(slots_.size()))
@@ -466,7 +466,7 @@
// The slot can only be collapsed if it is a tab and in a collapsed group.
// If the slot is indeed a tab and in a group, check the collapsed state of
// the group to determine if it is collapsed.
- const base::Optional<tab_groups::TabGroupId> id = slots_[i].view->group();
+ const absl::optional<tab_groups::TabGroupId> id = slots_[i].view->group();
return (slots_[i].type == ViewType::kTab && id.has_value())
? controller_->IsGroupCollapsed(id.value())
: false;
diff --git a/chrome/browser/ui/views/tabs/tab_strip_layout_helper.h b/chrome/browser/ui/views/tabs/tab_strip_layout_helper.h
index 2e97d42..c73da02 100644
--- a/chrome/browser/ui/views/tabs/tab_strip_layout_helper.h
+++ b/chrome/browser/ui/views/tabs/tab_strip_layout_helper.h
@@ -9,12 +9,12 @@
#include "base/callback.h"
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/ui/tabs/tab_types.h"
#include "chrome/browser/ui/views/tabs/tab_animation_state.h"
#include "chrome/browser/ui/views/tabs/tab_slot_view.h"
#include "chrome/browser/ui/views/tabs/tab_strip_layout.h"
#include "chrome/browser/ui/views/tabs/tab_width_constraints.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/view_model.h"
@@ -78,7 +78,7 @@
// Called when the tabstrip has left tab closing mode or when falling back
// to the old animation system while in closing mode. Returns the current
// available width.
- base::Optional<int> ExitTabClosingMode();
+ absl::optional<int> ExitTabClosingMode();
// Invoked when |tab| has been destroyed by TabStrip (i.e. the remove
// animation has completed).
@@ -86,7 +86,7 @@
// Moves the tab at |prev_index| with group |moving_tab_group| to |new_index|.
// Also updates the group header's location if necessary.
- void MoveTab(base::Optional<tab_groups::TabGroupId> moving_tab_group,
+ void MoveTab(absl::optional<tab_groups::TabGroupId> moving_tab_group,
int prev_index,
int new_index);
@@ -130,7 +130,7 @@
// Calculates the bounds each tab should occupy, subject to the provided
// width constraint.
std::vector<gfx::Rect> CalculateIdealBounds(
- base::Optional<int> available_width);
+ absl::optional<int> available_width);
// Given |model_index| for a tab already present in |slots_|, return
// the corresponding index in |slots_|.
@@ -140,7 +140,7 @@
// |slots_|. |group| is the new tab's group.
int GetSlotInsertionIndexForNewTab(
int new_model_index,
- base::Optional<tab_groups::TabGroupId> group) const;
+ absl::optional<tab_groups::TabGroupId> group) const;
// Used internally in the above two functions. For a tabstrip with N
// tabs, this takes 0 <= |model_index| <= N and returns the first
@@ -194,12 +194,12 @@
// When in tab closing mode, if we want the next tab to the right to end up
// under the cursor, each tab needs to stay the same size. When defined,
// this specifies that size.
- base::Optional<TabWidthOverride> tab_width_override_;
+ absl::optional<TabWidthOverride> tab_width_override_;
// When in tab closing mode, if we want the next tab to the left to end up
// under the cursor, the overall space taken by tabs needs to stay the same.
// When defined, this specifies that size.
- base::Optional<int> tabstrip_width_override_;
+ absl::optional<int> tabstrip_width_override_;
// The current widths of tabs. If the space for tabs is not evenly divisible
// into these widths, the initial tabs in the strip will be 1 px larger.
diff --git a/chrome/browser/ui/views/tabs/tab_strip_layout_unittest.cc b/chrome/browser/ui/views/tabs/tab_strip_layout_unittest.cc
index d2dda098..8275a00 100644
--- a/chrome/browser/ui/views/tabs/tab_strip_layout_unittest.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip_layout_unittest.cc
@@ -81,7 +81,7 @@
}
return CalculateTabBounds(layout_constants, tab_states,
- test_case.tabstrip_width, base::nullopt);
+ test_case.tabstrip_width, absl::nullopt);
}
} // namespace
diff --git a/chrome/browser/ui/views/tabs/tab_strip_unittest.cc b/chrome/browser/ui/views/tabs/tab_strip_unittest.cc
index c7fab4b..b720ce3 100644
--- a/chrome/browser/ui/views/tabs/tab_strip_unittest.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip_unittest.cc
@@ -255,14 +255,14 @@
views::View::Views GetTabSlotViewsInVisualOrder() {
views::View::Views ordered_views;
- base::Optional<tab_groups::TabGroupId> prev_group = base::nullopt;
+ absl::optional<tab_groups::TabGroupId> prev_group = absl::nullopt;
for (int i = 0; i < tab_strip_->GetTabCount(); ++i) {
Tab* tab = tab_strip_->tab_at(i);
// If the current Tab is the first one in a group, first add the
// TabGroupHeader to the list of views.
- base::Optional<tab_groups::TabGroupId> curr_group = tab->group();
+ absl::optional<tab_groups::TabGroupId> curr_group = tab->group();
if (curr_group.has_value() && curr_group != prev_group)
ordered_views.push_back(tab_strip_->group_header(curr_group.value()));
prev_group = curr_group;
@@ -427,9 +427,9 @@
controller_->AddTab(3, false);
EXPECT_EQ(GetTabSlotViewsInFocusOrder(), GetTabSlotViewsInVisualOrder());
- base::Optional<tab_groups::TabGroupId> group1 =
+ absl::optional<tab_groups::TabGroupId> group1 =
tab_groups::TabGroupId::GenerateNew();
- base::Optional<tab_groups::TabGroupId> group2 =
+ absl::optional<tab_groups::TabGroupId> group2 =
tab_groups::TabGroupId::GenerateNew();
// Add multiple tabs to a group and verify view order.
@@ -895,7 +895,7 @@
Tab* tab = tab_strip_->tab_at(0);
const int first_slot_x = tab->x();
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_groups::TabGroupId::GenerateNew();
controller_->MoveTabIntoGroup(0, group);
CompleteAnimationAndLayout();
@@ -918,7 +918,7 @@
const int second_slot_x = tab_strip_->tab_at(1)->x();
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_groups::TabGroupId::GenerateNew();
controller_->MoveTabIntoGroup(1, group);
@@ -930,7 +930,7 @@
SetMaxTabStripWidth(2000);
for (int i = 0; i < 4; i++)
controller_->AddTab(i, false);
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_groups::TabGroupId::GenerateNew();
controller_->MoveTabIntoGroup(1, group);
CompleteAnimationAndLayout();
@@ -948,7 +948,7 @@
SetMaxTabStripWidth(2000);
for (int i = 0; i < 4; i++)
controller_->AddTab(i, false);
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_groups::TabGroupId::GenerateNew();
controller_->MoveTabIntoGroup(2, group);
CompleteAnimationAndLayout();
@@ -966,7 +966,7 @@
SetMaxTabStripWidth(2000);
for (int i = 0; i < 4; i++)
controller_->AddTab(i, false);
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_groups::TabGroupId::GenerateNew();
controller_->MoveTabIntoGroup(1, group);
controller_->MoveTabIntoGroup(2, group);
@@ -1037,14 +1037,14 @@
TEST_P(TabStripTest, DeleteTabGroupViewsWhenEmpty) {
controller_->AddTab(0, false);
controller_->AddTab(1, false);
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_groups::TabGroupId::GenerateNew();
controller_->MoveTabIntoGroup(0, group);
controller_->MoveTabIntoGroup(1, group);
- controller_->MoveTabIntoGroup(0, base::nullopt);
+ controller_->MoveTabIntoGroup(0, absl::nullopt);
EXPECT_EQ(1u, ListGroupViews().size());
- controller_->MoveTabIntoGroup(1, base::nullopt);
+ controller_->MoveTabIntoGroup(1, absl::nullopt);
EXPECT_EQ(0u, ListGroupViews().size());
}
@@ -1053,7 +1053,7 @@
bounds_animator()->SetAnimationDuration(base::TimeDelta());
controller_->AddTab(0, false);
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_groups::TabGroupId::GenerateNew();
controller_->MoveTabIntoGroup(0, group);
CompleteAnimationAndLayout();
@@ -1087,7 +1087,7 @@
bounds_animator()->SetAnimationDuration(base::TimeDelta());
controller_->AddTab(0, false);
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_groups::TabGroupId::GenerateNew();
controller_->MoveTabIntoGroup(0, group);
CompleteAnimationAndLayout();
@@ -1141,7 +1141,7 @@
CompleteAnimationAndLayout();
ASSERT_EQ(3, tab_strip_->GetTabCount());
ASSERT_EQ(3, tab_strip_->GetModelCount());
- EXPECT_EQ(base::nullopt, tab_strip_->tab_at(0)->group());
+ EXPECT_EQ(absl::nullopt, tab_strip_->tab_at(0)->group());
EXPECT_EQ(group_id, tab_strip_->tab_at(1)->group());
EXPECT_EQ(group_id, tab_strip_->tab_at(2)->group());
@@ -1170,7 +1170,7 @@
// After finishing animations, there should be exactly 1 tab in no
// group.
EXPECT_EQ(1, tab_strip_->GetTabCount());
- EXPECT_EQ(base::nullopt, tab_strip_->tab_at(0)->group());
+ EXPECT_EQ(absl::nullopt, tab_strip_->tab_at(0)->group());
EXPECT_EQ(1, tab_strip_->GetModelCount());
}
@@ -1380,7 +1380,7 @@
ASSERT_TRUE(tab_strip_->tab_at(i)->GetVisible());
// The group header of an invisible tab should not be visible.
- base::Optional<tab_groups::TabGroupId> group1 =
+ absl::optional<tab_groups::TabGroupId> group1 =
tab_groups::TabGroupId::GenerateNew();
controller_->MoveTabIntoGroup(invisible_tab_index, group1);
CompleteAnimationAndLayout();
@@ -1389,7 +1389,7 @@
// The group header of a visible tab should be visible when the group is
// expanded and collapsed.
- base::Optional<tab_groups::TabGroupId> group2 =
+ absl::optional<tab_groups::TabGroupId> group2 =
tab_groups::TabGroupId::GenerateNew();
controller_->MoveTabIntoGroup(0, group2);
CompleteAnimationAndLayout();
@@ -1416,7 +1416,7 @@
CompleteAnimationAndLayout();
// Create a tab group.
- base::Optional<tab_groups::TabGroupId> group =
+ absl::optional<tab_groups::TabGroupId> group =
tab_groups::TabGroupId::GenerateNew();
controller_->MoveTabIntoGroup(0, group);
CompleteAnimationAndLayout();
diff --git a/chrome/browser/ui/views/tabs/tab_style_views.cc b/chrome/browser/ui/views/tabs/tab_style_views.cc
index 7a8aefdd..1874999 100644
--- a/chrome/browser/ui/views/tabs/tab_style_views.cc
+++ b/chrome/browser/ui/views/tabs/tab_style_views.cc
@@ -131,12 +131,12 @@
void PaintInactiveTabBackground(gfx::Canvas* canvas) const;
void PaintTabBackground(gfx::Canvas* canvas,
TabActive active,
- base::Optional<int> fill_id,
+ absl::optional<int> fill_id,
int y_inset) const;
void PaintTabBackgroundFill(gfx::Canvas* canvas,
TabActive active,
bool paint_hover_effect,
- base::Optional<int> fill_id,
+ absl::optional<int> fill_id,
int y_inset) const;
void PaintBackgroundStroke(gfx::Canvas* canvas,
TabActive active,
@@ -478,7 +478,7 @@
}
void GM2TabStyle::PaintTab(gfx::Canvas* canvas) const {
- base::Optional<int> active_tab_fill_id;
+ absl::optional<int> active_tab_fill_id;
int active_tab_y_inset = 0;
if (tab_->GetThemeProvider()->HasCustomImage(IDR_THEME_TOOLBAR)) {
active_tab_fill_id = IDR_THEME_TOOLBAR;
@@ -741,7 +741,7 @@
}
int GM2TabStyle::GetStrokeThickness(bool should_paint_as_active) const {
- base::Optional<tab_groups::TabGroupId> group = tab_->group();
+ absl::optional<tab_groups::TabGroupId> group = tab_->group();
if (group.has_value() && tab_->IsActive())
return TabGroupUnderline::kStrokeThickness;
@@ -802,12 +802,12 @@
void GM2TabStyle::PaintTabBackground(gfx::Canvas* canvas,
TabActive active,
- base::Optional<int> fill_id,
+ absl::optional<int> fill_id,
int y_inset) const {
// |y_inset| is only set when |fill_id| is being used.
DCHECK(!y_inset || fill_id.has_value());
- base::Optional<SkColor> group_color = tab_->GetGroupColor();
+ absl::optional<SkColor> group_color = tab_->GetGroupColor();
PaintTabBackgroundFill(canvas, active,
active == TabActive::kInactive && IsHoverActive(),
@@ -821,7 +821,7 @@
void GM2TabStyle::PaintTabBackgroundFill(gfx::Canvas* canvas,
TabActive active,
bool paint_hover_effect,
- base::Optional<int> fill_id,
+ absl::optional<int> fill_id,
int y_inset) const {
const SkPath fill_path = GetPath(PathType::kFill, canvas->image_scale(),
active == TabActive::kActive);
@@ -964,7 +964,7 @@
}
// static
-base::Optional<TabStyle::TabColors> ui::metadata::TypeConverter<
+absl::optional<TabStyle::TabColors> ui::metadata::TypeConverter<
TabStyle::TabColors>::FromString(const std::u16string& source_value) {
std::u16string trimmed_string;
base::TrimString(source_value, u"{ }", &trimmed_string);
@@ -974,9 +974,9 @@
const auto background_color =
SkColorConverter::GetNextColor(color_pos, trimmed_string.cend());
return (foreground_color && background_color)
- ? base::make_optional<TabStyle::TabColors>(
+ ? absl::make_optional<TabStyle::TabColors>(
foreground_color.value(), background_color.value())
- : base::nullopt;
+ : absl::nullopt;
}
// static
diff --git a/chrome/browser/ui/views/tabs/tab_style_views.h b/chrome/browser/ui/views/tabs/tab_style_views.h
index abe8e2d2..062f042 100644
--- a/chrome/browser/ui/views/tabs/tab_style_views.h
+++ b/chrome/browser/ui/views/tabs/tab_style_views.h
@@ -17,7 +17,7 @@
: ui::metadata::BaseTypeConverter<true> {
static std::u16string ToString(
ui::metadata::ArgType<TabStyle::TabColors> source_value);
- static base::Optional<TabStyle::TabColors> FromString(
+ static absl::optional<TabStyle::TabColors> FromString(
const std::u16string& source_value);
static ui::metadata::ValidStrings GetValidStrings();
};
diff --git a/chrome/browser/ui/views/tabs/tab_unittest.cc b/chrome/browser/ui/views/tabs/tab_unittest.cc
index 7f77e3a..c7051dc 100644
--- a/chrome/browser/ui/views/tabs/tab_unittest.cc
+++ b/chrome/browser/ui/views/tabs/tab_unittest.cc
@@ -108,9 +108,9 @@
return active == TabActive::kActive ? tab_fg_color_active_
: tab_fg_color_inactive_;
}
- base::Optional<int> GetCustomBackgroundId(
+ absl::optional<int> GetCustomBackgroundId(
BrowserFrameActiveState active_state) const override {
- return base::nullopt;
+ return absl::nullopt;
}
gfx::Rect GetTabAnimationTargetBounds(const Tab* tab) override {
return tab->bounds();
@@ -424,8 +424,8 @@
}
TEST_F(TabTest, LayoutAndVisibilityOfElements) {
- static const base::Optional<TabAlertState> kAlertStatesToTest[] = {
- base::nullopt,
+ static const absl::optional<TabAlertState> kAlertStatesToTest[] = {
+ absl::nullopt,
TabAlertState::TAB_CAPTURING,
TabAlertState::AUDIO_PLAYING,
TabAlertState::AUDIO_MUTING,
@@ -445,7 +445,7 @@
// results.
for (bool is_pinned_tab : {false, true}) {
for (bool is_active_tab : {false, true}) {
- for (base::Optional<TabAlertState> alert_state : kAlertStatesToTest) {
+ for (absl::optional<TabAlertState> alert_state : kAlertStatesToTest) {
SCOPED_TRACE(
::testing::Message()
<< (is_active_tab ? "Active " : "Inactive ")
diff --git a/chrome/browser/ui/views/toolbar/avatar_toolbar_button_browsertest.cc b/chrome/browser/ui/views/toolbar/avatar_toolbar_button_browsertest.cc
index aa1debba..08b9ad9 100644
--- a/chrome/browser/ui/views/toolbar/avatar_toolbar_button_browsertest.cc
+++ b/chrome/browser/ui/views/toolbar/avatar_toolbar_button_browsertest.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/optional.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/test/browser_test.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class AvatarToolbarButtonBrowserTest : public InProcessBrowserTest {
public:
@@ -18,14 +18,14 @@
~AvatarToolbarButtonBrowserTest() override = default;
// Returns the window count in avatar button text, if it exists.
- base::Optional<int> GetWindowCountInAvatarButtonText(Browser* browser) {
+ absl::optional<int> GetWindowCountInAvatarButtonText(Browser* browser) {
std::u16string button_text = BrowserView::GetBrowserViewForBrowser(browser)
->toolbar()
->avatar_->GetText();
size_t before_number = button_text.find('(');
if (before_number == std::string::npos)
- return base::Optional<int>();
+ return absl::optional<int>();
size_t after_number = button_text.find(')');
EXPECT_NE(std::string::npos, after_number);
@@ -34,8 +34,8 @@
button_text.substr(before_number + 1, after_number - before_number - 1);
int window_count;
return base::StringToInt(number_text, &window_count)
- ? base::Optional<int>(window_count)
- : base::Optional<int>();
+ ? absl::optional<int>(window_count)
+ : absl::optional<int>();
}
};
diff --git a/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc b/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc
index 769e26a..b259d929 100644
--- a/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc
+++ b/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc
@@ -143,7 +143,7 @@
text = l10n_util::GetStringUTF16(IDS_APP_MENU_BUTTON_ERROR);
}
- base::Optional<SkColor> color;
+ absl::optional<SkColor> color;
switch (type_and_severity_.severity) {
case AppMenuIconController::Severity::NONE:
break;
diff --git a/chrome/browser/ui/views/toolbar/browser_app_menu_button.h b/chrome/browser/ui/views/toolbar/browser_app_menu_button.h
index 3624c20..14cdfd0 100644
--- a/chrome/browser/ui/views/toolbar/browser_app_menu_button.h
+++ b/chrome/browser/ui/views/toolbar/browser_app_menu_button.h
@@ -9,11 +9,11 @@
#include <set>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/ui/toolbar/app_menu_icon_controller.h"
#include "chrome/browser/ui/user_education/feature_promo_controller.h"
#include "chrome/browser/ui/views/frame/app_menu_button.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/view.h"
@@ -66,7 +66,7 @@
// Our owning toolbar view.
ToolbarView* const toolbar_view_;
- base::Optional<FeaturePromoController::PromoHandle> reopen_tab_promo_handle_;
+ absl::optional<FeaturePromoController::PromoHandle> reopen_tab_promo_handle_;
base::CallbackListSubscription subscription_ =
ui::TouchUiController::Get()->RegisterCallback(
diff --git a/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model.cc b/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model.cc
index dcfacd3..b74bd84 100644
--- a/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model.cc
+++ b/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model.cc
@@ -4,16 +4,16 @@
#include "chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/flag_descriptions.h"
#include "chrome/grit/generated_resources.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
-base::Optional<std::vector<LabInfo>>& GetTestData() {
- static base::NoDestructor<base::Optional<std::vector<LabInfo>>> test_lab_data;
+absl::optional<std::vector<LabInfo>>& GetTestData() {
+ static base::NoDestructor<absl::optional<std::vector<LabInfo>>> test_lab_data;
return *test_lab_data;
}
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button.cc b/chrome/browser/ui/views/toolbar/toolbar_button.cc
index 6b2fded..e98b8fa 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_button.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_button.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/feature_list.h"
#include "base/location.h"
-#include "base/optional.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
@@ -26,6 +25,7 @@
#include "chrome/browser/ui/views/chrome_view_class_properties.h"
#include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h"
#include "chrome/browser/ui/views/user_education/feature_promo_colors.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/metadata/metadata_impl_macros.h"
@@ -204,7 +204,7 @@
if (host->has_in_product_help_promo_)
return GetFeaturePromoHighlightColorForToolbar(
host->GetThemeProvider());
- base::Optional<SkColor> drop_base_color =
+ absl::optional<SkColor> drop_base_color =
host->highlight_color_animation_.GetInkDropBaseColor();
if (drop_base_color)
return *drop_base_color;
@@ -242,7 +242,7 @@
const float default_contrast =
color_utils::GetContrastRatio(default_focus_ring_color, background);
if (default_contrast > color_utils::kMinimumVisibleContrastRatio) {
- focus_ring->SetColor(base::nullopt);
+ focus_ring->SetColor(absl::nullopt);
return;
}
const SkColor fallback_focus_ring_color = host->GetThemeProvider()->GetColor(
@@ -256,11 +256,11 @@
focus_ring->SetColor(fallback_focus_ring_color);
return;
}
- focus_ring->SetColor(base::nullopt);
+ focus_ring->SetColor(absl::nullopt);
}
void ToolbarButton::SetHighlight(const std::u16string& highlight_text,
- base::Optional<SkColor> highlight_color) {
+ absl::optional<SkColor> highlight_color) {
if (highlight_text.empty() && !highlight_color.has_value()) {
ClearHighlight();
return;
@@ -313,7 +313,7 @@
(target_size.height() - GetLayoutConstant(LOCATION_BAR_HEIGHT)) / 2) +
*GetProperty(views::kInternalPaddingKey);
- base::Optional<SkColor> background_color =
+ absl::optional<SkColor> background_color =
highlight_color_animation_.GetBackgroundColor();
if (background_color) {
SetBackground(views::CreateBackgroundFromPainter(
@@ -329,7 +329,7 @@
// Apply new border with target insets.
- base::Optional<SkColor> border_color =
+ absl::optional<SkColor> border_color =
highlight_color_animation_.GetBorderColor();
if (!border() || target_insets != current_insets ||
last_border_color_ != border_color ||
@@ -472,11 +472,11 @@
return menu_showing_;
}
-base::Optional<gfx::Insets> ToolbarButton::GetLayoutInsets() const {
+absl::optional<gfx::Insets> ToolbarButton::GetLayoutInsets() const {
return layout_insets_;
}
-void ToolbarButton::SetLayoutInsets(const base::Optional<gfx::Insets>& insets) {
+void ToolbarButton::SetLayoutInsets(const absl::optional<gfx::Insets>& insets) {
if (layout_insets_ == insets)
return;
layout_insets_ = insets;
@@ -788,7 +788,7 @@
ToolbarButton::HighlightColorAnimation::~HighlightColorAnimation() = default;
void ToolbarButton::HighlightColorAnimation::Show(
- base::Optional<SkColor> highlight_color) {
+ absl::optional<SkColor> highlight_color) {
// If the animation is showing, we will jump to a different color in the
// middle of the animation and continue animating towards the new
// |highlight_color_|. If the animation is fully shown, we will jump directly
@@ -806,10 +806,10 @@
highlight_color_animation_.Hide();
}
-base::Optional<SkColor> ToolbarButton::HighlightColorAnimation::GetTextColor()
+absl::optional<SkColor> ToolbarButton::HighlightColorAnimation::GetTextColor()
const {
if (!IsShown() || !parent_->GetThemeProvider())
- return base::nullopt;
+ return absl::nullopt;
SkColor text_color;
if (highlight_color_) {
text_color = *highlight_color_;
@@ -819,10 +819,10 @@
return FadeWithAnimation(text_color, highlight_color_animation_);
}
-base::Optional<SkColor> ToolbarButton::HighlightColorAnimation::GetBorderColor()
+absl::optional<SkColor> ToolbarButton::HighlightColorAnimation::GetBorderColor()
const {
if (!IsShown() || !parent_->GetThemeProvider()) {
- return base::nullopt;
+ return absl::nullopt;
}
SkColor border_color;
@@ -834,10 +834,10 @@
return FadeWithAnimation(border_color, highlight_color_animation_);
}
-base::Optional<SkColor>
+absl::optional<SkColor>
ToolbarButton::HighlightColorAnimation::GetBackgroundColor() const {
if (!IsShown() || !parent_->GetThemeProvider())
- return base::nullopt;
+ return absl::nullopt;
SkColor bg_color =
SkColorSetA(GetDefaultBackgroundColor(parent_->GetThemeProvider()),
kBackgroundBaseLayerAlpha);
@@ -853,10 +853,10 @@
return FadeWithAnimation(bg_color, highlight_color_animation_);
}
-base::Optional<SkColor>
+absl::optional<SkColor>
ToolbarButton::HighlightColorAnimation::GetInkDropBaseColor() const {
if (!highlight_color_)
- return base::nullopt;
+ return absl::nullopt;
return *highlight_color_;
}
@@ -885,5 +885,5 @@
}
BEGIN_METADATA(ToolbarButton, views::LabelButton)
-ADD_PROPERTY_METADATA(base::Optional<gfx::Insets>, LayoutInsets)
+ADD_PROPERTY_METADATA(absl::optional<gfx::Insets>, LayoutInsets)
END_METADATA
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button.h b/chrome/browser/ui/views/toolbar/toolbar_button.h
index 55846dc..731221c5 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_button.h
+++ b/chrome/browser/ui/views/toolbar/toolbar_button.h
@@ -8,8 +8,8 @@
#include <memory>
#include "base/bind.h"
-#include "base/optional.h"
#include "chrome/browser/ui/views/chrome_views_export.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/pointer/touch_ui_controller.h"
#include "ui/base/theme_provider.h"
@@ -67,7 +67,7 @@
// highlight directly without any animation. To clear the previous highlight
// (also using an animation), call this function with both parameters empty.
void SetHighlight(const std::u16string& highlight_text,
- base::Optional<SkColor> highlight_color);
+ absl::optional<SkColor> highlight_color);
// Sets the leading margin when the browser is maximized and updates layout to
// make the focus rectangle centered.
@@ -100,8 +100,8 @@
virtual void UpdateIcon();
// Gets/Sets |layout_insets_|, see comment there.
- base::Optional<gfx::Insets> GetLayoutInsets() const;
- void SetLayoutInsets(const base::Optional<gfx::Insets>& insets);
+ absl::optional<gfx::Insets> GetLayoutInsets() const;
+ void SetLayoutInsets(const absl::optional<gfx::Insets>& insets);
// views::LabelButton:
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
@@ -188,7 +188,7 @@
// Starts a fade-in animation using the provided |highlight color| or using
// a default color if not set.
- void Show(base::Optional<SkColor> highlight_color);
+ void Show(absl::optional<SkColor> highlight_color);
// Starts a fade-out animation. A no-op if the fade-out animation is
// currently in progress or not shown.
@@ -199,10 +199,10 @@
// influences the alpha channel). Returns no value if there is no such color
// and we should use the default text color / paint no border / paint no
// background / use the default ink-drop base color.
- base::Optional<SkColor> GetTextColor() const;
- base::Optional<SkColor> GetBorderColor() const;
- base::Optional<SkColor> GetBackgroundColor() const;
- base::Optional<SkColor> GetInkDropBaseColor() const;
+ absl::optional<SkColor> GetTextColor() const;
+ absl::optional<SkColor> GetBorderColor() const;
+ absl::optional<SkColor> GetBackgroundColor() const;
+ absl::optional<SkColor> GetInkDropBaseColor() const;
void AnimationEnded(const gfx::Animation* animation) override;
void AnimationProgressed(const gfx::Animation* animation) override;
@@ -221,7 +221,7 @@
// A highlight color is used to signal special states. When set this color
// is used as a base for background, text, border and ink drops. When not
// set, uses the default ToolbarButton ink drop.
- base::Optional<SkColor> highlight_color_;
+ absl::optional<SkColor> highlight_color_;
// Animation for showing the highlight color (in border, text, and
// background) when it becomes non-empty and hiding it when it becomes empty
@@ -285,13 +285,13 @@
// Vector icons for the ToolbarButton. The icon is chosen based on touch-ui.
// Reacts to theme changes using default colors.
- base::Optional<VectorIcons> vector_icons_;
+ absl::optional<VectorIcons> vector_icons_;
// Layout insets to use. This is used when the ToolbarButton is not actually
// hosted inside the toolbar. If not supplied,
// |GetLayoutInsets(TOOLBAR_BUTTON)| is used instead which is not appropriate
// outside the toolbar.
- base::Optional<gfx::Insets> layout_insets_;
+ absl::optional<gfx::Insets> layout_insets_;
// Delta from regular toolbar-button insets. This is necessary for buttons
// that use smaller or larger icons than regular ToolbarButton instances.
@@ -314,7 +314,7 @@
// If either |last_border_color_| or |last_paint_insets_| have changed since
// the last update to |border_| it must be recalculated to match current
// values.
- base::Optional<SkColor> last_border_color_;
+ absl::optional<SkColor> last_border_color_;
gfx::Insets last_paint_insets_;
base::CallbackListSubscription subscription_ =
@@ -327,7 +327,7 @@
};
BEGIN_VIEW_BUILDER(CHROME_VIEWS_EXPORT, ToolbarButton, views::LabelButton)
-VIEW_BUILDER_PROPERTY(base::Optional<gfx::Insets>, LayoutInsets)
+VIEW_BUILDER_PROPERTY(absl::optional<gfx::Insets>, LayoutInsets)
END_VIEW_BUILDER
DEFINE_VIEW_BUILDER(CHROME_VIEWS_EXPORT, ToolbarButton)
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button_unittest.cc b/chrome/browser/ui/views/toolbar/toolbar_button_unittest.cc
index ac738a3..a54c3ae2 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_button_unittest.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_button_unittest.cc
@@ -37,7 +37,7 @@
const gfx::Insets layout_inset_delta() const {
return button_->layout_inset_delta_;
}
- const base::Optional<SkColor> last_border_color() const {
+ const absl::optional<SkColor> last_border_color() const {
return button_->last_border_color_;
}
void SetAnimationTimingForTesting() {
diff --git a/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.h b/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.h
index 27a15bd6..c7282d3 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.h
+++ b/chrome/browser/ui/views/toolbar/toolbar_icon_container_view.h
@@ -115,7 +115,7 @@
// Override for the icon color. If not set, |COLOR_TOOLBAR_BUTTON_ICON| is
// used.
- base::Optional<SkColor> icon_color_;
+ absl::optional<SkColor> icon_color_;
// Points to the child buttons that we know are currently highlighted.
// TODO(pbos): Consider observing buttons leaving our hierarchy and removing
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc
index 5b64231..a57538f 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -460,7 +460,7 @@
bool show_stay_in_chrome,
bool show_remember_selection,
PageActionIconType icon_type,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
IntentPickerResponse callback) {
PageActionIconView* const intent_picker_view =
GetPageActionIconView(icon_type);
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.h b/chrome/browser/ui/views/toolbar/toolbar_view.h
index a672a86..cfface6 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_view.h
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.h
@@ -9,7 +9,6 @@
#include <vector>
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/command_observer.h"
@@ -25,6 +24,7 @@
#include "chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model.h"
#include "chrome/browser/upgrade_detector/upgrade_observer.h"
#include "components/prefs/pref_member.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/pointer/touch_ui_controller.h"
@@ -125,7 +125,7 @@
bool show_stay_in_chrome,
bool show_remember_selection,
PageActionIconType icon_type,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
IntentPickerResponse callback);
// Shows a bookmark bubble and anchors it appropriately.
diff --git a/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc b/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc
index 7ae0adb1..c27608e5 100644
--- a/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc
+++ b/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc
@@ -142,7 +142,7 @@
native_window_->RemovePreTargetHandler(this);
}
- const base::Optional<gfx::Point>& last_interaction_location() const {
+ const absl::optional<gfx::Point>& last_interaction_location() const {
return last_interaction_location_;
}
@@ -174,7 +174,7 @@
}
}
- base::Optional<gfx::Point> last_interaction_location_;
+ absl::optional<gfx::Point> last_interaction_location_;
gfx::NativeWindow native_window_;
base::ScopedObservation<views::Widget, views::WidgetObserver>
scoped_widget_observation_{this};
@@ -220,8 +220,8 @@
int GetDisappearingLabelTargetPosition() const;
int GetBorderStartingY() const;
- base::Optional<int> last_num_tabs_;
- base::Optional<int> pending_num_tabs_ = 0;
+ absl::optional<int> last_num_tabs_;
+ absl::optional<int> pending_num_tabs_ = 0;
bool pending_throbber_ = false;
TabCounterAnimationType current_animation_ = TabCounterAnimationType::kNone;
diff --git a/chrome/browser/ui/views/user_education/feature_promo_bubble_owner.h b/chrome/browser/ui/views/user_education/feature_promo_bubble_owner.h
index 1aadb84..52f011e 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_bubble_owner.h
+++ b/chrome/browser/ui/views/user_education/feature_promo_bubble_owner.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_FEATURE_PROMO_BUBBLE_OWNER_H_
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "base/token.h"
#include "chrome/browser/ui/views/user_education/feature_promo_bubble_view.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Manages display of a user education bubble. Notifies a client when the bubble
// is closed. Ensures only one bubble shows per instance. This is an interface
@@ -26,7 +26,7 @@
// identifies the bubble for CloseBubble or BubbleIsShowing calls. Fails and
// returns nothing if a bubble is currently showing or the bubble couldn't be
// created for other reasons.
- virtual base::Optional<base::Token> ShowBubble(
+ virtual absl::optional<base::Token> ShowBubble(
FeaturePromoBubbleView::CreateParams params,
base::OnceClosure close_callback) = 0;
diff --git a/chrome/browser/ui/views/user_education/feature_promo_bubble_owner_impl.cc b/chrome/browser/ui/views/user_education/feature_promo_bubble_owner_impl.cc
index 99bfa50f..3ce36077 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_bubble_owner_impl.cc
+++ b/chrome/browser/ui/views/user_education/feature_promo_bubble_owner_impl.cc
@@ -5,9 +5,9 @@
#include "chrome/browser/ui/views/user_education/feature_promo_bubble_owner_impl.h"
#include "base/callback.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/token.h"
#include "chrome/browser/ui/views/user_education/feature_promo_bubble_view.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/widget/widget.h"
FeaturePromoBubbleOwnerImpl::FeaturePromoBubbleOwnerImpl() = default;
@@ -19,11 +19,11 @@
return instance.get();
}
-base::Optional<base::Token> FeaturePromoBubbleOwnerImpl::ShowBubble(
+absl::optional<base::Token> FeaturePromoBubbleOwnerImpl::ShowBubble(
FeaturePromoBubbleView::CreateParams params,
base::OnceClosure close_callback) {
if (bubble_)
- return base::nullopt;
+ return absl::nullopt;
DCHECK(!bubble_id_);
DCHECK(!close_callback_);
@@ -72,6 +72,6 @@
void FeaturePromoBubbleOwnerImpl::HandleBubbleClosed() {
widget_observation_.Reset();
bubble_ = nullptr;
- bubble_id_ = base::nullopt;
+ bubble_id_ = absl::nullopt;
std::move(close_callback_).Run();
}
diff --git a/chrome/browser/ui/views/user_education/feature_promo_bubble_owner_impl.h b/chrome/browser/ui/views/user_education/feature_promo_bubble_owner_impl.h
index 1f02aa5..f2143ac 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_bubble_owner_impl.h
+++ b/chrome/browser/ui/views/user_education/feature_promo_bubble_owner_impl.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_FEATURE_PROMO_BUBBLE_OWNER_IMPL_H_
#define CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_FEATURE_PROMO_BUBBLE_OWNER_IMPL_H_
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/token.h"
#include "chrome/browser/ui/views/user_education/feature_promo_bubble_owner.h"
#include "chrome/browser/ui/views/user_education/feature_promo_bubble_view.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/widget/widget_observer.h"
// FeaturePromoBubbleOwner that creates a production FeaturePromoBubbleView.
@@ -24,7 +24,7 @@
FeaturePromoBubbleView* bubble_for_testing() { return bubble_; }
// FeaturePromoBubbleOwner:
- base::Optional<base::Token> ShowBubble(
+ absl::optional<base::Token> ShowBubble(
FeaturePromoBubbleView::CreateParams params,
base::OnceClosure close_callback) override;
bool BubbleIsShowing(base::Token bubble_id) override;
@@ -43,7 +43,7 @@
FeaturePromoBubbleView* bubble_ = nullptr;
// ID of the currently showing bubble. Must be nullopt if `bubble_` is null.
- base::Optional<base::Token> bubble_id_;
+ absl::optional<base::Token> bubble_id_;
// Called when `bubble_` closes.
base::OnceClosure close_callback_;
diff --git a/chrome/browser/ui/views/user_education/feature_promo_bubble_params.h b/chrome/browser/ui/views/user_education/feature_promo_bubble_params.h
index a309675..b4dda25 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_bubble_params.h
+++ b/chrome/browser/ui/views/user_education/feature_promo_bubble_params.h
@@ -8,8 +8,8 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/views/bubble/bubble_border.h"
@@ -38,10 +38,10 @@
std::u16string body_text_raw;
// Title shown larger at top of bubble. Optional.
- base::Optional<int> title_string_specifier;
+ absl::optional<int> title_string_specifier;
// String to be announced when bubble is shown. Optional.
- base::Optional<int> screenreader_string_specifier;
+ absl::optional<int> screenreader_string_specifier;
// A keyboard accelerator to access the feature. If
// |screenreader_string_specifier| is set and contains a placeholder,
@@ -50,8 +50,8 @@
// One of |feature_accelerator| or |feature_command_id|, or neither,
// can be filled in. If |feature_command_id| is specified this ID is
// looked up on BrowserView and the associated accelerator is fetched.
- base::Optional<ui::Accelerator> feature_accelerator;
- base::Optional<int> feature_command_id;
+ absl::optional<ui::Accelerator> feature_accelerator;
+ absl::optional<int> feature_command_id;
// Positioning and sizing:
@@ -64,7 +64,7 @@
// If set, determines the width of the bubble. Prefer the default if
// possible.
- base::Optional<int> preferred_width;
+ absl::optional<int> preferred_width;
// Determines if this bubble can be focused. If true, it will get
// focused on creation.
@@ -81,8 +81,8 @@
bool allow_snooze = false;
// Changes the bubble timeout. Intended for tests, avoid use.
- base::Optional<base::TimeDelta> timeout_default;
- base::Optional<base::TimeDelta> timeout_short;
+ absl::optional<base::TimeDelta> timeout_default;
+ absl::optional<base::TimeDelta> timeout_short;
};
#endif // CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_FEATURE_PROMO_BUBBLE_PARAMS_H_
diff --git a/chrome/browser/ui/views/user_education/feature_promo_bubble_view.h b/chrome/browser/ui/views/user_education/feature_promo_bubble_view.h
index ab90d53f..e5234c9 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_bubble_view.h
+++ b/chrome/browser/ui/views/user_education/feature_promo_bubble_view.h
@@ -8,9 +8,9 @@
#include <cstddef>
#include <memory>
-#include "base/optional.h"
#include "chrome/browser/ui/views/user_education/feature_promo_bubble_params.h"
#include "chrome/browser/ui/views/user_education/feature_promo_bubble_timeout.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
@@ -59,24 +59,24 @@
views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_LEFT;
std::u16string body_text;
- base::Optional<std::u16string> title_text;
- base::Optional<std::u16string> screenreader_text;
+ absl::optional<std::u16string> title_text;
+ absl::optional<std::u16string> screenreader_text;
std::vector<ButtonParams> buttons;
- base::Optional<int> preferred_width;
+ absl::optional<int> preferred_width;
bool focusable = false;
bool persist_on_blur = false;
// Determines how progress indicators for tutorials will be rendered. If not
// provided, no progress indicator will be visible.
- base::Optional<int> tutorial_progress_current;
- base::Optional<int> tutorial_progress_max;
+ absl::optional<int> tutorial_progress_current;
+ absl::optional<int> tutorial_progress_max;
// Changes the bubble timeout. Intended for tests, avoid use.
- base::Optional<base::TimeDelta> timeout_default;
- base::Optional<base::TimeDelta> timeout_short;
+ absl::optional<base::TimeDelta> timeout_default;
+ absl::optional<base::TimeDelta> timeout_short;
};
// NOTE: Please read comment above class. This method shouldn't be
@@ -120,7 +120,7 @@
std::u16string accessible_name_;
- base::Optional<int> preferred_width_;
+ absl::optional<int> preferred_width_;
std::unique_ptr<FeaturePromoBubbleTimeout> feature_promo_bubble_timeout_;
};
diff --git a/chrome/browser/ui/views/user_education/feature_promo_controller_views.cc b/chrome/browser/ui/views/user_education/feature_promo_controller_views.cc
index 0583f6b..3f9edac 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_controller_views.cc
+++ b/chrome/browser/ui/views/user_education/feature_promo_controller_views.cc
@@ -9,7 +9,6 @@
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/token.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -24,6 +23,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/feature_engagement/public/tracker.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/style/platform_style.h"
#include "ui/views/view.h"
@@ -72,14 +72,14 @@
return MaybeShowPromoImpl(iph_feature, params, std::move(close_callback));
}
-base::Optional<base::Token> FeaturePromoControllerViews::ShowCriticalPromo(
+absl::optional<base::Token> FeaturePromoControllerViews::ShowCriticalPromo(
const FeaturePromoBubbleParams& params) {
if (promos_blocked_for_testing_)
- return base::nullopt;
+ return absl::nullopt;
// Don't preempt an existing critical promo.
if (current_critical_promo_)
- return base::nullopt;
+ return absl::nullopt;
// If a normal bubble is showing, close it. If the promo is has
// continued after a CloseBubbleAndContinuePromo() call, we can't stop
@@ -118,7 +118,7 @@
const base::Feature& iph_feature,
FeaturePromoTextReplacements text_replacements,
BubbleCloseCallback close_callback) {
- base::Optional<FeaturePromoBubbleParams> params =
+ absl::optional<FeaturePromoBubbleParams> params =
FeaturePromoRegistry::GetInstance()->GetParamsForFeature(iph_feature,
browser_view_);
if (!params)
@@ -165,7 +165,7 @@
DCHECK_EQ(&iph_feature, current_iph_feature_);
DCHECK(bubble_id_);
- bubble_owner_->CloseBubble(*std::exchange(bubble_id_, base::nullopt));
+ bubble_owner_->CloseBubble(*std::exchange(bubble_id_, absl::nullopt));
if (anchor_view_tracker_.view())
anchor_view_tracker_.view()->SetProperty(kHasInProductHelpPromoKey, false);
@@ -329,7 +329,7 @@
DCHECK_NE(current_iph_feature_ != nullptr,
current_critical_promo_.has_value());
- bubble_id_ = base::nullopt;
+ bubble_id_ = absl::nullopt;
if (anchor_view_tracker_.view())
anchor_view_tracker_.view()->SetProperty(kHasInProductHelpPromoKey, false);
@@ -341,6 +341,6 @@
tracker_->Dismissed(*current_iph_feature_);
current_iph_feature_ = nullptr;
} else {
- current_critical_promo_ = base::nullopt;
+ current_critical_promo_ = absl::nullopt;
}
}
diff --git a/chrome/browser/ui/views/user_education/feature_promo_controller_views.h b/chrome/browser/ui/views/user_education/feature_promo_controller_views.h
index 9a706f2..2281941 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_controller_views.h
+++ b/chrome/browser/ui/views/user_education/feature_promo_controller_views.h
@@ -9,11 +9,11 @@
#include "base/cancelable_callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/token.h"
#include "chrome/browser/ui/user_education/feature_promo_controller.h"
#include "chrome/browser/ui/views/user_education/feature_promo_bubble_owner.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/view_tracker.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h"
@@ -64,7 +64,7 @@
//
// Returns an ID that can be passed to CloseBubbleForCriticalPromo()
// if successful. This can fail if another critical promo is showing.
- base::Optional<base::Token> ShowCriticalPromo(
+ absl::optional<base::Token> ShowCriticalPromo(
const FeaturePromoBubbleParams& params);
// Ends a promo started by ShowCriticalPromo() if it's still showing.
@@ -130,14 +130,14 @@
const base::Feature* current_iph_feature_ = nullptr;
// Bubble ID from `bubble_owner_`, if a bubble is showing.
- base::Optional<base::Token> bubble_id_;
+ absl::optional<base::Token> bubble_id_;
// Has a value if a critical promo is showing. If this has a value,
// |current_iph_feature_| will usually be null. There is one edge case
// where this may not be true: when a critical promo is requested
// between a normal promo's CloseBubbleAndContinuePromo() call and its
// end.
- base::Optional<base::Token> current_critical_promo_;
+ absl::optional<base::Token> current_critical_promo_;
// If present, called when |current_iph_feature_|'s bubble stops
// showing. Only valid if |current_iph_feature_| and |promo_bubble_|
diff --git a/chrome/browser/ui/views/user_education/feature_promo_controller_views_unittest.cc b/chrome/browser/ui/views/user_education/feature_promo_controller_views_unittest.cc
index d0151eb2..ca9ededf 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_controller_views_unittest.cc
+++ b/chrome/browser/ui/views/user_education/feature_promo_controller_views_unittest.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/feature_list.h"
-#include "base/optional.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
@@ -27,6 +26,7 @@
#include "chrome/test/base/testing_profile.h"
#include "components/feature_engagement/test/mock_tracker.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/bubble/bubble_border.h"
#include "ui/views/test/widget_test.h"
@@ -249,7 +249,7 @@
// bubble, but doesn't yet tell the backend the promo finished.
EXPECT_CALL(close_callback, Run()).Times(1);
- base::Optional<FeaturePromoController::PromoHandle> promo_handle =
+ absl::optional<FeaturePromoController::PromoHandle> promo_handle =
controller_->CloseBubbleAndContinuePromo(kTestIPHFeature);
EXPECT_FALSE(controller_->BubbleIsShowing(kTestIPHFeature));
EXPECT_FALSE(
@@ -372,7 +372,7 @@
}
TEST_F(FeaturePromoControllerViewsTest, CloseBubbleForCriticalPromo) {
- base::Optional<base::Token> maybe_id =
+ absl::optional<base::Token> maybe_id =
controller_->ShowCriticalPromo(DefaultBubbleParams());
ASSERT_TRUE(maybe_id);
base::Token id = maybe_id.value();
@@ -385,7 +385,7 @@
TEST_F(FeaturePromoControllerViewsTest,
CloseBubbleForCriticalPromoDoesNothingAfterClose) {
- base::Optional<base::Token> maybe_id =
+ absl::optional<base::Token> maybe_id =
controller_->ShowCriticalPromo(DefaultBubbleParams());
ASSERT_TRUE(maybe_id);
base::Token id = maybe_id.value();
@@ -406,7 +406,7 @@
}
TEST_F(FeaturePromoControllerViewsTest, ShowNewCriticalPromoAfterClose) {
- base::Optional<base::Token> maybe_id =
+ absl::optional<base::Token> maybe_id =
controller_->ShowCriticalPromo(DefaultBubbleParams());
ASSERT_TRUE(maybe_id);
base::Token id = maybe_id.value();
diff --git a/chrome/browser/ui/views/user_education/feature_promo_registry.cc b/chrome/browser/ui/views/user_education/feature_promo_registry.cc
index 455321e..917365a 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_registry.cc
+++ b/chrome/browser/ui/views/user_education/feature_promo_registry.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/views/user_education/feature_promo_registry.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "build/buildflag.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
@@ -26,6 +25,7 @@
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/feature_engagement/public/feature_constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/accelerators/accelerator.h"
#if BUILDFLAG(ENABLE_WEBUI_TAB_STRIP)
@@ -112,7 +112,7 @@
return instance.get();
}
-base::Optional<FeaturePromoBubbleParams>
+absl::optional<FeaturePromoBubbleParams>
FeaturePromoRegistry::GetParamsForFeature(const base::Feature& iph_feature,
BrowserView* browser_view) {
auto data_it = feature_promo_data_.find(&iph_feature);
@@ -121,7 +121,7 @@
views::View* const anchor_view =
data_it->second.get_anchor_view_callback.Run(browser_view);
if (!anchor_view)
- return base::nullopt;
+ return absl::nullopt;
FeaturePromoBubbleParams params = data_it->second.params;
params.anchor_view = anchor_view;
diff --git a/chrome/browser/ui/views/user_education/feature_promo_registry.h b/chrome/browser/ui/views/user_education/feature_promo_registry.h
index 27a70e9..54298e9 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_registry.h
+++ b/chrome/browser/ui/views/user_education/feature_promo_registry.h
@@ -8,8 +8,8 @@
#include <map>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/browser/ui/views/user_education/feature_promo_bubble_params.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class BrowserView;
@@ -42,7 +42,7 @@
// The params must be used immediately since it contains a View
// pointer that may become stale. This may return nothing in which
// case the promo shouldn't show.
- base::Optional<FeaturePromoBubbleParams> GetParamsForFeature(
+ absl::optional<FeaturePromoBubbleParams> GetParamsForFeature(
const base::Feature& iph_feature,
BrowserView* browser_view);
diff --git a/chrome/browser/ui/views/user_education/feature_promo_snooze_interactive_uitest.cc b/chrome/browser/ui/views/user_education/feature_promo_snooze_interactive_uitest.cc
index 7b20908f..fc9da2f 100644
--- a/chrome/browser/ui/views/user_education/feature_promo_snooze_interactive_uitest.cc
+++ b/chrome/browser/ui/views/user_education/feature_promo_snooze_interactive_uitest.cc
@@ -4,7 +4,6 @@
#include <memory>
-#include "base/optional.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
@@ -22,6 +21,7 @@
#include "content/public/test/browser_test.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/events/types/event_type.h"
@@ -114,9 +114,9 @@
void SetSnoozePrefs(const base::Feature& iph_feature,
bool is_dismissed,
- base::Optional<int> show_count,
+ absl::optional<int> show_count,
int snooze_count,
- base::Optional<base::Time> last_show_time,
+ absl::optional<base::Time> last_show_time,
base::Time last_snooze_time,
base::TimeDelta last_snooze_duration) {
FeaturePromoSnoozeService::SnoozeData data;
@@ -357,9 +357,9 @@
base::Time snooze_time = base::Time::Now() - snooze_duration;
SetSnoozePrefs(feature_engagement::kIPHDesktopTabGroupsNewGroupFeature,
/* is_dismiss */ false,
- /* show_count */ base::nullopt,
+ /* show_count */ absl::nullopt,
/* snooze_count */ 1,
- /* last_show_time */ base::nullopt,
+ /* last_show_time */ absl::nullopt,
/* last_snooze_time */ snooze_time,
/* last_snooze_duration */ snooze_duration);
diff --git a/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_browsertest.cc b/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_browsertest.cc
index 074ccaa..1ebed69 100644
--- a/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_browsertest.cc
+++ b/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_browsertest.cc
@@ -4,7 +4,6 @@
#include <cmath>
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "build/build_config.h"
@@ -38,6 +37,7 @@
#include "content/public/test/theme_change_waiter.h"
#include "extensions/test/test_extension_dir.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/controls/label.h"
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.cc b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.cc
index 25ca65c..85296a7 100644
--- a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.cc
+++ b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.cc
@@ -7,7 +7,6 @@
#include "base/base_paths.h"
#include "base/containers/flat_map.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/strings/pattern.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
@@ -50,6 +49,7 @@
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom-shared.h"
#include "third_party/re2/src/re2/re2.h"
@@ -158,7 +158,7 @@
WebAppIntegrationBrowserTestBase::~WebAppIntegrationBrowserTestBase() = default;
// static
-base::Optional<ProfileState>
+absl::optional<ProfileState>
WebAppIntegrationBrowserTestBase::GetStateForProfile(
StateSnapshot* state_snapshot,
Profile* profile) {
@@ -166,36 +166,36 @@
DCHECK(profile);
auto it = state_snapshot->profiles.find(profile);
return it == state_snapshot->profiles.end()
- ? base::nullopt
- : base::make_optional<ProfileState>(it->second);
+ ? absl::nullopt
+ : absl::make_optional<ProfileState>(it->second);
}
// static
-base::Optional<BrowserState>
+absl::optional<BrowserState>
WebAppIntegrationBrowserTestBase::GetStateForBrowser(
StateSnapshot* state_snapshot,
Profile* profile,
Browser* browser) {
- base::Optional<ProfileState> profile_state =
+ absl::optional<ProfileState> profile_state =
GetStateForProfile(state_snapshot, profile);
if (!profile_state) {
- return base::nullopt;
+ return absl::nullopt;
}
auto it = profile_state->browsers.find(browser);
return it == profile_state->browsers.end()
- ? base::nullopt
- : base::make_optional<BrowserState>(it->second);
+ ? absl::nullopt
+ : absl::make_optional<BrowserState>(it->second);
}
-base::Optional<AppState> WebAppIntegrationBrowserTestBase::GetAppByScope(
+absl::optional<AppState> WebAppIntegrationBrowserTestBase::GetAppByScope(
StateSnapshot* state_snapshot,
Profile* profile,
const std::string& action_param) {
- base::Optional<ProfileState> profile_state =
+ absl::optional<ProfileState> profile_state =
GetStateForProfile(state_snapshot, profile);
if (!profile_state) {
- return base::nullopt;
+ return absl::nullopt;
}
GURL scope = GetURLForScope(action_param);
@@ -206,37 +206,37 @@
});
return it == profile_state->apps.end()
- ? base::nullopt
- : base::make_optional<AppState>(it->second);
+ ? absl::nullopt
+ : absl::make_optional<AppState>(it->second);
}
// static
-base::Optional<TabState> WebAppIntegrationBrowserTestBase::GetStateForActiveTab(
+absl::optional<TabState> WebAppIntegrationBrowserTestBase::GetStateForActiveTab(
BrowserState browser_state) {
if (!browser_state.active_tab) {
- return base::nullopt;
+ return absl::nullopt;
}
auto it = browser_state.tabs.find(browser_state.active_tab);
DCHECK(it != browser_state.tabs.end());
- return base::make_optional<TabState>(it->second);
+ return absl::make_optional<TabState>(it->second);
}
// static
-base::Optional<AppState> WebAppIntegrationBrowserTestBase::GetStateForAppId(
+absl::optional<AppState> WebAppIntegrationBrowserTestBase::GetStateForAppId(
StateSnapshot* state_snapshot,
Profile* profile,
web_app::AppId id) {
- base::Optional<ProfileState> profile_state =
+ absl::optional<ProfileState> profile_state =
GetStateForProfile(state_snapshot, profile);
if (!profile_state) {
- return base::nullopt;
+ return absl::nullopt;
}
auto it = profile_state->apps.find(id);
return it == profile_state->apps.end()
- ? base::nullopt
- : base::make_optional<AppState>(it->second);
+ ? absl::nullopt
+ : absl::make_optional<AppState>(it->second);
}
// static
@@ -603,7 +603,7 @@
void WebAppIntegrationBrowserTestBase::LaunchInternal(
const std::string& action_param) {
- base::Optional<AppState> app_state =
+ absl::optional<AppState> app_state =
GetAppByScope(before_action_state_.get(), profile(), action_param);
ASSERT_TRUE(app_state.has_value())
<< "No app installed for scope: " << action_param;
@@ -665,7 +665,7 @@
void WebAppIntegrationBrowserTestBase::SetOpenInTabInternal(
const std::string& action_param) {
- base::Optional<AppState> app_state =
+ absl::optional<AppState> app_state =
GetAppByScope(before_action_state_.get(), profile(), action_param);
ASSERT_TRUE(app_state.has_value())
<< "No app installed for scope: " << action_param;
@@ -678,7 +678,7 @@
void WebAppIntegrationBrowserTestBase::SetOpenInWindowInternal(
const std::string& action_param) {
- base::Optional<AppState> app_state =
+ absl::optional<AppState> app_state =
GetAppByScope(before_action_state_.get(), profile(), action_param);
ASSERT_TRUE(app_state.has_value())
<< "No app installed for scope: " << action_param;
@@ -749,7 +749,7 @@
void WebAppIntegrationBrowserTestBase::UninstallInternal(
const std::string& action_param) {
- base::Optional<AppState> app_state =
+ absl::optional<AppState> app_state =
GetAppByScope(before_action_state_.get(), profile(), action_param);
ASSERT_TRUE(app_state.has_value())
<< "No app installed for scope: " << action_param;
@@ -786,7 +786,7 @@
// Assert Actions
void WebAppIntegrationBrowserTestBase::AssertAppNotLocallyInstalledInternal() {
DCHECK(after_action_state_);
- base::Optional<AppState> app_state =
+ absl::optional<AppState> app_state =
GetStateForAppId(after_action_state_.get(), profile(), active_app_id_);
ASSERT_TRUE(app_state.has_value());
EXPECT_FALSE(app_state->is_installed_locally);
@@ -795,17 +795,17 @@
void WebAppIntegrationBrowserTestBase::AssertAppNotInList(
const std::string& action_param) {
DCHECK(after_action_state_);
- base::Optional<AppState> app_state =
+ absl::optional<AppState> app_state =
GetAppByScope(after_action_state_.get(), profile(), action_param);
EXPECT_FALSE(app_state.has_value());
}
void WebAppIntegrationBrowserTestBase::AssertInstallable() {
DCHECK(after_action_state_);
- base::Optional<BrowserState> browser_state =
+ absl::optional<BrowserState> browser_state =
GetStateForBrowser(after_action_state_.get(), profile(), browser());
ASSERT_TRUE(browser_state.has_value());
- base::Optional<TabState> active_tab =
+ absl::optional<TabState> active_tab =
GetStateForActiveTab(browser_state.value());
ASSERT_TRUE(active_tab.has_value());
EXPECT_TRUE(active_tab->is_installable);
@@ -813,7 +813,7 @@
void WebAppIntegrationBrowserTestBase::AssertInstallIconShown() {
DCHECK(after_action_state_);
- base::Optional<BrowserState> browser_state =
+ absl::optional<BrowserState> browser_state =
GetStateForBrowser(after_action_state_.get(), profile(), browser());
ASSERT_TRUE(browser_state.has_value());
EXPECT_TRUE(browser_state->install_icon_shown);
@@ -821,7 +821,7 @@
}
void WebAppIntegrationBrowserTestBase::AssertInstallIconNotShown() {
- base::Optional<BrowserState> browser_state =
+ absl::optional<BrowserState> browser_state =
GetStateForBrowser(after_action_state_.get(), profile(), browser());
ASSERT_TRUE(browser_state.has_value());
EXPECT_FALSE(browser_state->install_icon_shown);
@@ -830,7 +830,7 @@
void WebAppIntegrationBrowserTestBase::AssertLaunchIconShown() {
DCHECK(after_action_state_);
- base::Optional<BrowserState> browser_state =
+ absl::optional<BrowserState> browser_state =
GetStateForBrowser(after_action_state_.get(), profile(), browser());
ASSERT_TRUE(browser_state.has_value());
EXPECT_TRUE(browser_state->launch_icon_shown);
@@ -838,7 +838,7 @@
void WebAppIntegrationBrowserTestBase::AssertLaunchIconNotShown() {
DCHECK(after_action_state_);
- base::Optional<BrowserState> browser_state =
+ absl::optional<BrowserState> browser_state =
GetStateForBrowser(after_action_state_.get(), profile(), browser());
ASSERT_TRUE(browser_state.has_value());
EXPECT_FALSE(browser_state->launch_icon_shown);
@@ -847,7 +847,7 @@
void WebAppIntegrationBrowserTestBase::AssertManifestDisplayModeInternal(
DisplayMode display_mode) {
DCHECK(after_action_state_);
- base::Optional<AppState> app_state =
+ absl::optional<AppState> app_state =
GetStateForAppId(after_action_state_.get(), profile(), active_app_id_);
ASSERT_TRUE(app_state.has_value());
EXPECT_EQ(display_mode, app_state->effective_display_mode);
@@ -856,16 +856,16 @@
void WebAppIntegrationBrowserTestBase::AssertTabCreated() {
DCHECK(before_action_state_);
DCHECK(after_action_state_);
- base::Optional<BrowserState> most_recent_browser_state =
+ absl::optional<BrowserState> most_recent_browser_state =
GetStateForBrowser(after_action_state_.get(), profile(), browser());
- base::Optional<BrowserState> previous_browser_state =
+ absl::optional<BrowserState> previous_browser_state =
GetStateForBrowser(before_action_state_.get(), profile(), browser());
ASSERT_TRUE(most_recent_browser_state.has_value());
ASSERT_TRUE(previous_browser_state.has_value());
EXPECT_GT(most_recent_browser_state->tabs.size(),
previous_browser_state->tabs.size());
- base::Optional<TabState> active_tab =
+ absl::optional<TabState> active_tab =
GetStateForActiveTab(most_recent_browser_state.value());
ASSERT_TRUE(active_tab.has_value());
}
@@ -873,7 +873,7 @@
void WebAppIntegrationBrowserTestBase::AssertUserDisplayModeInternal(
DisplayMode display_mode) {
DCHECK(after_action_state_);
- base::Optional<AppState> app_state =
+ absl::optional<AppState> app_state =
GetStateForAppId(after_action_state_.get(), profile(), active_app_id_);
ASSERT_TRUE(app_state.has_value());
EXPECT_EQ(display_mode, app_state->user_display_mode);
@@ -882,9 +882,9 @@
void WebAppIntegrationBrowserTestBase::AssertWindowClosed() {
DCHECK(before_action_state_);
DCHECK(after_action_state_);
- base::Optional<ProfileState> after_action_profile =
+ absl::optional<ProfileState> after_action_profile =
GetStateForProfile(after_action_state_.get(), profile());
- base::Optional<ProfileState> before_action_profile =
+ absl::optional<ProfileState> before_action_profile =
GetStateForProfile(before_action_state_.get(), profile());
ASSERT_TRUE(after_action_profile.has_value());
ASSERT_TRUE(before_action_profile.has_value());
@@ -895,9 +895,9 @@
void WebAppIntegrationBrowserTestBase::AssertWindowCreated() {
DCHECK(before_action_state_);
DCHECK(after_action_state_);
- base::Optional<ProfileState> after_action_profile =
+ absl::optional<ProfileState> after_action_profile =
GetStateForProfile(after_action_state_.get(), profile());
- base::Optional<ProfileState> before_action_profile =
+ absl::optional<ProfileState> before_action_profile =
GetStateForProfile(before_action_state_.get(), profile());
ASSERT_TRUE(after_action_profile.has_value());
ASSERT_TRUE(before_action_profile.has_value());
@@ -909,7 +909,7 @@
blink::mojom::DisplayMode display_mode) {
DCHECK(app_browser());
DCHECK(app_browser()->app_controller()->AsWebAppBrowserController());
- base::Optional<AppState> app_state =
+ absl::optional<AppState> app_state =
GetStateForAppId(after_action_state_.get(), profile(), active_app_id_);
ASSERT_TRUE(app_state.has_value());
@@ -997,7 +997,7 @@
void WebAppIntegrationBrowserTestBase::ForceUpdateManifestContents(
const std::string& app_scope,
GURL app_url_with_manifest_param) {
- base::Optional<AppState> app_state =
+ absl::optional<AppState> app_state =
GetAppByScope(before_action_state_.get(), profile(), app_scope);
ASSERT_TRUE(app_state.has_value());
auto app_id = app_state->id;
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.h b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.h
index bdb71ca..c938a4b 100644
--- a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.h
+++ b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.h
@@ -102,16 +102,16 @@
explicit WebAppIntegrationBrowserTestBase(TestDelegate* delegate);
~WebAppIntegrationBrowserTestBase();
- static base::Optional<ProfileState> GetStateForProfile(
+ static absl::optional<ProfileState> GetStateForProfile(
StateSnapshot* state_snapshot,
Profile* profile);
- static base::Optional<BrowserState> GetStateForBrowser(
+ static absl::optional<BrowserState> GetStateForBrowser(
StateSnapshot* state_snapshot,
Profile* profile,
Browser* browser);
- static base::Optional<TabState> GetStateForActiveTab(
+ static absl::optional<TabState> GetStateForActiveTab(
BrowserState browser_state);
- static base::Optional<AppState> GetStateForAppId(
+ static absl::optional<AppState> GetStateForAppId(
StateSnapshot* state_snapshot,
Profile* profile,
web_app::AppId id);
@@ -122,7 +122,7 @@
// * site_a/bar
// * site_b
// * site_c
- base::Optional<AppState> GetAppByScope(StateSnapshot* state_snapshot,
+ absl::optional<AppState> GetAppByScope(StateSnapshot* state_snapshot,
Profile* profile,
const std::string& scope);
diff --git a/chrome/browser/ui/views/web_apps/web_app_uninstall_dialog_browsertest.cc b/chrome/browser/ui/views/web_apps/web_app_uninstall_dialog_browsertest.cc
index 3e54525f..37de571 100644
--- a/chrome/browser/ui/views/web_apps/web_app_uninstall_dialog_browsertest.cc
+++ b/chrome/browser/ui/views/web_apps/web_app_uninstall_dialog_browsertest.cc
@@ -7,7 +7,6 @@
#include "base/barrier_closure.h"
#include "base/callback_helpers.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "build/chromeos_buildflags.h"
@@ -29,6 +28,7 @@
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_dialog_auto_confirm.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using web_app::AppId;
diff --git a/chrome/browser/ui/views/webauthn/authenticator_client_pin_entry_view.h b/chrome/browser/ui/views/webauthn/authenticator_client_pin_entry_view.h
index 339f6e9..f447b31 100644
--- a/chrome/browser/ui/views/webauthn/authenticator_client_pin_entry_view.h
+++ b/chrome/browser/ui/views/webauthn/authenticator_client_pin_entry_view.h
@@ -7,7 +7,7 @@
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/controls/textfield/textfield_controller.h"
#include "ui/views/view.h"
diff --git a/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.cc b/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.cc
index c54035a..ead8cc0 100644
--- a/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.cc
+++ b/chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.cc
@@ -51,7 +51,7 @@
explicit QRView(const std::string& qr_string) {
CHECK_LE(qr_string.size(), QRCodeGenerator::V5::kInputBytes);
- base::Optional<QRCode::GeneratedCode> code = qr_.Generate(
+ absl::optional<QRCode::GeneratedCode> code = qr_.Generate(
base::as_bytes(base::make_span(qr_string)), kMinimumQRVersion);
DCHECK(code);
// The QR Encoder supports dynamic sizing but we expect our data to fit in
@@ -68,7 +68,7 @@
CHECK_LE(qr_string.size(), QRCodeGenerator::V5::kInputBytes);
state_ = (state_ + 1) % 6;
- base::Optional<QRCode::GeneratedCode> code =
+ absl::optional<QRCode::GeneratedCode> code =
qr_.Generate(base::as_bytes(base::make_span(qr_string)),
kMinimumQRVersion, /*mask=*/state_);
DCHECK(code);
diff --git a/chrome/browser/ui/views/webauthn/hover_list_view.h b/chrome/browser/ui/views/webauthn/hover_list_view.h
index efcf12db..968ede0f 100644
--- a/chrome/browser/ui/views/webauthn/hover_list_view.h
+++ b/chrome/browser/ui/views/webauthn/hover_list_view.h
@@ -9,8 +9,8 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "chrome/browser/ui/webauthn/hover_list_model.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/view.h"
@@ -77,7 +77,7 @@
std::unique_ptr<HoverListModel> model_;
std::map<int, ListItemViews> tags_to_list_item_views_;
std::vector<WebAuthnHoverButton*> throbber_views_;
- base::Optional<ListItemViews> placeholder_list_item_view_;
+ absl::optional<ListItemViews> placeholder_list_item_view_;
views::ScrollView* scroll_view_;
views::View* item_container_;
// is_two_line_list_, if true, indicates that list items should be sized so
diff --git a/chrome/browser/ui/views/webauthn/webauthn_icon_interactive_uitest.cc b/chrome/browser/ui/views/webauthn/webauthn_icon_interactive_uitest.cc
index f51f2ba..a2932b4 100644
--- a/chrome/browser/ui/views/webauthn/webauthn_icon_interactive_uitest.cc
+++ b/chrome/browser/ui/views/webauthn/webauthn_icon_interactive_uitest.cc
@@ -81,8 +81,8 @@
virtual_device_factory->SetCtap2Config(std::move(config));
virtual_device_factory->mutable_state()->InjectResidentKey(
std::vector<uint8_t>{1, 2, 3, 4}, "www.example.com",
- std::vector<uint8_t>{6, 7, 8, 9}, /*user_name=*/base::nullopt,
- /*user_display_name=*/base::nullopt);
+ std::vector<uint8_t>{6, 7, 8, 9}, /*user_name=*/absl::nullopt,
+ /*user_display_name=*/absl::nullopt);
virtual_device_factory->mutable_state()->fingerprints_enrolled = true;
PageActionIconView* webauthn_icon =
BrowserView::GetBrowserViewForBrowser(browser())
diff --git a/chrome/browser/ui/views/webid/webid_signin_page_view.cc b/chrome/browser/ui/views/webid/webid_signin_page_view.cc
index c3d3240..ed804e8d 100644
--- a/chrome/browser/ui/views/webid/webid_signin_page_view.cc
+++ b/chrome/browser/ui/views/webid/webid_signin_page_view.cc
@@ -171,7 +171,7 @@
// progress.
if (progress >= 1) {
// hide the progress bar
- dialog_->GetBubbleFrameView()->SetProgress(base::nullopt);
+ dialog_->GetBubbleFrameView()->SetProgress(absl::nullopt);
return;
}
dialog_->GetBubbleFrameView()->SetProgress(progress);
diff --git a/chrome/browser/ui/web_applications/app_browser_controller.cc b/chrome/browser/ui/web_applications/app_browser_controller.cc
index a939ba2..e9a68d2 100644
--- a/chrome/browser/ui/web_applications/app_browser_controller.cc
+++ b/chrome/browser/ui/web_applications/app_browser_controller.cc
@@ -90,7 +90,7 @@
SkColor GetAltColor(SkColor color) {
return color_utils::BlendForMinContrast(
- color, color, base::nullopt,
+ color, color, absl::nullopt,
kAutogeneratedThemeActiveTabPreferredContrast)
.color;
}
@@ -160,7 +160,7 @@
AppBrowserController::AppBrowserController(
Browser* browser,
- base::Optional<web_app::AppId> app_id)
+ absl::optional<web_app::AppId> app_id)
: content::WebContentsObserver(nullptr),
app_id_(std::move(app_id)),
browser_(browser),
@@ -169,7 +169,7 @@
system_app_type_(HasAppId() ? WebAppProvider::Get(browser->profile())
->system_web_app_manager()
.GetSystemAppTypeForAppId(GetAppId())
- : base::nullopt),
+ : absl::nullopt),
has_tab_strip_(
(system_app_type_.has_value() &&
WebAppProvider::Get(browser->profile())
@@ -413,27 +413,27 @@
UpdateThemePack();
}
-base::Optional<SkColor> AppBrowserController::GetThemeColor() const {
- base::Optional<SkColor> result;
+absl::optional<SkColor> AppBrowserController::GetThemeColor() const {
+ absl::optional<SkColor> result;
// HTML meta theme-color tag overrides manifest theme_color, see spec:
// https://www.w3.org/TR/appmanifest/#theme_color-member
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
if (web_contents) {
- base::Optional<SkColor> color = web_contents->GetThemeColor();
+ absl::optional<SkColor> color = web_contents->GetThemeColor();
if (color)
result = color;
}
if (!result)
- return base::nullopt;
+ return absl::nullopt;
// The frame/tabstrip code expects an opaque color.
return SkColorSetA(*result, SK_AlphaOPAQUE);
}
-base::Optional<SkColor> AppBrowserController::GetBackgroundColor() const {
- base::Optional<SkColor> color;
+absl::optional<SkColor> AppBrowserController::GetBackgroundColor() const {
+ absl::optional<SkColor> color;
if (auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents())
color = web_contents->GetBackgroundColor();
return color ? SkColorSetA(*color, SK_AlphaOPAQUE) : color;
@@ -563,12 +563,12 @@
}
void AppBrowserController::UpdateThemePack() {
- base::Optional<SkColor> theme_color = GetThemeColor();
+ absl::optional<SkColor> theme_color = GetThemeColor();
AutogeneratedThemeColors colors;
// TODO(crbug.com/1053823): Add tests for theme properties being set in this
// branch.
- base::Optional<SkColor> background_color = GetBackgroundColor();
+ absl::optional<SkColor> background_color = GetBackgroundColor();
if (theme_color == last_theme_color_ &&
background_color == last_background_color_) {
return;
diff --git a/chrome/browser/ui/web_applications/app_browser_controller.h b/chrome/browser/ui/web_applications/app_browser_controller.h
index ef9953c..f1b9497b 100644
--- a/chrome/browser/ui/web_applications/app_browser_controller.h
+++ b/chrome/browser/ui/web_applications/app_browser_controller.h
@@ -9,7 +9,6 @@
#include <string>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/ui/page_action/page_action_icon_type.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
@@ -17,6 +16,7 @@
#include "components/url_formatter/url_formatter.h"
#include "components/webapps/browser/installable/installable_metrics.h"
#include "content/public/browser/web_contents_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkRegion.h"
@@ -108,10 +108,10 @@
virtual gfx::ImageSkia GetWindowIcon() const = 0;
// Returns the color of the title bar.
- virtual base::Optional<SkColor> GetThemeColor() const;
+ virtual absl::optional<SkColor> GetThemeColor() const;
// Returns the background color of the page.
- virtual base::Optional<SkColor> GetBackgroundColor() const;
+ virtual absl::optional<SkColor> GetBackgroundColor() const;
// Returns the title to be displayed in the window title bar.
virtual std::u16string GetTitle() const;
@@ -157,7 +157,7 @@
bool is_for_system_web_app() const { return system_app_type_.has_value(); }
// Returns the SystemAppType for this controller.
- const base::Optional<SystemAppType>& system_app_type() const {
+ const absl::optional<SystemAppType>& system_app_type() const {
return system_app_type_;
}
@@ -196,7 +196,7 @@
CustomThemeSupplier* GetThemeSupplier() const override;
void UpdateDraggableRegion(const SkRegion& region);
- const base::Optional<SkRegion>& draggable_region() const {
+ const absl::optional<SkRegion>& draggable_region() const {
return draggable_region_;
}
@@ -204,7 +204,7 @@
protected:
explicit AppBrowserController(Browser* browser,
- base::Optional<web_app::AppId> app_id);
+ absl::optional<web_app::AppId> app_id);
// Called once the app browser controller has determined its initial url.
virtual void OnReceivedInitialURL();
@@ -222,20 +222,20 @@
void UpdateThemePack();
- const base::Optional<AppId> app_id_;
+ const absl::optional<AppId> app_id_;
Browser* const browser_;
GURL initial_url_;
scoped_refptr<BrowserThemePack> theme_pack_;
std::unique_ptr<ui::ThemeProvider> theme_provider_;
- base::Optional<SkColor> last_theme_color_;
- base::Optional<SkColor> last_background_color_;
+ absl::optional<SkColor> last_theme_color_;
+ absl::optional<SkColor> last_background_color_;
- base::Optional<SystemAppType> system_app_type_;
+ absl::optional<SystemAppType> system_app_type_;
const bool has_tab_strip_;
- base::Optional<SkRegion> draggable_region_ = base::nullopt;
+ absl::optional<SkRegion> draggable_region_ = absl::nullopt;
base::OnceClosure on_draggable_region_set_for_testing_;
};
diff --git a/chrome/browser/ui/web_applications/create_shortcut_browsertest.cc b/chrome/browser/ui/web_applications/create_shortcut_browsertest.cc
index c3f4706d..b9af6af6 100644
--- a/chrome/browser/ui/web_applications/create_shortcut_browsertest.cc
+++ b/chrome/browser/ui/web_applications/create_shortcut_browsertest.cc
@@ -77,7 +77,7 @@
NavigateToURLAndWait(browser(), url);
AppId app_id = InstallShortcutAppForCurrentUrl();
- base::Optional<int> install_source = GetIntWebAppPref(
+ absl::optional<int> install_source = GetIntWebAppPref(
profile()->GetPrefs(), app_id, kLatestWebAppInstallSource);
EXPECT_TRUE(install_source.has_value());
EXPECT_EQ(static_cast<webapps::WebappInstallSource>(*install_source),
diff --git a/chrome/browser/ui/web_applications/share_target_utils.cc b/chrome/browser/ui/web_applications/share_target_utils.cc
index 4b45e3c..8fe10e1 100644
--- a/chrome/browser/ui/web_applications/share_target_utils.cc
+++ b/chrome/browser/ui/web_applications/share_target_utils.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/web_applications/share_target_utils.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -19,6 +18,7 @@
#include "services/network/public/cpp/resource_request_body.h"
#include "storage/browser/file_system/file_system_context.h"
#include "storage/browser/file_system/file_system_url.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
#include "url/gurl.h"
diff --git a/chrome/browser/ui/web_applications/system_web_app_ui_utils.cc b/chrome/browser/ui/web_applications/system_web_app_ui_utils.cc
index 1445164..4ba2fe6 100644
--- a/chrome/browser/ui/web_applications/system_web_app_ui_utils.cc
+++ b/chrome/browser/ui/web_applications/system_web_app_ui_utils.cc
@@ -11,7 +11,6 @@
#include "base/check_op.h"
#include "base/debug/dump_without_crashing.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
@@ -34,6 +33,7 @@
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_launch/web_launch_files_helper.h"
#include "chrome/common/webui_url_constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/window_open_disposition.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
@@ -76,30 +76,30 @@
namespace web_app {
-base::Optional<SystemAppType> GetSystemWebAppTypeForAppId(Profile* profile,
+absl::optional<SystemAppType> GetSystemWebAppTypeForAppId(Profile* profile,
AppId app_id) {
auto* provider = WebAppProvider::Get(profile);
return provider ? provider->system_web_app_manager().GetSystemAppTypeForAppId(
app_id)
- : base::Optional<SystemAppType>();
+ : absl::optional<SystemAppType>();
}
-base::Optional<AppId> GetAppIdForSystemWebApp(Profile* profile,
+absl::optional<AppId> GetAppIdForSystemWebApp(Profile* profile,
SystemAppType app_type) {
auto* provider = WebAppProvider::Get(profile);
return provider
? provider->system_web_app_manager().GetAppIdForSystemApp(app_type)
- : base::Optional<AppId>();
+ : absl::optional<AppId>();
}
-base::Optional<apps::AppLaunchParams> CreateSystemWebAppLaunchParams(
+absl::optional<apps::AppLaunchParams> CreateSystemWebAppLaunchParams(
Profile* profile,
SystemAppType app_type,
int64_t display_id) {
- base::Optional<AppId> app_id = GetAppIdForSystemWebApp(profile, app_type);
+ absl::optional<AppId> app_id = GetAppIdForSystemWebApp(profile, app_type);
// TODO(calamity): Decide whether to report app launch failure or CHECK fail.
if (!app_id)
- return base::nullopt;
+ return absl::nullopt;
auto* provider = WebAppProvider::Get(profile);
DCHECK(provider);
@@ -170,7 +170,7 @@
return;
}
- const base::Optional<AppId> app_id =
+ const absl::optional<AppId> app_id =
GetAppIdForSystemWebApp(profile_for_launch, type);
if (!app_id)
return;
@@ -301,7 +301,7 @@
Browser::Type browser_type) {
// TODO(calamity): Determine whether, during startup, we need to wait for
// app install and then provide a valid answer here.
- base::Optional<AppId> app_id = GetAppIdForSystemWebApp(profile, app_type);
+ absl::optional<AppId> app_id = GetAppIdForSystemWebApp(profile, app_type);
if (!app_id)
return nullptr;
@@ -334,12 +334,12 @@
browser->app_controller()->system_app_type() == type;
}
-base::Optional<SystemAppType> GetCapturingSystemAppForURL(Profile* profile,
+absl::optional<SystemAppType> GetCapturingSystemAppForURL(Profile* profile,
const GURL& url) {
auto* provider = WebAppProvider::Get(profile);
if (!provider)
- return base::nullopt;
+ return absl::nullopt;
return provider->system_web_app_manager().GetCapturingSystemAppForURL(url);
}
diff --git a/chrome/browser/ui/web_applications/system_web_app_ui_utils.h b/chrome/browser/ui/web_applications/system_web_app_ui_utils.h
index 4e4be0f..9c7ac9a 100644
--- a/chrome/browser/ui/web_applications/system_web_app_ui_utils.h
+++ b/chrome/browser/ui/web_applications/system_web_app_ui_utils.h
@@ -5,13 +5,13 @@
#ifndef CHROME_BROWSER_UI_WEB_APPLICATIONS_SYSTEM_WEB_APP_UI_UTILS_H_
#define CHROME_BROWSER_UI_WEB_APPLICATIONS_SYSTEM_WEB_APP_UI_UTILS_H_
-#include "base/optional.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/system_web_apps/system_web_app_manager.h"
#include "components/services/app_service/public/mojom/types.mojom-shared.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class Profile;
@@ -19,14 +19,14 @@
namespace web_app {
// Returns the system app type for the given App ID.
-base::Optional<SystemAppType> GetSystemWebAppTypeForAppId(Profile* profile,
+absl::optional<SystemAppType> GetSystemWebAppTypeForAppId(Profile* profile,
AppId app_id);
// Returns the PWA system App ID for the given system app type.
-base::Optional<AppId> GetAppIdForSystemWebApp(Profile* profile,
+absl::optional<AppId> GetAppIdForSystemWebApp(Profile* profile,
SystemAppType app_type);
-base::Optional<apps::AppLaunchParams> CreateSystemWebAppLaunchParams(
+absl::optional<apps::AppLaunchParams> CreateSystemWebAppLaunchParams(
Profile* profile,
SystemAppType app_type,
int64_t display_id);
@@ -39,7 +39,7 @@
// If provided launches System Apps into |url|, instead of its start_url (as
// specified its WebApplicationInfo). Mutually exclusive with non-empty
// |launch_paths|.
- base::Optional<GURL> url;
+ absl::optional<GURL> url;
// Where the app is launched from.
apps::mojom::LaunchSource launch_source =
@@ -96,7 +96,7 @@
bool IsSystemWebApp(Browser* browser);
// Returns the SystemAppType that should capture the |url|.
-base::Optional<SystemAppType> GetCapturingSystemAppForURL(Profile* profile,
+absl::optional<SystemAppType> GetCapturingSystemAppForURL(Profile* profile,
const GURL& url);
// Returns whether the |browser| hosts the system app |type|.
diff --git a/chrome/browser/ui/web_applications/test/system_web_app_interactive_uitest.cc b/chrome/browser/ui/web_applications/test/system_web_app_interactive_uitest.cc
index 37c5755..3f24d713 100644
--- a/chrome/browser/ui/web_applications/test/system_web_app_interactive_uitest.cc
+++ b/chrome/browser/ui/web_applications/test/system_web_app_interactive_uitest.cc
@@ -519,7 +519,7 @@
SystemWebAppManager& manager =
web_app::WebAppProvider::Get(profile)->system_web_app_manager();
- base::Optional<AppId> app_id =
+ absl::optional<AppId> app_id =
manager.GetAppIdForSystemApp(installation_->GetType());
CHECK(app_id.has_value());
return *app_id;
diff --git a/chrome/browser/ui/web_applications/web_app_badging_browsertest.cc b/chrome/browser/ui/web_applications/web_app_badging_browsertest.cc
index fa82ebc..1a83cfe 100644
--- a/chrome/browser/ui/web_applications/web_app_badging_browsertest.cc
+++ b/chrome/browser/ui/web_applications/web_app_badging_browsertest.cc
@@ -138,7 +138,7 @@
BadgeChange set_badge_change;
set_badge_change.last_badge_content_ = set_app_badge.second;
set_badge_change.was_flagged_ =
- set_badge_change.last_badge_content_ == base::nullopt;
+ set_badge_change.last_badge_content_ == absl::nullopt;
const AppId& set_app_id = set_app_badge.first;
ASSERT_TRUE(badge_change_map_.find(set_app_id) ==
@@ -186,7 +186,7 @@
// then calls setAppBadge() with |badge_value|.
void SetBadgeInServiceWorkerAndWaitForChanges(
const GURL& service_worker_scope,
- base::Optional<uint64_t> badge_value,
+ absl::optional<uint64_t> badge_value,
size_t expected_badge_change_count) {
std::string message_data;
if (badge_value) {
@@ -241,7 +241,7 @@
struct BadgeChange {
bool was_cleared_ = false;
bool was_flagged_ = false;
- base::Optional<uint64_t> last_badge_content_ = base::nullopt;
+ absl::optional<uint64_t> last_badge_content_ = absl::nullopt;
};
// Records a single badge update for multiple apps.
@@ -298,7 +298,7 @@
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(main_app_id(), &badge_change));
ASSERT_FALSE(badge_change.was_cleared_);
ASSERT_FALSE(badge_change.was_flagged_);
- ASSERT_EQ(base::Optional<uint64_t>(99u), badge_change.last_badge_content_);
+ ASSERT_EQ(absl::optional<uint64_t>(99u), badge_change.last_badge_content_);
}
// Tests that calls to |Badge.clear| are propagated across processes.
@@ -309,13 +309,13 @@
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(main_app_id(), &badge_change));
ASSERT_FALSE(badge_change.was_cleared_);
ASSERT_FALSE(badge_change.was_flagged_);
- ASSERT_EQ(base::Optional<uint64_t>(55u), badge_change.last_badge_content_);
+ ASSERT_EQ(absl::optional<uint64_t>(55u), badge_change.last_badge_content_);
ExecuteScriptAndWaitForBadgeChange("navigator.clearAppBadge()", main_frame_);
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(main_app_id(), &badge_change));
ASSERT_TRUE(badge_change.was_cleared_);
ASSERT_FALSE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
}
// Tests that calling Badge.set(0) is equivalent to calling |Badge.clear| and
@@ -326,7 +326,7 @@
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(main_app_id(), &badge_change));
ASSERT_TRUE(badge_change.was_cleared_);
ASSERT_FALSE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
}
// Tests that setting the badge without content is propagated across processes.
@@ -336,7 +336,7 @@
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(main_app_id(), &badge_change));
ASSERT_FALSE(badge_change.was_cleared_);
ASSERT_TRUE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
}
// Tests that the badge can be set and cleared from an in scope frame.
@@ -348,14 +348,14 @@
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(main_app_id(), &badge_change));
ASSERT_FALSE(badge_change.was_cleared_);
ASSERT_TRUE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
ExecuteScriptAndWaitForBadgeChange("navigator.clearAppBadge()",
in_scope_frame_);
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(main_app_id(), &badge_change));
ASSERT_TRUE(badge_change.was_cleared_);
ASSERT_FALSE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
}
// Tests that changing the badge of a subframe with an app affects the
@@ -366,14 +366,14 @@
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(sub_app_id(), &badge_change));
ASSERT_FALSE(badge_change.was_cleared_);
ASSERT_TRUE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
ExecuteScriptAndWaitForBadgeChange("navigator.clearAppBadge()",
sub_app_frame_);
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(sub_app_id(), &badge_change));
ASSERT_TRUE(badge_change.was_cleared_);
ASSERT_FALSE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
}
// Tests that setting a badge on a subframe with an app only effects the sub
@@ -385,7 +385,7 @@
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(sub_app_id(), &badge_change));
ASSERT_FALSE(badge_change.was_cleared_);
ASSERT_TRUE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
}
// Tests that setting a badge on a subframe via call() craziness sets the
@@ -402,7 +402,7 @@
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(sub_app_id(), &badge_change));
ASSERT_FALSE(badge_change.was_cleared_);
ASSERT_TRUE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
}
// Test that badging through a service worker scoped to the sub app updates
@@ -425,7 +425,7 @@
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(sub_app_id(), &badge_change));
ASSERT_TRUE(badge_change.was_cleared_);
ASSERT_FALSE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
}
// Test that badging through a service worker scoped to the main app updates
@@ -434,30 +434,30 @@
IN_PROC_BROWSER_TEST_F(WebAppBadgingBrowserTest,
AppServiceWorkerBadgeAffectsMultipleApps) {
SetBadgeInServiceWorkerAndWaitForChanges(app_service_worker_scope_,
- base::nullopt,
+ absl::nullopt,
/*expected_badge_change_count=*/2);
BadgeChange badge_change;
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(main_app_id(), &badge_change));
ASSERT_FALSE(badge_change.was_cleared_);
ASSERT_TRUE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(sub_app_id(), &badge_change));
ASSERT_FALSE(badge_change.was_cleared_);
ASSERT_TRUE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
ClearBadgeInServiceWorkerAndWaitForChanges(app_service_worker_scope_,
/*expected_badge_change_count=*/2);
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(main_app_id(), &badge_change));
ASSERT_TRUE(badge_change.was_cleared_);
ASSERT_FALSE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
ASSERT_NO_FATAL_FAILURE(GetBadgeChange(sub_app_id(), &badge_change));
ASSERT_TRUE(badge_change.was_cleared_);
ASSERT_FALSE(badge_change.was_flagged_);
- ASSERT_EQ(base::nullopt, badge_change.last_badge_content_);
+ ASSERT_EQ(absl::nullopt, badge_change.last_badge_content_);
}
// Tests that badging incognito windows does not cause a crash.
diff --git a/chrome/browser/ui/web_applications/web_app_browser_controller.cc b/chrome/browser/ui/web_applications/web_app_browser_controller.cc
index b2d3a40..db0e6dd 100644
--- a/chrome/browser/ui/web_applications/web_app_browser_controller.cc
+++ b/chrome/browser/ui/web_applications/web_app_browser_controller.cc
@@ -139,12 +139,12 @@
return GetWindowAppIcon();
}
-base::Optional<SkColor> WebAppBrowserController::GetThemeColor() const {
+absl::optional<SkColor> WebAppBrowserController::GetThemeColor() const {
// System App popups (settings pages) always use default theme.
if (is_for_system_web_app() && browser()->is_type_app_popup())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<SkColor> web_theme_color =
+ absl::optional<SkColor> web_theme_color =
AppBrowserController::GetThemeColor();
if (web_theme_color)
return web_theme_color;
@@ -152,7 +152,7 @@
return registrar().GetAppThemeColor(GetAppId());
}
-base::Optional<SkColor> WebAppBrowserController::GetBackgroundColor() const {
+absl::optional<SkColor> WebAppBrowserController::GetBackgroundColor() const {
if (auto color = AppBrowserController::GetBackgroundColor())
return color;
return registrar().GetAppBackgroundColor(GetAppId());
@@ -285,7 +285,7 @@
asset_link_handler_ =
std::make_unique<digital_asset_links::DigitalAssetLinksHandler>(
browser->profile()->GetURLLoaderFactory());
- is_verified_ = base::nullopt;
+ is_verified_ = absl::nullopt;
if (!HasAppId())
return;
@@ -296,9 +296,9 @@
return;
const std::string origin = GetAppStartUrl().GetOrigin().spec();
- const base::Optional<std::string> package_name =
+ const absl::optional<std::string> package_name =
apk_web_app_service->GetPackageNameForWebApp(GetAppId());
- const base::Optional<std::string> fingerprint =
+ const absl::optional<std::string> fingerprint =
apk_web_app_service->GetCertificateSha256Fingerprint(GetAppId());
// Any web-only TWA should have an associated package name and fingerprint.
diff --git a/chrome/browser/ui/web_applications/web_app_browser_controller.h b/chrome/browser/ui/web_applications/web_app_browser_controller.h
index b20e9487..119bdd0 100644
--- a/chrome/browser/ui/web_applications/web_app_browser_controller.h
+++ b/chrome/browser/ui/web_applications/web_app_browser_controller.h
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
@@ -18,6 +17,7 @@
#include "chrome/browser/web_applications/components/app_registrar_observer.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "components/services/app_service/public/mojom/types.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/image/image_skia.h"
@@ -55,8 +55,8 @@
bool HasMinimalUiButtons() const override;
gfx::ImageSkia GetWindowAppIcon() const override;
gfx::ImageSkia GetWindowIcon() const override;
- base::Optional<SkColor> GetThemeColor() const override;
- base::Optional<SkColor> GetBackgroundColor() const override;
+ absl::optional<SkColor> GetThemeColor() const override;
+ absl::optional<SkColor> GetBackgroundColor() const override;
std::u16string GetTitle() const override;
std::u16string GetAppShortName() const override;
std::u16string GetFormattedUrlOrigin() const override;
@@ -102,12 +102,12 @@
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
WebAppProvider& provider_;
- mutable base::Optional<gfx::ImageSkia> app_icon_;
+ mutable absl::optional<gfx::ImageSkia> app_icon_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
// The result of digital asset link verification of the web app.
// Only used for web-only TWAs installed through the Play Store.
- base::Optional<bool> is_verified_;
+ absl::optional<bool> is_verified_;
std::unique_ptr<digital_asset_links::DigitalAssetLinksHandler>
asset_link_handler_;
diff --git a/chrome/browser/ui/web_applications/web_app_browsertest.cc b/chrome/browser/ui/web_applications/web_app_browsertest.cc
index 28d2a7e..bcdfebac 100644
--- a/chrome/browser/ui/web_applications/web_app_browsertest.cc
+++ b/chrome/browser/ui/web_applications/web_app_browsertest.cc
@@ -140,7 +140,7 @@
}
bool HasMinimalUiButtons(DisplayMode display_mode,
- base::Optional<DisplayMode> display_override_mode,
+ absl::optional<DisplayMode> display_override_mode,
bool open_as_window) {
static int index = 0;
@@ -219,12 +219,12 @@
auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info->start_url = GURL("http://example.org/2");
web_app_info->scope = GURL("http://example.org/");
- web_app_info->theme_color = base::Optional<SkColor>();
+ web_app_info->theme_color = absl::optional<SkColor>();
AppId app_id = InstallWebApp(std::move(web_app_info));
Browser* app_browser = LaunchWebAppBrowser(app_id);
EXPECT_EQ(GetAppIdFromApplicationName(app_browser->app_name()), app_id);
- EXPECT_EQ(base::nullopt, app_browser->app_controller()->GetThemeColor());
+ EXPECT_EQ(absl::nullopt, app_browser->app_controller()->GetThemeColor());
}
}
@@ -359,26 +359,26 @@
}
IN_PROC_BROWSER_TEST_F(WebAppBrowserTest, WithMinimalUiButtons) {
- EXPECT_TRUE(HasMinimalUiButtons(DisplayMode::kBrowser, base::nullopt,
+ EXPECT_TRUE(HasMinimalUiButtons(DisplayMode::kBrowser, absl::nullopt,
/*open_as_window=*/true));
- EXPECT_TRUE(HasMinimalUiButtons(DisplayMode::kMinimalUi, base::nullopt,
+ EXPECT_TRUE(HasMinimalUiButtons(DisplayMode::kMinimalUi, absl::nullopt,
/*open_as_window=*/true));
- EXPECT_TRUE(HasMinimalUiButtons(DisplayMode::kBrowser, base::nullopt,
+ EXPECT_TRUE(HasMinimalUiButtons(DisplayMode::kBrowser, absl::nullopt,
/*open_as_window=*/false));
- EXPECT_TRUE(HasMinimalUiButtons(DisplayMode::kMinimalUi, base::nullopt,
+ EXPECT_TRUE(HasMinimalUiButtons(DisplayMode::kMinimalUi, absl::nullopt,
/*open_as_window=*/false));
}
IN_PROC_BROWSER_TEST_F(WebAppBrowserTest, WithoutMinimalUiButtons) {
- EXPECT_FALSE(HasMinimalUiButtons(DisplayMode::kStandalone, base::nullopt,
+ EXPECT_FALSE(HasMinimalUiButtons(DisplayMode::kStandalone, absl::nullopt,
/*open_as_window=*/true));
- EXPECT_FALSE(HasMinimalUiButtons(DisplayMode::kFullscreen, base::nullopt,
+ EXPECT_FALSE(HasMinimalUiButtons(DisplayMode::kFullscreen, absl::nullopt,
/*open_as_window=*/true));
- EXPECT_FALSE(HasMinimalUiButtons(DisplayMode::kStandalone, base::nullopt,
+ EXPECT_FALSE(HasMinimalUiButtons(DisplayMode::kStandalone, absl::nullopt,
/*open_as_window=*/false));
- EXPECT_FALSE(HasMinimalUiButtons(DisplayMode::kFullscreen, base::nullopt,
+ EXPECT_FALSE(HasMinimalUiButtons(DisplayMode::kFullscreen, absl::nullopt,
/*open_as_window=*/false));
}
diff --git a/chrome/browser/ui/web_applications/web_app_controller_browsertest.cc b/chrome/browser/ui/web_applications/web_app_controller_browsertest.cc
index 94d4e2a..b3c4154 100644
--- a/chrome/browser/ui/web_applications/web_app_controller_browsertest.cc
+++ b/chrome/browser/ui/web_applications/web_app_controller_browsertest.cc
@@ -92,7 +92,7 @@
return new_browser;
}
-base::Optional<AppId> WebAppControllerBrowserTestBase::FindAppWithUrlInScope(
+absl::optional<AppId> WebAppControllerBrowserTestBase::FindAppWithUrlInScope(
const GURL& url) {
return provider().registrar().FindAppWithUrlInScope(url);
}
diff --git a/chrome/browser/ui/web_applications/web_app_controller_browsertest.h b/chrome/browser/ui/web_applications/web_app_controller_browsertest.h
index 588d4f2a..eef61f7 100644
--- a/chrome/browser/ui/web_applications/web_app_controller_browsertest.h
+++ b/chrome/browser/ui/web_applications/web_app_controller_browsertest.h
@@ -62,7 +62,7 @@
Browser* NavigateInNewWindowAndAwaitInstallabilityCheck(const GURL&);
- base::Optional<AppId> FindAppWithUrlInScope(const GURL& url);
+ absl::optional<AppId> FindAppWithUrlInScope(const GURL& url);
};
class WebAppControllerBrowserTest : public WebAppControllerBrowserTestBase {
diff --git a/chrome/browser/ui/web_applications/web_app_engagement_browsertest.cc b/chrome/browser/ui/web_applications/web_app_engagement_browsertest.cc
index b8cc4c8..e8cd051 100644
--- a/chrome/browser/ui/web_applications/web_app_engagement_browsertest.cc
+++ b/chrome/browser/ui/web_applications/web_app_engagement_browsertest.cc
@@ -225,7 +225,7 @@
CountUserInstalledApps();
}
- base::Optional<InstallResultCode> result_code_;
+ absl::optional<InstallResultCode> result_code_;
private:
ScopedOsHooksSuppress os_hooks_suppress_;
@@ -410,7 +410,7 @@
InstallDefaultAppAndCountApps(CreateInstallOptions(example_url));
ASSERT_EQ(InstallResultCode::kSuccessNewInstall, result_code_.value());
- base::Optional<AppId> app_id = FindAppWithUrlInScope(example_url);
+ absl::optional<AppId> app_id = FindAppWithUrlInScope(example_url);
ASSERT_TRUE(app_id);
// TODO(ericwilligers): Assert app_id was installed by default.
@@ -495,7 +495,7 @@
auto result_code = ExternallyManagedAppManagerInstall(
browser()->profile(), CreateInstallOptions(example_url));
ASSERT_EQ(InstallResultCode::kSuccessNewInstall, result_code);
- base::Optional<AppId> app_id = FindAppWithUrlInScope(example_url);
+ absl::optional<AppId> app_id = FindAppWithUrlInScope(example_url);
ASSERT_TRUE(app_id);
content::WindowedNotificationObserver app_loaded_observer(
content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
@@ -548,7 +548,7 @@
auto result_code =
ExternallyManagedAppManagerInstall(browser()->profile(), install_options);
ASSERT_EQ(InstallResultCode::kSuccessNewInstall, result_code);
- base::Optional<AppId> app_id = FindAppWithUrlInScope(example_url);
+ absl::optional<AppId> app_id = FindAppWithUrlInScope(example_url);
ASSERT_TRUE(app_id);
content::WindowedNotificationObserver app_loaded_observer(
content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
diff --git a/chrome/browser/ui/web_applications/web_app_launch_manager.cc b/chrome/browser/ui/web_applications/web_app_launch_manager.cc
index ff894faf..7eb3571 100644
--- a/chrome/browser/ui/web_applications/web_app_launch_manager.cc
+++ b/chrome/browser/ui/web_applications/web_app_launch_manager.cc
@@ -80,7 +80,7 @@
content::WebContents* NavigateWebAppUsingParams(const std::string& app_id,
NavigateParams& nav_params) {
Browser* browser = nav_params.browser;
- const base::Optional<web_app::SystemAppType> capturing_system_app_type =
+ const absl::optional<web_app::SystemAppType> capturing_system_app_type =
web_app::GetCapturingSystemAppForURL(browser->profile(), nav_params.url);
// TODO(crbug.com/1201820): This block creates conditions where Navigate()
// returns early and causes a crash. Fail gracefully instead. Further
@@ -104,11 +104,11 @@
return web_contents;
}
-base::Optional<GURL> GetUrlHandlingLaunchUrl(
+absl::optional<GURL> GetUrlHandlingLaunchUrl(
WebAppProvider& provider,
const apps::AppLaunchParams& params) {
if (!params.url_handler_launch_url.has_value()) {
- return base::nullopt;
+ return absl::nullopt;
}
GURL url = params.url_handler_launch_url.value();
@@ -128,17 +128,17 @@
// TODO(crbug.com/1019239): Passing a WebAppProvider seems to be a bit of an
// anti-pattern. We should refactor this and other existing functions in this
// file to receive an OsIntegrationManager instead.
-base::Optional<GURL> GetProtocolHandlingTranslatedUrl(
+absl::optional<GURL> GetProtocolHandlingTranslatedUrl(
WebAppProvider& provider,
const apps::AppLaunchParams& params) {
if (!params.protocol_handler_launch_url.has_value())
- return base::nullopt;
+ return absl::nullopt;
GURL protocol_url(params.protocol_handler_launch_url.value());
if (!protocol_url.is_valid())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<GURL> translated_url =
+ absl::optional<GURL> translated_url =
provider.os_integration_manager().TranslateProtocolUrl(params.app_id,
protocol_url);
@@ -152,20 +152,20 @@
return params.override_url;
// Handle url_handlers launch
- base::Optional<GURL> url_handler_launch_url =
+ absl::optional<GURL> url_handler_launch_url =
GetUrlHandlingLaunchUrl(provider, params);
if (url_handler_launch_url.has_value())
return url_handler_launch_url.value();
// Handle file_handlers launch
- base::Optional<GURL> file_handler_url =
+ absl::optional<GURL> file_handler_url =
provider.os_integration_manager().GetMatchingFileHandlerURL(
params.app_id, params.launch_files);
if (file_handler_url.has_value())
return file_handler_url.value();
// Handle protocol_handlers launch
- base::Optional<GURL> protocol_handler_translated_url =
+ absl::optional<GURL> protocol_handler_translated_url =
GetProtocolHandlingTranslatedUrl(provider, params);
if (protocol_handler_translated_url.has_value())
return protocol_handler_translated_url.value();
@@ -269,7 +269,7 @@
display::ScopedDisplayForNewWindows scoped_display(params.display_id);
// System Web Apps go through their own launch path.
- base::Optional<SystemAppType> system_app_type =
+ absl::optional<SystemAppType> system_app_type =
GetSystemWebAppTypeForAppId(profile_, params.app_id);
if (system_app_type) {
Browser* browser =
@@ -378,8 +378,8 @@
const std::string& app_id,
const base::CommandLine& command_line,
const base::FilePath& current_directory,
- const base::Optional<GURL>& url_handler_launch_url,
- const base::Optional<GURL>& protocol_handler_launch_url,
+ const absl::optional<GURL>& url_handler_launch_url,
+ const absl::optional<GURL>& protocol_handler_launch_url,
base::OnceCallback<void(Browser* browser,
apps::mojom::LaunchContainer container)> callback) {
if (!provider_)
diff --git a/chrome/browser/ui/web_applications/web_app_launch_manager.h b/chrome/browser/ui/web_applications/web_app_launch_manager.h
index 3e3ce72..9f674105e 100644
--- a/chrome/browser/ui/web_applications/web_app_launch_manager.h
+++ b/chrome/browser/ui/web_applications/web_app_launch_manager.h
@@ -7,8 +7,8 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Browser;
enum class WindowOpenDisposition;
@@ -52,8 +52,8 @@
const std::string& app_id,
const base::CommandLine& command_line,
const base::FilePath& current_directory,
- const base::Optional<GURL>& url_handler_launch_url,
- const base::Optional<GURL>& protocol_handler_launch_url,
+ const absl::optional<GURL>& url_handler_launch_url,
+ const absl::optional<GURL>& protocol_handler_launch_url,
base::OnceCallback<void(Browser* browser,
apps::mojom::LaunchContainer container)>
callback);
diff --git a/chrome/browser/ui/web_applications/web_app_launch_manager_unittest.cc b/chrome/browser/ui/web_applications/web_app_launch_manager_unittest.cc
index a66e194..19e7246 100644
--- a/chrome/browser/ui/web_applications/web_app_launch_manager_unittest.cc
+++ b/chrome/browser/ui/web_applications/web_app_launch_manager_unittest.cc
@@ -5,7 +5,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/web_applications/test/web_app_test.h"
@@ -14,6 +13,7 @@
#include "chrome/common/chrome_switches.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace web_app {
@@ -62,8 +62,8 @@
apps::AppLaunchParams CreateLaunchParams(
const base::CommandLine& command_line,
const std::vector<base::FilePath>& launch_files,
- const base::Optional<GURL>& url_handler_launch_url,
- const base::Optional<GURL>& protocol_handler_launch_url) {
+ const absl::optional<GURL>& url_handler_launch_url,
+ const absl::optional<GURL>& protocol_handler_launch_url) {
apps::AppLaunchParams params(
kTestAppId, apps::mojom::LaunchContainer::kLaunchContainerWindow,
WindowOpenDisposition::NEW_WINDOW,
@@ -84,8 +84,8 @@
return command_line;
}
- void ValidateOptionalGURL(const base::Optional<GURL>& actual,
- const base::Optional<GURL>& expected) {
+ void ValidateOptionalGURL(const absl::optional<GURL>& actual,
+ const absl::optional<GURL>& expected) {
ASSERT_EQ(actual.has_value(), expected.has_value());
if (actual.has_value()) {
EXPECT_EQ(actual.value(), expected.value());
@@ -119,7 +119,7 @@
apps::AppLaunchParams expected_results =
CreateLaunchParams(command_line, std::vector<base::FilePath>(),
- base::nullopt, base::nullopt);
+ absl::nullopt, absl::nullopt);
testing::StrictMock<MockWebAppLaunchManager> manager(profile());
EXPECT_CALL(manager, LaunchWebApplication(testing::_, testing::_))
@@ -134,14 +134,14 @@
}));
manager.LaunchApplication(kTestAppId, command_line,
- base::FilePath(kCurrentDirectory), base::nullopt,
- base::nullopt, base::DoNothing());
+ base::FilePath(kCurrentDirectory), absl::nullopt,
+ absl::nullopt, base::DoNothing());
run_loop.Run();
}
TEST_F(WebAppLaunchManagerUnitTest, LaunchApplication_ProtocolWebPrefix) {
base::RunLoop run_loop;
- const base::Optional<GURL> protocol_handler_launch_url(
+ const absl::optional<GURL> protocol_handler_launch_url(
GURL("web+test://test"));
base::CommandLine command_line = CreateCommandLine();
@@ -149,7 +149,7 @@
apps::AppLaunchParams expected_results =
CreateLaunchParams(command_line, std::vector<base::FilePath>(),
- base::nullopt, protocol_handler_launch_url);
+ absl::nullopt, protocol_handler_launch_url);
testing::StrictMock<MockWebAppLaunchManager> manager(profile());
EXPECT_CALL(manager, LaunchWebApplication(testing::_, testing::_))
@@ -164,14 +164,14 @@
}));
manager.LaunchApplication(kTestAppId, command_line,
- base::FilePath(kCurrentDirectory), base::nullopt,
+ base::FilePath(kCurrentDirectory), absl::nullopt,
protocol_handler_launch_url, base::DoNothing());
run_loop.Run();
}
TEST_F(WebAppLaunchManagerUnitTest, LaunchApplication_ProtocolMailTo) {
base::RunLoop run_loop;
- const base::Optional<GURL> protocol_handler_launch_url(
+ const absl::optional<GURL> protocol_handler_launch_url(
GURL("mailto://[email protected]"));
base::CommandLine command_line = CreateCommandLine();
@@ -179,7 +179,7 @@
apps::AppLaunchParams expected_results =
CreateLaunchParams(command_line, std::vector<base::FilePath>(),
- base::nullopt, protocol_handler_launch_url);
+ absl::nullopt, protocol_handler_launch_url);
testing::StrictMock<MockWebAppLaunchManager> manager(profile());
EXPECT_CALL(manager, LaunchWebApplication(testing::_, testing::_))
@@ -194,7 +194,7 @@
}));
manager.LaunchApplication(kTestAppId, command_line,
- base::FilePath(kCurrentDirectory), base::nullopt,
+ base::FilePath(kCurrentDirectory), absl::nullopt,
protocol_handler_launch_url, base::DoNothing());
run_loop.Run();
}
@@ -209,14 +209,14 @@
#endif // defined(OS_WIN)
base::RunLoop run_loop;
- const base::Optional<GURL> protocol_handler_launch_url(
+ const absl::optional<GURL> protocol_handler_launch_url(
"file:///C:/test_app_path/test_app_file.txt");
base::CommandLine command_line = CreateCommandLine();
command_line.AppendArg(protocol_handler_launch_url.value().spec());
apps::AppLaunchParams expected_results = CreateLaunchParams(
- command_line, {base::FilePath(kTestPath)}, base::nullopt, base::nullopt);
+ command_line, {base::FilePath(kTestPath)}, absl::nullopt, absl::nullopt);
testing::StrictMock<MockWebAppLaunchManager> manager(profile());
EXPECT_CALL(manager, LaunchWebApplication(testing::_, testing::_))
@@ -231,8 +231,8 @@
}));
manager.LaunchApplication(kTestAppId, command_line,
- base::FilePath(kCurrentDirectory), base::nullopt,
- base::nullopt, base::DoNothing());
+ base::FilePath(kCurrentDirectory), absl::nullopt,
+ absl::nullopt, base::DoNothing());
run_loop.Run();
}
@@ -246,14 +246,14 @@
#endif // defined(OS_WIN)
base::RunLoop run_loop;
- const base::Optional<GURL> protocol_handler_launch_url(
+ const absl::optional<GURL> protocol_handler_launch_url(
"https://www.test.com/");
base::CommandLine command_line = CreateCommandLine();
command_line.AppendArg(protocol_handler_launch_url.value().spec());
apps::AppLaunchParams expected_results = CreateLaunchParams(
- command_line, {base::FilePath(kTestPath)}, base::nullopt, base::nullopt);
+ command_line, {base::FilePath(kTestPath)}, absl::nullopt, absl::nullopt);
testing::StrictMock<MockWebAppLaunchManager> manager(profile());
EXPECT_CALL(manager, LaunchWebApplication(testing::_, testing::_))
@@ -268,8 +268,8 @@
}));
manager.LaunchApplication(kTestAppId, command_line,
- base::FilePath(kCurrentDirectory), base::nullopt,
- base::nullopt, base::DoNothing());
+ base::FilePath(kCurrentDirectory), absl::nullopt,
+ absl::nullopt, base::DoNothing());
run_loop.Run();
}
@@ -289,7 +289,7 @@
command_line.AppendArgPath(test_path);
apps::AppLaunchParams expected_results = CreateLaunchParams(
- command_line, {test_path}, base::nullopt, base::nullopt);
+ command_line, {test_path}, absl::nullopt, absl::nullopt);
testing::StrictMock<MockWebAppLaunchManager> manager(profile());
EXPECT_CALL(manager, LaunchWebApplication(testing::_, testing::_))
@@ -304,8 +304,8 @@
}));
manager.LaunchApplication(kTestAppId, command_line,
- base::FilePath(kCurrentDirectory), base::nullopt,
- base::nullopt, base::DoNothing());
+ base::FilePath(kCurrentDirectory), absl::nullopt,
+ absl::nullopt, base::DoNothing());
run_loop.Run();
}
@@ -325,7 +325,7 @@
command_line.AppendArgPath(test_path);
apps::AppLaunchParams expected_results = CreateLaunchParams(
- command_line, {test_path}, base::nullopt, base::nullopt);
+ command_line, {test_path}, absl::nullopt, absl::nullopt);
testing::StrictMock<MockWebAppLaunchManager> manager(profile());
EXPECT_CALL(manager, LaunchWebApplication(testing::_, testing::_))
@@ -340,8 +340,8 @@
}));
manager.LaunchApplication(kTestAppId, command_line,
- base::FilePath(kCurrentDirectory), base::nullopt,
- base::nullopt, base::DoNothing());
+ base::FilePath(kCurrentDirectory), absl::nullopt,
+ absl::nullopt, base::DoNothing());
run_loop.Run();
}
diff --git a/chrome/browser/ui/web_applications/web_app_launch_utils.cc b/chrome/browser/ui/web_applications/web_app_launch_utils.cc
index ec1b2b7..4a95ab3 100644
--- a/chrome/browser/ui/web_applications/web_app_launch_utils.cc
+++ b/chrome/browser/ui/web_applications/web_app_launch_utils.cc
@@ -74,15 +74,15 @@
namespace web_app {
-base::Optional<AppId> GetWebAppForActiveTab(Browser* browser) {
+absl::optional<AppId> GetWebAppForActiveTab(Browser* browser) {
WebAppProvider* provider = WebAppProvider::Get(browser->profile());
if (!provider)
- return base::nullopt;
+ return absl::nullopt;
content::WebContents* web_contents =
browser->tab_strip_model()->GetActiveWebContents();
if (!web_contents)
- return base::nullopt;
+ return absl::nullopt;
return provider->registrar().FindInstalledAppWithUrlInScope(
web_contents->GetMainFrame()->GetLastCommittedURL());
@@ -114,7 +114,7 @@
}
Browser* ReparentWebAppForActiveTab(Browser* browser) {
- base::Optional<AppId> app_id = GetWebAppForActiveTab(browser);
+ absl::optional<AppId> app_id = GetWebAppForActiveTab(browser);
if (!app_id)
return nullptr;
return ReparentWebContentsIntoAppBrowser(
@@ -135,7 +135,7 @@
AppRegistrar& registrar =
WebAppProviderBase::GetProviderBase(profile)->registrar();
if (registrar.IsInstalled(app_id)) {
- base::Optional<GURL> app_scope = registrar.GetAppScope(app_id);
+ absl::optional<GURL> app_scope = registrar.GetAppScope(app_id);
if (!app_scope)
app_scope = registrar.GetAppStartUrl(app_id).GetWithoutFilename();
diff --git a/chrome/browser/ui/web_applications/web_app_launch_utils.h b/chrome/browser/ui/web_applications/web_app_launch_utils.h
index a365ca8..02adc83 100644
--- a/chrome/browser/ui/web_applications/web_app_launch_utils.h
+++ b/chrome/browser/ui/web_applications/web_app_launch_utils.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_UI_WEB_APPLICATIONS_WEB_APP_LAUNCH_UTILS_H_
#define CHROME_BROWSER_UI_WEB_APPLICATIONS_WEB_APP_LAUNCH_UTILS_H_
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Browser;
class GURL;
@@ -17,7 +17,7 @@
namespace web_app {
-base::Optional<AppId> GetWebAppForActiveTab(Browser* browser);
+absl::optional<AppId> GetWebAppForActiveTab(Browser* browser);
bool IsInScope(const GURL& url, const GURL& scope_spec);
diff --git a/chrome/browser/ui/web_applications/web_app_metrics.cc b/chrome/browser/ui/web_applications/web_app_metrics.cc
index e488df6..a207424f 100644
--- a/chrome/browser/ui/web_applications/web_app_metrics.cc
+++ b/chrome/browser/ui/web_applications/web_app_metrics.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/debug/dump_without_crashing.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/power_monitor/power_monitor.h"
#include "base/time/time.h"
#include "chrome/browser/profiles/profile.h"
@@ -24,10 +23,11 @@
#include "components/site_engagement/content/site_engagement_service.h"
#include "components/webapps/browser/banners/app_banner_manager.h"
#include "components/webapps/browser/installable/installable_metrics.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom.h"
using DisplayMode = blink::mojom::DisplayMode;
-using base::Optional;
+using absl::optional;
using content::WebContents;
namespace web_app {
@@ -62,9 +62,9 @@
RecordTabOrWindowHistogram(histogram_prefix, in_window, engagement_type);
}
-Optional<int> GetLatestWebAppInstallSource(const AppId& app_id,
+optional<int> GetLatestWebAppInstallSource(const AppId& app_id,
PrefService* prefs) {
- Optional<int> value =
+ optional<int> value =
GetIntWebAppPref(prefs, app_id, kLatestWebAppInstallSource);
DCHECK_GE(value.value_or(0), 0);
DCHECK_LT(value.value_or(0),
diff --git a/chrome/browser/ui/web_applications/web_app_ui_manager_impl.h b/chrome/browser/ui/web_applications/web_app_ui_manager_impl.h
index 3a57f9e9..80d8f83 100644
--- a/chrome/browser/ui/web_applications/web_app_ui_manager_impl.h
+++ b/chrome/browser/ui/web_applications/web_app_ui_manager_impl.h
@@ -11,10 +11,10 @@
#include "base/callback_forward.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/web_applications/components/web_app_ui_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
class Browser;
diff --git a/chrome/browser/ui/webauthn/authenticator_dialog_browsertest.cc b/chrome/browser/ui/webauthn/authenticator_dialog_browsertest.cc
index 22f2aa3..0182e35 100644
--- a/chrome/browser/ui/webauthn/authenticator_dialog_browsertest.cc
+++ b/chrome/browser/ui/webauthn/authenticator_dialog_browsertest.cc
@@ -92,14 +92,14 @@
AuthenticatorRequestDialogModel::Step::kCableActivate);
} else if (name == "cable_v2_activate") {
model->set_cable_transport_info(
- /*extension_is_v2=*/base::nullopt,
+ /*extension_is_v2=*/absl::nullopt,
/*paired_phones=*/{},
/*contact_phone_callback=*/base::DoNothing(), "fido://qrcode");
model->SetCurrentStepForTesting(
AuthenticatorRequestDialogModel::Step::kCableActivate);
} else if (name == "cable_v2_pair") {
model->set_cable_transport_info(
- /*extension_is_v2=*/base::nullopt,
+ /*extension_is_v2=*/absl::nullopt,
/*paired_phones=*/{},
/*contact_phone_callback=*/base::DoNothing(), "fido://qrcode");
model->SetCurrentStepForTesting(
@@ -218,7 +218,7 @@
static const uint8_t kAppParam[32] = {0};
static const uint8_t kSignatureCounter[4] = {0};
device::AuthenticatorData auth_data(kAppParam, 0 /* flags */,
- kSignatureCounter, base::nullopt);
+ kSignatureCounter, absl::nullopt);
device::AuthenticatorGetAssertionResponse response(
std::move(auth_data), {10, 11, 12, 13} /* signature */);
device::PublicKeyCredentialUserEntity user({1, 2, 3, 4});
diff --git a/chrome/browser/ui/webauthn/hover_list_model.h b/chrome/browser/ui/webauthn/hover_list_model.h
index 1d94b68..9a7edb8 100644
--- a/chrome/browser/ui/webauthn/hover_list_model.h
+++ b/chrome/browser/ui/webauthn/hover_list_model.h
@@ -12,7 +12,7 @@
#include "base/check.h"
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/vector_icon_types.h"
// List model that controls which item is added to WebAuthN UI views.
diff --git a/chrome/browser/ui/webauthn/other_transports_menu_model.cc b/chrome/browser/ui/webauthn/other_transports_menu_model.cc
index 4305ea5..75ad1dce5 100644
--- a/chrome/browser/ui/webauthn/other_transports_menu_model.cc
+++ b/chrome/browser/ui/webauthn/other_transports_menu_model.cc
@@ -14,7 +14,7 @@
: ui::SimpleMenuModel(this), dialog_model_(dialog_model) {
base::span<const AuthenticatorRequestDialogModel::Mechanism> mechanisms =
dialog_model->mechanisms();
- const base::Optional<size_t> current_mechanism =
+ const absl::optional<size_t> current_mechanism =
dialog_model->current_mechanism();
constexpr int kTransportIconSize = 16;
diff --git a/chrome/browser/ui/webauthn/sheet_models.cc b/chrome/browser/ui/webauthn/sheet_models.cc
index d47a157..5d5512c 100644
--- a/chrome/browser/ui/webauthn/sheet_models.cc
+++ b/chrome/browser/ui/webauthn/sheet_models.cc
@@ -718,7 +718,7 @@
dialog_model->min_pin_length());
break;
case device::pin::PINEntryError::kWrongPIN:
- base::Optional<int> attempts = dialog_model->pin_attempts();
+ absl::optional<int> attempts = dialog_model->pin_attempts();
error_ =
attempts && *attempts <= 3
? l10n_util::GetPluralStringFUTF16(
diff --git a/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.h b/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.h
index 2d274054..a62ad8b 100644
--- a/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.h
+++ b/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.h
@@ -9,10 +9,10 @@
#include "base/bind.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "components/autofill/core/browser/logging/log_receiver.h"
#include "content/public/browser/browsing_data_remover.h"
#include "content/public/browser/web_ui_message_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace autofill {
class LogRouter;
@@ -93,7 +93,7 @@
// Whether |this| is registered as a log receiver with the LogRouter.
bool registered_with_log_router_ = false;
- base::Optional<AutofillCacheResetter> autofill_cache_resetter_;
+ absl::optional<AutofillCacheResetter> autofill_cache_resetter_;
DISALLOW_COPY_AND_ASSIGN(InternalsUIHandler);
};
diff --git a/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc b/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc
index d960bf0..9a78bdc 100644
--- a/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/arc_graphics_tracing/arc_graphics_tracing_handler.cc
@@ -109,7 +109,7 @@
if (!base::ReadFileToString(last_model_path, &json_content))
return std::make_pair(base::Value(), std::string());
- base::Optional<base::Value> model = base::JSONReader::Read(json_content);
+ absl::optional<base::Value> model = base::JSONReader::Read(json_content);
if (!model || !model->is_dict())
return std::make_pair(base::Value(), "Failed to read last tracing model");
diff --git a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc
index a8da3b94..b0b7eba 100644
--- a/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/crostini_installer/crostini_installer_page_handler.cc
@@ -10,7 +10,6 @@
#include "ash/constants/ash_features.h"
#include "base/bind.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info.h"
#include "base/task/post_task.h"
@@ -20,6 +19,7 @@
#include "chrome/browser/ash/crostini/crostini_installer_ui_delegate.h"
#include "chrome/browser/ash/crostini/crostini_types.mojom.h"
#include "chrome/browser/ash/crostini/crostini_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/text/bytes_formatting.h"
namespace chromeos {
diff --git a/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc b/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc
index 28920a09..ac252c29 100644
--- a/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.cc
@@ -77,7 +77,7 @@
}
void CryptohomeWebUIHandler::OnIsMounted(
- base::Optional<user_data_auth::IsMountedReply> reply) {
+ absl::optional<user_data_auth::IsMountedReply> reply) {
bool mounted = false;
if (reply.has_value()) {
mounted = reply->is_mounted();
@@ -86,7 +86,7 @@
}
void CryptohomeWebUIHandler::OnPkcs11IsTpmTokenReady(
- base::Optional<user_data_auth::Pkcs11IsTpmTokenReadyReply> reply) {
+ absl::optional<user_data_auth::Pkcs11IsTpmTokenReadyReply> reply) {
bool ready = false;
if (reply.has_value()) {
ready = reply->ready();
diff --git a/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.h b/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.h
index cff27792..72a3f99b 100644
--- a/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.h
+++ b/chrome/browser/ui/webui/chromeos/cryptohome_web_ui_handler.h
@@ -9,11 +9,11 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chromeos/dbus/dbus_method_call_status.h"
#include "chromeos/dbus/tpm_manager/tpm_manager.pb.h"
#include "chromeos/dbus/userdataauth/userdataauth_client.h"
#include "content/public/browser/web_ui_message_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
@@ -39,9 +39,9 @@
void DidGetNSSUtilInfoOnUIThread(bool is_tpm_token_ready);
- void OnIsMounted(base::Optional<user_data_auth::IsMountedReply> reply);
+ void OnIsMounted(absl::optional<user_data_auth::IsMountedReply> reply);
void OnPkcs11IsTpmTokenReady(
- base::Optional<user_data_auth::Pkcs11IsTpmTokenReadyReply> reply);
+ absl::optional<user_data_auth::Pkcs11IsTpmTokenReadyReply> reply);
// This method is called when TpmManager D-Bus GetTpmNonsensitiveStatus call
// completes.
diff --git a/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_login_handler_chromeos.cc b/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_login_handler_chromeos.cc
index 89302e3d..dab4da5 100644
--- a/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_login_handler_chromeos.cc
+++ b/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_login_handler_chromeos.cc
@@ -314,7 +314,7 @@
ResolveJavascriptCallback(base::Value(initialize_edu_args_callback_.value()),
std::move(params));
- initialize_edu_args_callback_ = base::nullopt;
+ initialize_edu_args_callback_ = absl::nullopt;
}
void EduCoexistenceLoginHandler::ConsentValid(const base::ListValue* args) {
diff --git a/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_login_handler_chromeos.h b/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_login_handler_chromeos.h
index 8a616952..283b4af7 100644
--- a/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_login_handler_chromeos.h
+++ b/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_login_handler_chromeos.h
@@ -8,12 +8,12 @@
#include <string>
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
#include "components/signin/public/identity_manager/access_token_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/primary_account_access_token_fetcher.h"
#include "content/public/browser/web_ui_message_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class ListValue;
@@ -64,8 +64,8 @@
base::RepeatingClosure close_dialog_closure_;
- base::Optional<signin::AccessTokenInfo> oauth_access_token_;
- base::Optional<std::string> initialize_edu_args_callback_;
+ absl::optional<signin::AccessTokenInfo> oauth_access_token_;
+ absl::optional<std::string> initialize_edu_args_callback_;
std::string edu_account_email_;
diff --git a/chrome/browser/ui/webui/chromeos/in_session_password_change/lock_screen_reauth_handler.cc b/chrome/browser/ui/webui/chromeos/in_session_password_change/lock_screen_reauth_handler.cc
index 1fdbe3f..7c8113f 100644
--- a/chrome/browser/ui/webui/chromeos/in_session_password_change/lock_screen_reauth_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/in_session_password_change/lock_screen_reauth_handler.cc
@@ -225,7 +225,7 @@
AccountType::GOOGLE),
using_saml, false /* using_saml_api */, password,
SamlPasswordAttributes::FromJs(*password_attributes),
- /*sync_trusted_vault_keys=*/base::nullopt,
+ /*sync_trusted_vault_keys=*/absl::nullopt,
*extension_provided_client_cert_usage_observer_,
pending_user_context_.get(), nullptr)) {
pending_user_context_.reset();
diff --git a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
index 645b8113..d98bba9 100644
--- a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
@@ -227,7 +227,7 @@
}
void CoreOobeHandler::HandleToggleResetScreen() {
- base::OnceCallback<void(bool, base::Optional<tpm_firmware_update::Mode>)>
+ base::OnceCallback<void(bool, absl::optional<tpm_firmware_update::Mode>)>
callback =
base::BindOnce(&CoreOobeHandler::HandleToggleResetScreenCallback,
weak_ptr_factory_.GetWeakPtr());
@@ -236,7 +236,7 @@
void CoreOobeHandler::HandleToggleResetScreenCallback(
bool is_reset_allowed,
- base::Optional<tpm_firmware_update::Mode> tpm_firmware_update_mode) {
+ absl::optional<tpm_firmware_update::Mode> tpm_firmware_update_mode) {
if (!is_reset_allowed)
return;
if (tpm_firmware_update_mode.has_value()) {
diff --git a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
index 4a8680d4..0c610f97 100644
--- a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
@@ -14,7 +14,6 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/ash/login/help_app_launcher.h"
#include "chrome/browser/ash/login/oobe_configuration.h"
@@ -22,6 +21,7 @@
#include "chrome/browser/chromeos/tpm_firmware_update.h"
#include "chrome/browser/ui/webui/chromeos/login/base_webui_handler.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/events/event_source.h"
namespace base {
@@ -159,7 +159,7 @@
// tpm_firmware_update in settings.
void HandleToggleResetScreenCallback(
bool is_reset_allowed,
- base::Optional<tpm_firmware_update::Mode> tpm_firmware_update_mode);
+ absl::optional<tpm_firmware_update::Mode> tpm_firmware_update_mode);
// When keyboard_utils.js arrow key down event is reached, raise it
// to tab/shift-tab event.
diff --git a/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc
index 6b52a49..8e73c3d 100644
--- a/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc
@@ -651,7 +651,7 @@
return;
}
active_directory_domain_join_config_.clear();
- base::Optional<base::Value> options = base::JSONReader::Read(
+ absl::optional<base::Value> options = base::JSONReader::Read(
unlocked_data, base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS);
if (!options || !options->is_list()) {
ShowError(IDS_AD_JOIN_CONFIG_NOT_PARSED, true);
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
index 8d9eed0a..85bd8340 100644
--- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -24,7 +24,6 @@
#include "base/memory/ref_counted.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -102,6 +101,7 @@
#include "net/cert/x509_certificate.h"
#include "services/network/nss_temp_certs_cache_chromeos.h"
#include "services/network/public/mojom/network_context.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/chromeos/devicetype_utils.h"
@@ -683,7 +683,7 @@
!LoginDisplayHost::default_host()->IsUserAllowlisted(
user_manager::known_user::GetAccountId(
user_email, std::string() /* id */, AccountType::UNKNOWN),
- base::nullopt)) {
+ absl::nullopt)) {
ShowAllowlistCheckFailedError();
}
}
@@ -802,9 +802,9 @@
using_saml_api_, password,
SamlPasswordAttributes::FromJs(*password_attributes),
IsSyncTrustedVaultKeysEnabled()
- ? base::make_optional(
+ ? absl::make_optional(
SyncTrustedVaultKeys::FromJs(*sync_trusted_vault_keys))
- : base::nullopt,
+ : absl::nullopt,
*extension_provided_client_cert_usage_observer_,
pending_user_context_.get(), &error)) {
LoginDisplayHost::default_host()->GetSigninUI()->ShowSigninError(
@@ -1020,7 +1020,7 @@
user ? user->GetType() : CalculateUserType(account_id),
GetAccountId(typed_email, gaia_id, AccountType::GOOGLE), using_saml,
using_saml_api_, password, SamlPasswordAttributes(),
- /*sync_trusted_vault_keys=*/base::nullopt,
+ /*sync_trusted_vault_keys=*/absl::nullopt,
*extension_provided_client_cert_usage_observer_, &user_context,
&error)) {
LoginDisplayHost::default_host()->GetSigninUI()->ShowSigninError(
@@ -1190,7 +1190,7 @@
bool enable_user_input,
security_token_pin::ErrorLabel error_label,
int attempts_left,
- const base::Optional<AccountId>& /*authenticating_user_account_id*/,
+ const absl::optional<AccountId>& /*authenticating_user_account_id*/,
SecurityTokenPinEnteredCallback pin_entered_callback,
SecurityTokenPinDialogClosedCallback pin_dialog_closed_callback) {
DCHECK(is_security_token_pin_enabled_);
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
index db5ffcb..f85a2d1 100644
--- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
@@ -136,7 +136,7 @@
bool enable_user_input,
security_token_pin::ErrorLabel error_label,
int attempts_left,
- const base::Optional<AccountId>& authenticating_user_account_id,
+ const absl::optional<AccountId>& authenticating_user_account_id,
SecurityTokenPinEnteredCallback pin_entered_callback,
SecurityTokenPinDialogClosedCallback pin_dialog_closed_callback) override;
void CloseSecurityTokenPinDialog() override;
diff --git a/chrome/browser/ui/webui/chromeos/login/online_login_helper.cc b/chrome/browser/ui/webui/chromeos/login/online_login_helper.cc
index 36faf0d..bccbf43 100644
--- a/chrome/browser/ui/webui/chromeos/login/online_login_helper.cc
+++ b/chrome/browser/ui/webui/chromeos/login/online_login_helper.cc
@@ -75,7 +75,7 @@
const GURL& gaia_url = GaiaUrls::GetInstance()->gaia_url();
std::unique_ptr<net::CanonicalCookie> cc(net::CanonicalCookie::Create(
gaia_url, gaps_cookie_value, base::Time::Now(),
- base::nullopt /* server_time */));
+ absl::nullopt /* server_time */));
if (!cc)
return;
@@ -111,7 +111,7 @@
bool using_saml_api,
const std::string& password,
const SamlPasswordAttributes& password_attributes,
- const base::Optional<SyncTrustedVaultKeys>& sync_trusted_vault_keys,
+ const absl::optional<SyncTrustedVaultKeys>& sync_trusted_vault_keys,
const LoginClientCertUsageObserver&
extension_provided_client_cert_usage_observer,
UserContext* user_context,
diff --git a/chrome/browser/ui/webui/chromeos/login/online_login_helper.h b/chrome/browser/ui/webui/chromeos/login/online_login_helper.h
index 0c18f03..cc3925f 100644
--- a/chrome/browser/ui/webui/chromeos/login/online_login_helper.h
+++ b/chrome/browser/ui/webui/chromeos/login/online_login_helper.h
@@ -7,7 +7,6 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/ash/login/login_client_cert_usage_observer.h"
#include "chrome/browser/ash/login/signin_partition_manager.h"
#include "chrome/browser/ash/login/ui/login_display_host.h"
@@ -20,6 +19,7 @@
#include "content/public/browser/web_ui.h"
#include "google_apis/gaia/gaia_urls.h"
#include "services/network/public/mojom/cookie_manager.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -76,7 +76,7 @@
bool using_saml_api,
const std::string& password,
const SamlPasswordAttributes& password_attributes,
- const base::Optional<SyncTrustedVaultKeys>& sync_trusted_vault_keys,
+ const absl::optional<SyncTrustedVaultKeys>& sync_trusted_vault_keys,
const LoginClientCertUsageObserver&
extension_provided_client_cert_usage_observer,
UserContext* user_context,
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc b/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc
index 06eee30..2d3b9f29 100644
--- a/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc
+++ b/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc
@@ -64,7 +64,7 @@
void SetUnifiedDesktopEnabled(bool enabled) override {}
void OverscanCalibration(const std::string& display_id,
ash::mojom::DisplayConfigOperation op,
- const base::Optional<gfx::Insets>& delta,
+ const absl::optional<gfx::Insets>& delta,
OverscanCalibrationCallback callback) override {}
void TouchCalibration(const std::string& display_id,
ash::mojom::DisplayConfigOperation op,
diff --git a/chrome/browser/ui/webui/chromeos/login/saml_challenge_key_handler.h b/chrome/browser/ui/webui/chromeos/login/saml_challenge_key_handler.h
index cb52b64..b41cdf0 100644
--- a/chrome/browser/ui/webui/chromeos/login/saml_challenge_key_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/saml_challenge_key_handler.h
@@ -58,7 +58,7 @@
// Timeout for `tpm_key_challenger_` to response.
const base::TimeDelta default_tpm_response_timeout_ =
base::TimeDelta::FromSeconds(15);
- base::Optional<base::TimeDelta> tpm_response_timeout_for_testing_;
+ absl::optional<base::TimeDelta> tpm_response_timeout_for_testing_;
// Performs attestation flow.
std::unique_ptr<attestation::TpmChallengeKeyWithTimeout> tpm_key_challenger_;
diff --git a/chrome/browser/ui/webui/chromeos/login/ssh_configured_handler.h b/chrome/browser/ui/webui/chromeos/login/ssh_configured_handler.h
index cc63d3d..8d892df 100644
--- a/chrome/browser/ui/webui/chromeos/login/ssh_configured_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/ssh_configured_handler.h
@@ -9,8 +9,8 @@
#include <vector>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ui/webui/chromeos/login/base_webui_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -36,7 +36,7 @@
void OnGetDebuggingFeatures(bool succeeded, int feature_mask);
void ResolveCallbacks();
- base::Optional<bool> is_ssh_configured_;
+ absl::optional<bool> is_ssh_configured_;
std::vector<std::string> callback_ids_;
base::WeakPtrFactory<SshConfiguredHandler> weak_factory_{this};
diff --git a/chrome/browser/ui/webui/chromeos/multidevice_internals/multidevice_internals_phone_hub_handler.cc b/chrome/browser/ui/webui/chromeos/multidevice_internals/multidevice_internals_phone_hub_handler.cc
index 992b7029..f1476312 100644
--- a/chrome/browser/ui/webui/chromeos/multidevice_internals/multidevice_internals_phone_hub_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/multidevice_internals/multidevice_internals_phone_hub_handler.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/webui/chromeos/multidevice_internals/multidevice_internals_phone_hub_handler.h"
#include "ash/public/cpp/system_tray.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/phonehub/phone_hub_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -13,6 +12,7 @@
#include "chromeos/components/phonehub/fake_phone_hub_manager.h"
#include "chromeos/components/phonehub/pref_names.h"
#include "components/prefs/pref_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/image/image.h"
@@ -476,20 +476,20 @@
int inline_reply_id;
CHECK(notification_data_dict->GetInteger("inlineReplyId", &inline_reply_id));
- base::Optional<std::u16string> opt_title;
+ absl::optional<std::u16string> opt_title;
std::u16string title;
if (notification_data_dict->GetString("title", &title) && !title.empty()) {
opt_title = title;
}
- base::Optional<std::u16string> opt_text_content;
+ absl::optional<std::u16string> opt_text_content;
std::u16string text_content;
if (notification_data_dict->GetString("textContent", &text_content) &&
!text_content.empty()) {
opt_text_content = text_content;
}
- base::Optional<gfx::Image> opt_shared_image;
+ absl::optional<gfx::Image> opt_shared_image;
int shared_image_type_as_int;
if (notification_data_dict->GetInteger("sharedImage",
&shared_image_type_as_int) &&
@@ -499,7 +499,7 @@
ImageTypeToBitmap(shared_image_type, kSharedImageSize));
}
- base::Optional<gfx::Image> opt_contact_image;
+ absl::optional<gfx::Image> opt_contact_image;
int contact_image_type_as_int;
if (notification_data_dict->GetInteger("contactImage",
&contact_image_type_as_int) &&
diff --git a/chrome/browser/ui/webui/chromeos/network_logs_message_handler.cc b/chrome/browser/ui/webui/chromeos/network_logs_message_handler.cc
index 4ff73727..ed0029e 100644
--- a/chrome/browser/ui/webui/chromeos/network_logs_message_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/network_logs_message_handler.cc
@@ -107,7 +107,7 @@
void NetworkLogsMessageHandler::OnWriteSystemLogs(
const std::string& callback_id,
base::Value&& options,
- base::Optional<base::FilePath> syslogs_path) {
+ absl::optional<base::FilePath> syslogs_path) {
if (!syslogs_path) {
Respond(callback_id, "Error writing system logs file.", /*is_error=*/true);
return;
@@ -138,7 +138,7 @@
void NetworkLogsMessageHandler::OnWriteDebugLogs(
const std::string& callback_id,
base::Value&& options,
- base::Optional<base::FilePath> logs_path) {
+ absl::optional<base::FilePath> logs_path) {
if (!logs_path) {
Respond(callback_id, "Error writing debug logs.", /*is_error=*/true);
return;
diff --git a/chrome/browser/ui/webui/chromeos/network_logs_message_handler.h b/chrome/browser/ui/webui/chromeos/network_logs_message_handler.h
index 6ecb291..3623d37c6 100644
--- a/chrome/browser/ui/webui/chromeos/network_logs_message_handler.h
+++ b/chrome/browser/ui/webui/chromeos/network_logs_message_handler.h
@@ -9,9 +9,9 @@
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/values.h"
#include "content/public/browser/web_ui_message_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -33,12 +33,12 @@
void OnStoreLogs(const base::ListValue* list);
void OnWriteSystemLogs(const std::string& callback_id,
base::Value&& options,
- base::Optional<base::FilePath> syslogs_path);
+ absl::optional<base::FilePath> syslogs_path);
void MaybeWriteDebugLogs(const std::string& callback_id,
base::Value&& options);
void OnWriteDebugLogs(const std::string& callback_id,
base::Value&& options,
- base::Optional<base::FilePath> logs_path);
+ absl::optional<base::FilePath> logs_path);
void MaybeWritePolicies(const std::string& callback_id,
base::Value&& options);
void OnWritePolicies(const std::string& callback_id, bool result);
diff --git a/chrome/browser/ui/webui/chromeos/network_ui.cc b/chrome/browser/ui/webui/chromeos/network_ui.cc
index 1bd6daf..509dc91c 100644
--- a/chrome/browser/ui/webui/chromeos/network_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/network_ui.cc
@@ -212,7 +212,7 @@
void OnGetShillNetworkProperties(const std::string& callback_id,
const std::string& guid,
const std::string& service_path,
- base::Optional<base::Value> result) {
+ absl::optional<base::Value> result) {
if (!result) {
RunErrorCallback(callback_id, guid, kGetNetworkProperties, "Error.DBus");
return;
@@ -321,7 +321,7 @@
void OnGetShillDeviceProperties(const std::string& callback_id,
const std::string& type,
const std::string& device_path,
- base::Optional<base::Value> result) {
+ absl::optional<base::Value> result) {
if (!result) {
RunErrorCallback(callback_id, type, kGetDeviceProperties,
"GetDeviceProperties failed");
diff --git a/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc b/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc
index 82636e7..f20c80f 100644
--- a/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc
+++ b/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.cc
@@ -207,7 +207,7 @@
AdjustWidgetInitParams(&extra_params);
dialog_window_ = chrome::ShowWebDialogWithParams(
parent, browser_context, this,
- base::make_optional<views::Widget::InitParams>(std::move(extra_params)));
+ absl::make_optional<views::Widget::InitParams>(std::move(extra_params)));
}
void SystemWebDialogDelegate::ShowSystemDialog(gfx::NativeWindow parent) {
diff --git a/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h b/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h
index 01d087e..b0e28ac 100644
--- a/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h
+++ b/chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h
@@ -9,7 +9,7 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/widget/widget.h"
#include "ui/web_dialogs/web_dialog_delegate.h"
diff --git a/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc b/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc
index 9ca70e55..e1bb7b8e 100644
--- a/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc
+++ b/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc
@@ -244,7 +244,7 @@
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
ThirdPartyFeaturesStatus GetThirdPartyFeaturesStatus(
- base::Optional<ThirdPartyConflictsManager::State>
+ absl::optional<ThirdPartyConflictsManager::State>
third_party_conflicts_manager_state) {
// The ThirdPartyConflictsManager instance exists if we have its state.
if (third_party_conflicts_manager_state.has_value()) {
@@ -345,7 +345,7 @@
void OnModuleDataFetched(ConflictsDataFetcher::OnConflictsDataFetchedCallback
on_conflicts_data_fetched_callback,
base::DictionaryValue results,
- base::Optional<ThirdPartyConflictsManager::State>
+ absl::optional<ThirdPartyConflictsManager::State>
third_party_conflicts_manager_state) {
OnConflictsDataFetched(
std::move(on_conflicts_data_fetched_callback), std::move(results),
diff --git a/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.h b/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.h
index 66e6104..e9b21a0 100644
--- a/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.h
+++ b/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.h
@@ -8,12 +8,12 @@
#include <memory>
#include "base/callback.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/sequenced_task_runner.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/browser/win/conflicts/module_database_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chrome/browser/win/conflicts/third_party_conflicts_manager.h"
@@ -73,7 +73,7 @@
SEQUENCE_CHECKER(sequence_checker_);
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
- base::Optional<ThirdPartyConflictsManager::State>
+ absl::optional<ThirdPartyConflictsManager::State>
third_party_conflicts_manager_state_;
base::WeakPtrFactory<ConflictsDataFetcher> weak_ptr_factory_;
diff --git a/chrome/browser/ui/webui/customize_themes/chrome_customize_themes_handler_unittest.cc b/chrome/browser/ui/webui/customize_themes/chrome_customize_themes_handler_unittest.cc
index 246f6a4..f64300ed 100644
--- a/chrome/browser/ui/webui/customize_themes/chrome_customize_themes_handler_unittest.cc
+++ b/chrome/browser/ui/webui/customize_themes/chrome_customize_themes_handler_unittest.cc
@@ -9,7 +9,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
@@ -33,6 +32,7 @@
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/webui/resources/cr_components/customize_themes/customize_themes.mojom.h"
@@ -235,7 +235,7 @@
test_data_dir.AppendASCII("extensions/theme_minimal/manifest.json");
std::string config_contents;
ASSERT_TRUE(base::ReadFileToString(manifest_path, &config_contents));
- base::Optional<base::Value> manifest =
+ absl::optional<base::Value> manifest =
base::JSONReader::Read(config_contents);
ASSERT_TRUE(manifest.has_value());
diff --git a/chrome/browser/ui/webui/discards/discards_ui.cc b/chrome/browser/ui/webui/discards/discards_ui.cc
index 76b8698..169d114 100644
--- a/chrome/browser/ui/webui/discards/discards_ui.cc
+++ b/chrome/browser/ui/webui/discards/discards_ui.cc
@@ -145,7 +145,7 @@
info->is_auto_discardable =
tab_lifecycle_unit_external->IsAutoDiscardable();
info->id = lifecycle_unit->GetID();
- base::Optional<float> reactivation_score =
+ absl::optional<float> reactivation_score =
resource_coordinator::TabActivityWatcher::GetInstance()
->CalculateReactivationScore(contents);
info->has_reactivation_score = reactivation_score.has_value();
diff --git a/chrome/browser/ui/webui/discards/graph_dump_impl.h b/chrome/browser/ui/webui/discards/graph_dump_impl.h
index c743d59f..8c9a476 100644
--- a/chrome/browser/ui/webui/discards/graph_dump_impl.h
+++ b/chrome/browser/ui/webui/discards/graph_dump_impl.h
@@ -157,7 +157,7 @@
// Ignored.
void OnFreezingVoteChanged(
const performance_manager::PageNode* page_node,
- base::Optional<performance_manager::freezing::FreezingVote>) override {}
+ absl::optional<performance_manager::freezing::FreezingVote>) override {}
// ProcessNodeObserver implementation:
void OnProcessNodeAdded(
diff --git a/chrome/browser/ui/webui/discards/graph_dump_impl_unittest.cc b/chrome/browser/ui/webui/discards/graph_dump_impl_unittest.cc
index c16a03b..39dcbe2 100644
--- a/chrome/browser/ui/webui/discards/graph_dump_impl_unittest.cc
+++ b/chrome/browser/ui/webui/discards/graph_dump_impl_unittest.cc
@@ -310,7 +310,7 @@
// Check that the descriptions make sense.
for (auto kv : node_descriptions_json) {
keys_received.push_back(kv.first);
- base::Optional<base::Value> v =
+ absl::optional<base::Value> v =
base::JSONReader::Read(kv.second);
EXPECT_TRUE(v->is_dict());
std::string* str = v->FindStringKey("test");
diff --git a/chrome/browser/ui/webui/discards/site_data_provider_impl.cc b/chrome/browser/ui/webui/discards/site_data_provider_impl.cc
index 9e05382..6b1e7c7 100644
--- a/chrome/browser/ui/webui/discards/site_data_provider_impl.cc
+++ b/chrome/browser/ui/webui/discards/site_data_provider_impl.cc
@@ -167,8 +167,8 @@
// Adapt the inspector callback to the mojom callback with this lambda.
auto inspector_callback = base::BindOnce(
[](GetSiteDataDatabaseSizeCallback callback,
- base::Optional<int64_t> num_rows,
- base::Optional<int64_t> on_disk_size_kb) {
+ absl::optional<int64_t> num_rows,
+ absl::optional<int64_t> on_disk_size_kb) {
discards::mojom::SiteDataDatabaseSizePtr result =
discards::mojom::SiteDataDatabaseSize::New();
result->num_rows = num_rows.has_value() ? num_rows.value() : -1;
diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.h b/chrome/browser/ui/webui/extensions/extensions_ui.h
index 12d266c..439f2ae3 100644
--- a/chrome/browser/ui/webui/extensions/extensions_ui.h
+++ b/chrome/browser/ui/webui/extensions/extensions_ui.h
@@ -48,7 +48,7 @@
WebuiLoadTimer webui_load_timer_;
// Time the chrome://extensions page has been open.
- base::Optional<base::ElapsedTimer> timer_;
+ absl::optional<base::ElapsedTimer> timer_;
};
} // namespace extensions
diff --git a/chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.cc b/chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.cc
index 2e6fdf7..fc89272 100644
--- a/chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.cc
+++ b/chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.cc
@@ -31,7 +31,7 @@
void UserEducationInternalsPageHandlerImpl::StartTutorial(
const std::string& tutorial_id) {
- base::Optional<FeatureTutorial> tutorial =
+ absl::optional<FeatureTutorial> tutorial =
GetFeatureTutorialFromStringId(tutorial_id);
if (!tutorial)
return;
diff --git a/chrome/browser/ui/webui/management/management_ui_handler.cc b/chrome/browser/ui/webui/management/management_ui_handler.cc
index 0df8e1d..c7bb05d 100644
--- a/chrome/browser/ui/webui/management/management_ui_handler.cc
+++ b/chrome/browser/ui/webui/management/management_ui_handler.cc
@@ -346,7 +346,7 @@
} // namespace
std::string ManagementUIHandler::GetAccountManager(Profile* profile) {
- base::Optional<std::string> account_manager =
+ absl::optional<std::string> account_manager =
chrome::GetAccountManagerIdentity(profile);
return account_manager ? *account_manager : std::string();
}
diff --git a/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc b/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc
index 1c9200b6..19f3416 100644
--- a/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc
+++ b/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc
@@ -341,7 +341,7 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
extracted_.management_overview = ExtractPathFromDict(data, "overview");
extracted_.update_required_eol = ExtractPathFromDict(data, "eolMessage");
- base::Optional<bool> showProxyDisclosure =
+ absl::optional<bool> showProxyDisclosure =
data.FindBoolPath("showProxyServerPrivacyDisclosure");
extracted_.show_proxy_server_privacy_disclosure =
showProxyDisclosure.has_value() && showProxyDisclosure.value();
@@ -349,7 +349,7 @@
extracted_.browser_management_notice =
ExtractPathFromDict(data, "browserManagementNotice");
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
- base::Optional<bool> managed = data.FindBoolPath("managed");
+ absl::optional<bool> managed = data.FindBoolPath("managed");
extracted_.managed = managed.has_value() && managed.value();
}
diff --git a/chrome/browser/ui/webui/media/media_history_ui.cc b/chrome/browser/ui/webui/media/media_history_ui.cc
index 46035f47..0e7094f 100644
--- a/chrome/browser/ui/webui/media/media_history_ui.cc
+++ b/chrome/browser/ui/webui/media/media_history_ui.cc
@@ -65,7 +65,7 @@
void MediaHistoryUI::GetMediaHistoryPlaybackSessionRows(
GetMediaHistoryPlaybackSessionRowsCallback callback) {
return GetMediaHistoryService()->GetPlaybackSessions(
- base::nullopt, base::nullopt, std::move(callback));
+ absl::nullopt, absl::nullopt, std::move(callback));
}
media_history::MediaHistoryKeyedService*
diff --git a/chrome/browser/ui/webui/nearby_internals/nearby_internals_contact_handler.cc b/chrome/browser/ui/webui/nearby_internals/nearby_internals_contact_handler.cc
index 4e0f1fd1..ce7df47 100644
--- a/chrome/browser/ui/webui/nearby_internals/nearby_internals_contact_handler.cc
+++ b/chrome/browser/ui/webui/nearby_internals/nearby_internals_contact_handler.cc
@@ -41,11 +41,11 @@
// dictionaries corresponding to each contact-manager observer functions. This
// will require changes at the javascript layer as well.
base::Value ContactMessageToDictionary(
- base::Optional<bool> did_contacts_change_since_last_upload,
- const base::Optional<std::set<std::string>>& allowed_contact_ids,
- const base::Optional<std::vector<nearbyshare::proto::ContactRecord>>&
+ absl::optional<bool> did_contacts_change_since_last_upload,
+ const absl::optional<std::set<std::string>>& allowed_contact_ids,
+ const absl::optional<std::vector<nearbyshare::proto::ContactRecord>>&
contacts,
- base::Optional<uint32_t> num_unreachable_contacts_filtered_out) {
+ absl::optional<uint32_t> num_unreachable_contacts_filtered_out) {
base::Value dictionary(base::Value::Type::DICTIONARY);
dictionary.SetKey(kContactMessageTimeKey, GetJavascriptTimestamp());
@@ -136,7 +136,7 @@
uint32_t num_unreachable_contacts_filtered_out) {
FireWebUIListener("contacts-updated",
ContactMessageToDictionary(
- /*did_contacts_change_since_last_upload=*/base::nullopt,
+ /*did_contacts_change_since_last_upload=*/absl::nullopt,
allowed_contact_ids, contacts,
num_unreachable_contacts_filtered_out));
}
@@ -147,7 +147,7 @@
"contacts-updated",
ContactMessageToDictionary(
did_contacts_change_since_last_upload,
- /*allowed_contact_ids=*/base::nullopt,
- /*contacts=*/base::nullopt,
- /*num_unreachable_contacts_filtered_out=*/base::nullopt));
+ /*allowed_contact_ids=*/absl::nullopt,
+ /*contacts=*/absl::nullopt,
+ /*num_unreachable_contacts_filtered_out=*/absl::nullopt));
}
diff --git a/chrome/browser/ui/webui/nearby_internals/nearby_internals_contact_handler.h b/chrome/browser/ui/webui/nearby_internals/nearby_internals_contact_handler.h
index a5bd632..8f7e963 100644
--- a/chrome/browser/ui/webui/nearby_internals/nearby_internals_contact_handler.h
+++ b/chrome/browser/ui/webui/nearby_internals/nearby_internals_contact_handler.h
@@ -10,11 +10,11 @@
#include <vector>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/nearby_sharing/contacts/nearby_share_contact_manager.h"
#include "chrome/browser/nearby_sharing/proto/rpc_resources.pb.h"
#include "content/public/browser/web_ui_message_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class ListValue;
diff --git a/chrome/browser/ui/webui/nearby_internals/nearby_internals_ui_trigger_handler.cc b/chrome/browser/ui/webui/nearby_internals/nearby_internals_ui_trigger_handler.cc
index edcde58..6fb03c7 100644
--- a/chrome/browser/ui/webui/nearby_internals/nearby_internals_ui_trigger_handler.cc
+++ b/chrome/browser/ui/webui/nearby_internals/nearby_internals_ui_trigger_handler.cc
@@ -477,8 +477,8 @@
std::vector<std::unique_ptr<Attachment>> attachments;
attachments.push_back(std::make_unique<TextAttachment>(
- TextAttachment::Type::kText, kPayloadExample, /*title=*/base::nullopt,
- /*mime_type=*/base::nullopt));
+ TextAttachment::Type::kText, kPayloadExample, /*title=*/absl::nullopt,
+ /*mime_type=*/absl::nullopt));
const base::Value& callback_id = args->GetList()[0];
ResolveJavascriptCallback(
diff --git a/chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui.cc b/chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui.cc
index 27e483d..f9130160 100644
--- a/chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui.cc
+++ b/chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui.cc
@@ -133,8 +133,8 @@
{"text", TextAttachment::Type::kText}}) {
if (net::GetValueForKeyInQuery(url, text_type.first, &value)) {
attachments.push_back(std::make_unique<TextAttachment>(
- text_type.second, value, /*title=*/base::nullopt,
- /*mime_type=*/base::nullopt));
+ text_type.second, value, /*title=*/absl::nullopt,
+ /*mime_type=*/absl::nullopt));
SetAttachments(std::move(attachments));
return;
}
diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc
index fe710aa2..6179390 100644
--- a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc
@@ -78,7 +78,7 @@
receiver_.set_disconnect_handler(
base::BindOnce(&DnsLookupClient::OnComplete, base::Unretained(this),
net::ERR_NAME_NOT_RESOLVED,
- net::ResolveErrorInfo(net::ERR_FAILED), base::nullopt));
+ net::ResolveErrorInfo(net::ERR_FAILED), absl::nullopt));
}
~DnsLookupClient() override {}
@@ -86,7 +86,7 @@
void OnComplete(
int32_t error,
const net::ResolveErrorInfo& resolve_error_info,
- const base::Optional<net::AddressList>& resolved_addresses) override {
+ const absl::optional<net::AddressList>& resolved_addresses) override {
std::string result;
if (error == net::OK) {
CHECK(resolved_addresses->size() == 1);
diff --git a/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc b/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc
index c8e8558f..49ebb59 100644
--- a/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc
+++ b/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc
@@ -662,7 +662,7 @@
UMA_HISTOGRAM_MEDIUM_TIMES("NewTabPage.Promos.RequestLatency2.Failure",
duration);
}
- promo_load_start_time_ = base::nullopt;
+ promo_load_start_time_ = absl::nullopt;
}
const auto& data = promo_service_->promo_data();
@@ -704,7 +704,7 @@
}
void NewTabPageHandler::OnPromoRendered(double time,
- const base::Optional<GURL>& log_url) {
+ const absl::optional<GURL>& log_url) {
logger_.LogEvent(NTP_MIDDLE_SLOT_PROMO_SHOWN,
base::Time::FromJsTime(time) - ntp_navigation_start_time_);
if (log_url.has_value() && log_url->is_valid()) {
@@ -799,7 +799,7 @@
void NewTabPageHandler::OnDoodleImageClicked(
new_tab_page::mojom::DoodleImageType type,
- const base::Optional<::GURL>& log_url) {
+ const absl::optional<::GURL>& log_url) {
NTPLoggingEventType event;
switch (type) {
case new_tab_page::mojom::DoodleImageType::kAnimation:
@@ -844,7 +844,7 @@
void NewTabPageHandler::OnDoodleShared(
new_tab_page::mojom::DoodleShareChannel channel,
const std::string& doodle_id,
- const base::Optional<std::string>& share_id) {
+ const absl::optional<std::string>& share_id) {
int channel_id;
switch (channel) {
case new_tab_page::mojom::DoodleShareChannel::kFacebook:
@@ -1028,7 +1028,7 @@
void NewTabPageHandler::OnLogoAvailable(
GetDoodleCallback callback,
search_provider_logos::LogoCallbackReason type,
- const base::Optional<search_provider_logos::EncodedLogo>& logo) {
+ const absl::optional<search_provider_logos::EncodedLogo>& logo) {
if (!logo) {
std::move(callback).Run(nullptr);
return;
@@ -1141,12 +1141,12 @@
bool success,
std::unique_ptr<std::string> body) {
if (!success || body->size() < 4 || body->substr(0, 4) != ")]}'") {
- std::move(callback).Run("", base::nullopt, "");
+ std::move(callback).Run("", absl::nullopt, "");
return;
}
auto value = base::JSONReader::Read(body->substr(4));
if (!value.has_value()) {
- std::move(callback).Run("", base::nullopt, "");
+ std::move(callback).Run("", absl::nullopt, "");
return;
}
@@ -1159,12 +1159,12 @@
value->FindPath("ddllog.interaction_log_url");
auto interaction_log_url =
interaction_log_url_value && interaction_log_url_value->is_string()
- ? base::Optional<GURL>(
+ ? absl::optional<GURL>(
GURL(TemplateURLServiceFactory::GetForProfile(profile_)
->search_terms_data()
.GoogleBaseURLValue())
.Resolve(interaction_log_url_value->GetString()))
- : base::nullopt;
+ : absl::nullopt;
auto* encoded_ei_value = value->FindPath("ddllog.encoded_ei");
auto encoded_ei = encoded_ei_value && encoded_ei_value->is_string()
? encoded_ei_value->GetString()
diff --git a/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.h b/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.h
index 9ff0724..f6b6c89 100644
--- a/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.h
+++ b/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.h
@@ -10,7 +10,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "chrome/browser/search/background/ntp_background_service_observer.h"
@@ -27,6 +26,7 @@
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/shell_dialogs/select_file_dialog.h"
class GURL;
@@ -104,7 +104,7 @@
double time) override;
void OnOneGoogleBarRendered(double time) override;
void OnPromoRendered(double time,
- const base::Optional<GURL>& log_url) override;
+ const absl::optional<GURL>& log_url) override;
void OnMostVisitedTileNavigation(new_tab_page::mojom::MostVisitedTilePtr tile,
uint32_t index,
uint8_t mouse_button,
@@ -115,14 +115,14 @@
void OnCustomizeDialogAction(
new_tab_page::mojom::CustomizeDialogAction action) override;
void OnDoodleImageClicked(new_tab_page::mojom::DoodleImageType type,
- const base::Optional<GURL>& log_url) override;
+ const absl::optional<GURL>& log_url) override;
void OnDoodleImageRendered(new_tab_page::mojom::DoodleImageType type,
double time,
const GURL& log_url,
OnDoodleImageRenderedCallback callback) override;
void OnDoodleShared(new_tab_page::mojom::DoodleShareChannel channel,
const std::string& doodle_id,
- const base::Optional<std::string>& share_id) override;
+ const absl::optional<std::string>& share_id) override;
void OnPromoLinkClicked() override;
private:
@@ -149,7 +149,7 @@
void OnLogoAvailable(
GetDoodleCallback callback,
search_provider_logos::LogoCallbackReason type,
- const base::Optional<search_provider_logos::EncodedLogo>& logo);
+ const absl::optional<search_provider_logos::EncodedLogo>& logo);
void LogEvent(NTPLoggingEventType event);
@@ -174,7 +174,7 @@
std::string images_request_collection_id_;
GetBackgroundImagesCallback background_images_callback_;
base::TimeTicks background_images_request_start_time_;
- base::Optional<base::TimeTicks> one_google_bar_load_start_time_;
+ absl::optional<base::TimeTicks> one_google_bar_load_start_time_;
Profile* profile_;
scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
content::WebContents* web_contents_;
@@ -187,7 +187,7 @@
PromoService* promo_service_;
base::ScopedObservation<PromoService, PromoServiceObserver>
promo_service_observation_{this};
- base::Optional<base::TimeTicks> promo_load_start_time_;
+ absl::optional<base::TimeTicks> promo_load_start_time_;
// These are located at the end of the list of member variables to ensure the
// WebUI page is disconnected before other members are destroyed.
diff --git a/chrome/browser/ui/webui/new_tab_page/untrusted_source.cc b/chrome/browser/ui/webui/new_tab_page/untrusted_source.cc
index ef141d4..4eb134a 100644
--- a/chrome/browser/ui/webui/new_tab_page/untrusted_source.cc
+++ b/chrome/browser/ui/webui/new_tab_page/untrusted_source.cc
@@ -13,7 +13,6 @@
#include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -29,6 +28,7 @@
#include "content/public/common/url_constants.h"
#include "net/base/url_util.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/re2/src/re2/re2.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/template_expressions.h"
@@ -232,14 +232,14 @@
}
void UntrustedSource::OnOneGoogleBarDataUpdated() {
- base::Optional<OneGoogleBarData> data =
+ absl::optional<OneGoogleBarData> data =
one_google_bar_service_->one_google_bar_data();
if (one_google_bar_load_start_time_.has_value()) {
NTPUserDataLogger::LogOneGoogleBarFetchDuration(
/*success=*/data.has_value(),
/*duration=*/base::TimeTicks::Now() - *one_google_bar_load_start_time_);
- one_google_bar_load_start_time_ = base::nullopt;
+ one_google_bar_load_start_time_ = absl::nullopt;
}
std::string html;
diff --git a/chrome/browser/ui/webui/new_tab_page/untrusted_source.h b/chrome/browser/ui/webui/new_tab_page/untrusted_source.h
index 03fd3bd..962f6d72 100644
--- a/chrome/browser/ui/webui/new_tab_page/untrusted_source.h
+++ b/chrome/browser/ui/webui/new_tab_page/untrusted_source.h
@@ -81,7 +81,7 @@
OneGoogleBarService* one_google_bar_service_;
base::ScopedObservation<OneGoogleBarService, OneGoogleBarServiceObserver>
one_google_bar_service_observation_{this};
- base::Optional<base::TimeTicks> one_google_bar_load_start_time_;
+ absl::optional<base::TimeTicks> one_google_bar_load_start_time_;
Profile* profile_;
};
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index f097212..622e704 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -17,7 +17,6 @@
#include "base/feature_list.h"
#include "base/i18n/rtl.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
@@ -89,6 +88,7 @@
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
#include "net/base/url_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
#include "url/gurl.h"
@@ -222,8 +222,8 @@
value->SetBoolean("mayCreateShortcuts", is_locally_installed);
value->SetBoolean("isLocallyInstalled", is_locally_installed);
- base::Optional<std::string> icon_big;
- base::Optional<std::string> icon_small;
+ absl::optional<std::string> icon_big;
+ absl::optional<std::string> icon_small;
if (HasMatchingOrGreaterThanIcon(
registrar.GetAppDownloadedIconSizesAny(app_id),
@@ -565,7 +565,7 @@
visible_apps_.insert(app_id);
base::Value highlight(attempting_web_app_install_page_ordinal_.has_value());
- attempting_web_app_install_page_ordinal_ = base::nullopt;
+ attempting_web_app_install_page_ordinal_ = absl::nullopt;
web_ui()->CallJavascriptFunctionUnsafe("ntp.appAdded", *app_info, highlight);
}
@@ -1240,7 +1240,7 @@
if (install_result !=
web_app::InstallResultCode::kSuccessNewInstall) {
app_launcher_handler->attempting_web_app_install_page_ordinal_ =
- base::nullopt;
+ absl::nullopt;
}
},
weak_ptr_factory_.GetWeakPtr());
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.h b/chrome/browser/ui/webui/ntp/app_launcher_handler.h
index 9cb5908..fe3704b 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.h
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.h
@@ -10,7 +10,6 @@
#include <string>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/task/cancelable_task_tracker.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
@@ -31,6 +30,7 @@
#include "content/public/browser/web_ui_message_handler.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/common/extension.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class ExtensionEnableFlow;
class PrefChangeRegistrar;
@@ -269,7 +269,7 @@
// When populated, we have attempted to install a bookmark app, and are still
// waiting to hear about success or failure from the extensions system.
- base::Optional<syncer::StringOrdinal>
+ absl::optional<syncer::StringOrdinal>
attempting_web_app_install_page_ordinal_;
// True if we have executed HandleGetApps() at least once.
diff --git a/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc b/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc
index 8bff292..fa0e815 100644
--- a/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc
+++ b/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc
@@ -13,7 +13,6 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/values.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
@@ -35,6 +34,7 @@
#include "printing/backend/print_backend_consts.h"
#include "printing/backend/printing_restrictions.h"
#include "printing/print_job_constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace printing {
@@ -65,10 +65,10 @@
base::Value OnSetUpPrinter(
base::Value policies,
const chromeos::Printer& printer,
- const base::Optional<PrinterSemanticCapsAndDefaults>& printer_caps) {
+ const absl::optional<PrinterSemanticCapsAndDefaults>& printer_caps) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<PrinterSemanticCapsAndDefaults> caps = printer_caps;
+ absl::optional<PrinterSemanticCapsAndDefaults> caps = printer_caps;
base::Value printer_info = AssemblePrinterSettings(
printer.id(), ToBasicInfo(printer),
PrinterSemanticCapsAndDefaults::Papers(), printer.HasSecureProtocol(),
@@ -185,7 +185,7 @@
GetCapabilityCallback cb) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<chromeos::Printer> printer =
+ absl::optional<chromeos::Printer> printer =
printers_manager_->GetPrinter(printer_id);
if (!printer) {
@@ -205,7 +205,7 @@
GetEulaUrlCallback cb) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<chromeos::Printer> printer =
+ absl::optional<chromeos::Printer> printer =
printers_manager_->GetPrinter(destination_id);
if (!printer) {
diff --git a/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc b/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc
index ee85b91..f79aac5 100644
--- a/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc
+++ b/chrome/browser/ui/webui/print_preview/local_printer_handler_default.cc
@@ -61,7 +61,7 @@
void OnDidGetDefaultPrinterName(
PrinterHandler::DefaultPrinterCallback callback,
- const base::Optional<std::string>& printer_name) {
+ const absl::optional<std::string>& printer_name) {
if (!printer_name.has_value()) {
LOG(WARNING) << "Failure getting default printer";
std::move(callback).Run(std::string());
diff --git a/chrome/browser/ui/webui/print_preview/pdf_printer_handler_unittest.cc b/chrome/browser/ui/webui/print_preview/pdf_printer_handler_unittest.cc
index a2b8224..74b46d3 100644
--- a/chrome/browser/ui/webui/print_preview/pdf_printer_handler_unittest.cc
+++ b/chrome/browser/ui/webui/print_preview/pdf_printer_handler_unittest.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/webui/print_preview/pdf_printer_handler.h"
#include "base/json/json_reader.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
@@ -14,6 +13,7 @@
#include "chrome/test/base/scoped_browser_locale.h"
#include "components/url_formatter/url_formatter.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#if defined(OS_MAC)
@@ -262,7 +262,7 @@
}
TEST_F(PdfPrinterHandlerGetCapabilityTest, GetCapability) {
- base::Optional<base::Value> expected_capability =
+ absl::optional<base::Value> expected_capability =
base::JSONReader::Read(kPdfPrinterCapability);
ASSERT_TRUE(expected_capability.has_value());
@@ -281,7 +281,7 @@
{"printer4", "", gfx::Size(101600, 50800)},
};
- base::Optional<base::Value> expected_capability =
+ absl::optional<base::Value> expected_capability =
base::JSONReader::Read(kPdfPrinterCapability);
ASSERT_TRUE(expected_capability.has_value());
ASSERT_TRUE(expected_capability.value().is_dict());
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
index 267a95f..08dffdb 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -204,7 +204,7 @@
// Get the print job settings dictionary from |json_str|.
// Returns |base::Value()| on failure.
base::Value GetSettingsDictionary(const std::string& json_str) {
- base::Optional<base::Value> settings = base::JSONReader::Read(json_str);
+ absl::optional<base::Value> settings = base::JSONReader::Read(json_str);
if (!settings || !settings->is_dict()) {
NOTREACHED() << "Print job settings must be a dictionary.";
return base::Value();
@@ -289,7 +289,7 @@
policies.SetKey(kCssBackground, std::move(background_graphics_policy));
base::Value paper_size_policy(base::Value::Type::DICTIONARY);
- const base::Optional<gfx::Size>& default_paper_size = ptr->paper_size_default;
+ const absl::optional<gfx::Size>& default_paper_size = ptr->paper_size_default;
if (default_paper_size.has_value()) {
base::Value default_paper_size_value(base::Value::Type::DICTIONARY);
default_paper_size_value.SetIntKey(kPaperSizeWidth,
@@ -342,7 +342,7 @@
policies.SetKey(kCssBackground, std::move(background_graphics_policy));
base::Value paper_size_policy(base::Value::Type::DICTIONARY);
- base::Optional<gfx::Size> default_paper_size = ParsePaperSizeDefault(prefs);
+ absl::optional<gfx::Size> default_paper_size = ParsePaperSizeDefault(prefs);
if (default_paper_size.has_value()) {
base::Value default_paper_size_value(base::Value::Type::DICTIONARY);
default_paper_size_value.SetIntKey(kPaperSizeWidth,
@@ -627,7 +627,7 @@
// Retrieve the page title and url and send it to the renderer process if
// headers and footers are to be displayed.
- base::Optional<bool> display_header_footer_opt =
+ absl::optional<bool> display_header_footer_opt =
settings.FindBoolKey(kSettingHeaderFooterEnabled);
DCHECK(display_header_footer_opt);
if (display_header_footer_opt.value_or(false)) {
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler_chromeos_unittest.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler_chromeos_unittest.cc
index 82461019..e7e74c7 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler_chromeos_unittest.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler_chromeos_unittest.cc
@@ -84,7 +84,7 @@
private:
Observer* observer_ = nullptr;
- base::Optional<std::vector<std::string>> print_server_ids_;
+ absl::optional<std::vector<std::string>> print_server_ids_;
chromeos::PrintServersConfig print_servers_config_;
};
@@ -166,7 +166,7 @@
friend class PrintPreviewHandlerChromeOSTest;
mojo::Remote<crosapi::mojom::PrintServerObserver> remote_;
- base::Optional<std::vector<std::string>> print_server_ids_;
+ absl::optional<std::vector<std::string>> print_server_ids_;
};
#endif
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc
index 714d431..ce24ad4 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc
@@ -15,7 +15,6 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/memory/ref_counted_memory.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -42,6 +41,7 @@
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/test_web_ui.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/crosapi/mojom/local_printer.mojom.h"
@@ -342,7 +342,7 @@
}
private:
- base::Optional<crosapi::mojom::Policies> policies_;
+ absl::optional<crosapi::mojom::Policies> policies_;
};
#endif
@@ -577,7 +577,7 @@
void ValidateInitialSettingsValuePolicy(
const content::TestWebUI::CallData& data,
const std::string& policy_name,
- base::Optional<base::Value> expected_policy_value) {
+ absl::optional<base::Value> expected_policy_value) {
CheckWebUIResponse(data, "test-callback-id-0", true);
const base::Value* settings = data.arg3();
@@ -598,8 +598,8 @@
void ValidateInitialSettingsAllowedDefaultModePolicy(
const content::TestWebUI::CallData& data,
const std::string& policy_name,
- base::Optional<base::Value> expected_allowed_mode,
- base::Optional<base::Value> expected_default_mode) {
+ absl::optional<base::Value> expected_allowed_mode,
+ absl::optional<base::Value> expected_default_mode) {
CheckWebUIResponse(data, "test-callback-id-0", true);
const base::Value* settings = data.arg3();
@@ -730,15 +730,15 @@
TEST_F(PrintPreviewHandlerTest, InitialSettingsNoPolicies) {
Initialize();
ValidateInitialSettingsAllowedDefaultModePolicy(*web_ui()->call_data().back(),
- "headerFooter", base::nullopt,
- base::nullopt);
+ "headerFooter", absl::nullopt,
+ absl::nullopt);
ValidateInitialSettingsAllowedDefaultModePolicy(*web_ui()->call_data().back(),
"cssBackground",
- base::nullopt, base::nullopt);
+ absl::nullopt, absl::nullopt);
ValidateInitialSettingsAllowedDefaultModePolicy(
- *web_ui()->call_data().back(), "mediaSize", base::nullopt, base::nullopt);
+ *web_ui()->call_data().back(), "mediaSize", absl::nullopt, absl::nullopt);
ValidateInitialSettingsValuePolicy(*web_ui()->call_data().back(), "sheets",
- base::nullopt);
+ absl::nullopt);
}
#if BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -750,15 +750,15 @@
kDummyInitiatorName);
// Verify policy settings are empty.
ValidateInitialSettingsAllowedDefaultModePolicy(*web_ui()->call_data().back(),
- "headerFooter", base::nullopt,
- base::nullopt);
+ "headerFooter", absl::nullopt,
+ absl::nullopt);
ValidateInitialSettingsAllowedDefaultModePolicy(*web_ui()->call_data().back(),
"cssBackground",
- base::nullopt, base::nullopt);
+ absl::nullopt, absl::nullopt);
ValidateInitialSettingsAllowedDefaultModePolicy(
- *web_ui()->call_data().back(), "mediaSize", base::nullopt, base::nullopt);
+ *web_ui()->call_data().back(), "mediaSize", absl::nullopt, absl::nullopt);
ValidateInitialSettingsValuePolicy(*web_ui()->call_data().back(), "sheets",
- base::nullopt);
+ absl::nullopt);
}
#endif
@@ -776,7 +776,7 @@
Initialize();
ValidateInitialSettingsAllowedDefaultModePolicy(
*web_ui()->call_data().back(), "headerFooter", base::Value(true),
- base::nullopt);
+ absl::nullopt);
}
TEST_F(PrintPreviewHandlerTest, InitialSettingsRestrictHeaderFooterDisabled) {
@@ -793,7 +793,7 @@
Initialize();
ValidateInitialSettingsAllowedDefaultModePolicy(
*web_ui()->call_data().back(), "headerFooter", base::Value(false),
- base::nullopt);
+ absl::nullopt);
}
TEST_F(PrintPreviewHandlerTest, InitialSettingsEnableHeaderFooter) {
@@ -808,7 +808,7 @@
#endif
Initialize();
ValidateInitialSettingsAllowedDefaultModePolicy(*web_ui()->call_data().back(),
- "headerFooter", base::nullopt,
+ "headerFooter", absl::nullopt,
base::Value(true));
}
@@ -824,7 +824,7 @@
#endif
Initialize();
ValidateInitialSettingsAllowedDefaultModePolicy(*web_ui()->call_data().back(),
- "headerFooter", base::nullopt,
+ "headerFooter", absl::nullopt,
base::Value(false));
}
@@ -842,7 +842,7 @@
Initialize();
ValidateInitialSettingsAllowedDefaultModePolicy(
*web_ui()->call_data().back(), "cssBackground", base::Value(1),
- base::nullopt);
+ absl::nullopt);
}
TEST_F(PrintPreviewHandlerTest,
@@ -859,7 +859,7 @@
Initialize();
ValidateInitialSettingsAllowedDefaultModePolicy(
*web_ui()->call_data().back(), "cssBackground", base::Value(2),
- base::nullopt);
+ absl::nullopt);
}
TEST_F(PrintPreviewHandlerTest, InitialSettingsEnableBackgroundGraphics) {
@@ -874,7 +874,7 @@
#endif
Initialize();
ValidateInitialSettingsAllowedDefaultModePolicy(
- *web_ui()->call_data().back(), "cssBackground", base::nullopt,
+ *web_ui()->call_data().back(), "cssBackground", absl::nullopt,
base::Value(1));
}
@@ -890,7 +890,7 @@
#endif
Initialize();
ValidateInitialSettingsAllowedDefaultModePolicy(
- *web_ui()->call_data().back(), "cssBackground", base::nullopt,
+ *web_ui()->call_data().back(), "cssBackground", absl::nullopt,
base::Value(2));
}
@@ -905,7 +905,7 @@
"height": 210000
})";
- base::Optional<base::Value> default_paper_size =
+ absl::optional<base::Value> default_paper_size =
base::JSONReader::Read(kPrintingPaperSizeDefaultName);
ASSERT_TRUE(default_paper_size.has_value());
#if BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -918,12 +918,12 @@
#endif
Initialize();
- base::Optional<base::Value> expected_initial_settings_policy =
+ absl::optional<base::Value> expected_initial_settings_policy =
base::JSONReader::Read(kExpectedInitialSettingsPolicy);
ASSERT_TRUE(expected_initial_settings_policy.has_value());
ValidateInitialSettingsAllowedDefaultModePolicy(
- *web_ui()->call_data().back(), "mediaSize", base::nullopt,
+ *web_ui()->call_data().back(), "mediaSize", absl::nullopt,
std::move(expected_initial_settings_policy));
}
@@ -942,7 +942,7 @@
"height": 210000
})";
- base::Optional<base::Value> default_paper_size =
+ absl::optional<base::Value> default_paper_size =
base::JSONReader::Read(kPrintingPaperSizeDefaultCustomSize);
ASSERT_TRUE(default_paper_size.has_value());
#if BUILDFLAG(IS_CHROMEOS_LACROS)
@@ -955,12 +955,12 @@
#endif
Initialize();
- base::Optional<base::Value> expected_initial_settings_policy =
+ absl::optional<base::Value> expected_initial_settings_policy =
base::JSONReader::Read(kExpectedInitialSettingsPolicy);
ASSERT_TRUE(expected_initial_settings_policy.has_value());
ValidateInitialSettingsAllowedDefaultModePolicy(
- *web_ui()->call_data().back(), "mediaSize", base::nullopt,
+ *web_ui()->call_data().back(), "mediaSize", absl::nullopt,
std::move(expected_initial_settings_policy));
}
@@ -1223,12 +1223,12 @@
const base::Value& preview_params = print_render_frame.GetSettings();
// Read the preview UI ID and request ID
- base::Optional<int> request_value =
+ absl::optional<int> request_value =
preview_params.FindIntKey(kPreviewRequestID);
ASSERT_TRUE(request_value.has_value());
int preview_request_id = request_value.value();
- base::Optional<int> ui_value = preview_params.FindIntKey(kPreviewUIID);
+ absl::optional<int> ui_value = preview_params.FindIntKey(kPreviewUIID);
ASSERT_TRUE(ui_value.has_value());
int preview_ui_id = ui_value.value();
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_metrics.cc b/chrome/browser/ui/webui/print_preview/print_preview_metrics.cc
index 303f21d..5c083e91 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_metrics.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_metrics.cc
@@ -8,13 +8,13 @@
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "printing/mojom/print.mojom.h"
#include "printing/print_job_constants.h"
#include "printing/print_settings.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace printing {
@@ -80,7 +80,7 @@
}
}
- base::Optional<bool> landscape_opt =
+ absl::optional<bool> landscape_opt =
preview_settings.FindBoolKey(kSettingLandscape);
if (landscape_opt)
ReportPrintSettingHistogram(landscape_opt.value()
@@ -96,21 +96,21 @@
if (print_settings.FindBoolKey(kSettingCollate).value_or(false))
ReportPrintSettingHistogram(PrintSettingsBuckets::kCollate);
- base::Optional<int> duplex_mode_opt =
+ absl::optional<int> duplex_mode_opt =
print_settings.FindIntKey(kSettingDuplexMode);
if (duplex_mode_opt)
ReportPrintSettingHistogram(duplex_mode_opt.value()
? PrintSettingsBuckets::kDuplex
: PrintSettingsBuckets::kSimplex);
- base::Optional<int> color_mode_opt = print_settings.FindIntKey(kSettingColor);
+ absl::optional<int> color_mode_opt = print_settings.FindIntKey(kSettingColor);
if (color_mode_opt.has_value()) {
mojom::ColorModel color_model =
ColorModeToColorModel(color_mode_opt.value());
bool unknown_color_model =
color_model == mojom::ColorModel::kUnknownColorModel;
if (!unknown_color_model) {
- base::Optional<bool> is_color = IsColorModelSelected(color_model);
+ absl::optional<bool> is_color = IsColorModelSelected(color_model);
ReportPrintSettingHistogram(is_color.value()
? PrintSettingsBuckets::kColor
: PrintSettingsBuckets::kBlackAndWhite);
@@ -163,7 +163,7 @@
if (print_settings.FindIntKey(kSettingDpiHorizontal).value_or(0) > 0 &&
print_settings.FindIntKey(kSettingDpiVertical).value_or(0) > 0) {
- base::Optional<bool> is_default_opt =
+ absl::optional<bool> is_default_opt =
print_settings.FindBoolKey(kSettingDpiDefault);
if (is_default_opt) {
ReportPrintSettingHistogram(is_default_opt.value()
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
index 5b729848..3512871 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -810,7 +810,7 @@
// static
bool PrintPreviewUI::ShouldCancelRequest(
- const base::Optional<int32_t>& preview_ui_id,
+ const absl::optional<int32_t>& preview_ui_id,
int request_id) {
if (!preview_ui_id)
return true;
@@ -820,7 +820,7 @@
return request_id != current_id;
}
-base::Optional<int32_t> PrintPreviewUI::GetIDForPrintPreviewUI() const {
+absl::optional<int32_t> PrintPreviewUI::GetIDForPrintPreviewUI() const {
return id_;
}
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.h b/chrome/browser/ui/webui/print_preview/print_preview_ui.h
index 712745f..e82df7cf 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_ui.h
+++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.h
@@ -17,7 +17,6 @@
#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
#include "chrome/services/printing/public/mojom/pdf_nup_converter.mojom.h"
@@ -25,6 +24,7 @@
#include "components/services/print_compositor/public/mojom/print_compositor.mojom.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "printing/mojom/print.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -141,11 +141,11 @@
// Determines whether to cancel a print preview request based on the request
// id.
// Can be called from any thread.
- static bool ShouldCancelRequest(const base::Optional<int32_t>& preview_ui_id,
+ static bool ShouldCancelRequest(const absl::optional<int32_t>& preview_ui_id,
int request_id);
// Returns an id to uniquely identify this PrintPreviewUI.
- base::Optional<int32_t> GetIDForPrintPreviewUI() const;
+ absl::optional<int32_t> GetIDForPrintPreviewUI() const;
// Notifies the Web UI of a print preview request with |request_id|.
virtual void OnPrintPreviewRequest(int request_id);
@@ -273,7 +273,7 @@
// The unique ID for this class instance. Stored here to avoid calling
// GetIDForPrintPreviewUI() everywhere.
- base::Optional<int32_t> id_;
+ absl::optional<int32_t> id_;
// Weak pointer to the WebUI handler.
PrintPreviewHandler* const handler_;
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_utils.cc b/chrome/browser/ui/webui/print_preview/print_preview_utils.cc
index 08b27d8..8bf95bf 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_utils.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_utils.cc
@@ -221,7 +221,7 @@
NOTREACHED();
return false;
}
- base::Optional<base::Value> ticket_value =
+ absl::optional<base::Value> ticket_value =
base::JSONReader::Read(*ticket_opt);
if (!ticket_value)
return false;
diff --git a/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc b/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc
index 658c0dd..dad823f 100644
--- a/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.cc
@@ -81,7 +81,7 @@
void ShowToast(const std::string& id, const std::u16string& message) {
ash::ToastManager::Get()->Show(ash::ToastData(
- id, message, kToastDurationMs, /*dismiss_text=*/base::nullopt));
+ id, message, kToastDurationMs, /*dismiss_text=*/absl::nullopt));
}
class AccountBuilder {
@@ -298,7 +298,7 @@
continue;
}
- base::Optional<AccountInfo> maybe_account_info =
+ absl::optional<AccountInfo> maybe_account_info =
identity_manager_
->FindExtendedAccountInfoForAccountWithRefreshTokenByGaiaId(
account_key.id);
diff --git a/chrome/browser/ui/webui/settings/chromeos/account_manager_handler_browsertest.cc b/chrome/browser/ui/webui/settings/chromeos/account_manager_handler_browsertest.cc
index 0554e6e9..f232e67 100644
--- a/chrome/browser/ui/webui/settings/chromeos/account_manager_handler_browsertest.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/account_manager_handler_browsertest.cc
@@ -371,7 +371,7 @@
EXPECT_EQ(expected_account.raw_email,
ValueOrEmpty(account.FindStringKey("email")));
- base::Optional<AccountInfo> expected_account_info =
+ absl::optional<AccountInfo> expected_account_info =
identity_manager()
->FindExtendedAccountInfoForAccountWithRefreshTokenByGaiaId(
expected_account.key.id);
diff --git a/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.cc b/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.cc
index b83273b0..8f8daf6d 100644
--- a/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.cc
@@ -19,7 +19,6 @@
#include "base/callback.h"
#include "base/logging.h"
#include "base/memory/ref_counted_memory.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/sequenced_task_runner_handle.h"
@@ -27,6 +26,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
@@ -190,7 +190,7 @@
// since the last time requesting the data. Abort any request in progress to
// avoid unnecessary updating invisible subpage.
ui_update_weak_factory_.InvalidateWeakPtrs();
- RequestSettingsAndAlbums(/*topic_source=*/base::nullopt);
+ RequestSettingsAndAlbums(/*topic_source=*/absl::nullopt);
}
void AmbientModeHandler::HandleRequestAlbums(const base::ListValue* args) {
@@ -452,11 +452,11 @@
OnSettingsAndAlbumsFetched(last_fetch_request_topic_source_, cached_settings_,
std::move(personal_albums_));
has_pending_fetch_request_ = false;
- last_fetch_request_topic_source_ = base::nullopt;
+ last_fetch_request_topic_source_ = absl::nullopt;
}
void AmbientModeHandler::RequestSettingsAndAlbums(
- base::Optional<ash::AmbientModeTopicSource> topic_source) {
+ absl::optional<ash::AmbientModeTopicSource> topic_source) {
last_fetch_request_topic_source_ = topic_source;
// If there is an ongoing update, do not request. If update succeeds, it will
@@ -476,8 +476,8 @@
}
void AmbientModeHandler::OnSettingsAndAlbumsFetched(
- base::Optional<ash::AmbientModeTopicSource> topic_source,
- const base::Optional<ash::AmbientSettings>& settings,
+ absl::optional<ash::AmbientModeTopicSource> topic_source,
+ const absl::optional<ash::AmbientSettings>& settings,
ash::PersonalAlbums personal_albums) {
// |settings| value implies success.
if (!settings) {
diff --git a/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.h b/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.h
index 3fa33f2..117a0ab 100644
--- a/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.h
+++ b/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler.h
@@ -9,10 +9,10 @@
#include "ash/public/cpp/ambient/ambient_backend_controller.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "components/prefs/pref_change_registrar.h"
#include "net/base/backoff_entry.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ash {
struct AmbientSettings;
@@ -104,12 +104,12 @@
// the callers:
// 1. |kGooglePhotos|: ambientMode/photos?topicSource=0
// 2. |kArtGallery|: ambientMode/photos?topicSource=1
- // 3. base::nullopt: ambientMode/
+ // 3. absl::nullopt: ambientMode/
void RequestSettingsAndAlbums(
- base::Optional<ash::AmbientModeTopicSource> topic_source);
+ absl::optional<ash::AmbientModeTopicSource> topic_source);
void OnSettingsAndAlbumsFetched(
- base::Optional<ash::AmbientModeTopicSource> topic_source,
- const base::Optional<ash::AmbientSettings>& settings,
+ absl::optional<ash::AmbientModeTopicSource> topic_source,
+ const absl::optional<ash::AmbientSettings>& settings,
ash::PersonalAlbums personal_albums);
// The |settings_| could be stale when the albums in Google Photos changes.
@@ -135,16 +135,16 @@
// Local settings which may contain changes from WebUI but have not sent to
// server.
- base::Optional<ash::AmbientSettings> settings_;
+ absl::optional<ash::AmbientSettings> settings_;
// The cached settings from the server. Should be the same as the server side.
// This value will be updated when RequestSettingsAndAlbums() and
// UpdateSettings() return successfully.
// If UpdateSettings() fails, will restore to this value.
- base::Optional<ash::AmbientSettings> cached_settings_;
+ absl::optional<ash::AmbientSettings> cached_settings_;
// A temporary settings sent to the server in UpdateSettings().
- base::Optional<ash::AmbientSettings> settings_sent_for_update_;
+ absl::optional<ash::AmbientSettings> settings_sent_for_update_;
ash::PersonalAlbums personal_albums_;
@@ -155,7 +155,7 @@
bool has_pending_fetch_request_ = false;
// The topic source in the latest RequestSettingsAndAlbums().
- base::Optional<ash::AmbientModeTopicSource> last_fetch_request_topic_source_;
+ absl::optional<ash::AmbientModeTopicSource> last_fetch_request_topic_source_;
// Whether the Settings updating is ongoing.
bool is_updating_backend_ = false;
diff --git a/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler_unittest.cc
index 8cce4c9..084be70b 100644
--- a/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/ambient_mode_handler_unittest.cc
@@ -69,7 +69,7 @@
return histogram_tester_;
}
- base::Optional<ash::AmbientSettings>& settings() {
+ absl::optional<ash::AmbientSettings>& settings() {
return handler_->settings_;
}
@@ -112,7 +112,7 @@
}
void FetchSettings() {
- handler_->RequestSettingsAndAlbums(/*topic_source=*/base::nullopt);
+ handler_->RequestSettingsAndAlbums(/*topic_source=*/absl::nullopt);
}
void UpdateSettings() {
@@ -152,7 +152,7 @@
void ReplyFetchSettingsAndAlbums(
bool success,
- base::Optional<ash::AmbientSettings> settings = base::nullopt) {
+ absl::optional<ash::AmbientSettings> settings = absl::nullopt) {
fake_backend_controller_->ReplyFetchSettingsAndAlbums(success,
std::move(settings));
}
diff --git a/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.cc b/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.cc
index b7ab2d8..181d7bb2 100644
--- a/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.cc
@@ -74,7 +74,7 @@
void SizeCalculator::NotifySizeCalculated(
int64_t total_bytes,
- const base::Optional<int64_t>& available_bytes) {
+ const absl::optional<int64_t>& available_bytes) {
calculating_ = false;
for (SizeCalculator::Observer& observer : observers_) {
observer.OnSizeCalculated(calculation_type_, total_bytes, available_bytes);
@@ -378,7 +378,7 @@
}
void OtherUsersSizeCalculator::OnGetOtherUserSize(
- base::Optional<user_data_auth::GetAccountDiskUsageReply> reply) {
+ absl::optional<user_data_auth::GetAccountDiskUsageReply> reply) {
user_sizes_.push_back(
user_data_auth::AccountDiskUsageReplyToUsageSize(reply));
if (user_sizes_.size() != other_users_.size())
diff --git a/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.h b/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.h
index be713fe..817a37f 100644
--- a/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.h
+++ b/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.h
@@ -52,7 +52,7 @@
virtual void OnSizeCalculated(
const CalculationType& item_id,
int64_t total_bytes,
- const base::Optional<int64_t>& available_bytes) = 0;
+ const absl::optional<int64_t>& available_bytes) = 0;
};
// Total number of storage items.
@@ -78,7 +78,7 @@
// Notify the StorageHandler about the calculated storage item size
void NotifySizeCalculated(
int64_t total_bytes,
- const base::Optional<int64_t>& available_bytes = base::nullopt);
+ const absl::optional<int64_t>& available_bytes = absl::nullopt);
// Item id.
const CalculationType calculation_type_;
@@ -278,7 +278,7 @@
// Callback to update the sizes of the other users.
void OnGetOtherUserSize(
- base::Optional<::user_data_auth::GetAccountDiskUsageReply> reply);
+ absl::optional<::user_data_auth::GetAccountDiskUsageReply> reply);
// The list of other users whose directory sizes will be accumulated as the
// size of "Other users".
diff --git a/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator_test_api.h b/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator_test_api.h
index 59a6c340..5710cd9 100644
--- a/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator_test_api.h
+++ b/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator_test_api.h
@@ -142,7 +142,7 @@
}
void SimulateOnGetOtherUserSize(
- base::Optional<user_data_auth::GetAccountDiskUsageReply> reply) {
+ absl::optional<user_data_auth::GetAccountDiskUsageReply> reply) {
other_users_size_calculator_->OnGetOtherUserSize(reply);
}
diff --git a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
index 9eecd53..f5b0963 100644
--- a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
@@ -16,7 +16,6 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/task/post_task.h"
@@ -58,6 +57,7 @@
#include "net/base/ip_endpoint.h"
#include "printing/backend/print_backend.h"
#include "printing/printer_status.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace chromeos {
@@ -646,7 +646,7 @@
return;
}
- base::Optional<Printer> existing_printer_object =
+ absl::optional<Printer> existing_printer_object =
printers_manager_->GetPrinter(printer->id());
if (existing_printer_object) {
if (!IsValidUriChange(*existing_printer_object, *printer)) {
@@ -1034,7 +1034,7 @@
CHECK(args->GetString(1, &printer_id));
PRINTER_LOG(USER) << "Adding discovered printer";
- base::Optional<Printer> printer = printers_manager_->GetPrinter(printer_id);
+ absl::optional<Printer> printer = printers_manager_->GetPrinter(printer_id);
if (!printer) {
PRINTER_LOG(ERROR) << "Discovered printer disappeared";
// Printer disappeared, so we don't have information about it anymore and
@@ -1211,7 +1211,7 @@
CHECK(args->GetString(0, &callback_id));
CHECK(args->GetString(1, &server_url));
- base::Optional<GURL> converted_server_url =
+ absl::optional<GURL> converted_server_url =
GenerateServerPrinterUrlWithValidScheme(server_url);
if (!converted_server_url) {
RejectJavascriptCallback(
@@ -1259,7 +1259,7 @@
printers_manager_->GetPrinters(PrinterClass::kSaved);
std::set<GURL> known_printers;
for (const Printer& printer : saved_printers) {
- base::Optional<GURL> gurl =
+ absl::optional<GURL> gurl =
GenerateServerPrinterUrlWithValidScheme(printer.uri().GetNormalized());
if (gurl)
known_printers.insert(gurl.value());
@@ -1272,7 +1272,7 @@
printers.reserve(returned_printers.size());
for (PrinterDetector::DetectedPrinter& printer : returned_printers) {
printers.push_back(std::move(printer.printer));
- base::Optional<GURL> printer_gurl = GenerateServerPrinterUrlWithValidScheme(
+ absl::optional<GURL> printer_gurl = GenerateServerPrinterUrlWithValidScheme(
printers.back().uri().GetNormalized());
if (printer_gurl && known_printers.count(printer_gurl.value()))
printers.pop_back();
diff --git a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc
index 15e1cc47..1b0fb8b 100644
--- a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler_unittest.cc
@@ -61,7 +61,7 @@
class TestCupsPrintersManager : public StubCupsPrintersManager {
public:
- base::Optional<Printer> GetPrinter(const std::string& id) const override {
+ absl::optional<Printer> GetPrinter(const std::string& id) const override {
return Printer();
}
};
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler_unittest.cc
index ed0bc88..fac7aee 100644
--- a/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler_unittest.cc
@@ -200,8 +200,8 @@
base::FilePath("/devices/platform/i8042/serio0/input/input1"), 1, 1,
0xab41);
fake_udev->AddFakeDevice(internal_kbd.name, internal_kbd.sys_path.value(),
- /*subsystem=*/"input", /*devnode=*/base::nullopt,
- /*devtype=*/base::nullopt, /*sysattrs=*/{},
+ /*subsystem=*/"input", /*devnode=*/absl::nullopt,
+ /*devtype=*/absl::nullopt, /*sysattrs=*/{},
/*properties=*/{});
// Generic external USB keyboard.
const ui::InputDevice external_generic_kbd(
@@ -212,8 +212,8 @@
0x046d, 0xc31c, 0x0111);
fake_udev->AddFakeDevice(external_generic_kbd.name,
external_generic_kbd.sys_path.value(),
- /*subsystem=*/"input", /*devnode=*/base::nullopt,
- /*devtype=*/base::nullopt, /*sysattrs=*/{},
+ /*subsystem=*/"input", /*devnode=*/absl::nullopt,
+ /*devtype=*/absl::nullopt, /*sysattrs=*/{},
/*properties=*/{});
// Apple keyboard.
const ui::InputDevice external_apple_kbd(
@@ -223,8 +223,8 @@
0x05ac, 0x026c, 0x0111);
fake_udev->AddFakeDevice(external_apple_kbd.name,
external_apple_kbd.sys_path.value(),
- /*subsystem=*/"input", /*devnode=*/base::nullopt,
- /*devtype=*/base::nullopt, /*sysattrs=*/{},
+ /*subsystem=*/"input", /*devnode=*/absl::nullopt,
+ /*devtype=*/absl::nullopt, /*sysattrs=*/{},
/*properties=*/{});
// Chrome OS external USB keyboard.
const ui::InputDevice external_chromeos_kbd(
@@ -234,8 +234,8 @@
0x04ca, 0x0082, 0x0111);
fake_udev->AddFakeDevice(
external_chromeos_kbd.name, external_chromeos_kbd.sys_path.value(),
- /*subsystem=*/"input", /*devnode=*/base::nullopt,
- /*devtype=*/base::nullopt, /*sysattrs=*/{},
+ /*subsystem=*/"input", /*devnode=*/absl::nullopt,
+ /*devtype=*/absl::nullopt, /*sysattrs=*/{},
/*properties=*/{{"CROS_KEYBOARD_TOP_ROW_LAYOUT", "1"}});
// Chrome OS external Bluetooth keyboard.
@@ -246,8 +246,8 @@
0x04ca, 0x0082, 0x0111);
fake_udev->AddFakeDevice(
external_bt_chromeos_kbd.name, external_bt_chromeos_kbd.sys_path.value(),
- /*subsystem=*/"input", /*devnode=*/base::nullopt,
- /*devtype=*/base::nullopt, /*sysattrs=*/{},
+ /*subsystem=*/"input", /*devnode=*/absl::nullopt,
+ /*devtype=*/absl::nullopt, /*sysattrs=*/{},
/*properties=*/{{"CROS_KEYBOARD_TOP_ROW_LAYOUT", "1"}});
// An internal keyboard shouldn't change the defaults.
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc b/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc
index 266ebfe..945609de 100644
--- a/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc
@@ -296,7 +296,7 @@
}
void PowerHandler::SendBatteryStatus() {
- const base::Optional<power_manager::PowerSupplyProperties>& proto =
+ const absl::optional<power_manager::PowerSupplyProperties>& proto =
PowerManagerClient::Get()->GetLastStatus();
DCHECK(proto);
bool charging = proto->battery_state() ==
@@ -339,7 +339,7 @@
}
void PowerHandler::SendPowerSources() {
- const base::Optional<power_manager::PowerSupplyProperties>& proto =
+ const absl::optional<power_manager::PowerSupplyProperties>& proto =
PowerManagerClient::Get()->GetLastStatus();
DCHECK(proto);
base::ListValue sources_list;
@@ -411,7 +411,7 @@
}
void PowerHandler::OnGotSwitchStates(
- base::Optional<PowerManagerClient::SwitchStates> result) {
+ absl::optional<PowerManagerClient::SwitchStates> result) {
if (!result.has_value())
return;
lid_state_ = result->lid_state;
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h b/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
index dcda341..80d8ab9f 100644
--- a/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
+++ b/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
@@ -11,11 +11,11 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "chromeos/dbus/power/power_manager_client.h"
#include "chromeos/dbus/power/power_policy_controller.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefChangeRegistrar;
class PrefService;
@@ -142,7 +142,7 @@
// Callback used to receive switch states from PowerManagerClient.
void OnGotSwitchStates(
- base::Optional<PowerManagerClient::SwitchStates> result);
+ absl::optional<PowerManagerClient::SwitchStates> result);
// Returns all possible idle behaviors (that a user can choose from) and
// current idle behavior based on enterprise policy and other factors when on
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_section.cc b/chrome/browser/ui/webui/settings/chromeos/device_section.cc
index 1cb8c731..adb7696 100644
--- a/chrome/browser/ui/webui/settings/chromeos/device_section.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/device_section.cc
@@ -792,7 +792,7 @@
if (power_manager_client) {
power_manager_client->AddObserver(this);
- const base::Optional<power_manager::PowerSupplyProperties>& last_status =
+ const absl::optional<power_manager::PowerSupplyProperties>& last_status =
power_manager_client->GetLastStatus();
if (last_status)
PowerChanged(*last_status);
@@ -1160,7 +1160,7 @@
}
void DeviceSection::OnGotSwitchStates(
- base::Optional<PowerManagerClient::SwitchStates> result) {
+ absl::optional<PowerManagerClient::SwitchStates> result) {
SearchTagRegistry::ScopedTagUpdater updater = registry()->StartUpdate();
if (result && result->lid_state != PowerManagerClient::LidState::NOT_PRESENT)
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_section.h b/chrome/browser/ui/webui/settings/chromeos/device_section.h
index 7f05679..95f5cab 100644
--- a/chrome/browser/ui/webui/settings/chromeos/device_section.h
+++ b/chrome/browser/ui/webui/settings/chromeos/device_section.h
@@ -10,13 +10,13 @@
#include "ash/public/cpp/night_light_controller.h"
#include "ash/public/mojom/cros_display_config.mojom.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/ash/system/pointer_device_observer.h"
#include "chrome/browser/ui/webui/settings/chromeos/os_settings_section.h"
#include "chromeos/dbus/power/power_manager_client.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/events/devices/input_device_event_observer.h"
class PrefService;
@@ -72,7 +72,7 @@
void PowerChanged(const power_manager::PowerSupplyProperties& proto) override;
void OnGotSwitchStates(
- base::Optional<PowerManagerClient::SwitchStates> result);
+ absl::optional<PowerManagerClient::SwitchStates> result);
void UpdateStylusSearchTags();
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc b/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc
index 7b94e1c..46951b8 100644
--- a/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.cc
@@ -244,7 +244,7 @@
void StorageHandler::OnSizeCalculated(
const calculator::SizeCalculator::CalculationType& calculation_type,
int64_t total_bytes,
- const base::Optional<int64_t>& available_bytes) {
+ const absl::optional<int64_t>& available_bytes) {
if (available_bytes) {
UpdateSizeStat(calculation_type, total_bytes, available_bytes.value());
} else {
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h b/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h
index b1196116..0daf7333 100644
--- a/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h
+++ b/chrome/browser/ui/webui/settings/chromeos/device_storage_handler.h
@@ -68,7 +68,7 @@
void OnSizeCalculated(
const calculator::SizeCalculator::CalculationType& calculation_type,
int64_t total_bytes,
- const base::Optional<int64_t>& available_bytes = base::nullopt) override;
+ const absl::optional<int64_t>& available_bytes = absl::nullopt) override;
// Remove the handler from the list of observers of every observed instances.
void StopObservingEvents();
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_storage_handler_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/device_storage_handler_unittest.cc
index 5bf1843..c1c5bdd 100644
--- a/chrome/browser/ui/webui/settings/chromeos/device_storage_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/device_storage_handler_unittest.cc
@@ -467,7 +467,7 @@
std::vector<int64_t>{200 * GB, 50 * GB, 50 * GB};
other_users_size_test_api_->InitializeOtherUserSize(other_user_sizes.size());
for (std::size_t i = 0; i < other_user_sizes.size(); i++) {
- base::Optional<::user_data_auth::GetAccountDiskUsageReply> reply =
+ absl::optional<::user_data_auth::GetAccountDiskUsageReply> reply =
::user_data_auth::GetAccountDiskUsageReply();
reply->set_size(other_user_sizes[i]);
other_users_size_test_api_->SimulateOnGetOtherUserSize(reply);
diff --git a/chrome/browser/ui/webui/settings/chromeos/fake_hierarchy.cc b/chrome/browser/ui/webui/settings/chromeos/fake_hierarchy.cc
index 3cf8646..8d6afc43 100644
--- a/chrome/browser/ui/webui/settings/chromeos/fake_hierarchy.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/fake_hierarchy.cc
@@ -23,7 +23,7 @@
mojom::SearchResultIcon icon,
mojom::SearchResultDefaultRank default_rank,
const std::string& url_path_with_parameters,
- base::Optional<mojom::Subpage> parent_subpage) {
+ absl::optional<mojom::Subpage> parent_subpage) {
auto pair = subpage_map_.emplace(
std::piecewise_construct, std::forward_as_tuple(subpage),
std::forward_as_tuple(name_message_id, section, subpage, icon,
@@ -35,7 +35,7 @@
void FakeHierarchy::AddSettingMetadata(
mojom::Section section,
mojom::Setting setting,
- base::Optional<mojom::Subpage> parent_subpage) {
+ absl::optional<mojom::Subpage> parent_subpage) {
auto pair = setting_map_.emplace(setting, section);
DCHECK(pair.second);
pair.first->second.primary.second = parent_subpage;
diff --git a/chrome/browser/ui/webui/settings/chromeos/fake_hierarchy.h b/chrome/browser/ui/webui/settings/chromeos/fake_hierarchy.h
index d0fbf81..4378aff 100644
--- a/chrome/browser/ui/webui/settings/chromeos/fake_hierarchy.h
+++ b/chrome/browser/ui/webui/settings/chromeos/fake_hierarchy.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_FAKE_HIERARCHY_H_
#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_FAKE_HIERARCHY_H_
-#include "base/optional.h"
#include "chrome/browser/ui/webui/settings/chromeos/hierarchy.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace settings {
@@ -29,11 +29,11 @@
mojom::SearchResultIcon icon,
mojom::SearchResultDefaultRank default_rank,
const std::string& url_path_with_parameters,
- base::Optional<mojom::Subpage> parent_subpage = base::nullopt);
+ absl::optional<mojom::Subpage> parent_subpage = absl::nullopt);
void AddSettingMetadata(
mojom::Section section,
mojom::Setting setting,
- base::Optional<mojom::Subpage> parent_subpage = base::nullopt);
+ absl::optional<mojom::Subpage> parent_subpage = absl::nullopt);
private:
// Hierarchy:
diff --git a/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h b/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h
index 7e81a6d0..6bcd141 100644
--- a/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h
+++ b/chrome/browser/ui/webui/settings/chromeos/google_assistant_handler.h
@@ -7,9 +7,9 @@
#include "ash/components/audio/cras_audio_handler.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace settings {
diff --git a/chrome/browser/ui/webui/settings/chromeos/hierarchy.cc b/chrome/browser/ui/webui/settings/chromeos/hierarchy.cc
index 8e69018..db70223 100644
--- a/chrome/browser/ui/webui/settings/chromeos/hierarchy.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/hierarchy.cc
@@ -98,7 +98,7 @@
CHECK(alternate.first != section_ || alternate.second)
<< "Setting has multiple identical alternate locations: " << setting;
}
- metadata.alternates.emplace_back(section_, /*subpage=*/base::nullopt);
+ metadata.alternates.emplace_back(section_, /*subpage=*/absl::nullopt);
// If a top-level setting exists, the section contains more than just a link
// to a subpage.
@@ -215,7 +215,7 @@
}
Hierarchy::SettingMetadata::SettingMetadata(mojom::Section primary_section)
- : primary(primary_section, /*subpage=*/base::nullopt) {}
+ : primary(primary_section, /*subpage=*/absl::nullopt) {}
Hierarchy::SettingMetadata::~SettingMetadata() = default;
diff --git a/chrome/browser/ui/webui/settings/chromeos/hierarchy.h b/chrome/browser/ui/webui/settings/chromeos/hierarchy.h
index 53334ca..8ca5a79 100644
--- a/chrome/browser/ui/webui/settings/chromeos/hierarchy.h
+++ b/chrome/browser/ui/webui/settings/chromeos/hierarchy.h
@@ -10,11 +10,11 @@
#include <utility>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
#include "chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom.h"
#include "chrome/browser/ui/webui/settings/chromeos/os_settings_identifier.h"
#include "chrome/browser/ui/webui/settings/chromeos/search/search.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace settings {
@@ -77,7 +77,7 @@
mojom::Section section;
// The parent subpage, if applicable. Only applies to nested subpages.
- base::Optional<mojom::Subpage> parent_subpage;
+ absl::optional<mojom::Subpage> parent_subpage;
// Generates a search result for this subpage, using the canonical search
// tag as the search result text. |relevance_score| must be passed by the
@@ -109,7 +109,7 @@
// its subpage. Some settings are embedded directly into the section and have
// no associated subpage.
using SettingLocation =
- std::pair<mojom::Section, base::Optional<mojom::Subpage>>;
+ std::pair<mojom::Section, absl::optional<mojom::Subpage>>;
struct SettingMetadata {
explicit SettingMetadata(mojom::Section primary_section);
diff --git a/chrome/browser/ui/webui/settings/chromeos/internet_section.cc b/chrome/browser/ui/webui/settings/chromeos/internet_section.cc
index e17720e..156e0d7 100644
--- a/chrome/browser/ui/webui/settings/chromeos/internet_section.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/internet_section.cc
@@ -569,13 +569,13 @@
return HermesManagerClient::Get()->GetAvailableEuiccs().size() != 0;
}
-base::Optional<std::string> GetCellularActiveSimIccid(
+absl::optional<std::string> GetCellularActiveSimIccid(
const network_config::mojom::DeviceStatePropertiesPtr& device) {
for (const auto& sim_info : *device->sim_infos) {
if (sim_info->is_primary)
return sim_info->iccid;
}
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace
diff --git a/chrome/browser/ui/webui/settings/chromeos/internet_section.h b/chrome/browser/ui/webui/settings/chromeos/internet_section.h
index 3e7b9e1..d2f50c4 100644
--- a/chrome/browser/ui/webui/settings/chromeos/internet_section.h
+++ b/chrome/browser/ui/webui/settings/chromeos/internet_section.h
@@ -8,12 +8,12 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "base/values.h"
#include "chrome/browser/ui/webui/settings/chromeos/os_settings_section.h"
#include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -72,14 +72,14 @@
// corresponds to the currently active SIM slot, and may not be
// currently connected. A connected cellular network will always be the
// active cellular network.
- base::Optional<std::string> active_cellular_iccid_;
- base::Optional<std::string> active_cellular_guid_;
+ absl::optional<std::string> active_cellular_iccid_;
+ absl::optional<std::string> active_cellular_guid_;
// Note: If not connected, the below fields are null.
- base::Optional<std::string> connected_ethernet_guid_;
- base::Optional<std::string> connected_wifi_guid_;
- base::Optional<std::string> connected_tether_guid_;
- base::Optional<std::string> connected_vpn_guid_;
+ absl::optional<std::string> connected_ethernet_guid_;
+ absl::optional<std::string> connected_wifi_guid_;
+ absl::optional<std::string> connected_tether_guid_;
+ absl::optional<std::string> connected_vpn_guid_;
bool does_ethernet_device_exist_ = false;
diff --git a/chrome/browser/ui/webui/settings/chromeos/main_section.cc b/chrome/browser/ui/webui/settings/chromeos/main_section.cc
index 5c0a895..f26640c 100644
--- a/chrome/browser/ui/webui/settings/chromeos/main_section.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/main_section.cc
@@ -71,7 +71,7 @@
// text which is left empty when the banner should not be shown.
std::u16string eol_return_banner_text;
if (device_managed && handler->ShouldShowUpdateRequiredEolBanner()) {
- base::Optional<int> days = handler->GetTimeRemainingInDays();
+ absl::optional<int> days = handler->GetTimeRemainingInDays();
// We only need to show the banner if less than equal to one week remains to
// reach the update required deadline.
if (days && days.value() <= 7) {
diff --git a/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc b/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc
index aa9adab..a9e1c9f 100644
--- a/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/multidevice_handler.cc
@@ -271,7 +271,7 @@
result = args->GetBoolean(2, &enabled);
DCHECK(result);
- base::Optional<std::string> auth_token;
+ absl::optional<std::string> auth_token;
std::string possible_token_value;
if (args->GetString(3, &possible_token_value))
auth_token = possible_token_value;
@@ -348,7 +348,7 @@
std::unique_ptr<base::DictionaryValue>
MultideviceHandler::GenerateAndroidSmsInfo() {
- base::Optional<GURL> app_url;
+ absl::optional<GURL> app_url;
if (android_sms_app_manager_)
app_url = android_sms_app_manager_->GetCurrentAppUrl();
if (!app_url)
diff --git a/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc
index 14dacce7..383489ac 100644
--- a/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/multidevice_handler_unittest.cc
@@ -74,7 +74,7 @@
void VerifyPageContentDict(
const base::Value* value,
multidevice_setup::mojom::HostStatus expected_host_status,
- const base::Optional<multidevice::RemoteDeviceRef>& expected_host_device,
+ const absl::optional<multidevice::RemoteDeviceRef>& expected_host_device,
const multidevice_setup::MultiDeviceSetupClient::FeatureStatesMap&
feature_states_map) {
const base::DictionaryValue* page_content_dict;
@@ -249,7 +249,7 @@
void SimulateHostStatusUpdate(
multidevice_setup::mojom::HostStatus host_status,
- const base::Optional<multidevice::RemoteDeviceRef>& host_device) {
+ const absl::optional<multidevice::RemoteDeviceRef>& host_device) {
size_t call_data_count_before_call = test_web_ui()->call_data().size();
fake_multidevice_setup_client_->SetHostStatusWithDevice(
@@ -312,7 +312,7 @@
void CallSetFeatureEnabledState(multidevice_setup::mojom::Feature feature,
bool enabled,
- const base::Optional<std::string>& auth_token,
+ const absl::optional<std::string>& auth_token,
bool success) {
size_t call_data_count_before_call = test_web_ui()->call_data().size();
@@ -474,7 +474,7 @@
SimulateHostStatusUpdate(
multidevice_setup::mojom::HostStatus::kEligibleHostExistsButNoHostSet,
- base::nullopt /* host_device */);
+ absl::nullopt /* host_device */);
SimulateHostStatusUpdate(multidevice_setup::mojom::HostStatus::
kHostSetLocallyButWaitingForBackendConfirmation,
test_device_);
diff --git a/chrome/browser/ui/webui/settings/chromeos/os_settings_manager_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/os_settings_manager_unittest.cc
index 0b80e34..5524951 100644
--- a/chrome/browser/ui/webui/settings/chromeos/os_settings_manager_unittest.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/os_settings_manager_unittest.cc
@@ -84,7 +84,7 @@
};
TEST_F(OsSettingsManagerTest, Initialization) {
- base::Optional<base::HistogramEnumEntryMap> sections_enum_entry_map =
+ absl::optional<base::HistogramEnumEntryMap> sections_enum_entry_map =
base::ReadEnumFromEnumsXml("OsSettingsSection");
ASSERT_TRUE(sections_enum_entry_map);
for (const auto& section : constants::AllSections()) {
@@ -108,7 +108,7 @@
<< "Missing OsSettingsSection enums.xml entry for " << section;
}
- base::Optional<base::HistogramEnumEntryMap> subpages_enum_entry_map =
+ absl::optional<base::HistogramEnumEntryMap> subpages_enum_entry_map =
base::ReadEnumFromEnumsXml("OsSettingsSubpage");
ASSERT_TRUE(subpages_enum_entry_map);
for (const auto& subpage : constants::AllSubpages()) {
@@ -122,7 +122,7 @@
<< "Missing OsSettingsSubpage enums.xml entry for " << subpage;
}
- base::Optional<base::HistogramEnumEntryMap> settings_enum_entry_map =
+ absl::optional<base::HistogramEnumEntryMap> settings_enum_entry_map =
base::ReadEnumFromEnumsXml("OsSetting");
ASSERT_TRUE(settings_enum_entry_map);
for (const auto& setting : constants::AllSettings()) {
diff --git a/chrome/browser/ui/webui/settings/chromeos/search/search_handler.cc b/chrome/browser/ui/webui/settings/chromeos/search/search_handler.cc
index 21f04bb..34fc3c59 100644
--- a/chrome/browser/ui/webui/settings/chromeos/search/search_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/search/search_handler.cc
@@ -126,7 +126,7 @@
uint32_t max_num_results,
mojom::ParentResultBehavior parent_result_behavior,
local_search_service::ResponseStatus response_status,
- const base::Optional<std::vector<local_search_service::Result>>&
+ const absl::optional<std::vector<local_search_service::Result>>&
local_search_service_results) {
if (response_status != local_search_service::ResponseStatus::kSuccess) {
LOG(ERROR) << "Cannot search; LocalSearchService returned "
diff --git a/chrome/browser/ui/webui/settings/chromeos/search/search_handler.h b/chrome/browser/ui/webui/settings/chromeos/search/search_handler.h
index ef6666f1..3dbffcf 100644
--- a/chrome/browser/ui/webui/settings/chromeos/search/search_handler.h
+++ b/chrome/browser/ui/webui/settings/chromeos/search/search_handler.h
@@ -8,7 +8,6 @@
#include <vector>
#include "base/gtest_prod_util.h"
-#include "base/optional.h"
#include "chrome/browser/ui/webui/settings/chromeos/search/search.mojom.h"
#include "chrome/browser/ui/webui/settings/chromeos/search/search_tag_registry.h"
#include "chromeos/components/local_search_service/public/cpp/local_search_service_proxy.h"
@@ -18,6 +17,7 @@
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/remote_set.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
@@ -75,7 +75,7 @@
uint32_t max_num_results,
mojom::ParentResultBehavior parent_result_behavior,
local_search_service::ResponseStatus response_status,
- const base::Optional<std::vector<local_search_service::Result>>&
+ const absl::optional<std::vector<local_search_service::Result>>&
local_search_service_results);
void AddParentResults(
diff --git a/chrome/browser/ui/webui/settings/chromeos/server_printer_url_util.cc b/chrome/browser/ui/webui/settings/chromeos/server_printer_url_util.cc
index 005d006a..1a15454 100644
--- a/chrome/browser/ui/webui/settings/chromeos/server_printer_url_util.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/server_printer_url_util.cc
@@ -33,16 +33,16 @@
gurl.SchemeIs("ipps");
}
-base::Optional<GURL> GenerateServerPrinterUrlWithValidScheme(
+absl::optional<GURL> GenerateServerPrinterUrlWithValidScheme(
const std::string& url) {
- base::Optional<GURL> gurl = base::make_optional(GURL(url));
+ absl::optional<GURL> gurl = absl::make_optional(GURL(url));
if (!HasValidServerPrinterScheme(*gurl)) {
// If we're missing a valid scheme, try querying with IPPS first.
gurl = GURL("ipps://" + url);
}
if (!gurl->is_valid())
- return base::nullopt;
+ return absl::nullopt;
// Replaces IPP/IPPS by HTTP/HTTPS. IPP standard describes protocol built
// on top of HTTP, so both types of addresses have the same meaning in the
@@ -66,7 +66,7 @@
}
// Check validation of the URL address and return |gurl| if valid.
- return gurl->IsStandard() ? gurl : base::nullopt;
+ return gurl->IsStandard() ? gurl : absl::nullopt;
}
} // namespace settings
diff --git a/chrome/browser/ui/webui/settings/chromeos/server_printer_url_util.h b/chrome/browser/ui/webui/settings/chromeos/server_printer_url_util.h
index ad118c1..4893f78 100644
--- a/chrome/browser/ui/webui/settings/chromeos/server_printer_url_util.h
+++ b/chrome/browser/ui/webui/settings/chromeos/server_printer_url_util.h
@@ -7,7 +7,7 @@
#include <string>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
@@ -18,10 +18,10 @@
// IPPS. Returns false for an empty or any other scheme.
bool HasValidServerPrinterScheme(const GURL& gurl);
-// Returns a GURL from the input |url|. Returns base::nullopt if
+// Returns a GURL from the input |url|. Returns absl::nullopt if
// either |url| is invalid or constructing the GURL failed. This will also
// default the server printer URI to use HTTPS if it detects a missing scheme.
-base::Optional<GURL> GenerateServerPrinterUrlWithValidScheme(
+absl::optional<GURL> GenerateServerPrinterUrlWithValidScheme(
const std::string& url);
} // namespace settings
diff --git a/chrome/browser/ui/webui/settings/chromeos/server_printer_url_util_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/server_printer_url_util_unittest.cc
index 26e2ec1..aa02398 100644
--- a/chrome/browser/ui/webui/settings/chromeos/server_printer_url_util_unittest.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/server_printer_url_util_unittest.cc
@@ -6,8 +6,8 @@
#include <string>
-#include "base/optional.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace chromeos {
@@ -44,7 +44,7 @@
TEST_F(ServerPrinterUrlUtilTest, ConvertToGURL) {
// Test that a GURL is created with |gurl1| as its source.
std::string url1("http://123.123.11.11:631");
- base::Optional<GURL> gurl1 = GenerateServerPrinterUrlWithValidScheme(url1);
+ absl::optional<GURL> gurl1 = GenerateServerPrinterUrlWithValidScheme(url1);
DCHECK(gurl1);
ASSERT_EQ("http://123.123.11.11:631/", gurl1->spec());
ASSERT_EQ("http", gurl1->scheme());
@@ -52,7 +52,7 @@
// Test that HTTPS is the default scheme if a scheme is not provided.
std::string url2("123.123.11.11:631");
- base::Optional<GURL> gurl2 = GenerateServerPrinterUrlWithValidScheme(url2);
+ absl::optional<GURL> gurl2 = GenerateServerPrinterUrlWithValidScheme(url2);
DCHECK(gurl2);
ASSERT_EQ("https", gurl2->scheme());
ASSERT_EQ("https://123.123.11.11:631/", gurl2->spec());
@@ -60,7 +60,7 @@
// Test that if a URL has IPP as its scheme, it will create a new GURL with
// HTTP as its scheme and 631 as its port.
std::string url3("ipp://123.123.11.11");
- base::Optional<GURL> gurl3 = GenerateServerPrinterUrlWithValidScheme(url3);
+ absl::optional<GURL> gurl3 = GenerateServerPrinterUrlWithValidScheme(url3);
DCHECK(gurl3);
ASSERT_EQ("http", gurl3->scheme());
ASSERT_EQ("631", gurl3->port());
@@ -69,7 +69,7 @@
// Test that if a URL has IPP as its scheme and a specified port, it will
// create a new GURL with HTTP as the scheme and keeps the same port.
std::string url4("ipp://123.123.11.11:321");
- base::Optional<GURL> gurl4 = GenerateServerPrinterUrlWithValidScheme(url4);
+ absl::optional<GURL> gurl4 = GenerateServerPrinterUrlWithValidScheme(url4);
DCHECK(gurl4);
ASSERT_EQ("http", gurl4->scheme());
ASSERT_EQ("321", gurl4->port());
@@ -78,7 +78,7 @@
// Test that if a URL has IPPS as its scheme and a specified port, a new GURL
// is created with the scheme as HTTPS and keeps the same port.
std::string url5("ipps://123.123.11.11:555");
- base::Optional<GURL> gurl5 = GenerateServerPrinterUrlWithValidScheme(url5);
+ absl::optional<GURL> gurl5 = GenerateServerPrinterUrlWithValidScheme(url5);
DCHECK(gurl5);
ASSERT_EQ("https", gurl5->scheme());
ASSERT_EQ("555", gurl5->port());
diff --git a/chrome/browser/ui/webui/settings/chromeos/settings_user_action_tracker.h b/chrome/browser/ui/webui/settings/chromeos/settings_user_action_tracker.h
index 93ce1f0..9f8130ed 100644
--- a/chrome/browser/ui/webui/settings/chromeos/settings_user_action_tracker.h
+++ b/chrome/browser/ui/webui/settings/chromeos/settings_user_action_tracker.h
@@ -7,12 +7,12 @@
#include <memory>
-#include "base/optional.h"
#include "chrome/browser/ui/webui/settings/chromeos/constants/setting.mojom.h"
#include "chrome/browser/ui/webui/settings/chromeos/search/per_session_settings_user_action_tracker.h"
#include "chrome/browser/ui/webui/settings/chromeos/search/user_action_recorder.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
namespace settings {
diff --git a/chrome/browser/ui/webui/settings/people_handler.cc b/chrome/browser/ui/webui/settings/people_handler.cc
index 4799a2f2..95c22b6 100644
--- a/chrome/browser/ui/webui/settings/people_handler.cc
+++ b/chrome/browser/ui/webui/settings/people_handler.cc
@@ -489,7 +489,7 @@
// Chrome OS), then show only the primary account, whether or not that account
// has consented to sync.
auto* identity_manager = IdentityManagerFactory::GetForProfile(profile_);
- base::Optional<AccountInfo> primary_account_info =
+ absl::optional<AccountInfo> primary_account_info =
identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
identity_manager->GetPrimaryAccountInfo(ConsentLevel::kSignin));
if (primary_account_info.has_value())
@@ -508,7 +508,7 @@
Browser* browser =
chrome::FindBrowserWithWebContents(web_ui()->GetWebContents());
- base::Optional<AccountInfo> maybe_account =
+ absl::optional<AccountInfo> maybe_account =
IdentityManagerFactory::GetForProfile(profile_)
->FindExtendedAccountInfoForAccountWithRefreshTokenByEmailAddress(
email->GetString());
diff --git a/chrome/browser/ui/webui/settings/safety_check_handler_unittest.cc b/chrome/browser/ui/webui/settings/safety_check_handler_unittest.cc
index 443d5c3..a42125a 100644
--- a/chrome/browser/ui/webui/settings/safety_check_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/safety_check_handler_unittest.cc
@@ -8,7 +8,6 @@
#include <unordered_map>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -44,6 +43,7 @@
#include "extensions/common/extension_builder.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_impl_win.h"
diff --git a/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc b/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc
index 061263c6..8220f6a 100644
--- a/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc
@@ -101,7 +101,7 @@
EXPECT_TRUE(profiles::IsDefaultAvatarIconUrl(icon_url, &url_icon_index));
EXPECT_EQ(icon_index, url_icon_index);
EXPECT_TRUE(!icon->FindStringPath("label")->empty());
- base::Optional<bool> current_selected = icon->FindBoolPath("selected");
+ absl::optional<bool> current_selected = icon->FindBoolPath("selected");
if (selected_index == icon_index) {
EXPECT_FALSE(selected_found);
EXPECT_TRUE(current_selected.value_or(false));
@@ -350,7 +350,7 @@
entry()->SetAvatarIconIndex(37);
web_ui()->ClearTrackedCalls();
- entry()->SetProfileThemeColors(base::nullopt);
+ entry()->SetProfileThemeColors(absl::nullopt);
EXPECT_EQ(1U, web_ui()->call_data().size());
const content::TestWebUI::CallData& data_1 = *web_ui()->call_data().back();
diff --git a/chrome/browser/ui/webui/settings/settings_security_key_handler.cc b/chrome/browser/ui/webui/settings/settings_security_key_handler.cc
index 14180463..a1cb57c 100644
--- a/chrome/browser/ui/webui/settings/settings_security_key_handler.cc
+++ b/chrome/browser/ui/webui/settings/settings_security_key_handler.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/containers/contains.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
@@ -23,6 +22,7 @@
#include "device/fido/pin.h"
#include "device/fido/reset_request_handler.h"
#include "device/fido/set_pin_request_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
using content::BrowserThread;
@@ -117,7 +117,7 @@
void SecurityKeysPINHandler::OnGatherPIN(uint32_t current_min_pin_length,
uint32_t new_min_pin_length,
- base::Optional<int64_t> num_retries) {
+ absl::optional<int64_t> num_retries) {
DCHECK_EQ(State::kStartSetPIN, state_);
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -422,9 +422,9 @@
void SecurityKeysCredentialHandler::OnHaveCredentials(
device::CtapDeviceResponseCode status,
- base::Optional<std::vector<device::AggregatedEnumerateCredentialsResponse>>
+ absl::optional<std::vector<device::AggregatedEnumerateCredentialsResponse>>
responses,
- base::Optional<size_t> remaining_credentials) {
+ absl::optional<size_t> remaining_credentials) {
DCHECK_EQ(State::kGettingCredentials, state_);
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(credential_management_);
@@ -741,7 +741,7 @@
void SecurityKeysBioEnrollmentHandler::OnHaveEnumeration(
device::CtapDeviceResponseCode code,
- base::Optional<std::map<std::vector<uint8_t>, std::string>> enrollments) {
+ absl::optional<std::map<std::vector<uint8_t>, std::string>> enrollments) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!callback_id_.empty());
DCHECK_EQ(state_, State::kEnumerating);
@@ -814,7 +814,7 @@
void SecurityKeysBioEnrollmentHandler::OnHavePostEnrollmentEnumeration(
std::vector<uint8_t> enrolled_template_id,
device::CtapDeviceResponseCode code,
- base::Optional<std::map<std::vector<uint8_t>, std::string>> enrollments) {
+ absl::optional<std::map<std::vector<uint8_t>, std::string>> enrollments) {
DCHECK_EQ(state_, State::kEnrolling);
DCHECK(!callback_id_.empty());
state_ = State::kReady;
diff --git a/chrome/browser/ui/webui/settings/settings_security_key_handler.h b/chrome/browser/ui/webui/settings/settings_security_key_handler.h
index fd83471..de5cb96 100644
--- a/chrome/browser/ui/webui/settings/settings_security_key_handler.h
+++ b/chrome/browser/ui/webui/settings/settings_security_key_handler.h
@@ -10,12 +10,12 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "device/fido/bio/enrollment.h"
#include "device/fido/bio/enrollment_handler.h"
#include "device/fido/fido_constants.h"
#include "device/fido/fido_discovery_factory.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class ListValue;
@@ -83,7 +83,7 @@
void HandleStartSetPIN(const base::ListValue* args);
void OnGatherPIN(uint32_t current_min_pin_length,
uint32_t new_min_pin_length,
- base::Optional<int64_t> num_retries);
+ absl::optional<int64_t> num_retries);
void OnSetPINComplete(device::CtapDeviceResponseCode code);
void HandleSetPIN(const base::ListValue* args);
@@ -124,7 +124,7 @@
State state_ = State::kNone;
std::unique_ptr<device::ResetRequestHandler> reset_;
- base::Optional<device::CtapDeviceResponseCode> reset_result_;
+ absl::optional<device::CtapDeviceResponseCode> reset_result_;
std::string callback_id_;
base::WeakPtrFactory<SecurityKeysResetHandler> weak_factory_{this};
@@ -164,10 +164,10 @@
void OnCredentialManagementReady();
void OnHaveCredentials(
device::CtapDeviceResponseCode status,
- base::Optional<
+ absl::optional<
std::vector<device::AggregatedEnumerateCredentialsResponse>>
responses,
- base::Optional<size_t> remaining_credentials);
+ absl::optional<size_t> remaining_credentials);
void OnGatherPIN(uint32_t min_pin_length,
int64_t num_retries,
base::OnceCallback<void(std::string)>);
@@ -225,7 +225,7 @@
void HandleEnumerate(const base::ListValue* args);
void OnHaveEnumeration(
device::CtapDeviceResponseCode,
- base::Optional<std::map<std::vector<uint8_t>, std::string>>);
+ absl::optional<std::map<std::vector<uint8_t>, std::string>>);
void OnEnrollingResponse(device::BioEnrollmentSampleStatus, uint8_t);
void OnEnrollmentFinished(device::CtapDeviceResponseCode,
@@ -233,7 +233,7 @@
void OnHavePostEnrollmentEnumeration(
std::vector<uint8_t> enrolled_template_id,
device::CtapDeviceResponseCode code,
- base::Optional<std::map<std::vector<uint8_t>, std::string>> enrollments);
+ absl::optional<std::map<std::vector<uint8_t>, std::string>> enrollments);
void HandleDelete(const base::ListValue* args);
void OnDelete(device::CtapDeviceResponseCode);
diff --git a/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc
index f59c594..a6805a64 100644
--- a/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc
@@ -104,35 +104,35 @@
html_source->AddLocalizedString("captionsEnableLiveCaptionSubtitle",
live_caption_subtitle_message);
- base::Optional<speech::SodaLanguagePackComponentConfig> englishConfig =
+ absl::optional<speech::SodaLanguagePackComponentConfig> englishConfig =
speech::GetLanguageComponentConfig(speech::LanguageCode::kEnUs);
html_source->AddString("sodaLanguageCodeEnglish",
englishConfig->language_name);
html_source->AddLocalizedString("sodaLanguageDisplayNameEnglish",
englishConfig->display_name);
- base::Optional<speech::SodaLanguagePackComponentConfig> frenchConfig =
+ absl::optional<speech::SodaLanguagePackComponentConfig> frenchConfig =
speech::GetLanguageComponentConfig(speech::LanguageCode::kFrFr);
html_source->AddString("sodaLanguageCodeFrench", frenchConfig->language_name);
html_source->AddLocalizedString("sodaLanguageDisplayNameFrench",
frenchConfig->display_name);
- base::Optional<speech::SodaLanguagePackComponentConfig> germanConfig =
+ absl::optional<speech::SodaLanguagePackComponentConfig> germanConfig =
speech::GetLanguageComponentConfig(speech::LanguageCode::kDeDe);
html_source->AddString("sodaLanguageCodeGerman", germanConfig->language_name);
html_source->AddLocalizedString("sodaLanguageDisplayNameGerman",
germanConfig->display_name);
- base::Optional<speech::SodaLanguagePackComponentConfig> italianConfig =
+ absl::optional<speech::SodaLanguagePackComponentConfig> italianConfig =
speech::GetLanguageComponentConfig(speech::LanguageCode::kItIt);
html_source->AddString("sodaLanguageCodeItalian",
italianConfig->language_name);
html_source->AddLocalizedString("sodaLanguageDisplayNameItalian",
italianConfig->display_name);
- base::Optional<speech::SodaLanguagePackComponentConfig> japaneseConfig =
+ absl::optional<speech::SodaLanguagePackComponentConfig> japaneseConfig =
speech::GetLanguageComponentConfig(speech::LanguageCode::kJaJp);
html_source->AddString("sodaLanguageCodeJapanese",
japaneseConfig->language_name);
html_source->AddLocalizedString("sodaLanguageDisplayNameJapanese",
japaneseConfig->display_name);
- base::Optional<speech::SodaLanguagePackComponentConfig> spanishConfig =
+ absl::optional<speech::SodaLanguagePackComponentConfig> spanishConfig =
speech::GetLanguageComponentConfig(speech::LanguageCode::kEsEs);
html_source->AddString("sodaLanguageCodeSpanish",
spanishConfig->language_name);
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.cc b/chrome/browser/ui/webui/settings/site_settings_handler.cc
index 89441e5a..da569d6 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler.cc
+++ b/chrome/browser/ui/webui/settings/site_settings_handler.cc
@@ -619,7 +619,7 @@
}
void SiteSettingsHandler::OnObjectPermissionChanged(
- base::Optional<ContentSettingsType> guard_content_settings_type,
+ absl::optional<ContentSettingsType> guard_content_settings_type,
ContentSettingsType data_content_settings_type) {
if (!guard_content_settings_type ||
!site_settings::HasRegisteredGroupName(*guard_content_settings_type) ||
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.h b/chrome/browser/ui/webui/settings/site_settings_handler.h
index 3aa4ea26..202503c 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler.h
+++ b/chrome/browser/ui/webui/settings/site_settings_handler.h
@@ -11,7 +11,6 @@
#include <string>
#include "base/containers/flat_set.h"
-#include "base/optional.h"
#include "base/scoped_multi_source_observation.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browsing_data/cookies_tree_model.h"
@@ -26,6 +25,7 @@
#include "components/prefs/pref_store.h"
#include "content/public/browser/host_zoom_map.h"
#include "ppapi/buildflags/buildflags.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefChangeRegistrar;
@@ -81,7 +81,7 @@
// ObjectPermissionContextBase::PermissionObserver implementation:
void OnObjectPermissionChanged(
- base::Optional<ContentSettingsType> guard_content_settings_type,
+ absl::optional<ContentSettingsType> guard_content_settings_type,
ContentSettingsType data_content_settings_type) override;
void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
index 861d246..132d2d6 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
@@ -2225,7 +2225,7 @@
UsbChooserContext::DeviceInfoToValue(*persistent_device_info_)));
EXPECT_CALL(observer_,
- OnObjectPermissionChanged(base::Optional<ContentSettingsType>(
+ OnObjectPermissionChanged(absl::optional<ContentSettingsType>(
ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
EXPECT_CALL(observer_, OnPermissionRevoked(kGoogleOrigin));
@@ -2272,7 +2272,7 @@
}
EXPECT_CALL(observer_,
- OnObjectPermissionChanged(base::Optional<ContentSettingsType>(
+ OnObjectPermissionChanged(absl::optional<ContentSettingsType>(
ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
EXPECT_CALL(observer_, OnPermissionRevoked(kChromiumOrigin));
@@ -2318,7 +2318,7 @@
}
EXPECT_CALL(observer_,
- OnObjectPermissionChanged(base::Optional<ContentSettingsType>(
+ OnObjectPermissionChanged(absl::optional<ContentSettingsType>(
ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
EXPECT_CALL(observer_, OnPermissionRevoked(kAndroidOrigin));
diff --git a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc
index 5c3d9c7..fd34c4c 100644
--- a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc
+++ b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc
@@ -437,7 +437,7 @@
dice_signed_in_profile_creator_ =
std::make_unique<DiceSignedInProfileCreator>(
profile_, account_info_.account_id,
- /*local_profile_name=*/std::u16string(), /*icon_index=*/base::nullopt,
+ /*local_profile_name=*/std::u16string(), /*icon_index=*/absl::nullopt,
/*use_guest=*/false,
base::BindOnce(&DiceTurnSyncOnHelper::OnNewSignedInProfileCreated,
base::Unretained(this)));
diff --git a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc
index e3e8c2c..4bd580a 100644
--- a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc
+++ b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper_unittest.cc
@@ -14,7 +14,6 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/location.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/policy/cloud/user_policy_signin_service.h"
@@ -49,6 +48,7 @@
#include "google_apis/gaia/google_service_auth_error.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using ::testing::AtLeast;
using ::testing::Return;
@@ -317,7 +317,7 @@
user_policy_signin_service_->set_account(account_id_, kEnterpriseEmail);
// Update the account info to have a consistent hosted domain field.
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
identity_manager()->FindExtendedAccountInfoForAccountWithRefreshToken(
core_account_info);
EXPECT_TRUE(account_info);
@@ -492,7 +492,7 @@
bool run_delegate_callbacks_ = true;
// Expected delegate calls.
- base::Optional<SigninUIError> expected_login_error_;
+ absl::optional<SigninUIError> expected_login_error_;
std::string expected_enterprise_confirmation_email_;
std::string expected_merge_data_previous_email_;
std::string expected_merge_data_new_email_;
@@ -520,7 +520,7 @@
// State of the delegate calls.
int delegate_destroyed_ = 0;
- base::Optional<SigninUIError> login_error_;
+ absl::optional<SigninUIError> login_error_;
std::string enterprise_confirmation_email_;
std::string merge_data_previous_email_;
std::string merge_data_new_email_;
diff --git a/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc b/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc
index a8fd230..e522b9c3d 100644
--- a/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc
+++ b/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc
@@ -126,7 +126,7 @@
Profile* profile = Profile::FromWebUI(web_ui());
signin::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(profile);
- base::Optional<AccountInfo> updated_info =
+ absl::optional<AccountInfo> updated_info =
identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
intercepted_account());
if (updated_info)
diff --git a/chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.cc b/chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.cc
index 5da506c..7161697 100644
--- a/chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.cc
+++ b/chrome/browser/ui/webui/signin/enterprise_profile_welcome_handler.cc
@@ -42,7 +42,7 @@
}
std::string GetManagedDeviceTitle() {
- base::Optional<std::string> device_manager =
+ absl::optional<std::string> device_manager =
chrome::GetDeviceManagerIdentity();
if (!device_manager)
return std::string();
diff --git a/chrome/browser/ui/webui/signin/inline_login_handler.cc b/chrome/browser/ui/webui/signin/inline_login_handler.cc
index 5091acb5..187467c8 100644
--- a/chrome/browser/ui/webui/signin/inline_login_handler.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_handler.cc
@@ -184,7 +184,7 @@
}
bool skip_for_now = dict.FindBoolKey("skipForNow").value_or(false);
- base::Optional<bool> trusted = dict.FindBoolKey("trusted");
+ absl::optional<bool> trusted = dict.FindBoolKey("trusted");
bool trusted_value = trusted.value_or(false);
bool trusted_found = trusted.has_value();
diff --git a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
index 5fb3ec9..6d28cde 100644
--- a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
@@ -259,7 +259,7 @@
if (has_primary_account && is_force_sign_in_with_usermanager) {
CoreAccountInfo primary_account =
identity_manager->GetPrimaryAccountInfo(signin::ConsentLevel::kSync);
- base::Optional<AccountInfo> primary_account_info =
+ absl::optional<AccountInfo> primary_account_info =
identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
primary_account);
std::u16string profile_name;
diff --git a/chrome/browser/ui/webui/signin/profile_creation_customize_themes_handler.h b/chrome/browser/ui/webui/signin/profile_creation_customize_themes_handler.h
index 0d385fd6d..5356308 100644
--- a/chrome/browser/ui/webui/signin/profile_creation_customize_themes_handler.h
+++ b/chrome/browser/ui/webui/signin/profile_creation_customize_themes_handler.h
@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_CREATION_CUSTOMIZE_THEMES_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_CREATION_CUSTOMIZE_THEMES_HANDLER_H_
-#include "base/optional.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/webui/resources/cr_components/customize_themes/customize_themes.mojom.h"
diff --git a/chrome/browser/ui/webui/signin/profile_picker_handler.cc b/chrome/browser/ui/webui/signin/profile_picker_handler.cc
index ec510ef..500d830 100644
--- a/chrome/browser/ui/webui/signin/profile_picker_handler.cc
+++ b/chrome/browser/ui/webui/signin/profile_picker_handler.cc
@@ -8,7 +8,6 @@
#include "base/callback_helpers.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/util/values/values_util.h"
@@ -46,6 +45,7 @@
#include "components/signin/public/identity_manager/account_info.h"
#include "components/startup_metric_utils/browser/startup_metric_utils.h"
#include "content/public/browser/url_data_source.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
@@ -70,14 +70,14 @@
kMaxValue = kDeleteProfile,
};
-base::Optional<SkColor> GetChromeColorColorById(int color_id) {
+absl::optional<SkColor> GetChromeColorColorById(int color_id) {
for (chrome_colors::ColorInfo color_info :
chrome_colors::kGeneratedColorsInfo) {
if (color_id == color_info.id)
return color_info.color;
}
- return base::nullopt;
+ return absl::nullopt;
}
void RecordProfilePickerAction(ProfilePickerAction action) {
@@ -88,7 +88,7 @@
base::UmaHistogramBoolean("ProfilePicker.AskOnStartupChanged", value);
}
-void RecordNewProfileSpec(base::Optional<SkColor> profile_color,
+void RecordNewProfileSpec(absl::optional<SkColor> profile_color,
bool create_shortcut) {
int theme_id =
profile_color.has_value()
@@ -103,7 +103,7 @@
}
base::Value GetAutogeneratedProfileThemeInfoValue(int color_id,
- base::Optional<SkColor> color,
+ absl::optional<SkColor> color,
SkColor frame_color,
SkColor active_tab_color,
SkColor frame_text_color,
@@ -136,7 +136,7 @@
ThemeProperties::COLOR_TAB_FOREGROUND_INACTIVE_FRAME_ACTIVE,
/*incognito=*/false, dark_mode);
return GetAutogeneratedProfileThemeInfoValue(
- kDefaultThemeColorId, base::nullopt, frame_color, active_tab_color,
+ kDefaultThemeColorId, absl::nullopt, frame_color, active_tab_color,
frame_text_color, avatar_icon_size);
}
@@ -339,7 +339,7 @@
if (!args->Get(0, &profile_path_value))
return;
- base::Optional<base::FilePath> profile_path =
+ absl::optional<base::FilePath> profile_path =
util::ValueToFilePath(*profile_path_value);
if (!profile_path)
return;
@@ -440,7 +440,7 @@
const base::Value& callback_id = args->GetList()[0];
const base::Value& user_theme_choice = args->GetList()[1];
int color_id = user_theme_choice.FindIntKey("colorId").value();
- base::Optional<SkColor> color = user_theme_choice.FindDoubleKey("color");
+ absl::optional<SkColor> color = user_theme_choice.FindDoubleKey("color");
int avatar_icon_size =
kProfileCreationAvatarSize * web_ui()->GetDeviceScaleFactor();
base::Value dict;
@@ -477,7 +477,7 @@
std::u16string profile_name =
base::UTF8ToUTF16(args->GetList()[0].GetString());
// profileColor is undefined for the default theme.
- base::Optional<SkColor> profile_color;
+ absl::optional<SkColor> profile_color;
if (args->GetList()[1].is_int())
profile_color = args->GetList()[1].GetInt();
size_t avatar_index = args->GetList()[2].GetInt();
@@ -520,7 +520,7 @@
if (!args->Get(0, &profile_path_value))
return;
- base::Optional<base::FilePath> profile_path =
+ absl::optional<base::FilePath> profile_path =
util::ValueToFilePath(*profile_path_value);
if (!profile_path)
return;
@@ -539,7 +539,7 @@
}
void ProfilePickerHandler::OnProfileCreated(
- base::Optional<SkColor> profile_color,
+ absl::optional<SkColor> profile_color,
bool create_shortcut,
Profile* profile,
Profile::CreateStatus status) {
@@ -571,7 +571,7 @@
}
void ProfilePickerHandler::OnProfileCreationSuccess(
- base::Optional<SkColor> profile_color,
+ absl::optional<SkColor> profile_color,
bool create_shortcut,
Profile* profile) {
DCHECK(profile);
@@ -621,7 +621,7 @@
void ProfilePickerHandler::HandleSetProfileName(const base::ListValue* args) {
CHECK_EQ(2U, args->GetSize());
const base::Value& profile_path_value = args->GetList()[0];
- base::Optional<base::FilePath> profile_path =
+ absl::optional<base::FilePath> profile_path =
util::ValueToFilePath(profile_path_value);
if (!profile_path) {
@@ -643,7 +643,7 @@
void ProfilePickerHandler::HandleRemoveProfile(const base::ListValue* args) {
CHECK_EQ(1U, args->GetSize());
const base::Value& profile_path_value = args->GetList()[0];
- base::Optional<base::FilePath> profile_path =
+ absl::optional<base::FilePath> profile_path =
util::ValueToFilePath(profile_path_value);
if (!profile_path) {
@@ -660,7 +660,7 @@
AllowJavascript();
CHECK_EQ(1U, args->GetSize());
const base::Value& profile_path_value = args->GetList()[0];
- base::Optional<base::FilePath> profile_path =
+ absl::optional<base::FilePath> profile_path =
util::ValueToFilePath(profile_path_value);
if (!profile_path)
return;
diff --git a/chrome/browser/ui/webui/signin/profile_picker_handler.h b/chrome/browser/ui/webui/signin/profile_picker_handler.h
index a7ee9a2..b000a77 100644
--- a/chrome/browser/ui/webui/signin/profile_picker_handler.h
+++ b/chrome/browser/ui/webui/signin/profile_picker_handler.h
@@ -76,11 +76,11 @@
bool open_settings,
Profile* profile,
Profile::CreateStatus profile_create_status);
- void OnProfileCreated(base::Optional<SkColor> profile_color,
+ void OnProfileCreated(absl::optional<SkColor> profile_color,
bool create_shortcut,
Profile* profile,
Profile::CreateStatus status);
- void OnProfileCreationSuccess(base::Optional<SkColor> profile_color,
+ void OnProfileCreationSuccess(absl::optional<SkColor> profile_color,
bool create_shortcut,
Profile* profile);
void PushProfilesList();
diff --git a/chrome/browser/ui/webui/signin/profile_picker_ui.cc b/chrome/browser/ui/webui/signin/profile_picker_ui.cc
index ea5ec0e..554025d 100644
--- a/chrome/browser/ui/webui/signin/profile_picker_ui.cc
+++ b/chrome/browser/ui/webui/signin/profile_picker_ui.cc
@@ -71,7 +71,7 @@
std::string GetManagedDeviceDisclaimer() {
if (!base::FeatureList::IsEnabled(features::kSignInProfileCreationEnterprise))
return std::string();
- base::Optional<std::string> device_manager =
+ absl::optional<std::string> device_manager =
chrome::GetDeviceManagerIdentity();
if (!device_manager)
return std::string();
diff --git a/chrome/browser/ui/webui/signin/signin_reauth_ui.cc b/chrome/browser/ui/webui/signin/signin_reauth_ui.cc
index e722b84..08fe36c4 100644
--- a/chrome/browser/ui/webui/signin/signin_reauth_ui.cc
+++ b/chrome/browser/ui/webui/signin/signin_reauth_ui.cc
@@ -8,7 +8,6 @@
#include "base/check.h"
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
@@ -28,6 +27,7 @@
#include "content/public/browser/web_ui_data_source.h"
#include "google_apis/gaia/core_account_id.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/resource_path.h"
#include "ui/base/webui/web_ui_util.h"
@@ -47,7 +47,7 @@
// Sync shouldn't be enabled. Otherwise, the primary account and the first
// cookie account may diverge.
DCHECK(!identity_manager->HasPrimaryAccount(signin::ConsentLevel::kSync));
- base::Optional<AccountInfo> account_info =
+ absl::optional<AccountInfo> account_info =
identity_manager
->FindExtendedAccountInfoForAccountWithRefreshTokenByAccountId(
account_id);
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
index f2efd0cd..116fdde 100644
--- a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
+++ b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
@@ -106,7 +106,7 @@
void SyncConfirmationHandler::HandleAccountInfoRequest(
const base::ListValue* args) {
DCHECK(ProfileSyncServiceFactory::IsSyncAllowed(profile_));
- base::Optional<AccountInfo> primary_account_info =
+ absl::optional<AccountInfo> primary_account_info =
identity_manager_->FindExtendedAccountInfoForAccountWithRefreshToken(
identity_manager_->GetPrimaryAccountInfo(ConsentLevel::kSignin));
@@ -217,7 +217,7 @@
const base::ListValue* args) {
AllowJavascript();
- base::Optional<AccountInfo> primary_account_info =
+ absl::optional<AccountInfo> primary_account_info =
identity_manager_->FindExtendedAccountInfoForAccountWithRefreshToken(
identity_manager_->GetPrimaryAccountInfo(ConsentLevel::kSignin));
if (!primary_account_info) {
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc b/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
index 73ff06f..1dc30cc0 100644
--- a/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
+++ b/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
@@ -165,7 +165,7 @@
signin::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(profile());
- base::Optional<AccountInfo> primary_account =
+ absl::optional<AccountInfo> primary_account =
identity_manager->FindExtendedAccountInfoForAccountWithRefreshToken(
identity_manager->GetPrimaryAccountInfo(
signin::ConsentLevel::kSync));
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc b/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc
index 768fdca3..e2da39f 100644
--- a/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc
+++ b/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc
@@ -45,7 +45,7 @@
: SigninWebDialogUI(web_ui), profile_(Profile::FromWebUI(web_ui)) {
// Initializing the WebUIDataSource in the constructor is needed for polymer
// tests.
- Initialize(/*profile_creation_flow_color=*/base::nullopt);
+ Initialize(/*profile_creation_flow_color=*/absl::nullopt);
}
SyncConfirmationUI::~SyncConfirmationUI() = default;
@@ -62,7 +62,7 @@
}
void SyncConfirmationUI::Initialize(
- base::Optional<SkColor> profile_creation_flow_color) {
+ absl::optional<SkColor> profile_creation_flow_color) {
const bool is_sync_allowed =
ProfileSyncServiceFactory::IsSyncAllowed(profile_);
@@ -108,7 +108,7 @@
void SyncConfirmationUI::InitializeForSyncConfirmation(
content::WebUIDataSource* source,
- base::Optional<SkColor> profile_creation_flow_color) {
+ absl::optional<SkColor> profile_creation_flow_color) {
// Resources for testing.
source->AddResourcePath("test_loader.js", IDR_WEBUI_JS_TEST_LOADER_JS);
source->AddResourcePath("test_loader_util.js",
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_ui.h b/chrome/browser/ui/webui/signin/sync_confirmation_ui.h
index 923a0ac..701c4af 100644
--- a/chrome/browser/ui/webui/signin/sync_confirmation_ui.h
+++ b/chrome/browser/ui/webui/signin/sync_confirmation_ui.h
@@ -40,11 +40,11 @@
void InitializeMessageHandlerForCreationFlow(SkColor profile_color);
private:
- void Initialize(base::Optional<SkColor> profile_creation_flow_color);
+ void Initialize(absl::optional<SkColor> profile_creation_flow_color);
void InitializeMessageHandler(Browser* browser);
void InitializeForSyncConfirmation(
content::WebUIDataSource* source,
- base::Optional<SkColor> profile_creation_flow_color);
+ absl::optional<SkColor> profile_creation_flow_color);
void InitializeForSyncDisabled(content::WebUIDataSource* source);
// Adds a string resource with the given GRD |ids| to the WebUI data |source|
diff --git a/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc b/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc
index 2545e53..84ee293 100644
--- a/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc
+++ b/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc
@@ -80,7 +80,7 @@
}
void TabSearchPageHandler::CloseTab(int32_t tab_id) {
- base::Optional<TabDetails> optional_details = GetTabDetails(tab_id);
+ absl::optional<TabDetails> optional_details = GetTabDetails(tab_id);
if (!optional_details)
return;
@@ -117,7 +117,7 @@
std::move(callback).Run(std::move(profile_tabs));
}
-base::Optional<TabSearchPageHandler::TabDetails>
+absl::optional<TabSearchPageHandler::TabDetails>
TabSearchPageHandler::GetTabDetails(int32_t tab_id) {
for (auto* browser : *BrowserList::GetInstance()) {
if (!ShouldTrackBrowser(browser)) {
@@ -133,7 +133,7 @@
}
}
- return base::nullopt;
+ return absl::nullopt;
}
void TabSearchPageHandler::GetTabGroups(GetTabGroupsCallback callback) {
@@ -144,7 +144,7 @@
void TabSearchPageHandler::SwitchToTab(
tab_search::mojom::SwitchToTabInfoPtr switch_to_tab_info) {
- base::Optional<TabDetails> optional_details =
+ absl::optional<TabDetails> optional_details =
GetTabDetails(switch_to_tab_info->tab_id);
if (!optional_details)
return;
@@ -286,7 +286,7 @@
tab_data->active = tab_strip_model->active_index() == index;
tab_data->tab_id = extensions::ExtensionTabUtil::GetTabId(contents);
tab_data->index = index;
- const base::Optional<tab_groups::TabGroupId> group_id =
+ const absl::optional<tab_groups::TabGroupId> group_id =
tab_strip_model->GetTabGroupForTab(index);
if (group_id.has_value()) {
tab_data->group_id = group_id.value().ToString();
diff --git a/chrome/browser/ui/webui/tab_search/tab_search_page_handler.h b/chrome/browser/ui/webui/tab_search/tab_search_page_handler.h
index f06f14dd..adb8578 100644
--- a/chrome/browser/ui/webui/tab_search/tab_search_page_handler.h
+++ b/chrome/browser/ui/webui/tab_search/tab_search_page_handler.h
@@ -110,7 +110,7 @@
sessions::TabRestoreService::Tab* tab);
// Returns tab details required to perform an action on the tab.
- base::Optional<TabDetails> GetTabDetails(int32_t tab_id);
+ absl::optional<TabDetails> GetTabDetails(int32_t tab_id);
// Schedule a timer to call TabsChanged() when it times out
// in order to reduce numbers of RPC.
diff --git a/chrome/browser/ui/webui/tab_search/tab_search_ui.h b/chrome/browser/ui/webui/tab_search/tab_search_ui.h
index 08b30d92..9c8b5a88 100644
--- a/chrome/browser/ui/webui/tab_search/tab_search_ui.h
+++ b/chrome/browser/ui/webui/tab_search/tab_search_ui.h
@@ -49,7 +49,7 @@
// A timer used to track the duration between when the WebUI is constructed
// and when the TabSearchPageHandler is constructed.
- base::Optional<base::ElapsedTimer> page_handler_timer_;
+ absl::optional<base::ElapsedTimer> page_handler_timer_;
WEB_UI_CONTROLLER_TYPE_DECL();
};
diff --git a/chrome/browser/ui/webui/tab_strip/tab_strip_ui_handler.cc b/chrome/browser/ui/webui/tab_strip/tab_strip_ui_handler.cc
index 604e645..9105a55 100644
--- a/chrome/browser/ui/webui/tab_strip/tab_strip_ui_handler.cc
+++ b/chrome/browser/ui/webui/tab_strip/tab_strip_ui_handler.cc
@@ -10,7 +10,6 @@
#include "base/containers/span.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/trace_event/trace_event.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
@@ -38,6 +37,7 @@
#include "components/tab_groups/tab_group_color.h"
#include "components/tab_groups/tab_group_id.h"
#include "components/tab_groups/tab_group_visual_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/input/web_gesture_event.h"
#include "ui/aura/window_delegate.h"
#include "ui/base/l10n/l10n_util.h"
@@ -265,7 +265,7 @@
}
void TabStripUIHandler::TabGroupedStateChanged(
- base::Optional<tab_groups::TabGroupId> group,
+ absl::optional<tab_groups::TabGroupId> group,
content::WebContents* contents,
int index) {
TRACE_EVENT0("browser",
@@ -309,7 +309,7 @@
case TabStripModelChange::kMoved: {
auto* move = change.GetMove();
- base::Optional<tab_groups::TabGroupId> tab_group_id =
+ absl::optional<tab_groups::TabGroupId> tab_group_id =
tab_strip_model->GetTabGroupForTab(move->to_index);
if (tab_group_id.has_value()) {
const gfx::Range tabs_in_group = tab_strip_model->group_model()
@@ -541,7 +541,7 @@
tab_data.SetInteger("id", extensions::ExtensionTabUtil::GetTabId(contents));
tab_data.SetInteger("index", index);
- const base::Optional<tab_groups::TabGroupId> group_id =
+ const absl::optional<tab_groups::TabGroupId> group_id =
browser_->tab_strip_model()->GetTabGroupForTab(index);
if (group_id.has_value()) {
tab_data.SetString("groupId", group_id.value().ToString());
@@ -697,7 +697,7 @@
DCHECK(got_tab);
const std::string group_id_string = args->GetList()[1].GetString();
- base::Optional<tab_groups::TabGroupId> group_id =
+ absl::optional<tab_groups::TabGroupId> group_id =
tab_strip_ui::GetTabGroupIdFromString(
browser_->tab_strip_model()->group_model(), group_id_string);
if (group_id.has_value()) {
@@ -733,7 +733,7 @@
return;
}
- base::Optional<tab_groups::TabGroupId> group_id =
+ absl::optional<tab_groups::TabGroupId> group_id =
tab_strip_ui::GetTabGroupIdFromString(
source_browser->tab_strip_model()->group_model(), group_id_string);
TabGroup* group =
@@ -766,7 +766,7 @@
target_browser->tab_strip_model()->group_model()->AddTabGroup(
group_id.value(),
- base::Optional<tab_groups::TabGroupVisualData>{*group->visual_data()});
+ absl::optional<tab_groups::TabGroupVisualData>{*group->visual_data()});
gfx::Range source_tab_indices = group->ListTabs();
const int tab_count = source_tab_indices.length();
@@ -854,7 +854,7 @@
void TabStripUIHandler::HandleShowEditDialogForGroup(
const base::ListValue* args) {
const std::string group_id_string = args->GetList()[0].GetString();
- base::Optional<tab_groups::TabGroupId> group_id =
+ absl::optional<tab_groups::TabGroupId> group_id =
tab_strip_ui::GetTabGroupIdFromString(
browser_->tab_strip_model()->group_model(), group_id_string);
if (!group_id.has_value()) {
diff --git a/chrome/browser/ui/webui/tab_strip/tab_strip_ui_handler.h b/chrome/browser/ui/webui/tab_strip/tab_strip_ui_handler.h
index 955ae9f..eed0ebce 100644
--- a/chrome/browser/ui/webui/tab_strip/tab_strip_ui_handler.h
+++ b/chrome/browser/ui/webui/tab_strip/tab_strip_ui_handler.h
@@ -33,7 +33,7 @@
// TabStripModelObserver:
void OnTabGroupChanged(const TabGroupChange& change) override;
- void TabGroupedStateChanged(base::Optional<tab_groups::TabGroupId> group,
+ void TabGroupedStateChanged(absl::optional<tab_groups::TabGroupId> group,
content::WebContents* contents,
int index) override;
void OnTabStripModelChanged(
diff --git a/chrome/browser/ui/webui/tab_strip/tab_strip_ui_handler_unittest.cc b/chrome/browser/ui/webui/tab_strip/tab_strip_ui_handler_unittest.cc
index 12fcdc0f..6b982c2a 100644
--- a/chrome/browser/ui/webui/tab_strip/tab_strip_ui_handler_unittest.cc
+++ b/chrome/browser/ui/webui/tab_strip/tab_strip_ui_handler_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_tab_util.h"
@@ -22,6 +21,7 @@
#include "content/public/browser/web_ui.h"
#include "content/public/test/test_web_ui.h"
#include "content/public/test/web_contents_tester.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/theme_provider.h"
#include "ui/gfx/color_utils.h"
@@ -299,7 +299,7 @@
ASSERT_EQ(moved_contents1, browser()->tab_strip_model()->GetWebContentsAt(1));
ASSERT_EQ(moved_contents2, browser()->tab_strip_model()->GetWebContentsAt(2));
- base::Optional<tab_groups::TabGroupId> new_group_id =
+ absl::optional<tab_groups::TabGroupId> new_group_id =
browser()->tab_strip_model()->GetTabGroupForTab(1);
ASSERT_TRUE(new_group_id.has_value());
ASSERT_EQ(browser()->tab_strip_model()->GetTabGroupForTab(1),
diff --git a/chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.cc b/chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.cc
index 1c0444e..742d66e 100644
--- a/chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.cc
+++ b/chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.cc
@@ -26,16 +26,16 @@
namespace tab_strip_ui {
-base::Optional<tab_groups::TabGroupId> GetTabGroupIdFromString(
+absl::optional<tab_groups::TabGroupId> GetTabGroupIdFromString(
TabGroupModel* tab_group_model,
std::string group_id_string) {
for (tab_groups::TabGroupId candidate : tab_group_model->ListTabGroups()) {
if (candidate.ToString() == group_id_string) {
- return base::Optional<tab_groups::TabGroupId>{candidate};
+ return absl::optional<tab_groups::TabGroupId>{candidate};
}
}
- return base::nullopt;
+ return absl::nullopt;
}
Browser* GetBrowserWithGroupId(Profile* profile, std::string group_id_string) {
@@ -44,7 +44,7 @@
continue;
}
- base::Optional<tab_groups::TabGroupId> group_id = GetTabGroupIdFromString(
+ absl::optional<tab_groups::TabGroupId> group_id = GetTabGroupIdFromString(
browser->tab_strip_model()->group_model(), group_id_string);
if (group_id.has_value()) {
return browser;
@@ -58,7 +58,7 @@
int from_index,
Browser* target_browser,
int to_index,
- base::Optional<tab_groups::TabGroupId> to_group_id) {
+ absl::optional<tab_groups::TabGroupId> to_group_id) {
bool was_active =
source_browser->tab_strip_model()->active_index() == from_index;
bool was_pinned = source_browser->tab_strip_model()->IsTabPinned(from_index);
@@ -124,7 +124,7 @@
Browser* source_browser = nullptr;
gfx::Range tab_indices_to_move;
- base::Optional<tab_groups::TabGroupId> source_group_id;
+ absl::optional<tab_groups::TabGroupId> source_group_id;
// TODO(https://crbug.com/1069869): de-duplicate with
// TabStripUIHandler::HandleMoveTab and
diff --git a/chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.h b/chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.h
index fcffd488b1..a20e47d 100644
--- a/chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.h
+++ b/chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.h
@@ -7,8 +7,8 @@
#include <string>
-#include "base/optional.h"
#include "components/tab_groups/tab_group_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Browser;
class Profile;
@@ -20,7 +20,7 @@
namespace tab_strip_ui {
-base::Optional<tab_groups::TabGroupId> GetTabGroupIdFromString(
+absl::optional<tab_groups::TabGroupId> GetTabGroupIdFromString(
TabGroupModel* tab_group_model,
std::string group_id_string);
@@ -31,7 +31,7 @@
int from_index,
Browser* target_browser,
int to_index,
- base::Optional<tab_groups::TabGroupId> to_group_id = base::nullopt);
+ absl::optional<tab_groups::TabGroupId> to_group_id = absl::nullopt);
// Returns whether |drop_data| is a tab drag originating from a WebUI
// tab strip.
diff --git a/chrome/browser/ui/webui/web_ui_test_handler.cc b/chrome/browser/ui/webui/web_ui_test_handler.cc
index 69214277..02924fef 100644
--- a/chrome/browser/ui/webui/web_ui_test_handler.cc
+++ b/chrome/browser/ui/webui/web_ui_test_handler.cc
@@ -54,7 +54,7 @@
}
void WebUITestHandler::TestComplete(
- const base::Optional<std::string>& error_message) {
+ const absl::optional<std::string>& error_message) {
// To ensure this gets done, do this before ASSERT* calls.
RunQuitClosure();
SCOPED_TRACE("WebUITestHandler::TestComplete");
diff --git a/chrome/browser/ui/webui/web_ui_test_handler.h b/chrome/browser/ui/webui/web_ui_test_handler.h
index 49bf84f7..5b7589e6 100644
--- a/chrome/browser/ui/webui/web_ui_test_handler.h
+++ b/chrome/browser/ui/webui/web_ui_test_handler.h
@@ -45,7 +45,7 @@
// Handles the result of a test. If |error_message| has no value, the test has
// succeeded.
- void TestComplete(const base::Optional<std::string>& error_message);
+ void TestComplete(const absl::optional<std::string>& error_message);
// Quits the currently running RunLoop.
void RunQuitClosure();
diff --git a/chrome/browser/ui/zoom/zoom_controller_unittest.cc b/chrome/browser/ui/zoom/zoom_controller_unittest.cc
index d60d73e..07c47e1 100644
--- a/chrome/browser/ui/zoom/zoom_controller_unittest.cc
+++ b/chrome/browser/ui/zoom/zoom_controller_unittest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "components/zoom/zoom_controller.h"
-#include "base/optional.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
@@ -18,6 +17,7 @@
#include "ipc/ipc_message.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using zoom::ZoomChangedWatcher;
using zoom::ZoomController;
diff --git a/chrome/browser/updates/announcement_notification/announcement_notification_handler.cc b/chrome/browser/updates/announcement_notification/announcement_notification_handler.cc
index d999322..59690108 100644
--- a/chrome/browser/updates/announcement_notification/announcement_notification_handler.cc
+++ b/chrome/browser/updates/announcement_notification/announcement_notification_handler.cc
@@ -40,8 +40,8 @@
Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) {
int button_index = action_index.has_value() ? action_index.value() : -1;
diff --git a/chrome/browser/updates/announcement_notification/announcement_notification_handler.h b/chrome/browser/updates/announcement_notification/announcement_notification_handler.h
index d773418b..83a074a 100644
--- a/chrome/browser/updates/announcement_notification/announcement_notification_handler.h
+++ b/chrome/browser/updates/announcement_notification/announcement_notification_handler.h
@@ -7,8 +7,8 @@
#include "base/callback.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/notifications/notification_handler.h" // nogncheck
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -28,8 +28,8 @@
void OnClick(Profile* profile,
const GURL& origin,
const std::string& notification_id,
- const base::Optional<int>& action_index,
- const base::Optional<std::u16string>& reply,
+ const absl::optional<int>& action_index,
+ const absl::optional<std::u16string>& reply,
base::OnceClosure completed_closure) override;
void OpenAnnouncement(Profile* profile);
diff --git a/chrome/browser/updates/announcement_notification/announcement_notification_service.h b/chrome/browser/updates/announcement_notification/announcement_notification_service.h
index c0f3dfe6..a093b8a 100644
--- a/chrome/browser/updates/announcement_notification/announcement_notification_service.h
+++ b/chrome/browser/updates/announcement_notification/announcement_notification_service.h
@@ -11,8 +11,8 @@
#include "base/feature_list.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace base {
diff --git a/chrome/browser/updates/internal/update_notification_service_impl.cc b/chrome/browser/updates/internal/update_notification_service_impl.cc
index a1a8279..a6a9966 100644
--- a/chrome/browser/updates/internal/update_notification_service_impl.cc
+++ b/chrome/browser/updates/internal/update_notification_service_impl.cc
@@ -55,18 +55,18 @@
notifications::UserFeedback::kNotHelpful,
notifications::ImpressionResult::kNegative);
if (should_show_immediately) {
- schedule_params.deliver_time_start = base::make_optional(clock->Now());
+ schedule_params.deliver_time_start = absl::make_optional(clock->Now());
schedule_params.deliver_time_end =
- base::make_optional(clock->Now() + base::TimeDelta::FromMinutes(1));
+ absl::make_optional(clock->Now() + base::TimeDelta::FromMinutes(1));
} else {
notifications::TimePair actual_window;
notifications::NextTimeWindow(clock, config->deliver_window_morning,
config->deliver_window_evening,
&actual_window);
schedule_params.deliver_time_start =
- base::make_optional(std::move(actual_window.first));
+ absl::make_optional(std::move(actual_window.first));
schedule_params.deliver_time_end =
- base::make_optional(std::move(actual_window.second));
+ absl::make_optional(std::move(actual_window.second));
}
return schedule_params;
}
diff --git a/chrome/browser/updates/internal/update_notification_service_impl_unittest.cc b/chrome/browser/updates/internal/update_notification_service_impl_unittest.cc
index f42d0ebf..b6b6d45 100644
--- a/chrome/browser/updates/internal/update_notification_service_impl_unittest.cc
+++ b/chrome/browser/updates/internal/update_notification_service_impl_unittest.cc
@@ -97,9 +97,9 @@
config()->deliver_window_evening,
&deliver_window);
expected_schedule_params.deliver_time_start =
- base::make_optional(std::move(deliver_window.first));
+ absl::make_optional(std::move(deliver_window.first));
expected_schedule_params.deliver_time_end =
- base::make_optional(std::move(deliver_window.second));
+ absl::make_optional(std::move(deliver_window.second));
notifications::NotificationData expected_notification_data;
expected_notification_data.title = kTestTitle;
diff --git a/chrome/browser/updates/test/mock_update_notification_service_bridge.h b/chrome/browser/updates/test/mock_update_notification_service_bridge.h
index 70cdc08..326161d 100644
--- a/chrome/browser/updates/test/mock_update_notification_service_bridge.h
+++ b/chrome/browser/updates/test/mock_update_notification_service_bridge.h
@@ -7,9 +7,9 @@
#include "chrome/browser/updates/update_notification_service_bridge.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updates {
namespace test {
@@ -21,9 +21,9 @@
~MockUpdateNotificationServiceBridge();
MOCK_METHOD1(UpdateLastShownTimeStamp, void(base::Time timestamp));
- MOCK_METHOD0(GetLastShownTimeStamp, base::Optional<base::Time>());
+ MOCK_METHOD0(GetLastShownTimeStamp, absl::optional<base::Time>());
MOCK_METHOD1(UpdateThrottleInterval, void(base::TimeDelta interval));
- MOCK_METHOD0(GetThrottleInterval, base::Optional<base::TimeDelta>());
+ MOCK_METHOD0(GetThrottleInterval, absl::optional<base::TimeDelta>());
MOCK_METHOD1(UpdateNegativeActionCount, void(int count));
MOCK_METHOD0(GetNegativeActionCount, int());
MOCK_METHOD1(LaunchChromeActivity, void(int state));
diff --git a/chrome/browser/updates/update_notification_service_bridge.h b/chrome/browser/updates/update_notification_service_bridge.h
index 8ce291e..3c5b5a3 100644
--- a/chrome/browser/updates/update_notification_service_bridge.h
+++ b/chrome/browser/updates/update_notification_service_bridge.h
@@ -8,7 +8,7 @@
#include <memory>
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updates {
diff --git a/chrome/browser/upgrade_detector/build_state.cc b/chrome/browser/upgrade_detector/build_state.cc
index d6d3ca5..af0cbd3 100644
--- a/chrome/browser/upgrade_detector/build_state.cc
+++ b/chrome/browser/upgrade_detector/build_state.cc
@@ -18,12 +18,12 @@
void BuildState::SetUpdate(
UpdateType update_type,
const base::Version& installed_version,
- const base::Optional<base::Version>& critical_version) {
+ const absl::optional<base::Version>& critical_version) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(update_type != UpdateType::kNone ||
(!installed_version.IsValid() && !critical_version.has_value()));
- base::Optional<base::Version> new_installed_version;
+ absl::optional<base::Version> new_installed_version;
if (installed_version.IsValid())
new_installed_version = installed_version;
diff --git a/chrome/browser/upgrade_detector/build_state.h b/chrome/browser/upgrade_detector/build_state.h
index 23666d52..f1d6a83 100644
--- a/chrome/browser/upgrade_detector/build_state.h
+++ b/chrome/browser/upgrade_detector/build_state.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_UPGRADE_DETECTOR_BUILD_STATE_H_
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/version.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class BuildStateObserver;
@@ -49,7 +49,7 @@
// value may be numerically higher or lower than the currently running build.
// Note: On Chrome OS, this is the system version number rather than the
// browser version number.
- const base::Optional<base::Version>& installed_version() const {
+ const absl::optional<base::Version>& installed_version() const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return installed_version_;
}
@@ -57,7 +57,7 @@
// If update_type() is not kNone, returns the optional critical version,
// indicating a minimum version that must be running. A running version lower
// than this must be updated as soon as possible. (Windows only.)
- const base::Optional<base::Version>& critical_version() const {
+ const absl::optional<base::Version>& critical_version() const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return critical_version_;
}
@@ -66,7 +66,7 @@
// differ from the instance's previous properties.
void SetUpdate(UpdateType update_type,
const base::Version& installed_version,
- const base::Optional<base::Version>& critical_version);
+ const absl::optional<base::Version>& critical_version);
void AddObserver(BuildStateObserver* observer);
void RemoveObserver(const BuildStateObserver* observer);
@@ -78,8 +78,8 @@
SEQUENCE_CHECKER(sequence_checker_);
base::ObserverList<BuildStateObserver, /*check_empty=*/true> observers_;
UpdateType update_type_ = UpdateType::kNone;
- base::Optional<base::Version> installed_version_;
- base::Optional<base::Version> critical_version_;
+ absl::optional<base::Version> installed_version_;
+ absl::optional<base::Version> critical_version_;
};
#endif // CHROME_BROWSER_UPGRADE_DETECTOR_BUILD_STATE_H_
diff --git a/chrome/browser/upgrade_detector/build_state_unittest.cc b/chrome/browser/upgrade_detector/build_state_unittest.cc
index c1966a6a..92d425bb 100644
--- a/chrome/browser/upgrade_detector/build_state_unittest.cc
+++ b/chrome/browser/upgrade_detector/build_state_unittest.cc
@@ -4,11 +4,11 @@
#include "chrome/browser/upgrade_detector/build_state.h"
-#include "base/optional.h"
#include "base/version.h"
#include "chrome/browser/upgrade_detector/mock_build_state_observer.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using ::testing::AllOf;
using ::testing::Eq;
@@ -33,7 +33,7 @@
TEST_F(BuildStateTest, SetUpdateNoUpdate) {
EXPECT_EQ(build_state().update_type(), BuildState::UpdateType::kNone);
build_state().SetUpdate(BuildState::UpdateType::kNone, base::Version(),
- base::nullopt);
+ absl::nullopt);
::testing::Mock::VerifyAndClearExpectations(&mock_observer());
EXPECT_EQ(build_state().update_type(), BuildState::UpdateType::kNone);
EXPECT_FALSE(build_state().installed_version().has_value());
@@ -50,7 +50,7 @@
Property(&BuildState::installed_version, IsFalse()),
Property(&BuildState::critical_version, IsFalse()))));
build_state().SetUpdate(BuildState::UpdateType::kNormalUpdate,
- base::Version(), base::nullopt);
+ base::Version(), absl::nullopt);
::testing::Mock::VerifyAndClearExpectations(&mock_observer());
}
@@ -64,10 +64,10 @@
Eq(BuildState::UpdateType::kNormalUpdate)),
Property(&BuildState::installed_version, IsTrue()),
Property(&BuildState::installed_version,
- Eq(base::Optional<base::Version>(expected_version))),
+ Eq(absl::optional<base::Version>(expected_version))),
Property(&BuildState::critical_version, IsFalse()))));
build_state().SetUpdate(BuildState::UpdateType::kNormalUpdate,
- expected_version, base::nullopt);
+ expected_version, absl::nullopt);
::testing::Mock::VerifyAndClearExpectations(&mock_observer());
}
@@ -84,10 +84,10 @@
Eq(BuildState::UpdateType::kNormalUpdate)),
Property(&BuildState::installed_version, IsTrue()),
Property(&BuildState::installed_version,
- Eq(base::Optional<base::Version>(expected_version))),
+ Eq(absl::optional<base::Version>(expected_version))),
Property(&BuildState::critical_version, IsTrue()),
Property(&BuildState::critical_version,
- Eq(base::Optional<base::Version>(expected_critical))))));
+ Eq(absl::optional<base::Version>(expected_critical))))));
build_state().SetUpdate(BuildState::UpdateType::kNormalUpdate,
expected_version, expected_critical);
::testing::Mock::VerifyAndClearExpectations(&mock_observer());
@@ -98,8 +98,8 @@
const base::Version expected_version("1.2.3.4");
EXPECT_CALL(mock_observer(), OnUpdate(&build_state()));
build_state().SetUpdate(BuildState::UpdateType::kNormalUpdate,
- expected_version, base::nullopt);
+ expected_version, absl::nullopt);
build_state().SetUpdate(BuildState::UpdateType::kNormalUpdate,
- expected_version, base::nullopt);
+ expected_version, absl::nullopt);
::testing::Mock::VerifyAndClearExpectations(&mock_observer());
}
diff --git a/chrome/browser/upgrade_detector/get_installed_version.h b/chrome/browser/upgrade_detector/get_installed_version.h
index c110ff2..8d84adc4 100644
--- a/chrome/browser/upgrade_detector/get_installed_version.h
+++ b/chrome/browser/upgrade_detector/get_installed_version.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_UPGRADE_DETECTOR_GET_INSTALLED_VERSION_H_
#define CHROME_BROWSER_UPGRADE_DETECTOR_GET_INSTALLED_VERSION_H_
-#include "base/optional.h"
#include "base/version.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
struct InstalledAndCriticalVersion {
explicit InstalledAndCriticalVersion(base::Version the_installed_version);
@@ -24,7 +24,7 @@
// An optional critical version, indicating a minimum version that must be
// running. A running version lower than this is presumed to have a critical
// flaw sufficiently important that it must be updated as soon as possible.
- base::Optional<base::Version> critical_version;
+ absl::optional<base::Version> critical_version;
};
// A platform-specific function that returns the currently installed version and
diff --git a/chrome/browser/upgrade_detector/installed_version_poller.cc b/chrome/browser/upgrade_detector/installed_version_poller.cc
index 0ecc8d7..ddc9051 100644
--- a/chrome/browser/upgrade_detector/installed_version_poller.cc
+++ b/chrome/browser/upgrade_detector/installed_version_poller.cc
@@ -203,7 +203,7 @@
if (update_type == BuildState::UpdateType::kNone) {
// The discovered version matches the current version, so report that no
// update is available.
- build_state_->SetUpdate(update_type, base::Version(), base::nullopt);
+ build_state_->SetUpdate(update_type, base::Version(), absl::nullopt);
} else {
// Either the installed version could not be discovered (invalid installed
// version) or differs from the running version. Report it accordingly.
diff --git a/chrome/browser/upgrade_detector/installed_version_poller.h b/chrome/browser/upgrade_detector/installed_version_poller.h
index 2bb8cea..47ae7638 100644
--- a/chrome/browser/upgrade_detector/installed_version_poller.h
+++ b/chrome/browser/upgrade_detector/installed_version_poller.h
@@ -10,11 +10,11 @@
#include "base/callback.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/upgrade_detector/get_installed_version.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class BuildState;
class InstalledVersionMonitor;
diff --git a/chrome/browser/upgrade_detector/installed_version_poller_unittest.cc b/chrome/browser/upgrade_detector/installed_version_poller_unittest.cc
index 02f9155..20179b1 100644
--- a/chrome/browser/upgrade_detector/installed_version_poller_unittest.cc
+++ b/chrome/browser/upgrade_detector/installed_version_poller_unittest.cc
@@ -163,7 +163,7 @@
Eq(BuildState::UpdateType::kNormalUpdate)),
Property(&BuildState::installed_version, IsTrue()),
Property(&BuildState::installed_version,
- Eq(base::Optional<base::Version>(GetUpgradeVersion()))),
+ Eq(absl::optional<base::Version>(GetUpgradeVersion()))),
Property(&BuildState::critical_version, IsFalse()))));
task_environment_.FastForwardBy(
InstalledVersionPoller::kDefaultPollingInterval);
@@ -193,7 +193,7 @@
Eq(BuildState::UpdateType::kNormalUpdate)),
Property(&BuildState::installed_version, IsTrue()),
Property(&BuildState::installed_version,
- Eq(base::Optional<base::Version>(GetUpgradeVersion()))),
+ Eq(absl::optional<base::Version>(GetUpgradeVersion()))),
Property(&BuildState::critical_version, IsFalse()))));
InstalledVersionPoller poller(&build_state_, callback.Get(), MakeMonitor(),
task_environment_.GetMockTickClock());
@@ -231,10 +231,10 @@
Eq(BuildState::UpdateType::kNormalUpdate)),
Property(&BuildState::installed_version, IsTrue()),
Property(&BuildState::installed_version,
- Eq(base::Optional<base::Version>(GetUpgradeVersion()))),
+ Eq(absl::optional<base::Version>(GetUpgradeVersion()))),
Property(&BuildState::critical_version, IsTrue()),
Property(&BuildState::critical_version,
- Eq(base::Optional<base::Version>(GetCriticalVersion()))))));
+ Eq(absl::optional<base::Version>(GetCriticalVersion()))))));
InstalledVersionPoller poller(&build_state_, callback.Get(), MakeMonitor(),
task_environment_.GetMockTickClock());
task_environment_.RunUntilIdle();
@@ -274,7 +274,7 @@
Eq(BuildState::UpdateType::kEnterpriseRollback)),
Property(&BuildState::installed_version, IsTrue()),
Property(&BuildState::installed_version,
- Eq(base::Optional<base::Version>(GetRollbackVersion()))),
+ Eq(absl::optional<base::Version>(GetRollbackVersion()))),
Property(&BuildState::critical_version, IsFalse()))));
InstalledVersionPoller poller(&build_state_, callback.Get(), MakeMonitor(),
task_environment_.GetMockTickClock());
diff --git a/chrome/browser/upgrade_detector/installed_version_updater_chromeos.cc b/chrome/browser/upgrade_detector/installed_version_updater_chromeos.cc
index e2041230..2984945c 100644
--- a/chrome/browser/upgrade_detector/installed_version_updater_chromeos.cc
+++ b/chrome/browser/upgrade_detector/installed_version_updater_chromeos.cc
@@ -71,5 +71,5 @@
}
}
build_state_->SetUpdate(update_type, base::Version(status.new_version()),
- base::nullopt);
+ absl::nullopt);
}
diff --git a/chrome/browser/upgrade_detector/installed_version_updater_chromeos.h b/chrome/browser/upgrade_detector/installed_version_updater_chromeos.h
index 795905a..bbd85af 100644
--- a/chrome/browser/upgrade_detector/installed_version_updater_chromeos.h
+++ b/chrome/browser/upgrade_detector/installed_version_updater_chromeos.h
@@ -8,9 +8,9 @@
#include <string>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "chromeos/dbus/update_engine_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class BuildState;
diff --git a/chrome/browser/upgrade_detector/installed_version_updater_chromeos_unittest.cc b/chrome/browser/upgrade_detector/installed_version_updater_chromeos_unittest.cc
index 2db6821..107b877 100644
--- a/chrome/browser/upgrade_detector/installed_version_updater_chromeos_unittest.cc
+++ b/chrome/browser/upgrade_detector/installed_version_updater_chromeos_unittest.cc
@@ -80,7 +80,7 @@
Eq(BuildState::UpdateType::kNormalUpdate)),
Property(&BuildState::installed_version, IsTrue()),
Property(&BuildState::installed_version,
- Eq(base::Optional<base::Version>(
+ Eq(absl::optional<base::Version>(
base::Version(new_version)))),
Property(&BuildState::critical_version, IsFalse()))));
NotifyStatusChanged(std::move(status));
@@ -104,7 +104,7 @@
Eq(BuildState::UpdateType::kEnterpriseRollback)),
Property(&BuildState::installed_version, IsTrue()),
Property(&BuildState::installed_version,
- Eq(base::Optional<base::Version>(
+ Eq(absl::optional<base::Version>(
base::Version(new_version)))),
Property(&BuildState::critical_version, IsFalse()))));
NotifyStatusChanged(std::move(status));
@@ -129,7 +129,7 @@
Property(&BuildState::installed_version, IsTrue()),
Property(
&BuildState::installed_version,
- Eq(base::Optional<base::Version>(base::Version(new_version)))),
+ Eq(absl::optional<base::Version>(base::Version(new_version)))),
Property(&BuildState::critical_version, IsFalse()))));
NotifyStatusChanged(std::move(status));
task_environment_.RunUntilIdle();
diff --git a/chrome/browser/upgrade_detector/upgrade_detector_chromeos.h b/chrome/browser/upgrade_detector/upgrade_detector_chromeos.h
index 0a47eea..a8978be 100644
--- a/chrome/browser/upgrade_detector/upgrade_detector_chromeos.h
+++ b/chrome/browser/upgrade_detector/upgrade_detector_chromeos.h
@@ -91,7 +91,7 @@
// user that a new version is available.
void NotifyOnUpgrade();
- base::Optional<InstalledVersionUpdater> installed_version_updater_;
+ absl::optional<InstalledVersionUpdater> installed_version_updater_;
// The time when elevated annoyance deadline is reached.
base::Time elevated_deadline_;
diff --git a/chrome/browser/upgrade_detector/upgrade_detector_impl.h b/chrome/browser/upgrade_detector/upgrade_detector_impl.h
index 7f97e97..bf4a04f 100644
--- a/chrome/browser/upgrade_detector/upgrade_detector_impl.h
+++ b/chrome/browser/upgrade_detector/upgrade_detector_impl.h
@@ -8,7 +8,6 @@
#include <array>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/timer/timer.h"
#include "base/version.h"
@@ -16,6 +15,7 @@
#include "chrome/browser/upgrade_detector/installed_version_poller.h"
#include "chrome/browser/upgrade_detector/upgrade_detector.h"
#include "components/variations/service/variations_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class Clock;
@@ -106,7 +106,7 @@
SEQUENCE_CHECKER(sequence_checker_);
- base::Optional<InstalledVersionPoller> installed_version_poller_;
+ absl::optional<InstalledVersionPoller> installed_version_poller_;
// A timer used to periodically check if the build has become outdated.
base::OneShotTimer outdated_build_timer_;
diff --git a/chrome/browser/usb/usb_chooser_context.cc b/chrome/browser/usb/usb_chooser_context.cc
index 35c2497..83803c58 100644
--- a/chrome/browser/usb/usb_chooser_context.cc
+++ b/chrome/browser/usb/usb_chooser_context.cc
@@ -430,8 +430,8 @@
if (!name->empty())
return base::UTF8ToUTF16(*name);
- base::Optional<int> vendor_id = object.FindIntKey(kVendorIdKey);
- base::Optional<int> product_id = object.FindIntKey(kProductIdKey);
+ absl::optional<int> vendor_id = object.FindIntKey(kVendorIdKey);
+ absl::optional<int> product_id = object.FindIntKey(kProductIdKey);
DCHECK(vendor_id && product_id);
return GetDeviceNameFromIds(*vendor_id, *product_id);
}
diff --git a/chrome/browser/usb/usb_chooser_context_unittest.cc b/chrome/browser/usb/usb_chooser_context_unittest.cc
index 682e941..6199954 100644
--- a/chrome/browser/usb/usb_chooser_context_unittest.cc
+++ b/chrome/browser/usb/usb_chooser_context_unittest.cc
@@ -110,7 +110,7 @@
EXPECT_FALSE(store->HasDevicePermission(origin, *device_info));
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
store->GrantDevicePermission(origin, *device_info);
@@ -129,7 +129,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
EXPECT_CALL(mock_permission_observer_, OnPermissionRevoked(origin));
@@ -162,7 +162,7 @@
EXPECT_FALSE(store->HasDevicePermission(origin, *device_info));
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
store->GrantDevicePermission(origin, *device_info);
@@ -183,7 +183,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
EXPECT_CALL(mock_permission_observer_, OnPermissionRevoked(origin));
@@ -207,7 +207,7 @@
EXPECT_FALSE(store->HasDevicePermission(origin, *device_info));
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
store->GrantDevicePermission(origin, *device_info);
@@ -252,7 +252,7 @@
EXPECT_FALSE(store->HasDevicePermission(origin, *device_info));
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
store->GrantDevicePermission(origin, *device_info);
@@ -268,7 +268,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
EXPECT_CALL(mock_device_observer_, OnDeviceRemoved(_));
device_manager_.RemoveDevice(device_info->guid);
@@ -303,7 +303,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
store->GrantDevicePermission(origin, *device_info_1);
@@ -312,7 +312,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
incognito_store->GrantDevicePermission(origin, *device_info_2);
@@ -358,7 +358,7 @@
auto* store = GetChooserContext(profile());
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA))
.Times(4);
store->GrantDevicePermission(kFooOrigin, *device_info);
@@ -743,11 +743,11 @@
int vendor_id,
int product_id,
const std::string& name) {
- const base::Optional<int> actual_vendor_id = actual.FindIntKey(kVendorIdKey);
+ const absl::optional<int> actual_vendor_id = actual.FindIntKey(kVendorIdKey);
ASSERT_TRUE(actual_vendor_id);
EXPECT_EQ(*actual_vendor_id, vendor_id);
- const base::Optional<int> actual_product_id =
+ const absl::optional<int> actual_product_id =
actual.FindIntKey(kProductIdKey);
ASSERT_TRUE(actual_product_id);
EXPECT_EQ(*actual_product_id, product_id);
@@ -977,7 +977,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA))
.Times(2);
store->GrantDevicePermission(kGoogleOrigin, *persistent_device_info);
@@ -1048,7 +1048,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
const auto kProductVendorOrigin =
url::Origin::Create(GURL(kProductVendorUrl));
@@ -1105,7 +1105,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
const auto kVendorOrigin = url::Origin::Create(GURL(kVendorUrl));
store->GrantDevicePermission(kVendorOrigin, *persistent_device_info);
@@ -1158,7 +1158,7 @@
EXPECT_CALL(mock_permission_observer_,
OnObjectPermissionChanged(
- base::make_optional(ContentSettingsType::USB_GUARD),
+ absl::make_optional(ContentSettingsType::USB_GUARD),
ContentSettingsType::USB_CHOOSER_DATA));
const auto kAnyDeviceOrigin = url::Origin::Create(GURL(kAnyDeviceUrl));
store->GrantDevicePermission(kAnyDeviceOrigin, *persistent_device_info);
diff --git a/chrome/browser/usb/usb_policy_allowed_devices.cc b/chrome/browser/usb/usb_policy_allowed_devices.cc
index 20179480..dcb2889 100644
--- a/chrome/browser/usb/usb_policy_allowed_devices.cc
+++ b/chrome/browser/usb/usb_policy_allowed_devices.cc
@@ -100,7 +100,7 @@
continue;
auto requesting_origin = url::Origin::Create(GURL(urls[0]));
- base::Optional<url::Origin> embedding_origin;
+ absl::optional<url::Origin> embedding_origin;
if (urls.size() == 2 && !urls[1].empty())
embedding_origin = url::Origin::Create(GURL(urls[1]));
diff --git a/chrome/browser/usb/usb_policy_allowed_devices.h b/chrome/browser/usb/usb_policy_allowed_devices.h
index 47aeadd..9bf762a 100644
--- a/chrome/browser/usb/usb_policy_allowed_devices.h
+++ b/chrome/browser/usb/usb_policy_allowed_devices.h
@@ -10,8 +10,8 @@
#include <set>
#include <utility>
-#include "base/optional.h"
#include "components/prefs/pref_change_registrar.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/origin.h"
namespace device {
diff --git a/chrome/browser/usb/usb_policy_allowed_devices_unittest.cc b/chrome/browser/usb/usb_policy_allowed_devices_unittest.cc
index 919a116..4aa0bf8 100644
--- a/chrome/browser/usb/usb_policy_allowed_devices_unittest.cc
+++ b/chrome/browser/usb/usb_policy_allowed_devices_unittest.cc
@@ -55,7 +55,7 @@
};
std::unique_ptr<base::Value> ReadJson(base::StringPiece json) {
- base::Optional<base::Value> value = base::JSONReader::Read(json);
+ absl::optional<base::Value> value = base::JSONReader::Read(json);
EXPECT_TRUE(value);
return value ? base::Value::ToUniquePtrValue(std::move(*value)) : nullptr;
}
diff --git a/chrome/browser/usb/web_usb_detector.cc b/chrome/browser/usb/web_usb_detector.cc
index 4646b07..cf2647e 100644
--- a/chrome/browser/usb/web_usb_detector.cc
+++ b/chrome/browser/usb/web_usb_detector.cc
@@ -11,7 +11,6 @@
#include "base/feature_list.h"
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/net/referrer.h"
#include "chrome/browser/notifications/system_notification_helper.h"
@@ -31,6 +30,7 @@
#include "device/base/features.h"
#include "services/device/public/mojom/usb_device.mojom.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/page_transition_types.h"
#include "ui/base/window_open_disposition.h"
@@ -124,8 +124,8 @@
}
}
- void Click(const base::Optional<int>& button_index,
- const base::Optional<std::u16string>& reply) override {
+ void Click(const absl::optional<int>& button_index,
+ const absl::optional<std::u16string>& reply) override {
disposition_ = WEBUSB_NOTIFICATION_CLOSED_CLICKED;
// If the URL is already open, activate that tab.
@@ -170,7 +170,7 @@
GURL landing_page_;
std::string notification_id_;
WebUsbNotificationClosed disposition_;
- base::Optional<BrowserTabStripTracker> browser_tab_strip_tracker_;
+ absl::optional<BrowserTabStripTracker> browser_tab_strip_tracker_;
DISALLOW_COPY_AND_ASSIGN(WebUsbNotificationDelegate);
};
diff --git a/chrome/browser/usb/web_usb_detector_unittest.cc b/chrome/browser/usb/web_usb_detector_unittest.cc
index f295fc5..9b2281c 100644
--- a/chrome/browser/usb/web_usb_detector_unittest.cc
+++ b/chrome/browser/usb/web_usb_detector_unittest.cc
@@ -130,7 +130,7 @@
device_manager_.AddDevice(device);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(device->guid());
ASSERT_TRUE(notification);
std::u16string expected_title = u"Google Product A detected";
@@ -326,7 +326,7 @@
device_manager_.AddDevice(device_2);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification =
+ absl::optional<message_center::Notification> notification =
display_service_->GetNotification(guid_2);
ASSERT_TRUE(notification);
std::u16string expected_title = u"Google Product B detected";
@@ -361,7 +361,7 @@
device_manager_.AddDevice(device_1);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_1 =
+ absl::optional<message_center::Notification> notification_1 =
display_service_->GetNotification(guid_1);
ASSERT_TRUE(notification_1);
std::u16string expected_title_1 = u"Google Product A detected";
@@ -376,7 +376,7 @@
device_manager_.AddDevice(device_2);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_2 =
+ absl::optional<message_center::Notification> notification_2 =
display_service_->GetNotification(guid_2);
ASSERT_TRUE(notification_2);
std::u16string expected_title_2 = u"Google Product B detected";
@@ -391,7 +391,7 @@
device_manager_.AddDevice(device_3);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_3 =
+ absl::optional<message_center::Notification> notification_3 =
display_service_->GetNotification(guid_3);
ASSERT_TRUE(notification_3);
std::u16string expected_title_3 = u"Google Product C detected";
@@ -426,7 +426,7 @@
device_manager_.AddDevice(device_1);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_1 =
+ absl::optional<message_center::Notification> notification_1 =
display_service_->GetNotification(guid_1);
ASSERT_TRUE(notification_1);
std::u16string expected_title_1 = u"Google Product A detected";
@@ -437,7 +437,7 @@
device_manager_.AddDevice(device_2);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_2 =
+ absl::optional<message_center::Notification> notification_2 =
display_service_->GetNotification(guid_2);
ASSERT_TRUE(notification_2);
std::u16string expected_title_2 = u"Google Product B detected";
@@ -452,7 +452,7 @@
device_manager_.AddDevice(device_3);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_3 =
+ absl::optional<message_center::Notification> notification_3 =
display_service_->GetNotification(guid_3);
ASSERT_TRUE(notification_3);
std::u16string expected_title_3 = u"Google Product C detected";
@@ -523,12 +523,12 @@
device_manager_.AddDevice(device_1);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_1 =
+ absl::optional<message_center::Notification> notification_1 =
display_service_->GetNotification(guid_1);
ASSERT_TRUE(notification_1);
EXPECT_EQ(2, tab_strip_model->count());
- notification_1->delegate()->Click(base::nullopt, base::nullopt);
+ notification_1->delegate()->Click(absl::nullopt, absl::nullopt);
EXPECT_EQ(2, tab_strip_model->count());
content::WebContents* web_contents =
tab_strip_model->GetWebContentsAt(tab_strip_model->active_index());
@@ -550,12 +550,12 @@
device_manager_.AddDevice(device_1);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_1 =
+ absl::optional<message_center::Notification> notification_1 =
display_service_->GetNotification(guid_1);
ASSERT_TRUE(notification_1);
EXPECT_EQ(0, tab_strip_model->count());
- notification_1->delegate()->Click(base::nullopt, base::nullopt);
+ notification_1->delegate()->Click(absl::nullopt, absl::nullopt);
EXPECT_EQ(1, tab_strip_model->count());
content::WebContents* web_contents =
tab_strip_model->GetWebContentsAt(tab_strip_model->active_index());
@@ -616,7 +616,7 @@
device_manager_.AddDevice(device_1);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_1 =
+ absl::optional<message_center::Notification> notification_1 =
display_service_->GetNotification(guid_1);
ASSERT_TRUE(notification_1);
std::u16string expected_title_1 = u"Google Product A detected";
@@ -639,7 +639,7 @@
device_manager_.AddDevice(device_2);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_2 =
+ absl::optional<message_center::Notification> notification_2 =
display_service_->GetNotification(guid_2);
ASSERT_TRUE(notification_2);
std::u16string expected_title_2 = u"Google Product B detected";
@@ -674,12 +674,12 @@
device_manager_.AddDevice(device_1);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_1 =
+ absl::optional<message_center::Notification> notification_1 =
display_service_->GetNotification(guid_1);
ASSERT_TRUE(notification_1);
EXPECT_EQ(0, tab_strip_model->count());
- notification_1->delegate()->Click(base::nullopt, base::nullopt);
+ notification_1->delegate()->Click(absl::nullopt, absl::nullopt);
EXPECT_EQ(1, tab_strip_model->count());
content::WebContents* web_contents =
tab_strip_model->GetWebContentsAt(tab_strip_model->active_index());
@@ -713,12 +713,12 @@
device_manager_.AddDevice(device_1);
base::RunLoop().RunUntilIdle();
- base::Optional<message_center::Notification> notification_1 =
+ absl::optional<message_center::Notification> notification_1 =
display_service_->GetNotification(guid_1);
ASSERT_TRUE(notification_1);
EXPECT_EQ(2, tab_strip_model->count());
- notification_1->delegate()->Click(base::nullopt, base::nullopt);
+ notification_1->delegate()->Click(absl::nullopt, absl::nullopt);
EXPECT_EQ(2, tab_strip_model->count());
content::WebContents* web_contents =
tab_strip_model->GetWebContentsAt(tab_strip_model->active_index());
diff --git a/chrome/browser/video_tutorials/internal/android/tutorial_conversion_bridge.cc b/chrome/browser/video_tutorials/internal/android/tutorial_conversion_bridge.cc
index 235f370..1c657c78 100644
--- a/chrome/browser/video_tutorials/internal/android/tutorial_conversion_bridge.cc
+++ b/chrome/browser/video_tutorials/internal/android/tutorial_conversion_bridge.cc
@@ -44,7 +44,7 @@
ScopedJavaLocalRef<jobject> TutorialConversionBridge::CreateJavaTutorial(
JNIEnv* env,
- base::Optional<Tutorial> tutorial) {
+ absl::optional<Tutorial> tutorial) {
ScopedJavaLocalRef<jobject> jobj;
if (tutorial.has_value()) {
jobj = CreateJavaTutorialAndMaybeAddToList(
diff --git a/chrome/browser/video_tutorials/internal/android/tutorial_conversion_bridge.h b/chrome/browser/video_tutorials/internal/android/tutorial_conversion_bridge.h
index fd71ca9..4168c17 100644
--- a/chrome/browser/video_tutorials/internal/android/tutorial_conversion_bridge.h
+++ b/chrome/browser/video_tutorials/internal/android/tutorial_conversion_bridge.h
@@ -8,8 +8,8 @@
#include <vector>
#include "base/android/jni_android.h"
-#include "base/optional.h"
#include "chrome/browser/video_tutorials/tutorial.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using base::android::ScopedJavaLocalRef;
@@ -25,7 +25,7 @@
static ScopedJavaLocalRef<jobject> CreateJavaTutorial(
JNIEnv* env,
- base::Optional<Tutorial> tutorial);
+ absl::optional<Tutorial> tutorial);
};
} // namespace video_tutorials
diff --git a/chrome/browser/video_tutorials/internal/android/video_tutorial_service_bridge.cc b/chrome/browser/video_tutorials/internal/android/video_tutorial_service_bridge.cc
index ea74999..4aa2740 100644
--- a/chrome/browser/video_tutorials/internal/android/video_tutorial_service_bridge.cc
+++ b/chrome/browser/video_tutorials/internal/android/video_tutorial_service_bridge.cc
@@ -31,7 +31,7 @@
}
void RunGetSingleTutorialCallback(const JavaRef<jobject>& j_callback,
- base::Optional<Tutorial> tutorial) {
+ absl::optional<Tutorial> tutorial) {
JNIEnv* env = AttachCurrentThread();
RunObjectCallbackAndroid(
j_callback, TutorialConversionBridge::CreateJavaTutorial(env, tutorial));
@@ -111,7 +111,7 @@
ScopedJavaLocalRef<jstring> VideoTutorialServiceBridge::GetPreferredLocale(
JNIEnv* env,
const JavaParamRef<jobject>& jcaller) {
- base::Optional<std::string> locale =
+ absl::optional<std::string> locale =
video_tutorial_service_->GetPreferredLocale();
return locale.has_value()
? base::android::ConvertUTF8ToJavaString(env, locale.value())
diff --git a/chrome/browser/video_tutorials/internal/store.h b/chrome/browser/video_tutorials/internal/store.h
index 38f84ee..61fad2c 100644
--- a/chrome/browser/video_tutorials/internal/store.h
+++ b/chrome/browser/video_tutorials/internal/store.h
@@ -12,7 +12,7 @@
#include "base/callback.h"
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace video_tutorials {
diff --git a/chrome/browser/video_tutorials/internal/tutorial_manager.h b/chrome/browser/video_tutorials/internal/tutorial_manager.h
index da79d77..17731fa 100644
--- a/chrome/browser/video_tutorials/internal/tutorial_manager.h
+++ b/chrome/browser/video_tutorials/internal/tutorial_manager.h
@@ -16,7 +16,7 @@
public:
using SuccessCallback = base::OnceCallback<void(bool)>;
using MultipleItemCallback = base::OnceCallback<void(std::vector<Tutorial>)>;
- using SingleItemCallback = base::OnceCallback<void(base::Optional<Tutorial>)>;
+ using SingleItemCallback = base::OnceCallback<void(absl::optional<Tutorial>)>;
// Loads video tutorials. Must be called again if the locale was changed by
// the user.
@@ -34,7 +34,7 @@
FeatureType feature_type) = 0;
// Returns the preferred locale for the video tutorials.
- virtual base::Optional<std::string> GetPreferredLocale() = 0;
+ virtual absl::optional<std::string> GetPreferredLocale() = 0;
// Sets the user preferred locale for watching the video tutorials. This
// doesn't update the cached tutorials. GetTutorials must be called for the
diff --git a/chrome/browser/video_tutorials/internal/tutorial_manager_impl.cc b/chrome/browser/video_tutorials/internal/tutorial_manager_impl.cc
index 7128d8a..379dfb3 100644
--- a/chrome/browser/video_tutorials/internal/tutorial_manager_impl.cc
+++ b/chrome/browser/video_tutorials/internal/tutorial_manager_impl.cc
@@ -52,7 +52,7 @@
// Find the data from cache. If the preferred locale is not set, use a default
// locale value to show the tutorial promos. Users will be asked again to
// confirm their language before the video starts.
- base::Optional<std::string> preferred_locale = GetPreferredLocale();
+ absl::optional<std::string> preferred_locale = GetPreferredLocale();
std::string locale = preferred_locale.has_value()
? preferred_locale.value()
: Config::GetDefaultPreferredLocale();
@@ -82,7 +82,7 @@
FeatureType feature_type,
std::vector<Tutorial> tutorials_excluding_summary) {
if (!tutorial_group_.has_value()) {
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
@@ -93,7 +93,7 @@
}
}
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
}
const std::vector<std::string>& TutorialManagerImpl::GetSupportedLanguages() {
@@ -106,10 +106,10 @@
return languages_for_tutorials_[feature_type];
}
-base::Optional<std::string> TutorialManagerImpl::GetPreferredLocale() {
+absl::optional<std::string> TutorialManagerImpl::GetPreferredLocale() {
if (prefs_->HasPrefPath(kPreferredLocaleKey))
return prefs_->GetString(kPreferredLocaleKey);
- return base::nullopt;
+ return absl::nullopt;
}
void TutorialManagerImpl::SetPreferredLocale(const std::string& locale) {
diff --git a/chrome/browser/video_tutorials/internal/tutorial_manager_impl.h b/chrome/browser/video_tutorials/internal/tutorial_manager_impl.h
index 67cad63..1c28d3e 100644
--- a/chrome/browser/video_tutorials/internal/tutorial_manager_impl.h
+++ b/chrome/browser/video_tutorials/internal/tutorial_manager_impl.h
@@ -14,8 +14,8 @@
#include <vector>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/video_tutorials/internal/store.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefService;
@@ -35,7 +35,7 @@
const std::vector<std::string>& GetSupportedLanguages() override;
const std::vector<std::string>& GetAvailableLanguagesForTutorial(
FeatureType feature_type) override;
- base::Optional<std::string> GetPreferredLocale() override;
+ absl::optional<std::string> GetPreferredLocale() override;
void SetPreferredLocale(const std::string& locale) override;
void SaveGroups(std::unique_ptr<std::vector<TutorialGroup>> groups) override;
@@ -63,10 +63,10 @@
std::map<FeatureType, std::vector<std::string>> languages_for_tutorials_;
// We only keep the tutorials for the preferred locale.
- base::Optional<TutorialGroup> tutorial_group_;
+ absl::optional<TutorialGroup> tutorial_group_;
// The initialization result of the database.
- base::Optional<bool> init_success_;
+ absl::optional<bool> init_success_;
// Caches the API calls in case initialization is not completed.
std::deque<base::OnceClosure> cached_api_calls_;
diff --git a/chrome/browser/video_tutorials/internal/tutorial_manager_impl_unittest.cc b/chrome/browser/video_tutorials/internal/tutorial_manager_impl_unittest.cc
index aa6e6e6..1554380e 100644
--- a/chrome/browser/video_tutorials/internal/tutorial_manager_impl_unittest.cc
+++ b/chrome/browser/video_tutorials/internal/tutorial_manager_impl_unittest.cc
@@ -142,7 +142,7 @@
}
void OnGetTutorial(base::RepeatingClosure closure,
- base::Optional<Tutorial> tutorial) {
+ absl::optional<Tutorial> tutorial) {
last_get_tutorial_result_ = tutorial;
std::move(closure).Run();
}
@@ -160,7 +160,7 @@
TutorialManager* manager() { return manager_.get(); }
TestStore* tutorial_store() { return tutorial_store_; }
std::vector<Tutorial> last_results() { return last_results_; }
- base::Optional<Tutorial> last_get_tutorial_result() {
+ absl::optional<Tutorial> last_get_tutorial_result() {
return last_get_tutorial_result_;
}
@@ -170,7 +170,7 @@
std::unique_ptr<TutorialManager> manager_;
TestStore* tutorial_store_;
std::vector<Tutorial> last_results_;
- base::Optional<Tutorial> last_get_tutorial_result_;
+ absl::optional<Tutorial> last_get_tutorial_result_;
};
TEST_F(TutorialManagerTest, InitAndGetTutorials) {
diff --git a/chrome/browser/video_tutorials/internal/tutorial_service_impl.cc b/chrome/browser/video_tutorials/internal/tutorial_service_impl.cc
index 4241241..225d56c 100644
--- a/chrome/browser/video_tutorials/internal/tutorial_service_impl.cc
+++ b/chrome/browser/video_tutorials/internal/tutorial_service_impl.cc
@@ -78,7 +78,7 @@
return tutorial_manager_->GetAvailableLanguagesForTutorial(feature_type);
}
-base::Optional<std::string> TutorialServiceImpl::GetPreferredLocale() {
+absl::optional<std::string> TutorialServiceImpl::GetPreferredLocale() {
return tutorial_manager_->GetPreferredLocale();
}
diff --git a/chrome/browser/video_tutorials/internal/tutorial_service_impl.h b/chrome/browser/video_tutorials/internal/tutorial_service_impl.h
index 675ba829..01454c8fcd 100644
--- a/chrome/browser/video_tutorials/internal/tutorial_service_impl.h
+++ b/chrome/browser/video_tutorials/internal/tutorial_service_impl.h
@@ -28,7 +28,7 @@
const std::vector<std::string>& GetSupportedLanguages() override;
const std::vector<std::string>& GetAvailableLanguagesForTutorial(
FeatureType feature_type) override;
- base::Optional<std::string> GetPreferredLocale() override;
+ absl::optional<std::string> GetPreferredLocale() override;
void SetPreferredLocale(const std::string& locale) override;
private:
diff --git a/chrome/browser/video_tutorials/prefs.h b/chrome/browser/video_tutorials/prefs.h
index 2c3a29fc..6ec708d 100644
--- a/chrome/browser/video_tutorials/prefs.h
+++ b/chrome/browser/video_tutorials/prefs.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_VIDEO_TUTORIALS_PREFS_H_
#define CHROME_BROWSER_VIDEO_TUTORIALS_PREFS_H_
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefRegistrySimple;
diff --git a/chrome/browser/video_tutorials/video_tutorial_service.h b/chrome/browser/video_tutorials/video_tutorial_service.h
index f3a2a607..22cab2f 100644
--- a/chrome/browser/video_tutorials/video_tutorial_service.h
+++ b/chrome/browser/video_tutorials/video_tutorial_service.h
@@ -9,16 +9,16 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
#include "base/supports_user_data.h"
#include "chrome/browser/video_tutorials/tutorial.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace video_tutorials {
using TutorialList = std::vector<Tutorial>;
using MultipleItemCallback = base::OnceCallback<void(std::vector<Tutorial>)>;
-using SingleItemCallback = base::OnceCallback<void(base::Optional<Tutorial>)>;
+using SingleItemCallback = base::OnceCallback<void(absl::optional<Tutorial>)>;
// The central class on chrome client responsible for managing, storing, and
// serving video tutorials in chrome.
@@ -40,7 +40,7 @@
FeatureType feature_type) = 0;
// Called to retrieve the preferred locale, if it is set by the user.
- virtual base::Optional<std::string> GetPreferredLocale() = 0;
+ virtual absl::optional<std::string> GetPreferredLocale() = 0;
// Called to set the preferred locale.
virtual void SetPreferredLocale(const std::string& locale) = 0;
diff --git a/chrome/browser/vr/base_scheduler_delegate_unittest.cc b/chrome/browser/vr/base_scheduler_delegate_unittest.cc
index 903c99249..639bb46 100644
--- a/chrome/browser/vr/base_scheduler_delegate_unittest.cc
+++ b/chrome/browser/vr/base_scheduler_delegate_unittest.cc
@@ -63,7 +63,7 @@
private:
scoped_refptr<base::TestMockTimeTaskRunner> test_task_runner_;
- base::Optional<base::ThreadTaskRunnerHandleOverrideForTesting>
+ absl::optional<base::ThreadTaskRunnerHandleOverrideForTesting>
task_runner_handle_override_;
};
diff --git a/chrome/browser/vr/databinding/binding.h b/chrome/browser/vr/databinding/binding.h
index ecfb737..1180e63 100644
--- a/chrome/browser/vr/databinding/binding.h
+++ b/chrome/browser/vr/databinding/binding.h
@@ -10,9 +10,9 @@
#include <memory>
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/vr/databinding/binding_base.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace vr {
@@ -39,7 +39,7 @@
Binding(const base::RepeatingCallback<T()>& getter,
const std::string& getter_text,
- const base::RepeatingCallback<void(const base::Optional<T>&,
+ const base::RepeatingCallback<void(const absl::optional<T>&,
const T&)>& setter,
const std::string& setter_text)
: getter_(getter),
@@ -52,7 +52,7 @@
: getter_(getter), setter_(setter) {}
Binding(const base::RepeatingCallback<T()>& getter,
- const base::RepeatingCallback<void(const base::Optional<T>&,
+ const base::RepeatingCallback<void(const absl::optional<T>&,
const T&)>& setter)
: getter_(getter), historic_setter_(setter) {}
#endif
@@ -89,9 +89,9 @@
private:
base::RepeatingCallback<T()> getter_;
base::RepeatingCallback<void(const T&)> setter_;
- base::RepeatingCallback<void(const base::Optional<T>&, const T&)>
+ base::RepeatingCallback<void(const absl::optional<T>&, const T&)>
historic_setter_;
- base::Optional<T> last_value_;
+ absl::optional<T> last_value_;
#ifndef NDEBUG
std::string getter_text_;
diff --git a/chrome/browser/vr/databinding/binding_unittest.cc b/chrome/browser/vr/databinding/binding_unittest.cc
index 1bf64d3..d3abc66 100644
--- a/chrome/browser/vr/databinding/binding_unittest.cc
+++ b/chrome/browser/vr/databinding/binding_unittest.cc
@@ -65,7 +65,7 @@
VR_BIND_LAMBDA([](TestModel* m) { return m->value; },
base::Unretained(&a)),
VR_BIND_LAMBDA(
- [](TestView* v, const base::Optional<bool>& last_value,
+ [](TestView* v, const absl::optional<bool>& last_value,
const bool& value) {
if (last_value)
v->value = value;
diff --git a/chrome/browser/vr/databinding/vector_binding.h b/chrome/browser/vr/databinding/vector_binding.h
index 0468f3ea..f808e34 100644
--- a/chrome/browser/vr/databinding/vector_binding.h
+++ b/chrome/browser/vr/databinding/vector_binding.h
@@ -11,9 +11,9 @@
#include "base/bind.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/vr/databinding/binding_base.h"
#include "chrome/browser/vr/databinding/vector_element_binding.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace vr {
@@ -74,7 +74,7 @@
private:
std::vector<M>* models_ = nullptr;
std::vector<std::unique_ptr<ElementBinding>> bindings_;
- base::Optional<size_t> last_size_;
+ absl::optional<size_t> last_size_;
ModelAddedCallback added_callback_;
ModelRemovedCallback removed_callback_;
diff --git a/chrome/browser/vr/databinding/vector_element_binding.h b/chrome/browser/vr/databinding/vector_element_binding.h
index b4c07d61..49e9afc 100644
--- a/chrome/browser/vr/databinding/vector_element_binding.h
+++ b/chrome/browser/vr/databinding/vector_element_binding.h
@@ -10,8 +10,8 @@
#include "base/bind.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/vr/databinding/binding_base.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace vr {
diff --git a/chrome/browser/vr/elements/ui_texture.h b/chrome/browser/vr/elements/ui_texture.h
index 53885b5..8da7303 100644
--- a/chrome/browser/vr/elements/ui_texture.h
+++ b/chrome/browser/vr/elements/ui_texture.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_VR_ELEMENTS_UI_TEXTURE_H_
#include "base/macros.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -70,8 +70,8 @@
private:
bool measured_ = false;
bool dirty_ = true;
- base::Optional<SkColor> foreground_color_;
- base::Optional<SkColor> background_color_;
+ absl::optional<SkColor> foreground_color_;
+ absl::optional<SkColor> background_color_;
DISALLOW_COPY_AND_ASSIGN(UiTexture);
};
diff --git a/chrome/browser/vr/test/vr_gl_test_suite.cc b/chrome/browser/vr/test/vr_gl_test_suite.cc
index f22a5c8..fe71c76 100644
--- a/chrome/browser/vr/test/vr_gl_test_suite.cc
+++ b/chrome/browser/vr/test/vr_gl_test_suite.cc
@@ -19,7 +19,7 @@
void VrGlTestSuite::Initialize() {
VrTestSuite::Initialize();
- gl::GLImageTestSupport::InitializeGL(base::nullopt);
+ gl::GLImageTestSupport::InitializeGL(absl::nullopt);
#if defined(VR_USE_COMMAND_BUFFER)
// Always enable gpu and oop raster, regardless of platform and denylist.
diff --git a/chrome/browser/vr/ui_scene_creator.cc b/chrome/browser/vr/ui_scene_creator.cc
index 9f3e2f3..239a6ec 100644
--- a/chrome/browser/vr/ui_scene_creator.cc
+++ b/chrome/browser/vr/ui_scene_creator.cc
@@ -944,7 +944,7 @@
TransientElement* e,
Model* model,
UiScene* scene,
- const base::Optional<
+ const absl::optional<
std::tuple<bool, CapturingStateModel, CapturingStateModel>>& last_value,
const std::tuple<bool, CapturingStateModel, CapturingStateModel>& value) {
const bool in_web_vr_presentation = model->web_vr_enabled() &&
@@ -1014,7 +1014,7 @@
TransientElement* e,
Model* model,
UiScene* scene,
- const base::Optional<std::tuple<bool, bool, bool>>& last_value,
+ const absl::optional<std::tuple<bool, bool, bool>>& last_value,
const std::tuple<bool, bool, bool>& value) {
const bool in_web_vr_presentation = std::get<0>(value);
const bool in_long_press = std::get<1>(value);
diff --git a/chrome/browser/vr/webxr_vr_isolated_device_service_test.cc b/chrome/browser/vr/webxr_vr_isolated_device_service_test.cc
index 85421ae..5000ff9f 100644
--- a/chrome/browser/vr/webxr_vr_isolated_device_service_test.cc
+++ b/chrome/browser/vr/webxr_vr_isolated_device_service_test.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/test/bind.h"
#include "build/build_config.h"
#include "chrome/browser/vr/test/mock_xr_device_hook_base.h"
@@ -11,6 +10,7 @@
#include "chrome/browser/vr/test/webxr_vr_browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/xr_test_utils.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace vr {
@@ -19,7 +19,7 @@
// Ensure that any time the XR Device Service is started, we have installed
// a new local hook before the IsolatedDeviceProvider has a chance to issue
// any enumeration requests.
- base::Optional<MockXRDeviceHookBase> device_hook(absl::in_place);
+ absl::optional<MockXRDeviceHookBase> device_hook(absl::in_place);
content::SetXRDeviceServiceStartupCallbackForTesting(
base::BindLambdaForTesting([&] { device_hook.emplace(); }));
diff --git a/chrome/browser/vr/win/vr_browser_renderer_thread_win.cc b/chrome/browser/vr/win/vr_browser_renderer_thread_win.cc
index b87d0ef..b101505 100644
--- a/chrome/browser/vr/win/vr_browser_renderer_thread_win.cc
+++ b/chrome/browser/vr/win/vr_browser_renderer_thread_win.cc
@@ -372,7 +372,7 @@
InRange(ret->pose->position->y()) &&
InRange(ret->pose->position->z()));
if (any_out_of_range) {
- ret->pose->position = base::nullopt;
+ ret->pose->position = absl::nullopt;
// If testing with unexpectedly high values, catch on debug builds
// rather than silently change data. On release builds its better to
// be safe and validate.
diff --git a/chrome/browser/web_applications/components/app_icon_manager.h b/chrome/browser/web_applications/components/app_icon_manager.h
index 27e3e47..6054b1e 100644
--- a/chrome/browser/web_applications/components/app_icon_manager.h
+++ b/chrome/browser/web_applications/components/app_icon_manager.h
@@ -10,9 +10,9 @@
#include <vector>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace web_app {
@@ -43,7 +43,7 @@
};
// For each of |purposes|, in the given order, looks for an icon with size at
// least |min_icon_size|. Returns information on the first icon found.
- virtual base::Optional<IconSizeAndPurpose> FindIconMatchBigger(
+ virtual absl::optional<IconSizeAndPurpose> FindIconMatchBigger(
const AppId& app_id,
const std::vector<IconPurpose>& purposes,
SquareSizePx min_size) const = 0;
diff --git a/chrome/browser/web_applications/components/app_registrar.cc b/chrome/browser/web_applications/components/app_registrar.cc
index 8dd9880a..09a1db6c 100644
--- a/chrome/browser/web_applications/components/app_registrar.cc
+++ b/chrome/browser/web_applications/components/app_registrar.cc
@@ -131,7 +131,7 @@
return installed_apps;
}
-base::Optional<AppId> AppRegistrar::LookupExternalAppId(
+absl::optional<AppId> AppRegistrar::LookupExternalAppId(
const GURL& install_url) const {
return ExternallyInstalledWebAppPrefs(profile()->GetPrefs())
.LookupAppId(install_url);
@@ -176,7 +176,7 @@
}
GURL AppRegistrar::GetAppScope(const AppId& app_id) const {
- base::Optional<GURL> scope = GetAppScopeInternal(app_id);
+ absl::optional<GURL> scope = GetAppScopeInternal(app_id);
if (scope)
return *scope;
if (base::FeatureList::IsEnabled(
@@ -187,11 +187,11 @@
return GetAppStartUrl(app_id).GetWithoutFilename();
}
-base::Optional<AppId> AppRegistrar::FindAppWithUrlInScope(
+absl::optional<AppId> AppRegistrar::FindAppWithUrlInScope(
const GURL& url) const {
const std::string url_path = url.spec();
- base::Optional<AppId> best_app_id;
+ absl::optional<AppId> best_app_id;
size_t best_app_path_length = 0U;
bool best_app_is_shortcut = true;
@@ -252,12 +252,12 @@
return in_scope;
}
-base::Optional<AppId> AppRegistrar::FindInstalledAppWithUrlInScope(
+absl::optional<AppId> AppRegistrar::FindInstalledAppWithUrlInScope(
const GURL& url,
bool window_only) const {
const std::string url_path = url.spec();
- base::Optional<AppId> best_app_id;
+ absl::optional<AppId> best_app_id;
size_t best_app_path_length = 0U;
bool best_app_is_shortcut = true;
diff --git a/chrome/browser/web_applications/components/app_registrar.h b/chrome/browser/web_applications/components/app_registrar.h
index 6f9d5ff..3859f298 100644
--- a/chrome/browser/web_applications/components/app_registrar.h
+++ b/chrome/browser/web_applications/components/app_registrar.h
@@ -10,12 +10,12 @@
#include <vector>
#include "base/observer_list.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
#include "components/services/app_service/public/cpp/file_handler.h"
#include "components/services/app_service/public/cpp/url_handler_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
class GURL;
@@ -75,7 +75,7 @@
// externally installed app for it. Note that the |install_url| is the URL
// that the app was installed from, which may not necessarily match the app's
// current start URL.
- virtual base::Optional<AppId> LookupExternalAppId(
+ virtual absl::optional<AppId> LookupExternalAppId(
const GURL& install_url) const;
// Returns whether the AppRegistrar has an externally installed app with
@@ -95,9 +95,9 @@
// All names are UTF8 encoded.
virtual std::string GetAppShortName(const AppId& app_id) const = 0;
virtual std::string GetAppDescription(const AppId& app_id) const = 0;
- virtual base::Optional<SkColor> GetAppThemeColor(
+ virtual absl::optional<SkColor> GetAppThemeColor(
const AppId& app_id) const = 0;
- virtual base::Optional<SkColor> GetAppBackgroundColor(
+ virtual absl::optional<SkColor> GetAppBackgroundColor(
const AppId& app_id) const = 0;
virtual const GURL& GetAppStartUrl(const AppId& app_id) const = 0;
virtual const std::string* GetAppLaunchQueryParams(
@@ -114,7 +114,7 @@
GURL GetAppLaunchUrl(const AppId& app_id) const;
// TODO(crbug.com/910016): Replace uses of this with GetAppScope().
- virtual base::Optional<GURL> GetAppScopeInternal(
+ virtual absl::optional<GURL> GetAppScopeInternal(
const AppId& app_id) const = 0;
virtual DisplayMode GetAppDisplayMode(const AppId& app_id) const = 0;
@@ -170,7 +170,7 @@
// Returns the app id of an app in the registry with the longest scope that is
// a prefix of |url|, if any.
- base::Optional<AppId> FindAppWithUrlInScope(const GURL& url) const;
+ absl::optional<AppId> FindAppWithUrlInScope(const GURL& url) const;
// Returns true if there exists at least one app installed under |scope|.
bool DoesScopeContainAnyApp(const GURL& scope) const;
@@ -181,7 +181,7 @@
// Returns the app id of an installed app in the registry with the longest
// scope that is a prefix of |url|, if any. If |window_only| is specified,
// only apps that open in app windows will be considered.
- base::Optional<AppId> FindInstalledAppWithUrlInScope(
+ absl::optional<AppId> FindInstalledAppWithUrlInScope(
const GURL& url,
bool window_only = false) const;
diff --git a/chrome/browser/web_applications/components/external_install_options.cc b/chrome/browser/web_applications/components/external_install_options.cc
index ef8c608..25e2e66 100644
--- a/chrome/browser/web_applications/components/external_install_options.cc
+++ b/chrome/browser/web_applications/components/external_install_options.cc
@@ -85,7 +85,7 @@
namespace {
template <typename T>
-std::ostream& operator<<(std::ostream& out, const base::Optional<T>& optional) {
+std::ostream& operator<<(std::ostream& out, const absl::optional<T>& optional) {
if (optional)
out << *optional;
else
diff --git a/chrome/browser/web_applications/components/external_install_options.h b/chrome/browser/web_applications/components/external_install_options.h
index 672edbc..e6f8538 100644
--- a/chrome/browser/web_applications/components/external_install_options.h
+++ b/chrome/browser/web_applications/components/external_install_options.h
@@ -9,12 +9,12 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/install_manager.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
#include "chrome/browser/web_applications/system_web_apps/system_web_app_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace web_app {
@@ -41,7 +41,7 @@
// App name to use for placeholder apps or web apps that have no name in
// their manifest.
- base::Optional<std::string> fallback_app_name;
+ absl::optional<std::string> fallback_app_name;
// If true, a shortcut is added to the Applications folder on macOS, and Start
// Menu on Linux and Windows and launcher on Chrome OS. If false, we skip
@@ -93,7 +93,7 @@
// Which feature flag should be enabled to install this app. See
// chrome/browser/web_applications/components/preinstalled_app_install_features.h
// for available features to gate on.
- base::Optional<std::string> gate_on_feature;
+ absl::optional<std::string> gate_on_feature;
// Whether this should not be installed for devices that support ARC.
bool disable_if_arc_supported = false;
@@ -119,7 +119,7 @@
// goes from less the milestone specified to greater or equal than the
// milestone specified. For example, if this value is 89 then we update the
// app on all browser upgrades from <89 to >=89. The update happens only once.
- base::Optional<int> force_reinstall_for_milestone;
+ absl::optional<int> force_reinstall_for_milestone;
// Whether we should wait for all app windows being closed before reinstalling
// the placeholder.
@@ -137,7 +137,7 @@
bool reinstall_placeholder = false;
// Optional query parameters to add to the start_url when launching the app.
- base::Optional<std::string> launch_query_params;
+ absl::optional<std::string> launch_query_params;
// Whether we should load |service_worker_registration_url| after successful
// installation to allow the site to install its service worker and set up
@@ -148,7 +148,7 @@
// configurable by sites that wish to be able to track install metrics of the
// install_url separate from the service worker registration step. Defaults to
// install_url if unset.
- base::Optional<GURL> service_worker_registration_url;
+ absl::optional<GURL> service_worker_registration_url;
// A list of app_ids that the Web App System should attempt to uninstall and
// replace with this app (e.g maintain shelf pins, app list positions).
@@ -168,7 +168,7 @@
WebApplicationInfoFactory app_info_factory;
// The type of SystemWebApp, if this app is a System Web App.
- base::Optional<SystemAppType> system_app_type = base::nullopt;
+ absl::optional<SystemAppType> system_app_type = absl::nullopt;
// Whether the app was installed by an OEM and should be placed in a special
// OEM folder in the app launcher. Only used on Chrome OS.
diff --git a/chrome/browser/web_applications/components/externally_installed_web_app_prefs.cc b/chrome/browser/web_applications/components/externally_installed_web_app_prefs.cc
index 1238caa..6c304197 100644
--- a/chrome/browser/web_applications/components/externally_installed_web_app_prefs.cc
+++ b/chrome/browser/web_applications/components/externally_installed_web_app_prefs.cc
@@ -161,7 +161,7 @@
update->SetKey(url.spec(), std::move(dict));
}
-base::Optional<AppId> ExternallyInstalledWebAppPrefs::LookupAppId(
+absl::optional<AppId> ExternallyInstalledWebAppPrefs::LookupAppId(
const GURL& url) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -171,10 +171,10 @@
if (v && v->is_dict()) {
v = v->FindKey(kExtensionId);
if (v && v->is_string()) {
- return base::make_optional(v->GetString());
+ return absl::make_optional(v->GetString());
}
}
- return base::nullopt;
+ return absl::nullopt;
}
bool ExternallyInstalledWebAppPrefs::HasNoApps() const {
@@ -185,7 +185,7 @@
return dict->DictEmpty();
}
-base::Optional<AppId> ExternallyInstalledWebAppPrefs::LookupPlaceholderAppId(
+absl::optional<AppId> ExternallyInstalledWebAppPrefs::LookupPlaceholderAppId(
const GURL& url) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -193,11 +193,11 @@
pref_service_->GetDictionary(prefs::kWebAppsExtensionIDs)
->FindKey(url.spec());
if (!entry)
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<bool> is_placeholder = entry->FindBoolKey(kIsPlaceholder);
+ absl::optional<bool> is_placeholder = entry->FindBoolKey(kIsPlaceholder);
if (!is_placeholder.has_value() || !is_placeholder.value())
- return base::nullopt;
+ return absl::nullopt;
return *entry->FindStringKey(kExtensionId);
}
diff --git a/chrome/browser/web_applications/components/externally_installed_web_app_prefs.h b/chrome/browser/web_applications/components/externally_installed_web_app_prefs.h
index 7a7a06d..597547b9 100644
--- a/chrome/browser/web_applications/components/externally_installed_web_app_prefs.h
+++ b/chrome/browser/web_applications/components/externally_installed_web_app_prefs.h
@@ -8,9 +8,9 @@
#include <map>
#include <string>
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
class PrefService;
@@ -53,13 +53,13 @@
void Insert(const GURL& url,
const AppId& app_id,
ExternalInstallSource install_source);
- base::Optional<AppId> LookupAppId(const GURL& url) const;
+ absl::optional<AppId> LookupAppId(const GURL& url) const;
bool HasNoApps() const;
// Returns an id if there is a placeholder app for |url|. Note that nullopt
// does not mean that there is no app for |url| just that there is no
// *placeholder app*.
- base::Optional<AppId> LookupPlaceholderAppId(const GURL& url) const;
+ absl::optional<AppId> LookupPlaceholderAppId(const GURL& url) const;
void SetIsPlaceholder(const GURL& url, bool is_placeholder);
bool IsPlaceholderApp(const AppId& app_id) const;
diff --git a/chrome/browser/web_applications/components/file_handler_manager.cc b/chrome/browser/web_applications/components/file_handler_manager.cc
index e83a32f..ac6e92a 100644
--- a/chrome/browser/web_applications/components/file_handler_manager.cc
+++ b/chrome/browser/web_applications/components/file_handler_manager.cc
@@ -256,22 +256,22 @@
return cleaned_up_count;
}
-const base::Optional<GURL> FileHandlerManager::GetMatchingFileHandlerURL(
+const absl::optional<GURL> FileHandlerManager::GetMatchingFileHandlerURL(
const AppId& app_id,
const std::vector<base::FilePath>& launch_files) {
if (!IsFileHandlingAPIAvailable(app_id) || launch_files.empty())
- return base::nullopt;
+ return absl::nullopt;
const apps::FileHandlers* file_handlers = GetAllFileHandlers(app_id);
if (!file_handlers)
- return base::nullopt;
+ return absl::nullopt;
std::set<std::string> launch_file_extensions;
for (const auto& file_path : launch_files) {
std::string file_extension =
base::FilePath(file_path.Extension()).AsUTF8Unsafe();
if (file_extension.length() <= 1)
- return base::nullopt;
+ return absl::nullopt;
launch_file_extensions.insert(file_extension);
}
@@ -290,7 +290,7 @@
return file_handler.action;
}
- return base::nullopt;
+ return absl::nullopt;
}
bool FileHandlerManager::IsFileHandlingForceEnabled(const AppId& app_id) {
diff --git a/chrome/browser/web_applications/components/file_handler_manager.h b/chrome/browser/web_applications/components/file_handler_manager.h
index 745a165f..614f902 100644
--- a/chrome/browser/web_applications/components/file_handler_manager.h
+++ b/chrome/browser/web_applications/components/file_handler_manager.h
@@ -57,7 +57,7 @@
// Returns |app_id|'s URL registered to handle |launch_files|'s extensions, or
// nullopt otherwise.
- const base::Optional<GURL> GetMatchingFileHandlerURL(
+ const absl::optional<GURL> GetMatchingFileHandlerURL(
const AppId& app_id,
const std::vector<base::FilePath>& launch_files);
diff --git a/chrome/browser/web_applications/components/file_handler_manager_unittest.cc b/chrome/browser/web_applications/components/file_handler_manager_unittest.cc
index 618697b0..ddae0baa 100644
--- a/chrome/browser/web_applications/components/file_handler_manager_unittest.cc
+++ b/chrome/browser/web_applications/components/file_handler_manager_unittest.cc
@@ -179,7 +179,7 @@
// Returns nullopt when no file handlers are registered.
const base::FilePath path(FILE_PATH_LITERAL("file.foo"));
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
file_handler_manager().GetMatchingFileHandlerURL(app_id, {path}));
}
@@ -191,7 +191,7 @@
{{"application/foo", {".foo"}}});
// Returns nullopt when no launch files are passed.
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
file_handler_manager().GetMatchingFileHandlerURL(app_id, {}));
}
@@ -217,7 +217,7 @@
// Returns nullopt on single invalid extension.
const base::FilePath path(FILE_PATH_LITERAL("file.bar"));
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
file_handler_manager().GetMatchingFileHandlerURL(app_id, {path}));
}
@@ -260,7 +260,7 @@
// Returns nullopt on partial extension match.
const base::FilePath path1(FILE_PATH_LITERAL("file.foo"));
const base::FilePath path2(FILE_PATH_LITERAL("file.bar"));
- EXPECT_EQ(base::nullopt, file_handler_manager().GetMatchingFileHandlerURL(
+ EXPECT_EQ(absl::nullopt, file_handler_manager().GetMatchingFileHandlerURL(
app_id, {path1, path2}));
}
@@ -273,7 +273,7 @@
// Returns nullopt where a file has no extension.
const base::FilePath path(FILE_PATH_LITERAL("file"));
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
file_handler_manager().GetMatchingFileHandlerURL(app_id, {path}));
}
@@ -287,7 +287,7 @@
// Returns nullopt where one file has no extension while others do.
const base::FilePath path1(FILE_PATH_LITERAL("file"));
const base::FilePath path2(FILE_PATH_LITERAL("file.foo"));
- EXPECT_EQ(base::nullopt, file_handler_manager().GetMatchingFileHandlerURL(
+ EXPECT_EQ(absl::nullopt, file_handler_manager().GetMatchingFileHandlerURL(
app_id, {path1, path2}));
}
diff --git a/chrome/browser/web_applications/components/install_bounce_metric.cc b/chrome/browser/web_applications/components/install_bounce_metric.cc
index e26da75..fa0a73d 100644
--- a/chrome/browser/web_applications/components/install_bounce_metric.cc
+++ b/chrome/browser/web_applications/components/install_bounce_metric.cc
@@ -15,8 +15,8 @@
namespace {
-base::Optional<base::Time>& GetTimeOverride() {
- static base::NoDestructor<base::Optional<base::Time>> g_time_override;
+absl::optional<base::Time>& GetTimeOverride() {
+ static base::NoDestructor<absl::optional<base::Time>> g_time_override;
return *g_time_override;
}
@@ -28,14 +28,14 @@
// TODO(alancutter): Dedupe Time/Value conversion logic with
// app_banner_settings_helper.cc and PrefService.
-base::Optional<base::Time> ParseTime(const base::Value* value) {
+absl::optional<base::Time> ParseTime(const base::Value* value) {
std::string delta_string;
if (!value || !value->GetAsString(&delta_string))
- return base::nullopt;
+ return absl::nullopt;
int64_t integer;
if (!base::StringToInt64(delta_string, &integer))
- return base::nullopt;
+ return absl::nullopt;
return base::Time::FromDeltaSinceWindowsEpoch(
base::TimeDelta::FromMicroseconds(integer));
@@ -54,7 +54,7 @@
webapps::WebappInstallSource source;
};
-base::Optional<InstallMetrics> ParseInstallMetricsFromPrefs(
+absl::optional<InstallMetrics> ParseInstallMetricsFromPrefs(
const PrefService* pref_service,
const web_app::AppId& app_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -62,20 +62,20 @@
const base::DictionaryValue* ids_to_metrics =
pref_service->GetDictionary(prefs::kWebAppInstallMetrics);
if (!ids_to_metrics)
- return base::nullopt;
+ return absl::nullopt;
const base::Value* metrics = ids_to_metrics->FindDictKey(app_id);
if (!metrics)
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<base::Time> timestamp =
+ absl::optional<base::Time> timestamp =
ParseTime(metrics->FindKey(kInstallTimestamp));
if (!timestamp)
- return base::nullopt;
+ return absl::nullopt;
const base::Value* source = metrics->FindKey(kInstallSource);
if (!source || !source->is_int())
- return base::nullopt;
+ return absl::nullopt;
return InstallMetrics{
*timestamp, static_cast<webapps::WebappInstallSource>(source->GetInt())};
@@ -98,7 +98,7 @@
namespace web_app {
-void SetInstallBounceMetricTimeForTesting(base::Optional<base::Time> time) {
+void SetInstallBounceMetricTimeForTesting(absl::optional<base::Time> time) {
GetTimeOverride() = time;
}
@@ -116,7 +116,7 @@
void RecordWebAppUninstallation(PrefService* pref_service,
const AppId& app_id) {
- base::Optional<InstallMetrics> metrics =
+ absl::optional<InstallMetrics> metrics =
ParseInstallMetricsFromPrefs(pref_service, app_id);
if (!metrics)
return;
diff --git a/chrome/browser/web_applications/components/install_bounce_metric.h b/chrome/browser/web_applications/components/install_bounce_metric.h
index c2c79ab..25f72411 100644
--- a/chrome/browser/web_applications/components/install_bounce_metric.h
+++ b/chrome/browser/web_applications/components/install_bounce_metric.h
@@ -6,17 +6,17 @@
#define CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_INSTALL_BOUNCE_METRIC_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "components/webapps/browser/installable/installable_metrics.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefService;
class PrefRegistrySimple;
namespace web_app {
-void SetInstallBounceMetricTimeForTesting(base::Optional<base::Time> time);
+void SetInstallBounceMetricTimeForTesting(absl::optional<base::Time> time);
void RegisterInstallBounceMetricProfilePrefs(PrefRegistrySimple* registry);
diff --git a/chrome/browser/web_applications/components/install_finalizer.cc b/chrome/browser/web_applications/components/install_finalizer.cc
index 478263df..ebaf40e 100644
--- a/chrome/browser/web_applications/components/install_finalizer.cc
+++ b/chrome/browser/web_applications/components/install_finalizer.cc
@@ -9,12 +9,12 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/web_applications/components/app_registrar.h"
#include "chrome/browser/web_applications/components/os_integration_manager.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_ui_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace web_app {
@@ -29,7 +29,7 @@
const GURL& app_url,
webapps::WebappUninstallSource webapp_uninstall_source,
UninstallWebAppCallback callback) {
- base::Optional<AppId> app_id = registrar().LookupExternalAppId(app_url);
+ absl::optional<AppId> app_id = registrar().LookupExternalAppId(app_url);
if (!app_id.has_value()) {
LOG(WARNING) << "Couldn't uninstall web app with url " << app_url
<< "; No corresponding web app for url.";
diff --git a/chrome/browser/web_applications/components/install_finalizer.h b/chrome/browser/web_applications/components/install_finalizer.h
index 8b3a914..5ea721c9 100644
--- a/chrome/browser/web_applications/components/install_finalizer.h
+++ b/chrome/browser/web_applications/components/install_finalizer.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_INSTALL_FINALIZER_H_
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_app_chromeos_data.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/components/web_app_system_web_app_data.h"
#include "components/webapps/browser/installable/installable_metrics.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
struct WebApplicationInfo;
class GURL;
@@ -50,8 +50,8 @@
webapps::WebappInstallSource::COUNT;
bool locally_installed = true;
- base::Optional<WebAppChromeOsData> chromeos_data;
- base::Optional<WebAppSystemWebAppData> system_web_app_data;
+ absl::optional<WebAppChromeOsData> chromeos_data;
+ absl::optional<WebAppSystemWebAppData> system_web_app_data;
};
// Write the WebApp data to disk and register the app.
diff --git a/chrome/browser/web_applications/components/install_finalizer_unittest.cc b/chrome/browser/web_applications/components/install_finalizer_unittest.cc
index 3182041..b829a12 100644
--- a/chrome/browser/web_applications/components/install_finalizer_unittest.cc
+++ b/chrome/browser/web_applications/components/install_finalizer_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
@@ -22,6 +21,7 @@
#include "chrome/browser/web_applications/web_app_install_finalizer.h"
#include "chrome/browser/web_applications/web_app_sync_bridge.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace web_app {
@@ -175,7 +175,7 @@
FinalizeInstallResult result = AwaitFinalizeInstall(*info, options);
- base::Optional<int> install_source =
+ absl::optional<int> install_source =
GetIntWebAppPref(profile()->GetPrefs(), result.installed_app_id,
kLatestWebAppInstallSource);
EXPECT_TRUE(install_source.has_value());
diff --git a/chrome/browser/web_applications/components/install_manager.h b/chrome/browser/web_applications/components/install_manager.h
index 100caf8d..ee4cbb8 100644
--- a/chrome/browser/web_applications/components/install_manager.h
+++ b/chrome/browser/web_applications/components/install_manager.h
@@ -10,13 +10,13 @@
#include <vector>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_app_chromeos_data.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/components/web_app_install_utils.h"
#include "chrome/browser/web_applications/components/web_app_url_loader.h"
#include "chrome/browser/web_applications/system_web_apps/system_web_app_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
struct WebApplicationInfo;
@@ -71,7 +71,7 @@
using WebAppManifestCheckCallback = base::OnceCallback<void(
std::unique_ptr<content::WebContents> web_contents,
InstallableCheckResult result,
- base::Optional<AppId> app_id)>;
+ absl::optional<AppId> app_id)>;
// Checks a WebApp installability (service worker check optional), retrieves
// manifest and icons and then performs the actual installation.
@@ -109,10 +109,10 @@
// // Setting this field will force the webapp to have a manifest id, which
// will result in a different AppId than if it isn't set. Currently here
// to support forwards compatibility with future sync entities..
- base::Optional<std::string> override_manifest_id;
+ absl::optional<std::string> override_manifest_id;
// App name to be used if manifest is unavailable.
- base::Optional<std::u16string> fallback_app_name;
+ absl::optional<std::u16string> fallback_app_name;
bool locally_installed = true;
// These OS shortcut fields can't be true if |locally_installed| is false.
@@ -131,8 +131,8 @@
std::vector<std::string> additional_search_terms;
- base::Optional<std::string> launch_query_params;
- base::Optional<SystemAppType> system_app_type;
+ absl::optional<std::string> launch_query_params;
+ absl::optional<SystemAppType> system_app_type;
bool oem_installed = false;
};
@@ -158,7 +158,7 @@
virtual void InstallWebAppFromInfo(
std::unique_ptr<WebApplicationInfo> web_application_info,
ForInstallableSite for_installable_site,
- const base::Optional<InstallParams>& install_params,
+ const absl::optional<InstallParams>& install_params,
webapps::WebappInstallSource install_source,
OnceInstallCallback callback) = 0;
diff --git a/chrome/browser/web_applications/components/os_integration_manager.cc b/chrome/browser/web_applications/components/os_integration_manager.cc
index cda0d82..1903fc0 100644
--- a/chrome/browser/web_applications/components/os_integration_manager.cc
+++ b/chrome/browser/web_applications/components/os_integration_manager.cc
@@ -15,7 +15,6 @@
#include "base/feature_list.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/threading/sequenced_task_runner_handle.h"
@@ -30,6 +29,7 @@
#include "chrome/common/chrome_features.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if defined(OS_MAC)
#include "chrome/browser/web_applications/components/app_shim_registry_mac.h"
@@ -277,7 +277,7 @@
return file_handler_manager_->GetEnabledFileHandlers(app_id);
}
-const base::Optional<GURL> OsIntegrationManager::GetMatchingFileHandlerURL(
+const absl::optional<GURL> OsIntegrationManager::GetMatchingFileHandlerURL(
const AppId& app_id,
const std::vector<base::FilePath>& launch_files) {
DCHECK(file_handler_manager_);
@@ -305,11 +305,11 @@
app_id);
}
-base::Optional<GURL> OsIntegrationManager::TranslateProtocolUrl(
+absl::optional<GURL> OsIntegrationManager::TranslateProtocolUrl(
const AppId& app_id,
const GURL& protocol_url) {
if (!protocol_handler_manager_)
- return base::Optional<GURL>();
+ return absl::optional<GURL>();
return protocol_handler_manager_->TranslateProtocolUrl(app_id, protocol_url);
}
diff --git a/chrome/browser/web_applications/components/os_integration_manager.h b/chrome/browser/web_applications/components/os_integration_manager.h
index 9683f5dd..a85d61ba 100644
--- a/chrome/browser/web_applications/components/os_integration_manager.h
+++ b/chrome/browser/web_applications/components/os_integration_manager.h
@@ -131,7 +131,7 @@
// Proxy calls for FileHandlerManager.
bool IsFileHandlingAPIAvailable(const AppId& app_id);
const apps::FileHandlers* GetEnabledFileHandlers(const AppId& app_id);
- const base::Optional<GURL> GetMatchingFileHandlerURL(
+ const absl::optional<GURL> GetMatchingFileHandlerURL(
const AppId& app_id,
const std::vector<base::FilePath>& launch_files);
void MaybeUpdateFileHandlingOriginTrialExpiry(
@@ -141,7 +141,7 @@
void DisableForceEnabledFileHandlingOriginTrial(const AppId& app_id);
// Proxy calls for ProtocolHandlerManager.
- virtual base::Optional<GURL> TranslateProtocolUrl(const AppId& app_id,
+ virtual absl::optional<GURL> TranslateProtocolUrl(const AppId& app_id,
const GURL& protocol_url);
// Getter for testing FileHandlerManager
diff --git a/chrome/browser/web_applications/components/protocol_handler_manager.cc b/chrome/browser/web_applications/components/protocol_handler_manager.cc
index 1258c74..139e5316 100644
--- a/chrome/browser/web_applications/components/protocol_handler_manager.cc
+++ b/chrome/browser/web_applications/components/protocol_handler_manager.cc
@@ -25,7 +25,7 @@
DCHECK(app_registrar_);
}
-base::Optional<GURL> ProtocolHandlerManager::TranslateProtocolUrl(
+absl::optional<GURL> ProtocolHandlerManager::TranslateProtocolUrl(
const AppId& app_id,
const GURL& protocol_url) const {
std::vector<ProtocolHandler> handlers = GetAppProtocolHandlers(app_id);
@@ -36,7 +36,7 @@
}
}
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<ProtocolHandler> ProtocolHandlerManager::GetHandlersFor(
diff --git a/chrome/browser/web_applications/components/protocol_handler_manager.h b/chrome/browser/web_applications/components/protocol_handler_manager.h
index a2cf1c2..769b973 100644
--- a/chrome/browser/web_applications/components/protocol_handler_manager.h
+++ b/chrome/browser/web_applications/components/protocol_handler_manager.h
@@ -29,7 +29,7 @@
// for the app indicated by |app_id|, this method will translate the protocol
// to a full app URL.
// If no matching handler is installed, no URL is returned.
- base::Optional<GURL> TranslateProtocolUrl(const AppId& app_id,
+ absl::optional<GURL> TranslateProtocolUrl(const AppId& app_id,
const GURL& protocol_url) const;
// Get the list of handlers for the given protocol.
diff --git a/chrome/browser/web_applications/components/url_handler_prefs.cc b/chrome/browser/web_applications/components/url_handler_prefs.cc
index 3de49ba..7312551 100644
--- a/chrome/browser/web_applications/components/url_handler_prefs.cc
+++ b/chrome/browser/web_applications/components/url_handler_prefs.cc
@@ -8,7 +8,6 @@
#include "base/check.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
@@ -18,6 +17,7 @@
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/url_constants.h"
@@ -103,7 +103,7 @@
const std::string* include_path = include_path_dict.FindStringKey(kPath);
if (!include_path)
continue;
- const base::Optional<int> choice_opt =
+ const absl::optional<int> choice_opt =
include_path_dict.FindIntKey(kChoice);
if (!choice_opt)
continue;
@@ -112,7 +112,7 @@
*choice_opt > static_cast<int>(UrlHandlerSavedChoice::kMax))
continue;
auto current_choice = static_cast<UrlHandlerSavedChoice>(*choice_opt);
- base::Optional<base::Time> current_timestamp =
+ absl::optional<base::Time> current_timestamp =
util::ValueToTime(include_path_dict.FindKey(kTimestamp));
if (!current_timestamp)
continue;
@@ -178,13 +178,13 @@
if (!app_id || app_id->empty())
continue;
- base::Optional<base::FilePath> profile_path =
+ absl::optional<base::FilePath> profile_path =
util::ValueToFilePath(handler.FindKey(kProfilePath));
if (!profile_path || profile_path->empty())
continue;
if (origin_trimmed) {
- base::Optional<bool> has_wildcard =
+ absl::optional<bool> has_wildcard =
handler.FindBoolKey(kHasOriginWildcard);
if (!has_wildcard || !*has_wildcard)
continue;
@@ -363,7 +363,7 @@
bool match_app_id,
const base::Value& handler) {
const std::string* const handler_app_id = handler.FindStringKey(kAppId);
- base::Optional<base::FilePath> handler_profile_path =
+ absl::optional<base::FilePath> handler_profile_path =
util::ValueToFilePath(handler.FindKey(kProfilePath));
if (!handler_app_id || !handler_profile_path)
@@ -452,7 +452,7 @@
if (!handler.is_dict())
continue;
const std::string* const handler_app_id = handler.FindStringKey(kAppId);
- base::Optional<base::FilePath> handler_profile_path =
+ absl::optional<base::FilePath> handler_profile_path =
util::ValueToFilePath(handler.FindKey(kProfilePath));
if (!handler_app_id || !handler_profile_path)
continue;
diff --git a/chrome/browser/web_applications/components/web_app_data_retriever.cc b/chrome/browser/web_applications/components/web_app_data_retriever.cc
index 39e043d..419a0eee 100644
--- a/chrome/browser/web_applications/components/web_app_data_retriever.cc
+++ b/chrome/browser/web_applications/components/web_app_data_retriever.cc
@@ -186,7 +186,7 @@
const bool is_installable = data.NoBlockingErrors();
DCHECK(!is_installable || data.valid_manifest);
- base::Optional<blink::Manifest> opt_manifest;
+ absl::optional<blink::Manifest> opt_manifest;
if (!data.manifest.IsEmpty())
opt_manifest = data.manifest;
@@ -215,7 +215,7 @@
std::move(get_web_app_info_callback_).Run(nullptr);
} else if (check_installability_callback_) {
std::move(check_installability_callback_)
- .Run(/*manifest=*/base::nullopt, /*manifest_url=*/GURL(),
+ .Run(/*manifest=*/absl::nullopt, /*manifest_url=*/GURL(),
/*valid_manifest_for_web_app=*/false,
/*is_installable=*/false);
} else if (get_icons_callback_) {
diff --git a/chrome/browser/web_applications/components/web_app_data_retriever.h b/chrome/browser/web_applications/components/web_app_data_retriever.h
index 87b3644..a8bc1a2 100644
--- a/chrome/browser/web_applications/components/web_app_data_retriever.h
+++ b/chrome/browser/web_applications/components/web_app_data_retriever.h
@@ -11,13 +11,13 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_app_icon_downloader.h"
#include "chrome/browser/web_applications/components/web_app_install_utils.h"
#include "components/webapps/common/web_page_metadata.mojom-forward.h"
#include "components/webapps/common/web_page_metadata_agent.mojom-forward.h"
#include "content/public/browser/web_contents_observer.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
struct WebApplicationInfo;
@@ -48,7 +48,7 @@
// If manifest is present then it is non-empty.
// |manifest_url| is empty if manifest is empty.
using CheckInstallabilityCallback =
- base::OnceCallback<void(base::Optional<blink::Manifest> manifest,
+ base::OnceCallback<void(absl::optional<blink::Manifest> manifest,
const GURL& manifest_url,
bool valid_manifest_for_web_app,
bool is_installable)>;
diff --git a/chrome/browser/web_applications/components/web_app_data_retriever_unittest.cc b/chrome/browser/web_applications/components/web_app_data_retriever_unittest.cc
index 8235153..784ba32 100644
--- a/chrome/browser/web_applications/components/web_app_data_retriever_unittest.cc
+++ b/chrome/browser/web_applications/components/web_app_data_retriever_unittest.cc
@@ -10,7 +10,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
@@ -30,6 +29,7 @@
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "testing/gtest/include/gtest/gtest.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/manifest/manifest.h"
@@ -143,7 +143,7 @@
private:
FakeWebPageMetadataAgent fake_chrome_render_frame_;
- base::Optional<std::unique_ptr<WebApplicationInfo>> web_app_info_;
+ absl::optional<std::unique_ptr<WebApplicationInfo>> web_app_info_;
std::vector<WebApplicationIconInfo> icons_;
};
@@ -307,7 +307,7 @@
WebAppDataRetriever retriever;
retriever.CheckInstallabilityAndRetrieveManifest(
web_contents(), /*bypass_service_worker_check=*/false,
- base::BindLambdaForTesting([&](base::Optional<blink::Manifest> manifest,
+ base::BindLambdaForTesting([&](absl::optional<blink::Manifest> manifest,
const GURL& manifest_url,
bool valid_manifest_for_web_app,
bool is_installable) {
@@ -369,7 +369,7 @@
const std::u16string manifest_short_name = u"Short Name from Manifest";
const std::u16string manifest_name = u"Name from Manifest";
const GURL manifest_scope = GURL("https://example.com/scope");
- const base::Optional<SkColor> manifest_theme_color = 0xAABBCCDD;
+ const absl::optional<SkColor> manifest_theme_color = 0xAABBCCDD;
{
auto manifest = std::make_unique<blink::Manifest>();
@@ -392,7 +392,7 @@
retriever.CheckInstallabilityAndRetrieveManifest(
web_contents(), /*bypass_service_worker_check=*/false,
base::BindLambdaForTesting(
- [&](base::Optional<blink::Manifest> result, const GURL& manifest_url,
+ [&](absl::optional<blink::Manifest> result, const GURL& manifest_url,
bool valid_manifest_for_web_app, bool is_installable) {
EXPECT_TRUE(is_installable);
@@ -429,7 +429,7 @@
retriever.CheckInstallabilityAndRetrieveManifest(
web_contents(), /*bypass_service_worker_check=*/false,
base::BindLambdaForTesting(
- [&](base::Optional<blink::Manifest> result, const GURL& manifest_url,
+ [&](absl::optional<blink::Manifest> result, const GURL& manifest_url,
bool valid_manifest_for_web_app, bool is_installable) {
EXPECT_FALSE(is_installable);
EXPECT_FALSE(valid_manifest_for_web_app);
diff --git a/chrome/browser/web_applications/components/web_app_file_handler_registration_linux_browsertest.cc b/chrome/browser/web_applications/components/web_app_file_handler_registration_linux_browsertest.cc
index 8b9ad8d..ae6851d 100644
--- a/chrome/browser/web_applications/components/web_app_file_handler_registration_linux_browsertest.cc
+++ b/chrome/browser/web_applications/components/web_app_file_handler_registration_linux_browsertest.cc
@@ -9,7 +9,6 @@
#include "base/containers/flat_set.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
@@ -25,6 +24,7 @@
#include "components/services/app_service/public/cpp/file_handler.h"
#include "content/public/test/browser_test.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/features.h"
#include "url/gurl.h"
@@ -68,7 +68,7 @@
}
base::test::ScopedFeatureList scoped_feature_list_;
- base::Optional<InstallResultCode> result_code_;
+ absl::optional<InstallResultCode> result_code_;
};
// Verify that the MIME type registration callback is called and that
diff --git a/chrome/browser/web_applications/components/web_app_file_handler_registration_win.cc b/chrome/browser/web_applications/components/web_app_file_handler_registration_win.cc
index 790a39c8a..8a1d186 100644
--- a/chrome/browser/web_applications/components/web_app_file_handler_registration_win.cc
+++ b/chrome/browser/web_applications/components/web_app_file_handler_registration_win.cc
@@ -34,7 +34,7 @@
const std::wstring& app_name_extension) {
const base::FilePath web_app_path =
GetOsIntegrationResourcesDirectoryForApp(profile_path, app_id, GURL());
- base::Optional<base::FilePath> app_specific_launcher_path =
+ absl::optional<base::FilePath> app_specific_launcher_path =
CreateAppLauncherFile(app_name, app_name_extension, web_app_path);
if (!app_specific_launcher_path.has_value())
return;
diff --git a/chrome/browser/web_applications/components/web_app_handler_registration_utils_win.cc b/chrome/browser/web_applications/components/web_app_handler_registration_utils_win.cc
index 3a97f8d..0418bc42 100644
--- a/chrome/browser/web_applications/components/web_app_handler_registration_utils_win.cc
+++ b/chrome/browser/web_applications/components/web_app_handler_registration_utils_win.cc
@@ -102,7 +102,7 @@
std::wstring user_visible_app_name(app_name);
user_visible_app_name.append(app_name_extension);
- base::Optional<base::FilePath> app_launcher_path =
+ absl::optional<base::FilePath> app_launcher_path =
web_app::CreateAppLauncherFile(
app_name, app_name_extension,
web_app::GetOsIntegrationResourcesDirectoryForApp(profile_path,
@@ -208,14 +208,14 @@
return prog_id;
}
-base::Optional<base::FilePath> CreateAppLauncherFile(
+absl::optional<base::FilePath> CreateAppLauncherFile(
const std::wstring& app_name,
const std::wstring& app_name_extension,
const base::FilePath& web_app_path) {
if (!base::CreateDirectory(web_app_path)) {
DPLOG(ERROR) << "Unable to create web app dir";
RecordRegistration(RegistrationResult::kFailToCopyFromGenericLauncher);
- return base::nullopt;
+ return absl::nullopt;
}
base::FilePath icon_path =
@@ -238,7 +238,7 @@
<< " app_specific_launcher_path: "
<< app_specific_launcher_path;
RecordRegistration(RegistrationResult::kFailToCopyFromGenericLauncher);
- return base::nullopt;
+ return absl::nullopt;
}
return app_specific_launcher_path;
diff --git a/chrome/browser/web_applications/components/web_app_handler_registration_utils_win.h b/chrome/browser/web_applications/components/web_app_handler_registration_utils_win.h
index 0d49209d..ef920ce 100644
--- a/chrome/browser/web_applications/components/web_app_handler_registration_utils_win.h
+++ b/chrome/browser/web_applications/components/web_app_handler_registration_utils_win.h
@@ -7,9 +7,9 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/components/web_app_shortcut_win.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace web_app {
@@ -34,8 +34,8 @@
// Makes an app-specific copy of chrome_pwa_launcher.exe that lives in the web
// application directory |web_app_path|. Returns path of the launcher file if
-// successful, base::nullopt otherwise.
-base::Optional<base::FilePath> CreateAppLauncherFile(
+// successful, absl::nullopt otherwise.
+absl::optional<base::FilePath> CreateAppLauncherFile(
const std::wstring& app_name,
const std::wstring& app_name_extension,
const base::FilePath& web_app_path);
diff --git a/chrome/browser/web_applications/components/web_app_handler_registration_utils_win_unittest.cc b/chrome/browser/web_applications/components/web_app_handler_registration_utils_win_unittest.cc
index 5d21ef3a..23301aab 100644
--- a/chrome/browser/web_applications/components/web_app_handler_registration_utils_win_unittest.cc
+++ b/chrome/browser/web_applications/components/web_app_handler_registration_utils_win_unittest.cc
@@ -59,7 +59,7 @@
const std::wstring& app_name,
const std::wstring& app_name_extension,
const base::FilePath& profile_path) {
- base::Optional<base::FilePath> launcher_path = CreateAppLauncherFile(
+ absl::optional<base::FilePath> launcher_path = CreateAppLauncherFile(
app_name, app_name_extension,
GetOsIntegrationResourcesDirectoryForApp(profile_path, app_id, GURL()));
ASSERT_TRUE(launcher_path.has_value());
@@ -229,7 +229,7 @@
TEST_F(WebAppHandlerRegistrationUtilsWinTest, CreateAppLauncherFile) {
std::wstring app_name_extension = L" extension";
- base::Optional<base::FilePath> launcher_path =
+ absl::optional<base::FilePath> launcher_path =
CreateAppLauncherFile(app_name(), app_name_extension,
GetOsIntegrationResourcesDirectoryForApp(
profile()->GetPath(), app_id(), GURL()));
diff --git a/chrome/browser/web_applications/components/web_app_helpers.cc b/chrome/browser/web_applications/components/web_app_helpers.cc
index 1556596..a39db1b 100644
--- a/chrome/browser/web_applications/components/web_app_helpers.cc
+++ b/chrome/browser/web_applications/components/web_app_helpers.cc
@@ -63,7 +63,7 @@
return crx_file::id_util::GenerateId(GenerateAppHashFromURL(url));
}
-AppId GenerateAppId(const base::Optional<std::string>& manifest_id,
+AppId GenerateAppId(const absl::optional<std::string>& manifest_id,
const GURL& start_url) {
// When manifest_id is specified, the app id is generated from
// <start_url_origin>/<manifest_id>.
@@ -107,13 +107,13 @@
app_url.SchemeIs(extensions::kExtensionScheme);
}
-base::Optional<AppId> FindInstalledAppWithUrlInScope(Profile* profile,
+absl::optional<AppId> FindInstalledAppWithUrlInScope(Profile* profile,
const GURL& url,
bool window_only) {
auto* provider = WebAppProviderBase::GetProviderBase(profile);
return provider ? provider->registrar().FindInstalledAppWithUrlInScope(
url, window_only)
- : base::nullopt;
+ : absl::nullopt;
}
} // namespace web_app
diff --git a/chrome/browser/web_applications/components/web_app_helpers.h b/chrome/browser/web_applications/components/web_app_helpers.h
index 1bd5eec0..c2574b0 100644
--- a/chrome/browser/web_applications/components/web_app_helpers.h
+++ b/chrome/browser/web_applications/components/web_app_helpers.h
@@ -7,9 +7,9 @@
#include <string>
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
class Profile;
@@ -46,7 +46,7 @@
//
// App ID and App Key match Extension ID and Extension Key for migration.
AppId GenerateAppIdFromURL(const GURL& url);
-AppId GenerateAppId(const base::Optional<std::string>& manifest_id,
+AppId GenerateAppId(const absl::optional<std::string>& manifest_id,
const GURL& start_url);
std::string GenerateAppKeyFromURL(const GURL& url);
@@ -60,7 +60,7 @@
// Searches for the first locally installed app id in the registry for which
// the |url| is in scope. If |window_only| is specified, only apps that
// open in app windows will be considered.
-base::Optional<AppId> FindInstalledAppWithUrlInScope(Profile* profile,
+absl::optional<AppId> FindInstalledAppWithUrlInScope(Profile* profile,
const GURL& url,
bool window_only = false);
diff --git a/chrome/browser/web_applications/components/web_app_icon_downloader_unittest.cc b/chrome/browser/web_applications/components/web_app_icon_downloader_unittest.cc
index c82453a..f15d864 100644
--- a/chrome/browser/web_applications/components/web_app_icon_downloader_unittest.cc
+++ b/chrome/browser/web_applications/components/web_app_icon_downloader_unittest.cc
@@ -111,8 +111,7 @@
std::vector<blink::mojom::FaviconURLPtr> initial_favicon_urls_;
IconsMap favicon_map_;
int id_counter_;
- base::Optional<bool> downloads_succeeded_;
-
+ absl::optional<bool> downloads_succeeded_;
};
TEST_F(WebAppIconDownloaderTest, SimpleDownload) {
diff --git a/chrome/browser/web_applications/components/web_app_install_utils.cc b/chrome/browser/web_applications/components/web_app_install_utils.cc
index e393d35e..b04a516 100644
--- a/chrome/browser/web_applications/components/web_app_install_utils.cc
+++ b/chrome/browser/web_applications/components/web_app_install_utils.cc
@@ -10,7 +10,6 @@
#include "base/containers/contains.h"
#include "base/feature_list.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
@@ -24,6 +23,7 @@
#include "components/webapps/browser/banners/app_banner_settings_helper.h"
#include "components/webapps/browser/installable/installable_data.h"
#include "components/webapps/browser/installable/installable_metrics.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -158,10 +158,10 @@
NOTREACHED();
}
-base::Optional<apps::ShareTarget> ToWebAppShareTarget(
- const base::Optional<blink::Manifest::ShareTarget>& share_target) {
+absl::optional<apps::ShareTarget> ToWebAppShareTarget(
+ const absl::optional<blink::Manifest::ShareTarget>& share_target) {
if (!share_target) {
- return base::nullopt;
+ return absl::nullopt;
}
apps::ShareTarget apps_share_target;
apps_share_target.action = share_target->action;
diff --git a/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc b/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc
index 0816e19..30ad2534 100644
--- a/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc
+++ b/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc
@@ -289,7 +289,7 @@
EXPECT_TRUE(share_target.params.files.empty());
}
- manifest.share_target = base::nullopt;
+ manifest.share_target = absl::nullopt;
UpdateWebAppInfoFromManifest(manifest, kAppManifestUrl, &web_app_info);
EXPECT_FALSE(web_app_info.share_target.has_value());
}
diff --git a/chrome/browser/web_applications/components/web_app_prefs_utils.cc b/chrome/browser/web_applications/components/web_app_prefs_utils.cc
index d8f1be2..ad6fbf4 100644
--- a/chrome/browser/web_applications/components/web_app_prefs_utils.cc
+++ b/chrome/browser/web_applications/components/web_app_prefs_utils.cc
@@ -54,7 +54,7 @@
}
// Returns whether the time occurred within X days.
-bool TimeOccurredWithinDays(base::Optional<base::Time> time, int days) {
+bool TimeOccurredWithinDays(absl::optional<base::Time> time, int days) {
return time && (base::Time::Now() - time.value()).InDays() < days;
}
@@ -134,14 +134,14 @@
web_app_prefs->SetBoolean(path, value);
}
-base::Optional<int> GetIntWebAppPref(const PrefService* pref_service,
+absl::optional<int> GetIntWebAppPref(const PrefService* pref_service,
const AppId& app_id,
base::StringPiece path) {
const base::DictionaryValue* web_app_prefs =
GetWebAppDictionary(pref_service, app_id);
if (web_app_prefs)
return web_app_prefs->FindIntPath(path);
- return base::nullopt;
+ return absl::nullopt;
}
void UpdateIntWebAppPref(PrefService* pref_service,
@@ -156,14 +156,14 @@
web_app_prefs->SetInteger(path, value);
}
-base::Optional<double> GetDoubleWebAppPref(const PrefService* pref_service,
+absl::optional<double> GetDoubleWebAppPref(const PrefService* pref_service,
const AppId& app_id,
base::StringPiece path) {
const base::DictionaryValue* web_app_prefs =
GetWebAppDictionary(pref_service, app_id);
if (web_app_prefs)
return web_app_prefs->FindDoublePath(path);
- return base::nullopt;
+ return absl::nullopt;
}
void UpdateDoubleWebAppPref(PrefService* pref_service,
@@ -178,7 +178,7 @@
web_app_prefs->SetDouble(path, value);
}
-base::Optional<base::Time> GetTimeWebAppPref(const PrefService* pref_service,
+absl::optional<base::Time> GetTimeWebAppPref(const PrefService* pref_service,
const AppId& app_id,
base::StringPiece path) {
if (const auto* web_app_prefs = GetWebAppDictionary(pref_service, app_id)) {
@@ -186,7 +186,7 @@
return util::ValueToTime(value);
}
- return base::nullopt;
+ return absl::nullopt;
}
void UpdateTimeWebAppPref(PrefService* pref_service,
@@ -215,7 +215,7 @@
void RecordInstallIphIgnored(PrefService* pref_service,
const AppId& app_id,
base::Time time) {
- base::Optional<int> ignored_count =
+ absl::optional<int> ignored_count =
GetIntWebAppPref(pref_service, app_id, kIphIgnoreCount);
int new_count = base::saturated_cast<int>(1 + ignored_count.value_or(0));
diff --git a/chrome/browser/web_applications/components/web_app_prefs_utils.h b/chrome/browser/web_applications/components/web_app_prefs_utils.h
index 20e8f2f..2fdbb0c 100644
--- a/chrome/browser/web_applications/components/web_app_prefs_utils.h
+++ b/chrome/browser/web_applications/components/web_app_prefs_utils.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_WEB_APP_PREFS_UTILS_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_WEB_APP_PREFS_UTILS_H_
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "base/time/time.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefService;
@@ -41,7 +41,7 @@
base::StringPiece path,
bool value);
-base::Optional<int> GetIntWebAppPref(const PrefService* pref_service,
+absl::optional<int> GetIntWebAppPref(const PrefService* pref_service,
const AppId& app_id,
base::StringPiece path);
@@ -50,7 +50,7 @@
base::StringPiece path,
int value);
-base::Optional<double> GetDoubleWebAppPref(const PrefService* pref_service,
+absl::optional<double> GetDoubleWebAppPref(const PrefService* pref_service,
const AppId& app_id,
base::StringPiece path);
@@ -59,7 +59,7 @@
base::StringPiece path,
double value);
-base::Optional<base::Time> GetTimeWebAppPref(const PrefService* pref_service,
+absl::optional<base::Time> GetTimeWebAppPref(const PrefService* pref_service,
const AppId& app_id,
base::StringPiece path);
diff --git a/chrome/browser/web_applications/components/web_app_protocol_handler_registration_win.cc b/chrome/browser/web_applications/components/web_app_protocol_handler_registration_win.cc
index c84a015f..cc1d7de 100644
--- a/chrome/browser/web_applications/components/web_app_protocol_handler_registration_win.cc
+++ b/chrome/browser/web_applications/components/web_app_protocol_handler_registration_win.cc
@@ -12,7 +12,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -33,6 +32,7 @@
#include "components/prefs/scoped_user_pref_update.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace {
@@ -49,7 +49,7 @@
web_app::GetOsIntegrationResourcesDirectoryForApp(profile_path, app_id,
GURL());
- base::Optional<base::FilePath> app_specific_launcher_path =
+ absl::optional<base::FilePath> app_specific_launcher_path =
web_app::CreateAppLauncherFile(app_name, app_name_extension,
web_app_path);
if (!app_specific_launcher_path.has_value())
diff --git a/chrome/browser/web_applications/components/web_app_system_web_app_data.h b/chrome/browser/web_applications/components/web_app_system_web_app_data.h
index c5c8627..d152f69 100644
--- a/chrome/browser/web_applications/components/web_app_system_web_app_data.h
+++ b/chrome/browser/web_applications/components/web_app_system_web_app_data.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_WEB_APP_SYSTEM_WEB_APP_DATA_H_
#include <iosfwd>
-#include "base/optional.h"
#include "chrome/browser/web_applications/system_web_apps/system_web_app_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace web_app {
diff --git a/chrome/browser/web_applications/components/web_app_url_loader_browsertest.cc b/chrome/browser/web_applications/components/web_app_url_loader_browsertest.cc
index 2a91a5a3..f890c0c2 100644
--- a/chrome/browser/web_applications/components/web_app_url_loader_browsertest.cc
+++ b/chrome/browser/web_applications/components/web_app_url_loader_browsertest.cc
@@ -7,7 +7,6 @@
#include "base/barrier_closure.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/test_mock_time_task_runner.h"
@@ -22,6 +21,7 @@
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace web_app {
@@ -80,7 +80,7 @@
}
Result LoadUrlAndWait(UrlComparison url_comparison, const std::string& path) {
- base::Optional<Result> result;
+ absl::optional<Result> result;
base::RunLoop run_loop;
WebAppUrlLoader loader;
loader.LoadUrl(embedded_test_server()->GetURL(path), web_contents(),
@@ -177,7 +177,7 @@
base::TestMockTimeTaskRunner::ScopedContext scoped_context(task_runner);
WebAppUrlLoader loader;
- base::Optional<Result> result;
+ absl::optional<Result> result;
loader.LoadUrl(embedded_test_server()->GetURL("/hung"), web_contents(),
UrlComparison::kExact,
@@ -200,7 +200,7 @@
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, WebContentsDestroyed) {
ASSERT_TRUE(embedded_test_server()->Start());
WebAppUrlLoader loader;
- base::Optional<Result> result;
+ absl::optional<Result> result;
base::RunLoop run_loop;
loader.LoadUrl(embedded_test_server()->GetURL("/hung"), web_contents(),
@@ -227,8 +227,8 @@
IN_PROC_BROWSER_TEST_F(WebAppUrlLoaderTest, MultipleLoadUrlCalls) {
ASSERT_TRUE(embedded_test_server()->Start());
WebAppUrlLoader loader;
- base::Optional<Result> title1_result;
- base::Optional<Result> title2_result;
+ absl::optional<Result> title1_result;
+ absl::optional<Result> title2_result;
std::unique_ptr<content::WebContents> web_contents1 =
content::WebContents::Create(
diff --git a/chrome/browser/web_applications/components/web_app_utils.cc b/chrome/browser/web_applications/components/web_app_utils.cc
index 58875b5..54c5d83 100644
--- a/chrome/browser/web_applications/components/web_app_utils.cc
+++ b/chrome/browser/web_applications/components/web_app_utils.cc
@@ -146,7 +146,7 @@
return {};
const AppRegistrar& registrar = provider->registrar();
- base::Optional<AppId> app_id = registrar.FindAppWithUrlInScope(url);
+ absl::optional<AppId> app_id = registrar.FindAppWithUrlInScope(url);
if (!app_id)
return {};
diff --git a/chrome/browser/web_applications/components/web_application_info.h b/chrome/browser/web_applications/components/web_application_info.h
index 134e962..1ef08f0 100644
--- a/chrome/browser/web_applications/components/web_application_info.h
+++ b/chrome/browser/web_applications/components/web_application_info.h
@@ -13,10 +13,10 @@
#include <vector>
#include "base/containers/flat_set.h"
-#include "base/optional.h"
#include "components/services/app_service/public/cpp/share_target.h"
#include "components/services/app_service/public/cpp/url_handler_info.h"
#include "components/webapps/common/web_page_metadata.mojom-forward.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom.h"
#include "third_party/blink/public/mojom/manifest/manifest.mojom-shared.h"
@@ -103,7 +103,7 @@
WebApplicationIconInfo& operator=(WebApplicationIconInfo&&) noexcept;
GURL url;
- base::Optional<SquareSizePx> square_size_px;
+ absl::optional<SquareSizePx> square_size_px;
IconPurpose purpose = IconPurpose::ANY;
};
@@ -169,7 +169,7 @@
~WebApplicationInfo();
// Id specified in the manifest.
- base::Optional<std::string> manifest_id;
+ absl::optional<std::string> manifest_id;
// Title of the application.
std::u16string title;
@@ -186,7 +186,7 @@
GURL manifest_url;
// Optional query parameters to add to the start_url when launching the app.
- base::Optional<std::string> launch_query_params;
+ absl::optional<std::string> launch_query_params;
// Scope for the app. Dictates what URLs will be opened in the app.
// https://www.w3.org/TR/appmanifest/#scope-member
@@ -210,11 +210,11 @@
SkColor generated_icon_color = SK_ColorTRANSPARENT;
// The color to use for the web app frame.
- base::Optional<SkColor> theme_color;
+ absl::optional<SkColor> theme_color;
// The expected page background color of the web app.
// https://www.w3.org/TR/appmanifest/#background_color-member
- base::Optional<SkColor> background_color;
+ absl::optional<SkColor> background_color;
// App preference regarding whether the app should be opened in a tab,
// in a window (with or without minimal-ui buttons), or full screen. Defaults
@@ -239,7 +239,7 @@
std::vector<blink::Manifest::FileHandler> file_handlers;
// File types the app accepts as a Web Share Target.
- base::Optional<apps::ShareTarget> share_target;
+ absl::optional<apps::ShareTarget> share_target;
// Additional search terms that users can use to find the app.
std::vector<std::string> additional_search_terms;
diff --git a/chrome/browser/web_applications/daily_metrics_helper.cc b/chrome/browser/web_applications/daily_metrics_helper.cc
index d436bfe..33d6ffc 100644
--- a/chrome/browser/web_applications/daily_metrics_helper.cc
+++ b/chrome/browser/web_applications/daily_metrics_helper.cc
@@ -60,8 +60,8 @@
namespace {
+using absl::optional;
using base::DictionaryValue;
-using base::Optional;
using base::TimeDelta;
using base::Value;
@@ -75,46 +75,46 @@
const char kBackgroundDurationSec[] = "background_duration_sec";
const char kNumSessions[] = "num_sessions";
-Optional<DailyInteraction> DictToRecord(const std::string& url,
+optional<DailyInteraction> DictToRecord(const std::string& url,
const DictionaryValue& record_dict) {
GURL gurl(url);
if (!gurl.is_valid())
- return base::nullopt;
+ return absl::nullopt;
DailyInteraction record(gurl);
- Optional<int> installed = record_dict.FindBoolKey(kInstalled);
+ optional<int> installed = record_dict.FindBoolKey(kInstalled);
if (!installed.has_value())
- return base::nullopt;
+ return absl::nullopt;
record.installed = *installed;
record.install_source = record_dict.FindIntKey(kInstallSource);
- Optional<int> effective_display_mode =
+ optional<int> effective_display_mode =
record_dict.FindIntKey(kEffectiveDisplayMode);
if (!effective_display_mode.has_value())
- return base::nullopt;
+ return absl::nullopt;
record.effective_display_mode = *effective_display_mode;
- Optional<bool> promotable = record_dict.FindBoolKey(kPromotable);
+ optional<bool> promotable = record_dict.FindBoolKey(kPromotable);
if (!promotable.has_value())
- return base::nullopt;
+ return absl::nullopt;
record.promotable = *promotable;
- Optional<int> foreground_duration_sec =
+ optional<int> foreground_duration_sec =
record_dict.FindIntKey(kForegroundDurationSec);
if (foreground_duration_sec) {
record.foreground_duration =
TimeDelta::FromSeconds(*foreground_duration_sec);
}
- Optional<int> background_duration_sec =
+ optional<int> background_duration_sec =
record_dict.FindIntKey(kBackgroundDurationSec);
if (background_duration_sec) {
record.background_duration =
TimeDelta::FromSeconds(*background_duration_sec);
}
- Optional<int> num_sessions = record_dict.FindIntKey(kNumSessions);
+ optional<int> num_sessions = record_dict.FindIntKey(kNumSessions);
if (num_sessions)
record.num_sessions = *num_sessions;
@@ -138,7 +138,7 @@
}
void EmitIfSourceIdExists(DailyInteraction record,
- Optional<ukm::SourceId> origin_source_id) {
+ optional<ukm::SourceId> origin_source_id) {
if (!origin_source_id)
return;
@@ -169,7 +169,7 @@
const std::string& url = iter.key();
const Value& val = iter.value();
const DictionaryValue& dict = Value::AsDictionaryValue(val);
- Optional<DailyInteraction> record = DictToRecord(url, dict);
+ optional<DailyInteraction> record = DictToRecord(url, dict);
if (record)
EmitRecord(*record, profile);
}
@@ -194,7 +194,7 @@
if (existing_val) {
// Sum duration and session values from existing record.
const DictionaryValue& dict = Value::AsDictionaryValue(*existing_val);
- Optional<DailyInteraction> existing_record = DictToRecord(url, dict);
+ optional<DailyInteraction> existing_record = DictToRecord(url, dict);
if (existing_record) {
record.foreground_duration += existing_record->foreground_duration;
record.background_duration += existing_record->background_duration;
diff --git a/chrome/browser/web_applications/daily_metrics_helper.h b/chrome/browser/web_applications/daily_metrics_helper.h
index 6a789ead..7bb298b 100644
--- a/chrome/browser/web_applications/daily_metrics_helper.h
+++ b/chrome/browser/web_applications/daily_metrics_helper.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_WEB_APPLICATIONS_DAILY_METRICS_HELPER_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_DAILY_METRICS_HELPER_H_
-#include "base/optional.h"
#include "base/time/time.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class PrefRegistrySimple;
@@ -19,7 +19,7 @@
GURL start_url;
// Implied bool used = true;
bool installed = false;
- base::Optional<int> install_source;
+ absl::optional<int> install_source;
int effective_display_mode = 0;
bool promotable = false;
// Durations and sessions emitted iff non-zero.
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_icon_manager.cc b/chrome/browser/web_applications/extensions/bookmark_app_icon_manager.cc
index bb4a56ec..1279071 100644
--- a/chrome/browser/web_applications/extensions/bookmark_app_icon_manager.cc
+++ b/chrome/browser/web_applications/extensions/bookmark_app_icon_manager.cc
@@ -202,17 +202,17 @@
return true;
}
-base::Optional<web_app::AppIconManager::IconSizeAndPurpose>
+absl::optional<web_app::AppIconManager::IconSizeAndPurpose>
BookmarkAppIconManager::FindIconMatchBigger(
const web_app::AppId& app_id,
const std::vector<IconPurpose>& purposes,
SquareSizePx min_size) const {
const Extension* app = GetBookmarkApp(profile_, app_id);
if (!app)
- return base::nullopt;
+ return absl::nullopt;
// Legacy bookmark apps handle IconPurpose::ANY icons only.
if (!base::Contains(purposes, IconPurpose::ANY))
- return base::nullopt;
+ return absl::nullopt;
const ExtensionIconSet& icons = IconsInfo::GetIcons(app);
const std::string& path = icons.Get(min_size, ExtensionIconSet::MATCH_BIGGER);
@@ -220,7 +220,7 @@
int found_icon_size = icons.GetIconSizeFromPath(path);
if (found_icon_size == 0)
- return base::nullopt;
+ return absl::nullopt;
return IconSizeAndPurpose{found_icon_size, IconPurpose::ANY};
}
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_icon_manager.h b/chrome/browser/web_applications/extensions/bookmark_app_icon_manager.h
index 07778a0..962f4427 100644
--- a/chrome/browser/web_applications/extensions/bookmark_app_icon_manager.h
+++ b/chrome/browser/web_applications/extensions/bookmark_app_icon_manager.h
@@ -29,7 +29,7 @@
bool HasIcons(const web_app::AppId& app_id,
IconPurpose purpose,
const SortedSizesPx& icon_sizes_in_px) const override;
- base::Optional<IconSizeAndPurpose> FindIconMatchBigger(
+ absl::optional<IconSizeAndPurpose> FindIconMatchBigger(
const web_app::AppId& app_id,
const std::vector<IconPurpose>& purposes,
SquareSizePx min_size) const override;
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.cc b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.cc
index f86dff4..bcf70dd 100644
--- a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.cc
+++ b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.cc
@@ -12,7 +12,6 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/profiles/profile.h"
@@ -38,6 +37,7 @@
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/extension_set.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
using extensions::mojom::ManifestLocation;
@@ -228,7 +228,7 @@
bool is_locally_installed,
InstallFinalizedCallback callback,
scoped_refptr<CrxInstaller> crx_installer,
- const base::Optional<CrxInstallError>& error) {
+ const absl::optional<CrxInstallError>& error) {
if (error) {
std::move(callback).Run(
web_app::AppId(),
@@ -272,7 +272,7 @@
const WebApplicationInfo& web_app_info,
InstallFinalizedCallback callback,
scoped_refptr<CrxInstaller> crx_installer,
- const base::Optional<CrxInstallError>& error) {
+ const absl::optional<CrxInstallError>& error) {
if (error) {
std::move(callback).Run(
web_app::AppId(),
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h
index ff29428..508ee63 100644
--- a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h
+++ b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h
@@ -75,14 +75,14 @@
bool is_locally_installed,
InstallFinalizedCallback callback,
scoped_refptr<CrxInstaller> crx_installer,
- const base::Optional<CrxInstallError>& error);
+ const absl::optional<CrxInstallError>& error);
void OnExtensionUpdated(const web_app::AppId& expected_app_id,
const std::string& old_name,
const WebApplicationInfo& web_app_info,
InstallFinalizedCallback callback,
scoped_refptr<CrxInstaller> crx_installer,
- const base::Optional<CrxInstallError>& error);
+ const absl::optional<CrxInstallError>& error);
CrxInstallerFactory crx_installer_factory_;
web_app::ExternallyInstalledWebAppPrefs externally_installed_app_prefs_;
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_registrar.cc b/chrome/browser/web_applications/extensions/bookmark_app_registrar.cc
index a9829ad..34417e2 100644
--- a/chrome/browser/web_applications/extensions/bookmark_app_registrar.cc
+++ b/chrome/browser/web_applications/extensions/bookmark_app_registrar.cc
@@ -133,19 +133,19 @@
return extension ? extension->description() : std::string();
}
-base::Optional<SkColor> BookmarkAppRegistrar::GetAppThemeColor(
+absl::optional<SkColor> BookmarkAppRegistrar::GetAppThemeColor(
const web_app::AppId& app_id) const {
const Extension* extension = GetBookmarkAppDchecked(app_id);
if (!extension)
- return base::nullopt;
+ return absl::nullopt;
return AppThemeColorInfo::GetThemeColor(extension);
}
-base::Optional<SkColor> BookmarkAppRegistrar::GetAppBackgroundColor(
+absl::optional<SkColor> BookmarkAppRegistrar::GetAppBackgroundColor(
const web_app::AppId& app_id) const {
// Only implemented for WebApp. Bookmark apps are going away.
- return base::nullopt;
+ return absl::nullopt;
}
const GURL& BookmarkAppRegistrar::GetAppStartUrl(
@@ -183,17 +183,17 @@
return false;
}
-base::Optional<GURL> BookmarkAppRegistrar::GetAppScopeInternal(
+absl::optional<GURL> BookmarkAppRegistrar::GetAppScopeInternal(
const web_app::AppId& app_id) const {
const Extension* extension = GetBookmarkAppDchecked(app_id);
if (!extension)
- return base::nullopt;
+ return absl::nullopt;
GURL scope_url = GetScopeURLFromBookmarkApp(GetBookmarkAppDchecked(app_id));
if (scope_url.is_valid())
return scope_url;
- return base::nullopt;
+ return absl::nullopt;
}
DisplayMode BookmarkAppRegistrar::GetAppDisplayMode(
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_registrar.h b/chrome/browser/web_applications/extensions/bookmark_app_registrar.h
index ceedca28..f80406ce 100644
--- a/chrome/browser/web_applications/extensions/bookmark_app_registrar.h
+++ b/chrome/browser/web_applications/extensions/bookmark_app_registrar.h
@@ -41,9 +41,9 @@
int CountUserInstalledApps() const override;
std::string GetAppShortName(const web_app::AppId& app_id) const override;
std::string GetAppDescription(const web_app::AppId& app_id) const override;
- base::Optional<SkColor> GetAppThemeColor(
+ absl::optional<SkColor> GetAppThemeColor(
const web_app::AppId& app_id) const override;
- base::Optional<SkColor> GetAppBackgroundColor(
+ absl::optional<SkColor> GetAppBackgroundColor(
const web_app::AppId& app_id) const override;
const GURL& GetAppStartUrl(const web_app::AppId& app_id) const override;
const std::string* GetAppLaunchQueryParams(
@@ -56,7 +56,7 @@
const web_app::AppId& app_id) const override;
bool IsAppFileHandlerPermissionBlocked(
const web_app::AppId& app_id) const override;
- base::Optional<GURL> GetAppScopeInternal(
+ absl::optional<GURL> GetAppScopeInternal(
const web_app::AppId& app_id) const override;
web_app::DisplayMode GetAppDisplayMode(
const web_app::AppId& app_id) const override;
diff --git a/chrome/browser/web_applications/extensions/externally_managed_app_install_task_unittest.cc b/chrome/browser/web_applications/extensions/externally_managed_app_install_task_unittest.cc
index 1e568cd..8df08c03 100644
--- a/chrome/browser/web_applications/extensions/externally_managed_app_install_task_unittest.cc
+++ b/chrome/browser/web_applications/extensions/externally_managed_app_install_task_unittest.cc
@@ -16,7 +16,6 @@
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
@@ -46,6 +45,7 @@
#include "components/webapps/browser/installable/installable_metrics.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "url/gurl.h"
@@ -392,9 +392,9 @@
task->Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
- base::Optional<AppId> id =
+ absl::optional<AppId> id =
ExternallyInstalledWebAppPrefs(profile()->GetPrefs())
.LookupAppId(kWebAppUrl);
@@ -437,9 +437,9 @@
task->Install(web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
- base::Optional<AppId> id =
+ absl::optional<AppId> id =
ExternallyInstalledWebAppPrefs(profile()->GetPrefs())
.LookupAppId(kWebAppUrl);
@@ -470,7 +470,7 @@
task->Install(
web_contents(),
- base::BindLambdaForTesting([&](base::Optional<AppId> app_id,
+ base::BindLambdaForTesting([&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult
result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
@@ -505,7 +505,7 @@
task->Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
EXPECT_TRUE(app_id.has_value());
@@ -540,7 +540,7 @@
base::RunLoop run_loop;
task->Install(
web_contents(),
- base::BindLambdaForTesting([&](base::Optional<AppId> app_id,
+ base::BindLambdaForTesting([&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult
result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
@@ -573,7 +573,7 @@
base::RunLoop run_loop;
task->Install(web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall,
result.code);
@@ -598,7 +598,7 @@
base::RunLoop run_loop;
task->Install(web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall,
result.code);
@@ -623,7 +623,7 @@
base::RunLoop run_loop;
task->Install(web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall,
result.code);
@@ -650,7 +650,7 @@
base::RunLoop run_loop;
task->Install(web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall,
result.code);
@@ -678,7 +678,7 @@
task->Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
EXPECT_TRUE(app_id.has_value());
@@ -722,7 +722,7 @@
task->Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
EXPECT_TRUE(app_id.has_value());
@@ -766,7 +766,7 @@
task->Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
placeholder_app_id = app_id.value();
@@ -787,7 +787,7 @@
task->Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
EXPECT_EQ(placeholder_app_id, app_id.value());
@@ -818,7 +818,7 @@
task->Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
placeholder_app_id = app_id.value();
@@ -841,7 +841,7 @@
task->Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
EXPECT_TRUE(app_id.has_value());
@@ -875,7 +875,7 @@
task->Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
placeholder_app_id = app_id.value();
@@ -900,7 +900,7 @@
task->Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kFailedPlaceholderUninstall,
result.code);
@@ -938,7 +938,7 @@
task->Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> installed_app_id,
+ [&](absl::optional<AppId> installed_app_id,
ExternallyManagedAppManager::InstallResult result) {
app_id = *installed_app_id;
@@ -967,7 +967,7 @@
task->Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> installed_app_id,
+ [&](absl::optional<AppId> installed_app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
EXPECT_EQ(app_id, *installed_app_id);
@@ -1006,7 +1006,7 @@
install_task.Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
EXPECT_EQ(result.code, result_pair.install_result);
run_loop.Quit();
@@ -1030,7 +1030,7 @@
install_task.Install(
web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId>,
+ [&](absl::optional<AppId>,
ExternallyManagedAppManager::InstallResult) { NOTREACHED(); }));
base::RunLoop().RunUntilIdle();
@@ -1059,10 +1059,10 @@
base::RunLoop run_loop;
task.Install(
/*web_contents=*/nullptr,
- base::BindLambdaForTesting([&](base::Optional<AppId> app_id,
+ base::BindLambdaForTesting([&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult
result) {
- base::Optional<AppId> id =
+ absl::optional<AppId> id =
ExternallyInstalledWebAppPrefs(profile()->GetPrefs())
.LookupAppId(kWebAppUrl);
EXPECT_EQ(InstallResultCode::kSuccessOfflineOnlyInstall, result.code);
@@ -1112,9 +1112,9 @@
task.Install(web_contents(),
base::BindLambdaForTesting(
- [&](base::Optional<AppId> app_id,
+ [&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
- base::Optional<AppId> id =
+ absl::optional<AppId> id =
ExternallyInstalledWebAppPrefs(profile()->GetPrefs())
.LookupAppId(kWebAppUrl);
@@ -1147,7 +1147,7 @@
task->Install(
web_contents(),
- base::BindLambdaForTesting([&](base::Optional<AppId> app_id,
+ base::BindLambdaForTesting([&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult
result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
@@ -1186,7 +1186,7 @@
task->Install(
web_contents(),
- base::BindLambdaForTesting([&](base::Optional<AppId> app_id,
+ base::BindLambdaForTesting([&](absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult
result) {
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code);
diff --git a/chrome/browser/web_applications/externally_managed_app_install_task.cc b/chrome/browser/web_applications/externally_managed_app_install_task.cc
index f3b41fe..ec3063f9 100644
--- a/chrome/browser/web_applications/externally_managed_app_install_task.cc
+++ b/chrome/browser/web_applications/externally_managed_app_install_task.cc
@@ -148,7 +148,7 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
- base::BindOnce(std::move(retry_on_failure), /*app_id=*/base::nullopt,
+ base::BindOnce(std::move(retry_on_failure), /*app_id=*/absl::nullopt,
ExternallyManagedAppManager::InstallResult{.code = code}));
}
@@ -172,7 +172,7 @@
void ExternallyManagedAppInstallTask::UninstallPlaceholderApp(
content::WebContents* web_contents,
ResultCallback result_callback) {
- base::Optional<AppId> app_id =
+ absl::optional<AppId> app_id =
externally_installed_app_prefs_.LookupPlaceholderAppId(
install_options_.install_url);
@@ -200,7 +200,7 @@
LOG(ERROR) << "Failed to uninstall placeholder for: "
<< install_options_.install_url;
std::move(result_callback)
- .Run(/*app_id=*/base::nullopt,
+ .Run(/*app_id=*/absl::nullopt,
{.code = InstallResultCode::kFailedPlaceholderUninstall});
return;
}
@@ -225,7 +225,7 @@
ResultCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<AppId> app_id =
+ absl::optional<AppId> app_id =
externally_installed_app_prefs_.LookupPlaceholderAppId(
install_options_.install_url);
if (app_id.has_value() && registrar_->IsInstalled(app_id.value())) {
@@ -275,7 +275,7 @@
const AppId& app_id,
InstallResultCode code) {
if (!IsNewInstall(code)) {
- std::move(result_callback).Run(/*app_id=*/base::nullopt, {.code = code});
+ std::move(result_callback).Run(/*app_id=*/absl::nullopt, {.code = code});
return;
}
@@ -344,7 +344,7 @@
void ExternallyManagedAppInstallTask::TryAppInfoFactoryOnFailure(
ResultCallback result_callback,
- base::Optional<AppId> app_id,
+ absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
if (!IsSuccess(result.code) && install_options().app_info_factory) {
InstallFromInfo(std::move(result_callback));
diff --git a/chrome/browser/web_applications/externally_managed_app_install_task.h b/chrome/browser/web_applications/externally_managed_app_install_task.h
index 891e9dec..605f996 100644
--- a/chrome/browser/web_applications/externally_managed_app_install_task.h
+++ b/chrome/browser/web_applications/externally_managed_app_install_task.h
@@ -8,7 +8,6 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/app_registrar.h"
#include "chrome/browser/web_applications/components/external_install_options.h"
#include "chrome/browser/web_applications/components/externally_installed_web_app_prefs.h"
@@ -18,6 +17,7 @@
#include "chrome/browser/web_applications/components/web_app_install_utils.h"
#include "chrome/browser/web_applications/components/web_app_url_loader.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -39,7 +39,7 @@
class ExternallyManagedAppInstallTask {
public:
using ResultCallback = base::OnceCallback<void(
- base::Optional<AppId> app_id,
+ absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result)>;
// Ensures the tab helpers necessary for installing an app are present.
@@ -102,7 +102,7 @@
InstallResultCode code);
void TryAppInfoFactoryOnFailure(
ResultCallback result_callback,
- base::Optional<AppId> app_id,
+ absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result);
void OnOsHooksCreated(const AppId& app_id,
base::ScopedClosureRunner scoped_closure,
diff --git a/chrome/browser/web_applications/externally_managed_app_manager_impl.cc b/chrome/browser/web_applications/externally_managed_app_manager_impl.cc
index cecee746..57d6ec3 100644
--- a/chrome/browser/web_applications/externally_managed_app_manager_impl.cc
+++ b/chrome/browser/web_applications/externally_managed_app_manager_impl.cc
@@ -151,7 +151,7 @@
return;
}
- base::Optional<AppId> app_id = externally_installed_app_prefs_.LookupAppId(
+ absl::optional<AppId> app_id = externally_installed_app_prefs_.LookupAppId(
install_options.install_url);
// If the URL is not in ExternallyInstalledWebAppPrefs, then no external
@@ -256,7 +256,7 @@
}
void ExternallyManagedAppManagerImpl::OnInstalled(
- base::Optional<AppId> app_id,
+ absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result) {
if (app_id && IsSuccess(result.code)) {
MaybeEnqueueServiceWorkerRegistration(
diff --git a/chrome/browser/web_applications/externally_managed_app_manager_impl.h b/chrome/browser/web_applications/externally_managed_app_manager_impl.h
index f90abff..308e7927 100644
--- a/chrome/browser/web_applications/externally_managed_app_manager_impl.h
+++ b/chrome/browser/web_applications/externally_managed_app_manager_impl.h
@@ -12,12 +12,12 @@
#include "base/callback.h"
#include "base/containers/circular_deque.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/external_install_options.h"
#include "chrome/browser/web_applications/components/externally_installed_web_app_prefs.h"
#include "chrome/browser/web_applications/components/externally_managed_app_manager.h"
#include "chrome/browser/web_applications/components/web_app_url_loader.h"
#include "chrome/browser/web_applications/externally_managed_app_install_task.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
class Profile;
@@ -80,7 +80,7 @@
void CreateWebContentsIfNecessary();
- void OnInstalled(base::Optional<AppId> app_id,
+ void OnInstalled(absl::optional<AppId> app_id,
ExternallyManagedAppManager::InstallResult result);
void MaybeEnqueueServiceWorkerRegistration(
diff --git a/chrome/browser/web_applications/externally_managed_app_manager_impl_browsertest.cc b/chrome/browser/web_applications/externally_managed_app_manager_impl_browsertest.cc
index 286f9d0..dace874 100644
--- a/chrome/browser/web_applications/externally_managed_app_manager_impl_browsertest.cc
+++ b/chrome/browser/web_applications/externally_managed_app_manager_impl_browsertest.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "chrome/browser/profiles/profile.h"
@@ -28,6 +27,7 @@
#include "content/public/test/browser_test.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace web_app {
@@ -76,7 +76,7 @@
run_loop.Run();
}
- base::Optional<InstallResultCode> result_code_;
+ absl::optional<InstallResultCode> result_code_;
private:
ScopedOsHooksSuppress os_hooks_suppress_;
@@ -90,7 +90,7 @@
GURL url(embedded_test_server()->GetURL("/banners/manifest_test_page.html"));
InstallApp(CreateInstallOptions(url));
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result_code_.value());
- base::Optional<AppId> app_id =
+ absl::optional<AppId> app_id =
ExternallyInstalledWebAppPrefs(browser()->profile()->GetPrefs())
.LookupAppId(url);
EXPECT_TRUE(app_id.has_value());
@@ -107,14 +107,14 @@
embedded_test_server()->GetURL("/server-redirect?" + start_url.spec());
InstallApp(CreateInstallOptions(install_url));
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result_code_.value());
- base::Optional<AppId> app_id =
+ absl::optional<AppId> app_id =
ExternallyInstalledWebAppPrefs(browser()->profile()->GetPrefs())
.LookupAppId(install_url);
EXPECT_TRUE(app_id.has_value());
EXPECT_EQ("Manifest test app", registrar().GetAppShortName(app_id.value()));
// Same AppID should be in the registrar using start_url from the manifest.
EXPECT_TRUE(registrar().IsLocallyInstalled(start_url));
- base::Optional<AppId> opt_app_id =
+ absl::optional<AppId> opt_app_id =
registrar().FindAppWithUrlInScope(start_url);
EXPECT_TRUE(opt_app_id.has_value());
EXPECT_EQ(*opt_app_id, app_id);
@@ -130,7 +130,7 @@
embedded_test_server()->GetURL("/server-redirect?" + final_url.spec());
InstallApp(CreateInstallOptions(install_url));
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result_code_.value());
- base::Optional<AppId> app_id =
+ absl::optional<AppId> app_id =
ExternallyInstalledWebAppPrefs(browser()->profile()->GetPrefs())
.LookupAppId(install_url);
EXPECT_TRUE(app_id.has_value());
@@ -138,7 +138,7 @@
registrar().GetAppShortName(app_id.value()));
// Same AppID should be in the registrar using install_url.
EXPECT_TRUE(registrar().IsLocallyInstalled(install_url));
- base::Optional<AppId> opt_app_id =
+ absl::optional<AppId> opt_app_id =
registrar().FindAppWithUrlInScope(install_url);
ASSERT_TRUE(opt_app_id.has_value());
EXPECT_EQ(*opt_app_id, app_id);
@@ -163,7 +163,7 @@
InstallApp(options);
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result_code_.value());
- base::Optional<AppId> app_id =
+ absl::optional<AppId> app_id =
ExternallyInstalledWebAppPrefs(browser()->profile()->GetPrefs())
.LookupAppId(url);
ASSERT_TRUE(app_id.has_value());
@@ -197,7 +197,7 @@
ExternalInstallOptions install_options = CreateInstallOptions(url);
install_options.bypass_service_worker_check = true;
InstallApp(std::move(install_options));
- base::Optional<AppId> app_id = registrar().FindAppWithUrlInScope(url);
+ absl::optional<AppId> app_id = registrar().FindAppWithUrlInScope(url);
EXPECT_TRUE(app_id.has_value());
EXPECT_TRUE(registrar().GetAppScopeInternal(*app_id).has_value());
EXPECT_EQ("Manifest test app", registrar().GetAppShortName(*app_id));
@@ -210,7 +210,7 @@
"/banners/manifest_no_service_worker.html"));
ExternalInstallOptions install_options = CreateInstallOptions(url);
InstallApp(std::move(install_options));
- base::Optional<AppId> app_id = registrar().FindAppWithUrlInScope(url);
+ absl::optional<AppId> app_id = registrar().FindAppWithUrlInScope(url);
EXPECT_TRUE(app_id.has_value());
EXPECT_TRUE(registrar().GetAppScopeInternal(app_id.value()).has_value());
}
@@ -226,7 +226,7 @@
install_options.force_reinstall = true;
InstallApp(std::move(install_options));
- base::Optional<AppId> app_id = registrar().FindAppWithUrlInScope(url);
+ absl::optional<AppId> app_id = registrar().FindAppWithUrlInScope(url);
EXPECT_TRUE(app_id.has_value());
EXPECT_EQ("Manifest", registrar().GetAppShortName(app_id.value()));
}
@@ -237,7 +237,7 @@
install_options.force_reinstall = true;
InstallApp(std::move(install_options));
- base::Optional<AppId> app_id = registrar().FindAppWithUrlInScope(url);
+ absl::optional<AppId> app_id = registrar().FindAppWithUrlInScope(url);
EXPECT_TRUE(app_id.has_value());
EXPECT_EQ("Manifest test app", registrar().GetAppShortName(app_id.value()));
}
@@ -252,7 +252,7 @@
"/banners/manifest_test_page.html?manifest=manifest_chrome_url.json"));
InstallApp(CreateInstallOptions(url));
EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result_code_.value());
- base::Optional<AppId> app_id =
+ absl::optional<AppId> app_id =
ExternallyInstalledWebAppPrefs(browser()->profile()->GetPrefs())
.LookupAppId(url);
ASSERT_TRUE(app_id.has_value());
@@ -276,7 +276,7 @@
EXPECT_EQ(InstallResultCode::kNotValidManifestForWebApp,
result_code_.value());
- base::Optional<AppId> id =
+ absl::optional<AppId> id =
ExternallyInstalledWebAppPrefs(browser()->profile()->GetPrefs())
.LookupAppId(url);
ASSERT_FALSE(id.has_value());
@@ -420,7 +420,7 @@
}));
run_loop.Run();
- base::Optional<AppId> app_id = registrar().FindAppWithUrlInScope(app_url);
+ absl::optional<AppId> app_id = registrar().FindAppWithUrlInScope(app_url);
DCHECK(app_id.has_value());
EXPECT_EQ(registrar().GetAppDisplayMode(*app_id), DisplayMode::kBrowser);
EXPECT_EQ(registrar().GetAppUserDisplayMode(*app_id),
diff --git a/chrome/browser/web_applications/externally_managed_app_manager_impl_unittest.cc b/chrome/browser/web_applications/externally_managed_app_manager_impl_unittest.cc
index 166aa110..7df023b 100644
--- a/chrome/browser/web_applications/externally_managed_app_manager_impl_unittest.cc
+++ b/chrome/browser/web_applications/externally_managed_app_manager_impl_unittest.cc
@@ -14,7 +14,6 @@
#include "base/callback.h"
#include "base/containers/contains.h"
#include "base/one_shot_event.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
@@ -35,6 +34,7 @@
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/url_constants.h"
namespace web_app {
@@ -57,8 +57,8 @@
}
ExternalInstallOptions GetFooInstallOptions(
- base::Optional<bool> override_previous_user_uninstall =
- base::Optional<bool>()) {
+ absl::optional<bool> override_previous_user_uninstall =
+ absl::optional<bool>()) {
ExternalInstallOptions options(FooWebAppUrl(), DisplayMode::kBrowser,
ExternalInstallSource::kExternalPolicy);
@@ -91,8 +91,8 @@
}
ExternalInstallOptions GetFooInstallOptionsWithWebAppInfo(
- base::Optional<bool> override_previous_user_uninstall =
- base::Optional<bool>()) {
+ absl::optional<bool> override_previous_user_uninstall =
+ absl::optional<bool>()) {
ExternalInstallOptions options(FooWebAppUrl(), DisplayMode::kBrowser,
ExternalInstallSource::kExternalPolicy);
options.only_use_app_info_factory = true;
@@ -209,7 +209,7 @@
if (!preempt_registration_callback_)
return false;
- base::Optional<base::OnceClosure> callback;
+ absl::optional<base::OnceClosure> callback;
preempt_registration_callback_.swap(callback);
std::move(*callback).Run();
return true;
@@ -315,7 +315,7 @@
auto result =
externally_managed_app_manager_impl_->GetNextInstallationTaskResult(
install_url);
- base::Optional<AppId> app_id;
+ absl::optional<AppId> app_id;
if (result.code == InstallResultCode::kSuccessNewInstall) {
app_id = GenerateFakeAppId(install_url);
GURL launch_url =
@@ -399,7 +399,7 @@
std::map<GURL, TestTaskResult> next_installation_task_results_;
std::map<GURL, GURL> next_installation_launch_urls_;
- base::Optional<base::OnceClosure> preempt_registration_callback_;
+ absl::optional<base::OnceClosure> preempt_registration_callback_;
base::OneShotEvent web_contents_released_event_;
};
@@ -450,8 +450,8 @@
ExternalInstallOptions install_options) {
base::RunLoop run_loop;
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
externally_managed_app_manager_impl()->Install(
std::move(install_options),
@@ -575,8 +575,8 @@
externally_managed_app_manager_impl()->SetNextInstallationLaunchURL(
FooWebAppUrl());
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(externally_managed_app_manager_impl(),
GetFooInstallOptions());
@@ -599,8 +599,8 @@
externally_managed_app_manager_impl()->SetNextInstallationLaunchURL(
FooWebAppUrl());
{
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(externally_managed_app_manager_impl(),
GetFooInstallOptions());
@@ -620,8 +620,8 @@
externally_managed_app_manager_impl()->SetNextInstallationLaunchURL(
BarWebAppUrl());
{
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(externally_managed_app_manager_impl(),
GetBarInstallOptions());
@@ -911,8 +911,8 @@
externally_managed_app_manager_impl()->SetNextInstallationTaskResult(
FooWebAppUrl(), InstallResultCode::kSuccessNewInstall);
{
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(externally_managed_app_manager_impl(),
GetFooInstallOptions());
@@ -924,8 +924,8 @@
}
{
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(externally_managed_app_manager_impl(),
GetFooInstallOptions());
@@ -993,8 +993,8 @@
};
{
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(externally_managed_app_manager_impl(),
get_force_reinstall_info());
@@ -1008,8 +1008,8 @@
externally_managed_app_manager_impl()->SetNextInstallationTaskResult(
FooWebAppUrl(), InstallResultCode::kSuccessNewInstall);
{
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(externally_managed_app_manager_impl(),
get_force_reinstall_info());
@@ -1026,8 +1026,8 @@
externally_managed_app_manager_impl()->SetNextInstallationTaskResult(
FooWebAppUrl(), InstallResultCode::kWebAppDisabled);
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(externally_managed_app_manager_impl(),
GetFooInstallOptions());
@@ -1045,8 +1045,8 @@
auto install_options = GetFooInstallOptions();
install_options.install_placeholder = true;
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) =
InstallAndWait(externally_managed_app_manager_impl(), install_options);
@@ -1314,8 +1314,8 @@
externally_managed_app_manager_impl()->SetNextInstallationTaskResult(
FooWebAppUrl(), InstallResultCode::kSuccessNewInstall);
{
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(externally_managed_app_manager_impl(),
GetFooInstallOptions());
@@ -1331,8 +1331,8 @@
externally_managed_app_manager_impl()->SetNextInstallationTaskResult(
FooWebAppUrl(), InstallResultCode::kSuccessNewInstall);
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(externally_managed_app_manager_impl(),
GetFooInstallOptions());
@@ -1346,8 +1346,8 @@
externally_managed_app_manager_impl()->SetNextInstallationTaskResult(
FooWebAppUrl(), InstallResultCode::kSuccessNewInstall);
{
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(externally_managed_app_manager_impl(),
GetFooInstallOptions());
@@ -1365,8 +1365,8 @@
// or fail depending on whether we set override_previous_user_uninstall. We
// try with override_previous_user_uninstall false first, true second.
{
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(
externally_managed_app_manager_impl(),
GetFooInstallOptions(false /* override_previous_user_uninstall */));
@@ -1381,8 +1381,8 @@
externally_managed_app_manager_impl()->SetNextInstallationTaskResult(
FooWebAppUrl(), InstallResultCode::kSuccessNewInstall);
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) = InstallAndWait(
externally_managed_app_manager_impl(),
GetFooInstallOptions(true /* override_previous_user_uninstall */));
@@ -1483,8 +1483,8 @@
externally_managed_app_manager_impl()->SetNextInstallationTaskResult(
FooWebAppUrl(), InstallResultCode::kSuccessNewInstall,
/*did_install_placeholder=*/true);
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) =
InstallAndWait(externally_managed_app_manager_impl(), install_options);
ASSERT_EQ(InstallResultCode::kSuccessNewInstall, code.value());
@@ -1500,8 +1500,8 @@
install_finalizer()->SetNextUninstallExternalWebAppResult(FooWebAppUrl(),
true);
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) =
InstallAndWait(externally_managed_app_manager_impl(), install_options);
@@ -1522,8 +1522,8 @@
externally_managed_app_manager_impl()->SetNextInstallationTaskResult(
FooWebAppUrl(), InstallResultCode::kSuccessNewInstall,
/*did_install_placeholder=*/true);
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) =
InstallAndWait(externally_managed_app_manager_impl(), install_options);
ASSERT_EQ(InstallResultCode::kSuccessNewInstall, code.value());
@@ -1537,8 +1537,8 @@
FooWebAppUrl(), InstallResultCode::kSuccessNewInstall,
/*did_install_placeholder=*/true);
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) =
InstallAndWait(externally_managed_app_manager_impl(), install_options);
@@ -1562,8 +1562,8 @@
externally_managed_app_manager_impl()->SetNextInstallationTaskResult(
FooWebAppUrl(), InstallResultCode::kSuccessNewInstall,
/*did_install_placeholder=*/true);
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) =
InstallAndWait(externally_managed_app_manager_impl(), install_options);
ASSERT_EQ(InstallResultCode::kSuccessNewInstall, code.value());
@@ -1579,8 +1579,8 @@
/*did_install_placeholder=*/false);
ui_manager()->SetNumWindowsForApp(GenerateFakeAppId(FooWebAppUrl()), 0);
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) =
InstallAndWait(externally_managed_app_manager_impl(), install_options);
@@ -1601,8 +1601,8 @@
externally_managed_app_manager_impl()->SetNextInstallationTaskResult(
FooWebAppUrl(), InstallResultCode::kSuccessNewInstall,
/*did_install_placeholder=*/true);
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) =
InstallAndWait(externally_managed_app_manager_impl(), install_options);
ASSERT_EQ(InstallResultCode::kSuccessNewInstall, code.value());
@@ -1620,8 +1620,8 @@
install_finalizer()->SetNextUninstallExternalWebAppResult(FooWebAppUrl(),
true);
- base::Optional<GURL> url;
- base::Optional<InstallResultCode> code;
+ absl::optional<GURL> url;
+ absl::optional<InstallResultCode> code;
std::tie(url, code) =
InstallAndWait(externally_managed_app_manager_impl(), install_options);
diff --git a/chrome/browser/web_applications/manifest_update_manager.cc b/chrome/browser/web_applications/manifest_update_manager.cc
index 43edfe8..5c277f5 100644
--- a/chrome/browser/web_applications/manifest_update_manager.cc
+++ b/chrome/browser/web_applications/manifest_update_manager.cc
@@ -97,7 +97,7 @@
}
bool ManifestUpdateManager::IsUpdateConsumed(const AppId& app_id) {
- base::Optional<base::Time> last_check_time = GetLastUpdateCheckTime(app_id);
+ absl::optional<base::Time> last_check_time = GetLastUpdateCheckTime(app_id);
base::Time now = time_override_for_testing_.value_or(base::Time::Now());
if (last_check_time.has_value() &&
now < *last_check_time + kDelayBetweenChecks &&
@@ -134,11 +134,11 @@
return true;
}
-base::Optional<base::Time> ManifestUpdateManager::GetLastUpdateCheckTime(
+absl::optional<base::Time> ManifestUpdateManager::GetLastUpdateCheckTime(
const AppId& app_id) const {
auto it = last_update_check_.find(app_id);
- return it != last_update_check_.end() ? base::Optional<base::Time>(it->second)
- : base::nullopt;
+ return it != last_update_check_.end() ? absl::optional<base::Time>(it->second)
+ : absl::nullopt;
}
void ManifestUpdateManager::SetLastUpdateCheckTime(const GURL& origin,
diff --git a/chrome/browser/web_applications/manifest_update_manager.h b/chrome/browser/web_applications/manifest_update_manager.h
index d07e49cc..4d223aa 100644
--- a/chrome/browser/web_applications/manifest_update_manager.h
+++ b/chrome/browser/web_applications/manifest_update_manager.h
@@ -9,13 +9,13 @@
#include "base/callback.h"
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "chrome/browser/web_applications/components/app_registrar.h"
#include "chrome/browser/web_applications/components/app_registrar_observer.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/manifest_update_task.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -75,7 +75,7 @@
private:
bool MaybeConsumeUpdateCheck(const GURL& origin, const AppId& app_id);
- base::Optional<base::Time> GetLastUpdateCheckTime(const AppId& app_id) const;
+ absl::optional<base::Time> GetLastUpdateCheckTime(const AppId& app_id) const;
void SetLastUpdateCheckTime(const GURL& origin,
const AppId& app_id,
base::Time time);
@@ -99,7 +99,7 @@
base::flat_map<AppId, base::Time> last_update_check_;
- base::Optional<base::Time> time_override_for_testing_;
+ absl::optional<base::Time> time_override_for_testing_;
ResultCallback result_callback_for_testing_;
bool started_ = false;
diff --git a/chrome/browser/web_applications/manifest_update_manager_browsertest.cc b/chrome/browser/web_applications/manifest_update_manager_browsertest.cc
index 0d369f1..e2be88c 100644
--- a/chrome/browser/web_applications/manifest_update_manager_browsertest.cc
+++ b/chrome/browser/web_applications/manifest_update_manager_browsertest.cc
@@ -192,7 +192,7 @@
Browser* browser_ = nullptr;
const GURL& url_;
base::RunLoop run_loop_;
- base::Optional<ManifestUpdateResult> result_;
+ absl::optional<ManifestUpdateResult> result_;
};
} // namespace
@@ -366,8 +366,8 @@
net::EmbeddedTestServer http_server_;
private:
- base::Optional<base::RunLoop> shortcut_run_loop_;
- base::Optional<SkColor> updated_shortcut_top_left_color_;
+ absl::optional<base::RunLoop> shortcut_run_loop_;
+ absl::optional<SkColor> updated_shortcut_top_left_color_;
ScopedOsHooksSuppress os_hooks_suppress_;
};
diff --git a/chrome/browser/web_applications/manifest_update_task.h b/chrome/browser/web_applications/manifest_update_task.h
index fd6a93cc..cd65afb5 100644
--- a/chrome/browser/web_applications/manifest_update_task.h
+++ b/chrome/browser/web_applications/manifest_update_task.h
@@ -9,7 +9,6 @@
#include "base/check_op.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/app_icon_manager.h"
#include "chrome/browser/web_applications/components/web_app_icon_downloader.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
@@ -17,6 +16,7 @@
#include "components/content_settings/core/common/content_settings.h"
#include "components/services/app_service/public/cpp/file_handler.h"
#include "content/public/browser/web_contents_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/manifest/manifest.h"
struct WebApplicationInfo;
@@ -146,8 +146,8 @@
OsIntegrationManager& os_integration_manager_;
Stage stage_;
- base::Optional<WebApplicationInfo> web_application_info_;
- base::Optional<WebAppIconDownloader> icon_downloader_;
+ absl::optional<WebApplicationInfo> web_application_info_;
+ absl::optional<WebAppIconDownloader> icon_downloader_;
const GURL url_;
const AppId app_id_;
diff --git a/chrome/browser/web_applications/policy/web_app_policy_manager.cc b/chrome/browser/web_applications/policy/web_app_policy_manager.cc
index 450ba18..e84b91a 100644
--- a/chrome/browser/web_applications/policy/web_app_policy_manager.cc
+++ b/chrome/browser/web_applications/policy/web_app_policy_manager.cc
@@ -337,7 +337,7 @@
}
RunOnOsLoginPolicy WebAppPolicyManager::GetUrlRunOnOsLoginPolicy(
- base::Optional<GURL> url) const {
+ absl::optional<GURL> url) const {
if (url) {
auto it = settings_by_url_.find(url.value());
if (it != settings_by_url_.end())
@@ -470,7 +470,7 @@
}
for (const auto& app_type : disabled_system_apps_) {
- base::Optional<AppId> app_id =
+ absl::optional<AppId> app_id =
web_app_manager_->GetAppIdForSystemApp(app_type);
if (app_id.has_value()) {
disabled_web_apps_.insert(app_id.value());
diff --git a/chrome/browser/web_applications/policy/web_app_policy_manager.h b/chrome/browser/web_applications/policy/web_app_policy_manager.h
index 1a60f3c6..9437707 100644
--- a/chrome/browser/web_applications/policy/web_app_policy_manager.h
+++ b/chrome/browser/web_applications/policy/web_app_policy_manager.h
@@ -75,7 +75,7 @@
// Checks if UI mode of disabled web apps is hidden.
bool IsDisabledAppsModeHidden() const;
- RunOnOsLoginPolicy GetUrlRunOnOsLoginPolicy(base::Optional<GURL> url) const;
+ RunOnOsLoginPolicy GetUrlRunOnOsLoginPolicy(absl::optional<GURL> url) const;
void AddObserver(WebAppPolicyManagerObserver* observer);
void RemoveObserver(WebAppPolicyManagerObserver* observer);
diff --git a/chrome/browser/web_applications/preinstalled_web_app_manager.cc b/chrome/browser/web_applications/preinstalled_web_app_manager.cc
index 208a2c6..46bfe0d 100644
--- a/chrome/browser/web_applications/preinstalled_web_app_manager.cc
+++ b/chrome/browser/web_applications/preinstalled_web_app_manager.cc
@@ -146,7 +146,7 @@
return result;
}
-base::Optional<std::string> GetDisableReason(
+absl::optional<std::string> GetDisableReason(
const ExternalInstallOptions& options,
Profile* profile,
bool preinstalled_apps_enabled_in_prefs,
@@ -208,7 +208,7 @@
// Keep if any apps to replace are installed.
for (const AppId& app_id : options.uninstall_and_replace) {
if (extensions::IsExtensionInstalled(profile, app_id)) {
- return base::nullopt;
+ return absl::nullopt;
}
}
@@ -250,7 +250,7 @@
}
}
- return base::nullopt;
+ return absl::nullopt;
}
std::string GetExtraConfigSubdirectory() {
@@ -450,7 +450,7 @@
size_t disabled_count = 0;
base::EraseIf(parsed_configs.options_list,
[&](const ExternalInstallOptions& options) {
- base::Optional<std::string> disable_reason = GetDisableReason(
+ absl::optional<std::string> disable_reason = GetDisableReason(
options, profile_, preinstalled_apps_enabled_in_prefs,
is_new_user, user_type);
if (disable_reason) {
diff --git a/chrome/browser/web_applications/preinstalled_web_app_manager_browsertest.cc b/chrome/browser/web_applications/preinstalled_web_app_manager_browsertest.cc
index caa3e38..b25b38f 100644
--- a/chrome/browser/web_applications/preinstalled_web_app_manager_browsertest.cc
+++ b/chrome/browser/web_applications/preinstalled_web_app_manager_browsertest.cc
@@ -81,7 +81,7 @@
}
// Mocks "icon.png" as available in the config's directory.
- base::Optional<InstallResultCode> SyncPreinstalledAppConfig(
+ absl::optional<InstallResultCode> SyncPreinstalledAppConfig(
const GURL& install_url,
base::StringPiece app_config_string) {
base::FilePath test_config_dir(FILE_PATH_LITERAL("test_dir"));
@@ -103,11 +103,11 @@
EXPECT_TRUE(json_parse_result.value)
<< "JSON parse error: " << json_parse_result.error_message;
if (!json_parse_result.value)
- return base::nullopt;
+ return absl::nullopt;
app_configs.push_back(*std::move(json_parse_result.value));
PreinstalledWebAppManager::SetConfigsForTesting(&app_configs);
- base::Optional<InstallResultCode> code;
+ absl::optional<InstallResultCode> code;
base::RunLoop sync_run_loop;
WebAppProvider::Get(browser()->profile())
->preinstalled_web_app_manager()
@@ -345,7 +345,7 @@
})";
std::string app_config = base::ReplaceStringPlaceholders(
kAppConfigTemplate, {GetAppUrl().spec()}, nullptr);
- EXPECT_EQ(SyncPreinstalledAppConfig(GetAppUrl(), app_config), base::nullopt);
+ EXPECT_EQ(SyncPreinstalledAppConfig(GetAppUrl(), app_config), absl::nullopt);
}
// The offline manifest JSON config functionality is only available on Chrome
@@ -605,7 +605,7 @@
// previous PRE_ launch and sync.
EXPECT_EQ(SyncPreinstalledAppConfig(GURL(kOnlyForNewUsersInstallUrl),
kOnlyForNewUsersConfig),
- base::nullopt);
+ absl::nullopt);
}
IN_PROC_BROWSER_TEST_F(PreinstalledWebAppManagerBrowserTest, OemInstalled) {
diff --git a/chrome/browser/web_applications/preinstalled_web_app_migration_browsertest.cc b/chrome/browser/web_applications/preinstalled_web_app_migration_browsertest.cc
index 66e359f..c0d909f 100644
--- a/chrome/browser/web_applications/preinstalled_web_app_migration_browsertest.cc
+++ b/chrome/browser/web_applications/preinstalled_web_app_migration_browsertest.cc
@@ -172,7 +172,7 @@
bool pass_config = true) {
base::RunLoop run_loop;
- base::Optional<InstallResultCode> code;
+ absl::optional<InstallResultCode> code;
auto callback = base::BindLambdaForTesting(
[&](std::map<GURL, ExternallyManagedAppManager::InstallResult>
@@ -231,7 +231,7 @@
private:
base::test::ScopedFeatureList features_;
- base::Optional<base::AutoReset<bool>> disable_external_extensions_scope_;
+ absl::optional<base::AutoReset<bool>> disable_external_extensions_scope_;
std::unique_ptr<extensions::ExtensionCacheFake> test_extension_cache_;
ScopedOsHooksSuppress os_hooks_suppress_;
};
diff --git a/chrome/browser/web_applications/preinstalled_web_app_utils.h b/chrome/browser/web_applications/preinstalled_web_app_utils.h
index f6a726e..c82edbf 100644
--- a/chrome/browser/web_applications/preinstalled_web_app_utils.h
+++ b/chrome/browser/web_applications/preinstalled_web_app_utils.h
@@ -7,9 +7,9 @@
#include <string>
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "chrome/browser/web_applications/components/external_install_options.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace base {
diff --git a/chrome/browser/web_applications/preinstalled_web_app_utils_unittest.cc b/chrome/browser/web_applications/preinstalled_web_app_utils_unittest.cc
index 1050484e..ffcfdab 100644
--- a/chrome/browser/web_applications/preinstalled_web_app_utils_unittest.cc
+++ b/chrome/browser/web_applications/preinstalled_web_app_utils_unittest.cc
@@ -40,9 +40,9 @@
});
}
- base::Optional<ExternalInstallOptions> ParseConfig(
+ absl::optional<ExternalInstallOptions> ParseConfig(
const char* app_config_string) {
- base::Optional<base::Value> app_config =
+ absl::optional<base::Value> app_config =
base::JSONReader::Read(app_config_string);
DCHECK(app_config);
FileUtilsWrapper file_utils;
@@ -53,12 +53,12 @@
absl::get_if<ExternalInstallOptions>(&result)) {
return std::move(*options);
}
- return base::nullopt;
+ return absl::nullopt;
}
- base::Optional<WebApplicationInfoFactory> ParseOfflineManifest(
+ absl::optional<WebApplicationInfoFactory> ParseOfflineManifest(
const char* offline_manifest_string) {
- base::Optional<base::Value> offline_manifest =
+ absl::optional<base::Value> offline_manifest =
base::JSONReader::Read(offline_manifest_string);
DCHECK(offline_manifest);
WebApplicationInfoFactoryOrError result = ::web_app::ParseOfflineManifest(
@@ -69,7 +69,7 @@
absl::get_if<WebApplicationInfoFactory>(&result)) {
return std::move(*factory);
}
- return base::nullopt;
+ return absl::nullopt;
}
protected:
@@ -108,7 +108,7 @@
};
TEST_P(PreinstalledWebAppUtilsTabletTest, DisableIfTabletFormFactor) {
- base::Optional<ExternalInstallOptions> disable_true_options = ParseConfig(R"(
+ absl::optional<ExternalInstallOptions> disable_true_options = ParseConfig(R"(
{
"app_url": "https://test.org",
"launch_container": "window",
@@ -118,7 +118,7 @@
)");
EXPECT_TRUE(disable_true_options->disable_if_tablet_form_factor);
- base::Optional<ExternalInstallOptions> disable_false_options = ParseConfig(R"(
+ absl::optional<ExternalInstallOptions> disable_false_options = ParseConfig(R"(
{
"app_url": "https://test.org",
"launch_container": "window",
@@ -150,7 +150,7 @@
};
TEST_P(PreinstalledWebAppUtilsArcTest, DisableIfArcSupported) {
- base::Optional<ExternalInstallOptions> disable_true_options = ParseConfig(R"(
+ absl::optional<ExternalInstallOptions> disable_true_options = ParseConfig(R"(
{
"app_url": "https://test.org",
"launch_container": "window",
@@ -160,7 +160,7 @@
)");
EXPECT_TRUE(disable_true_options->disable_if_arc_supported);
- base::Optional<ExternalInstallOptions> disable_false_options = ParseConfig(R"(
+ absl::optional<ExternalInstallOptions> disable_false_options = ParseConfig(R"(
{
"app_url": "https://test.org",
"launch_container": "window",
@@ -445,7 +445,7 @@
}
TEST_F(PreinstalledWebAppUtilsTest, ForceReinstallForMilestone) {
- base::Optional<ExternalInstallOptions> non_number = ParseConfig(R"(
+ absl::optional<ExternalInstallOptions> non_number = ParseConfig(R"(
{
"app_url": "https://test.org",
"launch_container": "window",
@@ -455,7 +455,7 @@
)");
EXPECT_FALSE(non_number.has_value());
- base::Optional<ExternalInstallOptions> number = ParseConfig(R"(
+ absl::optional<ExternalInstallOptions> number = ParseConfig(R"(
{
"app_url": "https://test.org",
"launch_container": "window",
@@ -492,7 +492,7 @@
}
TEST_F(PreinstalledWebAppUtilsTest, OemInstalled) {
- base::Optional<ExternalInstallOptions> non_bool = ParseConfig(R"(
+ absl::optional<ExternalInstallOptions> non_bool = ParseConfig(R"(
{
"app_url": "https://www.test.org",
"launch_container": "window",
@@ -502,7 +502,7 @@
)");
EXPECT_FALSE(non_bool.has_value());
- base::Optional<ExternalInstallOptions> no_oem = ParseConfig(R"(
+ absl::optional<ExternalInstallOptions> no_oem = ParseConfig(R"(
{
"app_url": "https://www.test.org",
"launch_container": "window",
@@ -511,7 +511,7 @@
)");
EXPECT_FALSE(no_oem->oem_installed);
- base::Optional<ExternalInstallOptions> oem_set = ParseConfig(R"(
+ absl::optional<ExternalInstallOptions> oem_set = ParseConfig(R"(
{
"app_url": "https://www.test.org",
"launch_container": "window",
diff --git a/chrome/browser/web_applications/system_web_apps/system_web_app_background_task.cc b/chrome/browser/web_applications/system_web_apps/system_web_app_background_task.cc
index c04e0c6..0c7df0b 100644
--- a/chrome/browser/web_applications/system_web_apps/system_web_app_background_task.cc
+++ b/chrome/browser/web_applications/system_web_apps/system_web_app_background_task.cc
@@ -22,7 +22,7 @@
const SystemAppBackgroundTaskInfo& other) = default;
SystemAppBackgroundTaskInfo::SystemAppBackgroundTaskInfo(
- const base::Optional<base::TimeDelta>& period,
+ const absl::optional<base::TimeDelta>& period,
const GURL& url,
bool open_immediately)
: period(period), url(url), open_immediately(open_immediately) {}
diff --git a/chrome/browser/web_applications/system_web_apps/system_web_app_background_task.h b/chrome/browser/web_applications/system_web_apps/system_web_app_background_task.h
index 7eca838c..18a7332 100644
--- a/chrome/browser/web_applications/system_web_apps/system_web_app_background_task.h
+++ b/chrome/browser/web_applications/system_web_apps/system_web_app_background_task.h
@@ -11,7 +11,6 @@
#include "base/memory/weak_ptr.h"
#include "base/one_shot_event.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/profiles/profile.h"
@@ -21,6 +20,7 @@
#include "components/prefs/pref_change_registrar.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -30,7 +30,7 @@
struct SystemAppBackgroundTaskInfo {
SystemAppBackgroundTaskInfo();
SystemAppBackgroundTaskInfo(const SystemAppBackgroundTaskInfo& other);
- SystemAppBackgroundTaskInfo(const base::Optional<base::TimeDelta>& period,
+ SystemAppBackgroundTaskInfo(const absl::optional<base::TimeDelta>& period,
const GURL& url,
bool open_immediately = false);
~SystemAppBackgroundTaskInfo();
@@ -39,7 +39,7 @@
// previous task is still running, it will be closed.
// You should have at least one of period or open_immediately set for the task
// to do anything.
- base::Optional<base::TimeDelta> period;
+ absl::optional<base::TimeDelta> period;
// The url of the background page to open. This should do one specific thing.
// (Probably opening a shared worker, waiting for a response, and closing)
@@ -98,7 +98,7 @@
return web_contents_.get();
}
- base::Optional<base::TimeDelta> period_for_testing() const { return period_; }
+ absl::optional<base::TimeDelta> period_for_testing() const { return period_; }
unsigned long opened_count_for_testing() const { return opened_count_; }
@@ -149,7 +149,7 @@
std::unique_ptr<base::OneShotTimer> timer_;
TimerState state_;
GURL url_;
- base::Optional<base::TimeDelta> period_;
+ absl::optional<base::TimeDelta> period_;
unsigned long opened_count_;
unsigned long timer_activated_count_;
bool open_immediately_;
diff --git a/chrome/browser/web_applications/system_web_apps/system_web_app_manager.cc b/chrome/browser/web_applications/system_web_apps/system_web_app_manager.cc
index fd37958..6a333cd 100644
--- a/chrome/browser/web_applications/system_web_apps/system_web_app_manager.cc
+++ b/chrome/browser/web_applications/system_web_apps/system_web_app_manager.cc
@@ -16,11 +16,11 @@
#include "base/containers/contains.h"
#include "base/metrics/histogram_functions.h"
#include "base/one_shot_event.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/version.h"
#include "build/chromeos_buildflags.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(b/174811949): Hide behind ChromeOS build flag.
#include "chrome/browser/ash/web_applications/chrome_camera_app_ui_constants.h"
#include "chrome/browser/browser_process.h"
@@ -207,7 +207,7 @@
if (base::FeatureList::IsEnabled(
chromeos::features::kHelpAppLauncherSearch)) {
infos.at(SystemAppType::HELP).timer_info = SystemAppBackgroundTaskInfo(
- base::nullopt, GURL("chrome://help-app/background"),
+ absl::nullopt, GURL("chrome://help-app/background"),
/*open_immediately=*/true);
}
}
@@ -597,27 +597,27 @@
return system_app_infos_;
}
-base::Optional<AppId> SystemWebAppManager::GetAppIdForSystemApp(
+absl::optional<AppId> SystemWebAppManager::GetAppIdForSystemApp(
SystemAppType id) const {
auto app_url_it = system_app_infos_.find(id);
if (app_url_it == system_app_infos_.end())
- return base::Optional<AppId>();
+ return absl::optional<AppId>();
return registrar_->LookupExternalAppId(app_url_it->second.install_url);
}
-base::Optional<SystemAppType> SystemWebAppManager::GetSystemAppTypeForAppId(
+absl::optional<SystemAppType> SystemWebAppManager::GetSystemAppTypeForAppId(
AppId app_id) const {
WebAppRegistrar* web_registrar = registrar_->AsWebAppRegistrar();
if (!web_registrar) {
- return base::nullopt;
+ return absl::nullopt;
}
const WebApp* web_app = web_registrar->GetAppById(app_id);
if (!web_app || !web_app->client_data().system_web_app_data.has_value()) {
- return base::nullopt;
+ return absl::nullopt;
}
// The registered system apps can change from previous runs (e.g. flipping a
@@ -632,13 +632,13 @@
return proto_type;
}
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<AppId> SystemWebAppManager::GetAppIds() const {
std::vector<AppId> app_ids;
for (const auto& app_type_to_app_info : system_app_infos_) {
- base::Optional<AppId> app_id =
+ absl::optional<AppId> app_id =
GetAppIdForSystemApp(app_type_to_app_info.first);
if (app_id.has_value()) {
app_ids.push_back(app_id.value());
@@ -693,7 +693,7 @@
if (navigation_handle->IsSameDocument())
return;
- const base::Optional<SystemAppType> type = GetSystemAppTypeForAppId(app_id);
+ const absl::optional<SystemAppType> type = GetSystemAppTypeForAppId(app_id);
// This function should only be called when an navigation happens inside a
// System App. So the |app_id| should always have a valid associated System
// App type.
@@ -775,30 +775,30 @@
return it->second.has_tab_strip;
}
-base::Optional<SystemAppType> SystemWebAppManager::GetCapturingSystemAppForURL(
+absl::optional<SystemAppType> SystemWebAppManager::GetCapturingSystemAppForURL(
const GURL& url) const {
if (!HasSystemWebAppScheme(url))
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<AppId> app_id = registrar_->FindAppWithUrlInScope(url);
+ absl::optional<AppId> app_id = registrar_->FindAppWithUrlInScope(url);
if (!app_id.has_value())
- return base::nullopt;
+ return absl::nullopt;
- base::Optional<SystemAppType> type = GetSystemAppTypeForAppId(app_id.value());
+ absl::optional<SystemAppType> type = GetSystemAppTypeForAppId(app_id.value());
if (!type.has_value())
- return base::nullopt;
+ return absl::nullopt;
const auto it = system_app_infos_.find(type);
if (it == system_app_infos_.end())
- return base::nullopt;
+ return absl::nullopt;
if (!it->second.capture_navigations)
- return base::nullopt;
+ return absl::nullopt;
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (type == SystemAppType::CAMERA &&
url.spec() != chromeos::kChromeUICameraAppMainURL)
- return base::nullopt;
+ return absl::nullopt;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
return type;
@@ -816,7 +816,7 @@
}
gfx::Size SystemWebAppManager::GetMinimumWindowSize(const AppId& app_id) const {
- base::Optional<SystemAppType> app_type = GetSystemAppTypeForAppId(app_id);
+ absl::optional<SystemAppType> app_type = GetSystemAppTypeForAppId(app_id);
if (!app_type.has_value())
return gfx::Size();
@@ -935,7 +935,7 @@
// Web Apps, does not run when for apps installed in the background.
for (const auto& it : system_app_infos_) {
const SystemAppType& type = it.first;
- base::Optional<AppId> app_id = GetAppIdForSystemApp(type);
+ absl::optional<AppId> app_id = GetAppIdForSystemApp(type);
if (!app_id)
continue;
diff --git a/chrome/browser/web_applications/system_web_apps/system_web_app_manager.h b/chrome/browser/web_applications/system_web_apps/system_web_app_manager.h
index d54f18b..a640f9573 100644
--- a/chrome/browser/web_applications/system_web_apps/system_web_app_manager.h
+++ b/chrome/browser/web_applications/system_web_apps/system_web_app_manager.h
@@ -135,7 +135,7 @@
WebApplicationInfoFactory app_info_factory;
// Setup information to drive a background task.
- base::Optional<SystemAppBackgroundTaskInfo> timer_info;
+ absl::optional<SystemAppBackgroundTaskInfo> timer_info;
};
// Installs, uninstalls, and updates System Web Apps.
@@ -188,10 +188,10 @@
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
// Returns the app id for the given System App |type|.
- base::Optional<AppId> GetAppIdForSystemApp(SystemAppType type) const;
+ absl::optional<AppId> GetAppIdForSystemApp(SystemAppType type) const;
// Returns the System App Type for the given |app_id|.
- base::Optional<SystemAppType> GetSystemAppTypeForAppId(AppId app_id) const;
+ absl::optional<SystemAppType> GetSystemAppTypeForAppId(AppId app_id) const;
// Returns the App Ids for all installed System Web Apps.
std::vector<AppId> GetAppIds() const;
@@ -236,7 +236,7 @@
bool ShouldHaveTabStrip(SystemAppType type) const;
// Returns the SystemAppType that should capture the navigation to |url|.
- base::Optional<SystemAppType> GetCapturingSystemAppForURL(
+ absl::optional<SystemAppType> GetCapturingSystemAppForURL(
const GURL& url) const;
// Return the default bound of App's window.
diff --git a/chrome/browser/web_applications/system_web_apps/test/system_web_app_browsertest_base.cc b/chrome/browser/web_applications/system_web_apps/test/system_web_app_browsertest_base.cc
index 42e2619a..d581304 100644
--- a/chrome/browser/web_applications/system_web_apps/test/system_web_app_browsertest_base.cc
+++ b/chrome/browser/web_applications/system_web_apps/test/system_web_app_browsertest_base.cc
@@ -45,7 +45,7 @@
apps::AppLaunchParams SystemWebAppBrowserTestBase::LaunchParamsForApp(
SystemAppType system_app_type) {
- base::Optional<AppId> app_id =
+ absl::optional<AppId> app_id =
GetManager().GetAppIdForSystemApp(system_app_type);
CHECK(app_id.has_value());
diff --git a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc
index 96f823cb..e8af8ad 100644
--- a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc
+++ b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc
@@ -1419,7 +1419,7 @@
list->Append(policy::SystemFeature::kOsSettings);
}
WaitForTestSystemAppInstall();
- base::Optional<AppId> settings_id =
+ absl::optional<AppId> settings_id =
GetManager().GetAppIdForSystemApp(SystemAppType::SETTINGS);
DCHECK(settings_id.has_value());
@@ -1445,7 +1445,7 @@
IN_PROC_BROWSER_TEST_P(SystemWebAppManagerAppSuspensionBrowserTest,
AppSuspendedAfterInstall) {
WaitForTestSystemAppInstall();
- base::Optional<AppId> settings_id =
+ absl::optional<AppId> settings_id =
GetManager().GetAppIdForSystemApp(SystemAppType::SETTINGS);
DCHECK(settings_id.has_value());
EXPECT_EQ(apps::mojom::Readiness::kReady, GetAppReadiness(*settings_id));
diff --git a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc
index 9bcab0e..52aa21f1 100644
--- a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc
+++ b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/task_traits.h"
@@ -44,6 +43,7 @@
#include "chrome/browser/web_applications/web_app_sync_bridge.h"
#include "chrome/common/chrome_features.h"
#include "content/public/test/test_utils.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/idle/idle.h"
#include "ui/base/idle/scoped_set_idle_state.h"
#include "url/gurl.h"
@@ -981,7 +981,7 @@
SystemWebAppManagerTimerTest()
: SystemWebAppManagerTest(
base::test::TaskEnvironment::TimeSource::MOCK_TIME) {}
- void SetupTimer(base::Optional<base::TimeDelta> period,
+ void SetupTimer(absl::optional<base::TimeDelta> period,
bool open_immediately) {
InitEmptyRegistrar();
@@ -1094,7 +1094,7 @@
TEST_F(SystemWebAppManagerTimerTest, TestTimerStartsImmediately) {
ui::ScopedSetIdleState idle(ui::IDLE_STATE_IDLE);
- SetupTimer(base::nullopt, true);
+ SetupTimer(absl::nullopt, true);
TestWebAppUrlLoader* loader = nullptr;
SystemWebAppWaiter waiter(&system_web_app_manager());
@@ -1121,7 +1121,7 @@
task_environment()->FastForwardBy(base::TimeDelta::FromSeconds(121));
EXPECT_EQ(1u, timers.size());
EXPECT_EQ(true, timers[0]->open_immediately_for_testing());
- EXPECT_EQ(base::nullopt, timers[0]->period_for_testing());
+ EXPECT_EQ(absl::nullopt, timers[0]->period_for_testing());
EXPECT_EQ(1u, timers[0]->timer_activated_count_for_testing());
EXPECT_EQ(1u, timers[0]->opened_count_for_testing());
diff --git a/chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.h b/chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.h
index 856c814..7128d9a 100644
--- a/chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.h
+++ b/chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.h
@@ -103,7 +103,7 @@
SystemWebAppManager::UpdatePolicy::kAlwaysUpdate;
std::unique_ptr<TestWebAppProviderCreator> test_web_app_provider_creator_;
// nullopt if SetUpWithoutApps() was used.
- const base::Optional<SystemAppType> type_;
+ const absl::optional<SystemAppType> type_;
std::vector<std::unique_ptr<TestSystemWebAppWebUIControllerFactory>>
web_ui_controller_factories_;
std::set<ContentSettingsType> auto_granted_permissions_;
diff --git a/chrome/browser/web_applications/test/test_app_registrar.cc b/chrome/browser/web_applications/test/test_app_registrar.cc
index ed01e7a..752d2fab 100644
--- a/chrome/browser/web_applications/test/test_app_registrar.cc
+++ b/chrome/browser/web_applications/test/test_app_registrar.cc
@@ -62,13 +62,13 @@
return apps;
}
-base::Optional<AppId> TestAppRegistrar::LookupExternalAppId(
+absl::optional<AppId> TestAppRegistrar::LookupExternalAppId(
const GURL& install_url) const {
auto it = std::find_if(installed_apps_.begin(), installed_apps_.end(),
[install_url](const auto& app_it) {
return app_it.second.install_url == install_url;
});
- return it == installed_apps_.end() ? base::Optional<AppId>() : it->first;
+ return it == installed_apps_.end() ? absl::optional<AppId>() : it->first;
}
bool TestAppRegistrar::HasExternalAppWithInstallSource(
@@ -97,16 +97,16 @@
return std::string();
}
-base::Optional<SkColor> TestAppRegistrar::GetAppThemeColor(
+absl::optional<SkColor> TestAppRegistrar::GetAppThemeColor(
const AppId& app_id) const {
NOTIMPLEMENTED();
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<SkColor> TestAppRegistrar::GetAppBackgroundColor(
+absl::optional<SkColor> TestAppRegistrar::GetAppBackgroundColor(
const AppId& app_id) const {
NOTIMPLEMENTED();
- return base::nullopt;
+ return absl::nullopt;
}
const GURL& TestAppRegistrar::GetAppStartUrl(const AppId& app_id) const {
@@ -142,13 +142,13 @@
return false;
}
-base::Optional<GURL> TestAppRegistrar::GetAppScopeInternal(
+absl::optional<GURL> TestAppRegistrar::GetAppScopeInternal(
const AppId& app_id) const {
const auto& result = installed_apps_.find(app_id);
if (result == installed_apps_.end())
- return base::nullopt;
+ return absl::nullopt;
- return base::make_optional(result->second.install_url);
+ return absl::make_optional(result->second.install_url);
}
DisplayMode TestAppRegistrar::GetAppDisplayMode(const AppId& app_id) const {
diff --git a/chrome/browser/web_applications/test/test_app_registrar.h b/chrome/browser/web_applications/test/test_app_registrar.h
index bb72059e..5bc079e 100644
--- a/chrome/browser/web_applications/test/test_app_registrar.h
+++ b/chrome/browser/web_applications/test/test_app_registrar.h
@@ -10,12 +10,12 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/app_registrar.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
#include "components/services/app_service/public/cpp/url_handler_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace base {
@@ -50,7 +50,7 @@
bool WasInstalledByOem(const AppId& app_id) const override;
std::map<AppId, GURL> GetExternallyInstalledApps(
ExternalInstallSource install_source) const override;
- base::Optional<AppId> LookupExternalAppId(
+ absl::optional<AppId> LookupExternalAppId(
const GURL& install_url) const override;
bool HasExternalAppWithInstallSource(
const AppId& app_id,
@@ -58,8 +58,8 @@
int CountUserInstalledApps() const override;
std::string GetAppShortName(const AppId& app_id) const override;
std::string GetAppDescription(const AppId& app_id) const override;
- base::Optional<SkColor> GetAppThemeColor(const AppId& app_id) const override;
- base::Optional<SkColor> GetAppBackgroundColor(
+ absl::optional<SkColor> GetAppThemeColor(const AppId& app_id) const override;
+ absl::optional<SkColor> GetAppBackgroundColor(
const AppId& app_id) const override;
const GURL& GetAppStartUrl(const AppId& app_id) const override;
const std::string* GetAppLaunchQueryParams(
@@ -72,7 +72,7 @@
const AppId& app_id) const override;
bool IsAppFileHandlerPermissionBlocked(
const web_app::AppId& app_id) const override;
- base::Optional<GURL> GetAppScopeInternal(const AppId& app_id) const override;
+ absl::optional<GURL> GetAppScopeInternal(const AppId& app_id) const override;
DisplayMode GetAppDisplayMode(const AppId& app_id) const override;
DisplayMode GetAppUserDisplayMode(const AppId& app_id) const override;
std::vector<DisplayMode> GetAppDisplayModeOverride(
diff --git a/chrome/browser/web_applications/test/test_data_retriever.cc b/chrome/browser/web_applications/test/test_data_retriever.cc
index 9d9f75cd..d9eee12f 100644
--- a/chrome/browser/web_applications/test/test_data_retriever.cc
+++ b/chrome/browser/web_applications/test/test_data_retriever.cc
@@ -36,7 +36,7 @@
content::WebContents* web_contents,
bool bypass_service_worker_check,
CheckInstallabilityCallback callback) {
- base::Optional<blink::Manifest> opt_manifest;
+ absl::optional<blink::Manifest> opt_manifest;
if (manifest_ && !manifest_->IsEmpty())
opt_manifest = *manifest_;
diff --git a/chrome/browser/web_applications/test/test_externally_managed_app_manager.cc b/chrome/browser/web_applications/test/test_externally_managed_app_manager.cc
index 60fb98b..2cd1234 100644
--- a/chrome/browser/web_applications/test/test_externally_managed_app_manager.cc
+++ b/chrome/browser/web_applications/test/test_externally_managed_app_manager.cc
@@ -86,7 +86,7 @@
FROM_HERE,
base::BindLambdaForTesting([this, weak_ptr, url, callback]() {
if (weak_ptr) {
- base::Optional<AppId> app_id = registrar_->LookupExternalAppId(url);
+ absl::optional<AppId> app_id = registrar_->LookupExternalAppId(url);
if (app_id) {
registrar_->RemoveExternalApp(*app_id);
deduped_uninstall_count_++;
diff --git a/chrome/browser/web_applications/test/test_externally_managed_app_manager_impl.h b/chrome/browser/web_applications/test/test_externally_managed_app_manager_impl.h
index 3eb9acd..b1210f0 100644
--- a/chrome/browser/web_applications/test/test_externally_managed_app_manager_impl.h
+++ b/chrome/browser/web_applications/test/test_externally_managed_app_manager_impl.h
@@ -7,9 +7,9 @@
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/externally_managed_app_manager_impl.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace web_app {
diff --git a/chrome/browser/web_applications/test/test_file_utils.cc b/chrome/browser/web_applications/test/test_file_utils.cc
index 41062b7..660e28e 100644
--- a/chrome/browser/web_applications/test/test_file_utils.cc
+++ b/chrome/browser/web_applications/test/test_file_utils.cc
@@ -32,7 +32,7 @@
}
void TestFileUtils::SetNextDeleteFileRecursivelyResult(
- base::Optional<bool> delete_result) {
+ absl::optional<bool> delete_result) {
delete_file_recursively_result_ = delete_result;
}
diff --git a/chrome/browser/web_applications/test/test_file_utils.h b/chrome/browser/web_applications/test/test_file_utils.h
index 86d294ae..689ef58 100644
--- a/chrome/browser/web_applications/test/test_file_utils.h
+++ b/chrome/browser/web_applications/test/test_file_utils.h
@@ -9,8 +9,8 @@
#include <memory>
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/file_utils_wrapper.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace web_app {
@@ -41,11 +41,11 @@
// Simulate "disk full" error: limit disk space for |WriteFile| operations.
void SetRemainingDiskSpaceSize(int remaining_disk_space);
- void SetNextDeleteFileRecursivelyResult(base::Optional<bool> delete_result);
+ void SetNextDeleteFileRecursivelyResult(absl::optional<bool> delete_result);
private:
std::map<base::FilePath, base::FilePath> read_file_rerouting_;
- base::Optional<bool> delete_file_recursively_result_;
+ absl::optional<bool> delete_file_recursively_result_;
int remaining_disk_space_ = kNoLimit;
DISALLOW_ASSIGN(TestFileUtils);
diff --git a/chrome/browser/web_applications/test/test_install_finalizer.h b/chrome/browser/web_applications/test/test_install_finalizer.h
index 44bd3de6..967ad27 100644
--- a/chrome/browser/web_applications/test/test_install_finalizer.h
+++ b/chrome/browser/web_applications/test/test_install_finalizer.h
@@ -9,8 +9,8 @@
#include <memory>
#include <set>
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/install_finalizer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
struct WebApplicationInfo;
@@ -87,8 +87,8 @@
std::vector<FinalizeOptions> finalize_options_list_;
std::vector<GURL> uninstall_external_web_app_urls_;
- base::Optional<AppId> next_app_id_;
- base::Optional<InstallResultCode> next_result_code_;
+ absl::optional<AppId> next_app_id_;
+ absl::optional<InstallResultCode> next_result_code_;
std::map<GURL, bool> next_uninstall_external_web_app_results_;
std::set<AppId> user_uninstalled_external_apps_;
diff --git a/chrome/browser/web_applications/test/test_os_integration_manager.h b/chrome/browser/web_applications/test/test_os_integration_manager.h
index d0ac3ce..a4199c68 100644
--- a/chrome/browser/web_applications/test/test_os_integration_manager.h
+++ b/chrome/browser/web_applications/test/test_os_integration_manager.h
@@ -7,9 +7,9 @@
#include <map>
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/os_integration_manager.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace web_app {
@@ -72,11 +72,11 @@
can_create_shortcuts_ = can_create_shortcuts;
}
- base::Optional<bool> did_add_to_desktop() const {
+ absl::optional<bool> did_add_to_desktop() const {
return did_add_to_desktop_;
}
- base::Optional<InstallOsHooksOptions> get_last_install_options() const {
+ absl::optional<InstallOsHooksOptions> get_last_install_options() const {
return last_options_;
}
@@ -100,8 +100,8 @@
size_t num_register_run_on_os_login_calls_ = 0;
size_t num_add_app_to_quick_launch_bar_calls_ = 0;
size_t num_register_url_handlers_calls_ = 0;
- base::Optional<bool> did_add_to_desktop_;
- base::Optional<InstallOsHooksOptions> last_options_;
+ absl::optional<bool> did_add_to_desktop_;
+ absl::optional<InstallOsHooksOptions> last_options_;
bool can_create_shortcuts_ = true;
std::map<AppId, bool> next_create_shortcut_results_;
diff --git a/chrome/browser/web_applications/test/test_web_app_database_factory.cc b/chrome/browser/web_applications/test/test_web_app_database_factory.cc
index 6e3193c..844ffe5 100644
--- a/chrome/browser/web_applications/test/test_web_app_database_factory.cc
+++ b/chrome/browser/web_applications/test/test_web_app_database_factory.cc
@@ -33,7 +33,7 @@
base::RunLoop run_loop;
store_->ReadAllData(base::BindLambdaForTesting(
- [&](const base::Optional<syncer::ModelError>& error,
+ [&](const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::ModelTypeStore::RecordList> data_records) {
DCHECK(!error);
@@ -79,7 +79,7 @@
store_->CommitWriteBatch(
std::move(write_batch),
base::BindOnce(base::BindLambdaForTesting(
- [&](const base::Optional<syncer::ModelError>& error) {
+ [&](const absl::optional<syncer::ModelError>& error) {
DCHECK(!error);
run_loop.Quit();
})));
diff --git a/chrome/browser/web_applications/test/web_app_registration_waiter.cc b/chrome/browser/web_applications/test/web_app_registration_waiter.cc
index 4769fcf..850a505e 100644
--- a/chrome/browser/web_applications/test/web_app_registration_waiter.cc
+++ b/chrome/browser/web_applications/test/web_app_registration_waiter.cc
@@ -40,7 +40,7 @@
void WebAppRegistrationWaiter::AwaitNextNonFailedRegistration(
const GURL& install_url) {
install_url_ = install_url;
- code_ = base::nullopt;
+ code_ = absl::nullopt;
run_loop_.Run();
}
diff --git a/chrome/browser/web_applications/test/web_app_registration_waiter.h b/chrome/browser/web_applications/test/web_app_registration_waiter.h
index 4e78854b..ba7a097 100644
--- a/chrome/browser/web_applications/test/web_app_registration_waiter.h
+++ b/chrome/browser/web_applications/test/web_app_registration_waiter.h
@@ -28,7 +28,7 @@
base::RunLoop run_loop_;
GURL install_url_;
// If unset then check for any non failure result.
- base::Optional<RegistrationResultCode> code_;
+ absl::optional<RegistrationResultCode> code_;
base::RunLoop complete_run_loop_;
};
diff --git a/chrome/browser/web_applications/test/web_app_test_utils.cc b/chrome/browser/web_applications/test/web_app_test_utils.cc
index 1fed556..486e3c4 100644
--- a/chrome/browser/web_applications/test/web_app_test_utils.cc
+++ b/chrome/browser/web_applications/test/web_app_test_utils.cc
@@ -195,7 +195,7 @@
RandomHelper random(seed);
const std::string seed_str = base::NumberToString(seed);
- base::Optional<std::string> manifest_id;
+ absl::optional<std::string> manifest_id;
if (random.next_bool())
manifest_id = "manifest_id_" + seed_str;
const GURL scope = base_url.Resolve("scope" + seed_str + "/");
@@ -204,9 +204,9 @@
const std::string name = "Name" + seed_str;
const std::string description = "Description" + seed_str;
- const base::Optional<SkColor> theme_color = random.next_uint();
- const base::Optional<SkColor> background_color = random.next_uint();
- const base::Optional<SkColor> synced_theme_color = random.next_uint();
+ const absl::optional<SkColor> theme_color = random.next_uint();
+ const absl::optional<SkColor> background_color = random.next_uint();
+ const absl::optional<SkColor> synced_theme_color = random.next_uint();
auto app = std::make_unique<WebApp>(app_id);
// Generate all possible permutations of field values in a random way:
@@ -324,7 +324,7 @@
app->SetManifestUrl(base_url.Resolve("/manifest" + seed_str + ".json"));
if (IsChromeOs()) {
- auto chromeos_data = base::make_optional<WebAppChromeOsData>();
+ auto chromeos_data = absl::make_optional<WebAppChromeOsData>();
chromeos_data->show_in_launcher = random.next_bool();
chromeos_data->show_in_search = random.next_bool();
chromeos_data->show_in_management = random.next_bool();
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc
index 40626c4..5adc6224 100644
--- a/chrome/browser/web_applications/web_app.cc
+++ b/chrome/browser/web_applications/web_app.cc
@@ -21,7 +21,7 @@
namespace {
-std::string ColorToString(base::Optional<SkColor> color) {
+std::string ColorToString(absl::optional<SkColor> color) {
return color.has_value() ? color_utils::SkColorToRgbaString(color.value())
: "none";
}
@@ -34,8 +34,8 @@
: app_id_(app_id),
display_mode_(DisplayMode::kUndefined),
user_display_mode_(DisplayMode::kUndefined),
- chromeos_data_(IsChromeOs() ? base::make_optional<WebAppChromeOsData>()
- : base::nullopt) {}
+ chromeos_data_(IsChromeOs() ? absl::make_optional<WebAppChromeOsData>()
+ : absl::nullopt) {}
WebApp::~WebApp() = default;
@@ -144,11 +144,11 @@
note_taking_new_note_url_ = note_taking_new_note_url;
}
-void WebApp::SetThemeColor(base::Optional<SkColor> theme_color) {
+void WebApp::SetThemeColor(absl::optional<SkColor> theme_color) {
theme_color_ = theme_color;
}
-void WebApp::SetBackgroundColor(base::Optional<SkColor> background_color) {
+void WebApp::SetBackgroundColor(absl::optional<SkColor> background_color) {
background_color_ = background_color;
}
@@ -188,7 +188,7 @@
}
void WebApp::SetWebAppChromeOsData(
- base::Optional<WebAppChromeOsData> chromeos_data) {
+ absl::optional<WebAppChromeOsData> chromeos_data) {
chromeos_data_ = std::move(chromeos_data);
}
@@ -230,7 +230,7 @@
file_handlers_ = std::move(file_handlers);
}
-void WebApp::SetShareTarget(base::Optional<apps::ShareTarget> share_target) {
+void WebApp::SetShareTarget(absl::optional<apps::ShareTarget> share_target) {
share_target_ = std::move(share_target);
}
@@ -284,7 +284,7 @@
}
void WebApp::SetLaunchQueryParams(
- base::Optional<std::string> launch_query_params) {
+ absl::optional<std::string> launch_query_params) {
launch_query_params_ = std::move(launch_query_params);
}
@@ -292,7 +292,7 @@
manifest_url_ = manifest_url;
}
-void WebApp::SetManifestId(const base::Optional<std::string>& manifest_id) {
+void WebApp::SetManifestId(const absl::optional<std::string>& manifest_id) {
manifest_id_ = manifest_id;
}
@@ -317,7 +317,7 @@
SyncFallbackData&& sync_fallback_data) = default;
template <typename T>
-std::ostream& operator<<(std::ostream& out, const base::Optional<T>& optional) {
+std::ostream& operator<<(std::ostream& out, const absl::optional<T>& optional) {
if (optional.has_value())
return out << optional.value();
return out << "nullopt";
diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h
index 03b34f3a..b0c0bdf 100644
--- a/chrome/browser/web_applications/web_app.h
+++ b/chrome/browser/web_applications/web_app.h
@@ -10,7 +10,6 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/web_app_chromeos_data.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
@@ -21,6 +20,7 @@
#include "components/services/app_service/public/cpp/share_target.h"
#include "components/services/app_service/public/cpp/url_handler_info.h"
#include "components/sync/model/string_ordinal.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "url/gurl.h"
@@ -54,8 +54,8 @@
const GURL& scope() const { return scope_; }
- const base::Optional<SkColor>& theme_color() const { return theme_color_; }
- const base::Optional<SkColor>& background_color() const {
+ const absl::optional<SkColor>& theme_color() const { return theme_color_; }
+ const absl::optional<SkColor>& background_color() const {
return background_color_;
}
@@ -72,7 +72,7 @@
return user_launch_ordinal_;
}
- const base::Optional<WebAppChromeOsData>& chromeos_data() const {
+ const absl::optional<WebAppChromeOsData>& chromeos_data() const {
return chromeos_data_;
}
@@ -80,7 +80,7 @@
ClientData();
~ClientData();
ClientData(const ClientData& client_data);
- base::Optional<WebAppSystemWebAppData> system_web_app_data;
+ absl::optional<WebAppSystemWebAppData> system_web_app_data;
};
const ClientData& client_data() const { return client_data_; }
@@ -128,7 +128,7 @@
return file_handler_permission_blocked_;
}
- const base::Optional<apps::ShareTarget>& share_target() const {
+ const absl::optional<apps::ShareTarget>& share_target() const {
return share_target_;
}
@@ -166,7 +166,7 @@
SyncFallbackData& operator=(SyncFallbackData&& sync_fallback_data);
std::string name;
- base::Optional<SkColor> theme_color;
+ absl::optional<SkColor> theme_color;
GURL scope;
std::vector<WebApplicationIconInfo> icon_infos;
};
@@ -190,7 +190,7 @@
const GURL& manifest_url() const { return manifest_url_; }
- const base::Optional<std::string>& manifest_id() const {
+ const absl::optional<std::string>& manifest_id() const {
return manifest_id_;
}
@@ -214,16 +214,16 @@
void SetName(const std::string& name);
void SetDescription(const std::string& description);
void SetStartUrl(const GURL& start_url);
- void SetLaunchQueryParams(base::Optional<std::string> launch_query_params);
+ void SetLaunchQueryParams(absl::optional<std::string> launch_query_params);
void SetScope(const GURL& scope);
- void SetThemeColor(base::Optional<SkColor> theme_color);
- void SetBackgroundColor(base::Optional<SkColor> background_color);
+ void SetThemeColor(absl::optional<SkColor> theme_color);
+ void SetBackgroundColor(absl::optional<SkColor> background_color);
void SetDisplayMode(DisplayMode display_mode);
void SetUserDisplayMode(DisplayMode user_display_mode);
void SetDisplayModeOverride(std::vector<DisplayMode> display_mode_override);
void SetUserPageOrdinal(syncer::StringOrdinal page_ordinal);
void SetUserLaunchOrdinal(syncer::StringOrdinal launch_ordinal);
- void SetWebAppChromeOsData(base::Optional<WebAppChromeOsData> chromeos_data);
+ void SetWebAppChromeOsData(absl::optional<WebAppChromeOsData> chromeos_data);
void SetIsLocallyInstalled(bool is_locally_installed);
void SetIsInSyncInstall(bool is_in_sync_install);
void SetIsUninstalling(bool is_uninstalling);
@@ -236,7 +236,7 @@
shortcuts_menu_item_infos);
void SetDownloadedShortcutsMenuIconsSizes(std::vector<IconSizes> icon_sizes);
void SetFileHandlers(apps::FileHandlers file_handlers);
- void SetShareTarget(base::Optional<apps::ShareTarget> share_target);
+ void SetShareTarget(absl::optional<apps::ShareTarget> share_target);
void SetAdditionalSearchTerms(
std::vector<std::string> additional_search_terms);
void SetProtocolHandlers(
@@ -250,7 +250,7 @@
void SetSyncFallbackData(SyncFallbackData sync_fallback_data);
void SetCaptureLinks(blink::mojom::CaptureLinks capture_links);
void SetManifestUrl(const GURL& manifest_url);
- void SetManifestId(const base::Optional<std::string>& manifest_id);
+ void SetManifestId(const absl::optional<std::string>& manifest_id);
void SetFileHandlerPermissionBlocked(bool permission_blocked);
// For logging and debug purposes.
@@ -272,16 +272,16 @@
std::string name_;
std::string description_;
GURL start_url_;
- base::Optional<std::string> launch_query_params_;
+ absl::optional<std::string> launch_query_params_;
GURL scope_;
- base::Optional<SkColor> theme_color_;
- base::Optional<SkColor> background_color_;
+ absl::optional<SkColor> theme_color_;
+ absl::optional<SkColor> background_color_;
DisplayMode display_mode_;
DisplayMode user_display_mode_;
std::vector<DisplayMode> display_mode_override_;
syncer::StringOrdinal user_page_ordinal_;
syncer::StringOrdinal user_launch_ordinal_;
- base::Optional<WebAppChromeOsData> chromeos_data_;
+ absl::optional<WebAppChromeOsData> chromeos_data_;
bool is_locally_installed_ = true;
bool is_in_sync_install_ = false;
// Note: This field is not persisted in the database.
@@ -297,7 +297,7 @@
std::vector<WebApplicationShortcutsMenuItemInfo> shortcuts_menu_item_infos_;
std::vector<IconSizes> downloaded_shortcuts_menu_icons_sizes_;
apps::FileHandlers file_handlers_;
- base::Optional<apps::ShareTarget> share_target_;
+ absl::optional<apps::ShareTarget> share_target_;
std::vector<std::string> additional_search_terms_;
std::vector<apps::ProtocolHandlerInfo> protocol_handlers_;
GURL note_taking_new_note_url_;
@@ -311,7 +311,7 @@
blink::mojom::CaptureLinks::kUndefined;
ClientData client_data_;
GURL manifest_url_;
- base::Optional<std::string> manifest_id_;
+ absl::optional<std::string> manifest_id_;
bool file_handler_permission_blocked_ = false;
// New fields must be added to:
// - |operator==|
diff --git a/chrome/browser/web_applications/web_app_database.cc b/chrome/browser/web_applications/web_app_database.cc
index 5233a9ea..538f48f3 100644
--- a/chrome/browser/web_applications/web_app_database.cc
+++ b/chrome/browser/web_applications/web_app_database.cc
@@ -394,9 +394,9 @@
return nullptr;
}
- base::Optional<std::string> manifest_id = base::nullopt;
+ absl::optional<std::string> manifest_id = absl::nullopt;
if (sync_data.has_manifest_id())
- manifest_id = base::Optional<std::string>(sync_data.manifest_id());
+ manifest_id = absl::optional<std::string>(sync_data.manifest_id());
const AppId app_id = GenerateAppId(manifest_id, start_url);
@@ -470,7 +470,7 @@
}
if (local_data.has_chromeos_data()) {
- auto chromeos_data = base::make_optional<WebAppChromeOsData>();
+ auto chromeos_data = absl::make_optional<WebAppChromeOsData>();
chromeos_data->show_in_launcher = chromeos_data_proto.show_in_launcher();
chromeos_data->show_in_search = chromeos_data_proto.show_in_search();
chromeos_data->show_in_management =
@@ -536,7 +536,7 @@
web_app->SetInstallTime(syncer::ProtoTimeToTime(local_data.install_time()));
}
- base::Optional<WebApp::SyncFallbackData> parsed_sync_fallback_data =
+ absl::optional<WebApp::SyncFallbackData> parsed_sync_fallback_data =
ParseSyncFallbackDataStruct(sync_data);
if (!parsed_sync_fallback_data.has_value()) {
// ParseSyncFallbackDataStruct() reports any errors.
@@ -544,7 +544,7 @@
}
web_app->SetSyncFallbackData(std::move(parsed_sync_fallback_data.value()));
- base::Optional<std::vector<WebApplicationIconInfo>> parsed_icon_infos =
+ absl::optional<std::vector<WebApplicationIconInfo>> parsed_icon_infos =
ParseWebAppIconInfos("WebApp", local_data.icon_infos());
if (!parsed_icon_infos.has_value()) {
// ParseWebAppIconInfos() reports any errors.
@@ -764,7 +764,7 @@
void WebAppDatabase::OnDatabaseOpened(
RegistryOpenedCallback callback,
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::ModelTypeStore> store) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (error) {
@@ -783,7 +783,7 @@
void WebAppDatabase::OnAllDataRead(
RegistryOpenedCallback callback,
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::ModelTypeStore::RecordList> data_records) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (error) {
@@ -800,7 +800,7 @@
void WebAppDatabase::OnAllMetadataRead(
std::unique_ptr<syncer::ModelTypeStore::RecordList> data_records,
RegistryOpenedCallback callback,
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::MetadataBatch> metadata_batch) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (error) {
@@ -825,7 +825,7 @@
void WebAppDatabase::OnDataWritten(
CompletionCallback callback,
- const base::Optional<syncer::ModelError>& error) {
+ const absl::optional<syncer::ModelError>& error) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (error) {
error_callback_.Run(*error);
diff --git a/chrome/browser/web_applications/web_app_database.h b/chrome/browser/web_applications/web_app_database.h
index 99b12f61..33f717b0 100644
--- a/chrome/browser/web_applications/web_app_database.h
+++ b/chrome/browser/web_applications/web_app_database.h
@@ -9,7 +9,6 @@
#include "base/callback_forward.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
@@ -17,6 +16,7 @@
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "components/sync/model/model_type_store.h"
#include "components/sync/protocol/web_app_specifics.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace syncer {
class ModelError;
@@ -66,21 +66,21 @@
static std::unique_ptr<WebApp> CreateWebApp(const WebAppProto& local_data);
void OnDatabaseOpened(RegistryOpenedCallback callback,
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::ModelTypeStore> store);
void OnAllDataRead(
RegistryOpenedCallback callback,
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::ModelTypeStore::RecordList> data_records);
void OnAllMetadataRead(
std::unique_ptr<syncer::ModelTypeStore::RecordList> data_records,
RegistryOpenedCallback callback,
- const base::Optional<syncer::ModelError>& error,
+ const absl::optional<syncer::ModelError>& error,
std::unique_ptr<syncer::MetadataBatch> metadata_batch);
void OnDataWritten(CompletionCallback callback,
- const base::Optional<syncer::ModelError>& error);
+ const absl::optional<syncer::ModelError>& error);
std::unique_ptr<syncer::ModelTypeStore> store_;
AbstractWebAppDatabaseFactory* const database_factory_;
diff --git a/chrome/browser/web_applications/web_app_database_unittest.cc b/chrome/browser/web_applications/web_app_database_unittest.cc
index 8116e7f..0bf10193 100644
--- a/chrome/browser/web_applications/web_app_database_unittest.cc
+++ b/chrome/browser/web_applications/web_app_database_unittest.cc
@@ -61,7 +61,7 @@
database_factory().store()->CommitWriteBatch(
std::move(write_batch),
base::BindLambdaForTesting(
- [&](const base::Optional<syncer::ModelError>& error) {
+ [&](const absl::optional<syncer::ModelError>& error) {
EXPECT_FALSE(error);
run_loop.Quit();
}));
@@ -285,7 +285,7 @@
app->SetIsLocallyInstalled(false);
// chromeos_data should always be set on ChromeOS.
if (IsChromeOs())
- app->SetWebAppChromeOsData(base::make_optional<WebAppChromeOsData>());
+ app->SetWebAppChromeOsData(absl::make_optional<WebAppChromeOsData>());
EXPECT_FALSE(app->HasAnySources());
for (int i = Source::kMinValue; i <= Source::kMaxValue; ++i) {
diff --git a/chrome/browser/web_applications/web_app_icon_manager.cc b/chrome/browser/web_applications/web_app_icon_manager.cc
index 3bb74df8..1e4bf6a4 100644
--- a/chrome/browser/web_applications/web_app_icon_manager.cc
+++ b/chrome/browser/web_applications/web_app_icon_manager.cc
@@ -648,14 +648,14 @@
icon_sizes);
}
-base::Optional<AppIconManager::IconSizeAndPurpose>
+absl::optional<AppIconManager::IconSizeAndPurpose>
WebAppIconManager::FindIconMatchBigger(const AppId& app_id,
const std::vector<IconPurpose>& purposes,
SquareSizePx min_size) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
const WebApp* web_app = registrar_.GetAppById(app_id);
if (!web_app)
- return base::nullopt;
+ return absl::nullopt;
// Must iterate through purposes in order given.
for (IconPurpose purpose : purposes) {
@@ -667,7 +667,7 @@
}
}
- return base::nullopt;
+ return absl::nullopt;
}
bool WebAppIconManager::HasSmallestIcon(
@@ -744,7 +744,7 @@
ReadIconWithPurposeCallback callback) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<IconSizeAndPurpose> best_icon =
+ absl::optional<IconSizeAndPurpose> best_icon =
FindIconMatchBigger(app_id, purposes, min_size_in_px);
DCHECK(best_icon.has_value());
IconId icon_id(app_id, best_icon->purpose, best_icon->size_px);
@@ -765,7 +765,7 @@
ReadCompressedIconWithPurposeCallback callback) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- base::Optional<IconSizeAndPurpose> best_icon =
+ absl::optional<IconSizeAndPurpose> best_icon =
FindIconMatchBigger(app_id, purposes, min_size_in_px);
DCHECK(best_icon.has_value());
IconId icon_id(app_id, best_icon->purpose, best_icon->size_px);
@@ -810,7 +810,7 @@
IconPurpose purpose,
SquareSizePx desired_icon_size,
ReadIconsCallback callback) const {
- base::Optional<IconSizeAndPurpose> best_icon =
+ absl::optional<IconSizeAndPurpose> best_icon =
FindIconMatchBigger(app_id, {purpose}, desired_icon_size);
if (!best_icon) {
best_icon = FindIconMatchSmaller(app_id, {purpose}, desired_icon_size);
@@ -869,7 +869,7 @@
favicon_read_callback_ = std::move(callback);
}
-base::Optional<AppIconManager::IconSizeAndPurpose>
+absl::optional<AppIconManager::IconSizeAndPurpose>
WebAppIconManager::FindIconMatchSmaller(
const AppId& app_id,
const std::vector<IconPurpose>& purposes,
@@ -877,7 +877,7 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
const WebApp* web_app = registrar_.GetAppById(app_id);
if (!web_app)
- return base::nullopt;
+ return absl::nullopt;
// Must check purposes in the order given.
for (IconPurpose purpose : purposes) {
@@ -889,7 +889,7 @@
}
}
- return base::nullopt;
+ return absl::nullopt;
}
void WebAppIconManager::ReadFavicon(const AppId& app_id) {
diff --git a/chrome/browser/web_applications/web_app_icon_manager.h b/chrome/browser/web_applications/web_app_icon_manager.h
index 4ab22875f..da00aec 100644
--- a/chrome/browser/web_applications/web_app_icon_manager.h
+++ b/chrome/browser/web_applications/web_app_icon_manager.h
@@ -12,12 +12,12 @@
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/web_applications/components/app_icon_manager.h"
#include "chrome/browser/web_applications/components/app_registrar.h"
#include "chrome/browser/web_applications/components/app_registrar_observer.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/image/image_skia.h"
@@ -64,7 +64,7 @@
bool HasIcons(const AppId& app_id,
IconPurpose purpose,
const SortedSizesPx& icon_sizes) const override;
- base::Optional<IconSizeAndPurpose> FindIconMatchBigger(
+ absl::optional<IconSizeAndPurpose> FindIconMatchBigger(
const AppId& app_id,
const std::vector<IconPurpose>& purposes,
SquareSizePx min_size) const override;
@@ -117,7 +117,7 @@
void SetFaviconReadCallbackForTesting(FaviconReadCallback callback);
private:
- base::Optional<IconSizeAndPurpose> FindIconMatchSmaller(
+ absl::optional<IconSizeAndPurpose> FindIconMatchSmaller(
const AppId& app_id,
const std::vector<IconPurpose>& purposes,
SquareSizePx max_size) const;
diff --git a/chrome/browser/web_applications/web_app_icon_manager_unittest.cc b/chrome/browser/web_applications/web_app_icon_manager_unittest.cc
index fa8dad3c..632fd16 100644
--- a/chrome/browser/web_applications/web_app_icon_manager_unittest.cc
+++ b/chrome/browser/web_applications/web_app_icon_manager_unittest.cc
@@ -904,18 +904,18 @@
controller().RegisterApp(std::move(web_app));
EXPECT_FALSE(icon_manager().HasSmallestIcon(app_id, {IconPurpose::ANY}, 70));
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
icon_manager().FindIconMatchBigger(app_id, {IconPurpose::ANY}, 70));
EXPECT_FALSE(icon_manager().HasSmallestIcon(
app_id, {IconPurpose::ANY, IconPurpose::MASKABLE}, 70));
- EXPECT_EQ(base::nullopt,
+ EXPECT_EQ(absl::nullopt,
icon_manager().FindIconMatchBigger(
app_id, {IconPurpose::ANY, IconPurpose::MASKABLE}, 70));
EXPECT_FALSE(
icon_manager().HasSmallestIcon(app_id, {IconPurpose::MASKABLE}, 40));
- EXPECT_EQ(base::nullopt, icon_manager().FindIconMatchBigger(
+ EXPECT_EQ(absl::nullopt, icon_manager().FindIconMatchBigger(
app_id, {IconPurpose::MASKABLE}, 40));
EXPECT_TRUE(icon_manager().HasSmallestIcon(
diff --git a/chrome/browser/web_applications/web_app_install_manager.cc b/chrome/browser/web_applications/web_app_install_manager.cc
index b437392..d83f5b97 100644
--- a/chrome/browser/web_applications/web_app_install_manager.cc
+++ b/chrome/browser/web_applications/web_app_install_manager.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/metrics/histogram_macros.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/profiles/profile.h"
@@ -23,6 +22,7 @@
#include "chrome/browser/web_applications/web_app_install_task.h"
#include "components/webapps/browser/installable/installable_metrics.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace web_app {
@@ -35,7 +35,7 @@
#endif
InstallManager::InstallParams CreateSyncInstallParams(
- const base::Optional<std::string>& manifest_id,
+ const absl::optional<std::string>& manifest_id,
const GURL& start_url,
const std::u16string& app_name,
DisplayMode user_display_mode) {
@@ -159,13 +159,13 @@
webapps::WebappInstallSource install_source,
OnceInstallCallback callback) {
InstallWebAppFromInfo(std::move(web_application_info), for_installable_site,
- base::nullopt, install_source, std::move(callback));
+ absl::nullopt, install_source, std::move(callback));
}
void WebAppInstallManager::InstallWebAppFromInfo(
std::unique_ptr<WebApplicationInfo> web_application_info,
ForInstallableSite for_installable_site,
- const base::Optional<InstallParams>& install_params,
+ const absl::optional<InstallParams>& install_params,
webapps::WebappInstallSource install_source,
OnceInstallCallback callback) {
DCHECK(started_);
@@ -464,7 +464,7 @@
DeleteTask(task);
InstallableCheckResult result;
- base::Optional<AppId> opt_app_id;
+ absl::optional<AppId> opt_app_id;
if (IsSuccess(code)) {
if (!app_id.empty() && registrar()->IsInstalled(app_id)) {
result = InstallableCheckResult::kAlreadyInstalled;
diff --git a/chrome/browser/web_applications/web_app_install_manager.h b/chrome/browser/web_applications/web_app_install_manager.h
index 9069f46..faab004 100644
--- a/chrome/browser/web_applications/web_app_install_manager.h
+++ b/chrome/browser/web_applications/web_app_install_manager.h
@@ -66,7 +66,7 @@
void InstallWebAppFromInfo(
std::unique_ptr<WebApplicationInfo> web_application_info,
ForInstallableSite for_installable_site,
- const base::Optional<InstallParams>& install_params,
+ const absl::optional<InstallParams>& install_params,
webapps::WebappInstallSource install_source,
OnceInstallCallback callback) override;
void InstallWebAppWithParams(content::WebContents* web_contents,
diff --git a/chrome/browser/web_applications/web_app_install_task.cc b/chrome/browser/web_applications/web_app_install_task.cc
index c584837..aa04ee8 100644
--- a/chrome/browser/web_applications/web_app_install_task.cc
+++ b/chrome/browser/web_applications/web_app_install_task.cc
@@ -13,7 +13,6 @@
#include "base/callback.h"
#include "base/feature_list.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/favicon/favicon_utils.h"
@@ -35,6 +34,7 @@
#include "components/webapps/browser/installable/installable_metrics.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "url/gurl.h"
@@ -204,7 +204,7 @@
}
void UpdateFinalizerClientData(
- const base::Optional<InstallManager::InstallParams>& params,
+ const absl::optional<InstallManager::InstallParams>& params,
InstallFinalizer::FinalizeOptions* options) {
if (params) {
if (IsChromeOs()) {
@@ -442,7 +442,7 @@
}
void WebAppInstallTask::OnWebAppInstallabilityChecked(
- base::Optional<blink::Manifest> manifest,
+ absl::optional<blink::Manifest> manifest,
const GURL& manifest_url,
bool valid_manifest_for_web_app,
bool is_installable) {
@@ -519,7 +519,7 @@
void WebAppInstallTask::OnDidPerformInstallableCheck(
std::unique_ptr<WebApplicationInfo> web_app_info,
bool force_shortcut_app,
- base::Optional<blink::Manifest> manifest,
+ absl::optional<blink::Manifest> manifest,
const GURL& manifest_url,
bool valid_manifest_for_web_app,
bool is_installable) {
@@ -571,7 +571,7 @@
}
void WebAppInstallTask::CheckForPlayStoreIntentOrGetIcons(
- base::Optional<blink::Manifest> manifest,
+ absl::optional<blink::Manifest> manifest,
std::unique_ptr<WebApplicationInfo> web_app_info,
std::vector<GURL> icon_urls,
ForInstallableSite for_installable_site,
diff --git a/chrome/browser/web_applications/web_app_install_task.h b/chrome/browser/web_applications/web_app_install_task.h
index 437a54af..fdd1b3c 100644
--- a/chrome/browser/web_applications/web_app_install_task.h
+++ b/chrome/browser/web_applications/web_app_install_task.h
@@ -11,7 +11,6 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/install_finalizer.h"
#include "chrome/browser/web_applications/components/install_manager.h"
#include "chrome/browser/web_applications/components/os_integration_manager.h"
@@ -21,6 +20,7 @@
#include "chrome/browser/web_applications/components/web_application_info.h"
#include "components/webapps/browser/installable/installable_metrics.h"
#include "content/public/browser/web_contents_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
class Profile;
@@ -64,7 +64,7 @@
// kExpectedAppIdCheckFailed if actual app_id doesn't match expected app_id.
// The actual resulting app_id is reported as a part of OnceInstallCallback.
void ExpectAppId(const AppId& expected_app_id);
- const base::Optional<AppId>& app_id_to_expect() const {
+ const absl::optional<AppId>& app_id_to_expect() const {
return expected_app_id_;
}
@@ -183,7 +183,7 @@
content::WebContents* web_contents,
WebAppUrlLoader::Result result);
void OnWebAppInstallabilityChecked(
- base::Optional<blink::Manifest> opt_manifest,
+ absl::optional<blink::Manifest> opt_manifest,
const GURL& manifest_url,
bool valid_manifest_for_web_app,
bool is_installable);
@@ -201,7 +201,7 @@
void OnDidPerformInstallableCheck(
std::unique_ptr<WebApplicationInfo> web_app_info,
bool force_shortcut_app,
- base::Optional<blink::Manifest> opt_manifest,
+ absl::optional<blink::Manifest> opt_manifest,
const GURL& manifest_url,
bool valid_manifest_for_web_app,
bool is_installable);
@@ -211,7 +211,7 @@
// synchronously calls OnDidCheckForIntentToPlayStore() implicitly failing the
// check if it cannot be made.
void CheckForPlayStoreIntentOrGetIcons(
- base::Optional<blink::Manifest> opt_manifest,
+ absl::optional<blink::Manifest> opt_manifest,
std::unique_ptr<WebApplicationInfo> web_app_info,
std::vector<GURL> icon_urls,
ForInstallableSite for_installable_site,
@@ -261,8 +261,8 @@
InstallManager::WebAppInstallDialogCallback dialog_callback_;
InstallManager::OnceInstallCallback install_callback_;
RetrieveWebApplicationInfoWithIconsCallback retrieve_info_callback_;
- base::Optional<InstallManager::InstallParams> install_params_;
- base::Optional<AppId> expected_app_id_;
+ absl::optional<InstallManager::InstallParams> install_params_;
+ absl::optional<AppId> expected_app_id_;
bool background_installation_ = false;
// The mechanism via which the app creation was triggered, will stay as
diff --git a/chrome/browser/web_applications/web_app_install_task_unittest.cc b/chrome/browser/web_applications/web_app_install_task_unittest.cc
index ce1024c9d..12b4bc6 100644
--- a/chrome/browser/web_applications/web_app_install_task_unittest.cc
+++ b/chrome/browser/web_applications/web_app_install_task_unittest.cc
@@ -17,7 +17,6 @@
#include "base/callback.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
@@ -56,6 +55,7 @@
#include "components/webapps/browser/installable/installable_data.h"
#include "components/webapps/browser/installable/installable_metrics.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -161,7 +161,7 @@
const std::string name,
const std::string description,
const GURL& scope,
- base::Optional<SkColor> theme_color,
+ absl::optional<SkColor> theme_color,
bool open_as_window) {
auto web_app_info = std::make_unique<WebApplicationInfo>();
@@ -178,7 +178,7 @@
void CreateRendererAppInfo(const GURL& url,
const std::string name,
const std::string description) {
- CreateRendererAppInfo(url, name, description, GURL(), base::nullopt,
+ CreateRendererAppInfo(url, name, description, GURL(), absl::nullopt,
/*open_as_window*/ true);
}
@@ -370,7 +370,7 @@
const std::string name,
const std::string description,
const GURL& scope,
- base::Optional<SkColor> theme_color,
+ absl::optional<SkColor> theme_color,
bool open_as_window,
bool run_on_os_login) {
auto web_app_info = std::make_unique<WebApplicationInfo>();
@@ -397,7 +397,7 @@
const std::string manifest_name = "Manifest Name";
const std::string description = "Description";
const GURL scope = GURL("https://example.com/scope");
- const base::Optional<SkColor> theme_color = 0xFFAABBCC;
+ const absl::optional<SkColor> theme_color = 0xFFAABBCC;
const AppId app_id = GenerateAppIdFromURL(url);
@@ -552,8 +552,8 @@
const AppId app_id = GenerateAppIdFromURL(manifest_start_url);
const std::string manifest_name = "Name from Manifest";
const GURL manifest_scope = GURL("https://example.com/scope");
- const base::Optional<SkColor> manifest_theme_color = 0xAABBCCDD;
- const base::Optional<SkColor> expected_theme_color = 0xFFBBCCDD; // Opaque.
+ const absl::optional<SkColor> manifest_theme_color = 0xAABBCCDD;
+ const absl::optional<SkColor> expected_theme_color = 0xFFBBCCDD; // Opaque.
const auto display_mode = DisplayMode::kMinimalUi;
{
@@ -977,7 +977,7 @@
const std::string name = "Name";
const std::string description = "Description";
const GURL scope("https://example.com/scope");
- const base::Optional<SkColor> theme_color = 0xAABBCCDD;
+ const absl::optional<SkColor> theme_color = 0xAABBCCDD;
CreateRendererAppInfo(url, name, description, /*scope*/ GURL{}, theme_color,
/*open_as_window*/ true);
@@ -1237,7 +1237,7 @@
const std::string name = "Name";
const std::string description = "Description";
const GURL scope = GURL("https://example.com/scope");
- const base::Optional<SkColor> theme_color = 0xFFAABBCC;
+ const absl::optional<SkColor> theme_color = 0xFFAABBCC;
const AppId app_id = GenerateAppIdFromURL(url);
@@ -1284,7 +1284,7 @@
const std::string name = "Name";
const std::string description = "Description";
const GURL scope = GURL("https://example.com/scope");
- const base::Optional<SkColor> theme_color = 0xFFAABBCC;
+ const absl::optional<SkColor> theme_color = 0xFFAABBCC;
const AppId app_id = GenerateAppIdFromURL(url);
diff --git a/chrome/browser/web_applications/web_app_installation_utils.cc b/chrome/browser/web_applications/web_app_installation_utils.cc
index 156695d6..ed561e2 100644
--- a/chrome/browser/web_applications/web_app_installation_utils.cc
+++ b/chrome/browser/web_applications/web_app_installation_utils.cc
@@ -11,7 +11,6 @@
#include "base/check.h"
#include "base/feature_list.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/web_applications/components/app_registrar.h"
#include "chrome/browser/web_applications/components/os_integration_manager.h"
@@ -24,6 +23,7 @@
#include "components/services/app_service/public/cpp/file_handler.h"
#include "components/services/app_service/public/cpp/protocol_handler_info.h"
#include "components/services/app_service/public/cpp/share_target.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
diff --git a/chrome/browser/web_applications/web_app_installation_utils_unittest.cc b/chrome/browser/web_applications/web_app_installation_utils_unittest.cc
index 1ac2218..d414a891 100644
--- a/chrome/browser/web_applications/web_app_installation_utils_unittest.cc
+++ b/chrome/browser/web_applications/web_app_installation_utils_unittest.cc
@@ -9,7 +9,6 @@
#include <utility>
#include <vector>
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
@@ -18,6 +17,7 @@
#include "chrome/browser/web_applications/web_app.h"
#include "components/services/app_service/public/cpp/share_target.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "url/gurl.h"
@@ -54,8 +54,8 @@
EXPECT_TRUE(web_app->background_color().has_value());
EXPECT_EQ(*web_app->background_color(), SK_ColorMAGENTA);
- web_app_info.theme_color = base::nullopt;
- web_app_info.background_color = base::nullopt;
+ web_app_info.theme_color = absl::nullopt;
+ web_app_info.background_color = absl::nullopt;
SetWebAppManifestFields(web_app_info, *web_app);
EXPECT_FALSE(web_app->theme_color().has_value());
EXPECT_FALSE(web_app->background_color().has_value());
@@ -130,7 +130,7 @@
EXPECT_TRUE(share_target.params.files.empty());
}
- web_app_info.share_target = base::nullopt;
+ web_app_info.share_target = absl::nullopt;
SetWebAppManifestFields(web_app_info, *web_app);
EXPECT_FALSE(web_app->share_target().has_value());
}
diff --git a/chrome/browser/web_applications/web_app_mover.cc b/chrome/browser/web_applications/web_app_mover.cc
index 0d3291c1..841a240 100644
--- a/chrome/browser/web_applications/web_app_mover.cc
+++ b/chrome/browser/web_applications/web_app_mover.cc
@@ -244,7 +244,7 @@
base::ScopedClosureRunner complete_callback_runner,
std::unique_ptr<content::WebContents> web_contents,
InstallManager::InstallableCheckResult result,
- base::Optional<AppId> app_id) {
+ absl::optional<AppId> app_id) {
switch (result) {
case InstallManager::InstallableCheckResult::kAlreadyInstalled:
LOG(WARNING) << "App already installed.";
diff --git a/chrome/browser/web_applications/web_app_mover.h b/chrome/browser/web_applications/web_app_mover.h
index 301a925..2d74dee 100644
--- a/chrome/browser/web_applications/web_app_mover.h
+++ b/chrome/browser/web_applications/web_app_mover.h
@@ -11,13 +11,13 @@
#include "base/callback_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/scoped_observation.h"
#include "chrome/browser/web_applications/components/install_manager.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "components/keep_alive_registry/scoped_keep_alive.h"
#include "components/sync/driver/sync_service.h"
#include "components/sync/driver/sync_service_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
class Profile;
@@ -85,7 +85,7 @@
base::ScopedClosureRunner complete_callback_runner,
std::unique_ptr<content::WebContents> web_contents,
InstallManager::InstallableCheckResult result,
- base::Optional<AppId> app_id);
+ absl::optional<AppId> app_id);
void OnAllUninstalled(
base::ScopedClosureRunner complete_callback_runner,
diff --git a/chrome/browser/web_applications/web_app_proto_utils.cc b/chrome/browser/web_applications/web_app_proto_utils.cc
index 21bfbcef..694e66d 100644
--- a/chrome/browser/web_applications/web_app_proto_utils.cc
+++ b/chrome/browser/web_applications/web_app_proto_utils.cc
@@ -10,13 +10,13 @@
namespace {
-base::Optional<blink::mojom::ManifestImageResource_Purpose>
+absl::optional<blink::mojom::ManifestImageResource_Purpose>
SyncPurposeToBlinkPurpose(sync_pb::WebAppIconInfo_Purpose purpose) {
switch (purpose) {
// Treat UNSPECIFIED purpose as invalid. It means a new purpose was added
// that this client does not understand.
case sync_pb::WebAppIconInfo_Purpose_UNSPECIFIED:
- return base::nullopt;
+ return absl::nullopt;
case sync_pb::WebAppIconInfo_Purpose_ANY:
return blink::mojom::ManifestImageResource_Purpose::ANY;
case sync_pb::WebAppIconInfo_Purpose_MASKABLE:
@@ -40,7 +40,7 @@
} // namespace
-base::Optional<std::vector<WebApplicationIconInfo>> ParseWebAppIconInfos(
+absl::optional<std::vector<WebApplicationIconInfo>> ParseWebAppIconInfos(
const char* container_name_for_logging,
RepeatedIconInfosProto icon_infos_proto) {
std::vector<WebApplicationIconInfo> icon_infos;
@@ -52,20 +52,20 @@
if (!icon_info_proto.has_url()) {
DLOG(ERROR) << container_name_for_logging << " IconInfo has missing url";
- return base::nullopt;
+ return absl::nullopt;
}
icon_info.url = GURL(icon_info_proto.url());
if (!icon_info.url.is_valid()) {
DLOG(ERROR) << container_name_for_logging << " IconInfo has invalid url: "
<< icon_info.url.possibly_invalid_spec();
- return base::nullopt;
+ return absl::nullopt;
}
if (icon_info_proto.has_purpose()) {
- base::Optional<blink::mojom::ManifestImageResource_Purpose> opt_purpose =
+ absl::optional<blink::mojom::ManifestImageResource_Purpose> opt_purpose =
SyncPurposeToBlinkPurpose(icon_info_proto.purpose());
if (!opt_purpose.has_value())
- return base::nullopt;
+ return absl::nullopt;
icon_info.purpose = opt_purpose.value();
} else {
// Treat unset purpose as ANY so that old data without the field is
@@ -115,7 +115,7 @@
return icon_info_proto;
}
-base::Optional<WebApp::SyncFallbackData> ParseSyncFallbackDataStruct(
+absl::optional<WebApp::SyncFallbackData> ParseSyncFallbackDataStruct(
const sync_pb::WebAppSpecifics& sync_proto) {
WebApp::SyncFallbackData parsed_sync_fallback_data;
@@ -129,14 +129,14 @@
if (!parsed_sync_fallback_data.scope.is_valid()) {
DLOG(ERROR) << "WebAppSpecifics scope has invalid url: "
<< parsed_sync_fallback_data.scope.possibly_invalid_spec();
- return base::nullopt;
+ return absl::nullopt;
}
}
- base::Optional<std::vector<WebApplicationIconInfo>> parsed_icon_infos =
+ absl::optional<std::vector<WebApplicationIconInfo>> parsed_icon_infos =
ParseWebAppIconInfos("WebAppSpecifics", sync_proto.icon_infos());
if (!parsed_icon_infos.has_value())
- return base::nullopt;
+ return absl::nullopt;
parsed_sync_fallback_data.icon_infos = std::move(parsed_icon_infos.value());
diff --git a/chrome/browser/web_applications/web_app_proto_utils.h b/chrome/browser/web_applications/web_app_proto_utils.h
index 4546b8a..bdab41df 100644
--- a/chrome/browser/web_applications/web_app_proto_utils.h
+++ b/chrome/browser/web_applications/web_app_proto_utils.h
@@ -7,10 +7,10 @@
#include <vector>
-#include "base/optional.h"
#include "chrome/browser/web_applications/proto/web_app.pb.h"
#include "chrome/browser/web_applications/web_app.h"
#include "components/sync/protocol/web_app_specifics.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace web_app {
@@ -19,7 +19,7 @@
using RepeatedIconInfosProto =
const ::google::protobuf::RepeatedPtrField<::sync_pb::WebAppIconInfo>;
-base::Optional<std::vector<WebApplicationIconInfo>> ParseWebAppIconInfos(
+absl::optional<std::vector<WebApplicationIconInfo>> ParseWebAppIconInfos(
const char* container_name_for_logging,
RepeatedIconInfosProto icon_infos_proto);
@@ -30,7 +30,7 @@
sync_pb::WebAppIconInfo WebAppIconInfoToSyncProto(
const WebApplicationIconInfo& icon_info);
-base::Optional<WebApp::SyncFallbackData> ParseSyncFallbackDataStruct(
+absl::optional<WebApp::SyncFallbackData> ParseSyncFallbackDataStruct(
const sync_pb::WebAppSpecifics& sync_proto);
::sync_pb::WebAppSpecifics::UserDisplayMode ToWebAppSpecificsUserDisplayMode(
diff --git a/chrome/browser/web_applications/web_app_proto_utils_unittest.cc b/chrome/browser/web_applications/web_app_proto_utils_unittest.cc
index 29ecd6e63..b7d05f1 100644
--- a/chrome/browser/web_applications/web_app_proto_utils_unittest.cc
+++ b/chrome/browser/web_applications/web_app_proto_utils_unittest.cc
@@ -57,7 +57,7 @@
EXPECT_EQ(sync_pb::WebAppSpecifics::BROWSER, sync_proto.user_display_mode());
// Check the fields were parsed into the web app struct.
- base::Optional<WebApp::SyncFallbackData> fallback_data =
+ absl::optional<WebApp::SyncFallbackData> fallback_data =
ParseSyncFallbackDataStruct(sync_proto);
ASSERT_TRUE(fallback_data.has_value());
EXPECT_EQ(kAppName, fallback_data->name);
@@ -77,7 +77,7 @@
sync_proto.set_user_display_mode(sync_pb::WebAppSpecifics::BROWSER);
// Parse the proto.
- base::Optional<WebApp::SyncFallbackData> fallback_data =
+ absl::optional<WebApp::SyncFallbackData> fallback_data =
ParseSyncFallbackDataStruct(sync_proto);
// Check the fields were parsed.
@@ -108,7 +108,7 @@
icon_info_2->set_purpose(sync_pb::WebAppIconInfo_Purpose_MASKABLE);
// Parse the proto.
- base::Optional<WebApp::SyncFallbackData> fallback_data =
+ absl::optional<WebApp::SyncFallbackData> fallback_data =
ParseSyncFallbackDataStruct(sync_proto);
// Check the fields were parsed.
diff --git a/chrome/browser/web_applications/web_app_registrar.cc b/chrome/browser/web_applications/web_app_registrar.cc
index e86130f..566a1fd3 100644
--- a/chrome/browser/web_applications/web_app_registrar.cc
+++ b/chrome/browser/web_applications/web_app_registrar.cc
@@ -108,16 +108,16 @@
return web_app ? web_app->description() : std::string();
}
-base::Optional<SkColor> WebAppRegistrar::GetAppThemeColor(
+absl::optional<SkColor> WebAppRegistrar::GetAppThemeColor(
const AppId& app_id) const {
auto* web_app = GetAppById(app_id);
- return web_app ? web_app->theme_color() : base::nullopt;
+ return web_app ? web_app->theme_color() : absl::nullopt;
}
-base::Optional<SkColor> WebAppRegistrar::GetAppBackgroundColor(
+absl::optional<SkColor> WebAppRegistrar::GetAppBackgroundColor(
const AppId& app_id) const {
auto* web_app = GetAppById(app_id);
- return web_app ? web_app->background_color() : base::nullopt;
+ return web_app ? web_app->background_color() : absl::nullopt;
}
const GURL& WebAppRegistrar::GetAppStartUrl(const AppId& app_id) const {
@@ -158,18 +158,18 @@
return web_app ? web_app->file_handler_permission_blocked() : false;
}
-base::Optional<GURL> WebAppRegistrar::GetAppScopeInternal(
+absl::optional<GURL> WebAppRegistrar::GetAppScopeInternal(
const AppId& app_id) const {
auto* web_app = GetAppById(app_id);
if (!web_app)
- return base::nullopt;
+ return absl::nullopt;
// TODO(crbug.com/910016): Treat shortcuts as PWAs.
// Shortcuts on the WebApp system have empty scopes, while the implementation
- // of IsShortcutApp just checks if the scope is |base::nullopt|, so make sure
- // we return |base::nullopt| rather than an empty scope.
+ // of IsShortcutApp just checks if the scope is |absl::nullopt|, so make sure
+ // we return |absl::nullopt| rather than an empty scope.
if (web_app->scope().is_empty())
- return base::nullopt;
+ return absl::nullopt;
return web_app->scope();
}
diff --git a/chrome/browser/web_applications/web_app_registrar.h b/chrome/browser/web_applications/web_app_registrar.h
index 34165b63..22d326f 100644
--- a/chrome/browser/web_applications/web_app_registrar.h
+++ b/chrome/browser/web_applications/web_app_registrar.h
@@ -12,12 +12,12 @@
#include <vector>
#include "base/check_op.h"
-#include "base/optional.h"
#include "chrome/browser/profiles/profile_manager_observer.h"
#include "chrome/browser/web_applications/components/app_registrar.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/components/web_application_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace web_app {
@@ -56,8 +56,8 @@
int CountUserInstalledApps() const override;
std::string GetAppShortName(const AppId& app_id) const override;
std::string GetAppDescription(const AppId& app_id) const override;
- base::Optional<SkColor> GetAppThemeColor(const AppId& app_id) const override;
- base::Optional<SkColor> GetAppBackgroundColor(
+ absl::optional<SkColor> GetAppThemeColor(const AppId& app_id) const override;
+ absl::optional<SkColor> GetAppBackgroundColor(
const AppId& app_id) const override;
const GURL& GetAppStartUrl(const AppId& app_id) const override;
const std::string* GetAppLaunchQueryParams(
@@ -70,7 +70,7 @@
const AppId& app_id) const override;
bool IsAppFileHandlerPermissionBlocked(
const web_app::AppId& app_id) const override;
- base::Optional<GURL> GetAppScopeInternal(const AppId& app_id) const override;
+ absl::optional<GURL> GetAppScopeInternal(const AppId& app_id) const override;
DisplayMode GetAppDisplayMode(const AppId& app_id) const override;
DisplayMode GetAppUserDisplayMode(const AppId& app_id) const override;
std::vector<DisplayMode> GetAppDisplayModeOverride(
diff --git a/chrome/browser/web_applications/web_app_registrar_unittest.cc b/chrome/browser/web_applications/web_app_registrar_unittest.cc
index e4988c4..4708473 100644
--- a/chrome/browser/web_applications/web_app_registrar_unittest.cc
+++ b/chrome/browser/web_applications/web_app_registrar_unittest.cc
@@ -13,7 +13,6 @@
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/bind.h"
@@ -26,6 +25,7 @@
#include "chrome/browser/web_applications/web_app_registry_update.h"
#include "chrome/browser/web_applications/web_app_sync_bridge.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace web_app {
@@ -176,7 +176,7 @@
const std::string name = "Name";
const std::string description = "Description";
const GURL scope = GURL("https://example.com/scope");
- const base::Optional<SkColor> theme_color = 0xAABBCCDD;
+ const absl::optional<SkColor> theme_color = 0xAABBCCDD;
const GURL start_url2 = GURL("https://example.com/path2");
const AppId app_id2 = GenerateAppIdFromURL(start_url2);
@@ -389,7 +389,7 @@
const AppId app_id = GenerateAppIdFromURL(start_url);
const std::string name = "Name";
const std::string description = "Description";
- const base::Optional<SkColor> theme_color = 0xAABBCCDD;
+ const absl::optional<SkColor> theme_color = 0xAABBCCDD;
const auto display_mode = DisplayMode::kMinimalUi;
const auto user_display_mode = DisplayMode::kStandalone;
std::vector<DisplayMode> display_mode_override;
@@ -535,12 +535,12 @@
app1->SetScope(app1_scope);
RegisterApp(std::move(app1));
- base::Optional<AppId> app2_match =
+ absl::optional<AppId> app2_match =
registrar().FindAppWithUrlInScope(app2_scope);
DCHECK(app2_match);
EXPECT_EQ(*app2_match, app1_id);
- base::Optional<AppId> app3_match =
+ absl::optional<AppId> app3_match =
registrar().FindAppWithUrlInScope(app3_scope);
EXPECT_FALSE(app3_match);
@@ -552,11 +552,11 @@
app3->SetScope(app3_scope);
RegisterApp(std::move(app3));
- base::Optional<AppId> origin_match =
+ absl::optional<AppId> origin_match =
registrar().FindAppWithUrlInScope(origin_scope);
EXPECT_FALSE(origin_match);
- base::Optional<AppId> app1_match =
+ absl::optional<AppId> app1_match =
registrar().FindAppWithUrlInScope(app1_scope);
DCHECK(app1_match);
EXPECT_EQ(*app1_match, app1_id);
@@ -589,11 +589,11 @@
auto app1 = CreateWebApp(app1_launch.spec());
RegisterApp(std::move(app1));
- base::Optional<AppId> app2_match =
+ absl::optional<AppId> app2_match =
registrar().FindAppWithUrlInScope(app2_page);
EXPECT_FALSE(app2_match);
- base::Optional<AppId> app3_match =
+ absl::optional<AppId> app3_match =
registrar().FindAppWithUrlInScope(app3_page);
EXPECT_FALSE(app3_match);
@@ -603,18 +603,18 @@
auto app3 = CreateWebApp(app3_launch.spec());
RegisterApp(std::move(app3));
- base::Optional<AppId> app1_match =
+ absl::optional<AppId> app1_match =
registrar().FindAppWithUrlInScope(app1_page);
DCHECK(app1_match);
- EXPECT_EQ(app1_match, base::Optional<AppId>(app1_id));
+ EXPECT_EQ(app1_match, absl::optional<AppId>(app1_id));
app2_match = registrar().FindAppWithUrlInScope(app2_page);
DCHECK(app2_match);
- EXPECT_EQ(app2_match, base::Optional<AppId>(app2_id));
+ EXPECT_EQ(app2_match, absl::optional<AppId>(app2_id));
app3_match = registrar().FindAppWithUrlInScope(app3_page);
DCHECK(app3_match);
- EXPECT_EQ(app3_match, base::Optional<AppId>(app3_id));
+ EXPECT_EQ(app3_match, absl::optional<AppId>(app3_id));
}
TEST_F(WebAppRegistrarTest, FindPwaOverShortcut) {
@@ -638,10 +638,10 @@
auto app3 = CreateWebApp(app3_launch.spec());
RegisterApp(std::move(app3));
- base::Optional<AppId> app2_match =
+ absl::optional<AppId> app2_match =
registrar().FindAppWithUrlInScope(app2_page);
DCHECK(app2_match);
- EXPECT_EQ(app2_match, base::Optional<AppId>(app2_id));
+ EXPECT_EQ(app2_match, absl::optional<AppId>(app2_id));
}
TEST_F(WebAppRegistrarTest, BeginAndCommitUpdate) {
diff --git a/chrome/browser/web_applications/web_app_sync_bridge.cc b/chrome/browser/web_applications/web_app_sync_bridge.cc
index 6d3c29d..ece386a 100644
--- a/chrome/browser/web_applications/web_app_sync_bridge.cc
+++ b/chrome/browser/web_applications/web_app_sync_bridge.cc
@@ -13,7 +13,6 @@
#include "base/containers/flat_set.h"
#include "base/logging.h"
#include "base/metrics/user_metrics.h"
-#include "base/optional.h"
#include "base/types/pass_key.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/web_applications/components/app_registry_controller.h"
@@ -36,6 +35,7 @@
#include "components/sync/model/model_type_store.h"
#include "components/sync/model/mutable_data_batch.h"
#include "components/sync/protocol/web_app_specifics.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace web_app {
@@ -73,9 +73,9 @@
DLOG(ERROR) << "ApplySyncDataToApp: start_url parse error.";
return;
}
- base::Optional<std::string> manifest_id = base::nullopt;
+ absl::optional<std::string> manifest_id = absl::nullopt;
if (sync_data.has_manifest_id())
- manifest_id = base::Optional<std::string>(sync_data.manifest_id());
+ manifest_id = absl::optional<std::string>(sync_data.manifest_id());
if (app->app_id() != GenerateAppId(manifest_id, start_url)) {
DLOG(ERROR) << "ApplySyncDataToApp: app_id doesn't match id generated "
@@ -105,7 +105,7 @@
app->SetUserLaunchOrdinal(
syncer::StringOrdinal(sync_data.user_launch_ordinal()));
- base::Optional<WebApp::SyncFallbackData> parsed_sync_fallback_data =
+ absl::optional<WebApp::SyncFallbackData> parsed_sync_fallback_data =
ParseSyncFallbackDataStruct(sync_data);
if (!parsed_sync_fallback_data.has_value()) {
// ParseSyncFallbackDataStruct() reports any errors.
@@ -234,7 +234,7 @@
if (!web_app)
return;
- base::Optional<WebAppChromeOsData> cros_data = web_app->chromeos_data();
+ absl::optional<WebAppChromeOsData> cros_data = web_app->chromeos_data();
DCHECK(cros_data.has_value());
if (cros_data->is_disabled != is_disabled) {
@@ -613,7 +613,7 @@
return syncer::ModelTypeStore::WriteBatch::CreateMetadataChangeList();
}
-base::Optional<syncer::ModelError> WebAppSyncBridge::MergeSyncData(
+absl::optional<syncer::ModelError> WebAppSyncBridge::MergeSyncData(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_data) {
CHECK(change_processor()->IsTrackingMetadata());
@@ -631,10 +631,10 @@
base::DoNothing());
ApplySyncChangesToRegistrar(std::move(update_local_data));
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<syncer::ModelError> WebAppSyncBridge::ApplySyncChanges(
+absl::optional<syncer::ModelError> WebAppSyncBridge::ApplySyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) {
CHECK(change_processor()->IsTrackingMetadata());
@@ -648,7 +648,7 @@
base::DoNothing());
ApplySyncChangesToRegistrar(std::move(update_local_data));
- return base::nullopt;
+ return absl::nullopt;
}
void WebAppSyncBridge::GetData(StorageKeyList storage_keys,
@@ -684,9 +684,9 @@
DCHECK(!start_url.is_empty());
DCHECK(start_url.is_valid());
- base::Optional<std::string> manifest_id = base::nullopt;
+ absl::optional<std::string> manifest_id = absl::nullopt;
if (specifics.has_manifest_id())
- manifest_id = base::Optional<std::string>(specifics.manifest_id());
+ manifest_id = absl::optional<std::string>(specifics.manifest_id());
return GenerateAppId(manifest_id, start_url);
}
diff --git a/chrome/browser/web_applications/web_app_sync_bridge.h b/chrome/browser/web_applications/web_app_sync_bridge.h
index eea42ab..5123291 100644
--- a/chrome/browser/web_applications/web_app_sync_bridge.h
+++ b/chrome/browser/web_applications/web_app_sync_bridge.h
@@ -9,7 +9,6 @@
#include "base/callback_forward.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/web_applications/components/app_registry_controller.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/web_app.h"
@@ -17,6 +16,7 @@
#include "components/sync/engine/entity_data.h"
#include "components/sync/model/entity_change.h"
#include "components/sync/model/model_type_sync_bridge.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
namespace base {
@@ -99,10 +99,10 @@
// syncer::ModelTypeSyncBridge:
std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList()
override;
- base::Optional<syncer::ModelError> MergeSyncData(
+ absl::optional<syncer::ModelError> MergeSyncData(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_data) override;
- base::Optional<syncer::ModelError> ApplySyncChanges(
+ absl::optional<syncer::ModelError> ApplySyncChanges(
std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
syncer::EntityChangeList entity_changes) override;
void GetData(StorageKeyList storage_keys, DataCallback callback) override;
diff --git a/chrome/browser/web_applications/web_app_unittest.cc b/chrome/browser/web_applications/web_app_unittest.cc
index 5a87277b..05f7d3e 100644
--- a/chrome/browser/web_applications/web_app_unittest.cc
+++ b/chrome/browser/web_applications/web_app_unittest.cc
@@ -16,7 +16,7 @@
std::string WebAppToPlatformAgnosticString(std::unique_ptr<WebApp> web_app) {
// Force this to be nullopt to avoid platform specific differences.
- web_app->SetWebAppChromeOsData(base::nullopt);
+ web_app->SetWebAppChromeOsData(absl::nullopt);
std::stringstream ss;
ss << *web_app;
return ss.str();
diff --git a/chrome/browser/webauthn/android/cable_module_android.cc b/chrome/browser/webauthn/android/cable_module_android.cc
index 54cfc1f..51371e42 100644
--- a/chrome/browser/webauthn/android/cable_module_android.cc
+++ b/chrome/browser/webauthn/android/cable_module_android.cc
@@ -199,14 +199,14 @@
registry->RegisterStringPref(kRootSecretPrefName, std::string());
}
-base::Optional<syncer::DeviceInfo::PhoneAsASecurityKeyInfo>
+absl::optional<syncer::DeviceInfo::PhoneAsASecurityKeyInfo>
GetSyncDataIfRegistered() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (!base::FeatureList::IsEnabled(device::kWebAuthCableSecondFactor) ||
!Java_CableAuthenticatorModuleProvider_canDeviceSupportCable(
base::android::AttachCurrentThread())) {
- return base::nullopt;
+ return absl::nullopt;
}
RegistrationState* state = GetRegistrationState();
@@ -215,7 +215,7 @@
// |state| will signal to Sync that something changed and this
// function will be called again.
state->SignalSyncWhenReady();
- return base::nullopt;
+ return absl::nullopt;
}
syncer::DeviceInfo::PhoneAsASecurityKeyInfo paask_info;
diff --git a/chrome/browser/webauthn/android/cable_module_android.h b/chrome/browser/webauthn/android/cable_module_android.h
index ea4174a..2b9d7e8 100644
--- a/chrome/browser/webauthn/android/cable_module_android.h
+++ b/chrome/browser/webauthn/android/cable_module_android.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_WEBAUTHN_ANDROID_CABLE_MODULE_ANDROID_H_
#define CHROME_BROWSER_WEBAUTHN_ANDROID_CABLE_MODULE_ANDROID_H_
-#include "base/optional.h"
#include "components/sync_device_info/device_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class PrefRegistrySimple;
@@ -24,7 +24,7 @@
// Sync that will let other Chrome instances contact this device to perform
// security key transactions, or it returns |nullopt| if that information is
// not yet ready.
-base::Optional<syncer::DeviceInfo::PhoneAsASecurityKeyInfo>
+absl::optional<syncer::DeviceInfo::PhoneAsASecurityKeyInfo>
GetSyncDataIfRegistered();
// RegisterLocalState registers prefs with the local-state represented by
diff --git a/chrome/browser/webauthn/authenticator_request_dialog_model.cc b/chrome/browser/webauthn/authenticator_request_dialog_model.cc
index 4ef2716..734fef39 100644
--- a/chrome/browser/webauthn/authenticator_request_dialog_model.cc
+++ b/chrome/browser/webauthn/authenticator_request_dialog_model.cc
@@ -139,7 +139,7 @@
}
void AuthenticatorRequestDialogModel::EphemeralState::Reset() {
- selected_authenticator_id_ = base::nullopt;
+ selected_authenticator_id_ = absl::nullopt;
saved_authenticators_.RemoveAllAuthenticators();
users_.clear();
}
@@ -676,7 +676,7 @@
return mechanisms_;
}
-base::Optional<size_t> AuthenticatorRequestDialogModel::current_mechanism()
+absl::optional<size_t> AuthenticatorRequestDialogModel::current_mechanism()
const {
return current_mechanism_;
}
@@ -729,8 +729,8 @@
void AuthenticatorRequestDialogModel::StartInlineBioEnrollment(
base::OnceClosure next_callback) {
- max_bio_samples_ = base::nullopt;
- bio_samples_remaining_ = base::nullopt;
+ max_bio_samples_ = absl::nullopt;
+ bio_samples_remaining_ = absl::nullopt;
bio_enrollment_callback_ = std::move(next_callback);
SetCurrentStep(Step::kInlineBioEnrollment);
}
@@ -761,10 +761,10 @@
}
void AuthenticatorRequestDialogModel::set_cable_transport_info(
- base::Optional<bool> extension_is_v2,
+ absl::optional<bool> extension_is_v2,
std::vector<PairedPhone> paired_phones,
base::RepeatingCallback<void(size_t)> contact_phone_callback,
- const base::Optional<std::string>& cable_qr_string) {
+ const absl::optional<std::string>& cable_qr_string) {
DCHECK(paired_phones.empty() || contact_phone_callback);
if (extension_is_v2.has_value()) {
@@ -837,7 +837,7 @@
device::FidoRequestType::kGetAssertion;
// priority_transport contains the transport that should be activated
// immediately, if this is a getAssertion.
- base::Optional<AuthenticatorTransport> priority_transport;
+ absl::optional<AuthenticatorTransport> priority_transport;
if (base::Contains(transport_availability_.available_transports,
AuthenticatorTransport::kInternal) &&
diff --git a/chrome/browser/webauthn/authenticator_request_dialog_model.h b/chrome/browser/webauthn/authenticator_request_dialog_model.h
index b9a59d9..f88c90d 100644
--- a/chrome/browser/webauthn/authenticator_request_dialog_model.h
+++ b/chrome/browser/webauthn/authenticator_request_dialog_model.h
@@ -13,7 +13,6 @@
#include "base/containers/span.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "base/types/strong_alias.h"
#include "build/build_config.h"
@@ -26,6 +25,7 @@
#include "device/fido/fido_types.h"
#include "device/fido/pin.h"
#include "device/fido/public_key_credential_user_entity.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace gfx {
@@ -249,7 +249,7 @@
return transport_availability()->is_ble_powered;
}
- const base::Optional<std::string>& selected_authenticator_id() const {
+ const absl::optional<std::string>& selected_authenticator_id() const {
return ephemeral_state_.selected_authenticator_id_;
}
@@ -443,7 +443,7 @@
// current_mechanism returns the index into |mechanisms| of the most recently
// activated mechanism, or nullopt if there isn't one.
- base::Optional<size_t> current_mechanism() const;
+ absl::optional<size_t> current_mechanism() const;
// ContactPhoneForTesting triggers a contact for a phone with the given name.
// Only for unittests. UI should use |mechanisms()| to enumerate the
@@ -482,15 +482,15 @@
void FinishCollectToken();
uint32_t min_pin_length() const { return min_pin_length_; }
device::pin::PINEntryError pin_error() const { return pin_error_; }
- base::Optional<int> pin_attempts() const { return pin_attempts_; }
+ absl::optional<int> pin_attempts() const { return pin_attempts_; }
void StartInlineBioEnrollment(base::OnceClosure next_callback);
void OnSampleCollected(int bio_samples_remaining);
void OnBioEnrollmentDone();
- base::Optional<int> max_bio_samples() { return max_bio_samples_; }
- base::Optional<int> bio_samples_remaining() { return bio_samples_remaining_; }
+ absl::optional<int> max_bio_samples() { return max_bio_samples_; }
+ absl::optional<int> bio_samples_remaining() { return bio_samples_remaining_; }
- base::Optional<int> uv_attempts() const { return uv_attempts_; }
+ absl::optional<int> uv_attempts() const { return uv_attempts_; }
void RequestAttestationPermission(bool is_enterprise_attestation,
base::OnceCallback<void(bool)> callback);
@@ -504,10 +504,10 @@
}
void set_cable_transport_info(
- base::Optional<bool> extension_is_v2,
+ absl::optional<bool> extension_is_v2,
std::vector<PairedPhone> paired_phones,
base::RepeatingCallback<void(size_t)> contact_phone_callback,
- const base::Optional<std::string>& cable_qr_string);
+ const absl::optional<std::string>& cable_qr_string);
bool win_native_api_enabled() const {
return transport_availability_.has_win_native_api_authenticator;
@@ -534,7 +534,7 @@
// Represents the id of the Bluetooth authenticator that the user is trying
// to connect to or conduct WebAuthN request to via the WebAuthN UI.
- base::Optional<std::string> selected_authenticator_id_;
+ absl::optional<std::string> selected_authenticator_id_;
// Stores a list of |AuthenticatorReference| values such that a request can
// be dispatched dispatched after some UI interaction. This is useful for
@@ -591,12 +591,12 @@
// pending_step_ holds requested steps until the UI is shown. The UI is only
// shown once the TransportAvailabilityInfo is available, but authenticators
// may request, e.g., PIN entry prior to that.
- base::Optional<Step> pending_step_;
+ absl::optional<Step> pending_step_;
// Determines which step to continue with once the Blueooth adapter is
// powered. Only set while the |current_step_| is either kBlePowerOnManual,
// kBlePowerOnAutomatic.
- base::Optional<Step> next_step_once_ble_powered_;
+ absl::optional<Step> next_step_once_ble_powered_;
base::ObserverList<Observer>::Unchecked observers_;
@@ -606,21 +606,21 @@
RequestCallback request_callback_;
base::RepeatingClosure bluetooth_adapter_power_on_callback_;
- base::Optional<int> max_bio_samples_;
- base::Optional<int> bio_samples_remaining_;
+ absl::optional<int> max_bio_samples_;
+ absl::optional<int> bio_samples_remaining_;
base::OnceClosure bio_enrollment_callback_;
base::OnceCallback<void(std::u16string)> pin_callback_;
uint32_t min_pin_length_ = device::kMinPinLength;
device::pin::PINEntryError pin_error_ = device::pin::PINEntryError::kNoError;
- base::Optional<int> pin_attempts_;
- base::Optional<int> uv_attempts_;
+ absl::optional<int> pin_attempts_;
+ absl::optional<int> uv_attempts_;
base::OnceCallback<void(bool)> attestation_callback_;
base::OnceCallback<void(device::AuthenticatorGetAssertionResponse)>
selection_callback_;
- base::Optional<device::PublicKeyCredentialUserEntity> preselected_account_;
+ absl::optional<device::PublicKeyCredentialUserEntity> preselected_account_;
// True if this request should use the non-modal location bar bubble UI
// instead of the page-modal, regular UI.
@@ -641,10 +641,10 @@
// current_mechanism_ contains the index of the most recently activated
// mechanism.
- base::Optional<size_t> current_mechanism_;
+ absl::optional<size_t> current_mechanism_;
// cable_ui_type_ contains the type of UI to display for a caBLE transaction.
- base::Optional<CableUIType> cable_ui_type_;
+ absl::optional<CableUIType> cable_ui_type_;
// paired_phones_ contains details of caBLEv2-paired phones from both Sync and
// QR-based pairing. The entries are sorted by name.
@@ -658,7 +658,7 @@
// to contact the indicated phone.
base::RepeatingCallback<void(size_t)> contact_phone_callback_;
- base::Optional<std::string> cable_qr_string_;
+ absl::optional<std::string> cable_qr_string_;
// win_native_api_already_tried_ is true if the Windows-native UI has been
// displayed already and the user cancelled it. In this case, we shouldn't
// jump straight to showing it again.
diff --git a/chrome/browser/webauthn/authenticator_request_dialog_model_unittest.cc b/chrome/browser/webauthn/authenticator_request_dialog_model_unittest.cc
index ddc6648..998f6d05f 100644
--- a/chrome/browser/webauthn/authenticator_request_dialog_model_unittest.cc
+++ b/chrome/browser/webauthn/authenticator_request_dialog_model_unittest.cc
@@ -12,7 +12,6 @@
#include "base/containers/contains.h"
#include "base/containers/flat_set.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/string_util.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
@@ -26,6 +25,7 @@
#include "device/fido/public_key_credential_user_entity.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -232,7 +232,7 @@
AuthenticatorRequestDialogModel model(/*relying_party_id=*/"example.com");
- base::Optional<bool> has_v2_cable_extension;
+ absl::optional<bool> has_v2_cable_extension;
if (base::Contains(test.params,
TransportAvailabilityParam::kHasCableV1Extension)) {
has_v2_cable_extension = false;
@@ -252,7 +252,7 @@
phones.emplace_back(name, /*contact_id=*/0, public_key);
}
model.set_cable_transport_info(has_v2_cable_extension, std::move(phones),
- base::DoNothing(), base::nullopt);
+ base::DoNothing(), absl::nullopt);
}
model.StartFlow(std::move(transports_info),
@@ -358,7 +358,7 @@
BluetoothAdapterPowerOnCallbackReceiver power_receiver;
AuthenticatorRequestDialogModel model(/*relying_party_id=*/"example.com");
model.SetBluetoothAdapterPowerOnCallback(power_receiver.GetCallback());
- model.set_cable_transport_info(true, {}, base::DoNothing(), base::nullopt);
+ model.set_cable_transport_info(true, {}, base::DoNothing(), absl::nullopt);
model.StartFlow(std::move(transports_info),
/*use_location_bar_bubble=*/false);
EXPECT_EQ(test_case.expected_final_step, model.current_step());
@@ -388,7 +388,7 @@
AuthenticatorRequestDialogModel model(/*relying_party_id=*/"example.com");
model.AddObserver(&mock_observer);
model.SetBluetoothAdapterPowerOnCallback(power_receiver.GetCallback());
- model.set_cable_transport_info(true, {}, base::DoNothing(), base::nullopt);
+ model.set_cable_transport_info(true, {}, base::DoNothing(), absl::nullopt);
model.StartFlow(std::move(transports_info),
/*use_location_bar_bubble=*/false);
@@ -429,7 +429,7 @@
BluetoothAdapterPowerOnCallbackReceiver power_receiver;
AuthenticatorRequestDialogModel model(/*relying_party_id=*/"example.com");
model.SetBluetoothAdapterPowerOnCallback(power_receiver.GetCallback());
- model.set_cable_transport_info(true, {}, base::DoNothing(), base::nullopt);
+ model.set_cable_transport_info(true, {}, base::DoNothing(), absl::nullopt);
model.StartFlow(std::move(transports_info),
/*use_location_bar_bubble=*/false);
@@ -575,15 +575,15 @@
static const uint8_t kAppParam[32] = {0};
static const uint8_t kSignatureCounter[4] = {0};
device::AuthenticatorData auth_data(kAppParam, /*flags=*/0, kSignatureCounter,
- base::nullopt);
+ absl::nullopt);
device::AuthenticatorGetAssertionResponse response_1(
device::AuthenticatorData(kAppParam, /*flags=*/0, kSignatureCounter,
- base::nullopt),
+ absl::nullopt),
/*signature=*/{1});
response_1.user_entity = user_1;
device::AuthenticatorGetAssertionResponse response_2(
device::AuthenticatorData(kAppParam, /*flags=*/0, kSignatureCounter,
- base::nullopt),
+ absl::nullopt),
/*signature=*/{2});
response_2.user_entity = user_2;
diff --git a/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc b/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc
index a9fcb8c..40360f5 100644
--- a/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc
+++ b/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc
@@ -91,18 +91,18 @@
return ret;
}
-base::Optional<std::string> GetString(const base::Value& dict,
+absl::optional<std::string> GetString(const base::Value& dict,
const char* key) {
const base::Value* v = dict.FindKey(key);
if (!v || !v->is_string()) {
- return base::nullopt;
+ return absl::nullopt;
}
return v->GetString();
}
template <size_t N>
bool CopyBytestring(std::array<uint8_t, N>* out,
- base::Optional<std::string> value) {
+ absl::optional<std::string> value) {
if (!value) {
return false;
}
@@ -117,7 +117,7 @@
}
bool CopyBytestring(std::vector<uint8_t>* out,
- base::Optional<std::string> value) {
+ absl::optional<std::string> value) {
if (!value) {
return false;
}
@@ -132,7 +132,7 @@
return true;
}
-bool CopyString(std::string* out, base::Optional<std::string> value) {
+bool CopyString(std::string* out, absl::optional<std::string> value) {
if (!value) {
return false;
}
@@ -179,7 +179,7 @@
ChromeWebAuthenticationDelegate::~ChromeWebAuthenticationDelegate() = default;
-base::Optional<std::string>
+absl::optional<std::string>
ChromeWebAuthenticationDelegate::MaybeGetRelyingPartyIdOverride(
const std::string& claimed_relying_party_id,
const url::Origin& caller_origin) {
@@ -187,7 +187,7 @@
constexpr char kCryptotokenOrigin[] =
"chrome-extension://kmendfapggjehodndflmmgagdbamhnfd";
if (caller_origin == url::Origin::Create(GURL(kCryptotokenOrigin))) {
- return base::nullopt;
+ return absl::nullopt;
}
// Otherwise, allow extensions to use WebAuthn and map their origins
@@ -197,12 +197,12 @@
// identifier because no flexibility is permitted. If a caller doesn't
// specify an RP ID then Blink defaults the value to the origin's host.
if (claimed_relying_party_id != caller_origin.host()) {
- return base::nullopt;
+ return absl::nullopt;
}
return caller_origin.Serialize();
}
- return base::nullopt;
+ return absl::nullopt;
}
bool ChromeWebAuthenticationDelegate::ShouldPermitIndividualAttestation(
@@ -250,7 +250,7 @@
std::move(metadata_secret)};
}
-base::Optional<ChromeWebAuthenticationDelegate::TouchIdAuthenticatorConfig>
+absl::optional<ChromeWebAuthenticationDelegate::TouchIdAuthenticatorConfig>
ChromeWebAuthenticationDelegate::GetTouchIdAuthenticatorConfig(
content::BrowserContext* browser_context) {
return TouchIdAuthenticatorConfigForProfile(
@@ -269,11 +269,11 @@
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
-base::Optional<bool> ChromeWebAuthenticationDelegate::
+absl::optional<bool> ChromeWebAuthenticationDelegate::
IsUserVerifyingPlatformAuthenticatorAvailableOverride(
content::RenderFrameHost* render_frame_host) {
// If the testing API is active, its override takes precedence.
- base::Optional<bool> testing_api_override =
+ absl::optional<bool> testing_api_override =
content::WebAuthenticationDelegate::
IsUserVerifyingPlatformAuthenticatorAvailableOverride(
render_frame_host);
@@ -297,7 +297,7 @@
return false;
}
- return base::nullopt;
+ return absl::nullopt;
}
// ---------------------------------------------------------------------
@@ -515,9 +515,9 @@
(!cable_extension_permitted &&
base::FeatureList::IsEnabled(device::kWebAuthCableSecondFactor));
- base::Optional<std::array<uint8_t, device::cablev2::kQRKeySize>>
+ absl::optional<std::array<uint8_t, device::cablev2::kQRKeySize>>
qr_generator_key;
- base::Optional<std::string> qr_string;
+ absl::optional<std::string> qr_string;
if (non_extension_cablev2_enabled ||
(cablev2_extension_provided &&
base::FeatureList::IsEnabled(device::kWebAuthCableServerLink))) {
@@ -544,7 +544,7 @@
}
if (cable_extension_provided || non_extension_cablev2_enabled) {
- base::Optional<bool> extension_is_v2;
+ absl::optional<bool> extension_is_v2;
if (cable_extension_provided) {
extension_is_v2 = cablev2_extension_provided;
}
@@ -783,7 +783,7 @@
// DeviceInfo (if any) into a caBLEv2 pairing. It may return nullptr.
static std::unique_ptr<device::cablev2::Pairing> PairingFromSyncedDevice(
syncer::DeviceInfo* device) {
- const base::Optional<syncer::DeviceInfo::PhoneAsASecurityKeyInfo>&
+ const absl::optional<syncer::DeviceInfo::PhoneAsASecurityKeyInfo>&
maybe_paask_info = device->paask_info();
if (!maybe_paask_info) {
return nullptr;
diff --git a/chrome/browser/webauthn/chrome_authenticator_request_delegate.h b/chrome/browser/webauthn/chrome_authenticator_request_delegate.h
index a9a3206b..a5342f87 100644
--- a/chrome/browser/webauthn/chrome_authenticator_request_delegate.h
+++ b/chrome/browser/webauthn/chrome_authenticator_request_delegate.h
@@ -11,7 +11,6 @@
#include "base/callback.h"
#include "base/gtest_prod_util.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
@@ -21,6 +20,7 @@
#include "device/fido/cable/cable_discovery_data.h"
#include "device/fido/fido_request_handler_base.h"
#include "device/fido/fido_transport_protocol.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class Profile;
@@ -53,7 +53,7 @@
~ChromeWebAuthenticationDelegate() override;
// content::WebAuthenticationDelegate:
- base::Optional<std::string> MaybeGetRelyingPartyIdOverride(
+ absl::optional<std::string> MaybeGetRelyingPartyIdOverride(
const std::string& claimed_relying_party_id,
const url::Origin& caller_origin) override;
bool ShouldPermitIndividualAttestation(
@@ -63,14 +63,14 @@
content::RenderFrameHost* render_frame_host) override;
bool IsFocused(content::WebContents* web_contents) override;
#if defined(OS_MAC)
- base::Optional<TouchIdAuthenticatorConfig> GetTouchIdAuthenticatorConfig(
+ absl::optional<TouchIdAuthenticatorConfig> GetTouchIdAuthenticatorConfig(
content::BrowserContext* browser_context) override;
#endif // defined(OS_MAC)
#if BUILDFLAG(IS_CHROMEOS_ASH)
ChromeOSGenerateRequestIdCallback GetGenerateRequestIdCallback(
content::RenderFrameHost* render_frame_host) override;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
- base::Optional<bool> IsUserVerifyingPlatformAuthenticatorAvailableOverride(
+ absl::optional<bool> IsUserVerifyingPlatformAuthenticatorAvailableOverride(
content::RenderFrameHost* render_frame_host) override;
};
@@ -174,7 +174,7 @@
content::BrowserContext* GetBrowserContext() const;
- base::Optional<device::FidoTransportProtocol> GetLastTransportUsed() const;
+ absl::optional<device::FidoTransportProtocol> GetLastTransportUsed() const;
// ShouldPermitCableExtension returns true if the given |origin| may set a
// caBLE extension. This extension contains website-chosen BLE pairing
diff --git a/chrome/browser/webauthn/chrome_webauthn_browsertest.cc b/chrome/browser/webauthn/chrome_webauthn_browsertest.cc
index 824130a..46112d9 100644
--- a/chrome/browser/webauthn/chrome_webauthn_browsertest.cc
+++ b/chrome/browser/webauthn/chrome_webauthn_browsertest.cc
@@ -187,7 +187,7 @@
void set_cable_data(
device::FidoRequestType request_type,
std::vector<device::CableDiscoveryData> cable_data,
- const base::Optional<std::array<uint8_t, device::cablev2::kQRKeySize>>&
+ const absl::optional<std::array<uint8_t, device::cablev2::kQRKeySize>>&
qr_generator_key,
std::vector<std::unique_ptr<device::cablev2::Pairing>> v2_pairings)
override {
diff --git a/chrome/browser/webshare/chromeos/sharesheet_client.cc b/chrome/browser/webshare/chromeos/sharesheet_client.cc
index 2643034..d4d2d87 100644
--- a/chrome/browser/webshare/chromeos/sharesheet_client.cc
+++ b/chrome/browser/webshare/chromeos/sharesheet_client.cc
@@ -165,7 +165,7 @@
if (!web_contents() || error != blink::mojom::ShareError::OK) {
std::move(current_share_->callback).Run(error);
- current_share_ = base::nullopt;
+ current_share_ = absl::nullopt;
return;
}
@@ -195,7 +195,7 @@
std::move(current_share_->callback).Run(error);
PrepareDirectoryTask::ScheduleSharedFileDeletion(
std::move(current_share_->file_paths), base::TimeDelta::FromMinutes(0));
- current_share_ = base::nullopt;
+ current_share_ = absl::nullopt;
return;
}
@@ -214,7 +214,7 @@
PrepareDirectoryTask::ScheduleSharedFileDeletion(
std::move(current_share_->file_paths),
PrepareDirectoryTask::kSharedFileLifetime);
- current_share_ = base::nullopt;
+ current_share_ = absl::nullopt;
}
// static
@@ -256,7 +256,7 @@
}
void SharesheetClient::WebContentsDestroyed() {
- current_share_ = base::nullopt;
+ current_share_ = absl::nullopt;
}
} // namespace webshare
diff --git a/chrome/browser/webshare/chromeos/sharesheet_client.h b/chrome/browser/webshare/chromeos/sharesheet_client.h
index 1c7898c..d0b78e3 100644
--- a/chrome/browser/webshare/chromeos/sharesheet_client.h
+++ b/chrome/browser/webshare/chromeos/sharesheet_client.h
@@ -9,9 +9,9 @@
#include <vector>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/sharesheet/sharesheet_types.h"
#include "content/public/browser/web_contents_observer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/webshare/webshare.mojom.h"
#include "url/gurl.h"
@@ -87,7 +87,7 @@
std::unique_ptr<PrepareDirectoryTask> prepare_directory_task;
};
- base::Optional<CurrentShare> current_share_;
+ absl::optional<CurrentShare> current_share_;
base::WeakPtrFactory<SharesheetClient> weak_ptr_factory_{this};
};
diff --git a/chrome/browser/webshare/win/fake_data_transfer_manager_unittest.cc b/chrome/browser/webshare/win/fake_data_transfer_manager_unittest.cc
index 9b83bc0..504e53a 100644
--- a/chrome/browser/webshare/win/fake_data_transfer_manager_unittest.cc
+++ b/chrome/browser/webshare/win/fake_data_transfer_manager_unittest.cc
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
@@ -21,6 +20,7 @@
#include "chrome/browser/webshare/win/fake_uri_runtime_class_factory.h"
#include "testing/gtest/include/gtest/gtest-spi.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using ABI::Windows::ApplicationModel::DataTransfer::DataRequestedEventArgs;
using ABI::Windows::ApplicationModel::DataTransfer::DataTransferManager;
@@ -101,7 +101,7 @@
Microsoft::WRL::Make<FakeDataTransferManager>();
}
- base::Optional<base::win::ScopedWinrtInitializer> winrt_initializer_;
+ absl::optional<base::win::ScopedWinrtInitializer> winrt_initializer_;
ComPtr<FakeDataTransferManager> fake_data_transfer_manager_;
};
diff --git a/chrome/browser/win/conflicts/incompatible_applications_updater_unittest.cc b/chrome/browser/win/conflicts/incompatible_applications_updater_unittest.cc
index df7a492e..523cb2e 100644
--- a/chrome/browser/win/conflicts/incompatible_applications_updater_unittest.cc
+++ b/chrome/browser/win/conflicts/incompatible_applications_updater_unittest.cc
@@ -8,7 +8,6 @@
#include <string>
#include <utility>
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
@@ -23,6 +22,7 @@
#include "content/public/common/process_type.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -89,7 +89,7 @@
ModuleInfoData module_data;
module_data.module_properties |= ModuleInfoData::kPropertyLoadedModule;
module_data.process_types |= ProcessTypeToBit(content::PROCESS_TYPE_BROWSER);
- module_data.inspection_result = base::make_optional<ModuleInspectionResult>();
+ module_data.inspection_result = absl::make_optional<ModuleInspectionResult>();
return module_data;
}
@@ -390,7 +390,7 @@
// Simulate the module loading into the process.
ModuleInfoKey module_key(dll1_, 0, 0);
ModuleInfoData module_data;
- module_data.inspection_result = base::make_optional<ModuleInspectionResult>();
+ module_data.inspection_result = absl::make_optional<ModuleInspectionResult>();
incompatible_applications_updater->OnNewModuleFound(module_key, module_data);
incompatible_applications_updater->OnModuleDatabaseIdle();
RunLoopUntilIdle();
diff --git a/chrome/browser/win/conflicts/inspection_results_cache.cc b/chrome/browser/win/conflicts/inspection_results_cache.cc
index e8df1676..a2a1ccd6 100644
--- a/chrome/browser/win/conflicts/inspection_results_cache.cc
+++ b/chrome/browser/win/conflicts/inspection_results_cache.cc
@@ -190,10 +190,10 @@
DCHECK(insert_result.second);
}
-base::Optional<ModuleInspectionResult> GetInspectionResultFromCache(
+absl::optional<ModuleInspectionResult> GetInspectionResultFromCache(
const ModuleInfoKey& module_key,
InspectionResultsCache* inspection_results_cache) {
- base::Optional<ModuleInspectionResult> inspection_result;
+ absl::optional<ModuleInspectionResult> inspection_result;
auto it = inspection_results_cache->find(module_key);
if (it != inspection_results_cache->end()) {
diff --git a/chrome/browser/win/conflicts/inspection_results_cache.h b/chrome/browser/win/conflicts/inspection_results_cache.h
index 4c74d002..5f966637 100644
--- a/chrome/browser/win/conflicts/inspection_results_cache.h
+++ b/chrome/browser/win/conflicts/inspection_results_cache.h
@@ -9,8 +9,8 @@
#include <utility>
#include "base/feature_list.h"
-#include "base/optional.h"
#include "chrome/browser/win/conflicts/module_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class FilePath;
@@ -59,9 +59,9 @@
// Helper function to retrieve a ModuleInspectionResult from an existing cache.
// Also updates the time stamp of the element found to base::Time::Now().
-// Returns base::nullopt if the cache does not contains an entry for
+// Returns absl::nullopt if the cache does not contains an entry for
// |module_key|.
-base::Optional<ModuleInspectionResult> GetInspectionResultFromCache(
+absl::optional<ModuleInspectionResult> GetInspectionResultFromCache(
const ModuleInfoKey& module_key,
InspectionResultsCache* inspection_results_cache);
diff --git a/chrome/browser/win/conflicts/module_blocklist_cache_updater_unittest.cc b/chrome/browser/win/conflicts/module_blocklist_cache_updater_unittest.cc
index 983f7ed..2277eed 100644
--- a/chrome/browser/win/conflicts/module_blocklist_cache_updater_unittest.cc
+++ b/chrome/browser/win/conflicts/module_blocklist_cache_updater_unittest.cc
@@ -17,7 +17,6 @@
#include "base/files/file_util.h"
#include "base/hash/sha1.h"
#include "base/i18n/case_conversion.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_path_override.h"
@@ -32,6 +31,7 @@
#include "chrome/install_static/install_util.h"
#include "content/public/common/process_type.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -50,7 +50,7 @@
ModuleInfoData module_data;
module_data.module_properties |= ModuleInfoData::kPropertyLoadedModule;
module_data.process_types |= ProcessTypeToBit(content::PROCESS_TYPE_BROWSER);
- module_data.inspection_result = base::make_optional<ModuleInspectionResult>();
+ module_data.inspection_result = absl::make_optional<ModuleInspectionResult>();
return module_data;
}
diff --git a/chrome/browser/win/conflicts/module_database_unittest.cc b/chrome/browser/win/conflicts/module_database_unittest.cc
index 14e71d6..187fbbf4 100644
--- a/chrome/browser/win/conflicts/module_database_unittest.cc
+++ b/chrome/browser/win/conflicts/module_database_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "base/time/time.h"
#include "chrome/browser/win/conflicts/module_database_observer.h"
@@ -17,6 +16,7 @@
#include "chrome/test/base/testing_browser_process.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -80,7 +80,7 @@
ScopedTestingLocalState scoped_testing_local_state_;
- base::Optional<UtilWinImpl> util_win_impl_;
+ absl::optional<UtilWinImpl> util_win_impl_;
std::unique_ptr<ModuleDatabase> module_database_;
diff --git a/chrome/browser/win/conflicts/module_info.h b/chrome/browser/win/conflicts/module_info.h
index 25d0e88..2c04131 100644
--- a/chrome/browser/win/conflicts/module_info.h
+++ b/chrome/browser/win/conflicts/module_info.h
@@ -9,10 +9,10 @@
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "chrome/browser/win/conflicts/module_info_util.h"
#include "content/public/common/process_type.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// ModuleInfoKey and ModuleInfoData are used in pair by the ModuleDatabase to
// maintain information about a module, usually in a std::map.
@@ -109,7 +109,7 @@
uint32_t module_properties;
// The inspection result obtained via InspectModule().
- base::Optional<ModuleInspectionResult> inspection_result;
+ absl::optional<ModuleInspectionResult> inspection_result;
};
// Given a module located at |module_path|, returns a populated
diff --git a/chrome/browser/win/conflicts/module_inspector_unittest.cc b/chrome/browser/win/conflicts/module_inspector_unittest.cc
index c8a218b..90394c3f 100644
--- a/chrome/browser/win/conflicts/module_inspector_unittest.cc
+++ b/chrome/browser/win/conflicts/module_inspector_unittest.cc
@@ -14,13 +14,13 @@
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/scoped_path_override.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/services/util_win/util_win_impl.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -93,7 +93,7 @@
content::BrowserTaskEnvironment task_environment_;
// Holds a working UtilWin service implementation.
- base::Optional<UtilWinImpl> util_win_impl_;
+ absl::optional<UtilWinImpl> util_win_impl_;
private:
std::vector<ModuleInspectionResult> inspected_modules_;
diff --git a/chrome/browser/win/conflicts/module_list_filter_unittest.cc b/chrome/browser/win/conflicts/module_list_filter_unittest.cc
index 59596e8..633df6e 100644
--- a/chrome/browser/win/conflicts/module_list_filter_unittest.cc
+++ b/chrome/browser/win/conflicts/module_list_filter_unittest.cc
@@ -12,12 +12,12 @@
#include "base/files/scoped_temp_dir.h"
#include "base/hash/sha1.h"
#include "base/i18n/case_conversion.h"
-#include "base/optional.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/win/conflicts/module_info.h"
#include "chrome/browser/win/conflicts/proto/module_list.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -47,8 +47,8 @@
}
// Adds a module to the allowlist.
- void AddAllowlistedModule(base::Optional<std::u16string> basename,
- base::Optional<std::string> code_id) {
+ void AddAllowlistedModule(absl::optional<std::u16string> basename,
+ absl::optional<std::string> code_id) {
CHECK(basename.has_value() || code_id.has_value());
chrome::conflicts::ModuleGroup* module_group =
@@ -127,7 +127,7 @@
std::forward_as_tuple());
result.second.inspection_result =
- base::make_optional<ModuleInspectionResult>();
+ absl::make_optional<ModuleInspectionResult>();
result.second.inspection_result->basename =
module_path.BaseName().AsUTF16Unsafe();
@@ -240,7 +240,7 @@
ModuleListBuilder module_list_builder(module_list_path());
module_list_builder.AddAllowlistedModule(
- original.second.inspection_result->basename, base::nullopt);
+ original.second.inspection_result->basename, absl::nullopt);
ASSERT_TRUE(module_list_builder.Finalize());
ASSERT_TRUE(module_list_filter().Initialize(module_list_path()));
@@ -265,7 +265,7 @@
ModuleListBuilder module_list_builder(module_list_path());
module_list_builder.AddAllowlistedModule(
- base::nullopt, GetCodeId(original.first.module_time_date_stamp,
+ absl::nullopt, GetCodeId(original.first.module_time_date_stamp,
original.first.module_size));
ASSERT_TRUE(module_list_builder.Finalize());
diff --git a/chrome/browser/win/conflicts/third_party_conflicts_manager.h b/chrome/browser/win/conflicts/third_party_conflicts_manager.h
index 1669b90..7eea2490 100644
--- a/chrome/browser/win/conflicts/third_party_conflicts_manager.h
+++ b/chrome/browser/win/conflicts/third_party_conflicts_manager.h
@@ -13,12 +13,12 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/strings/string_piece_forward.h"
#include "chrome/browser/win/conflicts/module_blocklist_cache_updater.h"
#include "chrome/browser/win/conflicts/module_database_observer.h"
#include "chrome/browser/win/conflicts/module_list_component_updater.h"
#include "chrome/chrome_elf/third_party_dlls/packed_list_format.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class IncompatibleApplicationsUpdater;
class InstalledApplications;
@@ -232,7 +232,7 @@
incompatible_applications_updater_;
// The final state of this instance.
- base::Optional<State> terminal_state_;
+ absl::optional<State> terminal_state_;
// The callback that is invoked when |state_| changes.
OnInitializationCompleteCallback on_initialization_complete_callback_;
diff --git a/chrome/browser/win/conflicts/third_party_conflicts_manager_unittest.cc b/chrome/browser/win/conflicts/third_party_conflicts_manager_unittest.cc
index 23cb4d8e..61618a59 100644
--- a/chrome/browser/win/conflicts/third_party_conflicts_manager_unittest.cc
+++ b/chrome/browser/win/conflicts/third_party_conflicts_manager_unittest.cc
@@ -11,7 +11,6 @@
#include "base/callback_helpers.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
@@ -24,6 +23,7 @@
#include "chrome/test/base/testing_browser_process.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class ThirdPartyConflictsManagerTest : public testing::Test,
public ModuleDatabaseEventSource {
@@ -68,7 +68,7 @@
std::move(quit_closure).Run();
}
- const base::Optional<ThirdPartyConflictsManager::State>& final_state() {
+ const absl::optional<ThirdPartyConflictsManager::State>& final_state() {
return final_state_;
}
@@ -85,7 +85,7 @@
base::test::ScopedFeatureList scoped_feature_list_;
- base::Optional<ThirdPartyConflictsManager::State> final_state_;
+ absl::optional<ThirdPartyConflictsManager::State> final_state_;
DISALLOW_COPY_AND_ASSIGN(ThirdPartyConflictsManagerTest);
};
@@ -100,7 +100,7 @@
std::forward_as_tuple());
module_info.second.inspection_result =
- base::make_optional<ModuleInspectionResult>();
+ absl::make_optional<ModuleInspectionResult>();
return module_info;
}
diff --git a/chrome/chrome_cleaner/DEPS b/chrome/chrome_cleaner/DEPS
index f69b764..034833c 100644
--- a/chrome/chrome_cleaner/DEPS
+++ b/chrome/chrome_cleaner/DEPS
@@ -9,6 +9,7 @@
"+mojo/public",
"+sandbox/win/src",
"+testing",
+ "+third_party/abseil-cpp/absl",
"+third_party/protobuf/src/google/protobuf",
"+url",
]
diff --git a/chrome/chrome_cleaner/chrome_utils/extensions_util.cc b/chrome/chrome_cleaner/chrome_utils/extensions_util.cc
index e083cfc9..57e111d 100644
--- a/chrome/chrome_cleaner/chrome_utils/extensions_util.cc
+++ b/chrome/chrome_cleaner/chrome_utils/extensions_util.cc
@@ -19,7 +19,6 @@
#include "base/files/file_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/waitable_event.h"
#include "base/values.h"
@@ -30,6 +29,7 @@
#include "chrome/chrome_cleaner/os/registry_util.h"
#include "chrome/chrome_cleaner/os/system_util.h"
#include "chrome/chrome_cleaner/parsers/parser_utils/parse_tasks_remaining_counter.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// TODO(crbug.com/981388): See if there's anything that isn't used from
// system_report_component.cc that can be removed from this file.
@@ -102,8 +102,8 @@
std::vector<ExtensionPolicyRegistryEntry>* policies,
scoped_refptr<ParseTasksRemainingCounter> counter,
ContentType type,
- base::Optional<base::Value> json,
- const base::Optional<std::string>& error) {
+ absl::optional<base::Value> json,
+ const absl::optional<std::string>& error) {
base::ScopedClosureRunner closure(
base::BindOnce(&ParseTasksRemainingCounter::Decrement, counter.get()));
@@ -172,8 +172,8 @@
const base::FilePath& extensions_file,
std::vector<ExtensionPolicyFile>* policies,
scoped_refptr<ParseTasksRemainingCounter> counter,
- base::Optional<base::Value> json,
- const base::Optional<std::string>& error) {
+ absl::optional<base::Value> json,
+ const absl::optional<std::string>& error) {
base::ScopedClosureRunner closure(
base::BindOnce(&ParseTasksRemainingCounter::Decrement, counter.get()));
@@ -201,8 +201,8 @@
const base::FilePath& extensions_file,
std::vector<ExtensionPolicyFile>* policies,
scoped_refptr<ParseTasksRemainingCounter> counter,
- base::Optional<base::Value> json,
- const base::Optional<std::string>& error) {
+ absl::optional<base::Value> json,
+ const absl::optional<std::string>& error) {
base::ScopedClosureRunner closure(
base::BindOnce(&ParseTasksRemainingCounter::Decrement, counter.get()));
diff --git a/chrome/chrome_cleaner/chrome_utils/extensions_util.h b/chrome/chrome_cleaner/chrome_utils/extensions_util.h
index ac1f519..51418b94 100644
--- a/chrome/chrome_cleaner/chrome_utils/extensions_util.h
+++ b/chrome/chrome_cleaner/chrome_utils/extensions_util.h
@@ -12,10 +12,10 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/chrome_cleaner/os/registry_util.h"
#include "chrome/chrome_cleaner/parsers/json_parser/json_parser_api.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chrome_cleaner {
diff --git a/chrome/chrome_cleaner/ipc/mojo_chrome_prompt_ipc.cc b/chrome/chrome_cleaner/ipc/mojo_chrome_prompt_ipc.cc
index 5d6c454..51796ff6 100644
--- a/chrome/chrome_cleaner/ipc/mojo_chrome_prompt_ipc.cc
+++ b/chrome/chrome_cleaner/ipc/mojo_chrome_prompt_ipc.cc
@@ -129,7 +129,7 @@
// deleted.
(*chrome_prompt_service_)
->PromptUser(std::move(files_to_delete), std::move(registry_keys),
- base::nullopt, std::move(callback));
+ absl::nullopt, std::move(callback));
}
}
diff --git a/chrome/chrome_cleaner/ipc/mojo_chrome_prompt_ipc_unittest.cc b/chrome/chrome_cleaner/ipc/mojo_chrome_prompt_ipc_unittest.cc
index f08d3f3..fcd770a 100644
--- a/chrome/chrome_cleaner/ipc/mojo_chrome_prompt_ipc_unittest.cc
+++ b/chrome/chrome_cleaner/ipc/mojo_chrome_prompt_ipc_unittest.cc
@@ -95,8 +95,8 @@
void PromptUser(
const std::vector<base::FilePath>& files_to_delete,
- const base::Optional<std::vector<std::wstring>>& registry_keys,
- const base::Optional<std::vector<std::wstring>>& extension_ids,
+ const absl::optional<std::vector<std::wstring>>& registry_keys,
+ const absl::optional<std::vector<std::wstring>>& extension_ids,
mojom::ChromePrompt::PromptUserCallback callback) override {
EXPECT_NE(test_config_.uws_expected, files_to_delete.empty());
if (test_config_.uws_expected) {
diff --git a/chrome/chrome_cleaner/ipc/sandbox_unittest.cc b/chrome/chrome_cleaner/ipc/sandbox_unittest.cc
index 17d22fc1..10dcc48 100644
--- a/chrome/chrome_cleaner/ipc/sandbox_unittest.cc
+++ b/chrome/chrome_cleaner/ipc/sandbox_unittest.cc
@@ -16,7 +16,6 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/numerics/safe_conversions.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
@@ -31,6 +30,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chrome_cleaner {
diff --git a/chrome/chrome_cleaner/parsers/broker/json_parser_sandbox_setup_unittest.cc b/chrome/chrome_cleaner/parsers/broker/json_parser_sandbox_setup_unittest.cc
index 94cf2bc..fcec817 100644
--- a/chrome/chrome_cleaner/parsers/broker/json_parser_sandbox_setup_unittest.cc
+++ b/chrome/chrome_cleaner/parsers/broker/json_parser_sandbox_setup_unittest.cc
@@ -52,8 +52,8 @@
void ParseCallbackExpectedKeyValue(const std::string& expected_key,
const std::string& expected_value,
WaitableEvent* done,
- base::Optional<base::Value> value,
- const base::Optional<std::string>& error) {
+ absl::optional<base::Value> value,
+ const absl::optional<std::string>& error) {
ASSERT_FALSE(error.has_value());
ASSERT_TRUE(value.has_value());
ASSERT_TRUE(value->is_dict());
@@ -67,8 +67,8 @@
}
void ParseCallbackExpectedError(WaitableEvent* done,
- base::Optional<base::Value> value,
- const base::Optional<std::string>& error) {
+ absl::optional<base::Value> value,
+ const absl::optional<std::string>& error) {
ASSERT_TRUE(error.has_value());
EXPECT_FALSE(error->empty());
done->Signal();
diff --git a/chrome/chrome_cleaner/parsers/json_parser/json_parser_api.h b/chrome/chrome_cleaner/parsers/json_parser/json_parser_api.h
index 487e7f1..c00e33b 100644
--- a/chrome/chrome_cleaner/parsers/json_parser/json_parser_api.h
+++ b/chrome/chrome_cleaner/parsers/json_parser/json_parser_api.h
@@ -6,14 +6,14 @@
#define CHROME_CHROME_CLEANER_PARSERS_JSON_PARSER_JSON_PARSER_API_H_
#include "base/callback.h"
-#include "base/optional.h"
#include "base/values.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chrome_cleaner {
using ParseDoneCallback =
- base::OnceCallback<void(base::Optional<base::Value>,
- const base::Optional<std::string>&)>;
+ base::OnceCallback<void(absl::optional<base::Value>,
+ const absl::optional<std::string>&)>;
class JsonParserAPI {
public:
diff --git a/chrome/chrome_cleaner/parsers/json_parser/test_json_parser.cc b/chrome/chrome_cleaner/parsers/json_parser/test_json_parser.cc
index 3098237..9b846fcd 100644
--- a/chrome/chrome_cleaner/parsers/json_parser/test_json_parser.cc
+++ b/chrome/chrome_cleaner/parsers/json_parser/test_json_parser.cc
@@ -17,10 +17,10 @@
json, base::JSON_ALLOW_TRAILING_COMMAS |
base::JSON_REPLACE_INVALID_CHARACTERS);
if (value_with_error.value) {
- std::move(callback).Run(std::move(value_with_error.value), base::nullopt);
+ std::move(callback).Run(std::move(value_with_error.value), absl::nullopt);
} else {
std::move(callback).Run(
- base::nullopt, base::make_optional(value_with_error.error_message));
+ absl::nullopt, absl::make_optional(value_with_error.error_message));
}
}
diff --git a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser.cc b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser.cc
index 712a810..c1df8097 100644
--- a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser.cc
+++ b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser.cc
@@ -108,10 +108,10 @@
scoped_refptr<ParseTasksRemainingCounter> counter,
std::vector<ShortcutInformation>* found_shortcuts,
mojom::LnkParsingResult parsing_result,
- const base::Optional<std::wstring>& optional_file_path,
- const base::Optional<std::wstring>& optional_working_dir,
- const base::Optional<std::wstring>& optional_command_line_arguments,
- const base::Optional<std::wstring>& optional_icon_location,
+ const absl::optional<std::wstring>& optional_file_path,
+ const absl::optional<std::wstring>& optional_working_dir,
+ const absl::optional<std::wstring>& optional_command_line_arguments,
+ const absl::optional<std::wstring>& optional_icon_location,
int32_t icon_index) {
ShortcutInformation parsed_shortcut;
parsed_shortcut.lnk_path = lnk_path;
diff --git a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser.h b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser.h
index 4e8edb75..c3a05322 100644
--- a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser.h
+++ b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser.h
@@ -43,10 +43,10 @@
scoped_refptr<ParseTasksRemainingCounter> counter,
std::vector<ShortcutInformation>* found_shortcuts,
mojom::LnkParsingResult parsing_result,
- const base::Optional<std::wstring>& optional_file_path,
- const base::Optional<std::wstring>& optional_working_dir,
- const base::Optional<std::wstring>& optional_command_line_arguments,
- const base::Optional<std::wstring>& optional_icon_location,
+ const absl::optional<std::wstring>& optional_file_path,
+ const absl::optional<std::wstring>& optional_working_dir,
+ const absl::optional<std::wstring>& optional_command_line_arguments,
+ const absl::optional<std::wstring>& optional_icon_location,
int32_t icon_index);
base::Lock lock_;
diff --git a/chrome/chrome_cleaner/parsers/shortcut_parser/sandboxed_lnk_parser_test_util.cc b/chrome/chrome_cleaner/parsers/shortcut_parser/sandboxed_lnk_parser_test_util.cc
index bd52410..90b382e 100644
--- a/chrome/chrome_cleaner/parsers/shortcut_parser/sandboxed_lnk_parser_test_util.cc
+++ b/chrome/chrome_cleaner/parsers/shortcut_parser/sandboxed_lnk_parser_test_util.cc
@@ -55,10 +55,10 @@
mojom::LnkParsingResult* out_result_code,
base::OnceClosure callback,
mojom::LnkParsingResult result_code,
- const base::Optional<std::wstring>& optional_target_path,
- const base::Optional<std::wstring>& optional_working_dir,
- const base::Optional<std::wstring>& optional_command_line_arguments,
- const base::Optional<std::wstring>& optional_icon_location,
+ const absl::optional<std::wstring>& optional_target_path,
+ const absl::optional<std::wstring>& optional_working_dir,
+ const absl::optional<std::wstring>& optional_command_line_arguments,
+ const absl::optional<std::wstring>& optional_icon_location,
int32_t icon_index) {
*out_result_code = result_code;
if (optional_target_path.has_value())
diff --git a/chrome/chrome_cleaner/parsers/shortcut_parser/sandboxed_lnk_parser_test_util.h b/chrome/chrome_cleaner/parsers/shortcut_parser/sandboxed_lnk_parser_test_util.h
index 13a8d780..3ed05f60 100644
--- a/chrome/chrome_cleaner/parsers/shortcut_parser/sandboxed_lnk_parser_test_util.h
+++ b/chrome/chrome_cleaner/parsers/shortcut_parser/sandboxed_lnk_parser_test_util.h
@@ -34,10 +34,10 @@
mojom::LnkParsingResult* out_result_code,
base::OnceClosure callback,
mojom::LnkParsingResult result_code,
- const base::Optional<std::wstring>& optional_target_path,
- const base::Optional<std::wstring>& optional_working_dir,
- const base::Optional<std::wstring>& optional_command_line_arguments,
- const base::Optional<std::wstring>& optional_icon_location,
+ const absl::optional<std::wstring>& optional_target_path,
+ const absl::optional<std::wstring>& optional_working_dir,
+ const absl::optional<std::wstring>& optional_command_line_arguments,
+ const absl::optional<std::wstring>& optional_icon_location,
int32_t optional_icon_index);
} // namespace chrome_cleaner
diff --git a/chrome/chrome_cleaner/parsers/target/parser_impl.cc b/chrome/chrome_cleaner/parsers/target/parser_impl.cc
index 894d0e3b..7db38ae8 100644
--- a/chrome/chrome_cleaner/parsers/target/parser_impl.cc
+++ b/chrome/chrome_cleaner/parsers/target/parser_impl.cc
@@ -28,11 +28,11 @@
json, base::JSON_ALLOW_TRAILING_COMMAS |
base::JSON_REPLACE_INVALID_CHARACTERS);
if (parsed_json.value) {
- std::move(callback).Run(std::move(parsed_json.value), base::nullopt);
+ std::move(callback).Run(std::move(parsed_json.value), absl::nullopt);
} else {
std::move(callback).Run(
- base::nullopt,
- base::make_optional(std::move(parsed_json.error_message)));
+ absl::nullopt,
+ absl::make_optional(std::move(parsed_json.error_message)));
}
}
@@ -42,10 +42,10 @@
if (!shortcut_handle.IsValid()) {
LOG(ERROR) << "Unable to get raw file HANDLE from mojo.";
std::move(callback).Run(mojom::LnkParsingResult::INVALID_HANDLE,
- base::make_optional<std::wstring>(),
- base::make_optional<std::wstring>(),
- base::make_optional<std::wstring>(),
- base::make_optional<std::wstring>(),
+ absl::make_optional<std::wstring>(),
+ absl::make_optional<std::wstring>(),
+ absl::make_optional<std::wstring>(),
+ absl::make_optional<std::wstring>(),
/*icon_index=*/-1);
return;
}
@@ -56,18 +56,18 @@
if (result != mojom::LnkParsingResult::SUCCESS) {
LOG(ERROR) << "Error parsing the shortcut";
- std::move(callback).Run(result, base::make_optional<std::wstring>(),
- base::make_optional<std::wstring>(),
- base::make_optional<std::wstring>(),
- base::make_optional<std::wstring>(),
+ std::move(callback).Run(result, absl::make_optional<std::wstring>(),
+ absl::make_optional<std::wstring>(),
+ absl::make_optional<std::wstring>(),
+ absl::make_optional<std::wstring>(),
/*icon_index=*/-1);
return;
}
std::move(callback).Run(
- result, base::make_optional<std::wstring>(parsed_shortcut.target_path),
- base::make_optional<std::wstring>(parsed_shortcut.working_dir),
- base::make_optional<std::wstring>(parsed_shortcut.command_line_arguments),
- base::make_optional<std::wstring>(parsed_shortcut.icon_location),
+ result, absl::make_optional<std::wstring>(parsed_shortcut.target_path),
+ absl::make_optional<std::wstring>(parsed_shortcut.working_dir),
+ absl::make_optional<std::wstring>(parsed_shortcut.command_line_arguments),
+ absl::make_optional<std::wstring>(parsed_shortcut.icon_location),
parsed_shortcut.icon_index);
}
diff --git a/chrome/chrome_cleaner/parsers/target/parser_impl_unittest.cc b/chrome/chrome_cleaner/parsers/target/parser_impl_unittest.cc
index 5075349..cb26ad4 100644
--- a/chrome/chrome_cleaner/parsers/target/parser_impl_unittest.cc
+++ b/chrome/chrome_cleaner/parsers/target/parser_impl_unittest.cc
@@ -92,8 +92,8 @@
sandboxed_json_parser_.Parse(
kTestJsonText,
base::BindOnce(
- [](WaitableEvent* done, base::Optional<base::Value> value,
- const base::Optional<std::string>& error) {
+ [](WaitableEvent* done, absl::optional<base::Value> value,
+ const absl::optional<std::string>& error) {
ASSERT_FALSE(error.has_value());
ASSERT_TRUE(value.has_value());
ASSERT_TRUE(value->is_dict());
@@ -115,8 +115,8 @@
sandboxed_json_parser_.Parse(
kInvalidJsonText,
base::BindOnce(
- [](WaitableEvent* done, base::Optional<base::Value> value,
- const base::Optional<std::string>& error) {
+ [](WaitableEvent* done, absl::optional<base::Value> value,
+ const absl::optional<std::string>& error) {
ASSERT_TRUE(error.has_value());
EXPECT_FALSE(error->empty());
done->Signal();
diff --git a/chrome/common/cloud_print/cloud_print_helpers.cc b/chrome/common/cloud_print/cloud_print_helpers.cc
index 7af0802..98d73e1 100644
--- a/chrome/common/cloud_print/cloud_print_helpers.cc
+++ b/chrome/common/cloud_print/cloud_print_helpers.cc
@@ -189,7 +189,7 @@
base::Value ParseResponseJSON(const std::string& response_data,
bool* succeeded) {
- base::Optional<base::Value> message_value =
+ absl::optional<base::Value> message_value =
base::JSONReader::Read(response_data);
if (!message_value || !message_value->is_dict())
return base::Value();
diff --git a/chrome/common/custom_handlers/protocol_handler.cc b/chrome/common/custom_handlers/protocol_handler.cc
index 99475b7..a09681e1 100644
--- a/chrome/common/custom_handlers/protocol_handler.cc
+++ b/chrome/common/custom_handlers/protocol_handler.cc
@@ -108,12 +108,12 @@
blink::ProtocolHandlerSecurityLevel::kStrict;
value->GetString("protocol", &protocol);
value->GetString("url", &url);
- base::Optional<base::Time> time_value =
+ absl::optional<base::Time> time_value =
util::ValueToTime(value->FindKey("last_modified"));
// Treat invalid times as the default value.
if (time_value)
time = *time_value;
- base::Optional<int> security_level_value =
+ absl::optional<int> security_level_value =
value->FindIntPath("security_level");
if (security_level_value) {
security_level =
diff --git a/chrome/common/custom_handlers/protocol_handler.h b/chrome/common/custom_handlers/protocol_handler.h
index 6ab8a9b..9ba2615 100644
--- a/chrome/common/custom_handlers/protocol_handler.h
+++ b/chrome/common/custom_handlers/protocol_handler.h
@@ -83,7 +83,7 @@
const std::string& protocol() const { return protocol_; }
const GURL& url() const { return url_;}
- const base::Optional<std::string>& web_app_id() const { return web_app_id_; }
+ const absl::optional<std::string>& web_app_id() const { return web_app_id_; }
const base::Time& last_modified() const { return last_modified_; }
bool IsEmpty() const {
@@ -104,7 +104,7 @@
std::string protocol_;
GURL url_;
- base::Optional<std::string> web_app_id_;
+ absl::optional<std::string> web_app_id_;
base::Time last_modified_;
blink::ProtocolHandlerSecurityLevel security_level_;
};
diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc
index 3c1179f..e45a588c 100644
--- a/chrome/common/extensions/chrome_extensions_client.cc
+++ b/chrome/common/extensions/chrome_extensions_client.cc
@@ -252,7 +252,7 @@
}
}
-base::Optional<int> ChromeExtensionsClient::GetExtensionExtendedErrorCode()
+absl::optional<int> ChromeExtensionsClient::GetExtensionExtendedErrorCode()
const {
return static_cast<int>(ChromeResourceRequestBlockedReason::kExtension);
}
diff --git a/chrome/common/extensions/chrome_extensions_client.h b/chrome/common/extensions/chrome_extensions_client.h
index aa134ff..3352d3a 100644
--- a/chrome/common/extensions/chrome_extensions_client.h
+++ b/chrome/common/extensions/chrome_extensions_client.h
@@ -48,7 +48,7 @@
bool is_extension_active,
std::vector<network::mojom::CorsOriginPatternPtr>* origin_patterns)
const override;
- base::Optional<int> GetExtensionExtendedErrorCode() const override;
+ absl::optional<int> GetExtensionExtendedErrorCode() const override;
private:
const ChromePermissionMessageProvider permission_message_provider_;
diff --git a/chrome/common/extensions/manifest_handlers/app_theme_color_info.cc b/chrome/common/extensions/manifest_handlers/app_theme_color_info.cc
index dfad20c..8cabe98 100644
--- a/chrome/common/extensions/manifest_handlers/app_theme_color_info.cc
+++ b/chrome/common/extensions/manifest_handlers/app_theme_color_info.cc
@@ -23,11 +23,11 @@
AppThemeColorInfo::~AppThemeColorInfo() {}
// static
-base::Optional<SkColor> AppThemeColorInfo::GetThemeColor(
+absl::optional<SkColor> AppThemeColorInfo::GetThemeColor(
const Extension* extension) {
AppThemeColorInfo* info = static_cast<AppThemeColorInfo*>(
extension->GetManifestData(keys::kAppThemeColor));
- return info ? info->theme_color : base::Optional<SkColor>();
+ return info ? info->theme_color : absl::optional<SkColor>();
}
AppThemeColorHandler::AppThemeColorHandler() {}
diff --git a/chrome/common/extensions/manifest_handlers/app_theme_color_info.h b/chrome/common/extensions/manifest_handlers/app_theme_color_info.h
index 12eafad..9027117 100644
--- a/chrome/common/extensions/manifest_handlers/app_theme_color_info.h
+++ b/chrome/common/extensions/manifest_handlers/app_theme_color_info.h
@@ -6,9 +6,9 @@
#define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_APP_THEME_COLOR_INFO_H_
#include "base/macros.h"
-#include "base/optional.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_handler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
namespace extensions {
@@ -18,10 +18,10 @@
AppThemeColorInfo();
~AppThemeColorInfo() override;
- static base::Optional<SkColor> GetThemeColor(const Extension* extension);
+ static absl::optional<SkColor> GetThemeColor(const Extension* extension);
// The color to use for the browser frame.
- base::Optional<SkColor> theme_color;
+ absl::optional<SkColor> theme_color;
};
// Parses the "app.theme_color" manifest key.
diff --git a/chrome/common/mac/app_mode_chrome_locator.mm b/chrome/common/mac/app_mode_chrome_locator.mm
index 7e5f3fa..d477d5c 100644
--- a/chrome/common/mac/app_mode_chrome_locator.mm
+++ b/chrome/common/mac/app_mode_chrome_locator.mm
@@ -10,10 +10,10 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/mac/foundation_util.h"
-#include "base/optional.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/mac/app_mode_common.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace app_mode {
@@ -24,7 +24,7 @@
bool is_new_app_structure;
};
-base::Optional<PathAndStructure> GetFrameworkDylibPathAndStructure(
+absl::optional<PathAndStructure> GetFrameworkDylibPathAndStructure(
NSString* bundle_path,
NSString* version) {
// NEW STYLE:
@@ -49,7 +49,7 @@
if ([[NSFileManager defaultManager] fileExistsAtPath:path])
return PathAndStructure{path, false};
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace
@@ -75,7 +75,7 @@
return false;
// Try to get the version requested, if present.
- base::Optional<PathAndStructure> framework_path_and_structure;
+ absl::optional<PathAndStructure> framework_path_and_structure;
if (!version_str.empty()) {
framework_path_and_structure = GetFrameworkDylibPathAndStructure(
cr_bundle_path, base::SysUTF8ToNSString(version_str));
diff --git a/chrome/common/mac/service_management.h b/chrome/common/mac/service_management.h
index 8867df6..61c19cf 100644
--- a/chrome/common/mac/service_management.h
+++ b/chrome/common/mac/service_management.h
@@ -8,7 +8,7 @@
#include <string>
#include <vector>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace mac {
namespace services {
@@ -19,7 +19,7 @@
~JobInfo();
std::string program;
- base::Optional<int> pid;
+ absl::optional<int> pid;
};
struct JobCheckinInfo {
diff --git a/chrome/common/media/cdm_registration.cc b/chrome/common/media/cdm_registration.cc
index 5c4155e..3850b5f0 100644
--- a/chrome/common/media/cdm_registration.cc
+++ b/chrome/common/media/cdm_registration.cc
@@ -266,7 +266,7 @@
// TODO(xhwang): Get the version from the DLL.
VLOG(1) << "Registering " << kMediaFoundationWidevineCdmDisplayName;
cdms->push_back(content::CdmInfo(
- kWidevineKeySystem, Robustness::kHardwareSecure, base::nullopt,
+ kWidevineKeySystem, Robustness::kHardwareSecure, absl::nullopt,
/*supports_sub_key_systems=*/false,
kMediaFoundationWidevineCdmDisplayName, kMediaFoundationWidevineCdmGuid,
base::Version(), widevine_cdm_path,
diff --git a/chrome/common/pref_names_util.cc b/chrome/common/pref_names_util.cc
index e2ecef8..98d62b0 100644
--- a/chrome/common/pref_names_util.cc
+++ b/chrome/common/pref_names_util.cc
@@ -47,9 +47,9 @@
return true;
}
-base::Optional<ui::CaptionStyle> GetCaptionStyleFromPrefs(PrefService* prefs) {
+absl::optional<ui::CaptionStyle> GetCaptionStyleFromPrefs(PrefService* prefs) {
if (!prefs) {
- return base::nullopt;
+ return absl::nullopt;
}
ui::CaptionStyle style;
diff --git a/chrome/common/pref_names_util.h b/chrome/common/pref_names_util.h
index b0c0177..f22204a 100644
--- a/chrome/common/pref_names_util.h
+++ b/chrome/common/pref_names_util.h
@@ -23,7 +23,7 @@
std::string* script);
// Constructs the CaptionStyle struct from the caption-related preferences.
-base::Optional<ui::CaptionStyle> GetCaptionStyleFromPrefs(PrefService* prefs);
+absl::optional<ui::CaptionStyle> GetCaptionStyleFromPrefs(PrefService* prefs);
} // namespace pref_names_util
diff --git a/chrome/common/printing/printer_capabilities.cc b/chrome/common/printing/printer_capabilities.cc
index 7054cd8..57ad9fe89 100644
--- a/chrome/common/printing/printer_capabilities.cc
+++ b/chrome/common/printing/printer_capabilities.cc
@@ -197,13 +197,13 @@
crash_keys::ScopedPrinterInfo crash_key(
print_backend->GetPrinterDriverInfo(device_name));
- auto caps = base::make_optional<PrinterSemanticCapsAndDefaults>();
+ auto caps = absl::make_optional<PrinterSemanticCapsAndDefaults>();
if (print_backend->GetPrinterSemanticCapsAndDefaults(device_name, &*caps) !=
mojom::ResultCode::kSuccess) {
// Failed to get capabilities, but proceed to assemble the settings to
// return what information we do have.
LOG(WARNING) << "Failed to get capabilities for " << device_name;
- caps = base::nullopt;
+ caps = absl::nullopt;
}
return AssemblePrinterSettings(device_name, basic_info, user_defined_papers,
diff --git a/chrome/common/printing/printer_capabilities_unittest.cc b/chrome/common/printing/printer_capabilities_unittest.cc
index 5dffa14..893cdda 100644
--- a/chrome/common/printing/printer_capabilities_unittest.cc
+++ b/chrome/common/printing/printer_capabilities_unittest.cc
@@ -47,10 +47,10 @@
const std::string* vendor = paper_dict.FindStringKey("vendor_id");
ASSERT_TRUE(vendor);
EXPECT_EQ(expected_vendor, *vendor);
- base::Optional<int> width = paper_dict.FindIntKey("width_microns");
+ absl::optional<int> width = paper_dict.FindIntKey("width_microns");
ASSERT_TRUE(width.has_value());
EXPECT_EQ(expected_size.width(), width.value());
- base::Optional<int> height = paper_dict.FindIntKey("height_microns");
+ absl::optional<int> height = paper_dict.FindIntKey("height_microns");
ASSERT_TRUE(height.has_value());
EXPECT_EQ(expected_size.height(), height.value());
}
@@ -252,7 +252,7 @@
// Verify that pin is not supported.
const Value* pin = printer->FindKeyOfType("pin", Value::Type::DICTIONARY);
ASSERT_TRUE(pin);
- base::Optional<bool> pin_supported = pin->FindBoolKey("supported");
+ absl::optional<bool> pin_supported = pin->FindBoolKey("supported");
ASSERT_TRUE(pin_supported.has_value());
ASSERT_FALSE(pin_supported.value());
}
diff --git a/chrome/common/profiler/thread_profiler_configuration.cc b/chrome/common/profiler/thread_profiler_configuration.cc
index b9c534c..64ad4c6 100644
--- a/chrome/common/profiler/thread_profiler_configuration.cc
+++ b/chrome/common/profiler/thread_profiler_configuration.cc
@@ -33,11 +33,11 @@
// Returns the channel if this is a Chrome release, otherwise returns nullopt. A
// build is considered to be a Chrome release if it's official and has Chrome
// branding.
-base::Optional<version_info::Channel> GetReleaseChannel() {
+absl::optional<version_info::Channel> GetReleaseChannel() {
#if defined(OFFICIAL_BUILD) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
return chrome::GetChannel();
#else
- return base::nullopt;
+ return absl::nullopt;
#endif
}
@@ -71,7 +71,7 @@
return *child_process_configuration == kChildProcessProfileEnabled;
}
- const base::Optional<VariationGroup>& variation_group =
+ const absl::optional<VariationGroup>& variation_group =
absl::get<BrowserProcessConfiguration>(configuration_);
return EnableForVariationGroup(variation_group);
@@ -89,7 +89,7 @@
std::string* trial_name,
std::string* group_name) const {
DCHECK(absl::holds_alternative<BrowserProcessConfiguration>(configuration_));
- const base::Optional<VariationGroup>& variation_group =
+ const absl::optional<VariationGroup>& variation_group =
absl::get<BrowserProcessConfiguration>(configuration_);
if (!variation_group.has_value())
@@ -121,7 +121,7 @@
void ThreadProfilerConfiguration::AppendCommandLineSwitchForChildProcess(
base::CommandLine* child_process_command_line) const {
DCHECK(absl::holds_alternative<BrowserProcessConfiguration>(configuration_));
- const base::Optional<VariationGroup>& variation_group =
+ const absl::optional<VariationGroup>& variation_group =
absl::get<BrowserProcessConfiguration>(configuration_);
if (!EnableForVariationGroup(variation_group))
@@ -153,7 +153,7 @@
// static
bool ThreadProfilerConfiguration::EnableForVariationGroup(
- base::Optional<VariationGroup> variation_group) {
+ absl::optional<VariationGroup> variation_group) {
// Enable if assigned to a variation group, and the group is one of the groups
// that are to be enabled.
return variation_group.has_value() && (*variation_group == kProfileEnabled ||
@@ -189,13 +189,13 @@
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kDisableStackProfiler))
- return base::nullopt;
+ return absl::nullopt;
- const base::Optional<version_info::Channel> release_channel =
+ const absl::optional<version_info::Channel> release_channel =
GetReleaseChannel();
if (!platform_configuration.IsSupported(release_channel))
- return base::nullopt;
+ return absl::nullopt;
using RuntimeModuleState =
ThreadProfilerPlatformConfiguration::RuntimeModuleState;
diff --git a/chrome/common/profiler/thread_profiler_configuration.h b/chrome/common/profiler/thread_profiler_configuration.h
index 7cf8e450..27f56c5 100644
--- a/chrome/common/profiler/thread_profiler_configuration.h
+++ b/chrome/common/profiler/thread_profiler_configuration.h
@@ -8,9 +8,9 @@
#include <initializer_list>
#include <string>
-#include "base/optional.h"
#include "base/profiler/stack_sampling_profiler.h"
#include "components/metrics/call_stack_profile_params.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace base {
@@ -81,7 +81,7 @@
// The configuration state for the browser process. If !has_value() profiling
// is disabled and no variations state is reported. Otherwise profiling is
// enabled based on the VariationGroup and the variation state is reported.
- using BrowserProcessConfiguration = base::Optional<VariationGroup>;
+ using BrowserProcessConfiguration = absl::optional<VariationGroup>;
// The configuration state in child processes.
enum ChildProcessConfiguration {
@@ -104,7 +104,7 @@
// True if the profiler is to be enabled for |variation_group|.
static bool EnableForVariationGroup(
- base::Optional<VariationGroup> variation_group);
+ absl::optional<VariationGroup> variation_group);
// Randomly chooses a variation from the weighted variations. Weights are
// expected to sum to 100 as a sanity check.
diff --git a/chrome/common/profiler/thread_profiler_platform_configuration.cc b/chrome/common/profiler/thread_profiler_platform_configuration.cc
index b4bde9d..6d0e09ec 100644
--- a/chrome/common/profiler/thread_profiler_platform_configuration.cc
+++ b/chrome/common/profiler/thread_profiler_platform_configuration.cc
@@ -25,10 +25,10 @@
// ThreadProfilerPlatformConfiguration:
RuntimeModuleState GetRuntimeModuleState(
- base::Optional<version_info::Channel> release_channel) const override;
+ absl::optional<version_info::Channel> release_channel) const override;
RelativePopulations GetEnableRates(
- base::Optional<version_info::Channel> release_channel) const override;
+ absl::optional<version_info::Channel> release_channel) const override;
double GetChildProcessEnableFraction(
metrics::CallStackProfileParams::Process process) const override;
@@ -39,7 +39,7 @@
protected:
bool IsSupportedForChannel(
- base::Optional<version_info::Channel> release_channel) const override;
+ absl::optional<version_info::Channel> release_channel) const override;
bool browser_test_mode_enabled() const { return browser_test_mode_enabled_; }
@@ -53,13 +53,13 @@
ThreadProfilerPlatformConfiguration::RuntimeModuleState
DefaultPlatformConfiguration::GetRuntimeModuleState(
- base::Optional<version_info::Channel> release_channel) const {
+ absl::optional<version_info::Channel> release_channel) const {
return RuntimeModuleState::kModuleNotRequired;
}
ThreadProfilerPlatformConfiguration::RelativePopulations
DefaultPlatformConfiguration::GetEnableRates(
- base::Optional<version_info::Channel> release_channel) const {
+ absl::optional<version_info::Channel> release_channel) const {
CHECK(IsSupportedForChannel(release_channel));
if (!release_channel) {
@@ -103,7 +103,7 @@
}
bool DefaultPlatformConfiguration::IsSupportedForChannel(
- base::Optional<version_info::Channel> release_channel) const {
+ absl::optional<version_info::Channel> release_channel) const {
// The profiler is always supported for local builds and the CQ.
if (!release_channel)
return true;
@@ -125,10 +125,10 @@
// DefaultPlatformConfiguration:
RuntimeModuleState GetRuntimeModuleState(
- base::Optional<version_info::Channel> release_channel) const override;
+ absl::optional<version_info::Channel> release_channel) const override;
RelativePopulations GetEnableRates(
- base::Optional<version_info::Channel> release_channel) const override;
+ absl::optional<version_info::Channel> release_channel) const override;
void RequestRuntimeModuleInstall() const override;
@@ -141,7 +141,7 @@
protected:
bool IsSupportedForChannel(
- base::Optional<version_info::Channel> release_channel) const override;
+ absl::optional<version_info::Channel> release_channel) const override;
};
AndroidPlatformConfiguration::AndroidPlatformConfiguration(
@@ -150,7 +150,7 @@
ThreadProfilerPlatformConfiguration::RuntimeModuleState
AndroidPlatformConfiguration::GetRuntimeModuleState(
- base::Optional<version_info::Channel> release_channel) const {
+ absl::optional<version_info::Channel> release_channel) const {
// The module will be present in releases due to having been installed via
// RequestRuntimeModuleInstall(), and in local/CQ builds of bundle targets
// where the module was installed with the bundle.
@@ -180,7 +180,7 @@
ThreadProfilerPlatformConfiguration::RelativePopulations
AndroidPlatformConfiguration::GetEnableRates(
- base::Optional<version_info::Channel> release_channel) const {
+ absl::optional<version_info::Channel> release_channel) const {
if (release_channel) {
CHECK(*release_channel == version_info::Channel::CANARY ||
*release_channel == version_info::Channel::DEV);
@@ -229,7 +229,7 @@
}
bool AndroidPlatformConfiguration::IsSupportedForChannel(
- base::Optional<version_info::Channel> release_channel) const {
+ absl::optional<version_info::Channel> release_channel) const {
// Enable on canary, for now.
if (release_channel && *release_channel == version_info::Channel::CANARY)
return true;
@@ -254,7 +254,7 @@
}
bool ThreadProfilerPlatformConfiguration::IsSupported(
- base::Optional<version_info::Channel> release_channel) const {
+ absl::optional<version_info::Channel> release_channel) const {
return base::StackSamplingProfiler::IsSupportedForCurrentPlatform() &&
IsSupportedForChannel(release_channel);
}
diff --git a/chrome/common/profiler/thread_profiler_platform_configuration.h b/chrome/common/profiler/thread_profiler_platform_configuration.h
index 64a531ef..fc97f07 100644
--- a/chrome/common/profiler/thread_profiler_platform_configuration.h
+++ b/chrome/common/profiler/thread_profiler_platform_configuration.h
@@ -7,9 +7,9 @@
#include <memory>
-#include "base/optional.h"
#include "components/metrics/call_stack_profile_params.h"
#include "components/version_info/version_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// Encapsulates the platform-specific configuration for the ThreadProfiler.
//
@@ -25,7 +25,7 @@
// configured for profiling. The overall enable/disable state should be reported
// to UMA in this case.
//
-// The base::Optional<version_info::Channel> release_channel passed to functions
+// The absl::optional<version_info::Channel> release_channel passed to functions
// in this interface should be the channel for released Chrome and nullopt for
// development/CQ builds.
class ThreadProfilerPlatformConfiguration {
@@ -61,13 +61,13 @@
// True if the platform supports the StackSamplingProfiler and the profiler is
// to be run for the released Chrome channel or development/CQ build.
- bool IsSupported(base::Optional<version_info::Channel> release_channel) const;
+ bool IsSupported(absl::optional<version_info::Channel> release_channel) const;
// Returns the current state of the runtime support module for the released
// Chrome channel or development/CQ build on the platform. Runtime module
// state is valid only if IsSupported().
virtual RuntimeModuleState GetRuntimeModuleState(
- base::Optional<version_info::Channel> release_channel) const = 0;
+ absl::optional<version_info::Channel> release_channel) const = 0;
// Request install of the runtime support module. May be invoked only if
// GetRuntimeModuleState() returns kModuleAbsentButAvailable.
@@ -77,7 +77,7 @@
// or development/CQ build on the platform. See the documentation on
// RelativePopulations. Enable rates are valid only if IsSupported().
virtual RelativePopulations GetEnableRates(
- base::Optional<version_info::Channel> release_channel) const = 0;
+ absl::optional<version_info::Channel> release_channel) const = 0;
// Returns the fraction of the time that profiling should be randomly enabled
// for the child |process|. The return value is in the range [0.0, 1.0].
@@ -95,7 +95,7 @@
// StackSamplingProfiler is supported on the platform since that's done in
// IsSupported().
virtual bool IsSupportedForChannel(
- base::Optional<version_info::Channel> release_channel) const = 0;
+ absl::optional<version_info::Channel> release_channel) const = 0;
};
#endif // CHROME_COMMON_PROFILER_THREAD_PROFILER_PLATFORM_CONFIGURATION_H_
diff --git a/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc b/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc
index 887a604..2fe375a 100644
--- a/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc
+++ b/chrome/common/profiler/thread_profiler_platform_configuration_unittest.cc
@@ -73,7 +73,7 @@
EXPECT_FALSE(config()->IsSupported(version_info::Channel::BETA));
EXPECT_FALSE(config()->IsSupported(version_info::Channel::STABLE));
- EXPECT_FALSE(config()->IsSupported(base::nullopt));
+ EXPECT_FALSE(config()->IsSupported(absl::nullopt));
#elif defined(OS_ANDROID)
EXPECT_FALSE(config()->IsSupported(version_info::Channel::UNKNOWN));
EXPECT_TRUE(config()->IsSupported(version_info::Channel::CANARY));
@@ -81,7 +81,7 @@
EXPECT_FALSE(config()->IsSupported(version_info::Channel::BETA));
EXPECT_FALSE(config()->IsSupported(version_info::Channel::STABLE));
- EXPECT_FALSE(config()->IsSupported(base::nullopt));
+ EXPECT_FALSE(config()->IsSupported(absl::nullopt));
#else
#if defined(OS_MAC)
// Sampling profiler does not work on macOS 11.0 yet:
@@ -100,7 +100,7 @@
EXPECT_FALSE(config()->IsSupported(version_info::Channel::BETA));
EXPECT_FALSE(config()->IsSupported(version_info::Channel::STABLE));
- EXPECT_EQ(on_default, config()->IsSupported(base::nullopt));
+ EXPECT_EQ(on_default, config()->IsSupported(absl::nullopt));
#endif
}
@@ -158,7 +158,7 @@
EXPECT_CHECK_DEATH(config()->GetEnableRates(version_info::Channel::STABLE));
EXPECT_EQ((RelativePopulations{100, 0}),
- config()->GetEnableRates(base::nullopt));
+ config()->GetEnableRates(absl::nullopt));
#endif
}
diff --git a/chrome/credential_provider/extension/app_inventory_manager.cc b/chrome/credential_provider/extension/app_inventory_manager.cc
index d712253..3d3eb1c 100644
--- a/chrome/credential_provider/extension/app_inventory_manager.cc
+++ b/chrome/credential_provider/extension/app_inventory_manager.cc
@@ -196,7 +196,7 @@
request_dict_->SetKey(kUploadAppInventoryRequestWin32AppsParameterName,
GetInstalledWin32Apps());
- base::Optional<base::Value> request_result;
+ absl::optional<base::Value> request_result;
hr = WinHttpUrlFetcher::BuildRequestAndFetchResultFromHttpService(
AppInventoryManager::Get()->GetGemServiceUploadAppInventoryUrl(),
/* access_token= */ std::string(), {}, *request_dict_,
diff --git a/chrome/credential_provider/extension/app_inventory_manager_unittests.cc b/chrome/credential_provider/extension/app_inventory_manager_unittests.cc
index 45f0730..0227bb8 100644
--- a/chrome/credential_provider/extension/app_inventory_manager_unittests.cc
+++ b/chrome/credential_provider/extension/app_inventory_manager_unittests.cc
@@ -192,7 +192,7 @@
FakeWinHttpUrlFetcherFactory::RequestData request_data =
fake_http_url_fetcher_factory()->GetRequestData(0);
- base::Optional<base::Value> body_value =
+ absl::optional<base::Value> body_value =
base::JSONReader::Read(request_data.body);
base::Value request(base::Value::Type::DICTIONARY);
diff --git a/chrome/credential_provider/gaiacp/associated_user_validator.cc b/chrome/credential_provider/gaiacp/associated_user_validator.cc
index 3c340de..62d2952 100644
--- a/chrome/credential_provider/gaiacp/associated_user_validator.cc
+++ b/chrome/credential_provider/gaiacp/associated_user_validator.cc
@@ -79,14 +79,14 @@
}
base::StringPiece response_string(response.data(), response.size());
- base::Optional<base::Value> properties(base::JSONReader::Read(
+ absl::optional<base::Value> properties(base::JSONReader::Read(
response_string, base::JSON_ALLOW_TRAILING_COMMAS));
if (!properties || !properties->is_dict()) {
LOGFN(ERROR) << "base::JSONReader::Read failed forcing reauth";
return 0;
}
- base::Optional<int> expires_in = properties->FindIntKey("expires_in");
+ absl::optional<int> expires_in = properties->FindIntKey("expires_in");
if (properties->FindKey("error") || !expires_in || expires_in.value() < 0) {
LOGFN(VERBOSE) << "Needs reauth sid=" << reauth_info->sid;
return 0;
diff --git a/chrome/credential_provider/gaiacp/credential_provider_broker_win.cc b/chrome/credential_provider/gaiacp/credential_provider_broker_win.cc
index f8526125..d5ff344 100644
--- a/chrome/credential_provider/gaiacp/credential_provider_broker_win.cc
+++ b/chrome/credential_provider/gaiacp/credential_provider_broker_win.cc
@@ -15,7 +15,7 @@
// clang-format on
#include "base/memory/free_deleter.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "base/strings/string_util.h"
#include "base/win/scoped_devinfo.h"
#include "mojo/public/cpp/platform/platform_handle.h"
@@ -48,18 +48,18 @@
}
// Gets the usage page for the input device |handle|.
-base::Optional<uint16_t> GetUsagePage(HANDLE handle) {
+absl::optional<uint16_t> GetUsagePage(HANDLE handle) {
ScopedPreparsedData scoped_preparsed_data;
if (!HidD_GetPreparsedData(
handle, ScopedPreparsedData::Receiver(scoped_preparsed_data).get()) ||
!scoped_preparsed_data.is_valid()) {
- return base::nullopt;
+ return absl::nullopt;
}
HIDP_CAPS capabilities = {};
if (HidP_GetCaps(scoped_preparsed_data.get(), &capabilities) !=
HIDP_STATUS_SUCCESS) {
- return base::nullopt;
+ return absl::nullopt;
}
return capabilities.UsagePage;
@@ -67,7 +67,7 @@
// Extracts the device path from |device_info_set| and |device_interface_data|
// input fields.
-base::Optional<std::wstring> GetDevicePath(
+absl::optional<std::wstring> GetDevicePath(
HDEVINFO device_info_set,
PSP_DEVICE_INTERFACE_DATA device_interface_data) {
DWORD required_size = 0;
@@ -86,7 +86,7 @@
if (!SetupDiGetDeviceInterfaceDetail(device_info_set, device_interface_data,
device_interface_detail_data.get(),
required_size, nullptr, nullptr)) {
- return base::nullopt;
+ return absl::nullopt;
}
// Extract the device path and compare it with input device path
// and ignore it if it doesn't match the input device path.
@@ -115,7 +115,7 @@
device_info_set.get(), nullptr, &GUID_DEVINTERFACE_HID,
device_index, &device_interface_data);
++device_index) {
- base::Optional<std::wstring> device_path =
+ absl::optional<std::wstring> device_path =
GetDevicePath(device_info_set.get(), &device_interface_data);
if (!device_path)
continue;
@@ -131,7 +131,7 @@
if (!device_handle.IsValid())
break;
- base::Optional<uint16_t> usage_page = GetUsagePage(device_handle.Get());
+ absl::optional<uint16_t> usage_page = GetUsagePage(device_handle.Get());
// Only if the input device path is corresponding to a FIDO
// device, we will return appropriate device handle. Otherwise,
diff --git a/chrome/credential_provider/gaiacp/dllmain.cc b/chrome/credential_provider/gaiacp/dllmain.cc
index 714fa8b23..0c49ba6f 100644
--- a/chrome/credential_provider/gaiacp/dllmain.cc
+++ b/chrome/credential_provider/gaiacp/dllmain.cc
@@ -197,7 +197,7 @@
// Don't log |buffer| since it contains sensitive info like password.
HRESULT hr = S_OK;
- base::Optional<base::Value> properties =
+ absl::optional<base::Value> properties =
base::JSONReader::Read(buffer.data(), base::JSON_ALLOW_TRAILING_COMMAS);
credential_provider::SecurelyClearBuffer(buffer.data(), buffer.size());
diff --git a/chrome/credential_provider/gaiacp/event_logs_upload_manager.cc b/chrome/credential_provider/gaiacp/event_logs_upload_manager.cc
index bfa82e25..1468747b 100644
--- a/chrome/credential_provider/gaiacp/event_logs_upload_manager.cc
+++ b/chrome/credential_provider/gaiacp/event_logs_upload_manager.cc
@@ -497,7 +497,7 @@
base::Value log_entries =
base::Value::FromUniquePtrValue(std::move(log_entries_value_list));
request_dict.SetKey(kRequestLogEntriesParameterName, std::move(log_entries));
- base::Optional<base::Value> request_result;
+ absl::optional<base::Value> request_result;
// Make the upload HTTP request.
hr = WinHttpUrlFetcher::BuildRequestAndFetchResultFromHttpService(
diff --git a/chrome/credential_provider/gaiacp/experiments_fetcher.cc b/chrome/credential_provider/gaiacp/experiments_fetcher.cc
index 3332aef..fb04fcd8 100644
--- a/chrome/credential_provider/gaiacp/experiments_fetcher.cc
+++ b/chrome/credential_provider/gaiacp/experiments_fetcher.cc
@@ -178,7 +178,7 @@
}
// Make the fetch experiments HTTP request.
- base::Optional<base::Value> request_result;
+ absl::optional<base::Value> request_result;
HRESULT hr = WinHttpUrlFetcher::BuildRequestAndFetchResultFromHttpService(
GetExperimentsUrl(), access_token, {}, *request_dict.get(),
kDefaultFetchExperimentsRequestTimeout, kMaxNumHttpRetries,
diff --git a/chrome/credential_provider/gaiacp/experiments_manager.cc b/chrome/credential_provider/gaiacp/experiments_manager.cc
index e3e720bc..db411d9 100644
--- a/chrome/credential_provider/gaiacp/experiments_manager.cc
+++ b/chrome/credential_provider/gaiacp/experiments_manager.cc
@@ -71,7 +71,7 @@
experiments_file->Read(0, buffer.data(), buffer.size());
experiments_file.reset();
- base::Optional<base::Value> experiments_data =
+ absl::optional<base::Value> experiments_data =
base::JSONReader::Read(base::StringPiece(buffer.data(), buffer.size()),
base::JSON_ALLOW_TRAILING_COMMAS);
if (!experiments_data || !experiments_data->is_dict()) {
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base.cc b/chrome/credential_provider/gaiacp/gaia_credential_base.cc
index 3edf91b1..f8d5c793 100644
--- a/chrome/credential_provider/gaiacp/gaia_credential_base.cc
+++ b/chrome/credential_provider/gaiacp/gaia_credential_base.cc
@@ -649,7 +649,7 @@
DCHECK(status_text);
// Check the exit_code to see if any errors were detected by the GLS.
- base::Optional<int> exit_code = result.FindIntKey(kKeyExitCode);
+ absl::optional<int> exit_code = result.FindIntKey(kKeyExitCode);
if (exit_code.value() != kUiecSuccess) {
switch (exit_code.value()) {
case kUiecAbort:
@@ -2476,7 +2476,7 @@
base::WideToUTF8(OLE2CW(authentication_info),
::SysStringLen(authentication_info), &json_string);
- base::Optional<base::Value> properties =
+ absl::optional<base::Value> properties =
base::JSONReader::Read(json_string, base::JSON_ALLOW_TRAILING_COMMAS);
SecurelyClearString(json_string);
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base.h b/chrome/credential_provider/gaiacp/gaia_credential_base.h
index 0f9529c..fff44c99 100644
--- a/chrome/credential_provider/gaiacp/gaia_credential_base.h
+++ b/chrome/credential_provider/gaiacp/gaia_credential_base.h
@@ -93,7 +93,7 @@
const CComBSTR& get_current_windows_password() const {
return current_windows_password_;
}
- const base::Optional<base::Value>& get_authentication_results() const {
+ const absl::optional<base::Value>& get_authentication_results() const {
return authentication_results_;
}
@@ -325,7 +325,7 @@
// Contains the information about the Gaia account that signed in. See the
// kKeyXXX constants for the data that is stored here.
- base::Optional<base::Value> authentication_results_;
+ absl::optional<base::Value> authentication_results_;
// Holds information about the success or failure of the sign in.
NTSTATUS result_status_ = STATUS_SUCCESS;
diff --git a/chrome/credential_provider/gaiacp/gcp_utils.cc b/chrome/credential_provider/gaiacp/gcp_utils.cc
index 35ae5762..89e9115 100644
--- a/chrome/credential_provider/gaiacp/gcp_utils.cc
+++ b/chrome/credential_provider/gaiacp/gcp_utils.cc
@@ -933,11 +933,11 @@
return GetLanguageSelector().matched_candidate();
}
-void SecurelyClearDictionaryValue(base::Optional<base::Value>* value) {
+void SecurelyClearDictionaryValue(absl::optional<base::Value>* value) {
SecurelyClearDictionaryValueWithKey(value, kKeyPassword);
}
-void SecurelyClearDictionaryValueWithKey(base::Optional<base::Value>* value,
+void SecurelyClearDictionaryValueWithKey(absl::optional<base::Value>* value,
const std::string& password_key) {
if (!value || !(*value) || !((*value)->is_dict()))
return;
@@ -969,7 +969,7 @@
const std::initializer_list<base::StringPiece>& path) {
DCHECK(path.size() > 0);
- base::Optional<base::Value> json_obj =
+ absl::optional<base::Value> json_obj =
base::JSONReader::Read(json_string, base::JSON_ALLOW_TRAILING_COMMAS);
if (!json_obj || !json_obj->is_dict()) {
LOGFN(ERROR) << "base::JSONReader::Read failed to translate to JSON";
@@ -1007,7 +1007,7 @@
std::vector<std::string>* output) {
DCHECK(path.size() > 0);
- base::Optional<base::Value> json_obj =
+ absl::optional<base::Value> json_obj =
base::JSONReader::Read(json_string, base::JSON_ALLOW_TRAILING_COMMAS);
if (!json_obj || !json_obj->is_dict()) {
LOGFN(ERROR) << "base::JSONReader::Read failed to translate to JSON";
diff --git a/chrome/credential_provider/gaiacp/gcp_utils.h b/chrome/credential_provider/gaiacp/gcp_utils.h
index bf94427..2ce087e 100644
--- a/chrome/credential_provider/gaiacp/gcp_utils.h
+++ b/chrome/credential_provider/gaiacp/gcp_utils.h
@@ -276,8 +276,8 @@
// Securely clear a base::Value that may be a dictionary value that may
// have a password field.
-void SecurelyClearDictionaryValue(base::Optional<base::Value>* value);
-void SecurelyClearDictionaryValueWithKey(base::Optional<base::Value>* value,
+void SecurelyClearDictionaryValue(absl::optional<base::Value>* value);
+void SecurelyClearDictionaryValueWithKey(absl::optional<base::Value>* value,
const std::string& password_key);
// Securely clear std::wstring and std::string.
diff --git a/chrome/credential_provider/gaiacp/gem_device_details_manager.cc b/chrome/credential_provider/gaiacp/gem_device_details_manager.cc
index 92ebbfb5..6e03485a4 100644
--- a/chrome/credential_provider/gaiacp/gem_device_details_manager.cc
+++ b/chrome/credential_provider/gaiacp/gem_device_details_manager.cc
@@ -295,7 +295,7 @@
base::WideToUTF8(known_resource_id));
}
- base::Optional<base::Value> request_result;
+ absl::optional<base::Value> request_result;
hr = WinHttpUrlFetcher::BuildRequestAndFetchResultFromHttpService(
GemDeviceDetailsManager::Get()->GetGemServiceUploadDeviceDetailsUrl(),
diff --git a/chrome/credential_provider/gaiacp/password_recovery_manager.cc b/chrome/credential_provider/gaiacp/password_recovery_manager.cc
index 4884d36..eb26039 100644
--- a/chrome/credential_provider/gaiacp/password_recovery_manager.cc
+++ b/chrome/credential_provider/gaiacp/password_recovery_manager.cc
@@ -128,7 +128,7 @@
// find padded secret. It then removes the padding and returns original secret.
bool UnpadSecret(const std::string& serialized_padded_secret,
std::string* out) {
- base::Optional<base::Value> pwd_padding_dict = base::JSONReader::Read(
+ absl::optional<base::Value> pwd_padding_dict = base::JSONReader::Read(
serialized_padded_secret, base::JSON_ALLOW_TRAILING_COMMAS);
if (!pwd_padding_dict.has_value() || !pwd_padding_dict->is_dict()) {
LOGFN(ERROR) << "Failed to deserialize given secret from json.";
@@ -152,7 +152,7 @@
// Encrypts the given |secret| with the provided |public_key|. Returns a vector
// of uint8_t as the encrypted secret.
-base::Optional<std::vector<uint8_t>> PublicKeyEncrypt(
+absl::optional<std::vector<uint8_t>> PublicKeyEncrypt(
const std::string& public_key,
const std::string& secret) {
CBS pub_key_cbs;
@@ -161,13 +161,13 @@
bssl::UniquePtr<EVP_PKEY> pub_key(EVP_parse_public_key(&pub_key_cbs));
if (!pub_key || CBS_len(&pub_key_cbs)) {
ERR_print_errors_cb(&LogBoringSSLError, /*unused*/ nullptr);
- return base::nullopt;
+ return absl::nullopt;
}
RSA* rsa = EVP_PKEY_get0_RSA(pub_key.get());
if (!rsa) {
ERR_print_errors_cb(&LogBoringSSLError, /*unused*/ nullptr);
- return base::nullopt;
+ return absl::nullopt;
}
// Generate a random session key and random nonce.
@@ -181,7 +181,7 @@
session_key_with_nonce, sizeof(session_key_with_nonce),
RSA_PKCS1_OAEP_PADDING)) {
ERR_print_errors_cb(&LogBoringSSLError, /*unused*/ nullptr);
- return base::nullopt;
+ return absl::nullopt;
}
std::string session_key(session_key_with_nonce,
@@ -202,8 +202,8 @@
}
// Decrypts the provided |ciphertext| with the given |private_key|. Returns
-// an base::Optional<std::string> as the decrypted secret.
-base::Optional<std::string> PrivateKeyDecrypt(
+// an absl::optional<std::string> as the decrypted secret.
+absl::optional<std::string> PrivateKeyDecrypt(
const std::string& private_key,
base::span<const uint8_t> ciphertext) {
CBS priv_key_cbs;
@@ -212,18 +212,18 @@
bssl::UniquePtr<EVP_PKEY> priv_key(EVP_parse_private_key(&priv_key_cbs));
if (!priv_key || CBS_len(&priv_key_cbs)) {
ERR_print_errors_cb(&LogBoringSSLError, /*unused*/ nullptr);
- return base::nullopt;
+ return absl::nullopt;
}
RSA* rsa = EVP_PKEY_get0_RSA(priv_key.get());
if (!rsa) {
LOGFN(ERROR) << "No RSA is found in EVP_PKEY_get0_RSA";
- return base::nullopt;
+ return absl::nullopt;
}
const size_t rsa_size = RSA_size(rsa);
if (ciphertext.size() < rsa_size) {
LOGFN(ERROR) << "Incorrect RSA size for given cipher text";
- return base::nullopt;
+ return absl::nullopt;
}
// Decrypt the encrypted session key using given provided key.
@@ -233,7 +233,7 @@
session_key_with_nonce.data(), session_key_with_nonce.size(),
ciphertext.data(), rsa_size, RSA_PKCS1_OAEP_PADDING)) {
ERR_print_errors_cb(&LogBoringSSLError, /*unused*/ nullptr);
- return base::nullopt;
+ return absl::nullopt;
}
session_key_with_nonce.resize(session_key_with_nonce_len);
@@ -264,7 +264,7 @@
const std::string& device_id,
const std::wstring& password,
const base::TimeDelta& request_timeout,
- base::Optional<base::Value>* encrypted_data) {
+ absl::optional<base::Value>* encrypted_data) {
DCHECK(encrypted_data);
DCHECK(!(*encrypted_data));
@@ -273,7 +273,7 @@
base::Value request_dict(base::Value::Type::DICTIONARY);
request_dict.SetStringKey(kGenerateKeyPairRequestDeviceIdParameterName,
device_id);
- base::Optional<base::Value> request_result;
+ absl::optional<base::Value> request_result;
// Fetch the results and extract the |resource_id| for the key and the
// |public_key| to be used for encryption.
@@ -315,7 +315,7 @@
auto opt = PublicKeyEncrypt(decoded_public_key, padded_password);
SecurelyClearString(padded_password);
- if (opt == base::nullopt)
+ if (opt == absl::nullopt)
return E_FAIL;
encrypted_data->emplace(base::Value(base::Value::Type::DICTIONARY));
@@ -339,7 +339,7 @@
// service.
HRESULT DecryptUserPasswordUsingEscrowService(
const std::string& access_token,
- const base::Optional<base::Value>& encrypted_data,
+ const absl::optional<base::Value>& encrypted_data,
const base::TimeDelta& request_timeout,
std::wstring* decrypted_password) {
if (!encrypted_data)
@@ -362,7 +362,7 @@
}
std::string private_key;
- base::Optional<base::Value> request_result;
+ absl::optional<base::Value> request_result;
// Fetch the results and extract the |private_key| to be used for decryption.
HRESULT hr = WinHttpUrlFetcher::BuildRequestAndFetchResultFromHttpService(
@@ -402,7 +402,7 @@
PrivateKeyDecrypt(decoded_private_key,
base::as_bytes(base::make_span(decoded_cipher_text)));
- if (decrypted_secret == base::nullopt)
+ if (decrypted_secret == absl::nullopt)
return E_FAIL;
std::string unpadded;
@@ -485,7 +485,7 @@
return S_OK;
}
- base::Optional<base::Value> encrypted_dict;
+ absl::optional<base::Value> encrypted_dict;
hr = EncryptUserPasswordUsingEscrowService(access_token, device_id, password,
encryption_key_request_timeout_,
&encrypted_dict);
@@ -544,7 +544,7 @@
LOGFN(ERROR) << "RetrievePrivateData hr=" << putHR(hr);
std::string json_string = base::WideToUTF8(password_lsa_data);
- base::Optional<base::Value> encrypted_dict =
+ absl::optional<base::Value> encrypted_dict =
base::JSONReader::Read(json_string, base::JSON_ALLOW_TRAILING_COMMAS);
SecurelyClearString(json_string);
SecurelyClearBuffer(password_lsa_data, sizeof(password_lsa_data));
diff --git a/chrome/credential_provider/gaiacp/user_policies.cc b/chrome/credential_provider/gaiacp/user_policies.cc
index 7471bf0e..ddf1f17a 100644
--- a/chrome/credential_provider/gaiacp/user_policies.cc
+++ b/chrome/credential_provider/gaiacp/user_policies.cc
@@ -58,13 +58,13 @@
UserPolicies user_policies;
- base::Optional<bool> dm_enrollment =
+ absl::optional<bool> dm_enrollment =
dict.FindBoolKey(kGcpwPolicyDmEnrollmentParameterName);
if (dm_enrollment) {
user_policies.enable_dm_enrollment = *dm_enrollment;
}
- base::Optional<bool> gcpw_auto_update =
+ absl::optional<bool> gcpw_auto_update =
dict.FindBoolKey(kGcpwPolicyAutoUpdateParameterName);
if (gcpw_auto_update) {
user_policies.enable_gcpw_auto_update = *gcpw_auto_update;
@@ -76,13 +76,13 @@
user_policies.gcpw_pinned_version = GcpwVersion(*pin_version);
}
- base::Optional<bool> multi_user_login =
+ absl::optional<bool> multi_user_login =
dict.FindBoolKey(kGcpwPolicMultiUserLoginParameterName);
if (multi_user_login) {
user_policies.enable_multi_user_login = *multi_user_login;
}
- base::Optional<int> validity_period_days =
+ absl::optional<int> validity_period_days =
dict.FindIntKey(kGcpwPolicyValidityPeriodParameterName);
if (validity_period_days) {
user_policies.validity_period_days = *validity_period_days;
diff --git a/chrome/credential_provider/gaiacp/user_policies_manager.cc b/chrome/credential_provider/gaiacp/user_policies_manager.cc
index 3526068..9328764 100644
--- a/chrome/credential_provider/gaiacp/user_policies_manager.cc
+++ b/chrome/credential_provider/gaiacp/user_policies_manager.cc
@@ -218,7 +218,7 @@
}
// Make the fetch policies HTTP request.
- base::Optional<base::Value> request_result;
+ absl::optional<base::Value> request_result;
HRESULT hr = WinHttpUrlFetcher::BuildRequestAndFetchResultFromHttpService(
user_policies_url, access_token, {}, {},
kDefaultFetchPoliciesRequestTimeout, kMaxNumHttpRetries, &request_result);
@@ -286,7 +286,7 @@
policy_file->Read(0, buffer.data(), buffer.size());
policy_file.reset();
- base::Optional<base::Value> policy_data =
+ absl::optional<base::Value> policy_data =
base::JSONReader::Read(base::StringPiece(buffer.data(), buffer.size()),
base::JSON_ALLOW_TRAILING_COMMAS);
if (!policy_data || !policy_data->is_dict()) {
diff --git a/chrome/credential_provider/gaiacp/win_http_url_fetcher.cc b/chrome/credential_provider/gaiacp/win_http_url_fetcher.cc
index 586284fe..7f489a68 100644
--- a/chrome/credential_provider/gaiacp/win_http_url_fetcher.cc
+++ b/chrome/credential_provider/gaiacp/win_http_url_fetcher.cc
@@ -68,9 +68,9 @@
// within the given |request_timeout|. If the background thread returns before
// the timeout expires, it is guaranteed that a result can be returned and the
// requester will delete itself.
- base::Optional<base::Value> WaitForResponseFromHttpService(
+ absl::optional<base::Value> WaitForResponseFromHttpService(
const base::TimeDelta& request_timeout) {
- base::Optional<base::Value> result;
+ absl::optional<base::Value> result;
// Start the thread and wait on its handle until |request_timeout| expires
// or the thread finishes.
@@ -423,7 +423,7 @@
const base::Value& request_dict,
const base::TimeDelta& request_timeout,
unsigned int request_retries,
- base::Optional<base::Value>* request_result) {
+ absl::optional<base::Value>* request_result) {
DCHECK(request_result);
HRESULT hr = S_OK;
@@ -458,7 +458,7 @@
LOGFN(ERROR) << "error: " << *error_detail;
// If error code is known, retry only on retryable server errors.
- base::Optional<int> error_code =
+ absl::optional<int> error_code =
error_detail->FindIntKey(kHttpErrorCodeKeyNameInResponse);
if (error_code.has_value() &&
kRetryableHttpErrorCodes.find(error_code.value()) ==
diff --git a/chrome/credential_provider/gaiacp/win_http_url_fetcher.h b/chrome/credential_provider/gaiacp/win_http_url_fetcher.h
index ace67e9..fc1109a 100644
--- a/chrome/credential_provider/gaiacp/win_http_url_fetcher.h
+++ b/chrome/credential_provider/gaiacp/win_http_url_fetcher.h
@@ -41,7 +41,7 @@
const base::Value& request_dict,
const base::TimeDelta& request_timeout,
unsigned int request_retries,
- base::Optional<base::Value>* request_result);
+ absl::optional<base::Value>* request_result);
virtual ~WinHttpUrlFetcher();
diff --git a/chrome/credential_provider/gaiacp/win_http_url_fetcher_unittests.cc b/chrome/credential_provider/gaiacp/win_http_url_fetcher_unittests.cc
index 07e510c..9aaac819 100644
--- a/chrome/credential_provider/gaiacp/win_http_url_fetcher_unittests.cc
+++ b/chrome/credential_provider/gaiacp/win_http_url_fetcher_unittests.cc
@@ -42,7 +42,7 @@
request.SetIntKey("request-int-key", 1234);
base::TimeDelta request_timeout =
base::TimeDelta::FromMilliseconds(timeout_in_millis);
- base::Optional<base::Value> request_result;
+ absl::optional<base::Value> request_result;
base::Value expected_result(base::Value::Type::DICTIONARY);
expected_result.SetStringKey("response-str-key", "response-str-value");
@@ -119,7 +119,7 @@
request_data.headers.at("Authorization").find(access_token));
ASSERT_EQ(1u, request_data.headers.count(header1));
ASSERT_EQ(header1_value, request_data.headers.at(header1));
- base::Optional<base::Value> body_value =
+ absl::optional<base::Value> body_value =
base::JSONReader::Read(request_data.body);
ASSERT_EQ(request, body_value.value());
}
diff --git a/chrome/installer/setup/archive_patch_helper.cc b/chrome/installer/setup/archive_patch_helper.cc
index 0c166d2..445db74 100644
--- a/chrome/installer/setup/archive_patch_helper.cc
+++ b/chrome/installer/setup/archive_patch_helper.cc
@@ -8,12 +8,12 @@
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "chrome/installer/setup/buildflags.h"
#include "chrome/installer/util/lzma_util.h"
#include "components/zucchini/zucchini.h"
#include "components/zucchini/zucchini_integration.h"
#include "courgette/courgette.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/bspatch/mbspatch.h"
namespace installer {
diff --git a/chrome/installer/setup/downgrade_cleanup.cc b/chrome/installer/setup/downgrade_cleanup.cc
index 9db42c5..4286e283 100644
--- a/chrome/installer/setup/downgrade_cleanup.cc
+++ b/chrome/installer/setup/downgrade_cleanup.cc
@@ -11,7 +11,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/strings/string_util.h"
@@ -26,6 +25,7 @@
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/work_item_list.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -35,7 +35,7 @@
// Returns the last version of Chrome which introduced breaking changes to the
// installer, or no value if Chrome is not installed or the version installed
// predates support for this feature.
-base::Optional<base::Version> GetLastBreakingInstallerVersion(HKEY reg_root) {
+absl::optional<base::Version> GetLastBreakingInstallerVersion(HKEY reg_root) {
base::win::RegKey key;
std::wstring last_breaking_installer_version;
if (key.Open(reg_root, install_static::GetClientStateKeyPath().c_str(),
@@ -43,11 +43,11 @@
key.ReadValue(google_update::kRegCleanInstallRequiredForVersionBelowField,
&last_breaking_installer_version) != ERROR_SUCCESS ||
last_breaking_installer_version.empty()) {
- return base::nullopt;
+ return absl::nullopt;
}
base::Version version(base::WideToASCII(last_breaking_installer_version));
if (!version.IsValid())
- return base::nullopt;
+ return absl::nullopt;
return version;
}
// Formats `cmd_line_with_placeholders` by replacing the placeholders with
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index edab4cc..a39bd5f 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -28,7 +28,6 @@
#include "base/metrics/histogram_macros.h"
#include "base/metrics/persistent_histogram_storage.h"
#include "base/numerics/safe_conversions.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/process/memory.h"
@@ -94,6 +93,7 @@
#include "components/crash/core/app/crash_switches.h"
#include "components/crash/core/app/run_as_crashpad_handler_win.h"
#include "content/public/common/content_switches.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chrome/installer/util/google_update_util.h"
@@ -913,7 +913,7 @@
const std::wstring protocol_associations_value =
cmd_line.GetSwitchValueNative(
installer::switches::kRegisterURLProtocol);
- base::Optional<ShellUtil::ProtocolAssociations> protocol_associations =
+ absl::optional<ShellUtil::ProtocolAssociations> protocol_associations =
ShellUtil::ProtocolAssociations::FromCommandLineArgument(
protocol_associations_value);
@@ -1050,7 +1050,7 @@
// existing value.
std::wstring token_switch_value =
cmd_line.GetSwitchValueNative(installer::switches::kStoreDMToken);
- base::Optional<std::string> token;
+ absl::optional<std::string> token;
if (!(token = installer::DecodeDMTokenSwitchValue(token_switch_value)) ||
!installer::StoreDMToken(*token)) {
*exit_code = installer::STORE_DMTOKEN_FAILED;
diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc
index f4bc0a7..a373582 100644
--- a/chrome/installer/setup/setup_util.cc
+++ b/chrome/installer/setup/setup_util.cc
@@ -730,11 +730,11 @@
return base::Time::FromFileTime(filetime);
}
-base::Optional<std::string> DecodeDMTokenSwitchValue(
+absl::optional<std::string> DecodeDMTokenSwitchValue(
const std::wstring& encoded_token) {
if (encoded_token.empty()) {
LOG(ERROR) << "Empty DMToken specified on the command line";
- return base::nullopt;
+ return absl::nullopt;
}
// The token passed on the command line is base64-encoded, but since this is
@@ -743,7 +743,7 @@
if (!base::IsStringASCII(encoded_token) ||
!base::Base64Decode(base::WideToASCII(encoded_token), &token)) {
LOG(ERROR) << "DMToken passed on the command line is not correctly encoded";
- return base::nullopt;
+ return absl::nullopt;
}
return token;
diff --git a/chrome/installer/setup/setup_util.h b/chrome/installer/setup/setup_util.h
index 601c425..5447d91 100644
--- a/chrome/installer/setup/setup_util.h
+++ b/chrome/installer/setup/setup_util.h
@@ -15,11 +15,11 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "base/time/time.h"
#include "base/win/windows_types.h"
#include "chrome/installer/util/lzma_util.h"
#include "chrome/installer/util/util_constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class WorkItemList;
@@ -142,7 +142,7 @@
// Returns a DM token decoded from the base-64 |encoded_token|, or null in case
// of a decoding error. The returned DM token is an opaque binary blob and
// should not be treated as an ASCII or UTF-8 string.
-base::Optional<std::string> DecodeDMTokenSwitchValue(
+absl::optional<std::string> DecodeDMTokenSwitchValue(
const std::wstring& encoded_token);
// Saves a DM token to a global location on the machine accessible to all
diff --git a/chrome/installer/util/helper_unittest.cc b/chrome/installer/util/helper_unittest.cc
index 9be31c1..7b44114 100644
--- a/chrome/installer/util/helper_unittest.cc
+++ b/chrome/installer/util/helper_unittest.cc
@@ -6,7 +6,6 @@
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/test/scoped_path_override.h"
#include "base/test/test_reg_util_win.h"
@@ -18,14 +17,15 @@
#include "chrome/installer/util/initial_preferences.h"
#include "chrome/installer/util/util_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace installer {
struct Params {
- Params(bool system_level, base::Optional<int> target_dir_key)
+ Params(bool system_level, absl::optional<int> target_dir_key)
: system_level(system_level), target_dir_key(target_dir_key) {}
bool system_level;
- base::Optional<int> target_dir_key;
+ absl::optional<int> target_dir_key;
};
// Tests GetChromeInstallPath with a params object that contains a boolean
@@ -90,9 +90,9 @@
base::ScopedTempDir random_;
base::ScopedTempDir local_app_data_;
registry_util::RegistryOverrideManager registry_override_manager_;
- base::Optional<base::ScopedPathOverride> program_files_override_;
- base::Optional<base::ScopedPathOverride> program_files_x86_override_;
- base::Optional<base::ScopedPathOverride> local_data_app_override_;
+ absl::optional<base::ScopedPathOverride> program_files_override_;
+ absl::optional<base::ScopedPathOverride> program_files_x86_override_;
+ absl::optional<base::ScopedPathOverride> local_data_app_override_;
};
TEST_P(GetChromeInstallPathTest, NoRegistryValue) {
@@ -157,10 +157,10 @@
INSTANTIATE_TEST_SUITE_P(UserLevelTest,
GetChromeInstallPathTest,
- testing::Values<Params>({false, base::nullopt}));
+ testing::Values<Params>({false, absl::nullopt}));
INSTANTIATE_TEST_SUITE_P(SystemLevelTest,
GetChromeInstallPathTest,
- testing::Values<Params>({true, base::nullopt}));
+ testing::Values<Params>({true, absl::nullopt}));
// Tests GetChromeInstallPath with a params object that contains a boolean
// |system_level| which is |true| if the test must use system-level values or
@@ -281,7 +281,7 @@
INSTANTIATE_TEST_SUITE_P(UserLevelEmptyPathSetupTest,
GetChromeInstallPathWithPrefsTest,
- testing::Values<Params>(Params(false, base::nullopt)));
+ testing::Values<Params>(Params(false, absl::nullopt)));
INSTANTIATE_TEST_SUITE_P(
MachineLevelX86SetupTest,
@@ -299,6 +299,6 @@
INSTANTIATE_TEST_SUITE_P(MachineLevelEmptyPathSetupTest,
GetChromeInstallPathWithPrefsTest,
- testing::Values<Params>(Params(true, base::nullopt)));
+ testing::Values<Params>(Params(true, absl::nullopt)));
} // namespace installer
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index e1dd8e26..1b1f53f 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -523,7 +523,7 @@
}
// static
-base::Optional<base::Version> InstallUtil::GetDowngradeVersion() {
+absl::optional<base::Version> InstallUtil::GetDowngradeVersion() {
RegKey key;
std::wstring downgrade_version;
if (key.Open(install_static::IsSystemInstall() ? HKEY_LOCAL_MACHINE
@@ -533,11 +533,11 @@
key.ReadValue(installer::kRegDowngradeVersion, &downgrade_version) !=
ERROR_SUCCESS ||
downgrade_version.empty()) {
- return base::nullopt;
+ return absl::nullopt;
}
base::Version version(base::WideToASCII(downgrade_version));
if (!version.IsValid())
- return base::nullopt;
+ return absl::nullopt;
return version;
}
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index bb15dafb..134819f 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -18,13 +18,13 @@
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "base/types/strong_alias.h"
#include "base/version.h"
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "chrome/installer/util/util_constants.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class WorkItemList;
@@ -171,7 +171,7 @@
// Returns the highest Chrome version that was installed prior to a downgrade,
// or no value if Chrome was not previously downgraded from a newer version.
- static base::Optional<base::Version> GetDowngradeVersion();
+ static absl::optional<base::Version> GetDowngradeVersion();
// Returns pairs of registry key paths and value names where the enrollment
// token is stored for machine level user cloud policies. The locations are
diff --git a/chrome/installer/util/lzma_util.cc b/chrome/installer/util/lzma_util.cc
index 4992112..180cee7 100644
--- a/chrome/installer/util/lzma_util.cc
+++ b/chrome/installer/util/lzma_util.cc
@@ -16,8 +16,8 @@
#include "base/files/file_util.h"
#include "base/files/memory_mapped_file.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
extern "C" {
#include "third_party/lzma_sdk/7z.h"
@@ -128,7 +128,7 @@
}
if (status != UNPACK_NO_ERROR) {
- base::Optional<DWORD> error_code = lzma_util.GetErrorCode();
+ absl::optional<DWORD> error_code = lzma_util.GetErrorCode();
if (error_code.value_or(ERROR_SUCCESS) == ERROR_DISK_FULL)
return UNPACK_DISK_FULL;
if (error_code.value_or(ERROR_SUCCESS) == ERROR_IO_DEVICE)
@@ -198,7 +198,7 @@
size_t last_folder_index = -1;
// A mapping of either the target file (if the file exactly fits within a
// folder) or a temporary file into which a folder is decompressed.
- base::Optional<base::MemoryMappedFile> mapped_file;
+ absl::optional<base::MemoryMappedFile> mapped_file;
for (size_t file_index = 0; file_index < db.NumFiles; ++file_index) {
size_t file_name_length = SzArEx_GetFileNameUtf16(&db, file_index, nullptr);
if (file_name_length < 1) {
@@ -402,7 +402,7 @@
void LzmaUtilImpl::CloseArchive() {
archive_file_.Close();
- error_code_ = base::nullopt;
+ error_code_ = absl::nullopt;
}
bool LzmaUtilImpl::CreateDirectory(const base::FilePath& dir) {
diff --git a/chrome/installer/util/lzma_util.h b/chrome/installer/util/lzma_util.h
index 0444160..9fb79fd 100644
--- a/chrome/installer/util/lzma_util.h
+++ b/chrome/installer/util/lzma_util.h
@@ -10,8 +10,8 @@
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/win/windows_types.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// The error status of LzmaUtil::Unpack which is used to publish metrics. Do not
// change the order.
@@ -59,7 +59,7 @@
UnPackStatus UnPack(const base::FilePath& location,
base::FilePath* output_file);
- base::Optional<DWORD> GetErrorCode() { return error_code_; }
+ absl::optional<DWORD> GetErrorCode() { return error_code_; }
void CloseArchive();
@@ -69,7 +69,7 @@
private:
base::File archive_file_;
std::set<base::FilePath> directories_created_;
- base::Optional<DWORD> error_code_;
+ absl::optional<DWORD> error_code_;
DISALLOW_COPY_AND_ASSIGN(LzmaUtilImpl);
};
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 3e81aaca..d4b7a0f 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -2366,7 +2366,7 @@
return cmd_arg;
}
-base::Optional<ShellUtil::ProtocolAssociations>
+absl::optional<ShellUtil::ProtocolAssociations>
ShellUtil::ProtocolAssociations::FromCommandLineArgument(
const std::wstring& argument) {
// Given that protocol associations are stored in a string in the following
@@ -2378,7 +2378,7 @@
&protocol_association_string_pairs);
if (protocol_association_string_pairs.empty())
- return base::nullopt;
+ return absl::nullopt;
std::vector<std::pair<std::wstring, std::wstring>> protocol_association_pairs;
protocol_association_pairs.reserve(protocol_association_string_pairs.size());
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h
index eca7827..8da9cd5 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -554,7 +554,7 @@
std::wstring ToCommandLineArgument() const;
// Parses a ProtocolAssociations instance from a string command line arg.
- static base::Optional<ProtocolAssociations> FromCommandLineArgument(
+ static absl::optional<ProtocolAssociations> FromCommandLineArgument(
const std::wstring& argument);
base::flat_map<std::wstring, std::wstring> associations;
diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc
index bcbe2a5..97526c1e 100644
--- a/chrome/installer/util/shell_util_unittest.cc
+++ b/chrome/installer/util/shell_util_unittest.cc
@@ -1107,7 +1107,7 @@
EXPECT_EQ(L"mailto:app_progid2,web+test:app_progid1", command_line);
// Ensure the above command line arguments parse correctly.
- base::Optional<ShellUtil::ProtocolAssociations> parsed_protocol_associations =
+ absl::optional<ShellUtil::ProtocolAssociations> parsed_protocol_associations =
ShellUtil::ProtocolAssociations::FromCommandLineArgument(command_line);
ASSERT_TRUE(parsed_protocol_associations.has_value());
EXPECT_EQ(protocol_associations.associations,
diff --git a/chrome/renderer/autofill/autofill_renderer_browsertest.cc b/chrome/renderer/autofill/autofill_renderer_browsertest.cc
index c4d1d04..1b73203 100644
--- a/chrome/renderer/autofill/autofill_renderer_browsertest.cc
+++ b/chrome/renderer/autofill/autofill_renderer_browsertest.cc
@@ -69,7 +69,7 @@
private:
// mojom::AutofillDriver:
void SetFormToBeProbablySubmitted(
- const base::Optional<FormData>& form) override {}
+ const absl::optional<FormData>& form) override {}
void FormsSeen(const std::vector<FormData>& forms) override {
// FormsSeen() could be called multiple times and sometimes even with empty
diff --git a/chrome/renderer/autofill/fake_mojo_password_manager_driver.h b/chrome/renderer/autofill/fake_mojo_password_manager_driver.h
index ba7eee45..b2fd8196 100644
--- a/chrome/renderer/autofill/fake_mojo_password_manager_driver.h
+++ b/chrome/renderer/autofill/fake_mojo_password_manager_driver.h
@@ -8,12 +8,12 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "components/autofill/content/common/mojom/autofill_driver.mojom.h"
#include "components/autofill/core/common/unique_ids.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class FakeMojoPasswordManagerDriver
: public autofill::mojom::PasswordManagerDriver {
@@ -49,7 +49,7 @@
return called_password_form_submitted_ && form_data_submitted_;
}
- const base::Optional<autofill::FormData>& form_data_submitted() const {
+ const absl::optional<autofill::FormData>& form_data_submitted() const {
return form_data_submitted_;
}
@@ -57,7 +57,7 @@
return called_dynamic_form_submission_;
}
- const base::Optional<autofill::FormData>& form_data_maybe_submitted() const {
+ const absl::optional<autofill::FormData>& form_data_maybe_submitted() const {
return form_data_maybe_submitted_;
}
@@ -65,7 +65,7 @@
return called_password_forms_parsed_;
}
- const base::Optional<std::vector<autofill::FormData>>& form_data_parsed()
+ const absl::optional<std::vector<autofill::FormData>>& form_data_parsed()
const {
return form_data_parsed_;
}
@@ -74,16 +74,16 @@
return called_password_forms_rendered_;
}
- const base::Optional<std::vector<autofill::FormData>>& form_data_rendered()
+ const absl::optional<std::vector<autofill::FormData>>& form_data_rendered()
const {
return form_data_rendered_;
}
void reset_password_forms_calls() {
called_password_forms_parsed_ = false;
- form_data_parsed_ = base::nullopt;
+ form_data_parsed_ = absl::nullopt;
called_password_forms_rendered_ = false;
- form_data_rendered_ = base::nullopt;
+ form_data_rendered_ = absl::nullopt;
}
bool called_record_save_progress() const {
@@ -98,13 +98,13 @@
return called_save_generation_field_;
}
- const base::Optional<std::u16string>& save_generation_field() const {
+ const absl::optional<std::u16string>& save_generation_field() const {
return save_generation_field_;
}
void reset_save_generation_field() {
called_save_generation_field_ = false;
- save_generation_field_ = base::nullopt;
+ save_generation_field_ = absl::nullopt;
}
int called_check_safe_browsing_reputation_cnt() const {
@@ -160,19 +160,19 @@
// Records whether PasswordFormSubmitted() gets called.
bool called_password_form_submitted_ = false;
// Records data received via PasswordFormSubmitted() call.
- base::Optional<autofill::FormData> form_data_submitted_;
+ absl::optional<autofill::FormData> form_data_submitted_;
// Records data received via ShowManualFallbackForSaving() call.
- base::Optional<autofill::FormData> form_data_maybe_submitted_;
+ absl::optional<autofill::FormData> form_data_maybe_submitted_;
// Records whether DynamicFormSubmission() gets called.
bool called_dynamic_form_submission_ = false;
// Records whether PasswordFormsParsed() gets called.
bool called_password_forms_parsed_ = false;
// Records if the list received via PasswordFormsParsed() call was empty.
- base::Optional<std::vector<autofill::FormData>> form_data_parsed_;
+ absl::optional<std::vector<autofill::FormData>> form_data_parsed_;
// Records whether PasswordFormsRendered() gets called.
bool called_password_forms_rendered_ = false;
// Records data received via PasswordFormsRendered() call.
- base::Optional<std::vector<autofill::FormData>> form_data_rendered_;
+ absl::optional<std::vector<autofill::FormData>> form_data_rendered_;
// Records whether RecordSavePasswordProgress() gets called.
bool called_record_save_progress_ = false;
// Records whether UserModifiedPasswordField() gets called.
@@ -180,7 +180,7 @@
// Records whether SaveGenerationFieldDetectedByClassifier() gets called.
bool called_save_generation_field_ = false;
// Records data received via SaveGenerationFieldDetectedByClassifier() call.
- base::Optional<std::u16string> save_generation_field_;
+ absl::optional<std::u16string> save_generation_field_;
// Records number of times CheckSafeBrowsingReputation() gets called.
int called_check_safe_browsing_reputation_cnt_ = 0;
diff --git a/chrome/renderer/autofill/fake_password_generation_driver.h b/chrome/renderer/autofill/fake_password_generation_driver.h
index de5431b..ade5b36 100644
--- a/chrome/renderer/autofill/fake_password_generation_driver.h
+++ b/chrome/renderer/autofill/fake_password_generation_driver.h
@@ -8,13 +8,13 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "components/autofill/content/common/mojom/autofill_driver.mojom.h"
#include "components/autofill/core/common/password_generation_util.h"
#include "components/autofill/core/common/unique_ids.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class FakePasswordGenerationDriver
: public autofill::mojom::PasswordGenerationDriver {
diff --git a/chrome/renderer/autofill/form_autocomplete_browsertest.cc b/chrome/renderer/autofill/form_autocomplete_browsertest.cc
index 65b93083..8e96117 100644
--- a/chrome/renderer/autofill/form_autocomplete_browsertest.cc
+++ b/chrome/renderer/autofill/form_autocomplete_browsertest.cc
@@ -68,7 +68,7 @@
private:
// mojom::AutofillDriver:
void SetFormToBeProbablySubmitted(
- const base::Optional<FormData>& form) override {}
+ const absl::optional<FormData>& form) override {}
void FormsSeen(const std::vector<FormData>& forms) override {}
diff --git a/chrome/renderer/autofill/password_generation_agent_browsertest.cc b/chrome/renderer/autofill/password_generation_agent_browsertest.cc
index e3b56a4..2275cf6 100644
--- a/chrome/renderer/autofill/password_generation_agent_browsertest.cc
+++ b/chrome/renderer/autofill/password_generation_agent_browsertest.cc
@@ -189,7 +189,7 @@
// Callback for TriggeredGeneratePassword.
MOCK_METHOD1(TriggeredGeneratePasswordReply,
- void(const base::Optional<
+ void(const absl::optional<
autofill::password_generation::PasswordGenerationUIData>&));
FakeMojoPasswordManagerDriver fake_driver_;
@@ -319,10 +319,10 @@
bool available) {
if (available) {
EXPECT_CALL(*this,
- TriggeredGeneratePasswordReply(testing::Ne(base::nullopt)));
+ TriggeredGeneratePasswordReply(testing::Ne(absl::nullopt)));
} else {
EXPECT_CALL(*this,
- TriggeredGeneratePasswordReply(testing::Eq(base::nullopt)));
+ TriggeredGeneratePasswordReply(testing::Eq(absl::nullopt)));
}
password_generation_->TriggeredGeneratePassword(base::BindOnce(
&PasswordGenerationAgentTest::TriggeredGeneratePasswordReply,
diff --git a/chrome/renderer/cart/commerce_hint_agent.cc b/chrome/renderer/cart/commerce_hint_agent.cc
index 02c1feb..2ba0bee 100644
--- a/chrome/renderer/cart/commerce_hint_agent.cc
+++ b/chrome/renderer/cart/commerce_hint_agent.cc
@@ -102,10 +102,10 @@
return observer;
}
-base::Optional<GURL> ScanCartURL(content::RenderFrame* render_frame) {
+absl::optional<GURL> ScanCartURL(content::RenderFrame* render_frame) {
blink::WebDocument doc = render_frame->GetWebFrame()->GetDocument();
- base::Optional<GURL> best;
+ absl::optional<GURL> best;
blink::WebVector<WebElement> elements =
doc.QuerySelectorAll(WebString("a[href]"));
for (WebElement element : elements) {
@@ -585,7 +585,7 @@
void CommerceHintAgent::DidStartNavigation(
const GURL& url,
- base::Optional<blink::WebNavigationType> navigation_type) {
+ absl::optional<blink::WebNavigationType> navigation_type) {
if (!url.SchemeIsHTTPOrHTTPS())
return;
starting_url_ = url;
diff --git a/chrome/renderer/cart/commerce_hint_agent.h b/chrome/renderer/cart/commerce_hint_agent.h
index 688e934..63ea207 100644
--- a/chrome/renderer/cart/commerce_hint_agent.h
+++ b/chrome/renderer/cart/commerce_hint_agent.h
@@ -64,7 +64,7 @@
void WillSendRequest(const blink::WebURLRequest& request) override;
void DidStartNavigation(
const GURL& url,
- base::Optional<blink::WebNavigationType> navigation_type) override;
+ absl::optional<blink::WebNavigationType> navigation_type) override;
void DidCommitProvisionalLoad(ui::PageTransition transition) override;
void DidFinishLoad() override;
void WillSubmitForm(const blink::WebFormElement& form) override;
diff --git a/chrome/renderer/cart/commerce_hint_agent_browsertest.cc b/chrome/renderer/cart/commerce_hint_agent_browsertest.cc
index ad82d9a2..bfe85a0 100644
--- a/chrome/renderer/cart/commerce_hint_agent_browsertest.cc
+++ b/chrome/renderer/cart/commerce_hint_agent_browsertest.cc
@@ -405,7 +405,7 @@
}
IN_PROC_BROWSER_TEST_F(CommerceHintAgentTest, VisitCheckout) {
- service_->AddCart(kMockExample, base::nullopt, kMockExampleProto);
+ service_->AddCart(kMockExample, absl::nullopt, kMockExampleProto);
WaitForCartCount(kExpectedExampleFallbackCart);
NavigateToURL("https://www.guitarcenter.com/");
@@ -414,7 +414,7 @@
}
IN_PROC_BROWSER_TEST_F(CommerceHintAgentTest, PurchaseByURL) {
- service_->AddCart(kMockAmazon, base::nullopt, kMockAmazonProto);
+ service_->AddCart(kMockAmazon, absl::nullopt, kMockAmazonProto);
WaitForCartCount(kExpectedAmazon);
NavigateToURL("http://amazon.com/");
@@ -424,7 +424,7 @@
}
IN_PROC_BROWSER_TEST_F(CommerceHintAgentTest, PurchaseByForm) {
- service_->AddCart(kMockExample, base::nullopt, kMockExampleProto);
+ service_->AddCart(kMockExample, absl::nullopt, kMockExampleProto);
WaitForCartCount(kExpectedExampleFallbackCart);
NavigateToURL("https://www.guitarcenter.com/purchase.html");
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 1aee7c3..2ac02aa 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -1633,7 +1633,7 @@
return false;
// TODO(solomonkinard): Use initiator_origin and add tests.
return extensions::WebAccessibleResourcesInfo::IsResourceWebAccessible(
- extension, url.path(), base::Optional<url::Origin>());
+ extension, url.path(), absl::optional<url::Origin>());
}
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
return true;
diff --git a/chrome/renderer/chrome_content_settings_agent_delegate.cc b/chrome/renderer/chrome_content_settings_agent_delegate.cc
index f876a83..e28c9529 100644
--- a/chrome/renderer/chrome_content_settings_agent_delegate.cc
+++ b/chrome/renderer/chrome_content_settings_agent_delegate.cc
@@ -70,7 +70,7 @@
#endif
}
-base::Optional<bool>
+absl::optional<bool>
ChromeContentSettingsAgentDelegate::AllowReadFromClipboard() {
#if BUILDFLAG(ENABLE_EXTENSIONS)
extensions::ScriptContext* current_context =
@@ -81,10 +81,10 @@
return true;
}
#endif
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<bool>
+absl::optional<bool>
ChromeContentSettingsAgentDelegate::AllowWriteToClipboard() {
#if BUILDFLAG(ENABLE_EXTENSIONS)
// All blessed extension pages could historically write to the clipboard, so
@@ -103,13 +103,13 @@
}
}
#endif
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<bool> ChromeContentSettingsAgentDelegate::AllowMutationEvents() {
+absl::optional<bool> ChromeContentSettingsAgentDelegate::AllowMutationEvents() {
if (IsPlatformApp())
return false;
- return base::nullopt;
+ return absl::nullopt;
}
void ChromeContentSettingsAgentDelegate::PassiveInsecureContentFound(
diff --git a/chrome/renderer/chrome_content_settings_agent_delegate.h b/chrome/renderer/chrome_content_settings_agent_delegate.h
index 6e6428e..56d90c3 100644
--- a/chrome/renderer/chrome_content_settings_agent_delegate.h
+++ b/chrome/renderer/chrome_content_settings_agent_delegate.h
@@ -36,9 +36,9 @@
// content_settings::ContentSettingsAgentImpl::Delegate:
bool IsSchemeAllowlisted(const std::string& scheme) override;
- base::Optional<bool> AllowReadFromClipboard() override;
- base::Optional<bool> AllowWriteToClipboard() override;
- base::Optional<bool> AllowMutationEvents() override;
+ absl::optional<bool> AllowReadFromClipboard() override;
+ absl::optional<bool> AllowWriteToClipboard() override;
+ absl::optional<bool> AllowMutationEvents() override;
void PassiveInsecureContentFound(const blink::WebURL&) override;
private:
diff --git a/chrome/renderer/extensions/chrome_extensions_renderer_client.cc b/chrome/renderer/extensions/chrome_extensions_renderer_client.cc
index 22c7b87..c7a01711 100644
--- a/chrome/renderer/extensions/chrome_extensions_renderer_client.cc
+++ b/chrome/renderer/extensions/chrome_extensions_renderer_client.cc
@@ -11,7 +11,6 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/metrics/histogram_functions.h"
-#include "base/optional.h"
#include "base/stl_util.h"
#include "chrome/common/chrome_isolated_world_ids.h"
#include "chrome/common/chrome_switches.h"
@@ -45,6 +44,7 @@
#include "net/cookies/site_for_cookies.h"
#include "services/metrics/public/cpp/mojo_ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_builders.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/security/protocol_handler_security_level.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/web/web_document.h"
diff --git a/chrome/renderer/extensions/extension_localization_peer.h b/chrome/renderer/extensions/extension_localization_peer.h
index fa8a4575..c9aec68 100644
--- a/chrome/renderer/extensions/extension_localization_peer.h
+++ b/chrome/renderer/extensions/extension_localization_peer.h
@@ -126,7 +126,7 @@
// Set when OnCompletedRequest() is called, and sent to the original peer on
// CompleteRequest().
- base::Optional<network::URLLoaderCompletionStatus> completion_status_;
+ absl::optional<network::URLLoaderCompletionStatus> completion_status_;
// Sends ExtensionHostMsg_GetMessageBundle message to the browser to fetch
// message catalog.
diff --git a/chrome/renderer/extensions/resource_request_policy.cc b/chrome/renderer/extensions/resource_request_policy.cc
index 80a1db5..f4ff9f1e4 100644
--- a/chrome/renderer/extensions/resource_request_policy.cc
+++ b/chrome/renderer/extensions/resource_request_policy.cc
@@ -60,7 +60,7 @@
const GURL& resource_url,
blink::WebLocalFrame* frame,
ui::PageTransition transition_type,
- const base::Optional<url::Origin>& initiator_origin) {
+ const absl::optional<url::Origin>& initiator_origin) {
CHECK(resource_url.SchemeIs(kExtensionScheme));
GURL frame_url = frame->GetDocument().Url();
diff --git a/chrome/renderer/extensions/resource_request_policy.h b/chrome/renderer/extensions/resource_request_policy.h
index e0643c1..921a8091 100644
--- a/chrome/renderer/extensions/resource_request_policy.h
+++ b/chrome/renderer/extensions/resource_request_policy.h
@@ -8,8 +8,8 @@
#include <set>
#include "base/macros.h"
-#include "base/optional.h"
#include "extensions/common/extension_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
#include "url/origin.h"
@@ -39,7 +39,7 @@
bool CanRequestResource(const GURL& resource_url,
blink::WebLocalFrame* frame,
ui::PageTransition transition_type,
- const base::Optional<url::Origin>& initiator_origin);
+ const absl::optional<url::Origin>& initiator_origin);
private:
Dispatcher* dispatcher_;
diff --git a/chrome/renderer/lite_video/lite_video_hint_agent.h b/chrome/renderer/lite_video/lite_video_hint_agent.h
index 426b0dc7..42f2537d 100644
--- a/chrome/renderer/lite_video/lite_video_hint_agent.h
+++ b/chrome/renderer/lite_video/lite_video_hint_agent.h
@@ -72,19 +72,19 @@
// The network downlink bandwidth target in kilobytes per second used to
// calculate the throttling delay on media requests
- base::Optional<int> target_downlink_bandwidth_kbps_;
+ absl::optional<int> target_downlink_bandwidth_kbps_;
// The network downlink rtt target latency used to calculate the
// throttling delay on media requests
- base::Optional<base::TimeDelta> target_downlink_rtt_latency_;
+ absl::optional<base::TimeDelta> target_downlink_rtt_latency_;
// The number of kilobytes for media to be observed before starting to
// throttle requests.
- base::Optional<int> kilobytes_to_buffer_before_throttle_;
+ absl::optional<int> kilobytes_to_buffer_before_throttle_;
// The maximum delay a throttle can introduce for a media request in
// milliseconds.
- base::Optional<base::TimeDelta> max_throttling_delay_;
+ absl::optional<base::TimeDelta> max_throttling_delay_;
// The number of media KB that have been left unthrottled before starting
// to introduce a throttling delay.
diff --git a/chrome/renderer/lite_video/lite_video_util.cc b/chrome/renderer/lite_video/lite_video_util.cc
index 0c1bbce8..572d9c4 100644
--- a/chrome/renderer/lite_video/lite_video_util.cc
+++ b/chrome/renderer/lite_video/lite_video_util.cc
@@ -29,13 +29,13 @@
"max_active_throttles", 50);
}
-base::Optional<uint64_t> GetContentLength(
+absl::optional<uint64_t> GetContentLength(
const network::mojom::URLResponseHead& response_head) {
if (response_head.content_length > 0)
return static_cast<uint64_t>(response_head.content_length);
if (response_head.encoded_body_length > 0)
return static_cast<uint64_t>(response_head.encoded_body_length);
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace lite_video
diff --git a/chrome/renderer/lite_video/lite_video_util.h b/chrome/renderer/lite_video/lite_video_util.h
index 662cc6a..86ff178 100644
--- a/chrome/renderer/lite_video/lite_video_util.h
+++ b/chrome/renderer/lite_video/lite_video_util.h
@@ -7,8 +7,8 @@
#include <stddef.h>
-#include "base/optional.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace lite_video {
@@ -25,9 +25,9 @@
// Returns the maximum active throttles size.
size_t GetMaxActiveThrottles();
-// Returns the content length of the response received. base::nullopt is
+// Returns the content length of the response received. absl::nullopt is
// returned when content length cannot be retrieved.
-base::Optional<uint64_t> GetContentLength(
+absl::optional<uint64_t> GetContentLength(
const network::mojom::URLResponseHead& response_head);
} // namespace lite_video
diff --git a/chrome/renderer/media/media_feeds.cc b/chrome/renderer/media/media_feeds.cc
index fae6fde..d512dbf 100644
--- a/chrome/renderer/media/media_feeds.cc
+++ b/chrome/renderer/media/media_feeds.cc
@@ -20,18 +20,18 @@
using blink::WebNode;
using blink::WebString;
-base::Optional<GURL> MediaFeeds::GetMediaFeedURL(content::RenderFrame* frame) {
+absl::optional<GURL> MediaFeeds::GetMediaFeedURL(content::RenderFrame* frame) {
// Media Feeds are only discovered on the main frame.
if (!frame->IsMainFrame())
- return base::nullopt;
+ return absl::nullopt;
WebDocument document = frame->GetWebFrame()->GetDocument();
if (document.IsNull())
- return base::nullopt;
+ return absl::nullopt;
WebElement head = document.Head();
if (head.IsNull())
- return base::nullopt;
+ return absl::nullopt;
url::Origin document_origin = document.GetSecurityOrigin();
@@ -60,7 +60,7 @@
frame->AddMessageToConsole(blink::mojom::ConsoleMessageLevel::kWarning,
"The Media Feed URL is not a valid URL.");
- return base::nullopt;
+ return absl::nullopt;
}
// If the URL is not the same origin as the document then we should throw
@@ -71,11 +71,11 @@
"The Media Feed URL needs to be the same "
"origin as the document URL.");
- return base::nullopt;
+ return absl::nullopt;
}
return url;
}
- return base::nullopt;
+ return absl::nullopt;
}
diff --git a/chrome/renderer/media/media_feeds.h b/chrome/renderer/media/media_feeds.h
index 910a90e5..a5e17333 100644
--- a/chrome/renderer/media/media_feeds.h
+++ b/chrome/renderer/media/media_feeds.h
@@ -5,7 +5,7 @@
#ifndef CHROME_RENDERER_MEDIA_MEDIA_FEEDS_H_
#define CHROME_RENDERER_MEDIA_MEDIA_FEEDS_H_
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
@@ -16,7 +16,7 @@
class MediaFeeds {
public:
// Gets the Media Feed URL (if present).
- static base::Optional<GURL> GetMediaFeedURL(content::RenderFrame* frame);
+ static absl::optional<GURL> GetMediaFeedURL(content::RenderFrame* frame);
};
#endif // CHROME_RENDERER_MEDIA_MEDIA_FEEDS_H_
diff --git a/chrome/renderer/net/net_error_helper_core_unittest.cc b/chrome/renderer/net/net_error_helper_core_unittest.cc
index 9ccb67c..3d4e2fc 100644
--- a/chrome/renderer/net/net_error_helper_core_unittest.cc
+++ b/chrome/renderer/net/net_error_helper_core_unittest.cc
@@ -149,7 +149,7 @@
#if defined(OS_ANDROID)
// State of auto fetch, as reported to Delegate. Unset if SetAutoFetchState
// was not called.
- base::Optional<chrome::mojom::OfflinePageAutoFetcherScheduleResult>
+ absl::optional<chrome::mojom::OfflinePageAutoFetcherScheduleResult>
auto_fetch_state() const {
return auto_fetch_state_;
}
@@ -280,7 +280,7 @@
std::string offline_content_json_;
std::string offline_content_summary_json_;
#if defined(OS_ANDROID)
- base::Optional<chrome::mojom::OfflinePageAutoFetcherScheduleResult>
+ absl::optional<chrome::mojom::OfflinePageAutoFetcherScheduleResult>
auto_fetch_state_;
#endif
bool offline_content_feature_enabled_ = false;
diff --git a/chrome/renderer/previews/resource_loading_hints_agent.h b/chrome/renderer/previews/resource_loading_hints_agent.h
index e00bc3d1..fa11d806b 100644
--- a/chrome/renderer/previews/resource_loading_hints_agent.h
+++ b/chrome/renderer/previews/resource_loading_hints_agent.h
@@ -7,13 +7,13 @@
#include "base/bind.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/common/previews_resource_loading_hints.mojom.h"
#include "chrome/renderer/lite_video/lite_video_hint_agent.h"
#include "content/public/renderer/render_frame_observer.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "services/service_manager/public/cpp/interface_provider.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/associated_interfaces/associated_interface_registry.h"
#include "url/gurl.h"
diff --git a/chrome/renderer/searchbox/searchbox.h b/chrome/renderer/searchbox/searchbox.h
index 3d6b957..27839c019 100644
--- a/chrome/renderer/searchbox/searchbox.h
+++ b/chrome/renderer/searchbox/searchbox.h
@@ -10,7 +10,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/common/search/instant_types.h"
#include "chrome/common/search/ntp_logging_events.h"
#include "chrome/common/search/search.mojom.h"
@@ -21,6 +20,7 @@
#include "content/public/renderer/render_frame_observer_tracker.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
// The renderer-side implementation of the embeddedSearch API (see
@@ -250,7 +250,7 @@
// comparing most visited items.
InstantMostVisitedInfo most_visited_info_;
bool has_received_most_visited_;
- base::Optional<NtpTheme> theme_;
+ absl::optional<NtpTheme> theme_;
base::WeakPtrFactory<SearchBox> weak_ptr_factory_{this};
diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc
index d06cd45..718bb9fd 100644
--- a/chrome/renderer/searchbox/searchbox_extension.cc
+++ b/chrome/renderer/searchbox/searchbox_extension.cc
@@ -174,12 +174,12 @@
return base::Time::FromJsTime(v8::Date::Cast(value)->ValueOf());
}
-base::Optional<int> CoerceToInt(v8::Isolate* isolate, v8::Value* value) {
+absl::optional<int> CoerceToInt(v8::Isolate* isolate, v8::Value* value) {
DCHECK(value);
v8::MaybeLocal<v8::Int32> maybe_int =
value->ToInt32(isolate->GetCurrentContext());
if (maybe_int.IsEmpty())
- return base::nullopt;
+ return absl::nullopt;
return maybe_int.ToLocalChecked()->Value();
}
@@ -227,10 +227,10 @@
!color->Get(context, 3).ToLocal(&a_value))
return false;
- base::Optional<int> r = CoerceToInt(isolate, *r_value);
- base::Optional<int> g = CoerceToInt(isolate, *g_value);
- base::Optional<int> b = CoerceToInt(isolate, *b_value);
- base::Optional<int> a = CoerceToInt(isolate, *a_value);
+ absl::optional<int> r = CoerceToInt(isolate, *r_value);
+ absl::optional<int> g = CoerceToInt(isolate, *g_value);
+ absl::optional<int> b = CoerceToInt(isolate, *b_value);
+ absl::optional<int> a = CoerceToInt(isolate, *a_value);
if (!r.has_value() || !g.has_value() || !b.has_value() || !a.has_value())
return false;
@@ -890,7 +890,7 @@
void NewTabPageBindings::DeleteMostVisitedItem(v8::Isolate* isolate,
v8::Local<v8::Value> rid_value) {
// Manually convert to integer, so that the string "\"1\"" is also accepted.
- base::Optional<int> rid = CoerceToInt(isolate, *rid_value);
+ absl::optional<int> rid = CoerceToInt(isolate, *rid_value);
if (!rid.has_value())
return;
SearchBox* search_box = GetSearchBoxForCurrentContext();
@@ -921,7 +921,7 @@
v8::Isolate* isolate,
v8::Local<v8::Value> rid_value) {
// Manually convert to integer, so that the string "\"1\"" is also accepted.
- base::Optional<int> rid = CoerceToInt(isolate, *rid_value);
+ absl::optional<int> rid = CoerceToInt(isolate, *rid_value);
if (!rid.has_value())
return;
SearchBox* search_box = GetSearchBoxForCurrentContext();
diff --git a/chrome/renderer/subresource_redirect/login_robots_compression_metrics.cc b/chrome/renderer/subresource_redirect/login_robots_compression_metrics.cc
index 237d285..5cdf8a9 100644
--- a/chrome/renderer/subresource_redirect/login_robots_compression_metrics.cc
+++ b/chrome/renderer/subresource_redirect/login_robots_compression_metrics.cc
@@ -28,7 +28,7 @@
void LoginRobotsCompressionMetrics::RecordMetricsOnLoadFinished(
SubresourceRedirectResult redirect_result,
size_t content_length,
- base::Optional<size_t> ofcl) {
+ absl::optional<size_t> ofcl) {
base::TimeTicks response_received_time = base::TimeTicks::Now();
ukm::builders::PublicImageCompressionImageLoad
diff --git a/chrome/renderer/subresource_redirect/login_robots_compression_metrics.h b/chrome/renderer/subresource_redirect/login_robots_compression_metrics.h
index f7fb756..a74ec80 100644
--- a/chrome/renderer/subresource_redirect/login_robots_compression_metrics.h
+++ b/chrome/renderer/subresource_redirect/login_robots_compression_metrics.h
@@ -6,10 +6,10 @@
#define CHROME_RENDERER_SUBRESOURCE_REDIRECT_LOGIN_ROBOTS_COMPRESSION_METRICS_H_
#include <cstdint>
-#include "base/optional.h"
#include "base/time/time.h"
#include "components/subresource_redirect/common/subresource_redirect_result.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace subresource_redirect {
@@ -33,7 +33,7 @@
// server.
void RecordMetricsOnLoadFinished(SubresourceRedirectResult redirect_result,
size_t content_length,
- base::Optional<size_t> ofcl);
+ absl::optional<size_t> ofcl);
private:
ukm::SourceId ukm_source_id_;
diff --git a/chrome/renderer/subresource_redirect/login_robots_decider_agent.cc b/chrome/renderer/subresource_redirect/login_robots_decider_agent.cc
index 0c05fb3a..3a485e66 100644
--- a/chrome/renderer/subresource_redirect/login_robots_decider_agent.cc
+++ b/chrome/renderer/subresource_redirect/login_robots_decider_agent.cc
@@ -53,7 +53,7 @@
LoginRobotsDeciderAgent::~LoginRobotsDeciderAgent() = default;
-base::Optional<SubresourceRedirectResult>
+absl::optional<SubresourceRedirectResult>
LoginRobotsDeciderAgent::ShouldRedirectSubresource(
const GURL& url,
ShouldRedirectDecisionCallback callback) {
@@ -83,7 +83,7 @@
robots_rules_parser_cache.GetWeakPtr(), origin));
}
- base::Optional<RobotsRulesParser::CheckResult> result =
+ absl::optional<RobotsRulesParser::CheckResult> result =
robots_rules_parser_cache.CheckRobotsRules(
routing_id(), url,
base::BindOnce(
@@ -96,7 +96,7 @@
return redirect_result;
}
- return base::nullopt;
+ return absl::nullopt;
}
void LoginRobotsDeciderAgent::OnShouldRedirectSubresourceResult(
@@ -124,7 +124,7 @@
: SubresourceRedirectResult::kRedirectable;
// Clear the logged-in state so it won't be reused for subsequent
// navigations.
- is_pending_navigation_loggged_in_ = base::nullopt;
+ is_pending_navigation_loggged_in_ = absl::nullopt;
} else {
// Logged-in state was not sent for the current navigation.
redirect_result_ = SubresourceRedirectResult::kUnknown;
diff --git a/chrome/renderer/subresource_redirect/login_robots_decider_agent.h b/chrome/renderer/subresource_redirect/login_robots_decider_agent.h
index c171b26c..3d533deb 100644
--- a/chrome/renderer/subresource_redirect/login_robots_decider_agent.h
+++ b/chrome/renderer/subresource_redirect/login_robots_decider_agent.h
@@ -43,7 +43,7 @@
void SetLoggedInState(bool is_logged_in) override;
// PublicResourceDeciderAgent:
- base::Optional<SubresourceRedirectResult> ShouldRedirectSubresource(
+ absl::optional<SubresourceRedirectResult> ShouldRedirectSubresource(
const GURL& url,
ShouldRedirectDecisionCallback callback) override;
void RecordMetricsOnLoadFinished(
@@ -73,10 +73,10 @@
// SetLoggedInState() mojo which is sent just before the navigation is
// committed in the browser process, and used in ReadyToCommitNavigation()
// when the navigation is committed in the renderer process. Value of
- // base::nullopt means logged-in state hasn't arrived from the browser. This
+ // absl::nullopt means logged-in state hasn't arrived from the browser. This
// value should be reset after each navigation commit, so that it won't get
// accidentally reused for subsequent navigations.
- base::Optional<bool> is_pending_navigation_loggged_in_;
+ absl::optional<bool> is_pending_navigation_loggged_in_;
THREAD_CHECKER(thread_checker_);
diff --git a/chrome/renderer/subresource_redirect/login_robots_decider_agent_browsertest.cc b/chrome/renderer/subresource_redirect/login_robots_decider_agent_browsertest.cc
index 3f6173f3..2afcd32 100644
--- a/chrome/renderer/subresource_redirect/login_robots_decider_agent_browsertest.cc
+++ b/chrome/renderer/subresource_redirect/login_robots_decider_agent_browsertest.cc
@@ -99,7 +99,7 @@
return login_robots_decider_agent_->redirect_result_;
}
- base::Optional<bool> is_pending_navigation_loggged_in() {
+ absl::optional<bool> is_pending_navigation_loggged_in() {
return login_robots_decider_agent_->is_pending_navigation_loggged_in_;
}
diff --git a/chrome/renderer/subresource_redirect/public_image_hints_decider_agent.cc b/chrome/renderer/subresource_redirect/public_image_hints_decider_agent.cc
index fa4bcc83e..ba2a2f90 100644
--- a/chrome/renderer/subresource_redirect/public_image_hints_decider_agent.cc
+++ b/chrome/renderer/subresource_redirect/public_image_hints_decider_agent.cc
@@ -46,12 +46,12 @@
void PublicImageHintsDeciderAgent::DidStartNavigation(
const GURL& url,
- base::Optional<blink::WebNavigationType> navigation_type) {
+ absl::optional<blink::WebNavigationType> navigation_type) {
if (!IsMainFrame())
return;
// Clear the hints when a navigation starts, so that hints from previous
// navigation do not apply in case the same renderframe is reused.
- public_image_urls_ = base::nullopt;
+ public_image_urls_ = absl::nullopt;
}
void PublicImageHintsDeciderAgent::ReadyToCommitNavigation(
@@ -82,7 +82,7 @@
RecordImageHintsUnavailableMetrics();
}
-base::Optional<SubresourceRedirectResult>
+absl::optional<SubresourceRedirectResult>
PublicImageHintsDeciderAgent::ShouldRedirectSubresource(
const GURL& url,
ShouldRedirectDecisionCallback callback) {
diff --git a/chrome/renderer/subresource_redirect/public_image_hints_decider_agent.h b/chrome/renderer/subresource_redirect/public_image_hints_decider_agent.h
index 35922985..c688bc8d 100644
--- a/chrome/renderer/subresource_redirect/public_image_hints_decider_agent.h
+++ b/chrome/renderer/subresource_redirect/public_image_hints_decider_agent.h
@@ -7,10 +7,10 @@
#include "base/containers/flat_set.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "base/timer/timer.h"
#include "chrome/renderer/subresource_redirect/public_resource_decider_agent.h"
#include "components/subresource_redirect/common/subresource_redirect_result.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace subresource_redirect {
@@ -34,7 +34,7 @@
// content::RenderFrameObserver:
void DidStartNavigation(
const GURL& url,
- base::Optional<blink::WebNavigationType> navigation_type) override;
+ absl::optional<blink::WebNavigationType> navigation_type) override;
void ReadyToCommitNavigation(
blink::WebDocumentLoader* document_loader) override;
void OnDestruct() override;
@@ -45,7 +45,7 @@
void SetLoggedInState(bool is_logged_in) override;
// PublicResourceDeciderAgent:
- base::Optional<SubresourceRedirectResult> ShouldRedirectSubresource(
+ absl::optional<SubresourceRedirectResult> ShouldRedirectSubresource(
const GURL& url,
ShouldRedirectDecisionCallback callback) override;
void RecordMetricsOnLoadFinished(
@@ -75,9 +75,9 @@
void RecordImageHintsUnavailableMetrics();
// The raw spec of image urls that are determined public, received from image
- // hints. Will be base::nullopt after the navigation starts and until the
+ // hints. Will be absl::nullopt after the navigation starts and until the
// hints have been received.
- base::Optional<base::flat_set<std::string>> public_image_urls_;
+ absl::optional<base::flat_set<std::string>> public_image_urls_;
// To trigger the timeout for the hints to be received from the time
// navigation starts.
diff --git a/chrome/renderer/subresource_redirect/public_resource_decider.h b/chrome/renderer/subresource_redirect/public_resource_decider.h
index cb646ceb..1561888 100644
--- a/chrome/renderer/subresource_redirect/public_resource_decider.h
+++ b/chrome/renderer/subresource_redirect/public_resource_decider.h
@@ -6,9 +6,9 @@
#define CHROME_RENDERER_SUBRESOURCE_REDIRECT_PUBLIC_RESOURCE_DECIDER_H_
#include "base/bind.h"
-#include "base/optional.h"
#include "base/time/time.h"
#include "components/subresource_redirect/common/subresource_redirect_result.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace subresource_redirect {
@@ -47,9 +47,9 @@
// Determine whether the subresource url should be redirected. When the
// determination can be made immediately, the decision should be returned.
- // Otherwise base::nullopt should be returned and the callback should be
+ // Otherwise absl::nullopt should be returned and the callback should be
// invoked with the decision asynchronously.
- virtual base::Optional<SubresourceRedirectResult> ShouldRedirectSubresource(
+ virtual absl::optional<SubresourceRedirectResult> ShouldRedirectSubresource(
const GURL& url,
ShouldRedirectDecisionCallback callback) = 0;
diff --git a/chrome/renderer/subresource_redirect/public_resource_decider_agent.h b/chrome/renderer/subresource_redirect/public_resource_decider_agent.h
index 6d135c0..2895665 100644
--- a/chrome/renderer/subresource_redirect/public_resource_decider_agent.h
+++ b/chrome/renderer/subresource_redirect/public_resource_decider_agent.h
@@ -6,7 +6,6 @@
#define CHROME_RENDERER_SUBRESOURCE_REDIRECT_PUBLIC_RESOURCE_DECIDER_AGENT_H_
#include "base/bind.h"
-#include "base/optional.h"
#include "chrome/common/subresource_redirect_service.mojom.h"
#include "chrome/renderer/subresource_redirect/public_resource_decider.h"
#include "components/subresource_redirect/common/subresource_redirect_result.h"
@@ -14,6 +13,7 @@
#include "content/public/renderer/render_frame_observer_tracker.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.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/associated_interfaces/associated_interface_registry.h"
#include "url/gurl.h"
diff --git a/chrome/renderer/subresource_redirect/robots_rules_parser.cc b/chrome/renderer/subresource_redirect/robots_rules_parser.cc
index ee89aed4..09d50989 100644
--- a/chrome/renderer/subresource_redirect/robots_rules_parser.cc
+++ b/chrome/renderer/subresource_redirect/robots_rules_parser.cc
@@ -140,7 +140,7 @@
}
void RobotsRulesParser::UpdateRobotsRules(
- const base::Optional<std::string>& rules) {
+ const absl::optional<std::string>& rules) {
robots_rules_.clear();
rules_receive_timeout_timer_.Stop();
@@ -184,7 +184,7 @@
pending_check_requests_.clear();
}
-base::Optional<RobotsRulesParser::CheckResult>
+absl::optional<RobotsRulesParser::CheckResult>
RobotsRulesParser::CheckRobotsRules(int routing_id,
const GURL& url,
CheckResultCallback callback) {
@@ -198,7 +198,7 @@
std::vector<std::pair<CheckResultCallback, std::string>>()));
it.first->second.emplace_back(
std::make_pair(std::move(callback), path_with_query));
- return base::nullopt;
+ return absl::nullopt;
}
return CheckRobotsRulesImmediate(path_with_query);
}
diff --git a/chrome/renderer/subresource_redirect/robots_rules_parser.h b/chrome/renderer/subresource_redirect/robots_rules_parser.h
index fdb1faeb..fb0b450 100644
--- a/chrome/renderer/subresource_redirect/robots_rules_parser.h
+++ b/chrome/renderer/subresource_redirect/robots_rules_parser.h
@@ -76,17 +76,17 @@
// Update the robots rules. This causes any pending check requests to be
// processed immediately and called with the result.
- void UpdateRobotsRules(const base::Optional<std::string>& rules);
+ void UpdateRobotsRules(const absl::optional<std::string>& rules);
// Check whether the URL is allowed or disallowed by robots rules. When the
// determination can be made immediately, the decision should be returned.
- // Otherwise base::nullopt should be returned and the |callback| will be
+ // Otherwise absl::nullopt should be returned and the |callback| will be
// added to |pending_check_requests_| and called when a decision can be made
// like when rules are retrieved, or rule fetch timeout, etc.
// The robots rules check will make use of the |url| path and query
// parameters.The |url| origin, ref fragment, etc are immaterial. |routing_id|
// is the render frame ID for which this URL is requested for.
- base::Optional<CheckResult> CheckRobotsRules(int routing_id,
+ absl::optional<CheckResult> CheckRobotsRules(int routing_id,
const GURL& url,
CheckResultCallback callback);
diff --git a/chrome/renderer/subresource_redirect/robots_rules_parser_cache.cc b/chrome/renderer/subresource_redirect/robots_rules_parser_cache.cc
index 765b5cb..7edfb3e6 100644
--- a/chrome/renderer/subresource_redirect/robots_rules_parser_cache.cc
+++ b/chrome/renderer/subresource_redirect/robots_rules_parser_cache.cc
@@ -34,7 +34,7 @@
void RobotsRulesParserCache::UpdateRobotsRules(
const url::Origin& origin,
- const base::Optional<std::string>& rules) {
+ const absl::optional<std::string>& rules) {
// Update the rules when cache has an entry for the origin. It may be missing
// due to cache eviction.
auto it = parsers_cache_.Get(origin);
@@ -42,7 +42,7 @@
it->second->UpdateRobotsRules(rules);
}
-base::Optional<RobotsRulesParser::CheckResult>
+absl::optional<RobotsRulesParser::CheckResult>
RobotsRulesParserCache::CheckRobotsRules(
int routing_id,
const GURL& url,
diff --git a/chrome/renderer/subresource_redirect/robots_rules_parser_cache.h b/chrome/renderer/subresource_redirect/robots_rules_parser_cache.h
index 5def893..c8931fba 100644
--- a/chrome/renderer/subresource_redirect/robots_rules_parser_cache.h
+++ b/chrome/renderer/subresource_redirect/robots_rules_parser_cache.h
@@ -37,14 +37,14 @@
// Update the robots |rules| to the parser for the |origin|. This update only
// happens when the cache already has an entry for |origin|.
void UpdateRobotsRules(const url::Origin& origin,
- const base::Optional<std::string>& rules);
+ const absl::optional<std::string>& rules);
// Returns the result of checking whether resource |url| is allowed by robots
// rules parser for the url origin. When the determination can be made
- // immediately, the decision should be returned. Otherwise base::nullopt
+ // immediately, the decision should be returned. Otherwise absl::nullopt
// should be returned and the |callback| will be invoked when the decision was
// made.
- base::Optional<RobotsRulesParser::CheckResult> CheckRobotsRules(
+ absl::optional<RobotsRulesParser::CheckResult> CheckRobotsRules(
int routing_id,
const GURL& url,
RobotsRulesParser::CheckResultCallback callback);
diff --git a/chrome/renderer/subresource_redirect/robots_rules_parser_cache_browsertest.cc b/chrome/renderer/subresource_redirect/robots_rules_parser_cache_browsertest.cc
index a63581a..8c312b0 100644
--- a/chrome/renderer/subresource_redirect/robots_rules_parser_cache_browsertest.cc
+++ b/chrome/renderer/subresource_redirect/robots_rules_parser_cache_browsertest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/strings/strcat.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
@@ -19,6 +18,7 @@
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace subresource_redirect {
diff --git a/chrome/renderer/subresource_redirect/robots_rules_parser_fuzzer.cc b/chrome/renderer/subresource_redirect/robots_rules_parser_fuzzer.cc
index 6152986..d55c26a 100644
--- a/chrome/renderer/subresource_redirect/robots_rules_parser_fuzzer.cc
+++ b/chrome/renderer/subresource_redirect/robots_rules_parser_fuzzer.cc
@@ -7,9 +7,9 @@
#include <stdint.h>
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/test/task_environment.h"
#include "base/test/test_timeouts.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/icu/fuzzers/fuzzer_utils.h"
#include "chrome/renderer/subresource_redirect/robots_rules_parser.h"
@@ -27,7 +27,7 @@
private:
IcuEnvironment icu;
- base::Optional<base::test::SingleThreadTaskEnvironment> task_env_;
+ absl::optional<base::test::SingleThreadTaskEnvironment> task_env_;
};
} // namespace
diff --git a/chrome/renderer/subresource_redirect/src_video_redirect_url_loader_throttle.cc b/chrome/renderer/subresource_redirect/src_video_redirect_url_loader_throttle.cc
index 1fbaf00..bf6002b3 100644
--- a/chrome/renderer/subresource_redirect/src_video_redirect_url_loader_throttle.cc
+++ b/chrome/renderer/subresource_redirect/src_video_redirect_url_loader_throttle.cc
@@ -29,7 +29,7 @@
// Returns the full content length of the response, either from the range, or
// content-length response headers, or the total body length.
-base::Optional<uint64_t> GetFullContentLength(
+absl::optional<uint64_t> GetFullContentLength(
const network::mojom::URLResponseHead& response_head) {
if (response_head.headers->response_code() == net::HTTP_PARTIAL_CONTENT) {
// Parse the full length from range response.
@@ -45,7 +45,7 @@
if (response_head.encoded_body_length > 0)
return static_cast<uint64_t>(response_head.encoded_body_length);
}
- return base::nullopt;
+ return absl::nullopt;
}
} // namespace
diff --git a/chrome/renderer/subresource_redirect/subresource_redirect_url_loader_throttle.cc b/chrome/renderer/subresource_redirect/subresource_redirect_url_loader_throttle.cc
index 4830c3c..eb139e4 100644
--- a/chrome/renderer/subresource_redirect/subresource_redirect_url_loader_throttle.cc
+++ b/chrome/renderer/subresource_redirect/subresource_redirect_url_loader_throttle.cc
@@ -45,7 +45,7 @@
LoginRobotsCompressionMetrics* login_robots_compression_metrics,
SubresourceRedirectResult redirect_result,
uint64_t content_length,
- base::Optional<float> ofcl) {
+ absl::optional<float> ofcl) {
if (login_robots_compression_metrics) {
login_robots_compression_metrics->RecordMetricsOnLoadFinished(
redirect_result, content_length, ofcl);
@@ -324,7 +324,7 @@
PublicResourceDeciderRedirectState::kRedirectAttempted) {
RecordMetricsOnLoadFinished(
base::OptionalOrNullptr(login_robots_compression_metrics_),
- redirect_result_, content_length, base::nullopt);
+ redirect_result_, content_length, absl::nullopt);
return;
}
DCHECK(ShouldCompressRedirectSubresource());
@@ -337,7 +337,7 @@
if (response_head->headers->response_code() != 200) {
RecordMetricsOnLoadFinished(
base::OptionalOrNullptr(login_robots_compression_metrics_),
- redirect_result_, content_length, base::nullopt);
+ redirect_result_, content_length, absl::nullopt);
return;
}
@@ -349,7 +349,7 @@
if (ofcl <= 0) {
RecordMetricsOnLoadFinished(
base::OptionalOrNullptr(login_robots_compression_metrics_),
- redirect_result_, content_length, base::nullopt);
+ redirect_result_, content_length, absl::nullopt);
return;
}
diff --git a/chrome/renderer/subresource_redirect/subresource_redirect_url_loader_throttle.h b/chrome/renderer/subresource_redirect/subresource_redirect_url_loader_throttle.h
index 3330f588..56bb966 100644
--- a/chrome/renderer/subresource_redirect/subresource_redirect_url_loader_throttle.h
+++ b/chrome/renderer/subresource_redirect/subresource_redirect_url_loader_throttle.h
@@ -88,7 +88,7 @@
SubresourceRedirectResult::kUnknown;
// Used to record the image load and compression metrics.
- base::Optional<LoginRobotsCompressionMetrics>
+ absl::optional<LoginRobotsCompressionMetrics>
login_robots_compression_metrics_;
// Used to get a weak pointer to |this|.
diff --git a/chrome/renderer/translate/per_frame_translate_agent_browsertest.cc b/chrome/renderer/translate/per_frame_translate_agent_browsertest.cc
index 896e44b..0d0e407 100644
--- a/chrome/renderer/translate/per_frame_translate_agent_browsertest.cc
+++ b/chrome/renderer/translate/per_frame_translate_agent_browsertest.cc
@@ -40,8 +40,8 @@
void CallGetWebLanguageDetectionDetails() {
// Reset result values firstly.
detected_language_details_ = false;
- detected_content_meta_lang_ = base::nullopt;
- detected_html_root_lang_ = base::nullopt;
+ detected_content_meta_lang_ = absl::nullopt;
+ detected_html_root_lang_ = absl::nullopt;
detected_has_notranslate_meta_ = false;
// Will get new result values via OnWebLanguageDetectionDetails.
@@ -70,8 +70,8 @@
// Reset result values firstly.
page_translated_ = false;
trans_result_cancelled_ = false;
- trans_result_source_lang_ = base::nullopt;
- trans_result_translated_lang_ = base::nullopt;
+ trans_result_source_lang_ = absl::nullopt;
+ trans_result_translated_lang_ = absl::nullopt;
trans_result_error_type_ = translate::TranslateErrors::NONE;
// Will get new result values via OnPageTranslated.
@@ -131,14 +131,14 @@
}
bool detected_language_details_;
- base::Optional<std::string> detected_content_meta_lang_;
- base::Optional<std::string> detected_html_root_lang_;
+ absl::optional<std::string> detected_content_meta_lang_;
+ absl::optional<std::string> detected_html_root_lang_;
bool detected_has_notranslate_meta_;
bool page_translated_;
bool trans_result_cancelled_;
- base::Optional<std::string> trans_result_source_lang_;
- base::Optional<std::string> trans_result_translated_lang_;
+ absl::optional<std::string> trans_result_source_lang_;
+ absl::optional<std::string> trans_result_translated_lang_;
translate::TranslateErrors::Type trans_result_error_type_;
DISALLOW_COPY_AND_ASSIGN(PerFrameTranslateAgent);
diff --git a/chrome/renderer/translate/translate_agent_browsertest.cc b/chrome/renderer/translate/translate_agent_browsertest.cc
index bc8680dc..b49f550 100644
--- a/chrome/renderer/translate/translate_agent_browsertest.cc
+++ b/chrome/renderer/translate/translate_agent_browsertest.cc
@@ -63,13 +63,13 @@
void ResetNewPageValues() {
called_new_page_ = false;
- details_ = base::nullopt;
+ details_ = absl::nullopt;
page_level_translation_critiera_met_ = false;
}
bool called_new_page_ = false;
bool page_level_translation_critiera_met_ = false;
- base::Optional<translate::LanguageDetectionDetails> details_;
+ absl::optional<translate::LanguageDetectionDetails> details_;
private:
mojo::ReceiverSet<translate::mojom::ContentTranslateDriver> receivers_;
@@ -96,8 +96,8 @@
// Reset result values firstly.
page_translated_ = false;
trans_result_cancelled_ = false;
- trans_result_source_lang_ = base::nullopt;
- trans_result_translated_lang_ = base::nullopt;
+ trans_result_source_lang_ = absl::nullopt;
+ trans_result_translated_lang_ = absl::nullopt;
trans_result_error_type_ = translate::TranslateErrors::NONE;
// Will get new result values via OnPageTranslated.
@@ -148,8 +148,8 @@
bool page_translated_;
bool trans_result_cancelled_;
- base::Optional<std::string> trans_result_source_lang_;
- base::Optional<std::string> trans_result_translated_lang_;
+ absl::optional<std::string> trans_result_source_lang_;
+ absl::optional<std::string> trans_result_translated_lang_;
translate::TranslateErrors::Type trans_result_error_type_;
DISALLOW_COPY_AND_ASSIGN(TestTranslateAgent);
diff --git a/chrome/service/cloud_print/cloud_print_connector.cc b/chrome/service/cloud_print/cloud_print_connector.cc
index b58dc54..9fd432df 100644
--- a/chrome/service/cloud_print/cloud_print_connector.cc
+++ b/chrome/service/cloud_print/cloud_print_connector.cc
@@ -466,7 +466,7 @@
for (const auto& printer : printer_list->GetList()) {
if (printer.is_dict()) {
int xmpp_timeout = 0;
- base::Optional<int> timeout =
+ absl::optional<int> timeout =
printer.FindIntKey(kLocalSettingsPendingXmppValue);
if (timeout) {
xmpp_timeout = *timeout;
diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc
index 995c7d90..63c48ee 100644
--- a/chrome/service/cloud_print/print_system_cups.cc
+++ b/chrome/service/cloud_print/print_system_cups.cc
@@ -532,7 +532,7 @@
const std::string& print_ticket_data,
const std::string& print_ticket_mime_type) {
DCHECK(initialized_);
- base::Optional<base::Value> ticket =
+ absl::optional<base::Value> ticket =
base::JSONReader::Read(print_ticket_data);
return ticket.has_value() && ticket.value().is_dict();
}
@@ -542,7 +542,7 @@
const std::string& print_ticket,
std::map<std::string, std::string>* options) {
DCHECK(options);
- base::Optional<base::Value> ticket = base::JSONReader::Read(print_ticket);
+ absl::optional<base::Value> ticket = base::JSONReader::Read(print_ticket);
if (!ticket.has_value() || !ticket.value().is_dict())
return false;
diff --git a/chrome/services/cups_proxy/cups_proxy_service_delegate.h b/chrome/services/cups_proxy/cups_proxy_service_delegate.h
index f435a6d4..f86abfd 100644
--- a/chrome/services/cups_proxy/cups_proxy_service_delegate.h
+++ b/chrome/services/cups_proxy/cups_proxy_service_delegate.h
@@ -36,7 +36,7 @@
virtual std::vector<chromeos::Printer> GetPrinters(
chromeos::PrinterClass printer_class) = 0;
- virtual base::Optional<chromeos::Printer> GetPrinter(
+ virtual absl::optional<chromeos::Printer> GetPrinter(
const std::string& id) = 0;
virtual std::vector<std::string> GetRecentlyUsedPrinters() = 0;
virtual bool IsPrinterInstalled(const chromeos::Printer& printer) = 0;
diff --git a/chrome/services/cups_proxy/fake_cups_proxy_service_delegate.cc b/chrome/services/cups_proxy/fake_cups_proxy_service_delegate.cc
index 9ada828..e349096 100644
--- a/chrome/services/cups_proxy/fake_cups_proxy_service_delegate.cc
+++ b/chrome/services/cups_proxy/fake_cups_proxy_service_delegate.cc
@@ -15,9 +15,9 @@
return {};
}
-base::Optional<chromeos::Printer> FakeCupsProxyServiceDelegate::GetPrinter(
+absl::optional<chromeos::Printer> FakeCupsProxyServiceDelegate::GetPrinter(
const std::string& id) {
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<std::string>
diff --git a/chrome/services/cups_proxy/fake_cups_proxy_service_delegate.h b/chrome/services/cups_proxy/fake_cups_proxy_service_delegate.h
index 4ba6cdc..cbe25540 100644
--- a/chrome/services/cups_proxy/fake_cups_proxy_service_delegate.h
+++ b/chrome/services/cups_proxy/fake_cups_proxy_service_delegate.h
@@ -24,7 +24,7 @@
bool IsPrinterAccessAllowed() const override;
std::vector<chromeos::Printer> GetPrinters(
chromeos::PrinterClass printer_class) override;
- base::Optional<chromeos::Printer> GetPrinter(const std::string& id) override;
+ absl::optional<chromeos::Printer> GetPrinter(const std::string& id) override;
std::vector<std::string> GetRecentlyUsedPrinters() override;
bool IsPrinterInstalled(const chromeos::Printer& printer) override;
void PrinterInstalled(const chromeos::Printer& printer) override;
diff --git a/chrome/services/cups_proxy/ipp_validator.cc b/chrome/services/cups_proxy/ipp_validator.cc
index dc84ccd..f7c2c09f 100644
--- a/chrome/services/cups_proxy/ipp_validator.cc
+++ b/chrome/services/cups_proxy/ipp_validator.cc
@@ -111,15 +111,15 @@
// Verifies that |method|, |endpoint|, and |http_version| form a valid HTTP
// request-line. On success, returns a wrapper obj containing the verified
// request-line.
-base::Optional<HttpRequestLine> IppValidator::ValidateHttpRequestLine(
+absl::optional<HttpRequestLine> IppValidator::ValidateHttpRequestLine(
base::StringPiece method,
base::StringPiece endpoint,
base::StringPiece http_version) {
if (method != "POST") {
- return base::nullopt;
+ return absl::nullopt;
}
if (http_version != "HTTP/1.1") {
- return base::nullopt;
+ return absl::nullopt;
}
// Empty endpoint is allowed.
@@ -131,19 +131,19 @@
// Ensure endpoint is a known printer.
auto printer_id = ParseEndpointForPrinterId(std::string(endpoint));
if (!printer_id.has_value()) {
- return base::nullopt;
+ return absl::nullopt;
}
auto printer = delegate_->GetPrinter(*printer_id);
if (!printer.has_value()) {
- return base::nullopt;
+ return absl::nullopt;
}
return HttpRequestLine{std::string(method), std::string(endpoint),
std::string(http_version)};
}
-base::Optional<std::vector<ipp_converter::HttpHeader>>
+absl::optional<std::vector<ipp_converter::HttpHeader>>
IppValidator::ValidateHttpHeaders(
const size_t http_content_length,
const base::flat_map<std::string, std::string>& headers) {
@@ -151,7 +151,7 @@
for (const auto& header : headers) {
if (!net::HttpUtil::IsValidHeaderName(header.first) ||
!net::HttpUtil::IsValidHeaderValue(header.second)) {
- return base::nullopt;
+ return absl::nullopt;
}
}
@@ -336,7 +336,7 @@
IppValidator::~IppValidator() = default;
-base::Optional<IppRequest> IppValidator::ValidateIppRequest(
+absl::optional<IppRequest> IppValidator::ValidateIppRequest(
ipp_parser::mojom::IppRequestPtr to_validate) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Build ipp message.
@@ -344,20 +344,20 @@
printing::ScopedIppPtr ipp =
printing::WrapIpp(ValidateIppMessage(std::move(to_validate->ipp)));
if (ipp == nullptr) {
- return base::nullopt;
+ return absl::nullopt;
}
// Validate ipp data.
// TODO(crbug/894607): Validate ippData (pdf).
if (!ValidateIppData(to_validate->data)) {
- return base::nullopt;
+ return absl::nullopt;
}
// Build request line.
auto request_line = ValidateHttpRequestLine(
to_validate->method, to_validate->endpoint, to_validate->http_version);
if (!request_line.has_value()) {
- return base::nullopt;
+ return absl::nullopt;
}
// Build headers; must happen after ipp message/data since it requires the
@@ -366,7 +366,7 @@
ippLength(ipp.get()) + to_validate->data.size();
auto headers = ValidateHttpHeaders(http_content_length, to_validate->headers);
if (!headers.has_value()) {
- return base::nullopt;
+ return absl::nullopt;
}
// Marshall request
@@ -381,7 +381,7 @@
ret.request_line.method, ret.request_line.endpoint,
ret.request_line.http_version, ret.headers, ret.ipp.get(), ret.ipp_data);
if (!request_buffer.has_value()) {
- return base::nullopt;
+ return absl::nullopt;
}
ret.buffer = std::move(*request_buffer);
diff --git a/chrome/services/cups_proxy/ipp_validator.h b/chrome/services/cups_proxy/ipp_validator.h
index 6ddb0ba..70fdc23 100644
--- a/chrome/services/cups_proxy/ipp_validator.h
+++ b/chrome/services/cups_proxy/ipp_validator.h
@@ -10,12 +10,12 @@
#include <vector>
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/strings/string_piece_forward.h"
#include "chrome/services/cups_proxy/cups_proxy_service_delegate.h"
#include "chrome/services/cups_proxy/public/cpp/ipp_messages.h"
#include "chrome/services/ipp_parser/public/cpp/ipp_converter.h"
#include "chrome/services/ipp_parser/public/mojom/ipp_parser.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace cups_proxy {
@@ -32,16 +32,16 @@
// Validates each of |to_validate|'s fields and returns a POD representation
// of the IPP request. Returns empty Optional on failure.
- base::Optional<IppRequest> ValidateIppRequest(
+ absl::optional<IppRequest> ValidateIppRequest(
ipp_parser::mojom::IppRequestPtr to_validate);
private:
- base::Optional<HttpRequestLine> ValidateHttpRequestLine(
+ absl::optional<HttpRequestLine> ValidateHttpRequestLine(
base::StringPiece method,
base::StringPiece endpoint,
base::StringPiece http_version);
- base::Optional<std::vector<ipp_converter::HttpHeader>> ValidateHttpHeaders(
+ absl::optional<std::vector<ipp_converter::HttpHeader>> ValidateHttpHeaders(
const size_t http_content_length,
const base::flat_map<std::string, std::string>& headers);
diff --git a/chrome/services/cups_proxy/ipp_validator_unittest.cc b/chrome/services/cups_proxy/ipp_validator_unittest.cc
index 85f8857..ddf4c07 100644
--- a/chrome/services/cups_proxy/ipp_validator_unittest.cc
+++ b/chrome/services/cups_proxy/ipp_validator_unittest.cc
@@ -42,9 +42,9 @@
known_printers_.insert(printer_id);
}
- base::Optional<Printer> GetPrinter(const std::string& id) override {
+ absl::optional<Printer> GetPrinter(const std::string& id) override {
if (!base::Contains(known_printers_, id)) {
- return base::nullopt;
+ return absl::nullopt;
}
return Printer(id);
@@ -63,7 +63,7 @@
~IppValidatorTest() override = default;
- base::Optional<IppRequest> RunValidateIppRequest(
+ absl::optional<IppRequest> RunValidateIppRequest(
const IppRequestPtr& request) {
return ipp_validator_->ValidateIppRequest(request.Clone());
}
diff --git a/chrome/services/cups_proxy/printer_installer_unittest.cc b/chrome/services/cups_proxy/printer_installer_unittest.cc
index d3eb24a..e82390e 100644
--- a/chrome/services/cups_proxy/printer_installer_unittest.cc
+++ b/chrome/services/cups_proxy/printer_installer_unittest.cc
@@ -53,9 +53,9 @@
installed_printers_[printer.id()] = true;
}
- base::Optional<Printer> GetPrinter(const std::string& id) override {
+ absl::optional<Printer> GetPrinter(const std::string& id) override {
if (!base::Contains(installed_printers_, id)) {
- return base::nullopt;
+ return absl::nullopt;
}
return Printer(id);
diff --git a/chrome/services/cups_proxy/proxy_manager.cc b/chrome/services/cups_proxy/proxy_manager.cc
index 2de65455..1e0e15f4f 100644
--- a/chrome/services/cups_proxy/proxy_manager.cc
+++ b/chrome/services/cups_proxy/proxy_manager.cc
@@ -113,7 +113,7 @@
DISALLOW_COPY_AND_ASSIGN(ProxyManagerImpl);
};
-base::Optional<std::vector<uint8_t>> RebuildIppRequest(
+absl::optional<std::vector<uint8_t>> RebuildIppRequest(
const std::string& method,
const std::string& url,
const std::string& version,
@@ -122,12 +122,12 @@
auto request_line_buffer =
ipp_converter::BuildRequestLine(method, url, version);
if (!request_line_buffer.has_value()) {
- return base::nullopt;
+ return absl::nullopt;
}
auto headers_buffer = ipp_converter::BuildHeaders(headers);
if (!headers_buffer.has_value()) {
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<uint8_t> ret;
@@ -259,7 +259,7 @@
delegate_->GetPrinters(chromeos::PrinterClass::kSaved),
delegate_->GetPrinters(chromeos::PrinterClass::kEnterprise),
delegate_->GetRecentlyUsedPrinters());
- base::Optional<IppResponse> response =
+ absl::optional<IppResponse> response =
BuildGetDestsResponse(in_flight_->request, printers);
if (!response.has_value()) {
return Fail("Failed to spoof CUPS-Get-Printers response",
diff --git a/chrome/services/cups_proxy/public/cpp/cups_util.cc b/chrome/services/cups_proxy/public/cpp/cups_util.cc
index 29358d29..196b7c8 100644
--- a/chrome/services/cups_proxy/public/cpp/cups_util.cc
+++ b/chrome/services/cups_proxy/public/cpp/cups_util.cc
@@ -17,7 +17,7 @@
namespace cups_proxy {
-base::Optional<IppResponse> BuildGetDestsResponse(
+absl::optional<IppResponse> BuildGetDestsResponse(
const IppRequest& request,
const std::vector<chromeos::Printer>& printers) {
IppResponse ret;
@@ -71,19 +71,19 @@
ret.status_line.http_version, ret.status_line.status_code,
ret.status_line.reason_phrase, ret.headers, ret.ipp.get(), ret.ipp_data);
if (!response_buffer) {
- return base::nullopt;
+ return absl::nullopt;
}
ret.buffer = std::move(*response_buffer);
return ret;
}
-base::Optional<std::string> GetPrinterId(ipp_t* ipp) {
+absl::optional<std::string> GetPrinterId(ipp_t* ipp) {
// We expect the printer id to be embedded in the printer-uri.
ipp_attribute_t* printer_uri_attr =
ippFindAttribute(ipp, "printer-uri", IPP_TAG_URI);
if (!printer_uri_attr) {
- return base::nullopt;
+ return absl::nullopt;
}
// Only care about the resource, throw everything else away
@@ -104,18 +104,18 @@
base::StringPiece uuid(resource);
auto uuid_start = uuid.find_last_of('/');
if (uuid_start == base::StringPiece::npos || uuid_start + 1 >= uuid.size()) {
- return base::nullopt;
+ return absl::nullopt;
}
return std::string(uuid.substr(uuid_start + 1));
}
-base::Optional<std::string> ParseEndpointForPrinterId(
+absl::optional<std::string> ParseEndpointForPrinterId(
base::StringPiece endpoint) {
size_t last_path = endpoint.find_last_of('/');
if (last_path == base::StringPiece::npos ||
last_path + 1 >= endpoint.size()) {
- return base::nullopt;
+ return absl::nullopt;
}
return std::string(endpoint.substr(last_path + 1));
diff --git a/chrome/services/cups_proxy/public/cpp/cups_util.h b/chrome/services/cups_proxy/public/cpp/cups_util.h
index fb93c095..847a20f7 100644
--- a/chrome/services/cups_proxy/public/cpp/cups_util.h
+++ b/chrome/services/cups_proxy/public/cpp/cups_util.h
@@ -12,8 +12,8 @@
#include <vector>
#include "base/macros.h"
-#include "base/optional.h"
#include "chrome/services/cups_proxy/public/cpp/ipp_messages.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace chromeos {
class Printer;
@@ -40,18 +40,18 @@
// Expects |request| to be an IPP_OP_GET_PRINTERS IPP request. This function
// creates an appropriate IPP response referencing |printers|.
// TODO(crbug.com/945409): Expand testing suite.
-base::Optional<IppResponse> BuildGetDestsResponse(
+absl::optional<IppResponse> BuildGetDestsResponse(
const IppRequest& request,
const std::vector<chromeos::Printer>& printers);
// If |ipp| refers to a printer, we return the associated printer_id.
// Note: Expects the printer id to be embedded in the resource field of the
// 'printer-uri' IPP attribute.
-base::Optional<std::string> GetPrinterId(ipp_t* ipp);
+absl::optional<std::string> GetPrinterId(ipp_t* ipp);
// Expects |endpoint| to be of the form '/printers/{printer_id}'.
// Returns an empty Optional if parsing fails or yields an empty printer_id.
-base::Optional<std::string> ParseEndpointForPrinterId(
+absl::optional<std::string> ParseEndpointForPrinterId(
base::StringPiece endpoint);
// Return list of printers containing first recently used printers,
diff --git a/chrome/services/cups_proxy/public/cpp/cups_util_unittest.cc b/chrome/services/cups_proxy/public/cpp/cups_util_unittest.cc
index 4fd21e6..85e0a9aa 100644
--- a/chrome/services/cups_proxy/public/cpp/cups_util_unittest.cc
+++ b/chrome/services/cups_proxy/public/cpp/cups_util_unittest.cc
@@ -99,7 +99,7 @@
}
TEST(ParseEndpointForPrinterIdTest, SimpleSanityTest) {
- base::Optional<std::string> printer_id = ParseEndpointForPrinterId(
+ absl::optional<std::string> printer_id = ParseEndpointForPrinterId(
std::string(kEndpointPrefix) + kDefaultPrinterId);
EXPECT_TRUE(printer_id.has_value());
diff --git a/chrome/services/cups_proxy/public/cpp/ipp_messages.h b/chrome/services/cups_proxy/public/cpp/ipp_messages.h
index 379013e..2ba4389c 100644
--- a/chrome/services/cups_proxy/public/cpp/ipp_messages.h
+++ b/chrome/services/cups_proxy/public/cpp/ipp_messages.h
@@ -11,9 +11,9 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "chrome/services/ipp_parser/public/cpp/ipp_converter.h"
#include "printing/backend/cups_ipp_helper.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
// POD representations of HTTP/IPP objects.
namespace cups_proxy {
diff --git a/chrome/services/cups_proxy/socket_manager.h b/chrome/services/cups_proxy/socket_manager.h
index 2f12e1b..23b7739 100644
--- a/chrome/services/cups_proxy/socket_manager.h
+++ b/chrome/services/cups_proxy/socket_manager.h
@@ -9,7 +9,7 @@
#include <vector>
#include "base/callback.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "chrome/services/cups_proxy/cups_proxy_service_delegate.h"
diff --git a/chrome/services/cups_proxy/socket_manager_unittest.cc b/chrome/services/cups_proxy/socket_manager_unittest.cc
index 8a91cd8..c2b2d14 100644
--- a/chrome/services/cups_proxy/socket_manager_unittest.cc
+++ b/chrome/services/cups_proxy/socket_manager_unittest.cc
@@ -26,14 +26,14 @@
namespace cups_proxy {
namespace {
-// Returns base::nullopt on failure.
-base::Optional<std::string> GetTestFile(std::string test_name) {
+// Returns absl::nullopt on failure.
+absl::optional<std::string> GetTestFile(std::string test_name) {
base::ScopedAllowBlockingForTesting allow_blocking;
// Build file path.
base::FilePath path;
if (!base::PathService::Get(Paths::DIR_TEST_DATA, &path)) {
- return base::nullopt;
+ return absl::nullopt;
}
path = path.Append(FILE_PATH_LITERAL(test_name))
@@ -42,7 +42,7 @@
// Read in file contents.
std::string contents;
if (!base::ReadFileToString(path, &contents)) {
- return base::nullopt;
+ return absl::nullopt;
}
return contents;
@@ -231,7 +231,7 @@
// All socket accesses are resolved synchronously.
TEST_F(SocketManagerTest, SyncEverything) {
// Read request & response
- base::Optional<std::string> http_handshake = GetTestFile("basic_handshake");
+ absl::optional<std::string> http_handshake = GetTestFile("basic_handshake");
EXPECT_TRUE(http_handshake);
// Pre-load |socket_| with request/response.
diff --git a/chrome/services/file_util/zip_file_creator.cc b/chrome/services/file_util/zip_file_creator.cc
index 5b775df..2b1bcba6 100644
--- a/chrome/services/file_util/zip_file_creator.cc
+++ b/chrome/services/file_util/zip_file_creator.cc
@@ -94,7 +94,7 @@
dir = dir_remote.get();
}
- base::Optional<std::vector<filesystem::mojom::DirectoryEntryPtr>>
+ absl::optional<std::vector<filesystem::mojom::DirectoryEntryPtr>>
directory_contents;
base::File::Error error;
dir->Read(&error, &directory_contents);
diff --git a/chrome/services/ipp_parser/ipp_parser.cc b/chrome/services/ipp_parser/ipp_parser.cc
index 82eed715..2efb5ad 100644
--- a/chrome/services/ipp_parser/ipp_parser.cc
+++ b/chrome/services/ipp_parser/ipp_parser.cc
@@ -11,10 +11,10 @@
#include <vector>
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "chrome/services/cups_proxy/public/cpp/type_conversions.h"
#include "chrome/services/ipp_parser/public/cpp/ipp_converter.h"
#include "net/http/http_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace ipp_parser {
namespace {
@@ -86,11 +86,11 @@
return true;
}
-base::Optional<std::vector<std::string>> ExtractHttpRequestLine(
+absl::optional<std::vector<std::string>> ExtractHttpRequestLine(
base::StringPiece request) {
size_t end_of_request_line = LocateEndOfRequestLine(request);
if (end_of_request_line < 0) {
- return base::nullopt;
+ return absl::nullopt;
}
const base::StringPiece request_line_slice =
@@ -98,16 +98,16 @@
return ipp_converter::ParseRequestLine(request_line_slice);
}
-base::Optional<std::vector<HttpHeader>> ExtractHttpHeaders(
+absl::optional<std::vector<HttpHeader>> ExtractHttpHeaders(
base::StringPiece request) {
size_t start_of_headers = LocateStartOfHeaders(request);
if (start_of_headers < 0) {
- return base::nullopt;
+ return absl::nullopt;
}
size_t end_of_headers = LocateEndOfHeaders(request);
if (end_of_headers < 0) {
- return base::nullopt;
+ return absl::nullopt;
}
const base::StringPiece headers_slice =
diff --git a/chrome/services/ipp_parser/public/cpp/ipp_converter.cc b/chrome/services/ipp_parser/public/cpp/ipp_converter.cc
index 4acacfc..83227c6 100644
--- a/chrome/services/ipp_parser/public/cpp/ipp_converter.cc
+++ b/chrome/services/ipp_parser/public/cpp/ipp_converter.cc
@@ -59,15 +59,15 @@
}
// Returns a parsed HttpHeader on success, empty Optional on failure.
-base::Optional<HttpHeader> ParseHeader(base::StringPiece header) {
+absl::optional<HttpHeader> ParseHeader(base::StringPiece header) {
if (base::Contains(header, kCarriage)) {
- return base::nullopt;
+ return absl::nullopt;
}
// Parse key
const size_t key_end_index = header.find(":");
if (key_end_index == std::string::npos || key_end_index == 0) {
- return base::nullopt;
+ return absl::nullopt;
}
const base::StringPiece key = header.substr(0, key_end_index);
@@ -85,7 +85,7 @@
}
// Converts |value_tag| to corresponding mojom type for marshalling.
-base::Optional<ValueType> ValueTagToType(const int value_tag) {
+absl::optional<ValueType> ValueTagToType(const int value_tag) {
switch (value_tag) {
case IPP_TAG_BOOLEAN:
return ValueType::BOOLEAN;
@@ -121,7 +121,7 @@
// Fail to convert any unrecognized types.
DVLOG(1) << "Failed to convert CUPS value tag, type " << value_tag;
- return base::nullopt;
+ return absl::nullopt;
}
std::vector<bool> IppGetBools(ipp_attribute_t* attr) {
@@ -136,7 +136,7 @@
return ret;
}
-base::Optional<std::vector<int>> IppGetInts(ipp_attribute_t* attr) {
+absl::optional<std::vector<int>> IppGetInts(ipp_attribute_t* attr) {
const size_t count = ippGetCount(attr);
std::vector<int> ret;
@@ -144,14 +144,14 @@
for (size_t i = 0; i < count; ++i) {
int v = ippGetInteger(attr, i);
if (!v) {
- return base::nullopt;
+ return absl::nullopt;
}
ret.push_back(v);
}
return ret;
}
-base::Optional<std::vector<std::string>> IppGetStrings(ipp_attribute_t* attr) {
+absl::optional<std::vector<std::string>> IppGetStrings(ipp_attribute_t* attr) {
const size_t count = ippGetCount(attr);
std::vector<std::string> ret;
@@ -160,14 +160,14 @@
const char* v = ippGetString(
attr, i, nullptr /* TODO(crbug.com/945409): figure out language */);
if (!v) {
- return base::nullopt;
+ return absl::nullopt;
}
ret.emplace_back(v);
}
return ret;
}
-base::Optional<std::vector<std::vector<uint8_t>>> IppGetOctets(
+absl::optional<std::vector<std::vector<uint8_t>>> IppGetOctets(
ipp_attribute_t* attr) {
const size_t count = ippGetCount(attr);
@@ -178,14 +178,14 @@
const uint8_t* v =
static_cast<const uint8_t*>(ippGetOctetString(attr, i, &len));
if (!v || len <= 0) {
- return base::nullopt;
+ return absl::nullopt;
}
ret.emplace_back(v, v + len);
}
return ret;
}
-base::Optional<std::vector<ipp_parser::mojom::ResolutionPtr>> IppGetResolutions(
+absl::optional<std::vector<ipp_parser::mojom::ResolutionPtr>> IppGetResolutions(
ipp_attribute_t* attr) {
const size_t count = ippGetCount(attr);
@@ -199,7 +199,7 @@
if (xres <= 0 || yres <= 0 || units != IPP_RES_PER_INCH) {
LOG(ERROR) << "bad resolution: " << xres << ", " << yres << ", "
<< int(units);
- return base::nullopt;
+ return absl::nullopt;
}
ret.push_back(ipp_parser::mojom::Resolution(xres, yres).Clone());
}
@@ -208,7 +208,7 @@
} // namespace
-base::Optional<std::vector<std::string>> ParseRequestLine(
+absl::optional<std::vector<std::string>> ParseRequestLine(
base::StringPiece status_line) {
// Split |status_slice| into triple method-endpoint-httpversion
std::vector<std::string> terms =
@@ -216,14 +216,14 @@
base::SPLIT_WANT_ALL);
if (terms.size() != 3) {
- return base::nullopt;
+ return absl::nullopt;
}
return terms;
}
// Implicit conversion is safe since the conversion preserves memory layout.
-base::Optional<std::vector<uint8_t>> BuildRequestLine(
+absl::optional<std::vector<uint8_t>> BuildRequestLine(
base::StringPiece method,
base::StringPiece endpoint,
base::StringPiece http_version) {
@@ -234,7 +234,7 @@
return std::vector<uint8_t>(status_line.begin(), status_line.end());
}
-base::Optional<std::vector<HttpHeader>> ParseHeaders(
+absl::optional<std::vector<HttpHeader>> ParseHeaders(
base::StringPiece headers_slice) {
auto raw_headers = base::SplitStringPieceUsingSubstr(
headers_slice, kCarriage, base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
@@ -244,7 +244,7 @@
for (auto raw_header : raw_headers) {
auto header = ParseHeader(raw_header);
if (!header) {
- return base::nullopt;
+ return absl::nullopt;
}
ret.push_back(header.value());
@@ -253,7 +253,7 @@
return ret;
}
-base::Optional<std::vector<uint8_t>> BuildHeaders(
+absl::optional<std::vector<uint8_t>> BuildHeaders(
std::vector<HttpHeader> terms) {
std::string headers;
for (auto term : terms) {
@@ -287,12 +287,12 @@
return ipp;
}
-base::Optional<std::vector<uint8_t>> BuildIppMessage(ipp_t* ipp) {
+absl::optional<std::vector<uint8_t>> BuildIppMessage(ipp_t* ipp) {
std::vector<uint8_t> request(ippLength(ipp));
// Need to start in idle state for reading/writing.
if (!ippSetState(ipp, IPP_STATE_IDLE)) {
- return base::nullopt;
+ return absl::nullopt;
}
// Casting IppWrite callback to correct internal CUPS type
@@ -304,13 +304,13 @@
if (ret == IPP_STATE_ERROR) {
// Write failed
- return base::nullopt;
+ return absl::nullopt;
}
return request;
}
-base::Optional<std::vector<uint8_t>> BuildIppRequest(
+absl::optional<std::vector<uint8_t>> BuildIppRequest(
base::StringPiece method,
base::StringPiece endpoint,
base::StringPiece http_version,
@@ -320,17 +320,17 @@
// Build each subpart
auto request_line_buffer = BuildRequestLine(method, endpoint, http_version);
if (!request_line_buffer) {
- return base::nullopt;
+ return absl::nullopt;
}
auto headers_buffer = BuildHeaders(std::move(terms));
if (!headers_buffer) {
- return base::nullopt;
+ return absl::nullopt;
}
auto ipp_message_buffer = BuildIppMessage(ipp);
if (!ipp_message_buffer) {
- return base::nullopt;
+ return absl::nullopt;
}
// Marshall request
@@ -350,7 +350,7 @@
}
// If no |ipp_data| is passed in, default to empty data portion.
-base::Optional<std::vector<uint8_t>> BuildIppRequest(
+absl::optional<std::vector<uint8_t>> BuildIppRequest(
base::StringPiece method,
base::StringPiece endpoint,
base::StringPiece http_version,
diff --git a/chrome/services/ipp_parser/public/cpp/ipp_converter.h b/chrome/services/ipp_parser/public/cpp/ipp_converter.h
index 74fe7ee69..e98d686 100644
--- a/chrome/services/ipp_parser/public/cpp/ipp_converter.h
+++ b/chrome/services/ipp_parser/public/cpp/ipp_converter.h
@@ -36,12 +36,12 @@
// Request line converters
// Parses |status_line| into vector of 3, individual terms, returns empty
// Optional on failure.
-base::Optional<std::vector<std::string>> ParseRequestLine(
+absl::optional<std::vector<std::string>> ParseRequestLine(
base::StringPiece status_line);
// Builds valid HTTP Request line from input span of 3 |terms|, returns empty
// Optional on failure.
-base::Optional<std::vector<uint8_t>> BuildRequestLine(
+absl::optional<std::vector<uint8_t>> BuildRequestLine(
base::StringPiece method,
base::StringPiece endpoint,
base::StringPiece http_version);
@@ -49,12 +49,12 @@
// Headers converters
// Parsed |headers_slice| into vector of HTTP header name/value pairs.
// Returns empty Optional on failure.
-base::Optional<std::vector<HttpHeader>> ParseHeaders(
+absl::optional<std::vector<HttpHeader>> ParseHeaders(
base::StringPiece headers_slice);
// Builds valid HTTP headers from input vector of header name/value pairs.
// Returns empty Optional on failure.
-base::Optional<std::vector<uint8_t>> BuildHeaders(
+absl::optional<std::vector<uint8_t>> BuildHeaders(
std::vector<HttpHeader> terms);
// IPP message converters
@@ -65,19 +65,19 @@
// Builds valid IPP message from |ipp|, using libCUPS APIs.
// Returns empty Optional on failure.
// Note: Does not take ownership of |ipp|.
-base::Optional<std::vector<uint8_t>> BuildIppMessage(ipp_t* ipp);
+absl::optional<std::vector<uint8_t>> BuildIppMessage(ipp_t* ipp);
// Often used helper wrapping the above commands for building a complete IPP
// request. Overloaded for cases without ipp_data.
// Returns empty Optional on any failure.
-base::Optional<std::vector<uint8_t>> BuildIppRequest(
+absl::optional<std::vector<uint8_t>> BuildIppRequest(
base::StringPiece method,
base::StringPiece endpoint,
base::StringPiece http_version,
std::vector<HttpHeader> terms,
ipp_t* ipp,
std::vector<uint8_t> ipp_data);
-base::Optional<std::vector<uint8_t>> BuildIppRequest(
+absl::optional<std::vector<uint8_t>> BuildIppRequest(
base::StringPiece method,
base::StringPiece endpoint,
base::StringPiece http_version,
diff --git a/chrome/services/mac_notifications/mac_notification_service_ns.mm b/chrome/services/mac_notifications/mac_notification_service_ns.mm
index 6401af8..708e5db6 100644
--- a/chrome/services/mac_notifications/mac_notification_service_ns.mm
+++ b/chrome/services/mac_notifications/mac_notification_service_ns.mm
@@ -305,7 +305,7 @@
GetNotificationOperationFromNotification(notification);
int buttonIndex = GetActionButtonIndexFromNotification(notification);
auto actionInfo = mac_notifications::mojom::NotificationActionInfo::New(
- std::move(meta), operation, buttonIndex, /*reply=*/base::nullopt);
+ std::move(meta), operation, buttonIndex, /*reply=*/absl::nullopt);
_handler->OnNotificationAction(std::move(actionInfo));
}
@@ -322,7 +322,7 @@
auto operation = NotificationOperation::NOTIFICATION_CLOSE;
int buttonIndex = notification_constants::kNotificationInvalidButtonIndex;
auto actionInfo = mac_notifications::mojom::NotificationActionInfo::New(
- std::move(meta), operation, buttonIndex, /*reply=*/base::nullopt);
+ std::move(meta), operation, buttonIndex, /*reply=*/absl::nullopt);
_handler->OnNotificationAction(std::move(actionInfo));
}
@@ -339,7 +339,7 @@
auto operation = NotificationOperation::NOTIFICATION_CLOSE;
int buttonIndex = notification_constants::kNotificationInvalidButtonIndex;
auto actionInfo = mac_notifications::mojom::NotificationActionInfo::New(
- std::move(meta), operation, buttonIndex, /*reply=*/base::nullopt);
+ std::move(meta), operation, buttonIndex, /*reply=*/absl::nullopt);
_handler->OnNotificationAction(std::move(actionInfo));
}
}
diff --git a/chrome/services/mac_notifications/mac_notification_service_un.mm b/chrome/services/mac_notifications/mac_notification_service_un.mm
index 6f5133a..ca401778 100644
--- a/chrome/services/mac_notifications/mac_notification_service_un.mm
+++ b/chrome/services/mac_notifications/mac_notification_service_un.mm
@@ -330,7 +330,7 @@
GetNotificationOperationFromAction([response actionIdentifier]);
int buttonIndex = GetActionButtonIndexFromAction([response actionIdentifier]);
auto actionInfo = mac_notifications::mojom::NotificationActionInfo::New(
- std::move(meta), operation, buttonIndex, /*reply=*/base::nullopt);
+ std::move(meta), operation, buttonIndex, /*reply=*/absl::nullopt);
_handler->OnNotificationAction(std::move(actionInfo));
completionHandler();
}
diff --git a/chrome/services/media_gallery_util/media_parser_android.cc b/chrome/services/media_gallery_util/media_parser_android.cc
index 8f55608..dcd8bef 100644
--- a/chrome/services/media_gallery_util/media_parser_android.cc
+++ b/chrome/services/media_gallery_util/media_parser_android.cc
@@ -7,10 +7,10 @@
#include <utility>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "chrome/services/media_gallery_util/ipc_data_source.h"
#include "chrome/services/media_gallery_util/video_thumbnail_parser.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -19,7 +19,7 @@
MediaParser::ExtractVideoFrameCallback video_frame_callback,
bool success,
chrome::mojom::VideoFrameDataPtr frame_data,
- const base::Optional<media::VideoDecoderConfig>& config) {
+ const absl::optional<media::VideoDecoderConfig>& config) {
std::move(video_frame_callback).Run(success, std::move(frame_data), config);
}
diff --git a/chrome/services/media_gallery_util/media_parser_android_unittest.cc b/chrome/services/media_gallery_util/media_parser_android_unittest.cc
index 065a59d..fc00d64 100644
--- a/chrome/services/media_gallery_util/media_parser_android_unittest.cc
+++ b/chrome/services/media_gallery_util/media_parser_android_unittest.cc
@@ -26,7 +26,7 @@
struct ExtractVideoFrameResult {
bool success = false;
chrome::mojom::VideoFrameDataPtr video_frame_data;
- base::Optional<media::VideoDecoderConfig> config;
+ absl::optional<media::VideoDecoderConfig> config;
};
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
@@ -114,7 +114,7 @@
mime_type, size, std::move(remote_data_source),
base::BindLambdaForTesting(
[&](bool success, chrome::mojom::VideoFrameDataPtr video_frame_data,
- const base::Optional<media::VideoDecoderConfig>& config) {
+ const absl::optional<media::VideoDecoderConfig>& config) {
result.success = success;
result.video_frame_data = std::move(video_frame_data);
result.config = config;
diff --git a/chrome/services/media_gallery_util/video_thumbnail_parser.cc b/chrome/services/media_gallery_util/video_thumbnail_parser.cc
index 16878bd..8fab6e0e 100644
--- a/chrome/services/media_gallery_util/video_thumbnail_parser.cc
+++ b/chrome/services/media_gallery_util/video_thumbnail_parser.cc
@@ -8,7 +8,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
@@ -20,6 +19,7 @@
#include "media/filters/vpx_video_decoder.h"
#include "media/media_buildflags.h"
#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -34,7 +34,7 @@
if (!frame) {
std::move(video_frame_callback)
- .Run(false, chrome::mojom::VideoFrameData::New(), base::nullopt);
+ .Run(false, chrome::mojom::VideoFrameData::New(), absl::nullopt);
return;
}
@@ -53,7 +53,7 @@
const media::VideoDecoderConfig& config) {
if (!success || data.empty()) {
std::move(video_frame_callback)
- .Run(false, chrome::mojom::VideoFrameData::New(), base::nullopt);
+ .Run(false, chrome::mojom::VideoFrameData::New(), absl::nullopt);
return;
}
@@ -73,7 +73,7 @@
if (config.codec() != media::VideoCodec::kCodecVP8 &&
config.codec() != media::VideoCodec::kCodecVP9) {
std::move(video_frame_callback)
- .Run(false, chrome::mojom::VideoFrameData::New(), base::nullopt);
+ .Run(false, chrome::mojom::VideoFrameData::New(), absl::nullopt);
return;
}
diff --git a/chrome/services/printing/print_backend_service_impl.cc b/chrome/services/printing/print_backend_service_impl.cc
index 3d0f1b9..f7c7152 100644
--- a/chrome/services/printing/print_backend_service_impl.cc
+++ b/chrome/services/printing/print_backend_service_impl.cc
@@ -9,12 +9,12 @@
#include "base/logging.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/services/printing/public/mojom/print_backend_service.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "printing/backend/print_backend.h"
#include "printing/mojom/print.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if defined(OS_MAC)
#include "base/threading/thread_restrictions.h"
@@ -58,7 +58,7 @@
if (!print_backend_) {
DLOG(ERROR)
<< "Print backend instance has not been initialized for locale.";
- std::move(callback).Run(base::nullopt);
+ std::move(callback).Run(absl::nullopt);
return;
}
std::move(callback).Run(print_backend_->GetDefaultPrinterName());
diff --git a/chrome/services/printing/print_backend_service_impl.h b/chrome/services/printing/print_backend_service_impl.h
index 4e95962..b62d98bc 100644
--- a/chrome/services/printing/print_backend_service_impl.h
+++ b/chrome/services/printing/print_backend_service_impl.h
@@ -9,11 +9,11 @@
#include "base/callback.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "chrome/services/printing/public/mojom/print_backend_service.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "printing/backend/print_backend.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace printing {
diff --git a/chrome/services/qrcode_generator/qrcode_generator_service_impl.cc b/chrome/services/qrcode_generator/qrcode_generator_service_impl.cc
index 1094d0e2..ad94694 100644
--- a/chrome/services/qrcode_generator/qrcode_generator_service_impl.cc
+++ b/chrome/services/qrcode_generator/qrcode_generator_service_impl.cc
@@ -271,7 +271,7 @@
// The QR version (i.e. size) must be >= 5 because otherwise the dino painted
// over the middle covers too much of the code to be decodable.
constexpr int kMinimumQRVersion = 5;
- base::Optional<QRCodeGenerator::GeneratedCode> qr_data =
+ absl::optional<QRCodeGenerator::GeneratedCode> qr_data =
qr.Generate(base::span<const uint8_t>(
reinterpret_cast<const uint8_t*>(request->data.data()),
request->data.size()),
diff --git a/chrome/services/sharing/nearby/decoder/advertisement_decoder.cc b/chrome/services/sharing/nearby/decoder/advertisement_decoder.cc
index 3c1e04a..3f484b73 100644
--- a/chrome/services/sharing/nearby/decoder/advertisement_decoder.cc
+++ b/chrome/services/sharing/nearby/decoder/advertisement_decoder.cc
@@ -100,7 +100,7 @@
return nullptr;
}
- base::Optional<std::string> optional_device_name;
+ absl::optional<std::string> optional_device_name;
if (device_name_length > 0) {
optional_device_name = std::string(iter, iter + device_name_length);
iter += device_name_length;
diff --git a/chrome/services/sharing/nearby/decoder/advertisement_decoder.h b/chrome/services/sharing/nearby/decoder/advertisement_decoder.h
index 738df4d..5d24a9a 100644
--- a/chrome/services/sharing/nearby/decoder/advertisement_decoder.h
+++ b/chrome/services/sharing/nearby/decoder/advertisement_decoder.h
@@ -11,8 +11,8 @@
#include <vector>
#include "base/containers/span.h"
-#include "base/optional.h"
#include "chrome/services/sharing/public/cpp/advertisement.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace sharing {
diff --git a/chrome/services/sharing/nearby/decoder/advertisement_decoder_unittest.cc b/chrome/services/sharing/nearby/decoder/advertisement_decoder_unittest.cc
index f88cf4f..adae7bd8 100644
--- a/chrome/services/sharing/nearby/decoder/advertisement_decoder_unittest.cc
+++ b/chrome/services/sharing/nearby/decoder/advertisement_decoder_unittest.cc
@@ -87,7 +87,7 @@
std::unique_ptr<sharing::Advertisement> advertisement =
sharing::Advertisement::NewInstance(kSalt, kEncryptedMetadataKey,
kDeviceType,
- /* device_name= */ base::nullopt);
+ /* device_name= */ absl::nullopt);
ExpectEquals(*advertisement, *sharing::AdvertisementDecoder::FromEndpointInfo(
advertisement->ToEndpointInfo()));
}
@@ -128,7 +128,7 @@
std::unique_ptr<sharing::Advertisement> advertisement =
sharing::Advertisement::NewInstance(kSalt, kEncryptedMetadataKey,
kDeviceType,
- /* device_name= */ base::nullopt);
+ /* device_name= */ absl::nullopt);
std::vector<uint8_t> v1EndpointInfo = {18, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
ExpectEquals(*advertisement, *sharing::AdvertisementDecoder::FromEndpointInfo(
diff --git a/chrome/services/sharing/nearby/decoder/nearby_decoder.cc b/chrome/services/sharing/nearby/decoder/nearby_decoder.cc
index 24b424c..4b29faf 100644
--- a/chrome/services/sharing/nearby/decoder/nearby_decoder.cc
+++ b/chrome/services/sharing/nearby/decoder/nearby_decoder.cc
@@ -9,11 +9,11 @@
#include <utility>
#include "base/callback.h"
-#include "base/optional.h"
#include "chrome/services/sharing/nearby/decoder/advertisement_decoder.h"
#include "chrome/services/sharing/public/cpp/advertisement.h"
#include "chrome/services/sharing/public/proto/wire_format.pb.h"
#include "chromeos/services/nearby/public/mojom/nearby_decoder_types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace sharing {
diff --git a/chrome/services/sharing/nearby/nearby_connections.h b/chrome/services/sharing/nearby/nearby_connections.h
index 6ca9777..5d21c21 100644
--- a/chrome/services/sharing/nearby/nearby_connections.h
+++ b/chrome/services/sharing/nearby/nearby_connections.h
@@ -13,7 +13,6 @@
#include "base/files/file.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/lock.h"
@@ -27,6 +26,7 @@
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/shared_remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/nearby/src/cpp/core/internal/service_controller.h"
namespace location {
diff --git a/chrome/services/sharing/nearby/nearby_connections_unittest.cc b/chrome/services/sharing/nearby/nearby_connections_unittest.cc
index 42d0b1e7..f2bed12 100644
--- a/chrome/services/sharing/nearby/nearby_connections_unittest.cc
+++ b/chrome/services/sharing/nearby/nearby_connections_unittest.cc
@@ -65,7 +65,7 @@
}
mojom::ConnectionOptionsPtr CreateConnectionOptions(
- base::Optional<std::vector<uint8_t>> bluetooth_mac_address) {
+ absl::optional<std::vector<uint8_t>> bluetooth_mac_address) {
auto allowed_mediums = mojom::MediumSelection::New(/*bluetooth=*/true,
/*ble=*/false,
/*web_rtc=*/false,
@@ -308,7 +308,7 @@
ClientProxy* RequestConnection(
FakeConnectionLifecycleListener& fake_connection_life_cycle_listener,
const EndpointData& endpoint_data,
- base::Optional<std::vector<uint8_t>> bluetooth_mac_address =
+ absl::optional<std::vector<uint8_t>> bluetooth_mac_address =
std::vector<uint8_t>(std::begin(kBluetoothMacAddress),
std::end(kBluetoothMacAddress))) {
ClientProxy* client_proxy;
@@ -561,7 +561,7 @@
FakeConnectionLifecycleListener fake_connection_life_cycle_listener;
RequestConnection(fake_connection_life_cycle_listener, endpoint_data,
- /*bluetooth_mac_address=*/base::nullopt);
+ /*bluetooth_mac_address=*/absl::nullopt);
}
TEST_F(NearbyConnectionsTest, RequestConnectionAccept) {
diff --git a/chrome/services/sharing/nearby/platform/ble_medium_unittest.cc b/chrome/services/sharing/nearby/platform/ble_medium_unittest.cc
index a833ca1..aa94ff2 100644
--- a/chrome/services/sharing/nearby/platform/ble_medium_unittest.cc
+++ b/chrome/services/sharing/nearby/platform/ble_medium_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include "base/bind.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
@@ -17,6 +16,7 @@
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "mojo/public/cpp/bindings/shared_remote.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace location {
namespace nearby {
diff --git a/chrome/services/sharing/nearby/platform/bluetooth_classic_medium.h b/chrome/services/sharing/nearby/platform/bluetooth_classic_medium.h
index b27b0d6..808baa2 100644
--- a/chrome/services/sharing/nearby/platform/bluetooth_classic_medium.h
+++ b/chrome/services/sharing/nearby/platform/bluetooth_classic_medium.h
@@ -8,13 +8,13 @@
#include <memory>
#include <string>
-#include "base/optional.h"
#include "base/timer/timer.h"
#include "chrome/services/sharing/nearby/platform/bluetooth_device.h"
#include "device/bluetooth/public/mojom/adapter.mojom.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/shared_remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/nearby/src/cpp/platform/api/bluetooth_classic.h"
namespace location {
@@ -66,7 +66,7 @@
mojo::Receiver<bluetooth::mojom::AdapterObserver> adapter_observer_{this};
// These properties are only set while discovery is active.
- base::Optional<DiscoveryCallback> discovery_callback_;
+ absl::optional<DiscoveryCallback> discovery_callback_;
mojo::Remote<bluetooth::mojom::DiscoverySession> discovery_session_;
// This is a mapping of MAC addresses to discovered Bluetooth devices.
diff --git a/chrome/services/sharing/nearby/platform/bluetooth_device.cc b/chrome/services/sharing/nearby/platform/bluetooth_device.cc
index 1d924d5..bfe8a1d 100644
--- a/chrome/services/sharing/nearby/platform/bluetooth_device.cc
+++ b/chrome/services/sharing/nearby/platform/bluetooth_device.cc
@@ -10,7 +10,7 @@
BluetoothDevice::BluetoothDevice(
bluetooth::mojom::DeviceInfoPtr device_info,
- base::Optional<base::TimeTicks> last_discovered_time)
+ absl::optional<base::TimeTicks> last_discovered_time)
: device_info_(std::move(device_info)),
last_discovered_time_(last_discovered_time) {}
@@ -26,7 +26,7 @@
void BluetoothDevice::UpdateDevice(
bluetooth::mojom::DeviceInfoPtr device_info,
- base::Optional<base::TimeTicks> last_discovered_time) {
+ absl::optional<base::TimeTicks> last_discovered_time) {
DCHECK_EQ(device_info_->address, device_info->address);
device_info_ = std::move(device_info);
last_discovered_time_ = last_discovered_time;
diff --git a/chrome/services/sharing/nearby/platform/bluetooth_device.h b/chrome/services/sharing/nearby/platform/bluetooth_device.h
index 0e9c346..73d641a 100644
--- a/chrome/services/sharing/nearby/platform/bluetooth_device.h
+++ b/chrome/services/sharing/nearby/platform/bluetooth_device.h
@@ -7,9 +7,9 @@
#include <string>
-#include "base/optional.h"
#include "base/time/time.h"
#include "device/bluetooth/public/mojom/adapter.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/nearby/src/cpp/platform/api/bluetooth_classic.h"
namespace location {
@@ -21,7 +21,7 @@
public:
BluetoothDevice(
bluetooth::mojom::DeviceInfoPtr device_info,
- base::Optional<base::TimeTicks> last_discovered_time = base::nullopt);
+ absl::optional<base::TimeTicks> last_discovered_time = absl::nullopt);
~BluetoothDevice() override;
BluetoothDevice(const BluetoothDevice&) = delete;
@@ -31,19 +31,19 @@
std::string GetName() const override;
std::string GetMacAddress() const override;
- base::Optional<base::TimeTicks> GetLastDiscoveredTime() {
+ absl::optional<base::TimeTicks> GetLastDiscoveredTime() {
return last_discovered_time_;
}
void UpdateDevice(bluetooth::mojom::DeviceInfoPtr device_info,
- base::Optional<base::TimeTicks> last_discovered_time);
+ absl::optional<base::TimeTicks> last_discovered_time);
private:
bluetooth::mojom::DeviceInfoPtr device_info_;
// Time when last the Bluetooth device was added/changed by the adapter.
// Used by BluetoothClassicMedium to remove stale devices during discovery.
- base::Optional<base::TimeTicks> last_discovered_time_ = base::nullopt;
+ absl::optional<base::TimeTicks> last_discovered_time_ = absl::nullopt;
};
} // namespace chrome
diff --git a/chrome/services/sharing/nearby/platform/bluetooth_socket.cc b/chrome/services/sharing/nearby/platform/bluetooth_socket.cc
index c88e4839..22e7d2a 100644
--- a/chrome/services/sharing/nearby/platform/bluetooth_socket.cc
+++ b/chrome/services/sharing/nearby/platform/bluetooth_socket.cc
@@ -169,7 +169,7 @@
std::unique_ptr<ByteArray> pending_read_buffer_;
uint32_t pending_read_buffer_pos_ = 0;
ExceptionOr<ByteArray> exception_or_received_byte_array_;
- base::Optional<base::WaitableEvent> read_waitable_event_;
+ absl::optional<base::WaitableEvent> read_waitable_event_;
};
// Concrete OutputStream implementation, tightly coupled to BluetoothSocket.
@@ -305,7 +305,7 @@
std::unique_ptr<ByteArray> pending_write_buffer_;
uint32_t pending_write_buffer_pos_ = 0;
bool write_success_ = false;
- base::Optional<base::WaitableEvent> write_waitable_event_;
+ absl::optional<base::WaitableEvent> write_waitable_event_;
};
} // namespace
diff --git a/chrome/services/sharing/nearby/platform/bluetooth_socket.h b/chrome/services/sharing/nearby/platform/bluetooth_socket.h
index a7b30e4..1c9946b7 100644
--- a/chrome/services/sharing/nearby/platform/bluetooth_socket.h
+++ b/chrome/services/sharing/nearby/platform/bluetooth_socket.h
@@ -7,10 +7,10 @@
#include <string>
-#include "base/optional.h"
#include "chrome/services/sharing/nearby/platform/bluetooth_device.h"
#include "device/bluetooth/public/mojom/adapter.mojom.h"
#include "mojo/public/cpp/bindings/shared_remote.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/nearby/src/cpp/platform/api/bluetooth_classic.h"
#include "third_party/nearby/src/cpp/platform/base/input_stream.h"
#include "third_party/nearby/src/cpp/platform/base/output_stream.h"
@@ -92,7 +92,7 @@
// connection, there is no previous owner of that device object, and therefore
// BluetoothSocket is expected to own it (within |remote_device_|). In this
// case, |remote_device_ref_| is a reference to |remote_device_|.
- base::Optional<chrome::BluetoothDevice> remote_device_;
+ absl::optional<chrome::BluetoothDevice> remote_device_;
api::BluetoothDevice& remote_device_ref_;
// The public methods which are overridden by BluetoothSocket's subclasses
diff --git a/chrome/services/sharing/nearby/platform/count_down_latch_unittest.cc b/chrome/services/sharing/nearby/platform/count_down_latch_unittest.cc
index 2fb943d..e0829ae8 100644
--- a/chrome/services/sharing/nearby/platform/count_down_latch_unittest.cc
+++ b/chrome/services/sharing/nearby/platform/count_down_latch_unittest.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/synchronization/lock.h"
#include "base/task/post_task.h"
@@ -22,6 +21,7 @@
#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace location {
namespace nearby {
@@ -35,14 +35,14 @@
void PostAwaitTask(base::RunLoop& run_loop,
const base::UnguessableToken& attempt_id,
- base::Optional<base::TimeDelta> timeout) {
+ absl::optional<base::TimeDelta> timeout) {
base::RunLoop wait_run_loop;
auto callback = base::BindLambdaForTesting([&, timeout]() {
base::ScopedAllowBaseSyncPrimitivesForTesting allow_base_sync_primitives;
wait_run_loop.Quit();
- base::Optional<ExceptionOr<bool>> result;
+ absl::optional<ExceptionOr<bool>> result;
if (timeout) {
result = count_down_latch_->Await(
absl::Microseconds(timeout->InMicroseconds()));
@@ -88,7 +88,7 @@
base::test::TaskEnvironment task_environment_;
base::Lock map_lock_;
- base::flat_map<base::UnguessableToken, base::Optional<ExceptionOr<bool>>>
+ base::flat_map<base::UnguessableToken, absl::optional<ExceptionOr<bool>>>
id_to_result_map_;
std::unique_ptr<CountDownLatch> count_down_latch_;
@@ -114,7 +114,7 @@
base::RunLoop run_loop;
base::UnguessableToken attempt_id = base::UnguessableToken::Create();
- PostAwaitTask(run_loop, attempt_id, base::nullopt /* timeout */);
+ PostAwaitTask(run_loop, attempt_id, absl::nullopt /* timeout */);
run_loop.Run();
EXPECT_EQ(1u, MapSize());
@@ -126,7 +126,7 @@
base::RunLoop run_loop;
base::UnguessableToken attempt_id = base::UnguessableToken::Create();
- PostAwaitTask(run_loop, attempt_id, base::nullopt /* timeout */);
+ PostAwaitTask(run_loop, attempt_id, absl::nullopt /* timeout */);
ASSERT_EQ(0u, MapSize());
count_down_latch_->CountDown();
@@ -157,13 +157,13 @@
base::RunLoop run_loop_1;
base::UnguessableToken attempt_id_1 = base::UnguessableToken::Create();
- PostAwaitTask(run_loop_1, attempt_id_1, base::nullopt /* timeout */);
+ PostAwaitTask(run_loop_1, attempt_id_1, absl::nullopt /* timeout */);
base::RunLoop run_loop_2;
base::UnguessableToken attempt_id_2 = base::UnguessableToken::Create();
- PostAwaitTask(run_loop_2, attempt_id_2, base::nullopt /* timeout */);
+ PostAwaitTask(run_loop_2, attempt_id_2, absl::nullopt /* timeout */);
base::RunLoop run_loop_3;
base::UnguessableToken attempt_id_3 = base::UnguessableToken::Create();
- PostAwaitTask(run_loop_3, attempt_id_3, base::nullopt /* timeout */);
+ PostAwaitTask(run_loop_3, attempt_id_3, absl::nullopt /* timeout */);
ASSERT_EQ(0u, MapSize());
count_down_latch_->CountDown();
diff --git a/chrome/services/sharing/public/cpp/advertisement.cc b/chrome/services/sharing/public/cpp/advertisement.cc
index 0dcbd890..b422c45 100644
--- a/chrome/services/sharing/public/cpp/advertisement.cc
+++ b/chrome/services/sharing/public/cpp/advertisement.cc
@@ -46,7 +46,7 @@
std::vector<uint8_t> salt,
std::vector<uint8_t> encrypted_metadata_key,
nearby_share::mojom::ShareTargetType device_type,
- base::Optional<std::string> device_name) {
+ absl::optional<std::string> device_name) {
if (salt.size() != sharing::Advertisement::kSaltSize) {
LOG(ERROR) << "Failed to create advertisement because the salt did "
"not match the expected length "
@@ -106,7 +106,7 @@
std::vector<uint8_t> salt,
std::vector<uint8_t> encrypted_metadata_key,
nearby_share::mojom::ShareTargetType device_type,
- base::Optional<std::string> device_name)
+ absl::optional<std::string> device_name)
: version_(version),
salt_(std::move(salt)),
encrypted_metadata_key_(std::move(encrypted_metadata_key)),
diff --git a/chrome/services/sharing/public/cpp/advertisement.h b/chrome/services/sharing/public/cpp/advertisement.h
index fa1714d..fc7d164 100644
--- a/chrome/services/sharing/public/cpp/advertisement.h
+++ b/chrome/services/sharing/public/cpp/advertisement.h
@@ -11,8 +11,8 @@
#include <vector>
#include "base/containers/span.h"
-#include "base/optional.h"
#include "chromeos/services/nearby/public/mojom/nearby_share_target_types.mojom.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace sharing {
@@ -26,7 +26,7 @@
std::vector<uint8_t> salt,
std::vector<uint8_t> encrypted_metadata_key,
nearby_share::mojom::ShareTargetType device_type,
- base::Optional<std::string> device_name);
+ absl::optional<std::string> device_name);
Advertisement(Advertisement&& other);
Advertisement(const Advertisement& other) = delete;
@@ -43,7 +43,7 @@
nearby_share::mojom::ShareTargetType device_type() const {
return device_type_;
}
- const base::Optional<std::string>& device_name() const {
+ const absl::optional<std::string>& device_name() const {
return device_name_;
}
bool HasDeviceName() const { return device_name_.has_value(); }
@@ -56,7 +56,7 @@
std::vector<uint8_t> salt,
std::vector<uint8_t> encrypted_metadata_key,
nearby_share::mojom::ShareTargetType device_type,
- base::Optional<std::string> device_name);
+ absl::optional<std::string> device_name);
// The version of the advertisement. Different versions can have different
// ways of parsing the endpoint id.
@@ -76,7 +76,7 @@
nearby_share::mojom::ShareTargetType device_type_;
// The human readable name of the remote device.
- base::Optional<std::string> device_name_;
+ absl::optional<std::string> device_name_;
};
} // namespace sharing
diff --git a/chrome/services/sharing/public/cpp/advertisement_unittest.cc b/chrome/services/sharing/public/cpp/advertisement_unittest.cc
index 0504065..13ca68a 100644
--- a/chrome/services/sharing/public/cpp/advertisement_unittest.cc
+++ b/chrome/services/sharing/public/cpp/advertisement_unittest.cc
@@ -34,7 +34,7 @@
std::unique_ptr<sharing::Advertisement> advertisement =
sharing::Advertisement::NewInstance(kSalt, kEncryptedMetadataKey,
kDeviceType,
- /* device_name=*/base::nullopt);
+ /* device_name=*/absl::nullopt);
EXPECT_FALSE(advertisement->device_name());
EXPECT_EQ(kEncryptedMetadataKey, advertisement->encrypted_metadata_key());
EXPECT_EQ(kDeviceType, advertisement->device_type());
diff --git a/chrome/services/speech/speech_recognition_recognizer_impl.cc b/chrome/services/speech/speech_recognition_recognizer_impl.cc
index 5305771..c8e390e5 100644
--- a/chrome/services/speech/speech_recognition_recognizer_impl.cc
+++ b/chrome/services/speech/speech_recognition_recognizer_impl.cc
@@ -291,7 +291,7 @@
void SpeechRecognitionRecognizerImpl::OnLanguageChanged(
const std::string& language) {
- base::Optional<speech::SodaLanguagePackComponentConfig>
+ absl::optional<speech::SodaLanguagePackComponentConfig>
language_component_config = GetLanguageComponentConfig(language);
if (!language_component_config.has_value())
return;
diff --git a/chrome/test/base/devtools_listener.cc b/chrome/test/base/devtools_listener.cc
index aba5414..526c9b17 100644
--- a/chrome/test/base/devtools_listener.cc
+++ b/chrome/test/base/devtools_listener.cc
@@ -279,7 +279,7 @@
return;
}
- base::Optional<int> id = value->FindIntPath("id");
+ absl::optional<int> id = value->FindIntPath("id");
if (id.has_value() && id.value() == value_id_) {
value_ = std::move(value);
CHECK(value_closure_);
diff --git a/chrome/test/base/interactive_test_utils_mac.mm b/chrome/test/base/interactive_test_utils_mac.mm
index 909d40e..5de5181a 100644
--- a/chrome/test/base/interactive_test_utils_mac.mm
+++ b/chrome/test/base/interactive_test_utils_mac.mm
@@ -50,7 +50,7 @@
base::RunLoop run_loop_;
// First key code pressed in the event sequence. This is also the last key
// code to be released and so it will be waited for.
- base::Optional<int> first_key_down_code_;
+ absl::optional<int> first_key_down_code_;
};
SendGlobalKeyEventsHelper* g_global_key_events_helper = nullptr;
diff --git a/chrome/test/base/mojo_web_ui_browser_test.cc b/chrome/test/base/mojo_web_ui_browser_test.cc
index 79d945b..f75ae8b 100644
--- a/chrome/test/base/mojo_web_ui_browser_test.cc
+++ b/chrome/test/base/mojo_web_ui_browser_test.cc
@@ -42,7 +42,7 @@
}
// web_ui_test::mojom::TestRunner:
- void TestComplete(const base::Optional<std::string>& message) override {
+ void TestComplete(const absl::optional<std::string>& message) override {
WebUITestHandler::TestComplete(message);
}
diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h
index 0edc8a9..d7249b5 100644
--- a/chrome/test/base/test_browser_window.h
+++ b/chrome/test/base/test_browser_window.h
@@ -146,7 +146,7 @@
bool show_stay_in_chrome,
bool show_remember_selection,
PageActionIconType icon_type,
- const base::Optional<url::Origin>& initiating_origin,
+ const absl::optional<url::Origin>& initiating_origin,
IntentPickerResponse callback) override {}
#endif // !define(OS_ANDROID)
send_tab_to_self::SendTabToSelfBubbleView* ShowSendTabToSelfBubble(
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index f3520cf74..d478af2 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -252,8 +252,8 @@
std::unique_ptr<policy::PolicyService> policy_service,
TestingFactories testing_factories,
const std::string& profile_name,
- base::Optional<bool> override_policy_connector_is_managed,
- base::Optional<OTRProfileID> otr_profile_id)
+ absl::optional<bool> override_policy_connector_is_managed,
+ absl::optional<OTRProfileID> otr_profile_id)
: prefs_(std::move(prefs)),
original_profile_(parent),
guest_session_(guest_session),
@@ -1114,7 +1114,7 @@
allows_browser_windows_, is_new_profile_, supervised_user_id_,
std::move(user_cloud_policy_manager_), std::move(policy_service_),
std::move(testing_factories_), profile_name_,
- override_policy_connector_is_managed_, base::Optional<OTRProfileID>());
+ override_policy_connector_is_managed_, absl::optional<OTRProfileID>());
}
TestingProfile* TestingProfile::Builder::BuildOffTheRecord(
@@ -1140,7 +1140,7 @@
std::move(user_cloud_policy_manager_), std::move(policy_service_),
std::move(testing_factories_), profile_name_,
override_policy_connector_is_managed_,
- base::Optional<OTRProfileID>(otr_profile_id));
+ absl::optional<OTRProfileID>(otr_profile_id));
}
TestingProfile* TestingProfile::Builder::BuildIncognito(
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h
index e046c88..fcc823d2 100644
--- a/chrome/test/base/testing_profile.h
+++ b/chrome/test/base/testing_profile.h
@@ -13,7 +13,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "build/build_config.h"
@@ -29,6 +28,7 @@
#include "extensions/buildflags/buildflags.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "net/cookies/cookie_store.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/settings/scoped_cros_settings_test_helper.h"
@@ -213,7 +213,7 @@
std::unique_ptr<policy::PolicyService> policy_service_;
TestingFactories testing_factories_;
std::string profile_name_{kDefaultProfileUserName};
- base::Optional<bool> override_policy_connector_is_managed_;
+ absl::optional<bool> override_policy_connector_is_managed_;
};
// Multi-profile aware constructor that takes the path to a directory managed
@@ -251,8 +251,8 @@
std::unique_ptr<policy::PolicyService> policy_service,
TestingFactories testing_factories,
const std::string& profile_name,
- base::Optional<bool> override_policy_connector_is_managed,
- base::Optional<OTRProfileID> otr_profile_id);
+ absl::optional<bool> override_policy_connector_is_managed,
+ absl::optional<OTRProfileID> otr_profile_id);
~TestingProfile() override;
@@ -381,7 +381,7 @@
void InitChromeOSPreferences() override {}
ash::ScopedCrosSettingsTestHelper* ScopedCrosSettingsTestHelper();
- base::Optional<std::string> requested_locale() { return requested_locale_; }
+ absl::optional<std::string> requested_locale() { return requested_locale_; }
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
// Schedules a task on the history backend and runs a nested loop until the
@@ -505,14 +505,14 @@
std::string profile_name_{kDefaultProfileUserName};
- base::Optional<bool> override_policy_connector_is_managed_;
- base::Optional<OTRProfileID> otr_profile_id_;
+ absl::optional<bool> override_policy_connector_is_managed_;
+ absl::optional<OTRProfileID> otr_profile_id_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
std::unique_ptr<ash::ScopedCrosSettingsTestHelper>
scoped_cros_settings_test_helper_;
- base::Optional<std::string> requested_locale_;
+ absl::optional<std::string> requested_locale_;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/chrome/test/base/testing_profile_manager.cc b/chrome/test/base/testing_profile_manager.cc
index 38c94e7..093ccdbe 100644
--- a/chrome/test/base/testing_profile_manager.cc
+++ b/chrome/test/base/testing_profile_manager.cc
@@ -67,8 +67,8 @@
int avatar_id,
const std::string& supervised_user_id,
TestingProfile::TestingFactories testing_factories,
- base::Optional<bool> is_new_profile,
- base::Optional<std::unique_ptr<policy::PolicyService>> policy_service) {
+ absl::optional<bool> is_new_profile,
+ absl::optional<std::unique_ptr<policy::PolicyService>> policy_service) {
DCHECK(called_set_up_);
// Create a path for the profile based on the name.
diff --git a/chrome/test/base/testing_profile_manager.h b/chrome/test/base/testing_profile_manager.h
index d4bf032..c401e9f 100644
--- a/chrome/test/base/testing_profile_manager.h
+++ b/chrome/test/base/testing_profile_manager.h
@@ -69,9 +69,9 @@
int avatar_id,
const std::string& supervised_user_id,
TestingProfile::TestingFactories testing_factories,
- base::Optional<bool> is_new_profile = base::nullopt,
- base::Optional<std::unique_ptr<policy::PolicyService>> policy_service =
- base::nullopt);
+ absl::optional<bool> is_new_profile = absl::nullopt,
+ absl::optional<std::unique_ptr<policy::PolicyService>> policy_service =
+ absl::nullopt);
// Small helpers for creating testing profiles. Just forward to above.
TestingProfile* CreateTestingProfile(const std::string& name);
diff --git a/chrome/test/base/web_ui_browser_test.cc b/chrome/test/base/web_ui_browser_test.cc
index bb95da8..2f5f24d 100644
--- a/chrome/test/base/web_ui_browser_test.cc
+++ b/chrome/test/base/web_ui_browser_test.cc
@@ -122,7 +122,7 @@
if (!test_succeeded)
ASSERT_TRUE(test_result->GetString(1, &message));
- TestComplete(test_succeeded ? base::Optional<std::string>() : message);
+ TestComplete(test_succeeded ? absl::optional<std::string>() : message);
}
// content::WebUIMessageHandler:
diff --git a/chrome/test/chromedriver/chrome/devtools_client_impl.cc b/chrome/test/chromedriver/chrome/devtools_client_impl.cc
index e48b288..dd2ded5 100644
--- a/chrome/test/chromedriver/chrome/devtools_client_impl.cc
+++ b/chrome/test/chromedriver/chrome/devtools_client_impl.cc
@@ -720,7 +720,7 @@
error_message == kInspectorOpaqueOrigins) {
return Status(kInvalidArgument, error_message);
}
- base::Optional<int> error_code = error_dict->FindIntPath("code");
+ absl::optional<int> error_code = error_dict->FindIntPath("code");
if (error_code == kInvalidParamsInspectorCode)
return Status(kInvalidArgument, error_message);
}
diff --git a/chrome/test/chromedriver/element_commands.cc b/chrome/test/chromedriver/element_commands.cc
index 9355a058..013f2ed 100644
--- a/chrome/test/chromedriver/element_commands.cc
+++ b/chrome/test/chromedriver/element_commands.cc
@@ -798,14 +798,14 @@
return status;
// Computed label stores as `name` in the AXTree.
- base::Optional<base::Value> nameNode = axNode->ExtractKey("name");
+ absl::optional<base::Value> nameNode = axNode->ExtractKey("name");
if (!nameNode) {
// No computed label found. Return empty string.
*value = std::make_unique<base::Value>("");
return Status(kOk);
}
- base::Optional<base::Value> nameVal = nameNode->ExtractKey("value");
+ absl::optional<base::Value> nameVal = nameNode->ExtractKey("value");
if (!nameVal)
return Status(kUnknownError,
"No name value found in the node in CDP response");
@@ -825,14 +825,14 @@
if (status.IsError())
return status;
- base::Optional<base::Value> roleNode = axNode->ExtractKey("role");
+ absl::optional<base::Value> roleNode = axNode->ExtractKey("role");
if (!roleNode) {
// No computed role found. Return empty string.
*value = std::make_unique<base::Value>("");
return Status(kOk);
}
- base::Optional<base::Value> roleVal = roleNode->ExtractKey("value");
+ absl::optional<base::Value> roleVal = roleNode->ExtractKey("value");
if (!roleVal)
return Status(kUnknownError,
"No role value found in the node in CDP response");
diff --git a/chrome/test/chromedriver/element_util.cc b/chrome/test/chromedriver/element_util.cc
index 2c57910..163209f8 100644
--- a/chrome/test/chromedriver/element_util.cc
+++ b/chrome/test/chromedriver/element_util.cc
@@ -7,7 +7,6 @@
#include <memory>
#include <utility>
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -22,6 +21,7 @@
#include "chrome/test/chromedriver/chrome/web_view.h"
#include "chrome/test/chromedriver/net/timeout.h"
#include "chrome/test/chromedriver/session.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/webdriver/atoms.h"
namespace {
@@ -105,7 +105,7 @@
args, &result);
if (status.IsError())
return status;
- base::Optional<bool> is_clickable = base::nullopt;
+ absl::optional<bool> is_clickable = absl::nullopt;
if (result->is_dict())
is_clickable = result->FindBoolKey("clickable");
if (!is_clickable.has_value()) {
@@ -956,7 +956,7 @@
if (status.IsError())
return status;
- base::Optional<base::Value> nodes = result->ExtractKey("nodes");
+ absl::optional<base::Value> nodes = result->ExtractKey("nodes");
if (!nodes)
return Status(kUnknownError, "No `nodes` found in CDP response");
diff --git a/chrome/test/chromedriver/net/sync_websocket_impl.cc b/chrome/test/chromedriver/net/sync_websocket_impl.cc
index d3eb95d..f6cdd19 100644
--- a/chrome/test/chromedriver/net/sync_websocket_impl.cc
+++ b/chrome/test/chromedriver/net/sync_websocket_impl.cc
@@ -134,7 +134,7 @@
void SyncWebSocketImpl::Core::DetermineRecipient(const std::string& message,
bool* send_to_chromedriver) {
- base::Optional<base::Value> message_value =
+ absl::optional<base::Value> message_value =
base::JSONReader::Read(message, base::JSON_REPLACE_INVALID_CHARACTERS);
base::DictionaryValue* message_dict;
if (!message_value || !message_value->GetAsDictionary(&message_dict)) {
diff --git a/chrome/test/chromedriver/net/sync_websocket_impl_unittest.cc b/chrome/test/chromedriver/net/sync_websocket_impl_unittest.cc
index 539de4ce..1424891 100644
--- a/chrome/test/chromedriver/net/sync_websocket_impl_unittest.cc
+++ b/chrome/test/chromedriver/net/sync_websocket_impl_unittest.cc
@@ -93,7 +93,7 @@
// Getting message id and method
base::DictionaryValue* message_dict;
- base::Optional<base::Value> message_value = base::JSONReader::Read(message);
+ absl::optional<base::Value> message_value = base::JSONReader::Read(message);
ASSERT_TRUE(message_value.has_value());
ASSERT_TRUE(message_value->GetAsDictionary(&message_dict));
std::string method;
diff --git a/chrome/test/chromedriver/webauthn_commands.cc b/chrome/test/chromedriver/webauthn_commands.cc
index 1ae54c59..5ff854e 100644
--- a/chrome/test/chromedriver/webauthn_commands.cc
+++ b/chrome/test/chromedriver/webauthn_commands.cc
@@ -162,7 +162,7 @@
if (status.IsError())
return status;
- base::Optional<base::Value> authenticator_id =
+ absl::optional<base::Value> authenticator_id =
result->ExtractKey("authenticatorId");
if (!authenticator_id)
return Status(kUnknownError, kDevToolsDidNotReturnExpectedValue);
@@ -214,7 +214,7 @@
if (status.IsError())
return status;
- base::Optional<base::Value> credentials = result->ExtractKey("credentials");
+ absl::optional<base::Value> credentials = result->ExtractKey("credentials");
if (!credentials)
return Status(kUnknownError, kDevToolsDidNotReturnExpectedValue);
diff --git a/chrome/test/media_router/media_router_ui_for_test.cc b/chrome/test/media_router/media_router_ui_for_test.cc
index de8af037..87167ec 100644
--- a/chrome/test/media_router/media_router_ui_for_test.cc
+++ b/chrome/test/media_router/media_router_ui_for_test.cc
@@ -355,7 +355,7 @@
void MediaRouterUiForTest::ObserveDialog(
WatchType watch_type,
- base::Optional<std::string> sink_name) {
+ absl::optional<std::string> sink_name) {
CHECK(!watch_sink_name_);
CHECK(!watch_callback_);
CHECK_EQ(watch_type_, WatchType::kNone);
diff --git a/chrome/test/media_router/media_router_ui_for_test.h b/chrome/test/media_router/media_router_ui_for_test.h
index caf3d86..a80f488 100644
--- a/chrome/test/media_router/media_router_ui_for_test.h
+++ b/chrome/test/media_router/media_router_ui_for_test.h
@@ -8,12 +8,12 @@
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "chrome/browser/ui/views/media_router/cast_dialog_view.h"
#include "chrome/browser/ui/views/media_router/media_router_dialog_controller_views.h"
#include "components/media_router/common/media_sink.h"
#include "components/media_router/common/media_source.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
class WebContents;
@@ -99,13 +99,13 @@
// of |watch_type| is observed. |sink_name| should be set only if observing
// for a sink.
void ObserveDialog(WatchType watch_type,
- base::Optional<std::string> sink_name = base::nullopt);
+ absl::optional<std::string> sink_name = absl::nullopt);
content::WebContents* web_contents_;
MediaRouterDialogControllerViews* dialog_controller_;
- base::Optional<std::string> watch_sink_name_;
- base::Optional<base::OnceClosure> watch_callback_;
+ absl::optional<std::string> watch_sink_name_;
+ absl::optional<base::OnceClosure> watch_callback_;
WatchType watch_type_ = WatchType::kNone;
base::WeakPtrFactory<MediaRouterUiForTest> weak_factory_{this};
diff --git a/chrome/test/origin_policy/origin_policy_browsertest.cc b/chrome/test/origin_policy/origin_policy_browsertest.cc
index 717d88d..9ff8b6be1 100644
--- a/chrome/test/origin_policy/origin_policy_browsertest.cc
+++ b/chrome/test/origin_policy/origin_policy_browsertest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/bind.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/test/base/in_process_browser_test.h"
@@ -13,6 +12,7 @@
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
const base::FilePath::CharType kDataRoot[] =
@@ -92,7 +92,7 @@
base::test::ScopedFeatureList feature_list_;
net::HttpStatusCode status_;
- base::Optional<std::string> location_header_;
+ absl::optional<std::string> location_header_;
DISALLOW_COPY_AND_ASSIGN(OriginPolicyBrowserTest);
};
diff --git a/chrome/test/ppapi/ppapi_browsertest.cc b/chrome/test/ppapi/ppapi_browsertest.cc
index 6479684..9053f35 100644
--- a/chrome/test/ppapi/ppapi_browsertest.cc
+++ b/chrome/test/ppapi/ppapi_browsertest.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/stl_util.h"
#include "base/test/scoped_feature_list.h"
@@ -70,6 +69,7 @@
#include "services/network/public/mojom/udp_socket.mojom.h"
#include "services/network/test/test_dns_util.h"
#include "services/network/test/test_network_context.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
@@ -390,8 +390,8 @@
receiver_(this, std::move(receiver)) {
if (tcp_failure_type_ == TCPFailureType::kConnectError) {
std::move(callback).Run(
- net::ERR_FAILED, base::nullopt /* local_addr */,
- base::nullopt /* peer_addr */,
+ net::ERR_FAILED, absl::nullopt /* local_addr */,
+ absl::nullopt /* peer_addr */,
mojo::ScopedDataPipeConsumerHandle() /* receive_stream */,
mojo::ScopedDataPipeProducerHandle() /* send_stream */);
return;
@@ -427,7 +427,7 @@
receiver_(this) {
if (tcp_failure_type_ == TCPFailureType::kAcceptError) {
std::move(callback).Run(
- net::ERR_FAILED, base::nullopt /* remote_addr */,
+ net::ERR_FAILED, absl::nullopt /* remote_addr */,
mojo::NullRemote() /* connected_socket */,
mojo::ScopedDataPipeConsumerHandle() /* receive_stream */,
mojo::ScopedDataPipeProducerHandle() /* send_stream */);
@@ -481,7 +481,7 @@
if (tcp_failure_type_ == TCPFailureType::kUpgradeToTLSError) {
std::move(callback).Run(
net::ERR_FAILED, mojo::ScopedDataPipeConsumerHandle(),
- mojo::ScopedDataPipeProducerHandle(), base::nullopt /* ssl_info */);
+ mojo::ScopedDataPipeProducerHandle(), absl::nullopt /* ssl_info */);
return;
}
@@ -605,7 +605,7 @@
: tcp_failure_type_(tcp_failure_type),
receiver_(this, std::move(receiver)) {
if (tcp_failure_type_ == TCPFailureType::kCreateTCPServerSocketError) {
- std::move(callback).Run(net::ERR_FAILED, base::nullopt /* local_addr */);
+ std::move(callback).Run(net::ERR_FAILED, absl::nullopt /* local_addr */);
return;
}
if (tcp_failure_type_ == TCPFailureType::kCreateTCPServerSocketHangs) {
@@ -669,7 +669,7 @@
: tcp_failure_type_(tcp_failure_type),
receiver_(this, std::move(receiver)) {
if (tcp_failure_type_ == TCPFailureType::kBindError) {
- std::move(callback).Run(net::ERR_FAILED, base::nullopt /* local_addr */);
+ std::move(callback).Run(net::ERR_FAILED, absl::nullopt /* local_addr */);
return;
}
if (tcp_failure_type_ == TCPFailureType::kBindHangs) {
@@ -753,7 +753,7 @@
}
void CreateTCPConnectedSocket(
- const base::Optional<net::IPEndPoint>& local_addr,
+ const absl::optional<net::IPEndPoint>& local_addr,
const net::AddressList& remote_addr_list,
network::mojom::TCPConnectedSocketOptionsPtr tcp_connected_socket_options,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
@@ -1052,7 +1052,7 @@
network::mojom::UDPSocketOptionsPtr options,
BindCallback callback) override {
if (failure_type_ == FailureType::kBindError) {
- std::move(callback).Run(net::ERR_FAILED, base::nullopt);
+ std::move(callback).Run(net::ERR_FAILED, absl::nullopt);
return;
}
if (failure_type_ == FailureType::kBindDropPipe) {
@@ -1096,8 +1096,8 @@
}
if (failure_type_ == FailureType::kReadError) {
for (uint32_t i = 0; i < num_additional_datagrams; ++i) {
- socket_listener_->OnReceived(net::ERR_FAILED, base::nullopt,
- base::nullopt);
+ socket_listener_->OnReceived(net::ERR_FAILED, absl::nullopt,
+ absl::nullopt);
}
return;
}
diff --git a/chrome/updater/app/app.cc b/chrome/updater/app/app.cc
index 900af54..86c85247 100644
--- a/chrome/updater/app/app.cc
+++ b/chrome/updater/app/app.cc
@@ -11,12 +11,12 @@
#include "base/callback.h"
#include "base/check_op.h"
#include "base/command_line.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/updater/tag.h"
#include "chrome/updater/updater_scope.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -24,20 +24,20 @@
App::App()
: process_scope_(GetProcessScope()),
- tag_args_([]() -> base::Optional<tagging::TagArgs> {
+ tag_args_([]() -> absl::optional<tagging::TagArgs> {
base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
const std::string tag = command_line->GetSwitchValueASCII(kTagSwitch);
if (tag.empty())
- return base::nullopt;
+ return absl::nullopt;
tagging::TagArgs tag_args;
const tagging::ErrorCode error =
- tagging::Parse(tag, base::nullopt, &tag_args);
+ tagging::Parse(tag, absl::nullopt, &tag_args);
VLOG_IF(1, error != tagging::ErrorCode::kSuccess)
<< "Tag parsing returned " << error << ".";
return error == tagging::ErrorCode::kSuccess
- ? base::make_optional(tag_args)
- : base::nullopt;
+ ? absl::make_optional(tag_args)
+ : absl::nullopt;
}()) {}
App::~App() = default;
@@ -91,7 +91,7 @@
return process_scope_;
}
-base::Optional<tagging::TagArgs> App::tag_args() const {
+absl::optional<tagging::TagArgs> App::tag_args() const {
return tag_args_;
}
diff --git a/chrome/updater/app/app.h b/chrome/updater/app/app.h
index 23b68f4..0192889 100644
--- a/chrome/updater/app/app.h
+++ b/chrome/updater/app/app.h
@@ -8,10 +8,10 @@
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "chrome/updater/tag.h"
#include "chrome/updater/updater_scope.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -58,7 +58,7 @@
// the command line arguments, including the tag arguments.
UpdaterScope updater_scope() const;
- base::Optional<tagging::TagArgs> tag_args() const;
+ absl::optional<tagging::TagArgs> tag_args() const;
private:
// Allows initialization of the thread pool for specific environments, in
@@ -82,7 +82,7 @@
const UpdaterScope process_scope_;
// Contains the tag if a tag is present on the command line.
- const base::Optional<tagging::TagArgs> tag_args_;
+ const absl::optional<tagging::TagArgs> tag_args_;
};
} // namespace updater
diff --git a/chrome/updater/app/app_install.cc b/chrome/updater/app/app_install.cc
index fa73044c..8d130af 100644
--- a/chrome/updater/app/app_install.cc
+++ b/chrome/updater/app/app_install.cc
@@ -13,7 +13,6 @@
#include "base/command_line.h"
#include "base/i18n/icu_util.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/threading/sequenced_task_runner_handle.h"
@@ -29,6 +28,7 @@
#include "chrome/updater/update_service_internal.h"
#include "chrome/updater/updater_version.h"
#include "components/prefs/pref_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -145,7 +145,7 @@
void AppInstall::MaybeInstallApp() {
const std::string app_id = [this]() {
- base::Optional<tagging::TagArgs> tag_args = this->tag_args();
+ absl::optional<tagging::TagArgs> tag_args = this->tag_args();
if (tag_args && !tag_args->apps.empty()) {
// TODO(crbug.com/1128631): support bundles. For now, assume one app.
DCHECK_EQ(tag_args->apps.size(), size_t{1});
diff --git a/chrome/updater/app/app_server_unittest.cc b/chrome/updater/app/app_server_unittest.cc
index a850d46..54f06d98 100644
--- a/chrome/updater/app/app_server_unittest.cc
+++ b/chrome/updater/app/app_server_unittest.cc
@@ -10,7 +10,6 @@
#include "base/files/file_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/message_loop/message_pump_type.h"
-#include "base/optional.h"
#include "base/task/single_thread_task_executor.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "chrome/updater/constants.h"
@@ -22,6 +21,7 @@
#include "components/prefs/pref_service.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
using testing::Invoke;
using testing::Return;
@@ -57,7 +57,7 @@
};
void ClearPrefs() {
- for (const base::Optional<base::FilePath>& path :
+ for (const absl::optional<base::FilePath>& path :
{GetBaseDirectory(), GetVersionedDirectory()}) {
ASSERT_TRUE(path);
ASSERT_TRUE(
diff --git a/chrome/updater/app/server/win/com_classes.cc b/chrome/updater/app/server/win/com_classes.cc
index 4618f31a..6018d2d 100644
--- a/chrome/updater/app/server/win/com_classes.cc
+++ b/chrome/updater/app/server/win/com_classes.cc
@@ -13,7 +13,6 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
@@ -22,6 +21,7 @@
#include "chrome/updater/app/server/win/server.h"
#include "chrome/updater/registration_data.h"
#include "chrome/updater/updater_version.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -122,35 +122,35 @@
return E_INVALIDARG;
// Validates that string parameters are not longer than 16K characters.
- base::Optional<RegistrationRequest> request =
+ absl::optional<RegistrationRequest> request =
[app_id, brand_code, tag, version,
existence_checker_path]() -> decltype(request) {
for (const auto* str :
{app_id, brand_code, tag, version, existence_checker_path}) {
constexpr size_t kMaxStringLen = 0x4000; // 16KB.
if (wcsnlen_s(str, kMaxStringLen) == kMaxStringLen) {
- return base::nullopt;
+ return absl::nullopt;
}
}
RegistrationRequest request;
if (!app_id || !base::WideToUTF8(app_id, wcslen(app_id), &request.app_id)) {
- return base::nullopt;
+ return absl::nullopt;
}
if (!brand_code || !base::WideToUTF8(brand_code, wcslen(brand_code),
&request.brand_code)) {
- return base::nullopt;
+ return absl::nullopt;
}
if (!tag || !base::WideToUTF8(tag, wcslen(tag), &request.tag)) {
- return base::nullopt;
+ return absl::nullopt;
}
std::string version_str;
if (!version || !base::WideToUTF8(version, wcslen(version), &version_str)) {
- return base::nullopt;
+ return absl::nullopt;
}
request.version = base::Version(version_str);
if (!request.version.IsValid()) {
- return base::nullopt;
+ return absl::nullopt;
}
request.existence_checker_path = base::FilePath(existence_checker_path);
diff --git a/chrome/updater/app/server/win/com_classes_legacy.h b/chrome/updater/app/server/win/com_classes_legacy.h
index 34cb8af..b6099512 100644
--- a/chrome/updater/app/server/win/com_classes_legacy.h
+++ b/chrome/updater/app/server/win/com_classes_legacy.h
@@ -11,10 +11,10 @@
#include <string>
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/synchronization/lock.h"
#include "chrome/updater/app/server/win/updater_legacy_idl.h"
#include "chrome/updater/update_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class SequencedTaskRunner;
@@ -141,8 +141,8 @@
// Access to these members must be serialized by using the lock.
mutable base::Lock lock_;
std::string app_id_;
- base::Optional<UpdateService::UpdateState> state_update_;
- base::Optional<UpdateService::Result> result_;
+ absl::optional<UpdateService::UpdateState> state_update_;
+ absl::optional<UpdateService::Result> result_;
};
} // namespace updater
diff --git a/chrome/updater/app/server/win/server.cc b/chrome/updater/app/server/win/server.cc
index 59b5e03..aa13f3fa 100644
--- a/chrome/updater/app/server/win/server.cc
+++ b/chrome/updater/app/server/win/server.cc
@@ -16,7 +16,6 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/system/sys_info.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
@@ -36,6 +35,7 @@
#include "chrome/updater/win/setup/uninstall.h"
#include "chrome/updater/win/wrl_module.h"
#include "components/prefs/pref_service.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -217,7 +217,7 @@
bool ComServerApp::SwapRPCInterfaces() {
std::unique_ptr<WorkItemList> list(WorkItem::CreateWorkItemList());
- base::Optional<base::FilePath> versioned_directory = GetVersionedDirectory();
+ absl::optional<base::FilePath> versioned_directory = GetVersionedDirectory();
if (!versioned_directory)
return false;
for (const CLSID& clsid : GetActiveServers()) {
diff --git a/chrome/updater/crash_client.cc b/chrome/updater/crash_client.cc
index 30165bcb..0d9f374 100644
--- a/chrome/updater/crash_client.cc
+++ b/chrome/updater/crash_client.cc
@@ -10,11 +10,11 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "chrome/updater/util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/crashpad/crashpad/client/crash_report_database.h"
#include "third_party/crashpad/crashpad/client/crashpad_client.h"
#include "third_party/crashpad/crashpad/client/prune_crash_reports.h"
@@ -55,7 +55,7 @@
base::FilePath handler_path;
base::PathService::Get(base::FILE_EXE, &handler_path);
- base::Optional<base::FilePath> database_path = GetVersionedDirectory();
+ absl::optional<base::FilePath> database_path = GetVersionedDirectory();
if (!database_path) {
LOG(ERROR) << "Failed to get the database path.";
return false;
diff --git a/chrome/updater/crash_reporter.cc b/chrome/updater/crash_reporter.cc
index c554493ba..9c06367 100644
--- a/chrome/updater/crash_reporter.cc
+++ b/chrome/updater/crash_reporter.cc
@@ -12,7 +12,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/stl_util.h"
#include "base/strings/strcat.h"
@@ -21,6 +20,7 @@
#include "chrome/updater/constants.h"
#include "chrome/updater/updater_branding.h"
#include "chrome/updater/util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/crashpad/crashpad/client/crashpad_client.h"
#include "third_party/crashpad/crashpad/handler/handler_main.h"
@@ -61,7 +61,7 @@
base::FilePath handler_path;
base::PathService::Get(base::FILE_EXE, &handler_path);
- base::Optional<base::FilePath> database_path = GetVersionedDirectory();
+ absl::optional<base::FilePath> database_path = GetVersionedDirectory();
if (!database_path) {
LOG(DFATAL) << "Failed to get the database path.";
return;
diff --git a/chrome/updater/device_management/dm_storage.cc b/chrome/updater/device_management/dm_storage.cc
index d66e4f6..622b0b04 100644
--- a/chrome/updater/device_management/dm_storage.cc
+++ b/chrome/updater/device_management/dm_storage.cc
@@ -12,13 +12,13 @@
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/files/important_file_writer.h"
-#include "base/optional.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/updater/device_management/dm_cached_policy_info.h"
#include "chrome/updater/device_management/dm_message.h"
#include "chrome/updater/device_management/dm_policy_manager.h"
#include "chrome/updater/util.h"
#include "components/policy/proto/device_management_backend.pb.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -189,7 +189,7 @@
}
scoped_refptr<DMStorage> GetDefaultDMStorage() {
- base::Optional<base::FilePath> updater_versioned_path =
+ absl::optional<base::FilePath> updater_versioned_path =
GetVersionedDirectory();
if (!updater_versioned_path)
return nullptr;
diff --git a/chrome/updater/enum_traits.h b/chrome/updater/enum_traits.h
index 43ca456..e5bea7df 100644
--- a/chrome/updater/enum_traits.h
+++ b/chrome/updater/enum_traits.h
@@ -8,7 +8,7 @@
#include <ostream>
#include <type_traits>
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -42,14 +42,14 @@
// The enum type must be annotated with traits to specify the lower and upper
// bounds of the enum values.
template <typename T, typename V>
-base::Optional<T> CheckedCastToEnum(V v) {
+absl::optional<T> CheckedCastToEnum(V v) {
static_assert(std::is_enum<T>::value, "T must be an enum type.");
static_assert(std::is_integral<V>::value, "V must be an integral type.");
using Traits = EnumTraits<T>;
return (static_cast<V>(Traits::first_elem) <= v &&
v <= static_cast<V>(Traits::last_elem))
- ? base::make_optional(static_cast<T>(v))
- : base::nullopt;
+ ? absl::make_optional(static_cast<T>(v))
+ : absl::nullopt;
}
} // namespace updater
diff --git a/chrome/updater/enum_traits_unittest.cc b/chrome/updater/enum_traits_unittest.cc
index 14d83295..41aa2646 100644
--- a/chrome/updater/enum_traits_unittest.cc
+++ b/chrome/updater/enum_traits_unittest.cc
@@ -6,8 +6,8 @@
#include <ostream>
-#include "base/optional.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -31,8 +31,8 @@
EXPECT_EQ(MyEnum::kVal1, *CheckedCastToEnum<MyEnum>(-1));
EXPECT_EQ(MyEnum::kVal2, *CheckedCastToEnum<MyEnum>(0));
EXPECT_EQ(MyEnum::kVal3, *CheckedCastToEnum<MyEnum>(1));
- EXPECT_EQ(CheckedCastToEnum<MyEnum>(-2), base::nullopt);
- EXPECT_EQ(CheckedCastToEnum<MyEnum>(2), base::nullopt);
+ EXPECT_EQ(CheckedCastToEnum<MyEnum>(-2), absl::nullopt);
+ EXPECT_EQ(CheckedCastToEnum<MyEnum>(2), absl::nullopt);
}
} // namespace updater
diff --git a/chrome/updater/external_constants_builder.cc b/chrome/updater/external_constants_builder.cc
index e99093ac..e77c4e6 100644
--- a/chrome/updater/external_constants_builder.cc
+++ b/chrome/updater/external_constants_builder.cc
@@ -9,9 +9,9 @@
#include "base/json/json_file_value_serializer.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "chrome/updater/constants.h"
#include "chrome/updater/util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -72,7 +72,7 @@
}
bool ExternalConstantsBuilder::Overwrite() {
- base::Optional<base::FilePath> base_path = GetBaseDirectory();
+ absl::optional<base::FilePath> base_path = GetBaseDirectory();
if (!base_path) {
LOG(ERROR) << "Can't find base directory; can't save constant overrides.";
return false;
diff --git a/chrome/updater/external_constants_builder_unittest.cc b/chrome/updater/external_constants_builder_unittest.cc
index 45f622d..c0b38de 100644
--- a/chrome/updater/external_constants_builder_unittest.cc
+++ b/chrome/updater/external_constants_builder_unittest.cc
@@ -11,13 +11,13 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "chrome/updater/constants.h"
#include "chrome/updater/external_constants.h"
#include "chrome/updater/external_constants_builder.h"
#include "chrome/updater/external_constants_override.h"
#include "chrome/updater/updater_branding.h"
#include "chrome/updater/util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace updater {
@@ -25,7 +25,7 @@
namespace {
void DeleteOverridesFile() {
- base::Optional<base::FilePath> target = GetBaseDirectory();
+ absl::optional<base::FilePath> target = GetBaseDirectory();
if (!target) {
LOG(ERROR) << "Could not get base directory to clean out overrides file.";
return;
diff --git a/chrome/updater/external_constants_override.cc b/chrome/updater/external_constants_override.cc
index 085cfd6..778e9dc 100644
--- a/chrome/updater/external_constants_override.cc
+++ b/chrome/updater/external_constants_override.cc
@@ -13,7 +13,6 @@
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/updater/constants.h"
@@ -22,6 +21,7 @@
#include "chrome/updater/updater_branding.h"
#include "chrome/updater/updater_version.h"
#include "chrome/updater/util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#if defined(OS_MAC)
@@ -117,7 +117,7 @@
std::unique_ptr<ExternalConstantsOverrider>
ExternalConstantsOverrider::FromDefaultJSONFile(
std::unique_ptr<ExternalConstants> next_provider) {
- base::Optional<base::FilePath> data_dir_path = GetBaseDirectory();
+ absl::optional<base::FilePath> data_dir_path = GetBaseDirectory();
if (!data_dir_path) {
LOG(ERROR) << "Cannot find app data path.";
return nullptr;
diff --git a/chrome/updater/installer.cc b/chrome/updater/installer.cc
index e18d151..01d982a 100644
--- a/chrome/updater/installer.cc
+++ b/chrome/updater/installer.cc
@@ -11,7 +11,6 @@
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/threading/scoped_blocking_call.h"
@@ -24,6 +23,7 @@
#include "components/crx_file/crx_verifier.h"
#include "components/update_client/update_client_errors.h"
#include "components/update_client/utils.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -37,10 +37,10 @@
// Returns the full path to the installation directory for the application
// identified by the |app_id|.
-base::Optional<base::FilePath> GetAppInstallDir(const std::string& app_id) {
- base::Optional<base::FilePath> app_install_dir = GetBaseDirectory();
+absl::optional<base::FilePath> GetAppInstallDir(const std::string& app_id) {
+ absl::optional<base::FilePath> app_install_dir = GetBaseDirectory();
if (!app_install_dir)
- return base::nullopt;
+ return absl::nullopt;
return app_install_dir->AppendASCII(kAppsDir).AppendASCII(app_id);
}
@@ -97,7 +97,7 @@
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::WILL_BLOCK);
- const base::Optional<base::FilePath> app_install_dir =
+ const absl::optional<base::FilePath> app_install_dir =
GetAppInstallDir(app_id_);
if (!app_install_dir || !base::PathExists(*app_install_dir)) {
return;
@@ -142,7 +142,7 @@
if (pv_.CompareTo(manifest_version) > 0)
return Result(update_client::InstallError::VERSION_NOT_UPGRADED);
- const base::Optional<base::FilePath> app_install_dir =
+ const absl::optional<base::FilePath> app_install_dir =
GetAppInstallDir(app_id_);
if (!app_install_dir)
return Result(update_client::InstallError::NO_DIR_COMPONENT_USER);
@@ -242,12 +242,12 @@
return false;
}
-base::Optional<base::FilePath> Installer::GetCurrentInstallDir() const {
+absl::optional<base::FilePath> Installer::GetCurrentInstallDir() const {
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::WILL_BLOCK);
- base::Optional<base::FilePath> path = GetAppInstallDir(app_id_);
+ absl::optional<base::FilePath> path = GetAppInstallDir(app_id_);
if (!path)
- return base::nullopt;
+ return absl::nullopt;
return path->AppendASCII(pv_.GetString());
}
diff --git a/chrome/updater/installer.h b/chrome/updater/installer.h
index fa09107..35c8be1 100644
--- a/chrome/updater/installer.h
+++ b/chrome/updater/installer.h
@@ -11,12 +11,12 @@
#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/version.h"
#include "build/build_config.h"
#include "chrome/updater/persisted_data.h"
#include "components/update_client/update_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -94,7 +94,7 @@
void DeleteOlderInstallPaths();
// Returns an install directory matching the |pv_| version.
- base::Optional<base::FilePath> GetCurrentInstallDir() const;
+ absl::optional<base::FilePath> GetCurrentInstallDir() const;
SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/updater/mac/mac_util.h b/chrome/updater/mac/mac_util.h
index f17253d..30578b7 100644
--- a/chrome/updater/mac/mac_util.h
+++ b/chrome/updater/mac/mac_util.h
@@ -6,9 +6,9 @@
#define CHROME_UPDATER_MAC_MAC_UTIL_H_
#include "base/mac/scoped_cftyperef.h"
-#include "base/optional.h"
#include "chrome/common/mac/launchd.h"
#include "chrome/updater/updater_scope.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class FilePath;
@@ -19,44 +19,44 @@
// For user installations returns: the "~/Library" for the logged in user.
// For system installations returns: "/Library".
-base::Optional<base::FilePath> GetLibraryFolderPath(UpdaterScope scope);
+absl::optional<base::FilePath> GetLibraryFolderPath(UpdaterScope scope);
// For user installations sets `path` to: the "~/Library/Application Support"
// for the logged in user. For system installations sets `path` to:
// "/Library/Application Support".
-base::Optional<base::FilePath> GetApplicationSupportDirectory(
+absl::optional<base::FilePath> GetApplicationSupportDirectory(
UpdaterScope scope);
// For user installations:
// ~/Library/Google/GoogleUpdater
// For system installations:
// /Library/Google/GoogleUpdater
-base::Optional<base::FilePath> GetUpdaterFolderPath(UpdaterScope scope);
+absl::optional<base::FilePath> GetUpdaterFolderPath(UpdaterScope scope);
// For user installations:
// ~/Library/Google/GoogleUpdater/88.0.4293.0
// For system installations:
// /Library/Google/GoogleUpdater/88.0.4293.0
-base::Optional<base::FilePath> GetVersionedUpdaterFolderPathForVersion(
+absl::optional<base::FilePath> GetVersionedUpdaterFolderPathForVersion(
UpdaterScope scope,
const base::Version& version);
// The same as GetVersionedUpdaterFolderPathForVersion, where the version is
// kUpdaterVersion.
-base::Optional<base::FilePath> GetVersionedUpdaterFolderPath(
+absl::optional<base::FilePath> GetVersionedUpdaterFolderPath(
UpdaterScope scope);
// For user installations:
// ~/Library/Google/GoogleUpdater/88.0.4293.0/GoogleUpdater.app/Contents/MacOS/GoogleUpdater
// For system installations:
// /Library/Google/GoogleUpdater/88.0.4293.0/GoogleUpdater.app/Contents/MacOS/GoogleUpdater
-base::Optional<base::FilePath> GetUpdaterExecutablePath(UpdaterScope scope);
+absl::optional<base::FilePath> GetUpdaterExecutablePath(UpdaterScope scope);
// For user installations:
// ~/Library/Google/GoogleUpdater/88.0.4293.0/GoogleUpdater.app/Contents/MacOS
// For system installations:
// /Library/Google/GoogleUpdater/88.0.4293.0/GoogleUpdater.app/Contents/MacOS
-base::Optional<base::FilePath> GetExecutableFolderPathForVersion(
+absl::optional<base::FilePath> GetExecutableFolderPathForVersion(
UpdaterScope scope,
const base::Version& version);
diff --git a/chrome/updater/mac/mac_util.mm b/chrome/updater/mac/mac_util.mm
index 64bf886..29bc4db1 100644
--- a/chrome/updater/mac/mac_util.mm
+++ b/chrome/updater/mac/mac_util.mm
@@ -12,7 +12,6 @@
#include "base/logging.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_cftyperef.h"
-#include "base/optional.h"
#include "base/process/launch.h"
#include "base/strings/sys_string_conversions.h"
#include "base/threading/scoped_blocking_call.h"
@@ -22,6 +21,7 @@
#include "chrome/updater/updater_scope.h"
#include "chrome/updater/updater_version.h"
#include "chrome/updater/util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
namespace {
@@ -41,7 +41,7 @@
} // namespace
-base::Optional<base::FilePath> GetLibraryFolderPath(UpdaterScope scope) {
+absl::optional<base::FilePath> GetLibraryFolderPath(UpdaterScope scope) {
switch (scope) {
case UpdaterScope::kUser:
return base::mac::GetUserLibraryPath();
@@ -50,14 +50,14 @@
if (!base::mac::GetLocalDirectory(NSLibraryDirectory,
&local_library_path)) {
VLOG(1) << "Could not get local library path";
- return base::nullopt;
+ return absl::nullopt;
}
return local_library_path;
}
}
}
-base::Optional<base::FilePath> GetApplicationSupportDirectory(
+absl::optional<base::FilePath> GetApplicationSupportDirectory(
UpdaterScope scope) {
base::FilePath path;
switch (scope) {
@@ -72,47 +72,47 @@
}
VLOG(1) << "Could not get applications support path";
- return base::nullopt;
+ return absl::nullopt;
}
-base::Optional<base::FilePath> GetUpdaterFolderPath(UpdaterScope scope) {
- base::Optional<base::FilePath> path = GetLibraryFolderPath(scope);
+absl::optional<base::FilePath> GetUpdaterFolderPath(UpdaterScope scope) {
+ absl::optional<base::FilePath> path = GetLibraryFolderPath(scope);
if (!path)
- return base::nullopt;
+ return absl::nullopt;
return path->Append(GetUpdateFolderName());
}
-base::Optional<base::FilePath> GetVersionedUpdaterFolderPathForVersion(
+absl::optional<base::FilePath> GetVersionedUpdaterFolderPathForVersion(
UpdaterScope scope,
const base::Version& version) {
- base::Optional<base::FilePath> path = GetUpdaterFolderPath(scope);
+ absl::optional<base::FilePath> path = GetUpdaterFolderPath(scope);
if (!path)
- return base::nullopt;
+ return absl::nullopt;
return path->AppendASCII(version.GetString());
}
-base::Optional<base::FilePath> GetVersionedUpdaterFolderPath(
+absl::optional<base::FilePath> GetVersionedUpdaterFolderPath(
UpdaterScope scope) {
- base::Optional<base::FilePath> path = GetUpdaterFolderPath(scope);
+ absl::optional<base::FilePath> path = GetUpdaterFolderPath(scope);
if (!path)
- return base::nullopt;
+ return absl::nullopt;
return path->AppendASCII(kUpdaterVersion);
}
-base::Optional<base::FilePath> GetExecutableFolderPathForVersion(
+absl::optional<base::FilePath> GetExecutableFolderPathForVersion(
UpdaterScope scope,
const base::Version& version) {
- base::Optional<base::FilePath> path =
+ absl::optional<base::FilePath> path =
GetVersionedUpdaterFolderPathForVersion(scope, version);
if (!path)
- return base::nullopt;
+ return absl::nullopt;
return path->Append(ExecutableFolderPath());
}
-base::Optional<base::FilePath> GetUpdaterExecutablePath(UpdaterScope scope) {
- base::Optional<base::FilePath> path = GetVersionedUpdaterFolderPath(scope);
+absl::optional<base::FilePath> GetUpdaterExecutablePath(UpdaterScope scope) {
+ absl::optional<base::FilePath> path = GetVersionedUpdaterFolderPath(scope);
if (!path)
- return base::nullopt;
+ return absl::nullopt;
return path->Append(ExecutableFolderPath())
.Append(FILE_PATH_LITERAL(PRODUCT_FULLNAME_STRING));
}
diff --git a/chrome/updater/mac/scoped_xpc_service_mock.h b/chrome/updater/mac/scoped_xpc_service_mock.h
index b8fd16c5..ea3cc0a 100644
--- a/chrome/updater/mac/scoped_xpc_service_mock.h
+++ b/chrome/updater/mac/scoped_xpc_service_mock.h
@@ -43,7 +43,7 @@
// code under test. Will not be populated before that request is issued.
// If the remote object is requested via .remoteObjectProxy rather than
// remoteObjectProxyWithErrorHandler:, this field is never populated.
- base::Optional<base::mac::ScopedBlock<void (^)(NSError*)>>
+ absl::optional<base::mac::ScopedBlock<void (^)(NSError*)>>
xpc_error_handler;
explicit RemoteObjectMockRecord(base::scoped_nsprotocol<id> mock_ptr);
diff --git a/chrome/updater/mac/setup/setup.mm b/chrome/updater/mac/setup/setup.mm
index 568a590..1d77166 100644
--- a/chrome/updater/mac/setup/setup.mm
+++ b/chrome/updater/mac/setup/setup.mm
@@ -15,7 +15,6 @@
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsobject.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/process/process.h"
@@ -34,6 +33,7 @@
#include "chrome/updater/updater_scope.h"
#include "chrome/updater/util.h"
#include "components/crash/core/common/crash_key.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -298,7 +298,7 @@
CopyUpdateServiceInternalLaunchdName());
}
-bool DeleteFolder(const base::Optional<base::FilePath>& installed_path) {
+bool DeleteFolder(const absl::optional<base::FilePath>& installed_path) {
if (!installed_path)
return false;
if (!base::DeletePathRecursively(*installed_path)) {
@@ -323,7 +323,7 @@
} // namespace
int Setup(UpdaterScope scope) {
- const base::Optional<base::FilePath> dest_path =
+ const absl::optional<base::FilePath> dest_path =
GetVersionedUpdaterFolderPath(scope);
if (!dest_path)
@@ -353,7 +353,7 @@
}
int PromoteCandidate(UpdaterScope scope) {
- const base::Optional<base::FilePath> dest_path =
+ const absl::optional<base::FilePath> dest_path =
GetVersionedUpdaterFolderPath(scope);
if (!dest_path)
return setup_exit_codes::kFailedToGetVersionedUpdaterFolderPath;
@@ -389,7 +389,7 @@
}
void UninstallOtherVersions(UpdaterScope scope) {
- const base::Optional<base::FilePath> path =
+ const absl::optional<base::FilePath> path =
GetVersionedUpdaterFolderPath(scope);
if (!path) {
LOG(ERROR) << "Failed to get updater folder path.";
diff --git a/chrome/updater/mac/update_service_proxy_test.mm b/chrome/updater/mac/update_service_proxy_test.mm
index 588f93e..ee562ece 100644
--- a/chrome/updater/mac/update_service_proxy_test.mm
+++ b/chrome/updater/mac/update_service_proxy_test.mm
@@ -18,7 +18,6 @@
#include "base/mac/scoped_nsobject.h"
#include "base/memory/scoped_policy.h"
#include "base/memory/scoped_refptr.h"
-#include "base/optional.h"
#include "base/strings/sys_string_conversions.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
@@ -33,6 +32,7 @@
#include "chrome/updater/updater_scope.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gtest_mac.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#import "third_party/ocmock/OCMock/OCMock.h"
#include "third_party/ocmock/gtest_support.h"
diff --git a/chrome/updater/policy_service.h b/chrome/updater/policy_service.h
index b647cb1..0ec97b6 100644
--- a/chrome/updater/policy_service.h
+++ b/chrome/updater/policy_service.h
@@ -10,8 +10,8 @@
#include <vector>
#include "base/callback_forward.h"
-#include "base/optional.h"
#include "chrome/updater/policy_manager.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -36,23 +36,23 @@
return; // We already have enough policies.
if (!effective_policy_ && is_managed) {
- effective_policy_ = base::make_optional<Entry>(source, policy);
+ effective_policy_ = absl::make_optional<Entry>(source, policy);
} else if (effective_policy_ &&
policy != effective_policy_.value().policy) {
- conflict_policy_ = base::make_optional<Entry>(source, policy);
+ conflict_policy_ = absl::make_optional<Entry>(source, policy);
}
}
- const base::Optional<Entry>& effective_policy() const {
+ const absl::optional<Entry>& effective_policy() const {
return effective_policy_;
}
- const base::Optional<Entry>& conflict_policy() const {
+ const absl::optional<Entry>& conflict_policy() const {
return conflict_policy_;
}
private:
- base::Optional<Entry> effective_policy_;
- base::Optional<Entry> conflict_policy_;
+ absl::optional<Entry> effective_policy_;
+ absl::optional<Entry> conflict_policy_;
};
// The PolicyService returns policies for enterprise managed machines from the
diff --git a/chrome/updater/prefs.cc b/chrome/updater/prefs.cc
index dfb8af44..b28ef68 100644
--- a/chrome/updater/prefs.cc
+++ b/chrome/updater/prefs.cc
@@ -10,7 +10,6 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "base/run_loop.h"
#include "chrome/updater/prefs_impl.h"
#include "chrome/updater/util.h"
@@ -19,6 +18,7 @@
#include "components/prefs/pref_service.h"
#include "components/prefs/pref_service_factory.h"
#include "components/update_client/update_client.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -72,7 +72,7 @@
if (!lock)
return nullptr;
- base::Optional<base::FilePath> global_prefs_dir = GetBaseDirectory();
+ absl::optional<base::FilePath> global_prefs_dir = GetBaseDirectory();
if (!global_prefs_dir)
return nullptr;
VLOG(1) << "global_prefs_dir: " << global_prefs_dir;
@@ -92,7 +92,7 @@
}
std::unique_ptr<LocalPrefs> CreateLocalPrefs() {
- base::Optional<base::FilePath> local_prefs_dir = GetVersionedDirectory();
+ absl::optional<base::FilePath> local_prefs_dir = GetVersionedDirectory();
if (!local_prefs_dir)
return nullptr;
diff --git a/chrome/updater/tag.cc b/chrome/updater/tag.cc
index 69c928b..5544791 100644
--- a/chrome/updater/tag.cc
+++ b/chrome/updater/tag.cc
@@ -9,13 +9,13 @@
#include "base/containers/contains.h"
#include "base/no_destructor.h"
-#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "chrome/updater/lib_util.h"
#include "chrome/updater/util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
namespace tagging {
@@ -85,7 +85,7 @@
// Character that is disallowed from appearing in the tag.
constexpr char kDisallowedCharInTag = '/';
-base::Optional<AppArgs::NeedsAdmin> ParseNeedsAdminEnum(base::StringPiece str) {
+absl::optional<AppArgs::NeedsAdmin> ParseNeedsAdminEnum(base::StringPiece str) {
if (base::EqualsCaseInsensitiveASCII("false", str))
return AppArgs::NeedsAdmin::kNo;
@@ -95,18 +95,18 @@
if (base::EqualsCaseInsensitiveASCII("prefers", str))
return AppArgs::NeedsAdmin::kPrefers;
- return base::nullopt;
+ return absl::nullopt;
}
-// Returns base::nullopt if parsing failed.
-base::Optional<bool> ParseBool(base::StringPiece str) {
+// Returns absl::nullopt if parsing failed.
+absl::optional<bool> ParseBool(base::StringPiece str) {
if (base::EqualsCaseInsensitiveASCII("false", str))
return false;
if (base::EqualsCaseInsensitiveASCII("true", str))
return true;
- return base::nullopt;
+ return absl::nullopt;
}
// A custom comparator functor class for the parse tables.
@@ -176,7 +176,7 @@
}
ErrorCode ParseFlighting(base::StringPiece value, TagArgs* args) {
- const base::Optional<bool> flighting = ParseBool(value);
+ const absl::optional<bool> flighting = ParseBool(value);
if (!flighting.has_value())
return ErrorCode::kGlobal_FlightingValueIsNotABoolean;
@@ -194,7 +194,7 @@
} else if (tristate == 1) {
args->usage_stats_enable = true;
} else if (tristate == 2) {
- args->usage_stats_enable = base::nullopt;
+ args->usage_stats_enable = absl::nullopt;
} else {
return ErrorCode::kGlobal_UsageStatsValueIsInvalid;
}
@@ -309,7 +309,7 @@
// index to |current_app_index|.
ErrorCode FindAppIdInTagArgs(base::StringPiece value,
TagArgs* args,
- base::Optional<size_t>* current_app_index) {
+ absl::optional<size_t>* current_app_index) {
if (!base::IsStringASCII(value))
return ErrorCode::kApp_AppIdIsNotValid;
@@ -328,7 +328,7 @@
ErrorCode ParseInstallerData(base::StringPiece value,
TagArgs* args,
- base::Optional<size_t>* current_app_index) {
+ absl::optional<size_t>* current_app_index) {
if (!current_app_index->has_value())
return ErrorCode::
kAppInstallerData_InstallerDataCannotBeSpecifiedBeforeAppId;
@@ -347,7 +347,7 @@
using ParseInstallerDataAttributeFunPtr =
ErrorCode (*)(base::StringPiece value,
TagArgs* args,
- base::Optional<size_t>* current_app_index);
+ absl::optional<size_t>* current_app_index);
using InstallerDataParseTable = std::map<base::StringPiece,
ParseInstallerDataAttributeFunPtr,
@@ -449,7 +449,7 @@
ErrorCode ParseAppInstallerDataArgs(base::StringPiece app_installer_data_args,
TagArgs* args) {
// The currently tracked app index to apply installer data to.
- base::Optional<size_t> current_app_index;
+ absl::optional<size_t> current_app_index;
// Installer data is assumed to be URL-encoded, so we don't unescape it.
bool unescape_value = false;
@@ -500,7 +500,7 @@
TagArgs& TagArgs::operator=(TagArgs&&) = default;
ErrorCode Parse(base::StringPiece tag,
- base::Optional<base::StringPiece> app_installer_data_args,
+ absl::optional<base::StringPiece> app_installer_data_args,
TagArgs* args) {
if (!IsValidArgs(tag))
return ErrorCode::kTagIsInvalid;
diff --git a/chrome/updater/tag.h b/chrome/updater/tag.h
index df33709..39d5b6f 100644
--- a/chrome/updater/tag.h
+++ b/chrome/updater/tag.h
@@ -9,8 +9,8 @@
#include <string>
#include <vector>
-#include "base/optional.h"
#include "base/strings/string_piece.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -52,7 +52,7 @@
std::string install_data_index;
std::string experiment_labels;
std::string untrusted_data;
- base::Optional<NeedsAdmin> needs_admin;
+ absl::optional<NeedsAdmin> needs_admin;
};
std::ostream& operator<<(std::ostream&, const AppArgs::NeedsAdmin&);
@@ -88,9 +88,9 @@
std::string experiment_labels;
std::string referral_id;
std::string language;
- base::Optional<BrowserType> browser_type;
- base::Optional<bool> flighting = false;
- base::Optional<bool> usage_stats_enable;
+ absl::optional<BrowserType> browser_type;
+ absl::optional<bool> flighting = false;
+ absl::optional<bool> usage_stats_enable;
// List of apps to install.
std::vector<AppArgs> apps;
@@ -219,7 +219,7 @@
//
// Note: This method assumes all attribute names are ASCII.
ErrorCode Parse(base::StringPiece tag,
- base::Optional<base::StringPiece> app_installer_data_args,
+ absl::optional<base::StringPiece> app_installer_data_args,
TagArgs* args);
} // namespace tagging
diff --git a/chrome/updater/tag_unittest.cc b/chrome/updater/tag_unittest.cc
index 76ae522..1d1010b 100644
--- a/chrome/updater/tag_unittest.cc
+++ b/chrome/updater/tag_unittest.cc
@@ -110,7 +110,7 @@
void VerifyTagParseSuccess(
base::StringPiece tag,
- base::Optional<base::StringPiece> app_installer_data_args,
+ absl::optional<base::StringPiece> app_installer_data_args,
const TagArgs& expected) {
TagArgs actual;
ASSERT_EQ(ErrorCode::kSuccess, Parse(tag, app_installer_data_args, &actual));
@@ -143,7 +143,7 @@
void VerifyTagParseFail(
base::StringPiece tag,
- base::Optional<base::StringPiece> app_installer_data_args,
+ absl::optional<base::StringPiece> app_installer_data_args,
ErrorCode expected) {
TagArgs args;
ASSERT_EQ(expected, Parse(tag, app_installer_data_args, &args));
@@ -162,28 +162,28 @@
VerifyTagParseFail(
"appguid=D0324988-DA8A-49e5-BCE5-925FCD04EAB7&"
"appname1=Hello",
- base::nullopt, ErrorCode::kUnrecognizedName);
+ absl::nullopt, ErrorCode::kUnrecognizedName);
}
TEST(TagParserTest, AppNameSpaceForValue) {
VerifyTagParseFail(
"appguid=D0324988-DA8A-49e5-BCE5-925FCD04EAB7&"
"appname= ",
- base::nullopt, ErrorCode::kAttributeMustHaveValue);
+ absl::nullopt, ErrorCode::kAttributeMustHaveValue);
}
TEST(TagParserTest, AppNameEncodedSpaceForValue) {
VerifyTagParseFail(
"appguid=D0324988-DA8A-49e5-BCE5-925FCD04EAB7&"
"appname=%20",
- base::nullopt, ErrorCode::kApp_AppNameCannotBeWhitespace);
+ absl::nullopt, ErrorCode::kApp_AppNameCannotBeWhitespace);
}
TEST(TagParserTest, AppNameValid) {
VerifyTagParseSuccess(
"appguid=D0324988-DA8A-49e5-BCE5-925FCD04EAB7&"
"appname=Test",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithBundleName("Test")
.WithApp(AppArgsBuilder("d0324988-da8a-49e5-bce5-925fcd04eab7")
@@ -197,7 +197,7 @@
VerifyTagParseSuccess(
"appguid=D0324988-DA8A-49e5-BCE5-925FCD04EAB7&"
"appname=Test App",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithBundleName("Test App")
.WithApp(AppArgsBuilder("d0324988-da8a-49e5-bce5-925fcd04eab7")
@@ -210,7 +210,7 @@
VerifyTagParseSuccess(
"appguid=D0324988-DA8A-49e5-BCE5-925FCD04EAB7&"
"appname= T Ap p ",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithBundleName("T Ap p")
.WithApp(AppArgsBuilder("d0324988-da8a-49e5-bce5-925fcd04eab7")
@@ -223,7 +223,7 @@
VerifyTagParseSuccess(
"appguid=D0324988-DA8A-49e5-BCE5-925FCD04EAB7&"
"appname=%20T%20Ap%20p%20",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithBundleName("T Ap p")
.WithApp(AppArgsBuilder("d0324988-da8a-49e5-bce5-925fcd04eab7")
@@ -236,7 +236,7 @@
VerifyTagParseSuccess(
"appguid=D0324988-DA8A-49e5-BCE5-925FCD04EAB7&"
"appname= T Ap p",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithBundleName("T Ap p")
.WithApp(AppArgsBuilder("d0324988-da8a-49e5-bce5-925fcd04eab7")
@@ -250,7 +250,7 @@
VerifyTagParseSuccess(
"appguid=D0324988-DA8A-49e5-BCE5-925FCD04EAB7&"
"appname=%E0%A4%B0%E0%A4%B9%E0%A4%BE",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithBundleName(non_ascii_name)
.WithApp(AppArgsBuilder("d0324988-da8a-49e5-bce5-925fcd04eab7")
@@ -270,7 +270,7 @@
tag << "appguid=D0324988-DA8A-49e5-BCE5-925FCD04EAB7&";
tag << "appname=" << escaped;
VerifyTagParseSuccess(
- tag.str(), base::nullopt,
+ tag.str(), absl::nullopt,
TagArgsBuilder()
.WithBundleName(non_ascii_name)
.WithApp(AppArgsBuilder("d0324988-da8a-49e5-bce5-925fcd04eab7")
@@ -281,7 +281,7 @@
TEST(TagParserTest, AppIdValid) {
VerifyTagParseSuccess(
- "appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B", base::nullopt,
+ "appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B", absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -289,7 +289,7 @@
}
TEST(TagParserTest, AppIdNotASCII) {
- VerifyTagParseFail("appguid=रहा", base::nullopt,
+ VerifyTagParseFail("appguid=रहा", absl::nullopt,
ErrorCode::kApp_AppIdIsNotValid);
}
@@ -297,13 +297,13 @@
// strings.
TEST(TagParserTest, AppIdNotAGuid) {
VerifyTagParseSuccess(
- "appguid=non-guid-id", base::nullopt,
+ "appguid=non-guid-id", absl::nullopt,
TagArgsBuilder().WithApp(AppArgsBuilder("non-guid-id").Build()).Build());
}
TEST(TagParserTest, AppIdCaseInsensitive) {
VerifyTagParseSuccess(
- "appguid=ShouldBeCaseInsensitive", base::nullopt,
+ "appguid=ShouldBeCaseInsensitive", absl::nullopt,
TagArgsBuilder()
.WithApp(AppArgsBuilder("shouldbecaseinsensitive").Build())
.Build());
@@ -313,21 +313,21 @@
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"needsadmin=Hello",
- base::nullopt, ErrorCode::kApp_NeedsAdminValueIsInvalid);
+ absl::nullopt, ErrorCode::kApp_NeedsAdminValueIsInvalid);
}
TEST(TagParserTest, NeedsAdminSpaceForValue) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"needsadmin= ",
- base::nullopt, ErrorCode::kAttributeMustHaveValue);
+ absl::nullopt, ErrorCode::kAttributeMustHaveValue);
}
TEST(TagParserTest, NeedsAdminTrueUpperCaseT) {
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"needsadmin=True",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b")
.WithNeedsAdmin(AppArgs::NeedsAdmin::kYes)
@@ -339,7 +339,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"needsadmin=true",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b")
.WithNeedsAdmin(AppArgs::NeedsAdmin::kYes)
@@ -351,7 +351,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"needsadmin=False",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b")
.WithNeedsAdmin(AppArgs::NeedsAdmin::kNo)
@@ -363,7 +363,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"needsadmin=false",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b")
.WithNeedsAdmin(AppArgs::NeedsAdmin::kNo)
@@ -376,42 +376,42 @@
//
TEST(TagParserTest, AssignmentOnly) {
- VerifyTagParseFail("=", base::nullopt, ErrorCode::kUnrecognizedName);
+ VerifyTagParseFail("=", absl::nullopt, ErrorCode::kUnrecognizedName);
}
TEST(TagParserTest, ExtraAssignment1) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1=",
- base::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
+ absl::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
}
TEST(TagParserTest, ExtraAssignment2) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"=usagestats=1",
- base::nullopt, ErrorCode::kUnrecognizedName);
+ absl::nullopt, ErrorCode::kUnrecognizedName);
}
TEST(TagParserTest, ExtraAssignment3) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1&=",
- base::nullopt, ErrorCode::kUnrecognizedName);
+ absl::nullopt, ErrorCode::kUnrecognizedName);
}
TEST(TagParserTest, ExtraAssignment4) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"=&usagestats=1",
- base::nullopt, ErrorCode::kUnrecognizedName);
+ absl::nullopt, ErrorCode::kUnrecognizedName);
}
TEST(TagParserTest, ValueWithoutName) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"=hello",
- base::nullopt, ErrorCode::kUnrecognizedName);
+ absl::nullopt, ErrorCode::kUnrecognizedName);
}
// Also tests ending extra arguments with '='.
@@ -419,28 +419,28 @@
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=",
- base::nullopt, ErrorCode::kAttributeMustHaveValue);
+ absl::nullopt, ErrorCode::kAttributeMustHaveValue);
}
TEST(TagParserTest, NameWithoutValueBeforeNextArgument) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=&client=hello",
- base::nullopt, ErrorCode::kAttributeMustHaveValue);
+ absl::nullopt, ErrorCode::kAttributeMustHaveValue);
}
TEST(TagParserTest, NameWithoutArgumentSeparatorAfterIntValue) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1client=hello",
- base::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
+ absl::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
}
TEST(TagParserTest, NameWithoutArgumentSeparatorAfterStringValue) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=yesclient=hello",
- base::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
+ absl::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
}
TEST(TagParserTest, TagHasDoubleAmpersand) {
@@ -459,14 +459,14 @@
}
TEST(TagParserTest, TagAmpersandOnly) {
- VerifyTagParseSuccess("&", base::nullopt, TagArgsBuilder().Build());
+ VerifyTagParseSuccess("&", absl::nullopt, TagArgsBuilder().Build());
}
TEST(TagParserTest, TagBeginsInAmpersand) {
VerifyTagParseSuccess(
"&appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -478,7 +478,7 @@
VerifyTagParseSuccess(
"&appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1&",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -488,7 +488,7 @@
TEST(TagParserTest, WhitespaceOnly) {
for (const auto* whitespace : {"", " ", "\t", "\r", "\n", "\r\n"}) {
- VerifyTagParseSuccess(whitespace, base::nullopt, TagArgsBuilder().Build());
+ VerifyTagParseSuccess(whitespace, absl::nullopt, TagArgsBuilder().Build());
}
}
@@ -500,7 +500,7 @@
VerifyTagParseSuccess(
"&appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -512,7 +512,7 @@
VerifyTagParseSuccess(
"&appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1&client=hello",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -525,49 +525,49 @@
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1/other_value=9",
- base::nullopt, ErrorCode::kTagIsInvalid);
+ absl::nullopt, ErrorCode::kTagIsInvalid);
}
TEST(TagParserTest, TagHasDoubleQuoteInTheMiddle) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1\"/other_value=9",
- base::nullopt, ErrorCode::kTagIsInvalid);
+ absl::nullopt, ErrorCode::kTagIsInvalid);
}
TEST(TagParserTest, TagHasDoubleQuoteInTheMiddleAndNoForwardSlash) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1\"other_value=9",
- base::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
+ absl::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
}
TEST(TagParserTest, TagHasSpaceAndForwardSlashBeforeQuote) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1 /other_value=9",
- base::nullopt, ErrorCode::kTagIsInvalid);
+ absl::nullopt, ErrorCode::kTagIsInvalid);
}
TEST(TagParserTest, TagHasForwardSlashBeforeQuote) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1/other_value=9",
- base::nullopt, ErrorCode::kTagIsInvalid);
+ absl::nullopt, ErrorCode::kTagIsInvalid);
}
TEST(TagParserTest, AttributeSpecifiedTwice) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1\" \"client=10",
- base::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
+ absl::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
}
TEST(TagParserTest, WhiteSpaceBeforeArgs1) {
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
" usagestats=1",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617EE50-F91C-4DC1-B937-0969EEF59B0B").Build())
@@ -579,7 +579,7 @@
VerifyTagParseSuccess(
"\tappguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617EE50-F91C-4DC1-B937-0969EEF59B0B").Build())
@@ -591,7 +591,7 @@
VerifyTagParseSuccess(
"\rappguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617EE50-F91C-4DC1-B937-0969EEF59B0B").Build())
@@ -603,7 +603,7 @@
VerifyTagParseSuccess(
"\nappguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B"
"&usagestats=1",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617EE50-F91C-4DC1-B937-0969EEF59B0B").Build())
@@ -612,31 +612,31 @@
}
TEST(TagParserTest, WhiteSpaceBeforeArgs5) {
- VerifyTagParseSuccess("\r\nusagestats=1", base::nullopt,
+ VerifyTagParseSuccess("\r\nusagestats=1", absl::nullopt,
TagArgsBuilder().WithUsageStatsEnable(true).Build());
}
TEST(TagParserTest, ForwardSlash1) {
- VerifyTagParseFail("/", base::nullopt, ErrorCode::kTagIsInvalid);
+ VerifyTagParseFail("/", absl::nullopt, ErrorCode::kTagIsInvalid);
}
TEST(TagParserTest, ForwardSlash2) {
VerifyTagParseFail("/ appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B",
- base::nullopt, ErrorCode::kTagIsInvalid);
+ absl::nullopt, ErrorCode::kTagIsInvalid);
}
TEST(TagParserTest, BackwardSlash1) {
- VerifyTagParseFail("\\", base::nullopt, ErrorCode::kUnrecognizedName);
+ VerifyTagParseFail("\\", absl::nullopt, ErrorCode::kUnrecognizedName);
}
TEST(TagParserTest, BackwardSlash2) {
VerifyTagParseFail("\\appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B",
- base::nullopt, ErrorCode::kUnrecognizedName);
+ absl::nullopt, ErrorCode::kUnrecognizedName);
}
TEST(TagParserTest, BackwardSlash3) {
VerifyTagParseFail("\\ appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B",
- base::nullopt, ErrorCode::kUnrecognizedName);
+ absl::nullopt, ErrorCode::kUnrecognizedName);
}
TEST(TagParserTest, AppArgsMustHaveValue) {
@@ -647,7 +647,7 @@
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&needsadmin",
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&installdataindex",
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&untrusteddata"}) {
- VerifyTagParseFail(tag, base::nullopt, ErrorCode::kAttributeMustHaveValue);
+ VerifyTagParseFail(tag, absl::nullopt, ErrorCode::kAttributeMustHaveValue);
}
}
@@ -659,14 +659,14 @@
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"/usagestats",
- base::nullopt, ErrorCode::kTagIsInvalid);
+ absl::nullopt, ErrorCode::kTagIsInvalid);
}
TEST(TagParserTest, UsageStatsOn) {
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=1",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -678,7 +678,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=0",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -690,7 +690,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=2",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -701,28 +701,28 @@
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=3",
- base::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
+ absl::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
}
TEST(TagParserTest, UsageStatsInvalidNegativeValue) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=-1",
- base::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
+ absl::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
}
TEST(TagParserTest, UsageStatsValueIsString) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"usagestats=true",
- base::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
+ absl::nullopt, ErrorCode::kGlobal_UsageStatsValueIsInvalid);
}
TEST(TagParserTest, BundleNameValid) {
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"bundlename=Google%20Bundle",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -735,21 +735,21 @@
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"bundlename= ",
- base::nullopt, ErrorCode::kAttributeMustHaveValue);
+ absl::nullopt, ErrorCode::kAttributeMustHaveValue);
}
TEST(TagParserTest, BundleNameEncodedSpaceForValue) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"bundlename=%20",
- base::nullopt, ErrorCode::kGlobal_BundleNameCannotBeWhitespace);
+ absl::nullopt, ErrorCode::kGlobal_BundleNameCannotBeWhitespace);
}
TEST(TagParserTest, BundleNameNotPresentButAppNameIs) {
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"appname=Google%20Chrome",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b")
.WithAppName("Google Chrome")
@@ -759,7 +759,7 @@
}
TEST(TagParserTest, BundleNameNorAppNamePresent) {
VerifyTagParseSuccess(
- "appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&", base::nullopt,
+ "appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&", absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -768,7 +768,7 @@
TEST(TagParserTest, BundleNameNotPresentAndNoApp) {
VerifyTagParseSuccess(
- "browser=0", base::nullopt,
+ "browser=0", absl::nullopt,
TagArgsBuilder().WithBrowserType(TagArgs::BrowserType::kUnknown).Build());
}
@@ -776,7 +776,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"iid=98CEC468-9429-4984-AEDE-4F53C6A14869",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -788,7 +788,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"iid=रहा",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -800,7 +800,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"brand=GOOG",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -812,7 +812,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"client=some_partner",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -824,7 +824,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"omahaexperiments=experiment%3DgroupA%7Cexpir",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -836,21 +836,21 @@
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"omahaexperiments= ",
- base::nullopt, ErrorCode::kAttributeMustHaveValue);
+ absl::nullopt, ErrorCode::kAttributeMustHaveValue);
}
TEST(TagParserTest, UpdaterExperimentIdEncodedSpaceForValue) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"omahaexperiments=%20",
- base::nullopt, ErrorCode::kGlobal_ExperimentLabelsCannotBeWhitespace);
+ absl::nullopt, ErrorCode::kGlobal_ExperimentLabelsCannotBeWhitespace);
}
TEST(TagParserTest, AppExperimentIdValid) {
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"experiments=experiment%3DgroupA%7Cexpir",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b")
.WithExperimentLabels("experiment=groupA|expir")
@@ -862,21 +862,21 @@
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"experiments= ",
- base::nullopt, ErrorCode::kAttributeMustHaveValue);
+ absl::nullopt, ErrorCode::kAttributeMustHaveValue);
}
TEST(TagParserTest, AppExperimentIdEncodedSpaceForValue) {
VerifyTagParseFail(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"experiments=%20",
- base::nullopt, ErrorCode::kApp_ExperimentLabelsCannotBeWhitespace);
+ absl::nullopt, ErrorCode::kApp_ExperimentLabelsCannotBeWhitespace);
}
TEST(TagParserTest, ReferralIdValid) {
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"referral=ABCD123",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -888,7 +888,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"ap=developer",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b")
.WithAp("developer")
@@ -928,14 +928,14 @@
"appname=TestApp2&"
"needsadmin=true&"
"installerdata=Hello%20World",
- base::nullopt, ErrorCode::kUnrecognizedName);
+ absl::nullopt, ErrorCode::kUnrecognizedName);
}
TEST(TagParserTest, InstallDataIndexValid) {
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"installdataindex=foobar",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b")
.WithInstallDataIndex("foobar")
@@ -958,7 +958,7 @@
tag << "appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&";
tag << "browser=" << std::get<0>(pair);
VerifyTagParseSuccess(
- tag.str(), base::nullopt,
+ tag.str(), absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -975,7 +975,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"browser=5",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -985,7 +985,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"browser=9",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -997,7 +997,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"lang=en",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -1010,7 +1010,7 @@
VerifyTagParseSuccess(
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"lang=foobar",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(
AppArgsBuilder("8617ee50-f91c-4dc1-b937-0969eef59b0b").Build())
@@ -1023,7 +1023,7 @@
"appguid=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"appname=TestApp&"
"appname=TestApp2&",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(AppArgsBuilder("8617EE50-F91C-4DC1-B937-0969EEF59B0B")
.WithAppName("TestApp2")
@@ -1036,7 +1036,7 @@
VerifyTagParseSuccess(
"APPguID=8617EE50-F91C-4DC1-B937-0969EEF59B0B&"
"APPNAME=TestApp&",
- base::nullopt,
+ absl::nullopt,
TagArgsBuilder()
.WithApp(AppArgsBuilder("8617EE50-F91C-4DC1-B937-0969EEF59B0B")
.WithAppName("TestApp")
@@ -1058,7 +1058,7 @@
"ap=test_ap&"
"usagestats=1&"
"browser=2&",
- base::nullopt, ErrorCode::kApp_AppIdNotSpecified);
+ absl::nullopt, ErrorCode::kApp_AppIdNotSpecified);
}
// This also tests that the last occurrence of a global extra arg is the one
diff --git a/chrome/updater/test/integration_test_commands_system.cc b/chrome/updater/test/integration_test_commands_system.cc
index 87d1e06..44f7e59 100644
--- a/chrome/updater/test/integration_test_commands_system.cc
+++ b/chrome/updater/test/integration_test_commands_system.cc
@@ -13,7 +13,6 @@
#include "base/files/file_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "build/build_config.h"
@@ -25,6 +24,7 @@
#include "chrome/updater/updater_scope.h"
#include "chrome/updater/util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#if defined(OS_WIN)
@@ -41,7 +41,7 @@
void PrintLog() const override { RunCommand("print_log"); }
void CopyLog() const override {
- const base::Optional<base::FilePath> path = GetDataDirPath(kUpdaterScope);
+ const absl::optional<base::FilePath> path = GetDataDirPath(kUpdaterScope);
ASSERT_TRUE(path);
if (path)
updater::test::CopyLog(*path);
diff --git a/chrome/updater/test/integration_test_commands_user.cc b/chrome/updater/test/integration_test_commands_user.cc
index e248c59..7822986f 100644
--- a/chrome/updater/test/integration_test_commands_user.cc
+++ b/chrome/updater/test/integration_test_commands_user.cc
@@ -10,13 +10,13 @@
#include "base/files/file_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/notreached.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/updater/test/integration_test_commands.h"
#include "chrome/updater/test/integration_tests_impl.h"
#include "chrome/updater/updater_scope.h"
#include "chrome/updater/util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace updater {
@@ -29,7 +29,7 @@
void PrintLog() const override { updater::test::PrintLog(kUpdaterScope); }
void CopyLog() const override {
- base::Optional<base::FilePath> path = GetDataDirPath(kUpdaterScope);
+ absl::optional<base::FilePath> path = GetDataDirPath(kUpdaterScope);
EXPECT_TRUE(path);
if (path)
updater::test::CopyLog(*path);
diff --git a/chrome/updater/test/integration_tests_impl.cc b/chrome/updater/test/integration_tests_impl.cc
index 9b3ebd1..baf93e8 100644
--- a/chrome/updater/test/integration_tests_impl.cc
+++ b/chrome/updater/test/integration_tests_impl.cc
@@ -16,7 +16,6 @@
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/numerics/checked_math.h"
-#include "base/optional.h"
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/run_loop.h"
@@ -36,6 +35,7 @@
#include "chrome/updater/updater_version.h"
#include "chrome/updater/util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
namespace test {
@@ -65,7 +65,7 @@
void PrintLog(UpdaterScope scope) {
std::string contents;
- base::Optional<base::FilePath> path = GetDataDirPath(scope);
+ absl::optional<base::FilePath> path = GetDataDirPath(scope);
EXPECT_TRUE(path);
if (path &&
base::ReadFileToString(path->AppendASCII("updater.log"), &contents)) {
@@ -106,7 +106,7 @@
}
void RunWake(UpdaterScope scope, int expected_exit_code) {
- const base::Optional<base::FilePath> installed_executable_path =
+ const absl::optional<base::FilePath> installed_executable_path =
GetInstalledExecutablePath(scope);
ASSERT_TRUE(installed_executable_path);
EXPECT_TRUE(base::PathExists(*installed_executable_path));
@@ -131,7 +131,7 @@
void SetupFakeUpdaterInstallFolder(UpdaterScope scope,
const base::Version& version) {
- const base::Optional<base::FilePath> folder_path =
+ const absl::optional<base::FilePath> folder_path =
GetFakeUpdaterInstallFolderPath(scope, version);
ASSERT_TRUE(folder_path);
ASSERT_TRUE(base::CreateDirectory(*folder_path));
diff --git a/chrome/updater/test/integration_tests_impl.h b/chrome/updater/test/integration_tests_impl.h
index 507bdbc57..3c8f8ff 100644
--- a/chrome/updater/test/integration_tests_impl.h
+++ b/chrome/updater/test/integration_tests_impl.h
@@ -10,9 +10,9 @@
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "build/build_config.h"
#include "chrome/updater/updater_scope.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class CommandLine;
@@ -50,7 +50,7 @@
void SleepFor(int seconds);
// Returns the path to the updater data dir.
-base::Optional<base::FilePath> GetDataDirPath(UpdaterScope scope);
+absl::optional<base::FilePath> GetDataDirPath(UpdaterScope scope);
// Expects that the updater is installed on the system.
void ExpectInstalled(UpdaterScope scope);
@@ -82,11 +82,11 @@
bool Run(UpdaterScope scope, base::CommandLine command_line, int* exit_code);
// Returns the path of the Updater executable.
-base::Optional<base::FilePath> GetInstalledExecutablePath(UpdaterScope scope);
+absl::optional<base::FilePath> GetInstalledExecutablePath(UpdaterScope scope);
// Returns the folder path under which the executable for the fake updater
// should reside.
-base::Optional<base::FilePath> GetFakeUpdaterInstallFolderPath(
+absl::optional<base::FilePath> GetFakeUpdaterInstallFolderPath(
UpdaterScope scope,
const base::Version& version);
diff --git a/chrome/updater/test/integration_tests_mac.mm b/chrome/updater/test/integration_tests_mac.mm
index ff45540..de2cdcf 100644
--- a/chrome/updater/test/integration_tests_mac.mm
+++ b/chrome/updater/test/integration_tests_mac.mm
@@ -11,7 +11,6 @@
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/mac/foundation_util.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/run_loop.h"
@@ -34,6 +33,7 @@
#include "chrome/updater/updater_scope.h"
#include "chrome/updater/util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace updater {
@@ -81,21 +81,21 @@
.Append(FILE_PATH_LITERAL(TEST_APP_FULLNAME_STRING));
}
-base::Optional<base::FilePath> GetProductPath(UpdaterScope scope) {
- base::Optional<base::FilePath> path = GetLibraryFolderPath(scope);
+absl::optional<base::FilePath> GetProductPath(UpdaterScope scope) {
+ absl::optional<base::FilePath> path = GetLibraryFolderPath(scope);
if (!path)
- return base::nullopt;
+ return absl::nullopt;
return path->AppendASCII(COMPANY_SHORTNAME_STRING)
.AppendASCII(PRODUCT_FULLNAME_STRING);
}
-base::Optional<base::FilePath> GetActiveFile(UpdaterScope scope,
+absl::optional<base::FilePath> GetActiveFile(UpdaterScope scope,
const std::string& id) {
- const base::Optional<base::FilePath> path =
+ const absl::optional<base::FilePath> path =
GetLibraryFolderPath(UpdaterScope::kUser);
if (!path)
- return base::nullopt;
+ return absl::nullopt;
return path->AppendASCII(COMPANY_SHORTNAME_STRING)
.AppendASCII(COMPANY_SHORTNAME_STRING "SoftwareUpdate")
@@ -128,12 +128,12 @@
.Overwrite());
}
-base::Optional<base::FilePath> GetDataDirPath(UpdaterScope scope) {
- base::Optional<base::FilePath> app_path =
+absl::optional<base::FilePath> GetDataDirPath(UpdaterScope scope) {
+ absl::optional<base::FilePath> app_path =
GetApplicationSupportDirectory(scope);
if (!app_path) {
VLOG(1) << "Failed to get Application support path.";
- return base::nullopt;
+ return absl::nullopt;
}
return app_path->AppendASCII(COMPANY_SHORTNAME_STRING)
@@ -144,7 +144,7 @@
Launchd::Domain launchd_domain = LaunchdDomain(scope);
Launchd::Type launchd_type = LaunchdType(scope);
- base::Optional<base::FilePath> path = GetProductPath(scope);
+ absl::optional<base::FilePath> path = GetProductPath(scope);
EXPECT_TRUE(path);
if (path)
EXPECT_TRUE(base::DeletePathRecursively(*path));
@@ -176,7 +176,7 @@
Launchd::Type launchd_type = LaunchdType(scope);
// Files must not exist on the file system.
- base::Optional<base::FilePath> path = GetProductPath(scope);
+ absl::optional<base::FilePath> path = GetProductPath(scope);
EXPECT_TRUE(path);
if (path)
EXPECT_FALSE(base::PathExists(*path));
@@ -202,7 +202,7 @@
Launchd::Type launchd_type = LaunchdType(scope);
// Files must exist on the file system.
- base::Optional<base::FilePath> path = GetProductPath(scope);
+ absl::optional<base::FilePath> path = GetProductPath(scope);
EXPECT_TRUE(path);
if (path)
EXPECT_TRUE(base::PathExists(*path));
@@ -228,7 +228,7 @@
Launchd::Type launchd_type = LaunchdType(scope);
// Files must exist on the file system.
- base::Optional<base::FilePath> path = GetProductPath(scope);
+ absl::optional<base::FilePath> path = GetProductPath(scope);
EXPECT_TRUE(path);
if (path)
EXPECT_TRUE(base::PathExists(*path));
@@ -247,7 +247,7 @@
EXPECT_EQ(exit_code, 0);
}
-base::Optional<base::FilePath> GetInstalledExecutablePath(UpdaterScope scope) {
+absl::optional<base::FilePath> GetInstalledExecutablePath(UpdaterScope scope) {
return GetUpdaterExecutablePath(scope);
}
@@ -255,7 +255,7 @@
Launchd::Domain launchd_domain = LaunchdDomain(scope);
Launchd::Type launchd_type = LaunchdType(scope);
- base::Optional<base::FilePath> versioned_folder_path =
+ absl::optional<base::FilePath> versioned_folder_path =
GetVersionedUpdaterFolderPath(scope);
EXPECT_TRUE(versioned_folder_path);
if (versioned_folder_path)
@@ -268,7 +268,7 @@
}
void Uninstall(UpdaterScope scope) {
- base::Optional<base::FilePath> path = GetExecutablePath();
+ absl::optional<base::FilePath> path = GetExecutablePath();
ASSERT_TRUE(path);
base::CommandLine command_line(*path);
command_line.AppendSwitch(kUninstallSwitch);
@@ -277,14 +277,14 @@
EXPECT_EQ(exit_code, 0);
}
-base::Optional<base::FilePath> GetFakeUpdaterInstallFolderPath(
+absl::optional<base::FilePath> GetFakeUpdaterInstallFolderPath(
UpdaterScope scope,
const base::Version& version) {
return GetExecutableFolderPathForVersion(scope, version);
}
void SetActive(UpdaterScope scope, const std::string& app_id) {
- const base::Optional<base::FilePath> path = GetActiveFile(scope, app_id);
+ const absl::optional<base::FilePath> path = GetActiveFile(scope, app_id);
ASSERT_TRUE(path);
VLOG(0) << "Actives file: " << *path;
base::File::Error err = base::File::FILE_OK;
@@ -294,14 +294,14 @@
}
void ExpectActive(UpdaterScope scope, const std::string& app_id) {
- const base::Optional<base::FilePath> path = GetActiveFile(scope, app_id);
+ const absl::optional<base::FilePath> path = GetActiveFile(scope, app_id);
ASSERT_TRUE(path);
EXPECT_TRUE(base::PathExists(*path));
EXPECT_TRUE(base::PathIsWritable(*path));
}
void ExpectNotActive(UpdaterScope scope, const std::string& app_id) {
- const base::Optional<base::FilePath> path = GetActiveFile(scope, app_id);
+ const absl::optional<base::FilePath> path = GetActiveFile(scope, app_id);
ASSERT_TRUE(path);
EXPECT_FALSE(base::PathExists(*path));
EXPECT_FALSE(base::PathIsWritable(*path));
diff --git a/chrome/updater/test/integration_tests_win.cc b/chrome/updater/test/integration_tests_win.cc
index 59d0186..0dd0733 100644
--- a/chrome/updater/test/integration_tests_win.cc
+++ b/chrome/updater/test/integration_tests_win.cc
@@ -10,7 +10,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
@@ -35,6 +34,7 @@
#include "chrome/updater/win/constants.h"
#include "chrome/updater/win/setup/setup_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace updater {
@@ -57,10 +57,10 @@
return test_executable.DirName().AppendASCII(TEST_APP_FULLNAME_STRING ".exe");
}
-base::Optional<base::FilePath> GetProductPath() {
+absl::optional<base::FilePath> GetProductPath() {
base::FilePath app_data_dir;
if (!base::PathService::Get(base::DIR_LOCAL_APP_DATA, &app_data_dir))
- return base::nullopt;
+ return absl::nullopt;
return app_data_dir.AppendASCII(COMPANY_SHORTNAME_STRING)
.AppendASCII(PRODUCT_FULLNAME_STRING)
.AppendASCII(kUpdaterVersion);
@@ -83,26 +83,26 @@
} // namespace
-base::Optional<base::FilePath> GetInstalledExecutablePath(UpdaterScope scope) {
- base::Optional<base::FilePath> path = GetProductPath();
+absl::optional<base::FilePath> GetInstalledExecutablePath(UpdaterScope scope) {
+ absl::optional<base::FilePath> path = GetProductPath();
if (!path)
- return base::nullopt;
+ return absl::nullopt;
return path->AppendASCII("updater.exe");
}
-base::Optional<base::FilePath> GetFakeUpdaterInstallFolderPath(
+absl::optional<base::FilePath> GetFakeUpdaterInstallFolderPath(
UpdaterScope scope,
const base::Version& version) {
- base::Optional<base::FilePath> path = GetProductPath();
+ absl::optional<base::FilePath> path = GetProductPath();
if (!path)
- return base::nullopt;
+ return absl::nullopt;
return path->AppendASCII(version.GetString());
}
-base::Optional<base::FilePath> GetDataDirPath(UpdaterScope scope) {
+absl::optional<base::FilePath> GetDataDirPath(UpdaterScope scope) {
base::FilePath app_data_dir;
if (!base::PathService::Get(base::DIR_LOCAL_APP_DATA, &app_data_dir))
- return base::nullopt;
+ return absl::nullopt;
return app_data_dir.AppendASCII(COMPANY_SHORTNAME_STRING)
.AppendASCII(PRODUCT_FULLNAME_STRING);
}
@@ -133,7 +133,7 @@
}
// TODO(crbug.com/1062288): Delete the COM service items.
// TODO(crbug.com/1062288): Delete the Wake task.
- base::Optional<base::FilePath> path = GetProductPath();
+ absl::optional<base::FilePath> path = GetProductPath();
EXPECT_TRUE(path);
if (path)
EXPECT_TRUE(base::DeletePathRecursively(*path));
@@ -171,7 +171,7 @@
// TODO(crbug.com/1062288): Assert there are no Wake tasks.
// Files must not exist on the file system.
- base::Optional<base::FilePath> path = GetProductPath();
+ absl::optional<base::FilePath> path = GetProductPath();
EXPECT_TRUE(path);
if (path)
EXPECT_FALSE(base::PathExists(*path));
@@ -198,7 +198,7 @@
// TODO(crbug.com/1062288): Assert there are Wake tasks.
// Files must exist on the file system.
- base::Optional<base::FilePath> path = GetProductPath();
+ absl::optional<base::FilePath> path = GetProductPath();
EXPECT_TRUE(path);
if (path)
EXPECT_TRUE(base::PathExists(*path));
@@ -209,7 +209,7 @@
// TODO(crbug.com/1062288): Assert there are no Wake tasks.
// Files must not exist on the file system.
- base::Optional<base::FilePath> path = GetProductPath();
+ absl::optional<base::FilePath> path = GetProductPath();
EXPECT_TRUE(path);
if (path)
EXPECT_FALSE(base::PathExists(*path));
@@ -219,7 +219,7 @@
// TODO(crbug.com/1062288): Assert that COM interfaces point to this version.
// Files must exist on the file system.
- base::Optional<base::FilePath> path = GetProductPath();
+ absl::optional<base::FilePath> path = GetProductPath();
EXPECT_TRUE(path);
if (path)
EXPECT_TRUE(base::PathExists(*path));
diff --git a/chrome/updater/tools/certificate_tag.cc b/chrome/updater/tools/certificate_tag.cc
index f4fc6ef..425c731 100644
--- a/chrome/updater/tools/certificate_tag.cc
+++ b/chrome/updater/tools/certificate_tag.cc
@@ -42,7 +42,7 @@
static constexpr uint16_t kAttributeCertificateTypePKCS7SignedData = 2;
// static
-base::Optional<Binary> Binary::Parse(base::span<const uint8_t> binary) {
+absl::optional<Binary> Binary::Parse(base::span<const uint8_t> binary) {
// Parse establishes some offsets into |binary| for structures that |GetTag|
// and |SetTag| will both need.
@@ -84,7 +84,7 @@
!CBS_get_bytes(&bin_for_header, &optional_header,
size_of_optional_header) ||
!CBS_get_u16le(&optional_header, &optional_header_magic)) {
- return base::nullopt;
+ return absl::nullopt;
}
size_t address_size = 0, extra_header_bytes = 0;
@@ -98,7 +98,7 @@
extra_header_bytes = 4;
break;
default:
- return base::nullopt;
+ return absl::nullopt;
}
// Skip the Windows-specific header section up until the number of data
@@ -120,14 +120,14 @@
!CBS_get_u32le(&optional_header, &cert_entry_size) ||
size_t{cert_entry_virtual_addr} + cert_entry_size < cert_entry_size ||
size_t{cert_entry_virtual_addr} + cert_entry_size != CBS_len(&bin)) {
- return base::nullopt;
+ return absl::nullopt;
}
CBS bin_for_certs = bin;
CBS certs;
if (!CBS_skip(&bin_for_certs, cert_entry_virtual_addr) ||
!CBS_get_bytes(&bin_for_certs, &certs, cert_entry_size)) {
- return base::nullopt;
+ return absl::nullopt;
}
// See the WIN_CERTIFICATE structure from
@@ -142,7 +142,7 @@
!CBS_get_u16le(&certs, &certs_type) ||
certs_type != kAttributeCertificateTypePKCS7SignedData ||
!CBS_get_asn1_element(&certs, &signed_data, CBS_ASN1_SEQUENCE)) {
- return base::nullopt;
+ return absl::nullopt;
}
Binary ret;
@@ -158,7 +158,7 @@
!CBS_get_u32le(&bin_for_check, &cert_entry_size_duplicate) ||
cert_entry_size_duplicate != cert_entry_size) {
NOTREACHED();
- return base::nullopt;
+ return absl::nullopt;
}
ret.binary_ = binary;
@@ -166,12 +166,12 @@
ret.attr_cert_offset_ = cert_entry_virtual_addr;
if (!ret.ParseTag())
- return base::nullopt;
+ return absl::nullopt;
return ret;
}
-const base::Optional<base::span<const uint8_t>>& Binary::tag() const {
+const absl::optional<base::span<const uint8_t>>& Binary::tag() const {
return tag_;
}
@@ -204,7 +204,7 @@
CBB_add_bytes(out, CBS_data(&element), CBS_len(&element)) == 1;
}
-base::Optional<std::vector<uint8_t>> Binary::SetTag(
+absl::optional<std::vector<uint8_t>> Binary::SetTag(
base::span<const uint8_t> tag) const {
bssl::ScopedCBB cbb;
if (!CBB_init(cbb.get(), binary_.size() + 1024) ||
@@ -216,7 +216,7 @@
!CBB_add_u32(cbb.get(), 0 /* Length. Filled in later. */) ||
!CBB_add_u16le(cbb.get(), kAttributeCertificateRevision) ||
!CBB_add_u16le(cbb.get(), kAttributeCertificateTypePKCS7SignedData)) {
- return base::nullopt;
+ return absl::nullopt;
}
// Walk the PKCS SignedData structure from the input and copy elements to the
@@ -246,7 +246,7 @@
0 | CBS_ASN1_CONSTRUCTED | CBS_ASN1_CONTEXT_SPECIFIC) ||
!CBB_add_asn1(&pkcs7_cbb, &certs_cbb,
0 | CBS_ASN1_CONSTRUCTED | CBS_ASN1_CONTEXT_SPECIFIC)) {
- return base::nullopt;
+ return absl::nullopt;
}
// Copy the certificates from the input to the output, potentially omitting
@@ -258,7 +258,7 @@
if ((have_last_cert && !CBB_add_bytes(&certs_cbb, CBS_data(&last_cert),
CBS_len(&last_cert))) ||
!CBS_get_asn1_element(&certs, &last_cert, CBS_ASN1_SEQUENCE)) {
- return base::nullopt;
+ return absl::nullopt;
}
have_last_cert = true;
}
@@ -268,7 +268,7 @@
// it.
if (!tag_.has_value() &&
!CBB_add_bytes(&certs_cbb, CBS_data(&last_cert), CBS_len(&last_cert))) {
- return base::nullopt;
+ return absl::nullopt;
}
// These values are DER-encoded OIDs needed in the X.509 certificate that's
@@ -359,7 +359,7 @@
// Copy signerInfos from the input PKCS#7 structure.
!CopyASN1(&pkcs7_cbb, &pkcs7) || CBS_len(&pkcs7) != 0 ||
!CBB_finish(cbb.get(), &cbb_data, &cbb_len)) {
- return base::nullopt;
+ return absl::nullopt;
}
// Copy the CBB result into a std::vector.
diff --git a/chrome/updater/tools/certificate_tag.h b/chrome/updater/tools/certificate_tag.h
index cee607e..4fccd24 100644
--- a/chrome/updater/tools/certificate_tag.h
+++ b/chrome/updater/tools/certificate_tag.h
@@ -9,7 +9,7 @@
#include <vector>
#include "base/containers/span.h"
-#include "base/optional.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
namespace tools {
@@ -24,15 +24,15 @@
// Parse a signed, Windows PE binary. Note that the returned structure
// contains pointers into the given data.
- static base::Optional<Binary> Parse(base::span<const uint8_t> binary);
+ static absl::optional<Binary> Parse(base::span<const uint8_t> binary);
// tag returns the embedded tag, if any.
- const base::Optional<base::span<const uint8_t>>& tag() const;
+ const absl::optional<base::span<const uint8_t>>& tag() const;
// SetTag returns an updated version of the binary that contains the given
// tag, or |nullopt| on error. If the binary already contains a tag then it
// will be replaced.
- base::Optional<std::vector<uint8_t>> SetTag(
+ absl::optional<std::vector<uint8_t>> SetTag(
base::span<const uint8_t> tag) const;
private:
@@ -49,7 +49,7 @@
base::span<const uint8_t> content_info_;
// tag_ contains the embedded tag, or |nullopt| if there isn't one.
- base::Optional<base::span<const uint8_t>> tag_;
+ absl::optional<base::span<const uint8_t>> tag_;
// attr_cert_offset_ is the offset in the file where the |WIN_CERTIFICATE|
// structure appears. (This is the last structure in the file.)
diff --git a/chrome/updater/tools/certificate_tag_unittest.cc b/chrome/updater/tools/certificate_tag_unittest.cc
index ab5a0511..56e0407 100644
--- a/chrome/updater/tools/certificate_tag_unittest.cc
+++ b/chrome/updater/tools/certificate_tag_unittest.cc
@@ -28,32 +28,32 @@
const base::span<const uint8_t> exe_span(
reinterpret_cast<const uint8_t*>(exe.data()), exe.size());
- base::Optional<Binary> bin(Binary::Parse(exe_span));
+ absl::optional<Binary> bin(Binary::Parse(exe_span));
ASSERT_TRUE(bin);
// Binary should be untagged on disk.
- base::Optional<base::span<const uint8_t>> orig_tag(bin->tag());
+ absl::optional<base::span<const uint8_t>> orig_tag(bin->tag());
EXPECT_FALSE(orig_tag);
static const uint8_t kTag[] = {1, 2, 3, 4, 5};
- base::Optional<std::vector<uint8_t>> updated_exe(bin->SetTag(kTag));
+ absl::optional<std::vector<uint8_t>> updated_exe(bin->SetTag(kTag));
ASSERT_TRUE(updated_exe);
- base::Optional<Binary> bin2(Binary::Parse(*updated_exe));
+ absl::optional<Binary> bin2(Binary::Parse(*updated_exe));
ASSERT_TRUE(bin2);
- base::Optional<base::span<const uint8_t>> parsed_tag(bin2->tag());
+ absl::optional<base::span<const uint8_t>> parsed_tag(bin2->tag());
ASSERT_TRUE(parsed_tag);
EXPECT_TRUE(parsed_tag->size() == sizeof(kTag) &&
memcmp(kTag, parsed_tag->data(), sizeof(kTag)) == 0);
// Update an existing tag.
static const uint8_t kTag2[] = {1, 2, 3, 4, 6};
- base::Optional<std::vector<uint8_t>> updated_again_exe(bin2->SetTag(kTag2));
+ absl::optional<std::vector<uint8_t>> updated_again_exe(bin2->SetTag(kTag2));
ASSERT_TRUE(updated_again_exe);
- base::Optional<Binary> bin3(Binary::Parse(*updated_again_exe));
+ absl::optional<Binary> bin3(Binary::Parse(*updated_again_exe));
ASSERT_TRUE(bin3);
- base::Optional<base::span<const uint8_t>> parsed_tag2(bin3->tag());
+ absl::optional<base::span<const uint8_t>> parsed_tag2(bin3->tag());
ASSERT_TRUE(parsed_tag2);
EXPECT_TRUE(parsed_tag2->size() == sizeof(kTag2) &&
memcmp(kTag2, parsed_tag2->data(), sizeof(kTag2)) == 0);
diff --git a/chrome/updater/tools/main.cc b/chrome/updater/tools/main.cc
index 7b40843..27540a3 100644
--- a/chrome/updater/tools/main.cc
+++ b/chrome/updater/tools/main.cc
@@ -128,14 +128,14 @@
HandleError(logging::GetLastSystemErrorCode());
}
- base::Optional<tools::Binary> bin = tools::Binary::Parse(contents);
+ absl::optional<tools::Binary> bin = tools::Binary::Parse(contents);
if (!bin) {
std::cerr << "Failed to parse tag binary." << std::endl;
std::exit(1);
}
if (args.get_superfluous_cert_tag) {
- base::Optional<base::span<const uint8_t>> tag = bin->tag();
+ absl::optional<base::span<const uint8_t>> tag = bin->tag();
if (!tag) {
std::cerr << "No tag in binary." << std::endl;
std::exit(1);
diff --git a/chrome/updater/update_service_impl.cc b/chrome/updater/update_service_impl.cc
index 9543d9c..7bc3bd8db 100644
--- a/chrome/updater/update_service_impl.cc
+++ b/chrome/updater/update_service_impl.cc
@@ -136,10 +136,10 @@
config, callback);
}
-std::vector<base::Optional<update_client::CrxComponent>> GetComponents(
+std::vector<absl::optional<update_client::CrxComponent>> GetComponents(
scoped_refptr<PersistedData> persisted_data,
const std::vector<std::string>& ids) {
- std::vector<base::Optional<update_client::CrxComponent>> components;
+ std::vector<absl::optional<update_client::CrxComponent>> components;
for (const auto& id : ids) {
components.push_back(base::MakeRefCounted<Installer>(id, persisted_data)
->MakeCrxComponent());
diff --git a/chrome/updater/updater.cc b/chrome/updater/updater.cc
index 2fbc7df..6e06a69 100644
--- a/chrome/updater/updater.cc
+++ b/chrome/updater/updater.cc
@@ -9,7 +9,6 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/message_loop/message_pump_type.h"
-#include "base/optional.h"
#include "base/task/single_thread_task_executor.h"
#include "build/build_config.h"
#include "chrome/updater/app/app.h"
@@ -24,6 +23,7 @@
#include "chrome/updater/updater_version.h"
#include "chrome/updater/util.h"
#include "components/crash/core/common/crash_key.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if defined(OS_WIN)
#include "chrome/updater/app/server/win/server.h"
@@ -54,7 +54,7 @@
// The log file is created in DIR_LOCAL_APP_DATA or DIR_APP_DATA.
void InitLogging(const base::CommandLine& command_line) {
logging::LoggingSettings settings;
- base::Optional<base::FilePath> log_dir = GetBaseDirectory();
+ absl::optional<base::FilePath> log_dir = GetBaseDirectory();
if (!log_dir) {
LOG(ERROR) << "Error getting base dir.";
return;
diff --git a/chrome/updater/util.cc b/chrome/updater/util.cc
index e5c892d..192b59e 100644
--- a/chrome/updater/util.cc
+++ b/chrome/updater/util.cc
@@ -8,13 +8,13 @@
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "chrome/updater/updater_branding.h"
#include "chrome/updater/updater_scope.h"
#include "chrome/updater/updater_version.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#if defined(OS_MAC)
@@ -85,9 +85,9 @@
} // namespace
-base::Optional<base::FilePath> GetBaseDirectory() {
+absl::optional<base::FilePath> GetBaseDirectory() {
UpdaterScope scope = GetProcessScope();
- base::Optional<base::FilePath> app_data_dir;
+ absl::optional<base::FilePath> app_data_dir;
#if defined(OS_WIN)
base::FilePath path;
if (!base::PathService::Get(scope == UpdaterScope::kSystem
@@ -95,14 +95,14 @@
: base::DIR_LOCAL_APP_DATA,
&path)) {
LOG(ERROR) << "Can't retrieve app data directory.";
- return base::nullopt;
+ return absl::nullopt;
}
app_data_dir = path;
#elif defined(OS_MAC)
app_data_dir = GetApplicationSupportDirectory(scope);
if (!app_data_dir) {
LOG(ERROR) << "Can't retrieve app data directory.";
- return base::nullopt;
+ return absl::nullopt;
}
#endif
const auto product_data_dir =
@@ -110,22 +110,22 @@
.AppendASCII(PRODUCT_FULLNAME_STRING);
if (!base::CreateDirectory(product_data_dir)) {
LOG(ERROR) << "Can't create base directory: " << product_data_dir;
- return base::nullopt;
+ return absl::nullopt;
}
return product_data_dir;
}
-base::Optional<base::FilePath> GetVersionedDirectory() {
- base::Optional<base::FilePath> product_dir = GetBaseDirectory();
+absl::optional<base::FilePath> GetVersionedDirectory() {
+ absl::optional<base::FilePath> product_dir = GetBaseDirectory();
if (!product_dir) {
LOG(ERROR) << "Failed to get the base directory.";
- return base::nullopt;
+ return absl::nullopt;
}
const auto versioned_dir = product_dir->AppendASCII(kUpdaterVersion);
if (!base::CreateDirectory(versioned_dir)) {
LOG(ERROR) << "Can't create versioned directory.";
- return base::nullopt;
+ return absl::nullopt;
}
return versioned_dir;
@@ -141,7 +141,7 @@
// The log file is created in DIR_LOCAL_APP_DATA or DIR_APP_DATA.
void InitLogging(const base::FilePath::StringType& filename) {
logging::LoggingSettings settings;
- base::Optional<base::FilePath> log_dir = GetBaseDirectory();
+ absl::optional<base::FilePath> log_dir = GetBaseDirectory();
if (!log_dir) {
LOG(ERROR) << "Error getting base dir.";
return;
diff --git a/chrome/updater/util.h b/chrome/updater/util.h
index 2d0cc2f..0b22948 100644
--- a/chrome/updater/util.h
+++ b/chrome/updater/util.h
@@ -6,9 +6,9 @@
#define CHROME_UPDATER_UTIL_H_
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
@@ -18,11 +18,11 @@
class CommandLine;
template <class T>
-std::ostream& operator<<(std::ostream& os, const base::Optional<T>& opt) {
+std::ostream& operator<<(std::ostream& os, const absl::optional<T>& opt) {
if (opt.has_value()) {
return os << opt.value();
} else {
- return os << "base::nullopt";
+ return os << "absl::nullopt";
}
}
@@ -33,12 +33,12 @@
// Returns the base directory common to all versions of the updater. For
// instance, this function may return %localappdata%\Chromium\ChromiumUpdater
// for a User install.
-base::Optional<base::FilePath> GetBaseDirectory();
+absl::optional<base::FilePath> GetBaseDirectory();
// Returns a versioned directory under which the running version of the updater
// stores its files and data. For instance, this function may return
// %localappdata%\Chromium\ChromiumUpdater\1.2.3.4 for a User install.
-base::Optional<base::FilePath> GetVersionedDirectory();
+absl::optional<base::FilePath> GetVersionedDirectory();
// Returns true if the user running the updater also owns the |path|.
bool PathOwnedByUser(const base::FilePath& path);
diff --git a/chrome/updater/win/installer.cc b/chrome/updater/win/installer.cc
index 697afab3..600c175 100644
--- a/chrome/updater/win/installer.cc
+++ b/chrome/updater/win/installer.cc
@@ -14,7 +14,6 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/numerics/ranges.h"
-#include "base/optional.h"
#include "base/process/launch.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
@@ -24,39 +23,40 @@
#include "chrome/updater/enum_traits.h"
#include "chrome/updater/win/constants.h"
#include "chrome/updater/win/installer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
namespace {
// Opens the registry ClientState subkey for the `app_id`.
-base::Optional<base::win::RegKey> ClientStateAppKeyOpen(
+absl::optional<base::win::RegKey> ClientStateAppKeyOpen(
const std::string& app_id,
REGSAM regsam) {
std::wstring subkey;
if (!base::UTF8ToWide(app_id.c_str(), app_id.size(), &subkey))
- return base::nullopt;
+ return absl::nullopt;
regsam = regsam | KEY_WOW64_32KEY;
base::win::RegKey key(HKEY_CURRENT_USER,
base::ASCIIToWide(CLIENT_STATE_KEY).c_str(), regsam);
if (key.OpenKey(subkey.c_str(), regsam) != ERROR_SUCCESS)
- return base::nullopt;
+ return absl::nullopt;
return key;
}
// Creates or opens the registry ClientState subkey for the `app_id`. `regsam`
// must contain the KEY_WRITE access right for the creation of the subkey to
// succeed.
-base::Optional<base::win::RegKey> ClientStateAppKeyCreate(
+absl::optional<base::win::RegKey> ClientStateAppKeyCreate(
const std::string& app_id,
REGSAM regsam) {
std::wstring subkey;
if (!base::UTF8ToWide(app_id.c_str(), app_id.size(), &subkey))
- return base::nullopt;
+ return absl::nullopt;
regsam = regsam | KEY_WOW64_32KEY;
base::win::RegKey key(HKEY_CURRENT_USER,
base::ASCIIToWide(CLIENT_STATE_KEY).c_str(), regsam);
if (key.CreateKey(subkey.c_str(), regsam) != ERROR_SUCCESS)
- return base::nullopt;
+ return absl::nullopt;
return key;
}
@@ -79,7 +79,7 @@
// Reads the installer progress from the registry value at:
// {HKLM|HKCU}\Software\Google\Update\ClientState\<appid>\InstallerProgress.
int GetInstallerProgress(const std::string& app_id) {
- base::Optional<base::win::RegKey> key =
+ absl::optional<base::win::RegKey> key =
ClientStateAppKeyOpen(app_id, KEY_READ);
DWORD progress = 0;
if (!key || key->ReadValueDW(kRegValueInstallerProgress, &progress) !=
@@ -90,20 +90,20 @@
}
bool SetInstallerProgressForTesting(const std::string& app_id, int value) {
- base::Optional<base::win::RegKey> key =
+ absl::optional<base::win::RegKey> key =
ClientStateAppKeyCreate(app_id, KEY_WRITE);
return key && key->WriteValue(kRegValueInstallerProgress, DWORD{value}) ==
ERROR_SUCCESS;
}
bool DeleteInstallerProgress(const std::string& app_id) {
- base::Optional<base::win::RegKey> key =
+ absl::optional<base::win::RegKey> key =
ClientStateAppKeyOpen(app_id, KEY_SET_VALUE);
return key && key->DeleteValue(kRegValueInstallerProgress) == ERROR_SUCCESS;
}
bool DeleteInstallerOutput(const std::string& app_id) {
- base::Optional<base::win::RegKey> key =
+ absl::optional<base::win::RegKey> key =
ClientStateAppKeyOpen(app_id, KEY_SET_VALUE | KEY_QUERY_VALUE);
if (!key)
return false;
@@ -123,12 +123,12 @@
[](auto result) { return result; });
}
-base::Optional<InstallerOutcome> GetInstallerOutcome(
+absl::optional<InstallerOutcome> GetInstallerOutcome(
const std::string& app_id) {
- base::Optional<base::win::RegKey> key =
+ absl::optional<base::win::RegKey> key =
ClientStateAppKeyOpen(app_id, KEY_READ);
if (!key)
- return base::nullopt;
+ return absl::nullopt;
InstallerOutcome installer_outcome;
{
DWORD val = 0;
@@ -166,7 +166,7 @@
bool SetInstallerOutcomeForTesting(const std::string& app_id,
const InstallerOutcome& installer_outcome) {
- base::Optional<base::win::RegKey> key =
+ absl::optional<base::win::RegKey> key =
ClientStateAppKeyCreate(app_id, KEY_WRITE);
if (!key)
return false;
@@ -230,7 +230,7 @@
// TODO(crbug.com/1172866): remove the hardcoded assumption that error must
// be zero to indicate success.
Installer::Result MakeInstallerResult(
- base::Optional<InstallerOutcome> installer_outcome,
+ absl::optional<InstallerOutcome> installer_outcome,
int exit_code) {
if (installer_outcome && installer_outcome->installer_result) {
Installer::Result result;
diff --git a/chrome/updater/win/installer.h b/chrome/updater/win/installer.h
index e9c7e8e3..700318c 100644
--- a/chrome/updater/win/installer.h
+++ b/chrome/updater/win/installer.h
@@ -7,9 +7,9 @@
#include <string>
-#include "base/optional.h"
#include "chrome/updater/enum_traits.h"
#include "chrome/updater/installer.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
@@ -91,11 +91,11 @@
InstallerOutcome(const InstallerOutcome&);
~InstallerOutcome();
- base::Optional<InstallerResult> installer_result;
- base::Optional<int> installer_error;
- base::Optional<int> installer_extracode1;
- base::Optional<std::string> installer_text;
- base::Optional<std::string> installer_cmd_line;
+ absl::optional<InstallerResult> installer_result;
+ absl::optional<int> installer_error;
+ absl::optional<int> installer_extracode1;
+ absl::optional<std::string> installer_text;
+ absl::optional<std::string> installer_cmd_line;
};
// Deletes the `app_id` registry sub key under the `ClientState`.
@@ -111,7 +111,7 @@
bool DeleteInstallerOutput(const std::string& app_id);
// Returns the Instaler API outcome, best-effort.
-base::Optional<InstallerOutcome> GetInstallerOutcome(const std::string& app_id);
+absl::optional<InstallerOutcome> GetInstallerOutcome(const std::string& app_id);
bool SetInstallerOutcomeForTesting(const std::string& app_id,
const InstallerOutcome& installer_outcome);
@@ -119,7 +119,7 @@
// `exit_code` is the exit code of the installer process, which may be used
// in some cases, depending on the installer outcome.
Installer::Result MakeInstallerResult(
- base::Optional<InstallerOutcome> installer_outcome,
+ absl::optional<InstallerOutcome> installer_outcome,
int exit_code);
// Returns the textual description of a system `error` as provided
diff --git a/chrome/updater/win/installer_unittest.cc b/chrome/updater/win/installer_unittest.cc
index 5d7930e1..871abac 100644
--- a/chrome/updater/win/installer_unittest.cc
+++ b/chrome/updater/win/installer_unittest.cc
@@ -45,7 +45,7 @@
EXPECT_TRUE(SetInstallerOutcomeForTesting(kAppId, installer_outcome));
}
- base::Optional<InstallerOutcome> installer_outcome =
+ absl::optional<InstallerOutcome> installer_outcome =
GetInstallerOutcome(kAppId);
ASSERT_TRUE(installer_outcome);
EXPECT_EQ(installer_outcome->installer_result, InstallerResult::kSystemError);
@@ -94,7 +94,7 @@
EXPECT_EQ(installer_result.extended_error, -2);
EXPECT_STREQ(installer_result.installer_text.c_str(), "some text");
EXPECT_TRUE(installer_result.installer_cmd_line.empty());
- installer_outcome.installer_error = base::nullopt;
+ installer_outcome.installer_error = absl::nullopt;
installer_result = MakeInstallerResult(installer_outcome, 10);
EXPECT_EQ(installer_result.error, 10);
EXPECT_EQ(installer_result.extended_error, -2);
@@ -114,7 +114,7 @@
EXPECT_EQ(installer_result.extended_error, -2);
EXPECT_FALSE(installer_result.installer_text.empty());
EXPECT_TRUE(installer_result.installer_cmd_line.empty());
- installer_outcome.installer_error = base::nullopt;
+ installer_outcome.installer_error = absl::nullopt;
installer_result = MakeInstallerResult(installer_outcome, 10);
EXPECT_EQ(installer_result.error, 10);
EXPECT_EQ(installer_result.extended_error, -2);
@@ -134,7 +134,7 @@
EXPECT_EQ(installer_result.extended_error, -2);
EXPECT_FALSE(installer_result.installer_text.empty());
EXPECT_TRUE(installer_result.installer_cmd_line.empty());
- installer_outcome.installer_error = base::nullopt;
+ installer_outcome.installer_error = absl::nullopt;
installer_result = MakeInstallerResult(installer_outcome, 10);
EXPECT_EQ(installer_result.error, 10);
EXPECT_EQ(installer_result.extended_error, -2);
diff --git a/chrome/updater/win/net/network_winhttp.cc b/chrome/updater/win/net/network_winhttp.cc
index 044248ec..466c561 100644
--- a/chrome/updater/win/net/network_winhttp.cc
+++ b/chrome/updater/win/net/network_winhttp.cc
@@ -187,7 +187,7 @@
if (!connect_handle_.get())
return HRESULTFromLastError();
- base::Optional<ScopedWinHttpProxyInfo> winhttp_proxy_info =
+ absl::optional<ScopedWinHttpProxyInfo> winhttp_proxy_info =
proxy_configuration_->GetProxyForUrl(session_handle_, url_);
request_handle_ = OpenRequest();
diff --git a/chrome/updater/win/net/proxy_configuration.cc b/chrome/updater/win/net/proxy_configuration.cc
index 6d512b5..8e9441b 100644
--- a/chrome/updater/win/net/proxy_configuration.cc
+++ b/chrome/updater/win/net/proxy_configuration.cc
@@ -87,13 +87,13 @@
: WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
}
-base::Optional<ScopedWinHttpProxyInfo> ProxyConfiguration::GetProxyForUrl(
+absl::optional<ScopedWinHttpProxyInfo> ProxyConfiguration::GetProxyForUrl(
HINTERNET session_handle,
const GURL& url) const {
return DoGetProxyForUrl(session_handle, url);
}
-base::Optional<ScopedWinHttpProxyInfo> ProxyConfiguration::DoGetProxyForUrl(
+absl::optional<ScopedWinHttpProxyInfo> ProxyConfiguration::DoGetProxyForUrl(
HINTERNET session_handle,
const GURL& url) const {
// Detect proxy settings using Web Proxy Auto Detection (WPAD).
@@ -150,7 +150,7 @@
void SetProxyForRequest(
const HINTERNET request_handle,
- const base::Optional<ScopedWinHttpProxyInfo>& winhttp_proxy_info) {
+ const absl::optional<ScopedWinHttpProxyInfo>& winhttp_proxy_info) {
// Set the proxy option on the request handle.
if (winhttp_proxy_info.has_value() && winhttp_proxy_info.value().IsValid()) {
const ScopedWinHttpProxyInfo& proxy_info = winhttp_proxy_info.value();
@@ -234,7 +234,7 @@
return WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY;
}
-base::Optional<ScopedWinHttpProxyInfo> AutoProxyConfiguration::DoGetProxyForUrl(
+absl::optional<ScopedWinHttpProxyInfo> AutoProxyConfiguration::DoGetProxyForUrl(
HINTERNET,
const GURL&) const {
// When using automatic proxy settings, Windows will resolve the proxy
diff --git a/chrome/updater/win/net/proxy_configuration.h b/chrome/updater/win/net/proxy_configuration.h
index 0adc8b12..70a6dc0 100644
--- a/chrome/updater/win/net/proxy_configuration.h
+++ b/chrome/updater/win/net/proxy_configuration.h
@@ -9,9 +9,9 @@
#include <winhttp.h>
#include "base/memory/ref_counted.h"
-#include "base/optional.h"
#include "chrome/updater/win/net/proxy_info.h"
#include "chrome/updater/win/net/scoped_winttp_proxy_info.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
@@ -37,7 +37,7 @@
ProxyConfiguration& operator=(const ProxyConfiguration&) = delete;
int access_type() const;
- base::Optional<ScopedWinHttpProxyInfo> GetProxyForUrl(
+ absl::optional<ScopedWinHttpProxyInfo> GetProxyForUrl(
HINTERNET session_handle,
const GURL& url) const;
@@ -48,7 +48,7 @@
friend class base::RefCounted<ProxyConfiguration>;
virtual int DoGetAccessType() const;
- virtual base::Optional<ScopedWinHttpProxyInfo> DoGetProxyForUrl(
+ virtual absl::optional<ScopedWinHttpProxyInfo> DoGetProxyForUrl(
HINTERNET session_handle,
const GURL& url) const;
@@ -64,7 +64,7 @@
private:
// Overrides for ProxyConfiguration.
int DoGetAccessType() const override;
- base::Optional<ScopedWinHttpProxyInfo> DoGetProxyForUrl(
+ absl::optional<ScopedWinHttpProxyInfo> DoGetProxyForUrl(
HINTERNET session_handle,
const GURL& url) const override;
};
@@ -72,7 +72,7 @@
// Sets proxy info on a request handle, if WINHTTP_PROXY_INFO is provided.
void SetProxyForRequest(
const HINTERNET request_handle,
- const base::Optional<ScopedWinHttpProxyInfo>& winhttp_proxy_info);
+ const absl::optional<ScopedWinHttpProxyInfo>& winhttp_proxy_info);
// Factory method for the proxy configuration strategy.
scoped_refptr<ProxyConfiguration> GetProxyConfiguration();
diff --git a/chrome/updater/win/net/proxy_configuration_unittest.cc b/chrome/updater/win/net/proxy_configuration_unittest.cc
index 61f35bf..69821bb 100644
--- a/chrome/updater/win/net/proxy_configuration_unittest.cc
+++ b/chrome/updater/win/net/proxy_configuration_unittest.cc
@@ -21,7 +21,7 @@
auto proxy_configuration = base::MakeRefCounted<AutoProxyConfiguration>();
EXPECT_EQ(proxy_configuration->access_type(),
WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY);
- base::Optional<ScopedWinHttpProxyInfo> winhttp_proxy_info =
+ absl::optional<ScopedWinHttpProxyInfo> winhttp_proxy_info =
proxy_configuration->GetProxyForUrl(nullptr, GURL("http://example.com"));
EXPECT_FALSE(winhttp_proxy_info.has_value());
}
@@ -38,7 +38,7 @@
base::MakeRefCounted<ProxyConfiguration>(ProxyInfo(true, L"", L"", L""));
EXPECT_EQ(proxy_configuration->access_type(),
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY);
- base::Optional<ScopedWinHttpProxyInfo> winhttp_proxy_info =
+ absl::optional<ScopedWinHttpProxyInfo> winhttp_proxy_info =
proxy_configuration->GetProxyForUrl(nullptr, GURL("http://example.com"));
EXPECT_FALSE(winhttp_proxy_info.has_value());
}
diff --git a/chrome/updater/win/setup/setup.cc b/chrome/updater/win/setup/setup.cc
index 3db7701..258dc211 100644
--- a/chrome/updater/win/setup/setup.cc
+++ b/chrome/updater/win/setup/setup.cc
@@ -17,7 +17,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/path_service.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
@@ -38,6 +37,7 @@
#include "chrome/updater/win/setup/setup_util.h"
#include "chrome/updater/win/task_scheduler.h"
#include "chrome/updater/win/util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
namespace {
@@ -122,7 +122,7 @@
LOG(ERROR) << "GetTempDir failed.";
return -1;
}
- base::Optional<base::FilePath> versioned_dir = GetVersionedDirectory();
+ absl::optional<base::FilePath> versioned_dir = GetVersionedDirectory();
if (!versioned_dir) {
LOG(ERROR) << "GetVersionedDirectory failed.";
return -1;
diff --git a/chrome/updater/win/setup/uninstall.cc b/chrome/updater/win/setup/uninstall.cc
index 522c0cf2..9e7811d 100644
--- a/chrome/updater/win/setup/uninstall.cc
+++ b/chrome/updater/win/setup/uninstall.cc
@@ -13,7 +13,6 @@
#include "base/callback_helpers.h"
#include "base/files/file_path.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/stl_util.h"
@@ -32,6 +31,7 @@
#include "chrome/updater/win/constants.h"
#include "chrome/updater/win/setup/setup_util.h"
#include "chrome/updater/win/task_scheduler.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
namespace {
@@ -77,7 +77,7 @@
}
int RunUninstallScript(bool uninstall_all) {
- base::Optional<base::FilePath> versioned_dir = GetVersionedDirectory();
+ absl::optional<base::FilePath> versioned_dir = GetVersionedDirectory();
if (!versioned_dir) {
LOG(ERROR) << "GetVersionedDirectory failed.";
return -1;
diff --git a/chrome/updater/win/update_service_proxy.cc b/chrome/updater/win/update_service_proxy.cc
index 1bae374..48e02d4 100644
--- a/chrome/updater/win/update_service_proxy.cc
+++ b/chrome/updater/win/update_service_proxy.cc
@@ -17,7 +17,6 @@
#include "base/callback.h"
#include "base/check_op.h"
#include "base/logging.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/task_traits.h"
@@ -30,6 +29,7 @@
#include "chrome/updater/registration_data.h"
#include "chrome/updater/updater_scope.h"
#include "chrome/updater/util.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
namespace {
@@ -267,7 +267,7 @@
HRESULT hr = update_state->get_state(&val_state);
if (SUCCEEDED(hr)) {
using State = UpdateService::UpdateState::State;
- base::Optional<State> state = CheckedCastToEnum<State>(val_state);
+ absl::optional<State> state = CheckedCastToEnum<State>(val_state);
if (state)
update_service_state.state = *state;
}
@@ -309,7 +309,7 @@
HRESULT hr = update_state->get_errorCategory(&val_error_category);
if (SUCCEEDED(hr)) {
using ErrorCategory = UpdateService::ErrorCategory;
- base::Optional<ErrorCategory> error_category =
+ absl::optional<ErrorCategory> error_category =
CheckedCastToEnum<ErrorCategory>(val_error_category);
if (error_category)
update_service_state.error_category = *error_category;
diff --git a/chrome/updater/win/util.h b/chrome/updater/win/util.h
index 6cba2bc..fa527ed 100644
--- a/chrome/updater/win/util.h
+++ b/chrome/updater/win/util.h
@@ -11,11 +11,11 @@
#include <string>
-#include "base/optional.h"
#include "base/win/atl.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_types.h"
#include "chrome/updater/updater_scope.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace updater {
diff --git a/chrome/utility/image_writer/image_writer_handler.cc b/chrome/utility/image_writer/image_writer_handler.cc
index 3437d91..1ba007ce 100644
--- a/chrome/utility/image_writer/image_writer_handler.cc
+++ b/chrome/utility/image_writer/image_writer_handler.cc
@@ -9,9 +9,9 @@
#include "base/bind.h"
#include "base/files/file_path.h"
-#include "base/optional.h"
#include "chrome/services/removable_storage_writer/public/mojom/removable_storage_writer.mojom.h"
#include "chrome/utility/image_writer/error_message_strings.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace {
@@ -106,7 +106,7 @@
}
void ImageWriterHandler::SendSucceeded() {
- client_->Complete(base::nullopt);
+ client_->Complete(absl::nullopt);
client_.reset();
}
diff --git a/chrome/utility/importer/nss_decryptor.cc b/chrome/utility/importer/nss_decryptor.cc
index a9d0f88f..143a0510 100644
--- a/chrome/utility/importer/nss_decryptor.cc
+++ b/chrome/utility/importer/nss_decryptor.cc
@@ -150,7 +150,7 @@
std::vector<importer::ImportedPasswordForm>* forms) {
std::string json_content;
base::ReadFileToString(json_file, &json_content);
- base::Optional<base::Value> parsed_json =
+ absl::optional<base::Value> parsed_json =
base::JSONReader::Read(json_content);
if (!parsed_json || !parsed_json->is_dict())
return false;