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

Side by Side Diff: chrome/browser/download/download_manager.h

Issue 55046: Installing extensions (drag/drop, download crx file) will now be... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/download/download_file.cc ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // The DownloadManager object manages the process of downloading, including 5 // The DownloadManager object manages the process of downloading, including
6 // updates to the history system and providing the information for displaying 6 // updates to the history system and providing the information for displaying
7 // the downloads view in the Destinations tab. There is one DownloadManager per 7 // the downloads view in the Destinations tab. There is one DownloadManager per
8 // active profile in Chrome. 8 // active profile in Chrome.
9 // 9 //
10 // Each download is represented by a DownloadItem, and all DownloadItems 10 // Each download is represented by a DownloadItem, and all DownloadItems
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 328
329 // Helper method for cancelling the network request associated with a 329 // Helper method for cancelling the network request associated with a
330 // download. 330 // download.
331 static void CancelDownloadRequest(int render_process_id, int request_id); 331 static void CancelDownloadRequest(int render_process_id, int request_id);
332 332
333 // Called from a view when a user clicks a UI button or link. 333 // Called from a view when a user clicks a UI button or link.
334 void DownloadCancelled(int32 download_id); 334 void DownloadCancelled(int32 download_id);
335 void PauseDownload(int32 download_id, bool pause); 335 void PauseDownload(int32 download_id, bool pause);
336 void RemoveDownload(int64 download_handle); 336 void RemoveDownload(int64 download_handle);
337 337
338 // Called when the download is renamed to its final name.
339 void DownloadRenamedToFinalName(int download_id, const FilePath& full_path);
340
338 // Remove downloads after remove_begin (inclusive) and before remove_end 341 // Remove downloads after remove_begin (inclusive) and before remove_end
339 // (exclusive). You may pass in null Time values to do an unbounded delete 342 // (exclusive). You may pass in null Time values to do an unbounded delete
340 // in either direction. 343 // in either direction.
341 int RemoveDownloadsBetween(const base::Time remove_begin, 344 int RemoveDownloadsBetween(const base::Time remove_begin,
342 const base::Time remove_end); 345 const base::Time remove_end);
343 346
344 // Remove downloads will delete all downloads that have a timestamp that is 347 // Remove downloads will delete all downloads that have a timestamp that is
345 // the same or more recent than |remove_begin|. The number of downloads 348 // the same or more recent than |remove_begin|. The number of downloads
346 // deleted is returned back to the caller. 349 // deleted is returned back to the caller.
347 int RemoveDownloads(const base::Time remove_begin); 350 int RemoveDownloads(const base::Time remove_begin);
348 351
349 // Download the object at the URL. Used in cases such as "Save Link As..." 352 // Download the object at the URL. Used in cases such as "Save Link As..."
350 void DownloadUrl(const GURL& url, 353 void DownloadUrl(const GURL& url,
351 const GURL& referrer, 354 const GURL& referrer,
352 WebContents* web_contents); 355 WebContents* web_contents);
353 356
354 // Allow objects to observe the download creation process. 357 // Allow objects to observe the download creation process.
355 void AddObserver(Observer* observer); 358 void AddObserver(Observer* observer);
356 359
357 // Remove a download observer from ourself. 360 // Remove a download observer from ourself.
358 void RemoveObserver(Observer* observer); 361 void RemoveObserver(Observer* observer);
359 362
360 // Methods called on completion of a query sent to the history system. 363 // Methods called on completion of a query sent to the history system.
361 void OnQueryDownloadEntriesComplete( 364 void OnQueryDownloadEntriesComplete(
362 std::vector<DownloadCreateInfo>* entries); 365 std::vector<DownloadCreateInfo>* entries);
363 void OnCreateDownloadEntryComplete(DownloadCreateInfo info, int64 db_handle); 366 void OnCreateDownloadEntryComplete(DownloadCreateInfo info, int64 db_handle);
364 void OnSearchComplete(HistoryService::Handle handle, 367 void OnSearchComplete(HistoryService::Handle handle,
365 std::vector<int64>* results); 368 std::vector<int64>* results);
366 369
367 // Show or Open a download via the Windows shell. 370 // Opens a download. For Chrome extensions call
371 // ExtensionsServices::InstallExtension, for everything else call
372 // OpenDownloadInShell.
373 void OpenDownload(const DownloadItem* download,
374 gfx::NativeView parent_window);
375
376 // Show a download via the Windows shell.
368 void ShowDownloadInShell(const DownloadItem* download); 377 void ShowDownloadInShell(const DownloadItem* download);
369 void OpenDownloadInShell(const DownloadItem* download,
370 gfx::NativeView parent_window);
371 378
372 // The number of in progress (including paused) downloads. 379 // The number of in progress (including paused) downloads.
373 int in_progress_count() const { 380 int in_progress_count() const {
374 return static_cast<int>(in_progress_.size()); 381 return static_cast<int>(in_progress_.size());
375 } 382 }
376 383
377 FilePath download_path() { 384 FilePath download_path() {
378 return FilePath::FromWStringHack(*download_path_); 385 return FilePath::FromWStringHack(*download_path_);
379 } 386 }
380 387
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 // Called when the user has validated the donwload of a dangerous file. 420 // Called when the user has validated the donwload of a dangerous file.
414 void DangerousDownloadValidated(DownloadItem* download); 421 void DangerousDownloadValidated(DownloadItem* download);
415 422
416 // Used to make sure we have a safe file extension and filename for a 423 // Used to make sure we have a safe file extension and filename for a
417 // download. |file_name| can either be just the file name or it can be a 424 // download. |file_name| can either be just the file name or it can be a
418 // full path to a file. 425 // full path to a file.
419 void GenerateSafeFilename(const std::string& mime_type, 426 void GenerateSafeFilename(const std::string& mime_type,
420 FilePath* file_name); 427 FilePath* file_name);
421 428
422 private: 429 private:
430 // Opens a download via the Windows shell.
431 void OpenDownloadInShell(const DownloadItem* download,
432 gfx::NativeView parent_window);
433
434 // Opens downloaded Chrome extension file (*.crx).
435 void OpenChromeExtension(const FilePath& full_path);
436
423 // Shutdown the download manager. This call is needed only after Init. 437 // Shutdown the download manager. This call is needed only after Init.
424 void Shutdown(); 438 void Shutdown();
425 439
426 // Called on the download thread to check whether the suggested file path 440 // Called on the download thread to check whether the suggested file path
427 // exists. We don't check if the file exists on the UI thread to avoid UI 441 // exists. We don't check if the file exists on the UI thread to avoid UI
428 // stalls from interacting with the file system. 442 // stalls from interacting with the file system.
429 void CheckIfSuggestedPathExists(DownloadCreateInfo* info); 443 void CheckIfSuggestedPathExists(DownloadCreateInfo* info);
430 444
431 // Called on the UI thread once the DownloadManager has determined whether the 445 // Called on the UI thread once the DownloadManager has determined whether the
432 // suggested file path exists. 446 // suggested file path exists.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 PendingFinishedMap pending_finished_downloads_; 586 PendingFinishedMap pending_finished_downloads_;
573 587
574 // The "Save As" dialog box used to ask the user where a file should be 588 // The "Save As" dialog box used to ask the user where a file should be
575 // saved. 589 // saved.
576 scoped_refptr<SelectFileDialog> select_file_dialog_; 590 scoped_refptr<SelectFileDialog> select_file_dialog_;
577 591
578 DISALLOW_COPY_AND_ASSIGN(DownloadManager); 592 DISALLOW_COPY_AND_ASSIGN(DownloadManager);
579 }; 593 };
580 594
581 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ 595 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_file.cc ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698