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

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

Issue 8413051: Move PageZoom enum into content/public/common and into the content namespace. Also move content_c... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/json/json_value_serializer.h" 15 #include "base/json/json_value_serializer.h"
16 #include "base/json/json_writer.h" 16 #include "base/json/json_writer.h"
17 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/path_service.h" 19 #include "base/path_service.h"
20 #include "base/process_util.h" 20 #include "base/process_util.h"
21 #include "base/string_piece.h" 21 #include "base/string_piece.h"
22 #include "base/string_split.h" 22 #include "base/string_split.h"
23 #include "base/string_util.h" 23 #include "base/string_util.h"
24 #include "base/sys_string_conversions.h" 24 #include "base/sys_string_conversions.h"
25 #include "base/time.h" 25 #include "base/time.h"
26 #include "base/utf_string_conversions.h" 26 #include "base/utf_string_conversions.h"
27 #include "content/common/appcache/appcache_dispatcher.h" 27 #include "content/common/appcache/appcache_dispatcher.h"
28 #include "content/common/clipboard_messages.h" 28 #include "content/common/clipboard_messages.h"
29 #include "content/common/content_constants.h"
30 #include "content/common/database_messages.h" 29 #include "content/common/database_messages.h"
31 #include "content/common/drag_messages.h" 30 #include "content/common/drag_messages.h"
32 #include "content/common/file_system/file_system_dispatcher.h" 31 #include "content/common/file_system/file_system_dispatcher.h"
33 #include "content/common/file_system/webfilesystem_callback_dispatcher.h" 32 #include "content/common/file_system/webfilesystem_callback_dispatcher.h"
34 #include "content/common/intents_messages.h" 33 #include "content/common/intents_messages.h"
35 #include "content/common/java_bridge_messages.h" 34 #include "content/common/java_bridge_messages.h"
36 #include "content/common/pepper_messages.h" 35 #include "content/common/pepper_messages.h"
37 #include "content/common/pepper_plugin_registry.h" 36 #include "content/common/pepper_plugin_registry.h"
38 #include "content/common/quota_dispatcher.h" 37 #include "content/common/quota_dispatcher.h"
39 #include "content/common/renderer_preferences.h" 38 #include "content/common/renderer_preferences.h"
40 #include "content/common/request_extra_data.h" 39 #include "content/common/request_extra_data.h"
41 #include "content/common/view_messages.h" 40 #include "content/common/view_messages.h"
42 #include "content/public/common/bindings_policy.h" 41 #include "content/public/common/bindings_policy.h"
42 #include "content/public/common/content_constants.h"
43 #include "content/public/common/content_switches.h" 43 #include "content/public/common/content_switches.h"
44 #include "content/public/common/url_constants.h" 44 #include "content/public/common/url_constants.h"
45 #include "content/public/renderer/content_renderer_client.h" 45 #include "content/public/renderer/content_renderer_client.h"
46 #include "content/public/renderer/navigation_state.h" 46 #include "content/public/renderer/navigation_state.h"
47 #include "content/public/renderer/render_view_observer.h" 47 #include "content/public/renderer/render_view_observer.h"
48 #include "content/public/renderer/render_view_visitor.h" 48 #include "content/public/renderer/render_view_visitor.h"
49 #include "content/renderer/device_orientation_dispatcher.h" 49 #include "content/renderer/device_orientation_dispatcher.h"
50 #include "content/renderer/devtools_agent.h" 50 #include "content/renderer/devtools_agent.h"
51 #include "content/renderer/external_popup_menu.h" 51 #include "content/renderer/external_popup_menu.h"
52 #include "content/renderer/geolocation_dispatcher.h" 52 #include "content/renderer/geolocation_dispatcher.h"
(...skipping 3468 matching lines...) Expand 10 before | Expand all | Expand 10 after
3521 } 3521 }
3522 3522
3523 void RenderViewImpl::OnFindReplyAck() { 3523 void RenderViewImpl::OnFindReplyAck() {
3524 // Check if there is any queued up request waiting to be sent. 3524 // Check if there is any queued up request waiting to be sent.
3525 if (queued_find_reply_message_.get()) { 3525 if (queued_find_reply_message_.get()) {
3526 // Send the search result over to the browser process. 3526 // Send the search result over to the browser process.
3527 Send(queued_find_reply_message_.release()); 3527 Send(queued_find_reply_message_.release());
3528 } 3528 }
3529 } 3529 }
3530 3530
3531 void RenderViewImpl::OnZoom(PageZoom::Function function) { 3531 void RenderViewImpl::OnZoom(content::PageZoom zoom) {
3532 if (!webview()) // Not sure if this can happen, but no harm in being safe. 3532 if (!webview()) // Not sure if this can happen, but no harm in being safe.
3533 return; 3533 return;
3534 3534
3535 webview()->hidePopups(); 3535 webview()->hidePopups();
3536 #if !defined(TOUCH_UI) 3536 #if !defined(TOUCH_UI)
3537 double old_zoom_level = webview()->zoomLevel(); 3537 double old_zoom_level = webview()->zoomLevel();
3538 double zoom_level; 3538 double zoom_level;
3539 if (function == PageZoom::RESET) { 3539 if (zoom == content::PAGE_ZOOM_RESET) {
3540 zoom_level = 0; 3540 zoom_level = 0;
3541 } else if (static_cast<int>(old_zoom_level) == old_zoom_level) { 3541 } else if (static_cast<int>(old_zoom_level) == old_zoom_level) {
3542 // Previous zoom level is a whole number, so just increment/decrement. 3542 // Previous zoom level is a whole number, so just increment/decrement.
3543 zoom_level = old_zoom_level + function; 3543 zoom_level = old_zoom_level + zoom;
3544 } else { 3544 } else {
3545 // Either the user hit the zoom factor limit and thus the zoom level is now 3545 // Either the user hit the zoom factor limit and thus the zoom level is now
3546 // not a whole number, or a plugin changed it to a custom value. We want 3546 // not a whole number, or a plugin changed it to a custom value. We want
3547 // to go to the next whole number so that the user can always get back to 3547 // to go to the next whole number so that the user can always get back to
3548 // 100% with the keyboard/menu. 3548 // 100% with the keyboard/menu.
3549 if ((old_zoom_level > 1 && function > 0) || 3549 if ((old_zoom_level > 1 && zoom > 0) ||
3550 (old_zoom_level < 1 && function < 0)) { 3550 (old_zoom_level < 1 && zoom < 0)) {
3551 zoom_level = static_cast<int>(old_zoom_level + function); 3551 zoom_level = static_cast<int>(old_zoom_level + zoom);
3552 } else { 3552 } else {
3553 // We're going towards 100%, so first go to the next whole number. 3553 // We're going towards 100%, so first go to the next whole number.
3554 zoom_level = static_cast<int>(old_zoom_level); 3554 zoom_level = static_cast<int>(old_zoom_level);
3555 } 3555 }
3556 } 3556 }
3557 webview()->setZoomLevel(false, zoom_level); 3557 webview()->setZoomLevel(false, zoom_level);
3558 #else 3558 #else
3559 double old_page_scale_factor = webview()->pageScaleFactor(); 3559 double old_page_scale_factor = webview()->pageScaleFactor();
3560 double page_scale_factor; 3560 double page_scale_factor;
3561 if (function == PageZoom::RESET) { 3561 if (zoom == content::PAGE_ZOOM_RESET) {
3562 page_scale_factor = 1.0; 3562 page_scale_factor = 1.0;
3563 } else { 3563 } else {
3564 page_scale_factor = old_page_scale_factor + 3564 page_scale_factor = old_page_scale_factor +
3565 (function > 0 ? kScalingIncrement : -kScalingIncrement); 3565 (zoom > 0 ? kScalingIncrement : -kScalingIncrement);
3566 } 3566 }
3567 webview()->scalePage(page_scale_factor, WebPoint(0, 0)); 3567 webview()->scalePage(page_scale_factor, WebPoint(0, 0));
3568 #endif 3568 #endif
3569 zoomLevelChanged(); 3569 zoomLevelChanged();
3570 } 3570 }
3571 3571
3572 void RenderViewImpl::OnSetZoomLevel(double zoom_level) { 3572 void RenderViewImpl::OnSetZoomLevel(double zoom_level) {
3573 // Don't set zoom level for full-page plugin since they don't use the same 3573 // Don't set zoom level for full-page plugin since they don't use the same
3574 // zoom settings. 3574 // zoom settings.
3575 if (webview()->mainFrame()->document().isPluginDocument()) 3575 if (webview()->mainFrame()->document().isPluginDocument())
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
4673 return webview()->settings()->useThreadedCompositor(); 4673 return webview()->settings()->useThreadedCompositor();
4674 } 4674 }
4675 4675
4676 void RenderViewImpl::OnJavaBridgeInit( 4676 void RenderViewImpl::OnJavaBridgeInit(
4677 const IPC::ChannelHandle& channel_handle) { 4677 const IPC::ChannelHandle& channel_handle) {
4678 DCHECK(!java_bridge_dispatcher_.get()); 4678 DCHECK(!java_bridge_dispatcher_.get());
4679 #if defined(ENABLE_JAVA_BRIDGE) 4679 #if defined(ENABLE_JAVA_BRIDGE)
4680 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); 4680 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle));
4681 #endif 4681 #endif
4682 } 4682 }
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698