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 #include "chrome/browser/dom_ui/dom_ui_screenshot_source.h" | 5 #include "chrome/browser/dom_ui/dom_ui_screenshot_source.h" |
6 | 6 |
7 #include "base/callback.h" | |
8 #include "base/file_util.h" | 7 #include "base/file_util.h" |
9 #include "base/path_service.h" | 8 #include "base/path_service.h" |
10 #include "base/ref_counted_memory.h" | 9 #include "base/ref_counted_memory.h" |
| 10 #include "base/synchronization/waitable_event.h" |
11 #include "base/task.h" | 11 #include "base/task.h" |
12 #include "base/threading/thread.h" | |
13 #include "base/synchronization/waitable_event.h" | |
14 #include "chrome/browser/browser_thread.h" | 12 #include "chrome/browser/browser_thread.h" |
15 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
16 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
17 #include "gfx/codec/jpeg_codec.h" | |
18 #include "googleurl/src/gurl.h" | |
19 #include "third_party/skia/include/core/SkBitmap.h" | |
20 | 15 |
21 static const char kCurrentScreenshot[] = "current"; | 16 static const char kCurrentScreenshot[] = "current"; |
22 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
23 static const char kSavedScreenshots[] = "saved/"; | 18 static const char kSavedScreenshots[] = "saved/"; |
24 #endif | 19 #endif |
25 | 20 |
26 static const char kScreenshotsRelativePath[] = "/Screenshots/"; | 21 static const char kScreenshotsRelativePath[] = "/Screenshots/"; |
27 | 22 |
28 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
29 // Read the file from the screenshots directory into the read_bytes vector. | 24 // Read the file from the screenshots directory into the read_bytes vector. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 bool is_off_the_record, | 109 bool is_off_the_record, |
115 int request_id) { | 110 int request_id) { |
116 SendResponse(request_id, new RefCountedBytes(GetScreenshot(path))); | 111 SendResponse(request_id, new RefCountedBytes(GetScreenshot(path))); |
117 } | 112 } |
118 | 113 |
119 std::string DOMUIScreenshotSource::GetMimeType(const std::string&) const { | 114 std::string DOMUIScreenshotSource::GetMimeType(const std::string&) const { |
120 // We need to explicitly return a mime type, otherwise if the user tries to | 115 // We need to explicitly return a mime type, otherwise if the user tries to |
121 // drag the image they get no extension. | 116 // drag the image they get no extension. |
122 return "image/png"; | 117 return "image/png"; |
123 } | 118 } |
OLD | NEW |