| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 base::Callback<void(bool)> callback_; | 43 base::Callback<void(bool)> callback_; |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(LoadWatcher); | 45 DISALLOW_COPY_AND_ASSIGN(LoadWatcher); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 RenderFrameObserverNatives::RenderFrameObserverNatives(ScriptContext* context) | 50 RenderFrameObserverNatives::RenderFrameObserverNatives(ScriptContext* context) |
| 51 : ObjectBackedNativeHandler(context), weak_ptr_factory_(this) { | 51 : ObjectBackedNativeHandler(context), weak_ptr_factory_(this) { |
| 52 RouteFunction( | 52 RouteFunction( |
| 53 "OnDocumentElementCreated", | 53 "OnDocumentElementCreated", "app.window", |
| 54 base::Bind(&RenderFrameObserverNatives::OnDocumentElementCreated, | 54 base::Bind(&RenderFrameObserverNatives::OnDocumentElementCreated, |
| 55 base::Unretained(this))); | 55 base::Unretained(this))); |
| 56 } | 56 } |
| 57 | 57 |
| 58 RenderFrameObserverNatives::~RenderFrameObserverNatives() {} | 58 RenderFrameObserverNatives::~RenderFrameObserverNatives() {} |
| 59 | 59 |
| 60 void RenderFrameObserverNatives::Invalidate() { | 60 void RenderFrameObserverNatives::Invalidate() { |
| 61 weak_ptr_factory_.InvalidateWeakPtrs(); | 61 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 62 ObjectBackedNativeHandler::Invalidate(); | 62 ObjectBackedNativeHandler::Invalidate(); |
| 63 } | 63 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 v8::Global<v8::Function> callback, | 98 v8::Global<v8::Function> callback, |
| 99 bool succeeded) { | 99 bool succeeded) { |
| 100 v8::Isolate* isolate = context()->isolate(); | 100 v8::Isolate* isolate = context()->isolate(); |
| 101 v8::HandleScope handle_scope(isolate); | 101 v8::HandleScope handle_scope(isolate); |
| 102 v8::Local<v8::Value> args[] = {v8::Boolean::New(isolate, succeeded)}; | 102 v8::Local<v8::Value> args[] = {v8::Boolean::New(isolate, succeeded)}; |
| 103 context()->CallFunction(v8::Local<v8::Function>::New(isolate, callback), | 103 context()->CallFunction(v8::Local<v8::Function>::New(isolate, callback), |
| 104 arraysize(args), args); | 104 arraysize(args), args); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace extensions | 107 } // namespace extensions |
| OLD | NEW |