summaryrefslogtreecommitdiffstats
path: root/chrome/views/controls/button
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-02 00:40:02 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-02 00:40:02 +0000
commit362e0041180293d9d81bc053a85912a9b3bd1089 (patch)
tree0d152f53c446c54a61d20b1e176f1d1f3a1803da /chrome/views/controls/button
parent40216b70b25e2cbfcff19eadbc2c246e98b2a3b8 (diff)
downloadchromium_src-362e0041180293d9d81bc053a85912a9b3bd1089.zip
chromium_src-362e0041180293d9d81bc053a85912a9b3bd1089.tar.gz
chromium_src-362e0041180293d9d81bc053a85912a9b3bd1089.tar.bz2
Add chrome/chromium icons as PNGs.
Also, add support to NativeButton for rendering as default independently of behaving as default. This will be used by the default browser infobar. Adds methods to the infobar delegate interface to allow the delegate to specify that it wants its Accept button to appear as the default button. http://crbug.com/9049 Review URL: http://codereview.chromium.org/100288 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15125 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/controls/button')
-rw-r--r--chrome/views/controls/button/native_button.cc8
-rw-r--r--chrome/views/controls/button/native_button.h9
2 files changed, 12 insertions, 5 deletions
diff --git a/chrome/views/controls/button/native_button.cc b/chrome/views/controls/button/native_button.cc
index a13ab14..e5c1850 100644
--- a/chrome/views/controls/button/native_button.cc
+++ b/chrome/views/controls/button/native_button.cc
@@ -69,13 +69,15 @@ void NativeButton::SetLabel(const std::wstring& label) {
void NativeButton::SetIsDefault(bool is_default) {
if (is_default == is_default_)
return;
- is_default_ = is_default;
-
- if (is_default_)
+ if (is_default)
AddAccelerator(Accelerator(VK_RETURN, false, false, false));
else
RemoveAccelerator(Accelerator(VK_RETURN, false, false, false));
+ SetAppearsAsDefault(is_default);
+}
+void NativeButton::SetAppearsAsDefault(bool appears_as_default) {
+ is_default_ = appears_as_default;
if (native_wrapper_)
native_wrapper_->UpdateDefault();
}
diff --git a/chrome/views/controls/button/native_button.h b/chrome/views/controls/button/native_button.h
index e86e80c..e7293c2 100644
--- a/chrome/views/controls/button/native_button.h
+++ b/chrome/views/controls/button/native_button.h
@@ -30,11 +30,16 @@ class NativeButton : public Button {
void set_font(const ChromeFont& font) { font_ = font; }
const ChromeFont& font() const { return font_; }
- // Sets/Gets whether or not the button appears as the default button in its
- // current context.
+ // Sets/Gets whether or not the button appears and behaves as the default
+ // button in its current context.
void SetIsDefault(bool default_button);
bool is_default() const { return is_default_; }
+ // Sets whether or not the button appears as the default button. This does
+ // not make it behave as the default (i.e. no enter key accelerator is
+ // registered, use SetIsDefault for that).
+ void SetAppearsAsDefault(bool default_button);
+
void set_minimum_size(const gfx::Size& minimum_size) {
minimum_size_ = minimum_size;
}