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

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

Issue 2339523004: Remove old (dead) app list code. (Closed)
Patch Set: Address nonbistytftatl review. Created 4 years, 3 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 (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/app_list/app_list_view_delegate.h" 5 #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 } 101 }
102 102
103 // Gets a list of URLs of the custom launcher pages to show in the launcher. 103 // Gets a list of URLs of the custom launcher pages to show in the launcher.
104 // Returns a URL for each installed launcher page. If --custom-launcher-page is 104 // Returns a URL for each installed launcher page. If --custom-launcher-page is
105 // specified and valid, also includes that URL. 105 // specified and valid, also includes that URL.
106 void GetCustomLauncherPageUrls(content::BrowserContext* browser_context, 106 void GetCustomLauncherPageUrls(content::BrowserContext* browser_context,
107 std::vector<GURL>* urls) { 107 std::vector<GURL>* urls) {
108 // First, check the command line. 108 // First, check the command line.
109 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 109 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
110 if (app_list::switches::IsExperimentalAppListEnabled() && 110 if (command_line->HasSwitch(app_list::switches::kCustomLauncherPage)) {
111 command_line->HasSwitch(app_list::switches::kCustomLauncherPage)) {
112 GURL custom_launcher_page_url(command_line->GetSwitchValueASCII( 111 GURL custom_launcher_page_url(command_line->GetSwitchValueASCII(
113 app_list::switches::kCustomLauncherPage)); 112 app_list::switches::kCustomLauncherPage));
114 113
115 if (custom_launcher_page_url.SchemeIs(extensions::kExtensionScheme)) { 114 if (custom_launcher_page_url.SchemeIs(extensions::kExtensionScheme)) {
116 urls->push_back(custom_launcher_page_url); 115 urls->push_back(custom_launcher_page_url);
117 } else { 116 } else {
118 LOG(ERROR) << "Invalid custom launcher page URL: " 117 LOG(ERROR) << "Invalid custom launcher page URL: "
119 << custom_launcher_page_url.possibly_invalid_spec(); 118 << custom_launcher_page_url.possibly_invalid_spec();
120 } 119 }
121 } 120 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // Browser::Browser when opening links in a browser window (see 245 // Browser::Browser when opening links in a browser window (see
247 // http://crbug.com/460437). 246 // http://crbug.com/460437).
248 DCHECK(!profile_->IsGuestSession() || profile_->IsOffTheRecord()) 247 DCHECK(!profile_->IsGuestSession() || profile_->IsOffTheRecord())
249 << "Guest mode must use incognito profile"; 248 << "Guest mode must use incognito profile";
250 249
251 { 250 {
252 // TODO(tapted): Remove ScopedTracker below once crbug.com/431326 is fixed. 251 // TODO(tapted): Remove ScopedTracker below once crbug.com/431326 is fixed.
253 tracked_objects::ScopedTracker tracking_profile( 252 tracked_objects::ScopedTracker tracking_profile(
254 FROM_HERE_WITH_EXPLICIT_FUNCTION( 253 FROM_HERE_WITH_EXPLICIT_FUNCTION(
255 "431326 AppListViewDelegate TemplateURL etc.")); 254 "431326 AppListViewDelegate TemplateURL etc."));
256 if (app_list::switches::IsExperimentalAppListEnabled()) { 255 TemplateURLService* template_url_service =
257 TemplateURLService* template_url_service = 256 TemplateURLServiceFactory::GetForProfile(profile_);
258 TemplateURLServiceFactory::GetForProfile(profile_); 257 template_url_service_observer_.Add(template_url_service);
259 template_url_service_observer_.Add(template_url_service);
260 }
261 258
262 model_ = app_list::AppListSyncableServiceFactory::GetForProfile(profile_) 259 model_ = app_list::AppListSyncableServiceFactory::GetForProfile(profile_)
263 ->GetModel(); 260 ->GetModel();
264 261
265 #if defined(USE_ASH) 262 #if defined(USE_ASH)
266 app_sync_ui_state_watcher_.reset( 263 app_sync_ui_state_watcher_.reset(
267 new AppSyncUIStateWatcher(profile_, model_)); 264 new AppSyncUIStateWatcher(profile_, model_));
268 #endif 265 #endif
269 266
270 SetUpSearchUI(); 267 SetUpSearchUI();
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 app_list::StartPageService* service = 683 app_list::StartPageService* service =
687 app_list::StartPageService::Get(profile_); 684 app_list::StartPageService::Get(profile_);
688 return service && service->GetSpeechRecognitionContents(); 685 return service && service->GetSpeechRecognitionContents();
689 } 686 }
690 687
691 const app_list::AppListViewDelegate::Users& 688 const app_list::AppListViewDelegate::Users&
692 AppListViewDelegate::GetUsers() const { 689 AppListViewDelegate::GetUsers() const {
693 return users_; 690 return users_;
694 } 691 }
695 692
696 bool AppListViewDelegate::ShouldCenterWindow() const {
697 // Some ChromeOS devices (those that support TouchView mode) turn this flag on
698 // by default, which ensures that the app list is consistently centered on
699 // those devices. This avoids having the app list change shape and position as
700 // the user enters and exits TouchView mode.
701 if (app_list::switches::IsCenteredAppListEnabled())
702 return true;
703
704 // keyboard depends upon Aura.
705 #if defined(USE_AURA)
706 // If the virtual keyboard is enabled, use the new app list position. The old
707 // position is too tall, and doesn't fit in the left-over screen space.
708 if (keyboard::IsKeyboardEnabled())
709 return true;
710 #endif
711
712 return false;
713 }
714
715 void AppListViewDelegate::AddObserver( 693 void AppListViewDelegate::AddObserver(
716 app_list::AppListViewDelegateObserver* observer) { 694 app_list::AppListViewDelegateObserver* observer) {
717 observers_.AddObserver(observer); 695 observers_.AddObserver(observer);
718 } 696 }
719 697
720 void AppListViewDelegate::RemoveObserver( 698 void AppListViewDelegate::RemoveObserver(
721 app_list::AppListViewDelegateObserver* observer) { 699 app_list::AppListViewDelegateObserver* observer) {
722 observers_.RemoveObserver(observer); 700 observers_.RemoveObserver(observer);
723 } 701 }
724 702
725 void AppListViewDelegate::OnTemplateURLServiceChanged() { 703 void AppListViewDelegate::OnTemplateURLServiceChanged() {
726 if (!app_list::switches::IsExperimentalAppListEnabled())
727 return;
728
729 TemplateURLService* template_url_service = 704 TemplateURLService* template_url_service =
730 TemplateURLServiceFactory::GetForProfile(profile_); 705 TemplateURLServiceFactory::GetForProfile(profile_);
731 const TemplateURL* default_provider = 706 const TemplateURL* default_provider =
732 template_url_service->GetDefaultSearchProvider(); 707 template_url_service->GetDefaultSearchProvider();
733 bool is_google = 708 bool is_google =
734 default_provider->GetEngineType( 709 default_provider->GetEngineType(
735 template_url_service->search_terms_data()) == 710 template_url_service->search_terms_data()) ==
736 SEARCH_ENGINE_GOOGLE; 711 SEARCH_ENGINE_GOOGLE;
737 712
738 model_->SetSearchEngineIsGoogle(is_google); 713 model_->SetSearchEngineIsGoogle(is_google);
(...skipping 12 matching lines...) Expand all
751 FOR_EACH_OBSERVER(app_list::AppListViewDelegateObserver, observers_, 726 FOR_EACH_OBSERVER(app_list::AppListViewDelegateObserver, observers_,
752 OnShutdown()); 727 OnShutdown());
753 728
754 SetProfile(nullptr); // Ensures launcher page web contents are torn down. 729 SetProfile(nullptr); // Ensures launcher page web contents are torn down.
755 730
756 // SigninManagerFactory is not a leaky singleton (unlike this class), and 731 // SigninManagerFactory is not a leaky singleton (unlike this class), and
757 // its destructor will check that it has no remaining observers. 732 // its destructor will check that it has no remaining observers.
758 scoped_observer_.RemoveAll(); 733 scoped_observer_.RemoveAll();
759 SigninManagerFactory::GetInstance()->RemoveObserver(this); 734 SigninManagerFactory::GetInstance()->RemoveObserver(this);
760 } 735 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698