| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_WEBUI_WEB_UI_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_WEB_UI_UTIL_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_WEB_UI_UTIL_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_WEB_UI_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/values.h" |
| 12 #include "webkit/glue/window_open_disposition.h" |
| 13 |
| 11 class SkBitmap; | 14 class SkBitmap; |
| 12 | 15 |
| 13 namespace web_ui_util { | 16 namespace web_ui_util { |
| 14 | 17 |
| 15 // Convenience routine to convert SkBitmap object to data url | 18 // Convenience routine to convert SkBitmap object to data url |
| 16 // so that it can be used in WebUI. | 19 // so that it can be used in WebUI. |
| 17 std::string GetImageDataUrl(const SkBitmap& bitmap); | 20 std::string GetImageDataUrl(const SkBitmap& bitmap); |
| 18 | 21 |
| 19 // Convenience routine to get data url that corresponds to given | 22 // Convenience routine to get data url that corresponds to given |
| 20 // resource_id as an image. This function does not check if the | 23 // resource_id as an image. This function does not check if the |
| 21 // resource for the |resource_id| is an image, therefore it is the | 24 // resource for the |resource_id| is an image, therefore it is the |
| 22 // caller's responsibility to make sure the resource is indeed an | 25 // caller's responsibility to make sure the resource is indeed an |
| 23 // image. Returns empty string if a resource does not exist for given | 26 // image. Returns empty string if a resource does not exist for given |
| 24 // |resource_id|. | 27 // |resource_id|. |
| 25 std::string GetImageDataUrlFromResource(int resource_id); | 28 std::string GetImageDataUrlFromResource(int resource_id); |
| 26 | 29 |
| 30 // Extracts a disposition from click event arguments. |args| should contain |
| 31 // an integer button and booleans alt key, ctrl key, meta key, and shift key |
| 32 // (in that order), starting at |start_index|. |
| 33 WindowOpenDisposition GetDispositionFromClick(const ListValue* args, |
| 34 int start_index); |
| 35 |
| 27 } // namespace web_ui_util | 36 } // namespace web_ui_util |
| 28 | 37 |
| 29 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_UTIL_H_ | 38 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_UTIL_H_ |
| OLD | NEW |