OLD | NEW |
1 // Copyright (c) 2012 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" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 87 } |
88 | 88 |
89 } // namespace | 89 } // namespace |
90 | 90 |
91 DownloadsDOMHandler::DownloadsDOMHandler(content::DownloadManager* dlm) | 91 DownloadsDOMHandler::DownloadsDOMHandler(content::DownloadManager* dlm) |
92 : search_text_(), | 92 : search_text_(), |
93 download_manager_(dlm), | 93 download_manager_(dlm), |
94 original_profile_download_manager_(NULL), | 94 original_profile_download_manager_(NULL), |
95 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 95 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
96 // Create our fileicon data source. | 96 // Create our fileicon data source. |
97 Profile::FromBrowserContext(dlm->GetBrowserContext())-> | 97 Profile* profile = Profile::FromBrowserContext(dlm->GetBrowserContext()); |
98 GetChromeURLDataManager()->AddDataSource(new FileIconSource()); | 98 ChromeURLDataManager::AddDataSource(profile, new FileIconSource()); |
99 | 99 |
100 // Figure out our parent DownloadManager, if any. | 100 // Figure out our parent DownloadManager, if any. |
101 Profile* profile = | |
102 Profile::FromBrowserContext(download_manager_->GetBrowserContext()); | |
103 Profile* original_profile = profile->GetOriginalProfile(); | 101 Profile* original_profile = profile->GetOriginalProfile(); |
104 if (original_profile != profile) { | 102 if (original_profile != profile) { |
105 original_profile_download_manager_ = DownloadServiceFactory::GetForProfile( | 103 original_profile_download_manager_ = DownloadServiceFactory::GetForProfile( |
106 original_profile)->GetDownloadManager(); | 104 original_profile)->GetDownloadManager(); |
107 } | 105 } |
108 } | 106 } |
109 | 107 |
110 DownloadsDOMHandler::~DownloadsDOMHandler() { | 108 DownloadsDOMHandler::~DownloadsDOMHandler() { |
111 ClearDownloadItems(); | 109 ClearDownloadItems(); |
112 download_manager_->RemoveObserver(this); | 110 download_manager_->RemoveObserver(this); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 402 } |
405 | 403 |
406 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue( | 404 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue( |
407 const ListValue* args) { | 405 const ListValue* args) { |
408 int id; | 406 int id; |
409 if (ExtractIntegerValue(args, &id)) { | 407 if (ExtractIntegerValue(args, &id)) { |
410 return GetDownloadById(id); | 408 return GetDownloadById(id); |
411 } | 409 } |
412 return NULL; | 410 return NULL; |
413 } | 411 } |
OLD | NEW |