components: 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: If697b7bf69b199c1796f873eedca3359cdb48c64
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897151
Commit-Queue: Anton Bikineev <[email protected]>
Owners-Override: Anton Bikineev <[email protected]>
Reviewed-by: Peter Kasting <[email protected]>
Cr-Commit-Position: refs/heads/master@{#883296}
diff --git a/components/bookmarks/browser/bookmark_model.cc b/components/bookmarks/browser/bookmark_model.cc
index 8b44e07..6b645872 100644
--- a/components/bookmarks/browser/bookmark_model.cc
+++ b/components/bookmarks/browser/bookmark_model.cc
@@ -579,7 +579,7 @@
size_t index,
const std::u16string& title,
const BookmarkNode::MetaInfoMap* meta_info,
- base::Optional<base::GUID> guid) {
+ absl::optional<base::GUID> guid) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(loaded_);
DCHECK(parent);
@@ -606,8 +606,8 @@
const std::u16string& title,
const GURL& url,
const BookmarkNode::MetaInfoMap* meta_info,
- base::Optional<base::Time> creation_time,
- base::Optional<base::GUID> guid) {
+ absl::optional<base::Time> creation_time,
+ absl::optional<base::GUID> guid) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(loaded_);
DCHECK(url.is_valid());
diff --git a/components/bookmarks/browser/bookmark_model.h b/components/bookmarks/browser/bookmark_model.h
index 33c7167f..2aa13d8 100644
--- a/components/bookmarks/browser/bookmark_model.h
+++ b/components/bookmarks/browser/bookmark_model.h
@@ -211,7 +211,7 @@
size_t index,
const std::u16string& title,
const BookmarkNode::MetaInfoMap* meta_info = nullptr,
- base::Optional<base::GUID> guid = base::nullopt);
+ absl::optional<base::GUID> guid = absl::nullopt);
// Adds a url at the specified position with the given |creation_time|,
// |meta_info| and |guid|. If no GUID is provided (i.e. nullopt), then a
@@ -222,8 +222,8 @@
const std::u16string& title,
const GURL& url,
const BookmarkNode::MetaInfoMap* meta_info = nullptr,
- base::Optional<base::Time> creation_time = base::nullopt,
- base::Optional<base::GUID> guid = base::nullopt);
+ absl::optional<base::Time> creation_time = absl::nullopt,
+ absl::optional<base::GUID> guid = absl::nullopt);
// Sorts the children of |parent|, notifying observers by way of the
// BookmarkNodeChildrenReordered method.
diff --git a/components/bookmarks/browser/titled_url_index.cc b/components/bookmarks/browser/titled_url_index.cc
index 3ecffe6..f4e9a8b3 100644
--- a/components/bookmarks/browser/titled_url_index.cc
+++ b/components/bookmarks/browser/titled_url_index.cc
@@ -106,7 +106,7 @@
std::vector<TitledUrlMatch> results;
for (TitledUrlNodes::const_iterator i = sorted_nodes.begin();
i != sorted_nodes.end() && results.size() < max_count; ++i) {
- base::Optional<TitledUrlMatch> match =
+ absl::optional<TitledUrlMatch> match =
MatchTitledUrlNodeWithQuery(*i, query_nodes, match_ancestor_titles);
if (match)
results.push_back(match.value());
@@ -123,12 +123,12 @@
}
}
-base::Optional<TitledUrlMatch> TitledUrlIndex::MatchTitledUrlNodeWithQuery(
+absl::optional<TitledUrlMatch> TitledUrlIndex::MatchTitledUrlNodeWithQuery(
const TitledUrlNode* node,
const query_parser::QueryNodeVector& query_nodes,
bool match_ancestor_titles) {
if (!node) {
- return base::nullopt;
+ return absl::nullopt;
}
// Check that the result matches the query. The previous search
// was a simple per-word search, while the more complex matching
@@ -162,7 +162,7 @@
query_has_ancestor_matches =
query_has_ancestor_matches || has_ancestor_matches;
if (!has_title_matches && !has_url_matches && !has_ancestor_matches)
- return base::nullopt;
+ return absl::nullopt;
query_parser::QueryParser::SortAndCoalesceMatchPositions(&title_matches);
query_parser::QueryParser::SortAndCoalesceMatchPositions(&url_matches);
}
diff --git a/components/bookmarks/browser/titled_url_index.h b/components/bookmarks/browser/titled_url_index.h
index 5348c0c..6420879 100644
--- a/components/bookmarks/browser/titled_url_index.h
+++ b/components/bookmarks/browser/titled_url_index.h
@@ -13,9 +13,9 @@
#include "base/containers/flat_set.h"
#include "base/macros.h"
-#include "base/optional.h"
#include "components/bookmarks/browser/titled_url_node_sorter.h"
#include "components/query_parser/query_parser.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
namespace bookmarks {
@@ -82,7 +82,7 @@
// Finds |query_nodes| matches in |node| and returns a TitledUrlMatch
// containing |node| and the matches.
- base::Optional<TitledUrlMatch> MatchTitledUrlNodeWithQuery(
+ absl::optional<TitledUrlMatch> MatchTitledUrlNodeWithQuery(
const TitledUrlNode* node,
const query_parser::QueryNodeVector& query_nodes,
bool match_ancestor_titles);