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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "ui/base/models/menu_model.h" | 47 #include "ui/base/models/menu_model.h" |
48 | 48 |
49 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
50 #include "apps/app_window_contents.h" | 50 #include "apps/app_window_contents.h" |
51 #include "apps/app_window_registry.h" | 51 #include "apps/app_window_registry.h" |
52 #include "apps/ui/native_app_window.h" | 52 #include "apps/ui/native_app_window.h" |
53 #include "ash/test/test_session_state_delegate.h" | 53 #include "ash/test/test_session_state_delegate.h" |
54 #include "ash/test/test_shell_delegate.h" | 54 #include "ash/test/test_shell_delegate.h" |
55 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | 55 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" |
56 #include "chrome/browser/ui/apps/chrome_app_delegate.h" | 56 #include "chrome/browser/ui/apps/chrome_app_delegate.h" |
57 #include "chrome/browser/ui/apps/chrome_app_window_delegate.h" | |
58 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" | 57 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" |
59 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" | 58 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" |
60 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 59 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
61 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 60 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
62 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" | 61 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
63 #include "chrome/common/chrome_constants.h" | 62 #include "chrome/common/chrome_constants.h" |
64 #include "chrome/common/chrome_switches.h" | 63 #include "chrome/common/chrome_switches.h" |
65 #include "chrome/test/base/testing_browser_process.h" | 64 #include "chrome/test/base/testing_browser_process.h" |
66 #include "chrome/test/base/testing_profile_manager.h" | 65 #include "chrome/test/base/testing_profile_manager.h" |
67 #include "content/public/browser/web_contents_observer.h" | 66 #include "content/public/browser/web_contents_observer.h" |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 scoped_ptr<aura::Window> native_window_; | 737 scoped_ptr<aura::Window> native_window_; |
739 | 738 |
740 DISALLOW_COPY_AND_ASSIGN(V1App); | 739 DISALLOW_COPY_AND_ASSIGN(V1App); |
741 }; | 740 }; |
742 | 741 |
743 // A V2 application which gets created with an |extension| and for a |profile|. | 742 // A V2 application which gets created with an |extension| and for a |profile|. |
744 // Upon destruction it will properly close the application. | 743 // Upon destruction it will properly close the application. |
745 class V2App { | 744 class V2App { |
746 public: | 745 public: |
747 V2App(Profile* profile, const extensions::Extension* extension) { | 746 V2App(Profile* profile, const extensions::Extension* extension) { |
748 window_ = new apps::AppWindow(profile, | 747 window_ = new apps::AppWindow(profile, new ChromeAppDelegate(), extension); |
749 new ChromeAppDelegate(), | |
750 new ChromeAppWindowDelegate(), | |
751 extension); | |
752 apps::AppWindow::CreateParams params = apps::AppWindow::CreateParams(); | 748 apps::AppWindow::CreateParams params = apps::AppWindow::CreateParams(); |
753 window_->Init( | 749 window_->Init( |
754 GURL(std::string()), new apps::AppWindowContentsImpl(window_), params); | 750 GURL(std::string()), new apps::AppWindowContentsImpl(window_), params); |
755 } | 751 } |
756 | 752 |
757 virtual ~V2App() { | 753 virtual ~V2App() { |
758 WebContentsDestroyedWatcher destroyed_watcher(window_->web_contents()); | 754 WebContentsDestroyedWatcher destroyed_watcher(window_->web_contents()); |
759 window_->GetBaseWindow()->Close(); | 755 window_->GetBaseWindow()->Close(); |
760 destroyed_watcher.Wait(); | 756 destroyed_watcher.Wait(); |
761 } | 757 } |
(...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2695 | 2691 |
2696 EXPECT_EQ(1, app_icon_loader->fetch_count()); | 2692 EXPECT_EQ(1, app_icon_loader->fetch_count()); |
2697 ASSERT_EQ(initial_size + 1, model_->items().size()); | 2693 ASSERT_EQ(initial_size + 1, model_->items().size()); |
2698 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); | 2694 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); |
2699 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); | 2695 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); |
2700 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); | 2696 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); |
2701 | 2697 |
2702 launcher_controller_->UnpinAppWithID("1"); | 2698 launcher_controller_->UnpinAppWithID("1"); |
2703 ASSERT_EQ(initial_size, model_->items().size()); | 2699 ASSERT_EQ(initial_size, model_->items().size()); |
2704 } | 2700 } |
OLD | NEW |