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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/sessions/restore_tab_helper.h" 9 #include "chrome/browser/sessions/restore_tab_helper.h"
10 #include "chrome/browser/tabs/tab_strip_model.h" 10 #include "chrome/browser/tabs/tab_strip_model.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 for (it = preview_tab_map_.begin(); it != preview_tab_map_.end(); ++it) { 70 for (it = preview_tab_map_.begin(); it != preview_tab_map_.end(); ++it) {
71 // If |tab| is an initiator tab. 71 // If |tab| is an initiator tab.
72 if (tab == it->second) { 72 if (tab == it->second) {
73 // Return the associated preview tab. 73 // Return the associated preview tab.
74 return it->first; 74 return it->first;
75 } 75 }
76 } 76 }
77 return NULL; 77 return NULL;
78 } 78 }
79 79
80 void PrintPreviewTabController::Observe(NotificationType type, 80 void PrintPreviewTabController::Observe(int type,
81 const NotificationSource& source, 81 const NotificationSource& source,
82 const NotificationDetails& details) { 82 const NotificationDetails& details) {
83 TabContents* source_tab = NULL; 83 TabContents* source_tab = NULL;
84 content::LoadCommittedDetails* detail_info = NULL; 84 content::LoadCommittedDetails* detail_info = NULL;
85 85
86 switch (type.value) { 86 switch (type) {
87 case NotificationType::TAB_CONTENTS_DESTROYED: { 87 case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: {
88 source_tab = Source<TabContents>(source).ptr(); 88 source_tab = Source<TabContents>(source).ptr();
89 break; 89 break;
90 } 90 }
91 case NotificationType::NAV_ENTRY_COMMITTED: { 91 case content::NOTIFICATION_NAV_ENTRY_COMMITTED: {
92 NavigationController* controller = 92 NavigationController* controller =
93 Source<NavigationController>(source).ptr(); 93 Source<NavigationController>(source).ptr();
94 source_tab = controller->tab_contents(); 94 source_tab = controller->tab_contents();
95 detail_info = Details<content::LoadCommittedDetails>(details).ptr(); 95 detail_info = Details<content::LoadCommittedDetails>(details).ptr();
96 break; 96 break;
97 } 97 }
98 default: { 98 default: {
99 NOTREACHED(); 99 NOTREACHED();
100 break; 100 break;
101 } 101 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 preview_tab_map_[preview_tab->tab_contents()] = initiator_tab; 227 preview_tab_map_[preview_tab->tab_contents()] = initiator_tab;
228 waiting_for_new_preview_page_ = true; 228 waiting_for_new_preview_page_ = true;
229 229
230 AddObservers(initiator_tab); 230 AddObservers(initiator_tab);
231 AddObservers(preview_tab->tab_contents()); 231 AddObservers(preview_tab->tab_contents());
232 232
233 return preview_tab->tab_contents(); 233 return preview_tab->tab_contents();
234 } 234 }
235 235
236 void PrintPreviewTabController::AddObservers(TabContents* tab) { 236 void PrintPreviewTabController::AddObservers(TabContents* tab) {
237 registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, 237 registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED,
238 Source<TabContents>(tab)); 238 Source<TabContents>(tab));
239 registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, 239 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
240 Source<NavigationController>(&tab->controller())); 240 Source<NavigationController>(&tab->controller()));
241 } 241 }
242 242
243 void PrintPreviewTabController::RemoveObservers(TabContents* tab) { 243 void PrintPreviewTabController::RemoveObservers(TabContents* tab) {
244 registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, 244 registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED,
245 Source<TabContents>(tab)); 245 Source<TabContents>(tab));
246 registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, 246 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
247 Source<NavigationController>(&tab->controller())); 247 Source<NavigationController>(&tab->controller()));
248 } 248 }
249 249
250 } // namespace printing 250 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_preview_tab_controller.h ('k') | chrome/browser/printing/print_view_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698