| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tabs/tabs_api.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 if (args_->GetSize() > 1) { | 1656 if (args_->GetSize() > 1) { |
| 1657 base::Value* spec = NULL; | 1657 base::Value* spec = NULL; |
| 1658 EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &spec) && spec); | 1658 EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &spec) && spec); |
| 1659 image_details = ImageDetails::FromValue(*spec); | 1659 image_details = ImageDetails::FromValue(*spec); |
| 1660 } | 1660 } |
| 1661 | 1661 |
| 1662 WebContents* contents = GetWebContentsForID(context_id); | 1662 WebContents* contents = GetWebContentsForID(context_id); |
| 1663 | 1663 |
| 1664 return CaptureAsync( | 1664 return CaptureAsync( |
| 1665 contents, image_details.get(), | 1665 contents, image_details.get(), |
| 1666 base::Bind(&TabsCaptureVisibleTabFunction::CopyFromBackingStoreComplete, | 1666 base::Bind(&TabsCaptureVisibleTabFunction::CopyFromSurfaceComplete, |
| 1667 this)); | 1667 this)); |
| 1668 } | 1668 } |
| 1669 | 1669 |
| 1670 void TabsCaptureVisibleTabFunction::OnCaptureSuccess(const SkBitmap& bitmap) { | 1670 void TabsCaptureVisibleTabFunction::OnCaptureSuccess(const SkBitmap& bitmap) { |
| 1671 std::string base64_result; | 1671 std::string base64_result; |
| 1672 if (!EncodeBitmap(bitmap, &base64_result)) { | 1672 if (!EncodeBitmap(bitmap, &base64_result)) { |
| 1673 OnCaptureFailure(FAILURE_REASON_ENCODING_FAILED); | 1673 OnCaptureFailure(FAILURE_REASON_ENCODING_FAILED); |
| 1674 return; | 1674 return; |
| 1675 } | 1675 } |
| 1676 | 1676 |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2117 params->tab_id | 2117 params->tab_id |
| 2118 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, | 2118 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, |
| 2119 base::IntToString(*params->tab_id)) | 2119 base::IntToString(*params->tab_id)) |
| 2120 : keys::kCannotFindTabToDiscard)); | 2120 : keys::kCannotFindTabToDiscard)); |
| 2121 } | 2121 } |
| 2122 | 2122 |
| 2123 TabsDiscardFunction::TabsDiscardFunction() {} | 2123 TabsDiscardFunction::TabsDiscardFunction() {} |
| 2124 TabsDiscardFunction::~TabsDiscardFunction() {} | 2124 TabsDiscardFunction::~TabsDiscardFunction() {} |
| 2125 | 2125 |
| 2126 } // namespace extensions | 2126 } // namespace extensions |
| OLD | NEW |