OLD | NEW |
1 // Copyright (c) 2009 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_DOM_UI_DOM_UI_SCREENSHOT_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_DOM_UI_SCREENSHOT_SOURCE_H_ |
6 #define CHROME_BROWSER_DOM_UI_DOM_UI_SCREENSHOT_SOURCE_H_ | 6 #define CHROME_BROWSER_DOM_UI_DOM_UI_SCREENSHOT_SOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | |
10 #include <vector> | 9 #include <vector> |
11 | 10 |
12 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
13 #include "base/scoped_ptr.h" | |
14 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 12 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
15 #include "chrome/browser/dom_ui/html_dialog_ui.h" | |
16 | 13 |
17 // ScreenshotSource is the data source that serves screenshots (saved | 14 // ScreenshotSource is the data source that serves screenshots (saved |
18 // or current) to the bug report html ui | 15 // or current) to the bug report html ui |
19 class DOMUIScreenshotSource : public ChromeURLDataManager::DataSource { | 16 class DOMUIScreenshotSource : public ChromeURLDataManager::DataSource { |
20 public: | 17 public: |
21 explicit DOMUIScreenshotSource( | 18 explicit DOMUIScreenshotSource( |
22 std::vector<unsigned char>* current_screenshot); | 19 std::vector<unsigned char>* current_screenshot); |
23 | 20 |
24 // Called when the network layer has requested a resource underneath | 21 // Called when the network layer has requested a resource underneath |
25 // the path we registered. | 22 // the path we registered. |
26 virtual void StartDataRequest(const std::string& path, | 23 virtual void StartDataRequest(const std::string& path, |
27 bool is_off_the_record, | 24 bool is_off_the_record, |
28 int request_id); | 25 int request_id); |
29 | 26 |
30 virtual std::string GetMimeType(const std::string&) const; | 27 virtual std::string GetMimeType(const std::string&) const; |
31 | 28 |
32 std::vector<unsigned char> GetScreenshot(const std::string& path); | 29 std::vector<unsigned char> GetScreenshot(const std::string& path); |
33 | 30 |
34 private: | 31 private: |
35 virtual ~DOMUIScreenshotSource(); | 32 virtual ~DOMUIScreenshotSource(); |
36 | 33 |
37 // scoped_refptr<RefCountedBytes> current_screenshot_; | |
38 std::vector<unsigned char> current_screenshot_; | 34 std::vector<unsigned char> current_screenshot_; |
39 DISALLOW_COPY_AND_ASSIGN(DOMUIScreenshotSource); | 35 DISALLOW_COPY_AND_ASSIGN(DOMUIScreenshotSource); |
40 }; | 36 }; |
41 | 37 |
42 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_SCREENSHOT_SOURCE_H_ | 38 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_SCREENSHOT_SOURCE_H_ |
OLD | NEW |