summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-16 05:09:31 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-16 05:09:31 +0000
commitddd9eb3adb36396909504a335f933cb8d2dd7439 (patch)
tree05b8765a4c0f290f6a41e4bcb7954e982f2626d7 /ash
parent9b90ef84c9e044c6b3697c0fea7ad803c2118106 (diff)
downloadchromium_src-ddd9eb3adb36396909504a335f933cb8d2dd7439.zip
chromium_src-ddd9eb3adb36396909504a335f933cb8d2dd7439.tar.gz
chromium_src-ddd9eb3adb36396909504a335f933cb8d2dd7439.tar.bz2
ash: Extract FixedSizedImageView into its own component(.h,.cc).
BUG=174228 R=jennyz@chromium.org,jamescook@chromium.org Review URL: https://chromiumcodereview.appspot.com/12277012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182935 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/ash.gyp2
-rw-r--r--ash/system/brightness/tray_brightness.cc2
-rw-r--r--ash/system/chromeos/tray_display.cc1
-rw-r--r--ash/system/power/power_status_view.cc3
-rw-r--r--ash/system/settings/tray_settings.cc1
-rw-r--r--ash/system/tray/fixed_sized_image_view.cc27
-rw-r--r--ash/system/tray/fixed_sized_image_view.h35
-rw-r--r--ash/system/tray/tray_item_more.cc1
-rw-r--r--ash/system/tray/tray_views.cc20
-rw-r--r--ash/system/tray/tray_views.h16
-rw-r--r--ash/system/tray_caps_lock.cc1
-rw-r--r--ash/system/tray_update.cc1
12 files changed, 73 insertions, 37 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 70919cc..cd51c31 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -233,6 +233,8 @@
'system/status_area_widget.h',
'system/status_area_widget_delegate.cc',
'system/status_area_widget_delegate.h',
+ 'system/tray/fixed_sized_image_view.cc',
+ 'system/tray/fixed_sized_image_view.h',
'system/tray/special_popup_row.cc',
'system/tray/special_popup_row.h',
'system/tray/system_tray.cc',
diff --git a/ash/system/brightness/tray_brightness.cc b/ash/system/brightness/tray_brightness.cc
index 1d9abf4..12fad9f 100644
--- a/ash/system/brightness/tray_brightness.cc
+++ b/ash/system/brightness/tray_brightness.cc
@@ -8,6 +8,7 @@
#include "ash/ash_constants.h"
#include "ash/shell.h"
#include "ash/system/brightness/brightness_control_delegate.h"
+#include "ash/system/tray/fixed_sized_image_view.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/system_tray_notifier.h"
#include "ash/system/tray/tray_constants.h"
@@ -24,7 +25,6 @@
#include "ui/views/controls/label.h"
#include "ui/views/controls/slider.h"
#include "ui/views/layout/box_layout.h"
-#include "ui/views/controls/image_view.h"
#include "ui/views/view.h"
namespace ash {
diff --git a/ash/system/chromeos/tray_display.cc b/ash/system/chromeos/tray_display.cc
index dd75fed..0401e23 100644
--- a/ash/system/chromeos/tray_display.cc
+++ b/ash/system/chromeos/tray_display.cc
@@ -8,6 +8,7 @@
#include "ash/display/display_manager.h"
#include "ash/screen_ash.h"
#include "ash/shell.h"
+#include "ash/system/tray/fixed_sized_image_view.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/tray_constants.h"
diff --git a/ash/system/power/power_status_view.cc b/ash/system/power/power_status_view.cc
index 5ca6b2e..a268d3a 100644
--- a/ash/system/power/power_status_view.cc
+++ b/ash/system/power/power_status_view.cc
@@ -7,13 +7,14 @@
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/system/power/tray_power.h"
+#include "ash/system/tray/fixed_sized_image_view.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_views.h"
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "grit/ash_strings.h"
-#include "ui/base/resource/resource_bundle.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
diff --git a/ash/system/settings/tray_settings.cc b/ash/system/settings/tray_settings.cc
index 8cc12d6..7445e32 100644
--- a/ash/system/settings/tray_settings.cc
+++ b/ash/system/settings/tray_settings.cc
@@ -6,6 +6,7 @@
#include "ash/shell.h"
#include "ash/system/power/power_status_view.h"
+#include "ash/system/tray/fixed_sized_image_view.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/system_tray_notifier.h"
#include "ash/system/tray/tray_constants.h"
diff --git a/ash/system/tray/fixed_sized_image_view.cc b/ash/system/tray/fixed_sized_image_view.cc
new file mode 100644
index 0000000..d0d49b9
--- /dev/null
+++ b/ash/system/tray/fixed_sized_image_view.cc
@@ -0,0 +1,27 @@
+// Copyright 2013 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/tray/fixed_sized_image_view.h"
+
+namespace ash {
+namespace internal {
+
+FixedSizedImageView::FixedSizedImageView(int width, int height)
+ : width_(width),
+ height_(height) {
+ SetHorizontalAlignment(views::ImageView::CENTER);
+ SetVerticalAlignment(views::ImageView::CENTER);
+}
+
+FixedSizedImageView::~FixedSizedImageView() {
+}
+
+gfx::Size FixedSizedImageView::GetPreferredSize() {
+ gfx::Size size = views::ImageView::GetPreferredSize();
+ return gfx::Size(width_ ? width_ : size.width(),
+ height_ ? height_ : size.height());
+}
+
+} // namespace internal
+} // namespace ash
diff --git a/ash/system/tray/fixed_sized_image_view.h b/ash/system/tray/fixed_sized_image_view.h
new file mode 100644
index 0000000..1e5c7cd
--- /dev/null
+++ b/ash/system/tray/fixed_sized_image_view.h
@@ -0,0 +1,35 @@
+// Copyright 2013 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.
+
+#ifndef ASH_SYSTEM_TRAY_FIXED_SIZED_IMAGE_VIEW_H_
+#define ASH_SYSTEM_TRAY_FIXED_SIZED_IMAGE_VIEW_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ui/views/controls/image_view.h"
+
+namespace ash {
+namespace internal {
+
+// An image view with a specified width and height (kTrayPopupDetailsIconWidth).
+// If the specified width or height is zero, then the image size is used for
+// that dimension.
+class FixedSizedImageView : public views::ImageView {
+ public:
+ FixedSizedImageView(int width, int height);
+ virtual ~FixedSizedImageView();
+
+ private:
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+
+ int width_;
+ int height_;
+
+ DISALLOW_COPY_AND_ASSIGN(FixedSizedImageView);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_SYSTEM_TRAY_FIXED_SIZED_IMAGE_VIEW_H_
diff --git a/ash/system/tray/tray_item_more.cc b/ash/system/tray/tray_item_more.cc
index a54e5a4..f13b2f1 100644
--- a/ash/system/tray/tray_item_more.cc
+++ b/ash/system/tray/tray_item_more.cc
@@ -4,6 +4,7 @@
#include "ash/system/tray/tray_item_more.h"
+#include "ash/system/tray/fixed_sized_image_view.h"
#include "ash/system/tray/system_tray_item.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_views.h"
diff --git a/ash/system/tray/tray_views.cc b/ash/system/tray/tray_views.cc
index f44d49e..06f8699 100644
--- a/ash/system/tray/tray_views.cc
+++ b/ash/system/tray/tray_views.cc
@@ -5,6 +5,7 @@
#include "ash/system/tray/tray_views.h"
#include "ash/ash_constants.h"
+#include "ash/system/tray/fixed_sized_image_view.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_item_view.h"
#include "base/i18n/rtl.h"
@@ -84,25 +85,6 @@ const int kTrayPopupLabelButtonBorderImagesHovered[] = {
}
////////////////////////////////////////////////////////////////////////////////
-// FixedSizedImageView
-
-FixedSizedImageView::FixedSizedImageView(int width, int height)
- : width_(width),
- height_(height) {
- SetHorizontalAlignment(views::ImageView::CENTER);
- SetVerticalAlignment(views::ImageView::CENTER);
-}
-
-FixedSizedImageView::~FixedSizedImageView() {
-}
-
-gfx::Size FixedSizedImageView::GetPreferredSize() {
- gfx::Size size = views::ImageView::GetPreferredSize();
- return gfx::Size(width_ ? width_ : size.width(),
- height_ ? height_ : size.height());
-}
-
-////////////////////////////////////////////////////////////////////////////////
// ActionableView
ActionableView::ActionableView()
diff --git a/ash/system/tray/tray_views.h b/ash/system/tray/tray_views.h
index 7b458dd..6950f91 100644
--- a/ash/system/tray/tray_views.h
+++ b/ash/system/tray/tray_views.h
@@ -34,22 +34,6 @@ namespace internal {
class TrayItemView;
-// An image view with a specified width and height (kTrayPopupDetailsIconWidth).
-// If the specified width or height is zero, then the image size is used for
-// that dimension.
-class FixedSizedImageView : public views::ImageView {
- public:
- FixedSizedImageView(int width, int height);
- virtual ~FixedSizedImageView();
-
- private:
- virtual gfx::Size GetPreferredSize() OVERRIDE;
-
- int width_;
- int height_;
- DISALLOW_COPY_AND_ASSIGN(FixedSizedImageView);
-};
-
// A focusable view that performs an action when user clicks on it, or presses
// enter or space when focused. Note that the action is triggered on mouse-up,
// instead of on mouse-down. So if user presses the mouse on the view, then
diff --git a/ash/system/tray_caps_lock.cc b/ash/system/tray_caps_lock.cc
index 6985533..9c0a7f1 100644
--- a/ash/system/tray_caps_lock.cc
+++ b/ash/system/tray_caps_lock.cc
@@ -6,6 +6,7 @@
#include "ash/caps_lock_delegate.h"
#include "ash/shell.h"
+#include "ash/system/tray/fixed_sized_image_view.h"
#include "ash/system/tray/system_tray_notifier.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_views.h"
diff --git a/ash/system/tray_update.cc b/ash/system/tray_update.cc
index 9843766..f448e30 100644
--- a/ash/system/tray_update.cc
+++ b/ash/system/tray_update.cc
@@ -7,6 +7,7 @@
#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/system/status_area_widget.h"
+#include "ash/system/tray/fixed_sized_image_view.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/system_tray_notifier.h"