view_id=>stream_id and add some code comments.
This commit is contained in:
parent
e90fd1444f
commit
3aba23b471
8 changed files with 37 additions and 27 deletions
|
@ -23,6 +23,8 @@ namespace atom {
|
|||
|
||||
namespace {
|
||||
|
||||
// Extracts the path value from the URL without the leading '/',
|
||||
// which follows the mapping of names in pdf_viewer_resources_map.
|
||||
std::string PathWithoutParams(const std::string& path) {
|
||||
return GURL(kPdfViewerUIOrigin + path).path().substr(1);
|
||||
}
|
||||
|
@ -86,14 +88,14 @@ class BundledDataSource : public content::URLDataSource {
|
|||
|
||||
PdfViewerUI::PdfViewerUI(content::BrowserContext* browser_context,
|
||||
content::WebUI* web_ui,
|
||||
const std::string& view_id,
|
||||
const std::string& stream_id,
|
||||
const std::string& src)
|
||||
: content::WebUIController(web_ui),
|
||||
content::WebContentsObserver(web_ui->GetWebContents()),
|
||||
src_(src) {
|
||||
auto context = static_cast<AtomBrowserContext*>(browser_context);
|
||||
auto stream_manager = context->stream_manager();
|
||||
stream_ = stream_manager->ReleaseStream(view_id);
|
||||
stream_ = stream_manager->ReleaseStream(stream_id);
|
||||
web_ui->AddMessageHandler(new PdfViewerHandler(stream_.get(), src));
|
||||
content::URLDataSource::Add(browser_context, new BundledDataSource);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue