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

Unified Diff: chrome/browser/notifications/arc_notifier_manager.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_notifier_manager.cc
diff --git a/chrome/browser/notifications/arc_notifier_manager.cc b/chrome/browser/notifications/arc_notifier_manager.cc
deleted file mode 100644
index d6f96b8b066a6b73acb90686f71d180bd172adcb..0000000000000000000000000000000000000000
--- a/chrome/browser/notifications/arc_notifier_manager.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// 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 <set>
-
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
-#include "ui/message_center/notifier_settings.h"
-
-namespace arc {
-
-namespace {
-constexpr int kSetNotificationsEnabledMinVersion = 6;
-} // namespace
-
-std::vector<std::unique_ptr<message_center::Notifier>>
-ArcNotifierManager::GetNotifiers(content::BrowserContext* 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;
- std::vector<std::unique_ptr<message_center::Notifier>> results;
-
- for (const std::string& app_id : app_ids) {
- const auto app = app_list->GetApp(app_id);
- if (!app)
- continue;
- // Handle packages having multiple launcher activities.
- if (added_packages.count(app->package_name))
- continue;
-
- 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));
- }
-
- return results;
-}
-
-void ArcNotifierManager::SetNotifierEnabled(const std::string& package,
- bool enabled) {
- auto* const service = arc::ArcBridgeService::Get();
- if (service) {
- if (service->app_version() >= kSetNotificationsEnabledMinVersion) {
- service->app_instance()->SetNotificationsEnabled(package, enabled);
- }
- }
-}
-
-} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698