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

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

Issue 9167019: Consolidate icon loading on ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment. Created 8 years, 10 months 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/string_piece.h" 15 #include "base/string_piece.h"
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/download/chrome_download_manager_delegate.h" 20 #include "chrome/browser/download/chrome_download_manager_delegate.h"
21 #include "chrome/browser/download/download_history.h" 21 #include "chrome/browser/download/download_history.h"
22 #include "chrome/browser/download/download_prefs.h" 22 #include "chrome/browser/download/download_prefs.h"
23 #include "chrome/browser/download/download_service.h" 23 #include "chrome/browser/download/download_service.h"
24 #include "chrome/browser/download/download_service_factory.h" 24 #include "chrome/browser/download/download_service_factory.h"
25 #include "chrome/browser/download/download_util.h" 25 #include "chrome/browser/download/download_util.h"
26 #include "chrome/browser/platform_util.h" 26 #include "chrome/browser/platform_util.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 28 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
29 #include "chrome/browser/ui/webui/fileicon_source.h" 29 #include "chrome/browser/ui/webui/fileicon_source.h"
30 #include "chrome/browser/ui/webui/fileicon_source_chromeos.h"
31 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
32 #include "content/public/browser/download_item.h" 31 #include "content/public/browser/download_item.h"
33 #include "content/public/browser/user_metrics.h" 32 #include "content/public/browser/user_metrics.h"
34 #include "content/public/browser/web_contents.h" 33 #include "content/public/browser/web_contents.h"
35 #include "content/public/browser/web_ui.h" 34 #include "content/public/browser/web_ui.h"
36 #include "grit/generated_resources.h" 35 #include "grit/generated_resources.h"
37 #include "ui/gfx/image/image.h" 36 #include "ui/gfx/image/image.h"
38 37
39 #if !defined(OS_MACOSX) 38 #if !defined(OS_MACOSX)
40 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 120
122 // The original profile's download manager. 121 // The original profile's download manager.
123 DownloadManager* original_profile_download_manager_; 122 DownloadManager* original_profile_download_manager_;
124 }; 123 };
125 124
126 DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm) 125 DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm)
127 : search_text_(), 126 : search_text_(),
128 download_manager_(dlm) { 127 download_manager_(dlm) {
129 // Create our fileicon data source. 128 // Create our fileicon data source.
130 Profile::FromBrowserContext(dlm->GetBrowserContext())-> 129 Profile::FromBrowserContext(dlm->GetBrowserContext())->
131 GetChromeURLDataManager()->AddDataSource( 130 GetChromeURLDataManager()->AddDataSource(new FileIconSource());
132 #if defined(OS_CHROMEOS)
133 new FileIconSourceCros());
134 #else
135 new FileIconSource());
136 #endif // OS_CHROMEOS
137 } 131 }
138 132
139 DownloadsDOMHandler::~DownloadsDOMHandler() { 133 DownloadsDOMHandler::~DownloadsDOMHandler() {
140 ClearDownloadItems(); 134 ClearDownloadItems();
141 download_manager_->RemoveObserver(this); 135 download_manager_->RemoveObserver(this);
142 } 136 }
143 137
144 // DownloadsDOMHandler, public: ----------------------------------------------- 138 // DownloadsDOMHandler, public: -----------------------------------------------
145 139
146 void DownloadsDOMHandler::Init() { 140 void DownloadsDOMHandler::Init() {
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 return NULL; 397 return NULL;
404 } 398 }
405 399
406 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { 400 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) {
407 int id; 401 int id;
408 if (ExtractIntegerValue(args, &id)) { 402 if (ExtractIntegerValue(args, &id)) {
409 return GetDownloadById(id); 403 return GetDownloadById(id);
410 } 404 }
411 return NULL; 405 return NULL;
412 } 406 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/active_downloads_ui.cc ('k') | chrome/browser/ui/webui/fileicon_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698