linux: Avoid using unsigned long directly.

This commit is contained in:
Cheng Zhao 2014-07-11 09:18:06 +08:00
parent 1c62211d99
commit 497174bbe4
2 changed files with 7 additions and 6 deletions

View file

@ -178,7 +178,7 @@ GlobalMenuBarX11::~GlobalMenuBarX11() {
} }
// static // static
std::string GlobalMenuBarX11::GetPathForWindow(unsigned long xid) { std::string GlobalMenuBarX11::GetPathForWindow(gfx::AcceleratedWidget xid) {
return base::StringPrintf("/com/canonical/menu/%lX", xid); return base::StringPrintf("/com/canonical/menu/%lX", xid);
} }
@ -195,7 +195,7 @@ void GlobalMenuBarX11::SetMenu(ui::MenuModel* menu_model) {
g_object_unref(root_item); g_object_unref(root_item);
} }
void GlobalMenuBarX11::InitServer(unsigned long xid) { void GlobalMenuBarX11::InitServer(gfx::AcceleratedWidget xid) {
std::string path = GetPathForWindow(xid); std::string path = GetPathForWindow(xid);
server_ = server_new(path.c_str()); server_ = server_new(path.c_str());
} }

View file

@ -10,6 +10,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "ui/base/glib/glib_signal.h" #include "ui/base/glib/glib_signal.h"
#include "ui/gfx/native_widget_types.h"
typedef struct _DbusmenuMenuitem DbusmenuMenuitem; typedef struct _DbusmenuMenuitem DbusmenuMenuitem;
typedef struct _DbusmenuServer DbusmenuServer; typedef struct _DbusmenuServer DbusmenuServer;
@ -36,17 +37,17 @@ class NativeWindowViews;
// from menu models instead, and it is also per-window specific. // from menu models instead, and it is also per-window specific.
class GlobalMenuBarX11 { class GlobalMenuBarX11 {
public: public:
GlobalMenuBarX11(NativeWindowViews* window); explicit GlobalMenuBarX11(NativeWindowViews* window);
virtual ~GlobalMenuBarX11(); virtual ~GlobalMenuBarX11();
// Creates the object path for DbusemenuServer which is attached to |xid|. // Creates the object path for DbusemenuServer which is attached to |xid|.
static std::string GetPathForWindow(unsigned long xid); static std::string GetPathForWindow(gfx::AcceleratedWidget xid);
void SetMenu(ui::MenuModel* menu_model); void SetMenu(ui::MenuModel* menu_model);
private: private:
// Creates a DbusmenuServer. // Creates a DbusmenuServer.
void InitServer(unsigned long xid); void InitServer(gfx::AcceleratedWidget xid);
// Create a menu from menu model. // Create a menu from menu model.
void BuildMenuFromModel(ui::MenuModel* model, DbusmenuMenuitem* parent); void BuildMenuFromModel(ui::MenuModel* model, DbusmenuMenuitem* parent);
@ -60,7 +61,7 @@ class GlobalMenuBarX11 {
CHROMEG_CALLBACK_0(GlobalMenuBarX11, void, OnSubMenuShow, DbusmenuMenuitem*); CHROMEG_CALLBACK_0(GlobalMenuBarX11, void, OnSubMenuShow, DbusmenuMenuitem*);
NativeWindowViews* window_; NativeWindowViews* window_;
int xid_; gfx::AcceleratedWidget xid_;
DbusmenuServer* server_; DbusmenuServer* server_;