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

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

Issue 8983012: Get rid of content::NavigationController in cc file and use "using" instead. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 11 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) 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 <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 22 matching lines...) Expand all
33 #include "content/public/browser/web_contents.h" 33 #include "content/public/browser/web_contents.h"
34 #include "content/public/browser/navigation_controller.h" 34 #include "content/public/browser/navigation_controller.h"
35 #include "content/public/browser/navigation_details.h" 35 #include "content/public/browser/navigation_details.h"
36 #include "content/public/browser/navigation_entry.h" 36 #include "content/public/browser/navigation_entry.h"
37 #include "content/public/browser/notification_details.h" 37 #include "content/public/browser/notification_details.h"
38 #include "content/public/browser/notification_source.h" 38 #include "content/public/browser/notification_source.h"
39 #include "content/public/browser/notification_types.h" 39 #include "content/public/browser/notification_types.h"
40 #include "content/public/browser/render_process_host.h" 40 #include "content/public/browser/render_process_host.h"
41 #include "webkit/plugins/webplugininfo.h" 41 #include "webkit/plugins/webplugininfo.h"
42 42
43 using content::NavigationController;
43 using content::WebContents; 44 using content::WebContents;
44 using content::WebUIMessageHandler; 45 using content::WebUIMessageHandler;
45 46
46 namespace { 47 namespace {
47 48
48 void EnableInternalPDFPluginForTab(TabContentsWrapper* preview_tab) { 49 void EnableInternalPDFPluginForTab(TabContentsWrapper* preview_tab) {
49 // Always enable the internal PDF plugin for the print preview page. 50 // Always enable the internal PDF plugin for the print preview page.
50 ChromePluginServiceFilter::GetInstance()->OverridePluginForTab( 51 ChromePluginServiceFilter::GetInstance()->OverridePluginForTab(
51 preview_tab->web_contents()->GetRenderProcessHost()->GetID(), 52 preview_tab->web_contents()->GetRenderProcessHost()->GetID(),
52 preview_tab->web_contents()->GetRenderViewHost()->routing_id(), 53 preview_tab->web_contents()->GetRenderViewHost()->routing_id(),
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 break; 216 break;
216 } 217 }
217 case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: { 218 case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: {
218 WebContents* tab = content::Source<WebContents>(source).ptr(); 219 WebContents* tab = content::Source<WebContents>(source).ptr();
219 TabContentsWrapper* wrapper = 220 TabContentsWrapper* wrapper =
220 TabContentsWrapper::GetCurrentWrapperForContents(tab); 221 TabContentsWrapper::GetCurrentWrapperForContents(tab);
221 OnTabContentsDestroyed(wrapper); 222 OnTabContentsDestroyed(wrapper);
222 break; 223 break;
223 } 224 }
224 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { 225 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: {
225 content::NavigationController* controller = 226 NavigationController* controller =
226 content::Source<content::NavigationController>(source).ptr(); 227 content::Source<NavigationController>(source).ptr();
227 TabContentsWrapper* wrapper = 228 TabContentsWrapper* wrapper =
228 TabContentsWrapper::GetCurrentWrapperForContents( 229 TabContentsWrapper::GetCurrentWrapperForContents(
229 controller->GetWebContents()); 230 controller->GetWebContents());
230 content::LoadCommittedDetails* load_details = 231 content::LoadCommittedDetails* load_details =
231 content::Details<content::LoadCommittedDetails>(details).ptr(); 232 content::Details<content::LoadCommittedDetails>(details).ptr();
232 OnNavEntryCommitted(wrapper, load_details); 233 OnNavEntryCommitted(wrapper, load_details);
233 break; 234 break;
234 } 235 }
235 default: { 236 default: {
236 NOTREACHED(); 237 NOTREACHED();
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 initiator_tab->print_view_manager()->RenderSourceName()); 410 initiator_tab->print_view_manager()->RenderSourceName());
410 } 411 }
411 } 412 }
412 413
413 void PrintPreviewTabController::AddObservers(TabContentsWrapper* tab) { 414 void PrintPreviewTabController::AddObservers(TabContentsWrapper* tab) {
414 WebContents* contents = tab->web_contents(); 415 WebContents* contents = tab->web_contents();
415 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 416 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
416 content::Source<WebContents>(contents)); 417 content::Source<WebContents>(contents));
417 registrar_.Add( 418 registrar_.Add(
418 this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 419 this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
419 content::Source<content::NavigationController>( 420 content::Source<NavigationController>(&contents->GetController()));
420 &contents->GetController()));
421 421
422 // Multiple sites may share the same RenderProcessHost, so check if this 422 // Multiple sites may share the same RenderProcessHost, so check if this
423 // notification has already been added. 423 // notification has already been added.
424 content::RenderProcessHost* rph = tab->web_contents()->GetRenderProcessHost(); 424 content::RenderProcessHost* rph = tab->web_contents()->GetRenderProcessHost();
425 if (!registrar_.IsRegistered(this, 425 if (!registrar_.IsRegistered(this,
426 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 426 content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
427 content::Source<content::RenderProcessHost>( 427 content::Source<content::RenderProcessHost>(
428 rph))) { 428 rph))) {
429 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 429 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
430 content::Source<content::RenderProcessHost>(rph)); 430 content::Source<content::RenderProcessHost>(rph));
431 } 431 }
432 } 432 }
433 433
434 void PrintPreviewTabController::RemoveObservers(TabContentsWrapper* tab) { 434 void PrintPreviewTabController::RemoveObservers(TabContentsWrapper* tab) {
435 WebContents* contents = tab->web_contents(); 435 WebContents* contents = tab->web_contents();
436 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 436 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
437 content::Source<WebContents>(contents)); 437 content::Source<WebContents>(contents));
438 registrar_.Remove( 438 registrar_.Remove(
439 this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 439 this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
440 content::Source<content::NavigationController>( 440 content::Source<NavigationController>(&contents->GetController()));
441 &contents->GetController()));
442 441
443 // Multiple sites may share the same RenderProcessHost, so check if this 442 // Multiple sites may share the same RenderProcessHost, so check if this
444 // notification has already been added. 443 // notification has already been added.
445 content::RenderProcessHost* rph = tab->web_contents()->GetRenderProcessHost(); 444 content::RenderProcessHost* rph = tab->web_contents()->GetRenderProcessHost();
446 if (registrar_.IsRegistered(this, 445 if (registrar_.IsRegistered(this,
447 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 446 content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
448 content::Source<content::RenderProcessHost>( 447 content::Source<content::RenderProcessHost>(
449 rph))) { 448 rph))) {
450 registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 449 registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
451 content::Source<content::RenderProcessHost>(rph)); 450 content::Source<content::RenderProcessHost>(rph));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 PrintPreviewUI* print_preview_ui = 487 PrintPreviewUI* print_preview_ui =
489 static_cast<PrintPreviewUI*>(preview_tab->web_contents()->GetWebUI()); 488 static_cast<PrintPreviewUI*>(preview_tab->web_contents()->GetWebUI());
490 if (print_preview_ui) 489 if (print_preview_ui)
491 print_preview_ui->OnTabDestroyed(); 490 print_preview_ui->OnTabDestroyed();
492 491
493 preview_tab_map_.erase(preview_tab); 492 preview_tab_map_.erase(preview_tab);
494 RemoveObservers(preview_tab); 493 RemoveObservers(preview_tab);
495 } 494 }
496 495
497 } // namespace printing 496 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_preview_message_handler.cc ('k') | chrome/browser/repost_form_warning_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698