| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 owner_->GetEntryAtIndex(i))); | 123 owner_->GetEntryAtIndex(i))); |
| 124 } | 124 } |
| 125 DCHECK_EQ(GetScreenshotCount(), 0); | 125 DCHECK_EQ(GetScreenshotCount(), 0); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void NavigationEntryScreenshotManager::TakeScreenshotImpl( | 128 void NavigationEntryScreenshotManager::TakeScreenshotImpl( |
| 129 RenderViewHost* host, | 129 RenderViewHost* host, |
| 130 NavigationEntryImpl* entry) { | 130 NavigationEntryImpl* entry) { |
| 131 DCHECK(host && host->GetView()); | 131 DCHECK(host && host->GetView()); |
| 132 DCHECK(entry); | 132 DCHECK(entry); |
| 133 SkBitmap::Config preferred_format = host->PreferredReadbackFormat(); | 133 SkColorType preferred_format = host->PreferredReadbackFormat(); |
| 134 host->CopyFromBackingStore( | 134 host->CopyFromBackingStore( |
| 135 gfx::Rect(), | 135 gfx::Rect(), |
| 136 host->GetView()->GetViewBounds().size(), | 136 host->GetView()->GetViewBounds().size(), |
| 137 base::Bind(&NavigationEntryScreenshotManager::OnScreenshotTaken, | 137 base::Bind(&NavigationEntryScreenshotManager::OnScreenshotTaken, |
| 138 screenshot_factory_.GetWeakPtr(), | 138 screenshot_factory_.GetWeakPtr(), |
| 139 entry->GetUniqueID()), | 139 entry->GetUniqueID()), |
| 140 preferred_format); | 140 preferred_format); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void NavigationEntryScreenshotManager::SetMinScreenshotIntervalMS( | 143 void NavigationEntryScreenshotManager::SetMinScreenshotIntervalMS( |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 owner_->GetEntryAtIndex(forward)); | 283 owner_->GetEntryAtIndex(forward)); |
| 284 if (ClearScreenshot(entry)) | 284 if (ClearScreenshot(entry)) |
| 285 --screenshot_count; | 285 --screenshot_count; |
| 286 ++forward; | 286 ++forward; |
| 287 } | 287 } |
| 288 CHECK_GE(screenshot_count, 0); | 288 CHECK_GE(screenshot_count, 0); |
| 289 CHECK_LE(screenshot_count, kMaxScreenshots); | 289 CHECK_LE(screenshot_count, kMaxScreenshots); |
| 290 } | 290 } |
| 291 | 291 |
| 292 } // namespace content | 292 } // namespace content |
| OLD | NEW |