0

content: 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
Change-Id: Ie9f37bcbf6115632a19f4d063387d07b3723926f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897246
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#883270}
This commit is contained in:
Anton Bikineev
2021-05-15 17:56:07 +00:00
committed by Chromium LUCI CQ
parent ae8cac83b4
commit f62d1bf48e
971 changed files with 3979 additions and 3978 deletions
content
app
app_shim_remote_cocoa
browser
accessibility
android
appcache
audio
back_forward_cache_browsertest.cc
background_fetch
bluetooth
browser_child_process_host_impl.ccbrowser_context.ccbrowser_main_loop.hbrowser_thread_impl.h
browsing_data
cache_storage
child_process_launcher_helper.hchild_process_launcher_helper_android.ccchild_process_launcher_helper_linux.ccchild_process_launcher_helper_mac.ccchild_process_launcher_helper_win.ccchild_process_security_policy_impl.ccchild_process_security_policy_impl.h
client_hints
contacts
content_index
conversions
cookie_store
cross_origin_opener_policy_browsertest.ccdata_decoder_browsertest.cc
devtools
direct_sockets
display_cutout
dom_storage
download
file_system
file_system_access
font_access
gpu
handwriting
indexed_db
interest_group
isolated_origin_browsertest.ccisolation_context.h
keyboard_lock
launch_as_mojo_client_browsertest.cc
loader
manifest
media
active_media_session_controller.ccactive_media_session_controller.h
android
audio_input_stream_broker.ccaudio_input_stream_broker.haudio_input_stream_broker_unittest.ccaudio_loopback_stream_broker.ccaudio_loopback_stream_broker.haudio_loopback_stream_broker_unittest.ccaudio_stream_broker.h
capture
cdm_registry_impl.cccdm_registry_impl.hcdm_registry_impl_unittest.ccflinging_renderer.ccflinging_renderer.hforwarding_audio_stream_factory.hkey_system_support_impl.cckey_system_support_impl.hkey_system_support_impl_unittest.cckey_system_support_win.cckey_system_support_win.hmedia_internals.ccmedia_power_experiment_manager.ccmedia_power_experiment_manager.hmedia_web_contents_observer.ccmedia_web_contents_observer.h
session
system_media_controls_notifier.ccsystem_media_controls_notifier.hsystem_media_controls_notifier_unittest.cc
message_port_provider.ccmojo_sandbox_browsertest.ccnavigation_browsertest.cc
net
network_service_client.ccnetwork_service_client.h
notifications
payments
permissions
picture_in_picture
plugin_service_impl.ccplugin_service_impl.hplugin_service_impl_browsertest.cc
portal
ppapi_plugin_process_host.ccppapi_plugin_process_host.h
prerender
presentation
process_internals
push_messaging
renderer_host
agent_scheduling_group_host.ccagent_scheduling_group_host.hback_forward_cache_impl.hback_forward_cache_metrics.ccback_forward_cache_metrics.hblocked_scheme_navigation_browsertest.ccbrowser_compositor_view_mac.mmclipboard_host_impl.hcode_cache_host_impl.cccookie_browsertest.cccross_origin_opener_policy_status.cccross_origin_opener_policy_status.hcross_process_frame_connector.cccross_process_frame_connector.hdata_transfer_util.ccdisplay_feature.ccdisplay_feature.hdwrite_font_lookup_table_builder_win.hdwrite_font_lookup_table_builder_win_unittest.ccdwrite_font_proxy_impl_win_unittest.ccembedded_frame_sink_provider_impl_unittest.ccfile_utilities_host_impl.ccframe_navigation_entry.ccframe_navigation_entry.hframe_tree_node.h
input
ipc_utils.cc
media
navigation_controller_impl.ccnavigation_controller_impl.hnavigation_controller_impl_browsertest.ccnavigation_controller_impl_unittest.ccnavigation_entry_impl.ccnavigation_entry_impl.hnavigation_request.ccnavigation_request.hnavigation_request_info.ccnavigation_request_info.hnavigation_request_unittest.ccnavigation_throttle_runner_unittest.ccnavigator.ccnavigator.horigin_policy_throttle.ccorigin_policy_throttle.hoverscroll_controller.ccoverscroll_controller.hoverscroll_controller_delegate.h
pepper
policy_container_host.hrender_frame_host_android.ccrender_frame_host_delegate.ccrender_frame_host_delegate.hrender_frame_host_impl.ccrender_frame_host_impl.hrender_frame_host_impl_browsertest.ccrender_frame_host_manager.ccrender_frame_host_manager.hrender_frame_host_manager_browsertest.ccrender_frame_host_manager_unittest.ccrender_frame_metadata_provider_impl.hrender_frame_proxy_host.ccrender_frame_proxy_host.hrender_process_host_browsertest.ccrender_process_host_impl.ccrender_process_host_impl.hrender_view_host_impl.ccrender_view_host_impl.hrender_widget_host_delegate.hrender_widget_host_impl.ccrender_widget_host_impl.hrender_widget_host_input_event_router.ccrender_widget_host_input_event_router.hrender_widget_host_unittest.ccrender_widget_host_view_android.ccrender_widget_host_view_android.hrender_widget_host_view_android_unittest.ccrender_widget_host_view_aura.ccrender_widget_host_view_aura.hrender_widget_host_view_aura_unittest.ccrender_widget_host_view_base.ccrender_widget_host_view_base.hrender_widget_host_view_child_frame.ccrender_widget_host_view_child_frame.hrender_widget_host_view_child_frame_browsertest.ccrender_widget_host_view_event_handler.ccrender_widget_host_view_event_handler.hrender_widget_host_view_mac.hrender_widget_host_view_mac.mmrender_widget_host_view_mac_editcommand_helper_unittest.mmrender_widget_targeter.ccrender_widget_targeter.htext_input_client_mac_unittest.mmtext_input_manager.cctext_input_manager.h
sandbox_parameters_mac.mm
scheduler
screen_orientation
security_exploit_browsertest.ccservice_process_host_browsertest.ccservice_process_host_impl.cc
service_worker
embedded_worker_instance.ccembedded_worker_instance.hembedded_worker_instance_unittest.ccfake_service_worker.ccfake_service_worker.hservice_worker_browsertest.ccservice_worker_cache_writer.ccservice_worker_client_utils.ccservice_worker_clients_api_browsertest.ccservice_worker_container_host.ccservice_worker_container_host.hservice_worker_container_host_unittest.ccservice_worker_context_unittest.ccservice_worker_context_wrapper.ccservice_worker_context_wrapper.hservice_worker_controllee_request_handler.ccservice_worker_controllee_request_handler_unittest.ccservice_worker_fetch_dispatcher.ccservice_worker_fetch_dispatcher.hservice_worker_installed_script_loader.ccservice_worker_installed_script_loader.hservice_worker_installed_script_reader.ccservice_worker_installed_script_reader.hservice_worker_installed_scripts_sender.ccservice_worker_installed_scripts_sender.hservice_worker_installed_scripts_sender_unittest.ccservice_worker_job_unittest.ccservice_worker_main_resource_loader.ccservice_worker_main_resource_loader.hservice_worker_main_resource_loader_interceptor.ccservice_worker_main_resource_loader_interceptor.hservice_worker_main_resource_loader_unittest.ccservice_worker_new_script_loader.ccservice_worker_new_script_loader.hservice_worker_object_host.ccservice_worker_object_host_unittest.ccservice_worker_offline_capability_check_browsertest.ccservice_worker_process_manager.ccservice_worker_process_manager.hservice_worker_process_manager_unittest.ccservice_worker_registration_object_host.ccservice_worker_registration_unittest.ccservice_worker_registry.ccservice_worker_registry.hservice_worker_registry_unittest.ccservice_worker_single_script_update_checker_unittest.ccservice_worker_test_utils.ccservice_worker_test_utils.hservice_worker_updated_script_loader.ccservice_worker_updated_script_loader.hservice_worker_version.ccservice_worker_version.hservice_worker_version_browsertest.ccservice_worker_version_unittest.cc
site_instance_impl_unittest.ccsite_per_process_browsertest.ccsite_per_process_hit_test_browsertest.cc
sms
speech
ssl
storage_partition_impl.ccstorage_partition_impl.hstorage_partition_impl_map.ccstorage_partition_impl_unittest.cc
tracing
url_loader_factory_params_helper.ccutility_process_host.ccutility_process_host.h
web_contents
web_database
web_exposed_isolation_info.ccweb_exposed_isolation_info.h
web_package
link_web_bundle_browsertest.ccmock_web_bundle_reader_factory.ccprefetched_signed_exchange_cache.ccprefetched_signed_exchange_cache_adapter.hsave_page_as_web_bundle_browsertest.ccsigned_exchange_cert_fetcher.ccsigned_exchange_cert_fetcher.hsigned_exchange_cert_fetcher_factory.ccsigned_exchange_cert_fetcher_factory.hsigned_exchange_cert_fetcher_unittest.ccsigned_exchange_certificate_chain.ccsigned_exchange_certificate_chain.hsigned_exchange_certificate_chain_unittest.ccsigned_exchange_devtools_proxy.ccsigned_exchange_devtools_proxy.hsigned_exchange_envelope.ccsigned_exchange_envelope.hsigned_exchange_envelope_unittest.ccsigned_exchange_error.ccsigned_exchange_error.hsigned_exchange_handler.ccsigned_exchange_handler.hsigned_exchange_handler_unittest.ccsigned_exchange_loader.ccsigned_exchange_loader.hsigned_exchange_loader_unittest.ccsigned_exchange_prefetch_handler.ccsigned_exchange_prefetch_handler.hsigned_exchange_prologue.hsigned_exchange_request_handler.hsigned_exchange_request_handler_browsertest.ccsigned_exchange_signature_header_field.ccsigned_exchange_signature_header_field.hsigned_exchange_signature_verifier.ccsigned_exchange_signature_verifier.hsigned_exchange_subresource_prefetch_browsertest.ccsigned_exchange_utils.ccsigned_exchange_utils.hsigned_exchange_utils_unittest.ccsigned_exchange_validity_pinger.ccsigned_exchange_validity_pinger.hweb_bundle_blob_data_source.ccweb_bundle_blob_data_source_unittest.ccweb_bundle_browsertest.ccweb_bundle_reader.ccweb_bundle_reader.hweb_bundle_reader_unittest.ccweb_bundle_redirect_url_loader.ccweb_bundle_redirect_url_loader.hweb_bundle_url_loader_factory.ccweb_bundle_url_loader_factory_unittest.cc
webauth
webid
webrtc
websockets
webtransport
webui
worker_host
xr
child
common
public
browser
common
renderer
test
renderer
accessibility
agent_scheduling_group.ccagent_scheduling_group.hcontent_security_policy_util.ccgpu_benchmarking_extension.cc
loader
media
navigation_client.ccnavigation_client.h
pepper
render_frame_impl.ccrender_frame_impl.hrender_frame_impl_browsertest.ccrender_frame_proxy.ccrender_frame_proxy.hrender_thread_impl.ccrender_thread_impl.hrender_view_browsertest.ccrender_view_impl.ccrender_view_impl.hrenderer_blink_platform_impl.ccrenderer_blink_platform_impl.hrenderer_main.cc
service_worker
stream_texture_host_android.ccstream_texture_host_android.h
worker
services
shell
test
utility
web_test

