diff options
-rw-r--r-- | ash/shell/app_list.cc | 4 | ||||
-rw-r--r-- | chrome/app/chrome_dll.rc | 4 | ||||
-rw-r--r-- | chrome/app/chrome_dll_resource.h | 1 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 3 | ||||
-rw-r--r-- | chrome/app/theme/default_100_percent/app_list.png | bin | 156 -> 0 bytes | |||
-rw-r--r-- | chrome/app/theme/theme_resources.grd | 3 | ||||
-rw-r--r-- | chrome/browser/ui/app_list/app_list_controller.h | 7 | ||||
-rw-r--r-- | chrome/browser/ui/app_list/app_list_view_delegate.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/app_list/app_list_view_delegate.h | 1 | ||||
-rw-r--r-- | chrome/browser/ui/ash/app_list/app_list_controller_ash.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/ash/app_list/app_list_controller_ash.h | 1 | ||||
-rw-r--r-- | chrome/browser/ui/views/app_list/app_list_controller_win.cc | 73 | ||||
-rw-r--r-- | ui/app_list/app_list_view.cc | 7 | ||||
-rw-r--r-- | ui/app_list/app_list_view.h | 1 | ||||
-rw-r--r-- | ui/app_list/app_list_view_delegate.h | 7 | ||||
-rw-r--r-- | ui/base/win/shell.cc | 31 | ||||
-rw-r--r-- | ui/base/win/shell.h | 7 |
17 files changed, 101 insertions, 58 deletions
diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc index 956282f..cd3a0fa 100644 --- a/ash/shell/app_list.cc +++ b/ash/shell/app_list.cc @@ -279,10 +279,6 @@ class ExampleAppListViewDelegate : public app_list::AppListViewDelegate { Shell::GetInstance()->ToggleAppList(); } - virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE { - return gfx::ImageSkia(); - } - app_list::AppListModel* model_; DISALLOW_COPY_AND_ASSIGN(ExampleAppListViewDelegate); diff --git a/chrome/app/chrome_dll.rc b/chrome/app/chrome_dll.rc index a985566..1cbbc1f 100644 --- a/chrome/app/chrome_dll.rc +++ b/chrome/app/chrome_dll.rc @@ -209,6 +209,10 @@ IDI_THROBBER_22 ICON "theme\vista_frame_throbber_22.i IDI_THROBBER_23 ICON "theme\vista_frame_throbber_23.ico" IDI_THROBBER_24 ICON "theme\vista_frame_throbber_24.ico" +// Icon for the App Lancher +IDI_APP_LIST ICON "theme\\app_list.ico" + + ///////////////////////////////////////////////////////////////////////////// // // Dialog diff --git a/chrome/app/chrome_dll_resource.h b/chrome/app/chrome_dll_resource.h index 43f84b7..e7b5d6e 100644 --- a/chrome/app/chrome_dll_resource.h +++ b/chrome/app/chrome_dll_resource.h @@ -30,6 +30,7 @@ #define IDI_THROBBER_23 124 #define IDI_THROBBER_24 125 #define IDR_SXS 126 +#define IDI_APP_LIST 127 // Values around 1600 are used by installer/setup/build/ diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index f095c58..aa66636 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -18045,6 +18045,9 @@ Battery full <message name="IDS_APP_LIST_CONTEXT_MENU_UNPIN" desc="Title text for the 'unpin' context menu item of an app list item."> Unpin from Launcher </message> + <message name="IDS_APP_LIST_SHORTCUT_NAME" desc="Name for the App List to appear in the taskbar and in any shortcuts to it."> + Chrome Apps Launcher + </message> <message name="IDS_SEARCH_BOX_HINT" desc="Hint text for the search box in app list window."> Search </message> diff --git a/chrome/app/theme/default_100_percent/app_list.png b/chrome/app/theme/default_100_percent/app_list.png Binary files differdeleted file mode 100644 index 29622b4..0000000 --- a/chrome/app/theme/default_100_percent/app_list.png +++ /dev/null diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 5e93e28..cc24337 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -32,9 +32,6 @@ <structure type="chrome_scaled_image" name="IDR_ALLOWED_JAVASCRIPT" file="allowed_script.png" /> <structure type="chrome_scaled_image" name="IDR_APP_DEFAULT_ICON" file="app_default_icon.png" /> <structure type="chrome_scaled_image" name="IDR_APP_DROPARROW" file="app_droparrow.png" /> - <if expr="is_win"> - <structure type="chrome_scaled_image" name="IDR_APP_LIST" file="app_list.png" /> - </if> <structure type="chrome_scaled_image" name="IDR_APP_NOTIFICATION_NUB" file="nub.png" /> <structure type="chrome_scaled_image" name="IDR_APP_NOTIFICATION_NUB_MASK" file="nub_mask.png" /> <structure type="chrome_scaled_image" name="IDR_APP_NOTIFICATION_SMALL_BUBBLE" file="small_bubble.png" /> diff --git a/chrome/browser/ui/app_list/app_list_controller.h b/chrome/browser/ui/app_list/app_list_controller.h index c185c3f..1d42d9f 100644 --- a/chrome/browser/ui/app_list/app_list_controller.h +++ b/chrome/browser/ui/app_list/app_list_controller.h @@ -7,10 +7,6 @@ #include <string> -namespace gfx { -class ImageSkia; -} - class Profile; // Interface to allow the view delegate to call out to whatever is controlling @@ -33,9 +29,6 @@ class AppListController { virtual void ActivateApp(Profile* profile, const std::string& extension_id, int event_flags) = 0; - - // Get the window icon to show, if any. - virtual gfx::ImageSkia GetWindowAppIcon() = 0; }; namespace app_list_controller { 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 13334b8..67bc837 100644 --- a/chrome/browser/ui/app_list/app_list_view_delegate.cc +++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc @@ -68,7 +68,3 @@ void AppListViewDelegate::InvokeSearchResultAction( void AppListViewDelegate::Close() { controller_->CloseView(); } - -gfx::ImageSkia AppListViewDelegate::GetWindowAppIcon() { - return controller_->GetWindowAppIcon(); -} diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.h b/chrome/browser/ui/app_list/app_list_view_delegate.h index 6e4434e..4d5eed7 100644 --- a/chrome/browser/ui/app_list/app_list_view_delegate.h +++ b/chrome/browser/ui/app_list/app_list_view_delegate.h @@ -35,7 +35,6 @@ class AppListViewDelegate : public app_list::AppListViewDelegate { int action_index, int event_flags) OVERRIDE; virtual void Close() OVERRIDE; - virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE; scoped_ptr<AppsModelBuilder> apps_builder_; scoped_ptr<SearchBuilder> search_builder_; diff --git a/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc b/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc index 79b4c9f..4bd0bbe 100644 --- a/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc +++ b/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc @@ -39,8 +39,3 @@ void AppListControllerAsh::ActivateApp(Profile* profile, ChromeLauncherController::instance()->OpenAppID(extension_id, event_flags); } - -gfx::ImageSkia AppListControllerAsh::GetWindowAppIcon() { - // This is not set for the ash port. - return gfx::ImageSkia(); -} diff --git a/chrome/browser/ui/ash/app_list/app_list_controller_ash.h b/chrome/browser/ui/ash/app_list/app_list_controller_ash.h index af8a48b..fe5b1a3 100644 --- a/chrome/browser/ui/ash/app_list/app_list_controller_ash.h +++ b/chrome/browser/ui/ash/app_list/app_list_controller_ash.h @@ -24,7 +24,6 @@ class AppListControllerAsh : public AppListController { virtual void ActivateApp(Profile* profile, const std::string& extension_id, int event_flags) OVERRIDE; - virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE; DISALLOW_COPY_AND_ASSIGN(AppListControllerAsh); }; diff --git a/chrome/browser/ui/views/app_list/app_list_controller_win.cc b/chrome/browser/ui/views/app_list/app_list_controller_win.cc index 5a6c3de..460ffd8 100644 --- a/chrome/browser/ui/views/app_list/app_list_controller_win.cc +++ b/chrome/browser/ui/views/app_list/app_list_controller_win.cc @@ -2,17 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <sstream> + +#include "base/command_line.h" #include "base/lazy_instance.h" +#include "base/path_service.h" +#include "base/utf_string_conversions.h" +#include "chrome/app/chrome_dll_resource.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/shell_integration.h" #include "chrome/browser/ui/app_list/app_list_controller.h" #include "chrome/browser/ui/app_list/app_list_view_delegate.h" #include "chrome/browser/ui/extensions/application_launch.h" -#include "grit/theme_resources.h" +#include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_switches.h" +#include "grit/generated_resources.h" #include "ui/app_list/app_list_view.h" #include "ui/app_list/pagination_model.h" -#include "ui/base/resource/resource_bundle.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/base/win/shell.h" #include "ui/gfx/display.h" #include "ui/gfx/screen.h" @@ -41,7 +52,6 @@ class AppListControllerWin : public AppListController { virtual void ActivateApp(Profile* profile, const std::string& extension_id, int event_flags) OVERRIDE; - virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE; DISALLOW_COPY_AND_ASSIGN(AppListControllerWin); }; @@ -80,12 +90,6 @@ void AppListControllerWin::ActivateApp(Profile* profile, profile, extension, extension_misc::LAUNCH_TAB, NEW_FOREGROUND_TAB)); } -gfx::ImageSkia AppListControllerWin::GetWindowAppIcon() { - gfx::ImageSkia* resource = ResourceBundle::GetSharedInstance(). - GetImageSkiaNamed(IDR_APP_LIST); - return *resource; -}; - // The AppListResources class manages global resources needed for the app // list to operate. class AppListResources { @@ -155,6 +159,44 @@ void UpdateArrowPositionAndAnchorPoint(app_list::AppListView* view) { view->SetAnchorPoint(anchor); } +CommandLine GetAppListCommandLine() { + CommandLine* current = CommandLine::ForCurrentProcess(); + CommandLine command_line(current->GetProgram()); + + if (current->HasSwitch(switches::kUserDataDir)) { + FilePath user_data_dir = current->GetSwitchValuePath( + switches::kUserDataDir); + command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); + } + + command_line.AppendSwitch(switches::kShowAppList); + return command_line; +} + +string16 GetAppListIconPath() { + FilePath icon_path; + if (!PathService::Get(base::DIR_MODULE, &icon_path)) + return string16(); + + icon_path = icon_path.Append(chrome::kBrowserResourcesDll); + std::stringstream ss; + ss << ",-" << IDI_APP_LIST; + string16 result = icon_path.value(); + result.append(UTF8ToUTF16(ss.str())); + return result; +} + +string16 GetAppModelId() { + static const wchar_t kAppListId[] = L"ChromeAppList"; + // The AppModelId should be the same for all profiles in a user data directory + // but different for different user data directories, so base it on the + // initial profile in the current user data directory. + FilePath initial_profile_path = + g_browser_process->profile_manager()->GetInitialProfileDir(); + return ShellIntegration::GetAppModelIdForProfile(kAppListId, + initial_profile_path); +} + base::LazyInstance<AppListResources>::Leaky g_app_list_resources = LAZY_INSTANCE_INITIALIZER; @@ -164,7 +206,6 @@ namespace app_list_controller { void ShowAppList() { #if !defined(USE_AURA) - static const wchar_t kAppListId[] = L"ChromeAppList"; // The controller will be owned by the view delegate, and the delegate is // owned by the app list view. The app list view manages it's own lifetime. @@ -179,10 +220,16 @@ void ShowAppList() { views::BubbleBorder::BOTTOM_LEFT); UpdateArrowPositionAndAnchorPoint(view); + HWND hwnd = view->GetWidget()->GetTopLevelWidget()->GetNativeWindow(); + ui::win::SetAppIdForWindow(GetAppModelId(), hwnd); + CommandLine relaunch = GetAppListCommandLine(); + ui::win::SetRelaunchDetailsForWindow( + relaunch.GetCommandLineString(), + l10n_util::GetStringUTF16(IDS_APP_LIST_SHORTCUT_NAME), + hwnd); + string16 icon_path = GetAppListIconPath(); + ui::win::SetAppIconForWindow(icon_path, hwnd); view->Show(); - view->GetWidget()->GetTopLevelWidget()->UpdateWindowIcon(); - ui::win::SetAppIdForWindow(kAppListId, - view->GetWidget()->GetTopLevelWidget()->GetNativeWindow()); #endif } diff --git a/ui/app_list/app_list_view.cc b/ui/app_list/app_list_view.cc index 8a4268d..13dc39a 100644 --- a/ui/app_list/app_list_view.cc +++ b/ui/app_list/app_list_view.cc @@ -143,13 +143,6 @@ views::View* AppListView::GetInitiallyFocusedView() { return search_box_view_->search_box(); } -gfx::ImageSkia AppListView::GetWindowAppIcon() { - if (delegate_.get()) - return delegate_->GetWindowAppIcon(); - - return gfx::ImageSkia(); -} - bool AppListView::HasHitTestMask() const { return true; } diff --git a/ui/app_list/app_list_view.h b/ui/app_list/app_list_view.h index e8351fd..68a73c8 100644 --- a/ui/app_list/app_list_view.h +++ b/ui/app_list/app_list_view.h @@ -53,7 +53,6 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDelegateView, // Overridden from views::WidgetDelegateView: virtual views::View* GetInitiallyFocusedView() OVERRIDE; - virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE; virtual bool HasHitTestMask() const OVERRIDE; virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; diff --git a/ui/app_list/app_list_view_delegate.h b/ui/app_list/app_list_view_delegate.h index f236971..d7e0c82 100644 --- a/ui/app_list/app_list_view_delegate.h +++ b/ui/app_list/app_list_view_delegate.h @@ -7,10 +7,6 @@ #include "ui/app_list/app_list_export.h" -namespace gfx { -class ImageSkia; -} - namespace app_list { class AppListItemModel; @@ -50,9 +46,6 @@ class APP_LIST_EXPORT AppListViewDelegate { // Invoked to close app list. virtual void Close() = 0; - - // Get the application icon to be used, if any, for the app list. - virtual gfx::ImageSkia GetWindowAppIcon() = 0; }; } // namespace app_list diff --git a/ui/base/win/shell.cc b/ui/base/win/shell.cc index 32ca484..c82daf0 100644 --- a/ui/base/win/shell.cc +++ b/ui/base/win/shell.cc @@ -22,9 +22,11 @@ namespace win { namespace { -void SetAppIdAndIconForWindow(const string16& app_id, - const string16& app_icon, - HWND hwnd) { +void SetAppDetailsForWindow(const string16& app_id, + const string16& app_icon, + const string16& relaunch_command, + const string16& relaunch_display_name, + HWND hwnd) { // This functionality is only available on Win7+. It also doesn't make sense // to do this for Chrome Metro. if (base::win::GetVersion() < base::win::VERSION_WIN7 || @@ -40,6 +42,15 @@ void SetAppIdAndIconForWindow(const string16& app_id, base::win::SetStringValueForPropertyStore( pps, PKEY_AppUserModel_RelaunchIconResource, app_icon.c_str()); } + if (!relaunch_command.empty()) { + base::win::SetStringValueForPropertyStore( + pps, PKEY_AppUserModel_RelaunchCommand, relaunch_command.c_str()); + } + if (!relaunch_display_name.empty()) { + base::win::SetStringValueForPropertyStore( + pps, PKEY_AppUserModel_RelaunchDisplayNameResource, + relaunch_display_name.c_str()); + } } } @@ -86,11 +97,21 @@ bool OpenItemViaShellNoZoneCheck(const FilePath& full_path) { } void SetAppIdForWindow(const string16& app_id, HWND hwnd) { - SetAppIdAndIconForWindow(app_id, string16(), hwnd); + SetAppDetailsForWindow(app_id, string16(), string16(), string16(), hwnd); } void SetAppIconForWindow(const string16& app_icon, HWND hwnd) { - SetAppIdAndIconForWindow(string16(), app_icon, hwnd); + SetAppDetailsForWindow(string16(), app_icon, string16(), string16(), hwnd); +} + +void SetRelaunchDetailsForWindow(const string16& relaunch_command, + const string16& display_name, + HWND hwnd) { + SetAppDetailsForWindow(string16(), + string16(), + relaunch_command, + display_name, + hwnd); } bool IsAeroGlassEnabled() { diff --git a/ui/base/win/shell.h b/ui/base/win/shell.h index bf2e263..ada23de 100644 --- a/ui/base/win/shell.h +++ b/ui/base/win/shell.h @@ -47,6 +47,13 @@ UI_EXPORT void SetAppIdForWindow(const string16& app_id, HWND hwnd); // Sets the application icon for the window specified. UI_EXPORT void SetAppIconForWindow(const string16& app_icon, HWND hwnd); +// Sets the relaunch command and relaunch display name for the window specified. +// Windows will use this information for grouping on the taskbar, and to create +// a shortcut if the window is pinned to the taskbar. +UI_EXPORT void SetRelaunchDetailsForWindow(const string16& relaunch_command, + const string16& display_name, + HWND hwnd); + // Returns true if composition is available and turned on on the current // platform. UI_EXPORT bool IsAeroGlassEnabled(); |