OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/views/touchui/touch_selection_menu_runner_views.h" | 5 #include "ui/views/touchui/touch_selection_menu_runner_views.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 SetAnchorRect(adjusted_anchor_rect); | 133 SetAnchorRect(adjusted_anchor_rect); |
134 | 134 |
135 BubbleDelegateView::CreateBubble(this); | 135 BubbleDelegateView::CreateBubble(this); |
136 GetWidget()->Show(); | 136 GetWidget()->Show(); |
137 } | 137 } |
138 | 138 |
139 TouchSelectionMenuRunnerViews::Menu::~Menu() { | 139 TouchSelectionMenuRunnerViews::Menu::~Menu() { |
140 } | 140 } |
141 | 141 |
142 void TouchSelectionMenuRunnerViews::Menu::CreateButtons() { | 142 void TouchSelectionMenuRunnerViews::Menu::CreateButtons() { |
| 143 #if defined(OS_ANDROID) |
| 144 if (!client_) |
| 145 return; |
| 146 #endif |
143 for (size_t i = 0; i < arraysize(kMenuCommands); i++) { | 147 for (size_t i = 0; i < arraysize(kMenuCommands); i++) { |
144 int command_id = kMenuCommands[i]; | 148 int command_id = kMenuCommands[i]; |
145 if (!client_->IsCommandIdEnabled(command_id)) | 149 if (!client_->IsCommandIdEnabled(command_id)) |
146 continue; | 150 continue; |
147 | 151 |
148 Button* button = | 152 Button* button = |
149 CreateButton(l10n_util::GetStringUTF16(command_id), command_id); | 153 CreateButton(l10n_util::GetStringUTF16(command_id), command_id); |
150 AddChildView(button); | 154 AddChildView(button); |
151 } | 155 } |
152 | 156 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // Closing the menu will eventually delete the object. | 244 // Closing the menu will eventually delete the object. |
241 menu_->Close(); | 245 menu_->Close(); |
242 menu_ = nullptr; | 246 menu_ = nullptr; |
243 } | 247 } |
244 | 248 |
245 bool TouchSelectionMenuRunnerViews::IsRunning() const { | 249 bool TouchSelectionMenuRunnerViews::IsRunning() const { |
246 return menu_ != nullptr; | 250 return menu_ != nullptr; |
247 } | 251 } |
248 | 252 |
249 } // namespace views | 253 } // namespace views |
OLD | NEW |