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

Side by Side Diff: chrome/browser/download/download_ui_controller.cc

Issue 1659203002: Remove HostDesktopType from FindLastActive[WithProfile] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nullptr Created 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/download/download_ui_controller.h" 5 #include "chrome/browser/download/download_ui_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 }; 80 };
81 81
82 void DownloadShelfUIControllerDelegate::OnNewDownloadReady( 82 void DownloadShelfUIControllerDelegate::OnNewDownloadReady(
83 content::DownloadItem* item) { 83 content::DownloadItem* item) {
84 content::WebContents* web_contents = item->GetWebContents(); 84 content::WebContents* web_contents = item->GetWebContents();
85 Browser* browser = 85 Browser* browser =
86 web_contents ? chrome::FindBrowserWithWebContents(web_contents) : NULL; 86 web_contents ? chrome::FindBrowserWithWebContents(web_contents) : NULL;
87 87
88 // As a last resort, use the last active browser for this profile. Not ideal, 88 // As a last resort, use the last active browser for this profile. Not ideal,
89 // but better than not showing the download at all. 89 // but better than not showing the download at all.
90 if (browser == NULL) { 90 if (browser == nullptr)
91 browser = chrome::FindLastActiveWithProfile(profile_, 91 browser = chrome::FindLastActiveWithProfile(profile_);
92 chrome::GetActiveDesktop());
93 }
94 92
95 if (browser && browser->window() && 93 if (browser && browser->window() &&
96 DownloadItemModel(item).ShouldShowInShelf()) { 94 DownloadItemModel(item).ShouldShowInShelf()) {
97 // GetDownloadShelf creates the download shelf if it was not yet created. 95 // GetDownloadShelf creates the download shelf if it was not yet created.
98 browser->window()->GetDownloadShelf()->AddDownload(item); 96 browser->window()->GetDownloadShelf()->AddDownload(item);
99 } 97 }
100 } 98 }
101 99
102 #endif // !OS_ANDROID 100 #endif // !OS_ANDROID
103 101
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 168 }
171 } 169 }
172 #endif 170 #endif
173 171
174 if (item->GetState() == content::DownloadItem::CANCELLED) 172 if (item->GetState() == content::DownloadItem::CANCELLED)
175 return; 173 return;
176 174
177 DownloadItemModel(item).SetWasUINotified(true); 175 DownloadItemModel(item).SetWasUINotified(true);
178 delegate_->OnNewDownloadReady(item); 176 delegate_->OnNewDownloadReady(item);
179 } 177 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_crx_util.cc ('k') | chrome/browser/extensions/api/extension_action/extension_action_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698