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

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

Issue 10407122: Get rid of the last RenderViewHostDelegate usage in chrome. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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
(...skipping 18 matching lines...) Expand all
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
31 #include "content/public/browser/navigation_controller.h" 31 #include "content/public/browser/navigation_controller.h"
32 #include "content/public/browser/navigation_details.h" 32 #include "content/public/browser/navigation_details.h"
33 #include "content/public/browser/navigation_entry.h" 33 #include "content/public/browser/navigation_entry.h"
34 #include "content/public/browser/notification_details.h" 34 #include "content/public/browser/notification_details.h"
35 #include "content/public/browser/notification_source.h" 35 #include "content/public/browser/notification_source.h"
36 #include "content/public/browser/notification_types.h" 36 #include "content/public/browser/notification_types.h"
37 #include "content/public/browser/render_process_host.h" 37 #include "content/public/browser/render_process_host.h"
38 #include "content/public/browser/render_view_host.h" 38 #include "content/public/browser/render_view_host.h"
39 #include "content/public/browser/render_view_host_delegate.h"
40 #include "content/public/browser/web_contents.h" 39 #include "content/public/browser/web_contents.h"
40 #include "content/public/browser/web_contents_delegate.h"
41 #include "webkit/plugins/webplugininfo.h" 41 #include "webkit/plugins/webplugininfo.h"
42 42
43 using content::NativeWebKeyboardEvent; 43 using content::NativeWebKeyboardEvent;
44 using content::NavigationController; 44 using content::NavigationController;
45 using content::WebContents; 45 using content::WebContents;
46 using content::WebUIMessageHandler; 46 using content::WebUIMessageHandler;
47 47
48 namespace { 48 namespace {
49 49
50 void EnableInternalPDFPluginForTab(TabContentsWrapper* preview_tab) { 50 void EnableInternalPDFPluginForTab(TabContentsWrapper* preview_tab) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 TabContentsWrapper* PrintPreviewTabController::GetOrCreatePreviewTab( 222 TabContentsWrapper* PrintPreviewTabController::GetOrCreatePreviewTab(
223 TabContentsWrapper* initiator_tab) { 223 TabContentsWrapper* initiator_tab) {
224 DCHECK(initiator_tab); 224 DCHECK(initiator_tab);
225 225
226 // Get the print preview tab for |initiator_tab|. 226 // Get the print preview tab for |initiator_tab|.
227 TabContentsWrapper* preview_tab = GetPrintPreviewForTab(initiator_tab); 227 TabContentsWrapper* preview_tab = GetPrintPreviewForTab(initiator_tab);
228 if (!preview_tab) 228 if (!preview_tab)
229 return CreatePrintPreviewTab(initiator_tab); 229 return CreatePrintPreviewTab(initiator_tab);
230 230
231 // Show the initiator tab holding the existing preview tab. 231 // Show the initiator tab holding the existing preview tab.
232 initiator_tab->web_contents()->GetRenderViewHost()->GetDelegate()->Activate(); 232 WebContents* web_contents = initiator_tab->web_contents();
233 web_contents->GetDelegate()->ActivateContents(web_contents);
233 return preview_tab; 234 return preview_tab;
234 } 235 }
235 236
236 TabContentsWrapper* PrintPreviewTabController::GetPrintPreviewForTab( 237 TabContentsWrapper* PrintPreviewTabController::GetPrintPreviewForTab(
237 TabContentsWrapper* tab) const { 238 TabContentsWrapper* tab) const {
238 // |preview_tab_map_| is keyed by the preview tab, so if find() succeeds, then 239 // |preview_tab_map_| is keyed by the preview tab, so if find() succeeds, then
239 // |tab| is the preview tab. 240 // |tab| is the preview tab.
240 PrintPreviewTabMap::const_iterator it = preview_tab_map_.find(tab); 241 PrintPreviewTabMap::const_iterator it = preview_tab_map_.find(tab);
241 if (it != preview_tab_map_.end()) 242 if (it != preview_tab_map_.end())
242 return tab; 243 return tab;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( 543 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
543 preview_tab->web_contents()->GetWebUI()->GetController()); 544 preview_tab->web_contents()->GetWebUI()->GetController());
544 if (print_preview_ui) 545 if (print_preview_ui)
545 print_preview_ui->OnTabDestroyed(); 546 print_preview_ui->OnTabDestroyed();
546 547
547 preview_tab_map_.erase(preview_tab); 548 preview_tab_map_.erase(preview_tab);
548 RemoveObservers(preview_tab); 549 RemoveObservers(preview_tab);
549 } 550 }
550 551
551 } // namespace printing 552 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/background_printing_manager.cc ('k') | chrome/browser/task_manager/task_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698