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

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

Issue 12260046: Show notification when activating with no connection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix logic and type icon Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ash/system/chromeos/network/tray_sms.cc ('k') | ash/system/tray/system_tray_unittest.cc » ('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/system/tray/system_tray.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell/panel_window.h" 9 #include "ash/shell/panel_window.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 detailed_item_ = items[0]; 388 detailed_item_ = items[0];
389 else 389 else
390 detailed_item_ = NULL; 390 detailed_item_ = NULL;
391 391
392 UpdateNotificationBubble(); // State changed, re-create notifications. 392 UpdateNotificationBubble(); // State changed, re-create notifications.
393 status_area_widget()->SetHideWebNotifications(true); 393 status_area_widget()->SetHideWebNotifications(true);
394 GetShelfLayoutManager()->UpdateAutoHideState(); 394 GetShelfLayoutManager()->UpdateAutoHideState();
395 } 395 }
396 396
397 void SystemTray::UpdateNotificationBubble() { 397 void SystemTray::UpdateNotificationBubble() {
398 // Only show the notification buble if we have notifications and we are not 398 // Only show the notification buble if we have notifications.
399 // showing the default bubble. 399 if (notification_items_.empty()) {
400 if (notification_items_.empty() ||
401 HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) {
402 DestroyNotificationBubble(); 400 DestroyNotificationBubble();
403 return; 401 return;
404 } 402 }
405 // Destroy the existing bubble before constructing a new one. 403 // Destroy the existing bubble before constructing a new one.
406 notification_bubble_.reset(); 404 notification_bubble_.reset();
407 SystemTrayBubble* notification_bubble; 405 SystemTrayBubble* notification_bubble;
408 if (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DETAILED)) { 406 notification_bubble = new SystemTrayBubble(
409 // Skip notifications for any currently displayed detailed item. 407 this, notification_items_, SystemTrayBubble::BUBBLE_TYPE_NOTIFICATION);
410 std::vector<SystemTrayItem*> items;
411 for (std::vector<SystemTrayItem*>::iterator iter =
412 notification_items_.begin();
413 iter != notification_items_.end(); ++ iter) {
414 if (*iter != detailed_item_)
415 items.push_back(*iter);
416 }
417 if (items.empty()) {
418 DestroyNotificationBubble();
419 return;
420 }
421 notification_bubble = new SystemTrayBubble(
422 this, items, SystemTrayBubble::BUBBLE_TYPE_NOTIFICATION);
423 } else {
424 // Show all notifications.
425 notification_bubble = new SystemTrayBubble(
426 this, notification_items_, SystemTrayBubble::BUBBLE_TYPE_NOTIFICATION);
427 }
428 views::View* anchor; 408 views::View* anchor;
429 TrayBubbleView::AnchorType anchor_type; 409 TrayBubbleView::AnchorType anchor_type;
430 if (system_bubble_.get()) { 410 if (system_bubble_.get()) {
431 anchor = system_bubble_->bubble_view(); 411 anchor = system_bubble_->bubble_view();
432 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; 412 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE;
433 } else { 413 } else {
434 anchor = tray_container(); 414 anchor = tray_container();
435 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; 415 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY;
436 } 416 }
437 TrayBubbleView::InitParams init_params(anchor_type, 417 TrayBubbleView::InitParams init_params(anchor_type,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 ConvertPointToWidget(this, &point); 532 ConvertPointToWidget(this, &point);
553 arrow_offset = point.x(); 533 arrow_offset = point.x();
554 } 534 }
555 } 535 }
556 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); 536 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset);
557 } 537 }
558 return true; 538 return true;
559 } 539 }
560 540
561 } // namespace ash 541 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/network/tray_sms.cc ('k') | ash/system/tray/system_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698