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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
435 return last_committed_entry_index_; | 435 return last_committed_entry_index_; |
436 } | 436 } |
437 | 437 |
438 NavigationEntry* NavigationControllerImpl::GetLastCommittedEntry() const { | 438 NavigationEntry* NavigationControllerImpl::GetLastCommittedEntry() const { |
439 if (last_committed_entry_index_ == -1) | 439 if (last_committed_entry_index_ == -1) |
440 return NULL; | 440 return NULL; |
441 return entries_[last_committed_entry_index_].get(); | 441 return entries_[last_committed_entry_index_].get(); |
442 } | 442 } |
443 | 443 |
444 bool NavigationControllerImpl::CanViewSource() const { | 444 bool NavigationControllerImpl::CanViewSource() const { |
445 bool is_supported_mime_type = net::IsSupportedNonImageMimeType( | 445 const std::string& mime_type = web_contents_->GetContentsMimeType().c_str(); |
Avi (use Gerrit)
2013/01/07 19:36:11
GetContentsMimeType() already returns a std::strin
wolenetz
2013/01/08 19:17:34
Good point. I'll upload another PS with this fixe
| |
446 web_contents_->GetContentsMimeType().c_str()); | 446 bool is_viewable_mime_type = net::IsSupportedNonImageMimeType(mime_type) && |
447 !net::IsSupportedMediaMimeType(mime_type); | |
447 NavigationEntry* active_entry = GetActiveEntry(); | 448 NavigationEntry* active_entry = GetActiveEntry(); |
448 return active_entry && !active_entry->IsViewSourceMode() && | 449 return active_entry && !active_entry->IsViewSourceMode() && |
449 is_supported_mime_type && !web_contents_->GetInterstitialPage(); | 450 is_viewable_mime_type && !web_contents_->GetInterstitialPage(); |
450 } | 451 } |
451 | 452 |
452 int NavigationControllerImpl::GetLastCommittedEntryIndex() const { | 453 int NavigationControllerImpl::GetLastCommittedEntryIndex() const { |
453 return last_committed_entry_index_; | 454 return last_committed_entry_index_; |
454 } | 455 } |
455 | 456 |
456 int NavigationControllerImpl::GetEntryCount() const { | 457 int NavigationControllerImpl::GetEntryCount() const { |
457 DCHECK(entries_.size() <= max_entry_count()); | 458 DCHECK(entries_.size() <= max_entry_count()); |
458 return static_cast<int>(entries_.size()); | 459 return static_cast<int>(entries_.size()); |
459 } | 460 } |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1676 } | 1677 } |
1677 } | 1678 } |
1678 } | 1679 } |
1679 | 1680 |
1680 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1681 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1681 const base::Callback<base::Time()>& get_timestamp_callback) { | 1682 const base::Callback<base::Time()>& get_timestamp_callback) { |
1682 get_timestamp_callback_ = get_timestamp_callback; | 1683 get_timestamp_callback_ = get_timestamp_callback; |
1683 } | 1684 } |
1684 | 1685 |
1685 } // namespace content | 1686 } // namespace content |
OLD | NEW |