| OLD | NEW |
| 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/file_select_helper.h" | 14 #include "chrome/browser/file_select_helper.h" |
| 15 #include "chrome/browser/history/top_sites.h" | 15 #include "chrome/browser/history/top_sites.h" |
| 16 #include "chrome/browser/password_manager/password_manager.h" | 16 #include "chrome/browser/password_manager/password_manager.h" |
| 17 #include "chrome/browser/password_manager_delegate_impl.h" | 17 #include "chrome/browser/password_manager_delegate_impl.h" |
| 18 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
| 19 #include "chrome/browser/prerender/prerender_observer.h" | 19 #include "chrome/browser/prerender/prerender_observer.h" |
| 20 #include "chrome/browser/printing/print_preview_message_handler.h" | 20 #include "chrome/browser/printing/print_preview_message_handler.h" |
| 21 #include "chrome/browser/printing/print_view_manager.h" | |
| 22 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" | 22 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" |
| 24 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 23 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 25 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 24 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
| 26 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" | 25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" |
| 27 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/common/render_messages.h" | 27 #include "chrome/common/render_messages.h" |
| 29 #include "content/browser/tab_contents/tab_contents.h" | 28 #include "content/browser/tab_contents/tab_contents.h" |
| 30 #include "content/common/notification_service.h" | 29 #include "content/common/notification_service.h" |
| 31 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 62 | 61 |
| 63 // Register for notifications about URL starredness changing on any profile. | 62 // Register for notifications about URL starredness changing on any profile. |
| 64 registrar_.Add(this, NotificationType::URLS_STARRED, | 63 registrar_.Add(this, NotificationType::URLS_STARRED, |
| 65 NotificationService::AllSources()); | 64 NotificationService::AllSources()); |
| 66 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, | 65 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, |
| 67 NotificationService::AllSources()); | 66 NotificationService::AllSources()); |
| 68 | 67 |
| 69 // Create the per-tab observers. | 68 // Create the per-tab observers. |
| 70 file_select_observer_.reset(new FileSelectObserver(contents)); | 69 file_select_observer_.reset(new FileSelectObserver(contents)); |
| 71 prerender_observer_.reset(new prerender::PrerenderObserver(contents)); | 70 prerender_observer_.reset(new prerender::PrerenderObserver(contents)); |
| 72 printing_.reset(new printing::PrintViewManager(contents)); | 71 print_view_manager_.reset(new printing::PrintViewManager(contents)); |
| 73 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); | 72 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); |
| 74 } | 73 } |
| 75 | 74 |
| 76 TabContentsWrapper::~TabContentsWrapper() { | 75 TabContentsWrapper::~TabContentsWrapper() { |
| 77 // We don't want any notifications while we're running our destructor. | 76 // We don't want any notifications while we're running our destructor. |
| 78 registrar_.RemoveAll(); | 77 registrar_.RemoveAll(); |
| 79 } | 78 } |
| 80 | 79 |
| 81 PropertyAccessor<TabContentsWrapper*>* TabContentsWrapper::property_accessor() { | 80 PropertyAccessor<TabContentsWrapper*>* TabContentsWrapper::property_accessor() { |
| 82 return g_tab_contents_wrapper_property_accessor.Pointer(); | 81 return g_tab_contents_wrapper_property_accessor.Pointer(); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 280 } |
| 282 | 281 |
| 283 void TabContentsWrapper::UpdateStarredStateForCurrentURL() { | 282 void TabContentsWrapper::UpdateStarredStateForCurrentURL() { |
| 284 BookmarkModel* model = tab_contents()->profile()->GetBookmarkModel(); | 283 BookmarkModel* model = tab_contents()->profile()->GetBookmarkModel(); |
| 285 const bool old_state = is_starred_; | 284 const bool old_state = is_starred_; |
| 286 is_starred_ = (model && model->IsBookmarked(tab_contents()->GetURL())); | 285 is_starred_ = (model && model->IsBookmarked(tab_contents()->GetURL())); |
| 287 | 286 |
| 288 if (is_starred_ != old_state && delegate()) | 287 if (is_starred_ != old_state && delegate()) |
| 289 delegate()->URLStarredChanged(this, is_starred_); | 288 delegate()->URLStarredChanged(this, is_starred_); |
| 290 } | 289 } |
| OLD | NEW |