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 | |
9 #include <algorithm> | 8 #include <algorithm> |
10 #include <string> | 9 #include <string> |
| 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "ash/ash_switches.h" | 13 #include "ash/ash_switches.h" |
14 #include "ash/shelf/shelf_item_delegate_manager.h" | 14 #include "ash/shelf/shelf_item_delegate_manager.h" |
15 #include "ash/shelf/shelf_model.h" | 15 #include "ash/shelf/shelf_model.h" |
16 #include "ash/shelf/shelf_model_observer.h" | 16 #include "ash/shelf/shelf_model_observer.h" |
17 #include "ash/shell.h" | 17 #include "ash/shell.h" |
18 #include "ash/test/shelf_item_delegate_manager_test_api.h" | 18 #include "ash/test/shelf_item_delegate_manager_test_api.h" |
19 #include "base/command_line.h" | 19 #include "base/command_line.h" |
20 #include "base/compiler_specific.h" | 20 #include "base/compiler_specific.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 const ui::Event& event) override { | 242 const ui::Event& event) override { |
243 return kExistingWindowActivated; | 243 return kExistingWindowActivated; |
244 } | 244 } |
245 base::string16 GetTitle() override { return base::string16(); } | 245 base::string16 GetTitle() override { return base::string16(); } |
246 ChromeLauncherAppMenuItems GetApplicationList(int event_flags) override { | 246 ChromeLauncherAppMenuItems GetApplicationList(int event_flags) override { |
247 ChromeLauncherAppMenuItems items; | 247 ChromeLauncherAppMenuItems items; |
248 items.push_back( | 248 items.push_back( |
249 new ChromeLauncherAppMenuItem(base::string16(), NULL, false)); | 249 new ChromeLauncherAppMenuItem(base::string16(), NULL, false)); |
250 items.push_back( | 250 items.push_back( |
251 new ChromeLauncherAppMenuItem(base::string16(), NULL, false)); | 251 new ChromeLauncherAppMenuItem(base::string16(), NULL, false)); |
252 return items.Pass(); | 252 return items; |
253 } | 253 } |
254 ui::MenuModel* CreateContextMenu(aura::Window* root_window) override { | 254 ui::MenuModel* CreateContextMenu(aura::Window* root_window) override { |
255 return NULL; | 255 return NULL; |
256 } | 256 } |
257 ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) override { | 257 ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) override { |
258 return NULL; | 258 return NULL; |
259 } | 259 } |
260 bool IsDraggable() override { return false; } | 260 bool IsDraggable() override { return false; } |
261 bool CanPin() const override { | 261 bool CanPin() const override { |
262 return launcher_controller()->CanPin(app_id()); | 262 return launcher_controller()->CanPin(app_id()); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 | 645 |
646 private: | 646 private: |
647 TestBrowserWindow* CreateTestBrowserWindowAura() { | 647 TestBrowserWindow* CreateTestBrowserWindowAura() { |
648 scoped_ptr<aura::Window> window(new aura::Window(nullptr)); | 648 scoped_ptr<aura::Window> window(new aura::Window(nullptr)); |
649 window->set_id(0); | 649 window->set_id(0); |
650 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 650 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
651 window->Init(ui::LAYER_TEXTURED); | 651 window->Init(ui::LAYER_TEXTURED); |
652 aura::client::ParentWindowWithContext(window.get(), GetContext(), | 652 aura::client::ParentWindowWithContext(window.get(), GetContext(), |
653 gfx::Rect(200, 200)); | 653 gfx::Rect(200, 200)); |
654 | 654 |
655 return new TestBrowserWindowAura(window.Pass()); | 655 return new TestBrowserWindowAura(std::move(window)); |
656 } | 656 } |
657 | 657 |
658 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerTest); | 658 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerTest); |
659 }; | 659 }; |
660 | 660 |
661 #if defined(OS_CHROMEOS) | 661 #if defined(OS_CHROMEOS) |
662 | 662 |
663 // Watches WebContents and blocks until it is destroyed. This is needed for | 663 // Watches WebContents and blocks until it is destroyed. This is needed for |
664 // the destruction of a V2 application. | 664 // the destruction of a V2 application. |
665 class WebContentsDestroyedWatcher : public content::WebContentsObserver { | 665 class WebContentsDestroyedWatcher : public content::WebContentsObserver { |
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2766 | 2766 |
2767 EXPECT_EQ(1, app_icon_loader->fetch_count()); | 2767 EXPECT_EQ(1, app_icon_loader->fetch_count()); |
2768 ASSERT_EQ(initial_size + 1, model_->items().size()); | 2768 ASSERT_EQ(initial_size + 1, model_->items().size()); |
2769 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); | 2769 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); |
2770 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); | 2770 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); |
2771 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); | 2771 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); |
2772 | 2772 |
2773 launcher_controller_->UnpinAppWithID("1"); | 2773 launcher_controller_->UnpinAppWithID("1"); |
2774 ASSERT_EQ(initial_size, model_->items().size()); | 2774 ASSERT_EQ(initial_size, model_->items().size()); |
2775 } | 2775 } |
OLD | NEW |