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 DCHECK(data_url.SchemeIs(chrome::kDataScheme)); | |
Charlie Reis
2012/07/03 17:54:37
Alternatively, just put a NOTREACHED inside the "i
mnaganov (inactive)
2012/07/04 15:25:57
Done, thanks for the suggestion.
| |
635 if (!data_url.SchemeIs(chrome::kDataScheme)) | |
636 return; | |
637 | |
638 needs_reload_ = false; | |
639 | |
640 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( | |
641 CreateNavigationEntry( | |
642 data_url, | |
643 referrer, | |
644 content::PAGE_TRANSITION_TYPED, | |
645 false, | |
646 std::string(), | |
647 browser_context_)); | |
648 entry->SetIsOverridingUserAgent(is_overriding_user_agent); | |
649 entry->SetBaseURLForDataURL(base_url); | |
650 entry->SetVirtualURL(history_url); | |
651 | |
652 LoadEntry(entry); | |
653 } | |
654 | |
626 void NavigationControllerImpl::DocumentLoadedInFrame() { | 655 void NavigationControllerImpl::DocumentLoadedInFrame() { |
627 last_document_loaded_ = base::TimeTicks::Now(); | 656 last_document_loaded_ = base::TimeTicks::Now(); |
628 } | 657 } |
629 | 658 |
630 bool NavigationControllerImpl::RendererDidNavigate( | 659 bool NavigationControllerImpl::RendererDidNavigate( |
631 const ViewHostMsg_FrameNavigate_Params& params, | 660 const ViewHostMsg_FrameNavigate_Params& params, |
632 content::LoadCommittedDetails* details) { | 661 content::LoadCommittedDetails* details) { |
633 | 662 |
634 // Save the previous state before we clobber it. | 663 // Save the previous state before we clobber it. |
635 if (GetLastCommittedEntry()) { | 664 if (GetLastCommittedEntry()) { |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1454 for (int i = 0; i < max_index; i++) { | 1483 for (int i = 0; i < max_index; i++) { |
1455 // When cloning a tab, copy all entries except interstitial pages | 1484 // When cloning a tab, copy all entries except interstitial pages |
1456 if (source.entries_[i].get()->GetPageType() != | 1485 if (source.entries_[i].get()->GetPageType() != |
1457 content::PAGE_TYPE_INTERSTITIAL) { | 1486 content::PAGE_TYPE_INTERSTITIAL) { |
1458 entries_.insert(entries_.begin() + insert_index++, | 1487 entries_.insert(entries_.begin() + insert_index++, |
1459 linked_ptr<NavigationEntryImpl>( | 1488 linked_ptr<NavigationEntryImpl>( |
1460 new NavigationEntryImpl(*source.entries_[i]))); | 1489 new NavigationEntryImpl(*source.entries_[i]))); |
1461 } | 1490 } |
1462 } | 1491 } |
1463 } | 1492 } |
OLD | NEW |