OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/shown_sections_handler.h" | 5 #include "chrome/browser/dom_ui/shown_sections_handler.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/metrics/user_metrics.h" | 11 #include "chrome/browser/metrics/user_metrics.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/profile.h" | 13 #include "chrome/browser/profile.h" |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
16 #include "chrome/common/notification_details.h" | 16 #include "chrome/common/notification_details.h" |
17 #include "chrome/common/notification_type.h" | 17 #include "chrome/common/notification_type.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // Will cause an UMA notification if the mode of the new tab page | 22 // Will cause an UMA notification if the mode of the new tab page |
23 // was changed to hide/show the most visited thumbnails. | 23 // was changed to hide/show the most visited thumbnails. |
| 24 // TODO(aa): Needs to be updated to match newest NTP - http://crbug.com/57440 |
24 void NotifySectionDisabled(int new_mode, int old_mode, Profile *profile) { | 25 void NotifySectionDisabled(int new_mode, int old_mode, Profile *profile) { |
25 // If the oldmode HAD either thumbs or lists visible. | 26 // If the oldmode HAD either thumbs or lists visible. |
26 bool old_had_it = old_mode & THUMB; | 27 bool old_had_it = (old_mode & THUMB) && !(old_mode & MINIMIZED_THUMB); |
27 bool new_has_it = new_mode & THUMB; | 28 bool new_has_it = (new_mode & THUMB) && !(new_mode & MINIMIZED_THUMB); |
28 | 29 |
29 if (old_had_it && !new_has_it) { | 30 if (old_had_it && !new_has_it) { |
30 UserMetrics::RecordAction( | 31 UserMetrics::RecordAction( |
31 UserMetricsAction("ShowSections_RecentSitesDisabled"), | 32 UserMetricsAction("ShowSections_RecentSitesDisabled"), |
32 profile); | 33 profile); |
33 } | 34 } |
34 | 35 |
35 if (new_has_it && !old_had_it) { | 36 if (new_has_it && !old_had_it) { |
36 UserMetrics::RecordAction( | 37 UserMetrics::RecordAction( |
37 UserMetricsAction("ShowSections_RecentSitesEnabled"), | 38 UserMetricsAction("ShowSections_RecentSitesEnabled"), |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 shown_sections = APPS; | 109 shown_sections = APPS; |
109 else | 110 else |
110 shown_sections = THUMB; | 111 shown_sections = THUMB; |
111 | 112 |
112 changed = true; | 113 changed = true; |
113 } | 114 } |
114 | 115 |
115 if (changed) | 116 if (changed) |
116 pref_service->SetInteger(prefs::kNTPShownSections, shown_sections); | 117 pref_service->SetInteger(prefs::kNTPShownSections, shown_sections); |
117 } | 118 } |
OLD | NEW |