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 3613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3624 NSMutableDictionary* mutableInfo = [NSMutableDictionary dictionary]; | 3624 NSMutableDictionary* mutableInfo = [NSMutableDictionary dictionary]; |
3625 NSString* title = nil; | 3625 NSString* title = nil; |
3626 std::string href; | 3626 std::string href; |
3627 if (element->GetString("href", &href)) { | 3627 if (element->GetString("href", &href)) { |
3628 mutableInfo[web::kContextLinkURLString] = base::SysUTF8ToNSString(href); | 3628 mutableInfo[web::kContextLinkURLString] = base::SysUTF8ToNSString(href); |
3629 GURL linkURL(href); | 3629 GURL linkURL(href); |
3630 if (linkURL.SchemeIs(url::kJavaScriptScheme)) { | 3630 if (linkURL.SchemeIs(url::kJavaScriptScheme)) { |
3631 title = @"JavaScript"; | 3631 title = @"JavaScript"; |
3632 } else { | 3632 } else { |
3633 DCHECK(web::GetWebClient()); | 3633 DCHECK(web::GetWebClient()); |
3634 const std::string& acceptLangs = web::GetWebClient()->GetAcceptLangs( | 3634 base::string16 urlText = url_formatter::FormatUrl(GURL(href)); |
3635 self.webStateImpl->GetBrowserState()); | |
3636 base::string16 urlText = | |
3637 url_formatter::FormatUrl(GURL(href), acceptLangs); | |
3638 title = base::SysUTF16ToNSString(urlText); | 3635 title = base::SysUTF16ToNSString(urlText); |
3639 } | 3636 } |
3640 } | 3637 } |
3641 std::string src; | 3638 std::string src; |
3642 if (element->GetString("src", &src)) { | 3639 if (element->GetString("src", &src)) { |
3643 mutableInfo[web::kContextImageURLString] = base::SysUTF8ToNSString(src); | 3640 mutableInfo[web::kContextImageURLString] = base::SysUTF8ToNSString(src); |
3644 if (!title) | 3641 if (!title) |
3645 title = base::SysUTF8ToNSString(src); | 3642 title = base::SysUTF8ToNSString(src); |
3646 if ([title hasPrefix:@"data:"]) | 3643 if ([title hasPrefix:@"data:"]) |
3647 title = @""; | 3644 title = @""; |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3935 if ([MIMEType isEqualToString:@"text/html"] || | 3932 if ([MIMEType isEqualToString:@"text/html"] || |
3936 [MIMEType isEqualToString:@"application/xhtml+xml"] || | 3933 [MIMEType isEqualToString:@"application/xhtml+xml"] || |
3937 [MIMEType isEqualToString:@"application/xml"]) { | 3934 [MIMEType isEqualToString:@"application/xml"]) { |
3938 return web::WEB_VIEW_DOCUMENT_TYPE_HTML; | 3935 return web::WEB_VIEW_DOCUMENT_TYPE_HTML; |
3939 } | 3936 } |
3940 | 3937 |
3941 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 3938 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
3942 } | 3939 } |
3943 | 3940 |
3944 @end | 3941 @end |
OLD | NEW |