OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/guest_view/web_view/web_view_internal_api.h" | 5 #include "extensions/browser/api/guest_view/web_view/web_view_internal_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 } | 327 } |
328 | 328 |
329 void WebViewInternalCaptureVisibleRegionFunction::OnCaptureSuccess( | 329 void WebViewInternalCaptureVisibleRegionFunction::OnCaptureSuccess( |
330 const SkBitmap& bitmap) { | 330 const SkBitmap& bitmap) { |
331 std::string base64_result; | 331 std::string base64_result; |
332 if (!EncodeBitmap(bitmap, &base64_result)) { | 332 if (!EncodeBitmap(bitmap, &base64_result)) { |
333 OnCaptureFailure(FAILURE_REASON_ENCODING_FAILED); | 333 OnCaptureFailure(FAILURE_REASON_ENCODING_FAILED); |
334 return; | 334 return; |
335 } | 335 } |
336 | 336 |
337 SetResult(base::MakeUnique<base::StringValue>(base64_result)); | 337 SetResult(base::MakeUnique<base::Value>(base64_result)); |
338 SendResponse(true); | 338 SendResponse(true); |
339 } | 339 } |
340 | 340 |
341 void WebViewInternalCaptureVisibleRegionFunction::OnCaptureFailure( | 341 void WebViewInternalCaptureVisibleRegionFunction::OnCaptureFailure( |
342 FailureReason reason) { | 342 FailureReason reason) { |
343 const char* reason_description = "internal error"; | 343 const char* reason_description = "internal error"; |
344 switch (reason) { | 344 switch (reason) { |
345 case FAILURE_REASON_UNKNOWN: | 345 case FAILURE_REASON_UNKNOWN: |
346 reason_description = "unknown error"; | 346 reason_description = "unknown error"; |
347 break; | 347 break; |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 case ZoomController::ZOOM_MODE_ISOLATED: | 696 case ZoomController::ZOOM_MODE_ISOLATED: |
697 zoom_mode = web_view_internal::ZOOM_MODE_PER_VIEW; | 697 zoom_mode = web_view_internal::ZOOM_MODE_PER_VIEW; |
698 break; | 698 break; |
699 case ZoomController::ZOOM_MODE_DISABLED: | 699 case ZoomController::ZOOM_MODE_DISABLED: |
700 zoom_mode = web_view_internal::ZOOM_MODE_DISABLED; | 700 zoom_mode = web_view_internal::ZOOM_MODE_DISABLED; |
701 break; | 701 break; |
702 default: | 702 default: |
703 NOTREACHED(); | 703 NOTREACHED(); |
704 } | 704 } |
705 | 705 |
706 return RespondNow(OneArgument(base::MakeUnique<base::StringValue>( | 706 return RespondNow(OneArgument( |
707 web_view_internal::ToString(zoom_mode)))); | 707 base::MakeUnique<base::Value>(web_view_internal::ToString(zoom_mode)))); |
708 } | 708 } |
709 | 709 |
710 WebViewInternalFindFunction::WebViewInternalFindFunction() { | 710 WebViewInternalFindFunction::WebViewInternalFindFunction() { |
711 } | 711 } |
712 | 712 |
713 WebViewInternalFindFunction::~WebViewInternalFindFunction() { | 713 WebViewInternalFindFunction::~WebViewInternalFindFunction() { |
714 } | 714 } |
715 | 715 |
716 bool WebViewInternalFindFunction::RunAsyncSafe(WebViewGuest* guest) { | 716 bool WebViewInternalFindFunction::RunAsyncSafe(WebViewGuest* guest) { |
717 std::unique_ptr<web_view_internal::Find::Params> params( | 717 std::unique_ptr<web_view_internal::Find::Params> params( |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 // Will finish asynchronously. | 980 // Will finish asynchronously. |
981 return true; | 981 return true; |
982 } | 982 } |
983 | 983 |
984 void WebViewInternalClearDataFunction::ClearDataDone() { | 984 void WebViewInternalClearDataFunction::ClearDataDone() { |
985 Release(); // Balanced in RunAsync(). | 985 Release(); // Balanced in RunAsync(). |
986 SendResponse(true); | 986 SendResponse(true); |
987 } | 987 } |
988 | 988 |
989 } // namespace extensions | 989 } // namespace extensions |
OLD | NEW |