OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 EXTENSIONS_BROWSER_FILE_HIGHLIGHTER_H_ | 5 #ifndef EXTENSIONS_BROWSER_FILE_HIGHLIGHTER_H_ |
6 #define EXTENSIONS_BROWSER_FILE_HIGHLIGHTER_H_ | 6 #define EXTENSIONS_BROWSER_FILE_HIGHLIGHTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // 'tabs' within 'permissions' would just be '"tabs"'. | 66 // 'tabs' within 'permissions' would just be '"tabs"'. |
67 // We can't use the JSONParser to do this, because we want to display the actual | 67 // We can't use the JSONParser to do this, because we want to display the actual |
68 // manifest, and once we parse it into Values, we lose any formatting the user | 68 // manifest, and once we parse it into Values, we lose any formatting the user |
69 // may have had. | 69 // may have had. |
70 // If a feature cannot be found, the feature will have zero-length. | 70 // If a feature cannot be found, the feature will have zero-length. |
71 class ManifestHighlighter : public FileHighlighter { | 71 class ManifestHighlighter : public FileHighlighter { |
72 public: | 72 public: |
73 ManifestHighlighter(const std::string& manifest, | 73 ManifestHighlighter(const std::string& manifest, |
74 const std::string& key, | 74 const std::string& key, |
75 const std::string& specific /* optional */); | 75 const std::string& specific /* optional */); |
76 virtual ~ManifestHighlighter(); | 76 ~ManifestHighlighter() override; |
77 | 77 |
78 private: | 78 private: |
79 // Called from the constructor; determine the start and end bounds of a | 79 // Called from the constructor; determine the start and end bounds of a |
80 // feature, using both the key and specific information. | 80 // feature, using both the key and specific information. |
81 void Parse(const std::string& key, const std::string& specific); | 81 void Parse(const std::string& key, const std::string& specific); |
82 | 82 |
83 // Find the bounds of any feature, either a full key or a specific item within | 83 // Find the bounds of any feature, either a full key or a specific item within |
84 // the key. |enforce_at_top_level| means that the feature we find must be at | 84 // the key. |enforce_at_top_level| means that the feature we find must be at |
85 // the same level as |start_| (i.e., ignore nested elements). | 85 // the same level as |start_| (i.e., ignore nested elements). |
86 // Returns true on success. | 86 // Returns true on success. |
87 bool FindBounds(const std::string& feature, bool enforce_at_top_level); | 87 bool FindBounds(const std::string& feature, bool enforce_at_top_level); |
88 | 88 |
89 // Finds the end of the feature. | 89 // Finds the end of the feature. |
90 void FindBoundsEnd(const std::string& feature, size_t local_start); | 90 void FindBoundsEnd(const std::string& feature, size_t local_start); |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(ManifestHighlighter); | 92 DISALLOW_COPY_AND_ASSIGN(ManifestHighlighter); |
93 }; | 93 }; |
94 | 94 |
95 // Use the SourceHighlighter to highlight a particular line in a given source | 95 // Use the SourceHighlighter to highlight a particular line in a given source |
96 // file. | 96 // file. |
97 class SourceHighlighter : public FileHighlighter { | 97 class SourceHighlighter : public FileHighlighter { |
98 public: | 98 public: |
99 SourceHighlighter(const std::string& source, size_t line_number); | 99 SourceHighlighter(const std::string& source, size_t line_number); |
100 virtual ~SourceHighlighter(); | 100 ~SourceHighlighter() override; |
101 | 101 |
102 private: | 102 private: |
103 // Called from the constructor; determine the bounds of the line in the source | 103 // Called from the constructor; determine the bounds of the line in the source |
104 // file. | 104 // file. |
105 void Parse(size_t line_number); | 105 void Parse(size_t line_number); |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(SourceHighlighter); | 107 DISALLOW_COPY_AND_ASSIGN(SourceHighlighter); |
108 }; | 108 }; |
109 | 109 |
110 } // namespace extensions | 110 } // namespace extensions |
111 | 111 |
112 #endif // EXTENSIONS_BROWSER_FILE_HIGHLIGHTER_H_ | 112 #endif // EXTENSIONS_BROWSER_FILE_HIGHLIGHTER_H_ |
OLD | NEW |