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. |
11 #pragma comment(lib, "wtsapi32.lib") | 11 #pragma comment(lib, "wtsapi32.lib") |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
19 #include "base/time.h" | 19 #include "base/time.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/prefs/pref_registry_syncable.h" |
21 #include "chrome/browser/prefs/pref_service.h" | 22 #include "chrome/browser/prefs/pref_service.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/ui/browser_finder.h" | 24 #include "chrome/browser/ui/browser_finder.h" |
24 #include "chrome/browser/ui/browser_list.h" | 25 #include "chrome/browser/ui/browser_list.h" |
25 #include "chrome/browser/ui/browser_list_observer.h" | 26 #include "chrome/browser/ui/browser_list_observer.h" |
26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
29 | 30 |
30 namespace { | 31 namespace { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 150 |
150 ::WTSFreeMemory(buffer); | 151 ::WTSFreeMemory(buffer); |
151 } | 152 } |
152 | 153 |
153 // static | 154 // static |
154 void NetworkProfileBubble::SetNotificationShown(bool shown) { | 155 void NetworkProfileBubble::SetNotificationShown(bool shown) { |
155 notification_shown_ = shown; | 156 notification_shown_ = shown; |
156 } | 157 } |
157 | 158 |
158 // static | 159 // static |
159 void NetworkProfileBubble::RegisterUserPrefs(PrefServiceSyncable* prefs) { | 160 void NetworkProfileBubble::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
160 prefs->RegisterIntegerPref(prefs::kNetworkProfileWarningsLeft, kMaxWarnings, | 161 registry->RegisterIntegerPref(prefs::kNetworkProfileWarningsLeft, |
161 PrefServiceSyncable::UNSYNCABLE_PREF); | 162 kMaxWarnings, |
162 prefs->RegisterInt64Pref(prefs::kNetworkProfileLastWarningTime, 0, | 163 PrefRegistrySyncable::UNSYNCABLE_PREF); |
163 PrefServiceSyncable::UNSYNCABLE_PREF); | 164 registry->RegisterInt64Pref(prefs::kNetworkProfileLastWarningTime, |
| 165 0, |
| 166 PrefRegistrySyncable::UNSYNCABLE_PREF); |
164 } | 167 } |
165 | 168 |
166 // static | 169 // static |
167 void NetworkProfileBubble::RecordUmaEvent(MetricNetworkedProfileCheck event) { | 170 void NetworkProfileBubble::RecordUmaEvent(MetricNetworkedProfileCheck event) { |
168 UMA_HISTOGRAM_ENUMERATION(kMetricNetworkedProfileCheck, | 171 UMA_HISTOGRAM_ENUMERATION(kMetricNetworkedProfileCheck, |
169 event, | 172 event, |
170 METRIC_NETWORKED_PROFILE_CHECK_SIZE); | 173 METRIC_NETWORKED_PROFILE_CHECK_SIZE); |
171 } | 174 } |
172 | 175 |
173 // static | 176 // static |
174 void NetworkProfileBubble::NotifyNetworkProfileDetected() { | 177 void NetworkProfileBubble::NotifyNetworkProfileDetected() { |
175 // TODO(robertshield): Eventually, we will need to figure out the correct | 178 // TODO(robertshield): Eventually, we will need to figure out the correct |
176 // desktop type for this for platforms that can have | 179 // desktop type for this for platforms that can have |
177 // multiple desktop types (win8/metro). | 180 // multiple desktop types (win8/metro). |
178 Browser* browser = chrome::FindLastActiveWithHostDesktopType( | 181 Browser* browser = chrome::FindLastActiveWithHostDesktopType( |
179 chrome::HOST_DESKTOP_TYPE_NATIVE); | 182 chrome::HOST_DESKTOP_TYPE_NATIVE); |
180 | 183 |
181 if (browser) | 184 if (browser) |
182 ShowNotification(browser); | 185 ShowNotification(browser); |
183 else | 186 else |
184 BrowserList::AddObserver(new BrowserListObserver()); | 187 BrowserList::AddObserver(new BrowserListObserver()); |
185 } | 188 } |
OLD | NEW |