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

Side by Side Diff: chrome/browser/dom_ui/downloads_dom_handler.cc

Issue 5682007: Cleanup: Remove needed #includes for profile.h. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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
OLDNEW
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/dom_ui/downloads_dom_handler.h" 5 #include "chrome/browser/dom_ui/downloads_dom_handler.h"
6 6
7 #include <algorithm>
8 #include <functional>
9
7 #include "base/basictypes.h" 10 #include "base/basictypes.h"
8 #include "base/callback.h" 11 #include "base/callback.h"
9 #include "base/singleton.h" 12 #include "base/singleton.h"
10 #include "base/string_piece.h" 13 #include "base/string_piece.h"
11 #include "base/thread.h" 14 #include "base/thread.h"
12 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 16 #include "base/values.h"
14 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/browser_thread.h" 18 #include "chrome/browser/browser_thread.h"
16 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 19 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
17 #include "chrome/browser/dom_ui/fileicon_source.h" 20 #include "chrome/browser/dom_ui/fileicon_source.h"
18 #include "chrome/browser/download/download_history.h" 21 #include "chrome/browser/download/download_history.h"
19 #include "chrome/browser/download/download_item.h" 22 #include "chrome/browser/download/download_item.h"
20 #include "chrome/browser/download/download_util.h" 23 #include "chrome/browser/download/download_util.h"
21 #include "chrome/browser/metrics/user_metrics.h" 24 #include "chrome/browser/metrics/user_metrics.h"
22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/tab_contents/tab_contents.h" 25 #include "chrome/browser/tab_contents/tab_contents.h"
24 #include "chrome/common/jstemplate_builder.h" 26 #include "chrome/common/jstemplate_builder.h"
25 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
26 #include "grit/browser_resources.h" 28 #include "grit/browser_resources.h"
27 #include "grit/generated_resources.h" 29 #include "grit/generated_resources.h"
28 30
29 namespace { 31 namespace {
30 32
31 // Maximum number of downloads to show. TODO(glen): Remove this and instead 33 // Maximum number of downloads to show. TODO(glen): Remove this and instead
32 // stuff the downloads down the pipe slowly. 34 // stuff the downloads down the pipe slowly.
33 static const int kMaxDownloads = 150; 35 static const int kMaxDownloads = 150;
34 36
35 // Sort DownloadItems into descending order by their start time. 37 // Sort DownloadItems into descending order by their start time.
36 class DownloadItemSorter : public std::binary_function<DownloadItem*, 38 class DownloadItemSorter : public std::binary_function<DownloadItem*,
37 DownloadItem*, 39 DownloadItem*,
38 bool> { 40 bool> {
39 public: 41 public:
40 bool operator()(const DownloadItem* lhs, const DownloadItem* rhs) { 42 bool operator()(const DownloadItem* lhs, const DownloadItem* rhs) {
41 return lhs->start_time() > rhs->start_time(); 43 return lhs->start_time() > rhs->start_time();
42 } 44 }
43 }; 45 };
44 46
45 } // namespace 47 } // namespace
46 48
47 DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm) 49 DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm)
48 : search_text_(), 50 : search_text_(),
49 download_manager_(dlm), 51 download_manager_(dlm),
50 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 52 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
51 // Create our fileicon data source. 53 // Create our fileicon data source.
52 BrowserThread::PostTask( 54 BrowserThread::PostTask(
53 BrowserThread::IO, FROM_HERE, 55 BrowserThread::IO, FROM_HERE,
54 NewRunnableMethod( 56 NewRunnableMethod(
55 ChromeURLDataManager::GetInstance(), 57 ChromeURLDataManager::GetInstance(),
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 return NULL; 243 return NULL;
242 } 244 }
243 245
244 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { 246 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) {
245 int id; 247 int id;
246 if (ExtractIntegerValue(args, &id)) { 248 if (ExtractIntegerValue(args, &id)) {
247 return GetDownloadById(id); 249 return GetDownloadById(id);
248 } 250 }
249 return NULL; 251 return NULL;
250 } 252 }
OLDNEW
« no previous file with comments | « chrome/browser/debugger/extension_ports_remote_service.cc ('k') | chrome/browser/dom_ui/keyboard_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698