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 "chrome/renderer/net/net_error_page_controller.h" | 5 #include "chrome/renderer/net/net_error_page_controller.h" |
6 | 6 |
7 #include "base/strings/string_piece.h" | 7 #include "base/strings/string_piece.h" |
8 #include "chrome/renderer/net/net_error_helper.h" | 8 #include "chrome/renderer/net/net_error_helper.h" |
9 #include "content/public/renderer/render_frame.h" | 9 #include "content/public/renderer/render_frame.h" |
10 #include "gin/handle.h" | 10 #include "gin/handle.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 v8::HandleScope handle_scope(isolate); | 21 v8::HandleScope handle_scope(isolate); |
22 v8::Handle<v8::Context> context = | 22 v8::Handle<v8::Context> context = |
23 render_frame->GetWebFrame()->mainWorldScriptContext(); | 23 render_frame->GetWebFrame()->mainWorldScriptContext(); |
24 if (context.IsEmpty()) | 24 if (context.IsEmpty()) |
25 return; | 25 return; |
26 | 26 |
27 v8::Context::Scope context_scope(context); | 27 v8::Context::Scope context_scope(context); |
28 | 28 |
29 gin::Handle<NetErrorPageController> controller = gin::CreateHandle( | 29 gin::Handle<NetErrorPageController> controller = gin::CreateHandle( |
30 isolate, new NetErrorPageController(render_frame)); | 30 isolate, new NetErrorPageController(render_frame)); |
| 31 if (controller.IsEmpty()) |
| 32 return; |
| 33 |
31 v8::Handle<v8::Object> global = context->Global(); | 34 v8::Handle<v8::Object> global = context->Global(); |
32 global->Set(gin::StringToV8(isolate, "errorPageController"), | 35 global->Set(gin::StringToV8(isolate, "errorPageController"), |
33 controller.ToV8()); | 36 controller.ToV8()); |
34 } | 37 } |
35 | 38 |
36 bool NetErrorPageController::LoadStaleButtonClick() { | 39 bool NetErrorPageController::LoadStaleButtonClick() { |
37 if (!render_frame()) | 40 if (!render_frame()) |
38 return false; | 41 return false; |
39 | 42 |
40 NetErrorHelper* net_error_helper = | 43 NetErrorHelper* net_error_helper = |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 isolate) | 83 isolate) |
81 .SetMethod("loadStaleButtonClick", | 84 .SetMethod("loadStaleButtonClick", |
82 &NetErrorPageController::LoadStaleButtonClick) | 85 &NetErrorPageController::LoadStaleButtonClick) |
83 .SetMethod("reloadButtonClick", | 86 .SetMethod("reloadButtonClick", |
84 &NetErrorPageController::ReloadButtonClick) | 87 &NetErrorPageController::ReloadButtonClick) |
85 .SetMethod("moreButtonClick", | 88 .SetMethod("moreButtonClick", |
86 &NetErrorPageController::MoreButtonClick); | 89 &NetErrorPageController::MoreButtonClick); |
87 } | 90 } |
88 | 91 |
89 void NetErrorPageController::OnDestruct() {} | 92 void NetErrorPageController::OnDestruct() {} |
OLD | NEW |