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 static const int kDefaultLayoutWidth = 980; | |
jam
2011/08/26 20:55:59
nit: comment?
Fady Samuel
2011/08/29 18:27:36
Done.
| |
266 static const int kDefaultLayoutHeight = 640; | |
265 static const float kScalingIncrement = 0.1f; | 267 static const float kScalingIncrement = 0.1f; |
266 | 268 |
267 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { | 269 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { |
268 WebVector<WebURL> urls; | 270 WebVector<WebURL> urls; |
269 ds->redirectChain(urls); | 271 ds->redirectChain(urls); |
270 result->reserve(urls.size()); | 272 result->reserve(urls.size()); |
271 for (size_t i = 0; i < urls.size(); ++i) | 273 for (size_t i = 0; i < urls.size(); ++i) |
272 result->push_back(urls[i]); | 274 result->push_back(urls[i]); |
273 } | 275 } |
274 | 276 |
(...skipping 946 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), | 1223 // 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. | 1224 // we don't want the transition type to persist. Just clear it. |
1223 navigation_state->set_transition_type(PageTransition::LINK); | 1225 navigation_state->set_transition_type(PageTransition::LINK); |
1224 | 1226 |
1225 // Check if the navigation was within the same page, in which case we don't | 1227 // Check if the navigation was within the same page, in which case we don't |
1226 // want to clear the accessibility cache. | 1228 // want to clear the accessibility cache. |
1227 if (accessibility_.get() && !navigation_state->was_within_same_page()) { | 1229 if (accessibility_.get() && !navigation_state->was_within_same_page()) { |
1228 accessibility_.reset(); | 1230 accessibility_.reset(); |
1229 pending_accessibility_notifications_.clear(); | 1231 pending_accessibility_notifications_.clear(); |
1230 } | 1232 } |
1233 #if defined(TOUCH_UI) | |
1234 // Only enable fixed layout for web pages and not extensions | |
1235 // and WebUI, by default. | |
1236 GURL frame_url = GURL(request.url()); | |
1237 if (!frame_url.SchemeIs(chrome::kChromeUIScheme) && | |
jam
2011/08/26 20:55:59
we really shouldn't be referring to chrome webui s
Fady Samuel
2011/08/29 18:27:36
Done.
| |
1238 !frame_url.SchemeIs(chrome::kExtensionScheme)) { | |
1239 webview()->enableFixedLayoutMode(true); | |
jam
2011/08/26 20:55:59
nit: spacing is off
Fady Samuel
2011/08/29 18:27:36
Done.
| |
1240 webview()->setFixedLayoutSize( | |
1241 WebSize(kDefaultLayoutWidth, kDefaultLayoutHeight)); | |
1242 } | |
1243 #endif | |
1231 } | 1244 } |
1232 | 1245 |
1233 // Tell the embedding application that the title of the active page has changed | 1246 // Tell the embedding application that the title of the active page has changed |
1234 void RenderView::UpdateTitle(WebFrame* frame, | 1247 void RenderView::UpdateTitle(WebFrame* frame, |
1235 const string16& title, | 1248 const string16& title, |
1236 WebTextDirection title_direction) { | 1249 WebTextDirection title_direction) { |
1237 // Ignore all but top level navigations. | 1250 // Ignore all but top level navigations. |
1238 if (frame->parent()) | 1251 if (frame->parent()) |
1239 return; | 1252 return; |
1240 | 1253 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1433 | 1446 |
1434 WebExternalPopupMenu* RenderView::createExternalPopupMenu( | 1447 WebExternalPopupMenu* RenderView::createExternalPopupMenu( |
1435 const WebPopupMenuInfo& popup_menu_info, | 1448 const WebPopupMenuInfo& popup_menu_info, |
1436 WebExternalPopupMenuClient* popup_menu_client) { | 1449 WebExternalPopupMenuClient* popup_menu_client) { |
1437 DCHECK(!external_popup_menu_.get()); | 1450 DCHECK(!external_popup_menu_.get()); |
1438 external_popup_menu_.reset( | 1451 external_popup_menu_.reset( |
1439 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); | 1452 new ExternalPopupMenu(this, popup_menu_info, popup_menu_client)); |
1440 return external_popup_menu_.get(); | 1453 return external_popup_menu_.get(); |
1441 } | 1454 } |
1442 | 1455 |
1456 #if defined(TOUCH_UI) | |
1457 WebRect RenderView::getDeviceRect() const { | |
1458 return WebRect(0, 0, size().width(), size().height()); | |
1459 } | |
1460 #endif | |
1461 | |
1443 RenderWidgetFullscreenPepper* RenderView::CreatePepperFullscreenContainer( | 1462 RenderWidgetFullscreenPepper* RenderView::CreatePepperFullscreenContainer( |
1444 webkit::ppapi::PluginInstance* plugin) { | 1463 webkit::ppapi::PluginInstance* plugin) { |
1445 GURL active_url; | 1464 GURL active_url; |
1446 if (webview() && webview()->mainFrame()) | 1465 if (webview() && webview()->mainFrame()) |
1447 active_url = GURL(webview()->mainFrame()->document().url()); | 1466 active_url = GURL(webview()->mainFrame()->document().url()); |
1448 RenderWidgetFullscreenPepper* widget = RenderWidgetFullscreenPepper::Create( | 1467 RenderWidgetFullscreenPepper* widget = RenderWidgetFullscreenPepper::Create( |
1449 routing_id_, render_thread_, plugin, active_url); | 1468 routing_id_, render_thread_, plugin, active_url); |
1450 widget->show(WebKit::WebNavigationPolicyIgnore); | 1469 widget->show(WebKit::WebNavigationPolicyIgnore); |
1451 return widget; | 1470 return widget; |
1452 } | 1471 } |
(...skipping 3130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4583 | 4602 |
4584 void RenderView::OnEnableViewSourceMode() { | 4603 void RenderView::OnEnableViewSourceMode() { |
4585 if (!webview()) | 4604 if (!webview()) |
4586 return; | 4605 return; |
4587 WebFrame* main_frame = webview()->mainFrame(); | 4606 WebFrame* main_frame = webview()->mainFrame(); |
4588 if (!main_frame) | 4607 if (!main_frame) |
4589 return; | 4608 return; |
4590 main_frame->enableViewSourceMode(true); | 4609 main_frame->enableViewSourceMode(true); |
4591 } | 4610 } |
4592 | 4611 |
OLD | NEW |