| 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 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 const CommandLine::StringVector& params = command_line.GetArgs(); | 1624 const CommandLine::StringVector& params = command_line.GetArgs(); |
| 1625 | 1625 |
| 1626 for (size_t i = 0; i < params.size(); ++i) { | 1626 for (size_t i = 0; i < params.size(); ++i) { |
| 1627 FilePath param = FilePath(params[i]); | 1627 FilePath param = FilePath(params[i]); |
| 1628 // Handle Vista way of searching - "? <search-term>" | 1628 // Handle Vista way of searching - "? <search-term>" |
| 1629 if (param.value().size() > 2 && | 1629 if (param.value().size() > 2 && |
| 1630 param.value()[0] == '?' && param.value()[1] == ' ') { | 1630 param.value()[0] == '?' && param.value()[1] == ' ') { |
| 1631 const TemplateURL* default_provider = | 1631 const TemplateURL* default_provider = |
| 1632 TemplateURLServiceFactory::GetForProfile(profile)-> | 1632 TemplateURLServiceFactory::GetForProfile(profile)-> |
| 1633 GetDefaultSearchProvider(); | 1633 GetDefaultSearchProvider(); |
| 1634 if (default_provider && default_provider->url()) { | 1634 if (default_provider && !default_provider->url().empty()) { |
| 1635 const TemplateURLRef* search_url = default_provider->url(); | 1635 const TemplateURLRef& search_url = default_provider->url_ref(); |
| 1636 DCHECK(search_url->SupportsReplacement()); | 1636 DCHECK(search_url.SupportsReplacement()); |
| 1637 string16 search_term = param.LossyDisplayName().substr(2); | 1637 string16 search_term = param.LossyDisplayName().substr(2); |
| 1638 urls.push_back(GURL(search_url->ReplaceSearchTermsUsingProfile( | 1638 urls.push_back(GURL(search_url.ReplaceSearchTermsUsingProfile( |
| 1639 profile, search_term, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, | 1639 profile, search_term, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, |
| 1640 string16()))); | 1640 string16()))); |
| 1641 continue; | 1641 continue; |
| 1642 } | 1642 } |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 // Otherwise, fall through to treating it as a URL. | 1645 // Otherwise, fall through to treating it as a URL. |
| 1646 | 1646 |
| 1647 // This will create a file URL or a regular URL. | 1647 // This will create a file URL or a regular URL. |
| 1648 // This call can (in rare circumstances) block the UI thread. | 1648 // This call can (in rare circumstances) block the UI thread. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1911 | 1911 |
| 1912 Profile* profile = ProfileManager::GetLastUsedProfile(); | 1912 Profile* profile = ProfileManager::GetLastUsedProfile(); |
| 1913 if (!profile) { | 1913 if (!profile) { |
| 1914 // We should only be able to get here if the profile already exists and | 1914 // We should only be able to get here if the profile already exists and |
| 1915 // has been created. | 1915 // has been created. |
| 1916 NOTREACHED(); | 1916 NOTREACHED(); |
| 1917 return; | 1917 return; |
| 1918 } | 1918 } |
| 1919 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); | 1919 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); |
| 1920 } | 1920 } |
| OLD | NEW |