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

Side by Side Diff: chrome/browser/search_engines/template_url_service.cc

Issue 21395002: [InstantExtended] Fixing how PageLoadSRP is emitted. Previously it was emitted only for Instant sea… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unnecessary include Created 7 years, 4 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/search_engines/template_url_service.h" 5 #include "chrome/browser/search_engines/template_url_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 NotifyObservers(); 683 NotifyObservers();
684 } 684 }
685 685
686 TemplateURL* TemplateURLService::GetDefaultSearchProvider() { 686 TemplateURL* TemplateURLService::GetDefaultSearchProvider() {
687 if (loaded_ && !load_failed_) 687 if (loaded_ && !load_failed_)
688 return default_search_provider_; 688 return default_search_provider_;
689 // We're not loaded, rely on the default search provider stored in prefs. 689 // We're not loaded, rely on the default search provider stored in prefs.
690 return initial_default_search_provider_.get(); 690 return initial_default_search_provider_.get();
691 } 691 }
692 692
693 bool TemplateURLService::IsSearchResultsPageFromDefaultSearchProvider(
694 const GURL current_url) {
695 TemplateURL* default_provider = GetDefaultSearchProvider();
696 return default_provider && default_provider->IsSearchURL(current_url);
697 }
698
693 TemplateURL* TemplateURLService::FindNewDefaultSearchProvider() { 699 TemplateURL* TemplateURLService::FindNewDefaultSearchProvider() {
694 // See if the prepopulated default still exists. 700 // See if the prepopulated default still exists.
695 scoped_ptr<TemplateURL> prepopulated_default( 701 scoped_ptr<TemplateURL> prepopulated_default(
696 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(profile_)); 702 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(profile_));
697 for (TemplateURLVector::iterator i = template_urls_.begin(); 703 for (TemplateURLVector::iterator i = template_urls_.begin();
698 i != template_urls_.end(); ++i) { 704 i != template_urls_.end(); ++i) {
699 if ((*i)->prepopulate_id() == prepopulated_default->prepopulate_id()) 705 if ((*i)->prepopulate_id() == prepopulated_default->prepopulate_id())
700 return *i; 706 return *i;
701 } 707 }
702 // If not, use the first non-extension keyword of the templates that supports 708 // If not, use the first non-extension keyword of the templates that supports
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 const ExtensionKeyword& extension_keyword) const { 2646 const ExtensionKeyword& extension_keyword) const {
2641 TemplateURLData data; 2647 TemplateURLData data;
2642 data.short_name = UTF8ToUTF16(extension_keyword.extension_name); 2648 data.short_name = UTF8ToUTF16(extension_keyword.extension_name);
2643 data.SetKeyword(UTF8ToUTF16(extension_keyword.extension_keyword)); 2649 data.SetKeyword(UTF8ToUTF16(extension_keyword.extension_keyword));
2644 // This URL is not actually used for navigation. It holds the extension's 2650 // This URL is not actually used for navigation. It holds the extension's
2645 // ID, as well as forcing the TemplateURL to be treated as a search keyword. 2651 // ID, as well as forcing the TemplateURL to be treated as a search keyword.
2646 data.SetURL(std::string(extensions::kExtensionScheme) + "://" + 2652 data.SetURL(std::string(extensions::kExtensionScheme) + "://" +
2647 extension_keyword.extension_id + "/?q={searchTerms}"); 2653 extension_keyword.extension_id + "/?q={searchTerms}");
2648 return new TemplateURL(profile_, data); 2654 return new TemplateURL(profile_, data);
2649 } 2655 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698