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

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

Issue 9570013: Activate the status area only when it's focused using the keyboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: uber tray support Created 8 years, 9 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
« no previous file with comments | « no previous file | ash/wm/activation_controller.cc » ('j') | ash/wm/activation_controller.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include "ash/shell.h"
7 #include "ash/shell/panel_window.h" 8 #include "ash/shell/panel_window.h"
9 #include "ash/shell_delegate.h"
8 #include "ash/system/tray/system_tray_item.h" 10 #include "ash/system/tray/system_tray_item.h"
9 #include "ash/wm/shadow_types.h" 11 #include "ash/wm/shadow_types.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
12 #include "third_party/skia/include/core/SkColor.h" 14 #include "third_party/skia/include/core/SkColor.h"
15 #include "ui/aura/client/activation_client.h"
13 #include "ui/views/border.h" 16 #include "ui/views/border.h"
14 #include "ui/views/bubble/bubble_delegate.h" 17 #include "ui/views/bubble/bubble_delegate.h"
15 #include "ui/views/controls/label.h" 18 #include "ui/views/controls/label.h"
16 #include "ui/views/layout/box_layout.h" 19 #include "ui/views/layout/box_layout.h"
17 #include "ui/views/view.h" 20 #include "ui/views/view.h"
18 21
19 namespace { 22 namespace {
20 23
21 const int kTrayIconHeight = 50; 24 const int kTrayIconHeight = 50;
22 const int kPadding = 5; 25 const int kPadding = 5;
(...skipping 12 matching lines...) Expand all
35 38
36 virtual ~SystemTrayBubble() { 39 virtual ~SystemTrayBubble() {
37 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); 40 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin();
38 it != items_.end(); 41 it != items_.end();
39 ++it) { 42 ++it) {
40 if (detailed_) 43 if (detailed_)
41 (*it)->DestroyDetailedView(); 44 (*it)->DestroyDetailedView();
42 else 45 else
43 (*it)->DestroyDefaultView(); 46 (*it)->DestroyDefaultView();
44 } 47 }
48 ActivateBrowserWindow();
45 } 49 }
46 50
47 private: 51 private:
48 // Overridden from views::BubbleDelegateView. 52 // Overridden from views::BubbleDelegateView.
49 virtual void Init() OVERRIDE { 53 virtual void Init() OVERRIDE {
50 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 54 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical,
51 0, 0, 1)); 55 0, 0, 1));
52 56
53 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); 57 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin();
54 it != items_.end(); 58 it != items_.end();
55 ++it) { 59 ++it) {
56 views::View* view = detailed_ ? (*it)->CreateDetailedView() : 60 views::View* view = detailed_ ? (*it)->CreateDetailedView() :
57 (*it)->CreateDefaultView(); 61 (*it)->CreateDefaultView();
58 if (it != items_.begin()) 62 if (it != items_.begin())
59 view->set_border(views::Border::CreateSolidSidedBorder( 63 view->set_border(views::Border::CreateSolidSidedBorder(
60 1, 0, 0, 0, SkColorSetARGB(25, 0, 0, 0))); 64 1, 0, 0, 0, SkColorSetARGB(25, 0, 0, 0)));
61 AddChildView(view); 65 AddChildView(view);
62 } 66 }
63 } 67 }
64 68
69 void ActivateBrowserWindow() {
70 const std::vector<aura::Window*>& windows =
71 ash::Shell::GetInstance()->delegate()->GetCycleWindowList(
Daniel Erat 2012/03/02 16:49:19 it seems a bit strange to have this class reach in
Yusuke Sato 2012/03/05 12:56:24 Removed the code. Modified kWindowContainerIds[] i
72 ash::ShellDelegate::SOURCE_LAUNCHER, ash::ShellDelegate::ORDER_MRU);
73 if (!windows.empty()) {
74 aura::client::GetActivationClient(ash::Shell::GetRootWindow())->
75 ActivateWindow(windows[0]);
76 }
77 }
78
65 ash::SystemTray* tray_; 79 ash::SystemTray* tray_;
66 std::vector<ash::SystemTrayItem*> items_; 80 std::vector<ash::SystemTrayItem*> items_;
67 bool detailed_; 81 bool detailed_;
68 82
69 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubble); 83 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubble);
70 }; 84 };
71 85
72 } // namespace 86 } // namespace
73 87
74 namespace ash { 88 namespace ash {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 ShowItems(items_, false); 141 ShowItems(items_, false);
128 return true; 142 return true;
129 } 143 }
130 144
131 void SystemTray::OnWidgetClosing(views::Widget* widget) { 145 void SystemTray::OnWidgetClosing(views::Widget* widget) {
132 CHECK_EQ(popup_, widget); 146 CHECK_EQ(popup_, widget);
133 popup_ = NULL; 147 popup_ = NULL;
134 } 148 }
135 149
136 } // namespace ash 150 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/activation_controller.cc » ('j') | ash/wm/activation_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698