| 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 11 matching lines...) Expand all Loading... |
| 22 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
| 23 #include "content/browser/web_contents/web_contents_view_guest.h" | 23 #include "content/browser/web_contents/web_contents_view_guest.h" |
| 24 #include "content/common/browser_plugin/browser_plugin_constants.h" | 24 #include "content/common/browser_plugin/browser_plugin_constants.h" |
| 25 #include "content/common/browser_plugin/browser_plugin_messages.h" | 25 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 26 #include "content/common/content_constants_internal.h" | 26 #include "content/common/content_constants_internal.h" |
| 27 #include "content/common/drag_messages.h" | 27 #include "content/common/drag_messages.h" |
| 28 #include "content/common/input_messages.h" | 28 #include "content/common/input_messages.h" |
| 29 #include "content/common/view_messages.h" | 29 #include "content/common/view_messages.h" |
| 30 #include "content/port/browser/render_view_host_delegate_view.h" | 30 #include "content/port/browser/render_view_host_delegate_view.h" |
| 31 #include "content/public/browser/browser_context.h" | 31 #include "content/public/browser/browser_context.h" |
| 32 #include "content/public/browser/browser_plugin_guest_manager_delegate.h" | 32 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 33 #include "content/public/browser/content_browser_client.h" | 33 #include "content/public/browser/content_browser_client.h" |
| 34 #include "content/public/browser/navigation_controller.h" | 34 #include "content/public/browser/navigation_controller.h" |
| 35 #include "content/public/browser/render_widget_host_view.h" | 35 #include "content/public/browser/render_widget_host_view.h" |
| 36 #include "content/public/browser/user_metrics.h" | 36 #include "content/public/browser/user_metrics.h" |
| 37 #include "content/public/browser/web_contents_observer.h" | 37 #include "content/public/browser/web_contents_observer.h" |
| 38 #include "content/public/common/context_menu_params.h" | 38 #include "content/public/common/context_menu_params.h" |
| 39 #include "content/public/common/drop_data.h" | 39 #include "content/public/common/drop_data.h" |
| 40 #include "content/public/common/media_stream_request.h" | 40 #include "content/public/common/media_stream_request.h" |
| 41 #include "content/public/common/result_codes.h" | 41 #include "content/public/common/result_codes.h" |
| 42 #include "content/public/common/url_constants.h" | 42 #include "content/public/common/url_constants.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 BrowserPluginGuestDelegate::PermissionResponseCallback callback = | 302 BrowserPluginGuestDelegate::PermissionResponseCallback callback = |
| 303 base::Bind(&BrowserPluginGuest::RespondToPermissionRequest, | 303 base::Bind(&BrowserPluginGuest::RespondToPermissionRequest, |
| 304 AsWeakPtr(), | 304 AsWeakPtr(), |
| 305 request_id); | 305 request_id); |
| 306 delegate_->RequestPermission( | 306 delegate_->RequestPermission( |
| 307 permission_type, request_info, callback, request->AllowedByDefault()); | 307 permission_type, request_info, callback, request->AllowedByDefault()); |
| 308 } | 308 } |
| 309 | 309 |
| 310 BrowserPluginGuest* BrowserPluginGuest::CreateNewGuestWindow( | 310 BrowserPluginGuest* BrowserPluginGuest::CreateNewGuestWindow( |
| 311 const OpenURLParams& params) { | 311 const OpenURLParams& params) { |
| 312 BrowserPluginGuestManagerDelegate* guest_manager = | 312 BrowserPluginGuestManager* guest_manager = |
| 313 GetBrowserPluginGuestManager(); | 313 GetBrowserPluginGuestManager(); |
| 314 | 314 |
| 315 // Allocate a new instance ID for the new guest. | 315 // Allocate a new instance ID for the new guest. |
| 316 int instance_id = guest_manager->GetNextInstanceID(); | 316 int instance_id = guest_manager->GetNextInstanceID(); |
| 317 | 317 |
| 318 // Set the attach params to use the same partition as the opener. | 318 // Set the attach params to use the same partition as the opener. |
| 319 // We pull the partition information from the site's URL, which is of the form | 319 // We pull the partition information from the site's URL, which is of the form |
| 320 // guest://site/{persist}?{partition_name}. | 320 // guest://site/{persist}?{partition_name}. |
| 321 const GURL& site_url = GetWebContents()->GetSiteInstance()->GetSiteURL(); | 321 const GURL& site_url = GetWebContents()->GetSiteInstance()->GetSiteURL(); |
| 322 | 322 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 void BrowserPluginGuest::CopyFromCompositingSurface( | 574 void BrowserPluginGuest::CopyFromCompositingSurface( |
| 575 gfx::Rect src_subrect, | 575 gfx::Rect src_subrect, |
| 576 gfx::Size dst_size, | 576 gfx::Size dst_size, |
| 577 const base::Callback<void(bool, const SkBitmap&)>& callback) { | 577 const base::Callback<void(bool, const SkBitmap&)>& callback) { |
| 578 copy_request_callbacks_.insert(std::make_pair(++copy_request_id_, callback)); | 578 copy_request_callbacks_.insert(std::make_pair(++copy_request_id_, callback)); |
| 579 SendMessageToEmbedder( | 579 SendMessageToEmbedder( |
| 580 new BrowserPluginMsg_CopyFromCompositingSurface(instance_id(), | 580 new BrowserPluginMsg_CopyFromCompositingSurface(instance_id(), |
| 581 copy_request_id_, src_subrect, dst_size)); | 581 copy_request_id_, src_subrect, dst_size)); |
| 582 } | 582 } |
| 583 | 583 |
| 584 BrowserPluginGuestManagerDelegate* | 584 BrowserPluginGuestManager* |
| 585 BrowserPluginGuest::GetBrowserPluginGuestManager() const { | 585 BrowserPluginGuest::GetBrowserPluginGuestManager() const { |
| 586 return GetWebContents()->GetBrowserContext()->GetGuestManagerDelegate(); | 586 return GetWebContents()->GetBrowserContext()->GetGuestManager(); |
| 587 } | 587 } |
| 588 | 588 |
| 589 // screen. | 589 // screen. |
| 590 gfx::Rect BrowserPluginGuest::ToGuestRect(const gfx::Rect& bounds) { | 590 gfx::Rect BrowserPluginGuest::ToGuestRect(const gfx::Rect& bounds) { |
| 591 gfx::Rect guest_rect(bounds); | 591 gfx::Rect guest_rect(bounds); |
| 592 guest_rect.Offset(guest_window_rect_.OffsetFromOrigin()); | 592 guest_rect.Offset(guest_window_rect_.OffsetFromOrigin()); |
| 593 return guest_rect; | 593 return guest_rect; |
| 594 } | 594 } |
| 595 | 595 |
| 596 void BrowserPluginGuest::EmbedderVisibilityChanged(bool visible) { | 596 void BrowserPluginGuest::EmbedderVisibilityChanged(bool visible) { |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1561 const GURL& url) { | 1561 const GURL& url) { |
| 1562 if (!url.is_valid()) { | 1562 if (!url.is_valid()) { |
| 1563 callback.Run(false); | 1563 callback.Run(false); |
| 1564 return; | 1564 return; |
| 1565 } | 1565 } |
| 1566 | 1566 |
| 1567 delegate_->CanDownload(request_method, url, callback); | 1567 delegate_->CanDownload(request_method, url, callback); |
| 1568 } | 1568 } |
| 1569 | 1569 |
| 1570 } // namespace content | 1570 } // namespace content |
| OLD | NEW |