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

Side by Side Diff: chrome/browser/download/download_file.cc

Issue 115740: Move download shelf from per-tab to per-window (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 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/cocoa/browser_window_cocoa.mm ('k') | chrome/browser/download/download_shelf.h » ('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 #include "chrome/browser/download/download_file.h" 5 #include "chrome/browser/download/download_file.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 DCHECK(MessageLoop::current() == file_loop_); 529 DCHECK(MessageLoop::current() == file_loop_);
530 platform_util::ShowItemInFolder(full_path); 530 platform_util::ShowItemInFolder(full_path);
531 } 531 }
532 532
533 // Launches the selected download using ShellExecute 'open' verb. For windows, 533 // Launches the selected download using ShellExecute 'open' verb. For windows,
534 // if there is a valid parent window, the 'safer' version will be used which can 534 // if there is a valid parent window, the 'safer' version will be used which can
535 // display a modal dialog asking for user consent on dangerous files. 535 // display a modal dialog asking for user consent on dangerous files.
536 void DownloadFileManager::OnOpenDownloadInShell(const FilePath& full_path, 536 void DownloadFileManager::OnOpenDownloadInShell(const FilePath& full_path,
537 const GURL& url, 537 const GURL& url,
538 gfx::NativeView parent_window) { 538 gfx::NativeView parent_window) {
539 DCHECK(MessageLoop::current() == file_loop_);
540
541 #if defined(OS_WIN) 539 #if defined(OS_WIN)
542 if (NULL != parent_window) { 540 DCHECK(MessageLoop::current() == file_loop_);
543 win_util::SaferOpenItemViaShell(parent_window, L"", full_path, 541 if (NULL != parent_window) {
544 UTF8ToWide(url.spec())); 542 win_util::SaferOpenItemViaShell(parent_window, L"", full_path,
545 return; 543 UTF8ToWide(url.spec()));
546 } 544 } else {
545 win_util::OpenItemViaShell(full_path);
546 }
547 #else
548 // TODO(port) implement me.
549 NOTIMPLEMENTED();
547 #endif 550 #endif
548
549 platform_util::OpenItem(full_path);
550 } 551 }
551 552
552 // The DownloadManager in the UI thread has provided a final name for the 553 // The DownloadManager in the UI thread has provided a final name for the
553 // download specified by 'id'. Rename the in progress download, and remove it 554 // download specified by 'id'. Rename the in progress download, and remove it
554 // from our table if it has been completed or cancelled already. 555 // from our table if it has been completed or cancelled already.
555 void DownloadFileManager::OnFinalDownloadName(int id, 556 void DownloadFileManager::OnFinalDownloadName(int id,
556 const FilePath& full_path, 557 const FilePath& full_path,
557 DownloadManager* manager) { 558 DownloadManager* manager) {
558 DCHECK(MessageLoop::current() == file_loop_); 559 DCHECK(MessageLoop::current() == file_loop_);
559 DownloadFileMap::iterator it = downloads_.find(id); 560 DownloadFileMap::iterator it = downloads_.find(id);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod( 599 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(
599 this, &DownloadFileManager::StopUpdateTimer)); 600 this, &DownloadFileManager::StopUpdateTimer));
600 } 601 }
601 602
602 // static 603 // static
603 void DownloadFileManager::DeleteFile(const FilePath& path) { 604 void DownloadFileManager::DeleteFile(const FilePath& path) {
604 // Make sure we only delete files. 605 // Make sure we only delete files.
605 if (!file_util::DirectoryExists(path)) 606 if (!file_util::DirectoryExists(path))
606 file_util::Delete(path, false); 607 file_util::Delete(path, false);
607 } 608 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/browser_window_cocoa.mm ('k') | chrome/browser/download/download_shelf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698