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

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h

Issue 2579343002: [Offline Pages] Make new archives have random file names. (Closed)
Patch Set: Remove unnecessary includes Created 3 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_MHTML_ARCHIVER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_MHTML_ARCHIVER_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_MHTML_ARCHIVER_H_ 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_MHTML_ARCHIVER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 24 matching lines...) Expand all
35 // void SavePageOffline(content::WebContents* web_contents) { 35 // void SavePageOffline(content::WebContents* web_contents) {
36 // const GURL& url = web_contents->GetLastCommittedURL(); 36 // const GURL& url = web_contents->GetLastCommittedURL();
37 // std::unique_ptr<OfflinePageMHTMLArchiver> archiver( 37 // std::unique_ptr<OfflinePageMHTMLArchiver> archiver(
38 // new OfflinePageMHTMLArchiver( 38 // new OfflinePageMHTMLArchiver(
39 // web_contents, archive_dir)); 39 // web_contents, archive_dir));
40 // // Callback is of type OfflinePageModel::SavePageCallback. 40 // // Callback is of type OfflinePageModel::SavePageCallback.
41 // model->SavePage(url, std::move(archiver), callback); 41 // model->SavePage(url, std::move(archiver), callback);
42 // } 42 // }
43 class OfflinePageMHTMLArchiver : public OfflinePageArchiver { 43 class OfflinePageMHTMLArchiver : public OfflinePageArchiver {
44 public: 44 public:
45 // Returns the extension name of the offline page file.
46 static std::string GetFileNameExtension();
47 // Creates a file name for the archive file based on url and title. Public for
48 // testing.
49 static base::FilePath GenerateFileName(const GURL& url,
50 const std::string& title,
51 int64_t archive_id);
52 45
53 explicit OfflinePageMHTMLArchiver(content::WebContents* web_contents); 46 explicit OfflinePageMHTMLArchiver(content::WebContents* web_contents);
54 ~OfflinePageMHTMLArchiver() override; 47 ~OfflinePageMHTMLArchiver() override;
55 48
56 // OfflinePageArchiver implementation: 49 // OfflinePageArchiver implementation:
57 void CreateArchive(const base::FilePath& archives_dir, 50 void CreateArchive(const base::FilePath& archives_dir,
58 int64_t archive_id, 51 int64_t archive_id,
59 const CreateArchiveCallback& callback) override; 52 const CreateArchiveCallback& callback) override;
60 53
61 protected: 54 protected:
(...skipping 26 matching lines...) Expand all
88 CreateArchiveCallback callback_; 81 CreateArchiveCallback callback_;
89 82
90 base::WeakPtrFactory<OfflinePageMHTMLArchiver> weak_ptr_factory_; 83 base::WeakPtrFactory<OfflinePageMHTMLArchiver> weak_ptr_factory_;
91 84
92 DISALLOW_COPY_AND_ASSIGN(OfflinePageMHTMLArchiver); 85 DISALLOW_COPY_AND_ASSIGN(OfflinePageMHTMLArchiver);
93 }; 86 };
94 87
95 } // namespace offline_pages 88 } // namespace offline_pages
96 89
97 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_MHTML_ARCHIVER_H_ 90 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_MHTML_ARCHIVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_mhtml_archiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698