| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MESSAGE_HANDLER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_MESSAGE_HANDLER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_MESSAGE_HANDLER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_MESSAGE_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Helper methods: | 39 // Helper methods: |
| 40 | 40 |
| 41 // Extract an integer value from a list Value. | 41 // Extract an integer value from a list Value. |
| 42 static bool ExtractIntegerValue(const base::ListValue* value, int* out_int); | 42 static bool ExtractIntegerValue(const base::ListValue* value, int* out_int); |
| 43 | 43 |
| 44 // Extract a floating point (double) value from a list Value. | 44 // Extract a floating point (double) value from a list Value. |
| 45 static bool ExtractDoubleValue(const base::ListValue* value, | 45 static bool ExtractDoubleValue(const base::ListValue* value, |
| 46 double* out_value); | 46 double* out_value); |
| 47 | 47 |
| 48 // Extract a string value from a list Value. | 48 // Extract a string value from a list Value. |
| 49 static string16 ExtractStringValue(const base::ListValue* value); | 49 static base::string16 ExtractStringValue(const base::ListValue* value); |
| 50 | 50 |
| 51 // This is where subclasses specify which messages they'd like to handle and | 51 // This is where subclasses specify which messages they'd like to handle and |
| 52 // perform any additional initialization.. At this point web_ui() will return | 52 // perform any additional initialization.. At this point web_ui() will return |
| 53 // the associated WebUI object. | 53 // the associated WebUI object. |
| 54 virtual void RegisterMessages() = 0; | 54 virtual void RegisterMessages() = 0; |
| 55 | 55 |
| 56 // Returns the attached WebUI for this handler. | 56 // Returns the attached WebUI for this handler. |
| 57 WebUI* web_ui() const { return web_ui_; } | 57 WebUI* web_ui() const { return web_ui_; } |
| 58 | 58 |
| 59 // Sets the attached WebUI - exposed to subclasses for testing purposes. | 59 // Sets the attached WebUI - exposed to subclasses for testing purposes. |
| 60 void set_web_ui(WebUI* web_ui) { web_ui_ = web_ui; } | 60 void set_web_ui(WebUI* web_ui) { web_ui_ = web_ui; } |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 // Provide external classes access to web_ui() and set_web_ui(). | 63 // Provide external classes access to web_ui() and set_web_ui(). |
| 64 friend class WebUIImpl; | 64 friend class WebUIImpl; |
| 65 friend class ::WebUIBrowserTest; | 65 friend class ::WebUIBrowserTest; |
| 66 | 66 |
| 67 WebUI* web_ui_; | 67 WebUI* web_ui_; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 } // namespace content | 70 } // namespace content |
| 71 | 71 |
| 72 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_MESSAGE_HANDLER_H_ | 72 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_MESSAGE_HANDLER_H_ |
| OLD | NEW |