blob: 2f9253e40336bc3c7078b49a710b3a89fd237981 [file] [log] [blame]
[email protected]85ed9d42010-06-08 22:37:441// Copyright (c) 2010 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
[email protected]cd1adc22009-01-16 01:29:225#include "chrome/browser/metrics/metrics_log.h"
initial.commit09911bf2008-07-26 23:55:296
[email protected]978df342009-11-24 06:21:537#include "base/base64.h"
[email protected]9165f742010-03-10 22:55:018#include "base/time.h"
[email protected]d1be67b2008-11-19 20:28:389#include "base/basictypes.h"
initial.commit09911bf2008-07-26 23:55:2910#include "base/file_util.h"
11#include "base/file_version_info.h"
12#include "base/md5.h"
[email protected]85ed9d42010-06-08 22:37:4413#include "base/perftimer.h"
initial.commit09911bf2008-07-26 23:55:2914#include "base/scoped_ptr.h"
15#include "base/string_util.h"
[email protected]fadf97f2008-09-18 12:18:1416#include "base/sys_info.h"
[email protected]1cb92b82010-03-08 23:12:1517#include "base/utf_string_conversions.h"
[email protected]37f39e42010-01-06 17:35:1718#include "base/third_party/nspr/prtime.h"
[email protected]bcff05a2010-04-14 01:46:4319#include "chrome/app/chrome_version_info.h"
initial.commit09911bf2008-07-26 23:55:2920#include "chrome/browser/autocomplete/autocomplete.h"
21#include "chrome/browser/browser_process.h"
[email protected]e8c287c872010-07-20 00:49:4222#include "chrome/browser/gpu_process_host.h"
[email protected]052313b2010-02-19 09:43:0823#include "chrome/browser/pref_service.h"
initial.commit09911bf2008-07-26 23:55:2924#include "chrome/common/logging_chrome.h"
25#include "chrome/common/pref_names.h"
[email protected]46072d42008-07-28 14:49:3526#include "googleurl/src/gurl.h"
initial.commit09911bf2008-07-26 23:55:2927
28#define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name)
29
[email protected]d1be67b2008-11-19 20:28:3830// http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
31#if defined(OS_WIN)
32extern "C" IMAGE_DOS_HEADER __ImageBase;
33#endif
34
[email protected]1226abb2010-06-10 18:01:2835MetricsLog::MetricsLog(const std::string& client_id, int session_id)
36 : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {}
[email protected]5ed7d4572009-12-23 17:42:4137
[email protected]1226abb2010-06-10 18:01:2838MetricsLog::~MetricsLog() {}
initial.commit09911bf2008-07-26 23:55:2939
40// static
41void MetricsLog::RegisterPrefs(PrefService* local_state) {
42 local_state->RegisterListPref(prefs::kStabilityPluginStats);
initial.commit09911bf2008-07-26 23:55:2943}
44
[email protected]9165f742010-03-10 22:55:0145int64 MetricsLog::GetIncrementalUptime(PrefService* pref) {
46 base::TimeTicks now = base::TimeTicks::Now();
47 static base::TimeTicks last_updated_time(now);
48 int64 incremental_time = (now - last_updated_time).InSeconds();
49 last_updated_time = now;
50
51 if (incremental_time > 0) {
52 int64 metrics_uptime = pref->GetInt64(prefs::kUninstallMetricsUptimeSec);
53 metrics_uptime += incremental_time;
54 pref->SetInt64(prefs::kUninstallMetricsUptimeSec, metrics_uptime);
55 }
56
57 return incremental_time;
58}
59
initial.commit09911bf2008-07-26 23:55:2960std::string MetricsLog::GetInstallDate() const {
61 PrefService* pref = g_browser_process->local_state();
62 if (pref) {
[email protected]ddd231e2010-06-29 20:35:1963 return pref->GetString(prefs::kMetricsClientIDTimestamp);
initial.commit09911bf2008-07-26 23:55:2964 } else {
65 NOTREACHED();
66 return "0";
67 }
68}
69
[email protected]1226abb2010-06-10 18:01:2870// static
71std::string MetricsLog::GetVersionString() {
72 scoped_ptr<FileVersionInfo> version_info(
73 chrome_app::GetChromeVersionInfo());
74 if (version_info.get()) {
75 std::string version = WideToUTF8(version_info->product_version());
76 if (!version_extension_.empty())
77 version += version_extension_;
78 if (!version_info->is_official_build())
79 version.append("-devel");
80 return version;
81 } else {
82 NOTREACHED() << "Unable to retrieve version string.";
83 }
84
85 return std::string();
86}
87
[email protected]0b33f80b2008-12-17 21:34:3688void MetricsLog::RecordIncrementalStabilityElements() {
89 DCHECK(!locked_);
90
91 PrefService* pref = g_browser_process->local_state();
92 DCHECK(pref);
93
[email protected]147bbc0b2009-01-06 19:37:4094 OPEN_ELEMENT_FOR_SCOPE("profile");
95 WriteCommonEventAttributes();
96
97 WriteInstallElement(); // Supply appversion.
98
99 {
100 OPEN_ELEMENT_FOR_SCOPE("stability"); // Minimal set of stability elements.
101 WriteRequiredStabilityAttributes(pref);
102 WriteRealtimeStabilityAttributes(pref);
103
104 WritePluginStabilityElements(pref);
105 }
[email protected]0b33f80b2008-12-17 21:34:36106}
107
initial.commit09911bf2008-07-26 23:55:29108void MetricsLog::WriteStabilityElement() {
109 DCHECK(!locked_);
110
111 PrefService* pref = g_browser_process->local_state();
112 DCHECK(pref);
113
114 // Get stability attributes out of Local State, zeroing out stored values.
115 // NOTE: This could lead to some data loss if this report isn't successfully
116 // sent, but that's true for all the metrics.
117
[email protected]ffaf78a2008-11-12 17:38:33118 OPEN_ELEMENT_FOR_SCOPE("stability");
[email protected]147bbc0b2009-01-06 19:37:40119 WriteRequiredStabilityAttributes(pref);
120 WriteRealtimeStabilityAttributes(pref);
initial.commit09911bf2008-07-26 23:55:29121
[email protected]0b33f80b2008-12-17 21:34:36122 // TODO(jar): The following are all optional, so we *could* optimize them for
123 // values of zero (and not include them).
[email protected]8e674e42008-07-30 16:05:48124 WriteIntAttribute("incompleteshutdowncount",
125 pref->GetInteger(
126 prefs::kStabilityIncompleteSessionEndCount));
127 pref->SetInteger(prefs::kStabilityIncompleteSessionEndCount, 0);
[email protected]0b33f80b2008-12-17 21:34:36128
129
[email protected]e73c01972008-08-13 00:18:24130 WriteIntAttribute("breakpadregistrationok",
131 pref->GetInteger(prefs::kStabilityBreakpadRegistrationSuccess));
132 pref->SetInteger(prefs::kStabilityBreakpadRegistrationSuccess, 0);
133 WriteIntAttribute("breakpadregistrationfail",
134 pref->GetInteger(prefs::kStabilityBreakpadRegistrationFail));
135 pref->SetInteger(prefs::kStabilityBreakpadRegistrationFail, 0);
136 WriteIntAttribute("debuggerpresent",
137 pref->GetInteger(prefs::kStabilityDebuggerPresent));
138 pref->SetInteger(prefs::kStabilityDebuggerPresent, 0);
139 WriteIntAttribute("debuggernotpresent",
140 pref->GetInteger(prefs::kStabilityDebuggerNotPresent));
141 pref->SetInteger(prefs::kStabilityDebuggerNotPresent, 0);
initial.commit09911bf2008-07-26 23:55:29142
[email protected]147bbc0b2009-01-06 19:37:40143 WritePluginStabilityElements(pref);
144}
145
146void MetricsLog::WritePluginStabilityElements(PrefService* pref) {
147 // Now log plugin stability info.
initial.commit09911bf2008-07-26 23:55:29148 const ListValue* plugin_stats_list = pref->GetList(
149 prefs::kStabilityPluginStats);
150 if (plugin_stats_list) {
[email protected]ffaf78a2008-11-12 17:38:33151 OPEN_ELEMENT_FOR_SCOPE("plugins");
initial.commit09911bf2008-07-26 23:55:29152 for (ListValue::const_iterator iter = plugin_stats_list->begin();
153 iter != plugin_stats_list->end(); ++iter) {
154 if (!(*iter)->IsType(Value::TYPE_DICTIONARY)) {
155 NOTREACHED();
156 continue;
157 }
158 DictionaryValue* plugin_dict = static_cast<DictionaryValue*>(*iter);
159
[email protected]8e50b602009-03-03 22:59:43160 std::wstring plugin_name;
161 plugin_dict->GetString(prefs::kStabilityPluginName, &plugin_name);
initial.commit09911bf2008-07-26 23:55:29162
[email protected]ffaf78a2008-11-12 17:38:33163 OPEN_ELEMENT_FOR_SCOPE("pluginstability");
[email protected]a27a9382009-02-11 23:55:10164 // Use "filename" instead of "name", otherwise we need to update the
165 // UMA servers.
[email protected]8e50b602009-03-03 22:59:43166 WriteAttribute("filename", CreateBase64Hash(WideToUTF8(plugin_name)));
initial.commit09911bf2008-07-26 23:55:29167
168 int launches = 0;
[email protected]8e50b602009-03-03 22:59:43169 plugin_dict->GetInteger(prefs::kStabilityPluginLaunches, &launches);
initial.commit09911bf2008-07-26 23:55:29170 WriteIntAttribute("launchcount", launches);
171
172 int instances = 0;
[email protected]8e50b602009-03-03 22:59:43173 plugin_dict->GetInteger(prefs::kStabilityPluginInstances, &instances);
initial.commit09911bf2008-07-26 23:55:29174 WriteIntAttribute("instancecount", instances);
175
176 int crashes = 0;
[email protected]8e50b602009-03-03 22:59:43177 plugin_dict->GetInteger(prefs::kStabilityPluginCrashes, &crashes);
initial.commit09911bf2008-07-26 23:55:29178 WriteIntAttribute("crashcount", crashes);
initial.commit09911bf2008-07-26 23:55:29179 }
180
181 pref->ClearPref(prefs::kStabilityPluginStats);
initial.commit09911bf2008-07-26 23:55:29182 }
initial.commit09911bf2008-07-26 23:55:29183}
184
[email protected]147bbc0b2009-01-06 19:37:40185void MetricsLog::WriteRequiredStabilityAttributes(PrefService* pref) {
[email protected]0b33f80b2008-12-17 21:34:36186 // The server refuses data that doesn't have certain values. crashcount and
187 // launchcount are currently "required" in the "stability" group.
188 WriteIntAttribute("launchcount",
189 pref->GetInteger(prefs::kStabilityLaunchCount));
190 pref->SetInteger(prefs::kStabilityLaunchCount, 0);
191 WriteIntAttribute("crashcount",
192 pref->GetInteger(prefs::kStabilityCrashCount));
193 pref->SetInteger(prefs::kStabilityCrashCount, 0);
194}
195
[email protected]147bbc0b2009-01-06 19:37:40196void MetricsLog::WriteRealtimeStabilityAttributes(PrefService* pref) {
[email protected]0b33f80b2008-12-17 21:34:36197 // Update the stats which are critical for real-time stability monitoring.
198 // Since these are "optional," only list ones that are non-zero, as the counts
199 // are aggergated (summed) server side.
200
201 int count = pref->GetInteger(prefs::kStabilityPageLoadCount);
202 if (count) {
203 WriteIntAttribute("pageloadcount", count);
204 pref->SetInteger(prefs::kStabilityPageLoadCount, 0);
205 }
206
207 count = pref->GetInteger(prefs::kStabilityRendererCrashCount);
208 if (count) {
209 WriteIntAttribute("renderercrashcount", count);
210 pref->SetInteger(prefs::kStabilityRendererCrashCount, 0);
211 }
212
[email protected]1f085622009-12-04 05:33:45213 count = pref->GetInteger(prefs::kStabilityExtensionRendererCrashCount);
214 if (count) {
215 WriteIntAttribute("extensionrenderercrashcount", count);
216 pref->SetInteger(prefs::kStabilityExtensionRendererCrashCount, 0);
217 }
218
[email protected]0b33f80b2008-12-17 21:34:36219 count = pref->GetInteger(prefs::kStabilityRendererHangCount);
220 if (count) {
221 WriteIntAttribute("rendererhangcount", count);
222 pref->SetInteger(prefs::kStabilityRendererHangCount, 0);
223 }
[email protected]1f085622009-12-04 05:33:45224
225 count = pref->GetInteger(prefs::kStabilityChildProcessCrashCount);
226 if (count) {
227 WriteIntAttribute("childprocesscrashcount", count);
228 pref->SetInteger(prefs::kStabilityChildProcessCrashCount, 0);
229 }
[email protected]9165f742010-03-10 22:55:01230
231 int64 recent_duration = GetIncrementalUptime(pref);
232 if (recent_duration)
233 WriteInt64Attribute("uptimesec", recent_duration);
[email protected]0b33f80b2008-12-17 21:34:36234}
235
initial.commit09911bf2008-07-26 23:55:29236void MetricsLog::WritePluginList(
237 const std::vector<WebPluginInfo>& plugin_list) {
238 DCHECK(!locked_);
239
[email protected]ffaf78a2008-11-12 17:38:33240 OPEN_ELEMENT_FOR_SCOPE("plugins");
initial.commit09911bf2008-07-26 23:55:29241
242 for (std::vector<WebPluginInfo>::const_iterator iter = plugin_list.begin();
243 iter != plugin_list.end(); ++iter) {
[email protected]ffaf78a2008-11-12 17:38:33244 OPEN_ELEMENT_FOR_SCOPE("plugin");
initial.commit09911bf2008-07-26 23:55:29245
246 // Plugin name and filename are hashed for the privacy of those
247 // testing unreleased new extensions.
[email protected]c9d811372010-06-23 21:44:57248 WriteAttribute("name", CreateBase64Hash(UTF16ToUTF8(iter->name)));
[email protected]046344c2009-01-13 00:54:21249 WriteAttribute("filename",
250 CreateBase64Hash(WideToUTF8(iter->path.BaseName().ToWStringHack())));
[email protected]c9d811372010-06-23 21:44:57251 WriteAttribute("version", UTF16ToUTF8(iter->version));
initial.commit09911bf2008-07-26 23:55:29252 }
initial.commit09911bf2008-07-26 23:55:29253}
254
[email protected]147bbc0b2009-01-06 19:37:40255void MetricsLog::WriteInstallElement() {
256 OPEN_ELEMENT_FOR_SCOPE("install");
257 WriteAttribute("installdate", GetInstallDate());
258 WriteIntAttribute("buildid", 0); // We're using appversion instead.
[email protected]147bbc0b2009-01-06 19:37:40259}
260
initial.commit09911bf2008-07-26 23:55:29261void MetricsLog::RecordEnvironment(
262 const std::vector<WebPluginInfo>& plugin_list,
263 const DictionaryValue* profile_metrics) {
264 DCHECK(!locked_);
265
266 PrefService* pref = g_browser_process->local_state();
267
[email protected]ffaf78a2008-11-12 17:38:33268 OPEN_ELEMENT_FOR_SCOPE("profile");
initial.commit09911bf2008-07-26 23:55:29269 WriteCommonEventAttributes();
270
[email protected]147bbc0b2009-01-06 19:37:40271 WriteInstallElement();
initial.commit09911bf2008-07-26 23:55:29272
273 WritePluginList(plugin_list);
274
275 WriteStabilityElement();
276
277 {
278 OPEN_ELEMENT_FOR_SCOPE("cpu");
[email protected]05f9b682008-09-29 22:18:01279 WriteAttribute("arch", base::SysInfo::CPUArchitecture());
initial.commit09911bf2008-07-26 23:55:29280 }
281
282 {
initial.commit09911bf2008-07-26 23:55:29283 OPEN_ELEMENT_FOR_SCOPE("memory");
[email protected]ed6fc352008-09-18 12:44:40284 WriteIntAttribute("mb", base::SysInfo::AmountOfPhysicalMemoryMB());
[email protected]d1be67b2008-11-19 20:28:38285#if defined(OS_WIN)
286 WriteIntAttribute("dllbase", reinterpret_cast<int>(&__ImageBase));
287#endif
initial.commit09911bf2008-07-26 23:55:29288 }
289
290 {
291 OPEN_ELEMENT_FOR_SCOPE("os");
292 WriteAttribute("name",
[email protected]05f9b682008-09-29 22:18:01293 base::SysInfo::OperatingSystemName());
initial.commit09911bf2008-07-26 23:55:29294 WriteAttribute("version",
[email protected]05f9b682008-09-29 22:18:01295 base::SysInfo::OperatingSystemVersion());
initial.commit09911bf2008-07-26 23:55:29296 }
297
298 {
[email protected]e8c287c872010-07-20 00:49:42299 OPEN_ELEMENT_FOR_SCOPE("gpu");
300 WriteIntAttribute("vendorid",
301 GpuProcessHost::Get()->gpu_info().vendor_id());
302 WriteIntAttribute("deviceid",
303 GpuProcessHost::Get()->gpu_info().device_id());
304 }
305
306 {
initial.commit09911bf2008-07-26 23:55:29307 OPEN_ELEMENT_FOR_SCOPE("display");
308 int width = 0;
309 int height = 0;
[email protected]05f9b682008-09-29 22:18:01310 base::SysInfo::GetPrimaryDisplayDimensions(&width, &height);
initial.commit09911bf2008-07-26 23:55:29311 WriteIntAttribute("xsize", width);
312 WriteIntAttribute("ysize", height);
[email protected]05f9b682008-09-29 22:18:01313 WriteIntAttribute("screens", base::SysInfo::DisplayCount());
initial.commit09911bf2008-07-26 23:55:29314 }
315
316 {
317 OPEN_ELEMENT_FOR_SCOPE("bookmarks");
318 int num_bookmarks_on_bookmark_bar =
319 pref->GetInteger(prefs::kNumBookmarksOnBookmarkBar);
320 int num_folders_on_bookmark_bar =
321 pref->GetInteger(prefs::kNumFoldersOnBookmarkBar);
322 int num_bookmarks_in_other_bookmarks_folder =
323 pref->GetInteger(prefs::kNumBookmarksInOtherBookmarkFolder);
324 int num_folders_in_other_bookmarks_folder =
325 pref->GetInteger(prefs::kNumFoldersInOtherBookmarkFolder);
326 {
327 OPEN_ELEMENT_FOR_SCOPE("bookmarklocation");
328 WriteAttribute("name", "full-tree");
329 WriteIntAttribute("foldercount",
330 num_folders_on_bookmark_bar + num_folders_in_other_bookmarks_folder);
331 WriteIntAttribute("itemcount",
332 num_bookmarks_on_bookmark_bar +
333 num_bookmarks_in_other_bookmarks_folder);
334 }
335 {
336 OPEN_ELEMENT_FOR_SCOPE("bookmarklocation");
337 WriteAttribute("name", "toolbar");
338 WriteIntAttribute("foldercount", num_folders_on_bookmark_bar);
339 WriteIntAttribute("itemcount", num_bookmarks_on_bookmark_bar);
340 }
341 }
342
343 {
344 OPEN_ELEMENT_FOR_SCOPE("keywords");
345 WriteIntAttribute("count", pref->GetInteger(prefs::kNumKeywords));
346 }
347
348 if (profile_metrics)
349 WriteAllProfilesMetrics(*profile_metrics);
initial.commit09911bf2008-07-26 23:55:29350}
351
352void MetricsLog::WriteAllProfilesMetrics(
353 const DictionaryValue& all_profiles_metrics) {
354 const std::wstring profile_prefix(prefs::kProfilePrefix);
355 for (DictionaryValue::key_iterator i = all_profiles_metrics.begin_keys();
356 i != all_profiles_metrics.end_keys(); ++i) {
[email protected]8e50b602009-03-03 22:59:43357 const std::wstring& key_name = *i;
initial.commit09911bf2008-07-26 23:55:29358 if (key_name.compare(0, profile_prefix.size(), profile_prefix) == 0) {
359 DictionaryValue* profile;
[email protected]4dad9ad82009-11-25 20:47:52360 if (all_profiles_metrics.GetDictionaryWithoutPathExpansion(key_name,
361 &profile))
initial.commit09911bf2008-07-26 23:55:29362 WriteProfileMetrics(key_name.substr(profile_prefix.size()), *profile);
363 }
364 }
365}
366
367void MetricsLog::WriteProfileMetrics(const std::wstring& profileidhash,
368 const DictionaryValue& profile_metrics) {
369 OPEN_ELEMENT_FOR_SCOPE("userprofile");
370 WriteAttribute("profileidhash", WideToUTF8(profileidhash));
371 for (DictionaryValue::key_iterator i = profile_metrics.begin_keys();
372 i != profile_metrics.end_keys(); ++i) {
373 Value* value;
[email protected]4dad9ad82009-11-25 20:47:52374 if (profile_metrics.GetWithoutPathExpansion(*i, &value)) {
[email protected]8e50b602009-03-03 22:59:43375 DCHECK(*i != L"id");
initial.commit09911bf2008-07-26 23:55:29376 switch (value->GetType()) {
377 case Value::TYPE_STRING: {
[email protected]5e324b72008-12-18 00:07:59378 std::string string_value;
initial.commit09911bf2008-07-26 23:55:29379 if (value->GetAsString(&string_value)) {
380 OPEN_ELEMENT_FOR_SCOPE("profileparam");
[email protected]8e50b602009-03-03 22:59:43381 WriteAttribute("name", WideToUTF8(*i));
[email protected]5e324b72008-12-18 00:07:59382 WriteAttribute("value", string_value);
initial.commit09911bf2008-07-26 23:55:29383 }
384 break;
385 }
386
387 case Value::TYPE_BOOLEAN: {
388 bool bool_value;
389 if (value->GetAsBoolean(&bool_value)) {
390 OPEN_ELEMENT_FOR_SCOPE("profileparam");
[email protected]8e50b602009-03-03 22:59:43391 WriteAttribute("name", WideToUTF8(*i));
initial.commit09911bf2008-07-26 23:55:29392 WriteIntAttribute("value", bool_value ? 1 : 0);
393 }
394 break;
395 }
396
397 case Value::TYPE_INTEGER: {
398 int int_value;
399 if (value->GetAsInteger(&int_value)) {
400 OPEN_ELEMENT_FOR_SCOPE("profileparam");
[email protected]8e50b602009-03-03 22:59:43401 WriteAttribute("name", WideToUTF8(*i));
initial.commit09911bf2008-07-26 23:55:29402 WriteIntAttribute("value", int_value);
403 }
404 break;
405 }
406
407 default:
408 NOTREACHED();
409 break;
410 }
411 }
412 }
413}
414
415void MetricsLog::RecordOmniboxOpenedURL(const AutocompleteLog& log) {
416 DCHECK(!locked_);
417
[email protected]ffaf78a2008-11-12 17:38:33418 OPEN_ELEMENT_FOR_SCOPE("uielement");
initial.commit09911bf2008-07-26 23:55:29419 WriteAttribute("action", "autocomplete");
420 WriteAttribute("targetidhash", "");
421 // TODO(kochi): Properly track windows.
422 WriteIntAttribute("window", 0);
423 WriteCommonEventAttributes();
424
[email protected]ffaf78a2008-11-12 17:38:33425 {
426 OPEN_ELEMENT_FOR_SCOPE("autocomplete");
initial.commit09911bf2008-07-26 23:55:29427
[email protected]ffaf78a2008-11-12 17:38:33428 WriteIntAttribute("typedlength", static_cast<int>(log.text.length()));
429 WriteIntAttribute("selectedindex", static_cast<int>(log.selected_index));
430 WriteIntAttribute("completedlength",
431 static_cast<int>(log.inline_autocompleted_length));
[email protected]381e2992008-12-16 01:41:00432 const std::string input_type(
433 AutocompleteInput::TypeToString(log.input_type));
434 if (!input_type.empty())
435 WriteAttribute("inputtype", input_type);
initial.commit09911bf2008-07-26 23:55:29436
[email protected]ffaf78a2008-11-12 17:38:33437 for (AutocompleteResult::const_iterator i(log.result.begin());
438 i != log.result.end(); ++i) {
439 OPEN_ELEMENT_FOR_SCOPE("autocompleteitem");
440 if (i->provider)
441 WriteAttribute("provider", i->provider->name());
[email protected]381e2992008-12-16 01:41:00442 const std::string result_type(AutocompleteMatch::TypeToString(i->type));
443 if (!result_type.empty())
444 WriteAttribute("resulttype", result_type);
[email protected]ffaf78a2008-11-12 17:38:33445 WriteIntAttribute("relevance", i->relevance);
446 WriteIntAttribute("isstarred", i->starred ? 1 : 0);
447 }
initial.commit09911bf2008-07-26 23:55:29448 }
initial.commit09911bf2008-07-26 23:55:29449
450 ++num_events_;
451}