Chromium Code Reviews| 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_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/ui/browser_finder.h" | |
| 23 #include "chrome/browser/ui/browser_list.h" | 24 #include "chrome/browser/ui/browser_list.h" |
| 24 #include "chrome/browser/ui/browser_list_observer.h" | 25 #include "chrome/browser/ui/browser_list_observer.h" |
| 25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 28 | 29 |
| 29 namespace { | 30 namespace { |
| 30 | 31 |
| 31 // The duration of the silent period before we start nagging the user again. | 32 // The duration of the silent period before we start nagging the user again. |
| 32 const int kSilenceDurationDays = 100; | 33 const int kSilenceDurationDays = 100; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 | 166 |
| 166 // static | 167 // static |
| 167 void NetworkProfileBubble::RecordUmaEvent(MetricNetworkedProfileCheck event) { | 168 void NetworkProfileBubble::RecordUmaEvent(MetricNetworkedProfileCheck event) { |
| 168 UMA_HISTOGRAM_ENUMERATION(kMetricNetworkedProfileCheck, | 169 UMA_HISTOGRAM_ENUMERATION(kMetricNetworkedProfileCheck, |
| 169 event, | 170 event, |
| 170 METRIC_NETWORKED_PROFILE_CHECK_SIZE); | 171 METRIC_NETWORKED_PROFILE_CHECK_SIZE); |
| 171 } | 172 } |
| 172 | 173 |
| 173 // static | 174 // static |
| 174 void NetworkProfileBubble::NotifyNetworkProfileDetected() { | 175 void NetworkProfileBubble::NotifyNetworkProfileDetected() { |
| 175 if (BrowserList::GetLastActive()) | 176 Browser* browser = browser::FindLastActiveWithHostDesktopType( |
| 176 ShowNotification(BrowserList::GetLastActive()); | 177 chrome::HOST_DESKTOP_TYPE_NATIVE); |
|
MAD
2012/08/30 13:45:22
Shouldn't we have a TODO here (or in chrome_browse
| |
| 178 | |
| 179 if (browser) | |
| 180 ShowNotification(browser); | |
| 177 else | 181 else |
| 178 BrowserList::AddObserver(new BrowserListObserver()); | 182 BrowserList::AddObserver(new BrowserListObserver()); |
| 179 } | 183 } |
| OLD | NEW |