| Index: chrome/browser/extensions/system/system_api.cc
|
| diff --git a/chrome/browser/extensions/system/system_api.cc b/chrome/browser/extensions/system/system_api.cc
|
| index 1e1eff642351709030c7ce181f49759432dc83fe..24ae6e9d97f8fac4aa130bcfa090e2e5c2fd7b37 100644
|
| --- a/chrome/browser/extensions/system/system_api.cc
|
| +++ b/chrome/browser/extensions/system/system_api.cc
|
| @@ -7,6 +7,7 @@
|
| #include "base/json/json_writer.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/extensions/event_router.h"
|
| +#include "chrome/browser/extensions/extension_system.h"
|
| #include "chrome/browser/prefs/pref_service.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| @@ -49,12 +50,17 @@ const char kOnScreenUnlocked[] = "systemPrivate.onScreenUnlocked";
|
| const char kOnWokeUp[] = "systemPrivate.onWokeUp";
|
|
|
| // Dispatches an extension event with |args|
|
| -void DispatchEvent(const std::string& event_name, base::Value* argument) {
|
| - Profile* profile = ProfileManager::GetDefaultProfile();
|
| - if (!profile)
|
| +void DispatchEvent(Profile* profile,
|
| + const std::string& event_name,
|
| + base::Value* argument) {
|
| + DCHECK(profile);
|
| +
|
| + extensions::ExtensionSystem* extension_system =
|
| + extensions::ExtensionSystem::Get(profile);
|
| + if (!extension_system)
|
| return;
|
| extensions::EventRouter* extension_event_router =
|
| - profile->GetExtensionEventRouter();
|
| + extension_system->event_router();
|
| if (!extension_event_router)
|
| return;
|
|
|
| @@ -142,26 +148,30 @@ bool GetUpdateStatusFunction::RunImpl() {
|
| return true;
|
| }
|
|
|
| -void DispatchVolumeChangedEvent(double volume, bool is_volume_muted) {
|
| +void DispatchVolumeChangedEvent(Profile* profile,
|
| + double volume,
|
| + bool is_volume_muted) {
|
| DictionaryValue* dict = new DictionaryValue();
|
| dict->SetDouble(kVolumeKey, volume);
|
| dict->SetBoolean(kIsVolumeMutedKey, is_volume_muted);
|
| - DispatchEvent(kOnVolumeChanged, dict);
|
| + DispatchEvent(profile, kOnVolumeChanged, dict);
|
| }
|
|
|
| -void DispatchBrightnessChangedEvent(int brightness, bool user_initiated) {
|
| +void DispatchBrightnessChangedEvent(Profile* profile,
|
| + int brightness,
|
| + bool user_initiated) {
|
| DictionaryValue* dict = new DictionaryValue();
|
| dict->SetInteger(kBrightnessKey, brightness);
|
| dict->SetBoolean(kUserInitiatedKey, user_initiated);
|
| - DispatchEvent(kOnBrightnessChanged, dict);
|
| + DispatchEvent(profile, kOnBrightnessChanged, dict);
|
| }
|
|
|
| -void DispatchScreenUnlockedEvent() {
|
| - DispatchEvent(kOnScreenUnlocked, NULL);
|
| +void DispatchScreenUnlockedEvent(Profile* profile) {
|
| + DispatchEvent(profile, kOnScreenUnlocked, NULL);
|
| }
|
|
|
| -void DispatchWokeUpEvent() {
|
| - DispatchEvent(kOnWokeUp, NULL);
|
| +void DispatchWokeUpEvent(Profile* profile) {
|
| + DispatchEvent(profile, kOnWokeUp, NULL);
|
| }
|
|
|
| } // namespace extensions
|
|
|