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