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

Side by Side Diff: chrome/browser/android/dev_tools_manager_delegate_android.cc

Issue 1114503002: [DevTools] Cleanup DevToolsTarget and DevToolsManagerDelegate after moving to devtools_discovery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@devtools-discovery-chrome
Patch Set: Created 5 years, 7 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/android/dev_tools_manager_delegate_android.h"
6
7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/history/top_sites_factory.h"
10 #include "chrome/browser/profiles/profile_manager.h"
11 #include "components/devtools_discovery/devtools_discovery_manager.h"
12 #include "components/history/core/browser/top_sites.h"
13 #include "content/public/browser/devtools_agent_host.h"
14 #include "content/public/browser/devtools_target.h"
15
16 using content::DevToolsAgentHost;
17
18 DevToolsManagerDelegateAndroid::DevToolsManagerDelegateAndroid()
19 : network_protocol_handler_(new DevToolsNetworkProtocolHandler()) {
20 }
21
22 DevToolsManagerDelegateAndroid::~DevToolsManagerDelegateAndroid() {
23 }
24
25 void DevToolsManagerDelegateAndroid::Inspect(
26 content::BrowserContext* browser_context,
27 content::DevToolsAgentHost* agent_host) {
28 }
29
30 base::DictionaryValue* DevToolsManagerDelegateAndroid::HandleCommand(
31 content::DevToolsAgentHost* agent_host,
32 base::DictionaryValue* command_dict) {
33 return network_protocol_handler_->HandleCommand(agent_host, command_dict);
34 }
35
36 void DevToolsManagerDelegateAndroid::DevToolsAgentStateChanged(
37 content::DevToolsAgentHost* agent_host,
38 bool attached) {
39 network_protocol_handler_->DevToolsAgentStateChanged(agent_host, attached);
40 }
41
42 scoped_ptr<content::DevToolsTarget>
43 DevToolsManagerDelegateAndroid::CreateNewTarget(const GURL& url) {
44 devtools_discovery::DevToolsDiscoveryManager* discovery_manager =
45 devtools_discovery::DevToolsDiscoveryManager::GetInstance();
46 return discovery_manager->CreateNew(url);
47 }
48
49 void DevToolsManagerDelegateAndroid::EnumerateTargets(TargetCallback callback) {
50 TargetList targets;
51 devtools_discovery::DevToolsDiscoveryManager* discovery_manager =
52 devtools_discovery::DevToolsDiscoveryManager::GetInstance();
53 for (const auto& descriptor : discovery_manager->GetDescriptors())
54 targets.push_back(descriptor);
55 callback.Run(targets);
56 }
57
58 std::string DevToolsManagerDelegateAndroid::GetPageThumbnailData(
59 const GURL& url) {
60 Profile* profile = ProfileManager::GetLastUsedProfile()->GetOriginalProfile();
61 scoped_refptr<history::TopSites> top_sites =
62 TopSitesFactory::GetForProfile(profile);
63 if (top_sites) {
64 scoped_refptr<base::RefCountedMemory> data;
65 if (top_sites->GetPageThumbnail(url, false, &data))
66 return std::string(data->front_as<char>(), data->size());
67 }
68 return std::string();
69 }
OLDNEW
« no previous file with comments | « chrome/browser/android/dev_tools_manager_delegate_android.h ('k') | chrome/browser/android/dev_tools_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698