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

Side by Side Diff: chrome/browser/ui/views/other_device_menu_views.cc

Issue 11009013: NTP5: Starting implementation of a native menu for showing other device sessions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix dumb typo. Created 8 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/other_device_menu_views.h"
6
7 #include "ui/base/models/simple_menu_model.h"
8 #include "ui/views/controls/menu/menu_model_adapter.h"
9 #include "ui/views/controls/menu/menu_runner.h"
10 #include "ui/views/widget/widget.h"
11
12 OtherDeviceMenuViews::OtherDeviceMenuViews(ui::SimpleMenuModel* menu_model)
13 : menu_model_(menu_model) {
14 }
15
16 OtherDeviceMenuViews::~OtherDeviceMenuViews() {
17 }
18
19 void OtherDeviceMenuViews::ShowMenu(gfx::NativeWindow window,
20 const gfx::Point& location) {
tfarina 2012/10/29 01:37:43 nit: indentation is off here!
jeremycho 2012/10/29 19:55:28 Done.
21 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window);
22 if (!widget)
23 return;
24
25 views::MenuModelAdapter menu_model_adapter(menu_model_);
26 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu()));
27
28 if (menu_runner_->RunMenuAt(widget, NULL, gfx::Rect(location, gfx::Size()),
29 views::MenuItemView::TOPLEFT, 0) ==
30 views::MenuRunner::MENU_DELETED) {
31 return;
32 }
33 }
34
35 // OtherDeviceMenuController ---------------------------------------------------
tfarina 2012/10/29 01:37:43 nit: s/OtherDeviceMenuController/OtherDeviceMenu
jeremycho 2012/10/29 19:55:28 Done.
jeremycho 2012/10/29 19:55:28 Done.
36
37 // static
38 OtherDeviceMenu* OtherDeviceMenu::Create(ui::SimpleMenuModel* menu_model) {
39 return new OtherDeviceMenuViews(menu_model);
40 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698