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 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
7 // | 7 // |
8 // OVERVIEW | 8 // OVERVIEW |
9 // | 9 // |
10 // A MetricsService instance is typically created at application startup. It | 10 // A MetricsService instance is typically created at application startup. It |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 // static | 492 // static |
493 void MetricsService::SetUpNotifications( | 493 void MetricsService::SetUpNotifications( |
494 content::NotificationRegistrar* registrar, | 494 content::NotificationRegistrar* registrar, |
495 content::NotificationObserver* observer) { | 495 content::NotificationObserver* observer) { |
496 registrar->Add(observer, chrome::NOTIFICATION_BROWSER_OPENED, | 496 registrar->Add(observer, chrome::NOTIFICATION_BROWSER_OPENED, |
497 content::NotificationService::AllBrowserContextsAndSources()); | 497 content::NotificationService::AllBrowserContextsAndSources()); |
498 registrar->Add(observer, chrome::NOTIFICATION_BROWSER_CLOSED, | 498 registrar->Add(observer, chrome::NOTIFICATION_BROWSER_CLOSED, |
499 content::NotificationService::AllSources()); | 499 content::NotificationService::AllSources()); |
500 registrar->Add(observer, content::NOTIFICATION_USER_ACTION, | 500 registrar->Add(observer, content::NOTIFICATION_USER_ACTION, |
501 content::NotificationService::AllSources()); | 501 content::NotificationService::AllSources()); |
502 registrar->Add(observer, content::NOTIFICATION_TAB_PARENTED, | 502 registrar->Add(observer, chrome::NOTIFICATION_TAB_PARENTED, |
503 content::NotificationService::AllSources()); | 503 content::NotificationService::AllSources()); |
504 registrar->Add(observer, content::NOTIFICATION_TAB_CLOSING, | 504 registrar->Add(observer, chrome::NOTIFICATION_TAB_CLOSING, |
505 content::NotificationService::AllSources()); | 505 content::NotificationService::AllSources()); |
506 registrar->Add(observer, content::NOTIFICATION_LOAD_START, | 506 registrar->Add(observer, content::NOTIFICATION_LOAD_START, |
507 content::NotificationService::AllSources()); | 507 content::NotificationService::AllSources()); |
508 registrar->Add(observer, content::NOTIFICATION_LOAD_STOP, | 508 registrar->Add(observer, content::NOTIFICATION_LOAD_STOP, |
509 content::NotificationService::AllSources()); | 509 content::NotificationService::AllSources()); |
510 registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 510 registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
511 content::NotificationService::AllSources()); | 511 content::NotificationService::AllSources()); |
512 registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_HANG, | 512 registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_HANG, |
513 content::NotificationService::AllSources()); | 513 content::NotificationService::AllSources()); |
514 registrar->Add(observer, content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED, | 514 registrar->Add(observer, content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED, |
(...skipping 23 matching lines...) Expand all Loading... |
538 case content::NOTIFICATION_USER_ACTION: | 538 case content::NOTIFICATION_USER_ACTION: |
539 log_manager_.current_log()->RecordUserAction( | 539 log_manager_.current_log()->RecordUserAction( |
540 *content::Details<const char*>(details).ptr()); | 540 *content::Details<const char*>(details).ptr()); |
541 break; | 541 break; |
542 | 542 |
543 case chrome::NOTIFICATION_BROWSER_OPENED: | 543 case chrome::NOTIFICATION_BROWSER_OPENED: |
544 case chrome::NOTIFICATION_BROWSER_CLOSED: | 544 case chrome::NOTIFICATION_BROWSER_CLOSED: |
545 LogWindowChange(type, source, details); | 545 LogWindowChange(type, source, details); |
546 break; | 546 break; |
547 | 547 |
548 case content::NOTIFICATION_TAB_PARENTED: | 548 case chrome::NOTIFICATION_TAB_PARENTED: |
549 case content::NOTIFICATION_TAB_CLOSING: | 549 case chrome::NOTIFICATION_TAB_CLOSING: |
550 LogWindowChange(type, source, details); | 550 LogWindowChange(type, source, details); |
551 break; | 551 break; |
552 | 552 |
553 case content::NOTIFICATION_LOAD_STOP: | 553 case content::NOTIFICATION_LOAD_STOP: |
554 LogLoadComplete(type, source, details); | 554 LogLoadComplete(type, source, details); |
555 break; | 555 break; |
556 | 556 |
557 case content::NOTIFICATION_LOAD_START: | 557 case content::NOTIFICATION_LOAD_START: |
558 LogLoadStarted(); | 558 LogLoadStarted(); |
559 break; | 559 break; |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 // know about. | 1304 // know about. |
1305 if (window_map_.find(window_or_tab) == window_map_.end()) { | 1305 if (window_map_.find(window_or_tab) == window_map_.end()) { |
1306 controller_id = next_window_id_++; | 1306 controller_id = next_window_id_++; |
1307 window_map_[window_or_tab] = controller_id; | 1307 window_map_[window_or_tab] = controller_id; |
1308 } else { | 1308 } else { |
1309 controller_id = window_map_[window_or_tab]; | 1309 controller_id = window_map_[window_or_tab]; |
1310 } | 1310 } |
1311 DCHECK_NE(controller_id, -1); | 1311 DCHECK_NE(controller_id, -1); |
1312 | 1312 |
1313 switch (type) { | 1313 switch (type) { |
1314 case content::NOTIFICATION_TAB_PARENTED: | 1314 case chrome::NOTIFICATION_TAB_PARENTED: |
1315 case chrome::NOTIFICATION_BROWSER_OPENED: | 1315 case chrome::NOTIFICATION_BROWSER_OPENED: |
1316 window_type = MetricsLog::WINDOW_CREATE; | 1316 window_type = MetricsLog::WINDOW_CREATE; |
1317 break; | 1317 break; |
1318 | 1318 |
1319 case content::NOTIFICATION_TAB_CLOSING: | 1319 case chrome::NOTIFICATION_TAB_CLOSING: |
1320 case chrome::NOTIFICATION_BROWSER_CLOSED: | 1320 case chrome::NOTIFICATION_BROWSER_CLOSED: |
1321 window_map_.erase(window_map_.find(window_or_tab)); | 1321 window_map_.erase(window_map_.find(window_or_tab)); |
1322 window_type = MetricsLog::WINDOW_DESTROY; | 1322 window_type = MetricsLog::WINDOW_DESTROY; |
1323 break; | 1323 break; |
1324 | 1324 |
1325 default: | 1325 default: |
1326 NOTREACHED(); | 1326 NOTREACHED(); |
1327 return; | 1327 return; |
1328 } | 1328 } |
1329 | 1329 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 if (local_state) { | 1670 if (local_state) { |
1671 const PrefService::Preference* uma_pref = | 1671 const PrefService::Preference* uma_pref = |
1672 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1672 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1673 if (uma_pref) { | 1673 if (uma_pref) { |
1674 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1674 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1675 DCHECK(success); | 1675 DCHECK(success); |
1676 } | 1676 } |
1677 } | 1677 } |
1678 return result; | 1678 return result; |
1679 } | 1679 } |
OLD | NEW |