OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ios/web/navigation/navigation_item_impl.h" | 5 #import "ios/web/navigation/navigation_item_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/strings/utf_string_conversions.h" |
13 #include "components/url_formatter/url_formatter.h" | 14 #include "components/url_formatter/url_formatter.h" |
14 #import "ios/web/navigation/navigation_manager_impl.h" | 15 #import "ios/web/navigation/navigation_manager_impl.h" |
15 #import "ios/web/public/web_client.h" | 16 #import "ios/web/public/web_client.h" |
16 #include "ui/base/page_transition_types.h" | 17 #include "ui/base/page_transition_types.h" |
17 #include "ui/gfx/text_elider.h" | 18 #include "ui/gfx/text_elider.h" |
18 | 19 |
19 #if !defined(__has_feature) || !__has_feature(objc_arc) | 20 #if !defined(__has_feature) || !__has_feature(objc_arc) |
20 #error "This file requires ARC support." | 21 #error "This file requires ARC support." |
21 #endif | 22 #endif |
22 | 23 |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 base::string16::size_type slashpos = title.rfind('/'); | 310 base::string16::size_type slashpos = title.rfind('/'); |
310 if (slashpos != base::string16::npos) | 311 if (slashpos != base::string16::npos) |
311 title = title.substr(slashpos + 1); | 312 title = title.substr(slashpos + 1); |
312 } | 313 } |
313 | 314 |
314 const size_t kMaxTitleChars = 4 * 1024; | 315 const size_t kMaxTitleChars = 4 * 1024; |
315 gfx::ElideString(title, kMaxTitleChars, &title); | 316 gfx::ElideString(title, kMaxTitleChars, &title); |
316 return title; | 317 return title; |
317 } | 318 } |
318 | 319 |
| 320 #ifndef NDEBUG |
| 321 NSString* NavigationItemImpl::GetDescription() const { |
| 322 return [NSString |
| 323 stringWithFormat: |
| 324 @"url:%s originalurl:%s title:%s transition:%d displayState:%@ " |
| 325 @"userAgentType:%s", |
| 326 url_.spec().c_str(), original_request_url_.spec().c_str(), |
| 327 base::UTF16ToUTF8(title_).c_str(), transition_type_, |
| 328 page_display_state_.GetDescription(), |
| 329 GetUserAgentTypeDescription(user_agent_type_).c_str()]; |
| 330 } |
| 331 #endif |
| 332 |
319 } // namespace web | 333 } // namespace web |
OLD | NEW |