Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/arc_application_notifier_source_chromeos. h" | 5 #include "chrome/browser/notifications/arc_application_notifier_source_chromeos. h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | |
| 11 #include "ui/base/layout.h" | 12 #include "ui/base/layout.h" |
| 12 #include "ui/display/display.h" | 13 #include "ui/display/display.h" |
| 13 #include "ui/display/screen.h" | 14 #include "ui/display/screen.h" |
| 14 #include "ui/message_center/notifier_settings.h" | 15 #include "ui/message_center/notifier_settings.h" |
| 15 | 16 |
| 16 namespace arc { | 17 namespace arc { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 constexpr int kArcAppIconSizeInDp = 48; | 20 constexpr int kArcAppIconSizeInDp = 48; |
| 20 } // namespace | 21 } // namespace |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 39 return std::vector<std::unique_ptr<message_center::Notifier>>(); | 40 return std::vector<std::unique_ptr<message_center::Notifier>>(); |
| 40 } | 41 } |
| 41 const std::vector<std::string>& app_ids = app_list->GetAppIds(); | 42 const std::vector<std::string>& app_ids = app_list->GetAppIds(); |
| 42 std::vector<std::unique_ptr<message_center::Notifier>> results; | 43 std::vector<std::unique_ptr<message_center::Notifier>> results; |
| 43 | 44 |
| 44 last_profile_ = profile; | 45 last_profile_ = profile; |
| 45 app_list->AddObserver(this); | 46 app_list->AddObserver(this); |
| 46 | 47 |
| 47 for (const std::string& app_id : app_ids) { | 48 for (const std::string& app_id : app_ids) { |
| 48 const auto app = app_list->GetApp(app_id); | 49 const auto app = app_list->GetApp(app_id); |
| 49 if (!app) | 50 if (!app || !arc::ShouldShowInLauncher(app_id)) |
|
dewittj
2016/06/27 16:17:49
Can an app that's not in the launcher show notific
uekawa-
2016/06/27 23:15:09
There are launchable activities and other activit
hirono
2016/06/28 02:20:31
I think there is two points here.
First the notif
dewittj
2016/06/29 16:09:34
I am not sure if you are waiting for me or not. I
| |
| 50 continue; | 51 continue; |
| 51 // Handle packages having multiple launcher activities. | 52 // Handle packages having multiple launcher activities. |
| 52 if (package_to_app_ids_.count(app->package_name)) | 53 if (package_to_app_ids_.count(app->package_name)) |
| 53 continue; | 54 continue; |
| 54 | 55 |
| 55 // Load icons for notifier. | 56 // Load icons for notifier. |
| 56 std::unique_ptr<ArcAppIcon> icon( | 57 std::unique_ptr<ArcAppIcon> icon( |
| 57 new ArcAppIcon(profile, app_id, | 58 new ArcAppIcon(profile, app_id, |
| 58 // ARC icon is available only for 48x48 dips. | 59 // ARC icon is available only for 48x48 dips. |
| 59 kArcAppIconSizeInDp, | 60 kArcAppIconSizeInDp, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 | 121 |
| 121 void ArcApplicationNotifierSourceChromeOS::StopObserving() { | 122 void ArcApplicationNotifierSourceChromeOS::StopObserving() { |
| 122 if (!last_profile_) | 123 if (!last_profile_) |
| 123 return; | 124 return; |
| 124 ArcAppListPrefs* const app_list = ArcAppListPrefs::Get(last_profile_); | 125 ArcAppListPrefs* const app_list = ArcAppListPrefs::Get(last_profile_); |
| 125 app_list->RemoveObserver(this); | 126 app_list->RemoveObserver(this); |
| 126 last_profile_ = nullptr; | 127 last_profile_ = nullptr; |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace arc | 130 } // namespace arc |
| OLD | NEW |