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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 notification_registrar_.Add(this, | 329 notification_registrar_.Add(this, |
330 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 330 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
331 content::Source<WebContents>(web_contents())); | 331 content::Source<WebContents>(web_contents())); |
332 | 332 |
333 notification_registrar_.Add(this, | 333 notification_registrar_.Add(this, |
334 content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, | 334 content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, |
335 content::Source<WebContents>(web_contents())); | 335 content::Source<WebContents>(web_contents())); |
336 | 336 |
337 if (web_view_guest_delegate_) | 337 if (web_view_guest_delegate_) |
338 web_view_guest_delegate_->OnDidInitialize(); | 338 web_view_guest_delegate_->OnDidInitialize(); |
339 AttachWebViewHelpers(web_contents()); | 339 ExtensionsAPIClient::Get()->AttachWebContentsHelpers(web_contents()); |
Fady Samuel
2015/06/10 20:51:18
Does this mean all extensions will get routed to a
Devlin
2015/06/10 20:59:20
Not really. ExtensionWebContentsObserver (and Ext
| |
340 web_view_permission_helper_.reset(new WebViewPermissionHelper(this)); | |
340 | 341 |
341 rules_registry_id_ = GetOrGenerateRulesRegistryID( | 342 rules_registry_id_ = GetOrGenerateRulesRegistryID( |
342 owner_web_contents()->GetRenderProcessHost()->GetID(), | 343 owner_web_contents()->GetRenderProcessHost()->GetID(), |
343 view_instance_id()); | 344 view_instance_id()); |
344 | 345 |
345 // We must install the mapping from guests to WebViews prior to resuming | 346 // We must install the mapping from guests to WebViews prior to resuming |
346 // suspended resource loads so that the WebRequest API will catch resource | 347 // suspended resource loads so that the WebRequest API will catch resource |
347 // requests. | 348 // requests. |
348 PushWebViewStateToIOThread(); | 349 PushWebViewStateToIOThread(); |
349 | 350 |
350 ApplyAttributes(create_params); | 351 ApplyAttributes(create_params); |
351 } | 352 } |
352 | 353 |
353 void WebViewGuest::AttachWebViewHelpers(WebContents* contents) { | |
354 if (web_view_guest_delegate_) | |
355 web_view_guest_delegate_->OnAttachWebViewHelpers(contents); | |
356 web_view_permission_helper_.reset(new WebViewPermissionHelper(this)); | |
357 } | |
358 | |
359 void WebViewGuest::ClearDataInternal(base::Time remove_since, | 354 void WebViewGuest::ClearDataInternal(base::Time remove_since, |
360 uint32 removal_mask, | 355 uint32 removal_mask, |
361 const base::Closure& callback) { | 356 const base::Closure& callback) { |
362 uint32 storage_partition_removal_mask = | 357 uint32 storage_partition_removal_mask = |
363 GetStoragePartitionRemovalMask(removal_mask); | 358 GetStoragePartitionRemovalMask(removal_mask); |
364 if (!storage_partition_removal_mask) { | 359 if (!storage_partition_removal_mask) { |
365 callback.Run(); | 360 callback.Run(); |
366 return; | 361 return; |
367 } | 362 } |
368 content::StoragePartition* partition = | 363 content::StoragePartition* partition = |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1441 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 1436 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
1442 DispatchEventToView( | 1437 DispatchEventToView( |
1443 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); | 1438 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); |
1444 } | 1439 } |
1445 // Since we changed fullscreen state, sending a Resize message ensures that | 1440 // Since we changed fullscreen state, sending a Resize message ensures that |
1446 // renderer/ sees the change. | 1441 // renderer/ sees the change. |
1447 web_contents()->GetRenderViewHost()->WasResized(); | 1442 web_contents()->GetRenderViewHost()->WasResized(); |
1448 } | 1443 } |
1449 | 1444 |
1450 } // namespace extensions | 1445 } // namespace extensions |
OLD | NEW |