Commit 9b8b4ece authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Revert "[CrOS PhoneHub] Add setter functions to various manager classes"

This reverts commit 6a3c229f.

Reason for revert: Collided with https://crrev.com/810071

This CL renamed SetHasAccessBeenGranted(), but the other CL added
more calls to it.

Original change's description:
> [CrOS PhoneHub] Add setter functions to various manager classes
> 
> The added setters are going to be used by a future Cl that implements
> the PhoneStatusProcessor class.
> 
> Bug: 1106937
> Change-Id: Ie95210cfcedbba2ad3ed5875a34ef21a7486b13f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2423346
> Commit-Queue: Jimmy Gong <jimmyxgong@chromium.org>
> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#810084}

TBR=khorimoto@chromium.org,jimmyxgong@chromium.org

Change-Id: I241a33162c008e5f7ab4de0621f1bdb6c0918965
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1106937
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2428103Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810089}
parent 6caff4fb
......@@ -77,7 +77,7 @@ class PhoneHubNotificationControllerTest : public AshTestBase {
TEST_F(PhoneHubNotificationControllerTest, AddNotifications) {
EXPECT_FALSE(message_center_->NotificationCount());
notification_manager_.SetNotificationsInternal(fake_notifications_);
notification_manager_.SetNotifications(fake_notifications_);
EXPECT_EQ(3u, message_center_->NotificationCount());
ASSERT_TRUE(
......@@ -95,7 +95,7 @@ TEST_F(PhoneHubNotificationControllerTest, AddNotifications) {
TEST_F(PhoneHubNotificationControllerTest, UpdateNotifications) {
EXPECT_FALSE(message_center_->NotificationCount());
notification_manager_.SetNotificationsInternal(fake_notifications_);
notification_manager_.SetNotifications(fake_notifications_);
EXPECT_EQ(3u, message_center_->NotificationCount());
auto* notification =
......@@ -124,7 +124,7 @@ TEST_F(PhoneHubNotificationControllerTest, UpdateNotifications) {
TEST_F(PhoneHubNotificationControllerTest, RemoveNotifications) {
EXPECT_FALSE(message_center_->NotificationCount());
notification_manager_.SetNotificationsInternal(fake_notifications_);
notification_manager_.SetNotifications(fake_notifications_);
EXPECT_EQ(3u, message_center_->NotificationCount());
notification_manager_.RemoveNotification(kPhoneHubNotificationId0);
......@@ -132,13 +132,13 @@ TEST_F(PhoneHubNotificationControllerTest, RemoveNotifications) {
EXPECT_FALSE(
message_center_->FindVisibleNotificationById(kCrOSNotificationId0));
notification_manager_.RemoveNotificationsInternal(base::flat_set<int64_t>(
notification_manager_.RemoveNotifications(base::flat_set<int64_t>(
{kPhoneHubNotificationId1, kPhoneHubNotificationId2}));
EXPECT_FALSE(message_center_->NotificationCount());
}
TEST_F(PhoneHubNotificationControllerTest, CloseByUser) {
notification_manager_.SetNotificationsInternal(fake_notifications_);
notification_manager_.SetNotifications(fake_notifications_);
EXPECT_EQ(3u, message_center_->NotificationCount());
message_center_->RemoveNotification(kCrOSNotificationId0, /*by_user=*/true);
......@@ -152,7 +152,7 @@ TEST_F(PhoneHubNotificationControllerTest, CloseByUser) {
}
TEST_F(PhoneHubNotificationControllerTest, InlineReply) {
notification_manager_.SetNotificationsInternal(fake_notifications_);
notification_manager_.SetNotifications(fake_notifications_);
const base::string16 kInlineReply0 = base::UTF8ToUTF16("inline reply 0");
const base::string16 kInlineReply1 = base::UTF8ToUTF16("inline reply 1");
......
......@@ -236,7 +236,7 @@ class MultideviceHandlerTest : public testing::Test {
}
void CallAttemptNotificationSetup(bool has_access_been_granted) {
fake_notification_access_manager()->SetHasAccessBeenGrantedInternal(
fake_notification_access_manager()->SetHasAccessBeenGranted(
has_access_been_granted);
base::ListValue empty_args;
test_web_ui()->HandleReceivedMessage("attemptNotificationSetup",
......
......@@ -32,7 +32,7 @@ class DoNotDisturbController {
// Note: Setting DND state is not a synchronous operation, since it requires
// sending a message to the connected phone. Use the observer interface to be
// notified of when the state changes.
virtual void RequestNewDoNotDisturbState(bool enabled) = 0;
virtual void SetDoNotDisturbState(bool enabled) = 0;
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
......@@ -40,10 +40,6 @@ class DoNotDisturbController {
protected:
DoNotDisturbController();
// This only sets the internal state of the DoNotDisturb mode and does not
// send a request to set the state of the remote phone device.
virtual void SetDoNotDisturbStateInternal(bool is_dnd_enabled) = 0;
void NotifyDndStateChanged();
private:
......
......@@ -17,12 +17,7 @@ bool DoNotDisturbControllerImpl::IsDndEnabled() const {
return is_dnd_enabled_;
}
void DoNotDisturbControllerImpl::SetDoNotDisturbStateInternal(
bool is_dnd_enabled) {
is_dnd_enabled_ = is_dnd_enabled;
}
void DoNotDisturbControllerImpl::RequestNewDoNotDisturbState(bool enabled) {
void DoNotDisturbControllerImpl::SetDoNotDisturbState(bool enabled) {
PA_LOG(INFO) << "Attempting to set DND state; new value: " << enabled;
}
......
......@@ -19,8 +19,7 @@ class DoNotDisturbControllerImpl : public DoNotDisturbController {
private:
// DoNotDisturbController:
bool IsDndEnabled() const override;
void SetDoNotDisturbStateInternal(bool is_dnd_enabled) override;
void RequestNewDoNotDisturbState(bool enabled) override;
void SetDoNotDisturbState(bool enabled) override;
bool is_dnd_enabled_ = false;
};
......
......@@ -15,18 +15,13 @@ bool FakeDoNotDisturbController::IsDndEnabled() const {
return is_dnd_enabled_;
}
void FakeDoNotDisturbController::SetDoNotDisturbStateInternal(
bool is_dnd_enabled) {
if (is_dnd_enabled_ == is_dnd_enabled)
void FakeDoNotDisturbController::SetDoNotDisturbState(bool enabled) {
if (is_dnd_enabled_ == enabled)
return;
is_dnd_enabled_ = is_dnd_enabled;
is_dnd_enabled_ = enabled;
NotifyDndStateChanged();
}
void FakeDoNotDisturbController::RequestNewDoNotDisturbState(bool enabled) {
SetDoNotDisturbStateInternal(enabled);
}
} // namespace phonehub
} // namespace chromeos
......@@ -17,8 +17,7 @@ class FakeDoNotDisturbController : public DoNotDisturbController {
// DoNotDisturbController:
bool IsDndEnabled() const override;
void SetDoNotDisturbStateInternal(bool is_dnd_enabled) override;
void RequestNewDoNotDisturbState(bool enabled) override;
void SetDoNotDisturbState(bool enabled) override;
private:
bool is_dnd_enabled_ = false;
......
......@@ -15,18 +15,13 @@ bool FakeFindMyDeviceController::IsPhoneRinging() const {
return is_phone_ringing_;
}
void FakeFindMyDeviceController::SetIsPhoneRingingInternal(
bool is_phone_ringing) {
if (is_phone_ringing_ == is_phone_ringing)
void FakeFindMyDeviceController::SetPhoneRingingState(bool ringing) {
if (is_phone_ringing_ == ringing)
return;
is_phone_ringing_ = is_phone_ringing;
is_phone_ringing_ = ringing;
NotifyPhoneRingingStateChanged();
}
void FakeFindMyDeviceController::RequestNewPhoneRingingState(bool ringing) {
SetIsPhoneRingingInternal(ringing);
}
} // namespace phonehub
} // namespace chromeos
......@@ -17,8 +17,7 @@ class FakeFindMyDeviceController : public FindMyDeviceController {
// FindMyDeviceController:
bool IsPhoneRinging() const override;
void SetIsPhoneRingingInternal(bool is_phone_ringing) override;
void RequestNewPhoneRingingState(bool ringing) override;
void SetPhoneRingingState(bool ringing) override;
private:
bool is_phone_ringing_ = false;
......
......@@ -13,7 +13,7 @@ FakeNotificationAccessManager::FakeNotificationAccessManager(
FakeNotificationAccessManager::~FakeNotificationAccessManager() = default;
void FakeNotificationAccessManager::SetHasAccessBeenGrantedInternal(
void FakeNotificationAccessManager::SetHasAccessBeenGranted(
bool has_access_been_granted) {
if (has_access_been_granted_ == has_access_been_granted)
return;
......@@ -30,7 +30,7 @@ void FakeNotificationAccessManager::SetNotificationSetupOperationStatus(
NotificationAccessSetupOperation::Status new_status) {
if (new_status ==
NotificationAccessSetupOperation::Status::kCompletedSuccessfully) {
SetHasAccessBeenGrantedInternal(true);
SetHasAccessBeenGranted(true);
}
NotificationAccessManager::SetNotificationSetupOperationStatus(new_status);
......
......@@ -17,7 +17,7 @@ class FakeNotificationAccessManager : public NotificationAccessManager {
using NotificationAccessManager::IsSetupOperationInProgress;
void SetHasAccessBeenGrantedInternal(bool has_access_been_granted) override;
void SetHasAccessBeenGranted(bool has_access_been_granted);
void SetNotificationSetupOperationStatus(
NotificationAccessSetupOperation::Status new_status);
......
......@@ -22,10 +22,10 @@ FakeNotificationManager::~FakeNotificationManager() = default;
void FakeNotificationManager::SetNotification(
const Notification& notification) {
SetNotificationsInternal(base::flat_set<Notification>{notification});
SetNotifications(base::flat_set<Notification>{notification});
}
void FakeNotificationManager::SetNotificationsInternal(
void FakeNotificationManager::SetNotifications(
const base::flat_set<Notification>& notifications) {
base::flat_set<int64_t> added_ids;
base::flat_set<int64_t> updated_ids;
......@@ -49,10 +49,10 @@ void FakeNotificationManager::SetNotificationsInternal(
}
void FakeNotificationManager::RemoveNotification(int64_t id) {
RemoveNotificationsInternal(base::flat_set<int64_t>{id});
RemoveNotifications(base::flat_set<int64_t>{id});
}
void FakeNotificationManager::RemoveNotificationsInternal(
void FakeNotificationManager::RemoveNotifications(
const base::flat_set<int64_t>& ids) {
for (int64_t id : ids) {
auto it = id_to_notification_map_.find(id);
......
......@@ -21,11 +21,10 @@ class FakeNotificationManager : public NotificationManager {
~FakeNotificationManager() override;
void SetNotification(const Notification& notification);
void SetNotificationsInternal(
const base::flat_set<Notification>& notifications) override;
void SetNotifications(const base::flat_set<Notification>& notifications);
void RemoveNotification(int64_t id);
void RemoveNotificationsInternal(const base::flat_set<int64_t>& ids) override;
void RemoveNotifications(const base::flat_set<int64_t>& ids);
const std::vector<int64_t>& dismissed_notification_ids() const {
return dismissed_notification_ids_;
......
......@@ -34,7 +34,7 @@ class FindMyDeviceController {
// Note: Ringing the phone via Find My Device is not a synchronous operation,
// since it requires sending a message to the connected phone. Use the
// observer interface to be notified of when the state changes.
virtual void RequestNewPhoneRingingState(bool ringing) = 0;
virtual void SetPhoneRingingState(bool ringing) = 0;
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
......@@ -42,9 +42,6 @@ class FindMyDeviceController {
protected:
FindMyDeviceController();
// This only sets the internal state of the whether the phone is ringin
// and does not send a request to start ringing the the remote phone device.
virtual void SetIsPhoneRingingInternal(bool is_phone_ringing) = 0;
void NotifyPhoneRingingStateChanged();
private:
......
......@@ -17,12 +17,7 @@ bool FindMyDeviceControllerImpl::IsPhoneRinging() const {
return is_phone_ringing_;
}
void FindMyDeviceControllerImpl::SetIsPhoneRingingInternal(
bool is_phone_ringing) {
is_phone_ringing_ = is_phone_ringing;
}
void FindMyDeviceControllerImpl::RequestNewPhoneRingingState(bool ringing) {
void FindMyDeviceControllerImpl::SetPhoneRingingState(bool ringing) {
PA_LOG(INFO) << "Attempting to set Find My Device phone ring state; new "
<< "value: " << ringing;
}
......
......@@ -19,8 +19,7 @@ class FindMyDeviceControllerImpl : public FindMyDeviceController {
private:
// FindMyDeviceController:
bool IsPhoneRinging() const override;
void SetIsPhoneRingingInternal(bool is_phone_ringing) override;
void RequestNewPhoneRingingState(bool ringing) override;
void SetPhoneRingingState(bool ringing) override;
bool is_phone_ringing_ = false;
};
......
......@@ -72,12 +72,6 @@ class NotificationAccessManager {
private:
friend class NotificationAccessManagerImplTest;
// This only sets the internal state of the whether notification access has
// mode been enabled and does not send a request to set the state of the
// remote phone device.
virtual void SetHasAccessBeenGrantedInternal(
bool has_access_been_granted) = 0;
void OnSetupOperationDeleted(int operation_id);
int next_operation_id_ = 0;
......
......@@ -28,13 +28,6 @@ bool NotificationAccessManagerImpl::HasAccessBeenGranted() const {
return pref_service_->GetBoolean(prefs::kNotificationAccessGranted);
}
void NotificationAccessManagerImpl::SetHasAccessBeenGrantedInternal(
bool has_access_been_granted) {
PA_LOG(INFO) << "Notification access state has been set to: "
<< has_access_been_granted;
// TODO(jimmyxgong): Implement this stub function.
}
void NotificationAccessManagerImpl::OnSetupAttemptStarted() {
PA_LOG(INFO) << "Notification access setup flow started.";
// TODO(khorimoto): Attempt notification setup flow.
......
......@@ -28,7 +28,6 @@ class NotificationAccessManagerImpl : public NotificationAccessManager {
private:
// NotificationAccessManager:
bool HasAccessBeenGranted() const override;
void SetHasAccessBeenGrantedInternal(bool has_access_been_granted) override;
void OnSetupAttemptStarted() override;
void OnSetupAttemptEnded() override;
......
......@@ -10,7 +10,6 @@
#include "base/containers/flat_set.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
#include "chromeos/components/phonehub/notification.h"
namespace chromeos {
namespace phonehub {
......@@ -63,17 +62,6 @@ class NotificationManager {
protected:
NotificationManager();
// Sets the internal collection of notifications. This does not send any
// requests to the remote phone device.
virtual void SetNotificationsInternal(
const base::flat_set<Notification>& notifications) = 0;
// Removes the dismissed notifications from the internal collection of
// notifications. Does not send a request to remove notifications to the
// remote device.
virtual void RemoveNotificationsInternal(
const base::flat_set<int64_t>& notification_ids) = 0;
void NotifyNotificationsAdded(
const base::flat_set<int64_t>& notification_ids);
void NotifyNotificationsUpdated(
......
......@@ -5,7 +5,6 @@
#include "chromeos/components/phonehub/notification_manager_impl.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/components/phonehub/notification.h"
namespace chromeos {
namespace phonehub {
......@@ -19,18 +18,6 @@ const Notification* NotificationManagerImpl::GetNotification(
return nullptr;
}
void NotificationManagerImpl::SetNotificationsInternal(
const base::flat_set<Notification>& notifications) {
PA_LOG(INFO) << "Setting notifications internally.";
// TODO(jimmyxong): Implement this stub function.
}
void NotificationManagerImpl::RemoveNotificationsInternal(
const base::flat_set<int64_t>& notification_ids) {
PA_LOG(INFO) << "Removing notifications internally.";
// TODO(jimmyxgong): Implement this stub function.
}
void NotificationManagerImpl::DismissNotification(int64_t notification_id) {
PA_LOG(INFO) << "Dismissing notification with ID " << notification_id << ".";
}
......
......@@ -5,8 +5,6 @@
#ifndef CHROMEOS_COMPONENTS_PHONEHUB_NOTIFICATION_MANAGER_IMPL_H_
#define CHROMEOS_COMPONENTS_PHONEHUB_NOTIFICATION_MANAGER_IMPL_H_
#include "base/containers/flat_set.h"
#include "chromeos/components/phonehub/notification.h"
#include "chromeos/components/phonehub/notification_manager.h"
namespace chromeos {
......@@ -21,10 +19,6 @@ class NotificationManagerImpl : public NotificationManager {
private:
// NotificationManager:
const Notification* GetNotification(int64_t notification_id) const override;
void SetNotificationsInternal(
const base::flat_set<Notification>& notifications) override;
void RemoveNotificationsInternal(
const base::flat_set<int64_t>& notification_ids) override;
void DismissNotification(int64_t notification_id) override;
void SendInlineReply(int64_t notification_id,
const base::string16& inline_reply_text) override;
......
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