Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 23283007: Move kJavaScriptScheme into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: content:: is necessary in web_drag_source_mac.mm Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/renderer_host/render_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 // loading" message will be received asynchronously from the UI of the 331 // loading" message will be received asynchronously from the UI of the
332 // browser. But we want to keep the throbber in sync with what's happening 332 // browser. But we want to keep the throbber in sync with what's happening
333 // in the UI. For example, we want to start throbbing immediately when the 333 // in the UI. For example, we want to start throbbing immediately when the
334 // user naivgates even if the renderer is delayed. There is also an issue 334 // user naivgates even if the renderer is delayed. There is also an issue
335 // with the throbber starting because the WebUI (which controls whether the 335 // with the throbber starting because the WebUI (which controls whether the
336 // favicon is displayed) happens synchronously. If the start loading 336 // favicon is displayed) happens synchronously. If the start loading
337 // messages was asynchronous, then the default favicon would flash in. 337 // messages was asynchronous, then the default favicon would flash in.
338 // 338 //
339 // WebKit doesn't send throb notifications for JavaScript URLs, so we 339 // WebKit doesn't send throb notifications for JavaScript URLs, so we
340 // don't want to either. 340 // don't want to either.
341 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) 341 if (!params.url.SchemeIs(kJavaScriptScheme))
342 delegate_->DidStartLoading(this); 342 delegate_->DidStartLoading(this);
343 343
344 FOR_EACH_OBSERVER(RenderViewHostObserver, observers_, Navigate(params.url)); 344 FOR_EACH_OBSERVER(RenderViewHostObserver, observers_, Navigate(params.url));
345 } 345 }
346 346
347 void RenderViewHostImpl::NavigateToURL(const GURL& url) { 347 void RenderViewHostImpl::NavigateToURL(const GURL& url) {
348 ViewMsg_Navigate_Params params; 348 ViewMsg_Navigate_Params params;
349 params.page_id = -1; 349 params.page_id = -1;
350 params.pending_history_list_offset = -1; 350 params.pending_history_list_offset = -1;
351 params.current_history_list_offset = -1; 351 params.current_history_list_offset = -1;
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); 1456 RenderViewHostDelegateView* view = delegate_->GetDelegateView();
1457 if (!view) 1457 if (!view)
1458 return; 1458 return;
1459 1459
1460 DropData filtered_data(drop_data); 1460 DropData filtered_data(drop_data);
1461 RenderProcessHost* process = GetProcess(); 1461 RenderProcessHost* process = GetProcess();
1462 ChildProcessSecurityPolicyImpl* policy = 1462 ChildProcessSecurityPolicyImpl* policy =
1463 ChildProcessSecurityPolicyImpl::GetInstance(); 1463 ChildProcessSecurityPolicyImpl::GetInstance();
1464 1464
1465 // Allow drag of Javascript URLs to enable bookmarklet drag to bookmark bar. 1465 // Allow drag of Javascript URLs to enable bookmarklet drag to bookmark bar.
1466 if (!filtered_data.url.SchemeIs(chrome::kJavaScriptScheme)) 1466 if (!filtered_data.url.SchemeIs(kJavaScriptScheme))
1467 FilterURL(policy, process, true, &filtered_data.url); 1467 FilterURL(policy, process, true, &filtered_data.url);
1468 FilterURL(policy, process, false, &filtered_data.html_base_url); 1468 FilterURL(policy, process, false, &filtered_data.html_base_url);
1469 // Filter out any paths that the renderer didn't have access to. This prevents 1469 // Filter out any paths that the renderer didn't have access to. This prevents
1470 // the following attack on a malicious renderer: 1470 // the following attack on a malicious renderer:
1471 // 1. StartDragging IPC sent with renderer-specified filesystem paths that it 1471 // 1. StartDragging IPC sent with renderer-specified filesystem paths that it
1472 // doesn't have read permissions for. 1472 // doesn't have read permissions for.
1473 // 2. We initiate a native DnD operation. 1473 // 2. We initiate a native DnD operation.
1474 // 3. DnD operation immediately ends since mouse is not held down. DnD events 1474 // 3. DnD operation immediately ends since mouse is not held down. DnD events
1475 // still fire though, which causes read permissions to be granted to the 1475 // still fire though, which causes read permissions to be granted to the
1476 // renderer for any file paths in the drop. 1476 // renderer for any file paths in the drop.
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 GetContentClient()->browser()->RequestDesktopNotificationPermission( 1945 GetContentClient()->browser()->RequestDesktopNotificationPermission(
1946 source_origin, callback_context, GetProcess()->GetID(), GetRoutingID()); 1946 source_origin, callback_context, GetProcess()->GetID(), GetRoutingID());
1947 } 1947 }
1948 1948
1949 void RenderViewHostImpl::OnShowDesktopNotification( 1949 void RenderViewHostImpl::OnShowDesktopNotification(
1950 const ShowDesktopNotificationHostMsgParams& params) { 1950 const ShowDesktopNotificationHostMsgParams& params) {
1951 // Disallow HTML notifications from javascript: and file: schemes as this 1951 // Disallow HTML notifications from javascript: and file: schemes as this
1952 // allows unwanted cross-domain access. 1952 // allows unwanted cross-domain access.
1953 GURL url = params.contents_url; 1953 GURL url = params.contents_url;
1954 if (params.is_html && 1954 if (params.is_html &&
1955 (url.SchemeIs(chrome::kJavaScriptScheme) || 1955 (url.SchemeIs(kJavaScriptScheme) ||
1956 url.SchemeIs(chrome::kFileScheme))) { 1956 url.SchemeIs(chrome::kFileScheme))) {
1957 return; 1957 return;
1958 } 1958 }
1959 1959
1960 GetContentClient()->browser()->ShowDesktopNotification( 1960 GetContentClient()->browser()->ShowDesktopNotification(
1961 params, GetProcess()->GetID(), GetRoutingID(), false); 1961 params, GetProcess()->GetID(), GetRoutingID(), false);
1962 } 1962 }
1963 1963
1964 void RenderViewHostImpl::OnCancelDesktopNotification(int notification_id) { 1964 void RenderViewHostImpl::OnCancelDesktopNotification(int notification_id) {
1965 GetContentClient()->browser()->CancelDesktopNotification( 1965 GetContentClient()->browser()->CancelDesktopNotification(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); 2049 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles();
2050 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); 2050 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin();
2051 file != file_paths.end(); ++file) { 2051 file != file_paths.end(); ++file) {
2052 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) 2052 if (!policy->CanReadFile(GetProcess()->GetID(), *file))
2053 return false; 2053 return false;
2054 } 2054 }
2055 return true; 2055 return true;
2056 } 2056 }
2057 2057
2058 } // namespace content 2058 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/child_process_security_policy_unittest.cc ('k') | content/browser/site_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698