OLD | NEW |
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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 private: | 223 private: |
224 // UsbService::observer override: | 224 // UsbService::observer override: |
225 void OnDeviceAdded(scoped_refptr<device::UsbDevice> device) override { | 225 void OnDeviceAdded(scoped_refptr<device::UsbDevice> device) override { |
226 const user_manager::User* user = | 226 const user_manager::User* user = |
227 ProfileHelper::Get()->GetUserByProfile(profile_); | 227 ProfileHelper::Get()->GetUserByProfile(profile_); |
228 if (!user || !user->HasGaiaAccount() || !user_manager::UserManager::Get() || | 228 if (!user || !user->HasGaiaAccount() || !user_manager::UserManager::Get() || |
229 user != user_manager::UserManager::Get()->GetActiveUser()) { | 229 user != user_manager::UserManager::Get()->GetActiveUser()) { |
230 return; | 230 return; |
231 } | 231 } |
232 | 232 |
233 if (!UsbDeviceIsPrinter(device)) { | 233 if (!UsbDeviceIsPrinter(*device)) { |
234 return; | 234 return; |
235 } | 235 } |
236 | 236 |
237 if (notification_ui_manager_ == nullptr) { | 237 if (notification_ui_manager_ == nullptr) { |
238 notification_ui_manager_ = g_browser_process->notification_ui_manager(); | 238 notification_ui_manager_ = g_browser_process->notification_ui_manager(); |
239 } | 239 } |
240 | 240 |
241 UMA_HISTOGRAM_ENUMERATION("PrinterService.PrinterServiceEvent", | 241 UMA_HISTOGRAM_ENUMERATION("PrinterService.PrinterServiceEvent", |
242 PRINTER_ADDED, PRINTER_SERVICE_EVENT_MAX); | 242 PRINTER_ADDED, PRINTER_SERVICE_EVENT_MAX); |
243 ShowPrinterPluggedNotification(device); | 243 ShowPrinterPluggedNotification(device); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 324 |
325 } // namespace | 325 } // namespace |
326 | 326 |
327 // static | 327 // static |
328 std::unique_ptr<PrinterDetector> PrinterDetector::CreateLegacy( | 328 std::unique_ptr<PrinterDetector> PrinterDetector::CreateLegacy( |
329 Profile* profile) { | 329 Profile* profile) { |
330 return base::MakeUnique<LegacyPrinterDetectorImpl>(profile); | 330 return base::MakeUnique<LegacyPrinterDetectorImpl>(profile); |
331 } | 331 } |
332 | 332 |
333 } // namespace chromeos | 333 } // namespace chromeos |
OLD | NEW |