[chromium-dev] Re: Need help on how to send data from RenderView to a custom DOMUI instantly
Here is a brute force way I think would *work*, but I'm not sure it's the right thing to do. Do we send big images across IPC anywhere currently? I think we send small stuff like favicons... So don't try this at home unless others say it isn't crazy, or you just want a proof of concept :) Creating your special DOMUI would happen shortly after handling the context menu click, so you can register a ChromeURLDataManager::DataSource for the print preview html at that time, before the request is sent to the RenderView to load the print:// URL. Some time after that your code to generate the image snapshot in the RenderView will get triggered, and a resource request will be issued to the browser process for the HTTP GET. So your image code could send the bitmap across, and the DOMUI in the associated TabContents would just sit tight until it received it. It would have to then send it to the data source or wait for the data source to ask for it, FileIconSource does something like this with HistoryBackend. The data source would respond asynchronously with the full HTML (e.g SendResponse) once it has received the image data and stuffed it into the html template. It feels convoluted to send the image through all these hoops though only to send it back down to the renderer though. I'm not sure what kind of hooks we'd need on the renderer side to avoid it.. we intercept for some about: urls and we have the alt error page fetcher, but I'm not sure how to go about generating the print preview html at the renderer entirely. On Tue, Sep 15, 2009 at 9:21 PM, Mohamed Mansour m...@chromium.org wrote: The UI is going to be in JavaScript with callbacks from the DOMUI page same as NTP, Downloads, History, etc... Therefore in render_view.cc, I need to replace the WebFrame with the DOMUI (I think). I don't want to introduce my own set of methods that exposes this, that is why I am asking for some thoughts, on the right approach. How do you recommend making print preview to work? The UI team's mockup was visioning a domui that handles the print preview/settings. Should we open a new tab for print preview, or should we use the same tab? In either case, how can I pass data, in particular the Bitmap image that is created in RenderView to the DOMUI page so I can view it. Any help is appreciated. - Mohamed On Wed, Sep 16, 2009 at 12:06 AM, Brett Wilson bre...@chromium.orgwrote: On Tue, Sep 15, 2009 at 7:31 PM, Mohamed Mansour m0.interact...@gmail.com wrote: Hi all, I am having trouble trying to figure out how I could replace the contents of a specific WebFrame while I am in RenderView with a custom DOMUI page that I have created. Here is a scenario: User visits http://www.google.com User waits till page is done loading User selects Options Print Preview The current page will be replaced with a custom PrintPreview DOMUI page (print:http://www.google.com) where I would be passing some Data such as a vector of bytes (image) from RenderView to PrintPreviewDOMUI I have created the DOMUI page and made sure it works, and created the bitmap and encoded it with JPEGEncoder, but I am clueless on how the connection would be from RenderView to DOMUI. Any assistance is appreciated. The reason why I want to replace the current contents is because print preview depends on what is exactly visible at that time. Unless there is a better way. Thanks in advance! Is the code you're writing in C++ or JS? Brett --~--~-~--~~~---~--~~ Chromium Developers mailing list: chromium-dev@googlegroups.com View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~--~~~~--~~--~--~---
[chromium-dev] Re: Need help on how to send data from RenderView to a custom DOMUI instantly
Here is a brute force way I think would *work*, but I'm not sure it's the right thing to do. Do we send big images across IPC anywhere currently? We did briefly (to and from the extension unpacker process), but it was changed to using on-disk files because were limits on the amount of data that could be sent (1MB, I think). Matt Perry knows more. --~--~-~--~~~---~--~~ Chromium Developers mailing list: chromium-dev@googlegroups.com View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~--~~~~--~~--~--~---
[chromium-dev] Re: Need help on how to send data from RenderView to a custom DOMUI instantly
Step 4 is wrong, you don't replace in-place, you do a navigation, like view-source. Random idea; the page's could be duplicated in a hidden iframe with javascript disabled, greatly simplifying the code to generated the print preview pages jpg and making the DOM duplication a 100% javascript issue. I don't know if that can be safely done merely with javascript, that would be awesome. Only caveat, print preview would be disabled when javascript is disabled. We need to find a way to not make the printed pages preview jump to the browser, that would be (slightly) insane. M-A On Sep 15, 2009 10:32 PM, Mohamed Mansour m0.interact...@gmail.com wrote: Hi all, I am having trouble trying to figure out how I could replace the contents of a specific WebFrame while I am in RenderView with a custom DOMUI page that I have created. Here is a scenario: 1. User visits http://www.google.com 2. User waits till page is done loading 3. User selects Options Print Preview 4. The current page will be replaced with a custom PrintPreview DOMUI page (print:http://www.google.com) where I would be passing some Data such as a vector of bytes (image) from RenderView to PrintPreviewDOMUI I have created the DOMUI page and made sure it works, and created the bitmap and encoded it with JPEGEncoder, but I am clueless on how the connection would be from RenderView to DOMUI. Any assistance is appreciated. The reason why I want to replace the current contents is because print preview depends on what is exactly visible at that time. Unless there is a better way. Thanks in advance! - Mohamed Mansour --~--~-~--~~~---~--~~ Chromium Developers mailing list: chromium-dev@googlegroups.com View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~--~~~~--~~--~--~---
[chromium-dev] Re: Need help on how to send data from RenderView to a custom DOMUI instantly
On Tue, Sep 15, 2009 at 9:21 PM, Mohamed Mansour m...@chromium.org wrote: The UI is going to be in JavaScript with callbacks from the DOMUI page same as NTP, Downloads, History, etc... Therefore in render_view.cc, I need to replace the WebFrame with the DOMUI (I think). I don't want to introduce my own set of methods that exposes this, that is why I am asking for some thoughts, on the right approach. There are many layers here, and you have to be careful you're at the right one. Because we wanted to prevent mistakes allowing web content access to privileged browser data (unless something's changed since I last worked on it) you have to use an entirely new renderering process for DOMUI. WebFrame is down within a given renderer, while DOMUI is a browser-level abstraction above the IPC layer. You can have a DOMUI within the same tab, of course (that's how you can click links from the new tab page). If you really want to show the original page, you'll have to do something either tricky or sneaky. M-A's idea is good. Another idea is to add more goop at the UI level to allow a tab to display a DOMUI toolbar (with the print button etc.) while still showing the original page below the toolbar. Like a frame, but done at a higher level so the page can't bust out of its frame. If instead you just want to display an image of the page, previewed, that's easier. Grab the snapshot when navigating away to your DOMUI; don't even tell the page you've navigated away (avoids all the do you want to save? dialogs etc.) and swap its renderer out entirely. To get the snapshot back in to your new DOMUI, the rest of what Tim wrote (aside from the part I just contradicted in the last sentence) about how to get images in is right. The way we load thumbnails into the NTP is a good resource; basically the page would have something like img src='whatever-the-internal-scheme-is://preview' and you'd hook up a data handler to serve the image data on that URL. You might run into some jankiness because of the way images are currently served (just as one huge string rather than incrementally loaded) but that is an optimization detail that can be worked on after you have it kinda working. --~--~-~--~~~---~--~~ Chromium Developers mailing list: chromium-dev@googlegroups.com View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~--~~~~--~~--~--~---
[chromium-dev] Re: Need help on how to send data from RenderView to a custom DOMUI instantly
On Tue, Sep 15, 2009 at 7:31 PM, Mohamed Mansour m0.interact...@gmail.com wrote: Hi all, I am having trouble trying to figure out how I could replace the contents of a specific WebFrame while I am in RenderView with a custom DOMUI page that I have created. Here is a scenario: User visits http://www.google.com User waits till page is done loading User selects Options Print Preview The current page will be replaced with a custom PrintPreview DOMUI page (print:http://www.google.com) where I would be passing some Data such as a vector of bytes (image) from RenderView to PrintPreviewDOMUI I have created the DOMUI page and made sure it works, and created the bitmap and encoded it with JPEGEncoder, but I am clueless on how the connection would be from RenderView to DOMUI. Any assistance is appreciated. The reason why I want to replace the current contents is because print preview depends on what is exactly visible at that time. Unless there is a better way. Thanks in advance! Is the code you're writing in C++ or JS? Brett --~--~-~--~~~---~--~~ Chromium Developers mailing list: chromium-dev@googlegroups.com View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~--~~~~--~~--~--~---
[chromium-dev] Re: Need help on how to send data from RenderView to a custom DOMUI instantly
The UI is going to be in JavaScript with callbacks from the DOMUI page same as NTP, Downloads, History, etc... Therefore in render_view.cc, I need to replace the WebFrame with the DOMUI (I think). I don't want to introduce my own set of methods that exposes this, that is why I am asking for some thoughts, on the right approach. How do you recommend making print preview to work? The UI team's mockup was visioning a domui that handles the print preview/settings. Should we open a new tab for print preview, or should we use the same tab? In either case, how can I pass data, in particular the Bitmap image that is created in RenderView to the DOMUI page so I can view it. Any help is appreciated. - Mohamed On Wed, Sep 16, 2009 at 12:06 AM, Brett Wilson bre...@chromium.org wrote: On Tue, Sep 15, 2009 at 7:31 PM, Mohamed Mansour m0.interact...@gmail.com wrote: Hi all, I am having trouble trying to figure out how I could replace the contents of a specific WebFrame while I am in RenderView with a custom DOMUI page that I have created. Here is a scenario: User visits http://www.google.com User waits till page is done loading User selects Options Print Preview The current page will be replaced with a custom PrintPreview DOMUI page (print:http://www.google.com) where I would be passing some Data such as a vector of bytes (image) from RenderView to PrintPreviewDOMUI I have created the DOMUI page and made sure it works, and created the bitmap and encoded it with JPEGEncoder, but I am clueless on how the connection would be from RenderView to DOMUI. Any assistance is appreciated. The reason why I want to replace the current contents is because print preview depends on what is exactly visible at that time. Unless there is a better way. Thanks in advance! Is the code you're writing in C++ or JS? Brett --~--~-~--~~~---~--~~ Chromium Developers mailing list: chromium-dev@googlegroups.com View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~--~~~~--~~--~--~---