OLD | NEW |
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 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // WebContentsDelegate that forwards shortcut keys in the print preview | 155 // WebContentsDelegate that forwards shortcut keys in the print preview |
156 // renderer to the browser and makes sure users can't reload/save. | 156 // renderer to the browser and makes sure users can't reload/save. |
157 class PrintPreviewWebContentDelegate : public WebDialogWebContentsDelegate, | 157 class PrintPreviewWebContentDelegate : public WebDialogWebContentsDelegate, |
158 public CoreTabHelperDelegate { | 158 public CoreTabHelperDelegate { |
159 public: | 159 public: |
160 PrintPreviewWebContentDelegate(Profile* profile, TabContents* initiator_tab); | 160 PrintPreviewWebContentDelegate(Profile* profile, TabContents* initiator_tab); |
161 virtual ~PrintPreviewWebContentDelegate(); | 161 virtual ~PrintPreviewWebContentDelegate(); |
162 | 162 |
163 // Overridden from WebDialogWebContentsDelegate: | 163 // Overridden from WebDialogWebContentsDelegate: |
164 virtual void HandleKeyboardEvent( | 164 virtual void HandleKeyboardEvent( |
| 165 WebContents* source, |
165 const NativeWebKeyboardEvent& event) OVERRIDE; | 166 const NativeWebKeyboardEvent& event) OVERRIDE; |
166 | 167 |
167 // Overridden from CoreTabHelperDelegate: | 168 // Overridden from CoreTabHelperDelegate: |
168 virtual bool CanReloadContents(TabContents* source) const OVERRIDE; | 169 virtual bool CanReloadContents(TabContents* source) const OVERRIDE; |
169 virtual bool CanSaveContents(TabContents* source) const OVERRIDE; | 170 virtual bool CanSaveContents(TabContents* source) const OVERRIDE; |
170 | 171 |
171 private: | 172 private: |
172 TabContents* tab_; | 173 TabContents* tab_; |
173 | 174 |
174 DISALLOW_COPY_AND_ASSIGN(PrintPreviewWebContentDelegate); | 175 DISALLOW_COPY_AND_ASSIGN(PrintPreviewWebContentDelegate); |
(...skipping 11 matching lines...) Expand all Loading... |
186 TabContents* source) const { | 187 TabContents* source) const { |
187 return false; | 188 return false; |
188 } | 189 } |
189 | 190 |
190 bool PrintPreviewWebContentDelegate::CanSaveContents( | 191 bool PrintPreviewWebContentDelegate::CanSaveContents( |
191 TabContents* source) const { | 192 TabContents* source) const { |
192 return false; | 193 return false; |
193 } | 194 } |
194 | 195 |
195 void PrintPreviewWebContentDelegate::HandleKeyboardEvent( | 196 void PrintPreviewWebContentDelegate::HandleKeyboardEvent( |
| 197 WebContents* source, |
196 const NativeWebKeyboardEvent& event) { | 198 const NativeWebKeyboardEvent& event) { |
197 // Disabled on Mac due to http://crbug.com/112173 | 199 // Disabled on Mac due to http://crbug.com/112173 |
198 #if !defined(OS_MACOSX) | 200 #if !defined(OS_MACOSX) |
199 Browser* current_browser = | 201 Browser* current_browser = |
200 browser::FindBrowserWithWebContents(tab_->web_contents()); | 202 browser::FindBrowserWithWebContents(tab_->web_contents()); |
201 if (!current_browser) | 203 if (!current_browser) |
202 return; | 204 return; |
203 current_browser->window()->HandleKeyboardEvent(event); | 205 current_browser->window()->HandleKeyboardEvent(event); |
204 #endif | 206 #endif |
205 } | 207 } |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( | 546 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( |
545 preview_tab->web_contents()->GetWebUI()->GetController()); | 547 preview_tab->web_contents()->GetWebUI()->GetController()); |
546 if (print_preview_ui) | 548 if (print_preview_ui) |
547 print_preview_ui->OnTabDestroyed(); | 549 print_preview_ui->OnTabDestroyed(); |
548 | 550 |
549 preview_tab_map_.erase(preview_tab); | 551 preview_tab_map_.erase(preview_tab); |
550 RemoveObservers(preview_tab); | 552 RemoveObservers(preview_tab); |
551 } | 553 } |
552 | 554 |
553 } // namespace printing | 555 } // namespace printing |
OLD | NEW |