OLD | NEW |
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 | 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 // found in the LICENSE file. | 2 // found in the LICENSE file. |
3 | 3 |
4 #include "chrome/browser/ui/network_profile_bubble.h" | 4 #include "chrome/browser/ui/network_profile_bubble.h" |
5 | 5 |
6 #include <windows.h> | 6 #include <windows.h> |
7 | 7 |
8 #include <wtsapi32.h> | 8 #include <wtsapi32.h> |
9 // Make sure we link the wtsapi lib file in. | 9 // Make sure we link the wtsapi lib file in. |
10 #pragma comment(lib, "wtsapi32.lib") | 10 #pragma comment(lib, "wtsapi32.lib") |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 unsigned short* type = reinterpret_cast<unsigned short*>(buffer); | 120 unsigned short* type = reinterpret_cast<unsigned short*>(buffer); |
121 // We should warn the users if they have their profile on a network share only | 121 // We should warn the users if they have their profile on a network share only |
122 // if running on a local session. | 122 // if running on a local session. |
123 if (*type == WTS_PROTOCOL_TYPE_CONSOLE) { | 123 if (*type == WTS_PROTOCOL_TYPE_CONSOLE) { |
124 bool profile_on_network = false; | 124 bool profile_on_network = false; |
125 if (!profile_folder.empty()) { | 125 if (!profile_folder.empty()) { |
126 base::FilePath temp_file; | 126 base::FilePath temp_file; |
127 // 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 |
128 // 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. |
129 if (base::CreateTemporaryFileInDir(profile_folder, &temp_file) && | 129 if (base::CreateTemporaryFileInDir(profile_folder, &temp_file) && |
130 (file_util::WriteFile(temp_file, ".", 1) == 1)) { | 130 (base::WriteFile(temp_file, ".", 1) == 1)) { |
131 base::FilePath normalized_temp_file; | 131 base::FilePath normalized_temp_file; |
132 if (!base::NormalizeFilePath(temp_file, &normalized_temp_file)) | 132 if (!base::NormalizeFilePath(temp_file, &normalized_temp_file)) |
133 profile_on_network = true; | 133 profile_on_network = true; |
134 } else { | 134 } else { |
135 RecordUmaEvent(METRIC_CHECK_IO_FAILED); | 135 RecordUmaEvent(METRIC_CHECK_IO_FAILED); |
136 } | 136 } |
137 base::DeleteFile(temp_file, false); | 137 base::DeleteFile(temp_file, false); |
138 } | 138 } |
139 if (profile_on_network) { | 139 if (profile_on_network) { |
140 RecordUmaEvent(METRIC_PROFILE_ON_NETWORK); | 140 RecordUmaEvent(METRIC_PROFILE_ON_NETWORK); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // static | 178 // static |
179 void NetworkProfileBubble::NotifyNetworkProfileDetected() { | 179 void NetworkProfileBubble::NotifyNetworkProfileDetected() { |
180 Browser* browser = chrome::FindLastActiveWithHostDesktopType( | 180 Browser* browser = chrome::FindLastActiveWithHostDesktopType( |
181 chrome::GetActiveDesktop()); | 181 chrome::GetActiveDesktop()); |
182 | 182 |
183 if (browser) | 183 if (browser) |
184 ShowNotification(browser); | 184 ShowNotification(browser); |
185 else | 185 else |
186 BrowserList::AddObserver(new BrowserListObserver()); | 186 BrowserList::AddObserver(new BrowserListObserver()); |
187 } | 187 } |
OLD | NEW |