OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/apps/apps_metro_handler_win.h" | 5 #include "chrome/browser/ui/apps/apps_metro_handler_win.h" |
6 | 6 |
7 #include "apps/app_window.h" | |
8 #include "apps/app_window_registry.h" | |
9 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/ui/simple_message_box.h" | 8 #include "chrome/browser/ui/simple_message_box.h" |
11 #include "chrome/grit/chromium_strings.h" | 9 #include "chrome/grit/chromium_strings.h" |
12 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| 11 #include "extensions/browser/app_window/app_window.h" |
| 12 #include "extensions/browser/app_window/app_window_registry.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 | 14 |
15 bool VerifyASHSwitchForApps(gfx::NativeWindow parent_window, | 15 bool VerifyASHSwitchForApps(gfx::NativeWindow parent_window, |
16 int win_restart_command_id) { | 16 int win_restart_command_id) { |
17 DCHECK(win_restart_command_id == IDC_WIN_DESKTOP_RESTART || | 17 DCHECK(win_restart_command_id == IDC_WIN_DESKTOP_RESTART || |
18 win_restart_command_id == IDC_WIN8_METRO_RESTART || | 18 win_restart_command_id == IDC_WIN8_METRO_RESTART || |
19 win_restart_command_id == IDC_WIN_CHROMEOS_RESTART); | 19 win_restart_command_id == IDC_WIN_CHROMEOS_RESTART); |
20 if (!apps::AppWindowRegistry::IsAppWindowRegisteredInAnyProfile( | 20 if (!extensions::AppWindowRegistry::IsAppWindowRegisteredInAnyProfile( |
21 apps::AppWindow::WINDOW_TYPE_DEFAULT)) { | 21 extensions::AppWindow::WINDOW_TYPE_DEFAULT)) { |
22 return true; | 22 return true; |
23 } | 23 } |
24 | 24 |
25 int string_id = 0; | 25 int string_id = 0; |
26 switch (win_restart_command_id) { | 26 switch (win_restart_command_id) { |
27 case IDC_WIN8_METRO_RESTART: | 27 case IDC_WIN8_METRO_RESTART: |
28 string_id = IDS_WIN8_PROMPT_TO_CLOSE_APPS_FOR_METRO; | 28 string_id = IDS_WIN8_PROMPT_TO_CLOSE_APPS_FOR_METRO; |
29 break; | 29 break; |
30 case IDC_WIN_CHROMEOS_RESTART: | 30 case IDC_WIN_CHROMEOS_RESTART: |
31 string_id = IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_CHROMEOS; | 31 string_id = IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_CHROMEOS; |
32 break; | 32 break; |
33 default: | 33 default: |
34 string_id = IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_DESKTOP; | 34 string_id = IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_DESKTOP; |
35 break; | 35 break; |
36 } | 36 } |
37 chrome::MessageBoxResult result = chrome::ShowMessageBox( | 37 chrome::MessageBoxResult result = chrome::ShowMessageBox( |
38 parent_window, | 38 parent_window, |
39 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 39 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
40 l10n_util::GetStringUTF16(string_id), | 40 l10n_util::GetStringUTF16(string_id), |
41 chrome::MESSAGE_BOX_TYPE_OK_CANCEL); | 41 chrome::MESSAGE_BOX_TYPE_OK_CANCEL); |
42 | 42 |
43 return result == chrome::MESSAGE_BOX_RESULT_YES; | 43 return result == chrome::MESSAGE_BOX_RESULT_YES; |
44 } | 44 } |
OLD | NEW |