| Index: chrome/test/base/test_tab_strip_model_observer.cc
|
| ===================================================================
|
| --- chrome/test/base/test_tab_strip_model_observer.cc (revision 110066)
|
| +++ 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/public/browser/notification_source.h"
|
| @@ -21,8 +23,26 @@
|
| tab_strip_model_->RemoveObserver(this);
|
| }
|
|
|
| -void TestTabStripModelObserver::TabInsertedAt(
|
| - TabContentsWrapper* contents, int index, bool foreground) {
|
| - RegisterAsObserver(
|
| - content::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(
|
| + content::Source<NavigationController>(&preview_tab->controller()));
|
| + }
|
| + }
|
| +}
|
|
|