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

Unified Diff: components/offline_pages/core/background/load_termination_listener.h

Issue 2898393002: Split Android-specific dependency from BackgroundLoaderOffliner. Create a subfolder of c/b/offline_… (Closed)
Patch Set: more build fixes Created 3 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
Index: components/offline_pages/core/background/load_termination_listener.h
diff --git a/components/offline_pages/core/background/load_termination_listener.h b/components/offline_pages/core/background/load_termination_listener.h
new file mode 100644
index 0000000000000000000000000000000000000000..09b61cadc4fc31742f6ed38ed5330f0bfe9c8b32
--- /dev/null
+++ b/components/offline_pages/core/background/load_termination_listener.h
@@ -0,0 +1,33 @@
+// Copyright 2017 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_CORE_BACKGROUND_LOAD_TERMINATION_LISTENER_H_
+#define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_LOAD_TERMINATION_LISTENER_H_
+
+#include "components/offline_pages/core/background/offliner.h"
+
+namespace offline_pages {
+
+// The OS-specific instance of this class is created and passed to
+// BackgroundLoaderOffliner which takes lifetime ownership of it.
+// When listener receives signals requiring immediate termination of loading,
+// it should call Offliner::TerminateLoadIfInProgress().
+class LoadTerminationListener {
+ public:
+ LoadTerminationListener() = default;
+ virtual ~LoadTerminationListener() = default;
+
+ // Called by Offliner when it takes ownership of this listener. Used to
+ // cache pointer back to offliner to terminate the load.
+ void set_offliner(Offliner* offliner) { offliner_ = offliner; }
+
+ protected:
+ // Raw pointer because this class is owned by Offliner.
+ Offliner* offliner_ = nullptr;
+ DISALLOW_COPY_AND_ASSIGN(LoadTerminationListener);
+};
+
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_LOAD_TERMINATION_LISTENER_H_

Powered by Google App Engine
This is Rietveld 408576698