Home | History | Annotate | Download | only in apps
      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/apps/apps_metro_handler_win.h"
      6 
      7 #include "apps/app_window.h"
      8 #include "apps/app_window_registry.h"
      9 #include "chrome/app/chrome_command_ids.h"
     10 #include "chrome/browser/ui/simple_message_box.h"
     11 #include "grit/chromium_strings.h"
     12 #include "grit/generated_resources.h"
     13 #include "ui/base/l10n/l10n_util.h"
     14 
     15 bool VerifyMetroSwitchForApps(gfx::NativeWindow parent_window,
     16                               int win8_restart_command_id) {
     17   DCHECK(win8_restart_command_id == IDC_WIN8_DESKTOP_RESTART ||
     18       win8_restart_command_id == IDC_WIN8_METRO_RESTART);
     19   if (!apps::AppWindowRegistry::IsAppWindowRegisteredInAnyProfile(
     20            apps::AppWindow::WINDOW_TYPE_DEFAULT)) {
     21     return true;
     22   }
     23 
     24   int string_id = win8_restart_command_id == IDC_WIN8_METRO_RESTART ?
     25       IDS_WIN8_PROMPT_TO_CLOSE_APPS_FOR_METRO :
     26       IDS_WIN8_PROMPT_TO_CLOSE_APPS_FOR_DESKTOP;
     27   chrome::MessageBoxResult result = chrome::ShowMessageBox(
     28       parent_window,
     29       l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
     30       l10n_util::GetStringUTF16(string_id),
     31       chrome::MESSAGE_BOX_TYPE_OK_CANCEL);
     32 
     33   return result == chrome::MESSAGE_BOX_RESULT_YES;
     34 }
     35