| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/guestview/webview/webview_guest.h" | 5 #include "chrome/browser/guestview/webview/webview_guest.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/extensions/api/web_request/web_request_api.h" | 9 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
| 10 #include "chrome/browser/extensions/api/webview/webview_api.h" | 10 #include "chrome/browser/extensions/api/webview/webview_api.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 PermissionResponseInfo(callback, permission_type, allowed_by_default); | 443 PermissionResponseInfo(callback, permission_type, allowed_by_default); |
| 444 scoped_ptr<base::DictionaryValue> args(request_info.DeepCopy()); | 444 scoped_ptr<base::DictionaryValue> args(request_info.DeepCopy()); |
| 445 args->SetInteger(webview::kRequestId, request_id); | 445 args->SetInteger(webview::kRequestId, request_id); |
| 446 switch (permission_type) { | 446 switch (permission_type) { |
| 447 case BROWSER_PLUGIN_PERMISSION_TYPE_NEW_WINDOW: { | 447 case BROWSER_PLUGIN_PERMISSION_TYPE_NEW_WINDOW: { |
| 448 DispatchEvent(new GuestView::Event(webview::kEventNewWindow, | 448 DispatchEvent(new GuestView::Event(webview::kEventNewWindow, |
| 449 args.Pass())); | 449 args.Pass())); |
| 450 break; | 450 break; |
| 451 } | 451 } |
| 452 case BROWSER_PLUGIN_PERMISSION_TYPE_JAVASCRIPT_DIALOG: { | 452 case BROWSER_PLUGIN_PERMISSION_TYPE_JAVASCRIPT_DIALOG: { |
| 453 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | |
| 454 if (channel > chrome::VersionInfo::CHANNEL_DEV) { | |
| 455 // 'dialog' API is not available in stable/beta. | |
| 456 callback.Run(false, std::string()); | |
| 457 return true; | |
| 458 } | |
| 459 DispatchEvent(new GuestView::Event(webview::kEventDialog, | 453 DispatchEvent(new GuestView::Event(webview::kEventDialog, |
| 460 args.Pass())); | 454 args.Pass())); |
| 461 break; | 455 break; |
| 462 } | 456 } |
| 463 default: { | 457 default: { |
| 464 args->SetString(webview::kPermission, | 458 args->SetString(webview::kPermission, |
| 465 PermissionTypeToString(permission_type)); | 459 PermissionTypeToString(permission_type)); |
| 466 DispatchEvent(new GuestView::Event(webview::kEventPermissionRequest, | 460 DispatchEvent(new GuestView::Event(webview::kEventPermissionRequest, |
| 467 args.Pass())); | 461 args.Pass())); |
| 468 break; | 462 break; |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 const PermissionResponseCallback& callback, | 810 const PermissionResponseCallback& callback, |
| 817 BrowserPluginPermissionType permission_type, | 811 BrowserPluginPermissionType permission_type, |
| 818 bool allowed_by_default) | 812 bool allowed_by_default) |
| 819 : callback(callback), | 813 : callback(callback), |
| 820 permission_type(permission_type), | 814 permission_type(permission_type), |
| 821 allowed_by_default(allowed_by_default) { | 815 allowed_by_default(allowed_by_default) { |
| 822 } | 816 } |
| 823 | 817 |
| 824 WebViewGuest::PermissionResponseInfo::~PermissionResponseInfo() { | 818 WebViewGuest::PermissionResponseInfo::~PermissionResponseInfo() { |
| 825 } | 819 } |
| OLD | NEW |