| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/launcher/chrome_launcher_controller_impl.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "chrome/browser/extensions/test_extension_system.h" | 41 #include "chrome/browser/extensions/test_extension_system.h" |
| 42 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 42 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
| 43 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 43 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
| 44 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 44 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 45 #include "chrome/browser/ui/app_list/arc/arc_app_test.h" | 45 #include "chrome/browser/ui/app_list/arc/arc_app_test.h" |
| 46 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 46 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 47 #include "chrome/browser/ui/apps/chrome_app_delegate.h" | 47 #include "chrome/browser/ui/apps/chrome_app_delegate.h" |
| 48 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 48 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 49 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" | 49 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" |
| 50 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" | 50 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" |
| 51 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
| 51 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont
roller.h" | 52 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont
roller.h" |
| 52 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | 53 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" |
| 53 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" | 54 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
| 54 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 55 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
| 55 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 56 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 56 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 57 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 57 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" | 58 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
| 58 #include "chrome/browser/ui/browser.h" | 59 #include "chrome/browser/ui/browser.h" |
| 59 #include "chrome/browser/ui/browser_commands.h" | 60 #include "chrome/browser/ui/browser_commands.h" |
| 60 #include "chrome/browser/ui/browser_finder.h" | 61 #include "chrome/browser/ui/browser_finder.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 new ChromeLauncherAppMenuItem(base::string16(), NULL, false)); | 275 new ChromeLauncherAppMenuItem(base::string16(), NULL, false)); |
| 275 items.push_back( | 276 items.push_back( |
| 276 new ChromeLauncherAppMenuItem(base::string16(), NULL, false)); | 277 new ChromeLauncherAppMenuItem(base::string16(), NULL, false)); |
| 277 return items; | 278 return items; |
| 278 } | 279 } |
| 279 ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) override { | 280 ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) override { |
| 280 return NULL; | 281 return NULL; |
| 281 } | 282 } |
| 282 bool IsDraggable() override { return false; } | 283 bool IsDraggable() override { return false; } |
| 283 bool CanPin() const override { | 284 bool CanPin() const override { |
| 284 return launcher_controller()->GetPinnable(app_id()) == | 285 return GetPinnableForAppID(app_id(), launcher_controller()->GetProfile()) == |
| 285 AppListControllerDelegate::PIN_EDITABLE; | 286 AppListControllerDelegate::PIN_EDITABLE; |
| 286 } | 287 } |
| 287 bool ShouldShowTooltip() override { return false; } | 288 bool ShouldShowTooltip() override { return false; } |
| 288 | 289 |
| 289 private: | 290 private: |
| 290 DISALLOW_COPY_AND_ASSIGN(TestV2AppLauncherItemController); | 291 DISALLOW_COPY_AND_ASSIGN(TestV2AppLauncherItemController); |
| 291 }; | 292 }; |
| 292 | 293 |
| 293 } // namespace | 294 } // namespace |
| 294 | 295 |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 // 2 is not pinned as it's not installed | 1304 // 2 is not pinned as it's not installed |
| 1304 EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); | 1305 EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); |
| 1305 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension3_->id())); | 1306 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension3_->id())); |
| 1306 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension4_->id())); | 1307 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension4_->id())); |
| 1307 // install extension 2 and check | 1308 // install extension 2 and check |
| 1308 extension_service_->AddExtension(extension2_.get()); | 1309 extension_service_->AddExtension(extension2_.get()); |
| 1309 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); | 1310 EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); |
| 1310 | 1311 |
| 1311 // Check user can manually pin or unpin these apps | 1312 // Check user can manually pin or unpin these apps |
| 1312 EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, | 1313 EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, |
| 1313 launcher_controller_->GetPinnable(extension1_->id())); | 1314 GetPinnableForAppID(extension1_->id(), |
| 1315 launcher_controller->Getprofile())); |
| 1314 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, | 1316 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, |
| 1315 launcher_controller_->GetPinnable(extension2_->id())); | 1317 GetPinnableForAppID(extension1_->id(), |
| 1318 launcher_controller->Getprofile())); |
| 1316 EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, | 1319 EXPECT_EQ(AppListControllerDelegate::PIN_EDITABLE, |
| 1317 launcher_controller_->GetPinnable(extension3_->id())); | 1320 GetPinnableForAppID(extension1_->id(), |
| 1321 launcher_controller->Getprofile())); |
| 1318 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, | 1322 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, |
| 1319 launcher_controller_->GetPinnable(extension4_->id())); | 1323 GetPinnableForAppID(extension1_->id(), |
| 1324 launcher_controller->Getprofile())); |
| 1320 | 1325 |
| 1321 // Check the order of shelf pinned apps | 1326 // Check the order of shelf pinned apps |
| 1322 EXPECT_EQ("AppList, App2, App4, App1, Chrome, App3", GetPinnedAppStatus()); | 1327 EXPECT_EQ("AppList, App2, App4, App1, Chrome, App3", GetPinnedAppStatus()); |
| 1323 } | 1328 } |
| 1324 | 1329 |
| 1325 // Check that the restauration of launcher items is happening in the same order | 1330 // Check that the restauration of launcher items is happening in the same order |
| 1326 // as the user has pinned them (on another system) when they are synced reverse | 1331 // as the user has pinned them (on another system) when they are synced reverse |
| 1327 // order. | 1332 // order. |
| 1328 TEST_F(ChromeLauncherControllerImplTest, RestoreDefaultAppsReverseOrder) { | 1333 TEST_F(ChromeLauncherControllerImplTest, RestoreDefaultAppsReverseOrder) { |
| 1329 InitLauncherController(); | 1334 InitLauncherController(); |
| (...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3347 // Set policy, that makes pins ARC app. Unlike native extension, for ARC app | 3352 // Set policy, that makes pins ARC app. Unlike native extension, for ARC app |
| 3348 // package_name (not hash) specified as id. In this test we check that | 3353 // package_name (not hash) specified as id. In this test we check that |
| 3349 // by hash we can determine that appropriate package was set by policy. | 3354 // by hash we can determine that appropriate package was set by policy. |
| 3350 base::ListValue policy_value; | 3355 base::ListValue policy_value; |
| 3351 InsertPrefValue(&policy_value, 0, appinfo.package_name); | 3356 InsertPrefValue(&policy_value, 0, appinfo.package_name); |
| 3352 profile()->GetTestingPrefService()->SetManagedPref( | 3357 profile()->GetTestingPrefService()->SetManagedPref( |
| 3353 prefs::kPolicyPinnedLauncherApps, policy_value.DeepCopy()); | 3358 prefs::kPolicyPinnedLauncherApps, policy_value.DeepCopy()); |
| 3354 | 3359 |
| 3355 EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); | 3360 EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id)); |
| 3356 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, | 3361 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, |
| 3357 launcher_controller_->GetPinnable(app_id)); | 3362 GetPinnableForAppID(extension1_->id(), |
| 3363 launcher_controller->Getprofile())); |
| 3358 } | 3364 } |
| OLD | NEW |