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

Side by Side Diff: chrome/browser/extensions/api/managed_mode/managed_mode_api.cc

Issue 11232066: Remove GetExtensionEventRouter from Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rerebase Created 8 years, 1 month 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 | Annotate | Revision Log
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 // 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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/extensions/api/preference/preference_api_constants.h" 14 #include "chrome/browser/extensions/api/preference/preference_api_constants.h"
15 #include "chrome/browser/extensions/event_router.h" 15 #include "chrome/browser/extensions/event_router.h"
16 #include "chrome/browser/extensions/extension_system.h"
16 #include "chrome/browser/managed_mode/managed_mode.h" 17 #include "chrome/browser/managed_mode/managed_mode.h"
17 #include "chrome/browser/prefs/pref_service.h" 18 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/common/chrome_notification_types.h" 20 #include "chrome/common/chrome_notification_types.h"
20 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
21 #include "content/public/browser/notification_details.h" 22 #include "content/public/browser/notification_details.h"
22 23
23 #if defined(ENABLE_CONFIGURATION_POLICY) 24 #if defined(ENABLE_CONFIGURATION_POLICY)
24 #include "chrome/browser/policy/managed_mode_policy_provider.h" 25 #include "chrome/browser/policy/managed_mode_policy_provider.h"
25 #endif 26 #endif
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 *content::Details<std::string>(details).ptr(); 60 *content::Details<std::string>(details).ptr();
60 DCHECK_EQ(std::string(prefs::kInManagedMode), pref_name); 61 DCHECK_EQ(std::string(prefs::kInManagedMode), pref_name);
61 62
62 DictionaryValue* dict = new DictionaryValue(); 63 DictionaryValue* dict = new DictionaryValue();
63 dict->SetBoolean( 64 dict->SetBoolean(
64 keys::kValue, 65 keys::kValue,
65 g_browser_process->local_state()->GetBoolean(prefs::kInManagedMode)); 66 g_browser_process->local_state()->GetBoolean(prefs::kInManagedMode));
66 scoped_ptr<ListValue> args(new ListValue()); 67 scoped_ptr<ListValue> args(new ListValue());
67 args->Set(0, dict); 68 args->Set(0, dict);
68 69
69 extensions::EventRouter* event_router = profile_->GetExtensionEventRouter(); 70 extensions::EventRouter* event_router =
71 extensions::ExtensionSystem::Get(profile_)->event_router();
70 event_router->DispatchEventToRenderers(kChangeEventName, args.Pass(), NULL, 72 event_router->DispatchEventToRenderers(kChangeEventName, args.Pass(), NULL,
71 GURL(), 73 GURL(),
72 extensions::EventFilteringInfo()); 74 extensions::EventFilteringInfo());
73 } 75 }
74 76
75 GetManagedModeFunction::~GetManagedModeFunction() { } 77 GetManagedModeFunction::~GetManagedModeFunction() { }
76 78
77 bool GetManagedModeFunction::RunImpl() { 79 bool GetManagedModeFunction::RunImpl() {
78 bool in_managed_mode = ManagedMode::IsInManagedMode(); 80 bool in_managed_mode = ManagedMode::IsInManagedMode();
79 81
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &value)); 125 EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &value));
124 #if defined(ENABLE_CONFIGURATION_POLICY) 126 #if defined(ENABLE_CONFIGURATION_POLICY)
125 policy::ManagedModePolicyProvider* policy_provider = 127 policy::ManagedModePolicyProvider* policy_provider =
126 profile_->GetManagedModePolicyProvider(); 128 profile_->GetManagedModePolicyProvider();
127 policy_provider->SetPolicy(key, value); 129 policy_provider->SetPolicy(key, value);
128 #endif 130 #endif
129 return true; 131 return true;
130 } 132 }
131 133
132 } // namespace extensions 134 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/input_ime/input_ime_api.cc ('k') | chrome/browser/extensions/api/management/management_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698