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

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

Issue 10391158: Moves methods for finding browsers to browser_finder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include fixs Created 8 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/auto_reset.h" 11 #include "base/auto_reset.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chrome_plugin_service_filter.h" 15 #include "chrome/browser/chrome_plugin_service_filter.h"
16 #include "chrome/browser/printing/print_view_manager.h" 16 #include "chrome/browser/printing/print_view_manager.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_list.h" 19 #include "chrome/browser/ui/browser_finder.h"
20 #include "chrome/browser/ui/browser_navigator.h" 20 #include "chrome/browser/ui/browser_navigator.h"
21 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
23 #include "chrome/browser/ui/tabs/tab_strip_model.h" 23 #include "chrome/browser/ui/tabs/tab_strip_model.h"
24 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" 24 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
25 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" 25 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
26 #include "chrome/browser/ui/webui/web_dialog_delegate.h" 26 #include "chrome/browser/ui/webui/web_dialog_delegate.h"
27 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" 27 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h"
28 #include "chrome/common/chrome_content_client.h" 28 #include "chrome/common/chrome_content_client.h"
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 bool PrintPreviewWebContentDelegate::CanReloadContents( 176 bool PrintPreviewWebContentDelegate::CanReloadContents(
177 WebContents* source) const { 177 WebContents* source) const {
178 return false; 178 return false;
179 } 179 }
180 180
181 void PrintPreviewWebContentDelegate::HandleKeyboardEvent( 181 void PrintPreviewWebContentDelegate::HandleKeyboardEvent(
182 const NativeWebKeyboardEvent& event) { 182 const NativeWebKeyboardEvent& event) {
183 // Disabled on Mac due to http://crbug.com/112173. 183 // Disabled on Mac due to http://crbug.com/112173.
184 #if !defined(OS_MACOSX) 184 #if !defined(OS_MACOSX)
185 Browser* current_browser = 185 Browser* current_browser =
186 BrowserList::FindBrowserWithWebContents(tab_->web_contents()); 186 browser::FindBrowserWithWebContents(tab_->web_contents());
187 if (!current_browser) 187 if (!current_browser)
188 return; 188 return;
189 current_browser->window()->HandleKeyboardEvent(event); 189 current_browser->window()->HandleKeyboardEvent(event);
190 #endif 190 #endif
191 } 191 }
192 192
193 } // namespace 193 } // namespace
194 194
195 namespace printing { 195 namespace printing {
196 196
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 403
404 // Initiator tab navigated. 404 // Initiator tab navigated.
405 RemoveInitiatorTab(tab, true); 405 RemoveInitiatorTab(tab, true);
406 } 406 }
407 407
408 TabContentsWrapper* PrintPreviewTabController::CreatePrintPreviewTab( 408 TabContentsWrapper* PrintPreviewTabController::CreatePrintPreviewTab(
409 TabContentsWrapper* initiator_tab) { 409 TabContentsWrapper* initiator_tab) {
410 AutoReset<bool> auto_reset(&is_creating_print_preview_tab_, true); 410 AutoReset<bool> auto_reset(&is_creating_print_preview_tab_, true);
411 WebContents* web_contents = initiator_tab->web_contents(); 411 WebContents* web_contents = initiator_tab->web_contents();
412 Browser* current_browser = 412 Browser* current_browser =
413 BrowserList::FindBrowserWithWebContents(web_contents); 413 browser::FindBrowserWithWebContents(web_contents);
414 if (!current_browser) { 414 if (!current_browser) {
415 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame)) { 415 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame)) {
416 Profile* profile = 416 Profile* profile =
417 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 417 Profile::FromBrowserContext(web_contents->GetBrowserContext());
418 current_browser = Browser::CreateWithParams( 418 current_browser = Browser::CreateWithParams(
419 Browser::CreateParams(Browser::TYPE_POPUP, profile)); 419 Browser::CreateParams(Browser::TYPE_POPUP, profile));
420 if (!current_browser) { 420 if (!current_browser) {
421 NOTREACHED() << "Failed to create popup browser window"; 421 NOTREACHED() << "Failed to create popup browser window";
422 return NULL; 422 return NULL;
423 } 423 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( 541 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
542 preview_tab->web_contents()->GetWebUI()->GetController()); 542 preview_tab->web_contents()->GetWebUI()->GetController());
543 if (print_preview_ui) 543 if (print_preview_ui)
544 print_preview_ui->OnTabDestroyed(); 544 print_preview_ui->OnTabDestroyed();
545 545
546 preview_tab_map_.erase(preview_tab); 546 preview_tab_map_.erase(preview_tab);
547 RemoveObservers(preview_tab); 547 RemoveObservers(preview_tab);
548 } 548 }
549 549
550 } // namespace printing 550 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698