| OLD | NEW |
| 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 // Implementation of the Chrome Extensions Managed Mode API. | 5 // Implementation of the Chrome Extensions Managed Mode API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/managed_mode/managed_mode_api.h" | 7 #include "chrome/browser/extensions/api/managed_mode/managed_mode_api.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void ExtensionManagedModeEventRouter::OnInManagedModeChanged() { | 54 void ExtensionManagedModeEventRouter::OnInManagedModeChanged() { |
| 55 DictionaryValue* dict = new DictionaryValue(); | 55 DictionaryValue* dict = new DictionaryValue(); |
| 56 dict->SetBoolean( | 56 dict->SetBoolean( |
| 57 keys::kValue, | 57 keys::kValue, |
| 58 g_browser_process->local_state()->GetBoolean(prefs::kInManagedMode)); | 58 g_browser_process->local_state()->GetBoolean(prefs::kInManagedMode)); |
| 59 scoped_ptr<ListValue> args(new ListValue()); | 59 scoped_ptr<ListValue> args(new ListValue()); |
| 60 args->Set(0, dict); | 60 args->Set(0, dict); |
| 61 | 61 |
| 62 extensions::EventRouter* event_router = | 62 extensions::EventRouter* event_router = |
| 63 extensions::ExtensionSystem::Get(profile_)->event_router(); | 63 extensions::ExtensionSystem::Get(profile_)->event_router(); |
| 64 event_router->DispatchEventToRenderers(kChangeEventName, args.Pass(), NULL, | 64 scoped_ptr<extensions::Event> event(new extensions::Event( |
| 65 GURL(), | 65 kChangeEventName, args.Pass())); |
| 66 extensions::EventFilteringInfo()); | 66 event_router->BroadcastEvent(event.Pass()); |
| 67 } | 67 } |
| 68 | 68 |
| 69 GetManagedModeFunction::~GetManagedModeFunction() { } | 69 GetManagedModeFunction::~GetManagedModeFunction() { } |
| 70 | 70 |
| 71 bool GetManagedModeFunction::RunImpl() { | 71 bool GetManagedModeFunction::RunImpl() { |
| 72 bool in_managed_mode = ManagedMode::IsInManagedMode(); | 72 bool in_managed_mode = ManagedMode::IsInManagedMode(); |
| 73 | 73 |
| 74 scoped_ptr<DictionaryValue> result(new DictionaryValue); | 74 scoped_ptr<DictionaryValue> result(new DictionaryValue); |
| 75 result->SetBoolean(keys::kValue, in_managed_mode); | 75 result->SetBoolean(keys::kValue, in_managed_mode); |
| 76 SetResult(result.release()); | 76 SetResult(result.release()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &value)); | 117 EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &value)); |
| 118 #if defined(ENABLE_CONFIGURATION_POLICY) | 118 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 119 policy::ManagedModePolicyProvider* policy_provider = | 119 policy::ManagedModePolicyProvider* policy_provider = |
| 120 profile_->GetManagedModePolicyProvider(); | 120 profile_->GetManagedModePolicyProvider(); |
| 121 policy_provider->SetPolicy(key, value); | 121 policy_provider->SetPolicy(key, value); |
| 122 #endif | 122 #endif |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace extensions | 126 } // namespace extensions |
| OLD | NEW |