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

Side by Side Diff: ash/system/web_notification/web_notification_tray.cc

Issue 11761032: Shows the notification icon during the login session. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « no previous file | no next file » | 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/web_notification/web_notification_tray.h" 5 #include "ash/system/web_notification/web_notification_tray.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/system/status_area_widget.h" 9 #include "ash/system/status_area_widget.h"
10 #include "ash/system/tray/tray_bubble_wrapper.h" 10 #include "ash/system/tray/tray_bubble_wrapper.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 WebNotificationTray::WebNotificationTray( 81 WebNotificationTray::WebNotificationTray(
82 internal::StatusAreaWidget* status_area_widget) 82 internal::StatusAreaWidget* status_area_widget)
83 : internal::TrayBackgroundView(status_area_widget), 83 : internal::TrayBackgroundView(status_area_widget),
84 button_(NULL), 84 button_(NULL),
85 show_message_center_on_unlock_(false) { 85 show_message_center_on_unlock_(false) {
86 message_center_.reset(new message_center::MessageCenter(this)); 86 message_center_.reset(new message_center::MessageCenter(this));
87 button_ = new views::ImageButton(this); 87 button_ = new views::ImageButton(this);
88 button_->set_triggerable_event_flags( 88 button_->set_triggerable_event_flags(
89 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON); 89 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON);
90 tray_container()->AddChildView(button_); 90 tray_container()->AddChildView(button_);
91 SetVisible(false);
91 UpdateTray(); 92 UpdateTray();
92 } 93 }
93 94
94 WebNotificationTray::~WebNotificationTray() { 95 WebNotificationTray::~WebNotificationTray() {
95 // message_center_ has a weak pointer to this; destroy it early. 96 // message_center_ has a weak pointer to this; destroy it early.
96 message_center_.reset(); 97 message_center_.reset();
97 // Release any child views that might have back pointers before ~View(). 98 // Release any child views that might have back pointers before ~View().
98 message_center_bubble_.reset(); 99 message_center_bubble_.reset();
99 popup_bubble_.reset(); 100 popup_bubble_.reset();
100 if (quiet_mode_bubble() && quiet_mode_bubble_->GetBubbleWidget()) 101 if (quiet_mode_bubble() && quiet_mode_bubble_->GetBubbleWidget())
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 if (message_center_bubble()) { 192 if (message_center_bubble()) {
192 message_center_bubble_.reset(); 193 message_center_bubble_.reset();
193 show_message_center_on_unlock_ = true; 194 show_message_center_on_unlock_ = true;
194 } 195 }
195 HidePopupBubble(); 196 HidePopupBubble();
196 } else { 197 } else {
197 if (show_message_center_on_unlock_) 198 if (show_message_center_on_unlock_)
198 ShowMessageCenterBubble(); 199 ShowMessageCenterBubble();
199 show_message_center_on_unlock_ = false; 200 show_message_center_on_unlock_ = false;
200 } 201 }
202 // The status icon should be always visible except for lock screen / login
203 // screen, to allow quiet mode and settings.
204 SetVisible((login_status != user::LOGGED_IN_NONE) &&
205 (login_status != user::LOGGED_IN_LOCKED));
201 UpdateTray(); 206 UpdateTray();
202 } 207 }
203 208
204 bool WebNotificationTray::IsMessageCenterBubbleVisible() const { 209 bool WebNotificationTray::IsMessageCenterBubbleVisible() const {
205 return (message_center_bubble() && 210 return (message_center_bubble() &&
206 message_center_bubble_->bubble()->IsVisible()); 211 message_center_bubble_->bubble()->IsVisible());
207 } 212 }
208 213
209 bool WebNotificationTray::IsMouseInNotificationBubble() const { 214 bool WebNotificationTray::IsMouseInNotificationBubble() const {
210 if (!popup_bubble()) 215 if (!popup_bubble())
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 IDR_AURA_UBER_TRAY_NOTIFY_BUTTON_INACTIVE_NORMAL)); 354 IDR_AURA_UBER_TRAY_NOTIFY_BUTTON_INACTIVE_NORMAL));
350 button_->SetImage(views::CustomButton::STATE_HOVERED, rb.GetImageSkiaNamed( 355 button_->SetImage(views::CustomButton::STATE_HOVERED, rb.GetImageSkiaNamed(
351 IDR_AURA_UBER_TRAY_NOTIFY_BUTTON_INACTIVE_HOVER)); 356 IDR_AURA_UBER_TRAY_NOTIFY_BUTTON_INACTIVE_HOVER));
352 button_->SetImage(views::CustomButton::STATE_PRESSED, rb.GetImageSkiaNamed( 357 button_->SetImage(views::CustomButton::STATE_PRESSED, rb.GetImageSkiaNamed(
353 IDR_AURA_UBER_TRAY_NOTIFY_BUTTON_INACTIVE_PRESSED)); 358 IDR_AURA_UBER_TRAY_NOTIFY_BUTTON_INACTIVE_PRESSED));
354 } 359 }
355 if (message_center_bubble()) 360 if (message_center_bubble())
356 button_->SetState(views::CustomButton::STATE_PRESSED); 361 button_->SetState(views::CustomButton::STATE_PRESSED);
357 else 362 else
358 button_->SetState(views::CustomButton::STATE_NORMAL); 363 button_->SetState(views::CustomButton::STATE_NORMAL);
359 bool is_visible =
360 (status_area_widget()->login_status() != user::LOGGED_IN_NONE) &&
361 (status_area_widget()->login_status() != user::LOGGED_IN_LOCKED) &&
362 (message_center_->NotificationCount() > 0);
363 SetVisible(is_visible);
364 Layout(); 364 Layout();
365 SchedulePaint(); 365 SchedulePaint();
366 } 366 }
367 367
368 bool WebNotificationTray::ClickedOutsideBubble() { 368 bool WebNotificationTray::ClickedOutsideBubble() {
369 // Only hide the message center and quiet mode bubble. 369 // Only hide the message center and quiet mode bubble.
370 if (!message_center_bubble() && !quiet_mode_bubble()) 370 if (!message_center_bubble() && !quiet_mode_bubble())
371 return false; 371 return false;
372 quiet_mode_bubble_.reset(); 372 quiet_mode_bubble_.reset();
373 HideMessageCenterBubble(); 373 HideMessageCenterBubble();
(...skipping 12 matching lines...) Expand all
386 386
387 message_center::MessagePopupBubble* 387 message_center::MessagePopupBubble*
388 WebNotificationTray::GetPopupBubbleForTest() { 388 WebNotificationTray::GetPopupBubbleForTest() {
389 if (!popup_bubble_.get()) 389 if (!popup_bubble_.get())
390 return NULL; 390 return NULL;
391 return static_cast<message_center::MessagePopupBubble*>( 391 return static_cast<message_center::MessagePopupBubble*>(
392 popup_bubble_->bubble()); 392 popup_bubble_->bubble());
393 } 393 }
394 394
395 } // namespace ash 395 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698