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

Side by Side Diff: chrome/browser/extensions/api/capture_web_contents_function.cc

Issue 188633002: Query the preferred readback config in CopyFromBackingStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for test build issue. Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/thumbnails/thumbnail_tab_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/extensions/api/capture_web_contents_function.h" 5 #include "chrome/browser/extensions/api/capture_web_contents_function.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h"
10 #include "chrome/common/extensions/extension_constants.h" 10 #include "chrome/common/extensions/extension_constants.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 RenderViewHost* render_view_host = contents->GetRenderViewHost(); 69 RenderViewHost* render_view_host = contents->GetRenderViewHost();
70 RenderWidgetHostView* view = render_view_host->GetView(); 70 RenderWidgetHostView* view = render_view_host->GetView();
71 if (!view) { 71 if (!view) {
72 OnCaptureFailure(FAILURE_REASON_VIEW_INVISIBLE); 72 OnCaptureFailure(FAILURE_REASON_VIEW_INVISIBLE);
73 return false; 73 return false;
74 } 74 }
75 render_view_host->CopyFromBackingStore( 75 render_view_host->CopyFromBackingStore(
76 gfx::Rect(), 76 gfx::Rect(),
77 view->GetViewBounds().size(), 77 view->GetViewBounds().size(),
78 base::Bind(&CaptureWebContentsFunction::CopyFromBackingStoreComplete, 78 base::Bind(&CaptureWebContentsFunction::CopyFromBackingStoreComplete,
79 this)); 79 this),
80 SkBitmap::kARGB_8888_Config);
80 return true; 81 return true;
81 } 82 }
82 83
83 void CaptureWebContentsFunction::CopyFromBackingStoreComplete( 84 void CaptureWebContentsFunction::CopyFromBackingStoreComplete(
84 bool succeeded, 85 bool succeeded,
85 const SkBitmap& bitmap) { 86 const SkBitmap& bitmap) {
86 if (succeeded) { 87 if (succeeded) {
87 OnCaptureSuccess(bitmap); 88 OnCaptureSuccess(bitmap);
88 return; 89 return;
89 } 90 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 reinterpret_cast<const char*>(vector_as_array(&data)), data.size()); 150 reinterpret_cast<const char*>(vector_as_array(&data)), data.size());
150 151
151 base::Base64Encode(stream_as_string, &base64_result); 152 base::Base64Encode(stream_as_string, &base64_result);
152 base64_result.insert(0, base::StringPrintf("data:%s;base64,", 153 base64_result.insert(0, base::StringPrintf("data:%s;base64,",
153 mime_type.c_str())); 154 mime_type.c_str()));
154 SetResult(new base::StringValue(base64_result)); 155 SetResult(new base::StringValue(base64_result));
155 SendResponse(true); 156 SendResponse(true);
156 } 157 }
157 158
158 } // namespace extensions 159 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/thumbnails/thumbnail_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698