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/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 2617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2628 const base::string16& title) { | 2628 const base::string16& title) { |
2629 // For file URLs without a title, use the pathname instead. In the case of a | 2629 // For file URLs without a title, use the pathname instead. In the case of a |
2630 // synthesized title, we don't want the update to count toward the "one set | 2630 // synthesized title, we don't want the update to count toward the "one set |
2631 // per page of the title to history." | 2631 // per page of the title to history." |
2632 base::string16 final_title; | 2632 base::string16 final_title; |
2633 bool explicit_set; | 2633 bool explicit_set; |
2634 if (entry && entry->GetURL().SchemeIsFile() && title.empty()) { | 2634 if (entry && entry->GetURL().SchemeIsFile() && title.empty()) { |
2635 final_title = base::UTF8ToUTF16(entry->GetURL().ExtractFileName()); | 2635 final_title = base::UTF8ToUTF16(entry->GetURL().ExtractFileName()); |
2636 explicit_set = false; // Don't count synthetic titles toward the set limit. | 2636 explicit_set = false; // Don't count synthetic titles toward the set limit. |
2637 } else { | 2637 } else { |
2638 TrimWhitespace(title, TRIM_ALL, &final_title); | 2638 base::TrimWhitespace(title, base::TRIM_ALL, &final_title); |
2639 explicit_set = true; | 2639 explicit_set = true; |
2640 } | 2640 } |
2641 | 2641 |
2642 // If a page is created via window.open and never navigated, | 2642 // If a page is created via window.open and never navigated, |
2643 // there will be no navigation entry. In this situation, | 2643 // there will be no navigation entry. In this situation, |
2644 // |page_title_when_no_navigation_entry_| will be used for page title. | 2644 // |page_title_when_no_navigation_entry_| will be used for page title. |
2645 if (entry) { | 2645 if (entry) { |
2646 if (final_title == entry->GetTitle()) | 2646 if (final_title == entry->GetTitle()) |
2647 return false; // Nothing changed, don't bother. | 2647 return false; // Nothing changed, don't bother. |
2648 | 2648 |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3662 | 3662 |
3663 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3663 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
3664 if (!delegate_) | 3664 if (!delegate_) |
3665 return; | 3665 return; |
3666 const gfx::Size new_size = GetPreferredSize(); | 3666 const gfx::Size new_size = GetPreferredSize(); |
3667 if (new_size != old_size) | 3667 if (new_size != old_size) |
3668 delegate_->UpdatePreferredSize(this, new_size); | 3668 delegate_->UpdatePreferredSize(this, new_size); |
3669 } | 3669 } |
3670 | 3670 |
3671 } // namespace content | 3671 } // namespace content |
OLD | NEW |