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

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

Issue 5730004: Rename ExtensionsService to ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 10 years 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) 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 15 matching lines...) Expand all
26 #include "base/utf_string_conversions.h" 26 #include "base/utf_string_conversions.h"
27 #include "base/values.h" 27 #include "base/values.h"
28 #include "base/win/windows_version.h" 28 #include "base/win/windows_version.h"
29 #include "chrome/browser/browser_thread.h" 29 #include "chrome/browser/browser_thread.h"
30 #include "chrome/browser/download/download_extensions.h" 30 #include "chrome/browser/download/download_extensions.h"
31 #include "chrome/browser/download/download_item.h" 31 #include "chrome/browser/download/download_item.h"
32 #include "chrome/browser/download/download_item_model.h" 32 #include "chrome/browser/download/download_item_model.h"
33 #include "chrome/browser/download/download_manager.h" 33 #include "chrome/browser/download/download_manager.h"
34 #include "chrome/browser/extensions/crx_installer.h" 34 #include "chrome/browser/extensions/crx_installer.h"
35 #include "chrome/browser/extensions/extension_install_ui.h" 35 #include "chrome/browser/extensions/extension_install_ui.h"
36 #include "chrome/browser/extensions/extensions_service.h" 36 #include "chrome/browser/extensions/extension_service.h"
37 #include "chrome/browser/history/download_create_info.h" 37 #include "chrome/browser/history/download_create_info.h"
38 #include "chrome/browser/net/chrome_url_request_context.h" 38 #include "chrome/browser/net/chrome_url_request_context.h"
39 #include "chrome/browser/profiles/profile.h" 39 #include "chrome/browser/profiles/profile.h"
40 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" 40 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
41 #include "chrome/browser/tab_contents/infobar_delegate.h" 41 #include "chrome/browser/tab_contents/infobar_delegate.h"
42 #include "chrome/browser/tab_contents/tab_contents.h" 42 #include "chrome/browser/tab_contents/tab_contents.h"
43 #include "chrome/browser/ui/browser.h" 43 #include "chrome/browser/ui/browser.h"
44 #include "chrome/common/chrome_paths.h" 44 #include "chrome/common/chrome_paths.h"
45 #include "chrome/common/notification_service.h" 45 #include "chrome/common/notification_service.h"
46 #include "chrome/common/time_format.h" 46 #include "chrome/common/time_format.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 225 }
226 #endif 226 #endif
227 } 227 }
228 228
229 void OpenChromeExtension(Profile* profile, 229 void OpenChromeExtension(Profile* profile,
230 DownloadManager* download_manager, 230 DownloadManager* download_manager,
231 const DownloadItem& download_item) { 231 const DownloadItem& download_item) {
232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
233 DCHECK(download_item.is_extension_install()); 233 DCHECK(download_item.is_extension_install());
234 234
235 ExtensionsService* service = profile->GetExtensionsService(); 235 ExtensionService* service = profile->GetExtensionService();
236 CHECK(service); 236 CHECK(service);
237 NotificationService* nservice = NotificationService::current(); 237 NotificationService* nservice = NotificationService::current();
238 GURL nonconst_download_url = download_item.url(); 238 GURL nonconst_download_url = download_item.url();
239 nservice->Notify(NotificationType::EXTENSION_READY_FOR_INSTALL, 239 nservice->Notify(NotificationType::EXTENSION_READY_FOR_INSTALL,
240 Source<DownloadManager>(download_manager), 240 Source<DownloadManager>(download_manager),
241 Details<GURL>(&nonconst_download_url)); 241 Details<GURL>(&nonconst_download_url));
242 242
243 scoped_refptr<CrxInstaller> installer( 243 scoped_refptr<CrxInstaller> installer(
244 new CrxInstaller(service, new ExtensionInstallUI(profile))); 244 new CrxInstaller(service, new ExtensionInstallUI(profile)));
245 installer->set_delete_source(true); 245 installer->set_delete_source(true);
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 // TODO(erikkay,phajdan.jr): This is apparently not being exercised in tests. 724 // TODO(erikkay,phajdan.jr): This is apparently not being exercised in tests.
725 bool IsDangerous(DownloadCreateInfo* info, Profile* profile) { 725 bool IsDangerous(DownloadCreateInfo* info, Profile* profile) {
726 DownloadDangerLevel danger_level = GetFileDangerLevel( 726 DownloadDangerLevel danger_level = GetFileDangerLevel(
727 info->suggested_path.BaseName()); 727 info->suggested_path.BaseName());
728 728
729 if (danger_level == Dangerous) { 729 if (danger_level == Dangerous) {
730 return true; 730 return true;
731 } else if (danger_level == AllowOnUserGesture && !info->has_user_gesture) { 731 } else if (danger_level == AllowOnUserGesture && !info->has_user_gesture) {
732 return true; 732 return true;
733 } else if (info->is_extension_install) { 733 } else if (info->is_extension_install) {
734 ExtensionsService* service = profile->GetExtensionsService(); 734 ExtensionService* service = profile->GetExtensionService();
735 if (!service || 735 if (!service ||
736 !service->IsDownloadFromGallery(info->url, info->referrer_url)) { 736 !service->IsDownloadFromGallery(info->url, info->referrer_url)) {
737 // Extensions that are not from the gallery are considered dangerous. 737 // Extensions that are not from the gallery are considered dangerous.
738 return true; 738 return true;
739 } 739 }
740 } 740 }
741 741
742 return false; 742 return false;
743 } 743 }
744 744
745 } // namespace download_util 745 } // namespace download_util
OLDNEW
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/extensions/all_urls_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698