| 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_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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 15 | 15 |
| 16 #if defined(OS_CHROMEOS) | 16 #if defined(OS_CHROMEOS) |
| 17 #include "chrome/browser/chromeos/gdata/drive_errorcode.h" |
| 17 #include "chrome/browser/chromeos/gdata/drive_resource_metadata.h" | 18 #include "chrome/browser/chromeos/gdata/drive_resource_metadata.h" |
| 18 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" | |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 typedef std::vector<unsigned char> ScreenshotData; | 21 typedef std::vector<unsigned char> ScreenshotData; |
| 22 typedef linked_ptr<ScreenshotData> ScreenshotDataPtr; | 22 typedef linked_ptr<ScreenshotData> ScreenshotDataPtr; |
| 23 | 23 |
| 24 class FilePath; | 24 class FilePath; |
| 25 class Profile; | 25 class Profile; |
| 26 | 26 |
| 27 // ScreenshotSource is the data source that serves screenshots (saved | 27 // ScreenshotSource is the data source that serves screenshots (saved |
| 28 // or current) to the bug report html ui. | 28 // or current) to the bug report html ui. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 56 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
| 57 // Send a saved screenshot image file specified by the given screenshot path | 57 // Send a saved screenshot image file specified by the given screenshot path |
| 58 // to the requestor. | 58 // to the requestor. |
| 59 void SendSavedScreenshot(const std::string& screenshot_path, | 59 void SendSavedScreenshot(const std::string& screenshot_path, |
| 60 int request_id, | 60 int request_id, |
| 61 const FilePath& file); | 61 const FilePath& file); |
| 62 | 62 |
| 63 // The callback for GData's getting file method. | 63 // The callback for GData's getting file method. |
| 64 void GetSavedScreenshotCallback(const std::string& screenshot_path, | 64 void GetSavedScreenshotCallback(const std::string& screenshot_path, |
| 65 int request_id, | 65 int request_id, |
| 66 gdata::GDataFileError error, | 66 gdata::DriveFileError error, |
| 67 const FilePath& file, | 67 const FilePath& file, |
| 68 const std::string& unused_mime_type, | 68 const std::string& unused_mime_type, |
| 69 gdata::DriveFileType file_type); | 69 gdata::DriveFileType file_type); |
| 70 | 70 |
| 71 #endif | 71 #endif |
| 72 // Sends the screenshot data to the requestor while caching it locally to the | 72 // Sends the screenshot data to the requestor while caching it locally to the |
| 73 // class instance, indexed by path. | 73 // class instance, indexed by path. |
| 74 void CacheAndSendScreenshot(const std::string& screenshot_path, | 74 void CacheAndSendScreenshot(const std::string& screenshot_path, |
| 75 int request_id, | 75 int request_id, |
| 76 ScreenshotDataPtr bytes); | 76 ScreenshotDataPtr bytes); |
| 77 | 77 |
| 78 // Pointer to the screenshot data for the current screenshot. | 78 // Pointer to the screenshot data for the current screenshot. |
| 79 ScreenshotDataPtr current_screenshot_; | 79 ScreenshotDataPtr current_screenshot_; |
| 80 | 80 |
| 81 Profile* profile_; | 81 Profile* profile_; |
| 82 | 82 |
| 83 // Key: Relative path to the screenshot (including filename) | 83 // Key: Relative path to the screenshot (including filename) |
| 84 // Value: Pointer to the screenshot data associated with the path. | 84 // Value: Pointer to the screenshot data associated with the path. |
| 85 std::map<std::string, ScreenshotDataPtr> cached_screenshots_; | 85 std::map<std::string, ScreenshotDataPtr> cached_screenshots_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(ScreenshotSource); | 87 DISALLOW_COPY_AND_ASSIGN(ScreenshotSource); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 #endif // CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_ | 90 #endif // CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_ |
| OLD | NEW |