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

Unified Diff: chrome/browser/chromeos/arc/arc_downloads_watcher_service.h

Issue 2003533002: arc: Register media files to MediaProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Use size_t. 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 | « no previous file | chrome/browser/chromeos/arc/arc_downloads_watcher_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/arc/arc_downloads_watcher_service.h
diff --git a/chrome/browser/chromeos/arc/arc_downloads_watcher_service.h b/chrome/browser/chromeos/arc/arc_downloads_watcher_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..415230f6902ebab131ca67580212e141ec12b1de
--- /dev/null
+++ b/chrome/browser/chromeos/arc/arc_downloads_watcher_service.h
@@ -0,0 +1,55 @@
+// 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 CHROME_BROWSER_CHROMEOS_ARC_ARC_DOWNLOADS_WATCHER_SERVICE_H_
+#define CHROME_BROWSER_CHROMEOS_ARC_ARC_DOWNLOADS_WATCHER_SERVICE_H_
+
+#include <memory>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "components/arc/arc_bridge_service.h"
+#include "components/arc/arc_service.h"
+
+namespace base {
+
+class FilePath;
+
+} // namespace base
+
+namespace arc {
+
+// Watches Downloads directory and registers newly created media files to
+// Android MediaProvider.
+class ArcDownloadsWatcherService : public ArcService,
+ public ArcBridgeService::Observer {
+ public:
+ explicit ArcDownloadsWatcherService(ArcBridgeService* bridge_service);
+ ~ArcDownloadsWatcherService() override;
+
+ // ArcBridgeService::Observer
+ void OnFileSystemInstanceReady() override;
+ void OnFileSystemInstanceClosed() override;
+
+ private:
+ class DownloadsWatcher;
+
+ void StartWatchingDownloads();
+ void StopWatchingDownloads();
+
+ void OnDownloadsChanged(const std::vector<base::FilePath>& paths);
+
+ std::unique_ptr<DownloadsWatcher> watcher_;
+
+ // Note: This should remain the last member so it'll be destroyed and
+ // invalidate the weak pointers before any other members are destroyed.
+ base::WeakPtrFactory<ArcDownloadsWatcherService> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArcDownloadsWatcherService);
+};
+
+} // namespace arc
+
+#endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_DOWNLOADS_WATCHER_SERVICE_H_
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_downloads_watcher_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698