Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: content/shell/renderer/binding_helpers.h

Issue 1113783002: Use Local instead of Handle in src/content/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/web_ui_runner.cc ('k') | content/shell/renderer/layout_test/gc_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CONTENT_SHELL_RENDERER_BINDING_HELPERS_H_ 5 #ifndef CONTENT_SHELL_RENDERER_BINDING_HELPERS_H_
6 #define CONTENT_SHELL_RENDERER_BINDING_HELPERS_H_ 6 #define CONTENT_SHELL_RENDERER_BINDING_HELPERS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "gin/handle.h" 12 #include "gin/handle.h"
13 #include "gin/wrappable.h" 13 #include "gin/wrappable.h"
14 #include "third_party/WebKit/public/web/WebFrame.h" 14 #include "third_party/WebKit/public/web/WebFrame.h"
15 #include "third_party/WebKit/public/web/WebKit.h" 15 #include "third_party/WebKit/public/web/WebKit.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 template<class WrappedClass> 19 template<class WrappedClass>
20 void InstallAsWindowProperties(WrappedClass* wrapped, 20 void InstallAsWindowProperties(WrappedClass* wrapped,
21 blink::WebFrame* frame, 21 blink::WebFrame* frame,
22 const std::vector<std::string>& names) { 22 const std::vector<std::string>& names) {
23 v8::Isolate* isolate = blink::mainThreadIsolate(); 23 v8::Isolate* isolate = blink::mainThreadIsolate();
24 v8::HandleScope handle_scope(isolate); 24 v8::HandleScope handle_scope(isolate);
25 v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); 25 v8::Local<v8::Context> context = frame->mainWorldScriptContext();
26 if (context.IsEmpty()) 26 if (context.IsEmpty())
27 return; 27 return;
28 28
29 v8::Context::Scope context_scope(context); 29 v8::Context::Scope context_scope(context);
30 30
31 gin::Handle<WrappedClass> bindings = gin::CreateHandle(isolate, wrapped); 31 gin::Handle<WrappedClass> bindings = gin::CreateHandle(isolate, wrapped);
32 if (bindings.IsEmpty()) 32 if (bindings.IsEmpty())
33 return; 33 return;
34 v8::Handle<v8::Object> global = context->Global(); 34 v8::Local<v8::Object> global = context->Global();
35 v8::Handle<v8::Value> v8_bindings = bindings.ToV8(); 35 v8::Local<v8::Value> v8_bindings = bindings.ToV8();
36 for (size_t i = 0; i < names.size(); ++i) 36 for (size_t i = 0; i < names.size(); ++i)
37 global->Set(gin::StringToV8(isolate, names[i].c_str()), v8_bindings); 37 global->Set(gin::StringToV8(isolate, names[i].c_str()), v8_bindings);
38 } 38 }
39 39
40 } // namespace content 40 } // namespace content
41 41
42 #endif // CONTENT_SHELL_RENDERER_BINDING_HELPERS_H_ 42 #endif // CONTENT_SHELL_RENDERER_BINDING_HELPERS_H_
OLDNEW
« no previous file with comments | « content/renderer/web_ui_runner.cc ('k') | content/shell/renderer/layout_test/gc_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698