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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "components/browsing_data/content/storage_partition_http_cache_data_rem
over.h" | |
17 #include "components/guest_view/browser/guest_view_event.h" | 16 #include "components/guest_view/browser/guest_view_event.h" |
18 #include "components/guest_view/browser/guest_view_manager.h" | 17 #include "components/guest_view/browser/guest_view_manager.h" |
19 #include "components/guest_view/common/guest_view_constants.h" | 18 #include "components/guest_view/common/guest_view_constants.h" |
20 #include "components/web_cache/browser/web_cache_manager.h" | 19 #include "components/web_cache/browser/web_cache_manager.h" |
21 #include "content/public/browser/browser_context.h" | 20 #include "content/public/browser/browser_context.h" |
22 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/child_process_security_policy.h" | 22 #include "content/public/browser/child_process_security_policy.h" |
24 #include "content/public/browser/native_web_keyboard_event.h" | 23 #include "content/public/browser/native_web_keyboard_event.h" |
25 #include "content/public/browser/navigation_entry.h" | 24 #include "content/public/browser/navigation_entry.h" |
26 #include "content/public/browser/navigation_handle.h" | 25 #include "content/public/browser/navigation_handle.h" |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 // |ClearDataInternal|. | 796 // |ClearDataInternal|. |
798 int render_process_id = web_contents()->GetRenderProcessHost()->GetID(); | 797 int render_process_id = web_contents()->GetRenderProcessHost()->GetID(); |
799 // We need to clear renderer cache separately for our process because | 798 // We need to clear renderer cache separately for our process because |
800 // StoragePartitionHttpCacheDataRemover::ClearData() does not clear that. | 799 // StoragePartitionHttpCacheDataRemover::ClearData() does not clear that. |
801 web_cache::WebCacheManager::GetInstance()->ClearCacheForProcess( | 800 web_cache::WebCacheManager::GetInstance()->ClearCacheForProcess( |
802 render_process_id); | 801 render_process_id); |
803 | 802 |
804 base::Closure cache_removal_done_callback = base::Bind( | 803 base::Closure cache_removal_done_callback = base::Bind( |
805 &WebViewGuest::ClearDataInternal, weak_ptr_factory_.GetWeakPtr(), | 804 &WebViewGuest::ClearDataInternal, weak_ptr_factory_.GetWeakPtr(), |
806 remove_since, removal_mask, callback); | 805 remove_since, removal_mask, callback); |
807 // StoragePartitionHttpCacheDataRemover removes itself when it is done. | |
808 // components/, move |ClearCache| to WebViewGuest: http//crbug.com/471287. | 806 // components/, move |ClearCache| to WebViewGuest: http//crbug.com/471287. |
809 browsing_data::StoragePartitionHttpCacheDataRemover::CreateForRange( | 807 partition->ClearHttpAndMediaCaches(remove_since, base::Time::Now(), |
810 partition, remove_since, base::Time::Now()) | 808 base::Callback<bool(const GURL&)>(), |
811 ->Remove(cache_removal_done_callback); | 809 cache_removal_done_callback); |
812 | |
813 return true; | 810 return true; |
814 } | 811 } |
815 | 812 |
816 ClearDataInternal(remove_since, removal_mask, callback); | 813 ClearDataInternal(remove_since, removal_mask, callback); |
817 return true; | 814 return true; |
818 } | 815 } |
819 | 816 |
820 WebViewGuest::WebViewGuest(WebContents* owner_web_contents) | 817 WebViewGuest::WebViewGuest(WebContents* owner_web_contents) |
821 : GuestView<WebViewGuest>(owner_web_contents), | 818 : GuestView<WebViewGuest>(owner_web_contents), |
822 rules_registry_id_(RulesRegistryService::kInvalidRulesRegistryID), | 819 rules_registry_id_(RulesRegistryService::kInvalidRulesRegistryID), |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 1555 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
1559 DispatchEventToView(base::MakeUnique<GuestViewEvent>( | 1556 DispatchEventToView(base::MakeUnique<GuestViewEvent>( |
1560 webview::kEventExitFullscreen, std::move(args))); | 1557 webview::kEventExitFullscreen, std::move(args))); |
1561 } | 1558 } |
1562 // Since we changed fullscreen state, sending a Resize message ensures that | 1559 // Since we changed fullscreen state, sending a Resize message ensures that |
1563 // renderer/ sees the change. | 1560 // renderer/ sees the change. |
1564 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); | 1561 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); |
1565 } | 1562 } |
1566 | 1563 |
1567 } // namespace extensions | 1564 } // namespace extensions |
OLD | NEW |