1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "athena/activity/activity_widget_delegate.h" 6 7#include "athena/activity/activity_frame_view.h" 8#include "athena/activity/public/activity_view_model.h" 9#include "ui/views/view.h" 10#include "ui/views/window/client_view.h" 11 12namespace athena { 13 14ActivityWidgetDelegate::ActivityWidgetDelegate(ActivityViewModel* view_model) 15 : view_model_(view_model) { 16} 17 18ActivityWidgetDelegate::~ActivityWidgetDelegate() { 19} 20 21base::string16 ActivityWidgetDelegate::GetWindowTitle() const { 22 return view_model_->GetTitle(); 23} 24 25void ActivityWidgetDelegate::DeleteDelegate() { 26 delete this; 27} 28 29views::Widget* ActivityWidgetDelegate::GetWidget() { 30 return GetContentsView()->GetWidget(); 31} 32 33const views::Widget* ActivityWidgetDelegate::GetWidget() const { 34 return const_cast<ActivityWidgetDelegate*>(this)->GetWidget(); 35} 36 37views::View* ActivityWidgetDelegate::GetContentsView() { 38 return view_model_->GetContentsView(); 39} 40 41views::ClientView* ActivityWidgetDelegate::CreateClientView( 42 views::Widget* widget) { 43 return new views::ClientView(widget, view_model_->GetContentsView()); 44} 45 46views::NonClientFrameView* ActivityWidgetDelegate::CreateNonClientFrameView( 47 views::Widget* widget) { 48 return new ActivityFrameView(widget, view_model_); 49} 50 51} // namespace athena 52