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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 302603012: Zoom Extension API (content changes) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove exceptions from IPC. Created 6 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 opened_by_user_gesture_(true), 640 opened_by_user_gesture_(true),
641 opener_suppressed_(false), 641 opener_suppressed_(false),
642 suppress_dialogs_until_swap_out_(false), 642 suppress_dialogs_until_swap_out_(false),
643 page_id_(-1), 643 page_id_(-1),
644 last_page_id_sent_to_browser_(-1), 644 last_page_id_sent_to_browser_(-1),
645 next_page_id_(params->next_page_id), 645 next_page_id_(params->next_page_id),
646 history_list_offset_(-1), 646 history_list_offset_(-1),
647 history_list_length_(0), 647 history_list_length_(0),
648 frames_in_progress_(0), 648 frames_in_progress_(0),
649 target_url_status_(TARGET_NONE), 649 target_url_status_(TARGET_NONE),
650 uses_temporary_zoom_level_(false),
650 #if defined(OS_ANDROID) 651 #if defined(OS_ANDROID)
651 top_controls_constraints_(cc::BOTH), 652 top_controls_constraints_(cc::BOTH),
652 #endif 653 #endif
653 cached_is_main_frame_pinned_to_left_(false), 654 cached_is_main_frame_pinned_to_left_(false),
654 cached_is_main_frame_pinned_to_right_(false), 655 cached_is_main_frame_pinned_to_right_(false),
655 has_scrolled_focused_editable_node_into_rect_(false), 656 has_scrolled_focused_editable_node_into_rect_(false),
656 push_messaging_dispatcher_(NULL), 657 push_messaging_dispatcher_(NULL),
657 speech_recognition_dispatcher_(NULL), 658 speech_recognition_dispatcher_(NULL),
658 media_stream_dispatcher_(NULL), 659 media_stream_dispatcher_(NULL),
659 browser_plugin_manager_(NULL), 660 browser_plugin_manager_(NULL),
660 midi_dispatcher_(NULL), 661 midi_dispatcher_(NULL),
661 devtools_agent_(NULL), 662 devtools_agent_(NULL),
662 accessibility_mode_(AccessibilityModeOff), 663 accessibility_mode_(AccessibilityModeOff),
663 renderer_accessibility_(NULL), 664 renderer_accessibility_(NULL),
664 mouse_lock_dispatcher_(NULL), 665 mouse_lock_dispatcher_(NULL),
665 #if defined(OS_ANDROID) 666 #if defined(OS_ANDROID)
666 expected_content_intent_id_(0), 667 expected_content_intent_id_(0),
667 #endif 668 #endif
668 #if defined(OS_WIN) 669 #if defined(OS_WIN)
669 focused_plugin_id_(-1), 670 focused_plugin_id_(-1),
670 #endif 671 #endif
671 #if defined(ENABLE_PLUGINS) 672 #if defined(ENABLE_PLUGINS)
672 plugin_find_handler_(NULL), 673 plugin_find_handler_(NULL),
673 focused_pepper_plugin_(NULL), 674 focused_pepper_plugin_(NULL),
674 pepper_last_mouse_event_target_(NULL), 675 pepper_last_mouse_event_target_(NULL),
675 #endif 676 #endif
676 enumeration_completion_id_(0), 677 enumeration_completion_id_(0),
677 session_storage_namespace_id_(params->session_storage_namespace_id), 678 session_storage_namespace_id_(params->session_storage_namespace_id),
678 next_snapshot_id_(0) { 679 next_snapshot_id_(0) {}
679 }
680 680
681 void RenderViewImpl::Initialize(RenderViewImplParams* params) { 681 void RenderViewImpl::Initialize(RenderViewImplParams* params) {
682 routing_id_ = params->routing_id; 682 routing_id_ = params->routing_id;
683 surface_id_ = params->surface_id; 683 surface_id_ = params->surface_id;
684 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) 684 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created)
685 opener_id_ = params->opener_id; 685 opener_id_ = params->opener_id;
686 686
687 // Ensure we start with a valid next_page_id_ from the browser. 687 // Ensure we start with a valid next_page_id_ from the browser.
688 DCHECK_GE(next_page_id_, 0); 688 DCHECK_GE(next_page_id_, 0);
689 689
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 OnSetEditCommandsForNextKeyEvent) 1072 OnSetEditCommandsForNextKeyEvent)
1073 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) 1073 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate)
1074 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) 1074 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop)
1075 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) 1075 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt)
1076 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) 1076 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt)
1077 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) 1077 IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
1078 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding) 1078 IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
1079 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) 1079 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
1080 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, 1080 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL,
1081 OnSetZoomLevelForLoadingURL) 1081 OnSetZoomLevelForLoadingURL)
1082 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView,
1083 OnSetZoomLevelForView)
1084 IPC_MESSAGE_HANDLER(ViewMsg_SetUsesTemporaryZoomLevel,
1085 OnSetUsesTemporaryZoomLevel)
1082 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) 1086 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
1083 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, 1087 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault,
1084 OnResetPageEncodingToDefault) 1088 OnResetPageEncodingToDefault)
1085 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent) 1089 IPC_MESSAGE_HANDLER(ViewMsg_PostMessageEvent, OnPostMessageEvent)
1086 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) 1090 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter)
1087 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) 1091 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver)
1088 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) 1092 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave)
1089 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) 1093 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop)
1090 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) 1094 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded)
1091 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, 1095 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded,
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 &ssl_status.security_bits, 1953 &ssl_status.security_bits,
1950 &ssl_status.connection_status, 1954 &ssl_status.connection_status,
1951 &ssl_status.signed_certificate_timestamp_ids); 1955 &ssl_status.signed_certificate_timestamp_ids);
1952 return ssl_status; 1956 return ssl_status;
1953 } 1957 }
1954 1958
1955 const std::string& RenderViewImpl::GetAcceptLanguages() const { 1959 const std::string& RenderViewImpl::GetAcceptLanguages() const {
1956 return renderer_preferences_.accept_languages; 1960 return renderer_preferences_.accept_languages;
1957 } 1961 }
1958 1962
1963 bool RenderViewImpl::UsesTemporaryZoomLevel() const {
Fady Samuel 2014/06/10 20:05:14 This doesn't need to be in the content API.
1964 return uses_temporary_zoom_level_;
1965 }
1966
1967 void RenderViewImpl::set_uses_temporary_zoom_level(
1968 bool uses_temporary_zoom_level) {
1969 uses_temporary_zoom_level_ = uses_temporary_zoom_level;
Fady Samuel 2014/06/10 20:05:14 Move this trivial accessor to the render_view_impl
wjmaclean 2014/06/10 20:18:55 Done.
wjmaclean 2014/06/12 17:40:09 Removed ... we're not using it at present anyways.
1970 }
1971
1959 void RenderViewImpl::didCreateDataSource(WebLocalFrame* frame, 1972 void RenderViewImpl::didCreateDataSource(WebLocalFrame* frame,
1960 WebDataSource* ds) { 1973 WebDataSource* ds) {
1961 bool content_initiated = !pending_navigation_params_.get(); 1974 bool content_initiated = !pending_navigation_params_.get();
1962 1975
1963 // Make sure any previous redirect URLs end up in our new data source. 1976 // Make sure any previous redirect URLs end up in our new data source.
1964 if (pending_navigation_params_.get()) { 1977 if (pending_navigation_params_.get()) {
1965 for (std::vector<GURL>::const_iterator i = 1978 for (std::vector<GURL>::const_iterator i =
1966 pending_navigation_params_->redirects.begin(); 1979 pending_navigation_params_->redirects.begin();
1967 i != pending_navigation_params_->redirects.end(); ++i) { 1980 i != pending_navigation_params_->redirects.end(); ++i) {
1968 ds->appendRedirect(*i); 1981 ds->appendRedirect(*i);
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
2651 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, 2664 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url,
2652 double zoom_level) { 2665 double zoom_level) {
2653 #if !defined(OS_ANDROID) 2666 #if !defined(OS_ANDROID)
2654 // On Android, page zoom isn't used, and in case of WebView, text zoom is used 2667 // On Android, page zoom isn't used, and in case of WebView, text zoom is used
2655 // for legacy WebView text scaling emulation. Thus, the code that resets 2668 // for legacy WebView text scaling emulation. Thus, the code that resets
2656 // the zoom level from this map will be effectively resetting text zoom level. 2669 // the zoom level from this map will be effectively resetting text zoom level.
2657 host_zoom_levels_[url] = zoom_level; 2670 host_zoom_levels_[url] = zoom_level;
2658 #endif 2671 #endif
2659 } 2672 }
2660 2673
2674 void RenderViewImpl::OnSetZoomLevelForView(double level) {
2675 webview()->hidePopups();
2676 webview()->setZoomLevel(level);
2677 }
2678
2679 void RenderViewImpl::OnSetUsesTemporaryZoomLevel(
2680 bool uses_temporary_zoom_level) {
2681 uses_temporary_zoom_level_ = uses_temporary_zoom_level;
Fady Samuel 2014/06/10 20:05:14 As I mentioned elsewhere, I think we should be mer
2682 }
2683
2661 void RenderViewImpl::OnSetPageEncoding(const std::string& encoding_name) { 2684 void RenderViewImpl::OnSetPageEncoding(const std::string& encoding_name) {
2662 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); 2685 webview()->setPageEncoding(WebString::fromUTF8(encoding_name));
2663 } 2686 }
2664 2687
2665 void RenderViewImpl::OnResetPageEncodingToDefault() { 2688 void RenderViewImpl::OnResetPageEncodingToDefault() {
2666 WebString no_encoding; 2689 WebString no_encoding;
2667 webview()->setPageEncoding(no_encoding); 2690 webview()->setPageEncoding(no_encoding);
2668 } 2691 }
2669 2692
2670 void RenderViewImpl::OnPostMessageEvent( 2693 void RenderViewImpl::OnPostMessageEvent(
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
4060 std::vector<gfx::Size> sizes; 4083 std::vector<gfx::Size> sizes;
4061 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4084 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4062 if (!url.isEmpty()) 4085 if (!url.isEmpty())
4063 urls.push_back( 4086 urls.push_back(
4064 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4087 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4065 } 4088 }
4066 SendUpdateFaviconURL(urls); 4089 SendUpdateFaviconURL(urls);
4067 } 4090 }
4068 4091
4069 } // namespace content 4092 } // namespace content
OLDNEW
« content/renderer/render_view_impl.h ('K') | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698