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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 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
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() { 109 ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
110 } 110 }
111 111
112 bool ChromeDownloadManagerDelegate::IsExtensionDownload( 112 bool ChromeDownloadManagerDelegate::IsExtensionDownload(
113 const DownloadItem* item) { 113 const DownloadItem* item) {
114 if (item->PromptUserForSaveLocation()) 114 if (item->PromptUserForSaveLocation())
115 return false; 115 return false;
116 116
117 if (item->GetMimeType() == Extension::kMimeType || 117 if (item->GetMimeType() == extensions::Extension::kMimeType ||
118 UserScript::IsURLUserScript(item->GetURL(), item->GetMimeType())) { 118 UserScript::IsURLUserScript(item->GetURL(), item->GetMimeType())) {
119 return true; 119 return true;
120 } else { 120 } else {
121 return false; 121 return false;
122 } 122 }
123 } 123 }
124 124
125 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { 125 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) {
126 download_manager_ = dm; 126 download_manager_ = dm;
127 download_history_.reset(new DownloadHistory(profile_)); 127 download_history_.reset(new DownloadHistory(profile_));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 return last_active ? last_active->GetSelectedWebContents() : NULL; 205 return last_active ? last_active->GetSelectedWebContents() : NULL;
206 #endif 206 #endif
207 } 207 }
208 208
209 209
210 bool ChromeDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( 210 bool ChromeDownloadManagerDelegate::ShouldOpenFileBasedOnExtension(
211 const FilePath& path) { 211 const FilePath& path) {
212 FilePath::StringType extension = path.Extension(); 212 FilePath::StringType extension = path.Extension();
213 if (extension.empty()) 213 if (extension.empty())
214 return false; 214 return false;
215 if (Extension::IsExtension(path)) 215 if (extensions::Extension::IsExtension(path))
216 return false; 216 return false;
217 DCHECK(extension[0] == FilePath::kExtensionSeparator); 217 DCHECK(extension[0] == FilePath::kExtensionSeparator);
218 extension.erase(0, 1); 218 extension.erase(0, 1);
219 return download_prefs_->IsAutoOpenEnabledForExtension(extension); 219 return download_prefs_->IsAutoOpenEnabledForExtension(extension);
220 } 220 }
221 221
222 // static 222 // static
223 void ChromeDownloadManagerDelegate::DisableSafeBrowsing(DownloadItem* item) { 223 void ChromeDownloadManagerDelegate::DisableSafeBrowsing(DownloadItem* item) {
224 #if defined(ENABLE_SAFE_BROWSING) 224 #if defined(ENABLE_SAFE_BROWSING)
225 SafeBrowsingState* state = static_cast<SafeBrowsingState*>( 225 SafeBrowsingState* state = static_cast<SafeBrowsingState*>(
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 int32 download_id, int64 db_handle) { 769 int32 download_id, int64 db_handle) {
770 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 770 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
771 // call this function with an invalid |db_handle|. For instance, this can 771 // call this function with an invalid |db_handle|. For instance, this can
772 // happen when the history database is offline. We cannot have multiple 772 // happen when the history database is offline. We cannot have multiple
773 // DownloadItems with the same invalid db_handle, so we need to assign a 773 // DownloadItems with the same invalid db_handle, so we need to assign a
774 // unique |db_handle| here. 774 // unique |db_handle| here.
775 if (db_handle == DownloadItem::kUninitializedHandle) 775 if (db_handle == DownloadItem::kUninitializedHandle)
776 db_handle = download_history_->GetNextFakeDbHandle(); 776 db_handle = download_history_->GetNextFakeDbHandle();
777 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 777 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
778 } 778 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698