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