15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/printing/print_error_dialog.h" 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/ui/browser_finder.h" 8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/ui/browser_window.h" 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/simple_message_box.h" 1003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)#include "chrome/grit/generated_resources.h" 11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "content/public/browser/browser_thread.h" 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/base/l10n/l10n_util.h" 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace chrome { 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace { 17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void ShowPrintErrorDialogTask() { 19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) Browser* browser = chrome::FindLastActiveWithHostDesktopType( 20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) chrome::GetActiveDesktop()); 21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) ShowMessageBox(browser ? browser->window()->GetNativeWindow() : NULL, 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) l10n_util::GetStringUTF16(IDS_PRINT_SPOOL_FAILED_TITLE_TEXT), 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) l10n_util::GetStringUTF16(IDS_PRINT_SPOOL_FAILED_ERROR_TEXT), 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) MESSAGE_BOX_TYPE_WARNING); 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} // namespace 28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void ShowPrintErrorDialog() { 30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Nested loop may destroy caller. 31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) base::Bind(&ShowPrintErrorDialogTask)); 33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace chrome 36