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 "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 <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 void PrinterDetector::OnDeviceAdded(scoped_refptr<device::UsbDevice> device) { | 311 void PrinterDetector::OnDeviceAdded(scoped_refptr<device::UsbDevice> device) { |
312 const user_manager::User* user = | 312 const user_manager::User* user = |
313 ProfileHelper::Get()->GetUserByProfile(profile_); | 313 ProfileHelper::Get()->GetUserByProfile(profile_); |
314 if (!user || !user->HasGaiaAccount() || !user_manager::UserManager::Get() || | 314 if (!user || !user->HasGaiaAccount() || !user_manager::UserManager::Get() || |
315 user != user_manager::UserManager::Get()->GetActiveUser()) { | 315 user != user_manager::UserManager::Get()->GetActiveUser()) { |
316 return; | 316 return; |
317 } | 317 } |
318 | 318 |
319 device::UsbDeviceFilter printer_filter; | 319 device::UsbDeviceFilter printer_filter; |
320 printer_filter.SetInterfaceClass(kPrinterInterfaceClass); | 320 printer_filter.interface_class = kPrinterInterfaceClass; |
321 if (!printer_filter.Matches(device)) { | 321 if (!printer_filter.Matches(device)) |
322 return; | 322 return; |
323 } | |
324 | 323 |
325 notification_ui_manager_ = notification_ui_manager_ | 324 notification_ui_manager_ = notification_ui_manager_ |
326 ? notification_ui_manager_ | 325 ? notification_ui_manager_ |
327 : g_browser_process->notification_ui_manager(); | 326 : g_browser_process->notification_ui_manager(); |
328 | 327 |
329 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 328 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
330 ::switches::kEnableNativeCups)) { | 329 ::switches::kEnableNativeCups)) { |
331 ShowUSBPrinterSetupNotification(device); | 330 ShowUSBPrinterSetupNotification(device); |
332 } else { | 331 } else { |
333 // TODO(xdai): Clean up the printer provider app notification related codes | 332 // TODO(xdai): Clean up the printer provider app notification related codes |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 notification_->set_type(message_center::NOTIFICATION_TYPE_SIMPLE); | 424 notification_->set_type(message_center::NOTIFICATION_TYPE_SIMPLE); |
426 std::vector<message_center::ButtonInfo> buttons; | 425 std::vector<message_center::ButtonInfo> buttons; |
427 buttons.push_back(message_center::ButtonInfo(l10n_util::GetStringUTF16( | 426 buttons.push_back(message_center::ButtonInfo(l10n_util::GetStringUTF16( |
428 IDS_PRINTER_DETECTED_NOTIFICATION_SET_UP_GET_HELP_BUTTON))); | 427 IDS_PRINTER_DETECTED_NOTIFICATION_SET_UP_GET_HELP_BUTTON))); |
429 notification_->set_buttons(buttons); | 428 notification_->set_buttons(buttons); |
430 command_ = ButtonCommand::GET_HELP; | 429 command_ = ButtonCommand::GET_HELP; |
431 notification_ui_manager_->Add(*notification_, profile_); | 430 notification_ui_manager_->Add(*notification_, profile_); |
432 } | 431 } |
433 | 432 |
434 } // namespace chromeos | 433 } // namespace chromeos |
OLD | NEW |