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

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

Issue 6965018: Install CRX updates one at a time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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
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 #include "chrome/browser/extensions/crx_installer.h" 5 #include "chrome/browser/extensions/crx_installer.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 std::set<std::string>& ids = g_whitelisted_install_data.Get().ids; 106 std::set<std::string>& ids = g_whitelisted_install_data.Get().ids;
107 if (ContainsKey(ids, id)) { 107 if (ContainsKey(ids, id)) {
108 ids.erase(id); 108 ids.erase(id);
109 return true; 109 return true;
110 } 110 }
111 return false; 111 return false;
112 } 112 }
113 113
114 CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak, 114 CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak,
115 ExtensionInstallUI* client) 115 ExtensionInstallUI* client)
116 : install_directory_(frontend_weak->install_directory()), 116 : install_source_(Extension::INTERNAL),
117 install_source_(Extension::INTERNAL), 117 extensions_enabled_(false), // Will be set again in body of this method.
118 extensions_enabled_(frontend_weak->extensions_enabled()),
119 delete_source_(false), 118 delete_source_(false),
120 is_gallery_install_(false), 119 is_gallery_install_(false),
121 create_app_shortcut_(false), 120 create_app_shortcut_(false),
122 frontend_weak_(frontend_weak), 121 frontend_weak_(frontend_weak),
123 client_(client), 122 client_(client),
124 apps_require_extension_mime_type_(false), 123 apps_require_extension_mime_type_(false),
125 allow_silent_install_(false), 124 allow_silent_install_(false),
126 install_cause_(extension_misc::INSTALL_CAUSE_UNSET) { 125 install_cause_(extension_misc::INSTALL_CAUSE_UNSET) {
126
127 // |frontend_weak| can be NULL at this point in unit tests.
Matt Perry 2011/05/31 21:34:25 Can we instead pass in a mock ExtensionService in
Sam Kerner (Chrome) 2011/05/31 23:16:15 There is ExtensionServiceInterface, which allows e
Matt Perry 2011/05/31 23:41:38 But I'm confused.. The rest of the code does not N
Sam Kerner (Chrome) 2011/06/01 00:15:11 Not sure what you mean: There are checks for fron
Matt Perry 2011/06/01 00:20:20 Ah, of course, sorry. That makes sense.
128 if (!frontend_weak.get())
129 return;
130
131 install_directory_ = frontend_weak->install_directory();
132 extensions_enabled_ = frontend_weak->extensions_enabled();
127 } 133 }
128 134
129 CrxInstaller::~CrxInstaller() { 135 CrxInstaller::~CrxInstaller() {
130 // Delete the temp directory and crx file as necessary. Note that the 136 // Delete the temp directory and crx file as necessary. Note that the
131 // destructor might be called on any thread, so we post a task to the file 137 // destructor might be called on any thread, so we post a task to the file
132 // thread to make sure the delete happens there. 138 // thread to make sure the delete happens there.
133 if (!temp_dir_.value().empty()) { 139 if (!temp_dir_.value().empty()) {
134 if (!BrowserThread::PostTask( 140 if (!BrowserThread::PostTask(
135 BrowserThread::FILE, FROM_HERE, 141 BrowserThread::FILE, FROM_HERE,
136 NewRunnableFunction( 142 NewRunnableFunction(
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 // Some users (such as the download shelf) need to know when a 566 // Some users (such as the download shelf) need to know when a
561 // CRXInstaller is done. Listening for the EXTENSION_* events 567 // CRXInstaller is done. Listening for the EXTENSION_* events
562 // is problematic because they don't know anything about the 568 // is problematic because they don't know anything about the
563 // extension before it is unpacked, so they can not filter based 569 // extension before it is unpacked, so they can not filter based
564 // on the extension. 570 // on the extension.
565 NotificationService::current()->Notify( 571 NotificationService::current()->Notify(
566 NotificationType::CRX_INSTALLER_DONE, 572 NotificationType::CRX_INSTALLER_DONE,
567 Source<CrxInstaller>(this), 573 Source<CrxInstaller>(this),
568 NotificationService::NoDetails()); 574 NotificationService::NoDetails());
569 } 575 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698