@ -161,7 +161,7 @@ void JNI_ContentChildProcessServiceDelegate_RetrieveFileDescriptorsIdsToKeys(
std::vector<int> ids;
std::vector<std::string> keys;
if (!file_switch_value.empty()) {
base::Optional<std::map<int, std::string>> ids_to_keys_from_command_line =
absl::optional<std::map<int, std::string>> ids_to_keys_from_command_line =
ParseSharedFileSwitchValue(file_switch_value);
if (ids_to_keys_from_command_line) {
for (auto iter : *ids_to_keys_from_command_line) {

@ -15,7 +15,6 @@
#include "base/logging.h"
#include "base/memory/shared_memory_hooks.h"
#include "base/message_loop/message_pump_type.h"
#include "base/optional.h"
#include "base/process/launch.h"
#include "base/process/memory.h"
#include "base/process/process.h"
@ -42,6 +41,7 @@
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/system/dynamic_library_support.h"
#include "sandbox/policy/sandbox_type.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/ui_base_paths.h"
#include "ui/base/ui_base_switches.h"
@ -115,7 +115,7 @@ void PopulateFDsFromCommandLine() {
if (shared_file_param.empty())
return;
base::Optional<std::map<int, std::string>> shared_file_descriptors =
absl::optional<std::map<int, std::string>> shared_file_descriptors =
ParseSharedFileSwitchValue(shared_file_param);
if (!shared_file_descriptors)
return;

@ -67,7 +67,7 @@ class RenderWidgetHostNSViewBridge : public mojom::RenderWidgetHostNSView,
void ShowDictionaryOverlay(ui::mojom::AttributedStringPtr attributed_string,
const gfx::Point& baseline_point) override;
void LockKeyboard(
const base::Optional<std::vector<uint32_t>>& uint_dom_codes) override;
const absl::optional<std::vector<uint32_t>>& uint_dom_codes) override;
void UnlockKeyboard() override;
void ShowSharingServicePicker(
const std::string& title,

@ -257,8 +257,8 @@ void RenderWidgetHostNSViewBridge::ShowDictionaryOverlay(
}
void RenderWidgetHostNSViewBridge::LockKeyboard(
const base::Optional<std::vector<uint32_t>>& uint_dom_codes) {
base::Optional<base::flat_set<ui::DomCode>> dom_codes;
const absl::optional<std::vector<uint32_t>>& uint_dom_codes) {
absl::optional<base::flat_set<ui::DomCode>> dom_codes;
if (uint_dom_codes) {
dom_codes.emplace();
for (const auto& uint_dom_code : *uint_dom_codes)

@ -12,10 +12,10 @@
#include "base/containers/flat_set.h"
#include "base/mac/scoped_nsobject.h"
#include "base/optional.h"
#include "content/browser/renderer_host/input/mouse_wheel_rails_filter_mac.h"
#include "content/common/render_widget_host_ns_view.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/input/input_handler.mojom-shared.h"
#import "ui/base/cocoa/command_dispatcher.h"
#import "ui/base/cocoa/tool_tip_base_view.h"
@ -259,7 +259,7 @@ struct DidOverscrollParams;
- (void)setCompositionRange:(gfx::Range)range;
// KeyboardLock methods.
- (void)lockKeyboard:(base::Optional<base::flat_set<ui::DomCode>>)keysToLock;
- (void)lockKeyboard:(absl::optional<base::flat_set<ui::DomCode>>)keysToLock;
- (void)unlockKeyboard;
// Cursorlock methods.

@ -164,7 +164,7 @@ void ExtractUnderlines(NSAttributedString* string,
// Private methods:
@interface RenderWidgetHostViewCocoa () {
bool _keyboardLockActive;
base::Optional<base::flat_set<ui::DomCode>> _lockedKeys;
absl::optional<base::flat_set<ui::DomCode>> _lockedKeys;
API_AVAILABLE(macos(10.12.2))
base::scoped_nsobject<NSCandidateListTouchBarItem> _candidateListTouchBarItem;
@ -846,7 +846,7 @@ void ExtractUnderlines(NSAttributedString* string,
}
}
- (void)lockKeyboard:(base::Optional<base::flat_set<ui::DomCode>>)keysToLock {
- (void)lockKeyboard:(absl::optional<base::flat_set<ui::DomCode>>)keysToLock {
// TODO(joedow): Integrate System-level keyboard hook into this method.
_lockedKeys = std::move(keysToLock);
_keyboardLockActive = true;

@ -283,7 +283,7 @@ using content::DropData;
// TODO(https://crbug.com/898608): The |downloadFileName_| and
// |downloadURL_| values should be computed by the caller.
if (_dropData->download_metadata.empty()) {
base::Optional<base::FilePath> suggestedFilename =
absl::optional<base::FilePath> suggestedFilename =
_dropData->GetSafeFilenameForImageFileContents();
if (suggestedFilename) {
_downloadFileName = std::move(*suggestedFilename);

@ -142,7 +142,7 @@ void AccessibilityScriptsMacBrowserTest::AssertOutputMatchesExpectations() {
base::FilePath expectation_file =
helper_.GetExpectationFilePath(test_file_path_);
EXPECT_FALSE(expectation_file.empty());
base::Optional<std::vector<std::string>> expected_lines =
absl::optional<std::vector<std::string>> expected_lines =
helper_.LoadExpectationFile(expectation_file);
EXPECT_TRUE(expected_lines.has_value());

@ -9,7 +9,6 @@
#include <utility>
#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@ -17,6 +16,7 @@
#include "base/values.h"
#include "content/browser/accessibility/browser_accessibility.h"
#include "content/browser/accessibility/browser_accessibility_manager.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/accessibility/ax_tree_manager_map.h"
@ -28,7 +28,7 @@
namespace content {
namespace {
base::Optional<std::string> GetStringAttribute(
absl::optional<std::string> GetStringAttribute(
const ui::AXNode& node,
ax::mojom::StringAttribute attr) {
// Language is different from other string attributes as it inherits and has
@ -36,7 +36,7 @@ base::Optional<std::string> GetStringAttribute(
if (attr == ax::mojom::StringAttribute::kLanguage) {
std::string value = node.GetLanguage();
if (value.empty()) {
return base::nullopt;
return absl::nullopt;
}
return value;
}
@ -45,7 +45,7 @@ base::Optional<std::string> GetStringAttribute(
if (attr == ax::mojom::StringAttribute::kFontFamily) {
std::string value = node.GetInheritedStringAttribute(attr);
if (value.empty()) {
return base::nullopt;
return absl::nullopt;
}
return value;
}
@ -56,7 +56,7 @@ base::Optional<std::string> GetStringAttribute(
if (node.GetStringAttribute(attr, &value)) {
return value;
}
return base::nullopt;
return absl::nullopt;
}
std::string FormatColor(int argb) {

@ -34,7 +34,7 @@ using LineIndexer =
ui::AXTreeIndexer<GetDOMId, NSArray*, ChildrenOf, NodeComparator>;
// Implements stateful id values. Can be either id or be in
// error or not applciable state. Similar to base::Optional, but tri-state
// error or not applciable state. Similar to absl::optional, but tri-state
// allowing nullable values.
class CONTENT_EXPORT OptionalNSObject final {
public:

@ -191,7 +191,7 @@ OptionalNSObject AttributeInvoker::ParamByPropertyNode(
// NSNumber. Format: integer.
NSNumber* AttributeInvoker::PropertyNodeToInt(
const AXPropertyNode& intnode) const {
base::Optional<int> param = intnode.AsInt();
absl::optional<int> param = intnode.AsInt();
if (!param) {
INT_FAIL(intnode, "not a number")
}
@ -208,7 +208,7 @@ NSArray* AttributeInvoker::PropertyNodeToIntArray(
NSMutableArray* array =
[[NSMutableArray alloc] initWithCapacity:arraynode.parameters.size()];
for (const auto& paramnode : arraynode.parameters) {
base::Optional<int> param = paramnode.AsInt();
absl::optional<int> param = paramnode.AsInt();
if (!param) {
INTARRAY_FAIL(arraynode, paramnode.name_or_value + " is not a number")
}
@ -224,12 +224,12 @@ NSValue* AttributeInvoker::PropertyNodeToRange(
NSRANGE_FAIL(dictnode, "dictionary is expected")
}
base::Optional<int> loc = dictnode.FindIntKey("loc");
absl::optional<int> loc = dictnode.FindIntKey("loc");
if (!loc) {
NSRANGE_FAIL(dictnode, "no loc or loc is not a number")
}
base::Optional<int> len = dictnode.FindIntKey("len");
absl::optional<int> len = dictnode.FindIntKey("len");
if (!len) {
NSRANGE_FAIL(dictnode, "no len or len is not a number")
}
@ -264,7 +264,7 @@ id AttributeInvoker::DictNodeToTextMarker(
TEXTMARKER_FAIL(dictnode, "1st argument: wrong anchor")
}
base::Optional<int> offset = dictnode.parameters[1].AsInt();
absl::optional<int> offset = dictnode.parameters[1].AsInt();
if (!offset) {
TEXTMARKER_FAIL(dictnode, "2nd argument: wrong offset")
}

@ -1347,7 +1347,7 @@ std::string BrowserAccessibility::SubtreeToStringHelper(size_t level) {
return result;
}
base::Optional<int> BrowserAccessibility::FindTextBoundary(
absl::optional<int> BrowserAccessibility::FindTextBoundary(
ax::mojom::TextBoundary boundary,
int offset,
ax::mojom::MoveDirection direction,
@ -1732,27 +1732,27 @@ bool BrowserAccessibility::IsTable() const {
return node()->IsTable();
}
base::Optional<int> BrowserAccessibility::GetTableRowCount() const {
absl::optional<int> BrowserAccessibility::GetTableRowCount() const {
return node()->GetTableRowCount();
}
base::Optional<int> BrowserAccessibility::GetTableColCount() const {
absl::optional<int> BrowserAccessibility::GetTableColCount() const {
return node()->GetTableColCount();
}
base::Optional<int> BrowserAccessibility::GetTableAriaColCount() const {
absl::optional<int> BrowserAccessibility::GetTableAriaColCount() const {
return node()->GetTableAriaColCount();
}
base::Optional<int> BrowserAccessibility::GetTableAriaRowCount() const {
absl::optional<int> BrowserAccessibility::GetTableAriaRowCount() const {
return node()->GetTableAriaRowCount();
}
base::Optional<int> BrowserAccessibility::GetTableCellCount() const {
absl::optional<int> BrowserAccessibility::GetTableCellCount() const {
return node()->GetTableCellCount();
}
base::Optional<bool> BrowserAccessibility::GetTableHasColumnOrRowHeaderNode()
absl::optional<bool> BrowserAccessibility::GetTableHasColumnOrRowHeaderNode()
const {
return node()->GetTableHasColumnOrRowHeaderNode();
}
@ -1788,7 +1788,7 @@ bool BrowserAccessibility::IsTableRow() const {
return node()->IsTableRow();
}
base::Optional<int> BrowserAccessibility::GetTableRowRowIndex() const {
absl::optional<int> BrowserAccessibility::GetTableRowRowIndex() const {
return node()->GetTableRowRowIndex();
}
@ -1796,47 +1796,47 @@ bool BrowserAccessibility::IsTableCellOrHeader() const {
return node()->IsTableCellOrHeader();
}
base::Optional<int> BrowserAccessibility::GetTableCellColIndex() const {
absl::optional<int> BrowserAccessibility::GetTableCellColIndex() const {
return node()->GetTableCellColIndex();
}
base::Optional<int> BrowserAccessibility::GetTableCellRowIndex() const {
absl::optional<int> BrowserAccessibility::GetTableCellRowIndex() const {
return node()->GetTableCellRowIndex();
}
base::Optional<int> BrowserAccessibility::GetTableCellColSpan() const {
absl::optional<int> BrowserAccessibility::GetTableCellColSpan() const {
return node()->GetTableCellColSpan();
}
base::Optional<int> BrowserAccessibility::GetTableCellRowSpan() const {
absl::optional<int> BrowserAccessibility::GetTableCellRowSpan() const {
return node()->GetTableCellRowSpan();
}
base::Optional<int> BrowserAccessibility::GetTableCellAriaColIndex() const {
absl::optional<int> BrowserAccessibility::GetTableCellAriaColIndex() const {
return node()->GetTableCellAriaColIndex();
}
base::Optional<int> BrowserAccessibility::GetTableCellAriaRowIndex() const {
absl::optional<int> BrowserAccessibility::GetTableCellAriaRowIndex() const {
return node()->GetTableCellAriaRowIndex();
}
base::Optional<int32_t> BrowserAccessibility::GetCellId(int row_index,
absl::optional<int32_t> BrowserAccessibility::GetCellId(int row_index,
int col_index) const {
ui::AXNode* cell = node()->GetTableCellFromCoords(row_index, col_index);
if (!cell)
return base::nullopt;
return absl::nullopt;
return cell->id();
}
base::Optional<int> BrowserAccessibility::GetTableCellIndex() const {
absl::optional<int> BrowserAccessibility::GetTableCellIndex() const {
return node()->GetTableCellIndex();
}
base::Optional<int32_t> BrowserAccessibility::CellIndexToId(
absl::optional<int32_t> BrowserAccessibility::CellIndexToId(
int cell_index) const {
ui::AXNode* cell = node()->GetTableCellFromIndex(cell_index);
if (!cell)
return base::nullopt;
return absl::nullopt;
return cell->id();
}
@ -2149,11 +2149,11 @@ bool BrowserAccessibility::IsOrderedSet() const {
return node()->IsOrderedSet();
}
base::Optional<int> BrowserAccessibility::GetPosInSet() const {
absl::optional<int> BrowserAccessibility::GetPosInSet() const {
return node()->GetPosInSet();
}
base::Optional<int> BrowserAccessibility::GetSetSize() const {
absl::optional<int> BrowserAccessibility::GetSetSize() const {
return node()->GetSetSize();
}

@ -16,10 +16,10 @@
#include <vector>
#include "base/macros.h"
#include "base/optional.h"
#include "base/strings/string_split.h"
#include "build/build_config.h"
#include "content/common/content_export.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/web/web_ax_enums.h"
#include "ui/accessibility/ax_enums.mojom-forward.h"
#include "ui/accessibility/ax_node.h"
@ -447,7 +447,7 @@ class CONTENT_EXPORT BrowserAccessibility : public ui::AXPlatformNodeDelegate {
int GetIndexInParent() override;
gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override;
base::Optional<int> FindTextBoundary(
absl::optional<int> FindTextBoundary(
ax::mojom::TextBoundary boundary,
int offset,
ax::mojom::MoveDirection direction,
@ -459,12 +459,12 @@ class CONTENT_EXPORT BrowserAccessibility : public ui::AXPlatformNodeDelegate {
std::string GetLanguage() const override;
bool IsTable() const override;
base::Optional<int> GetTableColCount() const override;
base::Optional<int> GetTableRowCount() const override;
base::Optional<int> GetTableAriaColCount() const override;
base::Optional<int> GetTableAriaRowCount() const override;
base::Optional<int> GetTableCellCount() const override;
base::Optional<bool> GetTableHasColumnOrRowHeaderNode() const override;
absl::optional<int> GetTableColCount() const override;
absl::optional<int> GetTableRowCount() const override;
absl::optional<int> GetTableAriaColCount() const override;
absl::optional<int> GetTableAriaRowCount() const override;
absl::optional<int> GetTableCellCount() const override;
absl::optional<bool> GetTableHasColumnOrRowHeaderNode() const override;
std::vector<ui::AXNodeID> GetColHeaderNodeIds() const override;
std::vector<ui::AXNodeID> GetColHeaderNodeIds(int col_index) const override;
std::vector<ui::AXNodeID> GetRowHeaderNodeIds() const override;
@ -472,19 +472,19 @@ class CONTENT_EXPORT BrowserAccessibility : public ui::AXPlatformNodeDelegate {
ui::AXPlatformNode* GetTableCaption() const override;
bool IsTableRow() const override;
base::Optional<int> GetTableRowRowIndex() const override;
absl::optional<int> GetTableRowRowIndex() const override;
bool IsTableCellOrHeader() const override;
base::Optional<int> GetTableCellIndex() const override;
base::Optional<int> GetTableCellColIndex() const override;
base::Optional<int> GetTableCellRowIndex() const override;
base::Optional<int> GetTableCellColSpan() const override;
base::Optional<int> GetTableCellRowSpan() const override;
base::Optional<int> GetTableCellAriaColIndex() const override;
base::Optional<int> GetTableCellAriaRowIndex() const override;
base::Optional<int32_t> GetCellId(int row_index,
absl::optional<int> GetTableCellIndex() const override;
absl::optional<int> GetTableCellColIndex() const override;
absl::optional<int> GetTableCellRowIndex() const override;
absl::optional<int> GetTableCellColSpan() const override;
absl::optional<int> GetTableCellRowSpan() const override;
absl::optional<int> GetTableCellAriaColIndex() const override;
absl::optional<int> GetTableCellAriaRowIndex() const override;
absl::optional<int32_t> GetCellId(int row_index,
int col_index) const override;
base::Optional<int32_t> CellIndexToId(int cell_index) const override;
absl::optional<int32_t> CellIndexToId(int cell_index) const override;
bool IsCellOrHeaderOfARIATable() const override;
bool IsCellOrHeaderOfARIAGrid() const override;
@ -515,8 +515,8 @@ class CONTENT_EXPORT BrowserAccessibility : public ui::AXPlatformNodeDelegate {
ax::mojom::IntListAttribute attr) override;
bool IsOrderedSetItem() const override;
bool IsOrderedSet() const override;
base::Optional<int> GetPosInSet() const override;
base::Optional<int> GetSetSize() const override;
absl::optional<int> GetPosInSet() const override;
absl::optional<int> GetSetSize() const override;
SkColor GetColor() const override;
SkColor GetBackgroundColor() const override;

@ -1642,7 +1642,7 @@ int BrowserAccessibilityAndroid::GetItemIndex() const {
if (max > min && value >= min && value <= max)
index = static_cast<int>(((value - min)) * 100 / (max - min));
} else {
base::Optional<int> pos_in_set = node()->GetPosInSet();
absl::optional<int> pos_in_set = node()->GetPosInSet();
if (pos_in_set && *pos_in_set > 0)
index = *pos_in_set - 1;
}
@ -2022,7 +2022,7 @@ int BrowserAccessibilityAndroid::ColumnCount() const {
}
int BrowserAccessibilityAndroid::RowIndex() const {
base::Optional<int> pos_in_set = node()->GetPosInSet();
absl::optional<int> pos_in_set = node()->GetPosInSet();
if (pos_in_set && pos_in_set > 0)
return *pos_in_set - 1;
return node()->GetTableCellRowIndex().value_or(0);

@ -363,7 +363,7 @@ TEST_F(BrowserAccessibilityAuraLinuxTest,
TestTextAttributesInContentEditables) {
auto has_attribute = [](AtkAttributeSet* attributes,
AtkTextAttribute text_attribute,
base::Optional<const char*> expected_value) {
absl::optional<const char*> expected_value) {
const char* name = atk_text_attribute_get_name(text_attribute);
while (attributes) {
const AtkAttribute* attribute =
@ -525,8 +525,8 @@ TEST_F(BrowserAccessibilityAuraLinuxTest,
ASSERT_TRUE(
has_attribute(attributes, ATK_TEXT_ATTR_FAMILY_NAME, "Helvetica"));
ASSERT_FALSE(
has_attribute(attributes, ATK_TEXT_ATTR_WEIGHT, base::nullopt));
ASSERT_FALSE(has_attribute(attributes, ATK_TEXT_ATTR_STYLE, base::nullopt));
has_attribute(attributes, ATK_TEXT_ATTR_WEIGHT, absl::nullopt));
ASSERT_FALSE(has_attribute(attributes, ATK_TEXT_ATTR_STYLE, absl::nullopt));
ASSERT_TRUE(has_attribute(attributes, ATK_TEXT_ATTR_UNDERLINE, "single"));
ASSERT_TRUE(has_attribute(attributes, ATK_TEXT_ATTR_LANGUAGE, "fr"));
@ -549,12 +549,12 @@ TEST_F(BrowserAccessibilityAuraLinuxTest,
ASSERT_TRUE(
has_attribute(attributes, ATK_TEXT_ATTR_FAMILY_NAME, "Helvetica"));
ASSERT_FALSE(
has_attribute(attributes, ATK_TEXT_ATTR_WEIGHT, base::nullopt));
ASSERT_FALSE(has_attribute(attributes, ATK_TEXT_ATTR_STYLE, base::nullopt));
has_attribute(attributes, ATK_TEXT_ATTR_WEIGHT, absl::nullopt));
ASSERT_FALSE(has_attribute(attributes, ATK_TEXT_ATTR_STYLE, absl::nullopt));
ASSERT_FALSE(
has_attribute(attributes, ATK_TEXT_ATTR_UNDERLINE, base::nullopt));
has_attribute(attributes, ATK_TEXT_ATTR_UNDERLINE, absl::nullopt));
ASSERT_FALSE(
has_attribute(attributes, ATK_TEXT_ATTR_INVALID, base::nullopt));
has_attribute(attributes, ATK_TEXT_ATTR_INVALID, absl::nullopt));
atk_attribute_set_free(attributes);
}
@ -572,8 +572,8 @@ TEST_F(BrowserAccessibilityAuraLinuxTest,
ASSERT_TRUE(has_attribute(attributes, ATK_TEXT_ATTR_WEIGHT, "700"));
ASSERT_TRUE(has_attribute(attributes, ATK_TEXT_ATTR_STYLE, "italic"));
ASSERT_FALSE(
has_attribute(attributes, ATK_TEXT_ATTR_UNDERLINE, base::nullopt));
ASSERT_FALSE(has_attribute(attributes, ATK_TEXT_ATTR_INVALID, base::nullopt));
has_attribute(attributes, ATK_TEXT_ATTR_UNDERLINE, absl::nullopt));
ASSERT_FALSE(has_attribute(attributes, ATK_TEXT_ATTR_INVALID, absl::nullopt));
atk_attribute_set_free(attributes);
AtkObject* ax_after_atk_object =
@ -584,10 +584,10 @@ TEST_F(BrowserAccessibilityAuraLinuxTest,
EXPECT_EQ(7, end_offset);
ASSERT_TRUE(
has_attribute(attributes, ATK_TEXT_ATTR_FAMILY_NAME, "Helvetica"));
ASSERT_FALSE(has_attribute(attributes, ATK_TEXT_ATTR_WEIGHT, base::nullopt));
ASSERT_FALSE(has_attribute(attributes, ATK_TEXT_ATTR_WEIGHT, absl::nullopt));
ASSERT_FALSE(has_attribute(attributes, ATK_TEXT_ATTR_STYLE, "italic"));
ASSERT_FALSE(
has_attribute(attributes, ATK_TEXT_ATTR_UNDERLINE, base::nullopt));
has_attribute(attributes, ATK_TEXT_ATTR_UNDERLINE, absl::nullopt));
atk_attribute_set_free(attributes);
manager.reset();

@ -17,7 +17,6 @@
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/optional.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
@ -30,6 +29,7 @@
#include "content/browser/accessibility/one_shot_accessibility_tree_search.h"
#include "content/public/common/content_client.h"
#include "content/public/common/use_zoom_for_dsf_policy.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/accessibility/ax_enum_util.h"
@ -949,7 +949,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
- (NSNumber*)ariaColumnCount {
if (![self instanceActive])
return nil;
base::Optional<int> aria_col_count = _owner->node()->GetTableAriaColCount();
absl::optional<int> aria_col_count = _owner->node()->GetTableAriaColCount();
if (!aria_col_count)
return nil;
return @(*aria_col_count);
@ -958,7 +958,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
- (NSNumber*)ariaColumnIndex {
if (![self instanceActive])
return nil;
base::Optional<int> ariaColIndex = _owner->node()->GetTableCellAriaColIndex();
absl::optional<int> ariaColIndex = _owner->node()->GetTableCellAriaColIndex();
if (!ariaColIndex)
return nil;
return @(*ariaColIndex);
@ -1004,7 +1004,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
- (NSNumber*)ariaPosInSet {
if (![self instanceActive])
return nil;
base::Optional<int> posInSet = _owner->node()->GetPosInSet();
absl::optional<int> posInSet = _owner->node()->GetPosInSet();
if (!posInSet)
return nil;
return @(*posInSet);
@ -1020,7 +1020,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
- (NSNumber*)ariaRowCount {
if (![self instanceActive])
return nil;
base::Optional<int> ariaRowCount = _owner->node()->GetTableAriaRowCount();
absl::optional<int> ariaRowCount = _owner->node()->GetTableAriaRowCount();
if (!ariaRowCount)
return nil;
return @(*ariaRowCount);
@ -1029,7 +1029,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
- (NSNumber*)ariaRowIndex {
if (![self instanceActive])
return nil;
base::Optional<int> ariaRowIndex = _owner->node()->GetTableCellAriaRowIndex();
absl::optional<int> ariaRowIndex = _owner->node()->GetTableCellAriaRowIndex();
if (!ariaRowIndex)
return nil;
return @(*ariaRowIndex);
@ -1038,7 +1038,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
- (NSNumber*)ariaSetSize {
if (![self instanceActive])
return nil;
base::Optional<int> setSize = _owner->node()->GetSetSize();
absl::optional<int> setSize = _owner->node()->GetSetSize();
if (!setSize)
return nil;
return @(*setSize);
@ -1142,7 +1142,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
}
} else {
// Otherwise this is a cell, return the column headers for this cell.
base::Optional<int> column = _owner->GetTableCellColIndex();
absl::optional<int> column = _owner->GetTableCellColIndex();
if (!column)
return nil;
@ -1161,8 +1161,8 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
if (![self instanceActive])
return nil;
base::Optional<int> column = _owner->node()->GetTableCellColIndex();
base::Optional<int> colspan = _owner->node()->GetTableCellColSpan();
absl::optional<int> column = _owner->node()->GetTableCellColIndex();
absl::optional<int> colspan = _owner->node()->GetTableCellColSpan();
if (column && colspan)
return [NSValue valueWithRange:NSMakeRange(*column, *colspan)];
return nil;
@ -1519,12 +1519,12 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
return [self treeItemRowIndex];
} else if ([self internalRole] == ax::mojom::Role::kColumn) {
DCHECK(_owner->node());
base::Optional<int> col_index = *_owner->node()->GetTableColColIndex();
absl::optional<int> col_index = *_owner->node()->GetTableColColIndex();
if (col_index)
return @(*col_index);
} else if ([self internalRole] == ax::mojom::Role::kRow) {
DCHECK(_owner->node());
base::Optional<int> row_index = _owner->node()->GetTableRowRowIndex();
absl::optional<int> row_index = _owner->node()->GetTableRowRowIndex();
if (row_index)
return @(*row_index);
}
@ -2205,8 +2205,8 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
if (![self instanceActive])
return nil;
base::Optional<int> row = _owner->node()->GetTableCellRowIndex();
base::Optional<int> rowspan = _owner->node()->GetTableCellRowSpan();
absl::optional<int> row = _owner->node()->GetTableCellRowIndex();
absl::optional<int> rowspan = _owner->node()->GetTableCellRowSpan();
if (row && rowspan)
return [NSValue valueWithRange:NSMakeRange(*row, *rowspan)];
return nil;

@ -251,10 +251,10 @@ bool BrowserAccessibilityManager::never_suppress_or_delay_events_for_testing_ =
false;
// static
base::Optional<int32_t> BrowserAccessibilityManager::last_focused_node_id_ = {};
absl::optional<int32_t> BrowserAccessibilityManager::last_focused_node_id_ = {};
// static
base::Optional<ui::AXTreeID>
absl::optional<ui::AXTreeID>
BrowserAccessibilityManager::last_focused_node_tree_id_ = {};
// static

@ -600,8 +600,8 @@ class CONTENT_EXPORT BrowserAccessibilityManager : public ui::AXTreeObserver,
//
// NOTE: Don't use or modify these properties directly, use the
// SetLastFocusedNode and GetLastFocusedNode methods instead.
static base::Optional<int32_t> last_focused_node_id_;
static base::Optional<ui::AXTreeID> last_focused_node_tree_id_;
static absl::optional<int32_t> last_focused_node_id_;
static absl::optional<ui::AXTreeID> last_focused_node_tree_id_;
// For debug only: True when handling OnAccessibilityEvents.
#if DCHECK_IS_ON()

@ -176,7 +176,7 @@ void DumpAccessibilityTestBase::RunTestForPlatform(
return;
}
base::Optional<std::vector<std::string>> expected_lines =
absl::optional<std::vector<std::string>> expected_lines =
test_helper_.LoadExpectationFile(expected_file);
if (!expected_lines) {
LOG(INFO) << "Skipping this test on this platform.";

@ -10,11 +10,11 @@
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_macros.h"
#include "base/optional.h"
#include "base/power_monitor/power_monitor.h"
#include "base/trace_event/trace_event.h"
#include "net/android/network_library.h"
#include "net/android/traffic_stats.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
const base::Feature kForegroundRadioStateCountWakeups{
"ForegroundRadioStateCountWakeups", base::FEATURE_DISABLED_BY_DEFAULT};
@ -28,7 +28,7 @@ void Report30SecondRadioUsage(int64_t tx_bytes, int64_t rx_bytes, int wakeups) {
if (base::android::RadioUtils::GetConnectionType() ==
base::android::RadioConnectionType::kWifi) {
base::Optional<int32_t> maybe_level = net::android::GetWifiSignalLevel();
absl::optional<int32_t> maybe_level = net::android::GetWifiSignalLevel();
if (!maybe_level.has_value())
return;
@ -47,7 +47,7 @@ void Report30SecondRadioUsage(int64_t tx_bytes, int64_t rx_bytes, int wakeups) {
"Power.ForegroundRadio.ReceivedKiB.Wifi.30Seconds", wifi_level,
rx_bytes, 1024);
} else {
base::Optional<base::android::RadioSignalLevel> maybe_level =
absl::optional<base::android::RadioSignalLevel> maybe_level =
base::android::RadioUtils::GetCellSignalLevel();
if (!maybe_level.has_value())
return;

@ -115,7 +115,7 @@ class ContentURLLoader : public network::mojom::URLLoader {
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 {}

@ -105,9 +105,9 @@ class SynchronousCompositorControlHost
void ReturnFrame(
uint32_t layer_tree_frame_sink_id,
uint32_t metadata_version,
const base::Optional<viz::LocalSurfaceId>& local_surface_id,
base::Optional<viz::CompositorFrame> frame,
base::Optional<viz::HitTestRegionList> hit_test_region_list) override {
const absl::optional<viz::LocalSurfaceId>& local_surface_id,
absl::optional<viz::CompositorFrame> frame,
absl::optional<viz::HitTestRegionList> hit_test_region_list) override {
if (frame && (!local_surface_id || !local_surface_id->is_valid())) {
bad_message::ReceivedBadMessage(
process_id_, bad_message::SYNC_COMPOSITOR_NO_LOCAL_SURFACE_ID);
@ -239,9 +239,9 @@ SynchronousCompositor::Frame SynchronousCompositorHost::DemandDrawHw(
uint32_t layer_tree_frame_sink_id;
uint32_t metadata_version = 0u;
base::Optional<viz::LocalSurfaceId> local_surface_id;
base::Optional<viz::CompositorFrame> compositor_frame;
base::Optional<viz::HitTestRegionList> hit_test_region_list;
absl::optional<viz::LocalSurfaceId> local_surface_id;
absl::optional<viz::CompositorFrame> compositor_frame;
absl::optional<viz::HitTestRegionList> hit_test_region_list;
blink::mojom::SyncCompositorCommonRendererParamsPtr common_renderer_params;
{
@ -316,7 +316,7 @@ bool SynchronousCompositorHost::DemandDrawSwInProc(SkCanvas* canvas) {
base::ScopedAllowBaseSyncPrimitivesOutsideBlockingScope
allow_base_sync_primitives;
blink::mojom::SyncCompositorCommonRendererParamsPtr common_renderer_params;
base::Optional<viz::CompositorFrameMetadata> metadata;
absl::optional<viz::CompositorFrameMetadata> metadata;
ScopedSetSkCanvas set_sk_canvas(canvas);
blink::mojom::SyncCompositorDemandDrawSwParamsPtr params =
blink::mojom::SyncCompositorDemandDrawSwParams::New(); // Unused.
@ -384,7 +384,7 @@ bool SynchronousCompositorHost::DemandDrawSw(SkCanvas* canvas,
if (!software_draw_shm_)
return false;
base::Optional<viz::CompositorFrameMetadata> metadata;
absl::optional<viz::CompositorFrameMetadata> metadata;
uint32_t metadata_version = 0u;
blink::mojom::SyncCompositorCommonRendererParamsPtr common_renderer_params;
{

@ -42,9 +42,9 @@ void SynchronousCompositorSyncCallBridge::RemoteClosedOnIOThread() {
bool SynchronousCompositorSyncCallBridge::ReceiveFrameOnIOThread(
int layer_tree_frame_sink_id,
uint32_t metadata_version,
base::Optional<viz::LocalSurfaceId> local_surface_id,
base::Optional<viz::CompositorFrame> compositor_frame,
base::Optional<viz::HitTestRegionList> hit_test_region_list) {
absl::optional<viz::LocalSurfaceId> local_surface_id,
absl::optional<viz::CompositorFrame> compositor_frame,
absl::optional<viz::HitTestRegionList> hit_test_region_list) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
base::AutoLock lock(lock_);
if (remote_state_ != RemoteState::READY || frame_futures_.empty())

@ -83,9 +83,9 @@ class SynchronousCompositorSyncCallBridge
bool ReceiveFrameOnIOThread(
int frame_sink_id,
uint32_t metadata_version,
base::Optional<viz::LocalSurfaceId> local_surface_id,
base::Optional<viz::CompositorFrame>,
base::Optional<viz::HitTestRegionList> hit_test_region_list);
absl::optional<viz::LocalSurfaceId> local_surface_id,
absl::optional<viz::CompositorFrame>,
absl::optional<viz::HitTestRegionList> hit_test_region_list);
// Receive a BeginFrameResponse. Returns true if handling the response was
// successful or not.

@ -9,7 +9,6 @@
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/android/scoped_java_ref.h"
#include "base/optional.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h"
@ -22,6 +21,7 @@
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/android/gurl_android.h"
using base::android::AttachCurrentThread;

@ -45,7 +45,7 @@ bool ForEachCache(sql::Database* db, const ForEachCallable& callable) {
bool AppCacheBackfillerVersion8::BackfillPaddingSizes() {
return ForEachCache(db_, [&](int64_t cache_id, int64_t group_id) -> bool {
base::Optional<std::string> manifest_url = GetManifestUrlForGroup(group_id);
absl::optional<std::string> manifest_url = GetManifestUrlForGroup(group_id);
if (!manifest_url.has_value())
return false;
@ -81,14 +81,14 @@ bool AppCacheBackfillerVersion8::ForEachEntry(int64_t cache_id,
return true;
}
base::Optional<std::string> AppCacheBackfillerVersion8::GetManifestUrlForGroup(
absl::optional<std::string> AppCacheBackfillerVersion8::GetManifestUrlForGroup(
int64_t group_id) {
static const char kSql[] =
"SELECT manifest_url, group_id FROM Groups WHERE group_id = ?";
sql::Statement statement(db_->GetUniqueStatement(kSql));
statement.BindInt64(0, group_id);
if (!statement.Step())
return base::nullopt;
return absl::nullopt;
return statement.ColumnString(0);
}
@ -116,7 +116,7 @@ bool AppCacheBackfillerVersion8::UpdateCachePaddingSize(int64_t cache_id,
bool AppCacheBackfillerVersion9::BackfillManifestParserVersionAndScope() {
return ForEachCache(db_, [&](int64_t cache_id, int64_t group_id) -> bool {
base::Optional<std::string> manifest_url = GetManifestUrlForGroup(group_id);
absl::optional<std::string> manifest_url = GetManifestUrlForGroup(group_id);
if (!manifest_url.has_value())
return false;
@ -159,14 +159,14 @@ bool AppCacheBackfillerVersion9::UpdateCacheManifestScope(
return statement.Run();
}
base::Optional<std::string> AppCacheBackfillerVersion9::GetManifestUrlForGroup(
absl::optional<std::string> AppCacheBackfillerVersion9::GetManifestUrlForGroup(
int64_t group_id) {
static const char kSql[] =
"SELECT manifest_url, group_id FROM Groups WHERE group_id = ?";
sql::Statement statement(db_->GetUniqueStatement(kSql));
statement.BindInt64(0, group_id);
if (!statement.Step())
return base::nullopt;
return absl::nullopt;
return statement.ColumnString(0);
}

@ -7,8 +7,8 @@
#include <string>
#include "base/optional.h"
#include "sql/database.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
@ -33,9 +33,9 @@ class AppCacheBackfillerVersion8 {
template <typename ForEachCallable>
bool ForEachEntry(int64_t cache_id, const ForEachCallable& callable);
// Gets the manifest URL of a group. Returns base::nullopt if the database
// Gets the manifest URL of a group. Returns absl::nullopt if the database
// query failed.
base::Optional<std::string> GetManifestUrlForGroup(int64_t group_id);
absl::optional<std::string> GetManifestUrlForGroup(int64_t group_id);
// Updates the padding size of the Entry record identified by |response_id|.
// Returns whether the database statement succeeded.
@ -74,7 +74,7 @@ class AppCacheBackfillerVersion9 {
bool UpdateCacheManifestScope(int64_t cache_id,
const std::string& manifest_scope);
base::Optional<std::string> GetManifestUrlForGroup(int64_t group_id);
absl::optional<std::string> GetManifestUrlForGroup(int64_t group_id);
// The AppCacheDatabase instance being backfilled.
sql::Database* const db_;

@ -208,7 +208,7 @@ class LoaderFactoryInterceptingBrowserClient : public TestContentBrowserClient {
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>*

@ -661,7 +661,7 @@ void AppCacheHost::MaybePassSubresourceFactory() {
GetContentClient()->browser()->WillCreateURLLoaderFactory(
rfh->GetProcess()->GetBrowserContext(), rfh, process_id_,
ContentBrowserClient::URLLoaderFactoryType::kDocumentSubResource,
origin_for_url_loader_factory_, base::nullopt /* navigation_id */,
origin_for_url_loader_factory_, absl::nullopt /* navigation_id */,
ukm::SourceIdObj::FromInt64(rfh->GetPageUkmSourceId()),
&factory_receiver, nullptr /* header_client */,
nullptr /* bypass_redirect_checks */, nullptr /* disable_secure_dns */,

@ -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 "content/browser/appcache/appcache_group.h"
#include "content/browser/appcache/appcache_service_impl.h"
#include "content/browser/appcache/appcache_storage.h"
@ -29,6 +28,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/blink/public/mojom/appcache/appcache.mojom.h"
#include "third_party/blink/public/mojom/appcache/appcache_info.mojom-forward.h"
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
@ -233,7 +233,7 @@ class CONTENT_EXPORT AppCacheHost : public blink::mojom::AppCacheHost,
site_for_cookies_initialized_ = true;
}
const base::Optional<url::Origin>& top_frame_origin() const {
const absl::optional<url::Origin>& top_frame_origin() const {
return top_frame_origin_;
}
@ -421,7 +421,7 @@ class CONTENT_EXPORT AppCacheHost : public blink::mojom::AppCacheHost,
// To be used in policy checks.
net::SiteForCookies site_for_cookies_;
bool site_for_cookies_initialized_ = false;
base::Optional<url::Origin> top_frame_origin_;
absl::optional<url::Origin> top_frame_origin_;
bool is_origin_trial_required_ = false;

@ -5,7 +5,7 @@
#ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_POLICY_H_
#define CONTENT_BROWSER_APPCACHE_APPCACHE_POLICY_H_
#include "base/optional.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
class GURL;
@ -26,14 +26,14 @@ class AppCachePolicy {
const GURL& manifest_url,
const GURL& site_for_cookies,
const base::Optional<url::Origin>& top_frame_origin) = 0;
const absl::optional<url::Origin>& top_frame_origin) = 0;
// Called prior to creating a new appcache. Returns true if allowed.
virtual bool CanCreateAppCache(
const GURL& manifest_url,
const GURL& site_for_cookies,
const base::Optional<url::Origin>& top_frame_origin) = 0;
const absl::optional<url::Origin>& top_frame_origin) = 0;
// Returns true if origin trial tokens are required in order to fetch or
// update manifests, as well as load any resources from such a manifest.

@ -31,10 +31,10 @@ int AppCacheRequest::GetResponseCode() const {
return 0;
}
base::Optional<url::Origin> AppCacheRequest::GetTopFrameOrigin() const {
absl::optional<url::Origin> AppCacheRequest::GetTopFrameOrigin() const {
return request_.trusted_params
? request_.trusted_params->isolation_info.top_frame_origin()
: base::nullopt;
: absl::nullopt;
}
std::string AppCacheRequest::GetResponseHeaderByName(
@ -50,8 +50,8 @@ void AppCacheRequest::UpdateWithRedirectInfo(
bool not_used_clear_body;
net::RedirectUtil::UpdateHttpRequest(
request_.url, request_.method, redirect_info,
base::nullopt /* removed_request_headers */,
base::nullopt /* modified_request_headers */, &request_.headers,
absl::nullopt /* removed_request_headers */,
absl::nullopt /* modified_request_headers */, &request_.headers,
&not_used_clear_body);
request_.url = redirect_info.new_url;
request_.method = redirect_info.new_method;

@ -8,11 +8,11 @@
#include <string>
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "base/sequence_checker.h"
#include "content/common/content_export.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace net {
@ -50,7 +50,7 @@ class CONTENT_EXPORT AppCacheRequest {
}
// Used for cookie policy.
base::Optional<url::Origin> GetTopFrameOrigin() const;
absl::optional<url::Origin> GetTopFrameOrigin() const;
// The referrer for this request.
const GURL GetReferrer() const { return request_.referrer; }

@ -644,10 +644,10 @@ bool AppCacheRequestHandler::MaybeCreateLoaderForResponse(
return true;
}
base::Optional<SubresourceLoaderParams>
absl::optional<SubresourceLoaderParams>
AppCacheRequestHandler::MaybeCreateSubresourceLoaderParams() {
if (!should_create_subresource_loader_)
return base::nullopt;
return absl::nullopt;
// The factory is destroyed when the renderer drops the connection.
mojo::PendingRemote<network::mojom::URLLoaderFactory> factory_remote;
@ -657,7 +657,7 @@ AppCacheRequestHandler::MaybeCreateSubresourceLoaderParams() {
SubresourceLoaderParams params;
params.pending_appcache_loader_factory = std::move(factory_remote);
return base::Optional<SubresourceLoaderParams>(std::move(params));
return absl::optional<SubresourceLoaderParams>(std::move(params));
}
void AppCacheRequestHandler::MaybeCreateSubresourceLoader(

@ -77,7 +77,7 @@ class CONTENT_EXPORT AppCacheRequestHandler
blink::ThrottlingURLLoader* url_loader,
bool* skip_other_interceptors,
bool* will_return_unsafe_redirect) override;
base::Optional<SubresourceLoaderParams> MaybeCreateSubresourceLoaderParams()
absl::optional<SubresourceLoaderParams> MaybeCreateSubresourceLoaderParams()
override;
// These methods are used for subresource loading by the

@ -1828,7 +1828,7 @@ class AppCacheStorageImplTest : public testing::Test {
TestBrowserContext browser_context_;
base::test::ScopedFeatureList appcache_require_origin_trial_feature_;
// Delayed initialization to avoid data races with feature list.
base::Optional<base::WeakPtrFactory<StoragePartitionImpl>>
absl::optional<base::WeakPtrFactory<StoragePartitionImpl>>
weak_partition_factory_;
// Test data

@ -131,14 +131,14 @@ class SubresourceLoader : public network::mojom::URLLoader,
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 {
DCHECK(modified_headers.IsEmpty() && modified_cors_exempt_headers.IsEmpty())
<< "Redirect with modified headers was not supported yet. "
"crbug.com/845683";
if (!handler_) {
network_loader_->FollowRedirect(
removed_headers, {} /* modified_headers */,
{} /* modified_cors_exempt_headers */, base::nullopt /* new_url */);
{} /* modified_cors_exempt_headers */, absl::nullopt /* new_url */);
return;
}
DCHECK(network_loader_);
@ -157,7 +157,7 @@ class SubresourceLoader : public network::mojom::URLLoader,
} else {
network_loader_->FollowRedirect(
{} /* removed_headers */, {} /* modified_headers */,
{} /* modified_cors_exempt_headers */, base::nullopt /* new_url */);
{} /* modified_cors_exempt_headers */, absl::nullopt /* new_url */);
}
}

@ -93,7 +93,7 @@ void AppCacheUpdateJob::UpdateURLLoaderRequest::SetSiteForCookies(
}
void AppCacheUpdateJob::UpdateURLLoaderRequest::SetInitiator(
const base::Optional<url::Origin>& initiator) {
const absl::optional<url::Origin>& initiator) {
request_.request_initiator = initiator;
}

@ -65,7 +65,7 @@ class AppCacheUpdateJob::UpdateURLLoaderRequest
void SetSiteForCookies(const GURL& site_for_cookies);
// Sets the origin of the context which initiated the request.
void SetInitiator(const base::Optional<url::Origin>& initiator);
void SetInitiator(const absl::optional<url::Origin>& initiator);
// Get all response headers, as a HttpResponseHeaders object. See comments
// in HttpResponseHeaders class as to the format of the data.

@ -145,7 +145,7 @@ void AppCacheURLLoader::FollowRedirect(
const std::vector<std::string>& modified_headers,
const net::HttpRequestHeaders& removed_headers,
const net::HttpRequestHeaders& removed_cors_exempt_headers,
const base::Optional<GURL>& new_url) {
const absl::optional<GURL>& new_url) {
NOTREACHED() << "appcache never produces redirects";
}

@ -131,7 +131,7 @@ class CONTENT_EXPORT AppCacheURLLoader : public AppCacheStorage::Delegate,
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;

@ -59,7 +59,7 @@ void ChromeAppCacheService::Shutdown() {
bool ChromeAppCacheService::CanLoadAppCache(
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) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
return GetContentClient()->browser()->AllowAppCache(
manifest_url, site_for_cookies, top_frame_origin, browser_context_);
@ -68,7 +68,7 @@ bool ChromeAppCacheService::CanLoadAppCache(
bool ChromeAppCacheService::CanCreateAppCache(
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) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
return GetContentClient()->browser()->AllowAppCache(
manifest_url, site_for_cookies, top_frame_origin, browser_context_);

@ -64,11 +64,11 @@ class CONTENT_EXPORT ChromeAppCacheService
bool CanLoadAppCache(
const GURL& manifest_url,
const GURL& site_for_cookies,
const base::Optional<url::Origin>& top_frame_origin) override;
const absl::optional<url::Origin>& top_frame_origin) override;
bool CanCreateAppCache(
const GURL& manifest_url,
const GURL& site_for_cookies,
const base::Optional<url::Origin>& top_frame_origin) override;
const absl::optional<url::Origin>& top_frame_origin) override;
bool IsOriginTrialRequiredForAppCache() override;
protected:

@ -18,7 +18,7 @@ MockAppCachePolicy::~MockAppCachePolicy() = default;
bool MockAppCachePolicy::CanLoadAppCache(
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) {
requested_manifest_url_ = manifest_url;
return can_load_return_value_;
}
@ -26,7 +26,7 @@ bool MockAppCachePolicy::CanLoadAppCache(
bool MockAppCachePolicy::CanCreateAppCache(
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) {
requested_manifest_url_ = manifest_url;
return can_create_return_value_;
}

@ -19,11 +19,11 @@ class MockAppCachePolicy : public AppCachePolicy {
bool CanLoadAppCache(
const GURL& manifest_url,
const GURL& site_for_cookies,
const base::Optional<url::Origin>& top_frame_origin) override;
const absl::optional<url::Origin>& top_frame_origin) override;
bool CanCreateAppCache(
const GURL& manifest_url,
const GURL& site_for_cookies,
const base::Optional<url::Origin>& top_frame_origin) override;
const absl::optional<url::Origin>& top_frame_origin) override;
bool IsOriginTrialRequiredForAppCache() override;
bool can_load_return_value_;

@ -8,7 +8,6 @@
#include "base/deferred_sequenced_task_runner.h"
#include "base/metrics/field_trial_params.h"
#include "base/no_destructor.h"
#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/sequence_local_storage_slot.h"
#include "base/time/time.h"
@ -28,37 +27,38 @@
#include "services/audio/public/cpp/audio_system_to_service_adapter.h"
#include "services/audio/service.h"
#include "services/audio/service_factory.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {
namespace {
base::Optional<base::TimeDelta> GetFieldTrialIdleTimeout() {
absl::optional<base::TimeDelta> GetFieldTrialIdleTimeout() {
std::string timeout_str =
base::GetFieldTrialParamValue("AudioService", "teardown_timeout_s");
int timeout_s = 0;
if (!base::StringToInt(timeout_str, &timeout_s))
return base::nullopt;
return absl::nullopt;
return base::TimeDelta::FromSeconds(timeout_s);
}
base::Optional<base::TimeDelta> GetCommandLineIdleTimeout() {
absl::optional<base::TimeDelta> GetCommandLineIdleTimeout() {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
std::string timeout_str =
command_line.GetSwitchValueASCII(switches::kAudioServiceQuitTimeoutMs);
int timeout_ms = 0;
if (!base::StringToInt(timeout_str, &timeout_ms))
return base::nullopt;
return absl::nullopt;
return base::TimeDelta::FromMilliseconds(timeout_ms);
}
base::Optional<base::TimeDelta> GetAudioServiceProcessIdleTimeout() {
base::Optional<base::TimeDelta> timeout = GetCommandLineIdleTimeout();
absl::optional<base::TimeDelta> GetAudioServiceProcessIdleTimeout() {
absl::optional<base::TimeDelta> timeout = GetCommandLineIdleTimeout();
if (!timeout)
timeout = GetFieldTrialIdleTimeout();
if (timeout && *timeout < base::TimeDelta())
return base::nullopt;
return absl::nullopt;
return timeout;
}

@ -10,7 +10,6 @@
#include "base/hash/hash.h"
#include "base/location.h"
#include "base/metrics/metrics_hashes.h"
#include "base/optional.h"
#include "base/run_loop.h"
#include "base/strings/string_piece_forward.h"
#include "base/strings/stringprintf.h"
@ -91,6 +90,7 @@
#include "services/device/public/mojom/vibration_manager.mojom.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/device_memory/approximated_device_memory.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h"
@ -7304,7 +7304,7 @@ IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest,
WaitForFirstVisuallyNonEmptyPaint(web_contents());
ASSERT_FALSE(delete_observer_rfh_a.deleted());
EXPECT_TRUE(rfh_a->IsInBackForwardCache());
EXPECT_EQ(web_contents()->GetThemeColor(), base::nullopt);
EXPECT_EQ(web_contents()->GetThemeColor(), absl::nullopt);
ThemeColorObserver observer(web_contents());
web_contents()->GetController().GoBack();

@ -239,8 +239,8 @@ void BackgroundFetchContext::AddRegistrationObserver(
void BackgroundFetchContext::UpdateUI(
const BackgroundFetchRegistrationId& registration_id,
const base::Optional<std::string>& title,
const base::Optional<SkBitmap>& icon,
const absl::optional<std::string>& title,
const absl::optional<SkBitmap>& icon,
blink::mojom::BackgroundFetchRegistrationService::UpdateUICallback
callback) {
DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId());

@ -13,13 +13,13 @@
#include "base/macros.h"
#include "base/memory/ref_counted_delete_on_sequence.h"
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "content/browser/background_fetch/background_fetch_delegate_proxy.h"
#include "content/browser/background_fetch/background_fetch_event_dispatcher.h"
#include "content/browser/background_fetch/storage/get_initialization_data_task.h"
#include "content/browser/devtools/devtools_background_services_context_impl.h"
#include "content/common/content_export.h"
#include "content/public/browser/browser_thread.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom.h"
namespace storage {
@ -123,8 +123,8 @@ class CONTENT_EXPORT BackgroundFetchContext
// internal |icon| is guarnteed to be not null.
void UpdateUI(
const BackgroundFetchRegistrationId& registration_id,
const base::Optional<std::string>& title,
const base::Optional<SkBitmap>& icon,
const absl::optional<std::string>& title,
const absl::optional<SkBitmap>& icon,
blink::mojom::BackgroundFetchRegistrationService::UpdateUICallback
callback);

@ -18,13 +18,13 @@
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/observer_list.h"
#include "base/optional.h"
#include "content/browser/background_fetch/background_fetch.pb.h"
#include "content/browser/background_fetch/background_fetch_registration_id.h"
#include "content/browser/background_fetch/background_fetch_scheduler.h"
#include "content/browser/background_fetch/storage/database_task.h"
#include "content/browser/background_fetch/storage/get_initialization_data_task.h"
#include "content/common/content_export.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom.h"
#include "url/origin.h"

@ -9,7 +9,7 @@
#include <vector>
#include "base/memory/scoped_refptr.h"
#include "base/optional.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom.h"
class SkBitmap;

@ -201,8 +201,8 @@ class BackgroundFetchDelegateProxy::Core
}
void UpdateUI(const std::string& job_unique_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(BrowserThread::UI);
if (auto* delegate = browser_context_->GetBackgroundFetchDelegate())
@ -405,8 +405,8 @@ void BackgroundFetchDelegateProxy::StartRequest(
void BackgroundFetchDelegateProxy::UpdateUI(
const std::string& job_unique_id,
const base::Optional<std::string>& title,
const base::Optional<SkBitmap>& icon,
const absl::optional<std::string>& title,
const absl::optional<SkBitmap>& icon,
blink::mojom::BackgroundFetchRegistrationService::UpdateUICallback
update_ui_callback) {
DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId());

@ -14,12 +14,12 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "content/browser/background_fetch/background_fetch_request_info.h"
#include "content/public/browser/background_fetch_delegate.h"
#include "content/public/browser/background_fetch_description.h"
#include "content/public/browser/background_fetch_response.h"
#include "content/public/browser/browser_thread.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom.h"
class SkBitmap;
@ -116,8 +116,8 @@ class CONTENT_EXPORT BackgroundFetchDelegateProxy {
// Called from the Controller (on the service worker core thread).
void UpdateUI(
const std::string& job_unique_id,
const base::Optional<std::string>& title,
const base::Optional<SkBitmap>& icon,
const absl::optional<std::string>& title,
const absl::optional<SkBitmap>& icon,
blink::mojom::BackgroundFetchRegistrationService::UpdateUICallback
update_ui_callback);

@ -81,8 +81,8 @@ class FakeBackgroundFetchDelegate : public BackgroundFetchDelegate {
void MarkJobComplete(const std::string& job_unique_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 {
++ui_update_count_;
}
@ -109,7 +109,7 @@ class FakeBackgroundFetchDelegate : public BackgroundFetchDelegate {
job_unique_id, guid,
std::make_unique<BackgroundFetchResult>(
std::move(response), base::Time::Now(), base::FilePath(),
base::nullopt /* blob_handle */, 10u));
absl::nullopt /* blob_handle */, 10u));
download_guid_to_url_map_.erase(guid);
}
@ -330,7 +330,7 @@ TEST_F(BackgroundFetchDelegateProxyTest, UpdateUI) {
EXPECT_TRUE(controller.request_started_);
EXPECT_TRUE(controller.request_completed_);
delegate_proxy_.UpdateUI(kExampleUniqueId, "Job 1 Complete!", base::nullopt,
delegate_proxy_.UpdateUI(kExampleUniqueId, "Job 1 Complete!", absl::nullopt,
base::DoNothing());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(delegate_->ui_update_count_, 1);

@ -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 "content/browser/background_fetch/background_fetch_delegate_proxy.h"
#include "content/browser/background_fetch/background_fetch_registration_id.h"
#include "content/browser/background_fetch/background_fetch_request_info.h"
@ -22,6 +21,7 @@
#include "content/common/background_fetch/background_fetch_types.h"
#include "content/common/content_export.h"
#include "content/public/browser/browser_thread.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace content {

@ -10,7 +10,6 @@
#include "base/callback_helpers.h"
#include "base/guid.h"
#include "base/memory/ptr_util.h"
#include "base/optional.h"
#include "base/task/post_task.h"
#include "content/browser/background_fetch/background_fetch_context.h"
#include "content/browser/background_fetch/background_fetch_metrics.h"
@ -23,6 +22,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
namespace content {
@ -85,7 +85,7 @@ void BackgroundFetchRegistrationServiceImpl::MatchRequests(
}
void BackgroundFetchRegistrationServiceImpl::UpdateUI(
const base::Optional<std::string>& title,
const absl::optional<std::string>& title,
const SkBitmap& icon,
UpdateUICallback callback) {
DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId());
@ -103,7 +103,7 @@ void BackgroundFetchRegistrationServiceImpl::UpdateUI(
// Wrap the icon in an optional for clarity.
auto optional_icon =
icon.isNull() ? base::nullopt : base::Optional<SkBitmap>(icon);
icon.isNull() ? absl::nullopt : absl::optional<SkBitmap>(icon);
background_fetch_context_->UpdateUI(registration_id_, title, optional_icon,
std::move(callback));

@ -27,7 +27,7 @@ class CONTENT_EXPORT BackgroundFetchRegistrationServiceImpl
blink::mojom::CacheQueryOptionsPtr cache_query_options,
bool match_all,
MatchRequestsCallback callback) override;
void UpdateUI(const base::Optional<std::string>& title,
void UpdateUI(const absl::optional<std::string>& title,
const SkBitmap& icon,
UpdateUICallback callback) override;
void Abort(AbortCallback callback) override;

@ -12,7 +12,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted_delete_on_sequence.h"
#include "base/optional.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "components/download/public/common/download_item.h"
@ -20,6 +19,7 @@
#include "content/common/content_export.h"
#include "content/public/browser/background_fetch_response.h"
#include "content/public/browser/browser_thread.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
#include "url/gurl.h"

@ -5,8 +5,8 @@
#ifndef CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_REQUEST_MATCH_PARAMS_H_
#define CONTENT_BROWSER_BACKGROUND_FETCH_BACKGROUND_FETCH_REQUEST_MATCH_PARAMS_H_
#include "base/optional.h"
#include "content/common/content_export.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom.h"
namespace content {

@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/guid.h"
#include "base/optional.h"
#include "base/task/post_task.h"
#include "content/browser/background_fetch/background_fetch_context.h"
#include "content/browser/background_fetch/background_fetch_metrics.h"
@ -24,6 +23,7 @@
#include "content/public/browser/service_worker_version_base_info.h"
#include "content/public/browser/web_contents.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
namespace content {

@ -11,8 +11,8 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/optional.h"
#include "content/browser/service_worker/embedded_worker_test_helper.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace content {

@ -160,7 +160,7 @@ void MockBackgroundFetchDelegate::DownloadUrl(
std::make_unique<BackgroundFetchResponse>(
std::vector<GURL>({url}), test_response->headers),
base::Time::Now(), response_path,
/* blob_handle= */ base::nullopt, test_response->data.size())));
/* blob_handle= */ absl::nullopt, test_response->data.size())));
} else {
auto response = std::make_unique<BackgroundFetchResponse>(
std::vector<GURL>({url}), test_response->headers);
@ -188,8 +188,8 @@ void MockBackgroundFetchDelegate::MarkJobComplete(
void MockBackgroundFetchDelegate::UpdateUI(
const std::string& job_unique_id,
const base::Optional<std::string>& title,
const base::Optional<SkBitmap>& icon) {
const absl::optional<std::string>& title,
const absl::optional<SkBitmap>& icon) {
job_id_to_client_map_[job_unique_id]->OnUIUpdated(job_unique_id);
}

@ -12,8 +12,8 @@
#include <vector>
#include "base/files/scoped_temp_dir.h"
#include "base/optional.h"
#include "content/public/browser/background_fetch_delegate.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "url/gurl.h"
@ -83,8 +83,8 @@ class MockBackgroundFetchDelegate : public BackgroundFetchDelegate {
void Abort(const std::string& job_unique_id) override;
void MarkJobComplete(const std::string& job_unique_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;
void RegisterResponse(const GURL& url,
std::unique_ptr<TestResponse> response);

@ -9,9 +9,9 @@
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/optional.h"
#include "base/strings/string_util.h"
#include "content/browser/bluetooth/bluetooth_blocklist.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
using device::BluetoothUUID;

@ -12,8 +12,8 @@
#include <vector>
#include "base/containers/flat_set.h"
#include "base/optional.h"
#include "content/common/content_export.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/bluetooth/web_bluetooth_device_id.h"
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h"

@ -6,10 +6,10 @@
#include "base/check.h"
#include "base/metrics/histogram_macros.h"
#include "base/optional.h"
#include "base/strings/string_split.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_client.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
using device::BluetoothUUID;

@ -196,7 +196,7 @@ bool MatchesFilters(
const std::string* device_name,
const UUIDSet& device_uuids,
const ManufacturerDataMap& device_manufacturer_data,
const base::Optional<
const absl::optional<
std::vector<blink::mojom::WebBluetoothLeScanFilterPtr>>& filters) {
DCHECK(HasValidFilter(filters));
for (const auto& filter : filters.value()) {
@ -338,13 +338,13 @@ void BluetoothDeviceChooserController::GetDevice(
void BluetoothDeviceChooserController::AddFilteredDevice(
const device::BluetoothDevice& device) {
base::Optional<std::string> device_name = device.GetName();
absl::optional<std::string> device_name = device.GetName();
if (chooser_.get()) {
if (options_->accept_all_devices ||
MatchesFilters(device_name ? &device_name.value() : nullptr,
device.GetUUIDs(), device.GetManufacturerData(),
options_->filters)) {
base::Optional<int8_t> rssi = device.GetInquiryRSSI();
absl::optional<int8_t> rssi = device.GetInquiryRSSI();
std::string device_id = device.GetAddress();
device_ids_.insert(device_id);
chooser_->AddOrUpdateDevice(
@ -534,7 +534,7 @@ void BluetoothDeviceChooserController::PostErrorCallback(
// static
std::unique_ptr<device::BluetoothDiscoveryFilter>
BluetoothDeviceChooserController::ComputeScanFilter(
const base::Optional<
const absl::optional<
std::vector<blink::mojom::WebBluetoothLeScanFilterPtr>>& filters) {
// There isn't much support for GATT over BR/EDR from neither platforms nor
// devices so performing a Dual scan will find devices that the API is not

@ -9,10 +9,10 @@
#include <unordered_set>
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "base/timer/timer.h"
#include "content/common/content_export.h"
#include "content/public/browser/bluetooth_chooser.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h"
namespace device {
@ -94,7 +94,7 @@ class CONTENT_EXPORT BluetoothDeviceChooserController final {
TestScanDurationSetting::IMMEDIATE_TIMEOUT);
static std::unique_ptr<device::BluetoothDiscoveryFilter> ComputeScanFilter(
const base::Optional<
const absl::optional<
std::vector<blink::mojom::WebBluetoothLeScanFilterPtr>>& filters);
private:

@ -37,7 +37,7 @@ int HashUUID(const std::string& canonical_uuid) {
return static_cast<int>(data & 0x7fffffff);
}
int HashUUID(const base::Optional<BluetoothUUID>& uuid) {
int HashUUID(const absl::optional<BluetoothUUID>& uuid) {
return uuid ? HashUUID(uuid->canonical_value()) : 0;
}
@ -126,7 +126,7 @@ void RecordGetPrimaryServicesOutcome(
void RecordGetPrimaryServicesServices(
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
const base::Optional<BluetoothUUID>& service) {
const absl::optional<BluetoothUUID>& service) {
// TODO(ortuno): Use a macro to histogram strings.
// http://crbug.com/520284
switch (quantity) {
@ -143,7 +143,7 @@ void RecordGetPrimaryServicesServices(
void RecordGetCharacteristicsCharacteristic(
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
const base::Optional<BluetoothUUID>& characteristic) {
const absl::optional<BluetoothUUID>& characteristic) {
switch (quantity) {
case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE:
base::UmaHistogramSparse("Bluetooth.Web.GetCharacteristic.Characteristic",

@ -104,7 +104,7 @@ void RecordGetPrimaryServicesOutcome(
// Records the UUID of the service used when calling getPrimaryService.
void RecordGetPrimaryServicesServices(
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
const base::Optional<device::BluetoothUUID>& service);
const absl::optional<device::BluetoothUUID>& service);
// getCharacteristic() and getCharacteristics() Metrics
@ -154,7 +154,7 @@ void RecordGetCharacteristicsOutcome(
// Records the UUID of the characteristic used when calling getCharacteristic.
void RecordGetCharacteristicsCharacteristic(
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
const base::Optional<device::BluetoothUUID>& characteristic);
const absl::optional<device::BluetoothUUID>& characteristic);
// Records the outcome of the cache query for getDescriptors. Should only be
// called if QueryCacheForService fails.

@ -44,7 +44,7 @@ class BluetoothUtilTest : public testing::Test {
};
TEST_F(BluetoothUtilTest, SameFilters) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
@ -67,135 +67,135 @@ TEST_F(BluetoothUtilTest, SameFilters) {
}
TEST_F(BluetoothUtilTest, BothNoName) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
auto filter_1 = blink::mojom::WebBluetoothLeScanFilter::New(
services, /*name=*/base::nullopt, "a",
/*manufacturer_data=*/base::nullopt);
services, /*name=*/absl::nullopt, "a",
/*manufacturer_data=*/absl::nullopt);
auto filter_2 = blink::mojom::WebBluetoothLeScanFilter::New(
services, /*name=*/base::nullopt, "a",
/*manufacturer_data=*/base::nullopt);
services, /*name=*/absl::nullopt, "a",
/*manufacturer_data=*/absl::nullopt);
EXPECT_TRUE(AreScanFiltersSame(*filter_1, *filter_2));
}
TEST_F(BluetoothUtilTest, OnlyOneHasName) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
auto filter_1 = blink::mojom::WebBluetoothLeScanFilter::New(
services, "ab", "a", /*manufacturer_data=*/base::nullopt);
services, "ab", "a", /*manufacturer_data=*/absl::nullopt);
auto filter_2 = blink::mojom::WebBluetoothLeScanFilter::New(
services, /*name=*/base::nullopt, "a",
/*manufacturer_data=*/base::nullopt);
services, /*name=*/absl::nullopt, "a",
/*manufacturer_data=*/absl::nullopt);
EXPECT_FALSE(AreScanFiltersSame(*filter_1, *filter_2));
}
TEST_F(BluetoothUtilTest, DifferentName) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
auto filter_1 = blink::mojom::WebBluetoothLeScanFilter::New(
services, "ab", "a", /*manufacturer_data=*/base::nullopt);
services, "ab", "a", /*manufacturer_data=*/absl::nullopt);
auto filter_2 = blink::mojom::WebBluetoothLeScanFilter::New(
services, "cd", "a", /*manufacturer_data=*/base::nullopt);
services, "cd", "a", /*manufacturer_data=*/absl::nullopt);
EXPECT_FALSE(AreScanFiltersSame(*filter_1, *filter_2));
}
TEST_F(BluetoothUtilTest, BothNoNamePrefix) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
auto filter_1 = blink::mojom::WebBluetoothLeScanFilter::New(
services, "ab", /*name_prefix=*/base::nullopt,
/*manufacturer_data=*/base::nullopt);
services, "ab", /*name_prefix=*/absl::nullopt,
/*manufacturer_data=*/absl::nullopt);
auto filter_2 = blink::mojom::WebBluetoothLeScanFilter::New(
services, "ab", /*name_prefix=*/base::nullopt,
/*manufacturer_data=*/base::nullopt);
services, "ab", /*name_prefix=*/absl::nullopt,
/*manufacturer_data=*/absl::nullopt);
EXPECT_TRUE(AreScanFiltersSame(*filter_1, *filter_2));
}
TEST_F(BluetoothUtilTest, OnlyOneHasNamePrefix) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
auto filter_1 = blink::mojom::WebBluetoothLeScanFilter::New(
services, "ab", "a", /*manufacturer_data=*/base::nullopt);
services, "ab", "a", /*manufacturer_data=*/absl::nullopt);
auto filter_2 = blink::mojom::WebBluetoothLeScanFilter::New(
services, "ab", /*name_prefix=*/base::nullopt,
/*manufacturer_data=*/base::nullopt);
services, "ab", /*name_prefix=*/absl::nullopt,
/*manufacturer_data=*/absl::nullopt);
EXPECT_FALSE(AreScanFiltersSame(*filter_1, *filter_2));
}
TEST_F(BluetoothUtilTest, DifferentNamePrefix) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
auto filter_1 = blink::mojom::WebBluetoothLeScanFilter::New(
services, "ab", "a", /*manufacturer_data=*/base::nullopt);
services, "ab", "a", /*manufacturer_data=*/absl::nullopt);
auto filter_2 = blink::mojom::WebBluetoothLeScanFilter::New(
services, "ab", "ab", /*manufacturer_data=*/base::nullopt);
services, "ab", "ab", /*manufacturer_data=*/absl::nullopt);
EXPECT_FALSE(AreScanFiltersSame(*filter_1, *filter_2));
}
TEST_F(BluetoothUtilTest, BothNoServicesUUID) {
auto filter_1 = blink::mojom::WebBluetoothLeScanFilter::New(
/*services=*/base::nullopt, "ab", "a",
/*manufacturer_data=*/base::nullopt);
/*services=*/absl::nullopt, "ab", "a",
/*manufacturer_data=*/absl::nullopt);
auto filter_2 = blink::mojom::WebBluetoothLeScanFilter::New(
/*services=*/base::nullopt, "ab", "a",
/*manufacturer_data=*/base::nullopt);
/*services=*/absl::nullopt, "ab", "a",
/*manufacturer_data=*/absl::nullopt);
EXPECT_TRUE(AreScanFiltersSame(*filter_1, *filter_2));
}
TEST_F(BluetoothUtilTest, OnlyOneHasServicesUUID) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
auto filter_1 = blink::mojom::WebBluetoothLeScanFilter::New(
services, "ab", "a", /*manufacturer_data=*/base::nullopt);
services, "ab", "a", /*manufacturer_data=*/absl::nullopt);
auto filter_2 = blink::mojom::WebBluetoothLeScanFilter::New(
/*services=*/base::nullopt, "ab", "ab",
/*manufacturer_data=*/base::nullopt);
/*services=*/absl::nullopt, "ab", "ab",
/*manufacturer_data=*/absl::nullopt);
EXPECT_FALSE(AreScanFiltersSame(*filter_1, *filter_2));
}
TEST_F(BluetoothUtilTest, DifferentServicesUUID) {
base::Optional<std::vector<device::BluetoothUUID>> services_1;
absl::optional<std::vector<device::BluetoothUUID>> services_1;
services_1.emplace();
services_1->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
auto filter_1 = blink::mojom::WebBluetoothLeScanFilter::New(
services_1, "ab", "a", /*manufacturer_data=*/base::nullopt);
services_1, "ab", "a", /*manufacturer_data=*/absl::nullopt);
base::Optional<std::vector<device::BluetoothUUID>> services_2;
absl::optional<std::vector<device::BluetoothUUID>> services_2;
services_2.emplace();
services_2->push_back(device::BluetoothUUID(kCyclingPowerUUIDString));
auto filter_2 = blink::mojom::WebBluetoothLeScanFilter::New(
services_2, "ab", "a", /*manufacturer_data=*/base::nullopt);
services_2, "ab", "a", /*manufacturer_data=*/absl::nullopt);
EXPECT_FALSE(AreScanFiltersSame(*filter_1, *filter_2));
}
TEST_F(BluetoothUtilTest, SameServicesUUIDButDifferentOrder) {
base::Optional<std::vector<device::BluetoothUUID>> services_1;
absl::optional<std::vector<device::BluetoothUUID>> services_1;
services_1.emplace();
services_1->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
services_1->push_back(device::BluetoothUUID(kCyclingPowerUUIDString));
auto filter_1 = blink::mojom::WebBluetoothLeScanFilter::New(
services_1, "ab", "a", /*manufacturer_data=*/base::nullopt);
services_1, "ab", "a", /*manufacturer_data=*/absl::nullopt);
base::Optional<std::vector<device::BluetoothUUID>> services_2;
absl::optional<std::vector<device::BluetoothUUID>> services_2;
services_2.emplace();
services_2->push_back(device::BluetoothUUID(kCyclingPowerUUIDString));
services_2->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
auto filter_2 = blink::mojom::WebBluetoothLeScanFilter::New(
services_2, "ab", "a", /*manufacturer_data=*/base::nullopt);
services_2, "ab", "a", /*manufacturer_data=*/absl::nullopt);
EXPECT_TRUE(AreScanFiltersSame(*filter_1, *filter_2));
}
TEST_F(BluetoothUtilTest, BothNoManufacturerData) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
@ -210,7 +210,7 @@ TEST_F(BluetoothUtilTest, BothNoManufacturerData) {
}
TEST_F(BluetoothUtilTest, OnlyOneHasManufacturerData) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
@ -219,12 +219,12 @@ TEST_F(BluetoothUtilTest, OnlyOneHasManufacturerData) {
auto filter_1 = blink::mojom::WebBluetoothLeScanFilter::New(
services, "ab", "a", std::move(manufacturer_data));
auto filter_2 = blink::mojom::WebBluetoothLeScanFilter::New(
services, "ab", "a", /*manufacturer_data=*/base::nullopt);
services, "ab", "a", /*manufacturer_data=*/absl::nullopt);
EXPECT_FALSE(AreScanFiltersSame(*filter_1, *filter_2));
}
TEST_F(BluetoothUtilTest, DifferentManufacturerDataSize) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
@ -246,7 +246,7 @@ TEST_F(BluetoothUtilTest, DifferentManufacturerDataSize) {
}
TEST_F(BluetoothUtilTest, DifferentManufacturerDataCompanyIdentifier) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
@ -266,7 +266,7 @@ TEST_F(BluetoothUtilTest, DifferentManufacturerDataCompanyIdentifier) {
}
TEST_F(BluetoothUtilTest, DifferentManufacturerDataFilterSize) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
@ -290,7 +290,7 @@ TEST_F(BluetoothUtilTest, DifferentManufacturerDataFilterSize) {
}
TEST_F(BluetoothUtilTest, DifferentManufacturerData) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
@ -314,7 +314,7 @@ TEST_F(BluetoothUtilTest, DifferentManufacturerData) {
}
TEST_F(BluetoothUtilTest, DifferentManufacturerDataMask) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));

@ -5,12 +5,12 @@
#include "content/browser/bluetooth/frame_connected_bluetooth_devices.h"
#include "base/containers/contains.h"
#include "base/optional.h"
#include "base/strings/string_util.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/web_contents.h"
#include "device/bluetooth/bluetooth_gatt_connection.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/bluetooth/web_bluetooth_device_id.h"
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h"
@ -87,12 +87,12 @@ void FrameConnectedBluetoothDevices::CloseConnectionToDeviceWithId(
DecrementDevicesConnectedCount();
}
base::Optional<blink::WebBluetoothDeviceId>
absl::optional<blink::WebBluetoothDeviceId>
FrameConnectedBluetoothDevices::CloseConnectionToDeviceWithAddress(
const std::string& device_address) {
auto device_address_iter = device_address_to_id_map_.find(device_address);
if (device_address_iter == device_address_to_id_map_.end()) {
return base::nullopt;
return absl::nullopt;
}
blink::WebBluetoothDeviceId device_id = device_address_iter->second;
auto device_id_iter = device_id_to_connection_map_.find(device_id);
@ -101,7 +101,7 @@ FrameConnectedBluetoothDevices::CloseConnectionToDeviceWithAddress(
CHECK(device_address_to_id_map_.erase(device_address));
device_id_to_connection_map_.erase(device_id);
DecrementDevicesConnectedCount();
return base::make_optional(device_id);
return absl::make_optional(device_id);
}
void FrameConnectedBluetoothDevices::CloseConnectionsToDevicesNotInList(

@ -9,9 +9,9 @@
#include <string>
#include <unordered_map>
#include "base/optional.h"
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/bluetooth/web_bluetooth_device_id.h"
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h"
#include "url/origin.h"
@ -58,7 +58,7 @@ class CONTENT_EXPORT FrameConnectedBluetoothDevices final {
// WebContents count of connected devices if |device_address| had a
// connection. Returns the device_id of the device associated with the
// connection.
base::Optional<blink::WebBluetoothDeviceId>
absl::optional<blink::WebBluetoothDeviceId>
CloseConnectionToDeviceWithAddress(const std::string& device_address);
// Deletes all connections that are NOT in the list of |permitted_ids| and

@ -40,7 +40,7 @@ void WebBluetoothPairingManager::PairForCharacteristicReadValue(
std::move(read_callback)
.Run(WebBluetoothServiceImpl::TranslateConnectErrorAndRecord(
BluetoothDevice::ConnectErrorCode::ERROR_UNKNOWN),
/*value=*/base::nullopt);
/*value=*/absl::nullopt);
return;
}
@ -78,7 +78,7 @@ void WebBluetoothPairingManager::OnReadCharacteristicValuePairFailure(
std::move(read_callback)
.Run(WebBluetoothServiceImpl::TranslateConnectErrorAndRecord(error_code),
/*value=*/base::nullopt);
/*value=*/absl::nullopt);
}
void WebBluetoothPairingManager::RequestPinCode(BluetoothDevice* device) {

@ -8,12 +8,12 @@
#include <utility>
#include <vector>
#include "base/optional.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "content/browser/bluetooth/web_bluetooth_pairing_manager.h"
#include "content/browser/bluetooth/web_bluetooth_pairing_manager_delegate.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
using blink::WebBluetoothDeviceId;
using blink::mojom::WebBluetoothResult;
@ -103,7 +103,7 @@ class BluetoothPairingManagerTest : public testing::Test,
}
std::move(callback).Run(WebBluetoothResult::CONNECT_AUTH_REJECTED,
base::nullopt);
absl::nullopt);
}
const std::string& characteristic_instance_id() const {
@ -142,7 +142,7 @@ TEST_F(BluetoothPairingManagerTest, ReadSuccessfulAuthFirstSuccess) {
characteristic_instance_id(), kStartingPairAttemptCount,
base::BindLambdaForTesting(
[&loop](WebBluetoothResult result,
const base::Optional<std::vector<uint8_t>>& value) {
const absl::optional<std::vector<uint8_t>>& value) {
EXPECT_EQ(WebBluetoothResult::SUCCESS, result);
EXPECT_EQ(value, kTestValue) << "Incorrect characteristic value";
loop.Quit();
@ -161,7 +161,7 @@ TEST_F(BluetoothPairingManagerTest, ReadSuccessfulAuthSecondSuccess) {
characteristic_instance_id(), kStartingPairAttemptCount,
base::BindLambdaForTesting(
[&loop](WebBluetoothResult result,
const base::Optional<std::vector<uint8_t>>& value) {
const absl::optional<std::vector<uint8_t>>& value) {
EXPECT_EQ(WebBluetoothResult::SUCCESS, result);
EXPECT_EQ(value, kTestValue) << "Incorrect characteristic value";
loop.Quit();
@ -180,7 +180,7 @@ TEST_F(BluetoothPairingManagerTest, ReadFailAllAuthsFail) {
characteristic_instance_id(), kStartingPairAttemptCount,
base::BindLambdaForTesting(
[&loop](WebBluetoothResult result,
const base::Optional<std::vector<uint8_t>>& value) {
const absl::optional<std::vector<uint8_t>>& value) {
EXPECT_EQ(WebBluetoothResult::CONNECT_AUTH_REJECTED, result);
loop.Quit();
}));
@ -198,7 +198,7 @@ TEST_F(BluetoothPairingManagerTest, ReadInvalidCharacteristicID) {
invalid_characteristic_instance_id(), kStartingPairAttemptCount,
base::BindLambdaForTesting(
[&loop](WebBluetoothResult result,
const base::Optional<std::vector<uint8_t>>& value) {
const absl::optional<std::vector<uint8_t>>& value) {
EXPECT_EQ(WebBluetoothResult::CONNECT_UNKNOWN_ERROR, result);
loop.Quit();
}));

@ -377,7 +377,7 @@ class WebBluetoothServiceImpl::ScanningClient
private:
void AddFilteredDeviceToPrompt(
const std::string& device_id,
const base::Optional<std::string>& device_name) {
const absl::optional<std::string>& device_name) {
bool should_update_name = device_name.has_value();
std::u16string device_name_for_display =
base::UTF8ToUTF16(device_name.value_or(""));
@ -392,7 +392,7 @@ class WebBluetoothServiceImpl::ScanningClient
};
bool HasValidFilter(
const base::Optional<
const absl::optional<
std::vector<blink::mojom::WebBluetoothLeScanFilterPtr>>& filters) {
if (!filters) {
return false;
@ -656,7 +656,7 @@ void WebBluetoothServiceImpl::DeviceChanged(BluetoothAdapter* adapter,
}
if (!device->IsGattConnected()) {
base::Optional<blink::WebBluetoothDeviceId> device_id =
absl::optional<blink::WebBluetoothDeviceId> device_id =
connected_devices_->CloseConnectionToDeviceWithAddress(
device->GetAddress());
@ -668,11 +668,11 @@ void WebBluetoothServiceImpl::DeviceChanged(BluetoothAdapter* adapter,
void WebBluetoothServiceImpl::DeviceAdvertisementReceived(
const std::string& device_address,
const base::Optional<std::string>& device_name,
const base::Optional<std::string>& advertisement_name,
base::Optional<int8_t> rssi,
base::Optional<int8_t> tx_power,
base::Optional<uint16_t> appearance,
const absl::optional<std::string>& device_name,
const absl::optional<std::string>& advertisement_name,
absl::optional<int8_t> rssi,
absl::optional<int8_t> tx_power,
absl::optional<uint16_t> appearance,
const BluetoothDevice::UUIDList& advertised_uuids,
const BluetoothDevice::ServiceDataMap& service_data_map,
const BluetoothDevice::ManufacturerDataMap& manufacturer_data_map) {
@ -935,7 +935,7 @@ void WebBluetoothServiceImpl::RemoteServerDisconnect(
void WebBluetoothServiceImpl::RemoteServerGetPrimaryServices(
const blink::WebBluetoothDeviceId& device_id,
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
const base::Optional<BluetoothUUID>& services_uuid,
const absl::optional<BluetoothUUID>& services_uuid,
RemoteServerGetPrimaryServicesCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
RecordGetPrimaryServicesServices(quantity, services_uuid);
@ -943,7 +943,7 @@ void WebBluetoothServiceImpl::RemoteServerGetPrimaryServices(
if (!IsAllowedToAccessAtLeastOneService(device_id)) {
std::move(callback).Run(
blink::mojom::WebBluetoothResult::NOT_ALLOWED_TO_ACCESS_ANY_SERVICE,
/*service=*/base::nullopt);
/*service=*/absl::nullopt);
return;
}
@ -951,7 +951,7 @@ void WebBluetoothServiceImpl::RemoteServerGetPrimaryServices(
!IsAllowedToAccessService(device_id, services_uuid.value())) {
std::move(callback).Run(
blink::mojom::WebBluetoothResult::NOT_ALLOWED_TO_ACCESS_SERVICE,
/*service=*/base::nullopt);
/*service=*/absl::nullopt);
return;
}
@ -964,7 +964,7 @@ void WebBluetoothServiceImpl::RemoteServerGetPrimaryServices(
if (query_result.outcome != CacheQueryOutcome::SUCCESS) {
RecordGetPrimaryServicesOutcome(quantity, query_result.outcome);
std::move(callback).Run(query_result.GetWebResult(),
base::nullopt /* service */);
absl::nullopt /* service */);
return;
}
@ -989,7 +989,7 @@ void WebBluetoothServiceImpl::RemoteServerGetPrimaryServices(
void WebBluetoothServiceImpl::RemoteServiceGetCharacteristics(
const std::string& service_instance_id,
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
const base::Optional<BluetoothUUID>& characteristics_uuid,
const absl::optional<BluetoothUUID>& characteristics_uuid,
RemoteServiceGetCharacteristicsCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@ -999,7 +999,7 @@ void WebBluetoothServiceImpl::RemoteServiceGetCharacteristics(
BluetoothBlocklist::Get().IsExcluded(characteristics_uuid.value())) {
std::move(callback).Run(
blink::mojom::WebBluetoothResult::BLOCKLISTED_CHARACTERISTIC_UUID,
base::nullopt /* characteristics */);
absl::nullopt /* characteristics */);
return;
}
@ -1012,7 +1012,7 @@ void WebBluetoothServiceImpl::RemoteServiceGetCharacteristics(
if (query_result.outcome != CacheQueryOutcome::SUCCESS) {
std::move(callback).Run(query_result.GetWebResult(),
base::nullopt /* characteristics */);
absl::nullopt /* characteristics */);
return;
}
@ -1057,13 +1057,13 @@ void WebBluetoothServiceImpl::RemoteServiceGetCharacteristics(
characteristics_uuid
? blink::mojom::WebBluetoothResult::CHARACTERISTIC_NOT_FOUND
: blink::mojom::WebBluetoothResult::NO_CHARACTERISTICS_FOUND,
base::nullopt /* characteristics */);
absl::nullopt /* characteristics */);
}
void WebBluetoothServiceImpl::RemoteCharacteristicGetDescriptors(
const std::string& characteristic_instance_id,
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
const base::Optional<BluetoothUUID>& descriptors_uuid,
const absl::optional<BluetoothUUID>& descriptors_uuid,
RemoteCharacteristicGetDescriptorsCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@ -1071,7 +1071,7 @@ void WebBluetoothServiceImpl::RemoteCharacteristicGetDescriptors(
BluetoothBlocklist::Get().IsExcluded(descriptors_uuid.value())) {
std::move(callback).Run(
blink::mojom::WebBluetoothResult::BLOCKLISTED_DESCRIPTOR_UUID,
base::nullopt /* descriptor */);
absl::nullopt /* descriptor */);
return;
}
@ -1084,7 +1084,7 @@ void WebBluetoothServiceImpl::RemoteCharacteristicGetDescriptors(
if (query_result.outcome != CacheQueryOutcome::SUCCESS) {
std::move(callback).Run(query_result.GetWebResult(),
base::nullopt /* descriptor */);
absl::nullopt /* descriptor */);
return;
}
@ -1124,7 +1124,7 @@ void WebBluetoothServiceImpl::RemoteCharacteristicGetDescriptors(
std::move(callback).Run(
descriptors_uuid ? blink::mojom::WebBluetoothResult::DESCRIPTOR_NOT_FOUND
: blink::mojom::WebBluetoothResult::NO_DESCRIPTORS_FOUND,
base::nullopt /* descriptors */);
absl::nullopt /* descriptors */);
}
void WebBluetoothServiceImpl::RemoteCharacteristicReadValue(
@ -1141,14 +1141,14 @@ void WebBluetoothServiceImpl::RemoteCharacteristicReadValue(
if (query_result.outcome != CacheQueryOutcome::SUCCESS) {
std::move(callback).Run(query_result.GetWebResult(),
base::nullopt /* value */);
absl::nullopt /* value */);
return;
}
if (BluetoothBlocklist::Get().IsExcludedFromReads(
query_result.characteristic->GetUUID())) {
std::move(callback).Run(blink::mojom::WebBluetoothResult::BLOCKLISTED_READ,
base::nullopt /* value */);
absl::nullopt /* value */);
return;
}
@ -1316,14 +1316,14 @@ void WebBluetoothServiceImpl::RemoteDescriptorReadValue(
if (query_result.outcome != CacheQueryOutcome::SUCCESS) {
std::move(callback).Run(query_result.GetWebResult(),
base::nullopt /* value */);
absl::nullopt /* value */);
return;
}
if (BluetoothBlocklist::Get().IsExcludedFromReads(
query_result.descriptor->GetUUID())) {
std::move(callback).Run(blink::mojom::WebBluetoothResult::BLOCKLISTED_READ,
base::nullopt /* value */);
absl::nullopt /* value */);
return;
}
@ -1756,7 +1756,7 @@ void WebBluetoothServiceImpl::OnDiscoverySessionErrorForWatchAdvertisements() {
void WebBluetoothServiceImpl::RemoteServerGetPrimaryServicesImpl(
const blink::WebBluetoothDeviceId& device_id,
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
const base::Optional<BluetoothUUID>& services_uuid,
const absl::optional<BluetoothUUID>& services_uuid,
RemoteServerGetPrimaryServicesCallback callback,
BluetoothDevice* device) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@ -1768,7 +1768,7 @@ void WebBluetoothServiceImpl::RemoteServerGetPrimaryServicesImpl(
RecordGetPrimaryServicesOutcome(
quantity, UMAGetPrimaryServiceOutcome::DEVICE_DISCONNECTED);
std::move(callback).Run(blink::mojom::WebBluetoothResult::NO_SERVICES_FOUND,
base::nullopt /* services */);
absl::nullopt /* services */);
return;
}
@ -1818,7 +1818,7 @@ void WebBluetoothServiceImpl::RemoteServerGetPrimaryServicesImpl(
std::move(callback).Run(
services_uuid ? blink::mojom::WebBluetoothResult::SERVICE_NOT_FOUND
: blink::mojom::WebBluetoothResult::NO_SERVICES_FOUND,
base::nullopt /* services */);
absl::nullopt /* services */);
}
void WebBluetoothServiceImpl::OnGetDevice(
@ -1900,12 +1900,12 @@ void WebBluetoothServiceImpl::OnCreateGATTConnectionFailed(
void WebBluetoothServiceImpl::OnCharacteristicReadValue(
RemoteCharacteristicReadValueCallback callback,
base::Optional<BluetoothGattService::GattErrorCode> error_code,
absl::optional<BluetoothGattService::GattErrorCode> error_code,
const std::vector<uint8_t>& value) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (error_code.has_value()) {
std::move(callback).Run(TranslateGATTError(error_code.value()),
/*value=*/base::nullopt);
/*value=*/absl::nullopt);
return;
}
std::move(callback).Run(blink::mojom::WebBluetoothResult::SUCCESS, value);
@ -1960,12 +1960,12 @@ void WebBluetoothServiceImpl::OnStopNotifySessionComplete(
void WebBluetoothServiceImpl::OnDescriptorReadValue(
RemoteDescriptorReadValueCallback callback,
base::Optional<BluetoothGattService::GattErrorCode> error_code,
absl::optional<BluetoothGattService::GattErrorCode> error_code,
const std::vector<uint8_t>& value) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (error_code.has_value()) {
std::move(callback).Run(TranslateGATTError(error_code.value()),
/*value=*/base::nullopt);
/*value=*/absl::nullopt);
return;
}
std::move(callback).Run(blink::mojom::WebBluetoothResult::SUCCESS, value);
@ -2176,7 +2176,7 @@ void WebBluetoothServiceImpl::StoreAllowedScanOptions(
}
bool WebBluetoothServiceImpl::AreScanFiltersAllowed(
const base::Optional<ScanFilters>& filters) const {
const absl::optional<ScanFilters>& filters) const {
if (accept_all_advertisements_) {
// Previously allowed accepting all advertisements and no filters. In this
// case since filtered advertisements are a subset of all advertisements,

@ -13,7 +13,6 @@
#include "base/callback.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/optional.h"
#include "base/scoped_observation.h"
#include "content/browser/bad_message.h"
#include "content/browser/bluetooth/bluetooth_allowed_devices.h"
@ -34,6 +33,7 @@
#include "mojo/public/cpp/bindings/pending_associated_remote.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"
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h"
namespace url {
@ -51,7 +51,7 @@ class RenderFrameHost;
class RenderProcessHost;
bool HasValidFilter(
const base::Optional<
const absl::optional<
std::vector<blink::mojom::WebBluetoothLeScanFilterPtr>>& filters);
// Implementation of Mojo WebBluetoothService located in
@ -149,11 +149,11 @@ class CONTENT_EXPORT WebBluetoothServiceImpl
device::BluetoothDevice* device) override;
void DeviceAdvertisementReceived(
const std::string& device_address,
const base::Optional<std::string>& device_name,
const base::Optional<std::string>& advertisement_name,
base::Optional<int8_t> rssi,
base::Optional<int8_t> tx_power,
base::Optional<uint16_t> appearance,
const absl::optional<std::string>& device_name,
const absl::optional<std::string>& advertisement_name,
absl::optional<int8_t> rssi,
absl::optional<int8_t> tx_power,
absl::optional<uint16_t> appearance,
const device::BluetoothDevice::UUIDList& advertised_uuids,
const device::BluetoothDevice::ServiceDataMap& service_data_map,
const device::BluetoothDevice::ManufacturerDataMap& manufacturer_data_map)
@ -187,12 +187,12 @@ class CONTENT_EXPORT WebBluetoothServiceImpl
void RemoteServerGetPrimaryServices(
const blink::WebBluetoothDeviceId& device_id,
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
const base::Optional<device::BluetoothUUID>& services_uuid,
const absl::optional<device::BluetoothUUID>& services_uuid,
RemoteServerGetPrimaryServicesCallback callback) override;
void RemoteServiceGetCharacteristics(
const std::string& service_instance_id,
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
const base::Optional<device::BluetoothUUID>& characteristics_uuid,
const absl::optional<device::BluetoothUUID>& characteristics_uuid,
RemoteServiceGetCharacteristicsCallback callback) override;
void RemoteCharacteristicReadValue(
const std::string& characteristic_instance_id,
@ -213,7 +213,7 @@ class CONTENT_EXPORT WebBluetoothServiceImpl
void RemoteCharacteristicGetDescriptors(
const std::string& service_instance_id,
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
const base::Optional<device::BluetoothUUID>& characteristics_uuid,
const absl::optional<device::BluetoothUUID>& characteristics_uuid,
RemoteCharacteristicGetDescriptorsCallback callback) override;
void RemoteDescriptorReadValue(
const std::string& characteristic_instance_id,
@ -279,7 +279,7 @@ class CONTENT_EXPORT WebBluetoothServiceImpl
void RemoteServerGetPrimaryServicesImpl(
const blink::WebBluetoothDeviceId& device_id,
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
const base::Optional<device::BluetoothUUID>& services_uuid,
const absl::optional<device::BluetoothUUID>& services_uuid,
RemoteServerGetPrimaryServicesCallback callback,
device::BluetoothDevice* device);
@ -304,7 +304,7 @@ class CONTENT_EXPORT WebBluetoothServiceImpl
// Callbacks for BluetoothRemoteGattCharacteristic::ReadRemoteCharacteristic.
void OnCharacteristicReadValue(
RemoteCharacteristicReadValueCallback callback,
base::Optional<device::BluetoothGattService::GattErrorCode> error_code,
absl::optional<device::BluetoothGattService::GattErrorCode> error_code,
const std::vector<uint8_t>& value);
// Callbacks for BluetoothRemoteGattCharacteristic::WriteRemoteCharacteristic.
@ -332,7 +332,7 @@ class CONTENT_EXPORT WebBluetoothServiceImpl
// Callbacks for BluetoothRemoteGattDescriptor::ReadRemoteDescriptor.
void OnDescriptorReadValue(
RemoteDescriptorReadValueCallback callback,
base::Optional<device::BluetoothGattService::GattErrorCode> error_code,
absl::optional<device::BluetoothGattService::GattErrorCode> error_code,
const std::vector<uint8_t>& value);
// Callbacks for BluetoothRemoteGattDescriptor::WriteRemoteDescriptor.
@ -380,7 +380,7 @@ class CONTENT_EXPORT WebBluetoothServiceImpl
void StoreAllowedScanOptions(
const blink::mojom::WebBluetoothRequestLEScanOptions& options);
bool AreScanFiltersAllowed(const base::Optional<ScanFilters>& filters) const;
bool AreScanFiltersAllowed(const absl::optional<ScanFilters>& filters) const;
// Clears all state (maps, sets, etc).
void ClearState();

@ -256,11 +256,11 @@ class WebBluetoothServiceImplTest : public RenderViewHostImplTestHarness {
blink::mojom::WebBluetoothLeScanFilterPtr CreateScanFilter(
const std::string& name,
const std::string& name_prefix) {
base::Optional<std::vector<device::BluetoothUUID>> services;
absl::optional<std::vector<device::BluetoothUUID>> services;
services.emplace();
services->push_back(device::BluetoothUUID(kBatteryServiceUUIDString));
return blink::mojom::WebBluetoothLeScanFilter::New(
services, name, name_prefix, /*manufacturer_data=*/base::nullopt);
services, name, name_prefix, /*manufacturer_data=*/absl::nullopt);
}
blink::mojom::WebBluetoothResult RequestScanningStartAndSimulatePromptEvent(
@ -274,7 +274,7 @@ class WebBluetoothServiceImplTest : public RenderViewHostImplTestHarness {
options->filters.emplace();
auto filter_ptr = blink::mojom::WebBluetoothLeScanFilter::New(
filter.services, filter.name, filter.name_prefix,
/*manufacturer_data=*/base::nullopt);
/*manufacturer_data=*/absl::nullopt);
options->filters->push_back(std::move(filter_ptr));
// Use two RunLoops to guarantee the order of operations for this test.
@ -328,7 +328,7 @@ TEST_F(WebBluetoothServiceImplTest, ClearStateDuringRequestDevice) {
TEST_F(WebBluetoothServiceImplTest, PermissionAllowed) {
blink::mojom::WebBluetoothLeScanFilterPtr filter = CreateScanFilter("a", "b");
base::Optional<WebBluetoothServiceImpl::ScanFilters> filters;
absl::optional<WebBluetoothServiceImpl::ScanFilters> filters;
filters.emplace();
filters->push_back(filter.Clone());
EXPECT_FALSE(service_->AreScanFiltersAllowed(filters));
@ -344,7 +344,7 @@ TEST_F(WebBluetoothServiceImplTest, PermissionAllowed) {
TEST_F(WebBluetoothServiceImplTest, ClearStateDuringRequestScanningStart) {
blink::mojom::WebBluetoothLeScanFilterPtr filter = CreateScanFilter("a", "b");
base::Optional<WebBluetoothServiceImpl::ScanFilters> filters;
absl::optional<WebBluetoothServiceImpl::ScanFilters> filters;
FakeWebBluetoothAdvertisementClientImpl client_impl;
mojo::PendingAssociatedRemote<blink::mojom::WebBluetoothAdvertisementClient>
@ -386,7 +386,7 @@ TEST_F(WebBluetoothServiceImplTest, ClearStateDuringRequestScanningStart) {
TEST_F(WebBluetoothServiceImplTest, PermissionPromptCanceled) {
blink::mojom::WebBluetoothLeScanFilterPtr filter = CreateScanFilter("a", "b");
base::Optional<WebBluetoothServiceImpl::ScanFilters> filters;
absl::optional<WebBluetoothServiceImpl::ScanFilters> filters;
filters.emplace();
filters->push_back(filter.Clone());
EXPECT_FALSE(service_->AreScanFiltersAllowed(filters));
@ -404,7 +404,7 @@ TEST_F(WebBluetoothServiceImplTest, PermissionPromptCanceled) {
TEST_F(WebBluetoothServiceImplTest,
BluetoothScanningPermissionRevokedWhenTabHidden) {
blink::mojom::WebBluetoothLeScanFilterPtr filter = CreateScanFilter("a", "b");
base::Optional<WebBluetoothServiceImpl::ScanFilters> filters;
absl::optional<WebBluetoothServiceImpl::ScanFilters> filters;
filters.emplace();
filters->push_back(filter.Clone());
FakeWebBluetoothAdvertisementClientImpl client_impl;
@ -423,7 +423,7 @@ TEST_F(WebBluetoothServiceImplTest,
TEST_F(WebBluetoothServiceImplTest,
BluetoothScanningPermissionRevokedWhenTabOccluded) {
blink::mojom::WebBluetoothLeScanFilterPtr filter = CreateScanFilter("a", "b");
base::Optional<WebBluetoothServiceImpl::ScanFilters> filters;
absl::optional<WebBluetoothServiceImpl::ScanFilters> filters;
filters.emplace();
filters->push_back(filter.Clone());
FakeWebBluetoothAdvertisementClientImpl client_impl;
@ -440,7 +440,7 @@ TEST_F(WebBluetoothServiceImplTest,
TEST_F(WebBluetoothServiceImplTest,
BluetoothScanningPermissionRevokedWhenFocusIsLost) {
blink::mojom::WebBluetoothLeScanFilterPtr filter = CreateScanFilter("a", "b");
base::Optional<WebBluetoothServiceImpl::ScanFilters> filters;
absl::optional<WebBluetoothServiceImpl::ScanFilters> filters;
filters.emplace();
filters->push_back(filter.Clone());
FakeWebBluetoothAdvertisementClientImpl client_impl;
@ -458,7 +458,7 @@ TEST_F(WebBluetoothServiceImplTest,
BluetoothScanningPermissionRevokedWhenBlocked) {
blink::mojom::WebBluetoothLeScanFilterPtr filter_1 =
CreateScanFilter("a", "b");
base::Optional<WebBluetoothServiceImpl::ScanFilters> filters_1;
absl::optional<WebBluetoothServiceImpl::ScanFilters> filters_1;
filters_1.emplace();
filters_1->push_back(filter_1.Clone());
FakeWebBluetoothAdvertisementClientImpl client_impl_1;
@ -471,7 +471,7 @@ TEST_F(WebBluetoothServiceImplTest,
blink::mojom::WebBluetoothLeScanFilterPtr filter_2 =
CreateScanFilter("c", "d");
base::Optional<WebBluetoothServiceImpl::ScanFilters> filters_2;
absl::optional<WebBluetoothServiceImpl::ScanFilters> filters_2;
filters_2.emplace();
filters_2->push_back(filter_2.Clone());
FakeWebBluetoothAdvertisementClientImpl client_impl_2;
@ -484,7 +484,7 @@ TEST_F(WebBluetoothServiceImplTest,
blink::mojom::WebBluetoothLeScanFilterPtr filter_3 =
CreateScanFilter("e", "f");
base::Optional<WebBluetoothServiceImpl::ScanFilters> filters_3;
absl::optional<WebBluetoothServiceImpl::ScanFilters> filters_3;
filters_3.emplace();
filters_3->push_back(filter_3.Clone());
FakeWebBluetoothAdvertisementClientImpl client_impl_3;
@ -521,7 +521,7 @@ TEST_F(WebBluetoothServiceImplTest,
base::BindLambdaForTesting(
[&callback_called](
blink::mojom::WebBluetoothResult result,
const base::Optional<std::vector<uint8_t>>& value) {
const absl::optional<std::vector<uint8_t>>& value) {
callback_called = true;
EXPECT_EQ(
blink::mojom::WebBluetoothResult::GATT_OPERATION_IN_PROGRESS,

@ -725,7 +725,7 @@ void BrowserChildProcessHostImpl::RegisterCoordinatorClient(
client_process,
memory_instrumentation::mojom::ProcessType process_type,
base::ProcessId process_id,
base::Optional<std::string> service_name) {
absl::optional<std::string> service_name) {
GetMemoryInstrumentationRegistry()->RegisterClientProcess(
std::move(receiver), std::move(client_process),
process_type, process_id, std::move(service_name));

@ -219,7 +219,7 @@ void BrowserContext::DeliverPushMessage(
const GURL& origin,
int64_t service_worker_registration_id,
const std::string& message_id,
base::Optional<std::string> payload,
absl::optional<std::string> payload,
base::OnceCallback<void(blink::mojom::PushEventStatus)> callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
PushMessagingRouter::DeliverMessage(

@ -301,7 +301,7 @@ class CONTENT_EXPORT BrowserMainLoop {
//
// TODO(fdoray): Move this to a more elaborate class that prevents BEST_EFFORT
// tasks from running when resources are needed to respond to user actions.
base::Optional<base::ThreadPoolInstance::ScopedBestEffortExecutionFence>
absl::optional<base::ThreadPoolInstance::ScopedBestEffortExecutionFence>
scoped_best_effort_execution_fence_;
// Unregister UI thread from hang watching on destruction.

@ -13,7 +13,7 @@
#if defined(OS_POSIX)
#include "base/files/file_descriptor_watcher_posix.h"
#include "base/optional.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#endif
namespace content {
@ -71,7 +71,7 @@ class CONTENT_EXPORT BrowserThreadImpl : public BrowserThread {
#if defined(OS_POSIX)
// Allows usage of the FileDescriptorWatcher API on the UI thread.
base::Optional<base::FileDescriptorWatcher> file_descriptor_watcher_;
absl::optional<base::FileDescriptorWatcher> file_descriptor_watcher_;
#endif
};

@ -10,12 +10,12 @@
#include <vector>
#include "base/callback.h"
#include "base/optional.h"
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_deletion_info.h"
#include "services/network/cookie_manager.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"
@ -63,7 +63,7 @@ void RunTestCase(TestCase test_case,
EXPECT_TRUE(test_url.is_valid()) << test_case.url;
std::unique_ptr<net::CanonicalCookie> cookie =
net::CanonicalCookie::Create(test_url, cookie_line, base::Time::Now(),
base::nullopt /* server_time */);
absl::nullopt /* server_time */);
EXPECT_TRUE(cookie) << cookie_line << " from " << test_case.url
<< " is not a valid cookie";
if (cookie) {
@ -79,7 +79,7 @@ void RunTestCase(TestCase test_case,
cookie_line = std::string("A=2;domain=") + test_url.host();
cookie =
net::CanonicalCookie::Create(test_url, cookie_line, base::Time::Now(),
base::nullopt /* server_time */);
absl::nullopt /* server_time */);
if (cookie) {
EXPECT_EQ(test_case.should_match,
delete_info.Matches(
@ -93,7 +93,7 @@ void RunTestCase(TestCase test_case,
cookie_line = std::string("A=2; HttpOnly;") + test_url.host();
cookie =
net::CanonicalCookie::Create(test_url, cookie_line, base::Time::Now(),
base::nullopt /* server_time */);
absl::nullopt /* server_time */);
if (cookie) {
EXPECT_EQ(test_case.should_match,
delete_info.Matches(
@ -107,7 +107,7 @@ void RunTestCase(TestCase test_case,
cookie_line = std::string("A=2; HttpOnly; Secure;") + test_url.host();
cookie =
net::CanonicalCookie::Create(test_url, cookie_line, base::Time::Now(),
base::nullopt /* server_time */);
absl::nullopt /* server_time */);
if (cookie) {
EXPECT_EQ(test_case.should_match,
delete_info.Matches(

@ -170,7 +170,7 @@ class ClearSiteDataHandlerBrowserTest : public ContentBrowserTest {
storage_partition()->GetCookieManagerForBrowserProcess();
std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create(
url, "A=1", base::Time::Now(), base::nullopt /* server_time */));
url, "A=1", base::Time::Now(), absl::nullopt /* server_time */));
base::RunLoop run_loop;
cookie_manager->SetCanonicalCookie(

@ -6,7 +6,6 @@
#include "base/callback_helpers.h"
#include "base/guid.h"
#include "base/optional.h"
#include "components/services/storage/public/mojom/blob_storage_context.mojom.h"
#include "content/browser/cache_storage/background_fetch_cache_entry_handler_impl.h"
#include "content/browser/cache_storage/cache_storage_manager.h"
@ -18,6 +17,7 @@
#include "storage/browser/blob/blob_data_builder.h"
#include "storage/browser/blob/blob_impl.h"
#include "storage/browser/blob/blob_storage_context.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/blob/blob_utils.h"
namespace content {
@ -214,7 +214,7 @@ int CacheStorageCacheEntryHandler::DiskCacheBlobEntry::GetSize(
void CacheStorageCacheEntryHandler::DiskCacheBlobEntry::Invalidate() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
cache_handle_ = base::nullopt;
cache_handle_ = absl::nullopt;
entry_handler_ = nullptr;
disk_cache_entry_ = nullptr;
}

@ -94,7 +94,7 @@ class CONTENT_EXPORT CacheStorageCacheEntryHandler {
~DiskCacheBlobEntry();
base::WeakPtr<CacheStorageCacheEntryHandler> entry_handler_;
base::Optional<CacheStorageCacheHandle> cache_handle_;
absl::optional<CacheStorageCacheHandle> cache_handle_;
disk_cache::ScopedEntryPtr disk_cache_entry_;
SEQUENCE_CHECKER(sequence_checker_);

@ -360,7 +360,7 @@ std::string CopySideData(blink::mojom::Blob* actual_blob) {
std::string output;
base::RunLoop loop;
actual_blob->ReadSideData(base::BindLambdaForTesting(
[&](const base::Optional<mojo_base::BigBuffer> data) {
[&](const absl::optional<mojo_base::BigBuffer> data) {
if (data)
output.append(data->data(), data->data() + data->size());
loop.Quit();
@ -669,7 +669,7 @@ class CacheStorageCacheTest : public testing::Test {
network::mojom::FetchResponseSource::kUnspecified,
base::flat_map<std::string, std::string>(kHeaders.cbegin(),
kHeaders.cend()),
/*mime_type=*/base::nullopt, net::HttpRequestHeaders::kGetMethod,
/*mime_type=*/absl::nullopt, net::HttpRequestHeaders::kGetMethod,
/*blob=*/nullptr, blink::mojom::ServiceWorkerResponseError::kUnknown,
response_time_, /*cache_storage_cache_name=*/std::string(),
/*cors_exposed_header_names=*/std::vector<std::string>(),
@ -679,7 +679,7 @@ class CacheStorageCacheTest : public testing::Test {
net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN,
/*alpn_negotiated_protocol=*/"unknown",
/*was_fetched_via_spdy=*/false, /*has_range_requested=*/false,
/*auth_challenge_info=*/base::nullopt);
/*auth_challenge_info=*/absl::nullopt);
}
void CopySideDataToResponse(const std::string& uuid,
@ -907,7 +907,7 @@ class CacheStorageCacheTest : public testing::Test {
}
void ErrorTypeCallback(base::RunLoop* run_loop, CacheStorageError error) {
callback_message_ = base::nullopt;
callback_message_ = absl::nullopt;
callback_error_ = error;
if (run_loop)
run_loop->Quit();
@ -1018,7 +1018,7 @@ class CacheStorageCacheTest : public testing::Test {
std::string expected_blob_data_;
CacheStorageError callback_error_ = CacheStorageError::kSuccess;
base::Optional<std::string> callback_message_ = base::nullopt;
absl::optional<std::string> callback_message_ = absl::nullopt;
blink::mojom::FetchAPIResponsePtr callback_response_;
std::vector<std::string> callback_strings_;
std::string bad_message_reason_;

@ -61,7 +61,7 @@ class CONTENT_EXPORT CacheStorageControlWrapper
private:
SEQUENCE_CHECKER(sequence_checker_);
base::Optional<storage::StoragePolicyObserver> storage_policy_observer_;
absl::optional<storage::StoragePolicyObserver> storage_policy_observer_;
base::SequenceBound<CacheStorageContextImpl> cache_storage_context_;
mojo::Remote<storage::mojom::CacheStorageControl> cache_storage_control_;

@ -140,7 +140,7 @@ bool ResponseBlockedByCrossOriginResourcePolicy(
if (response->response_type != FetchResponseType::kOpaque)
return false;
base::Optional<std::string> corp_header_value;
absl::optional<std::string> corp_header_value;
auto corp_header =
response->headers.find(network::CrossOriginResourcePolicy::kHeaderName);
if (corp_header != response->headers.end())
@ -559,7 +559,7 @@ class CacheStorageDispatcherHost::CacheImpl
content::CacheStorageCache* cache = cache_handle_.value();
if (!cache) {
std::move(cb).Run(CacheStorageVerboseError::New(
CacheStorageError::kErrorNotFound, base::nullopt));
CacheStorageError::kErrorNotFound, absl::nullopt));
return;
}

@ -640,7 +640,7 @@ class CacheStorageManagerTest : public testing::Test {
auto response = blink::mojom::FetchAPIResponse::New(
std::vector<GURL>({request->url}), status_code, "OK", response_type,
padding, network::mojom::FetchResponseSource::kUnspecified,
response_headers, /*mime_type=*/base::nullopt,
response_headers, /*mime_type=*/absl::nullopt,
net::HttpRequestHeaders::kGetMethod, std::move(blob),
blink::mojom::ServiceWorkerResponseError::kUnknown, base::Time(),
/*cache_storage_cache_name=*/std::string(),
@ -651,7 +651,7 @@ class CacheStorageManagerTest : public testing::Test {
net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN,
/*alpn_negotiated_protocol=*/"unknown",
/*was_fetched_via_spdy=*/false, /*has_range_requested=*/false,
/*auth_challenge_info=*/base::nullopt);
/*auth_challenge_info=*/absl::nullopt);
blink::mojom::BatchOperationPtr operation =
blink::mojom::BatchOperation::New();

@ -424,11 +424,11 @@ blink::mojom::FetchAPIResponsePtr CreateResponse(
? metadata.response().alpn_negotiated_protocol()
: "unknown";
base::Optional<std::string> mime_type;
absl::optional<std::string> mime_type;
if (metadata.response().has_mime_type())
mime_type = metadata.response().mime_type();
base::Optional<std::string> request_method;
absl::optional<std::string> request_method;
if (metadata.response().has_request_method())
request_method = metadata.response().request_method();
@ -463,7 +463,7 @@ blink::mojom::FetchAPIResponsePtr CreateResponse(
static_cast<net::HttpResponseInfo::ConnectionInfo>(
metadata.response().connection_info()),
alpn_negotiated_protocol, metadata.response().was_fetched_via_spdy(),
/*has_range_requested=*/false, /*auth_challenge_info=*/base::nullopt);
/*has_range_requested=*/false, /*auth_challenge_info=*/absl::nullopt);
}
int64_t CalculateSideDataPadding(
@ -700,7 +700,7 @@ void LegacyCacheStorageCache::BatchOperation(
// This method may produce a warning message that should be returned in the
// final VerboseErrorCallback. A message may be present in both the failure
// and success paths.
base::Optional<std::string> message;
absl::optional<std::string> message;
if (backend_state_ == BACKEND_CLOSED) {
scheduler_task_runner_->PostTask(
@ -794,7 +794,7 @@ void LegacyCacheStorageCache::BatchDidGetUsageAndQuota(
int64_t trace_id,
VerboseErrorCallback callback,
BadMessageCallback bad_message_callback,
base::Optional<std::string> message,
absl::optional<std::string> message,
uint64_t space_required,
uint64_t side_data_size,
blink::mojom::QuotaStatusCode status_code,
@ -883,7 +883,7 @@ void LegacyCacheStorageCache::BatchDidGetUsageAndQuota(
void LegacyCacheStorageCache::BatchDidOneOperation(
base::OnceClosure completion_closure,
VerboseErrorCallback error_callback,
base::Optional<std::string> message,
absl::optional<std::string> message,
int64_t trace_id,
CacheStorageError error) {
TRACE_EVENT_WITH_FLOW0("CacheStorage",
@ -902,7 +902,7 @@ void LegacyCacheStorageCache::BatchDidOneOperation(
void LegacyCacheStorageCache::BatchDidAllOperations(
VerboseErrorCallback callback,
base::Optional<std::string> message,
absl::optional<std::string> message,
int64_t trace_id) {
TRACE_EVENT_WITH_FLOW0("CacheStorage",
"LegacyCacheStorageCache::BatchDidAllOperations",

@ -16,7 +16,6 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "components/services/storage/public/mojom/cache_storage_control.mojom.h"
#include "content/browser/cache_storage/blob_storage_context_wrapper.h"
#include "content/browser/cache_storage/cache_storage_cache.h"
@ -26,6 +25,7 @@
#include "net/base/completion_once_callback.h"
#include "net/base/io_buffer.h"
#include "net/disk_cache/disk_cache.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom.h"
#include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
#include "url/origin.h"
@ -108,7 +108,7 @@ class CONTENT_EXPORT LegacyCacheStorageCache : public CacheStorageCache {
int64_t trace_id,
VerboseErrorCallback callback,
BadMessageCallback bad_message_callback,
base::Optional<std::string> message,
absl::optional<std::string> message,
uint64_t space_required,
uint64_t side_data_size,
blink::mojom::QuotaStatusCode status_code,
@ -119,13 +119,13 @@ class CONTENT_EXPORT LegacyCacheStorageCache : public CacheStorageCache {
// completion.
void BatchDidOneOperation(base::OnceClosure completion_closure,
VerboseErrorCallback error_callback,
base::Optional<std::string> message,
absl::optional<std::string> message,
int64_t trace_id,
blink::mojom::CacheStorageError error);
// Callback invoked once all BatchDidOneOperation() calls have run.
// Invokes |error_callback|.
void BatchDidAllOperations(VerboseErrorCallback error_callback,
base::Optional<std::string> message,
absl::optional<std::string> message,
int64_t trace_id);
void Keys(blink::mojom::FetchAPIRequestPtr request,

@ -11,7 +11,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "base/process/kill.h"
#include "base/process/process.h"
#include "base/sequenced_task_runner.h"
@ -20,6 +19,7 @@
#include "content/public/common/zygote/zygote_buildflags.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"
#if !defined(OS_FUCHSIA)
#include "mojo/public/cpp/platform/named_platform_channel.h"
@ -115,9 +115,9 @@ class ChildProcessLauncherHelper :
#if !defined(OS_FUCHSIA)
// Called to give implementors a chance at creating a server pipe. Platform-
// specific. Returns |base::nullopt| if the helper should initialize
// specific. Returns |absl::nullopt| if the helper should initialize
// a regular PlatformChannel for communication instead.
base::Optional<mojo::NamedPlatformChannel>
absl::optional<mojo::NamedPlatformChannel>
CreateNamedPlatformChannelOnClientThread();
#endif
@ -224,13 +224,13 @@ class ChildProcessLauncherHelper :
// child process in most cases. Only used if the platform's helper
// implementation doesn't return a server endpoint from
// |CreateNamedPlatformChannelOnClientThread()|.
base::Optional<mojo::PlatformChannel> mojo_channel_;
absl::optional<mojo::PlatformChannel> mojo_channel_;
#if !defined(OS_FUCHSIA)
// May be used in exclusion to the above if the platform helper implementation
// returns a valid server endpoint from
// |CreateNamedPlatformChannelOnClientThread()|.
base::Optional<mojo::NamedPlatformChannel> mojo_named_channel_;
absl::optional<mojo::NamedPlatformChannel> mojo_named_channel_;
#endif
bool terminate_on_shutdown_;

@ -61,9 +61,9 @@ void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() {
!command_line()->HasSwitch(sandbox::policy::switches::kNoSandbox));
}
base::Optional<mojo::NamedPlatformChannel>
absl::optional<mojo::NamedPlatformChannel>
ChildProcessLauncherHelper::CreateNamedPlatformChannelOnClientThread() {
return base::nullopt;
return absl::nullopt;
}
std::unique_ptr<PosixFileDescriptorInfo>

@ -25,10 +25,10 @@
namespace content {
namespace internal {
base::Optional<mojo::NamedPlatformChannel>
absl::optional<mojo::NamedPlatformChannel>
ChildProcessLauncherHelper::CreateNamedPlatformChannelOnClientThread() {
DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
return base::nullopt;
return absl::nullopt;
}
void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() {

@ -28,10 +28,10 @@
namespace content {
namespace internal {
base::Optional<mojo::NamedPlatformChannel>
absl::optional<mojo::NamedPlatformChannel>
ChildProcessLauncherHelper::CreateNamedPlatformChannelOnClientThread() {
DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
return base::nullopt;
return absl::nullopt;
}
void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() {

@ -26,12 +26,12 @@ void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() {
DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
}
base::Optional<mojo::NamedPlatformChannel>
absl::optional<mojo::NamedPlatformChannel>
ChildProcessLauncherHelper::CreateNamedPlatformChannelOnClientThread() {
DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
if (!delegate_->ShouldLaunchElevated())
return base::nullopt;
return absl::nullopt;
mojo::NamedPlatformChannel::Options options;
mojo::NamedPlatformChannel named_channel(options);

@ -2063,7 +2063,7 @@ bool ChildProcessSecurityPolicyImpl::IsGloballyIsolatedOriginForTesting(
}
std::vector<url::Origin> ChildProcessSecurityPolicyImpl::GetIsolatedOrigins(
base::Optional<IsolatedOriginSource> source,
absl::optional<IsolatedOriginSource> source,
BrowserContext* browser_context) {
std::vector<url::Origin> origins;
base::AutoLock isolated_origins_lock(isolated_origins_lock_);

@ -184,7 +184,7 @@ class CONTENT_EXPORT ProcessLock {
// TODO(creis): Consider tracking multiple compatible SiteInfos in ProcessLock
// (e.g., multiple extensions). This can better restrict what the process has
// access to in cases that we don't currently use a ProcessLock.
base::Optional<SiteInfo> site_info_;
absl::optional<SiteInfo> site_info_;
};
CONTENT_EXPORT std::ostream& operator<<(std::ostream& out,
@ -324,7 +324,7 @@ class CONTENT_EXPORT ChildProcessSecurityPolicyImpl
BrowserContext* browser_context = nullptr) override;
bool IsGloballyIsolatedOriginForTesting(const url::Origin& origin) override;
std::vector<url::Origin> GetIsolatedOrigins(
base::Optional<IsolatedOriginSource> source = base::nullopt,
absl::optional<IsolatedOriginSource> source = absl::nullopt,
BrowserContext* browser_context = nullptr) override;
bool IsIsolatedSiteFromSource(const url::Origin& origin,
IsolatedOriginSource source) override;

@ -11,7 +11,6 @@
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/numerics/safe_conversions.h"
#include "base/optional.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
@ -34,6 +33,7 @@
#include "net/nqe/network_quality_estimator_params.h"
#include "services/network/public/cpp/client_hints.h"
#include "services/network/public/cpp/network_quality_tracker.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/device_memory/approximated_device_memory.h"
#include "third_party/blink/public/common/page/page_zoom.h"
@ -76,7 +76,7 @@ double GetRandomMultiplier(const std::string& host) {
}
unsigned long RoundRtt(const std::string& host,
const base::Optional<base::TimeDelta>& rtt) {
const absl::optional<base::TimeDelta>& rtt) {
if (!rtt.has_value()) {
// RTT is unavailable. So, return the fastest value.
return 0;
@ -95,7 +95,7 @@ unsigned long RoundRtt(const std::string& host,
}
double RoundKbpsToMbps(const std::string& host,
const base::Optional<int32_t>& downlink_kbps) {
const absl::optional<int32_t>& downlink_kbps) {
// Limit the size of the buckets and the maximum reported value to reduce
// fingerprinting.
static const size_t kGranularityKbps = 50;
@ -173,23 +173,23 @@ std::string DoubleToSpecCompliantString(double value) {
// Return the effective connection type value overridden for web APIs.
// If no override value has been set, a null value is returned.
base::Optional<net::EffectiveConnectionType>
absl::optional<net::EffectiveConnectionType>
GetWebHoldbackEffectiveConnectionType() {
if (!base::FeatureList::IsEnabled(
features::kNetworkQualityEstimatorWebHoldback)) {
return base::nullopt;
return absl::nullopt;
}
std::string effective_connection_type_param =
base::GetFieldTrialParamValueByFeature(
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);
if (!effective_connection_type)
return base::nullopt;
return absl::nullopt;
DCHECK_NE(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN,
effective_connection_type.value());
return effective_connection_type;
@ -276,7 +276,7 @@ void AddRttHeader(net::HttpRequestHeaders* headers,
const GURL& url) {
DCHECK(headers);
base::Optional<net::EffectiveConnectionType> web_holdback_ect =
absl::optional<net::EffectiveConnectionType> web_holdback_ect =
GetWebHoldbackEffectiveConnectionType();
base::TimeDelta http_rtt;
@ -297,7 +297,7 @@ void AddDownlinkHeader(net::HttpRequestHeaders* headers,
network::NetworkQualityTracker* network_quality_tracker,
const GURL& url) {
DCHECK(headers);
base::Optional<net::EffectiveConnectionType> web_holdback_ect =
absl::optional<net::EffectiveConnectionType> web_holdback_ect =
GetWebHoldbackEffectiveConnectionType();
int32_t downlink_throughput_kbps;
@ -328,7 +328,7 @@ void AddEctHeader(net::HttpRequestHeaders* headers,
DCHECK_EQ(blink::kWebEffectiveConnectionTypeMappingCount,
static_cast<size_t>(net::EFFECTIVE_CONNECTION_TYPE_LAST));
base::Optional<net::EffectiveConnectionType> web_holdback_ect =
absl::optional<net::EffectiveConnectionType> web_holdback_ect =
GetWebHoldbackEffectiveConnectionType();
int effective_connection_type;
@ -462,14 +462,14 @@ void UpdateNavigationRequestClientUaHeadersImpl(
FrameTreeNode* frame_tree_node,
ClientUaHeaderCallType call_type,
net::HttpRequestHeaders* headers) {
base::Optional<blink::UserAgentMetadata> ua_metadata;
absl::optional<blink::UserAgentMetadata> ua_metadata;
bool disable_due_to_custom_ua = false;
if (override_ua) {
NavigatorDelegate* nav_delegate =
frame_tree_node ? frame_tree_node->navigator().GetDelegate() : nullptr;
ua_metadata =
nav_delegate ? nav_delegate->GetUserAgentOverride().ua_metadata_override
: base::nullopt;
: absl::nullopt;
// If a custom UA override is set, but no value is provided for UA client
// hints, disable them.
disable_due_to_custom_ua = !ua_metadata.has_value();
@ -570,12 +570,12 @@ bool ShouldAddClientHints(const GURL& url,
}
unsigned long RoundRttForTesting(const std::string& host,
const base::Optional<base::TimeDelta>& rtt) {
const absl::optional<base::TimeDelta>& rtt) {
return RoundRtt(host, rtt);
}
double RoundKbpsToMbpsForTesting(const std::string& host,
const base::Optional<int32_t>& downlink_kbps) {
const absl::optional<int32_t>& downlink_kbps) {
return RoundKbpsToMbps(host, downlink_kbps);
}
@ -717,7 +717,7 @@ void AddNavigationRequestClientHintsHeaders(
container_policy);
}
base::Optional<std::vector<network::mojom::WebClientHintsType>>
absl::optional<std::vector<network::mojom::WebClientHintsType>>
ParseAndPersistAcceptCHForNagivation(
const GURL& url,
const ::network::mojom::ParsedHeadersPtr& headers,
@ -729,10 +729,10 @@ ParseAndPersistAcceptCHForNagivation(
DCHECK(headers);
if (!headers->accept_ch)
return base::nullopt;
return absl::nullopt;
if (!IsValidURLForClientHints(url))
return base::nullopt;
return absl::nullopt;
// Client hints should only be enabled when JavaScript is enabled. Platforms
// which enable/disable JavaScript on a per-origin basis should implement
@ -741,18 +741,18 @@ ParseAndPersistAcceptCHForNagivation(
// WebPreferences setting.
if (!delegate->IsJavaScriptAllowed(url) ||
!IsJavascriptEnabled(frame_tree_node)) {
return base::nullopt;
return absl::nullopt;
}
// Only the main frame should parse accept-CH.
if (!frame_tree_node->IsMainFrame())
return base::nullopt;
return absl::nullopt;
base::Optional<std::vector<network::mojom::WebClientHintsType>> parsed =
absl::optional<std::vector<network::mojom::WebClientHintsType>> parsed =
blink::FilterAcceptCH(headers->accept_ch.value(), LangClientHintEnabled(),
delegate->UserAgentClientHintEnabled());
if (!parsed.has_value())
return base::nullopt;
return absl::nullopt;
base::TimeDelta persist_duration;
if (IsPermissionsPolicyForClientHintsEnabled()) {

Some files were not shown because too many files have changed in this diff Show More