| 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/extensions/extension_message_handler.h" | 14 #include "chrome/browser/extensions/extension_message_handler.h" |
| 15 #include "chrome/browser/extensions/extension_tab_helper.h" | 15 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 16 #include "chrome/browser/favicon_tab_helper.h" |
| 16 #include "chrome/browser/file_select_helper.h" | 17 #include "chrome/browser/file_select_helper.h" |
| 17 #include "chrome/browser/history/top_sites.h" | 18 #include "chrome/browser/history/top_sites.h" |
| 18 #include "chrome/browser/password_manager/password_manager.h" | 19 #include "chrome/browser/password_manager/password_manager.h" |
| 19 #include "chrome/browser/password_manager_delegate_impl.h" | 20 #include "chrome/browser/password_manager_delegate_impl.h" |
| 20 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
| 21 #include "chrome/browser/prerender/prerender_observer.h" | 22 #include "chrome/browser/prerender/prerender_observer.h" |
| 22 #include "chrome/browser/printing/print_preview_message_handler.h" | 23 #include "chrome/browser/printing/print_preview_message_handler.h" |
| 23 #include "chrome/browser/printing/print_view_manager.h" | 24 #include "chrome/browser/printing/print_view_manager.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" | 26 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 49 tab_contents_(contents) { | 50 tab_contents_(contents) { |
| 50 DCHECK(contents); | 51 DCHECK(contents); |
| 51 // Stash this in the property bag so it can be retrieved without having to | 52 // Stash this in the property bag so it can be retrieved without having to |
| 52 // go to a Browser. | 53 // go to a Browser. |
| 53 property_accessor()->SetProperty(contents->property_bag(), this); | 54 property_accessor()->SetProperty(contents->property_bag(), this); |
| 54 | 55 |
| 55 // Create the tab helpers. | 56 // Create the tab helpers. |
| 56 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(contents)); | 57 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(contents)); |
| 57 autofill_manager_.reset(new AutofillManager(contents)); | 58 autofill_manager_.reset(new AutofillManager(contents)); |
| 58 extension_tab_helper_.reset(new ExtensionTabHelper(this)); | 59 extension_tab_helper_.reset(new ExtensionTabHelper(this)); |
| 60 favicon_tab_helper_.reset(new FaviconTabHelper(contents)); |
| 59 find_tab_helper_.reset(new FindTabHelper(contents)); | 61 find_tab_helper_.reset(new FindTabHelper(contents)); |
| 60 password_manager_delegate_.reset(new PasswordManagerDelegateImpl(contents)); | 62 password_manager_delegate_.reset(new PasswordManagerDelegateImpl(contents)); |
| 61 password_manager_.reset( | 63 password_manager_.reset( |
| 62 new PasswordManager(contents, password_manager_delegate_.get())); | 64 new PasswordManager(contents, password_manager_delegate_.get())); |
| 63 search_engine_tab_helper_.reset(new SearchEngineTabHelper(contents)); | 65 search_engine_tab_helper_.reset(new SearchEngineTabHelper(contents)); |
| 64 | 66 |
| 65 // Register for notifications about URL starredness changing on any profile. | 67 // Register for notifications about URL starredness changing on any profile. |
| 66 registrar_.Add(this, NotificationType::URLS_STARRED, | 68 registrar_.Add(this, NotificationType::URLS_STARRED, |
| 67 NotificationService::AllSources()); | 69 NotificationService::AllSources()); |
| 68 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, | 70 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 } | 291 } |
| 290 | 292 |
| 291 void TabContentsWrapper::UpdateStarredStateForCurrentURL() { | 293 void TabContentsWrapper::UpdateStarredStateForCurrentURL() { |
| 292 BookmarkModel* model = tab_contents()->profile()->GetBookmarkModel(); | 294 BookmarkModel* model = tab_contents()->profile()->GetBookmarkModel(); |
| 293 const bool old_state = is_starred_; | 295 const bool old_state = is_starred_; |
| 294 is_starred_ = (model && model->IsBookmarked(tab_contents()->GetURL())); | 296 is_starred_ = (model && model->IsBookmarked(tab_contents()->GetURL())); |
| 295 | 297 |
| 296 if (is_starred_ != old_state && delegate()) | 298 if (is_starred_ != old_state && delegate()) |
| 297 delegate()->URLStarredChanged(this, is_starred_); | 299 delegate()->URLStarredChanged(this, is_starred_); |
| 298 } | 300 } |
| OLD | NEW |