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

Unified Diff: components/offline_pages/offline_page_types.h

Issue 1968563003: [Offline pages] Extracting callbacks from the Offline Page Model (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding a missing fix to gypi file Created 4 years, 7 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/offline_page_storage_manager_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/offline_page_types.h
diff --git a/components/offline_pages/offline_page_types.h b/components/offline_pages/offline_page_types.h
new file mode 100644
index 0000000000000000000000000000000000000000..c5a99ca9013fb2763509d6dd235c68a6cdcf3ccf
--- /dev/null
+++ b/components/offline_pages/offline_page_types.h
@@ -0,0 +1,84 @@
+// Copyright 2016 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_TYPES_H_
+#define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TYPES_H_
+
+#include <stdint.h>
+
+#include <set>
+#include <vector>
+
+#include "base/callback.h"
+#include "components/offline_pages/offline_page_item.h"
+
+class GURL;
+
+// This file contains common callbacks used by OfflinePageModel and is a
+// temporary step to refactor and interface of the model out of the
+// implementation.
+namespace offline_pages {
+// Result of saving a page offline.
+// A Java counterpart will be generated for this enum.
+// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.offlinepages
+enum class SavePageResult {
+ SUCCESS,
+ CANCELLED,
+ DEVICE_FULL,
+ CONTENT_UNAVAILABLE,
+ ARCHIVE_CREATION_FAILED,
+ STORE_FAILURE,
+ ALREADY_EXISTS,
+ // Certain pages, i.e. file URL or NTP, will not be saved because these
+ // are already locally accessible.
+ SKIPPED,
+ SECURITY_CERTIFICATE_ERROR,
+ // NOTE: always keep this entry at the end. Add new result types only
+ // immediately above this line. Make sure to update the corresponding
+ // histogram enum accordingly.
+ RESULT_COUNT,
+};
+
+// Result of deleting an offline page.
+// A Java counterpart will be generated for this enum.
+// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.offlinepages
+enum class DeletePageResult {
+ SUCCESS,
+ CANCELLED,
+ STORE_FAILURE,
+ DEVICE_FAILURE,
+ NOT_FOUND,
+ // NOTE: always keep this entry at the end. Add new result types only
+ // immediately above this line. Make sure to update the corresponding
+ // histogram enum accordingly.
+ RESULT_COUNT,
+};
+
+// Result of loading all pages.
+enum class LoadResult {
+ SUCCESS,
+ CANCELLED,
+ STORE_FAILURE,
+};
+
+typedef std::set<GURL> CheckPagesExistOfflineResult;
+typedef std::vector<int64_t> MultipleOfflineIdResult;
+typedef base::Optional<OfflinePageItem> SingleOfflinePageItemResult;
+typedef std::vector<OfflinePageItem> MultipleOfflinePageItemResult;
+
+typedef base::Callback<void(SavePageResult, int64_t)> SavePageCallback;
+typedef base::Callback<void(DeletePageResult)> DeletePageCallback;
+typedef base::Callback<void(const CheckPagesExistOfflineResult&)>
+ CheckPagesExistOfflineCallback;
+typedef base::Callback<void(bool)> HasPagesCallback;
+typedef base::Callback<void(const MultipleOfflineIdResult&)>
+ MultipleOfflineIdCallback;
+typedef base::Callback<void(const SingleOfflinePageItemResult&)>
+ SingleOfflinePageItemCallback;
+typedef base::Callback<void(const MultipleOfflinePageItemResult&)>
+ MultipleOfflinePageItemCallback;
+typedef base::Callback<bool(const GURL&)> UrlPredicate;
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TYPES_H_
« no previous file with comments | « components/offline_pages/offline_page_storage_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698