OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 #include "content/public/browser/navigation_details.h" | 33 #include "content/public/browser/navigation_details.h" |
34 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
35 #include "content/public/browser/notification_types.h" | 35 #include "content/public/browser/notification_types.h" |
36 #include "content/public/browser/render_widget_host.h" | 36 #include "content/public/browser/render_widget_host.h" |
37 #include "content/public/browser/render_widget_host_view.h" | 37 #include "content/public/browser/render_widget_host_view.h" |
38 #include "content/public/browser/storage_partition.h" | 38 #include "content/public/browser/storage_partition.h" |
39 #include "content/public/browser/user_metrics.h" | 39 #include "content/public/browser/user_metrics.h" |
40 #include "content/public/common/content_client.h" | 40 #include "content/public/common/content_client.h" |
41 #include "content/public/common/content_constants.h" | 41 #include "content/public/common/content_constants.h" |
42 #include "content/public/common/content_switches.h" | 42 #include "content/public/common/content_switches.h" |
43 #include "media/base/mime_util.h" | |
43 #include "net/base/escape.h" | 44 #include "net/base/escape.h" |
44 #include "net/base/mime_util.h" | |
45 #include "net/base/net_util.h" | 45 #include "net/base/net_util.h" |
46 #include "skia/ext/platform_canvas.h" | 46 #include "skia/ext/platform_canvas.h" |
47 #include "url/url_constants.h" | 47 #include "url/url_constants.h" |
48 | 48 |
49 namespace content { | 49 namespace content { |
50 namespace { | 50 namespace { |
51 | 51 |
52 // Invoked when entries have been pruned, or removed. For example, if the | 52 // Invoked when entries have been pruned, or removed. For example, if the |
53 // current entries are [google, digg, yahoo], with the current entry google, | 53 // current entries are [google, digg, yahoo], with the current entry google, |
54 // and the user types in cnet, then digg and yahoo are pruned. | 54 // and the user types in cnet, then digg and yahoo are pruned. |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 NavigationEntryImpl* NavigationControllerImpl::GetLastCommittedEntry() const { | 489 NavigationEntryImpl* NavigationControllerImpl::GetLastCommittedEntry() const { |
490 if (last_committed_entry_index_ == -1) | 490 if (last_committed_entry_index_ == -1) |
491 return NULL; | 491 return NULL; |
492 return entries_[last_committed_entry_index_].get(); | 492 return entries_[last_committed_entry_index_].get(); |
493 } | 493 } |
494 | 494 |
495 bool NavigationControllerImpl::CanViewSource() const { | 495 bool NavigationControllerImpl::CanViewSource() const { |
496 const std::string& mime_type = delegate_->GetContentsMimeType(); | 496 const std::string& mime_type = delegate_->GetContentsMimeType(); |
497 bool is_viewable_mime_type = | 497 bool is_viewable_mime_type = |
498 mime_util::IsSupportedNonImageMimeType(mime_type) && | 498 mime_util::IsSupportedNonImageMimeType(mime_type) && |
499 !net::IsSupportedMediaMimeType(mime_type); | 499 !media::IsSupportedMediaMimeType(mime_type); |
500 NavigationEntry* visible_entry = GetVisibleEntry(); | 500 NavigationEntry* visible_entry = GetVisibleEntry(); |
501 return visible_entry && !visible_entry->IsViewSourceMode() && | 501 return visible_entry && !visible_entry->IsViewSourceMode() && |
502 is_viewable_mime_type && !delegate_->GetInterstitialPage(); | 502 is_viewable_mime_type && !delegate_->GetInterstitialPage(); |
503 } | 503 } |
504 | 504 |
505 int NavigationControllerImpl::GetLastCommittedEntryIndex() const { | 505 int NavigationControllerImpl::GetLastCommittedEntryIndex() const { |
506 return last_committed_entry_index_; | 506 return last_committed_entry_index_; |
507 } | 507 } |
508 | 508 |
509 int NavigationControllerImpl::GetEntryCount() const { | 509 int NavigationControllerImpl::GetEntryCount() const { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
748 entry->SetRedirectChain(params.redirect_chain); | 748 entry->SetRedirectChain(params.redirect_chain); |
749 // Don't allow an entry replacement if there is no entry to replace. | 749 // Don't allow an entry replacement if there is no entry to replace. |
750 // http://crbug.com/457149 | 750 // http://crbug.com/457149 |
751 if (params.should_replace_current_entry && entries_.size() > 0) | 751 if (params.should_replace_current_entry && entries_.size() > 0) |
752 entry->set_should_replace_entry(true); | 752 entry->set_should_replace_entry(true); |
753 entry->set_should_clear_history_list(params.should_clear_history_list); | 753 entry->set_should_clear_history_list(params.should_clear_history_list); |
754 entry->SetIsOverridingUserAgent(override); | 754 entry->SetIsOverridingUserAgent(override); |
755 entry->set_transferred_global_request_id( | 755 entry->set_transferred_global_request_id( |
756 params.transferred_global_request_id); | 756 params.transferred_global_request_id); |
757 | 757 |
758 #if defined(OS_ANDROID) | 758 #if defined(OS_ANDROID) |
ddorwin
2015/05/08 16:29:18
#include "build/build_config.h"
servolk
2015/05/08 17:33:04
Done.
| |
759 if (params.intent_received_timestamp > 0) { | 759 if (params.intent_received_timestamp > 0) { |
760 entry->set_intent_received_timestamp( | 760 entry->set_intent_received_timestamp( |
761 base::TimeTicks() + | 761 base::TimeTicks() + |
762 base::TimeDelta::FromMilliseconds(params.intent_received_timestamp)); | 762 base::TimeDelta::FromMilliseconds(params.intent_received_timestamp)); |
763 } | 763 } |
764 #endif | 764 #endif |
765 | 765 |
766 switch (params.load_type) { | 766 switch (params.load_type) { |
767 case LOAD_TYPE_DEFAULT: | 767 case LOAD_TYPE_DEFAULT: |
768 break; | 768 break; |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1866 } | 1866 } |
1867 } | 1867 } |
1868 } | 1868 } |
1869 | 1869 |
1870 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1870 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1871 const base::Callback<base::Time()>& get_timestamp_callback) { | 1871 const base::Callback<base::Time()>& get_timestamp_callback) { |
1872 get_timestamp_callback_ = get_timestamp_callback; | 1872 get_timestamp_callback_ = get_timestamp_callback; |
1873 } | 1873 } |
1874 | 1874 |
1875 } // namespace content | 1875 } // namespace content |
OLD | NEW |