| OLD | NEW |
| 1 # High-level overview of Save-Page-As code | 1 # High-level overview of Save-Page-As code |
| 2 | 2 |
| 3 This document describes code under `//content/browser/downloads` | 3 This document describes code under `//content/browser/downloads` |
| 4 restricting the scope only to code handling Save-Page-As functionality | 4 restricting the scope only to code handling Save-Page-As functionality |
| 5 (i.e. leaving out other downloads-related code). | 5 (i.e. leaving out other downloads-related code). |
| 6 This document focuses on high-level overview and aspects of the code that | 6 This document focuses on high-level overview and aspects of the code that |
| 7 span multiple compilation units (hoping that individual compilation units | 7 span multiple compilation units (hoping that individual compilation units |
| 8 are described by their code comments or by their code structure). | 8 are described by their code comments or by their code structure). |
| 9 | 9 |
| 10 ## Classes overview | 10 ## Classes overview |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 ### MHTML | 82 ### MHTML |
| 83 | 83 |
| 84 Very high-level flow of saving a page as MHTML: | 84 Very high-level flow of saving a page as MHTML: |
| 85 | 85 |
| 86 * Step 1: `WebContents::GenerateMHTML` is called by either `SavePackage` (for | 86 * Step 1: `WebContents::GenerateMHTML` is called by either `SavePackage` (for |
| 87 Save-Page-As UI) or Extensions (via `chrome.pageCapture` extensions | 87 Save-Page-As UI) or Extensions (via `chrome.pageCapture` extensions |
| 88 API) or by an embedder of `WebContents` (since this is public API of | 88 API) or by an embedder of `WebContents` (since this is public API of |
| 89 //content). | 89 //content). |
| 90 | 90 |
| 91 * Step 2: `MHTMLGenerationManager` coordinates generation of the MHTML file | 91 * Step 2: `MHTMLGenerationManager` creates a new instance of |
| 92 by sequentially (one-at-a-time) asking each frame to write its portion | 92 `MHTMLGenerationManager::Job` that coordinates generation of |
| 93 of MHTML to a file handle. Other classes (i.e. `SavePackage` and/or | 93 the MHTML file by sequentially (one-at-a-time) asking each |
| 94 `SaveFileManager`) are not used at this step at all. | 94 frame to write its portion of MHTML to a file handle. Other |
| 95 classes (i.e. `SavePackage` and/or `SaveFileManager`) are not |
| 96 used at this step at all. |
| 95 | 97 |
| 96 * Step 3: When done `MHTMLGenerationManager` calls a completion callback | 98 * Step 3: When done `MHTMLGenerationManager` destroys |
| 97 which in case of Save-Page-As will end up in | 99 `MHTMLGenerationManager::Job` instance and calls a completion |
| 100 callback which in case of Save-Page-As will end up in |
| 98 `SavePackage::OnMHTMLGenerated`. | 101 `SavePackage::OnMHTMLGenerated`. |
| 99 | 102 |
| 100 Note: MHTML format is by default disabled in Save-Page-As UI on Windows, MacOS | 103 Note: MHTML format is by default disabled in Save-Page-As UI on Windows, MacOS |
| 101 and Linux (it is the default on ChromeOS), but for testing this can be easily | 104 and Linux (it is the default on ChromeOS), but for testing this can be easily |
| 102 changed using `--save-page-as-mhtml` command line switch. | 105 changed using `--save-page-as-mhtml` command line switch. |
| 103 | 106 |
| 104 | 107 |
| 105 ### HTML Only | 108 ### HTML Only |
| 106 | 109 |
| 107 Very high-level flow of saving a page as "HTML Only": | 110 Very high-level flow of saving a page as "HTML Only": |
| (...skipping 20 matching lines...) Expand all Loading... |
| 128 | 131 |
| 129 * Blink: | 132 * Blink: |
| 130 * `//third_party/WebKit/public/web/WebFrameSerializer...` | 133 * `//third_party/WebKit/public/web/WebFrameSerializer...` |
| 131 * `//third_party/WebKit/Source/web/WebFrameSerializerImpl...` | 134 * `//third_party/WebKit/Source/web/WebFrameSerializerImpl...` |
| 132 (used for Complete HTML today; should use `FrameSerializer` instead in | 135 (used for Complete HTML today; should use `FrameSerializer` instead in |
| 133 the long-term - see https://crbug.com/328354). | 136 the long-term - see https://crbug.com/328354). |
| 134 * `//third_party/WebKit/Source/core/frame/FrameSerializer...` | 137 * `//third_party/WebKit/Source/core/frame/FrameSerializer...` |
| 135 (used for MHTML today) | 138 (used for MHTML today) |
| 136 * `//third_party/WebKit/Source/platform/mhtml/MHTMLArchive...` | 139 * `//third_party/WebKit/Source/platform/mhtml/MHTMLArchive...` |
| 137 | 140 |
| OLD | NEW |