forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdevtools_manager_delegate_android.cc
43 lines (33 loc) · 1.42 KB
/
devtools_manager_delegate_android.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2019 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 "weblayer/browser/devtools_manager_delegate_android.h"
#include "weblayer/browser/browser_context_impl.h"
#include "weblayer/browser/profile_impl.h"
namespace weblayer {
DevToolsManagerDelegateAndroid::DevToolsManagerDelegateAndroid() = default;
DevToolsManagerDelegateAndroid::~DevToolsManagerDelegateAndroid() = default;
content::BrowserContext*
DevToolsManagerDelegateAndroid::GetDefaultBrowserContext() {
auto profiles = ProfileImpl::GetAllProfiles();
if (profiles.empty())
return nullptr;
// This is called when granting permissions via devtools in browser tests or WPT. We assume that
// there is only a single profile and just pick the first one here. Note that outside of tests
// there might exist multiple profiles for WebLayer and this assumption won't hold.
ProfileImpl* profile = *profiles.begin();
return profile->GetBrowserContext();
}
std::string DevToolsManagerDelegateAndroid::GetDiscoveryPageHTML() {
const char html[] =
"<html>"
"<head><title>WebLayer remote debugging</title></head>"
"<body>Please use <a href=\'chrome://inspect\'>chrome://inspect</a>"
"</body>"
"</html>";
return html;
}
bool DevToolsManagerDelegateAndroid::IsBrowserTargetDiscoverable() {
return true;
}
} // namespace weblayer