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

Side by Side Diff: chrome/browser/notifications/notification_platform_bridge_mac.mm

Issue 2877053002: Relax the character limits before resorting to eTLD+1 (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/notifications/notification_platform_bridge_mac.h" 5 #include "chrome/browser/notifications/notification_platform_bridge_mac.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 // Mac OS notifications don't provide a good way to elide the domain (or tell 141 // Mac OS notifications don't provide a good way to elide the domain (or tell
142 // you the maximum width of the subtitle field). We have experimentally 142 // you the maximum width of the subtitle field). We have experimentally
143 // determined the maximum number of characters that fit using the widest 143 // determined the maximum number of characters that fit using the widest
144 // possible character (m). If the domain fits in those character we show it 144 // possible character (m). If the domain fits in those character we show it
145 // completely. Otherwise we use eTLD + 1. 145 // completely. Otherwise we use eTLD + 1.
146 146
147 // These numbers have been obtained through experimentation on various 147 // These numbers have been obtained through experimentation on various
148 // Mac OS platforms. 148 // Mac OS platforms.
149 149
150 // Corresponds to the string "mmmmmmmmmmmmmm" 150 constexpr size_t kMaxDomainLenghtAlert = 19;
151 constexpr size_t kMaxDomainLenghtAlert = 14; 151 constexpr size_t kMaxDomainLenghtBanner = 28;
152
153 // Corresponds to the string "mmmmmmmmmmmmmmmmmmmmm"
154 constexpr size_t kMaxDomainLenghtBanner = 21;
155 152
156 size_t max_characters = IsPersistentNotification(notification) 153 size_t max_characters = IsPersistentNotification(notification)
157 ? kMaxDomainLenghtAlert 154 ? kMaxDomainLenghtAlert
158 : kMaxDomainLenghtBanner; 155 : kMaxDomainLenghtBanner;
159 156
160 base::string16 origin = url_formatter::FormatOriginForSecurityDisplay( 157 base::string16 origin = url_formatter::FormatOriginForSecurityDisplay(
161 url::Origin(notification.origin_url()), 158 url::Origin(notification.origin_url()),
162 url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS); 159 url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS);
163 160
164 if (origin.size() <= max_characters) 161 if (origin.size() <= max_characters)
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 base::scoped_nsobject<CrXPCMachPort> xpcPort( 595 base::scoped_nsobject<CrXPCMachPort> xpcPort(
599 [[CrXPCMachPort alloc] initWithMachSendRight:std::move(exceptionPort)]); 596 [[CrXPCMachPort alloc] initWithMachSendRight:std::move(exceptionPort)]);
600 [proxy setMachExceptionPort:xpcPort]; 597 [proxy setMachExceptionPort:xpcPort];
601 setExceptionPort_ = YES; 598 setExceptionPort_ = YES;
602 } 599 }
603 600
604 return proxy; 601 return proxy;
605 } 602 }
606 603
607 @end 604 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698