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/browser_init.h" | 5 #include "chrome/browser/ui/browser_init.h" |
6 | 6 |
7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 #if defined(TOOLKIT_USES_GTK) | 120 #if defined(TOOLKIT_USES_GTK) |
121 #include "chrome/browser/chromeos/legacy_window_manager/wm_message_listener.h" | 121 #include "chrome/browser/chromeos/legacy_window_manager/wm_message_listener.h" |
122 #endif | 122 #endif |
123 #endif | 123 #endif |
124 | 124 |
125 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) | 125 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) |
126 #include "ui/base/touch/touch_factory.h" | 126 #include "ui/base/touch/touch_factory.h" |
127 #endif | 127 #endif |
128 | 128 |
129 #if defined(OS_WIN) | 129 #if defined(OS_WIN) |
| 130 #include "base/win/windows_version.h" |
130 #include "chrome/installer/util/auto_launch_util.h" | 131 #include "chrome/installer/util/auto_launch_util.h" |
131 #endif | 132 #endif |
132 | 133 |
133 using content::BrowserThread; | 134 using content::BrowserThread; |
134 using content::ChildProcessSecurityPolicy; | 135 using content::ChildProcessSecurityPolicy; |
135 using content::OpenURLParams; | 136 using content::OpenURLParams; |
136 using content::Referrer; | 137 using content::Referrer; |
137 using content::WebContents; | 138 using content::WebContents; |
138 | 139 |
139 namespace { | 140 namespace { |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 | 486 |
486 enum LaunchMode { | 487 enum LaunchMode { |
487 LM_TO_BE_DECIDED = 0, // Possibly direct launch or via a shortcut. | 488 LM_TO_BE_DECIDED = 0, // Possibly direct launch or via a shortcut. |
488 LM_AS_WEBAPP, // Launched as a installed web application. | 489 LM_AS_WEBAPP, // Launched as a installed web application. |
489 LM_WITH_URLS, // Launched with urls in the cmd line. | 490 LM_WITH_URLS, // Launched with urls in the cmd line. |
490 LM_SHORTCUT_NONE, // Not launched from a shortcut. | 491 LM_SHORTCUT_NONE, // Not launched from a shortcut. |
491 LM_SHORTCUT_NONAME, // Launched from shortcut but no name available. | 492 LM_SHORTCUT_NONAME, // Launched from shortcut but no name available. |
492 LM_SHORTCUT_UNKNOWN, // Launched from user-defined shortcut. | 493 LM_SHORTCUT_UNKNOWN, // Launched from user-defined shortcut. |
493 LM_SHORTCUT_QUICKLAUNCH, // Launched from the quick launch bar. | 494 LM_SHORTCUT_QUICKLAUNCH, // Launched from the quick launch bar. |
494 LM_SHORTCUT_DESKTOP, // Launched from a desktop shortcut. | 495 LM_SHORTCUT_DESKTOP, // Launched from a desktop shortcut. |
495 LM_SHORTCUT_STARTMENU, // Launched from start menu. | 496 LM_SHORTCUT_TASKBAR, // Launched from the taskbar. |
496 LM_LINUX_MAC_BEOS // Other OS buckets start here. | 497 LM_LINUX_MAC_BEOS // Other OS buckets start here. |
497 }; | 498 }; |
498 | 499 |
499 #if defined(OS_WIN) | 500 #if defined(OS_WIN) |
500 // Undocumented flag in the startup info structure tells us what shortcut was | 501 // Undocumented flag in the startup info structure tells us what shortcut was |
501 // used to launch the browser. See http://www.catch22.net/tuts/undoc01 for | 502 // used to launch the browser. See http://www.catch22.net/tuts/undoc01 for |
502 // more information. Confirmed to work on XP, Vista and Win7. | 503 // more information. Confirmed to work on XP, Vista and Win7. |
503 LaunchMode GetLaunchShortcutKind() { | 504 LaunchMode GetLaunchShortcutKind() { |
504 STARTUPINFOW si = { sizeof(si) }; | 505 STARTUPINFOW si = { sizeof(si) }; |
505 GetStartupInfoW(&si); | 506 GetStartupInfoW(&si); |
506 if (si.dwFlags & 0x800) { | 507 if (si.dwFlags & 0x800) { |
507 if (!si.lpTitle) | 508 if (!si.lpTitle) |
508 return LM_SHORTCUT_NONAME; | 509 return LM_SHORTCUT_NONAME; |
509 std::wstring shortcut(si.lpTitle); | 510 string16 shortcut(si.lpTitle); |
510 // The windows quick launch path is not localized. | 511 // The windows quick launch path is not localized. |
511 if (shortcut.find(L"\\Quick Launch\\") != std::wstring::npos) | 512 if (shortcut.find(L"\\Quick Launch\\") != string16::npos) { |
512 return LM_SHORTCUT_QUICKLAUNCH; | 513 if (base::win::GetVersion() >= base::win::VERSION_WIN7) |
| 514 return LM_SHORTCUT_TASKBAR; |
| 515 else |
| 516 return LM_SHORTCUT_QUICKLAUNCH; |
| 517 } |
513 scoped_ptr<base::Environment> env(base::Environment::Create()); | 518 scoped_ptr<base::Environment> env(base::Environment::Create()); |
514 std::string appdata_path; | 519 std::string appdata_path; |
515 env->GetVar("USERPROFILE", &appdata_path); | 520 env->GetVar("USERPROFILE", &appdata_path); |
516 if (!appdata_path.empty() && | 521 if (!appdata_path.empty() && |
517 shortcut.find(ASCIIToWide(appdata_path)) != std::wstring::npos) | 522 shortcut.find(ASCIIToWide(appdata_path)) != std::wstring::npos) |
518 return LM_SHORTCUT_DESKTOP; | 523 return LM_SHORTCUT_DESKTOP; |
519 return LM_SHORTCUT_UNKNOWN; | 524 return LM_SHORTCUT_UNKNOWN; |
520 } | 525 } |
521 return LM_SHORTCUT_NONE; | 526 return LM_SHORTCUT_NONE; |
522 } | 527 } |
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1920 | 1925 |
1921 Profile* profile = ProfileManager::GetLastUsedProfile(); | 1926 Profile* profile = ProfileManager::GetLastUsedProfile(); |
1922 if (!profile) { | 1927 if (!profile) { |
1923 // We should only be able to get here if the profile already exists and | 1928 // We should only be able to get here if the profile already exists and |
1924 // has been created. | 1929 // has been created. |
1925 NOTREACHED(); | 1930 NOTREACHED(); |
1926 return; | 1931 return; |
1927 } | 1932 } |
1928 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); | 1933 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); |
1929 } | 1934 } |
OLD | NEW |