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

Side by Side Diff: chrome/browser/extensions/system/system_api.cc

Issue 9604001: Fix crash during ChromeOS login (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const char kNeedRestartState[] = "NeedRestart"; 43 const char kNeedRestartState[] = "NeedRestart";
44 44
45 // Event names. 45 // Event names.
46 const char kOnBrightnessChanged[] = "systemPrivate.onBrightnessChanged"; 46 const char kOnBrightnessChanged[] = "systemPrivate.onBrightnessChanged";
47 const char kOnVolumeChanged[] = "systemPrivate.onVolumeChanged"; 47 const char kOnVolumeChanged[] = "systemPrivate.onVolumeChanged";
48 const char kOnScreenUnlocked[] = "systemPrivate.onScreenUnlocked"; 48 const char kOnScreenUnlocked[] = "systemPrivate.onScreenUnlocked";
49 const char kOnWokeUp[] = "systemPrivate.onWokeUp"; 49 const char kOnWokeUp[] = "systemPrivate.onWokeUp";
50 50
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();
54 if (!profile)
55 return;
56 ExtensionEventRouter* extension_event_router =
57 profile->GetExtensionEventRouter();
58 if (!extension_event_router)
59 return;
53 std::string json_args; 60 std::string json_args;
54 base::JSONWriter::Write(&args, false, &json_args); 61 base::JSONWriter::Write(&args, false, &json_args);
55 ProfileManager::GetDefaultProfile()->GetExtensionEventRouter()-> 62 extension_event_router->DispatchEventToRenderers(
56 DispatchEventToRenderers(event_name, json_args, NULL, GURL()); 63 event_name, json_args, NULL, GURL());
57 } 64 }
58 65
59 } // namespace 66 } // namespace
60 67
61 namespace extensions { 68 namespace extensions {
62 69
63 bool GetIncognitoModeAvailabilityFunction::RunImpl() { 70 bool GetIncognitoModeAvailabilityFunction::RunImpl() {
64 PrefService* prefs = profile_->GetPrefs(); 71 PrefService* prefs = profile_->GetPrefs();
65 int value = prefs->GetInteger(prefs::kIncognitoModeAvailability); 72 int value = prefs->GetInteger(prefs::kIncognitoModeAvailability);
66 EXTENSION_FUNCTION_VALIDATE( 73 EXTENSION_FUNCTION_VALIDATE(
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 ListValue args; 161 ListValue args;
155 DispatchEvent(kOnScreenUnlocked, args); 162 DispatchEvent(kOnScreenUnlocked, args);
156 } 163 }
157 164
158 void DispatchWokeUpEvent() { 165 void DispatchWokeUpEvent() {
159 ListValue args; 166 ListValue args;
160 DispatchEvent(kOnWokeUp, args); 167 DispatchEvent(kOnWokeUp, args);
161 } 168 }
162 169
163 } // namespace extensions 170 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698