[email protected] | 940ed1d | 2012-11-27 21:03:21 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | e6910e34 | 2014-03-03 15:51:33 | [diff] [blame] | 5 | #ifndef CONTENT_RENDERER_WEB_UI_EXTENSION_DATA_H_ |
| 6 | #define CONTENT_RENDERER_WEB_UI_EXTENSION_DATA_H_ |
[email protected] | 940ed1d | 2012-11-27 21:03:21 | [diff] [blame] | 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
| 10 | |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 11 | #include "base/macros.h" |
[email protected] | 940ed1d | 2012-11-27 21:03:21 | [diff] [blame] | 12 | #include "content/public/renderer/render_view_observer.h" |
| 13 | #include "content/public/renderer/render_view_observer_tracker.h" |
| 14 | |
| 15 | namespace content { |
| 16 | |
| 17 | class WebUIExtensionData |
| 18 | : public RenderViewObserver, |
| 19 | public RenderViewObserverTracker<WebUIExtensionData> { |
| 20 | public: |
| 21 | explicit WebUIExtensionData(RenderView* render_view); |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 22 | ~WebUIExtensionData() override; |
[email protected] | 940ed1d | 2012-11-27 21:03:21 | [diff] [blame] | 23 | |
| 24 | // Returns value for a given |key|. Will return an empty string if no such key |
| 25 | // exists in the |variable_map_|. |
| 26 | std::string GetValue(const std::string& key) const; |
| 27 | |
| 28 | private: |
| 29 | // RenderViewObserver implementation. |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 30 | bool OnMessageReceived(const IPC::Message& message) override; |
xjz | 694b50a9 | 2016-06-07 21:49:37 | [diff] [blame] | 31 | void OnDestruct() override; |
[email protected] | 940ed1d | 2012-11-27 21:03:21 | [diff] [blame] | 32 | |
| 33 | void OnSetWebUIProperty(const std::string& name, const std::string& value); |
| 34 | |
| 35 | std::map<std::string, std::string> variable_map_; |
| 36 | |
| 37 | DISALLOW_IMPLICIT_CONSTRUCTORS(WebUIExtensionData); |
| 38 | }; |
| 39 | |
| 40 | } // namespace content |
| 41 | |
[email protected] | e6910e34 | 2014-03-03 15:51:33 | [diff] [blame] | 42 | #endif // CONTENT_RENDERER_WEB_UI_EXTENSION_DATA_H_ |