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

Side by Side Diff: chrome/browser/extensions/api/runtime/runtime_api.cc

Issue 242613004: Replace NOTIFICATION_EXTENSION_LOADED to NOTIFICATION_EXTENSION_LOADED_DEPRECATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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/api/runtime/runtime_api.h" 5 #include "chrome/browser/extensions/api/runtime/runtime_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 BrowserContextKeyedAPIFactory<RuntimeAPI>* RuntimeAPI::GetFactoryInstance() { 156 BrowserContextKeyedAPIFactory<RuntimeAPI>* RuntimeAPI::GetFactoryInstance() {
157 return g_factory.Pointer(); 157 return g_factory.Pointer();
158 } 158 }
159 159
160 RuntimeAPI::RuntimeAPI(content::BrowserContext* context) 160 RuntimeAPI::RuntimeAPI(content::BrowserContext* context)
161 : browser_context_(context), 161 : browser_context_(context),
162 dispatch_chrome_updated_event_(false), 162 dispatch_chrome_updated_event_(false),
163 registered_for_updates_(false) { 163 registered_for_updates_(false) {
164 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, 164 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY,
165 content::Source<BrowserContext>(context)); 165 content::Source<BrowserContext>(context));
166 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 166 registrar_.Add(this,
167 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
167 content::Source<BrowserContext>(context)); 168 content::Source<BrowserContext>(context));
168 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, 169 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED,
169 content::Source<BrowserContext>(context)); 170 content::Source<BrowserContext>(context));
170 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, 171 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
171 content::Source<BrowserContext>(context)); 172 content::Source<BrowserContext>(context));
172 173
173 // Check if registered events are up-to-date. We can only do this once 174 // Check if registered events are up-to-date. We can only do this once
174 // per browser context, since it updates internal state when called. 175 // per browser context, since it updates internal state when called.
175 dispatch_chrome_updated_event_ = 176 dispatch_chrome_updated_event_ =
176 ExtensionsBrowserClient::Get()->DidVersionUpdate(browser_context_); 177 ExtensionsBrowserClient::Get()->DidVersionUpdate(browser_context_);
177 } 178 }
178 179
179 RuntimeAPI::~RuntimeAPI() { 180 RuntimeAPI::~RuntimeAPI() {
180 if (registered_for_updates_) { 181 if (registered_for_updates_) {
181 ExtensionSystem::Get(browser_context_)-> 182 ExtensionSystem::Get(browser_context_)->
182 extension_service()->RemoveUpdateObserver(this); 183 extension_service()->RemoveUpdateObserver(this);
183 } 184 }
184 } 185 }
185 186
186 void RuntimeAPI::Observe(int type, 187 void RuntimeAPI::Observe(int type,
187 const content::NotificationSource& source, 188 const content::NotificationSource& source,
188 const content::NotificationDetails& details) { 189 const content::NotificationDetails& details) {
189 switch (type) { 190 switch (type) {
190 case chrome::NOTIFICATION_EXTENSIONS_READY: { 191 case chrome::NOTIFICATION_EXTENSIONS_READY: {
191 OnExtensionsReady(); 192 OnExtensionsReady();
192 break; 193 break;
193 } 194 }
194 case chrome::NOTIFICATION_EXTENSION_LOADED: { 195 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
195 const Extension* extension = 196 const Extension* extension =
196 content::Details<const Extension>(details).ptr(); 197 content::Details<const Extension>(details).ptr();
197 OnExtensionLoaded(extension); 198 OnExtensionLoaded(extension);
198 break; 199 break;
199 } 200 }
200 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { 201 case chrome::NOTIFICATION_EXTENSION_INSTALLED: {
201 const Extension* extension = 202 const Extension* extension =
202 content::Details<const InstalledExtensionInfo>(details)->extension; 203 content::Details<const InstalledExtensionInfo>(details)->extension;
203 OnExtensionInstalled(extension); 204 OnExtensionInstalled(extension);
204 break; 205 break;
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 content::ChildProcessSecurityPolicy::GetInstance(); 669 content::ChildProcessSecurityPolicy::GetInstance();
669 policy->GrantReadFileSystem(renderer_id, filesystem_id); 670 policy->GrantReadFileSystem(renderer_id, filesystem_id);
670 base::DictionaryValue* dict = new base::DictionaryValue(); 671 base::DictionaryValue* dict = new base::DictionaryValue();
671 SetResult(dict); 672 SetResult(dict);
672 dict->SetString("fileSystemId", filesystem_id); 673 dict->SetString("fileSystemId", filesystem_id);
673 dict->SetString("baseName", relative_path); 674 dict->SetString("baseName", relative_path);
674 return true; 675 return true;
675 } 676 }
676 677
677 } // namespace extensions 678 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698