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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
Index: ash/system/chromeos/label_tray_view.cc
diff --git a/ash/system/chromeos/label_tray_view.cc b/ash/system/chromeos/label_tray_view.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cf3604a2e31b6b5b7dda49e379b1123d06663d22
--- /dev/null
+++ b/ash/system/chromeos/label_tray_view.cc
@@ -0,0 +1,61 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/system/chromeos/label_tray_view.h"
+
+#include "ash/system/tray/hover_highlight_view.h"
+#include "ash/system/tray/tray_constants.h"
+#include "ash/system/tray/tray_views.h"
+#include "ash/system/tray/view_click_listener.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/font.h"
+#include "ui/views/controls/label.h"
+#include "ui/views/layout/fill_layout.h"
+
+namespace ash {
+namespace internal {
+
+LabelTrayView::LabelTrayView(ViewClickListener* click_listener,
+ int icon_resource_id)
+ : click_listener_(click_listener),
+ icon_resource_id_(icon_resource_id) {
+ SetLayoutManager(new views::FillLayout());
+ SetVisible(false);
+}
+
+LabelTrayView::~LabelTrayView() {
+}
+
+void LabelTrayView::SetMessage(const base::string16& message) {
+ if (message_ == message)
+ return;
+
+ message_ = message;
+ RemoveAllChildViews(true);
+ if (!message_.empty()) {
+ AddChildView(CreateChildView(message_));
+ SetVisible(true);
+ } else {
+ SetVisible(false);
+ }
+}
+
+views::View* LabelTrayView::CreateChildView(
+ const base::string16& message) const {
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ const gfx::ImageSkia* icon =
+ 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.
+ HoverHighlightView* child = new HoverHighlightView(click_listener_);
+ child->AddIconAndLabel(*icon, message, gfx::Font::NORMAL);
+ child->text_label()->SetMultiLine(true);
+ child->text_label()->SetAllowCharacterBreak(true);
+ child->set_border(views::Border::CreateEmptyBorder(0,
+ kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingHorizontal));
+ child->SetExpandable(true);
+ child->SetVisible(true);
+ return child;
+}
+
+} // namespace internal
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698