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

Side by Side Diff: chrome/browser/download/download_crx_util.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 (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 // Download code which handles CRX files (extensions, themes, apps, ...). 5 // Download code which handles CRX files (extensions, themes, apps, ...).
6 6
7 #include "chrome/browser/download/download_crx_util.h" 7 #include "chrome/browser/download/download_crx_util.h"
8 8
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/extensions/crx_installer.h" 10 #include "chrome/browser/extensions/crx_installer.h"
(...skipping 30 matching lines...) Expand all
41 // Use a mock if one is present. Otherwise, create a real extensions 41 // Use a mock if one is present. Otherwise, create a real extensions
42 // install UI. 42 // install UI.
43 if (mock_install_prompt_for_testing) { 43 if (mock_install_prompt_for_testing) {
44 ExtensionInstallPrompt* result = mock_install_prompt_for_testing; 44 ExtensionInstallPrompt* result = mock_install_prompt_for_testing;
45 mock_install_prompt_for_testing = NULL; 45 mock_install_prompt_for_testing = NULL;
46 return scoped_ptr<ExtensionInstallPrompt>(result); 46 return scoped_ptr<ExtensionInstallPrompt>(result);
47 } else { 47 } else {
48 content::WebContents* web_contents = download_item.GetWebContents(); 48 content::WebContents* web_contents = download_item.GetWebContents();
49 if (!web_contents) { 49 if (!web_contents) {
50 chrome::HostDesktopType active_desktop = chrome::GetActiveDesktop(); 50 chrome::HostDesktopType active_desktop = chrome::GetActiveDesktop();
51 Browser* browser = chrome::FindLastActiveWithProfile(profile, 51 Browser* browser = chrome::FindLastActiveWithProfile(profile);
52 active_desktop);
53 if (!browser) 52 if (!browser)
54 browser = new Browser(Browser::CreateParams(Browser::TYPE_TABBED, 53 browser = new Browser(Browser::CreateParams(Browser::TYPE_TABBED,
55 profile, active_desktop)); 54 profile, active_desktop));
56 web_contents = browser->tab_strip_model()->GetActiveWebContents(); 55 web_contents = browser->tab_strip_model()->GetActiveWebContents();
57 } 56 }
58 return scoped_ptr<ExtensionInstallPrompt>( 57 return scoped_ptr<ExtensionInstallPrompt>(
59 new ExtensionInstallPrompt(web_contents)); 58 new ExtensionInstallPrompt(web_contents));
60 } 59 }
61 } 60 }
62 61
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 131
133 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) { 132 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) {
134 // TODO(aa): RefererURL is cleared in some cases, for example when going 133 // TODO(aa): RefererURL is cleared in some cases, for example when going
135 // between secure and non-secure URLs. It would be better if DownloadItem 134 // between secure and non-secure URLs. It would be better if DownloadItem
136 // tracked the initiating page explicitly. 135 // tracked the initiating page explicitly.
137 return extensions::ExtensionManagementFactory::GetForBrowserContext(profile) 136 return extensions::ExtensionManagementFactory::GetForBrowserContext(profile)
138 ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl()); 137 ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl());
139 } 138 }
140 139
141 } // namespace download_crx_util 140 } // namespace download_crx_util
OLDNEW
« no previous file with comments | « chrome/browser/background/background_mode_manager.cc ('k') | chrome/browser/download/download_ui_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698