| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/notification/download_notification_item.h" | 5 #include "chrome/browser/download/notification/download_notification_item.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/download/download_crx_util.h" | 9 #include "chrome/browser/download/download_crx_util.h" |
| 10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 return; | 142 return; |
| 143 } | 143 } |
| 144 | 144 |
| 145 DownloadCommands::Command command = button_actions_->at(button_index); | 145 DownloadCommands::Command command = button_actions_->at(button_index); |
| 146 if (command != DownloadCommands::PAUSE && | 146 if (command != DownloadCommands::PAUSE && |
| 147 command != DownloadCommands::RESUME) { | 147 command != DownloadCommands::RESUME) { |
| 148 CloseNotificationByUser(); | 148 CloseNotificationByUser(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 DownloadCommands(item_).ExecuteCommand(command); | 151 DownloadCommands(item_).ExecuteCommand(command); |
| 152 |
| 153 // Shows the notification again after clicking "Keep" on dangerous download. |
| 154 if (command == DownloadCommands::KEEP) |
| 155 UpdateNotificationData(ADD_NEW); |
| 152 } | 156 } |
| 153 | 157 |
| 154 // DownloadItem::Observer methods | 158 // DownloadItem::Observer methods |
| 155 void DownloadNotificationItem::OnDownloadUpdated(content::DownloadItem* item) { | 159 void DownloadNotificationItem::OnDownloadUpdated(content::DownloadItem* item) { |
| 156 DCHECK_EQ(item, item_); | 160 DCHECK_EQ(item, item_); |
| 157 | 161 |
| 158 UpdateNotificationData(UPDATE_EXISTING); | 162 UpdateNotificationData(UPDATE_EXISTING); |
| 159 } | 163 } |
| 160 | 164 |
| 161 void DownloadNotificationItem::CloseNotificationByUser() { | 165 void DownloadNotificationItem::CloseNotificationByUser() { |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 NOTREACHED(); | 467 NOTREACHED(); |
| 464 return base::string16(); | 468 return base::string16(); |
| 465 } | 469 } |
| 466 | 470 |
| 467 Browser* DownloadNotificationItem::GetBrowser() { | 471 Browser* DownloadNotificationItem::GetBrowser() { |
| 468 chrome::ScopedTabbedBrowserDisplayer browser_displayer( | 472 chrome::ScopedTabbedBrowserDisplayer browser_displayer( |
| 469 profile_, chrome::GetActiveDesktop()); | 473 profile_, chrome::GetActiveDesktop()); |
| 470 DCHECK(browser_displayer.browser()); | 474 DCHECK(browser_displayer.browser()); |
| 471 return browser_displayer.browser(); | 475 return browser_displayer.browser(); |
| 472 } | 476 } |
| OLD | NEW |