Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: chrome/browser/ui/browser_init.cc

Issue 10173001: Add a Profile* member to TemplateURL. This makes some invocations of ReplaceSearchTerms() a bit le… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 // Handle Vista way of searching - "? <search-term>" 1645 // Handle Vista way of searching - "? <search-term>"
1646 if (param.value().size() > 2 && 1646 if (param.value().size() > 2 &&
1647 param.value()[0] == '?' && param.value()[1] == ' ') { 1647 param.value()[0] == '?' && param.value()[1] == ' ') {
1648 const TemplateURL* default_provider = 1648 const TemplateURL* default_provider =
1649 TemplateURLServiceFactory::GetForProfile(profile)-> 1649 TemplateURLServiceFactory::GetForProfile(profile)->
1650 GetDefaultSearchProvider(); 1650 GetDefaultSearchProvider();
1651 if (default_provider) { 1651 if (default_provider) {
1652 const TemplateURLRef& search_url = default_provider->url_ref(); 1652 const TemplateURLRef& search_url = default_provider->url_ref();
1653 DCHECK(search_url.SupportsReplacement()); 1653 DCHECK(search_url.SupportsReplacement());
1654 string16 search_term = param.LossyDisplayName().substr(2); 1654 string16 search_term = param.LossyDisplayName().substr(2);
1655 urls.push_back(GURL(search_url.ReplaceSearchTermsUsingProfile( 1655 urls.push_back(GURL(search_url.ReplaceSearchTerms(search_term,
1656 profile, search_term, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, 1656 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())));
1657 string16())));
1658 continue; 1657 continue;
1659 } 1658 }
1660 } 1659 }
1661 1660
1662 // Otherwise, fall through to treating it as a URL. 1661 // Otherwise, fall through to treating it as a URL.
1663 1662
1664 // This will create a file URL or a regular URL. 1663 // This will create a file URL or a regular URL.
1665 // This call can (in rare circumstances) block the UI thread. 1664 // This call can (in rare circumstances) block the UI thread.
1666 // Allow it until this bug is fixed. 1665 // Allow it until this bug is fixed.
1667 // http://code.google.com/p/chromium/issues/detail?id=60641 1666 // http://code.google.com/p/chromium/issues/detail?id=60641
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 1943
1945 Profile* profile = ProfileManager::GetLastUsedProfile(); 1944 Profile* profile = ProfileManager::GetLastUsedProfile();
1946 if (!profile) { 1945 if (!profile) {
1947 // We should only be able to get here if the profile already exists and 1946 // We should only be able to get here if the profile already exists and
1948 // has been created. 1947 // has been created.
1949 NOTREACHED(); 1948 NOTREACHED();
1950 return; 1949 return;
1951 } 1950 }
1952 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL); 1951 ProcessCmdLineImpl(cmd_line, cur_dir, false, profile, Profiles(), NULL, NULL);
1953 } 1952 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698