OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file defines a service that collects information about the user | 5 // This file defines a service that collects information about the user |
6 // experience in order to help improve future versions of the app. | 6 // experience in order to help improve future versions of the app. |
7 | 7 |
8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
10 #pragma once | 10 #pragma once |
11 | 11 |
12 #include <map> | 12 #include <map> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/memory/weak_ptr.h" |
19 #include "base/process_util.h" | 20 #include "base/process_util.h" |
20 #include "chrome/browser/io_thread.h" | 21 #include "chrome/browser/io_thread.h" |
21 #include "chrome/common/metrics_helpers.h" | 22 #include "chrome/common/metrics_helpers.h" |
22 #include "content/common/child_process_info.h" | 23 #include "content/common/child_process_info.h" |
23 #include "content/public/common/url_fetcher_delegate.h" | 24 #include "content/public/common/url_fetcher_delegate.h" |
24 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
25 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
26 | 27 |
27 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
28 #include "chrome/browser/chromeos/external_metrics.h" | 29 #include "chrome/browser/chromeos/external_metrics.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // it. |next_window_id_| is used to track which IDs we have used so far. | 362 // it. |next_window_id_| is used to track which IDs we have used so far. |
362 typedef std::map<uintptr_t, int> WindowMap; | 363 typedef std::map<uintptr_t, int> WindowMap; |
363 WindowMap window_map_; | 364 WindowMap window_map_; |
364 int next_window_id_; | 365 int next_window_id_; |
365 | 366 |
366 // Buffer of child process notifications for quick access. See | 367 // Buffer of child process notifications for quick access. See |
367 // ChildProcessStats documentation above for more details. | 368 // ChildProcessStats documentation above for more details. |
368 struct ChildProcessStats; | 369 struct ChildProcessStats; |
369 std::map<string16, ChildProcessStats> child_process_stats_buffer_; | 370 std::map<string16, ChildProcessStats> child_process_stats_buffer_; |
370 | 371 |
371 ScopedRunnableMethodFactory<MetricsService> log_sender_factory_; | 372 base::WeakPtrFactory<MetricsService> log_sender_weak_factory_; |
372 ScopedRunnableMethodFactory<MetricsService> state_saver_factory_; | 373 base::WeakPtrFactory<MetricsService> state_saver_weak_factory_; |
373 | 374 |
374 // Dictionary containing all the profile specific metrics. This is set | 375 // Dictionary containing all the profile specific metrics. This is set |
375 // at creation time from the prefs. | 376 // at creation time from the prefs. |
376 scoped_ptr<base::DictionaryValue> profile_dictionary_; | 377 scoped_ptr<base::DictionaryValue> profile_dictionary_; |
377 | 378 |
378 // The scheduler for determining when uploads should happen. | 379 // The scheduler for determining when uploads should happen. |
379 scoped_ptr<MetricsReportingScheduler> scheduler_; | 380 scoped_ptr<MetricsReportingScheduler> scheduler_; |
380 | 381 |
381 // Indicates that an asynchronous reporting step is running. | 382 // Indicates that an asynchronous reporting step is running. |
382 // This is used only for debugging. | 383 // This is used only for debugging. |
(...skipping 22 matching lines...) Expand all Loading... |
405 friend class InstantFieldTrial; | 406 friend class InstantFieldTrial; |
406 friend bool prerender::IsOmniboxEnabled(Profile* profile); | 407 friend bool prerender::IsOmniboxEnabled(Profile* profile); |
407 | 408 |
408 // Returns true if prefs::kMetricsReportingEnabled is set. | 409 // Returns true if prefs::kMetricsReportingEnabled is set. |
409 static bool IsMetricsReportingEnabled(); | 410 static bool IsMetricsReportingEnabled(); |
410 | 411 |
411 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); | 412 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); |
412 }; | 413 }; |
413 | 414 |
414 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 415 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
OLD | NEW |