| Index: chrome/browser/chrome_browser_main.cc
|
| diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
|
| index 685fb3a88bc4394e88235da6959d2804b6e826d4..5780373c10fae5e80931e43a45515a36a8255a9f 100644
|
| --- a/chrome/browser/chrome_browser_main.cc
|
| +++ b/chrome/browser/chrome_browser_main.cc
|
| @@ -73,6 +73,7 @@
|
| #include "chrome/browser/search_engines/template_url_service_factory.h"
|
| #include "chrome/browser/service/service_process_control.h"
|
| #include "chrome/browser/shell_integration.h"
|
| +#include "chrome/browser/simple_message_box.h"
|
| #include "chrome/browser/translate/translate_manager.h"
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/browser_init.h"
|
| @@ -140,6 +141,7 @@
|
| // progress and should not be taken as an indication of a real refactoring.
|
|
|
| #if defined(OS_WIN)
|
| +#include <wtsapi32.h>
|
| #include "base/environment.h" // For PreRead experiment.
|
| #include "base/win/windows_version.h"
|
| #include "chrome/browser/browser_trial.h"
|
| @@ -157,6 +159,9 @@
|
| #include "net/base/net_util.h"
|
| #include "printing/printed_document.h"
|
| #include "ui/base/l10n/l10n_util_win.h"
|
| +
|
| +// Make sure we link the wtsapi lib file in.
|
| +#pragma comment(lib, "wtsapi32.lib")
|
| #endif // defined(OS_WIN)
|
|
|
| #if defined(OS_MACOSX)
|
| @@ -1186,6 +1191,43 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
|
| g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str());
|
| #endif
|
|
|
| +#if defined(OS_WIN)
|
| + // On windows notify the user if he is serving his profile from a network
|
| + // share as we don't officially support this setup yet.
|
| + // However we don't want to bother users on Cytrix setups as those have no
|
| + // real choice and their admins must be well aware of the risks associated.
|
| + LPWSTR buffer = NULL;
|
| + DWORD buffer_length = 0;
|
| + if (::WTSQuerySessionInformation(WTS_CURRENT_SERVER, WTS_CURRENT_SESSION,
|
| + WTSClientProtocolType,
|
| + &buffer, &buffer_length)) {
|
| + CHECK(buffer_length == sizeof(USHORT));
|
| + USHORT* type = reinterpret_cast<USHORT*>(buffer);
|
| + // Zero means local environment and we should warn the user if he runs
|
| + // on a network share.
|
| + if (*type == 0) {
|
| + bool profile_on_network = false;
|
| + FilePath temp_file;
|
| + // Try to create some non-empty temp file in the profile dir and use
|
| + // it to check if there is a reparse-point free path to it.
|
| + if (file_util::CreateTemporaryFileInDir(user_data_dir_, &temp_file) &&
|
| + file_util::WriteFile(temp_file, ".", 1)) {
|
| + FilePath normalized_temp_file;
|
| + if (!file_util::NormalizeFilePath(temp_file, &normalized_temp_file))
|
| + profile_on_network = true;
|
| + }
|
| + file_util::Delete(temp_file, false);
|
| + if (profile_on_network) {
|
| + browser::ShowErrorBox(NULL,
|
| + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
|
| + l10n_util::GetStringUTF16(
|
| + IDS_PROFILE_ON_NETWORK_WARNING));
|
| + }
|
| + } // Local session.
|
| + ::WTSFreeMemory(buffer);
|
| + } // WTSQuerySessionInformation succeeded.
|
| +#endif
|
| +
|
| // These members must be initialized before returning from this function.
|
| master_prefs_.reset(new FirstRun::MasterPrefs);
|
| browser_init_.reset(new BrowserInit);
|
|
|