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

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

Issue 14238037: Made it possible to tell whether an extension is being installed or updated. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added extra check. Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/state_store.h" 5 #include "chrome/browser/extensions/state_store.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "chrome/common/chrome_notification_types.h" 9 #include "chrome/common/chrome_notification_types.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 task_queue_->InvokeWhenReady( 122 task_queue_->InvokeWhenReady(
123 base::Bind(&ValueStoreFrontend::Remove, base::Unretained(&store_), 123 base::Bind(&ValueStoreFrontend::Remove, base::Unretained(&store_),
124 GetFullKey(extension_id, key))); 124 GetFullKey(extension_id, key)));
125 } 125 }
126 126
127 void StateStore::Observe(int type, 127 void StateStore::Observe(int type,
128 const content::NotificationSource& source, 128 const content::NotificationSource& source,
129 const content::NotificationDetails& details) { 129 const content::NotificationDetails& details) {
130 switch (type) { 130 switch (type) {
131 case chrome::NOTIFICATION_EXTENSION_INSTALLED: 131 case chrome::NOTIFICATION_EXTENSION_INSTALLED:
132 RemoveKeysForExtension(
133 content::Details<const InstalledExtensionInfo>(details)->extension->
134 id());
135 break;
132 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: 136 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED:
133 RemoveKeysForExtension( 137 RemoveKeysForExtension(
134 content::Details<const Extension>(details).ptr()->id()); 138 content::Details<const Extension>(details)->id());
135 break; 139 break;
136 case chrome::NOTIFICATION_SESSION_RESTORE_DONE: 140 case chrome::NOTIFICATION_SESSION_RESTORE_DONE:
137 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: 141 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME:
138 registrar_.Remove(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 142 registrar_.Remove(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
139 content::NotificationService::AllSources()); 143 content::NotificationService::AllSources());
140 registrar_.Remove(this, chrome::NOTIFICATION_SESSION_RESTORE_DONE, 144 registrar_.Remove(this, chrome::NOTIFICATION_SESSION_RESTORE_DONE,
141 content::NotificationService::AllSources()); 145 content::NotificationService::AllSources());
142 MessageLoop::current()->PostDelayedTask(FROM_HERE, 146 MessageLoop::current()->PostDelayedTask(FROM_HERE,
143 base::Bind(&StateStore::Init, AsWeakPtr()), 147 base::Bind(&StateStore::Init, AsWeakPtr()),
144 base::TimeDelta::FromSeconds(kInitDelaySeconds)); 148 base::TimeDelta::FromSeconds(kInitDelaySeconds));
(...skipping 13 matching lines...) Expand all
158 void StateStore::RemoveKeysForExtension(const std::string& extension_id) { 162 void StateStore::RemoveKeysForExtension(const std::string& extension_id) {
159 for (std::set<std::string>::iterator key = registered_keys_.begin(); 163 for (std::set<std::string>::iterator key = registered_keys_.begin();
160 key != registered_keys_.end(); ++key) { 164 key != registered_keys_.end(); ++key) {
161 task_queue_->InvokeWhenReady( 165 task_queue_->InvokeWhenReady(
162 base::Bind(&ValueStoreFrontend::Remove, base::Unretained(&store_), 166 base::Bind(&ValueStoreFrontend::Remove, base::Unretained(&store_),
163 GetFullKey(extension_id, *key))); 167 GetFullKey(extension_id, *key)));
164 } 168 }
165 } 169 }
166 170
167 } // namespace extensions 171 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/extensions/updater/extension_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698