| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 207 } |
| 208 | 208 |
| 209 Response PageHandler::Reload(const bool* ignoreCache, | 209 Response PageHandler::Reload(const bool* ignoreCache, |
| 210 const std::string* script_to_evaluate_on_load, | 210 const std::string* script_to_evaluate_on_load, |
| 211 const std::string* script_preprocessor) { | 211 const std::string* script_preprocessor) { |
| 212 WebContentsImpl* web_contents = GetWebContents(); | 212 WebContentsImpl* web_contents = GetWebContents(); |
| 213 if (!web_contents) | 213 if (!web_contents) |
| 214 return Response::InternalError("Could not connect to view"); | 214 return Response::InternalError("Could not connect to view"); |
| 215 | 215 |
| 216 if (web_contents->IsCrashed() || | 216 if (web_contents->IsCrashed() || |
| 217 web_contents->GetController().GetVisibleEntry()->IsViewSourceMode()) { | 217 (web_contents->GetController().GetVisibleEntry() && |
| 218 web_contents->GetController().GetVisibleEntry()->IsViewSourceMode())) { |
| 218 web_contents->GetController().Reload(false); | 219 web_contents->GetController().Reload(false); |
| 219 return Response::OK(); | 220 return Response::OK(); |
| 220 } else { | 221 } else { |
| 221 // Handle reload in renderer except for crashed and view source mode. | 222 // Handle reload in renderer except for crashed and view source mode. |
| 222 return Response::FallThrough(); | 223 return Response::FallThrough(); |
| 223 } | 224 } |
| 224 } | 225 } |
| 225 | 226 |
| 226 Response PageHandler::Navigate(const std::string& url, | 227 Response PageHandler::Navigate(const std::string& url, |
| 227 FrameId* frame_id) { | 228 FrameId* frame_id) { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 512 |
| 512 void PageHandler::OnColorPicked(int r, int g, int b, int a) { | 513 void PageHandler::OnColorPicked(int r, int g, int b, int a) { |
| 513 scoped_refptr<dom::RGBA> color = | 514 scoped_refptr<dom::RGBA> color = |
| 514 dom::RGBA::Create()->set_r(r)->set_g(g)->set_b(b)->set_a(a); | 515 dom::RGBA::Create()->set_r(r)->set_g(g)->set_b(b)->set_a(a); |
| 515 client_->ColorPicked(ColorPickedParams::Create()->set_color(color)); | 516 client_->ColorPicked(ColorPickedParams::Create()->set_color(color)); |
| 516 } | 517 } |
| 517 | 518 |
| 518 } // namespace page | 519 } // namespace page |
| 519 } // namespace devtools | 520 } // namespace devtools |
| 520 } // namespace content | 521 } // namespace content |
| OLD | NEW |