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 "chrome/browser/guest_view/web_view/web_view_guest.h" | 5 #include "chrome/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 "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 std::string partition_domain; | 1103 std::string partition_domain; |
1104 std::string partition_id; | 1104 std::string partition_id; |
1105 bool in_memory; | 1105 bool in_memory; |
1106 if (!GetGuestPartitionConfigForSite( | 1106 if (!GetGuestPartitionConfigForSite( |
1107 site_url, &partition_domain, &partition_id, &in_memory)) { | 1107 site_url, &partition_domain, &partition_id, &in_memory)) { |
1108 NOTREACHED(); | 1108 NOTREACHED(); |
1109 return; | 1109 return; |
1110 } | 1110 } |
1111 DCHECK(embedder_extension_id() == partition_domain); | 1111 DCHECK(embedder_extension_id() == partition_domain); |
1112 | 1112 |
1113 ExtensionRendererState::WebViewInfo webview_info; | 1113 ExtensionRendererState::WebViewInfo web_view_info; |
1114 webview_info.embedder_process_id = embedder_render_process_id(); | 1114 web_view_info.embedder_process_id = embedder_render_process_id(); |
1115 webview_info.instance_id = view_instance_id(); | 1115 web_view_info.instance_id = view_instance_id(); |
1116 webview_info.partition_id = partition_id; | 1116 web_view_info.partition_id = partition_id; |
1117 webview_info.embedder_extension_id = embedder_extension_id(); | 1117 web_view_info.embedder_extension_id = embedder_extension_id(); |
1118 | 1118 |
1119 content::BrowserThread::PostTask( | 1119 content::BrowserThread::PostTask( |
1120 content::BrowserThread::IO, FROM_HERE, | 1120 content::BrowserThread::IO, |
1121 base::Bind( | 1121 FROM_HERE, |
1122 &ExtensionRendererState::AddWebView, | 1122 base::Bind(&ExtensionRendererState::AddWebView, |
1123 base::Unretained(ExtensionRendererState::GetInstance()), | 1123 base::Unretained(ExtensionRendererState::GetInstance()), |
1124 guest_web_contents()->GetRenderProcessHost()->GetID(), | 1124 guest_web_contents()->GetRenderProcessHost()->GetID(), |
1125 guest_web_contents()->GetRoutingID(), | 1125 guest_web_contents()->GetRoutingID(), |
1126 webview_info)); | 1126 web_view_info)); |
1127 } | 1127 } |
1128 | 1128 |
1129 // static | 1129 // static |
1130 void WebViewGuest::RemoveWebViewFromExtensionRendererState( | 1130 void WebViewGuest::RemoveWebViewFromExtensionRendererState( |
1131 WebContents* web_contents) { | 1131 WebContents* web_contents) { |
1132 content::BrowserThread::PostTask( | 1132 content::BrowserThread::PostTask( |
1133 content::BrowserThread::IO, FROM_HERE, | 1133 content::BrowserThread::IO, FROM_HERE, |
1134 base::Bind( | 1134 base::Bind( |
1135 &ExtensionRendererState::RemoveWebView, | 1135 &ExtensionRendererState::RemoveWebView, |
1136 base::Unretained(ExtensionRendererState::GetInstance()), | 1136 base::Unretained(ExtensionRendererState::GetInstance()), |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 bool allow, | 1591 bool allow, |
1592 const std::string& user_input) { | 1592 const std::string& user_input) { |
1593 WebViewGuest* guest = | 1593 WebViewGuest* guest = |
1594 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); | 1594 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); |
1595 if (!guest) | 1595 if (!guest) |
1596 return; | 1596 return; |
1597 | 1597 |
1598 if (!allow) | 1598 if (!allow) |
1599 guest->Destroy(); | 1599 guest->Destroy(); |
1600 } | 1600 } |
OLD | NEW |