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

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

Issue 2583393002: Send notification to users upon receiving sms messages (Closed)
Patch Set: update return type Created 3 years, 10 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
« no previous file with comments | « ash/common/system/tray/system_tray_bubble.h ('k') | ash/common/system/tray/system_tray_item.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/system/tray/system_tray_bubble.h" 5 #include "ash/common/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/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_->reset_delegate();
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 DCHECK(bubble_type != BUBBLE_TYPE_NOTIFICATION);
94 93
95 std::unique_ptr<ui::Layer> scoped_layer; 94 std::unique_ptr<ui::Layer> scoped_layer;
96 if (bubble_type != bubble_type_) { 95 if (bubble_type != bubble_type_) {
97 base::TimeDelta swipe_duration = 96 base::TimeDelta swipe_duration =
98 base::TimeDelta::FromMilliseconds(kSwipeDelayMS); 97 base::TimeDelta::FromMilliseconds(kSwipeDelayMS);
99 scoped_layer = bubble_view_->RecreateLayer(); 98 scoped_layer = bubble_view_->RecreateLayer();
100 // Keep the reference to layer as we need it after releasing it. 99 // Keep the reference to layer as we need it after releasing it.
101 ui::Layer* layer = scoped_layer.get(); 100 ui::Layer* layer = scoped_layer.get();
102 DCHECK(layer); 101 DCHECK(layer);
103 layer->SuppressPaint(); 102 layer->SuppressPaint();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 188
190 void SystemTrayBubble::InitView(views::View* anchor, 189 void SystemTrayBubble::InitView(views::View* anchor,
191 LoginStatus login_status, 190 LoginStatus login_status,
192 TrayBubbleView::InitParams* init_params) { 191 TrayBubbleView::InitParams* init_params) {
193 DCHECK(anchor); 192 DCHECK(anchor);
194 DCHECK(!bubble_view_); 193 DCHECK(!bubble_view_);
195 194
196 if (bubble_type_ == BUBBLE_TYPE_DETAILED && 195 if (bubble_type_ == BUBBLE_TYPE_DETAILED &&
197 init_params->max_height < GetDetailedBubbleMaxHeight()) { 196 init_params->max_height < GetDetailedBubbleMaxHeight()) {
198 init_params->max_height = GetDetailedBubbleMaxHeight(); 197 init_params->max_height = GetDetailedBubbleMaxHeight();
199 } else if (bubble_type_ == BUBBLE_TYPE_NOTIFICATION) {
200 init_params->close_on_deactivate = false;
201 } 198 }
202 199
203 bubble_view_ = TrayBubbleView::Create(anchor, tray_, init_params); 200 bubble_view_ = TrayBubbleView::Create(anchor, tray_, init_params);
204 UpdateBottomPadding(); 201 UpdateBottomPadding();
205 bubble_view_->set_adjust_if_offscreen(false); 202 bubble_view_->set_adjust_if_offscreen(false);
206 CreateItemViews(login_status); 203 CreateItemViews(login_status);
207 204
208 if (bubble_view_->CanActivate()) { 205 if (bubble_view_->CanActivate()) {
209 bubble_view_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 206 bubble_view_->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
210 } 207 }
(...skipping 19 matching lines...) Expand all
230 void SystemTrayBubble::DestroyItemViews() { 227 void SystemTrayBubble::DestroyItemViews() {
231 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); 228 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin();
232 it != items_.end(); ++it) { 229 it != items_.end(); ++it) {
233 switch (bubble_type_) { 230 switch (bubble_type_) {
234 case BUBBLE_TYPE_DEFAULT: 231 case BUBBLE_TYPE_DEFAULT:
235 (*it)->DestroyDefaultView(); 232 (*it)->DestroyDefaultView();
236 break; 233 break;
237 case BUBBLE_TYPE_DETAILED: 234 case BUBBLE_TYPE_DETAILED:
238 (*it)->DestroyDetailedView(); 235 (*it)->DestroyDetailedView();
239 break; 236 break;
240 case BUBBLE_TYPE_NOTIFICATION:
241 (*it)->DestroyNotificationView();
242 break;
243 } 237 }
244 } 238 }
245 } 239 }
246 240
247 void SystemTrayBubble::BubbleViewDestroyed() { 241 void SystemTrayBubble::BubbleViewDestroyed() {
248 bubble_view_ = nullptr; 242 bubble_view_ = nullptr;
249 } 243 }
250 244
251 void SystemTrayBubble::StartAutoCloseTimer(int seconds) { 245 void SystemTrayBubble::StartAutoCloseTimer(int seconds) {
252 autoclose_.Stop(); 246 autoclose_.Stop();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 views::View* item_view = nullptr; 327 views::View* item_view = nullptr;
334 switch (bubble_type_) { 328 switch (bubble_type_) {
335 case BUBBLE_TYPE_DEFAULT: 329 case BUBBLE_TYPE_DEFAULT:
336 item_view = items_[i]->CreateDefaultView(login_status); 330 item_view = items_[i]->CreateDefaultView(login_status);
337 if (items_[i]->restore_focus()) 331 if (items_[i]->restore_focus())
338 focus_view = item_view; 332 focus_view = item_view;
339 break; 333 break;
340 case BUBBLE_TYPE_DETAILED: 334 case BUBBLE_TYPE_DETAILED:
341 item_view = items_[i]->CreateDetailedView(login_status); 335 item_view = items_[i]->CreateDetailedView(login_status);
342 break; 336 break;
343 case BUBBLE_TYPE_NOTIFICATION:
344 item_view = items_[i]->CreateNotificationView(login_status);
345 break;
346 } 337 }
347 if (item_view) { 338 if (item_view) {
348 TrayPopupItemContainer* tray_popup_item_container = 339 TrayPopupItemContainer* tray_popup_item_container =
349 new TrayPopupItemContainer( 340 new TrayPopupItemContainer(
350 item_view, 341 item_view,
351 is_default_bubble && 342 is_default_bubble &&
352 !MaterialDesignController::IsSystemTrayMenuMaterial()); 343 !MaterialDesignController::IsSystemTrayMenuMaterial());
353 bubble_view_->AddChildView(tray_popup_item_container); 344 bubble_view_->AddChildView(tray_popup_item_container);
354 item_containers.push_back(tray_popup_item_container); 345 item_containers.push_back(tray_popup_item_container);
355 tray_item_view_map_[items_[i]->uma_type()] = tray_popup_item_container; 346 tray_item_view_map_[items_[i]->uma_type()] = tray_popup_item_container;
(...skipping 13 matching lines...) Expand all
369 } 360 }
370 } 361 }
371 362
372 if (focus_view) { 363 if (focus_view) {
373 tray_->ActivateBubble(); 364 tray_->ActivateBubble();
374 focus_view->RequestFocus(); 365 focus_view->RequestFocus();
375 } 366 }
376 } 367 }
377 368
378 } // namespace ash 369 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/system_tray_bubble.h ('k') | ash/common/system/tray/system_tray_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698