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

Side by Side Diff: android_webview/browser/aw_dev_tools_discovery_provider.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase 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
« no previous file with comments | « no previous file | base/json/json_string_value_serializer.cc » ('j') | 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 "android_webview/browser/aw_dev_tools_discovery_provider.h" 5 #include "android_webview/browser/aw_dev_tools_discovery_provider.h"
6 6
7 #include "android_webview/browser/browser_view_renderer.h" 7 #include "android_webview/browser/browser_view_renderer.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 17 matching lines...) Expand all
28 description.SetBoolean("visible", bvr->IsVisible()); 28 description.SetBoolean("visible", bvr->IsVisible());
29 gfx::Rect screen_rect = bvr->GetScreenRect(); 29 gfx::Rect screen_rect = bvr->GetScreenRect();
30 description.SetInteger("screenX", screen_rect.x()); 30 description.SetInteger("screenX", screen_rect.x());
31 description.SetInteger("screenY", screen_rect.y()); 31 description.SetInteger("screenY", screen_rect.y());
32 description.SetBoolean("empty", screen_rect.size().IsEmpty()); 32 description.SetBoolean("empty", screen_rect.size().IsEmpty());
33 if (!screen_rect.size().IsEmpty()) { 33 if (!screen_rect.size().IsEmpty()) {
34 description.SetInteger("width", screen_rect.width()); 34 description.SetInteger("width", screen_rect.width());
35 description.SetInteger("height", screen_rect.height()); 35 description.SetInteger("height", screen_rect.height());
36 } 36 }
37 std::string json; 37 std::string json;
38 base::JSONWriter::Write(&description, &json); 38 base::JSONWriter::Write(description, &json);
39 return json; 39 return json;
40 } 40 }
41 41
42 class TargetDescriptor : public devtools_discovery::BasicTargetDescriptor { 42 class TargetDescriptor : public devtools_discovery::BasicTargetDescriptor {
43 public: 43 public:
44 explicit TargetDescriptor(scoped_refptr<DevToolsAgentHost> agent_host); 44 explicit TargetDescriptor(scoped_refptr<DevToolsAgentHost> agent_host);
45 45
46 // devtools_discovery::BasicTargetDescriptor overrides. 46 // devtools_discovery::BasicTargetDescriptor overrides.
47 std::string GetDescription() const override { return description_; } 47 std::string GetDescription() const override { return description_; }
48 48
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 AwDevToolsDiscoveryProvider::GetDescriptors() { 80 AwDevToolsDiscoveryProvider::GetDescriptors() {
81 DevToolsAgentHost::List agent_hosts = DevToolsAgentHost::GetOrCreateAll(); 81 DevToolsAgentHost::List agent_hosts = DevToolsAgentHost::GetOrCreateAll();
82 devtools_discovery::DevToolsTargetDescriptor::List result; 82 devtools_discovery::DevToolsTargetDescriptor::List result;
83 result.reserve(agent_hosts.size()); 83 result.reserve(agent_hosts.size());
84 for (const auto& agent_host : agent_hosts) 84 for (const auto& agent_host : agent_hosts)
85 result.push_back(new TargetDescriptor(agent_host)); 85 result.push_back(new TargetDescriptor(agent_host));
86 return result; 86 return result;
87 } 87 }
88 88
89 } // namespace android_webview 89 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | base/json/json_string_value_serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698