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

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

Issue 1662783002: Remove HostDesktopType from Browser::CreateParams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-12
Patch Set: remove desktop_type_ in bookmark_bubble_sign_in_delegate 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 29 matching lines...) Expand all
40 const DownloadItem& download_item) { 40 const DownloadItem& download_item) {
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();
51 Browser* browser = chrome::FindLastActiveWithProfile(profile); 50 Browser* browser = chrome::FindLastActiveWithProfile(profile);
52 if (!browser) 51 if (!browser)
53 browser = new Browser(Browser::CreateParams(Browser::TYPE_TABBED, 52 browser =
54 profile, active_desktop)); 53 new Browser(Browser::CreateParams(Browser::TYPE_TABBED, profile));
55 web_contents = browser->tab_strip_model()->GetActiveWebContents(); 54 web_contents = browser->tab_strip_model()->GetActiveWebContents();
56 } 55 }
57 return scoped_ptr<ExtensionInstallPrompt>( 56 return scoped_ptr<ExtensionInstallPrompt>(
58 new ExtensionInstallPrompt(web_contents)); 57 new ExtensionInstallPrompt(web_contents));
59 } 58 }
60 } 59 }
61 60
62 } // namespace 61 } // namespace
63 62
64 // Tests can call this method to inject a mock ExtensionInstallPrompt 63 // Tests can call this method to inject a mock ExtensionInstallPrompt
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 130
132 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) { 131 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) {
133 // TODO(aa): RefererURL is cleared in some cases, for example when going 132 // TODO(aa): RefererURL is cleared in some cases, for example when going
134 // between secure and non-secure URLs. It would be better if DownloadItem 133 // between secure and non-secure URLs. It would be better if DownloadItem
135 // tracked the initiating page explicitly. 134 // tracked the initiating page explicitly.
136 return extensions::ExtensionManagementFactory::GetForBrowserContext(profile) 135 return extensions::ExtensionManagementFactory::GetForBrowserContext(profile)
137 ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl()); 136 ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl());
138 } 137 }
139 138
140 } // namespace download_crx_util 139 } // namespace download_crx_util
OLDNEW
« no previous file with comments | « chrome/browser/download/download_commands.cc ('k') | chrome/browser/download/notification/download_item_notification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698