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

Side by Side Diff: chrome/browser/extensions/extension_idle_api.cc

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. 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
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/extension_idle_api.h" 5 #include "chrome/browser/extensions/extension_idle_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // Don't send the response, it'll be sent by our callback 168 // Don't send the response, it'll be sent by our callback
169 return true; 169 return true;
170 } 170 }
171 171
172 void ExtensionIdleEventRouter::OnIdleStateChange(Profile* profile, 172 void ExtensionIdleEventRouter::OnIdleStateChange(Profile* profile,
173 IdleState state) { 173 IdleState state) {
174 // Prepare the single argument of the current state. 174 // Prepare the single argument of the current state.
175 ListValue args; 175 ListValue args;
176 args.Append(CreateIdleValue(state)); 176 args.Append(CreateIdleValue(state));
177 std::string json_args; 177 std::string json_args;
178 base::JSONWriter::Write(&args, false, &json_args); 178 base::JSONWriter::Write(&args, &json_args);
179 179
180 profile->GetExtensionEventRouter()->DispatchEventToRenderers( 180 profile->GetExtensionEventRouter()->DispatchEventToRenderers(
181 keys::kOnStateChanged, json_args, profile, GURL()); 181 keys::kOnStateChanged, json_args, profile, GURL());
182 } 182 }
183 183
184 ExtensionIdleCache::CacheData ExtensionIdleCache::cached_data = 184 ExtensionIdleCache::CacheData ExtensionIdleCache::cached_data =
185 {-1, -1, -1, -1}; 185 {-1, -1, -1, -1};
186 186
187 IdleState ExtensionIdleCache::CalculateIdleState(int threshold) { 187 IdleState ExtensionIdleCache::CalculateIdleState(int threshold) {
188 return CalculateState(threshold, base::Time::Now().ToDoubleT()); 188 return CalculateState(threshold, base::Time::Now().ToDoubleT());
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 261 }
262 } 262 }
263 263
264 int ExtensionIdleCache::get_min_threshold() { 264 int ExtensionIdleCache::get_min_threshold() {
265 return kMinThreshold; 265 return kMinThreshold;
266 } 266 }
267 267
268 double ExtensionIdleCache::get_throttle_interval() { 268 double ExtensionIdleCache::get_throttle_interval() {
269 return static_cast<double>(kThrottleInterval); 269 return static_cast<double>(kThrottleInterval);
270 } 270 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_function.cc ('k') | chrome/browser/extensions/extension_input_ime_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698