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

Side by Side Diff: tools/gn/build_settings.h

Issue 988563002: Add an whitelist for calling GN's exec_script. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | tools/gn/function_exec_script.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 TOOLS_GN_BUILD_SETTINGS_H_ 5 #ifndef TOOLS_GN_BUILD_SETTINGS_H_
6 #define TOOLS_GN_BUILD_SETTINGS_H_ 6 #define TOOLS_GN_BUILD_SETTINGS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "tools/gn/args.h" 15 #include "tools/gn/args.h"
15 #include "tools/gn/scope.h" 16 #include "tools/gn/scope.h"
16 #include "tools/gn/source_dir.h" 17 #include "tools/gn/source_dir.h"
17 #include "tools/gn/source_file.h" 18 #include "tools/gn/source_file.h"
18 19
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 item_defined_callback_ = cb; 79 item_defined_callback_ = cb;
79 } 80 }
80 81
81 // Defines a callback that will be used to override the behavior of the 82 // Defines a callback that will be used to override the behavior of the
82 // print function. This is used in tests to collect print output. If the 83 // print function. This is used in tests to collect print output. If the
83 // callback is is_null() (the default) the output will be printed to the 84 // callback is is_null() (the default) the output will be printed to the
84 // console. 85 // console.
85 const PrintCallback& print_callback() const { return print_callback_; } 86 const PrintCallback& print_callback() const { return print_callback_; }
86 void set_print_callback(const PrintCallback& cb) { print_callback_ = cb; } 87 void set_print_callback(const PrintCallback& cb) { print_callback_ = cb; }
87 88
89 // A list of files that can call exec_script(). If the returned pointer is
90 // null, exec_script may be called from anywhere.
91 const std::set<SourceFile>* exec_script_whitelist() const {
92 return exec_script_whitelist_.get();
93 }
94 void set_exec_script_whitelist(scoped_ptr<std::set<SourceFile>> list) {
95 exec_script_whitelist_ = list.Pass();
96 }
97
88 private: 98 private:
89 base::FilePath root_path_; 99 base::FilePath root_path_;
90 std::string root_path_utf8_; 100 std::string root_path_utf8_;
91 base::FilePath secondary_source_path_; 101 base::FilePath secondary_source_path_;
92 base::FilePath python_path_; 102 base::FilePath python_path_;
93 103
94 SourceFile build_config_file_; 104 SourceFile build_config_file_;
95 SourceDir build_dir_; 105 SourceDir build_dir_;
96 Args build_args_; 106 Args build_args_;
97 107
98 ItemDefinedCallback item_defined_callback_; 108 ItemDefinedCallback item_defined_callback_;
99 PrintCallback print_callback_; 109 PrintCallback print_callback_;
100 110
111 scoped_ptr<std::set<SourceFile>> exec_script_whitelist_;
112
101 BuildSettings& operator=(const BuildSettings& other); // Disallow. 113 BuildSettings& operator=(const BuildSettings& other); // Disallow.
102 }; 114 };
103 115
104 #endif // TOOLS_GN_BUILD_SETTINGS_H_ 116 #endif // TOOLS_GN_BUILD_SETTINGS_H_
OLDNEW
« no previous file with comments | « no previous file | tools/gn/function_exec_script.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698