Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: ash/system/date/tray_date.cc

Issue 10235010: Prepare SystemTray to support notifications (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/system/date/tray_date.h" 5 #include "ash/system/date/tray_date.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/date/date_view.h" 8 #include "ash/system/date/date_view.h"
9 #include "ash/system/tray/system_tray_delegate.h" 9 #include "ash/system/tray/system_tray_delegate.h"
10 #include "ash/system/tray/tray_constants.h" 10 #include "ash/system/tray/tray_constants.h"
(...skipping 17 matching lines...) Expand all
28 #include "ui/views/layout/box_layout.h" 28 #include "ui/views/layout/box_layout.h"
29 #include "ui/views/view.h" 29 #include "ui/views/view.h"
30 #include "ui/views/widget/widget.h" 30 #include "ui/views/widget/widget.h"
31 #include "unicode/datefmt.h" 31 #include "unicode/datefmt.h"
32 #include "unicode/fieldpos.h" 32 #include "unicode/fieldpos.h"
33 #include "unicode/fmtable.h" 33 #include "unicode/fmtable.h"
34 34
35 namespace ash { 35 namespace ash {
36 namespace internal { 36 namespace internal {
37 37
38 TrayDate::TrayDate() { 38 TrayDate::TrayDate()
39 : date_tray_(NULL) {
39 } 40 }
40 41
41 TrayDate::~TrayDate() { 42 TrayDate::~TrayDate() {
42 } 43 }
43 44
44 views::View* TrayDate::CreateTrayView(user::LoginStatus status) { 45 views::View* TrayDate::CreateTrayView(user::LoginStatus status) {
45 date_tray_.reset(new tray::DateView(tray::DateView::TIME)); 46 DCHECK(date_tray_ == NULL);
47 date_tray_ = new tray::DateView(tray::DateView::TIME);
46 date_tray_->set_border( 48 date_tray_->set_border(
47 views::Border::CreateEmptyBorder(0, 10, 0, 7)); 49 views::Border::CreateEmptyBorder(0, 10, 0, 7));
48 SetupLabelForTray(date_tray_->label()); 50 SetupLabelForTray(date_tray_->label());
49 gfx::Font font = date_tray_->label()->font(); 51 gfx::Font font = date_tray_->label()->font();
50 date_tray_->label()->SetFont( 52 date_tray_->label()->SetFont(
51 font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD)); 53 font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD));
52 54
53 views::View* view = new TrayItemView; 55 views::View* view = new TrayItemView;
54 view->AddChildView(date_tray_.get()); 56 view->AddChildView(date_tray_);
55 return view; 57 return view;
56 } 58 }
57 59
58 views::View* TrayDate::CreateDefaultView(user::LoginStatus status) { 60 views::View* TrayDate::CreateDefaultView(user::LoginStatus status) {
59 return NULL; 61 return NULL;
60 } 62 }
61 63
62 views::View* TrayDate::CreateDetailedView(user::LoginStatus status) { 64 views::View* TrayDate::CreateDetailedView(user::LoginStatus status) {
63 return NULL; 65 return NULL;
64 } 66 }
65 67
66 void TrayDate::DestroyTrayView() { 68 void TrayDate::DestroyTrayView() {
67 date_tray_.reset(); 69 date_tray_ = NULL;
68 } 70 }
69 71
70 void TrayDate::DestroyDefaultView() { 72 void TrayDate::DestroyDefaultView() {
71 } 73 }
72 74
73 void TrayDate::DestroyDetailedView() { 75 void TrayDate::DestroyDetailedView() {
74 } 76 }
75 77
76 void TrayDate::UpdateAfterLoginStatusChange(user::LoginStatus status) { 78 void TrayDate::UpdateAfterLoginStatusChange(user::LoginStatus status) {
77 } 79 }
78 80
79 void TrayDate::OnDateFormatChanged() { 81 void TrayDate::OnDateFormatChanged() {
80 date_tray_->UpdateTimeFormat(); 82 date_tray_->UpdateTimeFormat();
81 } 83 }
82 84
83 void TrayDate::Refresh() { 85 void TrayDate::Refresh() {
84 date_tray_->UpdateText(); 86 date_tray_->UpdateText();
85 } 87 }
86 88
87 } // namespace internal 89 } // namespace internal
88 } // namespace ash 90 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698