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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | « chrome/browser/debugger/devtools_window.cc ('k') | chrome/browser/download/download_util.cc » ('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) 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"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/chrome_notification_types.h" 12 #include "chrome/common/chrome_notification_types.h"
13 #include "content/browser/download/download_item.h" 13 #include "content/browser/download/download_item.h"
14 #include "content/common/notification_service.h" 14 #include "content/public/browser/notification_service.h"
15 15
16 namespace download_crx_util { 16 namespace download_crx_util {
17 17
18 namespace { 18 namespace {
19 19
20 // Hold a mock ExtensionInstallUI object that will be used when the 20 // Hold a mock ExtensionInstallUI object that will be used when the
21 // download system opens a CRX. 21 // download system opens a CRX.
22 ExtensionInstallUI* mock_install_ui_for_testing = NULL; 22 ExtensionInstallUI* mock_install_ui_for_testing = NULL;
23 23
24 // Called to get an extension install UI object. In tests, will return 24 // Called to get an extension install UI object. In tests, will return
(...skipping 21 matching lines...) Expand all
46 mock_install_ui_for_testing = mock_ui; 46 mock_install_ui_for_testing = mock_ui;
47 } 47 }
48 48
49 scoped_refptr<CrxInstaller> OpenChromeExtension( 49 scoped_refptr<CrxInstaller> OpenChromeExtension(
50 Profile* profile, 50 Profile* profile,
51 const DownloadItem& download_item) { 51 const DownloadItem& download_item) {
52 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 52 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
53 53
54 ExtensionService* service = profile->GetExtensionService(); 54 ExtensionService* service = profile->GetExtensionService();
55 CHECK(service); 55 CHECK(service);
56 NotificationService* nservice = NotificationService::current(); 56 content::NotificationService* nservice =
57 content::NotificationService::current();
57 GURL nonconst_download_url = download_item.GetURL(); 58 GURL nonconst_download_url = download_item.GetURL();
58 nservice->Notify(chrome::NOTIFICATION_EXTENSION_READY_FOR_INSTALL, 59 nservice->Notify(chrome::NOTIFICATION_EXTENSION_READY_FOR_INSTALL,
59 content::Source<Profile>(profile), 60 content::Source<Profile>(profile),
60 content::Details<GURL>(&nonconst_download_url)); 61 content::Details<GURL>(&nonconst_download_url));
61 62
62 scoped_refptr<CrxInstaller> installer( 63 scoped_refptr<CrxInstaller> installer(
63 service->MakeCrxInstaller(CreateExtensionInstallUI(profile))); 64 service->MakeCrxInstaller(CreateExtensionInstallUI(profile)));
64 installer->set_delete_source(true); 65 installer->set_delete_source(true);
65 66
66 if (UserScript::IsURLUserScript(download_item.GetURL(), 67 if (UserScript::IsURLUserScript(download_item.GetURL(),
(...skipping 11 matching lines...) Expand all
78 installer->set_original_download_url(download_item.original_url()); 79 installer->set_original_download_url(download_item.original_url());
79 installer->set_allow_silent_install(is_gallery_download); 80 installer->set_allow_silent_install(is_gallery_download);
80 installer->set_install_cause(extension_misc::INSTALL_CAUSE_USER_DOWNLOAD); 81 installer->set_install_cause(extension_misc::INSTALL_CAUSE_USER_DOWNLOAD);
81 installer->InstallCrx(download_item.full_path()); 82 installer->InstallCrx(download_item.full_path());
82 } 83 }
83 84
84 return installer; 85 return installer;
85 } 86 }
86 87
87 } // namespace download_crx_util 88 } // namespace download_crx_util
OLDNEW
« no previous file with comments | « chrome/browser/debugger/devtools_window.cc ('k') | chrome/browser/download/download_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698