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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 #endif | 78 #endif |
79 | 79 |
80 #if defined(USE_ASH) | 80 #if defined(USE_ASH) |
81 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" | 81 #include "chrome/browser/ui/ash/app_list/app_sync_ui_state_watcher.h" |
82 #endif | 82 #endif |
83 | 83 |
84 #if defined(OS_WIN) | 84 #if defined(OS_WIN) |
85 #include "chrome/browser/web_applications/web_app_win.h" | 85 #include "chrome/browser/web_applications/web_app_win.h" |
86 #endif | 86 #endif |
87 | 87 |
| 88 #if !defined(OS_CHROMEOS) |
| 89 #include "chrome/grit/chromium_strings.h" |
| 90 #include "chrome/grit/generated_resources.h" |
| 91 #include "ui/base/l10n/l10n_util.h" |
| 92 #endif |
88 | 93 |
89 namespace chrome { | 94 namespace chrome { |
90 const char kAppLauncherCategoryTag[] = "AppLauncher"; | 95 const char kAppLauncherCategoryTag[] = "AppLauncher"; |
91 } // namespace chrome | 96 } // namespace chrome |
92 | 97 |
93 namespace { | 98 namespace { |
94 | 99 |
95 const int kAutoLaunchDefaultTimeoutMilliSec = 50; | 100 const int kAutoLaunchDefaultTimeoutMilliSec = 50; |
96 | 101 |
97 #if defined(OS_WIN) | 102 #if defined(OS_WIN) |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 void AppListViewDelegate::AddObserver( | 784 void AppListViewDelegate::AddObserver( |
780 app_list::AppListViewDelegateObserver* observer) { | 785 app_list::AppListViewDelegateObserver* observer) { |
781 observers_.AddObserver(observer); | 786 observers_.AddObserver(observer); |
782 } | 787 } |
783 | 788 |
784 void AppListViewDelegate::RemoveObserver( | 789 void AppListViewDelegate::RemoveObserver( |
785 app_list::AppListViewDelegateObserver* observer) { | 790 app_list::AppListViewDelegateObserver* observer) { |
786 observers_.RemoveObserver(observer); | 791 observers_.RemoveObserver(observer); |
787 } | 792 } |
788 | 793 |
| 794 #if !defined(OS_CHROMEOS) |
| 795 base::string16 AppListViewDelegate::GetMessageTitle() const { |
| 796 return l10n_util::GetStringUTF16(IDS_APP_LIST_MESSAGE_TITLE); |
| 797 } |
| 798 |
| 799 base::string16 AppListViewDelegate::GetMessageText( |
| 800 size_t* message_break) const { |
| 801 return l10n_util::GetStringFUTF16(IDS_APP_LIST_MESSAGE_TEXT, base::string16(), |
| 802 message_break); |
| 803 } |
| 804 |
| 805 base::string16 AppListViewDelegate::GetAppsShortcutName() const { |
| 806 return l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_APPS_SHORTCUT_NAME); |
| 807 } |
| 808 |
| 809 base::string16 AppListViewDelegate::GetLearnMoreText() const { |
| 810 return l10n_util::GetStringUTF16(IDS_APP_LIST_MESSAGE_LEARN_MORE_TEXT); |
| 811 } |
| 812 |
| 813 base::string16 AppListViewDelegate::GetLearnMoreLink() const { |
| 814 return l10n_util::GetStringUTF16(IDS_APP_LIST_MESSAGE_LEARN_MORE_LINK); |
| 815 } |
| 816 |
| 817 gfx::ImageSkia* AppListViewDelegate::GetAppsIcon() const { |
| 818 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 819 // Ensure it's backed by a native image type in the ResourceBundle cache. |
| 820 rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_APPS_SHORTCUT); |
| 821 return rb.GetImageSkiaNamed(IDR_BOOKMARK_BAR_APPS_SHORTCUT); |
| 822 } |
| 823 |
| 824 void AppListViewDelegate::OpenLearnMoreLink() { |
| 825 controller_->OpenURL(profile_, GURL(GetLearnMoreLink()), |
| 826 ui::PAGE_TRANSITION_LINK, CURRENT_TAB); |
| 827 } |
| 828 #endif // !defined(OS_CHROMEOS) |
| 829 |
789 void AppListViewDelegate::OnTemplateURLServiceChanged() { | 830 void AppListViewDelegate::OnTemplateURLServiceChanged() { |
790 if (!app_list::switches::IsExperimentalAppListEnabled()) | 831 if (!app_list::switches::IsExperimentalAppListEnabled()) |
791 return; | 832 return; |
792 | 833 |
793 TemplateURLService* template_url_service = | 834 TemplateURLService* template_url_service = |
794 TemplateURLServiceFactory::GetForProfile(profile_); | 835 TemplateURLServiceFactory::GetForProfile(profile_); |
795 const TemplateURL* default_provider = | 836 const TemplateURL* default_provider = |
796 template_url_service->GetDefaultSearchProvider(); | 837 template_url_service->GetDefaultSearchProvider(); |
797 bool is_google = | 838 bool is_google = |
798 TemplateURLPrepopulateData::GetEngineType( | 839 TemplateURLPrepopulateData::GetEngineType( |
(...skipping 20 matching lines...) Expand all Loading... |
819 | 860 |
820 // SigninManagerFactory is not a leaky singleton (unlike this class), and | 861 // SigninManagerFactory is not a leaky singleton (unlike this class), and |
821 // its destructor will check that it has no remaining observers. | 862 // its destructor will check that it has no remaining observers. |
822 scoped_observer_.RemoveAll(); | 863 scoped_observer_.RemoveAll(); |
823 SigninManagerFactory::GetInstance()->RemoveObserver(this); | 864 SigninManagerFactory::GetInstance()->RemoveObserver(this); |
824 break; | 865 break; |
825 default: | 866 default: |
826 NOTREACHED(); | 867 NOTREACHED(); |
827 } | 868 } |
828 } | 869 } |
OLD | NEW |