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/usb/web_usb_detector.h" | 5 #include "chrome/browser/usb/web_usb_detector.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 Browser* GetBrowser() { | 68 Browser* GetBrowser() { |
69 chrome::ScopedTabbedBrowserDisplayer browser_displayer( | 69 chrome::ScopedTabbedBrowserDisplayer browser_displayer( |
70 ProfileManager::GetActiveUserProfile()); | 70 ProfileManager::GetActiveUserProfile()); |
71 DCHECK(browser_displayer.browser()); | 71 DCHECK(browser_displayer.browser()); |
72 return browser_displayer.browser(); | 72 return browser_displayer.browser(); |
73 } | 73 } |
74 | 74 |
75 void OpenURL(const GURL& url) { | 75 void OpenURL(const GURL& url) { |
76 GetBrowser()->OpenURL(content::OpenURLParams( | 76 GetBrowser()->OpenURL(content::OpenURLParams( |
77 url, content::Referrer(), NEW_FOREGROUND_TAB, | 77 url, content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, |
78 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initialized */)); | 78 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initialized */)); |
79 } | 79 } |
80 | 80 |
81 // Delegate for webusb notification | 81 // Delegate for webusb notification |
82 class WebUsbNotificationDelegate : public message_center::NotificationDelegate { | 82 class WebUsbNotificationDelegate : public message_center::NotificationDelegate { |
83 public: | 83 public: |
84 WebUsbNotificationDelegate(const GURL& landing_page, | 84 WebUsbNotificationDelegate(const GURL& landing_page, |
85 const std::string& notification_id) | 85 const std::string& notification_id) |
86 : landing_page_(landing_page), notification_id_(notification_id) {} | 86 : landing_page_(landing_page), notification_id_(notification_id) {} |
87 | 87 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 164 } |
165 | 165 |
166 void WebUsbDetector::OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) { | 166 void WebUsbDetector::OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) { |
167 std::string notification_id = device->guid(); | 167 std::string notification_id = device->guid(); |
168 message_center::MessageCenter* message_center = | 168 message_center::MessageCenter* message_center = |
169 message_center::MessageCenter::Get(); | 169 message_center::MessageCenter::Get(); |
170 if (message_center->FindVisibleNotificationById(notification_id)) { | 170 if (message_center->FindVisibleNotificationById(notification_id)) { |
171 message_center->RemoveNotification(notification_id, false /* by_user */); | 171 message_center->RemoveNotification(notification_id, false /* by_user */); |
172 } | 172 } |
173 } | 173 } |
OLD | NEW |