summaryrefslogtreecommitdiffstats
path: root/chrome/browser/printing/print_error_dialog.cc
blob: 43abe64cb2eb8e23afe862c394cdbf6f1ce75a4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/printing/print_error_dialog.h"

#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/simple_message_box.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/browser_thread.h"
#include "ui/base/l10n/l10n_util.h"

namespace chrome {

namespace {

void ShowPrintErrorDialogTask() {
  Browser* browser = chrome::FindLastActiveWithHostDesktopType(
      chrome::GetActiveDesktop());
  ShowMessageBox(browser ? browser->window()->GetNativeWindow() : NULL,
                 l10n_util::GetStringUTF16(IDS_PRINT_SPOOL_FAILED_TITLE_TEXT),
                 l10n_util::GetStringUTF16(IDS_PRINT_SPOOL_FAILED_ERROR_TEXT),
                 MESSAGE_BOX_TYPE_WARNING);
}

}  // namespace

void ShowPrintErrorDialog() {
  // Nested loop may destroy caller.
  content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
                                   base::Bind(&ShowPrintErrorDialogTask));
}

}  // namespace chrome