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

Unified Diff: chrome/browser/chromeos/extensions/file_manager/zip_file_creator.h

Issue 23945002: file_manager: Move non-binding code to c/b/chromeos/file_manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 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: chrome/browser/chromeos/extensions/file_manager/zip_file_creator.h
diff --git a/chrome/browser/chromeos/extensions/file_manager/zip_file_creator.h b/chrome/browser/chromeos/extensions/file_manager/zip_file_creator.h
deleted file mode 100644
index 122d5cc96a9a65c064a1507e12fd83030d51c032..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/extensions/file_manager/zip_file_creator.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2012 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_EXTENSIONS_FILE_MANAGER_ZIP_FILE_CREATOR_H_
-#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_ZIP_FILE_CREATOR_H_
-
-#include <string>
-
-#include "base/files/file_path.h"
-#include "base/memory/ref_counted.h"
-#include "base/platform_file.h"
-#include "chrome/common/extensions/extension.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/utility_process_host_client.h"
-
-namespace file_manager {
-
-// ZipFileCreator creates a ZIP file from a specified list of files and
-// directories under a common parent directory. This is done in a sandboxed
-// subprocess to protect the browser process from handling arbitrary input data
-// from untrusted sources.
-//
-// Lifetime management:
-//
-// This class is ref-counted by each call it makes to itself on another thread,
-// and by UtilityProcessHost.
-//
-// Additionally, we hold a reference to our own client so that it lives at least
-// long enough to receive the result of zip file creation.
-class ZipFileCreator : public content::UtilityProcessHostClient {
- public:
- class Observer {
- public:
- virtual void OnZipDone(bool success) = 0;
-
- protected:
- virtual ~Observer() {}
- };
-
- // Creates a zip file from the specified list of files and directories.
- ZipFileCreator(Observer* observer,
- const base::FilePath& src_dir,
- const std::vector<base::FilePath>& src_relative_paths,
- const base::FilePath& dest_file);
-
- // Start creating the zip file. The client is called with the results.
- void Start();
-
- private:
- friend class ProcessHostClient;
-
- virtual ~ZipFileCreator();
-
- // Opens a handle for the zip file, and proceeds to StartProcessOnIOThread.
- void OpenFileHandleOnBlockingThreadPool();
-
- // Starts the utility process that creates the zip file.
- void StartProcessOnIOThread(base::PlatformFile dest_file);
-
- // UtilityProcessHostClient
- virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
- virtual void OnProcessCrashed(int exit_code) OVERRIDE;
-
- // IPC message handlers.
- void OnCreateZipFileSucceeded();
- void OnCreateZipFileFailed();
-
- void ReportDone(bool success);
-
- // The observer's thread. This is the thread we respond on.
- content::BrowserThread::ID thread_identifier_;
-
- // The observer.
- Observer* observer_;
-
- // The source directory for input files.
- base::FilePath src_dir_;
-
- // The list of source files paths to be included in the zip file.
- // Entries are relative paths under directory |src_dir_|.
- std::vector<base::FilePath> src_relative_paths_;
-
- // The output zip file.
- base::FilePath dest_file_;
-
- // Whether we've received a response from the utility process yet.
- bool got_response_;
-};
-
-} // namespace file_manager
-
-#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_ZIP_FILE_CREATOR_H_

Powered by Google App Engine
This is Rietveld 408576698