Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 12881005: Allow CopyFromBackingStore to fallback to copying from the renderer side if the accelerated surface… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/tabs/tabs_api.cc
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index 2a4e565039e1e542c29228befa4fc4d0117cfdf5..aed504c88938571c1cf4f8741f7b434ea53d7b93 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -45,7 +45,6 @@
#include "chrome/browser/ui/extensions/shell_window.h"
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/panels/panel_manager.h"
-#include "chrome/browser/ui/snapshot_tab_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/window_sizer/window_sizer.h"
#include "chrome/browser/web_applications/web_app.h"
@@ -1744,49 +1743,14 @@ bool TabsCaptureVisibleTabFunction::RunImpl() {
void TabsCaptureVisibleTabFunction::CopyFromBackingStoreComplete(
bool succeeded,
const SkBitmap& bitmap) {
- if (succeeded) {
- VLOG(1) << "captureVisibleTab() got image from backing store.";
- SendResultFromBitmap(bitmap);
- return;
- }
-
- WebContents* web_contents = NULL;
- if (!GetTabToCapture(&web_contents)) {
+ if (!succeeded) {
error_ = keys::kInternalVisibleTabCaptureError;
SendResponse(false);
return;
}
- // Ask the renderer for a snapshot of the tab.
- registrar_.Add(this,
- chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN,
- content::Source<WebContents>(web_contents));
- AddRef(); // Balanced in TabsCaptureVisibleTabFunction::Observe().
- SnapshotTabHelper::FromWebContents(web_contents)->CaptureSnapshot();
-}
-
-// If a backing store was not available in
-// TabsCaptureVisibleTabFunction::RunImpl, than the renderer was asked for a
-// snapshot. Listen for a notification that the snapshot is available.
-void TabsCaptureVisibleTabFunction::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK(type == chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN);
-
- const SkBitmap *screen_capture =
- content::Details<const SkBitmap>(details).ptr();
- const bool error = screen_capture->empty();
-
- if (error) {
- error_ = keys::kInternalVisibleTabCaptureError;
- SendResponse(false);
- } else {
- VLOG(1) << "captureVisibleTab() got image from renderer.";
- SendResultFromBitmap(*screen_capture);
- }
-
- Release(); // Balanced in TabsCaptureVisibleTabFunction::RunImpl().
+ VLOG(1) << "captureVisibleTab() got image.";
+ SendResultFromBitmap(bitmap);
Sam Kerner (Chrome) 2013/03/18 13:49:51 It has been a while since I was in this code. Is
}
// Turn a bitmap of the screen into an image, set that image as the result,

Powered by Google App Engine
This is Rietveld 408576698