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/mime_handler_view/mime_handler_view_gues t.h" | 5 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/host_zoom_map.h" | |
9 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
10 #include "content/public/browser/stream_handle.h" | 11 #include "content/public/browser/stream_handle.h" |
11 #include "content/public/browser/stream_info.h" | 12 #include "content/public/browser/stream_info.h" |
12 #include "content/public/common/service_registry.h" | 13 #include "content/public/common/service_registry.h" |
13 #include "content/public/common/url_constants.h" | 14 #include "content/public/common/url_constants.h" |
14 #include "extensions/browser/api/extensions_api_client.h" | 15 #include "extensions/browser/api/extensions_api_client.h" |
15 #include "extensions/browser/api/mime_handler_private/mime_handler_private.h" | 16 #include "extensions/browser/api/mime_handler_private/mime_handler_private.h" |
16 #include "extensions/browser/extension_registry.h" | 17 #include "extensions/browser/extension_registry.h" |
17 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_stream_ma nager.h" | 18 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_stream_ma nager.h" |
18 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_cons tants.h" | 19 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_cons tants.h" |
19 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t_delegate.h" | 20 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t_delegate.h" |
20 #include "extensions/browser/process_manager.h" | 21 #include "extensions/browser/process_manager.h" |
22 #include "extensions/common/constants.h" | |
21 #include "extensions/common/extension_messages.h" | 23 #include "extensions/common/extension_messages.h" |
22 #include "extensions/common/guest_view/guest_view_constants.h" | 24 #include "extensions/common/guest_view/guest_view_constants.h" |
23 #include "extensions/strings/grit/extensions_strings.h" | 25 #include "extensions/strings/grit/extensions_strings.h" |
24 #include "ipc/ipc_message_macros.h" | 26 #include "ipc/ipc_message_macros.h" |
25 #include "net/base/url_util.h" | 27 #include "net/base/url_util.h" |
26 | 28 |
27 using content::WebContents; | 29 using content::WebContents; |
28 | 30 |
29 namespace extensions { | 31 namespace extensions { |
30 | 32 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 LOG(ERROR) << "Extension for mime_type not found, mime_type = " | 120 LOG(ERROR) << "Extension for mime_type not found, mime_type = " |
119 << stream_->stream_info()->mime_type; | 121 << stream_->stream_info()->mime_type; |
120 callback.Run(nullptr); | 122 callback.Run(nullptr); |
121 return; | 123 return; |
122 } | 124 } |
123 | 125 |
124 // Use the mime handler extension's SiteInstance to create the guest so it | 126 // Use the mime handler extension's SiteInstance to create the guest so it |
125 // goes under the same process as the extension. | 127 // goes under the same process as the extension. |
126 ProcessManager* process_manager = ProcessManager::Get(browser_context()); | 128 ProcessManager* process_manager = ProcessManager::Get(browser_context()); |
127 content::SiteInstance* guest_site_instance = | 129 content::SiteInstance* guest_site_instance = |
128 process_manager->GetSiteInstanceForURL( | 130 process_manager->GetSiteInstanceForURL(stream_->handler_url()); |
129 Extension::GetBaseURLFromExtensionId(GetOwnerSiteURL().host())); | 131 |
132 content::HostZoomMap::Get(guest_site_instance) | |
raymes
2015/01/28 00:39:28
Could you add a comment about why we disable zoom
Sam McNally
2015/01/28 01:35:15
Done.
| |
133 ->SetZoomLevelForHostAndScheme(kExtensionScheme, stream_->extension_id(), | |
134 0); | |
130 | 135 |
131 WebContents::CreateParams params(browser_context(), guest_site_instance); | 136 WebContents::CreateParams params(browser_context(), guest_site_instance); |
132 params.guest_delegate = this; | 137 params.guest_delegate = this; |
133 callback.Run(WebContents::Create(params)); | 138 callback.Run(WebContents::Create(params)); |
134 } | 139 } |
135 | 140 |
136 void MimeHandlerViewGuest::DidAttachToEmbedder() { | 141 void MimeHandlerViewGuest::DidAttachToEmbedder() { |
137 web_contents()->GetController().LoadURL( | 142 web_contents()->GetController().LoadURL( |
138 stream_->handler_url(), content::Referrer(), | 143 stream_->handler_url(), content::Referrer(), |
139 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); | 144 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 | 233 |
229 void MimeHandlerViewGuest::OnRequest( | 234 void MimeHandlerViewGuest::OnRequest( |
230 const ExtensionHostMsg_Request_Params& params) { | 235 const ExtensionHostMsg_Request_Params& params) { |
231 if (extension_function_dispatcher_) { | 236 if (extension_function_dispatcher_) { |
232 extension_function_dispatcher_->Dispatch( | 237 extension_function_dispatcher_->Dispatch( |
233 params, web_contents()->GetRenderViewHost()); | 238 params, web_contents()->GetRenderViewHost()); |
234 } | 239 } |
235 } | 240 } |
236 | 241 |
237 } // namespace extensions | 242 } // namespace extensions |
OLD | NEW |