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

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

Issue 6962051: Support PDF print preview in ChromeFrame by opening the preview in a new Chrome popup window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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/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/tabs/tab_strip_model.h" 8 #include "chrome/browser/tabs/tab_strip_model.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 PrintPreviewTabMap::iterator it = preview_tab_map_.find(preview_tab); 163 PrintPreviewTabMap::iterator it = preview_tab_map_.find(preview_tab);
164 if (it != preview_tab_map_.end()) 164 if (it != preview_tab_map_.end())
165 return preview_tab_map_[preview_tab]; 165 return preview_tab_map_[preview_tab];
166 return NULL; 166 return NULL;
167 } 167 }
168 168
169 TabContents* PrintPreviewTabController::CreatePrintPreviewTab( 169 TabContents* PrintPreviewTabController::CreatePrintPreviewTab(
170 TabContents* initiator_tab) { 170 TabContents* initiator_tab) {
171 Browser* current_browser = BrowserList::FindBrowserWithID( 171 Browser* current_browser = BrowserList::FindBrowserWithID(
172 initiator_tab->controller().window_id().id()); 172 initiator_tab->controller().window_id().id());
173 if (!current_browser) 173 if (!current_browser) {
174 return NULL; 174 if (initiator_tab->delegate()->IsExternalTabContainer()) {
175 current_browser = Browser::CreateForType(Browser::TYPE_POPUP,
176 initiator_tab->profile());
177 if (!current_browser) {
178 NOTREACHED() << "Failed to create popup browser window";
179 return NULL;
180 }
181 } else {
182 return NULL;
183 }
184 }
175 185
176 // Add a new tab next to initiator tab. 186 // Add a new tab next to initiator tab.
177 browser::NavigateParams params(current_browser, 187 browser::NavigateParams params(current_browser,
178 GURL(chrome::kChromeUIPrintURL), 188 GURL(chrome::kChromeUIPrintURL),
179 PageTransition::LINK); 189 PageTransition::LINK);
180 params.disposition = NEW_FOREGROUND_TAB; 190 params.disposition = NEW_FOREGROUND_TAB;
191 if (initiator_tab->delegate()->IsExternalTabContainer())
192 params.disposition = NEW_POPUP;
181 params.tabstrip_index = current_browser->tabstrip_model()-> 193 params.tabstrip_index = current_browser->tabstrip_model()->
182 GetWrapperIndex(initiator_tab) + 1; 194 GetWrapperIndex(initiator_tab) + 1;
183 browser::Navigate(&params); 195 browser::Navigate(&params);
184 TabContentsWrapper* preview_tab = params.target_contents; 196 TabContentsWrapper* preview_tab = params.target_contents;
185 preview_tab->tab_contents()->Activate(); 197 preview_tab->tab_contents()->Activate();
186 198
187 // Add an entry to the map. 199 // Add an entry to the map.
188 preview_tab_map_[preview_tab->tab_contents()] = initiator_tab; 200 preview_tab_map_[preview_tab->tab_contents()] = initiator_tab;
189 waiting_for_new_preview_page_ = true; 201 waiting_for_new_preview_page_ = true;
190 202
(...skipping 11 matching lines...) Expand all
202 } 214 }
203 215
204 void PrintPreviewTabController::RemoveObservers(TabContents* tab) { 216 void PrintPreviewTabController::RemoveObservers(TabContents* tab) {
205 registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, 217 registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED,
206 Source<TabContents>(tab)); 218 Source<TabContents>(tab));
207 registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, 219 registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED,
208 Source<NavigationController>(&tab->controller())); 220 Source<NavigationController>(&tab->controller()));
209 } 221 }
210 222
211 } // namespace printing 223 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698