OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/status/network_menu.h" | 5 #include "chrome/browser/chromeos/status/network_menu.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 int remember) const; | 139 int remember) const; |
140 | 140 |
141 // Called by NetworkMenu::RunMenu to initialize list of menu items. | 141 // Called by NetworkMenu::RunMenu to initialize list of menu items. |
142 virtual void InitMenuItems(bool is_browser_mode, | 142 virtual void InitMenuItems(bool is_browser_mode, |
143 bool should_open_button_options) = 0; | 143 bool should_open_button_options) = 0; |
144 | 144 |
145 // PopulateMenu() clears and reinstalls the menu items defined in this | 145 // PopulateMenu() clears and reinstalls the menu items defined in this |
146 // instance by calling PopulateMenuItem() on each one. Subclasses override | 146 // instance by calling PopulateMenuItem() on each one. Subclasses override |
147 // PopulateMenuItem(), transform command_id into the correct range for | 147 // PopulateMenuItem(), transform command_id into the correct range for |
148 // the menu, and call the base class PopulateMenuItem(). | 148 // the menu, and call the base class PopulateMenuItem(). |
149 virtual void PopulateMenu(views::MenuItemView* menu); | 149 virtual void PopulateMenu(views::MenuItemInterface* menu); |
150 virtual void PopulateMenuItem(views::MenuItemView* menu, | 150 virtual void PopulateMenuItem(views::MenuItemInterface* menu, |
151 int index, | 151 int index, |
152 int command_id); | 152 int command_id); |
153 | 153 |
154 // Menu item field accessors. | 154 // Menu item field accessors. |
155 const MenuItemVector& menu_items() const { return menu_items_; } | 155 const MenuItemVector& menu_items() const { return menu_items_; } |
156 int GetItemCount() const; | 156 int GetItemCount() const; |
157 ui::MenuModel::ItemType GetTypeAt(int index) const; | 157 ui::MenuModel::ItemType GetTypeAt(int index) const; |
158 string16 GetLabelAt(int index) const; | 158 string16 GetLabelAt(int index) const; |
159 const gfx::Font* GetLabelFontAt(int index) const; | 159 const gfx::Font* GetLabelFontAt(int index) const; |
160 bool IsItemCheckedAt(int index) const; | 160 bool IsItemCheckedAt(int index) const; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 | 211 |
212 class MoreMenuModel : public NetworkMenuModel { | 212 class MoreMenuModel : public NetworkMenuModel { |
213 public: | 213 public: |
214 explicit MoreMenuModel(NetworkMenu* owner) : NetworkMenuModel(owner) {} | 214 explicit MoreMenuModel(NetworkMenu* owner) : NetworkMenuModel(owner) {} |
215 virtual ~MoreMenuModel() {} | 215 virtual ~MoreMenuModel() {} |
216 | 216 |
217 // NetworkMenuModel implementation. | 217 // NetworkMenuModel implementation. |
218 virtual void InitMenuItems(bool is_browser_mode, | 218 virtual void InitMenuItems(bool is_browser_mode, |
219 bool should_open_button_options) OVERRIDE; | 219 bool should_open_button_options) OVERRIDE; |
220 virtual void PopulateMenuItem(views::MenuItemView* menu, | 220 virtual void PopulateMenuItem(views::MenuItemInterface* menu, |
221 int index, | 221 int index, |
222 int command_id) OVERRIDE; | 222 int command_id) OVERRIDE; |
223 | 223 |
224 private: | 224 private: |
225 DISALLOW_COPY_AND_ASSIGN(MoreMenuModel); | 225 DISALLOW_COPY_AND_ASSIGN(MoreMenuModel); |
226 }; | 226 }; |
227 | 227 |
228 class VPNMenuModel : public NetworkMenuModel { | 228 class VPNMenuModel : public NetworkMenuModel { |
229 public: | 229 public: |
230 explicit VPNMenuModel(NetworkMenu* owner) : NetworkMenuModel(owner) {} | 230 explicit VPNMenuModel(NetworkMenu* owner) : NetworkMenuModel(owner) {} |
231 virtual ~VPNMenuModel() {} | 231 virtual ~VPNMenuModel() {} |
232 | 232 |
233 // NetworkMenuModel implementation. | 233 // NetworkMenuModel implementation. |
234 virtual void InitMenuItems(bool is_browser_mode, | 234 virtual void InitMenuItems(bool is_browser_mode, |
235 bool should_open_button_options) OVERRIDE; | 235 bool should_open_button_options) OVERRIDE; |
236 virtual void PopulateMenuItem(views::MenuItemView* menu, | 236 virtual void PopulateMenuItem(views::MenuItemInterface* menu, |
237 int index, | 237 int index, |
238 int command_id) OVERRIDE; | 238 int command_id) OVERRIDE; |
239 | 239 |
240 private: | 240 private: |
241 DISALLOW_COPY_AND_ASSIGN(VPNMenuModel); | 241 DISALLOW_COPY_AND_ASSIGN(VPNMenuModel); |
242 }; | 242 }; |
243 | 243 |
244 class MainMenuModel : public NetworkMenuModel { | 244 class MainMenuModel : public NetworkMenuModel { |
245 public: | 245 public: |
246 explicit MainMenuModel(NetworkMenu* owner) | 246 explicit MainMenuModel(NetworkMenu* owner) |
247 : NetworkMenuModel(owner), | 247 : NetworkMenuModel(owner), |
248 vpn_menu_model_(new VPNMenuModel(owner)), | 248 vpn_menu_model_(new VPNMenuModel(owner)), |
249 more_menu_model_(new MoreMenuModel(owner)) { | 249 more_menu_model_(new MoreMenuModel(owner)) { |
250 } | 250 } |
251 virtual ~MainMenuModel() {} | 251 virtual ~MainMenuModel() {} |
252 | 252 |
253 // NetworkMenuModel implementation. | 253 // NetworkMenuModel implementation. |
254 virtual void InitMenuItems(bool is_browser_mode, | 254 virtual void InitMenuItems(bool is_browser_mode, |
255 bool should_open_button_options) OVERRIDE; | 255 bool should_open_button_options) OVERRIDE; |
256 virtual void PopulateMenuItem(views::MenuItemView* menu, | 256 virtual void PopulateMenuItem(views::MenuItemInterface* menu, |
257 int index, | 257 int index, |
258 int command_id) OVERRIDE; | 258 int command_id) OVERRIDE; |
259 | 259 |
260 // views::MenuDelegate implementation. | 260 // views::MenuDelegate implementation. |
261 virtual const gfx::Font& GetLabelFont(int id) const OVERRIDE; | 261 virtual const gfx::Font& GetLabelFont(int id) const OVERRIDE; |
262 virtual bool IsItemChecked(int id) const OVERRIDE; | 262 virtual bool IsItemChecked(int id) const OVERRIDE; |
263 virtual bool IsCommandEnabled(int id) const OVERRIDE; | 263 virtual bool IsCommandEnabled(int id) const OVERRIDE; |
264 virtual void ExecuteCommand(int id) OVERRIDE; | 264 virtual void ExecuteCommand(int id) OVERRIDE; |
265 | 265 |
266 private: | 266 private: |
267 const NetworkMenuModel* GetMenuItemModel(int id) const; | 267 const NetworkMenuModel* GetMenuItemModel(int id) const; |
268 | 268 |
269 scoped_ptr<NetworkMenuModel> vpn_menu_model_; | 269 scoped_ptr<NetworkMenuModel> vpn_menu_model_; |
270 scoped_ptr<MoreMenuModel> more_menu_model_; | 270 scoped_ptr<MoreMenuModel> more_menu_model_; |
271 | 271 |
272 DISALLOW_COPY_AND_ASSIGN(MainMenuModel); | 272 DISALLOW_COPY_AND_ASSIGN(MainMenuModel); |
273 }; | 273 }; |
274 | 274 |
275 //////////////////////////////////////////////////////////////////////////////// | 275 //////////////////////////////////////////////////////////////////////////////// |
276 // NetworkMenuModel, public methods: | 276 // NetworkMenuModel, public methods: |
277 | 277 |
278 void NetworkMenuModel::PopulateMenu(views::MenuItemView* menu) { | 278 void NetworkMenuModel::PopulateMenu(views::MenuItemInterface* menu) { |
279 if (menu->HasSubmenu()) { | 279 menu->ClearSubmenu(); |
280 const int old_count = menu->GetSubmenu()->child_count(); | |
281 for (int i = 0; i < old_count; ++i) | |
282 menu->RemoveMenuItemAt(0); | |
283 } | |
284 | 280 |
285 const int menu_items_count = GetItemCount(); | 281 const int menu_items_count = GetItemCount(); |
286 for (int i = 0; i < menu_items_count; ++i) | 282 for (int i = 0; i < menu_items_count; ++i) |
287 PopulateMenuItem(menu, i, i); | 283 PopulateMenuItem(menu, i, i); |
288 } | 284 } |
289 | 285 |
290 void NetworkMenuModel::PopulateMenuItem( | 286 void NetworkMenuModel::PopulateMenuItem( |
291 views::MenuItemView* menu, int index, int command_id) { | 287 views::MenuItemInterface* menu, int index, int command_id) { |
292 DCHECK_GT(GetItemCount(), index); | 288 DCHECK_GT(GetItemCount(), index); |
293 switch (GetTypeAt(index)) { | 289 switch (GetTypeAt(index)) { |
294 case ui::MenuModel::TYPE_SEPARATOR: | 290 case ui::MenuModel::TYPE_SEPARATOR: |
295 menu->AppendSeparator(); | 291 menu->AppendSeparator(); |
296 break; | 292 break; |
297 case ui::MenuModel::TYPE_COMMAND: { | 293 case ui::MenuModel::TYPE_COMMAND: { |
298 views::MenuItemView* item = NULL; | 294 views::MenuItemInterface* item = NULL; |
299 SkBitmap icon; | 295 SkBitmap icon; |
300 if (GetIconAt(index, &icon)) { | 296 if (GetIconAt(index, &icon)) { |
301 item = menu->AppendMenuItemWithIcon(command_id, | 297 item = menu->AppendMenuItemWithIcon(command_id, |
302 UTF16ToWide(GetLabelAt(index)), | 298 UTF16ToWide(GetLabelAt(index)), |
303 icon); | 299 icon); |
304 } else { | 300 } else { |
305 item = menu->AppendMenuItemWithLabel(command_id, | 301 item = menu->AppendMenuItemWithLabel(command_id, |
306 UTF16ToWide(GetLabelAt(index))); | 302 UTF16ToWide(GetLabelAt(index))); |
307 } | 303 } |
308 item->set_margins(kTopMargin, kBottomMargin); | 304 item->set_margins(kTopMargin, kBottomMargin); |
309 break; | 305 break; |
310 } | 306 } |
311 case ui::MenuModel::TYPE_SUBMENU: { | 307 case ui::MenuModel::TYPE_SUBMENU: { |
312 views::MenuItemView* submenu = NULL; | 308 views::MenuItemInterface* submenu = NULL; |
313 SkBitmap icon; | 309 SkBitmap icon; |
314 if (GetIconAt(index, &icon)) { | 310 if (GetIconAt(index, &icon)) { |
315 submenu = menu->AppendSubMenuWithIcon(command_id, | 311 submenu = menu->AppendSubMenuWithIcon(command_id, |
316 UTF16ToWide(GetLabelAt(index)), | 312 UTF16ToWide(GetLabelAt(index)), |
317 icon); | 313 icon); |
318 } else { | 314 } else { |
319 submenu = menu->AppendSubMenu(command_id, | 315 submenu = menu->AppendSubMenu(command_id, |
320 UTF16ToWide(GetLabelAt(index))); | 316 UTF16ToWide(GetLabelAt(index))); |
321 } | 317 } |
322 submenu->set_margins(kTopMargin, kBottomMargin); | 318 submenu->set_margins(kTopMargin, kBottomMargin); |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 if (!more_menu_model_->menu_items().empty()) { | 854 if (!more_menu_model_->menu_items().empty()) { |
859 menu_items_.push_back(MenuItem( | 855 menu_items_.push_back(MenuItem( |
860 ui::MenuModel::TYPE_SUBMENU, | 856 ui::MenuModel::TYPE_SUBMENU, |
861 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_MORE), | 857 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_MORE), |
862 SkBitmap(), more_menu_model_.get(), FLAG_NONE)); | 858 SkBitmap(), more_menu_model_.get(), FLAG_NONE)); |
863 } | 859 } |
864 } | 860 } |
865 } | 861 } |
866 | 862 |
867 void MainMenuModel::PopulateMenuItem( | 863 void MainMenuModel::PopulateMenuItem( |
868 views::MenuItemView* menu, int index, int command_id) { | 864 views::MenuItemInterface* menu, int index, int command_id) { |
869 int main_command_id = command_id | kMainIndexMask; | 865 int main_command_id = command_id | kMainIndexMask; |
870 NetworkMenuModel::PopulateMenuItem(menu, index, main_command_id); | 866 NetworkMenuModel::PopulateMenuItem(menu, index, main_command_id); |
871 } | 867 } |
872 | 868 |
873 // views::MenuDelegate implementation. | 869 // views::MenuDelegate implementation. |
874 | 870 |
875 const gfx::Font& MainMenuModel::GetLabelFont(int id) const { | 871 const gfx::Font& MainMenuModel::GetLabelFont(int id) const { |
876 const NetworkMenuModel* model = GetMenuItemModel(id); | 872 const NetworkMenuModel* model = GetMenuItemModel(id); |
877 const gfx::Font* font = NULL; | 873 const gfx::Font* font = NULL; |
878 if (model) | 874 if (model) |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 SkBitmap(), std::string(), FLAG_ADD_VPN)); | 964 SkBitmap(), std::string(), FLAG_ADD_VPN)); |
969 if (active_vpn) { | 965 if (active_vpn) { |
970 menu_items_.push_back(MenuItem( | 966 menu_items_.push_back(MenuItem( |
971 ui::MenuModel::TYPE_COMMAND, | 967 ui::MenuModel::TYPE_COMMAND, |
972 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DISCONNECT_VPN), | 968 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DISCONNECT_VPN), |
973 SkBitmap(), std::string(), FLAG_DISCONNECT_VPN)); | 969 SkBitmap(), std::string(), FLAG_DISCONNECT_VPN)); |
974 } | 970 } |
975 } | 971 } |
976 | 972 |
977 void VPNMenuModel::PopulateMenuItem( | 973 void VPNMenuModel::PopulateMenuItem( |
978 views::MenuItemView* menu, int index, int command_id) { | 974 views::MenuItemInterface* menu, int index, int command_id) { |
979 int vpn_command_id = command_id | kVPNIndexMask; | 975 int vpn_command_id = command_id | kVPNIndexMask; |
980 NetworkMenuModel::PopulateMenuItem(menu, index, vpn_command_id); | 976 NetworkMenuModel::PopulateMenuItem(menu, index, vpn_command_id); |
981 } | 977 } |
982 | 978 |
983 //////////////////////////////////////////////////////////////////////////////// | 979 //////////////////////////////////////////////////////////////////////////////// |
984 // MoreMenuModel | 980 // MoreMenuModel |
985 | 981 |
986 void MoreMenuModel::InitMenuItems( | 982 void MoreMenuModel::InitMenuItems( |
987 bool is_browser_mode, bool should_open_button_options) { | 983 bool is_browser_mode, bool should_open_button_options) { |
988 // This gets called on initialization, so any changes should be reflected | 984 // This gets called on initialization, so any changes should be reflected |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 } | 1049 } |
1054 | 1050 |
1055 menu_items_ = link_items; | 1051 menu_items_ = link_items; |
1056 if (!menu_items_.empty() && address_items.size() > 1) | 1052 if (!menu_items_.empty() && address_items.size() > 1) |
1057 menu_items_.push_back(MenuItem()); // Separator | 1053 menu_items_.push_back(MenuItem()); // Separator |
1058 menu_items_.insert(menu_items_.end(), | 1054 menu_items_.insert(menu_items_.end(), |
1059 address_items.begin(), address_items.end()); | 1055 address_items.begin(), address_items.end()); |
1060 } | 1056 } |
1061 | 1057 |
1062 void MoreMenuModel::PopulateMenuItem( | 1058 void MoreMenuModel::PopulateMenuItem( |
1063 views::MenuItemView* menu, int index, int command_id) { | 1059 views::MenuItemInterface* menu, int index, int command_id) { |
1064 int more_command_id = command_id | kMoreIndexMask; | 1060 int more_command_id = command_id | kMoreIndexMask; |
1065 NetworkMenuModel::PopulateMenuItem(menu, index, more_command_id); | 1061 NetworkMenuModel::PopulateMenuItem(menu, index, more_command_id); |
1066 } | 1062 } |
1067 | 1063 |
1068 //////////////////////////////////////////////////////////////////////////////// | 1064 //////////////////////////////////////////////////////////////////////////////// |
1069 // NetworkMenu | 1065 // NetworkMenu |
1070 | 1066 |
1071 NetworkMenu::NetworkMenu(Delegate* delegate, bool is_browser_mode) | 1067 |
1072 : delegate_(delegate), | 1068 NetworkMenu::NetworkMenu(Delegate* delegate, |
| 1069 bool is_browser_mode, |
| 1070 views::MenuItemInterface* menu_item) |
| 1071 : menu_item_(menu_item), |
| 1072 delegate_(delegate), |
1073 is_browser_mode_(is_browser_mode), | 1073 is_browser_mode_(is_browser_mode), |
1074 refreshing_menu_(false), | 1074 refreshing_menu_(false) { |
1075 min_width_(kDefaultMinimumWidth) { | |
1076 main_menu_model_.reset(new MainMenuModel(this)); | 1075 main_menu_model_.reset(new MainMenuModel(this)); |
1077 menu_item_view_.reset(new views::MenuItemView(main_menu_model_.get())); | |
1078 menu_item_view_->set_has_icons(true); | |
1079 menu_item_view_->set_menu_position( | |
1080 views::MenuItemView::POSITION_BELOW_BOUNDS); | |
1081 } | 1076 } |
1082 | 1077 |
1083 NetworkMenu::~NetworkMenu() { | 1078 NetworkMenu::~NetworkMenu() { |
1084 } | 1079 } |
1085 | 1080 |
1086 void NetworkMenu::CancelMenu() { | 1081 void NetworkMenu::CancelMenu() { |
1087 menu_item_view_->Cancel(); | 1082 menu_item_->Cancel(); |
1088 } | 1083 } |
1089 | 1084 |
1090 void NetworkMenu::UpdateMenu() { | 1085 void NetworkMenu::UpdateMenu() { |
1091 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1086 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1092 | 1087 |
1093 refreshing_menu_ = true; | 1088 refreshing_menu_ = true; |
1094 main_menu_model_->InitMenuItems( | 1089 main_menu_model_->InitMenuItems( |
1095 is_browser_mode(), delegate_->ShouldOpenButtonOptions()); | 1090 is_browser_mode(), delegate_->ShouldOpenButtonOptions()); |
1096 main_menu_model_->PopulateMenu(menu_item_view_.get()); | 1091 main_menu_model_->PopulateMenu(menu_item_.get()); |
1097 menu_item_view_->ChildrenChanged(); | 1092 menu_item_->ChildrenChanged(); |
1098 refreshing_menu_ = false; | 1093 refreshing_menu_ = false; |
1099 } | 1094 } |
1100 | 1095 |
1101 void NetworkMenu::RunMenu(views::View* source) { | |
1102 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); | |
1103 cros->RequestNetworkScan(); | |
1104 | |
1105 UpdateMenu(); | |
1106 | |
1107 gfx::Point screen_location; | |
1108 views::View::ConvertPointToScreen(source, &screen_location); | |
1109 gfx::Rect bounds(screen_location, source->size()); | |
1110 menu_item_view_->GetSubmenu()->set_minimum_preferred_width(min_width_); | |
1111 menu_item_view_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(), | |
1112 delegate_->GetMenuButton(), bounds, | |
1113 views::MenuItemView::TOPRIGHT, true); | |
1114 } | |
1115 | |
1116 void NetworkMenu::ShowTabbedNetworkSettings(const Network* network) const { | 1096 void NetworkMenu::ShowTabbedNetworkSettings(const Network* network) const { |
1117 DCHECK(network); | 1097 DCHECK(network); |
1118 Browser* browser = BrowserList::GetLastActive(); | 1098 Browser* browser = BrowserList::GetLastActive(); |
1119 if (!browser) | 1099 if (!browser) |
1120 return; | 1100 return; |
1121 std::string network_name(network->name()); | 1101 std::string network_name(network->name()); |
1122 if (network_name.empty() && network->type() == chromeos::TYPE_ETHERNET) { | 1102 if (network_name.empty() && network->type() == chromeos::TYPE_ETHERNET) { |
1123 network_name = l10n_util::GetStringUTF8( | 1103 network_name = l10n_util::GetStringUTF8( |
1124 IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); | 1104 IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); |
1125 } | 1105 } |
1126 std::string page = StringPrintf( | 1106 std::string page = StringPrintf( |
1127 "%s?servicePath=%s&networkType=%d&networkName=%s", | 1107 "%s?servicePath=%s&networkType=%d&networkName=%s", |
1128 chrome::kInternetOptionsSubPage, | 1108 chrome::kInternetOptionsSubPage, |
1129 EscapeUrlEncodedData(network->service_path(), true).c_str(), | 1109 EscapeUrlEncodedData(network->service_path(), true).c_str(), |
1130 network->type(), | 1110 network->type(), |
1131 EscapeUrlEncodedData(network_name, false).c_str()); | 1111 EscapeUrlEncodedData(network_name, false).c_str()); |
1132 browser->ShowOptionsTab(page); | 1112 browser->ShowOptionsTab(page); |
1133 } | 1113 } |
1134 | 1114 |
| 1115 views::MenuDelegate* NetworkMenu::GetMenuDelegate() { |
| 1116 return main_menu_model_.get(); |
| 1117 } |
| 1118 |
| 1119 //////////////////////////////////////////////////////////////////////////////// |
| 1120 // NetworkMenuView |
| 1121 |
| 1122 NetworkMenuView::NetworkMenuView(Delegate* delegate, bool is_browser_mode) |
| 1123 : NetworkMenu(delegate, is_browser_mode, NULL), |
| 1124 min_width_(kDefaultMinimumWidth) { |
| 1125 menu_item_view_ = new views::MenuItemView(main_menu_model_.get()); |
| 1126 menu_item_.reset(menu_item_view_); |
| 1127 |
| 1128 menu_item_view_->set_has_icons(true); |
| 1129 menu_item_view_->set_menu_position( |
| 1130 views::MenuItemView::POSITION_BELOW_BOUNDS); |
| 1131 } |
| 1132 |
| 1133 NetworkMenuView::~NetworkMenuView() { |
| 1134 } |
| 1135 |
| 1136 void NetworkMenuView::RunMenu(views::View* source) { |
| 1137 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); |
| 1138 cros->RequestNetworkScan(); |
| 1139 |
| 1140 UpdateMenu(); |
| 1141 |
| 1142 gfx::Point screen_location; |
| 1143 views::View::ConvertPointToScreen(source, &screen_location); |
| 1144 gfx::Rect bounds(screen_location, source->size()); |
| 1145 menu_item_view_->GetSubmenu()->set_minimum_preferred_width(min_width_); |
| 1146 menu_item_view_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(), |
| 1147 delegate()->GetMenuButton(), bounds, |
| 1148 views::MenuItemView::TOPRIGHT, true); |
| 1149 } |
| 1150 |
1135 } // namespace chromeos | 1151 } // namespace chromeos |
OLD | NEW |