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

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: Respond to tfarina's comments. 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 // static
13 OtherDeviceMenu* OtherDeviceMenu::Create(ui::SimpleMenuModel* menu_model) {
14 return new OtherDeviceMenuViews(menu_model);
15 }
16
17 OtherDeviceMenuViews::OtherDeviceMenuViews(ui::SimpleMenuModel* menu_model)
18 : menu_model_(menu_model) {
19 }
20
21 OtherDeviceMenuViews::~OtherDeviceMenuViews() {
22 }
23
24 void OtherDeviceMenuViews::ShowMenu(gfx::NativeWindow window,
25 const gfx::Point& location) {
26 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window);
27 if (!widget)
28 return;
29
30 views::MenuModelAdapter menu_model_adapter(menu_model_);
31 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu()));
32
33 if (menu_runner_->RunMenuAt(widget, NULL, gfx::Rect(location, gfx::Size()),
34 views::MenuItemView::TOPLEFT, 0) ==
35 views::MenuRunner::MENU_DELETED) {
36 return;
37 }
38 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/other_device_menu_views.h ('k') | chrome/browser/ui/webui/ntp/foreign_session_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698