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

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

Issue 2668863002: [Extensions] Remove FeatureSwitch::easy_off_store_install (Closed)
Patch Set: Add TODO for histograms Created 3 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 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"
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 878
879 // User-initiated extension downloads from pref-whitelisted sources are not 879 // User-initiated extension downloads from pref-whitelisted sources are not
880 // considered dangerous. 880 // considered dangerous.
881 if (download_->HasUserGesture() && 881 if (download_->HasUserGesture() &&
882 is_extension_download && 882 is_extension_download &&
883 download_crx_util::OffStoreInstallAllowedByPrefs( 883 download_crx_util::OffStoreInstallAllowedByPrefs(
884 GetProfile(), *download_)) { 884 GetProfile(), *download_)) {
885 return DownloadFileType::NOT_DANGEROUS; 885 return DownloadFileType::NOT_DANGEROUS;
886 } 886 }
887 887
888 #if BUILDFLAG(ENABLE_EXTENSIONS)
889 // Extensions that are not from the gallery are considered dangerous.
890 // When off-store install is disabled we skip this, since in this case, we
891 // will not offer to install the extension.
892 if (extensions::FeatureSwitch::easy_off_store_install()->IsEnabled() &&
893 is_extension_download &&
894 !extensions::WebstoreInstaller::GetAssociatedApproval(*download_)) {
895 return DownloadFileType::ALLOW_ON_USER_GESTURE;
896 }
897 #endif
898
899 // Anything the user has marked auto-open is OK if it's user-initiated. 888 // Anything the user has marked auto-open is OK if it's user-initiated.
900 if (download_prefs_->IsAutoOpenEnabledBasedOnExtension(virtual_path_) && 889 if (download_prefs_->IsAutoOpenEnabledBasedOnExtension(virtual_path_) &&
901 download_->HasUserGesture()) 890 download_->HasUserGesture())
902 return DownloadFileType::NOT_DANGEROUS; 891 return DownloadFileType::NOT_DANGEROUS;
903 892
904 DownloadFileType::DangerLevel danger_level = 893 DownloadFileType::DangerLevel danger_level =
905 safe_browsing::FileTypePolicies::GetInstance()->GetFileDangerLevel( 894 safe_browsing::FileTypePolicies::GetInstance()->GetFileDangerLevel(
906 virtual_path_.BaseName()); 895 virtual_path_.BaseName());
907 896
908 // A danger level of ALLOW_ON_USER_GESTURE is used to label potentially 897 // A danger level of ALLOW_ON_USER_GESTURE is used to label potentially
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 const base::FilePath& suggested_path) { 940 const base::FilePath& suggested_path) {
952 return base::FilePath(suggested_path.value() + kCrdownloadSuffix); 941 return base::FilePath(suggested_path.value() + kCrdownloadSuffix);
953 } 942 }
954 943
955 #if defined(OS_WIN) 944 #if defined(OS_WIN)
956 // static 945 // static
957 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() { 946 bool DownloadTargetDeterminer::IsAdobeReaderUpToDate() {
958 return g_is_adobe_reader_up_to_date_; 947 return g_is_adobe_reader_up_to_date_;
959 } 948 }
960 #endif 949 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698