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

Side by Side Diff: ui/message_center/views/message_center_view.cc

Issue 14225010: Sets request_focus_on_press to false for message_center_buttons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 8 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 | ui/message_center/views/message_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/message_center/views/message_center_view.h" 5 #include "ui/message_center/views/message_center_view.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "grit/ui_strings.h" 9 #include "grit/ui_strings.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 message_center()->RemoveAllNotifications(true); // Action by user. 106 message_center()->RemoveAllNotifications(true); // Action by user.
107 } 107 }
108 108
109 // NotificationCenterButton //////////////////////////////////////////////////// 109 // NotificationCenterButton ////////////////////////////////////////////////////
110 110
111 class NotificationCenterButton : public views::TextButton { 111 class NotificationCenterButton : public views::TextButton {
112 public: 112 public:
113 NotificationCenterButton(views::ButtonListener* listener, 113 NotificationCenterButton(views::ButtonListener* listener,
114 const string16& text); 114 const string16& text);
115 115
116 // Overridden from views::View:
117 virtual gfx::Size GetPreferredSize() OVERRIDE;
118
116 protected: 119 protected:
117 // Overridden from views::View: 120 // Overridden from views::View:
118 virtual gfx::Size GetPreferredSize() OVERRIDE; 121 virtual void OnPaintBorder(gfx::Canvas* canvas) OVERRIDE;
119 virtual void OnPaintBorder(gfx::Canvas* canvas); 122 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE;
120 virtual void OnPaintFocusBorder(gfx::Canvas* canvas);
121 123
124 private:
122 DISALLOW_COPY_AND_ASSIGN(NotificationCenterButton); 125 DISALLOW_COPY_AND_ASSIGN(NotificationCenterButton);
123 }; 126 };
124 127
125 NotificationCenterButton::NotificationCenterButton( 128 NotificationCenterButton::NotificationCenterButton(
126 views::ButtonListener* listener, 129 views::ButtonListener* listener,
127 const string16& text) 130 const string16& text)
128 : views::TextButton(listener, text) { 131 : views::TextButton(listener, text) {
129 set_border(views::Border::CreateEmptyBorder(0, 16, 0, 16)); 132 set_border(views::Border::CreateEmptyBorder(0, 16, 0, 16));
130 set_min_height(kFooterHeight); 133 set_min_height(kFooterHeight);
131 SetEnabledColor(kFooterTextColor); 134 SetEnabledColor(kFooterTextColor);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 168
166 private: 169 private:
167 // Overridden from views::View: 170 // Overridden from views::View:
168 virtual void ChildVisibilityChanged(views::View* child) OVERRIDE; 171 virtual void ChildVisibilityChanged(views::View* child) OVERRIDE;
169 172
170 // Overridden from views::ButtonListener: 173 // Overridden from views::ButtonListener:
171 virtual void ButtonPressed(views::Button* sender, 174 virtual void ButtonPressed(views::Button* sender,
172 const ui::Event& event) OVERRIDE; 175 const ui::Event& event) OVERRIDE;
173 176
174 views::Label* notification_label_; 177 views::Label* notification_label_;
175 views::Button* settings_button_; 178 NotificationCenterButton* settings_button_;
176 179
177 DISALLOW_COPY_AND_ASSIGN(RichMessageCenterButtonBar); 180 DISALLOW_COPY_AND_ASSIGN(RichMessageCenterButtonBar);
178 }; 181 };
179 182
180 RichMessageCenterButtonBar::RichMessageCenterButtonBar( 183 RichMessageCenterButtonBar::RichMessageCenterButtonBar(
181 MessageCenter* message_center) 184 MessageCenter* message_center)
182 : MessageCenterButtonBar(message_center) { 185 : MessageCenterButtonBar(message_center) {
183 set_background(views::Background::CreateSolidBackground( 186 set_background(views::Background::CreateSolidBackground(
184 kMessageCenterBackgroundColor)); 187 kMessageCenterBackgroundColor));
185 set_border(views::Border::CreateSolidSidedBorder( 188 set_border(views::Border::CreateSolidSidedBorder(
186 1, 0, 0, 0, kFooterDelimiterColor)); 189 1, 0, 0, 0, kFooterDelimiterColor));
187 190
188 191
189 notification_label_ = new views::Label(l10n_util::GetStringUTF16( 192 notification_label_ = new views::Label(l10n_util::GetStringUTF16(
190 IDS_MESSAGE_CENTER_FOOTER_TITLE)); 193 IDS_MESSAGE_CENTER_FOOTER_TITLE));
191 notification_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 194 notification_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
192 notification_label_->SetElideBehavior(views::Label::ELIDE_AT_END); 195 notification_label_->SetElideBehavior(views::Label::ELIDE_AT_END);
193 notification_label_->SetEnabledColor(kFooterTextColor); 196 notification_label_->SetEnabledColor(kFooterTextColor);
194 AddChildView(notification_label_); 197 AddChildView(notification_label_);
195 settings_button_ = new NotificationCenterButton( 198 settings_button_ = new NotificationCenterButton(
196 this, l10n_util::GetStringUTF16( 199 this, l10n_util::GetStringUTF16(
197 IDS_MESSAGE_CENTER_SETTINGS_BUTTON_LABEL)); 200 IDS_MESSAGE_CENTER_SETTINGS_BUTTON_LABEL));
198 settings_button_->set_focusable(true); 201 settings_button_->set_focusable(true);
202 settings_button_->set_request_focus_on_press(false);
199 AddChildView(settings_button_); 203 AddChildView(settings_button_);
200 NotificationCenterButton* close_all_button = new NotificationCenterButton( 204 NotificationCenterButton* close_all_button = new NotificationCenterButton(
201 this, l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_CLEAR_ALL)); 205 this, l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_CLEAR_ALL));
202 close_all_button->set_focusable(true); 206 close_all_button->set_focusable(true);
207 close_all_button->set_request_focus_on_press(false);
203 AddChildView(close_all_button); 208 AddChildView(close_all_button);
204 209
205 views::GridLayout* layout = new views::GridLayout(this); 210 views::GridLayout* layout = new views::GridLayout(this);
206 SetLayoutManager(layout); 211 SetLayoutManager(layout);
207 layout->SetInsets( 212 layout->SetInsets(
208 kMarginBetweenItems, kFooterMargin, kMarginBetweenItems, 0); 213 kMarginBetweenItems, kFooterMargin, kMarginBetweenItems, 0);
209 views::ColumnSet* column = layout->AddColumnSet(0); 214 views::ColumnSet* column = layout->AddColumnSet(0);
210 column->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 215 column->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL,
211 1.0f, views::GridLayout::USE_PREF, 0, 0); 216 1.0f, views::GridLayout::USE_PREF, 0, 0);
212 column->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 217 column->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL,
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // NotificationViews are expanded by default here until 455 // NotificationViews are expanded by default here until
451 // http://crbug.com/217902 is fixed. TODO(dharcourt): Fix. 456 // http://crbug.com/217902 is fixed. TODO(dharcourt): Fix.
452 MessageView* view = NotificationView::Create( 457 MessageView* view = NotificationView::Create(
453 notification, message_center_, true); 458 notification, message_center_, true);
454 view->set_scroller(scroller_); 459 view->set_scroller(scroller_);
455 message_views_[notification.id()] = view; 460 message_views_[notification.id()] = view;
456 message_list_view_->AddChildView(view); 461 message_list_view_->AddChildView(view);
457 } 462 }
458 463
459 } // namespace message_center 464 } // namespace message_center
OLDNEW
« no previous file with comments | « no previous file | ui/message_center/views/message_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698