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