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" |
| (...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 if (!app) |
|
dewittj
2016/06/30 17:55:27
nit: combine all these if statements
hirono
2016/07/01 07:19:05
Done.
| |
| 50 continue; | 50 continue; |
| 51 // Handle packages having multiple launcher activities. | 51 // Handle packages having multiple launcher activities. |
| 52 if (package_to_app_ids_.count(app->package_name)) | 52 if (package_to_app_ids_.count(app->package_name)) |
| 53 continue; | 53 continue; |
| 54 | 54 |
| 55 const auto package = app_list->GetPackage(app->package_name); | |
| 56 if (!package || package->system) | |
| 57 continue; | |
|
xiyuan
2016/06/30 14:43:03
nit: wrong indent ?
hirono
2016/07/01 07:19:05
Done.
| |
| 58 | |
| 55 // Load icons for notifier. | 59 // Load icons for notifier. |
| 56 std::unique_ptr<ArcAppIcon> icon( | 60 std::unique_ptr<ArcAppIcon> icon( |
| 57 new ArcAppIcon(profile, app_id, | 61 new ArcAppIcon(profile, app_id, |
| 58 // ARC icon is available only for 48x48 dips. | 62 // ARC icon is available only for 48x48 dips. |
| 59 kArcAppIconSizeInDp, | 63 kArcAppIconSizeInDp, |
| 60 // The life time of icon must shorter than |this|. | 64 // The life time of icon must shorter than |this|. |
| 61 this)); | 65 this)); |
| 62 icon->LoadForScaleFactor( | 66 icon->LoadForScaleFactor( |
| 63 ui::GetSupportedScaleFactor(display::Screen::GetScreen() | 67 ui::GetSupportedScaleFactor(display::Screen::GetScreen() |
| 64 ->GetPrimaryDisplay() | 68 ->GetPrimaryDisplay() |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 | 124 |
| 121 void ArcApplicationNotifierSourceChromeOS::StopObserving() { | 125 void ArcApplicationNotifierSourceChromeOS::StopObserving() { |
| 122 if (!last_profile_) | 126 if (!last_profile_) |
| 123 return; | 127 return; |
| 124 ArcAppListPrefs* const app_list = ArcAppListPrefs::Get(last_profile_); | 128 ArcAppListPrefs* const app_list = ArcAppListPrefs::Get(last_profile_); |
| 125 app_list->RemoveObserver(this); | 129 app_list->RemoveObserver(this); |
| 126 last_profile_ = nullptr; | 130 last_profile_ = nullptr; |
| 127 } | 131 } |
| 128 | 132 |
| 129 } // namespace arc | 133 } // namespace arc |
| OLD | NEW |