OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/devtools/renderer_overrides_handler.h" | 5 #include "content/browser/devtools/renderer_overrides_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 GURL gurl(url); | 138 GURL gurl(url); |
139 if (!gurl.is_valid()) { | 139 if (!gurl.is_valid()) { |
140 return command->ErrorResponse( | 140 return command->ErrorResponse( |
141 DevToolsProtocol::kErrorInternalError, | 141 DevToolsProtocol::kErrorInternalError, |
142 "Cannot navigate to invalid URL"); | 142 "Cannot navigate to invalid URL"); |
143 } | 143 } |
144 RenderViewHost* host = agent_->GetRenderViewHost(); | 144 RenderViewHost* host = agent_->GetRenderViewHost(); |
145 if (host) { | 145 if (host) { |
146 WebContents* web_contents = host->GetDelegate()->GetAsWebContents(); | 146 WebContents* web_contents = host->GetDelegate()->GetAsWebContents(); |
147 if (web_contents) { | 147 if (web_contents) { |
148 web_contents->GetController().LoadURL( | 148 web_contents->GetController() |
149 gurl, Referrer(), PAGE_TRANSITION_TYPED, ""); | 149 .LoadURL(gurl, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
150 return command->SuccessResponse(new base::DictionaryValue()); | 150 return command->SuccessResponse(new base::DictionaryValue()); |
151 } | 151 } |
152 } | 152 } |
153 return command->ErrorResponse( | 153 return command->ErrorResponse( |
154 DevToolsProtocol::kErrorInternalError, | 154 DevToolsProtocol::kErrorInternalError, |
155 "No WebContents to navigate"); | 155 "No WebContents to navigate"); |
156 } | 156 } |
157 | 157 |
158 scoped_ptr<DevToolsProtocol::Response> | 158 scoped_ptr<DevToolsProtocol::Response> |
159 RendererOverridesHandler::PageCaptureScreenshot( | 159 RendererOverridesHandler::PageCaptureScreenshot( |
(...skipping 20 matching lines...) Expand all Loading... |
180 snapshot_bounds)) | 180 snapshot_bounds)) |
181 return false; | 181 return false; |
182 | 182 |
183 return base::Base64Encode(base::StringPiece( | 183 return base::Base64Encode(base::StringPiece( |
184 reinterpret_cast<char*>(&*png.begin()), | 184 reinterpret_cast<char*>(&*png.begin()), |
185 png.size()), | 185 png.size()), |
186 base_64_data); | 186 base_64_data); |
187 } | 187 } |
188 | 188 |
189 } // namespace content | 189 } // namespace content |
OLD | NEW |