| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 return std::vector<std::unique_ptr<message_center::Notifier>>(); | 39 return std::vector<std::unique_ptr<message_center::Notifier>>(); |
| 40 } | 40 } |
| 41 const std::vector<std::string>& app_ids = app_list->GetAppIds(); | 41 const std::vector<std::string>& app_ids = app_list->GetAppIds(); |
| 42 std::vector<std::unique_ptr<message_center::Notifier>> results; | 42 std::vector<std::unique_ptr<message_center::Notifier>> results; |
| 43 | 43 |
| 44 last_profile_ = profile; | 44 last_profile_ = profile; |
| 45 app_list->AddObserver(this); | 45 app_list->AddObserver(this); |
| 46 | 46 |
| 47 for (const std::string& app_id : app_ids) { | 47 for (const std::string& app_id : app_ids) { |
| 48 const auto app = app_list->GetApp(app_id); | 48 const auto app = app_list->GetApp(app_id); |
| 49 if (!app) | 49 // Handle packages having multiple launcher activities. |
| 50 if (!app || package_to_app_ids_.count(app->package_name)) |
| 50 continue; | 51 continue; |
| 51 // Handle packages having multiple launcher activities. | 52 |
| 52 if (package_to_app_ids_.count(app->package_name)) | 53 const auto package = app_list->GetPackage(app->package_name); |
| 54 if (!package || package->system) |
| 53 continue; | 55 continue; |
| 54 | 56 |
| 55 // Load icons for notifier. | 57 // Load icons for notifier. |
| 56 std::unique_ptr<ArcAppIcon> icon( | 58 std::unique_ptr<ArcAppIcon> icon( |
| 57 new ArcAppIcon(profile, app_id, | 59 new ArcAppIcon(profile, app_id, |
| 58 // ARC icon is available only for 48x48 dips. | 60 // ARC icon is available only for 48x48 dips. |
| 59 kArcAppIconSizeInDp, | 61 kArcAppIconSizeInDp, |
| 60 // The life time of icon must shorter than |this|. | 62 // The life time of icon must shorter than |this|. |
| 61 this)); | 63 this)); |
| 62 icon->LoadForScaleFactor( | 64 icon->LoadForScaleFactor( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 122 |
| 121 void ArcApplicationNotifierSourceChromeOS::StopObserving() { | 123 void ArcApplicationNotifierSourceChromeOS::StopObserving() { |
| 122 if (!last_profile_) | 124 if (!last_profile_) |
| 123 return; | 125 return; |
| 124 ArcAppListPrefs* const app_list = ArcAppListPrefs::Get(last_profile_); | 126 ArcAppListPrefs* const app_list = ArcAppListPrefs::Get(last_profile_); |
| 125 app_list->RemoveObserver(this); | 127 app_list->RemoveObserver(this); |
| 126 last_profile_ = nullptr; | 128 last_profile_ = nullptr; |
| 127 } | 129 } |
| 128 | 130 |
| 129 } // namespace arc | 131 } // namespace arc |
| OLD | NEW |