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 2599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2610 const base::string16& title) { | 2610 const base::string16& title) { |
2611 // For file URLs without a title, use the pathname instead. In the case of a | 2611 // For file URLs without a title, use the pathname instead. In the case of a |
2612 // synthesized title, we don't want the update to count toward the "one set | 2612 // synthesized title, we don't want the update to count toward the "one set |
2613 // per page of the title to history." | 2613 // per page of the title to history." |
2614 base::string16 final_title; | 2614 base::string16 final_title; |
2615 bool explicit_set; | 2615 bool explicit_set; |
2616 if (entry && entry->GetURL().SchemeIsFile() && title.empty()) { | 2616 if (entry && entry->GetURL().SchemeIsFile() && title.empty()) { |
2617 final_title = base::UTF8ToUTF16(entry->GetURL().ExtractFileName()); | 2617 final_title = base::UTF8ToUTF16(entry->GetURL().ExtractFileName()); |
2618 explicit_set = false; // Don't count synthetic titles toward the set limit. | 2618 explicit_set = false; // Don't count synthetic titles toward the set limit. |
2619 } else { | 2619 } else { |
2620 TrimWhitespace(title, TRIM_ALL, &final_title); | 2620 base::TrimWhitespace(title, base::TRIM_ALL, &final_title); |
2621 explicit_set = true; | 2621 explicit_set = true; |
2622 } | 2622 } |
2623 | 2623 |
2624 // If a page is created via window.open and never navigated, | 2624 // If a page is created via window.open and never navigated, |
2625 // there will be no navigation entry. In this situation, | 2625 // there will be no navigation entry. In this situation, |
2626 // |page_title_when_no_navigation_entry_| will be used for page title. | 2626 // |page_title_when_no_navigation_entry_| will be used for page title. |
2627 if (entry) { | 2627 if (entry) { |
2628 if (final_title == entry->GetTitle()) | 2628 if (final_title == entry->GetTitle()) |
2629 return false; // Nothing changed, don't bother. | 2629 return false; // Nothing changed, don't bother. |
2630 | 2630 |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3644 | 3644 |
3645 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3645 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
3646 if (!delegate_) | 3646 if (!delegate_) |
3647 return; | 3647 return; |
3648 const gfx::Size new_size = GetPreferredSize(); | 3648 const gfx::Size new_size = GetPreferredSize(); |
3649 if (new_size != old_size) | 3649 if (new_size != old_size) |
3650 delegate_->UpdatePreferredSize(this, new_size); | 3650 delegate_->UpdatePreferredSize(this, new_size); |
3651 } | 3651 } |
3652 | 3652 |
3653 } // namespace content | 3653 } // namespace content |
OLD | NEW |