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