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 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1997 } | 1997 } |
1998 } | 1998 } |
1999 } | 1999 } |
2000 | 2000 |
2001 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2001 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
2002 const base::Callback<base::Time()>& get_timestamp_callback) { | 2002 const base::Callback<base::Time()>& get_timestamp_callback) { |
2003 get_timestamp_callback_ = get_timestamp_callback; | 2003 get_timestamp_callback_ = get_timestamp_callback; |
2004 } | 2004 } |
2005 | 2005 |
2006 } // namespace content | 2006 } // namespace content |
OLD | NEW |