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

Side by Side Diff: chrome/browser/extensions/webstore_installer.cc

Issue 10703083: Fix extensions download when default download location is drive. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extensions/webstore_installer.h" 5 #include "chrome/browser/extensions/webstore_installer.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 20 matching lines...) Expand all
31 #include "content/public/browser/download_save_info.h" 31 #include "content/public/browser/download_save_info.h"
32 #include "content/public/browser/download_url_parameters.h" 32 #include "content/public/browser/download_url_parameters.h"
33 #include "content/public/browser/navigation_controller.h" 33 #include "content/public/browser/navigation_controller.h"
34 #include "content/public/browser/navigation_entry.h" 34 #include "content/public/browser/navigation_entry.h"
35 #include "content/public/browser/notification_details.h" 35 #include "content/public/browser/notification_details.h"
36 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
37 #include "content/public/browser/notification_source.h" 37 #include "content/public/browser/notification_source.h"
38 #include "googleurl/src/gurl.h" 38 #include "googleurl/src/gurl.h"
39 #include "net/base/escape.h" 39 #include "net/base/escape.h"
40 40
41 #if defined(OS_CHROMEOS)
42 #include "chrome/browser/chromeos/gdata/gdata_util.h"
43 #endif
44
41 using content::BrowserContext; 45 using content::BrowserContext;
42 using content::BrowserThread; 46 using content::BrowserThread;
43 using content::DownloadId; 47 using content::DownloadId;
44 using content::DownloadItem; 48 using content::DownloadItem;
45 using content::DownloadManager; 49 using content::DownloadManager;
46 using content::NavigationController; 50 using content::NavigationController;
47 using content::DownloadUrlParameters; 51 using content::DownloadUrlParameters;
48 52
49 namespace { 53 namespace {
50 54
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 net::EscapeQueryParamValue(JoinString(params, '&'), true)); 90 net::EscapeQueryParamValue(JoinString(params, '&'), true));
87 DCHECK(url.is_valid()); 91 DCHECK(url.is_valid());
88 92
89 return url; 93 return url;
90 } 94 }
91 95
92 // Must be executed on the FILE thread. 96 // Must be executed on the FILE thread.
93 void GetDownloadFilePath( 97 void GetDownloadFilePath(
94 const FilePath& download_directory, const std::string& id, 98 const FilePath& download_directory, const std::string& id,
95 const base::Callback<void(const FilePath&)>& callback) { 99 const base::Callback<void(const FilePath&)>& callback) {
96 const FilePath& directory(g_download_directory_for_tests ? 100 FilePath directory(g_download_directory_for_tests ?
97 *g_download_directory_for_tests : download_directory); 101 *g_download_directory_for_tests : download_directory);
102
103 #if defined (OS_CHROMEOS)
104 // Do not use drive for extension downloads.
105 if (gdata::util::IsUnderGDataMountPoint(directory))
106 directory = download_util::GetDefaultDownloadDirectory();
107 #endif
98 108
99 // Ensure the download directory exists. TODO(asargent) - make this use 109 // Ensure the download directory exists. TODO(asargent) - make this use
100 // common code from the downloads system. 110 // common code from the downloads system.
101 if (!file_util::DirectoryExists(directory)) { 111 if (!file_util::DirectoryExists(directory)) {
102 if (!file_util::CreateDirectory(directory)) { 112 if (!file_util::CreateDirectory(directory)) {
103 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 113 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
104 base::Bind(callback, FilePath())); 114 base::Bind(callback, FilePath()));
105 return; 115 return;
106 } 116 }
107 } 117 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 351 }
342 352
343 void WebstoreInstaller::ReportSuccess() { 353 void WebstoreInstaller::ReportSuccess() {
344 if (delegate_) { 354 if (delegate_) {
345 delegate_->OnExtensionInstallSuccess(id_); 355 delegate_->OnExtensionInstallSuccess(id_);
346 delegate_ = NULL; 356 delegate_ = NULL;
347 } 357 }
348 358
349 Release(); // Balanced in Start(). 359 Release(); // Balanced in Start().
350 } 360 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698