Skip to content

Commit

Permalink
Rename method: cancelLongPress -> cancelPress in notifications.mojom
Browse files Browse the repository at this point in the history
Now this method is used for cancelling not only long presses but also
normal presses. The change itself has been done in ARC side (ag/5382077),
so that this chromium-side CL just changes the names in the code.

Bug: b/116513513
Test: none

Change-Id: Ief379a954a560de7e4aff13caceb2f7660f60fbb
Reviewed-on: https://chromium-review.googlesource.com/c/1309384
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Greg Kerr <kerrnel@chromium.org>
Commit-Queue: Yoshiki Iguchi <yoshiki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604545}
  • Loading branch information
yoshikig authored and Commit Bot committed Nov 1, 2018
1 parent bf4001e commit 3ca0b0f
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class ArcNotificationContentView::EventForwarder : public ui::EventHandler {
widget->OnMouseEvent(located_event->AsMouseEvent());
} else if (located_event->IsScrollEvent()) {
widget->OnScrollEvent(located_event->AsScrollEvent());
owner_->item_->CancelLongPress();
owner_->item_->CancelPress();
} else if (located_event->IsGestureEvent() &&
event->type() != ui::ET_GESTURE_TAP) {
bool slide_handled_by_android = false;
Expand All @@ -128,7 +128,7 @@ class ArcNotificationContentView::EventForwarder : public ui::EventHandler {
}

if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN)
owner_->item_->CancelLongPress();
owner_->item_->CancelPress();

if (event->type() == ui::ET_GESTURE_SCROLL_END)
swipe_captured_ = false;
Expand Down
2 changes: 1 addition & 1 deletion ash/system/message_center/arc/arc_notification_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ArcNotificationItem {
virtual bool IsManuallyExpandedOrCollapsed() const = 0;

// Cancel long press operation on Android side.
virtual void CancelLongPress() = 0;
virtual void CancelPress() = 0;

// Returns the rect for which Android wants to handle all swipe events.
// Defaults to the empty rectangle.
Expand Down
4 changes: 2 additions & 2 deletions ash/system/message_center/arc/arc_notification_item_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ const std::string& ArcNotificationItemImpl::GetNotificationId() const {
return notification_id_;
}

void ArcNotificationItemImpl::CancelLongPress() {
manager_->CancelLongPress(notification_key_);
void ArcNotificationItemImpl::CancelPress() {
manager_->CancelPress(notification_key_);
}

} // namespace ash
2 changes: 1 addition & 1 deletion ash/system/message_center/arc/arc_notification_item_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ArcNotificationItemImpl : public ArcNotificationItem {
gfx::Rect GetSwipeInputRect() const override;
const std::string& GetNotificationKey() const override;
const std::string& GetNotificationId() const override;
void CancelLongPress() override;
void CancelPress() override;

private:
ArcNotificationManager* const manager_;
Expand Down
6 changes: 3 additions & 3 deletions ash/system/message_center/arc/arc_notification_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,9 @@ void ArcNotificationManager::SetDoNotDisturbStatusOnAndroid(bool enabled) {
notifications_instance->SetDoNotDisturbStatusOnAndroid(std::move(status));
}

void ArcNotificationManager::CancelLongPress(const std::string& key) {
void ArcNotificationManager::CancelPress(const std::string& key) {
auto* notifications_instance =
ARC_GET_INSTANCE_FOR_METHOD(instance_owner_->holder(), CancelLongPress);
ARC_GET_INSTANCE_FOR_METHOD(instance_owner_->holder(), CancelPress);

// On shutdown, the ARC channel may quit earlier than notifications.
if (!notifications_instance) {
Expand All @@ -526,7 +526,7 @@ void ArcNotificationManager::CancelLongPress(const std::string& key) {
return;
}

notifications_instance->CancelLongPress(key);
notifications_instance->CancelPress(key);
}

void ArcNotificationManager::SetNotificationConfiguration() {
Expand Down
2 changes: 1 addition & 1 deletion ash/system/message_center/arc/arc_notification_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ArcNotificationManager
bool IsOpeningSettingsSupported() const;
void SendNotificationToggleExpansionOnChrome(const std::string& key);
void SetDoNotDisturbStatusOnAndroid(bool enabled);
void CancelLongPress(const std::string& key);
void CancelPress(const std::string& key);
void SetNotificationConfiguration();

private:
Expand Down
2 changes: 1 addition & 1 deletion ash/system/message_center/arc/mock_arc_notification_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MockArcNotificationItem : public ArcNotificationItem {
void IncrementWindowRefCount() override {}
void DecrementWindowRefCount() override {}
void OnRemoteInputActivationChanged(bool activate) override {}
void CancelLongPress() override {}
void CancelPress() override {}

arc::mojom::ArcNotificationType GetNotificationType() const override;
arc::mojom::ArcNotificationExpandState GetExpandState() const override;
Expand Down
9 changes: 5 additions & 4 deletions components/arc/common/notifications.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,12 @@ interface NotificationsInstance {
[MinVersion=18]
SetDoNotDisturbStatusOnAndroid@7(ArcDoNotDisturbStatus status);

// Cancels the long-press operation even during touching the view. This should
// be called when the on-going gesture is recognized not as a normal touch
// event but as a scroll event, and the on-going touch should be cancelled.
// Cancels the current press operation even during touching the view. This
// should be called when the on-going gesture is recognized not as a normal
// touch event but as a scroll event, and the on-going touch events should be
// cancelled.
[MinVersion=19]
CancelLongPress@8(string key);
CancelPress@8(string key);

// Performs the user action being deferred in Android.
[MinVersion=21]
Expand Down
2 changes: 1 addition & 1 deletion components/arc/test/fake_notifications_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void FakeNotificationsInstance::SetDoNotDisturbStatusOnAndroid(
latest_do_not_disturb_status_ = std::move(status);
}

void FakeNotificationsInstance::CancelLongPress(const std::string& key) {}
void FakeNotificationsInstance::CancelPress(const std::string& key) {}

void FakeNotificationsInstance::InitDeprecated(
mojom::NotificationsHostPtr host_ptr) {
Expand Down
2 changes: 1 addition & 1 deletion components/arc/test/fake_notifications_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FakeNotificationsInstance : public mojom::NotificationsInstance {
void OpenNotificationSnoozeSettings(const std::string& key) override;
void SetDoNotDisturbStatusOnAndroid(
mojom::ArcDoNotDisturbStatusPtr status) override;
void CancelLongPress(const std::string& key) override;
void CancelPress(const std::string& key) override;
void PerformDeferredUserAction(uint32_t action_id) override;
void CancelDeferredUserAction(uint32_t action_id) override;
void SetLockScreenSettingOnAndroid(
Expand Down

0 comments on commit 3ca0b0f

Please sign in to comment.