OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/frame_host/navigation_entry_screenshot_manager.h" | 5 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/threading/worker_pool.h" | 8 #include "base/threading/worker_pool.h" |
9 #include "content/browser/frame_host/navigation_controller_impl.h" | 9 #include "content/browser/frame_host/navigation_controller_impl.h" |
10 #include "content/browser/frame_host/navigation_entry_impl.h" | 10 #include "content/browser/frame_host/navigation_entry_impl.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 scoped_refptr<base::RefCountedBytes> data() const { return data_; } | 43 scoped_refptr<base::RefCountedBytes> data() const { return data_; } |
44 | 44 |
45 private: | 45 private: |
46 friend class base::RefCountedThreadSafe<ScreenshotData>; | 46 friend class base::RefCountedThreadSafe<ScreenshotData>; |
47 virtual ~ScreenshotData() { | 47 virtual ~ScreenshotData() { |
48 } | 48 } |
49 | 49 |
50 void EncodeOnWorker(const SkBitmap& bitmap) { | 50 void EncodeOnWorker(const SkBitmap& bitmap) { |
51 std::vector<unsigned char> data; | 51 std::vector<unsigned char> data; |
52 if (gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &data)) | 52 if (gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &data, true)) |
53 data_ = new base::RefCountedBytes(data); | 53 data_ = new base::RefCountedBytes(data); |
54 } | 54 } |
55 | 55 |
56 scoped_refptr<base::RefCountedBytes> data_; | 56 scoped_refptr<base::RefCountedBytes> data_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(ScreenshotData); | 58 DISALLOW_COPY_AND_ASSIGN(ScreenshotData); |
59 }; | 59 }; |
60 | 60 |
61 NavigationEntryScreenshotManager::NavigationEntryScreenshotManager( | 61 NavigationEntryScreenshotManager::NavigationEntryScreenshotManager( |
62 NavigationControllerImpl* owner) | 62 NavigationControllerImpl* owner) |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 owner_->GetEntryAtIndex(forward)); | 267 owner_->GetEntryAtIndex(forward)); |
268 if (ClearScreenshot(entry)) | 268 if (ClearScreenshot(entry)) |
269 --screenshot_count; | 269 --screenshot_count; |
270 ++forward; | 270 ++forward; |
271 } | 271 } |
272 CHECK_GE(screenshot_count, 0); | 272 CHECK_GE(screenshot_count, 0); |
273 CHECK_LE(screenshot_count, kMaxScreenshots); | 273 CHECK_LE(screenshot_count, kMaxScreenshots); |
274 } | 274 } |
275 | 275 |
276 } // namespace content | 276 } // namespace content |
OLD | NEW |