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

Side by Side Diff: content/browser/download/docs/save-page-as.md

Issue 2075273002: Resource requests from Save-Page-As should go through CanRequestURL checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace MarkAsUnauthorized with constructor argument. Created 4 years, 4 months 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 # 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
11 11
12 * SavePackage class 12 * SavePackage class
13 * coordinates overall save-page-as request 13 * coordinates overall save-page-as request
14 * created and owned by `WebContents` 14 * created and owned by `WebContents`
15 (ref-counted today, but it is unnecessary - see https://crbug.com/596953) 15 (ref-counted today, but it is unnecessary - see https://crbug.com/596953)
16 * UI-thread object 16 * UI-thread object
17 17
18 * SaveFileCreateInfo::SaveFileSource enum 18 * SaveFileCreateInfo::SaveFileSource enum
19 * classifies `SaveItem` and `SaveFile` processing into 3 flavours: 19 * classifies `SaveItem` and `SaveFile` processing into 2 flavours:
20 * `SAVE_FILE_FROM_NET` (see `SaveFileResourceHandler`) 20 * `SAVE_FILE_FROM_NET` (see `SaveFileResourceHandler`)
21 * `SAVE_FILE_FROM_DOM` (see "Complete HTML" section below) 21 * `SAVE_FILE_FROM_DOM` (see "Complete HTML" section below)
22 * `SAVE_FILE_FROM_FILE` (see `SaveFileManager::SaveLocalFile`)
23 22
24 * SaveItem class 23 * SaveItem class
25 * tracks saving a single file 24 * tracks saving a single file
26 * created and owned by `SavePackage` 25 * created and owned by `SavePackage`
27 * UI-thread object 26 * UI-thread object
28 27
29 * SaveFileManager class 28 * SaveFileManager class
30 * coordinates between FILE and UI threads 29 * coordinates between FILE and UI threads
31 * Gets requests from `SavePackage` and communicates results back to 30 * Gets requests from `SavePackage` and communicates results back to
32 `SavePackage` on the UI thread. 31 `SavePackage` on the UI thread.
(...skipping 28 matching lines...) Expand all
61 The flow is different depending on the save format chosen by the user 60 The flow is different depending on the save format chosen by the user
62 (each flow is described in a separate section below). 61 (each flow is described in a separate section below).
63 62
64 ### Complete HTML 63 ### Complete HTML
65 64
66 Very high-level flow of saving a page as "Complete HTML": 65 Very high-level flow of saving a page as "Complete HTML":
67 66
68 * Step 1: `SavePackage` asks all frames for "savable resources" 67 * Step 1: `SavePackage` asks all frames for "savable resources"
69 and creates `SaveItem` for each of files that need to be saved 68 and creates `SaveItem` for each of files that need to be saved
70 69
71 * Step 2: `SavePackage` first processes `SAVE_FILE_FROM_NET` and 70 * Step 2: `SavePackage` first processes `SAVE_FILE_FROM_NET`
72 `SAVE_FILE_FROM_FILE` `SaveItem`s and asks `SaveFileManager` to save 71 `SaveItem`s and asks `SaveFileManager` to save
73 them. 72 them.
74 73
75 * Step 3: `SavePackage` handles remaining `SAVE_FILE_FROM_DOM` `SaveItem`s and 74 * Step 3: `SavePackage` handles remaining `SAVE_FILE_FROM_DOM` `SaveItem`s and
76 asks each frame to serialize its DOM/HTML (each frame gets from 75 asks each frame to serialize its DOM/HTML (each frame gets from
77 `SavePackage` a map covering local paths that need to be referenced by 76 `SavePackage` a map covering local paths that need to be referenced by
78 the frame). Responses from frames get forwarded to `SaveFileManager` 77 the frame). Responses from frames get forwarded to `SaveFileManager`
79 to be written to disk. 78 to be written to disk.
80 79
81 80
82 ### MHTML 81 ### MHTML
(...skipping 19 matching lines...) Expand all
102 101
103 Note: MHTML format is by default disabled in Save-Page-As UI on Windows, MacOS 102 Note: MHTML format is by default disabled in Save-Page-As UI on Windows, MacOS
104 and Linux (it is the default on ChromeOS), but for testing this can be easily 103 and Linux (it is the default on ChromeOS), but for testing this can be easily
105 changed using `--save-page-as-mhtml` command line switch. 104 changed using `--save-page-as-mhtml` command line switch.
106 105
107 106
108 ### HTML Only 107 ### HTML Only
109 108
110 Very high-level flow of saving a page as "HTML Only": 109 Very high-level flow of saving a page as "HTML Only":
111 110
112 * `SavePackage` creates only a single `SaveItem` (either `SAVE_FILE_FROM_NET` or 111 * `SavePackage` creates only a single `SaveItem` (always `SAVE_FILE_FROM_NET`)
113 `SAVE_FILE_FROM_FILE`) and asks `SaveFileManager` to process it 112 and asks `SaveFileManager` to process it
114 (as in the Complete HTML individual SaveItem handling above.). 113 (as in the Complete HTML individual SaveItem handling above.).
115 114
116 115
117 ## Other relevant code 116 ## Other relevant code
118 117
119 Pointers to related code outside of `//content/browser/download`: 118 Pointers to related code outside of `//content/browser/download`:
120 119
121 * End-to-end tests: 120 * End-to-end tests:
122 * `//chrome/browser/downloads/save_page_browsertest.cc` 121 * `//chrome/browser/downloads/save_page_browsertest.cc`
123 * `//chrome/test/data/save_page/...` 122 * `//chrome/test/data/save_page/...`
124 123
125 * Other tests: 124 * Other tests:
126 * `//content/browser/downloads/*test*.cc` 125 * `//content/browser/downloads/*test*.cc`
127 * `//content/renderer/dom_serializer_browsertest.cc` - single process... :-/ 126 * `//content/renderer/dom_serializer_browsertest.cc` - single process... :-/
128 127
129 * Elsewhere in `//content`: 128 * Elsewhere in `//content`:
130 * `//content/renderer/savable_resources...` 129 * `//content/renderer/savable_resources...`
131 130
132 * Blink: 131 * Blink:
133 * `//third_party/WebKit/public/web/WebFrameSerializer...` 132 * `//third_party/WebKit/public/web/WebFrameSerializer...`
134 * `//third_party/WebKit/Source/web/WebFrameSerializerImpl...` 133 * `//third_party/WebKit/Source/web/WebFrameSerializerImpl...`
135 (used for Complete HTML today; should use `FrameSerializer` instead in 134 (used for Complete HTML today; should use `FrameSerializer` instead in
136 the long-term - see https://crbug.com/328354). 135 the long-term - see https://crbug.com/328354).
137 * `//third_party/WebKit/Source/core/frame/FrameSerializer...` 136 * `//third_party/WebKit/Source/core/frame/FrameSerializer...`
138 (used for MHTML today) 137 (used for MHTML today)
139 * `//third_party/WebKit/Source/platform/mhtml/MHTMLArchive...` 138 * `//third_party/WebKit/Source/platform/mhtml/MHTMLArchive...`
140 139
OLDNEW
« no previous file with comments | « chrome/test/data/save_page/unauthorized-access.htm ('k') | content/browser/download/save_file_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698