Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / printing / print_error_dialog.cc
blob43abe64cb2eb8e23afe862c394cdbf6f1ce75a4e
1 // Copyright (c) 2012 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/printing/print_error_dialog.h"
7 #include "chrome/browser/ui/browser_finder.h"
8 #include "chrome/browser/ui/browser_window.h"
9 #include "chrome/browser/ui/simple_message_box.h"
10 #include "chrome/grit/generated_resources.h"
11 #include "content/public/browser/browser_thread.h"
12 #include "ui/base/l10n/l10n_util.h"
14 namespace chrome {
16 namespace {
18 void ShowPrintErrorDialogTask() {
19 Browser* browser = chrome::FindLastActiveWithHostDesktopType(
20 chrome::GetActiveDesktop());
21 ShowMessageBox(browser ? browser->window()->GetNativeWindow() : NULL,
22 l10n_util::GetStringUTF16(IDS_PRINT_SPOOL_FAILED_TITLE_TEXT),
23 l10n_util::GetStringUTF16(IDS_PRINT_SPOOL_FAILED_ERROR_TEXT),
24 MESSAGE_BOX_TYPE_WARNING);
27 } // namespace
29 void ShowPrintErrorDialog() {
30 // Nested loop may destroy caller.
31 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
32 base::Bind(&ShowPrintErrorDialogTask));
35 } // namespace chrome