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 "chrome/browser/extensions/api/web_view/web_view_internal_api.h" | 5 #include "chrome/browser/extensions/api/web_view/web_view_internal_api.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" | 8 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" |
9 #include "chrome/browser/extensions/api/context_menus/context_menus_api.h" | 9 #include "chrome/browser/extensions/api/context_menus/context_menus_api.h" |
10 #include "chrome/browser/extensions/api/context_menus/context_menus_api_helpers.
h" | 10 #include "chrome/browser/extensions/api/context_menus/context_menus_api_helpers.
h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 } | 347 } |
348 | 348 |
349 bool WebViewInternalCaptureVisibleRegionFunction::IsScreenshotEnabled() { | 349 bool WebViewInternalCaptureVisibleRegionFunction::IsScreenshotEnabled() { |
350 return true; | 350 return true; |
351 } | 351 } |
352 | 352 |
353 WebContents* WebViewInternalCaptureVisibleRegionFunction::GetWebContentsForID( | 353 WebContents* WebViewInternalCaptureVisibleRegionFunction::GetWebContentsForID( |
354 int instance_id) { | 354 int instance_id) { |
355 WebViewGuest* guest = WebViewGuest::From( | 355 WebViewGuest* guest = WebViewGuest::From( |
356 render_view_host()->GetProcess()->GetID(), instance_id); | 356 render_view_host()->GetProcess()->GetID(), instance_id); |
357 return guest ? guest->guest_web_contents() : NULL; | 357 return guest ? guest->web_contents() : NULL; |
358 } | 358 } |
359 | 359 |
360 void WebViewInternalCaptureVisibleRegionFunction::OnCaptureFailure( | 360 void WebViewInternalCaptureVisibleRegionFunction::OnCaptureFailure( |
361 FailureReason reason) { | 361 FailureReason reason) { |
362 SendResponse(false); | 362 SendResponse(false); |
363 } | 363 } |
364 | 364 |
365 WebViewInternalSetNameFunction::WebViewInternalSetNameFunction() { | 365 WebViewInternalSetNameFunction::WebViewInternalSetNameFunction() { |
366 } | 366 } |
367 | 367 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 break; | 519 break; |
520 default: | 520 default: |
521 NOTREACHED(); | 521 NOTREACHED(); |
522 } | 522 } |
523 | 523 |
524 std::string user_input; | 524 std::string user_input; |
525 if (params->user_input) | 525 if (params->user_input) |
526 user_input = *params->user_input; | 526 user_input = *params->user_input; |
527 | 527 |
528 WebViewPermissionHelper* web_view_permission_helper = | 528 WebViewPermissionHelper* web_view_permission_helper = |
529 WebViewPermissionHelper:: FromWebContents(guest->guest_web_contents()); | 529 WebViewPermissionHelper::FromWebContents(guest->web_contents()); |
530 | 530 |
531 WebViewPermissionHelper::SetPermissionResult result = | 531 WebViewPermissionHelper::SetPermissionResult result = |
532 web_view_permission_helper->SetPermission( | 532 web_view_permission_helper->SetPermission( |
533 params->request_id, action, user_input); | 533 params->request_id, action, user_input); |
534 | 534 |
535 EXTENSION_FUNCTION_VALIDATE( | 535 EXTENSION_FUNCTION_VALIDATE( |
536 result != WebViewPermissionHelper::SET_PERMISSION_INVALID); | 536 result != WebViewPermissionHelper::SET_PERMISSION_INVALID); |
537 | 537 |
538 SetResult(new base::FundamentalValue( | 538 SetResult(new base::FundamentalValue( |
539 result == WebViewPermissionHelper::SET_PERMISSION_ALLOWED)); | 539 result == WebViewPermissionHelper::SET_PERMISSION_ALLOWED)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 | 596 |
597 WebViewInternalTerminateFunction::~WebViewInternalTerminateFunction() { | 597 WebViewInternalTerminateFunction::~WebViewInternalTerminateFunction() { |
598 } | 598 } |
599 | 599 |
600 bool WebViewInternalTerminateFunction::RunAsyncSafe(WebViewGuest* guest) { | 600 bool WebViewInternalTerminateFunction::RunAsyncSafe(WebViewGuest* guest) { |
601 guest->Terminate(); | 601 guest->Terminate(); |
602 return true; | 602 return true; |
603 } | 603 } |
604 | 604 |
605 } // namespace extensions | 605 } // namespace extensions |
OLD | NEW |