Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc

Issue 1432143002: Track where WebContents are created in order to better understand issue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/guest_view/common/guest_view_constants.h" 8 #include "components/guest_view/common/guest_view_constants.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/host_zoom_map.h" 10 #include "content/public/browser/host_zoom_map.h"
11 #include "content/public/browser/navigation_entry.h" 11 #include "content/public/browser/navigation_entry.h"
12 #include "content/public/browser/render_process_host.h" 12 #include "content/public/browser/render_process_host.h"
13 #include "content/public/browser/stream_handle.h" 13 #include "content/public/browser/stream_handle.h"
14 #include "content/public/browser/stream_info.h" 14 #include "content/public/browser/stream_info.h"
15 #include "content/public/browser/web_contents_source.h"
15 #include "content/public/common/service_registry.h" 16 #include "content/public/common/service_registry.h"
16 #include "content/public/common/url_constants.h" 17 #include "content/public/common/url_constants.h"
17 #include "extensions/browser/api/extensions_api_client.h" 18 #include "extensions/browser/api/extensions_api_client.h"
18 #include "extensions/browser/api/mime_handler_private/mime_handler_private.h" 19 #include "extensions/browser/api/mime_handler_private/mime_handler_private.h"
19 #include "extensions/browser/extension_registry.h" 20 #include "extensions/browser/extension_registry.h"
20 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_stream_ma nager.h" 21 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_stream_ma nager.h"
21 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_cons tants.h" 22 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_cons tants.h"
22 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t_delegate.h" 23 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t_delegate.h"
23 #include "extensions/browser/process_manager.h" 24 #include "extensions/browser/process_manager.h"
24 #include "extensions/common/constants.h" 25 #include "extensions/common/constants.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // responsible for managing its own zoom. This is necessary for OOP PDF, as 126 // responsible for managing its own zoom. This is necessary for OOP PDF, as
126 // otherwise the UI is zoomed and the calculations to determine the PDF size 127 // otherwise the UI is zoomed and the calculations to determine the PDF size
127 // mix zoomed and unzoomed units. 128 // mix zoomed and unzoomed units.
128 content::HostZoomMap::Get(guest_site_instance.get()) 129 content::HostZoomMap::Get(guest_site_instance.get())
129 ->SetZoomLevelForHostAndScheme(kExtensionScheme, stream_->extension_id(), 130 ->SetZoomLevelForHostAndScheme(kExtensionScheme, stream_->extension_id(),
130 0); 131 0);
131 132
132 WebContents::CreateParams params(browser_context(), 133 WebContents::CreateParams params(browser_context(),
133 guest_site_instance.get()); 134 guest_site_instance.get());
134 params.guest_delegate = this; 135 params.guest_delegate = this;
135 callback.Run(WebContents::Create(params)); 136 WebContents* web_contents = WebContents::Create(params);
137 WebContentsSource::CreateForWebContentsAndLocation(web_contents, FROM_HERE);
138 callback.Run(web_contents);
136 } 139 }
137 140
138 void MimeHandlerViewGuest::DidAttachToEmbedder() { 141 void MimeHandlerViewGuest::DidAttachToEmbedder() {
139 web_contents()->GetController().LoadURL( 142 web_contents()->GetController().LoadURL(
140 stream_->handler_url(), content::Referrer(), 143 stream_->handler_url(), content::Referrer(),
141 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); 144 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string());
142 web_contents()->GetMainFrame()->GetServiceRegistry()->AddService( 145 web_contents()->GetMainFrame()->GetServiceRegistry()->AddService(
143 base::Bind(&MimeHandlerServiceImpl::Create, stream_->GetWeakPtr())); 146 base::Bind(&MimeHandlerServiceImpl::Create, stream_->GetWeakPtr()));
144 } 147 }
145 148
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 element_instance_id())); 233 element_instance_id()));
231 } 234 }
232 235
233 base::WeakPtr<StreamContainer> MimeHandlerViewGuest::GetStream() const { 236 base::WeakPtr<StreamContainer> MimeHandlerViewGuest::GetStream() const {
234 if (!stream_) 237 if (!stream_)
235 return base::WeakPtr<StreamContainer>(); 238 return base::WeakPtr<StreamContainer>();
236 return stream_->GetWeakPtr(); 239 return stream_->GetWeakPtr();
237 } 240 }
238 241
239 } // namespace extensions 242 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698