| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/ash/chrome_launcher_prefs.h" | 5 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/app_mode/app_mode_utils.h" | 14 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 15 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 16 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| 15 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 17 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 16 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" | 18 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
| 17 #include "chrome/common/extensions/extension_constants.h" | 19 #include "chrome/common/extensions/extension_constants.h" |
| 18 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 19 #include "components/pref_registry/pref_registry_syncable.h" | 21 #include "components/pref_registry/pref_registry_syncable.h" |
| 20 #include "components/prefs/pref_service.h" | 22 #include "components/prefs/pref_service.h" |
| 21 #include "components/prefs/scoped_user_pref_update.h" | 23 #include "components/prefs/scoped_user_pref_update.h" |
| 22 #include "ui/display/screen.h" | 24 #include "ui/display/screen.h" |
| 23 | 25 |
| 24 namespace ash { | 26 namespace ash { |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 dictionary->GetString(kPinnedAppsPrefAppIDPath, &app_id) && | 362 dictionary->GetString(kPinnedAppsPrefAppIDPath, &app_id) && |
| 361 helper->IsValidIDForCurrentUser(app_id) && | 363 helper->IsValidIDForCurrentUser(app_id) && |
| 362 std::find(apps.begin(), apps.end(), app_id) == apps.end() && | 364 std::find(apps.begin(), apps.end(), app_id) == apps.end() && |
| 363 (!dictionary->GetBoolean(kPinnedAppsPrefPinnedByPolicy, | 365 (!dictionary->GetBoolean(kPinnedAppsPrefPinnedByPolicy, |
| 364 &pinned_by_policy) || | 366 &pinned_by_policy) || |
| 365 !pinned_by_policy)) { | 367 !pinned_by_policy)) { |
| 366 apps.push_back(app_id); | 368 apps.push_back(app_id); |
| 367 } | 369 } |
| 368 } | 370 } |
| 369 | 371 |
| 372 if (arc::ArcAuthService::IsAllowedForProfile(helper->profile()) && |
| 373 helper->IsValidIDForCurrentUser(ArcSupportHost::kHostAppId)) { |
| 374 apps.push_back(ArcSupportHost::kHostAppId); |
| 375 } |
| 376 |
| 370 // If not added yet, the chrome item will be the last item in the list. | 377 // If not added yet, the chrome item will be the last item in the list. |
| 371 if (!chrome_listed) | 378 if (!chrome_listed) |
| 372 apps.push_back(extension_misc::kChromeAppId); | 379 apps.push_back(extension_misc::kChromeAppId); |
| 373 | 380 |
| 374 // If not added yet, place the app list item at the beginning of the list. | 381 // If not added yet, place the app list item at the beginning of the list. |
| 375 if (std::find(apps.begin(), apps.end(), kPinnedAppsPlaceholder) == apps.end()) | 382 if (std::find(apps.begin(), apps.end(), kPinnedAppsPlaceholder) == apps.end()) |
| 376 apps.insert(apps.begin(), kPinnedAppsPlaceholder); | 383 apps.insert(apps.begin(), kPinnedAppsPlaceholder); |
| 377 | 384 |
| 378 return apps; | 385 return apps; |
| 379 } | 386 } |
| 380 | 387 |
| 381 } // namespace ash | 388 } // namespace ash |
| OLD | NEW |