| 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/devtools/chrome_devtools_discovery_provider.h" | 5 #include "chrome/browser/devtools/chrome_devtools_discovery_provider.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 9 #include "chrome/browser/ui/browser_navigator.h" | 9 #include "chrome/browser/ui/browser_navigator.h" |
| 10 #include "chrome/browser/ui/browser_navigator_params.h" | 10 #include "chrome/browser/ui/browser_navigator_params.h" |
| 11 #include "content/public/browser/devtools_agent_host.h" | 11 #include "content/public/browser/devtools_agent_host.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 scoped_refptr<content::DevToolsAgentHost> | 15 scoped_refptr<content::DevToolsAgentHost> |
| 16 CreateNewChromeTab(const GURL& url) { | 16 CreateNewChromeTab(const GURL& url) { |
| 17 chrome::NavigateParams params(ProfileManager::GetLastUsedProfile(), | 17 chrome::NavigateParams params(ProfileManager::GetLastUsedProfile(), |
| 18 url, ui::PAGE_TRANSITION_AUTO_TOPLEVEL); | 18 url, ui::PAGE_TRANSITION_AUTO_TOPLEVEL); |
| 19 params.disposition = NEW_FOREGROUND_TAB; | 19 params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
| 20 chrome::Navigate(¶ms); | 20 chrome::Navigate(¶ms); |
| 21 if (!params.target_contents) | 21 if (!params.target_contents) |
| 22 return nullptr; | 22 return nullptr; |
| 23 | 23 |
| 24 if (!params.target_contents) | 24 if (!params.target_contents) |
| 25 return nullptr; | 25 return nullptr; |
| 26 return content::DevToolsAgentHost::GetOrCreateFor(params.target_contents); | 26 return content::DevToolsAgentHost::GetOrCreateFor(params.target_contents); |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 // static | 42 // static |
| 43 void ChromeDevToolsDiscoveryProvider::Install() { | 43 void ChromeDevToolsDiscoveryProvider::Install() { |
| 44 devtools_discovery::DevToolsDiscoveryManager* discovery_manager = | 44 devtools_discovery::DevToolsDiscoveryManager* discovery_manager = |
| 45 devtools_discovery::DevToolsDiscoveryManager::GetInstance(); | 45 devtools_discovery::DevToolsDiscoveryManager::GetInstance(); |
| 46 discovery_manager->AddProvider( | 46 discovery_manager->AddProvider( |
| 47 base::WrapUnique(new ChromeDevToolsDiscoveryProvider())); | 47 base::WrapUnique(new ChromeDevToolsDiscoveryProvider())); |
| 48 discovery_manager->SetCreateCallback(base::Bind(&CreateNewChromeTab)); | 48 discovery_manager->SetCreateCallback(base::Bind(&CreateNewChromeTab)); |
| 49 } | 49 } |
| OLD | NEW |