| 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_view.h" | 5 #include "chrome/browser/chromeos/status/status_area_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/browser/chromeos/status/accessibility_menu_button.h" |
| 10 #include "chrome/browser/chromeos/status/caps_lock_menu_button.h" | 11 #include "chrome/browser/chromeos/status/caps_lock_menu_button.h" |
| 11 #include "chrome/browser/chromeos/status/clock_menu_button.h" | 12 #include "chrome/browser/chromeos/status/clock_menu_button.h" |
| 12 #include "chrome/browser/chromeos/status/input_method_menu_button.h" | 13 #include "chrome/browser/chromeos/status/input_method_menu_button.h" |
| 13 #include "chrome/browser/chromeos/status/memory_menu_button.h" | 14 #include "chrome/browser/chromeos/status/memory_menu_button.h" |
| 14 #include "chrome/browser/chromeos/status/network_menu_button.h" | 15 #include "chrome/browser/chromeos/status/network_menu_button.h" |
| 15 #include "chrome/browser/chromeos/status/power_menu_button.h" | 16 #include "chrome/browser/chromeos/status/power_menu_button.h" |
| 16 #include "chrome/browser/chromeos/status/status_area_host.h" | 17 #include "chrome/browser/chromeos/status/status_area_host.h" |
| 17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 18 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
| 21 #include "views/border.h" | 22 #include "views/border.h" |
| 22 #include "views/controls/image_view.h" | 23 #include "views/controls/image_view.h" |
| 23 | 24 |
| 24 namespace chromeos { | 25 namespace chromeos { |
| 25 | 26 |
| 26 // Number of pixels to separate each icon. | 27 // Number of pixels to separate each icon. |
| 27 #if defined(TOUCH_UI) | 28 #if defined(TOUCH_UI) |
| 28 const int kSeparation = 25; | 29 const int kSeparation = 25; |
| 29 #else | 30 #else |
| 30 const int kSeparation = 5; | 31 const int kSeparation = 5; |
| 31 #endif | 32 #endif |
| 32 | 33 |
| 33 StatusAreaView::StatusAreaView(StatusAreaHost* host) | 34 StatusAreaView::StatusAreaView(StatusAreaHost* host) |
| 34 : host_(host), | 35 : host_(host), |
| 36 accessibility_view_(NULL), |
| 35 caps_lock_view_(NULL), | 37 caps_lock_view_(NULL), |
| 36 clock_view_(NULL), | 38 clock_view_(NULL), |
| 37 input_method_view_(NULL), | 39 input_method_view_(NULL), |
| 38 memory_view_(NULL), | 40 memory_view_(NULL), |
| 39 network_view_(NULL), | 41 network_view_(NULL), |
| 40 power_view_(NULL) { | 42 power_view_(NULL) { |
| 41 } | 43 } |
| 42 | 44 |
| 43 void StatusAreaView::Init() { | 45 void StatusAreaView::Init() { |
| 44 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget)) { | 46 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget)) { |
| 45 memory_view_ = new MemoryMenuButton(host_); | 47 memory_view_ = new MemoryMenuButton(host_); |
| 46 AddChildView(memory_view_); | 48 AddChildView(memory_view_); |
| 47 } | 49 } |
| 48 | 50 |
| 51 accessibility_view_ = new AccessibilityMenuButton(host_); |
| 52 accessibility_view_->set_border(views::Border::CreateEmptyBorder(0, 1, 0, 0)); |
| 53 AddChildView(accessibility_view_); |
| 54 |
| 49 caps_lock_view_ = new CapsLockMenuButton(host_); | 55 caps_lock_view_ = new CapsLockMenuButton(host_); |
| 50 caps_lock_view_->set_border(views::Border::CreateEmptyBorder(0, 1, 0, 0)); | 56 caps_lock_view_->set_border(views::Border::CreateEmptyBorder(0, 1, 0, 0)); |
| 51 AddChildView(caps_lock_view_); | 57 AddChildView(caps_lock_view_); |
| 52 | 58 |
| 53 clock_view_ = new ClockMenuButton(host_); | 59 clock_view_ = new ClockMenuButton(host_); |
| 54 clock_view_->set_border(views::Border::CreateEmptyBorder(0, 1, 0, 0)); | 60 clock_view_->set_border(views::Border::CreateEmptyBorder(0, 1, 0, 0)); |
| 55 AddChildView(clock_view_); | 61 AddChildView(clock_view_); |
| 56 | 62 |
| 57 input_method_view_ = new InputMethodMenuButton(host_); | 63 input_method_view_ = new InputMethodMenuButton(host_); |
| 58 AddChildView(input_method_view_); | 64 AddChildView(input_method_view_); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 network_view()->set_active(active); | 124 network_view()->set_active(active); |
| 119 power_view()->set_active(active); | 125 power_view()->set_active(active); |
| 120 } | 126 } |
| 121 | 127 |
| 122 void StatusAreaView::ButtonVisibilityChanged(views::View* button_view) { | 128 void StatusAreaView::ButtonVisibilityChanged(views::View* button_view) { |
| 123 Layout(); | 129 Layout(); |
| 124 PreferredSizeChanged(); | 130 PreferredSizeChanged(); |
| 125 } | 131 } |
| 126 | 132 |
| 127 } // namespace chromeos | 133 } // namespace chromeos |
| OLD | NEW |