| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/protocol/page_handler.h" | 5 #include "content/browser/devtools/protocol/page_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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 return Response::FallThrough(); | 193 return Response::FallThrough(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 Response PageHandler::Disable() { | 196 Response PageHandler::Disable() { |
| 197 enabled_ = false; | 197 enabled_ = false; |
| 198 screencast_enabled_ = false; | 198 screencast_enabled_ = false; |
| 199 color_picker_->SetEnabled(false); | 199 color_picker_->SetEnabled(false); |
| 200 return Response::FallThrough(); | 200 return Response::FallThrough(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 Response PageHandler::Reload(const bool* ignoreCache, | 203 Response PageHandler::Reload(const bool* bypassCache, |
| 204 const std::string* script_to_evaluate_on_load, | 204 const std::string* script_to_evaluate_on_load, |
| 205 const std::string* script_preprocessor) { | 205 const std::string* script_preprocessor) { |
| 206 WebContentsImpl* web_contents = GetWebContents(); | 206 WebContentsImpl* web_contents = GetWebContents(); |
| 207 if (!web_contents) | 207 if (!web_contents) |
| 208 return Response::InternalError("Could not connect to view"); | 208 return Response::InternalError("Could not connect to view"); |
| 209 | 209 |
| 210 if (web_contents->IsCrashed() || | 210 if (web_contents->IsCrashed() || |
| 211 (web_contents->GetController().GetVisibleEntry() && | 211 (web_contents->GetController().GetVisibleEntry() && |
| 212 web_contents->GetController().GetVisibleEntry()->IsViewSourceMode())) { | 212 web_contents->GetController().GetVisibleEntry()->IsViewSourceMode())) { |
| 213 web_contents->GetController().Reload(false); | 213 if (bypassCache && *bypassCache) |
| 214 web_contents->GetController().ReloadBypassingCache(false); |
| 215 else |
| 216 web_contents->GetController().Reload(false); |
| 214 return Response::OK(); | 217 return Response::OK(); |
| 215 } else { | 218 } else { |
| 216 // Handle reload in renderer except for crashed and view source mode. | 219 // Handle reload in renderer except for crashed and view source mode. |
| 217 return Response::FallThrough(); | 220 return Response::FallThrough(); |
| 218 } | 221 } |
| 219 } | 222 } |
| 220 | 223 |
| 221 Response PageHandler::Navigate(const std::string& url, | 224 Response PageHandler::Navigate(const std::string& url, |
| 222 FrameId* frame_id) { | 225 FrameId* frame_id) { |
| 223 GURL gurl(url); | 226 GURL gurl(url); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 514 |
| 512 void PageHandler::OnColorPicked(int r, int g, int b, int a) { | 515 void PageHandler::OnColorPicked(int r, int g, int b, int a) { |
| 513 scoped_refptr<dom::RGBA> color = | 516 scoped_refptr<dom::RGBA> color = |
| 514 dom::RGBA::Create()->set_r(r)->set_g(g)->set_b(b)->set_a(a); | 517 dom::RGBA::Create()->set_r(r)->set_g(g)->set_b(b)->set_a(a); |
| 515 client_->ColorPicked(ColorPickedParams::Create()->set_color(color)); | 518 client_->ColorPicked(ColorPickedParams::Create()->set_color(color)); |
| 516 } | 519 } |
| 517 | 520 |
| 518 } // namespace page | 521 } // namespace page |
| 519 } // namespace devtools | 522 } // namespace devtools |
| 520 } // namespace content | 523 } // namespace content |
| OLD | NEW |