summaryrefslogtreecommitdiff
path: root/chromium/ui/base/template_expressions.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/base/template_expressions.cc')
-rw-r--r--chromium/ui/base/template_expressions.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/chromium/ui/base/template_expressions.cc b/chromium/ui/base/template_expressions.cc
index 34064ebadd1..c28d58da732 100644
--- a/chromium/ui/base/template_expressions.cc
+++ b/chromium/ui/base/template_expressions.cc
@@ -9,11 +9,12 @@
#include <ostream>
#include "base/check_op.h"
-#include "base/optional.h"
#include "base/stl_util.h"
+#include "base/strings/string_piece.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
#include "net/base/escape.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#if DCHECK_IS_ON()
#include "third_party/re2/src/re2/re2.h" // nogncheck
@@ -94,7 +95,7 @@ std::string PolymerParameterEscape(const std::string& in_string,
}
bool EscapeForJS(const std::string& in_string,
- base::Optional<char> in_previous,
+ absl::optional<char> in_previous,
std::string* out_string) {
out_string->reserve(in_string.size() * 2);
bool last_was_dollar = in_previous && in_previous.value() == '$';
@@ -160,8 +161,7 @@ bool ReplaceTemplateExpressionsInternal(
size_t key_end = source.find(kKeyClose, current_pos);
CHECK_NE(key_end, std::string::npos);
- std::string key =
- source.substr(current_pos, key_end - current_pos).as_string();
+ std::string key(source.substr(current_pos, key_end - current_pos));
CHECK(!key.empty());
auto value = replacements.find(key);
@@ -171,9 +171,9 @@ bool ReplaceTemplateExpressionsInternal(
std::string replacement = value->second;
if (is_javascript) {
// Run JS escaping first.
- base::Optional<char> last = formatted->empty()
- ? base::nullopt
- : base::make_optional(formatted->back());
+ absl::optional<char> last = formatted->empty()
+ ? absl::nullopt
+ : absl::make_optional(formatted->back());
std::string escaped_replacement;
if (!EscapeForJS(replacement, last, &escaped_replacement))
return false;
@@ -240,12 +240,12 @@ bool ReplaceTemplateExpressionsInJS(base::StringPiece source,
// If there are no more templates, copy the remaining JS to the output and
// return true.
if (current_template.type == NONE) {
- formatted->append(remaining.as_string());
+ formatted->append(std::string(remaining));
return true;
}
// Copy the JS before the template to the output.
- formatted->append(remaining.substr(0, current_template.start).as_string());
+ formatted->append(std::string(remaining.substr(0, current_template.start)));
// Retrieve the HTML portion of the source.
base::StringPiece html_template =