Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 CONTENT_PUBLIC_BROWSER_WEB_UI_DATA_SOURCE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_DATA_SOURCE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_DATA_SOURCE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_DATA_SOURCE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
|
Charlie Reis
2016/11/16 18:38:46
nit: No blank line?
| |
| 10 #include <memory> | |
| 11 | |
| 10 #include "base/callback.h" | 12 #include "base/callback.h" |
| 11 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 12 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 13 | 15 |
| 14 namespace base { | 16 namespace base { |
| 15 class DictionaryValue; | 17 class DictionaryValue; |
| 16 class RefCountedMemory; | 18 class RefCountedMemory; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace content { | 21 namespace content { |
| 20 class BrowserContext; | 22 class BrowserContext; |
| 21 | 23 |
| 22 // A data source that can help with implementing the common operations needed by | 24 // A data source that can help with implementing the common operations needed by |
| 23 // WebUI pages. | 25 // WebUI pages. |
| 24 class WebUIDataSource { | 26 class WebUIDataSource { |
| 25 public: | 27 public: |
| 26 virtual ~WebUIDataSource() {} | 28 virtual ~WebUIDataSource() {} |
| 27 | 29 |
| 28 CONTENT_EXPORT static WebUIDataSource* Create(const std::string& source_name); | 30 CONTENT_EXPORT static WebUIDataSource* Create(const std::string& source_name); |
| 29 | 31 |
| 30 // Adds a WebUI data source to |browser_context|. | 32 // Adds a WebUI data source to |browser_context|. TODO(dbeam): update this API |
| 33 // to take a std::unique_ptr instead to make it clear that |source| can be | |
| 34 // destroyed and references should not be kept by callers. Use |Update()| | |
| 35 // if you need to change an existing data source. | |
| 31 CONTENT_EXPORT static void Add(BrowserContext* browser_context, | 36 CONTENT_EXPORT static void Add(BrowserContext* browser_context, |
| 32 WebUIDataSource* source); | 37 WebUIDataSource* source); |
| 33 | 38 |
| 39 CONTENT_EXPORT static void Update( | |
|
Charlie Reis
2016/11/16 18:38:46
Please include comments for all methods in the pub
| |
| 40 BrowserContext* browser_context, | |
| 41 const std::string& source_name, | |
| 42 std::unique_ptr<base::DictionaryValue> update); | |
| 43 | |
| 34 // Adds a string keyed to its name to our dictionary. | 44 // Adds a string keyed to its name to our dictionary. |
| 35 virtual void AddString(const std::string& name, | 45 virtual void AddString(const std::string& name, |
| 36 const base::string16& value) = 0; | 46 const base::string16& value) = 0; |
| 37 | 47 |
| 38 // Adds a string keyed to its name to our dictionary. | 48 // Adds a string keyed to its name to our dictionary. |
| 39 virtual void AddString(const std::string& name, const std::string& value) = 0; | 49 virtual void AddString(const std::string& name, const std::string& value) = 0; |
| 40 | 50 |
| 41 // Adds a localized string with resource |ids| keyed to its name to our | 51 // Adds a localized string with resource |ids| keyed to its name to our |
| 42 // dictionary. | 52 // dictionary. |
| 43 virtual void AddLocalizedString(const std::string& name, int ids) = 0; | 53 virtual void AddLocalizedString(const std::string& name, int ids) = 0; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 virtual void DisableDenyXFrameOptions() = 0; | 104 virtual void DisableDenyXFrameOptions() = 0; |
| 95 | 105 |
| 96 // Tells the loading code that resources are gzipped on disk. TODO(dbeam): | 106 // Tells the loading code that resources are gzipped on disk. TODO(dbeam): |
| 97 // write a streaming $i18n{} replacer and remove the "DisableI18n" part. | 107 // write a streaming $i18n{} replacer and remove the "DisableI18n" part. |
| 98 virtual void DisableI18nAndUseGzipForAllPaths() = 0; | 108 virtual void DisableI18nAndUseGzipForAllPaths() = 0; |
| 99 }; | 109 }; |
| 100 | 110 |
| 101 } // namespace content | 111 } // namespace content |
| 102 | 112 |
| 103 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_DATA_SOURCE_H_ | 113 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_DATA_SOURCE_H_ |
| OLD | NEW |