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

Unified Diff: chrome/browser/download/drag_download_file_win.h

Issue 351029: Support dragging a virtual file out of the browser. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 12 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 | « chrome/browser/download/download_util.h ('k') | chrome/browser/download/drag_download_file_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/drag_download_file_win.h
===================================================================
--- chrome/browser/download/drag_download_file_win.h (revision 0)
+++ chrome/browser/download/drag_download_file_win.h (revision 0)
@@ -0,0 +1,84 @@
+// Copyright (c) 2009 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_DOWNLOAD_DRAG_DOWNLOAD_FILE_WIN_H_
+#define CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_FILE_WIN_H_
+
+#include "app/os_exchange_data.h"
+#include "base/file_path.h"
+#include "chrome/browser/download/download_manager.h"
+#include "googleurl/src/gurl.h"
+
+class TabContents;
+
+class DragDownloadFile : public OSExchangeData::DownloadFileProvider,
+ public DownloadManager::Observer,
+ public DownloadItem::Observer {
+ public:
+ DragDownloadFile(const GURL& url,
+ const GURL& referrer,
+ const std::string& referrer_encoding,
+ TabContents* tab_contents);
+
+ // OSExchangeData::DownloadFileProvider methods.
+ // Called on drag-and-drop thread.
+ virtual bool Start(OSExchangeData::DownloadFileObserver* observer,
+ int format);
+ virtual void Stop();
+
+ // DownloadManager::Observer methods.
+ // Called on UI thread.
+ virtual void ModelChanged();
+ virtual void SetDownloads(std::vector<DownloadItem*>& downloads);
+
+ // DownloadItem::Observer methods.
+ // Called on UI thread.
+ virtual void OnDownloadUpdated(DownloadItem* download);
+ virtual void OnDownloadFileCompleted(DownloadItem* download);
+ virtual void OnDownloadOpened(DownloadItem* download) { }
+
+ private:
+ // Called on drag-and-drop thread.
+ virtual ~DragDownloadFile();
+
+ bool InitiateDownload();
+ void InitiateDownloadSucceeded(
+ const std::vector<OSExchangeData::DownloadFileInfo*>& downloads);
+ void InitiateDownloadFailed();
+ void InitiateDownloadCompleted(bool result);
+
+ void DownloadCancelled();
+ void DownloadCompleted(const FilePath& file_path);
+
+ void StartNestedMessageLoop();
+ void QuitNestedMessageLoopIfNeeded();
+
+ // Called on UI thread.
+ void OnInitiateDownload(const FilePath& dir_path);
+ void CheckDownloadStatus(DownloadItem* download);
+
+ // Initialized on drag-and-drop thread. Can be accessed on either thread.
+ GURL url_;
+ GURL referrer_;
+ std::string referrer_encoding_;
+ TabContents* tab_contents_;
+ MessageLoop* drag_message_loop_;
+
+ // Accessed on drag-and-drop thread.
+ bool is_started_;
+ bool is_running_nested_message_loop_;
+ bool initiate_download_result_;
+ scoped_refptr<OSExchangeData::DownloadFileObserver> observer_;
+ int format_;
+ FilePath dir_path_;
+ FilePath file_path_;
+
+ // Access on UI thread.
+ DownloadManager* download_manager_;
+ bool download_item_observer_added_;
+
+ DISALLOW_COPY_AND_ASSIGN(DragDownloadFile);
+};
+
+#endif // CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_FILE_WIN_H_
Property changes on: chrome\browser\download\drag_download_file_win.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/download/download_util.h ('k') | chrome/browser/download/drag_download_file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698