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/apps/chrome_apps_client.h"
7 #include "base/memory/singleton.h"
8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/ui/apps/app_metro_infobar_delegate_win.h"
11 #include "extensions/common/extension.h"
14 #include "win8/util/win8_util.h"
17 ChromeAppsClient::ChromeAppsClient() {}
19 ChromeAppsClient::~ChromeAppsClient() {}
22 ChromeAppsClient
* ChromeAppsClient::GetInstance() {
23 return Singleton
<ChromeAppsClient
,
24 LeakySingletonTraits
<ChromeAppsClient
> >::get();
27 std::vector
<content::BrowserContext
*>
28 ChromeAppsClient::GetLoadedBrowserContexts() {
29 std::vector
<Profile
*> profiles
=
30 g_browser_process
->profile_manager()->GetLoadedProfiles();
31 return std::vector
<content::BrowserContext
*>(profiles
.begin(),
35 bool ChromeAppsClient::CheckAppLaunch(content::BrowserContext
* context
,
36 const extensions::Extension
* extension
) {
38 // On Windows 8's single window Metro mode we can not launch platform apps.
39 // Offer to switch Chrome to desktop mode.
40 if (win8::IsSingleWindowMetroMode()) {
41 AppMetroInfoBarDelegateWin::Create(
42 Profile::FromBrowserContext(context
),
43 AppMetroInfoBarDelegateWin::LAUNCH_PACKAGED_APP
,