Chromium Code Reviews| 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() const { | |
| 800 return l10n_util::GetStringUTF16(IDS_APP_LIST_MESSAGE_TEXT); | |
|
Matt Giuca
2016/03/22 03:28:06
base::string16 GetMessageText(size_t* offset) cons
tapted
2016/03/22 04:58:14
Acknowledged.
| |
| 801 } | |
| 802 | |
| 803 base::string16 AppListViewDelegate::GetAppsShortcutName() const { | |
| 804 return l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_APPS_SHORTCUT_NAME); | |
| 805 } | |
| 806 | |
| 807 base::string16 AppListViewDelegate::GetLearnMoreText() const { | |
| 808 return l10n_util::GetStringUTF16(IDS_APP_LIST_MESSAGE_LEARN_MORE_TEXT); | |
| 809 } | |
| 810 | |
| 811 base::string16 AppListViewDelegate::GetLearnMoreLink() const { | |
| 812 return l10n_util::GetStringUTF16(IDS_APP_LIST_MESSAGE_LEARN_MORE_LINK); | |
| 813 } | |
| 814 | |
| 815 gfx::ImageSkia* AppListViewDelegate::GetAppsIcon() const { | |
| 816 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | |
| 817 // Ensure it's backed by a native image type in the ResourceBundle cache. | |
| 818 rb.GetNativeImageNamed(IDR_BOOKMARK_BAR_APPS_SHORTCUT); | |
| 819 return rb.GetImageSkiaNamed(IDR_BOOKMARK_BAR_APPS_SHORTCUT); | |
| 820 } | |
| 821 | |
| 822 void AppListViewDelegate::OpenLearnMoreLink() { | |
| 823 controller_->OpenURL(profile_, GURL(GetLearnMoreLink()), | |
| 824 ui::PAGE_TRANSITION_LINK, CURRENT_TAB); | |
| 825 } | |
| 826 #endif // !defined(OS_CHROMEOS) | |
| 827 | |
| 789 void AppListViewDelegate::OnTemplateURLServiceChanged() { | 828 void AppListViewDelegate::OnTemplateURLServiceChanged() { |
| 790 if (!app_list::switches::IsExperimentalAppListEnabled()) | 829 if (!app_list::switches::IsExperimentalAppListEnabled()) |
| 791 return; | 830 return; |
| 792 | 831 |
| 793 TemplateURLService* template_url_service = | 832 TemplateURLService* template_url_service = |
| 794 TemplateURLServiceFactory::GetForProfile(profile_); | 833 TemplateURLServiceFactory::GetForProfile(profile_); |
| 795 const TemplateURL* default_provider = | 834 const TemplateURL* default_provider = |
| 796 template_url_service->GetDefaultSearchProvider(); | 835 template_url_service->GetDefaultSearchProvider(); |
| 797 bool is_google = | 836 bool is_google = |
| 798 TemplateURLPrepopulateData::GetEngineType( | 837 TemplateURLPrepopulateData::GetEngineType( |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 819 | 858 |
| 820 // SigninManagerFactory is not a leaky singleton (unlike this class), and | 859 // SigninManagerFactory is not a leaky singleton (unlike this class), and |
| 821 // its destructor will check that it has no remaining observers. | 860 // its destructor will check that it has no remaining observers. |
| 822 scoped_observer_.RemoveAll(); | 861 scoped_observer_.RemoveAll(); |
| 823 SigninManagerFactory::GetInstance()->RemoveObserver(this); | 862 SigninManagerFactory::GetInstance()->RemoveObserver(this); |
| 824 break; | 863 break; |
| 825 default: | 864 default: |
| 826 NOTREACHED(); | 865 NOTREACHED(); |
| 827 } | 866 } |
| 828 } | 867 } |
| OLD | NEW |