| Index: chrome/browser/notifications/arc_application_notifier_source_chromeos.cc
|
| diff --git a/chrome/browser/notifications/arc_notifier_manager.cc b/chrome/browser/notifications/arc_application_notifier_source_chromeos.cc
|
| similarity index 57%
|
| rename from chrome/browser/notifications/arc_notifier_manager.cc
|
| rename to chrome/browser/notifications/arc_application_notifier_source_chromeos.cc
|
| index d6f96b8b066a6b73acb90686f71d180bd172adcb..171268ef852287bb4386bd37ba2310e95eb1c564 100644
|
| --- a/chrome/browser/notifications/arc_notifier_manager.cc
|
| +++ b/chrome/browser/notifications/arc_application_notifier_source_chromeos.cc
|
| @@ -2,11 +2,12 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/notifications/arc_notifier_manager.h"
|
| +#include "chrome/browser/notifications/arc_application_notifier_source_chromeos.h"
|
|
|
| #include <set>
|
|
|
| #include "base/strings/utf_string_conversions.h"
|
| +#include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
|
| #include "ui/message_center/notifier_settings.h"
|
|
|
| @@ -16,8 +17,12 @@ namespace {
|
| constexpr int kSetNotificationsEnabledMinVersion = 6;
|
| } // namespace
|
|
|
| +ArcApplicationNotifierSourceChromeOS::ArcApplicationNotifierSourceChromeOS(
|
| + Observer* observer)
|
| + : observer_(observer) {}
|
| +
|
| std::vector<std::unique_ptr<message_center::Notifier>>
|
| -ArcNotifierManager::GetNotifiers(content::BrowserContext* profile) {
|
| +ArcApplicationNotifierSourceChromeOS::GetNotifierList(Profile* profile) {
|
| const ArcAppListPrefs* const app_list = ArcAppListPrefs::Get(profile);
|
| const std::vector<std::string>& app_ids = app_list->GetAppIds();
|
| std::set<std::string> added_packages;
|
| @@ -34,23 +39,31 @@ ArcNotifierManager::GetNotifiers(content::BrowserContext* profile) {
|
| added_packages.insert(app->package_name);
|
| message_center::NotifierId notifier_id(
|
| message_center::NotifierId::ARC_APPLICATION, app->package_name);
|
| - results.emplace_back(new message_center::Notifier(
|
| - notifier_id,
|
| - base::ASCIIToUTF16(app->name),
|
| - app->notifications_enabled));
|
| + results.emplace_back(
|
| + new message_center::Notifier(notifier_id, base::ASCIIToUTF16(app->name),
|
| + app->notifications_enabled));
|
| }
|
|
|
| return results;
|
| }
|
|
|
| -void ArcNotifierManager::SetNotifierEnabled(const std::string& package,
|
| - bool enabled) {
|
| +void ArcApplicationNotifierSourceChromeOS::SetNotifierEnabled(
|
| + Profile* profile,
|
| + const message_center::Notifier& notifier,
|
| + bool enabled) {
|
| auto* const service = arc::ArcBridgeService::Get();
|
| if (service) {
|
| if (service->app_version() >= kSetNotificationsEnabledMinVersion) {
|
| - service->app_instance()->SetNotificationsEnabled(package, enabled);
|
| + service->app_instance()->SetNotificationsEnabled(notifier.notifier_id.id,
|
| + enabled);
|
| + observer_->OnNotifierEnabledChanged(notifier.notifier_id, enabled);
|
| }
|
| }
|
| }
|
|
|
| +message_center::NotifierId::NotifierType
|
| +ArcApplicationNotifierSourceChromeOS::GetNotifierType() {
|
| + return message_center::NotifierId::ARC_APPLICATION;
|
| +}
|
| +
|
| } // namespace arc
|
|
|