• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
12 namespace athena {
13 
ActivityWidgetDelegate(ActivityViewModel * view_model)14 ActivityWidgetDelegate::ActivityWidgetDelegate(ActivityViewModel* view_model)
15     : view_model_(view_model) {
16 }
17 
~ActivityWidgetDelegate()18 ActivityWidgetDelegate::~ActivityWidgetDelegate() {
19 }
20 
GetWindowTitle() const21 base::string16 ActivityWidgetDelegate::GetWindowTitle() const {
22   return view_model_->GetTitle();
23 }
24 
DeleteDelegate()25 void ActivityWidgetDelegate::DeleteDelegate() {
26   delete this;
27 }
28 
GetWidget()29 views::Widget* ActivityWidgetDelegate::GetWidget() {
30   return GetContentsView()->GetWidget();
31 }
32 
GetWidget() const33 const views::Widget* ActivityWidgetDelegate::GetWidget() const {
34   return const_cast<ActivityWidgetDelegate*>(this)->GetWidget();
35 }
36 
GetContentsView()37 views::View* ActivityWidgetDelegate::GetContentsView() {
38   return view_model_->GetContentsView();
39 }
40 
CreateClientView(views::Widget * widget)41 views::ClientView* ActivityWidgetDelegate::CreateClientView(
42     views::Widget* widget) {
43   return new views::ClientView(widget, view_model_->GetContentsView());
44 }
45 
CreateNonClientFrameView(views::Widget * widget)46 views::NonClientFrameView* ActivityWidgetDelegate::CreateNonClientFrameView(
47     views::Widget* widget) {
48   return new ActivityFrameView(widget, view_model_);
49 }
50 
51 }  // namespace athena
52