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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_SCREENSHOT_SOURCE_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_
6 #define CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_ 6 #define CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <map>
Daniel Erat 2011/08/12 14:43:40 nit: alphabetize
rkc 2011/08/22 13:23:52 Done.
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
13 14
14 // ScreenshotSource is the data source that serves screenshots (saved 15 // ScreenshotSource is the data source that serves screenshots (saved
15 // or current) to the bug report html ui 16 // or current) to the bug report html ui
16 class ScreenshotSource : public ChromeURLDataManager::DataSource { 17 class ScreenshotSource : public ChromeURLDataManager::DataSource {
17 public: 18 public:
18 explicit ScreenshotSource( 19 explicit ScreenshotSource(
19 std::vector<unsigned char>* current_screenshot); 20 std::vector<unsigned char>* current_screenshot);
20 21
Daniel Erat 2011/08/12 14:43:40 nit: remove extra blank line
rkc 2011/08/22 13:23:52 Done.
22
21 // Called when the network layer has requested a resource underneath 23 // Called when the network layer has requested a resource underneath
22 // the path we registered. 24 // the path we registered.
23 virtual void StartDataRequest(const std::string& path, 25 virtual void StartDataRequest(const std::string& path,
24 bool is_incognito, 26 bool is_incognito,
25 int request_id); 27 int request_id);
26 28
27 virtual std::string GetMimeType(const std::string&) const; 29 virtual std::string GetMimeType(const std::string&) const;
28 30
29 std::vector<unsigned char> GetScreenshot(const std::string& path); 31 std::vector<unsigned char> GetCachedScreenshot(const std::string& path);
30 32
31 private: 33 private:
32 virtual ~ScreenshotSource(); 34 virtual ~ScreenshotSource();
33 35
36
37 void CacheAndSendScreenshot(const std::string& path, int request_id,
Daniel Erat 2011/08/12 14:43:40 nit: add comment and only put one param on each li
rkc 2011/08/22 13:23:52 Done.
38 const std::vector<unsigned char> bytes);
zel 2011/08/12 13:01:37 const std::vector<unsigned char>& bytes
rkc 2011/08/22 13:23:52 Done.
39 void SendScreenshot(const std::string& path, int request_id);
40 #if defined(OS_CHROMEOS)
41 void SendSavedScreenshot(const std::string& filename, int request_id);
42 #endif
43
34 std::vector<unsigned char> current_screenshot_; 44 std::vector<unsigned char> current_screenshot_;
45 std::map<std::string, std::vector<unsigned char> > cached_screenshots_;
Daniel Erat 2011/08/12 14:43:40 don't store things that are expensive to copy insi
Daniel Erat 2011/08/12 14:43:40 is this code caching screenshots indefinitely? if
rkc 2011/08/22 13:23:52 Done.
rkc 2011/08/22 13:23:52 No, this gets put in the data sources delete queue
35 46
36 DISALLOW_COPY_AND_ASSIGN(ScreenshotSource); 47 DISALLOW_COPY_AND_ASSIGN(ScreenshotSource);
37 }; 48 };
38 49
39 #endif // CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_ 50 #endif // CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698