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

Side by Side Diff: ash/system/chromeos/label_tray_view.cc

Issue 14507003: Add tray warning for Locally managed users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes Created 7 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/system/chromeos/label_tray_view.h"
6
7 #include "ash/system/tray/hover_highlight_view.h"
8 #include "ash/system/tray/tray_constants.h"
9 #include "ash/system/tray/tray_views.h"
10 #include "ash/system/tray/view_click_listener.h"
11 #include "ui/base/resource/resource_bundle.h"
12 #include "ui/gfx/font.h"
13 #include "ui/views/controls/label.h"
14 #include "ui/views/layout/fill_layout.h"
15
16 namespace ash {
17 namespace internal {
18
19 LabelTrayView::LabelTrayView(ViewClickListener* click_listener,
20 int icon_resource_id)
21 : click_listener_(click_listener),
22 icon_resource_id_(icon_resource_id) {
23 SetLayoutManager(new views::FillLayout());
24 SetVisible(false);
25 }
26
27 LabelTrayView::~LabelTrayView() {
28 }
29
30 void LabelTrayView::SetMessage(const base::string16& message) {
31 if (message_ == message)
32 return;
33
34 message_ = message;
35 RemoveAllChildViews(true);
36 if (!message_.empty()) {
37 AddChildView(CreateChildView(message_));
38 SetVisible(true);
39 } else {
40 SetVisible(false);
41 }
42 }
43
44 views::View* LabelTrayView::CreateChildView(
45 const base::string16& message) const {
46 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
47 const gfx::ImageSkia* icon =
48 rb.GetImageSkiaNamed(icon_resource_id_);
Daniel Erat 2013/04/29 14:34:27 nit: i don't think this line needs to be wrapped
Denis Kuznetsov (DE-MUC) 2013/04/30 10:29:28 Done.
49 HoverHighlightView* child = new HoverHighlightView(click_listener_);
50 child->AddIconAndLabel(*icon, message, gfx::Font::NORMAL);
51 child->text_label()->SetMultiLine(true);
52 child->text_label()->SetAllowCharacterBreak(true);
53 child->set_border(views::Border::CreateEmptyBorder(0,
54 kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingHorizontal));
55 child->SetExpandable(true);
56 child->SetVisible(true);
57 return child;
58 }
59
60 } // namespace internal
61 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698