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

Side by Side Diff: chrome/browser/chromeos/printer_detector/printer_detector.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chromeos/printer_detector/printer_detector.h" 5 #include "chrome/browser/chromeos/printer_detector/printer_detector.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 const std::string kVendorIdStr = base::IntToString(device->vendor_id()); 205 const std::string kVendorIdStr = base::IntToString(device->vendor_id());
206 const std::string kProductIdStr = base::IntToString(device->product_id()); 206 const std::string kProductIdStr = base::IntToString(device->product_id());
207 207
208 if (HasAppThatSupportsPrinter(profile, device)) { 208 if (HasAppThatSupportsPrinter(profile, device)) {
209 UMA_HISTOGRAM_ENUMERATION("PrinterService.PrinterServiceEvent", 209 UMA_HISTOGRAM_ENUMERATION("PrinterService.PrinterServiceEvent",
210 NOTIFICATION_SHOWN_PRINTER_SUPPORTED, 210 NOTIFICATION_SHOWN_PRINTER_SUPPORTED,
211 PRINTER_SERVICE_EVENT_MAX); 211 PRINTER_SERVICE_EVENT_MAX);
212 notification.reset(new Notification( 212 notification.reset(new Notification(
213 message_center::NOTIFICATION_TYPE_SIMPLE, 213 message_center::NOTIFICATION_TYPE_SIMPLE,
214 GURL(kPrinterProviderFoundNotificationID),
215 GetNotificationTitle(device->vendor_id(), device->product_id()), 214 GetNotificationTitle(device->vendor_id(), device->product_id()),
216 l10n_util::GetStringUTF16( 215 l10n_util::GetStringUTF16(
217 IDS_PRINTER_DETECTED_NOTIFICATION_PRINT_APP_FOUND_BODY), 216 IDS_PRINTER_DETECTED_NOTIFICATION_PRINT_APP_FOUND_BODY),
218 bundle.GetImageNamed(IDR_PRINTER_NOTIFICATION), 217 bundle.GetImageNamed(IDR_PRINTER_NOTIFICATION),
219 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, 218 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
220 kPrinterProviderFoundNotificationID), 219 kPrinterProviderFoundNotificationID),
221 base::string16(), GetNotificationTag(kVendorIdStr, kProductIdStr), 220 base::string16(), GURL(kPrinterProviderFoundNotificationID),
221 GetNotificationTag(kVendorIdStr, kProductIdStr),
222 message_center::RichNotificationData(), 222 message_center::RichNotificationData(),
223 new PrinterProviderExistsNotificationDelegate(kVendorIdStr, 223 new PrinterProviderExistsNotificationDelegate(kVendorIdStr,
224 kProductIdStr))); 224 kProductIdStr)));
225 } else { 225 } else {
226 UMA_HISTOGRAM_ENUMERATION("PrinterService.PrinterServiceEvent", 226 UMA_HISTOGRAM_ENUMERATION("PrinterService.PrinterServiceEvent",
227 NOTIFICATION_SHOWN_PRINTER_NOT_SUPPORTED, 227 NOTIFICATION_SHOWN_PRINTER_NOT_SUPPORTED,
228 PRINTER_SERVICE_EVENT_MAX); 228 PRINTER_SERVICE_EVENT_MAX);
229 message_center::RichNotificationData options; 229 message_center::RichNotificationData options;
230 options.clickable = true; 230 options.clickable = true;
231 notification.reset(new Notification( 231 notification.reset(new Notification(
232 message_center::NOTIFICATION_TYPE_SIMPLE, 232 message_center::NOTIFICATION_TYPE_SIMPLE,
233 GURL(kNoPrinterProviderNotificationID),
234 GetNotificationTitle(device->vendor_id(), device->product_id()), 233 GetNotificationTitle(device->vendor_id(), device->product_id()),
235 l10n_util::GetStringUTF16( 234 l10n_util::GetStringUTF16(
236 IDS_PRINTER_DETECTED_NOTIFICATION_NO_PRINT_APP_BODY), 235 IDS_PRINTER_DETECTED_NOTIFICATION_NO_PRINT_APP_BODY),
237 bundle.GetImageNamed(IDR_PRINTER_NOTIFICATION), 236 bundle.GetImageNamed(IDR_PRINTER_NOTIFICATION),
238 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, 237 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
239 kNoPrinterProviderNotificationID), 238 kNoPrinterProviderNotificationID),
240 base::string16(), GetNotificationTag(kVendorIdStr, kProductIdStr), 239 base::string16(), GURL(kNoPrinterProviderNotificationID),
241 options, new SearchPrinterAppNotificationDelegate( 240 GetNotificationTag(kVendorIdStr, kProductIdStr), options,
242 profile, device->vendor_id(), kVendorIdStr, 241 new SearchPrinterAppNotificationDelegate(
243 device->product_id(), kProductIdStr))); 242 profile, device->vendor_id(), kVendorIdStr, device->product_id(),
243 kProductIdStr)));
244 } 244 }
245 245
246 notification->SetSystemPriority(); 246 notification->SetSystemPriority();
247 notification_ui_manager->Add(*notification, profile); 247 notification_ui_manager->Add(*notification, profile);
248 } 248 }
249 249
250 } // namespace 250 } // namespace
251 251
252 namespace chromeos { 252 namespace chromeos {
253 253
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 : g_browser_process->notification_ui_manager(), 298 : g_browser_process->notification_ui_manager(),
299 device); 299 device);
300 } 300 }
301 301
302 void PrinterDetector::SetNotificationUIManagerForTesting( 302 void PrinterDetector::SetNotificationUIManagerForTesting(
303 NotificationUIManager* manager) { 303 NotificationUIManager* manager) {
304 notification_ui_manager_ = manager; 304 notification_ui_manager_ = manager;
305 } 305 }
306 306
307 } // namespace chromeos 307 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698