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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_button.cc

Issue 2518183002: Moved action verbs out of Blink. (Closed)
Patch Set: Added missing braces. Created 4 years 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
« no previous file with comments | « no previous file | content/app/strings/content_strings.grd » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/ui/views/toolbar/toolbar_button.h" 5 #include "chrome/browser/ui/views/toolbar/toolbar_button.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/themes/theme_service.h" 13 #include "chrome/browser/themes/theme_service.h"
14 #include "chrome/browser/themes/theme_service_factory.h" 14 #include "chrome/browser/themes/theme_service_factory.h"
15 #include "ui/accessibility/ax_node_data.h" 15 #include "ui/accessibility/ax_node_data.h"
16 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/models/menu_model.h" 16 #include "ui/base/models/menu_model.h"
18 #include "ui/display/display.h" 17 #include "ui/display/display.h"
19 #include "ui/display/screen.h" 18 #include "ui/display/screen.h"
20 #include "ui/strings/grit/ui_strings.h"
21 #include "ui/views/controls/button/label_button_border.h" 19 #include "ui/views/controls/button/label_button_border.h"
22 #include "ui/views/controls/menu/menu_item_view.h" 20 #include "ui/views/controls/menu/menu_item_view.h"
23 #include "ui/views/controls/menu/menu_model_adapter.h" 21 #include "ui/views/controls/menu/menu_model_adapter.h"
24 #include "ui/views/controls/menu/menu_runner.h" 22 #include "ui/views/controls/menu/menu_runner.h"
25 #include "ui/views/widget/widget.h" 23 #include "ui/views/widget/widget.h"
26 24
27 ToolbarButton::ToolbarButton(Profile* profile, 25 ToolbarButton::ToolbarButton(Profile* profile,
28 views::ButtonListener* listener, 26 views::ButtonListener* listener,
29 ui::MenuModel* model) 27 ui::MenuModel* model)
30 : views::LabelButton(listener, base::string16()), 28 : views::LabelButton(listener, base::string16()),
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 event->StopPropagation(); 122 event->StopPropagation();
125 return; 123 return;
126 } 124 }
127 125
128 LabelButton::OnGestureEvent(event); 126 LabelButton::OnGestureEvent(event);
129 } 127 }
130 128
131 void ToolbarButton::GetAccessibleNodeData(ui::AXNodeData* node_data) { 129 void ToolbarButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {
132 CustomButton::GetAccessibleNodeData(node_data); 130 CustomButton::GetAccessibleNodeData(node_data);
133 node_data->role = ui::AX_ROLE_BUTTON_DROP_DOWN; 131 node_data->role = ui::AX_ROLE_BUTTON_DROP_DOWN;
134 node_data->AddStringAttribute(
135 ui::AX_ATTR_ACTION, l10n_util::GetStringUTF8(IDS_APP_ACCACTION_PRESS));
136 node_data->AddStateFlag(ui::AX_STATE_HASPOPUP); 132 node_data->AddStateFlag(ui::AX_STATE_HASPOPUP);
133 if (enabled()) {
134 node_data->AddIntAttribute(ui::AX_ATTR_ACTION,
135 ui::AX_SUPPORTED_ACTION_PRESS);
136 }
137 } 137 }
138 138
139 std::unique_ptr<views::LabelButtonBorder> ToolbarButton::CreateDefaultBorder() 139 std::unique_ptr<views::LabelButtonBorder> ToolbarButton::CreateDefaultBorder()
140 const { 140 const {
141 std::unique_ptr<views::LabelButtonBorder> border = 141 std::unique_ptr<views::LabelButtonBorder> border =
142 views::LabelButton::CreateDefaultBorder(); 142 views::LabelButton::CreateDefaultBorder();
143 143
144 if (ThemeServiceFactory::GetForProfile(profile_)->UsingSystemTheme()) 144 if (ThemeServiceFactory::GetForProfile(profile_)->UsingSystemTheme())
145 border->set_insets(gfx::Insets(kInteriorPadding)); 145 border->set_insets(gfx::Insets(kInteriorPadding));
146 146
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if (state() != STATE_DISABLED) 230 if (state() != STATE_DISABLED)
231 SetState(STATE_NORMAL); 231 SetState(STATE_NORMAL);
232 232
233 menu_runner_.reset(); 233 menu_runner_.reset();
234 menu_model_adapter_.reset(); 234 menu_model_adapter_.reset();
235 } 235 }
236 236
237 const char* ToolbarButton::GetClassName() const { 237 const char* ToolbarButton::GetClassName() const {
238 return "ToolbarButton"; 238 return "ToolbarButton";
239 } 239 }
OLDNEW
« no previous file with comments | « no previous file | content/app/strings/content_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698