| 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 #ifndef EXTENSIONS_BROWSER_API_WEB_CONTENTS_CAPTURE_CLIENT_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_WEB_CONTENTS_CAPTURE_CLIENT_H_ |
| 6 #define EXTENSIONS_BROWSER_API_WEB_CONTENTS_CAPTURE_CLIENT_H_ | 6 #define EXTENSIONS_BROWSER_API_WEB_CONTENTS_CAPTURE_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "content/public/browser/readback_types.h" | 9 #include "content/public/browser/readback_types.h" |
| 10 #include "extensions/browser/extension_function.h" | 10 #include "extensions/browser/extension_function.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 FAILURE_REASON_UNKNOWN, | 34 FAILURE_REASON_UNKNOWN, |
| 35 FAILURE_REASON_ENCODING_FAILED, | 35 FAILURE_REASON_ENCODING_FAILED, |
| 36 FAILURE_REASON_VIEW_INVISIBLE | 36 FAILURE_REASON_VIEW_INVISIBLE |
| 37 }; | 37 }; |
| 38 bool CaptureAsync(content::WebContents* web_contents, | 38 bool CaptureAsync(content::WebContents* web_contents, |
| 39 const api::extension_types::ImageDetails* image_detail, | 39 const api::extension_types::ImageDetails* image_detail, |
| 40 const content::ReadbackRequestCallback callback); | 40 const content::ReadbackRequestCallback callback); |
| 41 bool EncodeBitmap(const SkBitmap& bitmap, std::string* base64_result); | 41 bool EncodeBitmap(const SkBitmap& bitmap, std::string* base64_result); |
| 42 virtual void OnCaptureFailure(FailureReason reason) = 0; | 42 virtual void OnCaptureFailure(FailureReason reason) = 0; |
| 43 virtual void OnCaptureSuccess(const SkBitmap& bitmap) = 0; | 43 virtual void OnCaptureSuccess(const SkBitmap& bitmap) = 0; |
| 44 void CopyFromBackingStoreComplete(const SkBitmap& bitmap, | 44 void CopyFromSurfaceComplete(const SkBitmap& bitmap, |
| 45 content::ReadbackResponse response); | 45 content::ReadbackResponse response); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 // The format (JPEG vs PNG) of the resulting image. Set in RunAsync(). | 48 // The format (JPEG vs PNG) of the resulting image. Set in RunAsync(). |
| 49 api::extension_types::ImageFormat image_format_; | 49 api::extension_types::ImageFormat image_format_; |
| 50 | 50 |
| 51 // Quality setting to use when encoding jpegs. Set in RunAsync(). | 51 // Quality setting to use when encoding jpegs. Set in RunAsync(). |
| 52 int image_quality_; | 52 int image_quality_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(WebContentsCaptureClient); | 54 DISALLOW_COPY_AND_ASSIGN(WebContentsCaptureClient); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace extensions | 57 } // namespace extensions |
| 58 | 58 |
| 59 #endif // EXTENSIONS_BROWSER_API_WEB_CONTENTS_CAPTURE_CLIENT_H_ | 59 #endif // EXTENSIONS_BROWSER_API_WEB_CONTENTS_CAPTURE_CLIENT_H_ |
| OLD | NEW |