OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "ios/web/web_state/ui/crw_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 3627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3638 NSMutableDictionary* mutableInfo = [NSMutableDictionary dictionary]; | 3638 NSMutableDictionary* mutableInfo = [NSMutableDictionary dictionary]; |
3639 NSString* title = nil; | 3639 NSString* title = nil; |
3640 std::string href; | 3640 std::string href; |
3641 if (element->GetString("href", &href)) { | 3641 if (element->GetString("href", &href)) { |
3642 mutableInfo[web::kContextLinkURLString] = base::SysUTF8ToNSString(href); | 3642 mutableInfo[web::kContextLinkURLString] = base::SysUTF8ToNSString(href); |
3643 GURL linkURL(href); | 3643 GURL linkURL(href); |
3644 if (linkURL.SchemeIs(url::kJavaScriptScheme)) { | 3644 if (linkURL.SchemeIs(url::kJavaScriptScheme)) { |
3645 title = @"JavaScript"; | 3645 title = @"JavaScript"; |
3646 } else { | 3646 } else { |
3647 DCHECK(web::GetWebClient()); | 3647 DCHECK(web::GetWebClient()); |
3648 const std::string& acceptLangs = web::GetWebClient()->GetAcceptLangs( | 3648 base::string16 urlText = url_formatter::FormatUrl(GURL(href)); |
3649 self.webStateImpl->GetBrowserState()); | |
3650 base::string16 urlText = | |
3651 url_formatter::FormatUrl(GURL(href), acceptLangs); | |
3652 title = base::SysUTF16ToNSString(urlText); | 3649 title = base::SysUTF16ToNSString(urlText); |
3653 } | 3650 } |
3654 } | 3651 } |
3655 std::string src; | 3652 std::string src; |
3656 if (element->GetString("src", &src)) { | 3653 if (element->GetString("src", &src)) { |
3657 mutableInfo[web::kContextImageURLString] = base::SysUTF8ToNSString(src); | 3654 mutableInfo[web::kContextImageURLString] = base::SysUTF8ToNSString(src); |
3658 if (!title) | 3655 if (!title) |
3659 title = base::SysUTF8ToNSString(src); | 3656 title = base::SysUTF8ToNSString(src); |
3660 if ([title hasPrefix:@"data:"]) | 3657 if ([title hasPrefix:@"data:"]) |
3661 title = @""; | 3658 title = @""; |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3949 if ([MIMEType isEqualToString:@"text/html"] || | 3946 if ([MIMEType isEqualToString:@"text/html"] || |
3950 [MIMEType isEqualToString:@"application/xhtml+xml"] || | 3947 [MIMEType isEqualToString:@"application/xhtml+xml"] || |
3951 [MIMEType isEqualToString:@"application/xml"]) { | 3948 [MIMEType isEqualToString:@"application/xml"]) { |
3952 return web::WEB_VIEW_DOCUMENT_TYPE_HTML; | 3949 return web::WEB_VIEW_DOCUMENT_TYPE_HTML; |
3953 } | 3950 } |
3954 | 3951 |
3955 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 3952 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
3956 } | 3953 } |
3957 | 3954 |
3958 @end | 3955 @end |
OLD | NEW |