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

Side by Side Diff: extensions/renderer/script_context.cc

Issue 444813002: Remove BrowserPlugin's -internal-attach method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 6 years, 4 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
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 #include "extensions/renderer/script_context.h" 5 #include "extensions/renderer/script_context.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "content/public/common/url_constants.h" 12 #include "content/public/common/url_constants.h"
13 #include "content/public/renderer/render_frame.h"
13 #include "content/public/renderer/render_view.h" 14 #include "content/public/renderer/render_view.h"
14 #include "content/public/renderer/v8_value_converter.h" 15 #include "content/public/renderer/v8_value_converter.h"
15 #include "extensions/common/extension.h" 16 #include "extensions/common/extension.h"
16 #include "extensions/common/extension_api.h" 17 #include "extensions/common/extension_api.h"
17 #include "extensions/common/extension_urls.h" 18 #include "extensions/common/extension_urls.h"
18 #include "extensions/common/features/base_feature_provider.h" 19 #include "extensions/common/features/base_feature_provider.h"
19 #include "gin/per_context_data.h" 20 #include "gin/per_context_data.h"
20 #include "third_party/WebKit/public/web/WebDataSource.h" 21 #include "third_party/WebKit/public/web/WebDataSource.h"
21 #include "third_party/WebKit/public/web/WebDocument.h" 22 #include "third_party/WebKit/public/web/WebDocument.h"
22 #include "third_party/WebKit/public/web/WebFrame.h" 23 #include "third_party/WebKit/public/web/WebFrame.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return extension_.get() ? extension_->id() : base::EmptyString(); 67 return extension_.get() ? extension_->id() : base::EmptyString();
67 } 68 }
68 69
69 content::RenderView* ScriptContext::GetRenderView() const { 70 content::RenderView* ScriptContext::GetRenderView() const {
70 if (web_frame_ && web_frame_->view()) 71 if (web_frame_ && web_frame_->view())
71 return content::RenderView::FromWebView(web_frame_->view()); 72 return content::RenderView::FromWebView(web_frame_->view());
72 else 73 else
73 return NULL; 74 return NULL;
74 } 75 }
75 76
77 content::RenderFrame* ScriptContext::GetRenderFrame() const {
78 if (web_frame_)
79 return content::RenderFrame::FromWebFrame(web_frame_);
80 else
81 return NULL;
not at google - send to devlin 2014/08/13 23:40:16 No else after return. Mind fixing line 74 as well?
Fady Samuel 2014/08/14 19:41:18 Done.
82 }
83
76 v8::Local<v8::Value> ScriptContext::CallFunction( 84 v8::Local<v8::Value> ScriptContext::CallFunction(
77 v8::Handle<v8::Function> function, 85 v8::Handle<v8::Function> function,
78 int argc, 86 int argc,
79 v8::Handle<v8::Value> argv[]) const { 87 v8::Handle<v8::Value> argv[]) const {
80 v8::EscapableHandleScope handle_scope(isolate()); 88 v8::EscapableHandleScope handle_scope(isolate());
81 v8::Context::Scope scope(v8_context()); 89 v8::Context::Scope scope(v8_context());
82 90
83 blink::WebScopedMicrotaskSuppression suppression; 91 blink::WebScopedMicrotaskSuppression suppression;
84 if (!is_valid()) { 92 if (!is_valid()) {
85 return handle_scope.Escape( 93 return handle_scope.Escape(
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 v8::Handle<v8::Value> argv[]) { 246 v8::Handle<v8::Value> argv[]) {
239 return CallFunction(function, argc, argv); 247 return CallFunction(function, argc, argv);
240 } 248 }
241 249
242 gin::ContextHolder* ScriptContext::GetContextHolder() { 250 gin::ContextHolder* ScriptContext::GetContextHolder() {
243 v8::HandleScope handle_scope(isolate()); 251 v8::HandleScope handle_scope(isolate());
244 return gin::PerContextData::From(v8_context())->context_holder(); 252 return gin::PerContextData::From(v8_context())->context_holder();
245 } 253 }
246 254
247 } // namespace extensions 255 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698