pdf, printing, remoting, rlz: Replace base::Optional with absl::optional
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: Ia67dd633d2451a6dd3a0d907a68ab186caa64372 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2897248 Auto-Submit: Anton Bikineev <bikineev@chromium.org> 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@{#883288}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
60ef3818ac
commit
11eb7ff7f2
pdf
accessibility.ccaccessibility_helper.ccout_of_process_instance.ccpdf.ccpdf.hpdf_engine.h
pdf_utils
pdf_view_plugin_base.ccpdfium
findtext_unittest.ccpdfium_api_string_buffer_adapter.hpdfium_engine.ccpdfium_engine.hpdfium_engine_exports.ccpdfium_engine_exports.hpdfium_engine_exports_unittest.ccpdfium_page.ccpdfium_page.hpdfium_page_unittest.ccpdfium_print_unittest.cc
ui
printing
backend
common
print_settings.ccprint_settings.hprint_settings_conversion.ccprint_settings_conversion_unittest.ccprinting_context_chromeos.hremoting
base
client
display
jni
notification
host
client_session.ccdesktop_environment_options.ccdesktop_session_agent.hdesktop_session_proxy.ccdesktop_session_proxy.h
file_transfer
buffered_file_writer_unittest.ccfake_file_operations.ccfake_file_operations.hfile_operations.hfile_transfer_message_handler.hfile_transfer_message_handler_unittest.ccipc_file_operations.hipc_file_operations_unittest.cclocal_file_operations.cclocal_file_operations_unittest.ccrtc_log_file_operations_unittest.cc
input_injector_win.ccinput_injector_x11.ccit2me
keyboard_layout_monitor_linux.cckeyboard_layout_monitor_mac.cclinux
token_validator_base.ccxsession_chooser_linux.ccios
protocol
fake_stream_socket.hfile_transfer_helpers.ccfile_transfer_helpers.hpeer_connection_controls.hwebrtc_transport.ccwebrtc_transport.h
test
rlz/chromeos/lib
@ -58,7 +58,7 @@ bool GetAccessibilityInfo(PDFEngine* engine,
|
||||
|
||||
int char_index = 0;
|
||||
while (char_index < char_count) {
|
||||
base::Optional<AccessibilityTextRunInfo> text_run_info_result =
|
||||
absl::optional<AccessibilityTextRunInfo> text_run_info_result =
|
||||
engine->GetTextRunInfo(page_index, char_index);
|
||||
DCHECK(text_run_info_result.has_value());
|
||||
const auto& text_run_info = text_run_info_result.value();
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/numerics/safe_math.h"
|
||||
#include "base/optional.h"
|
||||
#include "pdf/accessibility_structs.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace chrome_pdf {
|
||||
|
||||
@ -38,7 +38,7 @@ AccessibilityTextRunRangeInfo GetEnclosingTextRunRangeForCharRange(
|
||||
return text_range;
|
||||
uint32_t end_char_index = checked_end_char_index.ValueOrDie();
|
||||
uint32_t current_char_index = 0;
|
||||
base::Optional<uint32_t> start_text_run;
|
||||
absl::optional<uint32_t> start_text_run;
|
||||
for (size_t i = 0; i < text_runs.size(); ++i) {
|
||||
if (!start_text_run.has_value() &&
|
||||
IsCharWithinTextRun(text_runs[i], current_char_index,
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@ -57,6 +56,7 @@
|
||||
#include "ppapi/cpp/size.h"
|
||||
#include "ppapi/cpp/var_array_buffer.h"
|
||||
#include "ppapi/cpp/var_dictionary.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/blink/public/common/input/web_input_event.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
@ -632,7 +632,7 @@ void OutOfProcessInstance::GetPrintPresetOptionsFromDocument(
|
||||
static_cast<PP_PrivateDuplexMode_Dev>(engine()->GetDuplexType());
|
||||
options->copies = engine()->GetCopiesToPrint();
|
||||
|
||||
base::Optional<gfx::Size> uniform_page_size =
|
||||
absl::optional<gfx::Size> uniform_page_size =
|
||||
engine()->GetUniformPageSizePoints();
|
||||
options->is_page_size_uniform = PP_FromBool(uniform_page_size.has_value());
|
||||
options->uniform_page_size = PPSizeFromSize(
|
||||
|
@ -93,7 +93,7 @@ bool GetPDFDocInfo(base::span<const uint8_t> pdf_buffer,
|
||||
return engine_exports->GetPDFDocInfo(pdf_buffer, page_count, max_page_width);
|
||||
}
|
||||
|
||||
base::Optional<bool> IsPDFDocTagged(base::span<const uint8_t> pdf_buffer) {
|
||||
absl::optional<bool> IsPDFDocTagged(base::span<const uint8_t> pdf_buffer) {
|
||||
ScopedSdkInitializer scoped_sdk_initializer(/*enable_v8=*/true);
|
||||
PDFEngineExports* engine_exports = PDFEngineExports::Get();
|
||||
return engine_exports->IsPDFDocTagged(pdf_buffer);
|
||||
@ -106,7 +106,7 @@ base::Value GetPDFStructTreeForPage(base::span<const uint8_t> pdf_buffer,
|
||||
return engine_exports->GetPDFStructTreeForPage(pdf_buffer, page_index);
|
||||
}
|
||||
|
||||
base::Optional<gfx::SizeF> GetPDFPageSizeByIndex(
|
||||
absl::optional<gfx::SizeF> GetPDFPageSizeByIndex(
|
||||
base::span<const uint8_t> pdf_buffer,
|
||||
int page_number) {
|
||||
ScopedSdkInitializer scoped_sdk_initializer(/*enable_v8=*/true);
|
||||
|
@ -8,10 +8,10 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/containers/span.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/values.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
@ -110,7 +110,7 @@ bool GetPDFDocInfo(base::span<const uint8_t> pdf_buffer,
|
||||
// Whether the PDF is Tagged (see 10.7 "Tagged PDF" in PDF Reference 1.7).
|
||||
// Returns true if it's a tagged (accessible) PDF, false if it's a valid
|
||||
// PDF but untagged, and nullopt if the PDF can't be parsed.
|
||||
base::Optional<bool> IsPDFDocTagged(base::span<const uint8_t> pdf_buffer);
|
||||
absl::optional<bool> IsPDFDocTagged(base::span<const uint8_t> pdf_buffer);
|
||||
|
||||
// Given a tagged PDF (see IsPDFDocTagged, above), return the portion of
|
||||
// the structure tree for a given page as a hierarchical tree of base::Values.
|
||||
@ -124,7 +124,7 @@ base::Value GetPDFStructTreeForPage(base::span<const uint8_t> pdf_buffer,
|
||||
// of.
|
||||
// Returns the size of the page in points, or nullopt if the document or the
|
||||
// page number are not valid.
|
||||
base::Optional<gfx::SizeF> GetPDFPageSizeByIndex(
|
||||
absl::optional<gfx::SizeF> GetPDFPageSizeByIndex(
|
||||
base::span<const uint8_t> pdf_buffer,
|
||||
int page_number);
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/containers/span.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/values.h"
|
||||
#include "build/build_config.h"
|
||||
@ -24,6 +23,7 @@
|
||||
#include "ppapi/cpp/completion_callback.h"
|
||||
#include "ppapi/cpp/private/pdf.h"
|
||||
#include "ppapi/cpp/url_loader.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/base/cursor/mojom/cursor_type.mojom-forward.h"
|
||||
#include "ui/base/window_open_disposition.h"
|
||||
@ -372,7 +372,7 @@ class PDFEngine {
|
||||
// Gets the number of pages in the document.
|
||||
virtual int GetNumberOfPages() const = 0;
|
||||
// Gets the named destination by name.
|
||||
virtual base::Optional<PDFEngine::NamedDestination> GetNamedDestination(
|
||||
virtual absl::optional<PDFEngine::NamedDestination> GetNamedDestination(
|
||||
const std::string& destination) = 0;
|
||||
// Gets the index of the most visible page, or -1 if none are visible.
|
||||
virtual int GetMostVisiblePage() = 0;
|
||||
@ -393,9 +393,9 @@ class PDFEngine {
|
||||
virtual uint32_t GetCharUnicode(int page_index, int char_index) = 0;
|
||||
// Given a start char index, find the longest continuous run of text that's
|
||||
// in a single direction and with the same text style. Return a filled out
|
||||
// AccessibilityTextRunInfo on success or base::nullopt on failure. e.g. When
|
||||
// AccessibilityTextRunInfo on success or absl::nullopt on failure. e.g. When
|
||||
// `start_char_index` is out of bounds.
|
||||
virtual base::Optional<AccessibilityTextRunInfo> GetTextRunInfo(
|
||||
virtual absl::optional<AccessibilityTextRunInfo> GetTextRunInfo(
|
||||
int page_index,
|
||||
int start_char_index) = 0;
|
||||
// For all the links on page `page_index`, get their urls, underlying text
|
||||
@ -427,8 +427,8 @@ class PDFEngine {
|
||||
// Returns the duplex setting.
|
||||
virtual int GetDuplexType() = 0;
|
||||
// Returns the uniform page size of the document in points. Returns
|
||||
// `base::nullopt` if the document has more than one page size.
|
||||
virtual base::Optional<gfx::Size> GetUniformPageSizePoints() = 0;
|
||||
// `absl::nullopt` if the document has more than one page size.
|
||||
virtual absl::optional<gfx::Size> GetUniformPageSizePoints() = 0;
|
||||
|
||||
// Returns a list of Values of Bookmarks. Each Bookmark is a dictionary Value
|
||||
// which contains the following key/values:
|
||||
@ -553,7 +553,7 @@ class PDFEngineExports {
|
||||
// Whether the PDF is Tagged (see 10.7 "Tagged PDF" in PDF Reference 1.7).
|
||||
// Returns true if it's a tagged (accessible) PDF, false if it's a valid
|
||||
// PDF but untagged, and nullopt if the PDF can't be parsed.
|
||||
virtual base::Optional<bool> IsPDFDocTagged(
|
||||
virtual absl::optional<bool> IsPDFDocTagged(
|
||||
base::span<const uint8_t> pdf_buffer) = 0;
|
||||
|
||||
// Given a tagged PDF (see IsPDFDocTagged, above), return the portion of
|
||||
@ -563,7 +563,7 @@ class PDFEngineExports {
|
||||
int page_index) = 0;
|
||||
|
||||
// See the definition of GetPDFPageSizeByIndex in pdf.cc for details.
|
||||
virtual base::Optional<gfx::SizeF> GetPDFPageSizeByIndex(
|
||||
virtual absl::optional<gfx::SizeF> GetPDFPageSizeByIndex(
|
||||
base::span<const uint8_t> pdf_buffer,
|
||||
int page_number) = 0;
|
||||
};
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/time/time.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace chrome_pdf {
|
||||
|
||||
@ -27,9 +27,9 @@ class DateDeserializer final {
|
||||
// Pops the first `num_digits` characters from the string and converts them to
|
||||
// an int if possible. Popping too many characters or characters that cannot
|
||||
// be converted puts the deserializer in a stopped state.
|
||||
base::Optional<int> PopDigits(size_t num_digits) {
|
||||
absl::optional<int> PopDigits(size_t num_digits) {
|
||||
if (stopped_)
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
// `base::StringToUint()` allows leading sign characters, so also verify
|
||||
// that the front character is a digit.
|
||||
@ -38,7 +38,7 @@ class DateDeserializer final {
|
||||
!base::IsAsciiDigit(deserializing_.front()) ||
|
||||
!base::StringToUint(deserializing_.substr(0, num_digits), &value)) {
|
||||
stopped_ = true;
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
// Pop front characters.
|
||||
@ -47,14 +47,14 @@ class DateDeserializer final {
|
||||
}
|
||||
|
||||
// Pops the front character if it is not a digit. Otherwise, does not change
|
||||
// the state of the deserializer and returns `base::nullopt`.
|
||||
base::Optional<char> TryPopNonDigit() {
|
||||
// the state of the deserializer and returns `absl::nullopt`.
|
||||
absl::optional<char> TryPopNonDigit() {
|
||||
if (stopped_ || deserializing_.empty())
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
const char front = deserializing_.front();
|
||||
if (base::IsAsciiDigit(front))
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
deserializing_ = deserializing_.substr(1);
|
||||
return front;
|
||||
@ -76,7 +76,7 @@ base::TimeDelta ParseOffset(DateDeserializer& deserializer) {
|
||||
base::TimeDelta offset;
|
||||
|
||||
// UTC is assumed if no time zone information is provided.
|
||||
const base::Optional<char> sign = deserializer.TryPopNonDigit();
|
||||
const absl::optional<char> sign = deserializer.TryPopNonDigit();
|
||||
if (!sign.has_value() || (sign.value() != '+' && sign.value() != '-'))
|
||||
return offset;
|
||||
|
||||
@ -84,7 +84,7 @@ base::TimeDelta ParseOffset(DateDeserializer& deserializer) {
|
||||
|
||||
// The spec requires that the hours offset be followed by an apostrophe, but
|
||||
// don't be strict about its presence.
|
||||
const base::Optional<char> apostrophe = deserializer.TryPopNonDigit();
|
||||
const absl::optional<char> apostrophe = deserializer.TryPopNonDigit();
|
||||
if (apostrophe.has_value() && apostrophe.value() != '\'')
|
||||
return sign.value() == '+' ? offset : -offset;
|
||||
|
||||
@ -108,7 +108,7 @@ base::Time ParsePdfDate(base::StringPiece date) {
|
||||
DateDeserializer deserializer(date);
|
||||
|
||||
// Year is the only required part of a valid date.
|
||||
const base::Optional<int> deserialized_year = deserializer.PopDigits(4);
|
||||
const absl::optional<int> deserialized_year = deserializer.PopDigits(4);
|
||||
if (!deserialized_year.has_value())
|
||||
return base::Time();
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "base/notreached.h"
|
||||
#include "base/numerics/ranges.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/time/time.h"
|
||||
@ -46,6 +45,7 @@
|
||||
#include "pdf/ui/document_properties.h"
|
||||
#include "pdf/ui/file_name.h"
|
||||
#include "pdf/ui/thumbnail.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/blink/public/common/input/web_input_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
||||
#include "third_party/blink/public/common/input/web_touch_event.h"
|
||||
@ -742,7 +742,7 @@ void PdfViewPluginBase::HandleGetNamedDestinationMessage(
|
||||
message.FindStringKey("namedDestination");
|
||||
CHECK(destination_name);
|
||||
|
||||
base::Optional<PDFEngine::NamedDestination> named_destination =
|
||||
absl::optional<PDFEngine::NamedDestination> named_destination =
|
||||
engine()->GetNamedDestination(*destination_name);
|
||||
|
||||
const int page_number = named_destination.has_value()
|
||||
|
@ -2,12 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "pdf/pdfium/pdfium_engine.h"
|
||||
#include "pdf/pdfium/pdfium_test_base.h"
|
||||
#include "pdf/test/test_client.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
using testing::_;
|
||||
using testing::InSequence;
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/numerics/safe_math.h"
|
||||
#include "base/optional.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace chrome_pdf {
|
||||
|
||||
@ -103,12 +103,12 @@ template <class AdapterType,
|
||||
class StringType,
|
||||
typename BufferType,
|
||||
typename ReturnType>
|
||||
base::Optional<StringType> CallPDFiumStringBufferApiAndReturnOptional(
|
||||
absl::optional<StringType> CallPDFiumStringBufferApiAndReturnOptional(
|
||||
base::RepeatingCallback<ReturnType(BufferType*, ReturnType)> api,
|
||||
bool check_expected_size) {
|
||||
ReturnType expected_size = api.Run(nullptr, 0);
|
||||
if (expected_size == 0)
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
StringType str;
|
||||
AdapterType api_string_adapter(&str, expected_size, check_expected_size);
|
||||
@ -124,7 +124,7 @@ template <class AdapterType,
|
||||
StringType CallPDFiumStringBufferApi(
|
||||
base::RepeatingCallback<ReturnType(BufferType*, ReturnType)> api,
|
||||
bool check_expected_size) {
|
||||
base::Optional<StringType> result =
|
||||
absl::optional<StringType> result =
|
||||
CallPDFiumStringBufferApiAndReturnOptional<AdapterType, StringType>(
|
||||
api, check_expected_size);
|
||||
return result.value_or(StringType());
|
||||
@ -146,7 +146,7 @@ std::u16string CallPDFiumWideStringBufferApi(
|
||||
// Variant of CallPDFiumWideStringBufferApi() that distinguishes between API
|
||||
// call failures and empty string return values.
|
||||
template <typename BufferType>
|
||||
base::Optional<std::u16string> CallPDFiumWideStringBufferApiAndReturnOptional(
|
||||
absl::optional<std::u16string> CallPDFiumWideStringBufferApiAndReturnOptional(
|
||||
base::RepeatingCallback<unsigned long(BufferType*, unsigned long)> api,
|
||||
bool check_expected_size) {
|
||||
using adapter_type = internal::PDFiumAPIStringBufferSizeInBytesAdapter;
|
||||
|
@ -2400,9 +2400,9 @@ base::Value PDFiumEngine::TraverseBookmarks(FPDF_BOOKMARK bookmark,
|
||||
if (PageIndexInBounds(page_index)) {
|
||||
dict.SetIntKey("page", page_index);
|
||||
|
||||
base::Optional<float> x;
|
||||
base::Optional<float> y;
|
||||
base::Optional<float> zoom;
|
||||
absl::optional<float> x;
|
||||
absl::optional<float> y;
|
||||
absl::optional<float> zoom;
|
||||
pages_[page_index]->GetPageDestinationTarget(dest, &x, &y, &zoom);
|
||||
|
||||
if (x)
|
||||
@ -2505,7 +2505,7 @@ void PDFiumEngine::ScrollToGlobalPoint(const gfx::Rect& target_rect,
|
||||
client_->ScrollBy(scroll_offset - global_point);
|
||||
}
|
||||
|
||||
base::Optional<PDFEngine::NamedDestination> PDFiumEngine::GetNamedDestination(
|
||||
absl::optional<PDFEngine::NamedDestination> PDFiumEngine::GetNamedDestination(
|
||||
const std::string& destination) {
|
||||
// Look for the destination.
|
||||
FPDF_DEST dest = FPDF_GetNamedDestByName(doc(), destination.c_str());
|
||||
@ -2600,7 +2600,7 @@ uint32_t PDFiumEngine::GetCharUnicode(int page_index, int char_index) {
|
||||
return pages_[page_index]->GetCharUnicode(char_index);
|
||||
}
|
||||
|
||||
base::Optional<AccessibilityTextRunInfo> PDFiumEngine::GetTextRunInfo(
|
||||
absl::optional<AccessibilityTextRunInfo> PDFiumEngine::GetTextRunInfo(
|
||||
int page_index,
|
||||
int start_char_index) {
|
||||
DCHECK(PageIndexInBounds(page_index));
|
||||
@ -2650,14 +2650,14 @@ int PDFiumEngine::GetDuplexType() {
|
||||
return static_cast<int>(FPDF_VIEWERREF_GetDuplex(doc()));
|
||||
}
|
||||
|
||||
base::Optional<gfx::Size> PDFiumEngine::GetUniformPageSizePoints() {
|
||||
absl::optional<gfx::Size> PDFiumEngine::GetUniformPageSizePoints() {
|
||||
if (pages_.empty())
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
gfx::Size page_size = GetPageSize(0);
|
||||
for (size_t i = 1; i < pages_.size(); ++i) {
|
||||
if (page_size != GetPageSize(i))
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
// Convert `page_size` back to points.
|
||||
@ -3123,19 +3123,19 @@ void PDFiumEngine::InsetPage(const DocumentLayout::Options& layout_options,
|
||||
static_cast<int>(ceil(inset_sizes.bottom * multiplier)));
|
||||
}
|
||||
|
||||
base::Optional<size_t> PDFiumEngine::GetAdjacentPageIndexForTwoUpView(
|
||||
absl::optional<size_t> PDFiumEngine::GetAdjacentPageIndexForTwoUpView(
|
||||
size_t page_index,
|
||||
size_t num_of_pages) const {
|
||||
DCHECK_LT(page_index, num_of_pages);
|
||||
|
||||
if (layout_.options().page_spread() == DocumentLayout::PageSpread::kOneUp) {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
int adjacent_page_offset = page_index % 2 ? -1 : 1;
|
||||
size_t adjacent_page_index = page_index + adjacent_page_offset;
|
||||
if (adjacent_page_index >= num_of_pages)
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
return adjacent_page_index;
|
||||
}
|
||||
@ -3434,7 +3434,7 @@ gfx::Rect PDFiumEngine::GetPageScreenRect(int page_index) const {
|
||||
GetInsetSizes(layout_.options(), page_index, pages_.size());
|
||||
|
||||
int max_page_height = page_rect.height();
|
||||
base::Optional<size_t> adjacent_page_index =
|
||||
absl::optional<size_t> adjacent_page_index =
|
||||
GetAdjacentPageIndexForTwoUpView(page_index, pages_.size());
|
||||
if (adjacent_page_index.has_value()) {
|
||||
max_page_height = std::max(
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/timer/timer.h"
|
||||
#include "base/values.h"
|
||||
@ -29,6 +28,7 @@
|
||||
#include "pdf/pdfium/pdfium_range.h"
|
||||
#include "ppapi/c/private/ppp_pdf.h"
|
||||
#include "ppapi/cpp/dev/buffer_dev.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/pdfium/public/cpp/fpdf_scopers.h"
|
||||
#include "third_party/pdfium/public/fpdf_formfill.h"
|
||||
#include "third_party/pdfium/public/fpdf_progressive.h"
|
||||
@ -133,7 +133,7 @@ class PDFiumEngine : public PDFEngine,
|
||||
const DocumentMetadata& GetDocumentMetadata() const override;
|
||||
int GetNumberOfPages() const override;
|
||||
base::Value GetBookmarks() override;
|
||||
base::Optional<PDFEngine::NamedDestination> GetNamedDestination(
|
||||
absl::optional<PDFEngine::NamedDestination> GetNamedDestination(
|
||||
const std::string& destination) override;
|
||||
int GetMostVisiblePage() override;
|
||||
gfx::Rect GetPageBoundsRect(int index) override;
|
||||
@ -143,7 +143,7 @@ class PDFiumEngine : public PDFEngine,
|
||||
int GetCharCount(int page_index) override;
|
||||
gfx::RectF GetCharBounds(int page_index, int char_index) override;
|
||||
uint32_t GetCharUnicode(int page_index, int char_index) override;
|
||||
base::Optional<AccessibilityTextRunInfo> GetTextRunInfo(
|
||||
absl::optional<AccessibilityTextRunInfo> GetTextRunInfo(
|
||||
int page_index,
|
||||
int start_char_index) override;
|
||||
std::vector<AccessibilityLinkInfo> GetLinkInfo(
|
||||
@ -161,7 +161,7 @@ class PDFiumEngine : public PDFEngine,
|
||||
bool GetPrintScaling() override;
|
||||
int GetCopiesToPrint() override;
|
||||
int GetDuplexType() override;
|
||||
base::Optional<gfx::Size> GetUniformPageSizePoints() override;
|
||||
absl::optional<gfx::Size> GetUniformPageSizePoints() override;
|
||||
void AppendBlankPages(size_t num_pages) override;
|
||||
void AppendPage(PDFEngine* engine, int index) override;
|
||||
std::vector<uint8_t> GetSaveData() override;
|
||||
@ -365,9 +365,9 @@ class PDFiumEngine : public PDFEngine,
|
||||
gfx::Rect& rect) const;
|
||||
|
||||
// If two-up view is enabled, returns the index of the page beside
|
||||
// `page_index` page. Returns base::nullopt if there is no adjacent page or
|
||||
// `page_index` page. Returns absl::nullopt if there is no adjacent page or
|
||||
// if two-up view is disabled.
|
||||
base::Optional<size_t> GetAdjacentPageIndexForTwoUpView(
|
||||
absl::optional<size_t> GetAdjacentPageIndexForTwoUpView(
|
||||
size_t page_index,
|
||||
size_t num_of_pages) const;
|
||||
|
||||
@ -728,9 +728,9 @@ class PDFiumEngine : public PDFEngine,
|
||||
int last_page_to_search_ = -1;
|
||||
int last_character_index_to_search_ = -1; // -1 if search until end of page.
|
||||
// Which result the user has currently selected. (0-based)
|
||||
base::Optional<size_t> current_find_index_;
|
||||
absl::optional<size_t> current_find_index_;
|
||||
// Where to resume searching. (0-based)
|
||||
base::Optional<size_t> resume_find_index_;
|
||||
absl::optional<size_t> resume_find_index_;
|
||||
|
||||
std::unique_ptr<PDFiumPermissions> permissions_;
|
||||
|
||||
@ -764,7 +764,7 @@ class PDFiumEngine : public PDFEngine,
|
||||
|
||||
// Holds the page index requested by PDFium while the scroll operation
|
||||
// is being handled (asynchronously).
|
||||
base::Optional<int> in_flight_visible_page_;
|
||||
absl::optional<int> in_flight_visible_page_;
|
||||
|
||||
// Set to true after FORM_DoDocumentJSAction/FORM_DoDocumentOpenAction have
|
||||
// been called. Only after that can we call FORM_DoPageAAction.
|
||||
|
@ -10,13 +10,13 @@
|
||||
#include "base/bind.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/optional.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "pdf/pdfium/pdfium_api_string_buffer_adapter.h"
|
||||
#include "pdf/pdfium/pdfium_mem_buffer_file_write.h"
|
||||
#include "pdf/pdfium/pdfium_print.h"
|
||||
#include "printing/nup_parameters.h"
|
||||
#include "printing/units.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/pdfium/public/cpp/fpdf_scopers.h"
|
||||
#include "third_party/pdfium/public/fpdf_catalog.h"
|
||||
#include "third_party/pdfium/public/fpdf_ppo.h"
|
||||
@ -153,7 +153,7 @@ base::Value RecursiveGetStructTree(FPDF_STRUCTELEMENT struct_elem) {
|
||||
if (children_count <= 0)
|
||||
return base::Value(base::Value::Type::NONE);
|
||||
|
||||
base::Optional<std::u16string> opt_type =
|
||||
absl::optional<std::u16string> opt_type =
|
||||
CallPDFiumWideStringBufferApiAndReturnOptional(
|
||||
base::BindRepeating(FPDF_StructElement_GetType, struct_elem), true);
|
||||
if (!opt_type)
|
||||
@ -162,14 +162,14 @@ base::Value RecursiveGetStructTree(FPDF_STRUCTELEMENT struct_elem) {
|
||||
base::Value result(base::Value::Type::DICTIONARY);
|
||||
result.SetStringKey("type", *opt_type);
|
||||
|
||||
base::Optional<std::u16string> opt_alt =
|
||||
absl::optional<std::u16string> opt_alt =
|
||||
CallPDFiumWideStringBufferApiAndReturnOptional(
|
||||
base::BindRepeating(FPDF_StructElement_GetAltText, struct_elem),
|
||||
true);
|
||||
if (opt_alt)
|
||||
result.SetStringKey("alt", *opt_alt);
|
||||
|
||||
base::Optional<std::u16string> opt_lang =
|
||||
absl::optional<std::u16string> opt_lang =
|
||||
CallPDFiumWideStringBufferApiAndReturnOptional(
|
||||
base::BindRepeating(FPDF_StructElement_GetLang, struct_elem), true);
|
||||
if (opt_lang)
|
||||
@ -411,11 +411,11 @@ bool PDFiumEngineExports::GetPDFDocInfo(base::span<const uint8_t> pdf_buffer,
|
||||
return true;
|
||||
}
|
||||
|
||||
base::Optional<bool> PDFiumEngineExports::IsPDFDocTagged(
|
||||
absl::optional<bool> PDFiumEngineExports::IsPDFDocTagged(
|
||||
base::span<const uint8_t> pdf_buffer) {
|
||||
ScopedFPDFDocument doc = LoadPdfData(pdf_buffer);
|
||||
if (!doc)
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
return FPDFCatalog_IsTagged(doc.get());
|
||||
}
|
||||
@ -448,16 +448,16 @@ base::Value PDFiumEngineExports::GetPDFStructTreeForPage(
|
||||
return RecursiveGetStructTree(struct_root_elem);
|
||||
}
|
||||
|
||||
base::Optional<gfx::SizeF> PDFiumEngineExports::GetPDFPageSizeByIndex(
|
||||
absl::optional<gfx::SizeF> PDFiumEngineExports::GetPDFPageSizeByIndex(
|
||||
base::span<const uint8_t> pdf_buffer,
|
||||
int page_number) {
|
||||
ScopedFPDFDocument doc = LoadPdfData(pdf_buffer);
|
||||
if (!doc)
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
FS_SIZEF size;
|
||||
if (!FPDF_GetPageSizeByIndexF(doc.get(), page_number, &size))
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
return gfx::SizeF(size.width, size.height);
|
||||
}
|
||||
|
@ -54,11 +54,11 @@ class PDFiumEngineExports : public PDFEngineExports {
|
||||
bool GetPDFDocInfo(base::span<const uint8_t> pdf_buffer,
|
||||
int* page_count,
|
||||
float* max_page_width) override;
|
||||
base::Optional<bool> IsPDFDocTagged(
|
||||
absl::optional<bool> IsPDFDocTagged(
|
||||
base::span<const uint8_t> pdf_buffer) override;
|
||||
base::Value GetPDFStructTreeForPage(base::span<const uint8_t> pdf_buffer,
|
||||
int page_index) override;
|
||||
base::Optional<gfx::SizeF> GetPDFPageSizeByIndex(
|
||||
absl::optional<gfx::SizeF> GetPDFPageSizeByIndex(
|
||||
base::span<const uint8_t> pdf_buffer,
|
||||
int page_number) override;
|
||||
};
|
||||
|
@ -3,10 +3,10 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/path_service.h"
|
||||
#include "pdf/pdf.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
#include "ui/gfx/geometry/size_f.h"
|
||||
@ -67,7 +67,7 @@ TEST_F(PDFiumEngineExportsTest, GetPDFPageSizeByIndex) {
|
||||
ASSERT_TRUE(GetPDFDocInfo(pdf_span, &page_count, nullptr));
|
||||
ASSERT_EQ(2, page_count);
|
||||
for (int page_number = 0; page_number < page_count; ++page_number) {
|
||||
base::Optional<gfx::SizeF> page_size =
|
||||
absl::optional<gfx::SizeF> page_size =
|
||||
GetPDFPageSizeByIndex(pdf_span, page_number);
|
||||
ASSERT_TRUE(page_size.has_value());
|
||||
EXPECT_EQ(gfx::SizeF(200, 200), page_size.value());
|
||||
@ -109,7 +109,7 @@ TEST_F(PDFiumEngineExportsTest, ConvertPdfPagesToNupPdf) {
|
||||
ASSERT_TRUE(GetPDFDocInfo(output_pdf_span, &page_count, nullptr));
|
||||
ASSERT_EQ(1, page_count);
|
||||
|
||||
base::Optional<gfx::SizeF> page_size =
|
||||
absl::optional<gfx::SizeF> page_size =
|
||||
GetPDFPageSizeByIndex(output_pdf_span, 0);
|
||||
ASSERT_TRUE(page_size.has_value());
|
||||
EXPECT_EQ(gfx::SizeF(792, 612), page_size.value());
|
||||
@ -137,7 +137,7 @@ TEST_F(PDFiumEngineExportsTest, ConvertPdfDocumentToNupPdf) {
|
||||
ASSERT_TRUE(GetPDFDocInfo(output_pdf_span, &page_count, nullptr));
|
||||
ASSERT_EQ(2, page_count);
|
||||
for (int page_number = 0; page_number < page_count; ++page_number) {
|
||||
base::Optional<gfx::SizeF> page_size =
|
||||
absl::optional<gfx::SizeF> page_size =
|
||||
GetPDFPageSizeByIndex(output_pdf_span, page_number);
|
||||
ASSERT_TRUE(page_size.has_value());
|
||||
EXPECT_EQ(gfx::SizeF(612, 792), page_size.value());
|
||||
|
@ -443,14 +443,14 @@ void PDFiumPage::LogOverlappingAnnotations() {
|
||||
overlap_count, 1, 100, 50);
|
||||
}
|
||||
|
||||
base::Optional<AccessibilityTextRunInfo> PDFiumPage::GetTextRunInfo(
|
||||
absl::optional<AccessibilityTextRunInfo> PDFiumPage::GetTextRunInfo(
|
||||
int start_char_index) {
|
||||
FPDF_PAGE page = GetPage();
|
||||
FPDF_TEXTPAGE text_page = GetTextPage();
|
||||
int chars_count = FPDFText_CountChars(text_page);
|
||||
// Check to make sure `start_char_index` is within bounds.
|
||||
if (start_char_index < 0 || start_char_index >= chars_count)
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
int actual_start_char_index = GetFirstNonUnicodeWhiteSpaceCharIndex(
|
||||
text_page, start_char_index, chars_count);
|
||||
@ -874,8 +874,8 @@ PDFiumPage::Area PDFiumPage::GetDestinationTarget(FPDF_DEST destination,
|
||||
|
||||
target->page = page_index;
|
||||
|
||||
base::Optional<float> x;
|
||||
base::Optional<float> y;
|
||||
absl::optional<float> x;
|
||||
absl::optional<float> y;
|
||||
GetPageDestinationTarget(destination, &x, &y, &target->zoom);
|
||||
|
||||
if (x) {
|
||||
@ -889,12 +889,12 @@ PDFiumPage::Area PDFiumPage::GetDestinationTarget(FPDF_DEST destination,
|
||||
}
|
||||
|
||||
void PDFiumPage::GetPageDestinationTarget(FPDF_DEST destination,
|
||||
base::Optional<float>* dest_x,
|
||||
base::Optional<float>* dest_y,
|
||||
base::Optional<float>* zoom_value) {
|
||||
*dest_x = base::nullopt;
|
||||
*dest_y = base::nullopt;
|
||||
*zoom_value = base::nullopt;
|
||||
absl::optional<float>* dest_x,
|
||||
absl::optional<float>* dest_y,
|
||||
absl::optional<float>* zoom_value) {
|
||||
*dest_x = absl::nullopt;
|
||||
*dest_y = absl::nullopt;
|
||||
*zoom_value = absl::nullopt;
|
||||
if (!available_)
|
||||
return;
|
||||
|
||||
|
@ -13,10 +13,10 @@
|
||||
#include "base/callback.h"
|
||||
#include "base/callback_forward.h"
|
||||
#include "base/gtest_prod_util.h"
|
||||
#include "base/optional.h"
|
||||
#include "pdf/page_orientation.h"
|
||||
#include "pdf/pdf_engine.h"
|
||||
#include "ppapi/cpp/private/pdf.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/pdfium/public/cpp/fpdf_scopers.h"
|
||||
#include "third_party/pdfium/public/fpdf_doc.h"
|
||||
#include "third_party/pdfium/public/fpdf_formfill.h"
|
||||
@ -60,7 +60,7 @@ class PDFiumPage {
|
||||
// Log overlaps between annotations in the page.
|
||||
void LogOverlappingAnnotations();
|
||||
// See definition of PDFEngine::GetTextRunInfo().
|
||||
base::Optional<AccessibilityTextRunInfo> GetTextRunInfo(int start_char_index);
|
||||
absl::optional<AccessibilityTextRunInfo> GetTextRunInfo(int start_char_index);
|
||||
// Get a unicode character from the page.
|
||||
uint32_t GetCharUnicode(int char_index);
|
||||
// Get the bounds of a character in page pixels.
|
||||
@ -102,10 +102,10 @@ class PDFiumPage {
|
||||
// Valid for DOCLINK_AREA only.
|
||||
int page;
|
||||
// Valid for DOCLINK_AREA only. From the top-left of the page.
|
||||
base::Optional<float> x_in_pixels;
|
||||
base::Optional<float> y_in_pixels;
|
||||
absl::optional<float> x_in_pixels;
|
||||
absl::optional<float> y_in_pixels;
|
||||
// Valid for DOCLINK_AREA only.
|
||||
base::Optional<float> zoom;
|
||||
absl::optional<float> zoom;
|
||||
};
|
||||
|
||||
// Given a `link_index`, returns the type of underlying area and the link
|
||||
@ -120,9 +120,9 @@ class PDFiumPage {
|
||||
// Fills the output params with the in-page coordinates and the zoom value of
|
||||
// the destination.
|
||||
void GetPageDestinationTarget(FPDF_DEST destination,
|
||||
base::Optional<float>* dest_x,
|
||||
base::Optional<float>* dest_y,
|
||||
base::Optional<float>* zoom_value);
|
||||
absl::optional<float>* dest_x,
|
||||
absl::optional<float>* dest_y,
|
||||
absl::optional<float>* zoom_value);
|
||||
|
||||
// For a named destination with "XYZ" view fit type, pre-processes the in-page
|
||||
// x/y coordinate in case it's out of the range of the page dimension. Then
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
@ -24,6 +23,7 @@
|
||||
#include "pdf/ui/thumbnail.h"
|
||||
#include "ppapi/c/private/ppb_pdf.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/pdfium/public/fpdf_formfill.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
@ -268,7 +268,7 @@ TEST_F(PDFiumPageTextTest, TestTextRunBounds) {
|
||||
constexpr int kFirstRunStartIndex = 0;
|
||||
constexpr int kFirstRunEndIndex = 20;
|
||||
constexpr int kPageIndex = 0;
|
||||
base::Optional<AccessibilityTextRunInfo> text_run_info_1 =
|
||||
absl::optional<AccessibilityTextRunInfo> text_run_info_1 =
|
||||
engine->GetTextRunInfo(kPageIndex, kFirstRunStartIndex);
|
||||
ASSERT_TRUE(text_run_info_1.has_value());
|
||||
|
||||
@ -304,7 +304,7 @@ TEST_F(PDFiumPageTextTest, TestTextRunBounds) {
|
||||
// Test the properties of second text run.
|
||||
// Note: The leading spaces in second text run are accounted for in the end
|
||||
// of first text run. Hence we won't see a space leading the second text run.
|
||||
base::Optional<AccessibilityTextRunInfo> text_run_info_2 =
|
||||
absl::optional<AccessibilityTextRunInfo> text_run_info_2 =
|
||||
engine->GetTextRunInfo(kPageIndex, kSecondRunStartIndex);
|
||||
ASSERT_TRUE(text_run_info_2.has_value());
|
||||
|
||||
@ -385,7 +385,7 @@ TEST_F(PDFiumPageTextTest, GetTextRunInfo) {
|
||||
}
|
||||
|
||||
// Test negative char index returns nullopt
|
||||
base::Optional<AccessibilityTextRunInfo> text_run_info_result =
|
||||
absl::optional<AccessibilityTextRunInfo> text_run_info_result =
|
||||
engine->GetTextRunInfo(0, -1);
|
||||
ASSERT_FALSE(text_run_info_result.has_value());
|
||||
|
||||
@ -439,7 +439,7 @@ TEST_F(PDFiumPageTextTest, TestHighlightTextRunInfo) {
|
||||
|
||||
int current_char_index = 0;
|
||||
for (const auto& expected_text_run : expected_text_runs) {
|
||||
base::Optional<AccessibilityTextRunInfo> text_run_info_result =
|
||||
absl::optional<AccessibilityTextRunInfo> text_run_info_result =
|
||||
engine->GetTextRunInfo(0, current_char_index);
|
||||
ASSERT_TRUE(text_run_info_result.has_value());
|
||||
const auto& actual_text_run = text_run_info_result.value();
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/hash/md5.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "pdf/pdfium/pdfium_engine.h"
|
||||
#include "pdf/pdfium/pdfium_engine_exports.h"
|
||||
@ -18,6 +17,7 @@
|
||||
#include "printing/pdf_render_settings.h"
|
||||
#include "printing/units.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/geometry/size_f.h"
|
||||
|
||||
@ -46,7 +46,7 @@ void CheckPdfDimensions(const std::vector<uint8_t>& pdf_data,
|
||||
ASSERT_EQ(expected_dimensions.size(), static_cast<size_t>(page_count));
|
||||
|
||||
for (int i = 0; i < page_count; ++i) {
|
||||
base::Optional<gfx::SizeF> page_size =
|
||||
absl::optional<gfx::SizeF> page_size =
|
||||
exports.GetPDFPageSizeByIndex(pdf_data, i);
|
||||
ASSERT_TRUE(page_size.has_value());
|
||||
EXPECT_EQ(expected_dimensions[i], page_size.value());
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
#include "base/i18n/number_formatting.h"
|
||||
#include "base/i18n/rtl.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "components/strings/grit/components_strings.h"
|
||||
#include "pdf/document_metadata.h"
|
||||
#include "printing/units.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/icu/source/i18n/unicode/ulocdata.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
@ -71,7 +71,7 @@ bool ShowInches() {
|
||||
|
||||
} // namespace
|
||||
|
||||
std::u16string FormatPageSize(const base::Optional<gfx::Size>& size_points) {
|
||||
std::u16string FormatPageSize(const absl::optional<gfx::Size>& size_points) {
|
||||
if (!size_points.has_value())
|
||||
return l10n_util::GetStringUTF16(IDS_PDF_PROPERTIES_PAGE_SIZE_VARIABLE);
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "pdf/document_metadata.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace gfx {
|
||||
class Size;
|
||||
@ -23,8 +23,8 @@ namespace chrome_pdf {
|
||||
// -> 210 x 297 mm (portrait)
|
||||
// -> 11.00 x 8.50 in (landscape)
|
||||
//
|
||||
// Returns the string "Varies" if `size_points` is `base::nullopt`.
|
||||
std::u16string FormatPageSize(const base::Optional<gfx::Size>& size_points);
|
||||
// Returns the string "Varies" if `size_points` is `absl::nullopt`.
|
||||
std::u16string FormatPageSize(const absl::optional<gfx::Size>& size_points);
|
||||
|
||||
// Formats `version` to a string suitable for display to a user. Version numbers
|
||||
// do not require localization.
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
#include "base/i18n/number_formatting.h"
|
||||
#include "base/i18n/rtl.h"
|
||||
#include "base/optional.h"
|
||||
#include "components/strings/grit/components_strings.h"
|
||||
#include "pdf/document_metadata.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/base/resource/mock_resource_bundle_delegate.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
@ -89,7 +89,7 @@ class FormatPageSizeTest : public testing::Test {
|
||||
} // namespace
|
||||
|
||||
TEST_F(FormatPageSizeTest, NoUniformSize) {
|
||||
EXPECT_EQ(FormatPageSize(base::nullopt), u"Varies");
|
||||
EXPECT_EQ(FormatPageSize(absl::nullopt), u"Varies");
|
||||
}
|
||||
|
||||
class FormatPageSizeMillimetersTest : public FormatPageSizeTest {
|
||||
|
@ -25,7 +25,7 @@ bool PapersEqual(const PrinterSemanticCapsAndDefaults::Paper& lhs,
|
||||
}
|
||||
|
||||
void VerifyCapabilityColorModels(const PrinterSemanticCapsAndDefaults& caps) {
|
||||
base::Optional<bool> maybe_color = IsColorModelSelected(caps.color_model);
|
||||
absl::optional<bool> maybe_color = IsColorModelSelected(caps.color_model);
|
||||
ASSERT_TRUE(maybe_color.has_value());
|
||||
EXPECT_TRUE(maybe_color.value());
|
||||
maybe_color = IsColorModelSelected(caps.bw_model);
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "printing/backend/cups_connection.h"
|
||||
@ -23,6 +22,7 @@
|
||||
#include "printing/mojom/print.mojom.h"
|
||||
#include "printing/printing_utils.h"
|
||||
#include "printing/units.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
#include "base/callback.h"
|
||||
@ -185,7 +185,7 @@ void ExtractCopies(const CupsOptionProvider& printer,
|
||||
}
|
||||
|
||||
// Reads resolution from `attr` and puts into `size` in dots per inch.
|
||||
base::Optional<gfx::Size> GetResolution(ipp_attribute_t* attr, int i) {
|
||||
absl::optional<gfx::Size> GetResolution(ipp_attribute_t* attr, int i) {
|
||||
ipp_res_t units;
|
||||
int yres;
|
||||
int xres = ippGetResolution(attr, i, &yres, &units);
|
||||
@ -211,12 +211,12 @@ void ExtractResolutions(const CupsOptionProvider& printer,
|
||||
|
||||
int num_options = ippGetCount(attr);
|
||||
for (int i = 0; i < num_options; i++) {
|
||||
base::Optional<gfx::Size> size = GetResolution(attr, i);
|
||||
absl::optional<gfx::Size> size = GetResolution(attr, i);
|
||||
if (size)
|
||||
printer_info->dpis.push_back(size.value());
|
||||
}
|
||||
ipp_attribute_t* def_attr = printer.GetDefaultOptionValue(kIppResolution);
|
||||
base::Optional<gfx::Size> size = GetResolution(def_attr, 0);
|
||||
absl::optional<gfx::Size> size = GetResolution(def_attr, 0);
|
||||
if (size)
|
||||
printer_info->default_dpi = size.value();
|
||||
}
|
||||
|
@ -8,10 +8,10 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "base/values.h"
|
||||
#include "printing/backend/cups_connection.h"
|
||||
#include "printing/backend/print_backend_consts.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace printing {
|
||||
|
@ -178,13 +178,13 @@ bool RecursiveBuildStructureTree(const ui::AXNode* ax_node,
|
||||
}
|
||||
|
||||
if (ui::IsCellOrTableHeader(ax_node->data().role)) {
|
||||
base::Optional<int> row_span = ax_node->GetTableCellRowSpan();
|
||||
absl::optional<int> row_span = ax_node->GetTableCellRowSpan();
|
||||
if (row_span.has_value()) {
|
||||
tag->fAttributes.appendInt(kPDFTableAttributeOwner,
|
||||
kPDFTableCellRowSpanAttribute,
|
||||
row_span.value());
|
||||
}
|
||||
base::Optional<int> col_span = ax_node->GetTableCellColSpan();
|
||||
absl::optional<int> col_span = ax_node->GetTableCellColSpan();
|
||||
if (col_span.has_value()) {
|
||||
tag->fAttributes.appendInt(kPDFTableAttributeOwner,
|
||||
kPDFTableCellColSpanAttribute,
|
||||
|
@ -189,7 +189,7 @@ std::string GetIppColorModelForModel(mojom::ColorModel color_model) {
|
||||
if (color_model == mojom::ColorModel::kUnknownColorModel)
|
||||
return CUPS_PRINT_COLOR_MODE_MONOCHROME;
|
||||
|
||||
base::Optional<bool> is_color = IsColorModelSelected(color_model);
|
||||
absl::optional<bool> is_color = IsColorModelSelected(color_model);
|
||||
if (!is_color.has_value()) {
|
||||
NOTREACHED();
|
||||
return std::string();
|
||||
@ -201,7 +201,7 @@ std::string GetIppColorModelForModel(mojom::ColorModel color_model) {
|
||||
#endif // defined(OS_MAC) || defined(OS_CHROMEOS)
|
||||
#endif // defined(USE_CUPS)
|
||||
|
||||
base::Optional<bool> IsColorModelSelected(mojom::ColorModel color_model) {
|
||||
absl::optional<bool> IsColorModelSelected(mojom::ColorModel color_model) {
|
||||
switch (color_model) {
|
||||
case mojom::ColorModel::kColor:
|
||||
case mojom::ColorModel::kCMYK:
|
||||
@ -237,7 +237,7 @@ base::Optional<bool> IsColorModelSelected(mojom::ColorModel color_model) {
|
||||
return false;
|
||||
case mojom::ColorModel::kUnknownColorModel:
|
||||
NOTREACHED();
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
// The default case is excluded from the above switch statement to ensure that
|
||||
// all ColorModel values are determinantly handled.
|
||||
|
@ -9,13 +9,13 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/component_export.h"
|
||||
#include "base/optional.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "printing/mojom/print.mojom.h"
|
||||
#include "printing/page_range.h"
|
||||
#include "printing/page_setup.h"
|
||||
#include "printing/print_job_constants.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
|
||||
@ -34,9 +34,9 @@ mojom::ColorModel ColorModeToColorModel(int color_mode);
|
||||
|
||||
// Returns true if `color_model` is color and false if it is B&W. Callers
|
||||
// are not supposed to pass in `mojom::ColorModel::kUnknownColorModel`, but
|
||||
// if they do then the result will be base::nullopt.
|
||||
// if they do then the result will be absl::nullopt.
|
||||
COMPONENT_EXPORT(PRINTING)
|
||||
base::Optional<bool> IsColorModelSelected(mojom::ColorModel color_model);
|
||||
absl::optional<bool> IsColorModelSelected(mojom::ColorModel color_model);
|
||||
|
||||
#if defined(USE_CUPS)
|
||||
// Get the color model setting name and value for the `color_model`.
|
||||
|
@ -84,8 +84,8 @@ PageRanges GetPageRangesFromJobSettings(const base::Value& job_settings) {
|
||||
if (!page_range.is_dict())
|
||||
continue;
|
||||
|
||||
base::Optional<int> from = page_range.FindIntKey(kSettingPageRangeFrom);
|
||||
base::Optional<int> to = page_range.FindIntKey(kSettingPageRangeTo);
|
||||
absl::optional<int> from = page_range.FindIntKey(kSettingPageRangeFrom);
|
||||
absl::optional<int> to = page_range.FindIntKey(kSettingPageRangeTo);
|
||||
if (!from.has_value() || !to.has_value())
|
||||
continue;
|
||||
|
||||
@ -100,7 +100,7 @@ PageRanges GetPageRangesFromJobSettings(const base::Value& job_settings) {
|
||||
std::unique_ptr<PrintSettings> PrintSettingsFromJobSettings(
|
||||
const base::Value& job_settings) {
|
||||
auto settings = std::make_unique<PrintSettings>();
|
||||
base::Optional<bool> display_header_footer =
|
||||
absl::optional<bool> display_header_footer =
|
||||
job_settings.FindBoolKey(kSettingHeaderFooterEnabled);
|
||||
if (!display_header_footer.has_value())
|
||||
return nullptr;
|
||||
@ -118,9 +118,9 @@ std::unique_ptr<PrintSettings> PrintSettingsFromJobSettings(
|
||||
settings->set_url(base::UTF8ToUTF16(*url));
|
||||
}
|
||||
|
||||
base::Optional<bool> backgrounds =
|
||||
absl::optional<bool> backgrounds =
|
||||
job_settings.FindBoolKey(kSettingShouldPrintBackgrounds);
|
||||
base::Optional<bool> selection_only =
|
||||
absl::optional<bool> selection_only =
|
||||
job_settings.FindBoolKey(kSettingShouldPrintSelectionOnly);
|
||||
if (!backgrounds.has_value() || !selection_only.has_value())
|
||||
return nullptr;
|
||||
@ -132,9 +132,9 @@ std::unique_ptr<PrintSettings> PrintSettingsFromJobSettings(
|
||||
const base::Value* media_size_value = job_settings.FindKeyOfType(
|
||||
kSettingMediaSize, base::Value::Type::DICTIONARY);
|
||||
if (media_size_value) {
|
||||
base::Optional<int> width_microns =
|
||||
absl::optional<int> width_microns =
|
||||
media_size_value->FindIntKey(kSettingMediaSizeWidthMicrons);
|
||||
base::Optional<int> height_microns =
|
||||
absl::optional<int> height_microns =
|
||||
media_size_value->FindIntKey(kSettingMediaSizeHeightMicrons);
|
||||
if (width_microns.has_value() && height_microns.has_value()) {
|
||||
requested_media.size_microns =
|
||||
@ -164,16 +164,16 @@ std::unique_ptr<PrintSettings> PrintSettingsFromJobSettings(
|
||||
|
||||
settings->set_ranges(GetPageRangesFromJobSettings(job_settings));
|
||||
|
||||
base::Optional<bool> collate = job_settings.FindBoolKey(kSettingCollate);
|
||||
base::Optional<int> copies = job_settings.FindIntKey(kSettingCopies);
|
||||
base::Optional<int> color = job_settings.FindIntKey(kSettingColor);
|
||||
base::Optional<int> duplex_mode = job_settings.FindIntKey(kSettingDuplexMode);
|
||||
base::Optional<bool> landscape = job_settings.FindBoolKey(kSettingLandscape);
|
||||
base::Optional<int> scale_factor =
|
||||
absl::optional<bool> collate = job_settings.FindBoolKey(kSettingCollate);
|
||||
absl::optional<int> copies = job_settings.FindIntKey(kSettingCopies);
|
||||
absl::optional<int> color = job_settings.FindIntKey(kSettingColor);
|
||||
absl::optional<int> duplex_mode = job_settings.FindIntKey(kSettingDuplexMode);
|
||||
absl::optional<bool> landscape = job_settings.FindBoolKey(kSettingLandscape);
|
||||
absl::optional<int> scale_factor =
|
||||
job_settings.FindIntKey(kSettingScaleFactor);
|
||||
base::Optional<bool> rasterize_pdf =
|
||||
absl::optional<bool> rasterize_pdf =
|
||||
job_settings.FindBoolKey(kSettingRasterizePdf);
|
||||
base::Optional<int> pages_per_sheet =
|
||||
absl::optional<int> pages_per_sheet =
|
||||
job_settings.FindIntKey(kSettingPagesPerSheet);
|
||||
|
||||
if (!collate.has_value() || !copies.has_value() || !color.has_value() ||
|
||||
@ -183,9 +183,9 @@ std::unique_ptr<PrintSettings> PrintSettingsFromJobSettings(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
base::Optional<int> dpi_horizontal =
|
||||
absl::optional<int> dpi_horizontal =
|
||||
job_settings.FindIntKey(kSettingDpiHorizontal);
|
||||
base::Optional<int> dpi_vertical =
|
||||
absl::optional<int> dpi_vertical =
|
||||
job_settings.FindIntKey(kSettingDpiVertical);
|
||||
if (!dpi_horizontal.has_value() || !dpi_vertical.has_value())
|
||||
return nullptr;
|
||||
@ -202,7 +202,7 @@ std::unique_ptr<PrintSettings> PrintSettingsFromJobSettings(
|
||||
settings->set_scale_factor(static_cast<double>(scale_factor.value()) / 100.0);
|
||||
settings->set_rasterize_pdf(rasterize_pdf.value());
|
||||
settings->set_pages_per_sheet(pages_per_sheet.value());
|
||||
base::Optional<bool> is_modifiable =
|
||||
absl::optional<bool> is_modifiable =
|
||||
job_settings.FindBoolKey(kSettingPreviewModifiable);
|
||||
if (is_modifiable.has_value()) {
|
||||
settings->set_is_modifiable(is_modifiable.value());
|
||||
|
@ -50,13 +50,13 @@ const char kPrinterSettings[] = R"({
|
||||
} // namespace
|
||||
|
||||
TEST(PrintSettingsConversionTest, ConversionTest_InvalidSettings) {
|
||||
base::Optional<base::Value> value = base::JSONReader::Read("{}");
|
||||
absl::optional<base::Value> value = base::JSONReader::Read("{}");
|
||||
ASSERT_TRUE(value.has_value());
|
||||
EXPECT_FALSE(PrintSettingsFromJobSettings(value.value()));
|
||||
}
|
||||
|
||||
TEST(PrintSettingsConversionTest, ConversionTest) {
|
||||
base::Optional<base::Value> value = base::JSONReader::Read(kPrinterSettings);
|
||||
absl::optional<base::Value> value = base::JSONReader::Read(kPrinterSettings);
|
||||
ASSERT_TRUE(value.has_value());
|
||||
std::unique_ptr<PrintSettings> settings =
|
||||
PrintSettingsFromJobSettings(value.value());
|
||||
@ -80,7 +80,7 @@ TEST(PrintSettingsConversionTest, ConversionTest) {
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
TEST(PrintSettingsConversionTest, ConversionTest_DontSendUsername) {
|
||||
base::Optional<base::Value> value = base::JSONReader::Read(kPrinterSettings);
|
||||
absl::optional<base::Value> value = base::JSONReader::Read(kPrinterSettings);
|
||||
ASSERT_TRUE(value.has_value());
|
||||
value->SetKey(kSettingSendUserInfo, base::Value(false));
|
||||
std::unique_ptr<PrintSettings> settings =
|
||||
|
@ -9,11 +9,11 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "printing/backend/cups_connection.h"
|
||||
#include "printing/backend/cups_deleters.h"
|
||||
#include "printing/backend/cups_printer.h"
|
||||
#include "printing/printing_context.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace printing {
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/optional.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
// Result<SuccessType, ErrorType> represents the success or failure of an
|
||||
// operation, along with either the success value or error details.
|
||||
@ -129,7 +129,7 @@ class SuccessTag {};
|
||||
class ErrorTag {};
|
||||
// Monostate can be used for SuccessType or ErrorType to indicate that there is
|
||||
// no data for that state. Thus, Result<SomeType, Monostate> is somewhat
|
||||
// analogous to base::Optional<SomeType>, and Result<Monostate, Monostate> is
|
||||
// analogous to absl::optional<SomeType>, and Result<Monostate, Monostate> is
|
||||
// effectively a (2-byte) boolean. Result<Monostate, ErrorType> can be useful
|
||||
// for cases where an operation can fail, but there is no return value in the
|
||||
// success case.
|
||||
|
@ -53,19 +53,18 @@ void SessionOptions::Append(const std::string& key,
|
||||
options_[key] = value;
|
||||
}
|
||||
|
||||
base::Optional<std::string> SessionOptions::Get(
|
||||
const std::string& key) const {
|
||||
absl::optional<std::string> SessionOptions::Get(const std::string& key) const {
|
||||
auto it = options_.find(key);
|
||||
if (it == options_.end()) {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
||||
base::Optional<bool> SessionOptions::GetBool(const std::string& key) const {
|
||||
base::Optional<std::string> value = Get(key);
|
||||
absl::optional<bool> SessionOptions::GetBool(const std::string& key) const {
|
||||
absl::optional<std::string> value = Get(key);
|
||||
if (!value) {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
const std::string lowercase_value = base::ToLowerASCII(*value);
|
||||
@ -79,17 +78,17 @@ base::Optional<bool> SessionOptions::GetBool(const std::string& key) const {
|
||||
}
|
||||
LOG(WARNING) << "Unexpected option received " << *value
|
||||
<< " which cannot be converted to bool.";
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
bool SessionOptions::GetBoolValue(const std::string& key) const {
|
||||
return GetBool(key).value_or(false);
|
||||
}
|
||||
|
||||
base::Optional<int> SessionOptions::GetInt(const std::string& key) const {
|
||||
base::Optional<std::string> value = Get(key);
|
||||
absl::optional<int> SessionOptions::GetInt(const std::string& key) const {
|
||||
absl::optional<std::string> value = Get(key);
|
||||
if (!value) {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
int result;
|
||||
@ -98,7 +97,7 @@ base::Optional<int> SessionOptions::GetInt(const std::string& key) const {
|
||||
}
|
||||
LOG(WARNING) << "Unexpected option received " << *value
|
||||
<< " which cannot be converted to integer.";
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
std::string SessionOptions::Export() const {
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/containers/flat_map.h"
|
||||
#include "base/optional.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace remoting {
|
||||
|
||||
@ -32,20 +32,20 @@ class SessionOptions final {
|
||||
|
||||
// Retrieves the value of |key|. Returns a true Optional if |key| has been
|
||||
// found, value of the Optional will be set to corresponding value.
|
||||
base::Optional<std::string> Get(const std::string& key) const;
|
||||
absl::optional<std::string> Get(const std::string& key) const;
|
||||
|
||||
// Retrieves the value of |key|. Returns a true Optional if |key| has been
|
||||
// found and the corresponding value can be converted to a boolean value.
|
||||
// "true", "1" or empty will be converted to true, "false" or "0" will be
|
||||
// converted to false.
|
||||
base::Optional<bool> GetBool(const std::string& key) const;
|
||||
absl::optional<bool> GetBool(const std::string& key) const;
|
||||
|
||||
// Equivalent to GetBool(key).value_or(false).
|
||||
bool GetBoolValue(const std::string& key) const;
|
||||
|
||||
// Retrieves the value of |key|. Returns a true Optional if |key| has been
|
||||
// found and the corresponding value can be converted to an integer.
|
||||
base::Optional<int> GetInt(const std::string& key) const;
|
||||
absl::optional<int> GetInt(const std::string& key) const;
|
||||
|
||||
// Returns a string to represent current instance. Consumers can rebuild an
|
||||
// exactly same instance with Import() function.
|
||||
|
@ -11,12 +11,12 @@
|
||||
#include "base/containers/queue.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/threading/thread_checker.h"
|
||||
#include "remoting/client/display/gl_cursor.h"
|
||||
#include "remoting/client/display/gl_cursor_feedback.h"
|
||||
#include "remoting/client/display/gl_desktop.h"
|
||||
#include "remoting/proto/control.pb.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
class DesktopFrame;
|
||||
@ -136,7 +136,7 @@ class GlRenderer {
|
||||
std::unique_ptr<Canvas> canvas_;
|
||||
|
||||
// Used to recover the transformation matrix when the canvas is recreated.
|
||||
base::Optional<std::array<float, 9>> transformation_matrix_;
|
||||
absl::optional<std::array<float, 9>> transformation_matrix_;
|
||||
|
||||
GlCursor cursor_;
|
||||
GlCursorFeedback cursor_feedback_;
|
||||
|
@ -49,7 +49,7 @@ void JniNotificationPresenter::Destroy(JNIEnv* env) {
|
||||
}
|
||||
|
||||
void JniNotificationPresenter::OnNotificationFetched(
|
||||
base::Optional<NotificationMessage> notification) {
|
||||
absl::optional<NotificationMessage> notification) {
|
||||
DCHECK(sequence_->RunsTasksInCurrentSequence());
|
||||
JNIEnv* env = base::android::AttachCurrentThread();
|
||||
auto java_presenter = java_presenter_.get(env);
|
||||
|
@ -27,7 +27,7 @@ class JniNotificationPresenter final {
|
||||
void Destroy(JNIEnv* env);
|
||||
|
||||
private:
|
||||
void OnNotificationFetched(base::Optional<NotificationMessage> notification);
|
||||
void OnNotificationFetched(absl::optional<NotificationMessage> notification);
|
||||
|
||||
JavaObjectWeakGlobalRef java_presenter_;
|
||||
NotificationClient notification_client_;
|
||||
|
@ -16,19 +16,19 @@ namespace {
|
||||
|
||||
constexpr char kGstaticUrlPrefix[] = "https://www.gstatic.com/chromoting/";
|
||||
|
||||
base::Optional<base::Value> GetResponse(
|
||||
absl::optional<base::Value> GetResponse(
|
||||
std::unique_ptr<net::URLFetcher> fetcher) {
|
||||
int response_code = fetcher->GetResponseCode();
|
||||
if (response_code != net::HTTP_OK) {
|
||||
LOG(ERROR) << "Json fetch request failed with error code: "
|
||||
<< response_code;
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
std::string response_string;
|
||||
if (!fetcher->GetResponseAsString(&response_string)) {
|
||||
LOG(ERROR) << "Failed to retrieve response data";
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
return base::JSONReader::Read(response_string);
|
||||
|
@ -8,10 +8,10 @@
|
||||
#include "base/containers/flat_map.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/single_thread_task_runner.h"
|
||||
#include "net/url_request/url_fetcher_delegate.h"
|
||||
#include "remoting/client/notification/json_fetcher.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace remoting {
|
||||
|
@ -23,14 +23,14 @@ namespace remoting {
|
||||
class JsonFetcher {
|
||||
public:
|
||||
using FetchJsonFileCallback =
|
||||
base::OnceCallback<void(base::Optional<base::Value>)>;
|
||||
base::OnceCallback<void(absl::optional<base::Value>)>;
|
||||
|
||||
JsonFetcher() = default;
|
||||
virtual ~JsonFetcher() = default;
|
||||
|
||||
// |relative_path| is relative to https://www.gstatic.com/chromoting/.
|
||||
// Runs |done| with the decoded value if the file is successfully fetched,
|
||||
// otherwise runs |done| with base::nullopt.
|
||||
// otherwise runs |done| with absl::nullopt.
|
||||
//
|
||||
// Note that the implementation MUST be able to handle concurrent requests and
|
||||
// MUST NOT keep |done| after its destructor is called.
|
||||
|
@ -131,12 +131,12 @@ class MessageAndLinkTextResults
|
||||
out_message_translation_(out_message_translation),
|
||||
out_link_translation_(out_link_translation) {}
|
||||
|
||||
void OnMessageTranslationsFetched(base::Optional<base::Value> translations) {
|
||||
void OnMessageTranslationsFetched(absl::optional<base::Value> translations) {
|
||||
is_message_translation_fetched_ = true;
|
||||
OnTranslationsFetched(std::move(translations), out_message_translation_);
|
||||
}
|
||||
|
||||
void OnLinkTranslationsFetched(base::Optional<base::Value> translations) {
|
||||
void OnLinkTranslationsFetched(absl::optional<base::Value> translations) {
|
||||
is_link_translation_fetched_ = true;
|
||||
OnTranslationsFetched(std::move(translations), out_link_translation_);
|
||||
}
|
||||
@ -146,7 +146,7 @@ class MessageAndLinkTextResults
|
||||
|
||||
~MessageAndLinkTextResults() = default;
|
||||
|
||||
void OnTranslationsFetched(base::Optional<base::Value> translations,
|
||||
void OnTranslationsFetched(absl::optional<base::Value> translations,
|
||||
std::string* string_to_update) {
|
||||
if (!done_) {
|
||||
LOG(WARNING) << "Received new translations after some translations have "
|
||||
@ -232,16 +232,16 @@ void NotificationClient::GetNotification(const std::string& user_email,
|
||||
|
||||
void NotificationClient::OnRulesFetched(const std::string& user_email,
|
||||
NotificationCallback callback,
|
||||
base::Optional<base::Value> rules) {
|
||||
absl::optional<base::Value> rules) {
|
||||
if (!rules) {
|
||||
LOG(ERROR) << "Rules not found";
|
||||
std::move(callback).Run(base::nullopt);
|
||||
std::move(callback).Run(absl::nullopt);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!rules->is_list()) {
|
||||
LOG(ERROR) << "Rules should be list";
|
||||
std::move(callback).Run(base::nullopt);
|
||||
std::move(callback).Run(absl::nullopt);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -258,10 +258,10 @@ void NotificationClient::OnRulesFetched(const std::string& user_email,
|
||||
}
|
||||
}
|
||||
// No matching rule is found.
|
||||
std::move(callback).Run(base::nullopt);
|
||||
std::move(callback).Run(absl::nullopt);
|
||||
}
|
||||
|
||||
base::Optional<NotificationMessage> NotificationClient::ParseAndMatchRule(
|
||||
absl::optional<NotificationMessage> NotificationClient::ParseAndMatchRule(
|
||||
const base::Value& rule,
|
||||
const std::string& user_email,
|
||||
std::string* out_message_text_filename,
|
||||
@ -280,40 +280,40 @@ base::Optional<NotificationMessage> NotificationClient::ParseAndMatchRule(
|
||||
!FindKeyAndGet(rule, "link_text", &link_text_filename) ||
|
||||
!FindKeyAndGet(rule, "link_url", &link_url) ||
|
||||
!FindKeyAndGet(rule, "percent", &percent)) {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
if (should_ignore_dev_messages_) {
|
||||
bool is_dev_mode;
|
||||
if (FindKeyAndGet(rule, "dev_mode", &is_dev_mode) && is_dev_mode) {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
if (target_platform != current_platform_) {
|
||||
VLOG(1) << "Notification ignored. Target platform: " << target_platform
|
||||
<< "; current platform: " << current_platform_;
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
VersionRange version_range(version_spec_string);
|
||||
if (!version_range.IsValid()) {
|
||||
LOG(ERROR) << "Invalid version range: " << version_spec_string;
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
if (!version_range.ContainsVersion(current_version_)) {
|
||||
VLOG(1) << "Current version " << current_version_ << " not in range "
|
||||
<< version_spec_string;
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
if (!ShouldShowNotificationForUser(user_email, percent)) {
|
||||
VLOG(1) << "User is not selected for notification";
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
auto message = base::make_optional<NotificationMessage>();
|
||||
auto message = absl::make_optional<NotificationMessage>();
|
||||
message->message_id = message_id;
|
||||
message->link_url = link_url;
|
||||
message->allow_silence = false;
|
||||
@ -326,9 +326,9 @@ base::Optional<NotificationMessage> NotificationClient::ParseAndMatchRule(
|
||||
void NotificationClient::FetchTranslatedTexts(
|
||||
const std::string& message_text_filename,
|
||||
const std::string& link_text_filename,
|
||||
base::Optional<NotificationMessage> partial_message,
|
||||
absl::optional<NotificationMessage> partial_message,
|
||||
NotificationCallback done) {
|
||||
// Copy the message into a unique_ptr since moving base::Optional does not
|
||||
// Copy the message into a unique_ptr since moving absl::optional does not
|
||||
// move the internal storage.
|
||||
auto message_copy = std::make_unique<NotificationMessage>(*partial_message);
|
||||
std::string* message_text_ptr = &message_copy->message_text;
|
||||
@ -337,8 +337,8 @@ void NotificationClient::FetchTranslatedTexts(
|
||||
[](std::unique_ptr<NotificationMessage> message,
|
||||
NotificationCallback done, bool is_successful) {
|
||||
std::move(done).Run(
|
||||
is_successful ? base::make_optional<NotificationMessage>(*message)
|
||||
: base::nullopt);
|
||||
is_successful ? absl::make_optional<NotificationMessage>(*message)
|
||||
: absl::nullopt);
|
||||
},
|
||||
std::move(message_copy), std::move(done));
|
||||
auto results = base::MakeRefCounted<MessageAndLinkTextResults>(
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
#include "base/callback_forward.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/single_thread_task_runner.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace base {
|
||||
class Value;
|
||||
@ -27,7 +27,7 @@ struct NotificationMessage;
|
||||
class NotificationClient final {
|
||||
public:
|
||||
using NotificationCallback =
|
||||
base::OnceCallback<void(base::Optional<NotificationMessage>)>;
|
||||
base::OnceCallback<void(absl::optional<NotificationMessage>)>;
|
||||
|
||||
explicit NotificationClient(
|
||||
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner);
|
||||
@ -35,7 +35,7 @@ class NotificationClient final {
|
||||
|
||||
// Fetches notifications from the server and calls |callback| with the
|
||||
// best matched notification. If notifications failed to fetch or no matching
|
||||
// notification is found then base::nullopt will be returned. |callback| will
|
||||
// notification is found then absl::nullopt will be returned. |callback| will
|
||||
// be silently dropped if |this| is deleted before the notification is
|
||||
// fetched.
|
||||
void GetNotification(const std::string& user_email,
|
||||
@ -53,12 +53,12 @@ class NotificationClient final {
|
||||
|
||||
void OnRulesFetched(const std::string& user_email,
|
||||
NotificationCallback callback,
|
||||
base::Optional<base::Value> rules);
|
||||
absl::optional<base::Value> rules);
|
||||
|
||||
// Returns non-empty NotificationMessage if the rule is parsed successfully
|
||||
// and the rule should apply to the user. |message_text| and |link_text| will
|
||||
// not be set and caller needs to call FetchTranslatedText to fill them up.
|
||||
base::Optional<NotificationMessage> ParseAndMatchRule(
|
||||
absl::optional<NotificationMessage> ParseAndMatchRule(
|
||||
const base::Value& rule,
|
||||
const std::string& user_email,
|
||||
std::string* out_message_text_filename,
|
||||
@ -66,7 +66,7 @@ class NotificationClient final {
|
||||
|
||||
void FetchTranslatedTexts(const std::string& message_text_filename,
|
||||
const std::string& link_text_filename,
|
||||
base::Optional<NotificationMessage> partial_message,
|
||||
absl::optional<NotificationMessage> partial_message,
|
||||
NotificationCallback done);
|
||||
|
||||
std::unique_ptr<JsonFetcher> fetcher_;
|
||||
|
@ -7,13 +7,13 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/test/mock_callback.h"
|
||||
#include "base/values.h"
|
||||
#include "remoting/client/notification/json_fetcher.h"
|
||||
#include "remoting/client/notification/notification_message.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace remoting {
|
||||
|
||||
@ -31,7 +31,7 @@ class MockJsonFetcher : public JsonFetcher {
|
||||
public:
|
||||
// GMock doesn't work with rvalue parameters. This works around it.
|
||||
MOCK_CONST_METHOD1(FetchJsonFile,
|
||||
base::Optional<base::Value>(const std::string&));
|
||||
absl::optional<base::Value>(const std::string&));
|
||||
void FetchJsonFile(const std::string& relative_path,
|
||||
FetchJsonFileCallback done,
|
||||
const net::NetworkTrafficAnnotationTag&) override {
|
||||
@ -217,9 +217,9 @@ TEST_F(NotificationClientTest, TextFilesNotFound) {
|
||||
base::Value translation = CreateDefaultTranslations("message");
|
||||
|
||||
EXPECT_CALL(*fetcher_, FetchJsonFile("notification/message_text.json"))
|
||||
.WillOnce(ReturnByMove(base::nullopt));
|
||||
.WillOnce(ReturnByMove(absl::nullopt));
|
||||
EXPECT_CALL(*fetcher_, FetchJsonFile("notification/link_text.json"))
|
||||
.WillOnce(ReturnByMove(base::nullopt));
|
||||
.WillOnce(ReturnByMove(absl::nullopt));
|
||||
|
||||
base::MockCallback<NotificationClient::NotificationCallback> callback;
|
||||
EXPECT_CALL(callback, Run(NoMessage()));
|
||||
|
@ -29,8 +29,8 @@ VersionRange::VersionRange(const std::string& range_spec) {
|
||||
size_t dash_pos = range_spec.find('-');
|
||||
if (dash_pos == std::string::npos) {
|
||||
// May be a single version string.
|
||||
min_version_ = base::make_optional<base::Version>(range_spec);
|
||||
max_version_ = base::make_optional<base::Version>(*min_version_);
|
||||
min_version_ = absl::make_optional<base::Version>(range_spec);
|
||||
max_version_ = absl::make_optional<base::Version>(*min_version_);
|
||||
is_min_version_inclusive_ = true;
|
||||
is_max_version_inclusive_ = true;
|
||||
return;
|
||||
@ -59,9 +59,9 @@ VersionRange::VersionRange(const std::string& range_spec) {
|
||||
// Unbound min version.
|
||||
std::vector<uint32_t> version_components{kUnboundMinVersionNumber};
|
||||
min_version_ =
|
||||
base::make_optional<base::Version>(std::move(version_components));
|
||||
absl::make_optional<base::Version>(std::move(version_components));
|
||||
} else {
|
||||
min_version_ = base::make_optional<base::Version>(min_version_string);
|
||||
min_version_ = absl::make_optional<base::Version>(min_version_string);
|
||||
}
|
||||
|
||||
std::string max_version_string = range_spec.substr(dash_pos + 1);
|
||||
@ -70,9 +70,9 @@ VersionRange::VersionRange(const std::string& range_spec) {
|
||||
// Unbound max version.
|
||||
std::vector<uint32_t> version_components{kUnboundMaxVersionNumber};
|
||||
max_version_ =
|
||||
base::make_optional<base::Version>(std::move(version_components));
|
||||
absl::make_optional<base::Version>(std::move(version_components));
|
||||
} else {
|
||||
max_version_ = base::make_optional<base::Version>(max_version_string);
|
||||
max_version_ = absl::make_optional<base::Version>(max_version_string);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/version.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace remoting {
|
||||
|
||||
@ -38,8 +38,8 @@ class VersionRange final {
|
||||
bool ContainsVersion(const std::string& version_string) const;
|
||||
|
||||
private:
|
||||
base::Optional<base::Version> min_version_;
|
||||
base::Optional<base::Version> max_version_;
|
||||
absl::optional<base::Version> min_version_;
|
||||
absl::optional<base::Version> max_version_;
|
||||
|
||||
bool is_min_version_inclusive_ = false;
|
||||
bool is_max_version_inclusive_ = false;
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/single_thread_task_runner.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
@ -44,6 +43,7 @@
|
||||
#include "remoting/protocol/session.h"
|
||||
#include "remoting/protocol/session_config.h"
|
||||
#include "remoting/protocol/video_frame_pump.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
|
||||
|
||||
namespace {
|
||||
@ -314,8 +314,8 @@ void ClientSession::ControlPeerConnection(
|
||||
if (!connection_->peer_connection_controls()) {
|
||||
return;
|
||||
}
|
||||
base::Optional<int> min_bitrate_bps;
|
||||
base::Optional<int> max_bitrate_bps;
|
||||
absl::optional<int> min_bitrate_bps;
|
||||
absl::optional<int> max_bitrate_bps;
|
||||
bool set_preferred_bitrates = false;
|
||||
if (parameters.has_preferred_min_bitrate_bps()) {
|
||||
min_bitrate_bps = parameters.preferred_min_bitrate_bps();
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "build/build_config.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "remoting/host/win/evaluate_d3d.h"
|
||||
@ -106,14 +106,13 @@ void DesktopEnvironmentOptions::set_enable_file_transfer(bool enabled) {
|
||||
void DesktopEnvironmentOptions::ApplySessionOptions(
|
||||
const SessionOptions& options) {
|
||||
#if defined(OS_WIN)
|
||||
base::Optional<bool> directx_capturer =
|
||||
options.GetBool("DirectX-Capturer");
|
||||
absl::optional<bool> directx_capturer = options.GetBool("DirectX-Capturer");
|
||||
if (directx_capturer) {
|
||||
desktop_capture_options_.set_allow_directx_capturer(*directx_capturer);
|
||||
}
|
||||
#endif
|
||||
// This field is for test purpose. Usually it should not be set to false.
|
||||
base::Optional<bool> detect_updated_region =
|
||||
absl::optional<bool> detect_updated_region =
|
||||
options.GetBool("Detect-Updated-Region");
|
||||
if (detect_updated_region) {
|
||||
desktop_capture_options_.set_detect_updated_region(*detect_updated_region);
|
||||
|
@ -241,7 +241,7 @@ class DesktopSessionAgent
|
||||
|
||||
// Routes file-transfer messages to the corresponding reader/writer to be
|
||||
// executed.
|
||||
base::Optional<SessionFileOperationsHandler> session_file_operations_handler_;
|
||||
absl::optional<SessionFileOperationsHandler> session_file_operations_handler_;
|
||||
|
||||
// Reports process statistic data to network process.
|
||||
std::unique_ptr<ProcessStatsSender> stats_sender_;
|
||||
|
@ -337,7 +337,7 @@ void DesktopSessionProxy::SetKeyboardLayoutMonitor(
|
||||
keyboard_layout_monitor_ = std::move(keyboard_layout_monitor);
|
||||
}
|
||||
|
||||
const base::Optional<protocol::KeyboardLayout>&
|
||||
const absl::optional<protocol::KeyboardLayout>&
|
||||
DesktopSessionProxy::GetKeyboardCurrentLayout() const {
|
||||
DCHECK(caller_task_runner_->BelongsToCurrentThread());
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "base/memory/read_only_shared_memory_region.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/process/process.h"
|
||||
#include "base/sequenced_task_runner_helpers.h"
|
||||
#include "ipc/ipc_channel_handle.h"
|
||||
@ -27,6 +26,7 @@
|
||||
#include "remoting/proto/event.pb.h"
|
||||
#include "remoting/protocol/clipboard_stub.h"
|
||||
#include "remoting/protocol/errors.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
|
||||
|
||||
namespace base {
|
||||
@ -135,7 +135,7 @@ class DesktopSessionProxy
|
||||
// changes. Called on the |caller_task_runner_| thread.
|
||||
void SetKeyboardLayoutMonitor(
|
||||
const base::WeakPtr<IpcKeyboardLayoutMonitor>& keyboard_layout_monitor);
|
||||
const base::Optional<protocol::KeyboardLayout>& GetKeyboardCurrentLayout()
|
||||
const absl::optional<protocol::KeyboardLayout>& GetKeyboardCurrentLayout()
|
||||
const;
|
||||
|
||||
// APIs used to implement the InputInjector interface.
|
||||
@ -267,7 +267,7 @@ class DesktopSessionProxy
|
||||
|
||||
// Caches the last keyboard layout received so it can be provided when Start
|
||||
// is called on IpcKeyboardLayoutMonitor.
|
||||
base::Optional<protocol::KeyboardLayout> keyboard_layout_;
|
||||
absl::optional<protocol::KeyboardLayout> keyboard_layout_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DesktopSessionProxy);
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ class BufferedFileWriterTest : public testing::Test {
|
||||
void OnError(protocol::FileTransfer_Error error);
|
||||
|
||||
bool complete_called_ = false;
|
||||
base::Optional<protocol::FileTransfer_Error> error_ = base::nullopt;
|
||||
absl::optional<protocol::FileTransfer_Error> error_ = absl::nullopt;
|
||||
|
||||
base::test::TaskEnvironment task_environment_;
|
||||
};
|
||||
|
@ -92,7 +92,7 @@ FakeFileOperations::OutputFile::~OutputFile() = default;
|
||||
FakeFileOperations::InputFile::InputFile(
|
||||
base::FilePath filename,
|
||||
std::vector<std::uint8_t> data,
|
||||
base::Optional<protocol::FileTransfer_Error> io_error)
|
||||
absl::optional<protocol::FileTransfer_Error> io_error)
|
||||
: filename(std::move(filename)),
|
||||
data(std::move(data)),
|
||||
io_error(std::move(io_error)) {}
|
||||
|
@ -10,9 +10,9 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/optional.h"
|
||||
#include "remoting/host/file_transfer/file_operations.h"
|
||||
#include "remoting/proto/file_transfer.pb.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace remoting {
|
||||
|
||||
@ -45,7 +45,7 @@ class FakeFileOperations : public FileOperations {
|
||||
InputFile();
|
||||
InputFile(base::FilePath filename,
|
||||
std::vector<std::uint8_t> data,
|
||||
base::Optional<protocol::FileTransfer_Error> io_error);
|
||||
absl::optional<protocol::FileTransfer_Error> io_error);
|
||||
InputFile(const InputFile& other);
|
||||
InputFile(InputFile&& other);
|
||||
InputFile& operator=(const InputFile&);
|
||||
@ -60,7 +60,7 @@ class FakeFileOperations : public FileOperations {
|
||||
|
||||
// If set, this error will be returned instead of EOF once the provided data
|
||||
// has been read.
|
||||
base::Optional<protocol::FileTransfer_Error> io_error;
|
||||
absl::optional<protocol::FileTransfer_Error> io_error;
|
||||
};
|
||||
|
||||
// Used to interact with FakeFileOperations after ownership is passed
|
||||
@ -78,7 +78,7 @@ class FakeFileOperations : public FileOperations {
|
||||
std::vector<OutputFile> files_written;
|
||||
|
||||
// If set, file operations will return this error.
|
||||
base::Optional<protocol::FileTransfer_Error> io_error = base::nullopt;
|
||||
absl::optional<protocol::FileTransfer_Error> io_error = absl::nullopt;
|
||||
};
|
||||
|
||||
explicit FakeFileOperations(TestIo* test_io);
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/optional.h"
|
||||
#include "remoting/protocol/file_transfer_helpers.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace base {
|
||||
class FilePath;
|
||||
|
@ -12,11 +12,11 @@
|
||||
|
||||
#include "base/containers/queue.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "remoting/host/file_transfer/buffered_file_writer.h"
|
||||
#include "remoting/host/file_transfer/file_operations.h"
|
||||
#include "remoting/protocol/file_transfer_helpers.h"
|
||||
#include "remoting/protocol/named_message_pipe_handler.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace remoting {
|
||||
|
||||
@ -84,7 +84,7 @@ class FileTransferMessageHandler : public protocol::NamedMessagePipeHandler {
|
||||
|
||||
State state_ = kConnected;
|
||||
std::unique_ptr<FileOperations> file_operations_;
|
||||
base::Optional<BufferedFileWriter> buffered_file_writer_;
|
||||
absl::optional<BufferedFileWriter> buffered_file_writer_;
|
||||
std::unique_ptr<FileOperations::Reader> file_reader_;
|
||||
std::size_t queued_chunks_ = 0;
|
||||
base::WeakPtrFactory<FileTransferMessageHandler> weak_ptr_factory_{this};
|
||||
|
@ -349,7 +349,7 @@ TEST_F(FileTransferMessageHandlerTest, ReadsFile) {
|
||||
|
||||
test_io.input_file = FakeFileOperations::InputFile(
|
||||
base::FilePath::FromUTF8Unsafe(kTestFilename),
|
||||
ByteArrayFrom(kTestDataOne, kTestDataTwo, kTestDataThree), base::nullopt);
|
||||
ByteArrayFrom(kTestDataOne, kTestDataTwo, kTestDataThree), absl::nullopt);
|
||||
|
||||
// This will delete itself when fake_pipe_->ClosePipe() is called.
|
||||
new FileTransferMessageHandler(kTestDatachannelName, fake_pipe_->Wrap(),
|
||||
|
@ -11,9 +11,9 @@
|
||||
|
||||
#include "base/containers/flat_map.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "remoting/host/file_transfer/file_operations.h"
|
||||
#include "remoting/protocol/file_transfer_helpers.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace remoting {
|
||||
|
||||
|
@ -151,7 +151,7 @@ TEST_F(IpcFileOperationsTest, WritesThreeChunks) {
|
||||
file_operations_->CreateWriter();
|
||||
ASSERT_EQ(FileOperations::kCreated, writer->state());
|
||||
|
||||
base::Optional<FileOperations::Writer::Result> open_result;
|
||||
absl::optional<FileOperations::Writer::Result> open_result;
|
||||
writer->Open(kTestFilename,
|
||||
BindLambda([&](FileOperations::Writer::Result result) {
|
||||
open_result = std::move(result);
|
||||
@ -163,7 +163,7 @@ TEST_F(IpcFileOperationsTest, WritesThreeChunks) {
|
||||
ASSERT_TRUE(*open_result);
|
||||
|
||||
for (const auto& chunk : {kTestDataOne, kTestDataTwo, kTestDataThree}) {
|
||||
base::Optional<FileOperations::Writer::Result> write_result;
|
||||
absl::optional<FileOperations::Writer::Result> write_result;
|
||||
writer->WriteChunk(chunk,
|
||||
BindLambda([&](FileOperations::Writer::Result result) {
|
||||
write_result = std::move(result);
|
||||
@ -175,7 +175,7 @@ TEST_F(IpcFileOperationsTest, WritesThreeChunks) {
|
||||
ASSERT_TRUE(*write_result);
|
||||
}
|
||||
|
||||
base::Optional<FileOperations::Writer::Result> close_result;
|
||||
absl::optional<FileOperations::Writer::Result> close_result;
|
||||
writer->Close(BindLambda([&](FileOperations::Writer::Result result) {
|
||||
close_result = std::move(result);
|
||||
}));
|
||||
@ -195,7 +195,7 @@ TEST_F(IpcFileOperationsTest, DroppingCancelsRemote) {
|
||||
std::unique_ptr<FileOperations::Writer> writer =
|
||||
file_operations_->CreateWriter();
|
||||
|
||||
base::Optional<FileOperations::Writer::Result> open_result;
|
||||
absl::optional<FileOperations::Writer::Result> open_result;
|
||||
writer->Open(kTestFilename,
|
||||
BindLambda([&](FileOperations::Writer::Result result) {
|
||||
open_result = std::move(result);
|
||||
@ -204,7 +204,7 @@ TEST_F(IpcFileOperationsTest, DroppingCancelsRemote) {
|
||||
ASSERT_TRUE(open_result && *open_result);
|
||||
|
||||
for (const auto& chunk : {kTestDataOne, kTestDataTwo, kTestDataThree}) {
|
||||
base::Optional<FileOperations::Writer::Result> write_result;
|
||||
absl::optional<FileOperations::Writer::Result> write_result;
|
||||
writer->WriteChunk(chunk,
|
||||
BindLambda([&](FileOperations::Writer::Result result) {
|
||||
write_result = std::move(result);
|
||||
@ -224,7 +224,7 @@ TEST_F(IpcFileOperationsTest, CancelsWhileOperationPending) {
|
||||
std::unique_ptr<FileOperations::Writer> writer =
|
||||
file_operations_->CreateWriter();
|
||||
|
||||
base::Optional<FileOperations::Writer::Result> open_result;
|
||||
absl::optional<FileOperations::Writer::Result> open_result;
|
||||
writer->Open(kTestFilename,
|
||||
BindLambda([&](FileOperations::Writer::Result result) {
|
||||
open_result = std::move(result);
|
||||
@ -232,7 +232,7 @@ TEST_F(IpcFileOperationsTest, CancelsWhileOperationPending) {
|
||||
task_environment_.RunUntilIdle();
|
||||
ASSERT_TRUE(open_result && *open_result);
|
||||
|
||||
base::Optional<FileOperations::Writer::Result> write_result;
|
||||
absl::optional<FileOperations::Writer::Result> write_result;
|
||||
writer->WriteChunk(kTestDataOne,
|
||||
BindLambda([&](FileOperations::Writer::Result result) {
|
||||
write_result = std::move(result);
|
||||
@ -261,7 +261,7 @@ TEST_F(IpcFileOperationsTest, ReadsThreeChunks) {
|
||||
ASSERT_EQ(FileOperations::kCreated, reader->state());
|
||||
|
||||
FakeFileChooser::SetResult(path);
|
||||
base::Optional<FileOperations::Reader::OpenResult> open_result;
|
||||
absl::optional<FileOperations::Reader::OpenResult> open_result;
|
||||
reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) {
|
||||
open_result = std::move(result);
|
||||
}));
|
||||
@ -272,7 +272,7 @@ TEST_F(IpcFileOperationsTest, ReadsThreeChunks) {
|
||||
ASSERT_TRUE(*open_result);
|
||||
|
||||
for (const auto& chunk : {kTestDataOne, kTestDataTwo, kTestDataThree}) {
|
||||
base::Optional<FileOperations::Reader::ReadResult> read_result;
|
||||
absl::optional<FileOperations::Reader::ReadResult> read_result;
|
||||
reader->ReadChunk(
|
||||
chunk.size(),
|
||||
BindLambda([&](FileOperations::Reader::ReadResult result) {
|
||||
@ -302,14 +302,14 @@ TEST_F(IpcFileOperationsTest, ReaderHandlesEof) {
|
||||
file_operations_->CreateReader();
|
||||
|
||||
FakeFileChooser::SetResult(path);
|
||||
base::Optional<FileOperations::Reader::OpenResult> open_result;
|
||||
absl::optional<FileOperations::Reader::OpenResult> open_result;
|
||||
reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) {
|
||||
open_result = std::move(result);
|
||||
}));
|
||||
task_environment_.RunUntilIdle();
|
||||
ASSERT_TRUE(open_result && *open_result);
|
||||
|
||||
base::Optional<FileOperations::Reader::ReadResult> read_result;
|
||||
absl::optional<FileOperations::Reader::ReadResult> read_result;
|
||||
reader->ReadChunk(
|
||||
contents.size() +
|
||||
kOverreadAmount, // Attempt to read more than is in file.
|
||||
@ -344,14 +344,14 @@ TEST_F(IpcFileOperationsTest, ReaderHandlesZeroSize) {
|
||||
file_operations_->CreateReader();
|
||||
|
||||
FakeFileChooser::SetResult(path);
|
||||
base::Optional<FileOperations::Reader::OpenResult> open_result;
|
||||
absl::optional<FileOperations::Reader::OpenResult> open_result;
|
||||
reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) {
|
||||
open_result = std::move(result);
|
||||
}));
|
||||
task_environment_.RunUntilIdle();
|
||||
ASSERT_TRUE(open_result && *open_result);
|
||||
|
||||
base::Optional<FileOperations::Reader::ReadResult> read_result;
|
||||
absl::optional<FileOperations::Reader::ReadResult> read_result;
|
||||
reader->ReadChunk(kChunkSize,
|
||||
BindLambda([&](FileOperations::Reader::ReadResult result) {
|
||||
read_result = std::move(result);
|
||||
@ -370,7 +370,7 @@ TEST_F(IpcFileOperationsTest, ReaderPropagatesError) {
|
||||
|
||||
// Currently non-existent file.
|
||||
FakeFileChooser::SetResult(TestDir().Append(kTestFilename));
|
||||
base::Optional<FileOperations::Reader::OpenResult> open_result;
|
||||
absl::optional<FileOperations::Reader::OpenResult> open_result;
|
||||
reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) {
|
||||
open_result = std::move(result);
|
||||
}));
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/sequence_checker.h"
|
||||
#include "base/sequenced_task_runner.h"
|
||||
@ -25,6 +24,7 @@
|
||||
#include "remoting/host/file_transfer/file_chooser.h"
|
||||
#include "remoting/host/file_transfer/get_desktop_directory.h"
|
||||
#include "remoting/protocol/file_transfer_helpers.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace remoting {
|
||||
|
||||
@ -95,7 +95,7 @@ class LocalFileReader : public FileOperations::Reader {
|
||||
scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
|
||||
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
|
||||
std::unique_ptr<FileChooser> file_chooser_;
|
||||
base::Optional<base::FileProxy> file_proxy_;
|
||||
absl::optional<base::FileProxy> file_proxy_;
|
||||
SEQUENCE_CHECKER(sequence_checker_);
|
||||
base::WeakPtrFactory<LocalFileReader> weak_ptr_factory_{this};
|
||||
|
||||
@ -144,7 +144,7 @@ class LocalFileWriter : public FileOperations::Writer {
|
||||
std::uint64_t bytes_written_ = 0;
|
||||
|
||||
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
|
||||
base::Optional<base::FileProxy> file_proxy_;
|
||||
absl::optional<base::FileProxy> file_proxy_;
|
||||
SEQUENCE_CHECKER(sequence_checker_);
|
||||
base::WeakPtrFactory<LocalFileWriter> weak_ptr_factory_{this};
|
||||
|
||||
|
@ -243,7 +243,7 @@ TEST_F(LocalFileOperationsTest, OpensReader) {
|
||||
file_operations_->CreateReader();
|
||||
|
||||
FakeFileChooser::SetResult(path);
|
||||
base::Optional<FileOperations::Reader::OpenResult> open_result;
|
||||
absl::optional<FileOperations::Reader::OpenResult> open_result;
|
||||
ASSERT_EQ(FileOperations::kCreated, reader->state());
|
||||
reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) {
|
||||
open_result = std::move(result);
|
||||
@ -271,7 +271,7 @@ TEST_F(LocalFileOperationsTest, ReadsThreeChunks) {
|
||||
file_operations_->CreateReader();
|
||||
|
||||
FakeFileChooser::SetResult(path);
|
||||
base::Optional<FileOperations::Reader::OpenResult> open_result;
|
||||
absl::optional<FileOperations::Reader::OpenResult> open_result;
|
||||
reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) {
|
||||
open_result = std::move(result);
|
||||
}));
|
||||
@ -279,7 +279,7 @@ TEST_F(LocalFileOperationsTest, ReadsThreeChunks) {
|
||||
ASSERT_TRUE(open_result && *open_result);
|
||||
|
||||
for (const auto& chunk : {kTestDataOne, kTestDataTwo, kTestDataThree}) {
|
||||
base::Optional<FileOperations::Reader::ReadResult> read_result;
|
||||
absl::optional<FileOperations::Reader::ReadResult> read_result;
|
||||
reader->ReadChunk(
|
||||
chunk.size(),
|
||||
BindLambda([&](FileOperations::Reader::ReadResult result) {
|
||||
@ -308,14 +308,14 @@ TEST_F(LocalFileOperationsTest, ReaderHandlesEof) {
|
||||
file_operations_->CreateReader();
|
||||
|
||||
FakeFileChooser::SetResult(path);
|
||||
base::Optional<FileOperations::Reader::OpenResult> open_result;
|
||||
absl::optional<FileOperations::Reader::OpenResult> open_result;
|
||||
reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) {
|
||||
open_result = std::move(result);
|
||||
}));
|
||||
task_environment_.RunUntilIdle();
|
||||
ASSERT_TRUE(open_result && *open_result);
|
||||
|
||||
base::Optional<FileOperations::Reader::ReadResult> read_result;
|
||||
absl::optional<FileOperations::Reader::ReadResult> read_result;
|
||||
reader->ReadChunk(
|
||||
contents.size() + 5, // Attempt to read more than is in file.
|
||||
BindLambda([&](FileOperations::Reader::ReadResult result) {
|
||||
@ -344,7 +344,7 @@ TEST_F(LocalFileOperationsTest, ReaderCancels) {
|
||||
|
||||
FakeFileChooser::SetResult(protocol::MakeFileTransferError(
|
||||
FROM_HERE, protocol::FileTransfer_Error_Type_CANCELED));
|
||||
base::Optional<FileOperations::Reader::OpenResult> open_result;
|
||||
absl::optional<FileOperations::Reader::OpenResult> open_result;
|
||||
reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) {
|
||||
open_result = std::move(result);
|
||||
}));
|
||||
@ -363,7 +363,7 @@ TEST_F(LocalFileOperationsTest, FileNotFound) {
|
||||
|
||||
// Currently non-existent file.
|
||||
FakeFileChooser::SetResult(TestDir().Append(kTestFilename));
|
||||
base::Optional<FileOperations::Reader::OpenResult> open_result;
|
||||
absl::optional<FileOperations::Reader::OpenResult> open_result;
|
||||
reader->Open(BindLambda([&](FileOperations::Reader::OpenResult result) {
|
||||
open_result = std::move(result);
|
||||
}));
|
||||
|
@ -51,8 +51,8 @@ class RtcLogFileOperationsTest : public testing::Test {
|
||||
std::unique_ptr<FileOperations::Reader> reader_;
|
||||
|
||||
// These are the most-recent results from the callbacks.
|
||||
base::Optional<FileOperations::Reader::OpenResult> open_result_;
|
||||
base::Optional<FileOperations::Reader::ReadResult> read_result_;
|
||||
absl::optional<FileOperations::Reader::OpenResult> open_result_;
|
||||
absl::optional<FileOperations::Reader::ReadResult> read_result_;
|
||||
|
||||
FileOperations::Reader::OpenCallback MakeOpenCallback() {
|
||||
return base::BindOnce(&RtcLogFileOperationsTest::OnOpenResult,
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/numerics/ranges.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/single_thread_task_runner.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@ -27,6 +26,7 @@
|
||||
#include "remoting/host/clipboard.h"
|
||||
#include "remoting/host/touch_injector_win.h"
|
||||
#include "remoting/proto/event.pb.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/events/keycodes/dom/keycode_converter.h"
|
||||
|
||||
namespace remoting {
|
||||
@ -168,8 +168,8 @@ bool IsLockKey(int scancode) {
|
||||
}
|
||||
|
||||
// Sets the keyboard lock states to those provided.
|
||||
void SetLockStates(base::Optional<bool> caps_lock,
|
||||
base::Optional<bool> num_lock) {
|
||||
void SetLockStates(absl::optional<bool> caps_lock,
|
||||
absl::optional<bool> num_lock) {
|
||||
if (caps_lock) {
|
||||
bool client_capslock_state = *caps_lock;
|
||||
bool host_capslock_state = (GetKeyState(VK_CAPITAL) & 1) != 0;
|
||||
@ -391,8 +391,8 @@ void InputInjectorWin::Core::HandleKey(const KeyEvent& event) {
|
||||
return;
|
||||
|
||||
if (event.pressed() && !IsLockKey(scancode)) {
|
||||
base::Optional<bool> caps_lock;
|
||||
base::Optional<bool> num_lock;
|
||||
absl::optional<bool> caps_lock;
|
||||
absl::optional<bool> num_lock;
|
||||
|
||||
// For caps lock, check both the new caps_lock field and the old lock_states
|
||||
// field.
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/location.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/single_thread_task_runner.h"
|
||||
#include "base/strings/utf_string_conversion_utils.h"
|
||||
#include "base/time/time.h"
|
||||
@ -27,6 +26,7 @@
|
||||
#include "remoting/host/linux/x11_keyboard_impl.h"
|
||||
#include "remoting/host/linux/x11_util.h"
|
||||
#include "remoting/proto/internal.pb.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
|
||||
#include "ui/events/keycodes/dom/dom_code.h"
|
||||
#include "ui/events/keycodes/dom/keycode_converter.h"
|
||||
@ -144,8 +144,8 @@ class InputInjectorX11 : public InputInjector {
|
||||
bool IsLockKey(x11::KeyCode keycode);
|
||||
|
||||
// Sets the keyboard lock states to those provided.
|
||||
void SetLockStates(base::Optional<bool> caps_lock,
|
||||
base::Optional<bool> num_lock);
|
||||
void SetLockStates(absl::optional<bool> caps_lock,
|
||||
absl::optional<bool> num_lock);
|
||||
|
||||
void InjectScrollWheelClicks(int button, int count);
|
||||
// Compensates for global button mappings and resets the XTest device
|
||||
@ -296,8 +296,8 @@ void InputInjectorX11::Core::InjectKeyEvent(const KeyEvent& event) {
|
||||
}
|
||||
|
||||
if (!IsLockKey(static_cast<x11::KeyCode>(keycode))) {
|
||||
base::Optional<bool> caps_lock;
|
||||
base::Optional<bool> num_lock;
|
||||
absl::optional<bool> caps_lock;
|
||||
absl::optional<bool> num_lock;
|
||||
|
||||
// For caps lock, check both the new caps_lock field and the old
|
||||
// lock_states field.
|
||||
@ -399,8 +399,8 @@ bool InputInjectorX11::Core::IsLockKey(x11::KeyCode keycode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void InputInjectorX11::Core::SetLockStates(base::Optional<bool> caps_lock,
|
||||
base::Optional<bool> num_lock) {
|
||||
void InputInjectorX11::Core::SetLockStates(absl::optional<bool> caps_lock,
|
||||
absl::optional<bool> num_lock) {
|
||||
// The lock bits associated with each lock key.
|
||||
auto caps_lock_mask = static_cast<unsigned int>(x11::ModMask::Lock);
|
||||
auto num_lock_mask = static_cast<unsigned int>(x11::ModMask::c_2);
|
||||
|
@ -563,7 +563,7 @@ void It2MeNativeMessagingHost::OnPolicyUpdate(
|
||||
}
|
||||
}
|
||||
|
||||
base::Optional<bool>
|
||||
absl::optional<bool>
|
||||
It2MeNativeMessagingHost::GetAllowElevatedHostPolicyValue() {
|
||||
DCHECK(policy_received_);
|
||||
#if defined(OS_WIN)
|
||||
@ -581,7 +581,7 @@ It2MeNativeMessagingHost::GetAllowElevatedHostPolicyValue() {
|
||||
}
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
void It2MeNativeMessagingHost::OnPolicyError() {
|
||||
|
@ -11,13 +11,13 @@
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "extensions/browser/api/messaging/native_message_host.h"
|
||||
#include "remoting/host/it2me/it2me_host.h"
|
||||
#include "remoting/protocol/errors.h"
|
||||
#include "remoting/signaling/delegating_signal_strategy.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
#include "remoting/host/native_messaging/log_message_handler.h"
|
||||
@ -104,7 +104,7 @@ class It2MeNativeMessagingHost : public It2MeHost::Observer,
|
||||
std::string ExtractAccessToken(const base::DictionaryValue* message);
|
||||
|
||||
// Returns the value of the 'allow_elevated_host' platform policy or empty.
|
||||
base::Optional<bool> GetAllowElevatedHostPolicyValue();
|
||||
absl::optional<bool> GetAllowElevatedHostPolicyValue();
|
||||
|
||||
// Indicates whether the current process is already elevated.
|
||||
bool is_process_elevated_ = false;
|
||||
|
@ -11,10 +11,10 @@
|
||||
#include "base/files/file_descriptor_watcher_posix.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/strings/utf_string_conversion_utils.h"
|
||||
#include "base/threading/sequenced_task_runner_handle.h"
|
||||
#include "remoting/proto/control.pb.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/base/glib/glib_signal.h"
|
||||
#include "ui/events/keycodes/dom/dom_code.h"
|
||||
#include "ui/events/keycodes/dom/keycode_converter.h"
|
||||
|
@ -16,11 +16,11 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/mac/scoped_cftyperef.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/single_thread_task_runner.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/threading/sequenced_task_runner_handle.h"
|
||||
#include "remoting/proto/control.pb.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/events/keycodes/dom/dom_code.h"
|
||||
#include "ui/events/keycodes/dom/keycode_converter.h"
|
||||
|
||||
@ -59,8 +59,8 @@ class KeyboardLayoutMonitorMac : public KeyboardLayoutMonitor {
|
||||
base::WeakPtrFactory<KeyboardLayoutMonitorMac> weak_ptr_factory_;
|
||||
};
|
||||
|
||||
base::Optional<protocol::LayoutKeyFunction> GetFixedKeyFunction(int keycode);
|
||||
base::Optional<protocol::LayoutKeyFunction> GetCharFunction(UniChar char_code,
|
||||
absl::optional<protocol::LayoutKeyFunction> GetFixedKeyFunction(int keycode);
|
||||
absl::optional<protocol::LayoutKeyFunction> GetCharFunction(UniChar char_code,
|
||||
int keycode);
|
||||
|
||||
KeyboardLayoutMonitorMac::KeyboardLayoutMonitorMac(
|
||||
@ -168,7 +168,7 @@ void KeyboardLayoutMonitorMac::QueryLayoutOnMainLoop(
|
||||
*(*layout_message.mutable_keys())[usb_code].mutable_actions();
|
||||
|
||||
for (int shift_level = 0; shift_level < 4; ++shift_level) {
|
||||
base::Optional<protocol::LayoutKeyFunction> fixed_function =
|
||||
absl::optional<protocol::LayoutKeyFunction> fixed_function =
|
||||
GetFixedKeyFunction(keycode);
|
||||
if (fixed_function) {
|
||||
key_actions[shift_level].set_function(*fixed_function);
|
||||
@ -197,7 +197,7 @@ void KeyboardLayoutMonitorMac::QueryLayoutOnMainLoop(
|
||||
}
|
||||
|
||||
if (result_length == 1) {
|
||||
base::Optional<protocol::LayoutKeyFunction> char_function =
|
||||
absl::optional<protocol::LayoutKeyFunction> char_function =
|
||||
GetCharFunction(result_array[0], keycode);
|
||||
if (char_function) {
|
||||
key_actions[shift_level].set_function(*char_function);
|
||||
@ -221,7 +221,7 @@ void KeyboardLayoutMonitorMac::QueryLayoutOnMainLoop(
|
||||
callback_context->weak_ptr, std::move(layout_message)));
|
||||
}
|
||||
|
||||
base::Optional<protocol::LayoutKeyFunction> GetFixedKeyFunction(int keycode) {
|
||||
absl::optional<protocol::LayoutKeyFunction> GetFixedKeyFunction(int keycode) {
|
||||
// Some keys are not represented in the layout and always have the same
|
||||
// function.
|
||||
switch (keycode) {
|
||||
@ -282,11 +282,11 @@ base::Optional<protocol::LayoutKeyFunction> GetFixedKeyFunction(int keycode) {
|
||||
case kVK_JIS_Eisu:
|
||||
return protocol::LayoutKeyFunction::EISU;
|
||||
default:
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
base::Optional<protocol::LayoutKeyFunction> GetCharFunction(UniChar char_code,
|
||||
absl::optional<protocol::LayoutKeyFunction> GetCharFunction(UniChar char_code,
|
||||
int keycode) {
|
||||
switch (char_code) {
|
||||
case kHomeCharCode:
|
||||
@ -332,7 +332,7 @@ base::Optional<protocol::LayoutKeyFunction> GetCharFunction(UniChar char_code,
|
||||
case kDeleteCharCode:
|
||||
return protocol::LayoutKeyFunction::DELETE_;
|
||||
default:
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,12 +43,12 @@
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/process/launch.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -101,13 +101,13 @@ void PrintUsage() {
|
||||
// Shell-escapes a single argument in a way that is compatible with various
|
||||
// different shells. Returns nullopt when argument contains a newline, which
|
||||
// can't be represented in a cross-shell fashion.
|
||||
base::Optional<std::string> ShellEscapeArgument(
|
||||
absl::optional<std::string> ShellEscapeArgument(
|
||||
const base::StringPiece argument) {
|
||||
std::string result;
|
||||
for (char character : argument) {
|
||||
// csh in particular doesn't provide a good way to handle this
|
||||
if (character == '\n') {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
// Some shells ascribe special meaning to some escape sequences such as \t,
|
||||
@ -228,12 +228,12 @@ class PamHandle {
|
||||
|
||||
// Returns the current username according to PAM. It is possible for PAM
|
||||
// modules to change this from the initial value passed to the constructor.
|
||||
base::Optional<std::string> GetUser() {
|
||||
absl::optional<std::string> GetUser() {
|
||||
const char* user;
|
||||
last_return_code_ = pam_get_item(pam_handle_, PAM_USER,
|
||||
reinterpret_cast<const void**>(&user));
|
||||
if (last_return_code_ != PAM_SUCCESS || user == nullptr)
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
return std::string(user);
|
||||
}
|
||||
|
||||
@ -244,11 +244,11 @@ class PamHandle {
|
||||
}
|
||||
|
||||
// Obtains the list of environment variables provided by PAM modules.
|
||||
base::Optional<base::EnvironmentMap> GetEnvironment() {
|
||||
absl::optional<base::EnvironmentMap> GetEnvironment() {
|
||||
char** environment = pam_getenvlist(pam_handle_);
|
||||
|
||||
if (environment == nullptr)
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
base::EnvironmentMap environment_map;
|
||||
|
||||
@ -318,14 +318,14 @@ std::string FindScriptPath() {
|
||||
// argv[0] with a '-'.
|
||||
std::string shell_name = '-' + base::FilePath(login_shell).BaseName().value();
|
||||
|
||||
base::Optional<std::string> escaped_script_path =
|
||||
absl::optional<std::string> escaped_script_path =
|
||||
ShellEscapeArgument(FindScriptPath());
|
||||
CHECK(escaped_script_path) << "Could not escape script path";
|
||||
|
||||
std::string shell_arg = *escaped_script_path + " --start --child-process";
|
||||
|
||||
for (const std::string& arg : script_args) {
|
||||
base::Optional<std::string> escaped_arg = ShellEscapeArgument(arg);
|
||||
absl::optional<std::string> escaped_arg = ShellEscapeArgument(arg);
|
||||
CHECK(escaped_arg) << "Could not escape script argument";
|
||||
shell_arg += " ";
|
||||
shell_arg += *escaped_arg;
|
||||
@ -364,7 +364,7 @@ std::string FindScriptPath() {
|
||||
|
||||
// Either |user| must be set when running as root, xor the real user ID must be
|
||||
// properly set when running as a user.
|
||||
void Relaunch(const base::Optional<std::string>& user,
|
||||
void Relaunch(const absl::optional<std::string>& user,
|
||||
const std::vector<std::string>& script_args) {
|
||||
CHECK(user.has_value() == (getuid() == 0));
|
||||
|
||||
@ -395,7 +395,7 @@ void Relaunch(const base::Optional<std::string>& user,
|
||||
// Returns: whether the session should be relaunched.
|
||||
bool ExecuteSession(std::string user,
|
||||
bool chown_log,
|
||||
base::Optional<uid_t> match_uid,
|
||||
absl::optional<uid_t> match_uid,
|
||||
const std::vector<std::string>& script_args) {
|
||||
PamHandle pam_handle(kPamName, user.c_str(), &kPamConversation);
|
||||
CHECK(pam_handle.IsInitialized()) << "Failed to initialize PAM";
|
||||
@ -487,7 +487,7 @@ bool ExecuteSession(std::string user,
|
||||
if (child_pid == 0) {
|
||||
PCHECK(setuid(pwinfo->pw_uid) == 0) << "setuid failed";
|
||||
PCHECK(chdir(pwinfo->pw_dir) == 0) << "chdir to $HOME failed";
|
||||
base::Optional<base::EnvironmentMap> pam_environment =
|
||||
absl::optional<base::EnvironmentMap> pam_environment =
|
||||
pam_handle.GetEnvironment();
|
||||
CHECK(pam_environment) << "Failed to get environment from PAM";
|
||||
|
||||
@ -798,7 +798,7 @@ int main(int argc, char** argv) {
|
||||
argv += 2;
|
||||
|
||||
bool foreground = false;
|
||||
base::Optional<std::string> user;
|
||||
absl::optional<std::string> user;
|
||||
std::vector<std::string> script_args;
|
||||
|
||||
while (argc > 0) {
|
||||
@ -850,8 +850,8 @@ int main(int argc, char** argv) {
|
||||
// Daemonizing redirects stdout to a log file, which we want to be owned by
|
||||
// the target user.
|
||||
bool chown_stdout = !foreground;
|
||||
base::Optional<uid_t> match_uid =
|
||||
real_uid != 0 ? base::make_optional(real_uid) : base::nullopt;
|
||||
absl::optional<uid_t> match_uid =
|
||||
real_uid != 0 ? absl::make_optional(real_uid) : absl::nullopt;
|
||||
|
||||
// Fork before opening PAM session so relaunches don't descend from the closed
|
||||
// PAM session.
|
||||
@ -880,7 +880,7 @@ int main(int argc, char** argv) {
|
||||
// If running as root, forward the username argument to the relaunched
|
||||
// process. Otherwise, it should be inferred from the user id and
|
||||
// environment.
|
||||
Relaunch(real_uid == 0 ? user : base::nullopt, script_args);
|
||||
Relaunch(real_uid == 0 ? user : absl::nullopt, script_args);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ std::string TokenValidatorBase::ProcessResponse(int net_result) {
|
||||
? data_.substr(sizeof(kJsonSafetyPrefix) - 1)
|
||||
: data_;
|
||||
|
||||
base::Optional<base::Value> value = base::JSONReader::Read(responseData);
|
||||
absl::optional<base::Value> value = base::JSONReader::Read(responseData);
|
||||
if (!value || !value->is_dict()) {
|
||||
LOG(ERROR) << "Invalid token validation response: '" << data_ << "'";
|
||||
return std::string();
|
||||
|
@ -30,13 +30,13 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/message_loop/message_pump_type.h"
|
||||
#include "base/nix/xdg_util.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/task/single_thread_task_executor.h"
|
||||
#include "remoting/base/string_resources.h"
|
||||
#include "remoting/host/logging.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/icu/source/common/unicode/unistr.h"
|
||||
#include "third_party/icu/source/i18n/unicode/coll.h"
|
||||
#include "ui/base/glib/glib_signal.h"
|
||||
@ -166,7 +166,7 @@ gboolean SessionDialog::OnClose(GtkWidget* dialog, GdkEvent*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
base::Optional<XSession> TryLoadSession(base::FilePath path) {
|
||||
absl::optional<XSession> TryLoadSession(base::FilePath path) {
|
||||
std::unique_ptr<GKeyFile, void (*)(GKeyFile*)> key_file(g_key_file_new(),
|
||||
&g_key_file_free);
|
||||
GError* error;
|
||||
@ -175,14 +175,14 @@ base::Optional<XSession> TryLoadSession(base::FilePath path) {
|
||||
G_KEY_FILE_NONE, &error)) {
|
||||
LOG(WARNING) << "Failed to load " << path << ": " << error->message;
|
||||
g_error_free(error);
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
// Files without a "Desktop Entry" group can be ignored. (An empty file can be
|
||||
// put in a higher-priority directory to hide entries from a lower-priority
|
||||
// directory.)
|
||||
if (!g_key_file_has_group(key_file.get(), G_KEY_FILE_DESKTOP_GROUP)) {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
// Files with "NoDisplay" or "Hidden" set should be ignored.
|
||||
@ -190,7 +190,7 @@ base::Optional<XSession> TryLoadSession(base::FilePath path) {
|
||||
{G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, G_KEY_FILE_DESKTOP_KEY_HIDDEN}) {
|
||||
if (g_key_file_get_boolean(key_file.get(), G_KEY_FILE_DESKTOP_GROUP, key,
|
||||
nullptr)) {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ base::Optional<XSession> TryLoadSession(base::FilePath path) {
|
||||
: !base::ExecutableExistsInPath(base::Environment::Create().get(),
|
||||
try_exec_path.value())) {
|
||||
LOG(INFO) << "Rejecting " << path << " due to TryExec=" << try_exec_path;
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ base::Optional<XSession> TryLoadSession(base::FilePath path) {
|
||||
} else {
|
||||
LOG(WARNING) << "Failed to load value of " << G_KEY_FILE_DESKTOP_KEY_NAME
|
||||
<< " from " << path;
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
if (gchar* exec =
|
||||
@ -234,7 +234,7 @@ base::Optional<XSession> TryLoadSession(base::FilePath path) {
|
||||
} else {
|
||||
LOG(WARNING) << "Failed to load value of " << G_KEY_FILE_DESKTOP_KEY_EXEC
|
||||
<< " from " << path;
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
// Optional fields.
|
||||
@ -296,7 +296,7 @@ std::vector<XSession> CollectXSessions() {
|
||||
"default"});
|
||||
|
||||
for (const auto& session : session_files) {
|
||||
base::Optional<XSession> loaded_session = TryLoadSession(session.second);
|
||||
absl::optional<XSession> loaded_session = TryLoadSession(session.second);
|
||||
if (loaded_session) {
|
||||
sessions.push_back(std::move(*loaded_session));
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class NotificationPresenter final {
|
||||
~NotificationPresenter() = delete;
|
||||
|
||||
void FetchNotificationIfNecessary();
|
||||
void OnNotificationFetched(base::Optional<NotificationMessage> notification);
|
||||
void OnNotificationFetched(absl::optional<NotificationMessage> notification);
|
||||
|
||||
NotificationClient notification_client_;
|
||||
|
||||
|
@ -105,7 +105,7 @@ void NotificationPresenter::FetchNotificationIfNecessary() {
|
||||
}
|
||||
|
||||
void NotificationPresenter::OnNotificationFetched(
|
||||
base::Optional<NotificationMessage> notification) {
|
||||
absl::optional<NotificationMessage> notification) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
DCHECK_EQ(State::FETCHING, state_);
|
||||
|
||||
|
@ -11,10 +11,10 @@
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "net/traffic_annotation/network_traffic_annotation.h"
|
||||
#include "remoting/protocol/p2p_stream_socket.h"
|
||||
#include "remoting/protocol/stream_channel_factory.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace base {
|
||||
class SingleThreadTaskRunner;
|
||||
@ -91,7 +91,7 @@ class FakeStreamSocket : public P2PStreamSocket {
|
||||
int write_limit_ = 0;
|
||||
int next_write_error_ = 0;
|
||||
|
||||
base::Optional<int> next_read_error_;
|
||||
absl::optional<int> next_read_error_;
|
||||
scoped_refptr<net::IOBuffer> read_buffer_;
|
||||
int read_buffer_size_ = 0;
|
||||
net::CompletionOnceCallback read_callback_;
|
||||
|
@ -10,7 +10,7 @@ namespace protocol {
|
||||
FileTransfer_Error MakeFileTransferError(
|
||||
base::Location location,
|
||||
FileTransfer_Error_Type type,
|
||||
base::Optional<int32_t> api_error_code) {
|
||||
absl::optional<int32_t> api_error_code) {
|
||||
FileTransfer_Error error;
|
||||
error.set_type(type);
|
||||
if (api_error_code) {
|
||||
|
@ -9,9 +9,9 @@
|
||||
#include <ostream>
|
||||
|
||||
#include "base/location.h"
|
||||
#include "base/optional.h"
|
||||
#include "remoting/base/result.h"
|
||||
#include "remoting/proto/file_transfer.pb.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace remoting {
|
||||
namespace protocol {
|
||||
@ -22,7 +22,7 @@ using FileTransferResult = Result<SuccessType, FileTransfer_Error>;
|
||||
FileTransfer_Error MakeFileTransferError(
|
||||
base::Location location,
|
||||
FileTransfer_Error_Type type,
|
||||
base::Optional<std::int32_t> api_error_code = base::nullopt);
|
||||
absl::optional<std::int32_t> api_error_code = absl::nullopt);
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, const FileTransfer_Error& error);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef REMOTING_PROTOCOL_PEER_CONNECTION_CONTROLS_H_
|
||||
#define REMOTING_PROTOCOL_PEER_CONNECTION_CONTROLS_H_
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace remoting {
|
||||
namespace protocol {
|
||||
@ -18,8 +18,8 @@ class PeerConnectionControls {
|
||||
|
||||
// Sets preferred min and max bitrates for the peer connection. nullopt means
|
||||
// no preference.
|
||||
virtual void SetPreferredBitrates(base::Optional<int> min_bitrate_bps,
|
||||
base::Optional<int> max_bitrate_bps) = 0;
|
||||
virtual void SetPreferredBitrates(absl::optional<int> min_bitrate_bps,
|
||||
absl::optional<int> max_bitrate_bps) = 0;
|
||||
|
||||
// Performs an ICE restart. This causes the host to initiate a new SDP
|
||||
// offer/answer exchange, and restarts the ICE gathering/connection sequence.
|
||||
|
@ -175,25 +175,25 @@ std::string GetTransportProtocol(
|
||||
// Returns true if the RTC stats report indicates a relay connection. If the
|
||||
// connection type cannot be determined (which should never happen with a valid
|
||||
// RTCStatsReport), nullopt is returned.
|
||||
base::Optional<bool> IsConnectionRelayed(
|
||||
absl::optional<bool> IsConnectionRelayed(
|
||||
const rtc::scoped_refptr<const webrtc::RTCStatsReport>& report) {
|
||||
const webrtc::RTCIceCandidatePairStats* selected_candidate_pair =
|
||||
GetSelectedCandidatePair(report);
|
||||
if (!selected_candidate_pair) {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
const auto* local_candidate =
|
||||
GetIceCandidate<webrtc::RTCLocalIceCandidateStats>(
|
||||
report, *selected_candidate_pair->local_candidate_id);
|
||||
if (!local_candidate) {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
std::string local_candidate_type = *local_candidate->candidate_type;
|
||||
const auto* remote_candidate =
|
||||
GetIceCandidate<webrtc::RTCRemoteIceCandidateStats>(
|
||||
report, *selected_candidate_pair->remote_candidate_id);
|
||||
if (!remote_candidate) {
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
std::string remote_candidate_type = *remote_candidate->candidate_type;
|
||||
|
||||
@ -716,8 +716,8 @@ const SessionOptions& WebrtcTransport::session_options() const {
|
||||
}
|
||||
|
||||
void WebrtcTransport::SetPreferredBitrates(
|
||||
base::Optional<int> min_bitrate_bps,
|
||||
base::Optional<int> max_bitrate_bps) {
|
||||
absl::optional<int> min_bitrate_bps,
|
||||
absl::optional<int> max_bitrate_bps) {
|
||||
preferred_min_bitrate_bps_ = min_bitrate_bps;
|
||||
preferred_max_bitrate_bps_ = max_bitrate_bps;
|
||||
if (connected_) {
|
||||
@ -838,7 +838,7 @@ void WebrtcTransport::Close(ErrorCode error) {
|
||||
void WebrtcTransport::ApplySessionOptions(const SessionOptions& options) {
|
||||
DCHECK(thread_checker_.CalledOnValidThread());
|
||||
session_options_ = options;
|
||||
base::Optional<std::string> video_codec = options.Get("Video-Codec");
|
||||
absl::optional<std::string> video_codec = options.Get("Video-Codec");
|
||||
if (video_codec) {
|
||||
preferred_video_codec_ = *video_codec;
|
||||
}
|
||||
@ -1117,7 +1117,7 @@ void WebrtcTransport::OnStatsDelivered(
|
||||
event_handler_->OnWebrtcTransportProtocolChanged();
|
||||
}
|
||||
|
||||
base::Optional<bool> connection_relayed = IsConnectionRelayed(report);
|
||||
absl::optional<bool> connection_relayed = IsConnectionRelayed(report);
|
||||
if (connection_relayed == connection_relayed_) {
|
||||
// No change in connection type. Unknown -> direct/relayed is treated as a
|
||||
// change, so the correct initial bitrate caps are set.
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/threading/thread_checker.h"
|
||||
#include "base/timer/timer.h"
|
||||
#include "crypto/hmac.h"
|
||||
@ -26,6 +25,7 @@
|
||||
#include "remoting/protocol/webrtc_dummy_video_encoder.h"
|
||||
#include "remoting/protocol/webrtc_event_log_data.h"
|
||||
#include "remoting/signaling/signal_strategy.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/webrtc/api/peer_connection_interface.h"
|
||||
|
||||
namespace base {
|
||||
@ -110,8 +110,8 @@ class WebrtcTransport : public Transport,
|
||||
const SessionOptions& session_options() const override;
|
||||
|
||||
// PeerConnectionControls implementations.
|
||||
void SetPreferredBitrates(base::Optional<int> min_bitrate_bps,
|
||||
base::Optional<int> max_bitrate_bps) override;
|
||||
void SetPreferredBitrates(absl::optional<int> min_bitrate_bps,
|
||||
absl::optional<int> max_bitrate_bps) override;
|
||||
void RequestIceRestart() override;
|
||||
void RequestSdpRestart() override;
|
||||
|
||||
@ -239,7 +239,7 @@ class WebrtcTransport : public Transport,
|
||||
|
||||
bool connected_ = false;
|
||||
|
||||
base::Optional<bool> connection_relayed_;
|
||||
absl::optional<bool> connection_relayed_;
|
||||
|
||||
std::string transport_protocol_;
|
||||
|
||||
@ -265,8 +265,8 @@ class WebrtcTransport : public Transport,
|
||||
|
||||
// Preferred bitrates set by the client. nullopt if the client has not
|
||||
// provided any preferred bitrates.
|
||||
base::Optional<int> preferred_min_bitrate_bps_;
|
||||
base::Optional<int> preferred_max_bitrate_bps_;
|
||||
absl::optional<int> preferred_min_bitrate_bps_;
|
||||
absl::optional<int> preferred_max_bitrate_bps_;
|
||||
|
||||
// Stores event log data generated by WebRTC for the PeerConnection.
|
||||
WebrtcEventLogData rtc_event_log_;
|
||||
|
@ -121,7 +121,7 @@ std::string TestTokenStorageOnDisk::FetchTokenFromKey(const std::string& key) {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
base::Optional<base::Value> token_data(base::JSONReader::Read(file_contents));
|
||||
absl::optional<base::Value> token_data(base::JSONReader::Read(file_contents));
|
||||
base::DictionaryValue* tokens = nullptr;
|
||||
if (!token_data.has_value() || !token_data->GetAsDictionary(&tokens)) {
|
||||
LOG(ERROR) << "File contents were not valid JSON, "
|
||||
@ -160,7 +160,7 @@ bool TestTokenStorageOnDisk::StoreTokenForKey(const std::string& key,
|
||||
}
|
||||
}
|
||||
|
||||
base::Optional<base::Value> token_data(base::JSONReader::Read(file_contents));
|
||||
absl::optional<base::Value> token_data(base::JSONReader::Read(file_contents));
|
||||
base::DictionaryValue* tokens = nullptr;
|
||||
if (!token_data.has_value() || !token_data->GetAsDictionary(&tokens)) {
|
||||
LOG(ERROR) << "Invalid token file format, could not store token.";
|
||||
|
@ -157,13 +157,13 @@ void OnSetRlzPingSent(int retry_count, bool success) {
|
||||
}
|
||||
|
||||
// Copy |value| without empty children.
|
||||
base::Optional<base::Value> CopyWithoutEmptyChildren(const base::Value& value) {
|
||||
absl::optional<base::Value> CopyWithoutEmptyChildren(const base::Value& value) {
|
||||
switch (value.type()) {
|
||||
case base::Value::Type::DICTIONARY: {
|
||||
base::Value::DictStorage storage;
|
||||
|
||||
for (const auto& key_value_pair : value.DictItems()) {
|
||||
base::Optional<base::Value> item_copy =
|
||||
absl::optional<base::Value> item_copy =
|
||||
CopyWithoutEmptyChildren(key_value_pair.second);
|
||||
if (item_copy)
|
||||
storage.insert(
|
||||
@ -171,7 +171,7 @@ base::Optional<base::Value> CopyWithoutEmptyChildren(const base::Value& value) {
|
||||
}
|
||||
|
||||
if (storage.empty())
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
return base::Value(std::move(storage));
|
||||
}
|
||||
@ -181,13 +181,13 @@ base::Optional<base::Value> CopyWithoutEmptyChildren(const base::Value& value) {
|
||||
storage.reserve(value.GetList().size());
|
||||
|
||||
for (const base::Value& item : value.GetList()) {
|
||||
base::Optional<base::Value> item_copy = CopyWithoutEmptyChildren(item);
|
||||
absl::optional<base::Value> item_copy = CopyWithoutEmptyChildren(item);
|
||||
if (item_copy)
|
||||
storage.push_back(std::move(*item_copy));
|
||||
}
|
||||
|
||||
if (storage.empty())
|
||||
return base::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
return base::Value(std::move(storage));
|
||||
}
|
||||
|
Reference in New Issue
Block a user