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/chrome_webusb_browser_client.h" | 5 #include "chrome/browser/chrome_webusb_browser_client.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/macros.h" | 9 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/net/referrer.h" | 11 #include "chrome/browser/net/referrer.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
11 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/host_desktop.h" | 14 #include "chrome/browser/ui/host_desktop.h" |
13 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 15 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
14 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
15 #include "chrome/grit/theme_resources.h" | 17 #include "chrome/grit/theme_resources.h" |
16 #include "content/public/common/origin_util.h" | 18 #include "content/public/common/origin_util.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 base::UTF8ToUTF16(landing_page.GetContent())), | 91 base::UTF8ToUTF16(landing_page.GetContent())), |
90 rb.GetNativeImageNamed(IDR_USB_NOTIFICATION_ICON), | 92 rb.GetNativeImageNamed(IDR_USB_NOTIFICATION_ICON), |
91 base::string16(), GURL(), | 93 base::string16(), GURL(), |
92 message_center::NotifierId( | 94 message_center::NotifierId( |
93 message_center::NotifierId::SYSTEM_COMPONENT, | 95 message_center::NotifierId::SYSTEM_COMPONENT, |
94 kWebUsbDetectorNotificationID), | 96 kWebUsbDetectorNotificationID), |
95 rich_notification_data, | 97 rich_notification_data, |
96 new WebUsbNotificationDelegate(landing_page, notification_id))); | 98 new WebUsbNotificationDelegate(landing_page, notification_id))); |
97 | 99 |
98 notification->SetSystemPriority(); | 100 notification->SetSystemPriority(); |
99 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 101 message_center::MessageCenter::Get()->AddNotification( |
| 102 std::move(notification)); |
100 } | 103 } |
101 | 104 |
102 void ChromeWebUsbBrowserClient::OnDeviceRemoved( | 105 void ChromeWebUsbBrowserClient::OnDeviceRemoved( |
103 const std::string& notification_id) { | 106 const std::string& notification_id) { |
104 message_center::MessageCenter* message_center = | 107 message_center::MessageCenter* message_center = |
105 message_center::MessageCenter::Get(); | 108 message_center::MessageCenter::Get(); |
106 if (message_center->FindVisibleNotificationById(notification_id)) { | 109 if (message_center->FindVisibleNotificationById(notification_id)) { |
107 message_center->RemoveNotification(notification_id, false /* by_user */); | 110 message_center->RemoveNotification(notification_id, false /* by_user */); |
108 } | 111 } |
109 } | 112 } |
OLD | NEW |