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

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

Issue 10704023: Moved ExtensionPrefs and related into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest-er master merged in Created 8 years, 5 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_util.h" 7 #include "chrome/browser/download/download_util.h"
8 #include "chrome/browser/extensions/crx_installer.h" 8 #include "chrome/browser/extensions/crx_installer.h"
9 #include "chrome/browser/extensions/extension_install_prompt.h" 9 #include "chrome/browser/extensions/extension_install_prompt.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 29 matching lines...) Expand all
40 mock_install_prompt_for_testing = NULL; 40 mock_install_prompt_for_testing = NULL;
41 } else { 41 } else {
42 Browser* browser = browser::FindLastActiveWithProfile(profile); 42 Browser* browser = browser::FindLastActiveWithProfile(profile);
43 result = chrome::CreateExtensionInstallPromptWithBrowser(browser); 43 result = chrome::CreateExtensionInstallPromptWithBrowser(browser);
44 } 44 }
45 45
46 return result; 46 return result;
47 } 47 }
48 48
49 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) { 49 bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) {
50 ExtensionPrefs* prefs = 50 extensions::ExtensionPrefs* prefs =
51 ExtensionSystem::Get(profile)->extension_service()->extension_prefs(); 51 ExtensionSystem::Get(profile)->extension_service()->extension_prefs();
52 CHECK(prefs); 52 CHECK(prefs);
53 53
54 URLPatternSet url_patterns = prefs->GetAllowedInstallSites(); 54 URLPatternSet url_patterns = prefs->GetAllowedInstallSites();
55 55
56 // TODO(aa): RefererURL is cleared in some cases, for example when going 56 // TODO(aa): RefererURL is cleared in some cases, for example when going
57 // between secure and non-secure URLs. It would be better if DownloadItem 57 // between secure and non-secure URLs. It would be better if DownloadItem
58 // tracked the initiating page explicitly. 58 // tracked the initiating page explicitly.
59 return url_patterns.MatchesURL(item.GetURL()) && 59 return url_patterns.MatchesURL(item.GetURL()) &&
60 url_patterns.MatchesURL(item.GetReferrerUrl()); 60 url_patterns.MatchesURL(item.GetReferrerUrl());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (download_item.GetMimeType() == extensions::Extension::kMimeType || 118 if (download_item.GetMimeType() == extensions::Extension::kMimeType ||
119 UserScript::IsURLUserScript(download_item.GetURL(), 119 UserScript::IsURLUserScript(download_item.GetURL(),
120 download_item.GetMimeType())) { 120 download_item.GetMimeType())) {
121 return true; 121 return true;
122 } else { 122 } else {
123 return false; 123 return false;
124 } 124 }
125 } 125 }
126 126
127 } // namespace download_crx_util 127 } // namespace download_crx_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698