1a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 2a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// found in the LICENSE file. 4a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 5a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "ash/test/test_shelf_item_delegate.h" 6a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 7a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "ash/wm/window_util.h" 8a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "ui/aura/window.h" 9a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 10a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)namespace ash { 11a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)namespace test { 12a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 13a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)TestShelfItemDelegate::TestShelfItemDelegate(aura::Window* window) 14a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) : window_(window) { 15a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)} 16a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 17a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)TestShelfItemDelegate::~TestShelfItemDelegate() { 18a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)} 19a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 20a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)bool TestShelfItemDelegate::ItemSelected(const ui::Event& event) { 21a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) if (window_) { 225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) if (window_->type() == ui::wm::WINDOW_TYPE_PANEL) 23a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) wm::MoveWindowToEventRoot(window_, event); 24a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) window_->Show(); 25a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) wm::ActivateWindow(window_); 26a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) } 27a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) return false; 28a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)} 29a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 30a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)base::string16 TestShelfItemDelegate::GetTitle() { 31a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) return window_ ? window_->title() : base::string16(); 32a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)} 33a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 34a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)ui::MenuModel* TestShelfItemDelegate::CreateContextMenu( 35a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) aura::Window* root_window) { 36a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) return NULL; 37a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)} 38a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 39a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)ShelfMenuModel* TestShelfItemDelegate::CreateApplicationMenu(int event_flags) { 40a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) return NULL; 41a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)} 42a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 43a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)bool TestShelfItemDelegate::IsDraggable() { 44a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) return true; 45a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)} 46a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 47a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)bool TestShelfItemDelegate::ShouldShowTooltip() { 48a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) return true; 49a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)} 50a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void TestShelfItemDelegate::Close() { 525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 54a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)} // namespace test 55a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)} // namespace ash 56