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 <[email protected]> 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 <[email protected]>wrote: > >> On Tue, Sep 15, 2009 at 7:31 PM, Mohamed Mansour >> <[email protected]> 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: [email protected] View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~----------~----~----~----~------~----~------~--~---
