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

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

Issue 2897553002: Do not activate TrayBubbleView by default (Closed)
Patch Set: Remove unnecessary code. Created 3 years, 6 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 : tray_(tray), 77 : tray_(tray),
78 bubble_view_(nullptr), 78 bubble_view_(nullptr),
79 items_(items), 79 items_(items),
80 bubble_type_(bubble_type), 80 bubble_type_(bubble_type),
81 autoclose_delay_(0) {} 81 autoclose_delay_(0) {}
82 82
83 SystemTrayBubble::~SystemTrayBubble() { 83 SystemTrayBubble::~SystemTrayBubble() {
84 DestroyItemViews(); 84 DestroyItemViews();
85 // Reset the host pointer in bubble_view_ in case its destruction is deferred. 85 // Reset the host pointer in bubble_view_ in case its destruction is deferred.
86 if (bubble_view_) 86 if (bubble_view_)
87 bubble_view_->reset_delegate(); 87 bubble_view_->ResetDelegate();
88 } 88 }
89 89
90 void SystemTrayBubble::UpdateView( 90 void SystemTrayBubble::UpdateView(
91 const std::vector<ash::SystemTrayItem*>& items, 91 const std::vector<ash::SystemTrayItem*>& items,
92 BubbleType bubble_type) { 92 BubbleType bubble_type) {
93 std::unique_ptr<ui::Layer> scoped_layer; 93 std::unique_ptr<ui::Layer> scoped_layer;
94 if (bubble_type != bubble_type_) { 94 if (bubble_type != bubble_type_) {
95 base::TimeDelta swipe_duration = 95 base::TimeDelta swipe_duration =
96 base::TimeDelta::FromMilliseconds(kSwipeDelayMS); 96 base::TimeDelta::FromMilliseconds(kSwipeDelayMS);
97 scoped_layer = bubble_view_->RecreateLayer(); 97 scoped_layer = bubble_view_->RecreateLayer();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 bubble_view_ = new TrayBubbleView(*init_params); 203 bubble_view_ = new TrayBubbleView(*init_params);
204 UpdateBottomPadding(); 204 UpdateBottomPadding();
205 bubble_view_->set_adjust_if_offscreen(false); 205 bubble_view_->set_adjust_if_offscreen(false);
206 CreateItemViews(login_status); 206 CreateItemViews(login_status);
207 207
208 if (bubble_view_->CanActivate()) { 208 if (bubble_view_->CanActivate()) {
209 bubble_view_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 209 bubble_view_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
210 } 210 }
211 } 211 }
212 212
213 void SystemTrayBubble::FocusDefaultIfNeeded() {
214 views::FocusManager* manager = bubble_view_->GetFocusManager();
215 if (!manager || manager->GetFocusedView())
216 return;
217
218 views::View* view =
219 manager->GetNextFocusableView(nullptr, nullptr, false, false);
220 if (view)
221 view->RequestFocus();
222 }
223
224 void SystemTrayBubble::DestroyItemViews() { 213 void SystemTrayBubble::DestroyItemViews() {
225 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); 214 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin();
226 it != items_.end(); ++it) { 215 it != items_.end(); ++it) {
227 switch (bubble_type_) { 216 switch (bubble_type_) {
228 case BUBBLE_TYPE_DEFAULT: 217 case BUBBLE_TYPE_DEFAULT:
229 (*it)->OnDefaultViewDestroyed(); 218 (*it)->OnDefaultViewDestroyed();
230 break; 219 break;
231 case BUBBLE_TYPE_DETAILED: 220 case BUBBLE_TYPE_DETAILED:
232 (*it)->OnDetailedViewDestroyed(); 221 (*it)->OnDetailedViewDestroyed();
233 break; 222 break;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 323 }
335 } 324 }
336 325
337 if (focus_view) { 326 if (focus_view) {
338 tray_->ActivateBubble(); 327 tray_->ActivateBubble();
339 focus_view->RequestFocus(); 328 focus_view->RequestFocus();
340 } 329 }
341 } 330 }
342 331
343 } // namespace ash 332 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698