| 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/display.h" | 24 #include "ui/display/display.h" |
| 23 #include "ui/display/screen.h" | 25 #include "ui/display/screen.h" |
| 24 | 26 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 dictionary->GetString(kPinnedAppsPrefAppIDPath, &app_id) && | 363 dictionary->GetString(kPinnedAppsPrefAppIDPath, &app_id) && |
| 362 helper->IsValidIDForCurrentUser(app_id) && | 364 helper->IsValidIDForCurrentUser(app_id) && |
| 363 std::find(apps.begin(), apps.end(), app_id) == apps.end() && | 365 std::find(apps.begin(), apps.end(), app_id) == apps.end() && |
| 364 (!dictionary->GetBoolean(kPinnedAppsPrefPinnedByPolicy, | 366 (!dictionary->GetBoolean(kPinnedAppsPrefPinnedByPolicy, |
| 365 &pinned_by_policy) || | 367 &pinned_by_policy) || |
| 366 !pinned_by_policy)) { | 368 !pinned_by_policy)) { |
| 367 apps.push_back(app_id); | 369 apps.push_back(app_id); |
| 368 } | 370 } |
| 369 } | 371 } |
| 370 | 372 |
| 373 if (arc::ArcAuthService::IsAllowedForProfile(helper->profile()) && |
| 374 helper->IsValidIDForCurrentUser(ArcSupportHost::kHostAppId)) { |
| 375 apps.push_back(ArcSupportHost::kHostAppId); |
| 376 } |
| 377 |
| 371 // If not added yet, the chrome item will be the last item in the list. | 378 // If not added yet, the chrome item will be the last item in the list. |
| 372 if (!chrome_listed) | 379 if (!chrome_listed) |
| 373 apps.push_back(extension_misc::kChromeAppId); | 380 apps.push_back(extension_misc::kChromeAppId); |
| 374 | 381 |
| 375 // If not added yet, place the app list item at the beginning of the list. | 382 // If not added yet, place the app list item at the beginning of the list. |
| 376 if (std::find(apps.begin(), apps.end(), kPinnedAppsPlaceholder) == apps.end()) | 383 if (std::find(apps.begin(), apps.end(), kPinnedAppsPlaceholder) == apps.end()) |
| 377 apps.insert(apps.begin(), kPinnedAppsPlaceholder); | 384 apps.insert(apps.begin(), kPinnedAppsPlaceholder); |
| 378 | 385 |
| 379 return apps; | 386 return apps; |
| 380 } | 387 } |
| 381 | 388 |
| 382 } // namespace ash | 389 } // namespace ash |
| OLD | NEW |