OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_init.h" | 5 #include "chrome/browser/browser_init.h" |
6 | 6 |
7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "base/env_var.h" |
11 #include "base/event_recorder.h" | 12 #include "base/event_recorder.h" |
12 #include "base/path_service.h" | 13 #include "base/path_service.h" |
13 #include "base/sys_info.h" | 14 #include "base/scoped_ptr.h" |
14 #include "chrome/browser/automation/automation_provider.h" | 15 #include "chrome/browser/automation/automation_provider.h" |
15 #include "chrome/browser/automation/chrome_frame_automation_provider.h" | 16 #include "chrome/browser/automation/chrome_frame_automation_provider.h" |
16 #include "chrome/browser/browser_list.h" | 17 #include "chrome/browser/browser_list.h" |
17 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/browser_window.h" | 19 #include "chrome/browser/browser_window.h" |
19 #include "chrome/browser/child_process_security_policy.h" | 20 #include "chrome/browser/child_process_security_policy.h" |
20 #include "chrome/browser/chrome_thread.h" | 21 #include "chrome/browser/chrome_thread.h" |
21 #include "chrome/browser/defaults.h" | 22 #include "chrome/browser/defaults.h" |
22 #include "chrome/browser/extensions/extension_creator.h" | 23 #include "chrome/browser/extensions/extension_creator.h" |
23 #include "chrome/browser/extensions/extensions_service.h" | 24 #include "chrome/browser/extensions/extensions_service.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 LaunchMode GetLaunchShortcutKind() { | 301 LaunchMode GetLaunchShortcutKind() { |
301 STARTUPINFOW si = { sizeof(si) }; | 302 STARTUPINFOW si = { sizeof(si) }; |
302 GetStartupInfoW(&si); | 303 GetStartupInfoW(&si); |
303 if (si.dwFlags & 0x800) { | 304 if (si.dwFlags & 0x800) { |
304 if (!si.lpTitle) | 305 if (!si.lpTitle) |
305 return LM_SHORTCUT_NONAME; | 306 return LM_SHORTCUT_NONAME; |
306 std::wstring shortcut(si.lpTitle); | 307 std::wstring shortcut(si.lpTitle); |
307 // The windows quick launch path is not localized. | 308 // The windows quick launch path is not localized. |
308 if (shortcut.find(L"\\Quick Launch\\") != std::wstring::npos) | 309 if (shortcut.find(L"\\Quick Launch\\") != std::wstring::npos) |
309 return LM_SHORTCUT_QUICKLAUNCH; | 310 return LM_SHORTCUT_QUICKLAUNCH; |
310 std::wstring appdata_path = base::SysInfo::GetEnvVar(L"USERPROFILE"); | 311 scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); |
| 312 std::string appdata_path; |
| 313 env->GetEnv("USERPROFILE", &appdata_path); |
311 if (!appdata_path.empty() && | 314 if (!appdata_path.empty() && |
312 shortcut.find(appdata_path) != std::wstring::npos) | 315 shortcut.find(ASCIIToWide(appdata_path)) != std::wstring::npos) |
313 return LM_SHORTCUT_DESKTOP; | 316 return LM_SHORTCUT_DESKTOP; |
314 return LM_SHORTCUT_UNKNOWN; | 317 return LM_SHORTCUT_UNKNOWN; |
315 } | 318 } |
316 return LM_SHORTCUT_NONE; | 319 return LM_SHORTCUT_NONE; |
317 } | 320 } |
318 #else | 321 #else |
319 // TODO(cpu): Port to other platforms. | 322 // TODO(cpu): Port to other platforms. |
320 LaunchMode GetLaunchShortcutKind() { | 323 LaunchMode GetLaunchShortcutKind() { |
321 return LM_LINUX_MAC_BEOS; | 324 return LM_LINUX_MAC_BEOS; |
322 } | 325 } |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 scoped_refptr<AutomationProviderClass> automation = | 1048 scoped_refptr<AutomationProviderClass> automation = |
1046 new AutomationProviderClass(profile); | 1049 new AutomationProviderClass(profile); |
1047 automation->ConnectToChannel(channel_id); | 1050 automation->ConnectToChannel(channel_id); |
1048 automation->SetExpectedTabCount(expected_tabs); | 1051 automation->SetExpectedTabCount(expected_tabs); |
1049 | 1052 |
1050 AutomationProviderList* list = | 1053 AutomationProviderList* list = |
1051 g_browser_process->InitAutomationProviderList(); | 1054 g_browser_process->InitAutomationProviderList(); |
1052 DCHECK(list); | 1055 DCHECK(list); |
1053 list->AddProvider(automation); | 1056 list->AddProvider(automation); |
1054 } | 1057 } |
OLD | NEW |