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

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

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month 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_target_determiner.h" 5 #include "chrome/browser/download/download_target_determiner.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "chrome/browser/download/chrome_download_manager_delegate.h" 14 #include "chrome/browser/download/chrome_download_manager_delegate.h"
15 #include "chrome/browser/download/download_crx_util.h" 15 #include "chrome/browser/download/download_crx_util.h"
16 #include "chrome/browser/download/download_prefs.h" 16 #include "chrome/browser/download/download_prefs.h"
17 #include "chrome/browser/history/history_service_factory.h" 17 #include "chrome/browser/history/history_service_factory.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/common/safe_browsing/file_type_policies.h" 20 #include "chrome/common/safe_browsing/file_type_policies.h"
21 #include "chrome/grit/generated_resources.h" 21 #include "chrome/grit/generated_resources.h"
22 #include "components/history/core/browser/history_service.h" 22 #include "components/history/core/browser/history_service.h"
23 #include "components/mime_util/mime_util.h" 23 #include "components/mime_util/mime_util.h"
24 #include "components/prefs/pref_service.h" 24 #include "components/prefs/pref_service.h"
25 #include "content/public/browser/browser_context.h" 25 #include "content/public/browser/browser_context.h"
26 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/download_interrupt_reasons.h" 27 #include "content/public/browser/download_interrupt_reasons.h"
28 #include "extensions/common/constants.h" 28 #include "extensions/common/constants.h"
29 #include "extensions/features/features.h"
29 #include "net/base/filename_util.h" 30 #include "net/base/filename_util.h"
30 #include "ui/base/l10n/l10n_util.h" 31 #include "ui/base/l10n/l10n_util.h"
31 #include "url/origin.h" 32 #include "url/origin.h"
32 33
33 #if defined(ENABLE_EXTENSIONS) 34 #if BUILDFLAG(ENABLE_EXTENSIONS)
34 #include "chrome/browser/extensions/webstore_installer.h" 35 #include "chrome/browser/extensions/webstore_installer.h"
35 #include "extensions/common/feature_switch.h" 36 #include "extensions/common/feature_switch.h"
36 #endif 37 #endif
37 38
38 #if defined(ENABLE_PLUGINS) 39 #if defined(ENABLE_PLUGINS)
39 #include "chrome/browser/plugins/plugin_prefs.h" 40 #include "chrome/browser/plugins/plugin_prefs.h"
40 #include "content/public/browser/plugin_service.h" 41 #include "content/public/browser/plugin_service.h"
41 #include "content/public/common/webplugininfo.h" 42 #include "content/public/common/webplugininfo.h"
42 #endif 43 #endif
43 44
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 869
869 // User-initiated extension downloads from pref-whitelisted sources are not 870 // User-initiated extension downloads from pref-whitelisted sources are not
870 // considered dangerous. 871 // considered dangerous.
871 if (download_->HasUserGesture() && 872 if (download_->HasUserGesture() &&
872 is_extension_download && 873 is_extension_download &&
873 download_crx_util::OffStoreInstallAllowedByPrefs( 874 download_crx_util::OffStoreInstallAllowedByPrefs(
874 GetProfile(), *download_)) { 875 GetProfile(), *download_)) {
875 return DownloadFileType::NOT_DANGEROUS; 876 return DownloadFileType::NOT_DANGEROUS;
876 } 877 }
877 878
878 #if defined(ENABLE_EXTENSIONS) 879 #if BUILDFLAG(ENABLE_EXTENSIONS)
879 // Extensions that are not from the gallery are considered dangerous. 880 // Extensions that are not from the gallery are considered dangerous.
880 // When off-store install is disabled we skip this, since in this case, we 881 // When off-store install is disabled we skip this, since in this case, we
881 // will not offer to install the extension. 882 // will not offer to install the extension.
882 if (extensions::FeatureSwitch::easy_off_store_install()->IsEnabled() && 883 if (extensions::FeatureSwitch::easy_off_store_install()->IsEnabled() &&
883 is_extension_download && 884 is_extension_download &&
884 !extensions::WebstoreInstaller::GetAssociatedApproval(*download_)) { 885 !extensions::WebstoreInstaller::GetAssociatedApproval(*download_)) {
885 return DownloadFileType::ALLOW_ON_USER_GESTURE; 886 return DownloadFileType::ALLOW_ON_USER_GESTURE;
886 } 887 }
887 #endif 888 #endif
888 889
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 const base::FilePath& suggested_path) { 942 const base::FilePath& suggested_path) {
942 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); 943 return base::FilePath(suggested_path.value() + kCrdownloadSuffix);
943 } 944 }
944 945
945 #if defined(OS_WIN) 946 #if defined(OS_WIN)
946 // static 947 // static
947 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { 948 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() {
948 return g_is_adobe_reader_up_to_date_; 949 return g_is_adobe_reader_up_to_date_;
949 } 950 }
950 #endif 951 #endif
OLDNEW
« no previous file with comments | « chrome/browser/download/download_service_impl.cc ('k') | chrome/browser/download/download_target_determiner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698