Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: chrome/renderer/render_view.cc

Issue 6413014: Original patch from issue 570048 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: a few fixes Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/renderer/render_view.h" 5 #include "chrome/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 2506 matching lines...) Expand 10 before | Expand all | Expand 10 after
2517 checked_state = RENDER_VIEW_COMMAND_CHECKED_STATE_CHECKED; 2517 checked_state = RENDER_VIEW_COMMAND_CHECKED_STATE_CHECKED;
2518 } 2518 }
2519 2519
2520 Send(new ViewHostMsg_CommandStateChanged( 2520 Send(new ViewHostMsg_CommandStateChanged(
2521 routing_id_, 2521 routing_id_,
2522 RENDER_VIEW_COMMAND_TOGGLE_SPELL_CHECK, 2522 RENDER_VIEW_COMMAND_TOGGLE_SPELL_CHECK,
2523 is_enabled, 2523 is_enabled,
2524 checked_state)); 2524 checked_state));
2525 } 2525 }
2526 2526
2527 void RenderView::ReportZoomLevelChanged(int request_id) {
2528 bool remember = !webview()->mainFrame()->document().isPluginDocument();
2529
2530 // Tell the browser which url got zoomed so it can update the menu and the
2531 // saved values if necessary
2532 Send(new ViewHostMsg_DidZoomURL(
2533 routing_id_, request_id, webview()->zoomLevel(), remember,
2534 GURL(webview()->mainFrame()->url())));
2535 }
2536
2527 void RenderView::StartNavStateSyncTimerIfNecessary() { 2537 void RenderView::StartNavStateSyncTimerIfNecessary() {
2528 int delay; 2538 int delay;
2529 if (send_content_state_immediately_) 2539 if (send_content_state_immediately_)
2530 delay = 0; 2540 delay = 0;
2531 else if (is_hidden()) 2541 else if (is_hidden())
2532 delay = kDelaySecondsForContentStateSyncHidden; 2542 delay = kDelaySecondsForContentStateSyncHidden;
2533 else 2543 else
2534 delay = kDelaySecondsForContentStateSync; 2544 delay = kDelaySecondsForContentStateSync;
2535 2545
2536 if (nav_state_sync_timer_.IsRunning()) { 2546 if (nav_state_sync_timer_.IsRunning()) {
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
4385 } 4395 }
4386 4396
4387 void RenderView::OnFindReplyAck() { 4397 void RenderView::OnFindReplyAck() {
4388 // Check if there is any queued up request waiting to be sent. 4398 // Check if there is any queued up request waiting to be sent.
4389 if (queued_find_reply_message_.get()) { 4399 if (queued_find_reply_message_.get()) {
4390 // Send the search result over to the browser process. 4400 // Send the search result over to the browser process.
4391 Send(queued_find_reply_message_.release()); 4401 Send(queued_find_reply_message_.release());
4392 } 4402 }
4393 } 4403 }
4394 4404
4405 void RenderView::AddErrorToRootConsole(const string16& message) {
4406 if (webview() && webview()->mainFrame()) {
4407 webview()->mainFrame()->addMessageToConsole(
4408 WebConsoleMessage(WebConsoleMessage::LevelError, message));
4409 }
4410 }
4411
4395 bool RenderView::AllowContentType(ContentSettingsType settings_type) { 4412 bool RenderView::AllowContentType(ContentSettingsType settings_type) {
4396 // CONTENT_SETTING_ASK is only valid for cookies. 4413 // CONTENT_SETTING_ASK is only valid for cookies.
4397 return current_content_settings_.settings[settings_type] != 4414 return current_content_settings_.settings[settings_type] !=
4398 CONTENT_SETTING_BLOCK; 4415 CONTENT_SETTING_BLOCK;
4399 } 4416 }
4400 4417
4401 void RenderView::DidBlockContentType(ContentSettingsType settings_type, 4418 void RenderView::DidBlockContentType(ContentSettingsType settings_type,
4402 const std::string& resource_identifier) { 4419 const std::string& resource_identifier) {
4403 if (!content_blocked_[settings_type]) { 4420 if (!content_blocked_[settings_type]) {
4404 content_blocked_[settings_type] = true; 4421 content_blocked_[settings_type] = true;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
4476 } else { 4493 } else {
4477 // We're going towards 100%, so first go to the next whole number. 4494 // We're going towards 100%, so first go to the next whole number.
4478 zoom_level = static_cast<int>(old_zoom_level); 4495 zoom_level = static_cast<int>(old_zoom_level);
4479 } 4496 }
4480 } 4497 }
4481 4498
4482 webview()->setZoomLevel(false, zoom_level); 4499 webview()->setZoomLevel(false, zoom_level);
4483 zoomLevelChanged(); 4500 zoomLevelChanged();
4484 } 4501 }
4485 4502
4486 void RenderView::OnSetZoomLevel(double zoom_level) { 4503 void RenderView::OnSetZoomLevel(int request_id, double zoom_level) {
4487 // Don't set zoom level for full-page plugin since they don't use the same
4488 // zoom settings.
4489 if (webview()->mainFrame()->document().isPluginDocument())
4490 return;
4491
4492 webview()->hidePopups(); 4504 webview()->hidePopups();
4493 webview()->setZoomLevel(false, zoom_level); 4505 webview()->setZoomLevel(false, zoom_level);
4494 zoomLevelChanged(); 4506 ReportZoomLevelChanged(request_id);
4495 } 4507 }
4496 4508
4497 void RenderView::OnSetContentSettingsForLoadingURL( 4509 void RenderView::OnSetContentSettingsForLoadingURL(
4498 const GURL& url, 4510 const GURL& url,
4499 const ContentSettings& content_settings) { 4511 const ContentSettings& content_settings) {
4500 host_content_settings_[url] = content_settings; 4512 host_content_settings_[url] = content_settings;
4501 } 4513 }
4502 4514
4503 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, 4515 void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url,
4504 double zoom_level) { 4516 double zoom_level) {
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
5666 int minimum_percent = static_cast<int>( 5678 int minimum_percent = static_cast<int>(
5667 WebView::zoomLevelToZoomFactor(minimum_level) * 100); 5679 WebView::zoomLevelToZoomFactor(minimum_level) * 100);
5668 int maximum_percent = static_cast<int>( 5680 int maximum_percent = static_cast<int>(
5669 WebView::zoomLevelToZoomFactor(maximum_level) * 100); 5681 WebView::zoomLevelToZoomFactor(maximum_level) * 100);
5670 5682
5671 Send(new ViewHostMsg_UpdateZoomLimits( 5683 Send(new ViewHostMsg_UpdateZoomLimits(
5672 routing_id_, minimum_percent, maximum_percent, remember)); 5684 routing_id_, minimum_percent, maximum_percent, remember));
5673 } 5685 }
5674 5686
5675 void RenderView::zoomLevelChanged() { 5687 void RenderView::zoomLevelChanged() {
5676 bool remember = !webview()->mainFrame()->document().isPluginDocument(); 5688 // Currently only extension zoom requests have a request id
5677 5689 ReportZoomLevelChanged(-1);
5678 // Tell the browser which url got zoomed so it can update the menu and the
5679 // saved values if necessary
5680 Send(new ViewHostMsg_DidZoomURL(
5681 routing_id_, webview()->zoomLevel(), remember,
5682 GURL(webview()->mainFrame()->url())));
5683 } 5690 }
5684 5691
5685 bool RenderView::IsNonLocalTopLevelNavigation( 5692 bool RenderView::IsNonLocalTopLevelNavigation(
5686 const GURL& url, WebKit::WebFrame* frame, WebKit::WebNavigationType type) { 5693 const GURL& url, WebKit::WebFrame* frame, WebKit::WebNavigationType type) {
5687 // Must be a top level frame. 5694 // Must be a top level frame.
5688 if (frame->parent() != NULL) 5695 if (frame->parent() != NULL)
5689 return false; 5696 return false;
5690 5697
5691 // Navigations initiated within Webkit are not sent out to the external host 5698 // Navigations initiated within Webkit are not sent out to the external host
5692 // in the following cases. 5699 // in the following cases.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
5746 // If you hit this please file a bug against jcivelli and include the page 5753 // If you hit this please file a bug against jcivelli and include the page
5747 // and steps to repro. 5754 // and steps to repro.
5748 NOTREACHED(); 5755 NOTREACHED();
5749 return; 5756 return;
5750 } 5757 }
5751 external_popup_menu_->DidSelectItem(selected_index); 5758 external_popup_menu_->DidSelectItem(selected_index);
5752 external_popup_menu_.reset(); 5759 external_popup_menu_.reset();
5753 } 5760 }
5754 #endif 5761 #endif
5755 5762
5756 void RenderView::AddErrorToRootConsole(const string16& message) {
5757 if (webview() && webview()->mainFrame()) {
5758 webview()->mainFrame()->addMessageToConsole(
5759 WebConsoleMessage(WebConsoleMessage::LevelError, message));
5760 }
5761 }
5762
5763 #if defined(ENABLE_FLAPPER_HACKS) 5763 #if defined(ENABLE_FLAPPER_HACKS)
5764 void RenderView::OnConnectTcpACK( 5764 void RenderView::OnConnectTcpACK(
5765 int request_id, 5765 int request_id,
5766 IPC::PlatformFileForTransit socket_for_transit, 5766 IPC::PlatformFileForTransit socket_for_transit,
5767 const PP_Flash_NetAddress& local_addr, 5767 const PP_Flash_NetAddress& local_addr,
5768 const PP_Flash_NetAddress& remote_addr) { 5768 const PP_Flash_NetAddress& remote_addr) {
5769 pepper_delegate_.OnConnectTcpACK( 5769 pepper_delegate_.OnConnectTcpACK(
5770 request_id, 5770 request_id,
5771 IPC::PlatformFileForTransitToPlatformFile(socket_for_transit), 5771 IPC::PlatformFileForTransitToPlatformFile(socket_for_transit),
5772 local_addr, 5772 local_addr,
5773 remote_addr); 5773 remote_addr);
5774 } 5774 }
5775 #endif 5775 #endif
5776 5776
5777 void RenderView::OnJavaScriptStressTestControl(int cmd, int param) { 5777 void RenderView::OnJavaScriptStressTestControl(int cmd, int param) {
5778 if (cmd == kJavaScriptStressTestSetStressRunType) { 5778 if (cmd == kJavaScriptStressTestSetStressRunType) {
5779 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param)); 5779 v8::Testing::SetStressRunType(static_cast<v8::Testing::StressType>(param));
5780 } else if (cmd == kJavaScriptStressTestPrepareStressRun) { 5780 } else if (cmd == kJavaScriptStressTestPrepareStressRun) {
5781 v8::Testing::PrepareStressRun(param); 5781 v8::Testing::PrepareStressRun(param);
5782 } 5782 }
5783 } 5783 }
5784 5784
5785 void RenderView::OnContextMenuClosed( 5785 void RenderView::OnContextMenuClosed(
5786 const webkit_glue::CustomContextMenuContext& custom_context) { 5786 const webkit_glue::CustomContextMenuContext& custom_context) {
5787 if (custom_context.is_pepper_menu) 5787 if (custom_context.is_pepper_menu)
5788 pepper_delegate_.OnContextMenuClosed(custom_context); 5788 pepper_delegate_.OnContextMenuClosed(custom_context);
5789 else 5789 else
5790 context_menu_node_.reset(); 5790 context_menu_node_.reset();
5791 } 5791 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698