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

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

Issue 8503018: Split DownloadItem into an ABC, an Impl, and a Mock. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merge Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 code which handles CRX files (extensions, themes, apps, ...). 5 // Download code which handles CRX files (extensions, themes, apps, ...).
6 6
7 #include "chrome/browser/download/download_util.h" 7 #include "chrome/browser/download/download_util.h"
8 #include "chrome/browser/extensions/crx_installer.h" 8 #include "chrome/browser/extensions/crx_installer.h"
9 #include "chrome/browser/extensions/extension_install_ui.h" 9 #include "chrome/browser/extensions/extension_install_ui.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
55 55
56 ExtensionService* service = profile->GetExtensionService(); 56 ExtensionService* service = profile->GetExtensionService();
57 CHECK(service); 57 CHECK(service);
58 58
59 scoped_refptr<CrxInstaller> installer( 59 scoped_refptr<CrxInstaller> installer(
60 CrxInstaller::Create(service, CreateExtensionInstallUI(profile))); 60 CrxInstaller::Create(service, CreateExtensionInstallUI(profile)));
61 installer->set_delete_source(true); 61 installer->set_delete_source(true);
62 62
63 if (UserScript::IsURLUserScript(download_item.GetURL(), 63 if (UserScript::IsURLUserScript(download_item.GetURL(),
64 download_item.mime_type())) { 64 download_item.GetMimeType())) {
65 installer->InstallUserScript(download_item.full_path(), 65 installer->InstallUserScript(download_item.GetFullPath(),
66 download_item.GetURL()); 66 download_item.GetURL());
67 } else { 67 } else {
68 bool is_gallery_download = service->IsDownloadFromGallery( 68 bool is_gallery_download = service->IsDownloadFromGallery(
69 download_item.GetURL(), download_item.referrer_url()); 69 download_item.GetURL(), download_item.GetReferrerUrl());
70 installer->set_original_mime_type(download_item.original_mime_type()); 70 installer->set_original_mime_type(download_item.GetOriginalMimeType());
71 installer->set_apps_require_extension_mime_type(true); 71 installer->set_apps_require_extension_mime_type(true);
72 installer->set_download_url(download_item.GetURL()); 72 installer->set_download_url(download_item.GetURL());
73 installer->set_is_gallery_install(is_gallery_download); 73 installer->set_is_gallery_install(is_gallery_download);
74 if (is_gallery_download) 74 if (is_gallery_download)
75 installer->set_original_download_url(download_item.original_url()); 75 installer->set_original_download_url(download_item.GetOriginalUrl());
76 installer->set_allow_silent_install(is_gallery_download); 76 installer->set_allow_silent_install(is_gallery_download);
77 installer->set_install_cause(extension_misc::INSTALL_CAUSE_USER_DOWNLOAD); 77 installer->set_install_cause(extension_misc::INSTALL_CAUSE_USER_DOWNLOAD);
78 installer->InstallCrx(download_item.full_path()); 78 installer->InstallCrx(download_item.GetFullPath());
79 } 79 }
80 80
81 return installer; 81 return installer;
82 } 82 }
83 83
84 } // namespace download_crx_util 84 } // namespace download_crx_util
OLDNEW
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/download/download_extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698