OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 } | 429 } |
430 | 430 |
431 int request_id = ++next_permission_request_id_; | 431 int request_id = ++next_permission_request_id_; |
432 permission_request_map_[request_id] = request; | 432 permission_request_map_[request_id] = request; |
433 | 433 |
434 BrowserPluginGuestDelegate::PermissionResponseCallback callback = | 434 BrowserPluginGuestDelegate::PermissionResponseCallback callback = |
435 base::Bind(&BrowserPluginGuest::RespondToPermissionRequest, | 435 base::Bind(&BrowserPluginGuest::RespondToPermissionRequest, |
436 AsWeakPtr(), | 436 AsWeakPtr(), |
437 request_id); | 437 request_id); |
438 // If BrowserPluginGuestDelegate hasn't handled the permission then we simply | 438 // If BrowserPluginGuestDelegate hasn't handled the permission then we simply |
439 // reject it immediately. | 439 // perform the default action (which is one of allow or reject) immediately. |
440 if (!delegate_->RequestPermission( | 440 if (!delegate_->RequestPermission( |
441 permission_type, request_info, callback, request->AllowedByDefault())) { | 441 permission_type, request_info, callback, request->AllowedByDefault())) { |
442 callback.Run(request->AllowedByDefault(), ""); | 442 callback.Run(request->AllowedByDefault(), ""); |
443 return browser_plugin::kInvalidPermissionRequestID; | 443 return browser_plugin::kInvalidPermissionRequestID; |
444 } | 444 } |
445 | 445 |
446 return request_id; | 446 return request_id; |
447 } | 447 } |
448 | 448 |
449 BrowserPluginGuest* BrowserPluginGuest::CreateNewGuestWindow( | 449 BrowserPluginGuest* BrowserPluginGuest::CreateNewGuestWindow( |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 request_info.Set(browser_plugin::kRequestMethod, | 1731 request_info.Set(browser_plugin::kRequestMethod, |
1732 base::Value::CreateStringValue(request_method)); | 1732 base::Value::CreateStringValue(request_method)); |
1733 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); | 1733 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); |
1734 | 1734 |
1735 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, | 1735 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, |
1736 new DownloadRequest(callback), | 1736 new DownloadRequest(callback), |
1737 request_info); | 1737 request_info); |
1738 } | 1738 } |
1739 | 1739 |
1740 } // namespace content | 1740 } // namespace content |
OLD | NEW |