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

Side by Side Diff: ui/base/x/x11_menu_list.cc

Issue 2924343002: Move ui::GetAtom to gfx::GetAtom (Closed)
Patch Set: fix CrOs build Created 3 years, 6 months 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 | « ui/base/x/selection_utils.cc ('k') | ui/base/x/x11_util.h » ('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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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/base/x/x11_menu_list.h" 5 #include "ui/base/x/x11_menu_list.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "ui/base/x/x11_util.h" 10 #include "ui/base/x/x11_util.h"
11 #include "ui/gfx/x/x11_atom_cache.h"
11 12
12 namespace ui { 13 namespace ui {
13 14
14 // static 15 // static
15 XMenuList* XMenuList::GetInstance() { 16 XMenuList* XMenuList::GetInstance() {
16 return base::Singleton<XMenuList>::get(); 17 return base::Singleton<XMenuList>::get();
17 } 18 }
18 19
19 XMenuList::XMenuList() 20 XMenuList::XMenuList()
20 : menu_type_atom_(GetAtom("_NET_WM_WINDOW_TYPE_MENU")) { 21 : menu_type_atom_(gfx::GetAtom("_NET_WM_WINDOW_TYPE_MENU")) {}
21 }
22 22
23 XMenuList::~XMenuList() { 23 XMenuList::~XMenuList() {
24 menus_.clear(); 24 menus_.clear();
25 } 25 }
26 26
27 void XMenuList::MaybeRegisterMenu(XID menu) { 27 void XMenuList::MaybeRegisterMenu(XID menu) {
28 int value = 0; 28 int value = 0;
29 if (!GetIntProperty(menu, "_NET_WM_WINDOW_TYPE", &value) || 29 if (!GetIntProperty(menu, "_NET_WM_WINDOW_TYPE", &value) ||
30 static_cast<XAtom>(value) != menu_type_atom_) { 30 static_cast<XAtom>(value) != menu_type_atom_) {
31 return; 31 return;
32 } 32 }
33 menus_.push_back(menu); 33 menus_.push_back(menu);
34 } 34 }
35 35
36 void XMenuList::MaybeUnregisterMenu(XID menu) { 36 void XMenuList::MaybeUnregisterMenu(XID menu) {
37 std::vector<XID>::iterator iter = std::find(menus_.begin(), menus_.end(), 37 std::vector<XID>::iterator iter = std::find(menus_.begin(), menus_.end(),
38 menu); 38 menu);
39 if (iter == menus_.end()) 39 if (iter == menus_.end())
40 return; 40 return;
41 menus_.erase(iter); 41 menus_.erase(iter);
42 } 42 }
43 43
44 void XMenuList::InsertMenuWindowXIDs(std::vector<XID>* stack) { 44 void XMenuList::InsertMenuWindowXIDs(std::vector<XID>* stack) {
45 stack->insert(stack->begin(), menus_.begin(), menus_.end()); 45 stack->insert(stack->begin(), menus_.begin(), menus_.end());
46 } 46 }
47 47
48 } // namespace ui 48 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/x/selection_utils.cc ('k') | ui/base/x/x11_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698