Commit 61bad0a5 authored by Erik Chen's avatar Erik Chen Committed by Chromium LUCI CQ

lacros: Add const to LacrosChromeServiceImpl Is{Foo}Available methods.

This CL is a refactor with no intended behavior change.

Change-Id: Ia4fd3f50e92674b1b16cb44488b6131e71d5d509
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2625826Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843757}
parent 283809b2
......@@ -493,41 +493,41 @@ void LacrosChromeServiceImpl::DisableCrosapiForTests() {
g_disable_all_crosapi_for_tests = true;
}
bool LacrosChromeServiceImpl::IsMessageCenterAvailable() {
bool LacrosChromeServiceImpl::IsMessageCenterAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version &&
version.value() >=
AshChromeService::MethodMinVersions::kBindMessageCenterMinVersion;
}
bool LacrosChromeServiceImpl::IsSelectFileAvailable() {
bool LacrosChromeServiceImpl::IsSelectFileAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version &&
version.value() >=
AshChromeService::MethodMinVersions::kBindSelectFileMinVersion;
}
bool LacrosChromeServiceImpl::IsKeystoreServiceAvailable() {
bool LacrosChromeServiceImpl::IsKeystoreServiceAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version && version.value() >= AshChromeService::MethodMinVersions::
kBindKeystoreServiceMinVersion;
}
bool LacrosChromeServiceImpl::IsHidManagerAvailable() {
bool LacrosChromeServiceImpl::IsHidManagerAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version &&
version.value() >=
AshChromeService::MethodMinVersions::kBindHidManagerMinVersion;
}
bool LacrosChromeServiceImpl::IsFeedbackAvailable() {
bool LacrosChromeServiceImpl::IsFeedbackAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version &&
version.value() >=
AshChromeService::MethodMinVersions::kBindFeedbackMinVersion;
}
bool LacrosChromeServiceImpl::IsAccountManagerAvailable() {
bool LacrosChromeServiceImpl::IsAccountManagerAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version &&
version.value() >=
......@@ -544,14 +544,14 @@ void LacrosChromeServiceImpl::BindAccountManagerReceiver(
weak_sequenced_state_, std::move(pending_receiver)));
}
bool LacrosChromeServiceImpl::IsFileManagerAvailable() {
bool LacrosChromeServiceImpl::IsFileManagerAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version &&
version.value() >=
AshChromeService::MethodMinVersions::kBindFileManagerMinVersion;
}
bool LacrosChromeServiceImpl::IsTestControllerAvailable() {
bool LacrosChromeServiceImpl::IsTestControllerAvailable() const {
#if BUILDFLAG(IS_CHROMEOS_DEVICE)
// The test controller is not available on production devices as tests only
// run on Linux.
......@@ -564,21 +564,21 @@ bool LacrosChromeServiceImpl::IsTestControllerAvailable() {
#endif
}
bool LacrosChromeServiceImpl::IsClipboardAvailable() {
bool LacrosChromeServiceImpl::IsClipboardAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version &&
version.value() >=
AshChromeService::MethodMinVersions::kBindClipboardMinVersion;
}
bool LacrosChromeServiceImpl::IsScreenManagerAvailable() {
bool LacrosChromeServiceImpl::IsScreenManagerAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version &&
version.value() >=
AshChromeService::MethodMinVersions::kBindScreenManagerMinVersion;
}
bool LacrosChromeServiceImpl::IsMediaSessionAudioFocusAvailable() {
bool LacrosChromeServiceImpl::IsMediaSessionAudioFocusAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version && version.value() >=
AshChromeService::MethodMinVersions::
......@@ -596,7 +596,7 @@ void LacrosChromeServiceImpl::BindAudioFocusManager(
weak_sequenced_state_, std::move(remote)));
}
bool LacrosChromeServiceImpl::IsMediaSessionAudioFocusDebugAvailable() {
bool LacrosChromeServiceImpl::IsMediaSessionAudioFocusDebugAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version && version.value() >=
AshChromeService::MethodMinVersions::
......@@ -615,7 +615,7 @@ void LacrosChromeServiceImpl::BindAudioFocusManagerDebug(
weak_sequenced_state_, std::move(remote)));
}
bool LacrosChromeServiceImpl::IsMediaSessionControllerAvailable() {
bool LacrosChromeServiceImpl::IsMediaSessionControllerAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version && version.value() >=
AshChromeService::MethodMinVersions::
......@@ -634,7 +634,7 @@ void LacrosChromeServiceImpl::BindMediaControllerManager(
weak_sequenced_state_, std::move(remote)));
}
bool LacrosChromeServiceImpl::IsMetricsReportingAvailable() {
bool LacrosChromeServiceImpl::IsMetricsReportingAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version && version.value() >= AshChromeService::MethodMinVersions::
kBindMetricsReportingMinVersion;
......@@ -650,27 +650,27 @@ void LacrosChromeServiceImpl::BindMetricsReporting(
weak_sequenced_state_, std::move(receiver)));
}
bool LacrosChromeServiceImpl::IsCertDbAvailable() {
bool LacrosChromeServiceImpl::IsCertDbAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version &&
version.value() >=
AshChromeService::MethodMinVersions::kBindCertDatabaseMinVersion;
}
bool LacrosChromeServiceImpl::IsDeviceAttributesAvailable() {
bool LacrosChromeServiceImpl::IsDeviceAttributesAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version && version.value() >= AshChromeService::MethodMinVersions::
kBindDeviceAttributesMinVersion;
}
bool LacrosChromeServiceImpl::IsPrefsAvailable() {
bool LacrosChromeServiceImpl::IsPrefsAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version &&
version.value() >=
AshChromeService::MethodMinVersions::kBindPrefsMinVersion;
}
bool LacrosChromeServiceImpl::IsOnLacrosStartupAvailable() {
bool LacrosChromeServiceImpl::IsOnLacrosStartupAvailable() const {
base::Optional<uint32_t> version = AshChromeServiceVersion();
return version &&
version.value() >=
......@@ -729,7 +729,8 @@ void LacrosChromeServiceImpl::GetActiveTabUrlAffineSequence(
delegate_->GetActiveTabUrl(std::move(callback));
}
base::Optional<uint32_t> LacrosChromeServiceImpl::AshChromeServiceVersion() {
base::Optional<uint32_t> LacrosChromeServiceImpl::AshChromeServiceVersion()
const {
if (g_disable_all_crosapi_for_tests)
return base::nullopt;
DCHECK(did_bind_receiver_);
......
......@@ -89,7 +89,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
// --------------------------------------------------------------------------
// message_center_remote() can only be used if this method returns true.
bool IsMessageCenterAvailable();
bool IsMessageCenterAvailable() const;
// This must be called on the affine sequence.
mojo::Remote<crosapi::mojom::MessageCenter>& message_center_remote() {
......@@ -99,7 +99,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
}
// select_file_remote() can only be used if this method returns true.
bool IsSelectFileAvailable();
bool IsSelectFileAvailable() const;
// This must be called on the affine sequence. It exposes a remote that can
// be used to show a select-file dialog.
......@@ -110,7 +110,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
}
// keystore_service_remote() can only be used if this method returns true.
bool IsKeystoreServiceAvailable();
bool IsKeystoreServiceAvailable() const;
// This must be called on the affine sequence. It exposes a remote that can
// be used to query the system keystores.
......@@ -121,7 +121,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
}
// hid_manager_remote() can only be used if this method returns true.
bool IsHidManagerAvailable();
bool IsHidManagerAvailable() const;
// This must be called on the affine sequence. It exposes a remote that can
// be used to support HID devices.
......@@ -132,7 +132,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
}
// feedback_remote() can only be used when this method returns true;
bool IsFeedbackAvailable();
bool IsFeedbackAvailable() const;
// This must be called on the affine sequence.
mojo::Remote<crosapi::mojom::Feedback>& feedback_remote() {
......@@ -143,7 +143,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
// media_session_audio_focus_remote() can only be used when this method
// returns true;
bool IsMediaSessionAudioFocusAvailable();
bool IsMediaSessionAudioFocusAvailable() const;
// This must be called on the affine sequence.
void BindAudioFocusManager(
......@@ -151,7 +151,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
// media_session_audio_focus_debug_remote() can only be used when this method
// returns true;
bool IsMediaSessionAudioFocusDebugAvailable();
bool IsMediaSessionAudioFocusDebugAvailable() const;
// This must be called on the affine sequence.
void BindAudioFocusManagerDebug(
......@@ -160,7 +160,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
// media_session_controller_remote() can only be used when this method returns
// true;
bool IsMediaSessionControllerAvailable();
bool IsMediaSessionControllerAvailable() const;
// This must be called on the affine sequence.
void BindMediaControllerManager(
......@@ -168,14 +168,14 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
remote);
// Whether the MetricsReporting API is available.
bool IsMetricsReportingAvailable();
bool IsMetricsReportingAvailable() const;
// Binds a receiver for the MetricsReporting API. May be called on any thread.
void BindMetricsReporting(
mojo::PendingReceiver<crosapi::mojom::MetricsReporting> receiver);
// cert_database_remote() can only be used when this method returns true;
bool IsCertDbAvailable();
bool IsCertDbAvailable() const;
// This must be called on the affine sequence.
mojo::Remote<crosapi::mojom::CertDatabase>& cert_database_remote() {
......@@ -185,7 +185,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
}
// Whether the DeviceAttributes API is available.
bool IsDeviceAttributesAvailable();
bool IsDeviceAttributesAvailable() const;
// This must be called on the affine sequence. It exposes a remote that can
// be used to interface with DeviceAttributes.
......@@ -196,7 +196,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
}
// file_manager_remote() can only be used if this method returns true.
bool IsFileManagerAvailable();
bool IsFileManagerAvailable() const;
// Must be called on the affine sequence.
mojo::Remote<crosapi::mojom::FileManager>& file_manager_remote() {
......@@ -206,7 +206,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
}
// test_controller_remote() can only be used if this method returns true.
bool IsTestControllerAvailable();
bool IsTestControllerAvailable() const;
// Must be called on the affine sequence.
mojo::Remote<crosapi::mojom::TestController>& test_controller_remote() {
......@@ -216,7 +216,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
}
// clipboard_remote() can only be used if this method returns true.
bool IsClipboardAvailable();
bool IsClipboardAvailable() const;
// This must be called on the affine sequence. It exposes a remote that can
// be used to interface with the clipboard
......@@ -227,7 +227,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
}
// Whether the Prefs API is available.
bool IsPrefsAvailable();
bool IsPrefsAvailable() const;
// This must be called on the affine sequence. It exposes a remote that can
// be used to interface with Prefs.
......@@ -245,14 +245,14 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
// --------------------------------------------------------------------------
// BindScreenManagerReceiver() can only be used if this method returns true.
bool IsScreenManagerAvailable();
bool IsScreenManagerAvailable() const;
// This may be called on any thread.
void BindScreenManagerReceiver(
mojo::PendingReceiver<crosapi::mojom::ScreenManager> pending_receiver);
// BindAccountManagerReceiver() can only be used if this method returns true.
bool IsAccountManagerAvailable();
bool IsAccountManagerAvailable() const;
// This may be called on any thread.
void BindAccountManagerReceiver(
......@@ -260,7 +260,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
// OnLacrosStartup method of AshChromeService crosapi can only be called
// if this method returns true.
bool IsOnLacrosStartupAvailable();
bool IsOnLacrosStartupAvailable() const;
// Returns LacrosInitParams which is passed from ash-chrome. On launching
// lacros-chrome from ash-chrome, ash-chrome creates a memory backed file
......@@ -311,7 +311,7 @@ class COMPONENT_EXPORT(CHROMEOS_LACROS) LacrosChromeServiceImpl {
// Returns ash's version of the AshChromeService mojo interface version. This
// determines which interface methods are available. This is safe to call from
// any sequence. This can only be called after BindReceiver().
base::Optional<uint32_t> AshChromeServiceVersion();
base::Optional<uint32_t> AshChromeServiceVersion() const;
// Delegate instance to inject Chrome dependent code. Must only be used on the
// affine sequence.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment