Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: chrome/browser/ui/network_profile_bubble.cc

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add to PrefRegistrySyncable and PrefServiceSyncable to let sync know of pre-registered prefs. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 149
149 ::WTSFreeMemory(buffer); 150 ::WTSFreeMemory(buffer);
150 } 151 }
151 152
152 // static 153 // static
153 void NetworkProfileBubble::SetNotificationShown(bool shown) { 154 void NetworkProfileBubble::SetNotificationShown(bool shown) {
154 notification_shown_ = shown; 155 notification_shown_ = shown;
155 } 156 }
156 157
157 // static 158 // static
158 void NetworkProfileBubble::RegisterUserPrefs(PrefServiceSyncable* prefs) { 159 void NetworkProfileBubble::RegisterUserPrefs(PrefRegistrySyncable* registry) {
159 prefs->RegisterIntegerPref(prefs::kNetworkProfileWarningsLeft, kMaxWarnings, 160 registry->RegisterIntegerPref(prefs::kNetworkProfileWarningsLeft,
160 PrefServiceSyncable::UNSYNCABLE_PREF); 161 kMaxWarnings,
161 prefs->RegisterInt64Pref(prefs::kNetworkProfileLastWarningTime, 0, 162 PrefRegistrySyncable::UNSYNCABLE_PREF);
162 PrefServiceSyncable::UNSYNCABLE_PREF); 163 registry->RegisterInt64Pref(prefs::kNetworkProfileLastWarningTime,
164 0,
165 PrefRegistrySyncable::UNSYNCABLE_PREF);
163 } 166 }
164 167
165 // static 168 // static
166 void NetworkProfileBubble::RecordUmaEvent(MetricNetworkedProfileCheck event) { 169 void NetworkProfileBubble::RecordUmaEvent(MetricNetworkedProfileCheck event) {
167 UMA_HISTOGRAM_ENUMERATION(kMetricNetworkedProfileCheck, 170 UMA_HISTOGRAM_ENUMERATION(kMetricNetworkedProfileCheck,
168 event, 171 event,
169 METRIC_NETWORKED_PROFILE_CHECK_SIZE); 172 METRIC_NETWORKED_PROFILE_CHECK_SIZE);
170 } 173 }
171 174
172 // static 175 // static
173 void NetworkProfileBubble::NotifyNetworkProfileDetected() { 176 void NetworkProfileBubble::NotifyNetworkProfileDetected() {
174 // TODO(robertshield): Eventually, we will need to figure out the correct 177 // TODO(robertshield): Eventually, we will need to figure out the correct
175 // desktop type for this for platforms that can have 178 // desktop type for this for platforms that can have
176 // multiple desktop types (win8/metro). 179 // multiple desktop types (win8/metro).
177 Browser* browser = chrome::FindLastActiveWithHostDesktopType( 180 Browser* browser = chrome::FindLastActiveWithHostDesktopType(
178 chrome::HOST_DESKTOP_TYPE_NATIVE); 181 chrome::HOST_DESKTOP_TYPE_NATIVE);
179 182
180 if (browser) 183 if (browser)
181 ShowNotification(browser); 184 ShowNotification(browser);
182 else 185 else
183 BrowserList::AddObserver(new BrowserListObserver()); 186 BrowserList::AddObserver(new BrowserListObserver());
184 } 187 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698