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> | 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 WEBUSB_NOTIFICATION_CLOSED_MAX | 47 WEBUSB_NOTIFICATION_CLOSED_MAX |
48 }; | 48 }; |
49 | 49 |
50 void RecordNotificationClosure(WebUsbNotificationClosed disposition) { | 50 void RecordNotificationClosure(WebUsbNotificationClosed disposition) { |
51 UMA_HISTOGRAM_ENUMERATION("WebUsb.NotificationClosed", disposition, | 51 UMA_HISTOGRAM_ENUMERATION("WebUsb.NotificationClosed", disposition, |
52 WEBUSB_NOTIFICATION_CLOSED_MAX); | 52 WEBUSB_NOTIFICATION_CLOSED_MAX); |
53 } | 53 } |
54 | 54 |
55 Browser* GetBrowser() { | 55 Browser* GetBrowser() { |
56 chrome::ScopedTabbedBrowserDisplayer browser_displayer( | 56 chrome::ScopedTabbedBrowserDisplayer browser_displayer( |
57 ProfileManager::GetActiveUserProfile(), chrome::GetActiveDesktop()); | 57 ProfileManager::GetActiveUserProfile()); |
58 DCHECK(browser_displayer.browser()); | 58 DCHECK(browser_displayer.browser()); |
59 return browser_displayer.browser(); | 59 return browser_displayer.browser(); |
60 } | 60 } |
61 | 61 |
62 void OpenURL(const GURL& url) { | 62 void OpenURL(const GURL& url) { |
63 GetBrowser()->OpenURL( | 63 GetBrowser()->OpenURL( |
64 content::OpenURLParams(url, content::Referrer(), NEW_FOREGROUND_TAB, | 64 content::OpenURLParams(url, content::Referrer(), NEW_FOREGROUND_TAB, |
65 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, true)); | 65 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, true)); |
66 } | 66 } |
67 | 67 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 | 137 |
138 void ChromeWebUsbBrowserClient::OnDeviceRemoved( | 138 void ChromeWebUsbBrowserClient::OnDeviceRemoved( |
139 const std::string& notification_id) { | 139 const std::string& notification_id) { |
140 message_center::MessageCenter* message_center = | 140 message_center::MessageCenter* message_center = |
141 message_center::MessageCenter::Get(); | 141 message_center::MessageCenter::Get(); |
142 if (message_center->FindVisibleNotificationById(notification_id)) { | 142 if (message_center->FindVisibleNotificationById(notification_id)) { |
143 message_center->RemoveNotification(notification_id, false /* by_user */); | 143 message_center->RemoveNotification(notification_id, false /* by_user */); |
144 } | 144 } |
145 } | 145 } |
OLD | NEW |