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 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1802 | 1802 |
1803 if (nav_state_sync_timer_.IsRunning()) { | 1803 if (nav_state_sync_timer_.IsRunning()) { |
1804 // The timer is already running. If the delay of the timer maches the amount | 1804 // The timer is already running. If the delay of the timer maches the amount |
1805 // we want to delay by, then return. Otherwise stop the timer so that it | 1805 // we want to delay by, then return. Otherwise stop the timer so that it |
1806 // gets started with the right delay. | 1806 // gets started with the right delay. |
1807 if (nav_state_sync_timer_.GetCurrentDelay().InSeconds() == delay) | 1807 if (nav_state_sync_timer_.GetCurrentDelay().InSeconds() == delay) |
1808 return; | 1808 return; |
1809 nav_state_sync_timer_.Stop(); | 1809 nav_state_sync_timer_.Stop(); |
1810 } | 1810 } |
1811 | 1811 |
1812 nav_state_sync_timer_.Start( | 1812 nav_state_sync_timer_.Start(TimeDelta::FromSeconds(delay), this, |
1813 TimeDelta::FromSeconds(delay), this, &RenderView::SyncNavigationState); | 1813 &RenderView::SyncNavigationState, FROM_HERE); |
1814 } | 1814 } |
1815 | 1815 |
1816 void RenderView::setMouseOverURL(const WebURL& url) { | 1816 void RenderView::setMouseOverURL(const WebURL& url) { |
1817 mouse_over_url_ = GURL(url); | 1817 mouse_over_url_ = GURL(url); |
1818 UpdateTargetURL(mouse_over_url_, focus_url_); | 1818 UpdateTargetURL(mouse_over_url_, focus_url_); |
1819 } | 1819 } |
1820 | 1820 |
1821 void RenderView::setKeyboardFocusURL(const WebURL& url) { | 1821 void RenderView::setKeyboardFocusURL(const WebURL& url) { |
1822 focus_url_ = GURL(url); | 1822 focus_url_ = GURL(url); |
1823 UpdateTargetURL(focus_url_, mouse_over_url_); | 1823 UpdateTargetURL(focus_url_, mouse_over_url_); |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2857 void RenderView::didUpdateLayout(WebFrame* frame) { | 2857 void RenderView::didUpdateLayout(WebFrame* frame) { |
2858 // We don't always want to set up a timer, only if we've been put in that | 2858 // We don't always want to set up a timer, only if we've been put in that |
2859 // mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| | 2859 // mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| |
2860 // message. | 2860 // message. |
2861 if (!send_preferred_size_changes_ || !webview()) | 2861 if (!send_preferred_size_changes_ || !webview()) |
2862 return; | 2862 return; |
2863 | 2863 |
2864 if (check_preferred_size_timer_.IsRunning()) | 2864 if (check_preferred_size_timer_.IsRunning()) |
2865 return; | 2865 return; |
2866 check_preferred_size_timer_.Start(TimeDelta::FromMilliseconds(0), this, | 2866 check_preferred_size_timer_.Start(TimeDelta::FromMilliseconds(0), this, |
2867 &RenderView::CheckPreferredSize); | 2867 &RenderView::CheckPreferredSize, FROM_HERE); |
2868 } | 2868 } |
2869 | 2869 |
2870 void RenderView::CheckPreferredSize() { | 2870 void RenderView::CheckPreferredSize() { |
2871 // We don't always want to send the change messages over IPC, only if we've | 2871 // We don't always want to send the change messages over IPC, only if we've |
2872 // been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| | 2872 // been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| |
2873 // message. | 2873 // message. |
2874 if (!send_preferred_size_changes_ || !webview()) | 2874 if (!send_preferred_size_changes_ || !webview()) |
2875 return; | 2875 return; |
2876 | 2876 |
2877 gfx::Size size(webview()->mainFrame()->contentsPreferredWidth(), | 2877 gfx::Size size(webview()->mainFrame()->contentsPreferredWidth(), |
(...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4607 } | 4607 } |
4608 | 4608 |
4609 void RenderView::OnEnableViewSourceMode() { | 4609 void RenderView::OnEnableViewSourceMode() { |
4610 if (!webview()) | 4610 if (!webview()) |
4611 return; | 4611 return; |
4612 WebFrame* main_frame = webview()->mainFrame(); | 4612 WebFrame* main_frame = webview()->mainFrame(); |
4613 if (!main_frame) | 4613 if (!main_frame) |
4614 return; | 4614 return; |
4615 main_frame->enableViewSourceMode(true); | 4615 main_frame->enableViewSourceMode(true); |
4616 } | 4616 } |
OLD | NEW |