| 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.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
| 12 #include "ash/shelf/shelf_item_delegate_manager.h" | 12 #include "ash/shelf/shelf_item_delegate_manager.h" |
| 13 #include "ash/shelf/shelf_model.h" | 13 #include "ash/shelf/shelf_model.h" |
| 14 #include "ash/shelf/shelf_model_observer.h" | 14 #include "ash/shelf/shelf_model_observer.h" |
| 15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/test/shelf_item_delegate_manager_test_api.h" | 16 #include "ash/test/shelf_item_delegate_manager_test_api.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
| 19 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
| 20 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
| 21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
| 22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/values.h" | 23 #include "base/values.h" |
| 24 #include "chrome/browser/extensions/extension_service.h" | 24 #include "chrome/browser/extensions/extension_service.h" |
| 25 #include "chrome/browser/extensions/test_extension_system.h" | 25 #include "chrome/browser/extensions/test_extension_system.h" |
| 26 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 26 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 27 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" | 27 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" |
| 28 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | 28 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" |
| 29 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 29 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
| 30 #include "chrome/browser/ui/ash/test_views_delegate_with_parent.h" |
| 30 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
| 31 #include "chrome/browser/ui/browser_commands.h" | 32 #include "chrome/browser/ui/browser_commands.h" |
| 32 #include "chrome/browser/ui/browser_finder.h" | 33 #include "chrome/browser/ui/browser_finder.h" |
| 33 #include "chrome/browser/ui/browser_list.h" | 34 #include "chrome/browser/ui/browser_list.h" |
| 34 #include "chrome/browser/ui/browser_tabstrip.h" | 35 #include "chrome/browser/ui/browser_tabstrip.h" |
| 35 #include "chrome/browser/ui/host_desktop.h" | 36 #include "chrome/browser/ui/host_desktop.h" |
| 36 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 37 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 37 #include "chrome/common/extensions/extension_constants.h" | 38 #include "chrome/common/extensions/extension_constants.h" |
| 38 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
| 39 #include "chrome/test/base/browser_with_test_window_test.h" | 40 #include "chrome/test/base/browser_with_test_window_test.h" |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 return CreateMultiUserProfile("user1"); | 915 return CreateMultiUserProfile("user1"); |
| 915 } | 916 } |
| 916 virtual void DestroyProfile(TestingProfile* profile) OVERRIDE { | 917 virtual void DestroyProfile(TestingProfile* profile) OVERRIDE { |
| 917 // Delete the profile through our profile manager. | 918 // Delete the profile through our profile manager. |
| 918 ProfileToNameMap::iterator it = created_profiles_.find(profile); | 919 ProfileToNameMap::iterator it = created_profiles_.find(profile); |
| 919 DCHECK(it != created_profiles_.end()); | 920 DCHECK(it != created_profiles_.end()); |
| 920 profile_manager_->DeleteTestingProfile(it->second); | 921 profile_manager_->DeleteTestingProfile(it->second); |
| 921 created_profiles_.erase(it); | 922 created_profiles_.erase(it); |
| 922 } | 923 } |
| 923 | 924 |
| 925 virtual views::ViewsDelegate* CreateViewsDelegate() OVERRIDE { |
| 926 return new TestViewsDelegateWithParent; |
| 927 } |
| 928 |
| 924 private: | 929 private: |
| 925 typedef std::map<Profile*, std::string> ProfileToNameMap; | 930 typedef std::map<Profile*, std::string> ProfileToNameMap; |
| 926 TestingProfileManager* profile_manager() { return profile_manager_.get(); } | 931 TestingProfileManager* profile_manager() { return profile_manager_.get(); } |
| 927 | 932 |
| 928 chromeos::FakeUserManager* GetFakeUserManager() { | 933 chromeos::FakeUserManager* GetFakeUserManager() { |
| 929 return static_cast<chromeos::FakeUserManager*>( | 934 return static_cast<chromeos::FakeUserManager*>( |
| 930 chromeos::UserManager::Get()); | 935 chromeos::UserManager::Get()); |
| 931 } | 936 } |
| 932 | 937 |
| 933 scoped_ptr<TestingProfileManager> profile_manager_; | 938 scoped_ptr<TestingProfileManager> profile_manager_; |
| (...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2693 | 2698 |
| 2694 EXPECT_EQ(1, app_icon_loader->fetch_count()); | 2699 EXPECT_EQ(1, app_icon_loader->fetch_count()); |
| 2695 ASSERT_EQ(initial_size + 1, model_->items().size()); | 2700 ASSERT_EQ(initial_size + 1, model_->items().size()); |
| 2696 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); | 2701 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); |
| 2697 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); | 2702 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); |
| 2698 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); | 2703 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); |
| 2699 | 2704 |
| 2700 launcher_controller_->UnpinAppWithID("1"); | 2705 launcher_controller_->UnpinAppWithID("1"); |
| 2701 ASSERT_EQ(initial_size, model_->items().size()); | 2706 ASSERT_EQ(initial_size, model_->items().size()); |
| 2702 } | 2707 } |
| OLD | NEW |