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

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

Issue 10356052: Disable off-store extension installs by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: argh Created 8 years, 7 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 | Annotate | Revision Log
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 #include "chrome/browser/download/chrome_download_manager_delegate.h" 5 #include "chrome/browser/download/chrome_download_manager_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 bool ChromeDownloadManagerDelegate::IsExtensionDownload( 90 bool ChromeDownloadManagerDelegate::IsExtensionDownload(
91 const DownloadItem* item) { 91 const DownloadItem* item) {
92 if (item->PromptUserForSaveLocation()) 92 if (item->PromptUserForSaveLocation())
93 return false; 93 return false;
94 94
95 if ((item->GetMimeType() != Extension::kMimeType) && 95 if ((item->GetMimeType() != Extension::kMimeType) &&
96 !UserScript::IsURLUserScript(item->GetURL(), item->GetMimeType())) { 96 !UserScript::IsURLUserScript(item->GetURL(), item->GetMimeType())) {
97 return false; 97 return false;
98 } 98 }
99 99
100 return download_crx_util::ShouldOpenExtensionDownload(*item); 100 Profile* profile = Profile::FromBrowserContext(item->GetBrowserContext());
101 return download_crx_util::ShouldOpenExtensionDownload(
102 profile->GetExtensionService(), *item);
101 } 103 }
102 104
103 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { 105 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) {
104 download_manager_ = dm; 106 download_manager_ = dm;
105 download_history_.reset(new DownloadHistory(profile_)); 107 download_history_.reset(new DownloadHistory(profile_));
106 download_history_->Load( 108 download_history_->Load(
107 base::Bind(&DownloadManager::OnPersistentStoreQueryComplete, 109 base::Bind(&DownloadManager::OnPersistentStoreQueryComplete,
108 base::Unretained(dm))); 110 base::Unretained(dm)));
109 } 111 }
110 112
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 int32 download_id, int64 db_handle) { 721 int32 download_id, int64 db_handle) {
720 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 722 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
721 // call this function with an invalid |db_handle|. For instance, this can 723 // call this function with an invalid |db_handle|. For instance, this can
722 // happen when the history database is offline. We cannot have multiple 724 // happen when the history database is offline. We cannot have multiple
723 // DownloadItems with the same invalid db_handle, so we need to assign a 725 // DownloadItems with the same invalid db_handle, so we need to assign a
724 // unique |db_handle| here. 726 // unique |db_handle| here.
725 if (db_handle == DownloadItem::kUninitializedHandle) 727 if (db_handle == DownloadItem::kUninitializedHandle)
726 db_handle = download_history_->GetNextFakeDbHandle(); 728 db_handle = download_history_->GetNextFakeDbHandle();
727 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 729 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
728 } 730 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_browsertest.cc » ('j') | chrome/browser/extensions/webstore_installer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698