Chromium Code Reviews| Index: chrome/browser/chrome_webusb_browser_client.cc |
| diff --git a/chrome/browser/chrome_webusb_browser_client.cc b/chrome/browser/chrome_webusb_browser_client.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..85301b4de96a8b206a48b5364470041176166821 |
| --- /dev/null |
| +++ b/chrome/browser/chrome_webusb_browser_client.cc |
| @@ -0,0 +1,33 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/chrome_webusb_browser_client.h" |
| + |
| +#include "base/command_line.h" |
| +#include "chrome/browser/net/referrer.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/ui/browser.h" |
| +#include "chrome/browser/ui/browser_finder.h" |
| +#include "chrome/browser/ui/host_desktop.h" |
| +#include "chrome/common/chrome_switches.h" |
| +#include "ui/base/page_transition_types.h" |
| +#include "ui/base/window_open_disposition.h" |
| +#include "url/gurl.h" |
| + |
| +ChromeWebUsbBrowserClient::ChromeWebUsbBrowserClient() {} |
| + |
| +ChromeWebUsbBrowserClient::~ChromeWebUsbBrowserClient() {} |
| + |
| +void ChromeWebUsbBrowserClient::OpenURL(Profile* profile, const GURL& url) { |
| + Browser* browser = |
| + chrome::FindBrowserWithProfile(profile, chrome::HOST_DESKTOP_TYPE_NATIVE); |
|
Reilly Grant (use Gerrit)
2015/08/18 18:30:02
I think we can use ProfileManager::GetActiveProfil
juncai
2015/08/20 15:56:32
Done.
|
| + content::OpenURLParams params(url, content::Referrer(), NEW_FOREGROUND_TAB, |
| + ui::PAGE_TRANSITION_AUTO_TOPLEVEL, true); |
| + browser->OpenURL(params); |
| +} |
| + |
| +bool ChromeWebUsbBrowserClient::WebUsbNotificationEnabled() { |
| + return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kEnableWebUsbNotification); |
| +} |