Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1734)

Unified Diff: ash/system/palette/palette_tray.cc

Issue 2961313003: Touch gestures for System Tray/ IME/ Stylus/ Notifications (Closed)
Patch Set: Swiping IME/Stylues/System tray/Notifications tray/bubble. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/system/palette/palette_tray.cc
diff --git a/ash/system/palette/palette_tray.cc b/ash/system/palette/palette_tray.cc
index c7da960ac4c17e251bf3cd51e389534e0df41df2..bac92925fd7bb400c274a86813b06d3941fd65da 100644
--- a/ash/system/palette/palette_tray.cc
+++ b/ash/system/palette/palette_tray.cc
@@ -163,17 +163,6 @@ PaletteTray::~PaletteTray() {
Shell::Get()->RemoveShellObserver(this);
}
-bool PaletteTray::PerformAction(const ui::Event& event) {
- if (bubble_) {
- if (num_actions_in_bubble_ == 0)
- RecordPaletteOptionsUsage(PaletteTrayOptions::PALETTE_CLOSED_NO_ACTION);
- HidePalette();
- return true;
- }
-
- return ShowPalette();
-}
-
bool PaletteTray::ShowPalette() {
if (bubble_)
return false;
@@ -324,6 +313,11 @@ void PaletteTray::HideBubble(const views::TrayBubbleView* bubble_view) {
HideBubbleWithView(bubble_view);
}
+bool PaletteTray::ProcessGestureEventForBubble(ui::GestureEvent* event) {
+ return drag_controller()->ProcessGestureEvent(*event, this,
+ true /* is_on_bubble */);
+}
+
void PaletteTray::HidePalette() {
is_bubble_auto_opened_ = false;
num_actions_in_bubble_ = 0;
@@ -385,6 +379,44 @@ void PaletteTray::Initialize() {
&PaletteTray::OnPaletteEnabledPrefChanged, weak_factory_.GetWeakPtr()));
}
+bool PaletteTray::PerformAction(const ui::Event& event) {
+ if (bubble_) {
+ if (num_actions_in_bubble_ == 0)
+ RecordPaletteOptionsUsage(PaletteTrayOptions::PALETTE_CLOSED_NO_ACTION);
+ HidePalette();
+ return true;
+ }
+
+ return ShowPalette();
+}
+
+bool PaletteTray::HasBubble() {
+ return bubble_.get() != NULL;
+}
+
+void PaletteTray::CloseBubble() {
+ HidePalette();
+}
+
+void PaletteTray::ShowBubble() {
+ ShowPalette();
+}
+
+views::TrayBubbleView* PaletteTray::GetBubbleView() {
+ if (HasBubble())
+ return bubble_->bubble_view();
+ return nullptr;
+}
+
+void PaletteTray::OnGestureEvent(ui::GestureEvent* event) {
+ if (drag_controller()->ProcessGestureEvent(*event, this,
+ false /* is_on_bubble */)) {
+ event->SetHandled();
+ } else {
+ TrayBackgroundView::OnGestureEvent(event);
+ }
+}
+
void PaletteTray::UpdateTrayIcon() {
icon_->SetImage(CreateVectorIcon(
palette_tool_manager_->GetActiveTrayIcon(

Powered by Google App Engine
This is Rietveld 408576698