| 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 #include "chrome/browser/extensions/extension_tabs_module.h" | 5 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 BackingStore* backing_store) { | 1154 BackingStore* backing_store) { |
| 1155 | 1155 |
| 1156 skia::PlatformCanvas temp_canvas; | 1156 skia::PlatformCanvas temp_canvas; |
| 1157 if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()), | 1157 if (!backing_store->CopyFromBackingStore(gfx::Rect(backing_store->size()), |
| 1158 &temp_canvas)) { | 1158 &temp_canvas)) { |
| 1159 return false; | 1159 return false; |
| 1160 } | 1160 } |
| 1161 VLOG(1) << "captureVisibleTab() got image from backing store."; | 1161 VLOG(1) << "captureVisibleTab() got image from backing store."; |
| 1162 | 1162 |
| 1163 SendResultFromBitmap( | 1163 SendResultFromBitmap( |
| 1164 temp_canvas.getTopPlatformDevice().accessBitmap(false)); | 1164 temp_canvas.getTopDevice().accessBitmap(false)); |
| 1165 return true; | 1165 return true; |
| 1166 } | 1166 } |
| 1167 | 1167 |
| 1168 // If a backing store was not available in CaptureVisibleTabFunction::RunImpl, | 1168 // If a backing store was not available in CaptureVisibleTabFunction::RunImpl, |
| 1169 // than the renderer was asked for a snapshot. Listen for a notification | 1169 // than the renderer was asked for a snapshot. Listen for a notification |
| 1170 // that the snapshot is available. | 1170 // that the snapshot is available. |
| 1171 void CaptureVisibleTabFunction::Observe(NotificationType type, | 1171 void CaptureVisibleTabFunction::Observe(NotificationType type, |
| 1172 const NotificationSource& source, | 1172 const NotificationSource& source, |
| 1173 const NotificationDetails& details) { | 1173 const NotificationDetails& details) { |
| 1174 DCHECK(type == NotificationType::TAB_SNAPSHOT_TAKEN); | 1174 DCHECK(type == NotificationType::TAB_SNAPSHOT_TAKEN); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 } | 1365 } |
| 1366 | 1366 |
| 1367 static GURL ResolvePossiblyRelativeURL(const std::string& url_string, | 1367 static GURL ResolvePossiblyRelativeURL(const std::string& url_string, |
| 1368 const Extension* extension) { | 1368 const Extension* extension) { |
| 1369 GURL url = GURL(url_string); | 1369 GURL url = GURL(url_string); |
| 1370 if (!url.is_valid()) | 1370 if (!url.is_valid()) |
| 1371 url = extension->GetResourceURL(url_string); | 1371 url = extension->GetResourceURL(url_string); |
| 1372 | 1372 |
| 1373 return url; | 1373 return url; |
| 1374 } | 1374 } |
| OLD | NEW |