| 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 "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 } | 438 } |
| 439 | 439 |
| 440 bool WebViewInternalStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) { | 440 bool WebViewInternalStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) { |
| 441 scoped_ptr<web_view_internal::StopFinding::Params> params( | 441 scoped_ptr<web_view_internal::StopFinding::Params> params( |
| 442 web_view_internal::StopFinding::Params::Create(*args_)); | 442 web_view_internal::StopFinding::Params::Create(*args_)); |
| 443 EXTENSION_FUNCTION_VALIDATE(params.get()); | 443 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 444 | 444 |
| 445 // Set the StopFindAction. | 445 // Set the StopFindAction. |
| 446 content::StopFindAction action; | 446 content::StopFindAction action; |
| 447 switch (params->action) { | 447 switch (params->action) { |
| 448 case web_view_internal::StopFinding::Params::ACTION_CLEAR: | 448 case web_view_internal::STOP_FINDING_ACTION_CLEAR: |
| 449 action = content::STOP_FIND_ACTION_CLEAR_SELECTION; | 449 action = content::STOP_FIND_ACTION_CLEAR_SELECTION; |
| 450 break; | 450 break; |
| 451 case web_view_internal::StopFinding::Params::ACTION_KEEP: | 451 case web_view_internal::STOP_FINDING_ACTION_KEEP: |
| 452 action = content::STOP_FIND_ACTION_KEEP_SELECTION; | 452 action = content::STOP_FIND_ACTION_KEEP_SELECTION; |
| 453 break; | 453 break; |
| 454 case web_view_internal::StopFinding::Params::ACTION_ACTIVATE: | 454 case web_view_internal::STOP_FINDING_ACTION_ACTIVATE: |
| 455 action = content::STOP_FIND_ACTION_ACTIVATE_SELECTION; | 455 action = content::STOP_FIND_ACTION_ACTIVATE_SELECTION; |
| 456 break; | 456 break; |
| 457 default: | 457 default: |
| 458 action = content::STOP_FIND_ACTION_KEEP_SELECTION; | 458 action = content::STOP_FIND_ACTION_KEEP_SELECTION; |
| 459 } | 459 } |
| 460 | 460 |
| 461 guest->StopFindingInternal(action); | 461 guest->StopFindingInternal(action); |
| 462 return true; | 462 return true; |
| 463 } | 463 } |
| 464 | 464 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 } | 522 } |
| 523 | 523 |
| 524 bool WebViewInternalSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) { | 524 bool WebViewInternalSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) { |
| 525 scoped_ptr<web_view_internal::SetPermission::Params> params( | 525 scoped_ptr<web_view_internal::SetPermission::Params> params( |
| 526 web_view_internal::SetPermission::Params::Create(*args_)); | 526 web_view_internal::SetPermission::Params::Create(*args_)); |
| 527 EXTENSION_FUNCTION_VALIDATE(params.get()); | 527 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 528 | 528 |
| 529 WebViewPermissionHelper::PermissionResponseAction action = | 529 WebViewPermissionHelper::PermissionResponseAction action = |
| 530 WebViewPermissionHelper::DEFAULT; | 530 WebViewPermissionHelper::DEFAULT; |
| 531 switch (params->action) { | 531 switch (params->action) { |
| 532 case Params::ACTION_ALLOW: | 532 case core_api::web_view_internal::SET_PERMISSION_ACTION_ALLOW: |
| 533 action = WebViewPermissionHelper::ALLOW; | 533 action = WebViewPermissionHelper::ALLOW; |
| 534 break; | 534 break; |
| 535 case Params::ACTION_DENY: | 535 case core_api::web_view_internal::SET_PERMISSION_ACTION_DENY: |
| 536 action = WebViewPermissionHelper::DENY; | 536 action = WebViewPermissionHelper::DENY; |
| 537 break; | 537 break; |
| 538 case Params::ACTION_DEFAULT: | 538 case core_api::web_view_internal::SET_PERMISSION_ACTION_DEFAULT: |
| 539 break; | 539 break; |
| 540 default: | 540 default: |
| 541 NOTREACHED(); | 541 NOTREACHED(); |
| 542 } | 542 } |
| 543 | 543 |
| 544 std::string user_input; | 544 std::string user_input; |
| 545 if (params->user_input) | 545 if (params->user_input) |
| 546 user_input = *params->user_input; | 546 user_input = *params->user_input; |
| 547 | 547 |
| 548 WebViewPermissionHelper* web_view_permission_helper = | 548 WebViewPermissionHelper* web_view_permission_helper = |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 // Will finish asynchronously. | 677 // Will finish asynchronously. |
| 678 return true; | 678 return true; |
| 679 } | 679 } |
| 680 | 680 |
| 681 void WebViewInternalClearDataFunction::ClearDataDone() { | 681 void WebViewInternalClearDataFunction::ClearDataDone() { |
| 682 Release(); // Balanced in RunAsync(). | 682 Release(); // Balanced in RunAsync(). |
| 683 SendResponse(true); | 683 SendResponse(true); |
| 684 } | 684 } |
| 685 | 685 |
| 686 } // namespace extensions | 686 } // namespace extensions |
| OLD | NEW |