OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/views/message_center/web_notification_tray.h" | 5 #include "chrome/browser/ui/views/message_center/web_notification_tray.h" |
6 | 6 |
7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 184 } |
185 message_center_delegate_ = | 185 message_center_delegate_ = |
186 new MessageCenterWidgetDelegate(this, | 186 new MessageCenterWidgetDelegate(this, |
187 message_center_tray_.get(), | 187 message_center_tray_.get(), |
188 true, // settings initally visible | 188 true, // settings initally visible |
189 GetPositionInfo()); | 189 GetPositionInfo()); |
190 | 190 |
191 return true; | 191 return true; |
192 } | 192 } |
193 | 193 |
| 194 bool WebNotificationTray::IsContextMenuEnabled() const { |
| 195 // It can always return true because the notifications are invisible if |
| 196 // the context menu shouldn't be enabled, such as in the lock screen. |
| 197 return true; |
| 198 } |
| 199 |
194 void WebNotificationTray::OnMessageCenterTrayChanged() { | 200 void WebNotificationTray::OnMessageCenterTrayChanged() { |
195 if (status_icon_) { | 201 if (status_icon_) { |
196 bool quiet_mode_state = message_center()->IsQuietMode(); | 202 bool quiet_mode_state = message_center()->IsQuietMode(); |
197 if (last_quiet_mode_state_ != quiet_mode_state) { | 203 if (last_quiet_mode_state_ != quiet_mode_state) { |
198 last_quiet_mode_state_ = quiet_mode_state; | 204 last_quiet_mode_state_ = quiet_mode_state; |
199 | 205 |
200 // Quiet mode has changed, update the quiet mode menu. | 206 // Quiet mode has changed, update the quiet mode menu. |
201 status_icon_menu_->SetCommandIdChecked(kToggleQuietMode, | 207 status_icon_menu_->SetCommandIdChecked(kToggleQuietMode, |
202 quiet_mode_state); | 208 quiet_mode_state); |
203 } | 209 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 status_icon_menu_ = menu.get(); | 370 status_icon_menu_ = menu.get(); |
365 status_icon->SetContextMenu(menu.Pass()); | 371 status_icon->SetContextMenu(menu.Pass()); |
366 } | 372 } |
367 | 373 |
368 MessageCenterWidgetDelegate* | 374 MessageCenterWidgetDelegate* |
369 WebNotificationTray::GetMessageCenterWidgetDelegateForTest() { | 375 WebNotificationTray::GetMessageCenterWidgetDelegateForTest() { |
370 return message_center_delegate_; | 376 return message_center_delegate_; |
371 } | 377 } |
372 | 378 |
373 } // namespace message_center | 379 } // namespace message_center |
OLD | NEW |