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 #include "chrome/browser/extensions/system/system_api.h" | 5 #include "chrome/browser/extensions/system/system_api.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/extension_event_router.h" | 9 #include "chrome/browser/extensions/extension_event_router.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Dispatches an extension event with |args| | 51 // Dispatches an extension event with |args| |
52 void DispatchEvent(const std::string& event_name, const ListValue& args) { | 52 void DispatchEvent(const std::string& event_name, const ListValue& args) { |
53 Profile* profile = ProfileManager::GetDefaultProfile(); | 53 Profile* profile = ProfileManager::GetDefaultProfile(); |
54 if (!profile) | 54 if (!profile) |
55 return; | 55 return; |
56 ExtensionEventRouter* extension_event_router = | 56 ExtensionEventRouter* extension_event_router = |
57 profile->GetExtensionEventRouter(); | 57 profile->GetExtensionEventRouter(); |
58 if (!extension_event_router) | 58 if (!extension_event_router) |
59 return; | 59 return; |
60 std::string json_args; | 60 std::string json_args; |
61 base::JSONWriter::Write(&args, false, &json_args); | 61 base::JSONWriter::Write(&args, &json_args); |
62 extension_event_router->DispatchEventToRenderers( | 62 extension_event_router->DispatchEventToRenderers( |
63 event_name, json_args, NULL, GURL()); | 63 event_name, json_args, NULL, GURL()); |
64 } | 64 } |
65 | 65 |
66 } // namespace | 66 } // namespace |
67 | 67 |
68 namespace extensions { | 68 namespace extensions { |
69 | 69 |
70 bool GetIncognitoModeAvailabilityFunction::RunImpl() { | 70 bool GetIncognitoModeAvailabilityFunction::RunImpl() { |
71 PrefService* prefs = profile_->GetPrefs(); | 71 PrefService* prefs = profile_->GetPrefs(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 ListValue args; | 161 ListValue args; |
162 DispatchEvent(kOnScreenUnlocked, args); | 162 DispatchEvent(kOnScreenUnlocked, args); |
163 } | 163 } |
164 | 164 |
165 void DispatchWokeUpEvent() { | 165 void DispatchWokeUpEvent() { |
166 ListValue args; | 166 ListValue args; |
167 DispatchEvent(kOnWokeUp, args); | 167 DispatchEvent(kOnWokeUp, args); |
168 } | 168 } |
169 | 169 |
170 } // namespace extensions | 170 } // namespace extensions |
OLD | NEW |