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

Side by Side Diff: chrome/browser/ui/tab_contents/tab_contents_wrapper.cc

Issue 6783005: Print Preview: Set a print job's title and url correctly. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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/ui/tab_contents/tab_contents_wrapper.h" 5 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "chrome/browser/autocomplete_history_manager.h" 8 #include "chrome/browser/autocomplete_history_manager.h"
9 #include "chrome/browser/autofill/autofill_manager.h" 9 #include "chrome/browser/autofill/autofill_manager.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 10 #include "chrome/browser/bookmarks/bookmark_model.h"
11 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 11 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
12 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h" 12 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h"
13 #include "chrome/browser/debugger/devtools_handler.h" 13 #include "chrome/browser/debugger/devtools_handler.h"
14 #include "chrome/browser/extensions/extension_tab_helper.h" 14 #include "chrome/browser/extensions/extension_tab_helper.h"
15 #include "chrome/browser/file_select_helper.h" 15 #include "chrome/browser/file_select_helper.h"
16 #include "chrome/browser/history/top_sites.h" 16 #include "chrome/browser/history/top_sites.h"
17 #include "chrome/browser/password_manager/password_manager.h" 17 #include "chrome/browser/password_manager/password_manager.h"
18 #include "chrome/browser/password_manager_delegate_impl.h" 18 #include "chrome/browser/password_manager_delegate_impl.h"
19 #include "chrome/browser/prefs/pref_service.h" 19 #include "chrome/browser/prefs/pref_service.h"
20 #include "chrome/browser/prerender/prerender_observer.h" 20 #include "chrome/browser/prerender/prerender_observer.h"
21 #include "chrome/browser/printing/print_preview_message_handler.h" 21 #include "chrome/browser/printing/print_preview_message_handler.h"
22 #include "chrome/browser/printing/print_view_manager.h"
23 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" 23 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
25 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 24 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
26 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" 25 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" 26 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h"
28 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
29 #include "chrome/common/render_messages.h" 28 #include "chrome/common/render_messages.h"
30 #include "content/browser/tab_contents/tab_contents.h" 29 #include "content/browser/tab_contents/tab_contents.h"
31 #include "content/common/notification_service.h" 30 #include "content/common/notification_service.h"
32 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // Register for notifications about URL starredness changing on any profile. 63 // Register for notifications about URL starredness changing on any profile.
65 registrar_.Add(this, NotificationType::URLS_STARRED, 64 registrar_.Add(this, NotificationType::URLS_STARRED,
66 NotificationService::AllSources()); 65 NotificationService::AllSources());
67 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, 66 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED,
68 NotificationService::AllSources()); 67 NotificationService::AllSources());
69 68
70 // Create the per-tab observers. 69 // Create the per-tab observers.
71 dev_tools_observer_.reset(new DevToolsObserver(contents)); 70 dev_tools_observer_.reset(new DevToolsObserver(contents));
72 file_select_observer_.reset(new FileSelectObserver(contents)); 71 file_select_observer_.reset(new FileSelectObserver(contents));
73 prerender_observer_.reset(new prerender::PrerenderObserver(contents)); 72 prerender_observer_.reset(new prerender::PrerenderObserver(contents));
74 printing_.reset(new printing::PrintViewManager(contents)); 73 print_view_manager_.reset(new printing::PrintViewManager(contents));
Avi (use Gerrit) 2011/04/06 11:21:32 Is this a per-tab observer or a Tab Helper? If it
Lei Zhang 2011/04/07 00:53:20 It's a tab helper then.
75 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); 74 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents));
76 } 75 }
77 76
78 TabContentsWrapper::~TabContentsWrapper() { 77 TabContentsWrapper::~TabContentsWrapper() {
79 // We don't want any notifications while we're running our destructor. 78 // We don't want any notifications while we're running our destructor.
80 registrar_.RemoveAll(); 79 registrar_.RemoveAll();
81 } 80 }
82 81
83 PropertyAccessor<TabContentsWrapper*>* TabContentsWrapper::property_accessor() { 82 PropertyAccessor<TabContentsWrapper*>* TabContentsWrapper::property_accessor() {
84 return g_tab_contents_wrapper_property_accessor.Pointer(); 83 return g_tab_contents_wrapper_property_accessor.Pointer();
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 286 }
288 287
289 void TabContentsWrapper::UpdateStarredStateForCurrentURL() { 288 void TabContentsWrapper::UpdateStarredStateForCurrentURL() {
290 BookmarkModel* model = tab_contents()->profile()->GetBookmarkModel(); 289 BookmarkModel* model = tab_contents()->profile()->GetBookmarkModel();
291 const bool old_state = is_starred_; 290 const bool old_state = is_starred_;
292 is_starred_ = (model && model->IsBookmarked(tab_contents()->GetURL())); 291 is_starred_ = (model && model->IsBookmarked(tab_contents()->GetURL()));
293 292
294 if (is_starred_ != old_state && delegate()) 293 if (is_starred_ != old_state && delegate())
295 delegate()->URLStarredChanged(this, is_starred_); 294 delegate()->URLStarredChanged(this, is_starred_);
296 } 295 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698