Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3115)

Unified Diff: chrome/browser/ui/webui/screenshot_source.h

Issue 7635017: Fix saved screenshots for feedback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac fix 4 Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/bug_report_ui.cc ('k') | chrome/browser/ui/webui/screenshot_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3bfac8a3cdfa4741a381632a20f6f60e211da18c 100644
--- a/chrome/browser/ui/webui/screenshot_source.h
+++ b/chrome/browser/ui/webui/screenshot_source.h
@@ -5,14 +5,19 @@
#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
+// or current) to the bug report html ui.
class ScreenshotSource : public ChromeURLDataManager::DataSource {
public:
explicit ScreenshotSource(
@@ -26,12 +31,36 @@ 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
+ // from a previous request to the screenshots source.
+ // Note: This method strips the query string from the given path.
+ ScreenshotDataPtr GetCachedScreenshot(const std::string& screenshot_path);
private:
virtual ~ScreenshotSource();
- std::vector<unsigned char> current_screenshot_;
+ // Send the screenshot specified by the given relative path to the requestor.
+ // This is the ancestor for SendSavedScreenshot and CacheAndSendScreenshot.
+ // All calls to send a screenshot should only call this method.
+ // Note: This method strips the query string from the given path.
+ void SendScreenshot(const std::string& screenshot_path, int request_id);
+#if defined(OS_CHROMEOS)
+ // Send a saved screenshot image file specified by the given screenshot path
+ // to the requestor.
+ void SendSavedScreenshot(const std::string& screenshot_path, int request_id);
+#endif
+ // Sends the screenshot data to the requestor while caching it locally to the
+ // class instance, indexed by path.
+ void CacheAndSendScreenshot(const std::string& screenshot_path,
+ int request_id,
+ ScreenshotDataPtr bytes);
+
+ // Pointer to the screenshot data for the current screenshot.
+ ScreenshotDataPtr current_screenshot_;
+
+ // 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);
};
« no previous file with comments | « chrome/browser/ui/webui/bug_report_ui.cc ('k') | chrome/browser/ui/webui/screenshot_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698