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

Side by Side 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: rebase 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"
7 #include "chrome/browser/tabs/tab_strip_model.h" 9 #include "chrome/browser/tabs/tab_strip_model.h"
8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
9 #include "content/public/browser/notification_source.h" 11 #include "content/public/browser/notification_source.h"
10 12
11 TestTabStripModelObserver::TestTabStripModelObserver( 13 TestTabStripModelObserver::TestTabStripModelObserver(
12 TabStripModel* tab_strip_model, 14 TabStripModel* tab_strip_model,
13 TestTabStripModelObserver::JsInjectionReadyObserver* 15 TestTabStripModelObserver::JsInjectionReadyObserver*
14 js_injection_ready_observer) 16 js_injection_ready_observer)
15 : TestNavigationObserver(js_injection_ready_observer, 1), 17 : TestNavigationObserver(js_injection_ready_observer, 1),
16 tab_strip_model_(tab_strip_model) { 18 tab_strip_model_(tab_strip_model) {
17 tab_strip_model_->AddObserver(this); 19 tab_strip_model_->AddObserver(this);
18 } 20 }
19 21
20 TestTabStripModelObserver::~TestTabStripModelObserver() { 22 TestTabStripModelObserver::~TestTabStripModelObserver() {
21 tab_strip_model_->RemoveObserver(this); 23 tab_strip_model_->RemoveObserver(this);
22 } 24 }
23 25
24 void TestTabStripModelObserver::TabInsertedAt( 26 void TestTabStripModelObserver::TabBlockedStateChanged(
25 TabContentsWrapper* contents, int index, bool foreground) { 27 TabContentsWrapper* contents, int index) {
26 RegisterAsObserver( 28 // Need to do this later - the print preview tab has not been created yet.
27 content::Source<NavigationController>(&contents->controller())); 29 MessageLoop::current()->PostTask(
30 FROM_HERE,
31 base::Bind(&TestTabStripModelObserver::ObservePrintPreviewTabContents,
32 base::Unretained(this),
33 contents));
28 } 34 }
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