Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: chrome/browser/printing/print_dialog_cloud.cc

Issue 9706023: Force print dialog to the foreground. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unused variable issue. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/printing/print_dialog_cloud.h" 5 #include "chrome/browser/printing/print_dialog_cloud.h"
6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h"
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 20 matching lines...) Expand all
31 #include "content/public/browser/navigation_controller.h" 31 #include "content/public/browser/navigation_controller.h"
32 #include "content/public/browser/navigation_entry.h" 32 #include "content/public/browser/navigation_entry.h"
33 #include "content/public/browser/notification_registrar.h" 33 #include "content/public/browser/notification_registrar.h"
34 #include "content/public/browser/notification_source.h" 34 #include "content/public/browser/notification_source.h"
35 #include "content/public/browser/notification_types.h" 35 #include "content/public/browser/notification_types.h"
36 #include "content/public/browser/render_view_host.h" 36 #include "content/public/browser/render_view_host.h"
37 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
38 #include "content/public/browser/web_contents_view.h" 38 #include "content/public/browser/web_contents_view.h"
39 #include "content/public/browser/web_ui.h" 39 #include "content/public/browser/web_ui.h"
40 #include "ui/base/l10n/l10n_util.h" 40 #include "ui/base/l10n/l10n_util.h"
41
42 #if defined(OS_WIN)
43 #include "ui/base/win/foreground_helper.h"
44 #endif
45
41 #include "webkit/glue/webpreferences.h" 46 #include "webkit/glue/webpreferences.h"
42 47
43 #include "grit/generated_resources.h" 48 #include "grit/generated_resources.h"
44 49
45 #if defined(USE_AURA) 50 #if defined(USE_AURA)
46 #include "chrome/browser/ui/browser_window.h" 51 #include "chrome/browser/ui/browser_window.h"
47 #include "chrome/browser/ui/views/html_dialog_view.h" 52 #include "chrome/browser/ui/views/html_dialog_view.h"
53 #include "ui/aura/root_window.h"
48 #include "ui/views/widget/widget.h" 54 #include "ui/views/widget/widget.h"
49 #endif 55 #endif
50 56
51 // This module implements the UI support in Chrome for cloud printing. 57 // This module implements the UI support in Chrome for cloud printing.
52 // This means hosting a dialog containing HTML/JavaScript and using 58 // This means hosting a dialog containing HTML/JavaScript and using
53 // the published cloud print user interface integration APIs to get 59 // the published cloud print user interface integration APIs to get
54 // page setup settings from the dialog contents and provide the 60 // page setup settings from the dialog contents and provide the
55 // generated print data to the dialog contents for uploading to the 61 // generated print data to the dialog contents for uploading to the
56 // cloud print service. 62 // cloud print service.
57 63
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 int width = pref_service->GetInteger(prefs::kCloudPrintDialogWidth); 683 int width = pref_service->GetInteger(prefs::kCloudPrintDialogWidth);
678 int height = pref_service->GetInteger(prefs::kCloudPrintDialogHeight); 684 int height = pref_service->GetInteger(prefs::kCloudPrintDialogHeight);
679 685
680 HtmlDialogUIDelegate* dialog_delegate = 686 HtmlDialogUIDelegate* dialog_delegate =
681 new internal_cloud_print_helpers::CloudPrintHtmlDialogDelegate( 687 new internal_cloud_print_helpers::CloudPrintHtmlDialogDelegate(
682 path_to_file, width, height, std::string(), job_title, print_ticket, 688 path_to_file, width, height, std::string(), job_title, print_ticket,
683 file_type, modal, delete_on_close, close_after_signin, 689 file_type, modal, delete_on_close, close_after_signin,
684 callback); 690 callback);
685 if (modal) { 691 if (modal) {
686 DCHECK(browser); 692 DCHECK(browser);
693
687 #if defined(USE_AURA) 694 #if defined(USE_AURA)
688 HtmlDialogView* html_view = 695 HtmlDialogView* html_view =
689 new HtmlDialogView(profile, browser, dialog_delegate); 696 new HtmlDialogView(profile, browser, dialog_delegate);
690 views::Widget::CreateWindowWithParent(html_view, 697 views::Widget::CreateWindowWithParent(html_view,
691 browser->window()->GetNativeHandle()); 698 browser->window()->GetNativeHandle());
692 html_view->InitDialog(); 699 html_view->InitDialog();
693 html_view->GetWidget()->Show(); 700 views::Widget* widget = html_view->GetWidget();
701 DCHECK(widget);
702 widget->Show();
703 #if defined(OS_WIN)
704 gfx::NativeWindow window = widget->GetNativeWindow();
705 #endif
694 #else 706 #else
695 browser->BrowserShowHtmlDialog(dialog_delegate, NULL, STYLE_GENERIC); 707 #if defined(OS_WIN)
708 gfx::NativeWindow window =
709 #endif
710 browser->BrowserShowHtmlDialog(dialog_delegate, NULL,
711 STYLE_GENERIC);
Scott Byer 2012/03/14 17:43:57 nit:indent
712 #endif
713 #if defined(OS_WIN)
714 HWND dialog_handle;
715 #if defined(USE_AURA)
716 dialog_handle = window->GetRootWindow()->GetAcceleratedWidget();
717 #else
718 dialog_handle = window;
719 #endif
720 if (::GetForegroundWindow() != dialog_handle) {
721 ui::ForegroundHelper::SetForeground(dialog_handle);
722 }
696 #endif 723 #endif
697 } else { 724 } else {
698 browser::ShowHtmlDialog(NULL, 725 browser::ShowHtmlDialog(NULL,
699 profile, 726 profile,
700 browser, 727 browser,
701 dialog_delegate, 728 dialog_delegate,
702 STYLE_GENERIC); 729 STYLE_GENERIC);
703 } 730 }
704 } 731 }
705 732
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 file_type, 836 file_type,
810 false, 837 false,
811 delete_on_close); 838 delete_on_close);
812 return true; 839 return true;
813 } 840 }
814 } 841 }
815 return false; 842 return false;
816 } 843 }
817 844
818 } // end namespace 845 } // end namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698