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

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

Issue 2961313003: Touch gestures for System Tray/ IME/ Stylus/ Notifications (Closed)
Patch Set: Create SystemTrayBubbleView instead of Delegate. 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 {
sammiequon 2017/06/30 17:46:02 I feel it makes more sense to move the bubble rela
xdai1 2017/06/30 17:51:01 I have the same feeling too. But I also understand
minch1 2017/06/30 19:08:04 Let's keep it as-is to let owner take a look. Than
93 public:
94 SystemTrayBubbleView(TrayBubbleView::InitParams* init_params,
95 SystemTray* tray)
96 : TrayBubbleView(*init_params), tray_(tray) {}
97
98 void OnGestureEvent(ui::GestureEvent* event) override {
sammiequon 2017/06/30 17:46:02 nit: // views::View:
minch1 2017/06/30 19:08:04 Done.
99 if (tray_) {
100 tray_->set_target_view(this);
101 if (tray_->ProcessGestureEvent(*event))
102 event->SetHandled();
103 } else {
104 TrayBubbleView::OnGestureEvent(event);
105 }
106 }
107
108 private:
109 SystemTray* tray_;
sammiequon 2017/06/30 17:46:02 nit: // Not owned.
minch1 2017/06/30 19:08:04 Done.
110
111 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubbleView);
112 };
113
92 // SystemTrayBubble 114 // SystemTrayBubble
93 115
94 SystemTrayBubble::SystemTrayBubble( 116 SystemTrayBubble::SystemTrayBubble(
95 ash::SystemTray* tray, 117 ash::SystemTray* tray,
96 const std::vector<ash::SystemTrayItem*>& items, 118 const std::vector<ash::SystemTrayItem*>& items,
97 BubbleType bubble_type) 119 BubbleType bubble_type)
98 : tray_(tray), 120 : tray_(tray),
99 bubble_view_(nullptr), 121 bubble_view_(nullptr),
100 items_(items), 122 items_(items),
101 bubble_type_(bubble_type), 123 bubble_type_(bubble_type),
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 tray_->GetBubbleWindowContainer()->AddChild(clipping_window_.get()); 258 tray_->GetBubbleWindowContainer()->AddChild(clipping_window_.get());
237 clipping_window_->Show(); 259 clipping_window_->Show();
238 } 260 }
239 clipping_window_->SetBounds(tray_->GetWorkAreaBoundsInScreen()); 261 clipping_window_->SetBounds(tray_->GetWorkAreaBoundsInScreen());
240 init_params->parent_window = clipping_window_.get(); 262 init_params->parent_window = clipping_window_.get();
241 } else { 263 } else {
242 init_params->parent_window = tray_->GetBubbleWindowContainer(); 264 init_params->parent_window = tray_->GetBubbleWindowContainer();
243 } 265 }
244 266
245 init_params->anchor_view = anchor; 267 init_params->anchor_view = anchor;
246 bubble_view_ = new TrayBubbleView(*init_params); 268 bubble_view_ = new SystemTrayBubbleView(init_params, tray_);
247 UpdateBottomPadding(); 269 UpdateBottomPadding();
248 bubble_view_->set_adjust_if_offscreen(false); 270 bubble_view_->set_adjust_if_offscreen(false);
249 CreateItemViews(login_status); 271 CreateItemViews(login_status);
250 272
251 if (bubble_view_->CanActivate()) { 273 if (bubble_view_->CanActivate()) {
252 bubble_view_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 274 bubble_view_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
253 } 275 }
254 } 276 }
255 277
256 void SystemTrayBubble::DestroyItemViews() { 278 void SystemTrayBubble::DestroyItemViews() {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 404 }
383 } 405 }
384 406
385 if (focus_view) { 407 if (focus_view) {
386 tray_->ActivateBubble(); 408 tray_->ActivateBubble();
387 focus_view->RequestFocus(); 409 focus_view->RequestFocus();
388 } 410 }
389 } 411 }
390 412
391 } // namespace ash 413 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698