OLD | NEW |
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/tab_contents/navigation_controller_impl.h" | 5 #include "content/browser/tab_contents/navigation_controller_impl.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" // Temporary | 9 #include "base/string_number_conversions.h" // Temporary |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "content/browser/browser_url_handler.h" | 13 #include "content/browser/browser_url_handler.h" |
14 #include "content/browser/child_process_security_policy.h" | 14 #include "content/browser/child_process_security_policy_impl.h" |
15 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 15 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
16 #include "content/browser/renderer_host/render_view_host.h" // Temporary | 16 #include "content/browser/renderer_host/render_view_host.h" // Temporary |
17 #include "content/browser/site_instance_impl.h" | 17 #include "content/browser/site_instance_impl.h" |
18 #include "content/browser/tab_contents/interstitial_page.h" | 18 #include "content/browser/tab_contents/interstitial_page.h" |
19 #include "content/browser/tab_contents/navigation_entry_impl.h" | 19 #include "content/browser/tab_contents/navigation_entry_impl.h" |
20 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
21 #include "content/common/view_messages.h" | 21 #include "content/common/view_messages.h" |
22 #include "content/public/browser/browser_context.h" | 22 #include "content/public/browser/browser_context.h" |
23 #include "content/public/browser/invalidate_type.h" | 23 #include "content/public/browser/invalidate_type.h" |
24 #include "content/public/browser/navigation_details.h" | 24 #include "content/public/browser/navigation_details.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 NavigationEntryImpl* NavigationControllerImpl::GetEntryWithPageID( | 323 NavigationEntryImpl* NavigationControllerImpl::GetEntryWithPageID( |
324 SiteInstance* instance, int32 page_id) const { | 324 SiteInstance* instance, int32 page_id) const { |
325 int index = GetEntryIndexWithPageID(instance, page_id); | 325 int index = GetEntryIndexWithPageID(instance, page_id); |
326 return (index != -1) ? entries_[index].get() : NULL; | 326 return (index != -1) ? entries_[index].get() : NULL; |
327 } | 327 } |
328 | 328 |
329 void NavigationControllerImpl::LoadEntry(NavigationEntryImpl* entry) { | 329 void NavigationControllerImpl::LoadEntry(NavigationEntryImpl* entry) { |
330 // Don't navigate to URLs disabled by policy. This prevents showing the URL | 330 // Don't navigate to URLs disabled by policy. This prevents showing the URL |
331 // on the Omnibar when it is also going to be blocked by | 331 // on the Omnibar when it is also going to be blocked by |
332 // ChildProcessSecurityPolicy::CanRequestURL. | 332 // ChildProcessSecurityPolicy::CanRequestURL. |
333 ChildProcessSecurityPolicy *policy = | 333 ChildProcessSecurityPolicyImpl* policy = |
334 ChildProcessSecurityPolicy::GetInstance(); | 334 ChildProcessSecurityPolicyImpl::GetInstance(); |
335 if (policy->IsDisabledScheme(entry->GetURL().scheme()) || | 335 if (policy->IsDisabledScheme(entry->GetURL().scheme()) || |
336 policy->IsDisabledScheme(entry->GetVirtualURL().scheme())) { | 336 policy->IsDisabledScheme(entry->GetVirtualURL().scheme())) { |
337 VLOG(1) << "URL not loaded because the scheme is blocked by policy: " | 337 VLOG(1) << "URL not loaded because the scheme is blocked by policy: " |
338 << entry->GetURL(); | 338 << entry->GetURL(); |
339 delete entry; | 339 delete entry; |
340 return; | 340 return; |
341 } | 341 } |
342 | 342 |
343 // When navigating to a new page, we don't know for sure if we will actually | 343 // When navigating to a new page, we don't know for sure if we will actually |
344 // end up leaving the current page. The new page load could for example | 344 // end up leaving the current page. The new page load could for example |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 for (int i = 0; i < max_index; i++) { | 1403 for (int i = 0; i < max_index; i++) { |
1404 // When cloning a tab, copy all entries except interstitial pages | 1404 // When cloning a tab, copy all entries except interstitial pages |
1405 if (source.entries_[i].get()->GetPageType() != | 1405 if (source.entries_[i].get()->GetPageType() != |
1406 content::PAGE_TYPE_INTERSTITIAL) { | 1406 content::PAGE_TYPE_INTERSTITIAL) { |
1407 entries_.insert(entries_.begin() + insert_index++, | 1407 entries_.insert(entries_.begin() + insert_index++, |
1408 linked_ptr<NavigationEntryImpl>( | 1408 linked_ptr<NavigationEntryImpl>( |
1409 new NavigationEntryImpl(*source.entries_[i]))); | 1409 new NavigationEntryImpl(*source.entries_[i]))); |
1410 } | 1410 } |
1411 } | 1411 } |
1412 } | 1412 } |
OLD | NEW |