Chromium Code Reviews| Index: chrome/browser/ui/webui/screenshot_source.h |
| diff --git a/chrome/browser/ui/webui/screenshot_source.h b/chrome/browser/ui/webui/screenshot_source.h |
| index 4b071d3df0acf92a53068593cca4260e1f4625f2..a5d20e222e8ea3ee63bb82ed38abf3d21d09a62e 100644 |
| --- a/chrome/browser/ui/webui/screenshot_source.h |
| +++ b/chrome/browser/ui/webui/screenshot_source.h |
| @@ -5,12 +5,17 @@ |
| #ifndef CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_ |
| #define CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_ |
| +#include <map> |
| #include <string> |
| #include <vector> |
| #include "base/basictypes.h" |
| +#include "base/memory/linked_ptr.h" |
| #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| +typedef std::vector<unsigned char> ScreenshotData; |
| +typedef linked_ptr<ScreenshotData> ScreenshotDataPtr; |
| + |
| // ScreenshotSource is the data source that serves screenshots (saved |
| // or current) to the bug report html ui |
| class ScreenshotSource : public ChromeURLDataManager::DataSource { |
| @@ -26,12 +31,32 @@ class ScreenshotSource : public ChromeURLDataManager::DataSource { |
| virtual std::string GetMimeType(const std::string&) const; |
| - std::vector<unsigned char> GetScreenshot(const std::string& path); |
| + // Get the screenshot specified by the given relative path that we've cached |
|
Daniel Erat
2011/08/23 16:58:37
this is confusing to me. the comment says "relati
rkc
2011/08/25 13:09:33
I've redone all the 'path' parameter names in both
|
| + // from a previous request to the screenshots source |
|
Daniel Erat
2011/08/23 16:58:37
nit: add period at end of sentence
rkc
2011/08/25 13:09:33
Done.
|
| + // Note: Query string will be stripped from the full_path |
|
Daniel Erat
2011/08/23 16:58:37
nit: add period
rkc
2011/08/25 13:09:33
Done.
|
| + ScreenshotDataPtr GetCachedScreenshot(const std::string& full_path); |
| private: |
| virtual ~ScreenshotSource(); |
| - std::vector<unsigned char> current_screenshot_; |
| + // Sends the screenshot data to the requestor while caching it locally to the |
| + // class instance, indexed by path. |
| + void CacheAndSendScreenshot(const std::string& path, |
| + int request_id, |
| + ScreenshotDataPtr bytes); |
| + // Send the screenshot specified by the given relative path (includes filename |
| + // in case of a saved screenshot) to the requestor |
|
Daniel Erat
2011/08/23 16:58:37
nit: add period
rkc
2011/08/25 13:09:33
Done.
|
| + void SendScreenshot(const std::string& path, int request_id); |
| +#if defined(OS_CHROMEOS) |
| + // Send a saved screenshot specified by the given filename to the requestor |
| + void SendSavedScreenshot(const std::string& filename, int request_id); |
|
Daniel Erat
2011/08/23 16:58:37
why do these methods still all have subtly differe
rkc
2011/08/25 13:09:33
Changed the names and comments to make sense all t
|
| +#endif |
| + |
| + // Pointer to the screenshot data for the current screenshot |
| + ScreenshotDataPtr current_screenshot_; |
|
Daniel Erat
2011/08/23 16:58:37
nit: add blank line after this one
rkc
2011/08/25 13:09:33
Done.
|
| + // Key: Relative path to the screenshot (including filename) |
| + // Value: Pointer to the screenshot data associated with the path |
| + std::map<std::string, ScreenshotDataPtr> cached_screenshots_; |
| DISALLOW_COPY_AND_ASSIGN(ScreenshotSource); |
| }; |