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

Side by Side Diff: ash/system/tray/system_tray_bubble.cc

Issue 2961313003: Touch gestures for System Tray/ IME/ Stylus/ Notifications (Closed)
Patch Set: Add |is_on_bubble_| instead of. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/system/tray/system_tray_bubble.h" 5 #include "ash/system/tray/system_tray_bubble.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/session/session_controller.h" 10 #include "ash/session/session_controller.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 system_tray_bubble_->Close(); 82 system_tray_bubble_->Close();
83 delete this; 83 delete this;
84 } 84 }
85 85
86 private: 86 private:
87 SystemTrayBubble* system_tray_bubble_ = nullptr; 87 SystemTrayBubble* system_tray_bubble_ = nullptr;
88 88
89 DISALLOW_COPY_AND_ASSIGN(CloseBubbleObserver); 89 DISALLOW_COPY_AND_ASSIGN(CloseBubbleObserver);
90 }; 90 };
91 91
92 class SystemTrayBubbleView : public TrayBubbleView {
93 public:
94 SystemTrayBubbleView(TrayBubbleView::InitParams* init_params,
95 SystemTray* tray)
96 : TrayBubbleView(*init_params), tray_(tray) {}
97
98 // views::View
xdai1 2017/06/30 22:27:08 nit: // views::View:
minch1 2017/07/01 05:57:14 Done.
99 void OnGestureEvent(ui::GestureEvent* event) override {
100 if (tray_ && tray_->ProcessGestureEvent(*event, true))
xdai1 2017/06/30 22:27:08 nit: tray_->ProcessGestureEvent(*event, true /* is
minch1 2017/07/01 05:57:14 Done.
101 event->SetHandled();
102 else
103 TrayBubbleView::OnGestureEvent(event);
104 }
105
106 private:
107 SystemTray* tray_; // Not owned.
108
109 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubbleView);
110 }; // namespace ash
111
92 // SystemTrayBubble 112 // SystemTrayBubble
93 113
94 SystemTrayBubble::SystemTrayBubble( 114 SystemTrayBubble::SystemTrayBubble(
95 ash::SystemTray* tray, 115 ash::SystemTray* tray,
96 const std::vector<ash::SystemTrayItem*>& items, 116 const std::vector<ash::SystemTrayItem*>& items,
97 BubbleType bubble_type) 117 BubbleType bubble_type)
98 : tray_(tray), 118 : tray_(tray),
99 bubble_view_(nullptr), 119 bubble_view_(nullptr),
100 items_(items), 120 items_(items),
101 bubble_type_(bubble_type), 121 bubble_type_(bubble_type),
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 tray_->GetBubbleWindowContainer()->AddChild(clipping_window_.get()); 256 tray_->GetBubbleWindowContainer()->AddChild(clipping_window_.get());
237 clipping_window_->Show(); 257 clipping_window_->Show();
238 } 258 }
239 clipping_window_->SetBounds(tray_->GetWorkAreaBoundsInScreen()); 259 clipping_window_->SetBounds(tray_->GetWorkAreaBoundsInScreen());
240 init_params->parent_window = clipping_window_.get(); 260 init_params->parent_window = clipping_window_.get();
241 } else { 261 } else {
242 init_params->parent_window = tray_->GetBubbleWindowContainer(); 262 init_params->parent_window = tray_->GetBubbleWindowContainer();
243 } 263 }
244 264
245 init_params->anchor_view = anchor; 265 init_params->anchor_view = anchor;
246 bubble_view_ = new TrayBubbleView(*init_params); 266 bubble_view_ = new SystemTrayBubbleView(init_params, tray_);
247 UpdateBottomPadding(); 267 UpdateBottomPadding();
248 bubble_view_->set_adjust_if_offscreen(false); 268 bubble_view_->set_adjust_if_offscreen(false);
249 CreateItemViews(login_status); 269 CreateItemViews(login_status);
250 270
251 if (bubble_view_->CanActivate()) { 271 if (bubble_view_->CanActivate()) {
252 bubble_view_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 272 bubble_view_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
253 } 273 }
254 } 274 }
255 275
256 void SystemTrayBubble::DestroyItemViews() { 276 void SystemTrayBubble::DestroyItemViews() {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 402 }
383 } 403 }
384 404
385 if (focus_view) { 405 if (focus_view) {
386 tray_->ActivateBubble(); 406 tray_->ActivateBubble();
387 focus_view->RequestFocus(); 407 focus_view->RequestFocus();
388 } 408 }
389 } 409 }
390 410
391 } // namespace ash 411 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698