OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/tab_contents/navigation_entry.h" | 5 #include "content/browser/tab_contents/navigation_entry.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
12 #include "content/browser/site_instance.h" | 12 #include "content/browser/site_instance.h" |
13 #include "content/browser/tab_contents/navigation_controller.h" | 13 #include "content/browser/tab_contents/navigation_controller.h" |
| 14 #include "content/common/content_constants.h" |
14 #include "grit/app_resources.h" | 15 #include "grit/app_resources.h" |
15 #include "net/base/net_util.h" | 16 #include "net/base/net_util.h" |
16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/base/text/text_elider.h" | 18 #include "ui/base/text/text_elider.h" |
18 | 19 |
19 // Use this to get a new unique ID for a NavigationEntry during construction. | 20 // Use this to get a new unique ID for a NavigationEntry during construction. |
20 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). | 21 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). |
21 static int GetUniqueID() { | 22 static int GetUniqueID() { |
22 static int unique_id_counter = 0; | 23 static int unique_id_counter = 0; |
23 return ++unique_id_counter; | 24 return ++unique_id_counter; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 title = net::FormatUrl(url_, languages); | 96 title = net::FormatUrl(url_, languages); |
96 } | 97 } |
97 | 98 |
98 // For file:// URLs use the filename as the title, not the full path. | 99 // For file:// URLs use the filename as the title, not the full path. |
99 if (url_.SchemeIsFile()) { | 100 if (url_.SchemeIsFile()) { |
100 string16::size_type slashpos = title.rfind('/'); | 101 string16::size_type slashpos = title.rfind('/'); |
101 if (slashpos != string16::npos) | 102 if (slashpos != string16::npos) |
102 title = title.substr(slashpos + 1); | 103 title = title.substr(slashpos + 1); |
103 } | 104 } |
104 | 105 |
105 ui::ElideString(title, chrome::kMaxTitleChars, &cached_display_title_); | 106 ui::ElideString(title, content::kMaxTitleChars, &cached_display_title_); |
106 return cached_display_title_; | 107 return cached_display_title_; |
107 } | 108 } |
108 | 109 |
109 bool NavigationEntry::IsViewSourceMode() const { | 110 bool NavigationEntry::IsViewSourceMode() const { |
110 return virtual_url_.SchemeIs(chrome::kViewSourceScheme); | 111 return virtual_url_.SchemeIs(chrome::kViewSourceScheme); |
111 } | 112 } |
OLD | NEW |