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

Unified Diff: chrome/browser/notifications/arc_application_notifier_source_chromeos.cc

Issue 2064363002: Refactor MessageCenterSettingsController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix misspell. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698