Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1588)

Unified Diff: ios/web/webui/crw_web_ui_manager.mm

Issue 2583963002: Remove WebUI favicon support on iOS (Closed)
Patch Set: Remove web_ui_favicons.js from BUILD.gn Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/BUILD.gn ('k') | ios/web/webui/crw_web_ui_manager_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/webui/crw_web_ui_manager.mm
diff --git a/ios/web/webui/crw_web_ui_manager.mm b/ios/web/webui/crw_web_ui_manager.mm
index 810060639ad7c4ca39ed208741d4cd62b0d0f5d9..d7660f7a3b25308ff472dfea7da68b2d9ba8e651 100644
--- a/ios/web/webui/crw_web_ui_manager.mm
+++ b/ios/web/webui/crw_web_ui_manager.mm
@@ -30,7 +30,7 @@
#endif
namespace {
-// Prefix for history.requestFavicon JavaScript message.
+// Prefix for JavaScript messages.
const char kScriptCommandPrefix[] = "webui";
}
@@ -51,9 +51,6 @@ const char kScriptCommandPrefix[] = "webui";
// Handles JavaScript message from the WebUI page.
- (BOOL)handleWebUIJSMessage:(const base::DictionaryValue&)message;
-// Handles webui.requestFavicon JavaScript message from the WebUI page.
-- (BOOL)handleRequestFavicon:(const base::ListValue*)arguments;
-
// Handles webui.loadMojo JavaScript message from the WebUI page.
- (BOOL)handleLoadMojo:(const base::ListValue*)arguments;
@@ -197,8 +194,6 @@ const char kScriptCommandPrefix[] = "webui";
return NO;
}
- if (command == "webui.requestFavicon")
- return [self handleRequestFavicon:arguments];
if (command == "webui.loadMojo")
return [self handleLoadMojo:arguments];
@@ -206,33 +201,6 @@ const char kScriptCommandPrefix[] = "webui";
return NO;
}
-- (BOOL)handleRequestFavicon:(const base::ListValue*)arguments {
- std::string favicon;
- if (!arguments->GetString(0, &favicon)) {
- DLOG(WARNING) << "JS message parameter not found: Favicon URL";
- return NO;
- }
- GURL faviconURL(favicon);
- DCHECK(faviconURL.is_valid());
- // Retrieve favicon resource and set favicon background image via JavaScript.
- base::WeakNSObject<CRWWebUIManager> weakSelf(self);
- void (^faviconHandler)(NSData*) = ^void(NSData* data) {
- base::scoped_nsobject<CRWWebUIManager> strongSelf(weakSelf);
- if (!strongSelf)
- return;
- NSString* base64EncodedResource = [data base64EncodedStringWithOptions:0];
- NSString* dataURLString = [NSString
- stringWithFormat:@"data:image/png;base64,%@", base64EncodedResource];
- NSString* faviconURLString = base::SysUTF8ToNSString(faviconURL.spec());
- NSString* script =
- [NSString stringWithFormat:@"chrome.setFaviconBackground('%@', '%@');",
- faviconURLString, dataURLString];
- [strongSelf webState]->ExecuteJavaScript(base::SysNSStringToUTF16(script));
- };
- [self fetchResourceWithURL:faviconURL completionHandler:faviconHandler];
- return YES;
-}
-
- (BOOL)handleLoadMojo:(const base::ListValue*)arguments {
std::string moduleName;
if (!arguments->GetString(0, &moduleName)) {
« no previous file with comments | « ios/web/BUILD.gn ('k') | ios/web/webui/crw_web_ui_manager_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698