| 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/dom_ui/downloads_ui.h" | 10 #include "chrome/browser/dom_ui/downloads_ui.h" |
| 10 #include "chrome/browser/download/download_item_model.h" | 11 #include "chrome/browser/download/download_item_model.h" |
| 11 #include "chrome/browser/download/download_manager.h" | 12 #include "chrome/browser/download/download_manager.h" |
| 12 #include "chrome/browser/metrics/user_metrics.h" | 13 #include "chrome/browser/metrics/user_metrics.h" |
| 13 #include "chrome/browser/tab_contents/tab_contents.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) || defined(OS_LINUX) | 17 #if defined(OS_WIN) || defined(OS_LINUX) |
| 18 // TODO(port): port this for mac. See two uses below. | 18 // TODO(port): port this for mac. See two uses below. |
| 19 #include "chrome/browser/download/download_util.h" | 19 #include "chrome/browser/download/download_util.h" |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 // DownloadShelf --------------------------------------------------------------- | 22 // DownloadShelf --------------------------------------------------------------- |
| 23 | 23 |
| 24 void DownloadShelf::ShowAllDownloads() { | 24 void DownloadShelf::ShowAllDownloads() { |
| 25 Profile* profile = tab_contents_->profile(); | 25 Profile* profile = browser_->profile(); |
| 26 if (profile) | 26 if (profile) |
| 27 UserMetrics::RecordAction(L"ShowDownloads", profile); | 27 UserMetrics::RecordAction(L"ShowDownloads", profile); |
| 28 tab_contents_->OpenURL(GURL(chrome::kChromeUIDownloadsURL), GURL(), | 28 browser_->OpenURL(GURL(chrome::kChromeUIDownloadsURL), GURL(), |
| 29 SINGLETON_TAB, PageTransition::AUTO_BOOKMARK); | 29 NEW_FOREGROUND_TAB, PageTransition::AUTO_BOOKMARK); |
| 30 } | |
| 31 | |
| 32 void DownloadShelf::ChangeTabContents(TabContents* old_contents, | |
| 33 TabContents* new_contents) { | |
| 34 DCHECK(old_contents == tab_contents_); | |
| 35 tab_contents_ = new_contents; | |
| 36 } | 30 } |
| 37 | 31 |
| 38 // DownloadShelfContextMenu ---------------------------------------------------- | 32 // DownloadShelfContextMenu ---------------------------------------------------- |
| 39 | 33 |
| 40 DownloadShelfContextMenu::DownloadShelfContextMenu( | 34 DownloadShelfContextMenu::DownloadShelfContextMenu( |
| 41 BaseDownloadItemModel* download_model) | 35 BaseDownloadItemModel* download_model) |
| 42 : download_(download_model->download()), | 36 : download_(download_model->download()), |
| 43 model_(download_model) { | 37 model_(download_model) { |
| 44 } | 38 } |
| 45 | 39 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 extension, !ItemIsChecked(ALWAYS_OPEN_TYPE)); | 110 extension, !ItemIsChecked(ALWAYS_OPEN_TYPE)); |
| 117 break; | 111 break; |
| 118 } | 112 } |
| 119 case CANCEL: | 113 case CANCEL: |
| 120 model_->CancelTask(); | 114 model_->CancelTask(); |
| 121 break; | 115 break; |
| 122 default: | 116 default: |
| 123 NOTREACHED(); | 117 NOTREACHED(); |
| 124 } | 118 } |
| 125 } | 119 } |
| OLD | NEW |