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 "extensions/renderer/render_frame_observer_natives.h" | 5 #include "extensions/renderer/render_frame_observer_natives.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/public/renderer/render_frame.h" | 10 #include "content/public/renderer/render_frame.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 void DidFailProvisionalLoad(const blink::WebURLError& error) override { | 34 void DidFailProvisionalLoad(const blink::WebURLError& error) override { |
35 // Use PostTask to avoid running user scripts while handling this | 35 // Use PostTask to avoid running user scripts while handling this |
36 // DidFailProvisionalLoad notification. | 36 // DidFailProvisionalLoad notification. |
37 base::MessageLoop::current()->PostTask(FROM_HERE, | 37 base::MessageLoop::current()->PostTask(FROM_HERE, |
38 base::Bind(callback_, false)); | 38 base::Bind(callback_, false)); |
39 delete this; | 39 delete this; |
40 } | 40 } |
41 | 41 |
| 42 void OnDestruct() override { delete this; } |
| 43 |
42 private: | 44 private: |
43 base::Callback<void(bool)> callback_; | 45 base::Callback<void(bool)> callback_; |
44 | 46 |
45 DISALLOW_COPY_AND_ASSIGN(LoadWatcher); | 47 DISALLOW_COPY_AND_ASSIGN(LoadWatcher); |
46 }; | 48 }; |
47 | 49 |
48 } // namespace | 50 } // namespace |
49 | 51 |
50 RenderFrameObserverNatives::RenderFrameObserverNatives(ScriptContext* context) | 52 RenderFrameObserverNatives::RenderFrameObserverNatives(ScriptContext* context) |
51 : ObjectBackedNativeHandler(context), weak_ptr_factory_(this) { | 53 : ObjectBackedNativeHandler(context), weak_ptr_factory_(this) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 v8::Global<v8::Function> callback, | 100 v8::Global<v8::Function> callback, |
99 bool succeeded) { | 101 bool succeeded) { |
100 v8::Isolate* isolate = context()->isolate(); | 102 v8::Isolate* isolate = context()->isolate(); |
101 v8::HandleScope handle_scope(isolate); | 103 v8::HandleScope handle_scope(isolate); |
102 v8::Local<v8::Value> args[] = {v8::Boolean::New(isolate, succeeded)}; | 104 v8::Local<v8::Value> args[] = {v8::Boolean::New(isolate, succeeded)}; |
103 context()->CallFunction(v8::Local<v8::Function>::New(isolate, callback), | 105 context()->CallFunction(v8::Local<v8::Function>::New(isolate, callback), |
104 arraysize(args), args); | 106 arraysize(args), args); |
105 } | 107 } |
106 | 108 |
107 } // namespace extensions | 109 } // namespace extensions |
OLD | NEW |