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

Side by Side Diff: chrome/browser/printing/print_preview_tab_controller.cc

Issue 4694008: Make pink's TabContentsWrapper change compile on Windows.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/browser/printing/print_preview_tab_controller.h" 5 #include "chrome/browser/printing/print_preview_tab_controller.h"
6 6
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/tab_contents/tab_contents.h" 8 #include "chrome/browser/tab_contents/tab_contents.h"
9 #include "chrome/browser/tab_contents_wrapper.h"
9 #include "chrome/browser/tabs/tab_strip_model.h" 10 #include "chrome/browser/tabs/tab_strip_model.h"
10 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
12 #include "chrome/browser/ui/browser_navigator.h" 13 #include "chrome/browser/ui/browser_navigator.h"
13 #include "chrome/common/notification_service.h" 14 #include "chrome/common/notification_service.h"
14 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
15 16
16 namespace printing { 17 namespace printing {
17 18
18 // static 19 // static
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 91
91 TabContents* PrintPreviewTabController::CreatePrintPreviewTab( 92 TabContents* PrintPreviewTabController::CreatePrintPreviewTab(
92 TabContents* initiator_tab, int browser_window_id) { 93 TabContents* initiator_tab, int browser_window_id) {
93 Browser* current_browser = BrowserList::FindBrowserWithID(browser_window_id); 94 Browser* current_browser = BrowserList::FindBrowserWithID(browser_window_id);
94 // Add a new tab next to initiator tab. 95 // Add a new tab next to initiator tab.
95 browser::NavigateParams params(current_browser, 96 browser::NavigateParams params(current_browser,
96 GURL(chrome::kChromeUIPrintURL), 97 GURL(chrome::kChromeUIPrintURL),
97 PageTransition::LINK); 98 PageTransition::LINK);
98 params.disposition = NEW_FOREGROUND_TAB; 99 params.disposition = NEW_FOREGROUND_TAB;
99 params.tabstrip_index = current_browser->tabstrip_model()-> 100 params.tabstrip_index = current_browser->tabstrip_model()->
100 GetIndexOfTabContents(initiator_tab) + 1; 101 GetWrapperIndex(initiator_tab) + 1;
101 browser::Navigate(&params); 102 browser::Navigate(&params);
102 TabContents* preview_tab = params.target_contents; 103 TabContentsWrapper* preview_tab = params.target_contents;
103 preview_tab->Activate(); 104 preview_tab->tab_contents()->Activate();
104 105
105 // Add an entry to the map. 106 // Add an entry to the map.
106 preview_tab_map_[preview_tab] = initiator_tab; 107 preview_tab_map_[preview_tab->tab_contents()] = initiator_tab;
107 waiting_for_new_preview_page_ = true; 108 waiting_for_new_preview_page_ = true;
108 109
109 AddObservers(initiator_tab); 110 AddObservers(initiator_tab);
110 AddObservers(preview_tab); 111 AddObservers(preview_tab->tab_contents());
111 112
112 return preview_tab; 113 return preview_tab->tab_contents();
113 } 114 }
114 115
115 void PrintPreviewTabController::Observe(NotificationType type, 116 void PrintPreviewTabController::Observe(NotificationType type,
116 const NotificationSource& source, 117 const NotificationSource& source,
117 const NotificationDetails& details) { 118 const NotificationDetails& details) {
118 TabContents* initiator_tab = NULL; 119 TabContents* initiator_tab = NULL;
119 TabContents* preview_tab = NULL; 120 TabContents* preview_tab = NULL;
120 TabContents* source_tab = NULL; 121 TabContents* source_tab = NULL;
121 NavigationController::LoadCommittedDetails* detail_info = NULL; 122 NavigationController::LoadCommittedDetails* detail_info = NULL;
122 123
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if (source_tab == preview_tab) { 186 if (source_tab == preview_tab) {
186 preview_tab_map_.erase(preview_tab); 187 preview_tab_map_.erase(preview_tab);
187 RemoveObservers(preview_tab); 188 RemoveObservers(preview_tab);
188 } 189 }
189 190
190 if (initiator_tab) 191 if (initiator_tab)
191 RemoveObservers(initiator_tab); 192 RemoveObservers(initiator_tab);
192 } 193 }
193 194
194 } // namespace printing 195 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698