Home | History | Annotate | Download | only in win
      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.
      4 
      5 #include "chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.h"
      6 
      7 #include "chrome/browser/metro_utils/metro_chrome_win.h"
      8 #include "chrome/browser/profiles/profile.h"
      9 #include "chrome/browser/ui/app_list/app_list_icon_win.h"
     10 #include "chrome/browser/ui/extensions/application_launch.h"
     11 #include "chrome/browser/ui/host_desktop.h"
     12 #include "extensions/browser/app_window/app_window.h"
     13 #include "extensions/browser/app_window/app_window_registry.h"
     14 #include "ui/base/resource/resource_bundle.h"
     15 
     16 AppListControllerDelegateWin::AppListControllerDelegateWin(
     17     AppListServiceViews* service)
     18     : AppListControllerDelegateViews(service) {}
     19 
     20 AppListControllerDelegateWin::~AppListControllerDelegateWin() {}
     21 
     22 bool AppListControllerDelegateWin::ForceNativeDesktop() const {
     23   return true;
     24 }
     25 
     26 gfx::ImageSkia AppListControllerDelegateWin::GetWindowIcon() {
     27   gfx::ImageSkia* resource = ResourceBundle::GetSharedInstance().
     28       GetImageSkiaNamed(GetAppListIconResourceId());
     29   return *resource;
     30 }
     31 
     32 void AppListControllerDelegateWin::FillLaunchParams(AppLaunchParams* params) {
     33   params->desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
     34   extensions::AppWindow* any_existing_window =
     35       extensions::AppWindowRegistry::Get(params->profile)
     36           ->GetCurrentAppWindowForApp(params->extension_id);
     37   if (any_existing_window &&
     38       chrome::GetHostDesktopTypeForNativeWindow(
     39           any_existing_window->GetNativeWindow())
     40       != chrome::HOST_DESKTOP_TYPE_NATIVE) {
     41     params->desktop_type = chrome::HOST_DESKTOP_TYPE_ASH;
     42     chrome::ActivateMetroChrome();
     43   }
     44 }
     45