| 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/extension_managed_mode_api.h" | 7 #include "chrome/browser/extensions/extension_managed_mode_api.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 DCHECK_EQ(std::string(prefs::kInManagedMode), pref_name); | 59 DCHECK_EQ(std::string(prefs::kInManagedMode), pref_name); |
| 60 | 60 |
| 61 ListValue args; | 61 ListValue args; |
| 62 DictionaryValue* dict = new DictionaryValue(); | 62 DictionaryValue* dict = new DictionaryValue(); |
| 63 args.Append(dict); | 63 args.Append(dict); |
| 64 dict->SetBoolean(extension_preference_api_constants::kValue, | 64 dict->SetBoolean(extension_preference_api_constants::kValue, |
| 65 g_browser_process->local_state()->GetBoolean(prefs::kInManagedMode)); | 65 g_browser_process->local_state()->GetBoolean(prefs::kInManagedMode)); |
| 66 std::string json_args; | 66 std::string json_args; |
| 67 base::JSONWriter::Write(&args, &json_args); | 67 base::JSONWriter::Write(&args, &json_args); |
| 68 ExtensionEventRouter* event_router = profile_->GetExtensionEventRouter(); | 68 ExtensionEventRouter* event_router = profile_->GetExtensionEventRouter(); |
| 69 event_router->DispatchEventToRenderers(kChangeEventName, json_args, NULL, | 69 event_router->DispatchEventToRenderers(kChangeEventName, json_args, |
| 70 GURL(), | 70 NULL, GURL()); |
| 71 extensions::EventFilteringInfo()); | |
| 72 } | 71 } |
| 73 | 72 |
| 74 GetManagedModeFunction::~GetManagedModeFunction() { } | 73 GetManagedModeFunction::~GetManagedModeFunction() { } |
| 75 | 74 |
| 76 bool GetManagedModeFunction::RunImpl() { | 75 bool GetManagedModeFunction::RunImpl() { |
| 77 bool in_managed_mode = ManagedMode::IsInManagedMode(); | 76 bool in_managed_mode = ManagedMode::IsInManagedMode(); |
| 78 | 77 |
| 79 scoped_ptr<DictionaryValue> result(new DictionaryValue); | 78 scoped_ptr<DictionaryValue> result(new DictionaryValue); |
| 80 result->SetBoolean(keys::kValue, in_managed_mode); | 79 result->SetBoolean(keys::kValue, in_managed_mode); |
| 81 result_.reset(result.release()); | 80 result_.reset(result.release()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &key)); | 119 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &key)); |
| 121 base::Value* value = NULL; | 120 base::Value* value = NULL; |
| 122 EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &value)); | 121 EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &value)); |
| 123 #if defined(ENABLE_CONFIGURATION_POLICY) | 122 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 124 policy::ManagedModePolicyProvider* policy_provider = | 123 policy::ManagedModePolicyProvider* policy_provider = |
| 125 ManagedModePolicyProviderFactory::GetForProfile(profile_); | 124 ManagedModePolicyProviderFactory::GetForProfile(profile_); |
| 126 policy_provider->SetPolicy(key, value); | 125 policy_provider->SetPolicy(key, value); |
| 127 #endif | 126 #endif |
| 128 return true; | 127 return true; |
| 129 } | 128 } |
| OLD | NEW |