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

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

Issue 22900002: Cleanup: Do not check for NULL pointers returned by new in printing code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix build, remove cruft Created 7 years, 4 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 | chrome/renderer/mock_printer.cc » ('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_dialog_controller.h" 5 #include "chrome/browser/printing/print_preview_dialog_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"
13 #include "base/path_service.h" 12 #include "base/path_service.h"
14 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
16 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" 16 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
18 #include "chrome/browser/printing/print_view_manager.h" 17 #include "chrome/browser/printing/print_view_manager.h"
19 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_finder.h" 20 #include "chrome/browser/ui/browser_finder.h"
22 #include "chrome/browser/ui/browser_navigator.h" 21 #include "chrome/browser/ui/browser_navigator.h"
23 #include "chrome/browser/ui/browser_window.h" 22 #include "chrome/browser/ui/browser_window.h"
24 #include "chrome/browser/ui/host_desktop.h" 23 #include "chrome/browser/ui/host_desktop.h"
25 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" 24 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
26 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" 25 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
27 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" 26 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
28 #include "chrome/common/chrome_content_client.h" 27 #include "chrome/common/chrome_content_client.h"
29 #include "chrome/common/chrome_paths.h" 28 #include "chrome/common/chrome_paths.h"
30 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
32 #include "content/public/browser/navigation_controller.h" 30 #include "content/public/browser/navigation_controller.h"
33 #include "content/public/browser/navigation_details.h" 31 #include "content/public/browser/navigation_details.h"
34 #include "content/public/browser/navigation_entry.h" 32 #include "content/public/browser/navigation_entry.h"
35 #include "content/public/browser/notification_details.h" 33 #include "content/public/browser/notification_details.h"
36 #include "content/public/browser/notification_source.h" 34 #include "content/public/browser/notification_source.h"
37 #include "content/public/browser/plugin_service.h" 35 #include "content/public/browser/plugin_service.h"
38 #include "content/public/browser/render_process_host.h" 36 #include "content/public/browser/render_process_host.h"
39 #include "content/public/browser/render_view_host.h" 37 #include "content/public/browser/render_view_host.h"
40 #include "content/public/browser/web_contents.h" 38 #include "content/public/browser/web_contents.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 387 }
390 388
391 RemoveInitiator(contents); 389 RemoveInitiator(contents);
392 } 390 }
393 391
394 WebContents* PrintPreviewDialogController::CreatePrintPreviewDialog( 392 WebContents* PrintPreviewDialogController::CreatePrintPreviewDialog(
395 WebContents* initiator) { 393 WebContents* initiator) {
396 base::AutoReset<bool> auto_reset(&is_creating_print_preview_dialog_, true); 394 base::AutoReset<bool> auto_reset(&is_creating_print_preview_dialog_, true);
397 Profile* profile = 395 Profile* profile =
398 Profile::FromBrowserContext(initiator->GetBrowserContext()); 396 Profile::FromBrowserContext(initiator->GetBrowserContext());
399 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame)) {
400 // Chrome Frame only ever runs on the native desktop, so it is safe to
401 // create the popup on the native desktop.
402 Browser* current_browser = new Browser(
403 Browser::CreateParams(Browser::TYPE_POPUP, profile,
404 chrome::GetActiveDesktop()));
405 if (!current_browser) {
406 NOTREACHED() << "Failed to create popup browser window";
407 return NULL;
408 }
409 }
410 397
411 // |web_dialog_ui_delegate| deletes itself in 398 // |web_dialog_ui_delegate| deletes itself in
412 // PrintPreviewDialogDelegate::OnDialogClosed(). 399 // PrintPreviewDialogDelegate::OnDialogClosed().
413 WebDialogDelegate* web_dialog_delegate = 400 WebDialogDelegate* web_dialog_delegate =
414 new PrintPreviewDialogDelegate(initiator); 401 new PrintPreviewDialogDelegate(initiator);
415 // |web_dialog_delegate|'s owner is |constrained_delegate|. 402 // |web_dialog_delegate|'s owner is |constrained_delegate|.
416 PrintPreviewWebContentDelegate* pp_wcd = 403 PrintPreviewWebContentDelegate* pp_wcd =
417 new PrintPreviewWebContentDelegate(profile, initiator); 404 new PrintPreviewWebContentDelegate(profile, initiator);
418 ConstrainedWebDialogDelegate* constrained_delegate = 405 ConstrainedWebDialogDelegate* constrained_delegate =
419 CreateConstrainedWebDialog(profile, 406 CreateConstrainedWebDialog(profile,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 PrintPreviewUI* print_preview_ui = 499 PrintPreviewUI* print_preview_ui =
513 static_cast<PrintPreviewUI*>(preview_dialog->GetWebUI()->GetController()); 500 static_cast<PrintPreviewUI*>(preview_dialog->GetWebUI()->GetController());
514 if (print_preview_ui) 501 if (print_preview_ui)
515 print_preview_ui->OnPrintPreviewDialogDestroyed(); 502 print_preview_ui->OnPrintPreviewDialogDestroyed();
516 503
517 preview_dialog_map_.erase(preview_dialog); 504 preview_dialog_map_.erase(preview_dialog);
518 RemoveObservers(preview_dialog); 505 RemoveObservers(preview_dialog);
519 } 506 }
520 507
521 } // namespace printing 508 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/mock_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698