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

Side by Side Diff: content/browser/download/mhtml_generation_manager.h

Issue 1417323006: OOPIFs: Deduplicating MHTML parts across frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mhtml-serialization-per-frame
Patch Set: Rebasing... Created 5 years 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_
6 #define CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set>
9 #include <string> 10 #include <string>
10 11
11 #include "base/files/file.h" 12 #include "base/files/file.h"
12 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
13 #include "base/process/process.h" 14 #include "base/process/process.h"
14 #include "ipc/ipc_platform_file.h" 15 #include "ipc/ipc_platform_file.h"
15 16
17 class GURL;
ncarter (slow) 2015/12/04 21:52:39 You can't use forward declaration here; std::set<F
Łukasz Anforowicz 2015/12/04 22:55:43 I thought that this is ok, because I don't need a
18
16 namespace base { 19 namespace base {
17 class FilePath; 20 class FilePath;
18 } 21 }
19 22
20 namespace content { 23 namespace content {
21 24
22 class WebContents; 25 class WebContents;
23 26
24 // The class and all of its members live on the UI thread. Only static methods 27 // The class and all of its members live on the UI thread. Only static methods
25 // are executed on other threads. 28 // are executed on other threads.
26 class MHTMLGenerationManager { 29 class MHTMLGenerationManager {
27 public: 30 public:
28 static MHTMLGenerationManager* GetInstance(); 31 static MHTMLGenerationManager* GetInstance();
29 32
30 // GenerateMHTMLCallback is called to report completion and status of MHTML 33 // GenerateMHTMLCallback is called to report completion and status of MHTML
31 // generation. On success |file_size| indicates the size of the 34 // generation. On success |file_size| indicates the size of the
32 // generated file. On failure |file_size| is -1. 35 // generated file. On failure |file_size| is -1.
33 typedef base::Callback<void(int64 file_size)> GenerateMHTMLCallback; 36 typedef base::Callback<void(int64 file_size)> GenerateMHTMLCallback;
34 37
35 // Instructs the render view to generate a MHTML representation of the current 38 // Instructs the render view to generate a MHTML representation of the current
36 // page for |web_contents|. 39 // page for |web_contents|.
37 void SaveMHTML(WebContents* web_contents, 40 void SaveMHTML(WebContents* web_contents,
38 const base::FilePath& file_path, 41 const base::FilePath& file_path,
39 const GenerateMHTMLCallback& callback); 42 const GenerateMHTMLCallback& callback);
40 43
41 // Handler for ViewHostMsg_SavedPageAsMHTML (a notification from the renderer 44 // Handler for ViewHostMsg_SavedPageAsMHTML (a notification from the renderer
42 // that the MHTML generation finished). 45 // that the MHTML generation finished).
43 void OnSavedPageAsMHTML(int job_id, 46 void OnSavedPageAsMHTML(int job_id,
44 bool mhtml_generation_in_renderer_succeeded, 47 bool mhtml_generation_in_renderer_succeeded,
45 const std::string& mhtml_boundary_marker); 48 const std::string& mhtml_boundary_marker,
49 const std::set<GURL>& uris_of_generated_mhtml_parts);
46 50
47 private: 51 private:
48 friend struct base::DefaultSingletonTraits<MHTMLGenerationManager>; 52 friend struct base::DefaultSingletonTraits<MHTMLGenerationManager>;
49 class Job; 53 class Job;
50 enum class JobStatus { SUCCESS, FAILURE }; 54 enum class JobStatus { SUCCESS, FAILURE };
51 55
52 MHTMLGenerationManager(); 56 MHTMLGenerationManager();
53 virtual ~MHTMLGenerationManager(); 57 virtual ~MHTMLGenerationManager();
54 58
55 // Called on the file thread to create |file|. 59 // Called on the file thread to create |file|.
(...skipping 22 matching lines...) Expand all
78 IDToJobMap id_to_job_; 82 IDToJobMap id_to_job_;
79 83
80 int next_job_id_; 84 int next_job_id_;
81 85
82 DISALLOW_COPY_AND_ASSIGN(MHTMLGenerationManager); 86 DISALLOW_COPY_AND_ASSIGN(MHTMLGenerationManager);
83 }; 87 };
84 88
85 } // namespace content 89 } // namespace content
86 90
87 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ 91 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698