| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/runtime/runtime_api.h" | 5 #include "extensions/browser/api/runtime/runtime_api.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 RemovePendingOnInstallInfoFromPref(extension->id()); | 244 RemovePendingOnInstallInfoFromPref(extension->id()); |
| 245 } | 245 } |
| 246 | 246 |
| 247 if (!dispatch_chrome_updated_event_) | 247 if (!dispatch_chrome_updated_event_) |
| 248 return; | 248 return; |
| 249 | 249 |
| 250 // Dispatch the onInstalled event with reason "chrome_update". | 250 // Dispatch the onInstalled event with reason "chrome_update". |
| 251 base::ThreadTaskRunnerHandle::Get()->PostTask( | 251 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 252 FROM_HERE, | 252 FROM_HERE, |
| 253 base::Bind(&RuntimeEventRouter::DispatchOnInstalledEvent, | 253 base::Bind(&RuntimeEventRouter::DispatchOnInstalledEvent, |
| 254 browser_context_, extension->id(), Version(), true)); | 254 browser_context_, extension->id(), base::Version(), true)); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void RuntimeAPI::OnExtensionWillBeInstalled( | 257 void RuntimeAPI::OnExtensionWillBeInstalled( |
| 258 content::BrowserContext* browser_context, | 258 content::BrowserContext* browser_context, |
| 259 const Extension* extension, | 259 const Extension* extension, |
| 260 bool is_update, | 260 bool is_update, |
| 261 const std::string& old_name) { | 261 const std::string& old_name) { |
| 262 // This extension might be disabled before it has a chance to load, e.g. if | 262 // This extension might be disabled before it has a chance to load, e.g. if |
| 263 // the extension increased its permissions. So instead of trying to send the | 263 // the extension increased its permissions. So instead of trying to send the |
| 264 // onInstalled event here, we remember the fact in prefs and fire the event | 264 // onInstalled event here, we remember the fact in prefs and fire the event |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 void RuntimeEventRouter::DispatchOnStartupEvent( | 502 void RuntimeEventRouter::DispatchOnStartupEvent( |
| 503 content::BrowserContext* context, | 503 content::BrowserContext* context, |
| 504 const std::string& extension_id) { | 504 const std::string& extension_id) { |
| 505 DispatchOnStartupEventImpl(context, extension_id, true, NULL); | 505 DispatchOnStartupEventImpl(context, extension_id, true, NULL); |
| 506 } | 506 } |
| 507 | 507 |
| 508 // static | 508 // static |
| 509 void RuntimeEventRouter::DispatchOnInstalledEvent( | 509 void RuntimeEventRouter::DispatchOnInstalledEvent( |
| 510 content::BrowserContext* context, | 510 content::BrowserContext* context, |
| 511 const std::string& extension_id, | 511 const std::string& extension_id, |
| 512 const Version& old_version, | 512 const base::Version& old_version, |
| 513 bool chrome_updated) { | 513 bool chrome_updated) { |
| 514 if (!ExtensionsBrowserClient::Get()->IsValidContext(context)) | 514 if (!ExtensionsBrowserClient::Get()->IsValidContext(context)) |
| 515 return; | 515 return; |
| 516 ExtensionSystem* system = ExtensionSystem::Get(context); | 516 ExtensionSystem* system = ExtensionSystem::Get(context); |
| 517 if (!system) | 517 if (!system) |
| 518 return; | 518 return; |
| 519 | 519 |
| 520 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); | 520 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); |
| 521 base::DictionaryValue* info = new base::DictionaryValue(); | 521 base::DictionaryValue* info = new base::DictionaryValue(); |
| 522 event_args->Append(info); | 522 event_args->Append(info); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 content::ChildProcessSecurityPolicy* policy = | 784 content::ChildProcessSecurityPolicy* policy = |
| 785 content::ChildProcessSecurityPolicy::GetInstance(); | 785 content::ChildProcessSecurityPolicy::GetInstance(); |
| 786 policy->GrantReadFileSystem(renderer_id, filesystem_id); | 786 policy->GrantReadFileSystem(renderer_id, filesystem_id); |
| 787 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 787 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 788 dict->SetString("fileSystemId", filesystem_id); | 788 dict->SetString("fileSystemId", filesystem_id); |
| 789 dict->SetString("baseName", relative_path); | 789 dict->SetString("baseName", relative_path); |
| 790 return RespondNow(OneArgument(std::move(dict))); | 790 return RespondNow(OneArgument(std::move(dict))); |
| 791 } | 791 } |
| 792 | 792 |
| 793 } // namespace extensions | 793 } // namespace extensions |
| OLD | NEW |