summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorglotov@google.com <glotov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-13 12:32:02 +0000
committerglotov@google.com <glotov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-13 12:32:02 +0000
commitd34f59d0a26db8dd33b52927fbfc425711655b32 (patch)
tree70da46a84b67da6a3af9358f7831b9eb6a3f1b7f /chrome
parentfdcf1be8a11acd9060fc3db1947dd1d78b568d9d (diff)
downloadchromium_src-d34f59d0a26db8dd33b52927fbfc425711655b32.zip
chromium_src-d34f59d0a26db8dd33b52927fbfc425711655b32.tar.gz
chromium_src-d34f59d0a26db8dd33b52927fbfc425711655b32.tar.bz2
Adding style notion to the TextButton.
Welcome screen uses different style of buttons. BUG=chromium-os:8468 TEST=none Review URL: http://codereview.chromium.org/4402001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66061 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/theme/textbutton_dropdown_b_h.pngbin0 -> 2807 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_b_p.pngbin0 -> 2804 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_bl_h.pngbin0 -> 2870 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_bl_p.pngbin0 -> 2836 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_br_h.pngbin0 -> 2839 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_br_p.pngbin0 -> 2834 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_c_h.pngbin0 -> 2813 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_c_p.pngbin0 -> 2793 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_l_h.pngbin0 -> 2824 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_l_p.pngbin0 -> 2822 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_r_h.pngbin0 -> 2821 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_r_p.pngbin0 -> 2831 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_t_h.pngbin0 -> 2800 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_t_p.pngbin0 -> 2802 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_tl_h.pngbin0 -> 2836 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_tl_p.pngbin0 -> 2841 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_tr_h.pngbin0 -> 2832 bytes
-rw-r--r--chrome/app/theme/textbutton_dropdown_tr_p.pngbin0 -> 2841 bytes
-rw-r--r--chrome/app/theme/theme_resources.grd18
-rw-r--r--chrome/browser/chromeos/login/network_selection_view.cc8
-rw-r--r--chrome/browser/chromeos/login/network_selection_view.h6
-rw-r--r--chrome/browser/chromeos/status/network_dropdown_button.cc8
-rw-r--r--chrome/browser/chromeos/status/network_dropdown_button.h4
-rw-r--r--chrome/browser/chromeos/views/dropdown_button.cc73
-rw-r--r--chrome/browser/chromeos/views/dropdown_button.h33
-rw-r--r--chrome/chrome_browser.gypi2
26 files changed, 139 insertions, 13 deletions
diff --git a/chrome/app/theme/textbutton_dropdown_b_h.png b/chrome/app/theme/textbutton_dropdown_b_h.png
new file mode 100644
index 0000000..e69324c
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_b_h.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_b_p.png b/chrome/app/theme/textbutton_dropdown_b_p.png
new file mode 100644
index 0000000..3446f9c
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_b_p.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_bl_h.png b/chrome/app/theme/textbutton_dropdown_bl_h.png
new file mode 100644
index 0000000..f1fce0d
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_bl_h.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_bl_p.png b/chrome/app/theme/textbutton_dropdown_bl_p.png
new file mode 100644
index 0000000..91506aa7
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_bl_p.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_br_h.png b/chrome/app/theme/textbutton_dropdown_br_h.png
new file mode 100644
index 0000000..3a54b0c
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_br_h.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_br_p.png b/chrome/app/theme/textbutton_dropdown_br_p.png
new file mode 100644
index 0000000..8fb9fb1
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_br_p.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_c_h.png b/chrome/app/theme/textbutton_dropdown_c_h.png
new file mode 100644
index 0000000..e777467
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_c_h.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_c_p.png b/chrome/app/theme/textbutton_dropdown_c_p.png
new file mode 100644
index 0000000..84c9ed0
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_c_p.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_l_h.png b/chrome/app/theme/textbutton_dropdown_l_h.png
new file mode 100644
index 0000000..9e10ed2f
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_l_h.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_l_p.png b/chrome/app/theme/textbutton_dropdown_l_p.png
new file mode 100644
index 0000000..a46ae7b
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_l_p.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_r_h.png b/chrome/app/theme/textbutton_dropdown_r_h.png
new file mode 100644
index 0000000..12db0c4
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_r_h.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_r_p.png b/chrome/app/theme/textbutton_dropdown_r_p.png
new file mode 100644
index 0000000..fc9a62a
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_r_p.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_t_h.png b/chrome/app/theme/textbutton_dropdown_t_h.png
new file mode 100644
index 0000000..8789156
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_t_h.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_t_p.png b/chrome/app/theme/textbutton_dropdown_t_p.png
new file mode 100644
index 0000000..2fb5de9
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_t_p.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_tl_h.png b/chrome/app/theme/textbutton_dropdown_tl_h.png
new file mode 100644
index 0000000..c30901e
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_tl_h.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_tl_p.png b/chrome/app/theme/textbutton_dropdown_tl_p.png
new file mode 100644
index 0000000..c87d3f1
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_tl_p.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_tr_h.png b/chrome/app/theme/textbutton_dropdown_tr_h.png
new file mode 100644
index 0000000..dd4dd3e
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_tr_h.png
Binary files differ
diff --git a/chrome/app/theme/textbutton_dropdown_tr_p.png b/chrome/app/theme/textbutton_dropdown_tr_p.png
new file mode 100644
index 0000000..776b57d
--- /dev/null
+++ b/chrome/app/theme/textbutton_dropdown_tr_p.png
Binary files differ
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index dd8672e..e6ad42c 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -590,6 +590,24 @@
<include name="IDR_SCROLL_THUMB_H" file="chromeos_scroll_thumb_h.png" type="BINDATA" />
<include name="IDR_SCROLL_THUMB_P" file="chromeos_scroll_thumb_p.png" type="BINDATA" />
<include name="IDR_SHUTDOWN_ICON" file="shutdown_icon.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_BOTTOM_H" file="textbutton_dropdown_b_h.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_BOTTOM_LEFT_H" file="textbutton_dropdown_bl_h.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_BOTTOM_LEFT_P" file="textbutton_dropdown_bl_p.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_BOTTOM_P" file="textbutton_dropdown_b_p.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_BOTTOM_RIGHT_H" file="textbutton_dropdown_br_h.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_BOTTOM_RIGHT_P" file="textbutton_dropdown_br_p.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_CENTER_H" file="textbutton_dropdown_c_h.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_CENTER_P" file="textbutton_dropdown_c_p.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_LEFT_H" file="textbutton_dropdown_l_h.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_LEFT_P" file="textbutton_dropdown_l_p.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_RIGHT_H" file="textbutton_dropdown_r_h.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_RIGHT_P" file="textbutton_dropdown_r_p.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_TOP_H" file="textbutton_dropdown_t_h.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_TOP_LEFT_H" file="textbutton_dropdown_tl_h.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_TOP_LEFT_P" file="textbutton_dropdown_tl_p.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_TOP_P" file="textbutton_dropdown_t_p.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_TOP_RIGHT_H" file="textbutton_dropdown_tr_h.png" type="BINDATA" />
+ <include name="IDR_DROPDOWN_TOP_RIGHT_P" file="textbutton_dropdown_tr_p.png" type="BINDATA" />
</if>
</includes>
</release>
diff --git a/chrome/browser/chromeos/login/network_selection_view.cc b/chrome/browser/chromeos/login/network_selection_view.cc
index 4c8ce93..5280d8b 100644
--- a/chrome/browser/chromeos/login/network_selection_view.cc
+++ b/chrome/browser/chromeos/login/network_selection_view.cc
@@ -65,7 +65,7 @@ const int kControlPaddingRow = 15;
const int kWelcomeTitleFontDelta = 5;
// Fixed size for language/keyboard/network controls height.
-const int kSelectionBoxHeight = 30;
+const int kSelectionBoxHeight = 29;
// Menu button is drawn using our custom icons in resources. See
// TextButtonBorder::Paint() for details. So this offset compensate
@@ -120,14 +120,14 @@ class NetworkControlReportOnActivate : public NetworkDropdownButton {
};
// MenuButton with custom processing on focus events.
-class NotifyingMenuButton : public views::MenuButton {
+class NotifyingMenuButton : public DropDownButton {
public:
NotifyingMenuButton(views::ButtonListener* listener,
const std::wstring& text,
views::ViewMenuDelegate* menu_delegate,
bool show_menu_marker,
NetworkScreenDelegate* delegate)
- : MenuButton(listener, text, menu_delegate, show_menu_marker),
+ : DropDownButton(listener, text, menu_delegate, show_menu_marker),
delegate_(delegate) {}
// Overridden from View:
@@ -305,7 +305,7 @@ void NetworkSelectionView::Init() {
select_keyboard_label_ = new views::Label();
select_keyboard_label_->SetFont(rb.GetFont(ResourceBundle::MediumFont));
- keyboards_menubutton_ = new views::MenuButton(
+ keyboards_menubutton_ = new DropDownButton(
NULL /* listener */, L"", delegate_->keyboard_switch_menu(),
true /* show_menu_marker */);
InitMenuButtonProperties(keyboards_menubutton_);
diff --git a/chrome/browser/chromeos/login/network_selection_view.h b/chrome/browser/chromeos/login/network_selection_view.h
index dfcc709..54626dd 100644
--- a/chrome/browser/chromeos/login/network_selection_view.h
+++ b/chrome/browser/chromeos/login/network_selection_view.h
@@ -9,7 +9,7 @@
#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "chrome/browser/chromeos/login/login_html_dialog.h"
-#include "views/controls/button/menu_button.h"
+#include "chrome/browser/chromeos/views/dropdown_button.h"
#include "views/controls/link.h"
#include "views/view.h"
#include "views/widget/widget_gtk.h"
@@ -105,8 +105,8 @@ class NetworkSelectionView : public views::View,
views::View* contents_view_;
// Screen controls.
- views::MenuButton* languages_menubutton_;
- views::MenuButton* keyboards_menubutton_;
+ DropDownButton* languages_menubutton_;
+ DropDownButton* keyboards_menubutton_;
views::Label* welcome_label_;
views::Label* select_language_label_;
views::Label* select_keyboard_label_;
diff --git a/chrome/browser/chromeos/status/network_dropdown_button.cc b/chrome/browser/chromeos/status/network_dropdown_button.cc
index d2be0ec..32ff4e6 100644
--- a/chrome/browser/chromeos/status/network_dropdown_button.cc
+++ b/chrome/browser/chromeos/status/network_dropdown_button.cc
@@ -25,10 +25,10 @@ const int NetworkDropdownButton::kThrobDuration = 1000;
NetworkDropdownButton::NetworkDropdownButton(bool browser_mode,
gfx::NativeWindow parent_window)
- : MenuButton(NULL,
- l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE),
- this,
- true),
+ : DropDownButton(NULL,
+ l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE),
+ this,
+ true),
browser_mode_(browser_mode),
ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)),
parent_window_(parent_window) {
diff --git a/chrome/browser/chromeos/status/network_dropdown_button.h b/chrome/browser/chromeos/status/network_dropdown_button.h
index ec2e337..a187f71 100644
--- a/chrome/browser/chromeos/status/network_dropdown_button.h
+++ b/chrome/browser/chromeos/status/network_dropdown_button.h
@@ -9,7 +9,7 @@
#include "app/throb_animation.h"
#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/status/network_menu.h"
-#include "views/controls/button/menu_button.h"
+#include "chrome/browser/chromeos/views/dropdown_button.h"
namespace chromeos {
@@ -17,7 +17,7 @@ namespace chromeos {
// This class will handle getting the networks to show connected network
// at top level and populating the menu.
// See NetworkMenu for more details.
-class NetworkDropdownButton : public views::MenuButton,
+class NetworkDropdownButton : public DropDownButton,
public NetworkMenu,
public NetworkLibrary::NetworkManagerObserver {
public:
diff --git a/chrome/browser/chromeos/views/dropdown_button.cc b/chrome/browser/chromeos/views/dropdown_button.cc
new file mode 100644
index 0000000..58e9d368
--- /dev/null
+++ b/chrome/browser/chromeos/views/dropdown_button.cc
@@ -0,0 +1,73 @@
+// Copyright (c) 2010 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 "app/resource_bundle.h"
+#include "chrome/browser/chromeos/views/dropdown_button.h"
+#include "gfx/canvas_skia.h"
+#include "grit/theme_resources.h"
+
+namespace {
+// Asset icon particularities makes us offset focus frame.
+const int kFocusFrameTopOffset = 0;
+const int kFocusFrameLeftOffset = 0;
+const int kFocusFrameRightOffset = 0;
+const int kFocusFrameBottomOffset = 1;
+
+// TextButtonBorder specification that uses different icons to draw the
+// button.
+class DropDownButtonBorder : public views::TextButtonBorder {
+ public:
+ DropDownButtonBorder();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DropDownButtonBorder);
+};
+
+DropDownButtonBorder::DropDownButtonBorder() {
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+
+ hot_set_.top_left = rb.GetBitmapNamed(IDR_DROPDOWN_TOP_LEFT_H);
+ hot_set_.top = rb.GetBitmapNamed(IDR_DROPDOWN_TOP_H);
+ hot_set_.top_right = rb.GetBitmapNamed(IDR_DROPDOWN_TOP_RIGHT_H);
+ hot_set_.left = rb.GetBitmapNamed(IDR_DROPDOWN_LEFT_H);
+ hot_set_.center = rb.GetBitmapNamed(IDR_DROPDOWN_CENTER_H);
+ hot_set_.right = rb.GetBitmapNamed(IDR_DROPDOWN_RIGHT_H);
+ hot_set_.bottom_left = rb.GetBitmapNamed(IDR_DROPDOWN_BOTTOM_LEFT_H);
+ hot_set_.bottom = rb.GetBitmapNamed(IDR_DROPDOWN_BOTTOM_H);
+ hot_set_.bottom_right = rb.GetBitmapNamed(IDR_DROPDOWN_BOTTOM_RIGHT_H);
+
+ pushed_set_.top_left = rb.GetBitmapNamed(IDR_DROPDOWN_TOP_LEFT_P);
+ pushed_set_.top = rb.GetBitmapNamed(IDR_DROPDOWN_TOP_P);
+ pushed_set_.top_right = rb.GetBitmapNamed(IDR_DROPDOWN_TOP_RIGHT_P);
+ pushed_set_.left = rb.GetBitmapNamed(IDR_DROPDOWN_LEFT_P);
+ pushed_set_.center = rb.GetBitmapNamed(IDR_DROPDOWN_CENTER_P);
+ pushed_set_.right = rb.GetBitmapNamed(IDR_DROPDOWN_RIGHT_P);
+ pushed_set_.bottom_left = rb.GetBitmapNamed(IDR_DROPDOWN_BOTTOM_LEFT_P);
+ pushed_set_.bottom = rb.GetBitmapNamed(IDR_DROPDOWN_BOTTOM_P);
+ pushed_set_.bottom_right = rb.GetBitmapNamed(IDR_DROPDOWN_BOTTOM_RIGHT_P);
+}
+
+} // namespace
+
+namespace chromeos {
+
+DropDownButton::DropDownButton(views::ButtonListener* listener,
+ const std::wstring& text,
+ views::ViewMenuDelegate* menu_delegate,
+ bool show_menu_marker)
+ : MenuButton(listener, text, menu_delegate, show_menu_marker) {
+ set_border(new DropDownButtonBorder);
+}
+
+DropDownButton::~DropDownButton() {
+}
+
+void DropDownButton::PaintFocusBorder(gfx::Canvas* canvas) {
+ if (HasFocus() && (IsFocusable() || IsAccessibilityFocusableInRootView()))
+ canvas->DrawFocusRect(kFocusFrameLeftOffset, kFocusFrameTopOffset,
+ width() - kFocusFrameRightOffset,
+ height() - kFocusFrameBottomOffset);
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/views/dropdown_button.h b/chrome/browser/chromeos/views/dropdown_button.h
new file mode 100644
index 0000000..637b7fa
--- /dev/null
+++ b/chrome/browser/chromeos/views/dropdown_button.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2010 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 CHROME_BROWSER_CHROMEOS_VIEWS_DROPDOWN_BUTTON_H_
+#define CHROME_BROWSER_CHROMEOS_VIEWS_DROPDOWN_BUTTON_H_
+#pragma once
+
+#include <string>
+
+#include "views/controls/button/menu_button.h"
+
+namespace chromeos {
+
+// MenuButton specification that uses different icons to draw the button and
+// adjust focus frame accordingly to the icons particularities.
+class DropDownButton : public views::MenuButton {
+ public:
+ DropDownButton(views::ButtonListener* listener,
+ const std::wstring& text,
+ views::ViewMenuDelegate* menu_delegate,
+ bool show_menu_marker);
+ virtual ~DropDownButton();
+
+ virtual void PaintFocusBorder(gfx::Canvas* canvas);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DropDownButton);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_VIEWS_DROPDOWN_BUTTON_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index c920435..a96d38c 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -751,6 +751,8 @@
'browser/chromeos/view_ids.h',
'browser/chromeos/views/copy_background.cc',
'browser/chromeos/views/copy_background.h',
+ 'browser/chromeos/views/dropdown_button.cc',
+ 'browser/chromeos/views/dropdown_button.h',
'browser/chromeos/views/menu_locator.cc',
'browser/chromeos/views/menu_locator.h',
'browser/chromeos/views/native_menu_domui.cc',