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

Side by Side Diff: chrome/browser/ui/webui/downloads_dom_handler.cc

Issue 8439018: Open cros filemanager when "Open Downloads Folder" is clicked. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 | « no previous file | no next file » | 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) 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 21 matching lines...) Expand all
32 #include "content/browser/download/download_item.h" 32 #include "content/browser/download/download_item.h"
33 #include "content/browser/tab_contents/tab_contents.h" 33 #include "content/browser/tab_contents/tab_contents.h"
34 #include "content/browser/user_metrics.h" 34 #include "content/browser/user_metrics.h"
35 #include "grit/generated_resources.h" 35 #include "grit/generated_resources.h"
36 #include "ui/gfx/image/image.h" 36 #include "ui/gfx/image/image.h"
37 37
38 #if !defined(OS_MACOSX) 38 #if !defined(OS_MACOSX)
39 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
40 #endif 40 #endif
41 41
42 #if defined(OS_CHROMEOS)
43 #include "chrome/browser/extensions/file_manager_util.h"
44 #endif
45
42 namespace { 46 namespace {
43 47
44 // Maximum number of downloads to show. TODO(glen): Remove this and instead 48 // Maximum number of downloads to show. TODO(glen): Remove this and instead
45 // stuff the downloads down the pipe slowly. 49 // stuff the downloads down the pipe slowly.
46 static const int kMaxDownloads = 150; 50 static const int kMaxDownloads = 150;
47 51
48 // Sort DownloadItems into descending order by their start time. 52 // Sort DownloadItems into descending order by their start time.
49 class DownloadItemSorter : public std::binary_function<DownloadItem*, 53 class DownloadItemSorter : public std::binary_function<DownloadItem*,
50 DownloadItem*, 54 DownloadItem*,
51 bool> { 55 bool> {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 354 }
351 355
352 void DownloadsDOMHandler::HandleOpenDownloadsFolder(const ListValue* args) { 356 void DownloadsDOMHandler::HandleOpenDownloadsFolder(const ListValue* args) {
353 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER); 357 CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER);
354 FilePath path = DownloadPrefs::FromDownloadManager(download_manager_)-> 358 FilePath path = DownloadPrefs::FromDownloadManager(download_manager_)->
355 download_path(); 359 download_path();
356 360
357 #if defined(OS_MACOSX) 361 #if defined(OS_MACOSX)
358 // Must be called from the UI thread on Mac. 362 // Must be called from the UI thread on Mac.
359 platform_util::OpenItem(path); 363 platform_util::OpenItem(path);
364 #elif defined(OS_CHROMEOS)
365 FileManagerUtil::ShowFullTabUrl(
366 Profile::FromBrowserContext(download_manager_->browser_context()),
367 path);
360 #else 368 #else
361 BrowserThread::PostTask( 369 BrowserThread::PostTask(
362 BrowserThread::FILE, FROM_HERE, 370 BrowserThread::FILE, FROM_HERE,
363 base::Bind(&platform_util::OpenItem, path)); 371 base::Bind(&platform_util::OpenItem, path));
364 #endif 372 #endif
365 } 373 }
366 374
367 // DownloadsDOMHandler, private: ---------------------------------------------- 375 // DownloadsDOMHandler, private: ----------------------------------------------
368 376
369 void DownloadsDOMHandler::SendCurrentDownloads() { 377 void DownloadsDOMHandler::SendCurrentDownloads() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 return NULL; 411 return NULL;
404 } 412 }
405 413
406 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { 414 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) {
407 int id; 415 int id;
408 if (ExtractIntegerValue(args, &id)) { 416 if (ExtractIntegerValue(args, &id)) {
409 return GetDownloadById(id); 417 return GetDownloadById(id);
410 } 418 }
411 return NULL; 419 return NULL;
412 } 420 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698