| 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "chrome/browser/load_notification_details.h" | 45 #include "chrome/browser/load_notification_details.h" |
| 46 #include "chrome/browser/metrics/metric_event_duration_details.h" | 46 #include "chrome/browser/metrics/metric_event_duration_details.h" |
| 47 #include "chrome/browser/metrics/user_metrics.h" | 47 #include "chrome/browser/metrics/user_metrics.h" |
| 48 #include "chrome/browser/modal_html_dialog_delegate.h" | 48 #include "chrome/browser/modal_html_dialog_delegate.h" |
| 49 #include "chrome/browser/omnibox_search_hint.h" | 49 #include "chrome/browser/omnibox_search_hint.h" |
| 50 #include "chrome/browser/pdf_unsupported_feature.h" | 50 #include "chrome/browser/pdf_unsupported_feature.h" |
| 51 #include "chrome/browser/platform_util.h" | 51 #include "chrome/browser/platform_util.h" |
| 52 #include "chrome/browser/plugin_installer_infobar_delegate.h" | 52 #include "chrome/browser/plugin_installer_infobar_delegate.h" |
| 53 #include "chrome/browser/prefs/pref_service.h" | 53 #include "chrome/browser/prefs/pref_service.h" |
| 54 #include "chrome/browser/prerender/prerender_manager.h" | 54 #include "chrome/browser/prerender/prerender_manager.h" |
| 55 #include "chrome/browser/prerender/prerender_plt_recorder.h" |
| 55 #include "chrome/browser/printing/print_preview_tab_controller.h" | 56 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 56 #include "chrome/browser/printing/print_view_manager.h" | 57 #include "chrome/browser/printing/print_view_manager.h" |
| 57 #include "chrome/browser/profiles/profile.h" | 58 #include "chrome/browser/profiles/profile.h" |
| 58 #include "chrome/browser/renderer_host/render_process_host.h" | 59 #include "chrome/browser/renderer_host/render_process_host.h" |
| 59 #include "chrome/browser/renderer_host/render_view_host.h" | 60 #include "chrome/browser/renderer_host/render_view_host.h" |
| 60 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 61 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 61 #include "chrome/browser/renderer_host/resource_request_details.h" | 62 #include "chrome/browser/renderer_host/resource_request_details.h" |
| 62 #include "chrome/browser/renderer_host/site_instance.h" | 63 #include "chrome/browser/renderer_host/site_instance.h" |
| 63 #include "chrome/browser/renderer_host/web_cache_manager.h" | 64 #include "chrome/browser/renderer_host/web_cache_manager.h" |
| 64 #include "chrome/browser/renderer_preferences_util.h" | 65 #include "chrome/browser/renderer_preferences_util.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 TabContentsView::Create(this))), | 361 TabContentsView::Create(this))), |
| 361 ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)), | 362 ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)), |
| 362 property_bag_(), | 363 property_bag_(), |
| 363 registrar_(), | 364 registrar_(), |
| 364 ALLOW_THIS_IN_INITIALIZER_LIST(printing_( | 365 ALLOW_THIS_IN_INITIALIZER_LIST(printing_( |
| 365 new printing::PrintViewManager(*this))), | 366 new printing::PrintViewManager(*this))), |
| 366 save_package_(), | 367 save_package_(), |
| 367 autocomplete_history_manager_(), | 368 autocomplete_history_manager_(), |
| 368 autofill_manager_(), | 369 autofill_manager_(), |
| 369 plugin_installer_(), | 370 plugin_installer_(), |
| 371 prerender_plt_recorder_(), |
| 370 bookmark_drag_(NULL), | 372 bookmark_drag_(NULL), |
| 371 ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_(this)), | 373 ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_(this)), |
| 372 is_loading_(false), | 374 is_loading_(false), |
| 373 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 375 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 374 crashed_error_code_(0), | 376 crashed_error_code_(0), |
| 375 waiting_for_response_(false), | 377 waiting_for_response_(false), |
| 376 max_page_id_(-1), | 378 max_page_id_(-1), |
| 377 current_load_start_(), | 379 current_load_start_(), |
| 378 load_state_(net::LOAD_STATE_IDLE), | 380 load_state_(net::LOAD_STATE_IDLE), |
| 379 load_state_host_(), | 381 load_state_host_(), |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 NotificationService::AllSources()); | 467 NotificationService::AllSources()); |
| 466 | 468 |
| 467 // Set-up the showing of the omnibox search infobar if applicable. | 469 // Set-up the showing of the omnibox search infobar if applicable. |
| 468 if (OmniboxSearchHint::IsEnabled(profile)) | 470 if (OmniboxSearchHint::IsEnabled(profile)) |
| 469 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); | 471 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); |
| 470 | 472 |
| 471 autofill_manager_.reset(new AutoFillManager(this)); | 473 autofill_manager_.reset(new AutoFillManager(this)); |
| 472 AddNavigationObserver(autofill_manager_.get()); | 474 AddNavigationObserver(autofill_manager_.get()); |
| 473 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this)); | 475 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this)); |
| 474 AddNavigationObserver(autocomplete_history_manager_.get()); | 476 AddNavigationObserver(autocomplete_history_manager_.get()); |
| 477 prerender_plt_recorder_.reset(new PrerenderPLTRecorder(this)); |
| 478 AddNavigationObserver(prerender_plt_recorder_.get()); |
| 475 AddNavigationObserver(&fav_icon_helper_); | 479 AddNavigationObserver(&fav_icon_helper_); |
| 476 AddNavigationObserver(printing_.get()); | 480 AddNavigationObserver(printing_.get()); |
| 477 } | 481 } |
| 478 | 482 |
| 479 TabContents::~TabContents() { | 483 TabContents::~TabContents() { |
| 480 is_being_destroyed_ = true; | 484 is_being_destroyed_ = true; |
| 481 | 485 |
| 482 // We don't want any notifications while we're running our destructor. | 486 // We don't want any notifications while we're running our destructor. |
| 483 registrar_.RemoveAll(); | 487 registrar_.RemoveAll(); |
| 484 pref_change_registrar_.RemoveAll(); | 488 pref_change_registrar_.RemoveAll(); |
| (...skipping 2901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3386 } | 3390 } |
| 3387 | 3391 |
| 3388 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 3392 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 3389 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 3393 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 3390 rwh_view->SetSize(view()->GetContainerSize()); | 3394 rwh_view->SetSize(view()->GetContainerSize()); |
| 3391 } | 3395 } |
| 3392 | 3396 |
| 3393 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { | 3397 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { |
| 3394 PrerenderManager* pm = profile()->GetPrerenderManager(); | 3398 PrerenderManager* pm = profile()->GetPrerenderManager(); |
| 3395 if (pm != NULL) { | 3399 if (pm != NULL) { |
| 3396 if (pm->MaybeUsePreloadedPage(this, url)) { | 3400 if (pm->MaybeUsePreloadedPage(this, url)) |
| 3397 // TODO(tburkard): If the preloaded page has not finished preloading | |
| 3398 // yet, we should not do this. | |
| 3399 DidStopLoading(); | |
| 3400 return true; | 3401 return true; |
| 3401 } | |
| 3402 } | 3402 } |
| 3403 return false; | 3403 return false; |
| 3404 } | 3404 } |
| OLD | NEW |