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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "content/public/browser/invalidate_type.h" | 30 #include "content/public/browser/invalidate_type.h" |
31 #include "content/public/browser/navigation_details.h" | 31 #include "content/public/browser/navigation_details.h" |
32 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
33 #include "content/public/browser/notification_types.h" | 33 #include "content/public/browser/notification_types.h" |
34 #include "content/public/browser/render_widget_host.h" | 34 #include "content/public/browser/render_widget_host.h" |
35 #include "content/public/browser/render_widget_host_view.h" | 35 #include "content/public/browser/render_widget_host_view.h" |
36 #include "content/public/browser/storage_partition.h" | 36 #include "content/public/browser/storage_partition.h" |
37 #include "content/public/browser/user_metrics.h" | 37 #include "content/public/browser/user_metrics.h" |
38 #include "content/public/common/content_client.h" | 38 #include "content/public/common/content_client.h" |
39 #include "content/public/common/content_constants.h" | 39 #include "content/public/common/content_constants.h" |
| 40 #include "media/base/mime_util.h" |
40 #include "net/base/escape.h" | 41 #include "net/base/escape.h" |
41 #include "net/base/mime_util.h" | |
42 #include "net/base/net_util.h" | 42 #include "net/base/net_util.h" |
43 #include "skia/ext/platform_canvas.h" | 43 #include "skia/ext/platform_canvas.h" |
44 #include "url/url_constants.h" | 44 #include "url/url_constants.h" |
45 | 45 |
46 namespace content { | 46 namespace content { |
47 namespace { | 47 namespace { |
48 | 48 |
49 const unsigned kInvalidateAll = 0xFFFFFFFF; | 49 const unsigned kInvalidateAll = 0xFFFFFFFF; |
50 | 50 |
51 // Invoked when entries have been pruned, or removed. For example, if the | 51 // Invoked when entries have been pruned, or removed. For example, if the |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 } | 476 } |
477 | 477 |
478 NavigationEntry* NavigationControllerImpl::GetLastCommittedEntry() const { | 478 NavigationEntry* NavigationControllerImpl::GetLastCommittedEntry() const { |
479 if (last_committed_entry_index_ == -1) | 479 if (last_committed_entry_index_ == -1) |
480 return NULL; | 480 return NULL; |
481 return entries_[last_committed_entry_index_].get(); | 481 return entries_[last_committed_entry_index_].get(); |
482 } | 482 } |
483 | 483 |
484 bool NavigationControllerImpl::CanViewSource() const { | 484 bool NavigationControllerImpl::CanViewSource() const { |
485 const std::string& mime_type = delegate_->GetContentsMimeType(); | 485 const std::string& mime_type = delegate_->GetContentsMimeType(); |
486 bool is_viewable_mime_type = net::IsSupportedNonImageMimeType(mime_type) && | 486 bool is_viewable_mime_type = net::IsSupportedNonImageMimeType(mime_type); |
487 !net::IsSupportedMediaMimeType(mime_type); | |
488 NavigationEntry* visible_entry = GetVisibleEntry(); | 487 NavigationEntry* visible_entry = GetVisibleEntry(); |
489 return visible_entry && !visible_entry->IsViewSourceMode() && | 488 return visible_entry && !visible_entry->IsViewSourceMode() && |
490 is_viewable_mime_type && !delegate_->GetInterstitialPage(); | 489 is_viewable_mime_type && !delegate_->GetInterstitialPage(); |
491 } | 490 } |
492 | 491 |
493 int NavigationControllerImpl::GetLastCommittedEntryIndex() const { | 492 int NavigationControllerImpl::GetLastCommittedEntryIndex() const { |
494 return last_committed_entry_index_; | 493 return last_committed_entry_index_; |
495 } | 494 } |
496 | 495 |
497 int NavigationControllerImpl::GetEntryCount() const { | 496 int NavigationControllerImpl::GetEntryCount() const { |
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 } | 1781 } |
1783 } | 1782 } |
1784 } | 1783 } |
1785 | 1784 |
1786 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1785 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1787 const base::Callback<base::Time()>& get_timestamp_callback) { | 1786 const base::Callback<base::Time()>& get_timestamp_callback) { |
1788 get_timestamp_callback_ = get_timestamp_callback; | 1787 get_timestamp_callback_ = get_timestamp_callback; |
1789 } | 1788 } |
1790 | 1789 |
1791 } // namespace content | 1790 } // namespace content |
OLD | NEW |