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

Unified Diff: components/offline_pages/offline_page_archiver.h

Issue 1174803002: [Offline] Adding archiver interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@offline-pages-store
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/offline_pages/BUILD.gn ('k') | components/offline_pages/offline_page_archiver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/offline_page_archiver.h
diff --git a/components/offline_pages/offline_page_archiver.h b/components/offline_pages/offline_page_archiver.h
new file mode 100644
index 0000000000000000000000000000000000000000..ef173381fe370ee0f8b8083e1afe77fcda2e841d
--- /dev/null
+++ b/components/offline_pages/offline_page_archiver.h
@@ -0,0 +1,54 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_ARCHIVER_H_
+#define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_ARCHIVER_H_
+
+#include "base/files/file_path.h"
+#include "url/gurl.h"
+
+namespace offline_pages {
+
+// Interface of a class responsible for creation of the archive for offline use.
+class OfflinePageArchiver {
+ public:
+ // Represents an in progress request to archive a page.
+ struct Request {
+ public:
+ explicit Request(const GURL& url);
+ ~Request();
+ GURL url;
+ };
+
+ // Interface of the clients that requests to archive pages.
+ class Client {
+ public:
+ virtual ~Client();
+
+ // Callback called by the archiver upon successful creation of the archive.
+ virtual void OnCreateArchiveSuccess(const Request& request,
+ const base::FilePath& file_path) = 0;
+ // Callback called by the archiver when it fails to create the archive.
+ virtual void OnCreateArchiveFailure(const Request& request) = 0;
Dmitry Titov 2015/06/11 18:35:32 What about returning some sort of error? I'm think
fgorski 2015/06/11 23:30:02 Done.
+
+ protected:
+ Client();
+ };
+
+ OfflinePageArchiver();
+ virtual ~OfflinePageArchiver();
+
+ // Starts creating the archive. Will pass result by calling methods on the
+ // passed in client.
Dmitry Titov 2015/06/11 18:35:32 It is a good place to add comment about 'suggested
fgorski 2015/06/11 23:30:02 Dropped the parameter per offline discussion.
+ virtual Request CreateArchive(
Dmitry Titov 2015/06/11 18:35:32 I think you want to return a pointer or ref to Req
fgorski 2015/06/11 23:30:02 Done.
+ const GURL& url,
+ const std::string& suggested_file_name,
+ Client* client) = 0;
+ // Cancels an in progress request to archive a page.
+ virtual void CancelRequest(const Request& request) = 0;
+};
+
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_ARCHIVER_H_
« no previous file with comments | « components/offline_pages/BUILD.gn ('k') | components/offline_pages/offline_page_archiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698