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 "extensions/browser/guest_view/web_view/web_view_guest.h" | 5 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" | 10 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
25 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
26 #include "content/public/browser/render_widget_host.h" | 26 #include "content/public/browser/render_widget_host.h" |
27 #include "content/public/browser/render_widget_host_view.h" | 27 #include "content/public/browser/render_widget_host_view.h" |
28 #include "content/public/browser/resource_request_details.h" | 28 #include "content/public/browser/resource_request_details.h" |
29 #include "content/public/browser/site_instance.h" | 29 #include "content/public/browser/site_instance.h" |
30 #include "content/public/browser/storage_partition.h" | 30 #include "content/public/browser/storage_partition.h" |
31 #include "content/public/browser/user_metrics.h" | 31 #include "content/public/browser/user_metrics.h" |
32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
33 #include "content/public/browser/web_contents_delegate.h" | 33 #include "content/public/browser/web_contents_delegate.h" |
| 34 #include "content/public/browser/web_contents_source.h" |
34 #include "content/public/common/media_stream_request.h" | 35 #include "content/public/common/media_stream_request.h" |
35 #include "content/public/common/page_zoom.h" | 36 #include "content/public/common/page_zoom.h" |
36 #include "content/public/common/result_codes.h" | 37 #include "content/public/common/result_codes.h" |
37 #include "content/public/common/stop_find_action.h" | 38 #include "content/public/common/stop_find_action.h" |
38 #include "content/public/common/url_constants.h" | 39 #include "content/public/common/url_constants.h" |
39 #include "extensions/browser/api/declarative/rules_registry_service.h" | 40 #include "extensions/browser/api/declarative/rules_registry_service.h" |
40 #include "extensions/browser/api/extensions_api_client.h" | 41 #include "extensions/browser/api/extensions_api_client.h" |
41 #include "extensions/browser/api/guest_view/web_view/web_view_internal_api.h" | 42 #include "extensions/browser/api/guest_view/web_view/web_view_internal_api.h" |
42 #include "extensions/browser/api/web_request/web_request_api.h" | 43 #include "extensions/browser/api/web_request/web_request_api.h" |
43 #include "extensions/browser/extension_system.h" | 44 #include "extensions/browser/extension_system.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 // Create the SiteInstance in a new BrowsingInstance, which will ensure | 349 // Create the SiteInstance in a new BrowsingInstance, which will ensure |
349 // that webview tags are also not allowed to send messages across | 350 // that webview tags are also not allowed to send messages across |
350 // different partitions. | 351 // different partitions. |
351 guest_site_instance = content::SiteInstance::CreateForURL( | 352 guest_site_instance = content::SiteInstance::CreateForURL( |
352 owner_render_process_host->GetBrowserContext(), guest_site); | 353 owner_render_process_host->GetBrowserContext(), guest_site); |
353 } | 354 } |
354 WebContents::CreateParams params( | 355 WebContents::CreateParams params( |
355 owner_render_process_host->GetBrowserContext(), | 356 owner_render_process_host->GetBrowserContext(), |
356 guest_site_instance); | 357 guest_site_instance); |
357 params.guest_delegate = this; | 358 params.guest_delegate = this; |
358 callback.Run(WebContents::Create(params)); | 359 WebContents* web_contents = WebContents::Create(params); |
| 360 WebContentsSource::CreateForWebContentsAndLocation(web_contents, FROM_HERE); |
| 361 callback.Run(web_contents); |
359 } | 362 } |
360 | 363 |
361 void WebViewGuest::DidAttachToEmbedder() { | 364 void WebViewGuest::DidAttachToEmbedder() { |
362 ApplyAttributes(*attach_params()); | 365 ApplyAttributes(*attach_params()); |
363 } | 366 } |
364 | 367 |
365 void WebViewGuest::DidDropLink(const GURL& url) { | 368 void WebViewGuest::DidDropLink(const GURL& url) { |
366 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 369 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
367 args->SetString(guest_view::kUrl, url.spec()); | 370 args->SetString(guest_view::kUrl, url.spec()); |
368 DispatchEventToView( | 371 DispatchEventToView( |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 1496 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
1494 DispatchEventToView( | 1497 DispatchEventToView( |
1495 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); | 1498 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); |
1496 } | 1499 } |
1497 // Since we changed fullscreen state, sending a Resize message ensures that | 1500 // Since we changed fullscreen state, sending a Resize message ensures that |
1498 // renderer/ sees the change. | 1501 // renderer/ sees the change. |
1499 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); | 1502 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); |
1500 } | 1503 } |
1501 | 1504 |
1502 } // namespace extensions | 1505 } // namespace extensions |
OLD | NEW |