| Index: chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
|
| diff --git a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
|
| index 39740943fee050fbe083e73d28ac3696bfde4f43..99b041aa5749bf8bcc80b5dd166bfd7b0e3c51f6 100644
|
| --- a/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
|
| +++ b/chrome/browser/extensions/api/autotest_private/autotest_private_api.cc
|
| @@ -29,6 +29,8 @@
|
| #include "chromeos/dbus/session_manager_client.h"
|
| #include "components/user_manager/user.h"
|
| #include "components/user_manager/user_manager.h"
|
| +#include "ui/message_center/message_center.h"
|
| +#include "ui/message_center/notification.h"
|
| #endif
|
|
|
| namespace extensions {
|
| @@ -322,6 +324,47 @@ bool AutotestPrivateSetPrimaryButtonRightFunction::RunSync() {
|
| return true;
|
| }
|
|
|
| +// static
|
| +std::string AutotestPrivateGetVisibleNotificationsFunction::ConvertToString(
|
| + message_center::NotificationType type) {
|
| +#if defined(OS_CHROMEOS)
|
| + switch (type) {
|
| + case message_center::NOTIFICATION_TYPE_SIMPLE:
|
| + return "simple";
|
| + case message_center::NOTIFICATION_TYPE_BASE_FORMAT:
|
| + return "base_format";
|
| + case message_center::NOTIFICATION_TYPE_IMAGE:
|
| + return "image";
|
| + case message_center::NOTIFICATION_TYPE_MULTIPLE:
|
| + return "multiple";
|
| + case message_center::NOTIFICATION_TYPE_PROGRESS:
|
| + return "progress";
|
| + }
|
| +#endif
|
| + return "unknown";
|
| +}
|
| +
|
| +bool AutotestPrivateGetVisibleNotificationsFunction::RunSync() {
|
| + DVLOG(1) << "AutotestPrivateGetVisibleNotificationsFunction";
|
| + base::ListValue* values = new base::ListValue;
|
| +#if defined(OS_CHROMEOS)
|
| + for (auto notification :
|
| + message_center::MessageCenter::Get()->GetVisibleNotifications()) {
|
| + base::DictionaryValue* result(new base::DictionaryValue);
|
| + result->SetString("id", notification->id());
|
| + result->SetString("type", ConvertToString(notification->type()));
|
| + result->SetString("title", notification->title());
|
| + result->SetString("message", notification->message());
|
| + result->SetInteger("priority", notification->priority());
|
| + result->SetInteger("progress", notification->progress());
|
| + values->Append(result);
|
| + }
|
| +
|
| +#endif
|
| + SetResult(values);
|
| + return true;
|
| +}
|
| +
|
| static base::LazyInstance<BrowserContextKeyedAPIFactory<AutotestPrivateAPI> >
|
| g_factory = LAZY_INSTANCE_INITIALIZER;
|
|
|
|
|