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

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

Issue 10196004: Changed ChromeURLDataManager to a ProfileKeyedService and made a Factory for it. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Made ChromeURLDataManager's destructor virtual Created 8 years, 8 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
« no previous file with comments | « chrome/browser/ui/webui/devtools_ui.cc ('k') | chrome/browser/ui/webui/downloads_ui.cc » ('j') | 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) 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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/devtools_ui.cc ('k') | chrome/browser/ui/webui/downloads_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698