| 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 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1892 // that would defer resource loads for the dialog itself. | 1892 // that would defer resource loads for the dialog itself. |
| 1893 if (RenderThread::current()) // Will be NULL during unit tests. | 1893 if (RenderThread::current()) // Will be NULL during unit tests. |
| 1894 RenderThread::current()->DoNotNotifyWebKitOfModalLoop(); | 1894 RenderThread::current()->DoNotNotifyWebKitOfModalLoop(); |
| 1895 | 1895 |
| 1896 message->EnableMessagePumping(); // Runs a nested message loop. | 1896 message->EnableMessagePumping(); // Runs a nested message loop. |
| 1897 return Send(message); | 1897 return Send(message); |
| 1898 } | 1898 } |
| 1899 | 1899 |
| 1900 void RenderView::AddGURLSearchProvider( | 1900 void RenderView::AddGURLSearchProvider( |
| 1901 const GURL& osd_url, | 1901 const GURL& osd_url, |
| 1902 const ViewHostMsg_PageHasOSDD_Type& provider_type) { | 1902 search_provider::OSDDType provider_type) { |
| 1903 if (!osd_url.is_empty()) | 1903 if (!osd_url.is_empty()) |
| 1904 Send(new ViewHostMsg_PageHasOSDD(routing_id_, page_id_, osd_url, | 1904 Send(new ViewHostMsg_PageHasOSDD(routing_id_, page_id_, osd_url, |
| 1905 provider_type)); | 1905 provider_type)); |
| 1906 } | 1906 } |
| 1907 | 1907 |
| 1908 void RenderView::OnAllowScriptToClose(bool script_can_close) { | 1908 void RenderView::OnAllowScriptToClose(bool script_can_close) { |
| 1909 script_can_close_ = script_can_close; | 1909 script_can_close_ = script_can_close; |
| 1910 } | 1910 } |
| 1911 | 1911 |
| 1912 void RenderView::AddSearchProvider( | 1912 void RenderView::AddSearchProvider( |
| 1913 const std::string& url, | 1913 const std::string& url, |
| 1914 const ViewHostMsg_PageHasOSDD_Type& provider_type) { | 1914 search_provider::OSDDType provider_type) { |
| 1915 if (provider_type.type == | 1915 if (provider_type == search_provider::EXPLICIT_DEFAULT_PROVIDER && |
| 1916 ViewHostMsg_PageHasOSDD_Type::EXPLICIT_DEFAULT_PROVIDER && | |
| 1917 !webview()->mainFrame()->isProcessingUserGesture()) | 1916 !webview()->mainFrame()->isProcessingUserGesture()) |
| 1918 return; | 1917 return; |
| 1919 | 1918 |
| 1920 AddGURLSearchProvider(GURL(url), provider_type); | 1919 AddGURLSearchProvider(GURL(url), provider_type); |
| 1921 } | 1920 } |
| 1922 | 1921 |
| 1923 ViewHostMsg_GetSearchProviderInstallState_Params | 1922 search_provider::InstallState |
| 1924 RenderView::GetSearchProviderInstallState(WebFrame* frame, | 1923 RenderView::GetSearchProviderInstallState(WebFrame* frame, |
| 1925 const std::string& url) { | 1924 const std::string& url) { |
| 1926 GURL inquiry_url = GURL(url); | 1925 GURL inquiry_url = GURL(url); |
| 1927 if (inquiry_url.is_empty()) | 1926 if (inquiry_url.is_empty()) |
| 1928 return ViewHostMsg_GetSearchProviderInstallState_Params::Denied(); | 1927 return search_provider::DENIED; |
| 1929 | 1928 |
| 1930 ViewHostMsg_GetSearchProviderInstallState_Params install; | 1929 search_provider::InstallState install; |
| 1931 Send(new ViewHostMsg_GetSearchProviderInstallState(routing_id_, | 1930 Send(new ViewHostMsg_GetSearchProviderInstallState(routing_id_, |
| 1932 frame->url(), | 1931 frame->url(), |
| 1933 inquiry_url, | 1932 inquiry_url, |
| 1934 &install)); | 1933 &install)); |
| 1935 return install; | 1934 return install; |
| 1936 } | 1935 } |
| 1937 | 1936 |
| 1938 void RenderView::OnMissingPluginStatus( | 1937 void RenderView::OnMissingPluginStatus( |
| 1939 WebPluginDelegateProxy* delegate, | 1938 WebPluginDelegateProxy* delegate, |
| 1940 int status) { | 1939 int status) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 // NOTE: For now we're doing the safest thing, and sending out notification | 2108 // NOTE: For now we're doing the safest thing, and sending out notification |
| 2110 // when done loading. This currently isn't an issue as the favicon is only | 2109 // when done loading. This currently isn't an issue as the favicon is only |
| 2111 // displayed when done loading. Ideally we would send notification when | 2110 // displayed when done loading. Ideally we would send notification when |
| 2112 // finished parsing the head, but webkit doesn't support that yet. | 2111 // finished parsing the head, but webkit doesn't support that yet. |
| 2113 // The feed discovery code would also benefit from access to the head. | 2112 // The feed discovery code would also benefit from access to the head. |
| 2114 GURL favicon_url(webview()->mainFrame()->favIconURL()); | 2113 GURL favicon_url(webview()->mainFrame()->favIconURL()); |
| 2115 if (!favicon_url.is_empty()) | 2114 if (!favicon_url.is_empty()) |
| 2116 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, favicon_url)); | 2115 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, favicon_url)); |
| 2117 | 2116 |
| 2118 AddGURLSearchProvider(webview()->mainFrame()->openSearchDescriptionURL(), | 2117 AddGURLSearchProvider(webview()->mainFrame()->openSearchDescriptionURL(), |
| 2119 ViewHostMsg_PageHasOSDD_Type::Autodetected()); | 2118 search_provider::AUTODETECTED_PROVIDER); |
| 2120 | 2119 |
| 2121 Send(new ViewHostMsg_DidStopLoading(routing_id_)); | 2120 Send(new ViewHostMsg_DidStopLoading(routing_id_)); |
| 2122 | 2121 |
| 2123 if (load_progress_tracker_ != NULL) | 2122 if (load_progress_tracker_ != NULL) |
| 2124 load_progress_tracker_->DidStopLoading(); | 2123 load_progress_tracker_->DidStopLoading(); |
| 2125 | 2124 |
| 2126 MessageLoop::current()->PostDelayedTask( | 2125 MessageLoop::current()->PostDelayedTask( |
| 2127 FROM_HERE, | 2126 FROM_HERE, |
| 2128 page_info_method_factory_.NewRunnableMethod( | 2127 page_info_method_factory_.NewRunnableMethod( |
| 2129 &RenderView::CapturePageInfo, page_id_, false), | 2128 &RenderView::CapturePageInfo, page_id_, false), |
| (...skipping 3244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5374 const webkit_glue::CustomContextMenuContext& custom_context) { | 5373 const webkit_glue::CustomContextMenuContext& custom_context) { |
| 5375 if (custom_context.is_pepper_menu) | 5374 if (custom_context.is_pepper_menu) |
| 5376 pepper_delegate_.OnContextMenuClosed(custom_context); | 5375 pepper_delegate_.OnContextMenuClosed(custom_context); |
| 5377 else | 5376 else |
| 5378 context_menu_node_.reset(); | 5377 context_menu_node_.reset(); |
| 5379 } | 5378 } |
| 5380 | 5379 |
| 5381 void RenderView::OnNetworkStateChanged(bool online) { | 5380 void RenderView::OnNetworkStateChanged(bool online) { |
| 5382 WebNetworkStateNotifier::setOnLine(online); | 5381 WebNetworkStateNotifier::setOnLine(online); |
| 5383 } | 5382 } |
| OLD | NEW |