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

Side by Side Diff: ash/system/chromeos/power/tray_power.cc

Issue 1292003004: Elide origins displayed on web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style nit Created 5 years, 4 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/chromeos/power/tray_power.h" 5 #include "ash/system/chromeos/power/tray_power.h"
6 6
7 #include "ash/accessibility_delegate.h" 7 #include "ash/accessibility_delegate.h"
8 #include "ash/ash_switches.h" 8 #include "ash/ash_switches.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/system/chromeos/devicetype_utils.h" 10 #include "ash/system/chromeos/devicetype_utils.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 bool TrayPower::MaybeShowUsbChargerNotification() { 185 bool TrayPower::MaybeShowUsbChargerNotification() {
186 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 186 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
187 const char kNotificationId[] = "usb-charger"; 187 const char kNotificationId[] = "usb-charger";
188 bool usb_charger_is_connected = PowerStatus::Get()->IsUsbChargerConnected(); 188 bool usb_charger_is_connected = PowerStatus::Get()->IsUsbChargerConnected();
189 189
190 // Check for a USB charger being connected. 190 // Check for a USB charger being connected.
191 if (usb_charger_is_connected && !usb_charger_was_connected_) { 191 if (usb_charger_is_connected && !usb_charger_was_connected_) {
192 scoped_ptr<Notification> notification(new Notification( 192 scoped_ptr<Notification> notification(new Notification(
193 message_center::NOTIFICATION_TYPE_SIMPLE, 193 message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId,
194 kNotificationId,
195 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_TITLE), 194 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_TITLE),
196 ash::SubstituteChromeOSDeviceType( 195 ash::SubstituteChromeOSDeviceType(
197 IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_MESSAGE_SHORT), 196 IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_MESSAGE_SHORT),
198 rb.GetImageNamed(IDR_AURA_NOTIFICATION_LOW_POWER_CHARGER), 197 rb.GetImageNamed(IDR_AURA_NOTIFICATION_LOW_POWER_CHARGER),
199 base::string16(), 198 base::string16(), GURL(),
200 message_center::NotifierId( 199 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
201 message_center::NotifierId::SYSTEM_COMPONENT, 200 system_notifier::kNotifierPower),
202 system_notifier::kNotifierPower), 201 message_center::RichNotificationData(), NULL));
203 message_center::RichNotificationData(),
204 NULL));
205 message_center_->AddNotification(notification.Pass()); 202 message_center_->AddNotification(notification.Pass());
206 return true; 203 return true;
207 } 204 }
208 205
209 // Check for unplug of a USB charger while the USB charger notification is 206 // Check for unplug of a USB charger while the USB charger notification is
210 // showing. 207 // showing.
211 if (!usb_charger_is_connected && usb_charger_was_connected_) { 208 if (!usb_charger_is_connected && usb_charger_was_connected_) {
212 message_center_->RemoveNotification(kNotificationId, false); 209 message_center_->RemoveNotification(kNotificationId, false);
213 return true; 210 return true;
214 } 211 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } 298 }
302 return false; 299 return false;
303 case NOTIFICATION_CRITICAL: 300 case NOTIFICATION_CRITICAL:
304 return false; 301 return false;
305 } 302 }
306 NOTREACHED(); 303 NOTREACHED();
307 return false; 304 return false;
308 } 305 }
309 306
310 } // namespace ash 307 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/power/battery_notification.cc ('k') | ash/system/chromeos/screen_security/screen_capture_tray_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698