| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_shelf.h" | 5 #include "chrome/browser/download/download_shelf.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "chrome/browser/dom_ui/downloads_ui.h" | 8 #include "chrome/browser/dom_ui/downloads_ui.h" |
| 9 #include "chrome/browser/download/download_item_model.h" | 9 #include "chrome/browser/download/download_item_model.h" |
| 10 #include "chrome/browser/download/download_manager.h" | 10 #include "chrome/browser/download/download_manager.h" |
| 11 #include "chrome/browser/metrics/user_metrics.h" | 11 #include "chrome/browser/metrics/user_metrics.h" |
| 12 #include "chrome/browser/tab_contents/tab_contents.h" | 12 #include "chrome/browser/tab_contents/tab_contents.h" |
| 13 #include "chrome/common/l10n_util.h" | 13 #include "chrome/common/l10n_util.h" |
| 14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 16 | 16 |
| 17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 18 #include "chrome/browser/download/download_util.h" | 18 #include "chrome/browser/download/download_util.h" |
| 19 #elif defined(OS_POSIX) | 19 #elif defined(OS_POSIX) |
| 20 #include "chrome/common/temp_scaffolding_stubs.h" | 20 #include "chrome/common/temp_scaffolding_stubs.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 // DownloadShelf --------------------------------------------------------------- | 23 // DownloadShelf --------------------------------------------------------------- |
| 24 | 24 |
| 25 void DownloadShelf::ShowAllDownloads() { | 25 void DownloadShelf::ShowAllDownloads() { |
| 26 Profile* profile = tab_contents_->profile(); | 26 Profile* profile = tab_contents_->profile(); |
| 27 if (profile) | 27 if (profile) |
| 28 UserMetrics::RecordAction(L"ShowDownloads", profile); | 28 UserMetrics::RecordAction(L"ShowDownloads", profile); |
| 29 tab_contents_->OpenURL(GURL(chrome::kChromeUIDownloadsURL), GURL(), | 29 tab_contents_->OpenURL(GURL(chrome::kChromeUIDownloadsURL), GURL(), |
| 30 NEW_FOREGROUND_TAB, PageTransition::AUTO_BOOKMARK); | 30 SINGLETON_TAB, PageTransition::AUTO_BOOKMARK); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void DownloadShelf::ChangeTabContents(TabContents* old_contents, | 33 void DownloadShelf::ChangeTabContents(TabContents* old_contents, |
| 34 TabContents* new_contents) { | 34 TabContents* new_contents) { |
| 35 DCHECK(old_contents == tab_contents_); | 35 DCHECK(old_contents == tab_contents_); |
| 36 tab_contents_ = new_contents; | 36 tab_contents_ = new_contents; |
| 37 } | 37 } |
| 38 | 38 |
| 39 // DownloadShelfContextMenu ---------------------------------------------------- | 39 // DownloadShelfContextMenu ---------------------------------------------------- |
| 40 | 40 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 extension, !ItemIsChecked(ALWAYS_OPEN_TYPE)); | 122 extension, !ItemIsChecked(ALWAYS_OPEN_TYPE)); |
| 123 break; | 123 break; |
| 124 } | 124 } |
| 125 case CANCEL: | 125 case CANCEL: |
| 126 model_->CancelTask(); | 126 model_->CancelTask(); |
| 127 break; | 127 break; |
| 128 default: | 128 default: |
| 129 NOTREACHED(); | 129 NOTREACHED(); |
| 130 } | 130 } |
| 131 } | 131 } |
| OLD | NEW |