| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1725 // created RenderView (i.e., as a constrained popup or as a new tab). | 1725 // created RenderView (i.e., as a constrained popup or as a new tab). |
| 1726 // | 1726 // |
| 1727 void RenderView::show(WebNavigationPolicy policy) { | 1727 void RenderView::show(WebNavigationPolicy policy) { |
| 1728 DCHECK(!did_show_) << "received extraneous Show call"; | 1728 DCHECK(!did_show_) << "received extraneous Show call"; |
| 1729 DCHECK(opener_id_ != MSG_ROUTING_NONE); | 1729 DCHECK(opener_id_ != MSG_ROUTING_NONE); |
| 1730 | 1730 |
| 1731 if (did_show_) | 1731 if (did_show_) |
| 1732 return; | 1732 return; |
| 1733 did_show_ = true; | 1733 did_show_ = true; |
| 1734 | 1734 |
| 1735 // Force new windows to a popup if they were not opened with a user gesture. |
| 1736 if (!opened_by_user_gesture_) { |
| 1737 // We exempt background tabs for compat with older versions of Chrome. |
| 1738 // TODO(darin): This seems bogus. These should have a user gesture, so |
| 1739 // we probably don't need this check. |
| 1740 if (policy != WebKit::WebNavigationPolicyNewBackgroundTab) |
| 1741 policy = WebKit::WebNavigationPolicyNewPopup; |
| 1742 } |
| 1743 |
| 1735 // NOTE: initial_pos_ may still have its default values at this point, but | 1744 // NOTE: initial_pos_ may still have its default values at this point, but |
| 1736 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the | 1745 // that's okay. It'll be ignored if disposition is not NEW_POPUP, or the |
| 1737 // browser process will impose a default position otherwise. | 1746 // browser process will impose a default position otherwise. |
| 1738 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, | 1747 Send(new ViewHostMsg_ShowView(opener_id_, routing_id_, |
| 1739 NavigationPolicyToDisposition(policy), initial_pos_, | 1748 NavigationPolicyToDisposition(policy), initial_pos_, |
| 1740 opened_by_user_gesture_, creator_url_)); | 1749 opened_by_user_gesture_, creator_url_)); |
| 1741 SetPendingWindowRect(initial_pos_); | 1750 SetPendingWindowRect(initial_pos_); |
| 1742 } | 1751 } |
| 1743 | 1752 |
| 1744 void RenderView::closeWidgetSoon() { | 1753 void RenderView::closeWidgetSoon() { |
| (...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2757 Send(new ViewMsg_DeterminePageText_Reply(routing_id_, contents)); | 2766 Send(new ViewMsg_DeterminePageText_Reply(routing_id_, contents)); |
| 2758 determine_page_text_after_loading_stops_ = false; | 2767 determine_page_text_after_loading_stops_ = false; |
| 2759 return; | 2768 return; |
| 2760 } | 2769 } |
| 2761 | 2770 |
| 2762 // We set |determine_page_text_after_loading_stops_| true here so that, | 2771 // We set |determine_page_text_after_loading_stops_| true here so that, |
| 2763 // after page has been loaded completely, the text in the page is captured. | 2772 // after page has been loaded completely, the text in the page is captured. |
| 2764 determine_page_text_after_loading_stops_ = true; | 2773 determine_page_text_after_loading_stops_ = true; |
| 2765 } | 2774 } |
| 2766 | 2775 |
| 2767 bool RenderView::WasOpenedByUserGesture() const { | |
| 2768 return opened_by_user_gesture_; | |
| 2769 } | |
| 2770 | |
| 2771 void RenderView::DnsPrefetch(const std::vector<std::string>& host_names) { | 2776 void RenderView::DnsPrefetch(const std::vector<std::string>& host_names) { |
| 2772 Send(new ViewHostMsg_DnsPrefetch(host_names)); | 2777 Send(new ViewHostMsg_DnsPrefetch(host_names)); |
| 2773 } | 2778 } |
| 2774 | 2779 |
| 2775 void RenderView::OnZoom(int function) { | 2780 void RenderView::OnZoom(int function) { |
| 2776 static const bool kZoomIsTextOnly = false; | 2781 static const bool kZoomIsTextOnly = false; |
| 2777 switch (function) { | 2782 switch (function) { |
| 2778 case PageZoom::SMALLER: | 2783 case PageZoom::SMALLER: |
| 2779 webview()->zoomOut(kZoomIsTextOnly); | 2784 webview()->zoomOut(kZoomIsTextOnly); |
| 2780 break; | 2785 break; |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3648 new PluginMsg_SignalModalDialogEvent(host_window_)); | 3653 new PluginMsg_SignalModalDialogEvent(host_window_)); |
| 3649 | 3654 |
| 3650 message->EnableMessagePumping(); // Runs a nested message loop. | 3655 message->EnableMessagePumping(); // Runs a nested message loop. |
| 3651 bool rv = Send(message); | 3656 bool rv = Send(message); |
| 3652 | 3657 |
| 3653 PluginChannelHost::Broadcast( | 3658 PluginChannelHost::Broadcast( |
| 3654 new PluginMsg_ResetModalDialogEvent(host_window_)); | 3659 new PluginMsg_ResetModalDialogEvent(host_window_)); |
| 3655 | 3660 |
| 3656 return rv; | 3661 return rv; |
| 3657 } | 3662 } |
| OLD | NEW |