Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CONTENT_BROWSER_WEBUI_I18N_SOURCE_STREAM_H_ | 5 #ifndef CONTENT_BROWSER_WEBUI_I18N_SOURCE_STREAM_H_ |
| 6 #define CONTENT_BROWSER_WEBUI_I18N_SOURCE_STREAM_H_ | 6 #define CONTENT_BROWSER_WEBUI_I18N_SOURCE_STREAM_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 | 33 |
| 34 // SourceStream implementation. | 34 // SourceStream implementation. |
| 35 std::string GetTypeAsString() const override; | 35 std::string GetTypeAsString() const override; |
| 36 int FilterData(net::IOBuffer* output_buffer, | 36 int FilterData(net::IOBuffer* output_buffer, |
| 37 int output_buffer_size, | 37 int output_buffer_size, |
| 38 net::IOBuffer* input_buffer, | 38 net::IOBuffer* input_buffer, |
| 39 int input_buffer_size, | 39 int input_buffer_size, |
| 40 int* consumed_bytes, | 40 int* consumed_bytes, |
| 41 bool upstream_end_reached) override; | 41 bool upstream_end_reached) override; |
| 42 | 42 |
| 43 // Accumulated from upstream. | 43 // Keep split $i18n tags until we have the whole tag. This is expected to vary |
|
mmenke
2017/01/03 16:47:16
nit: Should avoid "we" in comments, since it's of
dschuyler
2017/01/03 20:37:34
Done.
| |
| 44 // in size from 0 to a few KB and should never be larger than the input file | |
| 45 // (in the worst case). | |
| 44 std::string input_; | 46 std::string input_; |
| 45 | 47 |
| 46 // To send downstream. | 48 // Keep excess that didn't fit in the output buffer. This is expected to vary |
| 49 // in size from 0 to a few KB and should never get much larger than the input | |
| 50 // file (in the worst case). | |
| 47 std::string output_; | 51 std::string output_; |
| 48 | 52 |
| 49 // How much of the |output_| has been sent. | |
| 50 size_t drain_offset_; | |
| 51 | |
| 52 // A map of i18n replacement keys and translations. | 53 // A map of i18n replacement keys and translations. |
| 53 const ui::TemplateReplacements* replacements_; // weak | 54 const ui::TemplateReplacements* replacements_; // weak |
| 54 | 55 |
| 55 DISALLOW_COPY_AND_ASSIGN(I18nSourceStream); | 56 DISALLOW_COPY_AND_ASSIGN(I18nSourceStream); |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 } // namespace content | 59 } // namespace content |
| 59 | 60 |
| 60 #endif // CONTENT_BROWSER_WEBUI_I18N_SOURCE_STREAM_H_ | 61 #endif // CONTENT_BROWSER_WEBUI_I18N_SOURCE_STREAM_H_ |
| OLD | NEW |