OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/status/status_area_bubble.h" | 5 #include "chrome/browser/chromeos/status/status_area_bubble.h" |
6 | 6 |
7 #include "chrome/browser/ui/views/window.h" | 7 #include "chrome/browser/ui/views/window.h" |
8 #include "ui/base/accessibility/accessible_view_state.h" | 8 #include "ui/base/accessibility/accessible_view_state.h" |
9 #include "ui/views/controls/label.h" | 9 #include "ui/views/controls/label.h" |
10 #include "ui/views/layout/box_layout.h" | 10 #include "ui/views/layout/box_layout.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 // TODO(msw): Get color from theme/window color. | |
15 const SkColor kColor = SK_ColorWHITE; | |
16 | |
17 const size_t kCloseBubbleTimerInSec = 5; | 14 const size_t kCloseBubbleTimerInSec = 5; |
18 | 15 |
19 } // namespace | 16 } // namespace |
20 | 17 |
21 namespace chromeos { | 18 namespace chromeos { |
22 | 19 |
23 StatusAreaBubbleContentView::StatusAreaBubbleContentView( | 20 StatusAreaBubbleContentView::StatusAreaBubbleContentView( |
24 views::View* anchor_view, | 21 views::View* anchor_view, |
25 views::View* icon_view, | 22 views::View* icon_view, |
26 const string16& message) | 23 const string16& message) |
27 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT, kColor), | 24 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), |
28 icon_view_(icon_view), | 25 icon_view_(icon_view), |
29 message_view_(new views::Label(message)) { | 26 message_view_(new views::Label(message)) { |
30 // Padding around status. | 27 // Padding around status. |
31 const int kPadX = 10, kPadY = 5; | 28 const int kPadX = 10, kPadY = 5; |
32 // Padding between image and text. | 29 // Padding between image and text. |
33 const int kTextPadX = 10; | 30 const int kTextPadX = 10; |
34 | 31 |
35 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, | 32 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, |
36 kPadX, kPadY, kTextPadX)); | 33 kPadX, kPadY, kTextPadX)); |
37 AddChildView(icon_view_); | 34 AddChildView(icon_view_); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 100 } |
104 | 101 |
105 void StatusAreaBubbleController::HideBubble() { | 102 void StatusAreaBubbleController::HideBubble() { |
106 if (!IsBubbleShown()) | 103 if (!IsBubbleShown()) |
107 return; | 104 return; |
108 timer_.Stop(); // no-op if it's not running. | 105 timer_.Stop(); // no-op if it's not running. |
109 bubble_->GetWidget()->Close(); | 106 bubble_->GetWidget()->Close(); |
110 } | 107 } |
111 | 108 |
112 } // namespace chromeos | 109 } // namespace chromeos |
OLD | NEW |