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 #include "chrome/browser/ui/network_profile_bubble.h" | 5 #include "chrome/browser/ui/network_profile_bubble.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <wtsapi32.h> | 9 #include <wtsapi32.h> |
10 // Make sure we link the wtsapi lib file in. | 10 // Make sure we link the wtsapi lib file in. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 ::WTSFreeMemory(buffer); | 149 ::WTSFreeMemory(buffer); |
150 } | 150 } |
151 | 151 |
152 // static | 152 // static |
153 void NetworkProfileBubble::SetNotificationShown(bool shown) { | 153 void NetworkProfileBubble::SetNotificationShown(bool shown) { |
154 notification_shown_ = shown; | 154 notification_shown_ = shown; |
155 } | 155 } |
156 | 156 |
157 // static | 157 // static |
158 void NetworkProfileBubble::RegisterPrefs(PrefService* prefs) { | 158 void NetworkProfileBubble::RegisterUserPrefs(PrefServiceSyncable* prefs) { |
159 prefs->RegisterIntegerPref(prefs::kNetworkProfileWarningsLeft, | 159 prefs->RegisterIntegerPref(prefs::kNetworkProfileWarningsLeft, kMaxWarnings, |
160 kMaxWarnings, | 160 PrefServiceSyncable::UNSYNCABLE_PREF); |
161 PrefService::UNSYNCABLE_PREF); | 161 prefs->RegisterInt64Pref(prefs::kNetworkProfileLastWarningTime, 0, |
162 prefs->RegisterInt64Pref(prefs::kNetworkProfileLastWarningTime, | 162 PrefServiceSyncable::UNSYNCABLE_PREF); |
163 0, | |
164 PrefService::UNSYNCABLE_PREF); | |
165 } | 163 } |
166 | 164 |
167 // static | 165 // static |
168 void NetworkProfileBubble::RecordUmaEvent(MetricNetworkedProfileCheck event) { | 166 void NetworkProfileBubble::RecordUmaEvent(MetricNetworkedProfileCheck event) { |
169 UMA_HISTOGRAM_ENUMERATION(kMetricNetworkedProfileCheck, | 167 UMA_HISTOGRAM_ENUMERATION(kMetricNetworkedProfileCheck, |
170 event, | 168 event, |
171 METRIC_NETWORKED_PROFILE_CHECK_SIZE); | 169 METRIC_NETWORKED_PROFILE_CHECK_SIZE); |
172 } | 170 } |
173 | 171 |
174 // static | 172 // static |
175 void NetworkProfileBubble::NotifyNetworkProfileDetected() { | 173 void NetworkProfileBubble::NotifyNetworkProfileDetected() { |
176 // TODO(robertshield): Eventually, we will need to figure out the correct | 174 // TODO(robertshield): Eventually, we will need to figure out the correct |
177 // desktop type for this for platforms that can have | 175 // desktop type for this for platforms that can have |
178 // multiple desktop types (win8/metro). | 176 // multiple desktop types (win8/metro). |
179 Browser* browser = chrome::FindLastActiveWithHostDesktopType( | 177 Browser* browser = chrome::FindLastActiveWithHostDesktopType( |
180 chrome::HOST_DESKTOP_TYPE_NATIVE); | 178 chrome::HOST_DESKTOP_TYPE_NATIVE); |
181 | 179 |
182 if (browser) | 180 if (browser) |
183 ShowNotification(browser); | 181 ShowNotification(browser); |
184 else | 182 else |
185 BrowserList::AddObserver(new BrowserListObserver()); | 183 BrowserList::AddObserver(new BrowserListObserver()); |
186 } | 184 } |
OLD | NEW |