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

Unified Diff: chrome/test/base/test_tab_strip_model_observer.cc

Issue 8136027: Print Preview: Make print preview tab modal. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: address comments Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/base/test_tab_strip_model_observer.cc
===================================================================
--- chrome/test/base/test_tab_strip_model_observer.cc (revision 105826)
+++ chrome/test/base/test_tab_strip_model_observer.cc (working copy)
@@ -4,6 +4,8 @@
#include "chrome/test/base/test_tab_strip_model_observer.h"
+#include "base/bind.h"
+#include "chrome/browser/printing/print_preview_tab_controller.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "content/common/notification_source.h"
@@ -21,7 +23,26 @@
tab_strip_model_->RemoveObserver(this);
}
-void TestTabStripModelObserver::TabInsertedAt(
- TabContentsWrapper* contents, int index, bool foreground) {
- RegisterAsObserver(Source<NavigationController>(&contents->controller()));
+void TestTabStripModelObserver::TabBlockedStateChanged(
+ TabContentsWrapper* contents, int index) {
+ // Need to do this later - the print preview tab has not been created yet.
+ MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&TestTabStripModelObserver::ObservePrintPreviewTabContents,
+ base::Unretained(this),
+ contents));
}
+
+void TestTabStripModelObserver::ObservePrintPreviewTabContents(
+ TabContentsWrapper* contents) {
+ printing::PrintPreviewTabController* tab_controller =
+ printing::PrintPreviewTabController::GetInstance();
+ if (tab_controller) {
+ TabContentsWrapper* preview_tab =
+ tab_controller->GetPrintPreviewForTab(contents);
+ if (preview_tab) {
+ RegisterAsObserver(
+ Source<NavigationController>(&preview_tab->controller()));
+ }
+ }
+}
« chrome/renderer/print_web_view_helper.cc ('K') | « chrome/test/base/test_tab_strip_model_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698