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

Side by Side Diff: chrome/browser/ui/app_list/start_page_service.cc

Issue 1983773002: Cache SearchEngineType of TemplateURL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-extracting-terms-from-template-url
Patch Set: Fix typo Created 4 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/app_list/start_page_service.h" 5 #include "chrome/browser/ui/app_list/start_page_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/ui/app_list/start_page_observer.h" 29 #include "chrome/browser/ui/app_list/start_page_observer.h"
30 #include "chrome/browser/ui/app_list/start_page_service_factory.h" 30 #include "chrome/browser/ui/app_list/start_page_service_factory.h"
31 #include "chrome/browser/ui/browser_navigator.h" 31 #include "chrome/browser/ui/browser_navigator.h"
32 #include "chrome/browser/ui/browser_navigator_params.h" 32 #include "chrome/browser/ui/browser_navigator_params.h"
33 #include "chrome/browser/ui/browser_tabstrip.h" 33 #include "chrome/browser/ui/browser_tabstrip.h"
34 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 34 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
35 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
36 #include "chrome/common/pref_names.h" 36 #include "chrome/common/pref_names.h"
37 #include "chrome/common/url_constants.h" 37 #include "chrome/common/url_constants.h"
38 #include "components/prefs/pref_service.h" 38 #include "components/prefs/pref_service.h"
39 #include "components/search_engines/template_url_prepopulate_data.h"
40 #include "components/search_engines/template_url_service.h" 39 #include "components/search_engines/template_url_service.h"
41 #include "components/zoom/zoom_controller.h" 40 #include "components/zoom/zoom_controller.h"
42 #include "content/public/browser/browser_thread.h" 41 #include "content/public/browser/browser_thread.h"
43 #include "content/public/browser/notification_details.h" 42 #include "content/public/browser/notification_details.h"
44 #include "content/public/browser/notification_observer.h" 43 #include "content/public/browser/notification_observer.h"
45 #include "content/public/browser/notification_registrar.h" 44 #include "content/public/browser/notification_registrar.h"
46 #include "content/public/browser/notification_service.h" 45 #include "content/public/browser/notification_service.h"
47 #include "content/public/browser/notification_source.h" 46 #include "content/public/browser/notification_source.h"
48 #include "content/public/browser/render_view_host.h" 47 #include "content/public/browser/render_view_host.h"
49 #include "content/public/browser/render_widget_host.h" 48 #include "content/public/browser/render_widget_host.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 microphone_available_(true), 331 microphone_available_(true),
333 search_engine_is_google_(false), 332 search_engine_is_google_(false),
334 backoff_entry_(&kDoodleBackoffPolicy), 333 backoff_entry_(&kDoodleBackoffPolicy),
335 weak_factory_(this) { 334 weak_factory_(this) {
336 if (switches::IsExperimentalAppListEnabled()) { 335 if (switches::IsExperimentalAppListEnabled()) {
337 TemplateURLService* template_url_service = 336 TemplateURLService* template_url_service =
338 TemplateURLServiceFactory::GetForProfile(profile_); 337 TemplateURLServiceFactory::GetForProfile(profile_);
339 const TemplateURL* default_provider = 338 const TemplateURL* default_provider =
340 template_url_service->GetDefaultSearchProvider(); 339 template_url_service->GetDefaultSearchProvider();
341 search_engine_is_google_ = 340 search_engine_is_google_ =
342 TemplateURLPrepopulateData::GetEngineType( 341 default_provider->GetEngineType(
343 *default_provider, template_url_service->search_terms_data()) == 342 template_url_service->search_terms_data()) ==
344 SEARCH_ENGINE_GOOGLE; 343 SEARCH_ENGINE_GOOGLE;
345 } 344 }
346 345
347 network_change_observer_.reset(new NetworkChangeObserver(this)); 346 network_change_observer_.reset(new NetworkChangeObserver(this));
348 } 347 }
349 348
350 StartPageService::~StartPageService() { 349 StartPageService::~StartPageService() {
351 } 350 }
352 351
353 void StartPageService::AddObserver(StartPageObserver* observer) { 352 void StartPageService::AddObserver(StartPageObserver* observer) {
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 698
700 // Check for a new doodle. 699 // Check for a new doodle.
701 content::BrowserThread::PostDelayedTask( 700 content::BrowserThread::PostDelayedTask(
702 content::BrowserThread::UI, FROM_HERE, 701 content::BrowserThread::UI, FROM_HERE,
703 base::Bind(&StartPageService::FetchDoodleJson, 702 base::Bind(&StartPageService::FetchDoodleJson,
704 weak_factory_.GetWeakPtr()), 703 weak_factory_.GetWeakPtr()),
705 recheck_delay); 704 recheck_delay);
706 } 705 }
707 706
708 } // namespace app_list 707 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698