OLD | NEW |
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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 #if defined(OS_ANDROID) | 650 #if defined(OS_ANDROID) |
651 top_controls_constraints_(cc::BOTH), | 651 top_controls_constraints_(cc::BOTH), |
652 #endif | 652 #endif |
653 cached_is_main_frame_pinned_to_left_(false), | |
654 cached_is_main_frame_pinned_to_right_(false), | |
655 has_scrolled_focused_editable_node_into_rect_(false), | 653 has_scrolled_focused_editable_node_into_rect_(false), |
656 push_messaging_dispatcher_(NULL), | 654 push_messaging_dispatcher_(NULL), |
657 speech_recognition_dispatcher_(NULL), | 655 speech_recognition_dispatcher_(NULL), |
658 media_stream_dispatcher_(NULL), | 656 media_stream_dispatcher_(NULL), |
659 browser_plugin_manager_(NULL), | 657 browser_plugin_manager_(NULL), |
660 midi_dispatcher_(NULL), | 658 midi_dispatcher_(NULL), |
661 devtools_agent_(NULL), | 659 devtools_agent_(NULL), |
662 accessibility_mode_(AccessibilityModeOff), | 660 accessibility_mode_(AccessibilityModeOff), |
663 renderer_accessibility_(NULL), | 661 renderer_accessibility_(NULL), |
664 mouse_lock_dispatcher_(NULL), | 662 mouse_lock_dispatcher_(NULL), |
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 preferred_size_)); | 2217 preferred_size_)); |
2220 } | 2218 } |
2221 | 2219 |
2222 BrowserPluginManager* RenderViewImpl::GetBrowserPluginManager() { | 2220 BrowserPluginManager* RenderViewImpl::GetBrowserPluginManager() { |
2223 if (!browser_plugin_manager_.get()) | 2221 if (!browser_plugin_manager_.get()) |
2224 browser_plugin_manager_ = BrowserPluginManager::Create(this); | 2222 browser_plugin_manager_ = BrowserPluginManager::Create(this); |
2225 return browser_plugin_manager_.get(); | 2223 return browser_plugin_manager_.get(); |
2226 } | 2224 } |
2227 | 2225 |
2228 void RenderViewImpl::UpdateScrollState(WebFrame* frame) { | 2226 void RenderViewImpl::UpdateScrollState(WebFrame* frame) { |
2229 WebSize offset = frame->scrollOffset(); | |
2230 WebSize minimum_offset = frame->minimumScrollOffset(); | |
2231 WebSize maximum_offset = frame->maximumScrollOffset(); | |
2232 | |
2233 bool is_pinned_to_left = offset.width <= minimum_offset.width; | |
2234 bool is_pinned_to_right = offset.width >= maximum_offset.width; | |
2235 | |
2236 if (is_pinned_to_left != cached_is_main_frame_pinned_to_left_ || | |
2237 is_pinned_to_right != cached_is_main_frame_pinned_to_right_) { | |
2238 Send(new ViewHostMsg_DidChangeScrollOffsetPinningForMainFrame( | |
2239 routing_id_, is_pinned_to_left, is_pinned_to_right)); | |
2240 | |
2241 cached_is_main_frame_pinned_to_left_ = is_pinned_to_left; | |
2242 cached_is_main_frame_pinned_to_right_ = is_pinned_to_right; | |
2243 } | |
2244 | |
2245 Send(new ViewHostMsg_DidChangeScrollOffset(routing_id_)); | 2227 Send(new ViewHostMsg_DidChangeScrollOffset(routing_id_)); |
2246 } | 2228 } |
2247 | 2229 |
2248 void RenderViewImpl::didChangeScrollOffset(WebLocalFrame* frame) { | 2230 void RenderViewImpl::didChangeScrollOffset(WebLocalFrame* frame) { |
2249 StartNavStateSyncTimerIfNecessary(); | 2231 StartNavStateSyncTimerIfNecessary(); |
2250 | 2232 |
2251 if (webview()->mainFrame() == frame) | 2233 if (webview()->mainFrame() == frame) |
2252 UpdateScrollState(frame); | 2234 UpdateScrollState(frame); |
2253 | 2235 |
2254 FOR_EACH_OBSERVER( | 2236 FOR_EACH_OBSERVER( |
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4060 std::vector<gfx::Size> sizes; | 4042 std::vector<gfx::Size> sizes; |
4061 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4043 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4062 if (!url.isEmpty()) | 4044 if (!url.isEmpty()) |
4063 urls.push_back( | 4045 urls.push_back( |
4064 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4046 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4065 } | 4047 } |
4066 SendUpdateFaviconURL(urls); | 4048 SendUpdateFaviconURL(urls); |
4067 } | 4049 } |
4068 | 4050 |
4069 } // namespace content | 4051 } // namespace content |
OLD | NEW |