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. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 unsigned short* type = reinterpret_cast<unsigned short*>(buffer); | 121 unsigned short* type = reinterpret_cast<unsigned short*>(buffer); |
122 // We should warn the users if they have their profile on a network share only | 122 // We should warn the users if they have their profile on a network share only |
123 // if running on a local session. | 123 // if running on a local session. |
124 if (*type == WTS_PROTOCOL_TYPE_CONSOLE) { | 124 if (*type == WTS_PROTOCOL_TYPE_CONSOLE) { |
125 bool profile_on_network = false; | 125 bool profile_on_network = false; |
126 if (!profile_folder.empty()) { | 126 if (!profile_folder.empty()) { |
127 base::FilePath temp_file; | 127 base::FilePath temp_file; |
128 // Try to create some non-empty temp file in the profile dir and use | 128 // 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. | 129 // it to check if there is a reparse-point free path to it. |
130 if (file_util::CreateTemporaryFileInDir(profile_folder, &temp_file) && | 130 if (base::CreateTemporaryFileInDir(profile_folder, &temp_file) && |
131 (file_util::WriteFile(temp_file, ".", 1) == 1)) { | 131 (file_util::WriteFile(temp_file, ".", 1) == 1)) { |
132 base::FilePath normalized_temp_file; | 132 base::FilePath normalized_temp_file; |
133 if (!file_util::NormalizeFilePath(temp_file, &normalized_temp_file)) | 133 if (!file_util::NormalizeFilePath(temp_file, &normalized_temp_file)) |
134 profile_on_network = true; | 134 profile_on_network = true; |
135 } else { | 135 } else { |
136 RecordUmaEvent(METRIC_CHECK_IO_FAILED); | 136 RecordUmaEvent(METRIC_CHECK_IO_FAILED); |
137 } | 137 } |
138 base::DeleteFile(temp_file, false); | 138 base::DeleteFile(temp_file, false); |
139 } | 139 } |
140 if (profile_on_network) { | 140 if (profile_on_network) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // static | 179 // static |
180 void NetworkProfileBubble::NotifyNetworkProfileDetected() { | 180 void NetworkProfileBubble::NotifyNetworkProfileDetected() { |
181 Browser* browser = chrome::FindLastActiveWithHostDesktopType( | 181 Browser* browser = chrome::FindLastActiveWithHostDesktopType( |
182 chrome::GetActiveDesktop()); | 182 chrome::GetActiveDesktop()); |
183 | 183 |
184 if (browser) | 184 if (browser) |
185 ShowNotification(browser); | 185 ShowNotification(browser); |
186 else | 186 else |
187 BrowserList::AddObserver(new BrowserListObserver()); | 187 BrowserList::AddObserver(new BrowserListObserver()); |
188 } | 188 } |
OLD | NEW |