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

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

Issue 11358027: Move constrained web dialog code back to chrome/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cros fix2 Created 8 years, 1 month 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 | chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm » ('j') | 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_preview_tab_controller.h" 5 #include "chrome/browser/printing/print_preview_tab_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/auto_reset.h" 11 #include "base/auto_reset.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/chrome_plugin_service_filter.h" 16 #include "chrome/browser/chrome_plugin_service_filter.h"
17 #include "chrome/browser/printing/print_view_manager.h" 17 #include "chrome/browser/printing/print_view_manager.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/browser_finder.h" 20 #include "chrome/browser/ui/browser_finder.h"
21 #include "chrome/browser/ui/browser_navigator.h" 21 #include "chrome/browser/ui/browser_navigator.h"
22 #include "chrome/browser/ui/browser_window.h" 22 #include "chrome/browser/ui/browser_window.h"
23 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 23 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
24 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" 24 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
25 #include "chrome/browser/ui/tab_contents/tab_contents.h" 25 #include "chrome/browser/ui/tab_contents/tab_contents.h"
26 #include "chrome/browser/ui/tabs/tab_strip_model.h" 26 #include "chrome/browser/ui/tabs/tab_strip_model.h"
27 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" 27 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
28 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
28 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" 29 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
29 #include "chrome/common/chrome_content_client.h" 30 #include "chrome/common/chrome_content_client.h"
30 #include "chrome/common/chrome_notification_types.h" 31 #include "chrome/common/chrome_notification_types.h"
31 #include "chrome/common/chrome_paths.h" 32 #include "chrome/common/chrome_paths.h"
32 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/url_constants.h" 34 #include "chrome/common/url_constants.h"
34 #include "content/public/browser/navigation_controller.h" 35 #include "content/public/browser/navigation_controller.h"
35 #include "content/public/browser/navigation_details.h" 36 #include "content/public/browser/navigation_details.h"
36 #include "content/public/browser/navigation_entry.h" 37 #include "content/public/browser/navigation_entry.h"
37 #include "content/public/browser/notification_details.h" 38 #include "content/public/browser/notification_details.h"
38 #include "content/public/browser/notification_source.h" 39 #include "content/public/browser/notification_source.h"
39 #include "content/public/browser/render_process_host.h" 40 #include "content/public/browser/render_process_host.h"
40 #include "content/public/browser/render_view_host.h" 41 #include "content/public/browser/render_view_host.h"
41 #include "content/public/browser/web_contents.h" 42 #include "content/public/browser/web_contents.h"
42 #include "content/public/browser/web_contents_delegate.h" 43 #include "content/public/browser/web_contents_delegate.h"
43 #include "ui/web_dialogs/constrained_web_dialog_ui.h"
44 #include "ui/web_dialogs/web_dialog_delegate.h" 44 #include "ui/web_dialogs/web_dialog_delegate.h"
45 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h" 45 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h"
46 #include "webkit/plugins/webplugininfo.h" 46 #include "webkit/plugins/webplugininfo.h"
47 47
48 using content::NativeWebKeyboardEvent; 48 using content::NativeWebKeyboardEvent;
49 using content::NavigationController; 49 using content::NavigationController;
50 using content::WebContents; 50 using content::WebContents;
51 using content::WebUIMessageHandler; 51 using content::WebUIMessageHandler;
52 using ui::ConstrainedWebDialogDelegate;
53 using ui::WebDialogDelegate; 52 using ui::WebDialogDelegate;
54 using ui::WebDialogWebContentsDelegate; 53 using ui::WebDialogWebContentsDelegate;
55 54
56 namespace { 55 namespace {
57 56
58 void EnableInternalPDFPluginForTab(TabContents* preview_tab) { 57 void EnableInternalPDFPluginForTab(TabContents* preview_tab) {
59 // Always enable the internal PDF plugin for the print preview page. 58 // Always enable the internal PDF plugin for the print preview page.
60 webkit::WebPluginInfo pdf_plugin; 59 webkit::WebPluginInfo pdf_plugin;
61 PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_plugin.path); 60 PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_plugin.path);
62 61
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } 428 }
430 429
431 // |web_dialog_ui_delegate| deletes itself in 430 // |web_dialog_ui_delegate| deletes itself in
432 // PrintPreviewTabDelegate::OnDialogClosed(). 431 // PrintPreviewTabDelegate::OnDialogClosed().
433 WebDialogDelegate* web_dialog_delegate = 432 WebDialogDelegate* web_dialog_delegate =
434 new PrintPreviewTabDelegate(initiator_tab); 433 new PrintPreviewTabDelegate(initiator_tab);
435 // |web_tab_content_delegate|'s owner is |constrained_web_ui_delegate|. 434 // |web_tab_content_delegate|'s owner is |constrained_web_ui_delegate|.
436 PrintPreviewWebContentDelegate* pp_wcd = 435 PrintPreviewWebContentDelegate* pp_wcd =
437 new PrintPreviewWebContentDelegate(profile, initiator_tab); 436 new PrintPreviewWebContentDelegate(profile, initiator_tab);
438 ConstrainedWebDialogDelegate* constrained_delegate = 437 ConstrainedWebDialogDelegate* constrained_delegate =
439 ui::CreateConstrainedWebDialog( 438 CreateConstrainedWebDialog(profile,
440 profile, 439 web_dialog_delegate,
441 web_dialog_delegate, 440 pp_wcd,
442 pp_wcd, 441 initiator_tab->web_contents());
443 initiator_tab);
444 TabContents* preview_tab = constrained_delegate->tab(); 442 TabContents* preview_tab = constrained_delegate->tab();
445 EnableInternalPDFPluginForTab(preview_tab); 443 EnableInternalPDFPluginForTab(preview_tab);
446 CoreTabHelper::FromWebContents(preview_tab->web_contents())-> 444 CoreTabHelper::FromWebContents(preview_tab->web_contents())->
447 set_delegate(pp_wcd); 445 set_delegate(pp_wcd);
448 446
449 // Add an entry to the map. 447 // Add an entry to the map.
450 preview_tab_map_[preview_tab] = initiator_tab; 448 preview_tab_map_[preview_tab] = initiator_tab;
451 waiting_for_new_preview_page_ = true; 449 waiting_for_new_preview_page_ = true;
452 450
453 AddObservers(initiator_tab); 451 AddObservers(initiator_tab);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( 536 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
539 preview_tab->web_contents()->GetWebUI()->GetController()); 537 preview_tab->web_contents()->GetWebUI()->GetController());
540 if (print_preview_ui) 538 if (print_preview_ui)
541 print_preview_ui->OnTabDestroyed(); 539 print_preview_ui->OnTabDestroyed();
542 540
543 preview_tab_map_.erase(preview_tab); 541 preview_tab_map_.erase(preview_tab);
544 RemoveObservers(preview_tab); 542 RemoveObservers(preview_tab);
545 } 543 }
546 544
547 } // namespace printing 545 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698