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 CHROME_BROWSER_EXTENSIONS_API_CAPTURE_WEB_CONTENTS_FUNCTION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_CAPTURE_WEB_CONTENTS_FUNCTION_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_CAPTURE_WEB_CONTENTS_FUNCTION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_CAPTURE_WEB_CONTENTS_FUNCTION_H_ |
7 | 7 |
8 #include "chrome/browser/extensions/chrome_extension_function.h" | 8 #include "chrome/browser/extensions/chrome_extension_function.h" |
9 #include "chrome/common/extensions/api/types.h" | 9 #include "chrome/common/extensions/api/types.h" |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 FAILURE_REASON_CONTENT_NOT_FOUND, | 37 FAILURE_REASON_CONTENT_NOT_FOUND, |
38 FAILURE_REASON_ENCODING_FAILED, | 38 FAILURE_REASON_ENCODING_FAILED, |
39 FAILURE_REASON_VIEW_INVISIBLE | 39 FAILURE_REASON_VIEW_INVISIBLE |
40 }; | 40 }; |
41 virtual void OnCaptureFailure(FailureReason reason) = 0; | 41 virtual void OnCaptureFailure(FailureReason reason) = 0; |
42 | 42 |
43 private: | 43 private: |
44 typedef api::types::ImageDetails ImageDetails; | 44 typedef api::types::ImageDetails ImageDetails; |
45 | 45 |
46 void CopyFromBackingStoreComplete(bool succeed, const SkBitmap& bitmap); | 46 void CopyFromBackingStoreComplete(bool succeed, const SkBitmap& bitmap); |
47 void GetSnapshotFromRendererComplete(bool succeeded, const SkBitmap& bitmap); | |
48 void OnCaptureSuccess(const SkBitmap& bitmap); | 47 void OnCaptureSuccess(const SkBitmap& bitmap); |
49 | 48 |
50 // |context_id_| is the ID used to find the relevant WebContents. In the | 49 // |context_id_| is the ID used to find the relevant WebContents. In the |
51 // |tabs.captureVisibleTab()| api, this represents the window-id, and in the | 50 // |tabs.captureVisibleTab()| api, this represents the window-id, and in the |
52 // |webview.captureVisibleRegion()| api, this represents the instance-id of | 51 // |webview.captureVisibleRegion()| api, this represents the instance-id of |
53 // the guest. | 52 // the guest. |
54 int context_id_; | 53 int context_id_; |
55 | 54 |
56 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). | 55 // The format (JPEG vs PNG) of the resulting image. Set in RunImpl(). |
57 ImageDetails::Format image_format_; | 56 ImageDetails::Format image_format_; |
58 | 57 |
59 // Quality setting to use when encoding jpegs. Set in RunImpl(). | 58 // Quality setting to use when encoding jpegs. Set in RunImpl(). |
60 int image_quality_; | 59 int image_quality_; |
61 | 60 |
62 DISALLOW_COPY_AND_ASSIGN(CaptureWebContentsFunction); | 61 DISALLOW_COPY_AND_ASSIGN(CaptureWebContentsFunction); |
63 }; | 62 }; |
64 | 63 |
65 } // namespace extensions | 64 } // namespace extensions |
66 | 65 |
67 #endif // CHROME_BROWSER_EXTENSIONS_API_CAPTURE_WEB_CONTENTS_FUNCTION_H_ | 66 #endif // CHROME_BROWSER_EXTENSIONS_API_CAPTURE_WEB_CONTENTS_FUNCTION_H_ |
OLD | NEW |