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

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

Issue 1905783002: [Extensions] Clean up comments in safe_builtins.h/cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « extensions/renderer/safe_builtins.h ('k') | no next file » | 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/safe_builtins.h" 5 #include "extensions/renderer/safe_builtins.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "extensions/renderer/script_context.h" 10 #include "extensions/renderer/script_context.h"
11 #include "extensions/renderer/v8_helpers.h" 11 #include "extensions/renderer/v8_helpers.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 using namespace v8_helpers; 15 using namespace v8_helpers;
16 16
17 namespace { 17 namespace {
18 18
19 const char kClassName[] = "extensions::SafeBuiltins"; 19 const char kClassName[] = "extensions::SafeBuiltins";
20 20
21 // Documentation for makeCallback in the JavaScript, out here to reduce the 21 // Documentation for makeCallback in the JavaScript, out here to reduce the
22 // (very small) amount of effort that the v8 parser needs to do: 22 // (very small) amount of effort that the v8 parser needs to do:
23 // 23 //
24 // Returns a new object with every function on |obj| configured to call()\n" 24 // Returns a new object with every function on |obj| configured to call()
25 // itself with the given arguments.\n" 25 // itself with the given arguments.
26 // E.g. given\n" 26 // E.g. given
27 // var result = makeCallable(Function.prototype)\n" 27 // var result = makeCallable(Function.prototype)
28 // |result| will be a object including 'bind' such that\n" 28 // |result| will be a object including 'bind' such that
29 // result.bind(foo, 1, 2, 3);\n" 29 // result.bind(foo, 1, 2, 3);
30 // is equivalent to Function.prototype.bind.call(foo, 1, 2, 3), and so on.\n" 30 // is equivalent to Function.prototype.bind.call(foo, 1, 2, 3), and so on.
31 // This is a convenient way to save functions that user scripts may clobber.\n" 31 // This is a convenient way to save functions that user scripts may clobber.
32 const char kScript[] = 32 const char kScript[] =
33 "(function() {\n" 33 "(function() {\n"
34 "'use strict';\n" 34 "'use strict';\n"
35 "native function Apply();\n" 35 "native function Apply();\n"
36 "native function Save();\n" 36 "native function Save();\n"
37 "\n" 37 "\n"
38 "// Used in the callback implementation, could potentially be clobbered.\n" 38 "// Used in the callback implementation, could potentially be clobbered.\n"
39 "function makeCallable(obj, target, isStatic, propertyNames) {\n" 39 "function makeCallable(obj, target, isStatic, propertyNames) {\n"
40 " propertyNames.forEach(function(propertyName) {\n" 40 " propertyNames.forEach(function(propertyName) {\n"
41 " var property = obj[propertyName];\n" 41 " var property = obj[propertyName];\n"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 v8::Local<v8::Object> SafeBuiltins::GetString() const { 249 v8::Local<v8::Object> SafeBuiltins::GetString() const {
250 return Load("String", context_->v8_context()); 250 return Load("String", context_->v8_context());
251 } 251 }
252 252
253 v8::Local<v8::Object> SafeBuiltins::GetError() const { 253 v8::Local<v8::Object> SafeBuiltins::GetError() const {
254 return Load("Error", context_->v8_context()); 254 return Load("Error", context_->v8_context());
255 } 255 }
256 256
257 } // namespace extensions 257 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/safe_builtins.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698