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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 #include "ui/views/controls/webview/webview.h" | 69 #include "ui/views/controls/webview/webview.h" |
70 | 70 |
71 #if defined(USE_AURA) | 71 #if defined(USE_AURA) |
72 #include "ui/keyboard/keyboard_util.h" | 72 #include "ui/keyboard/keyboard_util.h" |
73 #endif | 73 #endif |
74 | 74 |
75 #if defined(USE_ASH) | 75 #if defined(USE_ASH) |
76 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" | 76 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" |
77 #endif | 77 #endif |
78 | 78 |
79 #if !defined(OS_CHROMEOS) | |
80 #include "chrome/grit/chromium_strings.h" | |
81 #include "chrome/grit/generated_resources.h" | |
82 #include "ui/base/l10n/l10n_util.h" | |
83 #endif | |
84 | |
85 namespace chrome { | 79 namespace chrome { |
86 const char kAppLauncherCategoryTag[] = "AppLauncher"; | 80 const char kAppLauncherCategoryTag[] = "AppLauncher"; |
87 } // namespace chrome | 81 } // namespace chrome |
88 | 82 |
89 namespace { | 83 namespace { |
90 | 84 |
91 const int kAutoLaunchDefaultTimeoutMilliSec = 50; | 85 const int kAutoLaunchDefaultTimeoutMilliSec = 50; |
92 | 86 |
93 void PopulateUsers(const base::FilePath& active_profile_path, | 87 void PopulateUsers(const base::FilePath& active_profile_path, |
94 app_list::AppListViewDelegate::Users* users) { | 88 app_list::AppListViewDelegate::Users* users) { |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 void AppListViewDelegate::AddObserver( | 715 void AppListViewDelegate::AddObserver( |
722 app_list::AppListViewDelegateObserver* observer) { | 716 app_list::AppListViewDelegateObserver* observer) { |
723 observers_.AddObserver(observer); | 717 observers_.AddObserver(observer); |
724 } | 718 } |
725 | 719 |
726 void AppListViewDelegate::RemoveObserver( | 720 void AppListViewDelegate::RemoveObserver( |
727 app_list::AppListViewDelegateObserver* observer) { | 721 app_list::AppListViewDelegateObserver* observer) { |
728 observers_.RemoveObserver(observer); | 722 observers_.RemoveObserver(observer); |
729 } | 723 } |
730 | 724 |
731 #if !defined(OS_CHROMEOS) | |
732 base::string16 AppListViewDelegate::GetMessageTitle() const { | |
733 return l10n_util::GetStringUTF16(IDS_APP_LIST_MESSAGE_TITLE); | |
734 } | |
735 | |
736 base::string16 AppListViewDelegate::GetMessageText( | |
737 size_t* message_break) const { | |
738 return l10n_util::GetStringFUTF16(IDS_APP_LIST_MESSAGE_TEXT, base::string16(), | |
739 message_break); | |
740 } | |
741 | |
742 base::string16 AppListViewDelegate::GetAppsShortcutName() const { | |
743 return l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_APPS_SHORTCUT_NAME); | |
744 } | |
745 | |
746 base::string16 AppListViewDelegate::GetLearnMoreText() const { | |
747 return l10n_util::GetStringUTF16(IDS_APP_LIST_MESSAGE_LEARN_MORE_TEXT); | |
748 } | |
749 | |
750 base::string16 AppListViewDelegate::GetLearnMoreLink() const { | |
751 return l10n_util::GetStringUTF16(IDS_APP_LIST_MESSAGE_LEARN_MORE_LINK); | |
752 } | |
753 | |
754 gfx::ImageSkia* AppListViewDelegate::GetAppsIcon() const { | |
755 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | |
756 // Ensure it's backed by a native image type in the ResourceBundle cache. | |
757 rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_APPS_SHORTCUT); | |
758 return rb.GetImageSkiaNamed(IDR_BOOKMARK_BAR_APPS_SHORTCUT); | |
759 } | |
760 | |
761 void AppListViewDelegate::OpenLearnMoreLink() { | |
762 controller_->OpenURL(profile_, GURL(GetLearnMoreLink()), | |
763 ui::PAGE_TRANSITION_LINK, | |
764 WindowOpenDisposition::CURRENT_TAB); | |
765 } | |
766 #endif // !defined(OS_CHROMEOS) | |
767 | |
768 void AppListViewDelegate::OnTemplateURLServiceChanged() { | 725 void AppListViewDelegate::OnTemplateURLServiceChanged() { |
769 if (!app_list::switches::IsExperimentalAppListEnabled()) | 726 if (!app_list::switches::IsExperimentalAppListEnabled()) |
770 return; | 727 return; |
771 | 728 |
772 TemplateURLService* template_url_service = | 729 TemplateURLService* template_url_service = |
773 TemplateURLServiceFactory::GetForProfile(profile_); | 730 TemplateURLServiceFactory::GetForProfile(profile_); |
774 const TemplateURL* default_provider = | 731 const TemplateURL* default_provider = |
775 template_url_service->GetDefaultSearchProvider(); | 732 template_url_service->GetDefaultSearchProvider(); |
776 bool is_google = | 733 bool is_google = |
777 default_provider->GetEngineType( | 734 default_provider->GetEngineType( |
(...skipping 16 matching lines...) Expand all Loading... |
794 FOR_EACH_OBSERVER(app_list::AppListViewDelegateObserver, observers_, | 751 FOR_EACH_OBSERVER(app_list::AppListViewDelegateObserver, observers_, |
795 OnShutdown()); | 752 OnShutdown()); |
796 | 753 |
797 SetProfile(nullptr); // Ensures launcher page web contents are torn down. | 754 SetProfile(nullptr); // Ensures launcher page web contents are torn down. |
798 | 755 |
799 // SigninManagerFactory is not a leaky singleton (unlike this class), and | 756 // SigninManagerFactory is not a leaky singleton (unlike this class), and |
800 // its destructor will check that it has no remaining observers. | 757 // its destructor will check that it has no remaining observers. |
801 scoped_observer_.RemoveAll(); | 758 scoped_observer_.RemoveAll(); |
802 SigninManagerFactory::GetInstance()->RemoveObserver(this); | 759 SigninManagerFactory::GetInstance()->RemoveObserver(this); |
803 } | 760 } |
OLD | NEW |