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 <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 V1App(Profile* profile, const std::string& app_name) { | 691 V1App(Profile* profile, const std::string& app_name) { |
692 // Create a window. | 692 // Create a window. |
693 native_window_.reset(new aura::Window(NULL)); | 693 native_window_.reset(new aura::Window(NULL)); |
694 native_window_->set_id(0); | 694 native_window_->set_id(0); |
695 native_window_->SetType(ui::wm::WINDOW_TYPE_POPUP); | 695 native_window_->SetType(ui::wm::WINDOW_TYPE_POPUP); |
696 native_window_->Init(ui::LAYER_TEXTURED); | 696 native_window_->Init(ui::LAYER_TEXTURED); |
697 native_window_->Show(); | 697 native_window_->Show(); |
698 aura::client::ParentWindowWithContext(native_window_.get(), | 698 aura::client::ParentWindowWithContext(native_window_.get(), |
699 ash::Shell::GetPrimaryRootWindow(), | 699 ash::Shell::GetPrimaryRootWindow(), |
700 gfx::Rect(10, 10, 20, 30)); | 700 gfx::Rect(10, 10, 20, 30)); |
701 Browser::CreateParams params = | 701 Browser::CreateParams params = Browser::CreateParams::CreateForApp( |
702 Browser::CreateParams::CreateForApp(kCrxAppPrefix + app_name, | 702 kCrxAppPrefix + app_name, true /* trusted_source */, gfx::Rect(), |
703 true /* trusted_source */, | 703 profile); |
704 gfx::Rect(), | |
705 profile, | |
706 chrome::HOST_DESKTOP_TYPE_ASH); | |
707 params.window = this; | 704 params.window = this; |
708 browser_.reset(new Browser(params)); | 705 browser_.reset(new Browser(params)); |
709 chrome::AddTabAt(browser_.get(), GURL(), 0, true); | 706 chrome::AddTabAt(browser_.get(), GURL(), 0, true); |
710 } | 707 } |
711 | 708 |
712 ~V1App() override { | 709 ~V1App() override { |
713 // close all tabs. Note that we do not need to destroy the browser itself. | 710 // close all tabs. Note that we do not need to destroy the browser itself. |
714 browser_->tab_strip_model()->CloseAllTabs(); | 711 browser_->tab_strip_model()->CloseAllTabs(); |
715 } | 712 } |
716 | 713 |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 | 1532 |
1536 // Create a second test profile. The first is the one in profile() created in | 1533 // Create a second test profile. The first is the one in profile() created in |
1537 // BrowserWithTestWindowTest::SetUp(). | 1534 // BrowserWithTestWindowTest::SetUp(). |
1538 // No need to add the profiles to the MultiUserWindowManager here. | 1535 // No need to add the profiles to the MultiUserWindowManager here. |
1539 // CreateMultiUserProfile() already does that. | 1536 // CreateMultiUserProfile() already does that. |
1540 TestingProfile* profile2 = CreateMultiUserProfile("user2"); | 1537 TestingProfile* profile2 = CreateMultiUserProfile("user2"); |
1541 const AccountId current_user = | 1538 const AccountId current_user = |
1542 multi_user_util::GetAccountIdFromProfile(profile()); | 1539 multi_user_util::GetAccountIdFromProfile(profile()); |
1543 | 1540 |
1544 // Create a browser window with a native window for the current user. | 1541 // Create a browser window with a native window for the current user. |
1545 Browser::CreateParams params(profile(), chrome::HOST_DESKTOP_TYPE_ASH); | 1542 Browser::CreateParams params(profile()); |
1546 scoped_ptr<Browser> browser( | 1543 scoped_ptr<Browser> browser( |
1547 chrome::CreateBrowserWithAuraTestWindowForParams(nullptr, ¶ms)); | 1544 chrome::CreateBrowserWithAuraTestWindowForParams(nullptr, ¶ms)); |
1548 BrowserWindow* browser_window = browser->window(); | 1545 BrowserWindow* browser_window = browser->window(); |
1549 aura::Window* window = browser_window->GetNativeWindow(); | 1546 aura::Window* window = browser_window->GetNativeWindow(); |
1550 manager->SetWindowOwner(window, current_user); | 1547 manager->SetWindowOwner(window, current_user); |
1551 | 1548 |
1552 // Check that an activation of the window on its owner's desktop does not | 1549 // Check that an activation of the window on its owner's desktop does not |
1553 // change the visibility to another user. | 1550 // change the visibility to another user. |
1554 launcher_controller_->ActivateWindowOrMinimizeIfActive(browser_window, false); | 1551 launcher_controller_->ActivateWindowOrMinimizeIfActive(browser_window, false); |
1555 EXPECT_TRUE(manager->IsWindowOnDesktopOfUser(window, current_user)); | 1552 EXPECT_TRUE(manager->IsWindowOnDesktopOfUser(window, current_user)); |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2766 | 2763 |
2767 EXPECT_EQ(1, app_icon_loader->fetch_count()); | 2764 EXPECT_EQ(1, app_icon_loader->fetch_count()); |
2768 ASSERT_EQ(initial_size + 1, model_->items().size()); | 2765 ASSERT_EQ(initial_size + 1, model_->items().size()); |
2769 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); | 2766 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); |
2770 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); | 2767 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); |
2771 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); | 2768 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); |
2772 | 2769 |
2773 launcher_controller_->UnpinAppWithID("1"); | 2770 launcher_controller_->UnpinAppWithID("1"); |
2774 ASSERT_EQ(initial_size, model_->items().size()); | 2771 ASSERT_EQ(initial_size, model_->items().size()); |
2775 } | 2772 } |
OLD | NEW |