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" |
11 #include "base/strings/string_number_conversions.h" // Temporary | 11 #include "base/strings/string_number_conversions.h" // Temporary |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
16 #include "cc/base/switches.h" | 16 #include "cc/base/switches.h" |
| 17 #include "components/mime_util/mime_util.h" |
17 #include "content/browser/bad_message.h" | 18 #include "content/browser/bad_message.h" |
18 #include "content/browser/browser_url_handler_impl.h" | 19 #include "content/browser/browser_url_handler_impl.h" |
19 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 20 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
20 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 21 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
21 #include "content/browser/frame_host/debug_urls.h" | 22 #include "content/browser/frame_host/debug_urls.h" |
22 #include "content/browser/frame_host/interstitial_page_impl.h" | 23 #include "content/browser/frame_host/interstitial_page_impl.h" |
23 #include "content/browser/frame_host/navigation_entry_impl.h" | 24 #include "content/browser/frame_host/navigation_entry_impl.h" |
24 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" | 25 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" |
25 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary | 26 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary |
26 #include "content/browser/site_instance_impl.h" | 27 #include "content/browser/site_instance_impl.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 } | 487 } |
487 | 488 |
488 NavigationEntryImpl* NavigationControllerImpl::GetLastCommittedEntry() const { | 489 NavigationEntryImpl* NavigationControllerImpl::GetLastCommittedEntry() const { |
489 if (last_committed_entry_index_ == -1) | 490 if (last_committed_entry_index_ == -1) |
490 return NULL; | 491 return NULL; |
491 return entries_[last_committed_entry_index_].get(); | 492 return entries_[last_committed_entry_index_].get(); |
492 } | 493 } |
493 | 494 |
494 bool NavigationControllerImpl::CanViewSource() const { | 495 bool NavigationControllerImpl::CanViewSource() const { |
495 const std::string& mime_type = delegate_->GetContentsMimeType(); | 496 const std::string& mime_type = delegate_->GetContentsMimeType(); |
496 bool is_viewable_mime_type = net::IsSupportedNonImageMimeType(mime_type) && | 497 bool is_viewable_mime_type = |
| 498 mime_util::IsSupportedNonImageMimeType(mime_type) && |
497 !net::IsSupportedMediaMimeType(mime_type); | 499 !net::IsSupportedMediaMimeType(mime_type); |
498 NavigationEntry* visible_entry = GetVisibleEntry(); | 500 NavigationEntry* visible_entry = GetVisibleEntry(); |
499 return visible_entry && !visible_entry->IsViewSourceMode() && | 501 return visible_entry && !visible_entry->IsViewSourceMode() && |
500 is_viewable_mime_type && !delegate_->GetInterstitialPage(); | 502 is_viewable_mime_type && !delegate_->GetInterstitialPage(); |
501 } | 503 } |
502 | 504 |
503 int NavigationControllerImpl::GetLastCommittedEntryIndex() const { | 505 int NavigationControllerImpl::GetLastCommittedEntryIndex() const { |
504 return last_committed_entry_index_; | 506 return last_committed_entry_index_; |
505 } | 507 } |
506 | 508 |
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1860 } | 1862 } |
1861 } | 1863 } |
1862 } | 1864 } |
1863 | 1865 |
1864 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1866 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1865 const base::Callback<base::Time()>& get_timestamp_callback) { | 1867 const base::Callback<base::Time()>& get_timestamp_callback) { |
1866 get_timestamp_callback_ = get_timestamp_callback; | 1868 get_timestamp_callback_ = get_timestamp_callback; |
1867 } | 1869 } |
1868 | 1870 |
1869 } // namespace content | 1871 } // namespace content |
OLD | NEW |