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

Side by Side Diff: content/child/notifications/notification_data_conversions.cc

Issue 1644573002: Notification actions may have an icon url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address peter's comments. Created 4 years, 10 months 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 unified diff | Download patch
OLDNEW
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 #include "content/child/notifications/notification_data_conversions.h" 5 #include "content/child/notifications/notification_data_conversions.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "third_party/WebKit/public/platform/URLConversion.h" 10 #include "third_party/WebKit/public/platform/URLConversion.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 platform_data.vibration_pattern.assign(web_data.vibrate.begin(), 43 platform_data.vibration_pattern.assign(web_data.vibrate.begin(),
44 web_data.vibrate.end()); 44 web_data.vibrate.end());
45 platform_data.silent = web_data.silent; 45 platform_data.silent = web_data.silent;
46 platform_data.require_interaction = web_data.requireInteraction; 46 platform_data.require_interaction = web_data.requireInteraction;
47 platform_data.data.assign(web_data.data.begin(), web_data.data.end()); 47 platform_data.data.assign(web_data.data.begin(), web_data.data.end());
48 platform_data.actions.resize(web_data.actions.size()); 48 platform_data.actions.resize(web_data.actions.size());
49 for (size_t i = 0; i < web_data.actions.size(); ++i) { 49 for (size_t i = 0; i < web_data.actions.size(); ++i) {
50 platform_data.actions[i].action = 50 platform_data.actions[i].action =
51 base::UTF16ToUTF8(base::StringPiece16(web_data.actions[i].action)); 51 base::UTF16ToUTF8(base::StringPiece16(web_data.actions[i].action));
52 platform_data.actions[i].title = web_data.actions[i].title; 52 platform_data.actions[i].title = web_data.actions[i].title;
53 platform_data.actions[i].icon =
54 blink::WebStringToGURL(web_data.actions[i].icon.string());
Peter Beverloo 2016/01/27 17:14:23 PTAL at content/child/notifications/notification_d
jochen (gone - plz use gerrit) 2016/01/28 12:12:24 should there be a max length of the URL?
Michael van Ouwerkerk 2016/02/01 14:39:22 Are you asking because this might be too large for
Michael van Ouwerkerk 2016/02/01 14:39:23 Done.
53 } 55 }
54 56
55 return platform_data; 57 return platform_data;
56 } 58 }
57 59
58 WebNotificationData ToWebNotificationData( 60 WebNotificationData ToWebNotificationData(
59 const PlatformNotificationData& platform_data) { 61 const PlatformNotificationData& platform_data) {
60 WebNotificationData web_data; 62 WebNotificationData web_data;
61 web_data.title = platform_data.title; 63 web_data.title = platform_data.title;
62 64
(...skipping 17 matching lines...) Expand all
80 web_data.silent = platform_data.silent; 82 web_data.silent = platform_data.silent;
81 web_data.requireInteraction = platform_data.require_interaction; 83 web_data.requireInteraction = platform_data.require_interaction;
82 web_data.data = platform_data.data; 84 web_data.data = platform_data.data;
83 blink::WebVector<blink::WebNotificationAction> resized( 85 blink::WebVector<blink::WebNotificationAction> resized(
84 platform_data.actions.size()); 86 platform_data.actions.size());
85 web_data.actions.swap(resized); 87 web_data.actions.swap(resized);
86 for (size_t i = 0; i < platform_data.actions.size(); ++i) { 88 for (size_t i = 0; i < platform_data.actions.size(); ++i) {
87 web_data.actions[i].action = 89 web_data.actions[i].action =
88 blink::WebString::fromUTF8(platform_data.actions[i].action); 90 blink::WebString::fromUTF8(platform_data.actions[i].action);
89 web_data.actions[i].title = platform_data.actions[i].title; 91 web_data.actions[i].title = platform_data.actions[i].title;
92 web_data.actions[i].icon = blink::WebURL(platform_data.actions[i].icon);
90 } 93 }
91 94
92 return web_data; 95 return web_data;
93 } 96 }
94 97
95 } // namespace content 98 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698