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

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

Issue 3353015: Implement gallery install API (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: erik comments Created 10 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/extensions/crx_installer.h » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Download utility implementation 5 // Download utility implementation
6 6
7 #include "chrome/browser/download/download_util.h" 7 #include "chrome/browser/download/download_util.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <shobjidl.h> 10 #include <shobjidl.h>
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 download_item.url()); 288 download_item.url());
289 } else { 289 } else {
290 bool is_gallery_download = ExtensionsService::IsDownloadFromGallery( 290 bool is_gallery_download = ExtensionsService::IsDownloadFromGallery(
291 download_item.url(), download_item.referrer_url()); 291 download_item.url(), download_item.referrer_url());
292 installer->set_original_mime_type(download_item.original_mime_type()); 292 installer->set_original_mime_type(download_item.original_mime_type());
293 installer->set_apps_require_extension_mime_type(true); 293 installer->set_apps_require_extension_mime_type(true);
294 installer->set_allow_privilege_increase(true); 294 installer->set_allow_privilege_increase(true);
295 installer->set_original_url(download_item.url()); 295 installer->set_original_url(download_item.url());
296 installer->set_limit_web_extent_to_download_host(!is_gallery_download); 296 installer->set_limit_web_extent_to_download_host(!is_gallery_download);
297 installer->InstallCrx(download_item.full_path()); 297 installer->InstallCrx(download_item.full_path());
298 installer->set_allow_silent_install(is_gallery_download);
298 } 299 }
299 } else { 300 } else {
300 TabContents* contents = NULL; 301 TabContents* contents = NULL;
301 // Get last active normal browser of profile. 302 // Get last active normal browser of profile.
302 Browser* last_active = 303 Browser* last_active =
303 BrowserList::FindBrowserWithType(profile, Browser::TYPE_NORMAL, true); 304 BrowserList::FindBrowserWithType(profile, Browser::TYPE_NORMAL, true);
304 if (last_active) 305 if (last_active)
305 contents = last_active->GetSelectedTabContents(); 306 contents = last_active->GetSelectedTabContents();
306 if (contents) { 307 if (contents) {
307 contents->AddInfoBar( 308 contents->AddInfoBar(
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 } 760 }
760 761
761 FilePath GetCrDownloadPath(const FilePath& suggested_path) { 762 FilePath GetCrDownloadPath(const FilePath& suggested_path) {
762 FilePath::StringType file_name; 763 FilePath::StringType file_name;
763 SStringPrintf(&file_name, PRFilePathLiteral FILE_PATH_LITERAL(".crdownload"), 764 SStringPrintf(&file_name, PRFilePathLiteral FILE_PATH_LITERAL(".crdownload"),
764 suggested_path.value().c_str()); 765 suggested_path.value().c_str());
765 return FilePath(file_name); 766 return FilePath(file_name);
766 } 767 }
767 768
768 } // namespace download_util 769 } // namespace download_util
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/crx_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698