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/renderer/render_view.h" | 5 #include "content/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 // current content state during tab closing we use a shorter timeout for the | 255 // current content state during tab closing we use a shorter timeout for the |
256 // foreground renderer. This means there is a small window of time from which | 256 // foreground renderer. This means there is a small window of time from which |
257 // content state is modified and not sent to session restore, but this is | 257 // content state is modified and not sent to session restore, but this is |
258 // better than having to wake up all renderers during shutdown. | 258 // better than having to wake up all renderers during shutdown. |
259 static const int kDelaySecondsForContentStateSyncHidden = 5; | 259 static const int kDelaySecondsForContentStateSyncHidden = 5; |
260 static const int kDelaySecondsForContentStateSync = 1; | 260 static const int kDelaySecondsForContentStateSync = 1; |
261 | 261 |
262 // The maximum number of popups that can be spawned from one page. | 262 // The maximum number of popups that can be spawned from one page. |
263 static const int kMaximumNumberOfUnacknowledgedPopups = 25; | 263 static const int kMaximumNumberOfUnacknowledgedPopups = 25; |
264 | 264 |
265 // The default layout width and height for pages when fixed layout is enabled. | |
266 static const int kDefaultLayoutWidth = 980; | |
267 static const int kDefaultLayoutHeight = 640; | |
268 | |
265 static const float kScalingIncrement = 0.1f; | 269 static const float kScalingIncrement = 0.1f; |
266 | 270 |
271 static const char* kHTTPScheme = "http"; | |
jam
2011/08/29 19:14:46
this is already defined in content\common\url_cons
| |
272 | |
267 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { | 273 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { |
268 WebVector<WebURL> urls; | 274 WebVector<WebURL> urls; |
269 ds->redirectChain(urls); | 275 ds->redirectChain(urls); |
270 result->reserve(urls.size()); | 276 result->reserve(urls.size()); |
271 for (size_t i = 0; i < urls.size(); ++i) | 277 for (size_t i = 0; i < urls.size(); ++i) |
272 result->push_back(urls[i]); | 278 result->push_back(urls[i]); |
273 } | 279 } |
274 | 280 |
275 static bool WebAccessibilityNotificationToViewHostMsg( | 281 static bool WebAccessibilityNotificationToViewHostMsg( |
276 WebAccessibilityNotification notification, | 282 WebAccessibilityNotification notification, |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1221 // If we end up reusing this WebRequest (for example, due to a #ref click), | 1227 // If we end up reusing this WebRequest (for example, due to a #ref click), |
1222 // we don't want the transition type to persist. Just clear it. | 1228 // we don't want the transition type to persist. Just clear it. |
1223 navigation_state->set_transition_type(PageTransition::LINK); | 1229 navigation_state->set_transition_type(PageTransition::LINK); |
1224 | 1230 |
1225 // Check if the navigation was within the same page, in which case we don't | 1231 // Check if the navigation was within the same page, in which case we don't |
1226 // want to clear the accessibility cache. | 1232 // want to clear the accessibility cache. |
1227 if (accessibility_.get() && !navigation_state->was_within_same_page()) { | 1233 if (accessibility_.get() && !navigation_state->was_within_same_page()) { |
1228 accessibility_.reset(); | 1234 accessibility_.reset(); |
1229 pending_accessibility_notifications_.clear(); | 1235 pending_accessibility_notifications_.clear(); |
1230 } | 1236 } |
1237 #if defined(TOUCH_UI) | |
1238 // Only enable fixed layout for normal web content. | |
1239 GURL frame_url = GURL(request.url()); | |
1240 if (frame_url.SchemeIs(kHTTPScheme) || frame_url.SchemeIsSecure()) { | |
1241 webview()->enableFixedLayoutMode(true); | |
1242 webview()->setFixedLayoutSize( | |
1243 WebSize(kDefaultLayoutWidth, kDefaultLayoutHeight)); | |
1244 } | |
1245 #endif | |
1231 } | 1246 } |
1232 | 1247 |
1233 // Tell the embedding application that the title of the active page has changed | 1248 // Tell the embedding application that the title of the active page has changed |
1234 void RenderView::UpdateTitle(WebFrame* frame, | 1249 void RenderView::UpdateTitle(WebFrame* frame, |
1235 const string16& title, | 1250 const string16& title, |
1236 WebTextDirection title_direction) { | 1251 WebTextDirection title_direction) { |
1237 // Ignore all but top level navigations. | 1252 // Ignore all but top level navigations. |
1238 if (frame->parent()) | 1253 if (frame->parent()) |
1239 return; | 1254 return; |
1240 | 1255 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1433 | 1448 |
1434 WebExternalPopupMenu* RenderView::createExternalPopupMenu( | 1449 WebExternalPopupMenu* RenderView::createExternalPopupMenu( |
1435 const WebPopupMenuInfo& popup_menu_info, | 1450 const WebPopupMenuInfo& popup_menu_info, |
1436 WebExternalPopupMenuClient* popup_menu_client) { | 1451 WebExternalPopupMenuClient* popup_menu_client) { |
1437 DCHECK(!external_popup_menu_.get()); | 1452 DCHECK(!external_popup_menu_.get()); |
1438 external_popup_menu_.reset( | 1453 external_popup_menu_.reset( |
1439 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); | 1454 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); |
1440 return external_popup_menu_.get(); | 1455 return external_popup_menu_.get(); |
1441 } | 1456 } |
1442 | 1457 |
1458 #if defined(TOUCH_UI) | |
1459 WebRect RenderView::getDeviceRect() const { | |
1460 return WebRect(0, 0, size().width(), size().height()); | |
1461 } | |
1462 #endif | |
1463 | |
1443 RenderWidgetFullscreenPepper* RenderView::CreatePepperFullscreenContainer( | 1464 RenderWidgetFullscreenPepper* RenderView::CreatePepperFullscreenContainer( |
1444 webkit::ppapi::PluginInstance* plugin) { | 1465 webkit::ppapi::PluginInstance* plugin) { |
1445 GURL active_url; | 1466 GURL active_url; |
1446 if (webview() && webview()->mainFrame()) | 1467 if (webview() && webview()->mainFrame()) |
1447 active_url = GURL(webview()->mainFrame()->document().url()); | 1468 active_url = GURL(webview()->mainFrame()->document().url()); |
1448 RenderWidgetFullscreenPepper* widget = RenderWidgetFullscreenPepper::Create( | 1469 RenderWidgetFullscreenPepper* widget = RenderWidgetFullscreenPepper::Create( |
1449 routing_id_, render_thread_, plugin, active_url); | 1470 routing_id_, render_thread_, plugin, active_url); |
1450 widget->show(WebKit::WebNavigationPolicyIgnore); | 1471 widget->show(WebKit::WebNavigationPolicyIgnore); |
1451 return widget; | 1472 return widget; |
1452 } | 1473 } |
(...skipping 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4585 } | 4606 } |
4586 | 4607 |
4587 void RenderView::OnEnableViewSourceMode() { | 4608 void RenderView::OnEnableViewSourceMode() { |
4588 if (!webview()) | 4609 if (!webview()) |
4589 return; | 4610 return; |
4590 WebFrame* main_frame = webview()->mainFrame(); | 4611 WebFrame* main_frame = webview()->mainFrame(); |
4591 if (!main_frame) | 4612 if (!main_frame) |
4592 return; | 4613 return; |
4593 main_frame->enableViewSourceMode(true); | 4614 main_frame->enableViewSourceMode(true); |
4594 } | 4615 } |
OLD | NEW |