| 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 37188e3ea79aa9647a0c6387f16d7d7c3264ad2d..77d26ada6bc29c42817ac2c78678bd42a861c3ac 100644
|
| --- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
|
| +++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
|
| @@ -17,11 +17,6 @@
|
| #include "base/stl_util.h"
|
| #include "build/build_config.h"
|
| #include "chrome/browser/browser_process.h"
|
| -#include "chrome/browser/chrome_notification_types.h"
|
| -#include "chrome/browser/lifetime/scoped_keep_alive.h"
|
| -#include "chrome/browser/profiles/profile_attributes_entry.h"
|
| -#include "chrome/browser/profiles/profile_attributes_storage.h"
|
| -#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"
|
| @@ -43,10 +38,8 @@
|
| #include "chrome/common/pref_names.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "components/prefs/pref_service.h"
|
| -#include "components/signin/core/browser/signin_manager.h"
|
| #include "components/user_prefs/user_prefs.h"
|
| #include "content/public/browser/browser_thread.h"
|
| -#include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/page_navigator.h"
|
| #include "content/public/browser/render_view_host.h"
|
| #include "content/public/browser/render_widget_host.h"
|
| @@ -61,7 +54,6 @@
|
| #include "extensions/common/manifest_handlers/launcher_page_info.h"
|
| #include "grit/theme_resources.h"
|
| #include "ui/app_list/app_list_switches.h"
|
| -#include "ui/app_list/app_list_view_delegate_observer.h"
|
| #include "ui/app_list/search_box_model.h"
|
| #include "ui/app_list/search_controller.h"
|
| #include "ui/app_list/speech_ui_model.h"
|
| @@ -107,22 +99,6 @@ void CreateShortcutInWebAppDir(
|
| }
|
| #endif
|
|
|
| -void PopulateUsers(const base::FilePath& active_profile_path,
|
| - app_list::AppListViewDelegate::Users* users) {
|
| - users->clear();
|
| - std::vector<ProfileAttributesEntry*> entries = g_browser_process->
|
| - profile_manager()->GetProfileAttributesStorage().
|
| - GetAllProfilesAttributesSortedByName();
|
| - for (const auto entry : entries) {
|
| - app_list::AppListViewDelegate::User user;
|
| - user.name = entry->GetName();
|
| - user.email = entry->GetUserName();
|
| - user.profile_path = entry->GetPath();
|
| - user.active = active_profile_path == user.profile_path;
|
| - users->push_back(user);
|
| - }
|
| -}
|
| -
|
| // Gets a list of URLs of the custom launcher pages to show in the launcher.
|
| // Returns a URL for each installed launcher page. If --custom-launcher-page is
|
| // specified and valid, also includes that URL.
|
| @@ -177,30 +153,8 @@ AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller)
|
| profile_(NULL),
|
| model_(NULL),
|
| is_voice_query_(false),
|
| - template_url_service_observer_(this),
|
| - scoped_observer_(this) {
|
| + template_url_service_observer_(this) {
|
| CHECK(controller_);
|
| - // The SigninManagerFactor and the SigninManagers are observed to keep the
|
| - // profile switcher menu up to date, with the correct list of profiles and the
|
| - // correct email address (or none for signed out users) for each.
|
| - SigninManagerFactory::GetInstance()->AddObserver(this);
|
| -
|
| - // Start observing all already-created SigninManagers.
|
| - ProfileManager* profile_manager = g_browser_process->profile_manager();
|
| - std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles();
|
| -
|
| - for (std::vector<Profile*>::iterator i = profiles.begin();
|
| - i != profiles.end();
|
| - ++i) {
|
| - SigninManagerBase* manager =
|
| - SigninManagerFactory::GetForProfileIfExists(*i);
|
| - if (manager) {
|
| - DCHECK(!scoped_observer_.IsObserving(manager));
|
| - scoped_observer_.Add(manager);
|
| - }
|
| - }
|
| -
|
| - profile_manager->GetProfileAttributesStorage().AddObserver(this);
|
| speech_ui_.reset(new app_list::SpeechUIModel);
|
|
|
| #if defined(GOOGLE_CHROME_BUILD)
|
| @@ -215,23 +169,10 @@ AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller)
|
|
|
| speech_ui_->set_logo(*image);
|
| #endif
|
| -
|
| - registrar_.Add(this,
|
| - chrome::NOTIFICATION_APP_TERMINATING,
|
| - content::NotificationService::AllSources());
|
| }
|
|
|
| AppListViewDelegate::~AppListViewDelegate() {
|
| - // Note that the destructor is not always called. E.g. on Mac, this is owned
|
| - // by a leaky singleton. Essential shutdown work must be done by observing
|
| - // chrome::NOTIFICATION_APP_TERMINATING.
|
| SetProfile(NULL);
|
| - g_browser_process->profile_manager()->GetProfileAttributesStorage().
|
| - RemoveObserver(this);
|
| -
|
| - SigninManagerFactory* factory = SigninManagerFactory::GetInstance();
|
| - if (factory)
|
| - factory->RemoveObserver(this);
|
| }
|
|
|
| void AppListViewDelegate::SetProfile(Profile* new_profile) {
|
| @@ -291,7 +232,6 @@ void AppListViewDelegate::SetProfile(Profile* new_profile) {
|
| #endif
|
|
|
| SetUpSearchUI();
|
| - SetUpProfileSwitcher();
|
| SetUpCustomLauncherPages();
|
| OnTemplateURLServiceChanged();
|
| }
|
| @@ -319,24 +259,6 @@ void AppListViewDelegate::SetUpSearchUI() {
|
| search_controller_ = CreateSearchController(profile_, model_, controller_);
|
| }
|
|
|
| -void AppListViewDelegate::SetUpProfileSwitcher() {
|
| - // If a profile change is observed when there is no app list, there is nothing
|
| - // to update until SetProfile() calls this function again.
|
| - if (!profile_)
|
| - return;
|
| -
|
| -#if defined(USE_ASH)
|
| - // Don't populate the app list users if we are on the ash desktop.
|
| - return;
|
| -#endif // USE_ASH
|
| -
|
| - // Populate the app list users.
|
| - PopulateUsers(profile_->GetPath(), &users_);
|
| -
|
| - FOR_EACH_OBSERVER(
|
| - app_list::AppListViewDelegateObserver, observers_, OnProfilesChanged());
|
| -}
|
| -
|
| void AppListViewDelegate::SetUpCustomLauncherPages() {
|
| std::vector<GURL> custom_launcher_page_urls;
|
| GetCustomLauncherPageUrls(profile_, &custom_launcher_page_urls);
|
| @@ -387,47 +309,6 @@ void AppListViewDelegate::OnHotwordRecognized(
|
| StartSpeechRecognitionForHotword(preamble);
|
| }
|
|
|
| -void AppListViewDelegate::SigninManagerCreated(SigninManagerBase* manager) {
|
| - scoped_observer_.Add(manager);
|
| -}
|
| -
|
| -void AppListViewDelegate::SigninManagerShutdown(SigninManagerBase* manager) {
|
| - if (scoped_observer_.IsObserving(manager))
|
| - scoped_observer_.Remove(manager);
|
| -}
|
| -
|
| -void AppListViewDelegate::GoogleSigninFailed(
|
| - const GoogleServiceAuthError& error) {
|
| - SetUpProfileSwitcher();
|
| -}
|
| -
|
| -void AppListViewDelegate::GoogleSigninSucceeded(const std::string& account_id,
|
| - const std::string& username,
|
| - const std::string& password) {
|
| - SetUpProfileSwitcher();
|
| -}
|
| -
|
| -void AppListViewDelegate::GoogleSignedOut(const std::string& account_id,
|
| - const std::string& username) {
|
| - SetUpProfileSwitcher();
|
| -}
|
| -
|
| -void AppListViewDelegate::OnProfileAdded(const base::FilePath& profile_path) {
|
| - SetUpProfileSwitcher();
|
| -}
|
| -
|
| -void AppListViewDelegate::OnProfileWasRemoved(
|
| - const base::FilePath& profile_path,
|
| - const base::string16& profile_name) {
|
| - SetUpProfileSwitcher();
|
| -}
|
| -
|
| -void AppListViewDelegate::OnProfileNameChanged(
|
| - const base::FilePath& profile_path,
|
| - const base::string16& old_profile_name) {
|
| - SetUpProfileSwitcher();
|
| -}
|
| -
|
| bool AppListViewDelegate::ForceNativeDesktop() const {
|
| return controller_->ForceNativeDesktop();
|
| }
|
| @@ -567,22 +448,6 @@ void AppListViewDelegate::ViewClosing() {
|
| }
|
| }
|
|
|
| -void AppListViewDelegate::OpenHelp() {
|
| - chrome::ScopedTabbedBrowserDisplayer displayer(profile_);
|
| - content::OpenURLParams params(GURL(chrome::kAppLauncherHelpURL),
|
| - content::Referrer(),
|
| - NEW_FOREGROUND_TAB,
|
| - ui::PAGE_TRANSITION_LINK,
|
| - false);
|
| - displayer.browser()->OpenURL(params);
|
| -}
|
| -
|
| -void AppListViewDelegate::OpenFeedback() {
|
| - Browser* browser = chrome::FindTabbedBrowser(profile_, false);
|
| - chrome::ShowFeedbackPage(browser, std::string(),
|
| - chrome::kAppLauncherCategoryTag);
|
| -}
|
| -
|
| void AppListViewDelegate::StartSpeechRecognition() {
|
| StartSpeechRecognitionForHotword(nullptr);
|
| }
|
| @@ -738,11 +603,6 @@ bool AppListViewDelegate::IsSpeechRecognitionEnabled() {
|
| return service && service->GetSpeechRecognitionContents();
|
| }
|
|
|
| -const app_list::AppListViewDelegate::Users&
|
| -AppListViewDelegate::GetUsers() const {
|
| - return users_;
|
| -}
|
| -
|
| bool AppListViewDelegate::ShouldCenterWindow() const {
|
| // Some ChromeOS devices (those that support TouchView mode) turn this flag on
|
| // by default, which ensures that the app list is consistently centered on
|
| @@ -762,16 +622,6 @@ bool AppListViewDelegate::ShouldCenterWindow() const {
|
| return false;
|
| }
|
|
|
| -void AppListViewDelegate::AddObserver(
|
| - app_list::AppListViewDelegateObserver* observer) {
|
| - observers_.AddObserver(observer);
|
| -}
|
| -
|
| -void AppListViewDelegate::RemoveObserver(
|
| - app_list::AppListViewDelegateObserver* observer) {
|
| - observers_.RemoveObserver(observer);
|
| -}
|
| -
|
| #if !defined(OS_CHROMEOS)
|
| base::string16 AppListViewDelegate::GetMessageTitle() const {
|
| return l10n_util::GetStringUTF16(IDS_APP_LIST_MESSAGE_TITLE);
|
| @@ -828,19 +678,3 @@ void AppListViewDelegate::OnTemplateURLServiceChanged() {
|
| if (start_page_service)
|
| start_page_service->set_search_engine_is_google(is_google);
|
| }
|
| -
|
| -void AppListViewDelegate::Observe(int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) {
|
| - DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type);
|
| -
|
| - FOR_EACH_OBSERVER(app_list::AppListViewDelegateObserver, observers_,
|
| - OnShutdown());
|
| -
|
| - SetProfile(nullptr); // Ensures launcher page web contents are torn down.
|
| -
|
| - // SigninManagerFactory is not a leaky singleton (unlike this class), and
|
| - // its destructor will check that it has no remaining observers.
|
| - scoped_observer_.RemoveAll();
|
| - SigninManagerFactory::GetInstance()->RemoveObserver(this);
|
| -}
|
|
|