| 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_CAPTURE_WEB_CONTENTS_FUNCTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_CAPTURE_WEB_CONTENTS_FUNCTION_H_ |
| 6 #define EXTENSIONS_BROWSER_API_CAPTURE_WEB_CONTENTS_FUNCTION_H_ | 6 #define EXTENSIONS_BROWSER_API_CAPTURE_WEB_CONTENTS_FUNCTION_H_ |
| 7 | 7 |
| 8 #include "extensions/browser/extension_function.h" | 8 #include "extensions/browser/extension_function.h" |
| 9 #include "extensions/common/api/extension_types.h" | 9 #include "extensions/common/api/extension_types.h" |
| 10 | 10 |
| 11 class SkBitmap; | 11 class SkBitmap; |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 class WebContents; | 14 class WebContents; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 // Base class for capturing visibile area of a WebContents. | 19 // Base class for capturing visibile area of a WebContents. |
| 20 // This is used by both webview.captureVisibleRegion and tabs.captureVisibleTab. | 20 // This is used by both webview.captureVisibleRegion and tabs.captureVisibleTab. |
| 21 class CaptureWebContentsFunction : public AsyncExtensionFunction { | 21 class CaptureWebContentsFunction : public AsyncExtensionFunction { |
| 22 public: | 22 public: |
| 23 CaptureWebContentsFunction() {} | 23 CaptureWebContentsFunction() {} |
| 24 | 24 |
| 25 protected: | 25 protected: |
| 26 virtual ~CaptureWebContentsFunction() {} | 26 virtual ~CaptureWebContentsFunction() {} |
| 27 | 27 |
| 28 // ExtensionFunction implementation. | 28 // ExtensionFunction implementation. |
| 29 virtual bool HasPermission() OVERRIDE; | 29 virtual bool HasPermission() override; |
| 30 virtual bool RunAsync() OVERRIDE; | 30 virtual bool RunAsync() override; |
| 31 | 31 |
| 32 virtual bool IsScreenshotEnabled() = 0; | 32 virtual bool IsScreenshotEnabled() = 0; |
| 33 virtual content::WebContents* GetWebContentsForID(int context_id) = 0; | 33 virtual content::WebContents* GetWebContentsForID(int context_id) = 0; |
| 34 | 34 |
| 35 enum FailureReason { | 35 enum FailureReason { |
| 36 FAILURE_REASON_UNKNOWN, | 36 FAILURE_REASON_UNKNOWN, |
| 37 FAILURE_REASON_ENCODING_FAILED, | 37 FAILURE_REASON_ENCODING_FAILED, |
| 38 FAILURE_REASON_VIEW_INVISIBLE | 38 FAILURE_REASON_VIEW_INVISIBLE |
| 39 }; | 39 }; |
| 40 virtual void OnCaptureFailure(FailureReason reason) = 0; | 40 virtual void OnCaptureFailure(FailureReason reason) = 0; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 56 | 56 |
| 57 // Quality setting to use when encoding jpegs. Set in RunAsync(). | 57 // Quality setting to use when encoding jpegs. Set in RunAsync(). |
| 58 int image_quality_; | 58 int image_quality_; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(CaptureWebContentsFunction); | 60 DISALLOW_COPY_AND_ASSIGN(CaptureWebContentsFunction); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace extensions | 63 } // namespace extensions |
| 64 | 64 |
| 65 #endif // EXTENSIONS_BROWSER_API_CAPTURE_WEB_CONTENTS_FUNCTION_H_ | 65 #endif // EXTENSIONS_BROWSER_API_CAPTURE_WEB_CONTENTS_FUNCTION_H_ |
| OLD | NEW |