| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), | 195 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), |
| 196 #endif | 196 #endif |
| 197 is_showing_before_unload_dialog_(false), | 197 is_showing_before_unload_dialog_(false), |
| 198 opener_web_ui_type_(WebUI::kNoWebUI), | 198 opener_web_ui_type_(WebUI::kNoWebUI), |
| 199 closed_by_user_gesture_(false), | 199 closed_by_user_gesture_(false), |
| 200 minimum_zoom_percent_( | 200 minimum_zoom_percent_( |
| 201 static_cast<int>(WebKit::WebView::minTextSizeMultiplier * 100)), | 201 static_cast<int>(WebKit::WebView::minTextSizeMultiplier * 100)), |
| 202 maximum_zoom_percent_( | 202 maximum_zoom_percent_( |
| 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 view_type_(content::VIEW_TYPE_TAB_CONTENTS) { |
| 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 | 213 |
| 214 #if defined(ENABLE_JAVA_BRIDGE) | 214 #if defined(ENABLE_JAVA_BRIDGE) |
| 215 java_bridge_dispatcher_host_manager_.reset( | 215 java_bridge_dispatcher_host_manager_.reset( |
| 216 new JavaBridgeDispatcherHostManager(this)); | 216 new JavaBridgeDispatcherHostManager(this)); |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 content::RendererPreferences TabContents::GetRendererPrefs( | 1401 content::RendererPreferences TabContents::GetRendererPrefs( |
| 1402 content::BrowserContext* browser_context) const { | 1402 content::BrowserContext* browser_context) const { |
| 1403 return renderer_preferences_; | 1403 return renderer_preferences_; |
| 1404 } | 1404 } |
| 1405 | 1405 |
| 1406 TabContents* TabContents::GetAsTabContents() { | 1406 TabContents* TabContents::GetAsTabContents() { |
| 1407 return this; | 1407 return this; |
| 1408 } | 1408 } |
| 1409 | 1409 |
| 1410 content::ViewType TabContents::GetRenderViewType() const { | 1410 content::ViewType TabContents::GetRenderViewType() const { |
| 1411 return content::VIEW_TYPE_TAB_CONTENTS; | 1411 return view_type_; |
| 1412 } | 1412 } |
| 1413 | 1413 |
| 1414 void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { | 1414 void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { |
| 1415 content::NotificationService::current()->Notify( | 1415 content::NotificationService::current()->Notify( |
| 1416 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, | 1416 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, |
| 1417 content::Source<TabContents>(this), | 1417 content::Source<TabContents>(this), |
| 1418 content::Details<RenderViewHost>(render_view_host)); | 1418 content::Details<RenderViewHost>(render_view_host)); |
| 1419 NavigationEntry* entry = controller_.GetActiveEntry(); | 1419 NavigationEntry* entry = controller_.GetActiveEntry(); |
| 1420 if (!entry) | 1420 if (!entry) |
| 1421 return; | 1421 return; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 | 1672 |
| 1673 // Update the URL display. | 1673 // Update the URL display. |
| 1674 NotifyNavigationStateChanged(TabContents::INVALIDATE_URL); | 1674 NotifyNavigationStateChanged(TabContents::INVALIDATE_URL); |
| 1675 } | 1675 } |
| 1676 | 1676 |
| 1677 void TabContents::DidChangeLoadProgress(double progress) { | 1677 void TabContents::DidChangeLoadProgress(double progress) { |
| 1678 if (delegate()) | 1678 if (delegate()) |
| 1679 delegate()->LoadProgressChanged(progress); | 1679 delegate()->LoadProgressChanged(progress); |
| 1680 } | 1680 } |
| 1681 | 1681 |
| 1682 void TabContents::DocumentAvailableInMainFrame( |
| 1683 RenderViewHost* render_view_host) { |
| 1684 FOR_EACH_OBSERVER(TabContentsObserver, observers_, |
| 1685 DocumentAvailableInMainFrame()); |
| 1686 } |
| 1687 |
| 1682 void TabContents::DocumentOnLoadCompletedInMainFrame( | 1688 void TabContents::DocumentOnLoadCompletedInMainFrame( |
| 1683 RenderViewHost* render_view_host, | 1689 RenderViewHost* render_view_host, |
| 1684 int32 page_id) { | 1690 int32 page_id) { |
| 1685 content::NotificationService::current()->Notify( | 1691 content::NotificationService::current()->Notify( |
| 1686 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 1692 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 1687 content::Source<TabContents>(this), | 1693 content::Source<TabContents>(this), |
| 1688 content::Details<int>(&page_id)); | 1694 content::Details<int>(&page_id)); |
| 1689 } | 1695 } |
| 1690 | 1696 |
| 1691 void TabContents::RequestOpenURL(const GURL& url, | 1697 void TabContents::RequestOpenURL(const GURL& url, |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1997 | 2003 |
| 1998 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2004 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 1999 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2005 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 2000 rwh_view->SetSize(view()->GetContainerSize()); | 2006 rwh_view->SetSize(view()->GetContainerSize()); |
| 2001 } | 2007 } |
| 2002 | 2008 |
| 2003 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { | 2009 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { |
| 2004 return render_view_host() ? | 2010 return render_view_host() ? |
| 2005 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; | 2011 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; |
| 2006 } | 2012 } |
| OLD | NEW |