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/apps/apps_metro_handler_win.h"
7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/apps/app_window_registry_util.h"
9 #include "chrome/browser/ui/simple_message_box.h"
10 #include "chrome/grit/chromium_strings.h"
11 #include "chrome/grit/generated_resources.h"
12 #include "extensions/browser/app_window/app_window.h"
13 #include "ui/base/l10n/l10n_util.h"
15 bool VerifyASHSwitchForApps(gfx::NativeWindow parent_window
,
16 int win_restart_command_id
) {
17 DCHECK(win_restart_command_id
== IDC_WIN_DESKTOP_RESTART
||
18 win_restart_command_id
== IDC_WIN8_METRO_RESTART
||
19 win_restart_command_id
== IDC_WIN_CHROMEOS_RESTART
);
20 if (!AppWindowRegistryUtil::IsAppWindowVisibleInAnyProfile(
21 extensions::AppWindow::WINDOW_TYPE_DEFAULT
)) {
26 switch (win_restart_command_id
) {
27 case IDC_WIN8_METRO_RESTART
:
28 string_id
= IDS_WIN8_PROMPT_TO_CLOSE_APPS_FOR_METRO
;
30 case IDC_WIN_CHROMEOS_RESTART
:
31 string_id
= IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_CHROMEOS
;
34 string_id
= IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_DESKTOP
;
37 chrome::MessageBoxResult result
= chrome::ShowMessageBox(
39 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME
),
40 l10n_util::GetStringUTF16(string_id
),
41 chrome::MESSAGE_BOX_TYPE_OK_CANCEL
);
43 return result
== chrome::MESSAGE_BOX_RESULT_YES
;