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

Side by Side Diff: chrome/browser/notifications/platform_notification_service_impl.cc

Issue 1864053002: Implement Android UI of web notification inline replies Base URL: https://chromium.googlesource.com/chromium/src.git@inline_replies_ps1
Patch Set: Fix filename? Created 4 years, 8 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 "chrome/browser/notifications/platform_notification_service_impl.h" 5 #include "chrome/browser/notifications/platform_notification_service_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/logging.h"
11 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
12 #include "base/metrics/user_metrics_action.h" 13 #include "base/metrics/user_metrics_action.h"
13 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "build/build_config.h" 16 #include "build/build_config.h"
16 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 18 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
18 #include "chrome/browser/notifications/desktop_notification_profile_util.h" 19 #include "chrome/browser/notifications/desktop_notification_profile_util.h"
19 #include "chrome/browser/notifications/notification_object_proxy.h" 20 #include "chrome/browser/notifications/notification_object_proxy.h"
20 #include "chrome/browser/notifications/notification_ui_manager.h" 21 #include "chrome/browser/notifications/notification_ui_manager.h"
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 462
462 // TODO(peter): Handle different screen densities instead of always using the 463 // TODO(peter): Handle different screen densities instead of always using the
463 // 1x bitmap - crbug.com/585815. 464 // 1x bitmap - crbug.com/585815.
464 notification.set_small_image( 465 notification.set_small_image(
465 gfx::Image::CreateFrom1xBitmap(notification_resources.badge)); 466 gfx::Image::CreateFrom1xBitmap(notification_resources.badge));
466 467
467 // Developer supplied action buttons. 468 // Developer supplied action buttons.
468 std::vector<message_center::ButtonInfo> buttons; 469 std::vector<message_center::ButtonInfo> buttons;
469 for (size_t i = 0; i < notification_data.actions.size(); i++) { 470 for (size_t i = 0; i < notification_data.actions.size(); i++) {
470 message_center::ButtonInfo button(notification_data.actions[i].title); 471 message_center::ButtonInfo button(notification_data.actions[i].title);
472 switch (notification_data.actions[i].type) {
473 case content::PLATFORM_NOTIFICATION_ACTION_TYPE_BUTTON:
474 button.type = message_center::BUTTON_INFO_TYPE_BUTTON;
475 break;
476 case content::PLATFORM_NOTIFICATION_ACTION_TYPE_TEXT:
477 button.type = message_center::BUTTON_INFO_TYPE_TEXT;
478 break;
479 }
480
471 // TODO(peter): Handle different screen densities instead of always using 481 // TODO(peter): Handle different screen densities instead of always using
472 // the 1x bitmap - crbug.com/585815. 482 // the 1x bitmap - crbug.com/585815.
473 button.icon = 483 button.icon =
474 gfx::Image::CreateFrom1xBitmap(notification_resources.action_icons[i]); 484 gfx::Image::CreateFrom1xBitmap(notification_resources.action_icons[i]);
485 button.placeholder = notification_data.actions[i].placeholder;
475 buttons.push_back(button); 486 buttons.push_back(button);
476 } 487 }
477 notification.set_buttons(buttons); 488 notification.set_buttons(buttons);
478 489
479 // On desktop, notifications with require_interaction==true stay on-screen 490 // On desktop, notifications with require_interaction==true stay on-screen
480 // rather than minimizing to the notification center after a timeout. 491 // rather than minimizing to the notification center after a timeout.
481 // On mobile, this is ignored (notifications are minimized at all times). 492 // On mobile, this is ignored (notifications are minimized at all times).
482 if (notification_data.require_interaction) 493 if (notification_data.require_interaction)
483 notification.set_never_timeout(true); 494 notification.set_never_timeout(true);
484 495
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( 544 extensions::ExtensionRegistry::Get(profile)->GetExtensionById(
534 origin.host(), extensions::ExtensionRegistry::EVERYTHING); 545 origin.host(), extensions::ExtensionRegistry::EVERYTHING);
535 DCHECK(extension); 546 DCHECK(extension);
536 547
537 return base::UTF8ToUTF16(extension->name()); 548 return base::UTF8ToUTF16(extension->name());
538 } 549 }
539 #endif 550 #endif
540 551
541 return base::string16(); 552 return base::string16();
542 } 553 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698