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