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

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

Issue 1336823003: Move chrome::HostDesktopType to ui::HostDesktopType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base_session_service_delegate_impl
Patch Set: Fix build on Mac and CrOS Created 5 years, 3 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(); 50 ui::HostDesktopType active_desktop = chrome::GetActiveDesktop();
51 Browser* browser = chrome::FindLastActiveWithProfile(profile, 51 Browser* browser = chrome::FindLastActiveWithProfile(profile,
52 active_desktop); 52 active_desktop);
53 if (!browser) 53 if (!browser)
54 browser = new Browser(Browser::CreateParams(Browser::TYPE_TABBED, 54 browser = new Browser(Browser::CreateParams(Browser::TYPE_TABBED,
55 profile, active_desktop)); 55 profile, active_desktop));
56 web_contents = browser->tab_strip_model()->GetActiveWebContents(); 56 web_contents = browser->tab_strip_model()->GetActiveWebContents();
57 } 57 }
58 return scoped_ptr<ExtensionInstallPrompt>( 58 return scoped_ptr<ExtensionInstallPrompt>(
59 new ExtensionInstallPrompt(web_contents)); 59 new ExtensionInstallPrompt(web_contents));
60 } 60 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) { 133 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) {
134 // TODO(aa): RefererURL is cleared in some cases, for example when going 134 // 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 135 // between secure and non-secure URLs. It would be better if DownloadItem
136 // tracked the initiating page explicitly. 136 // tracked the initiating page explicitly.
137 return extensions::ExtensionManagementFactory::GetForBrowserContext(profile) 137 return extensions::ExtensionManagementFactory::GetForBrowserContext(profile)
138 ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl()); 138 ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl());
139 } 139 }
140 140
141 } // namespace download_crx_util 141 } // namespace download_crx_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698