Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: chrome/browser/chrome_webusb_browser_client.cc

Issue 1712683002: Navigations from WebUSB notifications are not renderer initiated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: navigations from WebUSB notifications are not renderer initiated Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, /*is_renderer_initiated=*/false));
Reilly Grant (use Gerrit) 2016/02/18 18:36:45 nit: The usual way to annotate this is: false /*
juncai 2016/02/18 20:17:50 Done.
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698