| 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_view_observer_natives.h" | 5 #include "extensions/renderer/render_view_observer_natives.h" |
| 6 | 6 |
| 7 #include "content/public/renderer/render_view.h" | 7 #include "content/public/renderer/render_view.h" |
| 8 #include "content/public/renderer/render_view_observer.h" | 8 #include "content/public/renderer/render_view_observer.h" |
| 9 #include "extensions/common/extension_api.h" | 9 #include "extensions/common/extension_api.h" |
| 10 #include "extensions/renderer/script_context.h" | 10 #include "extensions/renderer/script_context.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 base::Bind(&RenderViewObserverNatives::OnDocumentElementCreated, | 56 base::Bind(&RenderViewObserverNatives::OnDocumentElementCreated, |
| 57 base::Unretained(this))); | 57 base::Unretained(this))); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void RenderViewObserverNatives::OnDocumentElementCreated( | 60 void RenderViewObserverNatives::OnDocumentElementCreated( |
| 61 const v8::FunctionCallbackInfo<v8::Value>& args) { | 61 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 62 CHECK(args.Length() == 2); | 62 CHECK(args.Length() == 2); |
| 63 CHECK(args[0]->IsInt32()); | 63 CHECK(args[0]->IsInt32()); |
| 64 CHECK(args[1]->IsFunction()); | 64 CHECK(args[1]->IsFunction()); |
| 65 | 65 |
| 66 int view_id = args[0]->Int32Value(); | 66 int view_id = args[0].As<v8::Int32>()->Value(); |
| 67 | 67 |
| 68 content::RenderView* view = content::RenderView::FromRoutingID(view_id); | 68 content::RenderView* view = content::RenderView::FromRoutingID(view_id); |
| 69 if (!view) { | 69 if (!view) { |
| 70 LOG(WARNING) << "No render view found to register LoadWatcher."; | 70 LOG(WARNING) << "No render view found to register LoadWatcher."; |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 | 73 |
| 74 new LoadWatcher(context(), view, args[1].As<v8::Function>()); | 74 new LoadWatcher(context(), view, args[1].As<v8::Function>()); |
| 75 | 75 |
| 76 args.GetReturnValue().Set(true); | 76 args.GetReturnValue().Set(true); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace extensions | 79 } // namespace extensions |
| OLD | NEW |