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

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

Issue 10837112: Add WebContents* to some more WebContentsDelegate methods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 4 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 | « chrome/browser/extensions/extension_host_mac.mm ('k') | chrome/browser/ui/browser.h » ('j') | 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) 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
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_host_mac.mm ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698