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/web_contents/navigation_controller_impl.h" | 5 #include "content/browser/web_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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
23 #include "content/common/view_messages.h" | 23 #include "content/common/view_messages.h" |
24 #include "content/public/browser/browser_context.h" | 24 #include "content/public/browser/browser_context.h" |
25 #include "content/public/browser/invalidate_type.h" | 25 #include "content/public/browser/invalidate_type.h" |
26 #include "content/public/browser/navigation_details.h" | 26 #include "content/public/browser/navigation_details.h" |
27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
28 #include "content/public/browser/notification_types.h" | 28 #include "content/public/browser/notification_types.h" |
29 #include "content/public/browser/user_metrics.h" | 29 #include "content/public/browser/user_metrics.h" |
30 #include "content/public/browser/web_contents_delegate.h" | 30 #include "content/public/browser/web_contents_delegate.h" |
31 #include "content/public/common/content_constants.h" | 31 #include "content/public/common/content_constants.h" |
| 32 #include "content/public/common/url_constants.h" |
32 #include "net/base/escape.h" | 33 #include "net/base/escape.h" |
33 #include "net/base/mime_util.h" | 34 #include "net/base/mime_util.h" |
34 #include "net/base/net_util.h" | 35 #include "net/base/net_util.h" |
35 #include "webkit/glue/webkit_glue.h" | 36 #include "webkit/glue/webkit_glue.h" |
36 | 37 |
37 using content::BrowserContext; | 38 using content::BrowserContext; |
38 using content::DOMStorageContext; | 39 using content::DOMStorageContext; |
39 using content::GlobalRequestID; | 40 using content::GlobalRequestID; |
40 using content::NavigationController; | 41 using content::NavigationController; |
41 using content::NavigationEntry; | 42 using content::NavigationEntry; |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 | 617 |
617 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( | 618 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
618 CreateNavigationEntry( | 619 CreateNavigationEntry( |
619 url, referrer, transition, is_renderer_initiated, extra_headers, | 620 url, referrer, transition, is_renderer_initiated, extra_headers, |
620 browser_context_)); | 621 browser_context_)); |
621 entry->SetIsOverridingUserAgent(is_overriding_user_agent); | 622 entry->SetIsOverridingUserAgent(is_overriding_user_agent); |
622 | 623 |
623 LoadEntry(entry); | 624 LoadEntry(entry); |
624 } | 625 } |
625 | 626 |
| 627 void NavigationControllerImpl::LoadDataWithBaseURL( |
| 628 const GURL& data_url, |
| 629 const content::Referrer& referrer, |
| 630 const GURL& base_url, |
| 631 const GURL& history_url, |
| 632 bool is_overriding_user_agent) { |
| 633 // Make sure we don't allow non-'data:' URLs. |
| 634 if (!data_url.SchemeIs(chrome::kDataScheme)) { |
| 635 NOTREACHED(); |
| 636 return; |
| 637 } |
| 638 |
| 639 needs_reload_ = false; |
| 640 |
| 641 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
| 642 CreateNavigationEntry( |
| 643 data_url, |
| 644 referrer, |
| 645 content::PAGE_TRANSITION_TYPED, |
| 646 false, |
| 647 std::string(), |
| 648 browser_context_)); |
| 649 entry->SetIsOverridingUserAgent(is_overriding_user_agent); |
| 650 entry->SetBaseURLForDataURL(base_url); |
| 651 entry->SetVirtualURL(history_url); |
| 652 |
| 653 LoadEntry(entry); |
| 654 } |
| 655 |
626 void NavigationControllerImpl::DocumentLoadedInFrame() { | 656 void NavigationControllerImpl::DocumentLoadedInFrame() { |
627 last_document_loaded_ = base::TimeTicks::Now(); | 657 last_document_loaded_ = base::TimeTicks::Now(); |
628 } | 658 } |
629 | 659 |
630 bool NavigationControllerImpl::RendererDidNavigate( | 660 bool NavigationControllerImpl::RendererDidNavigate( |
631 const ViewHostMsg_FrameNavigate_Params& params, | 661 const ViewHostMsg_FrameNavigate_Params& params, |
632 content::LoadCommittedDetails* details) { | 662 content::LoadCommittedDetails* details) { |
633 | 663 |
634 // Save the previous state before we clobber it. | 664 // Save the previous state before we clobber it. |
635 if (GetLastCommittedEntry()) { | 665 if (GetLastCommittedEntry()) { |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 for (int i = 0; i < max_index; i++) { | 1484 for (int i = 0; i < max_index; i++) { |
1455 // When cloning a tab, copy all entries except interstitial pages | 1485 // When cloning a tab, copy all entries except interstitial pages |
1456 if (source.entries_[i].get()->GetPageType() != | 1486 if (source.entries_[i].get()->GetPageType() != |
1457 content::PAGE_TYPE_INTERSTITIAL) { | 1487 content::PAGE_TYPE_INTERSTITIAL) { |
1458 entries_.insert(entries_.begin() + insert_index++, | 1488 entries_.insert(entries_.begin() + insert_index++, |
1459 linked_ptr<NavigationEntryImpl>( | 1489 linked_ptr<NavigationEntryImpl>( |
1460 new NavigationEntryImpl(*source.entries_[i]))); | 1490 new NavigationEntryImpl(*source.entries_[i]))); |
1461 } | 1491 } |
1462 } | 1492 } |
1463 } | 1493 } |
OLD | NEW |