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

Side by Side Diff: ash/system/tray/system_tray_bubble.cc

Issue 11377133: Customize user details in ash system bubble for public account mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Massively overhauled and redone implementation. Created 8 years, 1 month 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/tray/system_tray_bubble.h" 5 #include "ash/system/tray/system_tray_bubble.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray.h" 8 #include "ash/system/tray/system_tray.h"
9 #include "ash/system/tray/system_tray_delegate.h" 9 #include "ash/system/tray/system_tray_delegate.h"
10 #include "ash/system/tray/system_tray_item.h" 10 #include "ash/system/tray/system_tray_item.h"
11 #include "ash/system/tray/tray_bubble_wrapper.h" 11 #include "ash/system/tray/tray_bubble_wrapper.h"
12 #include "ash/system/tray/tray_constants.h" 12 #include "ash/system/tray/tray_constants.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
15 #include "ui/compositor/layer.h" 15 #include "ui/compositor/layer.h"
16 #include "ui/compositor/layer_animation_observer.h" 16 #include "ui/compositor/layer_animation_observer.h"
17 #include "ui/compositor/scoped_layer_animation_settings.h" 17 #include "ui/compositor/scoped_layer_animation_settings.h"
18 #include "ui/gfx/canvas.h" 18 #include "ui/gfx/canvas.h"
19 #include "ui/views/layout/box_layout.h" 19 #include "ui/views/layout/fill_layout.h"
20 #include "ui/views/view.h" 20 #include "ui/views/view.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 using views::TrayBubbleView; 23 using views::TrayBubbleView;
24 24
25 namespace ash { 25 namespace ash {
26 26
27 namespace { 27 namespace {
28 28
29 // Normally a detailed view is the same size as the default view. However, 29 // Normally a detailed view is the same size as the default view. However,
30 // when showing a detailed view directly (e.g. clicking on a notification), 30 // when showing a detailed view directly (e.g. clicking on a notification),
31 // we may not know the height of the default view, or the default view may 31 // we may not know the height of the default view, or the default view may
32 // be too short, so we use this as a default and minimum height for any 32 // be too short, so we use this as a default and minimum height for any
33 // detailed view. 33 // detailed view.
34 const int kDetailedBubbleMaxHeight = kTrayPopupItemHeight * 5; 34 const int kDetailedBubbleMaxHeight = kTrayPopupItemHeight * 5;
35 35
36 // A view with some special behaviour for tray items in the popup: 36 // A view with some special behaviour for tray items in the popup:
37 // - optionally changes background color on hover. 37 // - optionally changes background color on hover.
38 class TrayPopupItemContainer : public views::View { 38 class TrayPopupItemContainer : public views::View {
39 public: 39 public:
40 TrayPopupItemContainer(views::View* view, 40 TrayPopupItemContainer(views::View* view,
41 ShelfAlignment alignment, 41 ShelfAlignment alignment,
42 bool change_background) 42 bool change_background)
43 : hover_(false), 43 : hover_(false),
44 change_background_(change_background) { 44 change_background_(change_background) {
45 set_notify_enter_exit_on_child(true); 45 set_notify_enter_exit_on_child(true);
46 views::BoxLayout* layout = new views::BoxLayout( 46 SetLayoutManager(new views::FillLayout);
47 views::BoxLayout::kVertical, 0, 0, 0);
48 layout->set_spread_blank_space(true);
49 SetLayoutManager(layout);
50 SetPaintToLayer(view->layer() != NULL); 47 SetPaintToLayer(view->layer() != NULL);
51 if (view->layer()) 48 if (view->layer())
52 SetFillsBoundsOpaquely(view->layer()->fills_bounds_opaquely()); 49 SetFillsBoundsOpaquely(view->layer()->fills_bounds_opaquely());
53 AddChildView(view); 50 AddChildView(view);
54 SetVisible(view->visible()); 51 SetVisible(view->visible());
55 } 52 }
56 53
57 virtual ~TrayPopupItemContainer() {} 54 virtual ~TrayPopupItemContainer() {}
58 55
59 private: 56 private:
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 331 }
335 if (view) { 332 if (view) {
336 bubble_view_->AddChildView(new TrayPopupItemContainer( 333 bubble_view_->AddChildView(new TrayPopupItemContainer(
337 view, tray_->shelf_alignment(), bubble_type_ == BUBBLE_TYPE_DEFAULT)); 334 view, tray_->shelf_alignment(), bubble_type_ == BUBBLE_TYPE_DEFAULT));
338 } 335 }
339 } 336 }
340 } 337 }
341 338
342 } // namespace internal 339 } // namespace internal
343 } // namespace ash 340 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698