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

Unified Diff: chrome/browser/ui/app_list/app_list_view_delegate.cc

Issue 907833002: Hide experimental app list Google logo and custom launcher page when search engine is not Google. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_app_list_bg_color
Patch Set: use AppListModel to hide everything, also hide the custom page view Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/app_list_view_delegate.cc
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc
index 897dca3ae4002b8e5a7913fda80b6aa49ff0a38f..e0aec05048d268053ca0b349a0c36c9a6a5970b9 100644
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/search/hotword_service.h"
#include "chrome/browser/search/hotword_service_factory.h"
+#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
#include "chrome/browser/ui/app_list/app_list_service.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service.h"
@@ -37,6 +38,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/url_constants.h"
+#include "components/search_engines/template_url_prepopulate_data.h"
#include "components/signin/core/browser/signin_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
@@ -160,6 +162,7 @@ AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller)
profile_(NULL),
model_(NULL),
is_voice_query_(false),
+ template_url_service_observer_(this),
scoped_observer_(this) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed.
tracked_objects::ScopedTracker tracking_profile(
@@ -288,6 +291,9 @@ void AppListViewDelegate::SetProfile(Profile* new_profile) {
tracked_objects::ScopedTracker tracking_profile3(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"431326 AppListViewDelegate::SetProfile3"));
+ template_url_service_observer_.RemoveAll();
+ template_url_service_observer_.Add(
+ TemplateURLServiceFactory::GetForProfile(profile_));
model_ =
app_list::AppListSyncableServiceFactory::GetForProfile(profile_)->model();
@@ -299,6 +305,7 @@ void AppListViewDelegate::SetProfile(Profile* new_profile) {
SetUpSearchUI();
SetUpProfileSwitcher();
SetUpCustomLauncherPages();
+ OnTemplateURLServiceChanged();
// TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed.
tracked_objects::ScopedTracker tracking_profile4(
@@ -783,6 +790,24 @@ void AppListViewDelegate::RemoveObserver(
observers_.RemoveObserver(observer);
}
+void AppListViewDelegate::OnTemplateURLServiceChanged() {
+ TemplateURLService* template_url_service =
+ TemplateURLServiceFactory::GetForProfile(profile_);
+ const TemplateURL* default_provider =
+ template_url_service->GetDefaultSearchProvider();
+ bool is_google =
+ TemplateURLPrepopulateData::GetEngineType(
+ *default_provider, template_url_service->search_terms_data()) ==
+ SEARCH_ENGINE_GOOGLE;
+
+ model_->SetSearchEngineIsGoogle(is_google);
+
+ app_list::StartPageService* start_page_service =
+ app_list::StartPageService::Get(profile_);
+ if (start_page_service)
Matt Giuca 2015/02/17 00:23:34 Do you know when the SPS gets created? I'm worried
calamity 2015/02/17 06:16:37 Hmm. I guess that's the most resilient thing to do
+ start_page_service->set_doodle_enabled(is_google);
+}
+
void AppListViewDelegate::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {

Powered by Google App Engine
This is Rietveld 408576698