| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/downloads_dom_handler.h" | 5 #include "chrome/browser/ui/webui/downloads_dom_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 // manager as well. | 351 // manager as well. |
| 352 if (profile->GetOriginalProfile() != profile) | 352 if (profile->GetOriginalProfile() != profile) |
| 353 DownloadServiceFactory::GetForProfile( | 353 DownloadServiceFactory::GetForProfile( |
| 354 profile->GetOriginalProfile())-> | 354 profile->GetOriginalProfile())-> |
| 355 GetDownloadManager()->RemoveAllDownloads(); | 355 GetDownloadManager()->RemoveAllDownloads(); |
| 356 } | 356 } |
| 357 | 357 |
| 358 void DownloadsDOMHandler::HandleOpenDownloadsFolder(const ListValue* args) { | 358 void DownloadsDOMHandler::HandleOpenDownloadsFolder(const ListValue* args) { |
| 359 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER); | 359 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER); |
| 360 platform_util::OpenItem( | 360 platform_util::OpenItem( |
| 361 DownloadPrefs::FromDownloadManager(download_manager_)->download_path()); | 361 DownloadPrefs::FromDownloadManager(download_manager_)->download_path(), |
| 362 NULL); |
| 362 } | 363 } |
| 363 | 364 |
| 364 // DownloadsDOMHandler, private: ---------------------------------------------- | 365 // DownloadsDOMHandler, private: ---------------------------------------------- |
| 365 | 366 |
| 366 void DownloadsDOMHandler::SendCurrentDownloads() { | 367 void DownloadsDOMHandler::SendCurrentDownloads() { |
| 367 ListValue results_value; | 368 ListValue results_value; |
| 368 for (OrderedDownloads::iterator it = download_items_.begin(); | 369 for (OrderedDownloads::iterator it = download_items_.begin(); |
| 369 it != download_items_.end(); ++it) { | 370 it != download_items_.end(); ++it) { |
| 370 int index = static_cast<int>(it - download_items_.begin()); | 371 int index = static_cast<int>(it - download_items_.begin()); |
| 371 if (index > kMaxDownloads) | 372 if (index > kMaxDownloads) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 400 return NULL; | 401 return NULL; |
| 401 } | 402 } |
| 402 | 403 |
| 403 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { | 404 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { |
| 404 int id; | 405 int id; |
| 405 if (ExtractIntegerValue(args, &id)) { | 406 if (ExtractIntegerValue(args, &id)) { |
| 406 return GetDownloadById(id); | 407 return GetDownloadById(id); |
| 407 } | 408 } |
| 408 return NULL; | 409 return NULL; |
| 409 } | 410 } |
| OLD | NEW |