| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 Browser* GetBrowser() { | 55 Browser* GetBrowser() { |
| 56 chrome::ScopedTabbedBrowserDisplayer browser_displayer( | 56 chrome::ScopedTabbedBrowserDisplayer browser_displayer( |
| 57 ProfileManager::GetActiveUserProfile()); | 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(content::OpenURLParams( |
| 64 content::OpenURLParams(url, content::Referrer(), NEW_FOREGROUND_TAB, | 64 url, content::Referrer(), NEW_FOREGROUND_TAB, |
| 65 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, true)); | 65 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initialized */)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Delegate for webusb notification | 68 // Delegate for webusb notification |
| 69 class WebUsbNotificationDelegate : public message_center::NotificationDelegate { | 69 class WebUsbNotificationDelegate : public message_center::NotificationDelegate { |
| 70 public: | 70 public: |
| 71 WebUsbNotificationDelegate(const GURL& landing_page, | 71 WebUsbNotificationDelegate(const GURL& landing_page, |
| 72 const std::string& notification_id) | 72 const std::string& notification_id) |
| 73 : landing_page_(landing_page), notification_id_(notification_id) {} | 73 : landing_page_(landing_page), notification_id_(notification_id) {} |
| 74 | 74 |
| 75 void Click() override { | 75 void Click() override { |
| (...skipping 60 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 |