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

Side by Side Diff: chrome/test/base/test_tab_strip_model_observer.cc

Issue 8564044: Revert 110056 - Print Preview: Make print preview tab modal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | « chrome/test/base/test_tab_strip_model_observer.h ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/test/base/test_tab_strip_model_observer.h" 5 #include "chrome/test/base/test_tab_strip_model_observer.h"
6 6
7 #include "base/bind.h"
8 #include "chrome/browser/printing/print_preview_tab_controller.h"
9 #include "chrome/browser/tabs/tab_strip_model.h" 7 #include "chrome/browser/tabs/tab_strip_model.h"
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
11 #include "content/public/browser/notification_source.h" 9 #include "content/public/browser/notification_source.h"
12 10
13 TestTabStripModelObserver::TestTabStripModelObserver( 11 TestTabStripModelObserver::TestTabStripModelObserver(
14 TabStripModel* tab_strip_model, 12 TabStripModel* tab_strip_model,
15 TestTabStripModelObserver::JsInjectionReadyObserver* 13 TestTabStripModelObserver::JsInjectionReadyObserver*
16 js_injection_ready_observer) 14 js_injection_ready_observer)
17 : TestNavigationObserver(js_injection_ready_observer, 1), 15 : TestNavigationObserver(js_injection_ready_observer, 1),
18 tab_strip_model_(tab_strip_model) { 16 tab_strip_model_(tab_strip_model) {
19 tab_strip_model_->AddObserver(this); 17 tab_strip_model_->AddObserver(this);
20 } 18 }
21 19
22 TestTabStripModelObserver::~TestTabStripModelObserver() { 20 TestTabStripModelObserver::~TestTabStripModelObserver() {
23 tab_strip_model_->RemoveObserver(this); 21 tab_strip_model_->RemoveObserver(this);
24 } 22 }
25 23
26 void TestTabStripModelObserver::TabBlockedStateChanged( 24 void TestTabStripModelObserver::TabInsertedAt(
27 TabContentsWrapper* contents, int index) { 25 TabContentsWrapper* contents, int index, bool foreground) {
28 // Need to do this later - the print preview tab has not been created yet. 26 RegisterAsObserver(
29 MessageLoop::current()->PostTask( 27 content::Source<NavigationController>(&contents->controller()));
30 FROM_HERE,
31 base::Bind(&TestTabStripModelObserver::ObservePrintPreviewTabContents,
32 base::Unretained(this),
33 contents));
34 } 28 }
35
36 void TestTabStripModelObserver::ObservePrintPreviewTabContents(
37 TabContentsWrapper* contents) {
38 printing::PrintPreviewTabController* tab_controller =
39 printing::PrintPreviewTabController::GetInstance();
40 if (tab_controller) {
41 TabContentsWrapper* preview_tab =
42 tab_controller->GetPrintPreviewForTab(contents);
43 if (preview_tab) {
44 RegisterAsObserver(
45 content::Source<NavigationController>(&preview_tab->controller()));
46 }
47 }
48 }
OLDNEW
« no previous file with comments | « 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