| 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_entry_impl.h" | 5 #include "content/browser/web_contents/navigation_entry_impl.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/public/common/content_constants.h" | 10 #include "content/public/common/content_constants.h" |
| 11 #include "content/public/common/url_constants.h" | 11 #include "content/public/common/url_constants.h" |
| 12 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
| 13 #include "ui/base/text/text_elider.h" | 13 #include "ui/gfx/text_elider.h" |
| 14 | 14 |
| 15 // Use this to get a new unique ID for a NavigationEntry during construction. | 15 // Use this to get a new unique ID for a NavigationEntry during construction. |
| 16 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). | 16 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). |
| 17 static int GetUniqueIDInConstructor() { | 17 static int GetUniqueIDInConstructor() { |
| 18 static int unique_id_counter = 0; | 18 static int unique_id_counter = 0; |
| 19 return ++unique_id_counter; | 19 return ++unique_id_counter; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace content { | 22 namespace content { |
| 23 | 23 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 title = net::FormatUrl(url_, languages); | 184 title = net::FormatUrl(url_, languages); |
| 185 } | 185 } |
| 186 | 186 |
| 187 // For file:// URLs use the filename as the title, not the full path. | 187 // For file:// URLs use the filename as the title, not the full path. |
| 188 if (url_.SchemeIsFile()) { | 188 if (url_.SchemeIsFile()) { |
| 189 string16::size_type slashpos = title.rfind('/'); | 189 string16::size_type slashpos = title.rfind('/'); |
| 190 if (slashpos != string16::npos) | 190 if (slashpos != string16::npos) |
| 191 title = title.substr(slashpos + 1); | 191 title = title.substr(slashpos + 1); |
| 192 } | 192 } |
| 193 | 193 |
| 194 ui::ElideString(title, kMaxTitleChars, &cached_display_title_); | 194 gfx::ElideString(title, kMaxTitleChars, &cached_display_title_); |
| 195 return cached_display_title_; | 195 return cached_display_title_; |
| 196 } | 196 } |
| 197 | 197 |
| 198 bool NavigationEntryImpl::IsViewSourceMode() const { | 198 bool NavigationEntryImpl::IsViewSourceMode() const { |
| 199 return virtual_url_.SchemeIs(kViewSourceScheme); | 199 return virtual_url_.SchemeIs(kViewSourceScheme); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void NavigationEntryImpl::SetTransitionType( | 202 void NavigationEntryImpl::SetTransitionType( |
| 203 PageTransition transition_type) { | 203 PageTransition transition_type) { |
| 204 transition_type_ = transition_type; | 204 transition_type_ = transition_type; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 } | 322 } |
| 323 | 323 |
| 324 void NavigationEntryImpl::SetScreenshotPNGData( | 324 void NavigationEntryImpl::SetScreenshotPNGData( |
| 325 scoped_refptr<base::RefCountedBytes> png_data) { | 325 scoped_refptr<base::RefCountedBytes> png_data) { |
| 326 screenshot_ = png_data; | 326 screenshot_ = png_data; |
| 327 if (screenshot_.get()) | 327 if (screenshot_.get()) |
| 328 UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); | 328 UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace content | 331 } // namespace content |
| OLD | NEW |