| OLD | NEW |
| 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 #ifndef TOOLS_GN_VISIBILITY_H_ | 5 #ifndef TOOLS_GN_VISIBILITY_H_ |
| 6 #define TOOLS_GN_VISIBILITY_H_ | 6 #define TOOLS_GN_VISIBILITY_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
| 12 #include "tools/gn/label_pattern.h" | 12 #include "tools/gn/label_pattern.h" |
| 13 #include "tools/gn/source_dir.h" | 13 #include "tools/gn/source_dir.h" |
| 14 | 14 |
| 15 class Err; | 15 class Err; |
| 16 class Item; | 16 class Item; |
| 17 class Label; | 17 class Label; |
| 18 class Scope; | 18 class Scope; |
| 19 class Value; | 19 class Value; |
| 20 | 20 |
| 21 class Visibility { | 21 class Visibility { |
| 22 public: | 22 public: |
| 23 // Defaults to private visibility (only the current file). | 23 // Defaults to private visibility (only the current file). |
| 24 Visibility(); | 24 Visibility(); |
| 25 ~Visibility(); | 25 ~Visibility(); |
| 26 | 26 |
| 27 // Set the visibility to the thing specified by the given value. On failure, | 27 // Set the visibility to the thing specified by the given value. On failure, |
| 28 // returns false and sets the error. | 28 // returns false and sets the error. |
| 29 bool Set(const SourceDir& current_dir, const Value& value, Err* err); | 29 bool Set(const base::FilePath& source_root, |
| 30 const SourceDir& current_dir, const Value& value, Err* err); |
| 30 | 31 |
| 31 // Sets the visibility to be public. | 32 // Sets the visibility to be public. |
| 32 void SetPublic(); | 33 void SetPublic(); |
| 33 | 34 |
| 34 // Sets the visibility to be private to the given directory. | 35 // Sets the visibility to be private to the given directory. |
| 35 void SetPrivate(const SourceDir& current_dir); | 36 void SetPrivate(const SourceDir& current_dir); |
| 36 | 37 |
| 37 // Returns true if the target with the given label can depend on one with the | 38 // Returns true if the target with the given label can depend on one with the |
| 38 // current visibility. | 39 // current visibility. |
| 39 bool CanSeeMe(const Label& label) const; | 40 bool CanSeeMe(const Label& label) const; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 52 // in the current scope. | 53 // in the current scope. |
| 53 static bool FillItemVisibility(Item* item, Scope* scope, Err* err); | 54 static bool FillItemVisibility(Item* item, Scope* scope, Err* err); |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 std::vector<LabelPattern> patterns_; | 57 std::vector<LabelPattern> patterns_; |
| 57 | 58 |
| 58 DISALLOW_COPY_AND_ASSIGN(Visibility); | 59 DISALLOW_COPY_AND_ASSIGN(Visibility); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 #endif // TOOLS_GN_VISIBILITY_H_ | 62 #endif // TOOLS_GN_VISIBILITY_H_ |
| OLD | NEW |