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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 | 633 |
634 WebViewInternalGetZoomFunction::~WebViewInternalGetZoomFunction() { | 634 WebViewInternalGetZoomFunction::~WebViewInternalGetZoomFunction() { |
635 } | 635 } |
636 | 636 |
637 ExtensionFunction::ResponseAction WebViewInternalGetZoomFunction::Run() { | 637 ExtensionFunction::ResponseAction WebViewInternalGetZoomFunction::Run() { |
638 std::unique_ptr<web_view_internal::GetZoom::Params> params( | 638 std::unique_ptr<web_view_internal::GetZoom::Params> params( |
639 web_view_internal::GetZoom::Params::Create(*args_)); | 639 web_view_internal::GetZoom::Params::Create(*args_)); |
640 EXTENSION_FUNCTION_VALIDATE(params.get()); | 640 EXTENSION_FUNCTION_VALIDATE(params.get()); |
641 | 641 |
642 double zoom_factor = guest_->GetZoom(); | 642 double zoom_factor = guest_->GetZoom(); |
643 return RespondNow( | 643 return RespondNow(OneArgument(base::MakeUnique<base::Value>(zoom_factor))); |
644 OneArgument(base::MakeUnique<base::FundamentalValue>(zoom_factor))); | |
645 } | 644 } |
646 | 645 |
647 WebViewInternalSetZoomModeFunction::WebViewInternalSetZoomModeFunction() { | 646 WebViewInternalSetZoomModeFunction::WebViewInternalSetZoomModeFunction() { |
648 } | 647 } |
649 | 648 |
650 WebViewInternalSetZoomModeFunction::~WebViewInternalSetZoomModeFunction() { | 649 WebViewInternalSetZoomModeFunction::~WebViewInternalSetZoomModeFunction() { |
651 } | 650 } |
652 | 651 |
653 ExtensionFunction::ResponseAction WebViewInternalSetZoomModeFunction::Run() { | 652 ExtensionFunction::ResponseAction WebViewInternalSetZoomModeFunction::Run() { |
654 std::unique_ptr<web_view_internal::SetZoomMode::Params> params( | 653 std::unique_ptr<web_view_internal::SetZoomMode::Params> params( |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 | 795 |
797 WebViewInternalGoFunction::~WebViewInternalGoFunction() { | 796 WebViewInternalGoFunction::~WebViewInternalGoFunction() { |
798 } | 797 } |
799 | 798 |
800 ExtensionFunction::ResponseAction WebViewInternalGoFunction::Run() { | 799 ExtensionFunction::ResponseAction WebViewInternalGoFunction::Run() { |
801 std::unique_ptr<web_view_internal::Go::Params> params( | 800 std::unique_ptr<web_view_internal::Go::Params> params( |
802 web_view_internal::Go::Params::Create(*args_)); | 801 web_view_internal::Go::Params::Create(*args_)); |
803 EXTENSION_FUNCTION_VALIDATE(params.get()); | 802 EXTENSION_FUNCTION_VALIDATE(params.get()); |
804 | 803 |
805 bool successful = guest_->Go(params->relative_index); | 804 bool successful = guest_->Go(params->relative_index); |
806 return RespondNow( | 805 return RespondNow(OneArgument(base::MakeUnique<base::Value>(successful))); |
807 OneArgument(base::MakeUnique<base::FundamentalValue>(successful))); | |
808 } | 806 } |
809 | 807 |
810 WebViewInternalReloadFunction::WebViewInternalReloadFunction() { | 808 WebViewInternalReloadFunction::WebViewInternalReloadFunction() { |
811 } | 809 } |
812 | 810 |
813 WebViewInternalReloadFunction::~WebViewInternalReloadFunction() { | 811 WebViewInternalReloadFunction::~WebViewInternalReloadFunction() { |
814 } | 812 } |
815 | 813 |
816 ExtensionFunction::ResponseAction WebViewInternalReloadFunction::Run() { | 814 ExtensionFunction::ResponseAction WebViewInternalReloadFunction::Run() { |
817 guest_->Reload(); | 815 guest_->Reload(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 WebViewPermissionHelper* web_view_permission_helper = | 849 WebViewPermissionHelper* web_view_permission_helper = |
852 WebViewPermissionHelper::FromWebContents(guest_->web_contents()); | 850 WebViewPermissionHelper::FromWebContents(guest_->web_contents()); |
853 | 851 |
854 WebViewPermissionHelper::SetPermissionResult result = | 852 WebViewPermissionHelper::SetPermissionResult result = |
855 web_view_permission_helper->SetPermission( | 853 web_view_permission_helper->SetPermission( |
856 params->request_id, action, user_input); | 854 params->request_id, action, user_input); |
857 | 855 |
858 EXTENSION_FUNCTION_VALIDATE(result != | 856 EXTENSION_FUNCTION_VALIDATE(result != |
859 WebViewPermissionHelper::SET_PERMISSION_INVALID); | 857 WebViewPermissionHelper::SET_PERMISSION_INVALID); |
860 | 858 |
861 return RespondNow(OneArgument(base::MakeUnique<base::FundamentalValue>( | 859 return RespondNow(OneArgument(base::MakeUnique<base::Value>( |
862 result == WebViewPermissionHelper::SET_PERMISSION_ALLOWED))); | 860 result == WebViewPermissionHelper::SET_PERMISSION_ALLOWED))); |
863 } | 861 } |
864 | 862 |
865 WebViewInternalOverrideUserAgentFunction:: | 863 WebViewInternalOverrideUserAgentFunction:: |
866 WebViewInternalOverrideUserAgentFunction() { | 864 WebViewInternalOverrideUserAgentFunction() { |
867 } | 865 } |
868 | 866 |
869 WebViewInternalOverrideUserAgentFunction:: | 867 WebViewInternalOverrideUserAgentFunction:: |
870 ~WebViewInternalOverrideUserAgentFunction() { | 868 ~WebViewInternalOverrideUserAgentFunction() { |
871 } | 869 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 // Will finish asynchronously. | 976 // Will finish asynchronously. |
979 return true; | 977 return true; |
980 } | 978 } |
981 | 979 |
982 void WebViewInternalClearDataFunction::ClearDataDone() { | 980 void WebViewInternalClearDataFunction::ClearDataDone() { |
983 Release(); // Balanced in RunAsync(). | 981 Release(); // Balanced in RunAsync(). |
984 SendResponse(true); | 982 SendResponse(true); |
985 } | 983 } |
986 | 984 |
987 } // namespace extensions | 985 } // namespace extensions |
OLD | NEW |