| 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 "content/browser/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 static_cast<int>(WebKit::WebView::maxTextSizeMultiplier * 100)), | 203 static_cast<int>(WebKit::WebView::maxTextSizeMultiplier * 100)), |
| 204 temporary_zoom_settings_(false), | 204 temporary_zoom_settings_(false), |
| 205 content_restrictions_(0) { | 205 content_restrictions_(0) { |
| 206 | 206 |
| 207 render_manager_.Init(browser_context, site_instance, routing_id); | 207 render_manager_.Init(browser_context, site_instance, routing_id); |
| 208 | 208 |
| 209 // We have the initial size of the view be based on the size of the passed in | 209 // We have the initial size of the view be based on the size of the passed in |
| 210 // tab contents (normally a tab from the same window). | 210 // tab contents (normally a tab from the same window). |
| 211 view_->CreateView(base_tab_contents ? | 211 view_->CreateView(base_tab_contents ? |
| 212 base_tab_contents->view()->GetContainerSize() : gfx::Size()); | 212 base_tab_contents->view()->GetContainerSize() : gfx::Size()); |
| 213 |
| 214 #if defined(ENABLE_JAVA_BRIDGE) |
| 215 java_bridge_dispatcher_host_manager_.reset( |
| 216 new JavaBridgeDispatcherHostManager(this)); |
| 217 #endif |
| 213 } | 218 } |
| 214 | 219 |
| 215 TabContents::~TabContents() { | 220 TabContents::~TabContents() { |
| 216 is_being_destroyed_ = true; | 221 is_being_destroyed_ = true; |
| 217 | 222 |
| 218 // Clear out any JavaScript state. | 223 // Clear out any JavaScript state. |
| 219 if (dialog_creator_) | 224 if (dialog_creator_) |
| 220 dialog_creator_->ResetJavaScriptState(this); | 225 dialog_creator_->ResetJavaScriptState(this); |
| 221 | 226 |
| 222 NotifyDisconnected(); | 227 NotifyDisconnected(); |
| (...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 SetIsLoading(false, NULL); | 1469 SetIsLoading(false, NULL); |
| 1465 NotifyDisconnected(); | 1470 NotifyDisconnected(); |
| 1466 SetIsCrashed(status, error_code); | 1471 SetIsCrashed(status, error_code); |
| 1467 view()->OnTabCrashed(crashed_status(), crashed_error_code()); | 1472 view()->OnTabCrashed(crashed_status(), crashed_error_code()); |
| 1468 | 1473 |
| 1469 FOR_EACH_OBSERVER(TabContentsObserver, observers_, RenderViewGone()); | 1474 FOR_EACH_OBSERVER(TabContentsObserver, observers_, RenderViewGone()); |
| 1470 } | 1475 } |
| 1471 | 1476 |
| 1472 void TabContents::RenderViewDeleted(RenderViewHost* rvh) { | 1477 void TabContents::RenderViewDeleted(RenderViewHost* rvh) { |
| 1473 render_manager_.RenderViewDeleted(rvh); | 1478 render_manager_.RenderViewDeleted(rvh); |
| 1479 FOR_EACH_OBSERVER(TabContentsObserver, observers_, RenderViewDeleted(rvh)); |
| 1474 } | 1480 } |
| 1475 | 1481 |
| 1476 void TabContents::DidNavigate(RenderViewHost* rvh, | 1482 void TabContents::DidNavigate(RenderViewHost* rvh, |
| 1477 const ViewHostMsg_FrameNavigate_Params& params) { | 1483 const ViewHostMsg_FrameNavigate_Params& params) { |
| 1478 if (content::PageTransitionIsMainFrame(params.transition)) | 1484 if (content::PageTransitionIsMainFrame(params.transition)) |
| 1479 render_manager_.DidNavigateMainFrame(rvh); | 1485 render_manager_.DidNavigateMainFrame(rvh); |
| 1480 | 1486 |
| 1481 // Update the site of the SiteInstance if it doesn't have one yet. | 1487 // Update the site of the SiteInstance if it doesn't have one yet. |
| 1482 if (!GetSiteInstance()->has_site()) | 1488 if (!GetSiteInstance()->has_site()) |
| 1483 GetSiteInstance()->SetSite(params.url); | 1489 GetSiteInstance()->SetSite(params.url); |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2000 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 1995 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2001 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 1996 rwh_view->SetSize(view()->GetContainerSize()); | 2002 rwh_view->SetSize(view()->GetContainerSize()); |
| 1997 } | 2003 } |
| 1998 | 2004 |
| 1999 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { | 2005 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { |
| 2000 return render_view_host() ? | 2006 return render_view_host() ? |
| 2001 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; | 2007 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; |
| 2002 } | 2008 } |
| 2003 | 2009 |
| OLD | NEW |