| OLD | NEW |
| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "content/public/browser/render_widget_host_view.h" | 54 #include "content/public/browser/render_widget_host_view.h" |
| 55 #include "content/public/browser/speech_recognition_session_preamble.h" | 55 #include "content/public/browser/speech_recognition_session_preamble.h" |
| 56 #include "content/public/browser/user_metrics.h" | 56 #include "content/public/browser/user_metrics.h" |
| 57 #include "content/public/browser/web_contents.h" | 57 #include "content/public/browser/web_contents.h" |
| 58 #include "extensions/browser/extension_registry.h" | 58 #include "extensions/browser/extension_registry.h" |
| 59 #include "extensions/common/constants.h" | 59 #include "extensions/common/constants.h" |
| 60 #include "extensions/common/extension_set.h" | 60 #include "extensions/common/extension_set.h" |
| 61 #include "extensions/common/manifest_constants.h" | 61 #include "extensions/common/manifest_constants.h" |
| 62 #include "extensions/common/manifest_handlers/launcher_page_info.h" | 62 #include "extensions/common/manifest_handlers/launcher_page_info.h" |
| 63 #include "ui/app_list/app_list_switches.h" | 63 #include "ui/app_list/app_list_switches.h" |
| 64 #include "ui/app_list/app_list_view_delegate_observer.h" | |
| 65 #include "ui/app_list/search_box_model.h" | 64 #include "ui/app_list/search_box_model.h" |
| 66 #include "ui/app_list/search_controller.h" | 65 #include "ui/app_list/search_controller.h" |
| 67 #include "ui/app_list/speech_ui_model.h" | 66 #include "ui/app_list/speech_ui_model.h" |
| 68 #include "ui/base/resource/resource_bundle.h" | 67 #include "ui/base/resource/resource_bundle.h" |
| 69 #include "ui/views/controls/webview/webview.h" | 68 #include "ui/views/controls/webview/webview.h" |
| 70 | 69 |
| 71 #if defined(USE_AURA) | 70 #if defined(USE_AURA) |
| 72 #include "ui/keyboard/keyboard_util.h" | 71 #include "ui/keyboard/keyboard_util.h" |
| 73 #endif | 72 #endif |
| 74 | 73 |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 app_list::StartPageService* service = | 679 app_list::StartPageService* service = |
| 681 app_list::StartPageService::Get(profile_); | 680 app_list::StartPageService::Get(profile_); |
| 682 return service && service->GetSpeechRecognitionContents(); | 681 return service && service->GetSpeechRecognitionContents(); |
| 683 } | 682 } |
| 684 | 683 |
| 685 const app_list::AppListViewDelegate::Users& | 684 const app_list::AppListViewDelegate::Users& |
| 686 AppListViewDelegate::GetUsers() const { | 685 AppListViewDelegate::GetUsers() const { |
| 687 return users_; | 686 return users_; |
| 688 } | 687 } |
| 689 | 688 |
| 690 void AppListViewDelegate::AddObserver( | |
| 691 app_list::AppListViewDelegateObserver* observer) { | |
| 692 observers_.AddObserver(observer); | |
| 693 } | |
| 694 | |
| 695 void AppListViewDelegate::RemoveObserver( | |
| 696 app_list::AppListViewDelegateObserver* observer) { | |
| 697 observers_.RemoveObserver(observer); | |
| 698 } | |
| 699 | |
| 700 void AppListViewDelegate::OnTemplateURLServiceChanged() { | 689 void AppListViewDelegate::OnTemplateURLServiceChanged() { |
| 701 TemplateURLService* template_url_service = | 690 TemplateURLService* template_url_service = |
| 702 TemplateURLServiceFactory::GetForProfile(profile_); | 691 TemplateURLServiceFactory::GetForProfile(profile_); |
| 703 const TemplateURL* default_provider = | 692 const TemplateURL* default_provider = |
| 704 template_url_service->GetDefaultSearchProvider(); | 693 template_url_service->GetDefaultSearchProvider(); |
| 705 bool is_google = | 694 bool is_google = |
| 706 default_provider->GetEngineType( | 695 default_provider->GetEngineType( |
| 707 template_url_service->search_terms_data()) == | 696 template_url_service->search_terms_data()) == |
| 708 SEARCH_ENGINE_GOOGLE; | 697 SEARCH_ENGINE_GOOGLE; |
| 709 | 698 |
| 710 model_->SetSearchEngineIsGoogle(is_google); | 699 model_->SetSearchEngineIsGoogle(is_google); |
| 711 | 700 |
| 712 app_list::StartPageService* start_page_service = | 701 app_list::StartPageService* start_page_service = |
| 713 app_list::StartPageService::Get(profile_); | 702 app_list::StartPageService::Get(profile_); |
| 714 if (start_page_service) | 703 if (start_page_service) |
| 715 start_page_service->set_search_engine_is_google(is_google); | 704 start_page_service->set_search_engine_is_google(is_google); |
| 716 } | 705 } |
| 717 | 706 |
| 718 void AppListViewDelegate::Observe(int type, | 707 void AppListViewDelegate::Observe(int type, |
| 719 const content::NotificationSource& source, | 708 const content::NotificationSource& source, |
| 720 const content::NotificationDetails& details) { | 709 const content::NotificationDetails& details) { |
| 721 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); | 710 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); |
| 722 | 711 |
| 723 FOR_EACH_OBSERVER(app_list::AppListViewDelegateObserver, observers_, | |
| 724 OnShutdown()); | |
| 725 | |
| 726 SetProfile(nullptr); // Ensures launcher page web contents are torn down. | 712 SetProfile(nullptr); // Ensures launcher page web contents are torn down. |
| 727 | 713 |
| 728 // SigninManagerFactory is not a leaky singleton (unlike this class), and | 714 // SigninManagerFactory is not a leaky singleton (unlike this class), and |
| 729 // its destructor will check that it has no remaining observers. | 715 // its destructor will check that it has no remaining observers. |
| 730 scoped_observer_.RemoveAll(); | 716 scoped_observer_.RemoveAll(); |
| 731 SigninManagerFactory::GetInstance()->RemoveObserver(this); | 717 SigninManagerFactory::GetInstance()->RemoveObserver(this); |
| 732 } | 718 } |
| OLD | NEW |