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

Side by Side Diff: chrome/renderer/extensions/bindings_utils.cc

Issue 8143009: Reland 103263 - Revert 103263 - Merge 101221 - Reland 101111 - Only deliver extension messages to... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/874/src/
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/bindings_utils.h" 5 #include "chrome/renderer/extensions/bindings_utils.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/string_split.h" 8 #include "base/string_split.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "content/renderer/render_view.h" 10 #include "content/renderer/render_view.h"
(...skipping 20 matching lines...) Expand all
31 const std::string& extension_id, 31 const std::string& extension_id,
32 WebFrame* frame) 32 WebFrame* frame)
33 : context(context), 33 : context(context),
34 extension_id(extension_id), 34 extension_id(extension_id),
35 unsafe_frame(frame), 35 unsafe_frame(frame),
36 num_connected_events(0) { 36 num_connected_events(0) {
37 } 37 }
38 38
39 ContextInfo::~ContextInfo() {} 39 ContextInfo::~ContextInfo() {}
40 40
41 WebFrame* ContextInfo::GetWebFrame() const {
42 return WebFrame::frameForContext(context);
43 }
44
45 RenderView* ContextInfo::GetRenderView() const {
46 WebFrame* frame = GetWebFrame();
47 if (!frame || !frame->view())
48 return NULL;
49
50 return RenderView::FromWebView(frame->view());
51 }
52
41 ContextList& GetContexts() { 53 ContextList& GetContexts() {
42 return g_singleton_data.Get().contexts; 54 return g_singleton_data.Get().contexts;
43 } 55 }
44 56
45 ContextInfo* GetInfoForCurrentContext() { 57 ContextInfo* GetInfoForCurrentContext() {
46 // This can happen in testing scenarios and v8::Context::GetCurrent() crashes 58 // This can happen in testing scenarios and v8::Context::GetCurrent() crashes
47 // if there is no JavaScript currently running. 59 // if there is no JavaScript currently running.
48 if (!v8::Context::InContext()) 60 if (!v8::Context::InContext())
49 return NULL; 61 return NULL;
50 62
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 134 }
123 135
124 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); 136 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value);
125 if (!function.IsEmpty()) 137 if (!function.IsEmpty())
126 return function->Call(v8::Object::New(), argc, argv); 138 return function->Call(v8::Object::New(), argc, argv);
127 139
128 return v8::Undefined(); 140 return v8::Undefined();
129 } 141 }
130 142
131 } // namespace bindings_utils 143 } // namespace bindings_utils
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/bindings_utils.h ('k') | chrome/renderer/extensions/event_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698