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

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

Issue 327953002: Make MessagingBindings use ScriptContextSet::ForEach (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ForEach shortcuts Created 6 years, 6 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
« no previous file with comments | « extensions/renderer/script_context.h ('k') | extensions/renderer/script_context_set.h » ('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 #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/values.h" 11 #include "base/values.h"
11 #include "content/public/common/url_constants.h" 12 #include "content/public/common/url_constants.h"
12 #include "content/public/renderer/render_view.h" 13 #include "content/public/renderer/render_view.h"
13 #include "content/public/renderer/v8_value_converter.h" 14 #include "content/public/renderer/v8_value_converter.h"
14 #include "extensions/common/extension.h" 15 #include "extensions/common/extension.h"
15 #include "extensions/common/extension_api.h" 16 #include "extensions/common/extension_api.h"
16 #include "extensions/common/extension_urls.h" 17 #include "extensions/common/extension_urls.h"
17 #include "extensions/common/features/base_feature_provider.h" 18 #include "extensions/common/features/base_feature_provider.h"
18 #include "third_party/WebKit/public/web/WebDataSource.h" 19 #include "third_party/WebKit/public/web/WebDataSource.h"
19 #include "third_party/WebKit/public/web/WebDocument.h" 20 #include "third_party/WebKit/public/web/WebDocument.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 52
52 void ScriptContext::Invalidate() { 53 void ScriptContext::Invalidate() {
53 if (!is_valid()) 54 if (!is_valid())
54 return; 55 return;
55 if (module_system_) 56 if (module_system_)
56 module_system_->Invalidate(); 57 module_system_->Invalidate();
57 web_frame_ = NULL; 58 web_frame_ = NULL;
58 v8_context_.reset(); 59 v8_context_.reset();
59 } 60 }
60 61
61 std::string ScriptContext::GetExtensionID() const { 62 const std::string& ScriptContext::GetExtensionID() const {
62 return extension_.get() ? extension_->id() : std::string(); 63 return extension_.get() ? extension_->id() : base::EmptyString();
63 } 64 }
64 65
65 content::RenderView* ScriptContext::GetRenderView() const { 66 content::RenderView* ScriptContext::GetRenderView() const {
66 if (web_frame_ && web_frame_->view()) 67 if (web_frame_ && web_frame_->view())
67 return content::RenderView::FromWebView(web_frame_->view()); 68 return content::RenderView::FromWebView(web_frame_->view());
68 else 69 else
69 return NULL; 70 return NULL;
70 } 71 }
71 72
72 v8::Local<v8::Value> ScriptContext::CallFunction( 73 v8::Local<v8::Value> ScriptContext::CallFunction(
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 v8::Handle<v8::Value> retval = module_system()->CallModuleMethod( 215 v8::Handle<v8::Value> retval = module_system()->CallModuleMethod(
215 "sendRequest", "handleResponse", arraysize(argv), argv); 216 "sendRequest", "handleResponse", arraysize(argv), argv);
216 217
217 // In debug, the js will validate the callback parameters and return a 218 // In debug, the js will validate the callback parameters and return a
218 // string if a validation error has occured. 219 // string if a validation error has occured.
219 DCHECK(retval.IsEmpty() || retval->IsUndefined()) 220 DCHECK(retval.IsEmpty() || retval->IsUndefined())
220 << *v8::String::Utf8Value(retval); 221 << *v8::String::Utf8Value(retval);
221 } 222 }
222 223
223 } // namespace extensions 224 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/script_context.h ('k') | extensions/renderer/script_context_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698