1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.h"
7 #include "apps/app_window.h"
8 #include "apps/app_window_registry.h"
9 #include "chrome/browser/metro_utils/metro_chrome_win.h"
10 #include "chrome/browser/ui/app_list/app_list_icon_win.h"
11 #include "chrome/browser/ui/extensions/application_launch.h"
12 #include "chrome/browser/ui/host_desktop.h"
13 #include "chrome/browser/ui/views/app_list/win/app_list_service_win.h"
14 #include "extensions/common/extension.h"
15 #include "ui/base/resource/resource_bundle.h"
17 AppListControllerDelegateWin::AppListControllerDelegateWin(
18 AppListServiceWin* service)
19 : AppListControllerDelegateImpl(service),
22 AppListControllerDelegateWin::~AppListControllerDelegateWin() {}
24 bool AppListControllerDelegateWin::ForceNativeDesktop() const {
28 void AppListControllerDelegateWin::ViewClosing() {
29 service_->OnAppListClosing();
32 gfx::ImageSkia AppListControllerDelegateWin::GetWindowIcon() {
33 gfx::ImageSkia* resource = ResourceBundle::GetSharedInstance().
34 GetImageSkiaNamed(GetAppListIconResourceId());
38 void AppListControllerDelegateWin::OnShowExtensionPrompt() {
39 service_->set_can_close(false);
42 void AppListControllerDelegateWin::OnCloseExtensionPrompt() {
43 service_->set_can_close(true);
46 bool AppListControllerDelegateWin::CanDoCreateShortcutsFlow() {
50 void AppListControllerDelegateWin::FillLaunchParams(AppLaunchParams* params) {
51 params->desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
52 apps::AppWindow* any_existing_window =
53 apps::AppWindowRegistry::Get(params->profile)
54 ->GetCurrentAppWindowForApp(params->extension_id);
55 if (any_existing_window &&
56 chrome::GetHostDesktopTypeForNativeWindow(
57 any_existing_window->GetNativeWindow())
58 != chrome::HOST_DESKTOP_TYPE_NATIVE) {
59 params->desktop_type = chrome::HOST_DESKTOP_TYPE_ASH;
60 chrome::ActivateMetroChrome();