| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. // 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. | 2 // found in the LICENSE file. |
| 4 | 3 |
| 5 #include "chrome/browser/ui/network_profile_bubble.h" | 4 #include "chrome/browser/ui/network_profile_bubble.h" |
| 6 | 5 |
| 7 #include <windows.h> | 6 #include <windows.h> |
| 8 | 7 |
| 9 #include <wtsapi32.h> | 8 #include <wtsapi32.h> |
| 10 // Make sure we link the wtsapi lib file in. | 9 // Make sure we link the wtsapi lib file in. |
| 11 #pragma comment(lib, "wtsapi32.lib") | 10 #pragma comment(lib, "wtsapi32.lib") |
| 12 | 11 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // if running on a local session. | 122 // if running on a local session. |
| 124 if (*type == WTS_PROTOCOL_TYPE_CONSOLE) { | 123 if (*type == WTS_PROTOCOL_TYPE_CONSOLE) { |
| 125 bool profile_on_network = false; | 124 bool profile_on_network = false; |
| 126 if (!profile_folder.empty()) { | 125 if (!profile_folder.empty()) { |
| 127 base::FilePath temp_file; | 126 base::FilePath temp_file; |
| 128 // Try to create some non-empty temp file in the profile dir and use | 127 // Try to create some non-empty temp file in the profile dir and use |
| 129 // it to check if there is a reparse-point free path to it. | 128 // it to check if there is a reparse-point free path to it. |
| 130 if (base::CreateTemporaryFileInDir(profile_folder, &temp_file) && | 129 if (base::CreateTemporaryFileInDir(profile_folder, &temp_file) && |
| 131 (file_util::WriteFile(temp_file, ".", 1) == 1)) { | 130 (file_util::WriteFile(temp_file, ".", 1) == 1)) { |
| 132 base::FilePath normalized_temp_file; | 131 base::FilePath normalized_temp_file; |
| 133 if (!file_util::NormalizeFilePath(temp_file, &normalized_temp_file)) | 132 if (!base::NormalizeFilePath(temp_file, &normalized_temp_file)) |
| 134 profile_on_network = true; | 133 profile_on_network = true; |
| 135 } else { | 134 } else { |
| 136 RecordUmaEvent(METRIC_CHECK_IO_FAILED); | 135 RecordUmaEvent(METRIC_CHECK_IO_FAILED); |
| 137 } | 136 } |
| 138 base::DeleteFile(temp_file, false); | 137 base::DeleteFile(temp_file, false); |
| 139 } | 138 } |
| 140 if (profile_on_network) { | 139 if (profile_on_network) { |
| 141 RecordUmaEvent(METRIC_PROFILE_ON_NETWORK); | 140 RecordUmaEvent(METRIC_PROFILE_ON_NETWORK); |
| 142 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 141 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 143 base::Bind(&NotifyNetworkProfileDetected)); | 142 base::Bind(&NotifyNetworkProfileDetected)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // static | 178 // static |
| 180 void NetworkProfileBubble::NotifyNetworkProfileDetected() { | 179 void NetworkProfileBubble::NotifyNetworkProfileDetected() { |
| 181 Browser* browser = chrome::FindLastActiveWithHostDesktopType( | 180 Browser* browser = chrome::FindLastActiveWithHostDesktopType( |
| 182 chrome::GetActiveDesktop()); | 181 chrome::GetActiveDesktop()); |
| 183 | 182 |
| 184 if (browser) | 183 if (browser) |
| 185 ShowNotification(browser); | 184 ShowNotification(browser); |
| 186 else | 185 else |
| 187 BrowserList::AddObserver(new BrowserListObserver()); | 186 BrowserList::AddObserver(new BrowserListObserver()); |
| 188 } | 187 } |
| OLD | NEW |