OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "athena/activity/public/activity_view_manager.h" | 5 #include "athena/activity/public/activity_view_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "athena/activity/public/activity.h" | 10 #include "athena/activity/public/activity.h" |
11 #include "athena/activity/public/activity_view_model.h" | 11 #include "athena/activity/public/activity_view_model.h" |
12 #include "athena/screen/public/screen_manager.h" | 12 #include "athena/screen/public/screen_manager.h" |
13 #include "base/strings/utf_string_conversions.h" | |
14 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
15 #include "ui/views/background.h" | 14 #include "ui/views/background.h" |
16 #include "ui/views/controls/label.h" | 15 #include "ui/views/controls/label.h" |
17 #include "ui/views/layout/layout_manager.h" | 16 #include "ui/views/layout/layout_manager.h" |
18 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
19 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
20 | 19 |
21 namespace athena { | 20 namespace athena { |
22 namespace { | 21 namespace { |
23 | 22 |
(...skipping 28 matching lines...) Expand all Loading... |
52 } | 51 } |
53 | 52 |
54 virtual ~ActivityWidget() {} | 53 virtual ~ActivityWidget() {} |
55 | 54 |
56 void Show() { | 55 void Show() { |
57 Update(); | 56 Update(); |
58 widget_->Show(); | 57 widget_->Show(); |
59 } | 58 } |
60 | 59 |
61 void Update() { | 60 void Update() { |
62 title_->SetText( | 61 title_->SetText(activity_->GetActivityViewModel()->GetTitle()); |
63 base::UTF8ToUTF16(activity_->GetActivityViewModel()->GetTitle())); | |
64 SkColor bgcolor = | 62 SkColor bgcolor = |
65 activity_->GetActivityViewModel()->GetRepresentativeColor(); | 63 activity_->GetActivityViewModel()->GetRepresentativeColor(); |
66 title_->set_background(views::Background::CreateSolidBackground(bgcolor)); | 64 title_->set_background(views::Background::CreateSolidBackground(bgcolor)); |
67 title_->SetBackgroundColor(bgcolor); | 65 title_->SetBackgroundColor(bgcolor); |
68 } | 66 } |
69 | 67 |
70 private: | 68 private: |
71 // views::LayoutManager: | 69 // views::LayoutManager: |
72 virtual void Layout(views::View* host) OVERRIDE { | 70 virtual void Layout(views::View* host) OVERRIDE { |
73 CHECK_EQ(container_, host); | 71 CHECK_EQ(container_, host); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 ActivityViewManager* ActivityViewManager::Get() { | 151 ActivityViewManager* ActivityViewManager::Get() { |
154 return instance; | 152 return instance; |
155 } | 153 } |
156 | 154 |
157 void ActivityViewManager::Shutdown() { | 155 void ActivityViewManager::Shutdown() { |
158 CHECK(instance); | 156 CHECK(instance); |
159 delete instance; | 157 delete instance; |
160 } | 158 } |
161 | 159 |
162 } // namespace athena | 160 } // namespace athena |
OLD | NEW |