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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc

Issue 10911351: Switch PrintViewManager, PrintPreviewMessageHandler to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, fix typo Created 8 years, 3 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
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 "base/json/json_writer.h" 5 #include "base/json/json_writer.h"
6 #include "base/values.h" 6 #include "base/values.h"
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/printing/background_printing_manager.h" 9 #include "chrome/browser/printing/background_printing_manager.h"
10 #include "chrome/browser/printing/print_preview_tab_controller.h" 10 #include "chrome/browser/printing/print_preview_tab_controller.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 62
63 void OpenPrintPreviewTab() { 63 void OpenPrintPreviewTab() {
64 TabContents* initiator_tab = chrome::GetActiveTabContents(browser()); 64 TabContents* initiator_tab = chrome::GetActiveTabContents(browser());
65 ASSERT_TRUE(initiator_tab); 65 ASSERT_TRUE(initiator_tab);
66 66
67 printing::PrintPreviewTabController* controller = 67 printing::PrintPreviewTabController* controller =
68 printing::PrintPreviewTabController::GetInstance(); 68 printing::PrintPreviewTabController::GetInstance();
69 ASSERT_TRUE(controller); 69 ASSERT_TRUE(controller);
70 70
71 initiator_tab->print_view_manager()->PrintPreviewNow(); 71 printing::PrintViewManager* print_view_manager =
72 printing::PrintViewManager::FromWebContents(
73 initiator_tab->web_contents());
74 print_view_manager->PrintPreviewNow();
72 preview_tab_ = controller->GetOrCreatePreviewTab(initiator_tab); 75 preview_tab_ = controller->GetOrCreatePreviewTab(initiator_tab);
73 ASSERT_TRUE(preview_tab_); 76 ASSERT_TRUE(preview_tab_);
74 77
75 preview_ui_ = static_cast<PrintPreviewUI*>( 78 preview_ui_ = static_cast<PrintPreviewUI*>(
76 preview_tab_->web_contents()->GetWebUI()->GetController()); 79 preview_tab_->web_contents()->GetWebUI()->GetController());
77 ASSERT_TRUE(preview_ui_); 80 ASSERT_TRUE(preview_ui_);
78 } 81 }
79 82
80 void DeletePrintPreviewTab() { 83 void DeletePrintPreviewTab() {
81 printing::BackgroundPrintingManager* bg_printing_manager = 84 printing::BackgroundPrintingManager* bg_printing_manager =
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 args.Append(new base::StringValue(json_string)); // |args| takes ownership. 131 args.Append(new base::StringValue(json_string)); // |args| takes ownership.
129 preview_ui_->handler_->HandlePrint(&args); 132 preview_ui_->handler_->HandlePrint(&args);
130 } 133 }
131 134
132 PrintPreviewUI* preview_ui_; 135 PrintPreviewUI* preview_ui_;
133 136
134 private: 137 private:
135 138
136 TabContents* preview_tab_; 139 TabContents* preview_tab_;
137 }; 140 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698