Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4773456

Browse files
committed
Rename GetObject to GetApiObject.
On Windows, wingdi.h contains a "#define GetObject GetObjectW", which causes problems for our code if any headers include wingdi.h, so rename this function to avoid such conficts.
1 parent d79b8ea commit 4773456

10 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/api/dispatcher_host.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ DispatcherHost::DispatcherHost(content::RenderViewHost* render_view_host)
4646
DispatcherHost::~DispatcherHost() {
4747
}
4848

49-
Base* DispatcherHost::GetObject(int id) {
49+
Base* DispatcherHost::GetApiObject(int id) {
5050
return objects_registry_.Lookup(id);
5151
}
5252

@@ -122,7 +122,7 @@ void DispatcherHost::OnCallObjectMethod(
122122
<< " method:" << method
123123
<< " arguments:" << arguments;
124124

125-
Base* object = GetObject(object_id);
125+
Base* object = GetApiObject(object_id);
126126
DCHECK(object) << "Unknown object: " << object_id;
127127
object->Call(method, arguments);
128128
}
@@ -138,7 +138,7 @@ void DispatcherHost::OnCallObjectMethodSync(
138138
<< " method:" << method
139139
<< " arguments:" << arguments;
140140

141-
Base* object = GetObject(object_id);
141+
Base* object = GetApiObject(object_id);
142142
DCHECK(object) << "Unknown object: " << object_id;
143143
object->CallSync(method, arguments, result);
144144
}

src/api/dispatcher_host.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ class DispatcherHost : public content::RenderViewHostObserver {
4646
virtual ~DispatcherHost();
4747

4848
// Get C++ object from its id.
49-
Base* GetObject(int id);
49+
Base* GetApiObject(int id);
5050

5151
// Helper function to convert type.
5252
template<class T>
53-
T* GetObject(int id) {
54-
return static_cast<T*>(GetObject(id));
53+
T* GetApiObject(int id) {
54+
return static_cast<T*>(GetApiObject(id));
5555
}
5656

5757
// Send event to C++ object's corresponding js object.

src/api/menu/menu.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ void Menu::Call(const std::string& method,
4343
if (method == "Append") {
4444
int object_id = 0;
4545
arguments.GetInteger(0, &object_id);
46-
Append(dispatcher_host()->GetObject<MenuItem>(object_id));
46+
Append(dispatcher_host()->GetApiObject<MenuItem>(object_id));
4747
} else if (method == "Insert") {
4848
int object_id = 0;
4949
arguments.GetInteger(0, &object_id);
5050
int pos = 0;
5151
arguments.GetInteger(1, &pos);
52-
Insert(dispatcher_host()->GetObject<MenuItem>(object_id), pos);
52+
Insert(dispatcher_host()->GetApiObject<MenuItem>(object_id), pos);
5353
} else if (method == "Remove") {
5454
int object_id = 0;
5555
arguments.GetInteger(0, &object_id);
5656
int pos = 0;
5757
arguments.GetInteger(1, &pos);
58-
Remove(dispatcher_host()->GetObject<MenuItem>(object_id), pos);
58+
Remove(dispatcher_host()->GetApiObject<MenuItem>(object_id), pos);
5959
} else if (method == "Popup") {
6060
int x = 0;
6161
arguments.GetInteger(0, &x);

src/api/menu/menu_delegate_win.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,34 @@ bool MenuDelegate::IsCommandIdChecked(int command_id) const {
3838
if (command_id < 0)
3939
return false;
4040

41-
MenuItem* item = dispatcher_host_->GetObject<MenuItem>(command_id);
41+
MenuItem* item = dispatcher_host_->GetApiObject<MenuItem>(command_id);
4242
return item->is_checked_;
4343
}
4444

4545
bool MenuDelegate::IsCommandIdEnabled(int command_id) const {
4646
if (command_id < 0)
4747
return false;
4848

49-
MenuItem* item = dispatcher_host_->GetObject<MenuItem>(command_id);
49+
MenuItem* item = dispatcher_host_->GetApiObject<MenuItem>(command_id);
5050
return item->is_enabled_;
5151
}
5252

5353
bool MenuDelegate::IsItemForCommandIdDynamic(int command_id) const {
5454
if (command_id < 0)
5555
return false;
5656

57-
MenuItem* item = dispatcher_host_->GetObject<MenuItem>(command_id);
57+
MenuItem* item = dispatcher_host_->GetApiObject<MenuItem>(command_id);
5858
return item->is_modified_;
5959
}
6060

6161
string16 MenuDelegate::GetLabelForCommandId(int command_id) const {
62-
MenuItem* item = dispatcher_host_->GetObject<MenuItem>(command_id);
62+
MenuItem* item = dispatcher_host_->GetApiObject<MenuItem>(command_id);
6363
return item->label_;
6464
}
6565

6666
bool MenuDelegate::GetIconForCommandId(int command_id,
6767
gfx::Image* icon) const {
68-
MenuItem* item = dispatcher_host_->GetObject<MenuItem>(command_id);
68+
MenuItem* item = dispatcher_host_->GetApiObject<MenuItem>(command_id);
6969
if (item->icon_.IsEmpty())
7070
return false;
7171

@@ -77,15 +77,15 @@ void MenuDelegate::ExecuteCommand(int command_id) {
7777
if (command_id < 0)
7878
return;
7979

80-
MenuItem* item = dispatcher_host_->GetObject<MenuItem>(command_id);
80+
MenuItem* item = dispatcher_host_->GetApiObject<MenuItem>(command_id);
8181
item->OnClick();
8282
}
8383

8484
bool MenuDelegate::HasIcon(int command_id) {
8585
if (command_id < 0)
8686
return false;
8787

88-
MenuItem* item = dispatcher_host_->GetObject<MenuItem>(command_id);
88+
MenuItem* item = dispatcher_host_->GetApiObject<MenuItem>(command_id);
8989
return !item->icon_.IsEmpty();
9090
}
9191

src/api/menuitem/menuitem.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void MenuItem::Call(const std::string& method,
6565
} else if (method == "SetSubmenu") {
6666
int object_id = 0;
6767
arguments.GetInteger(0, &object_id);
68-
SetSubmenu(dispatcher_host()->GetObject<Menu>(object_id));
68+
SetSubmenu(dispatcher_host()->GetApiObject<Menu>(object_id));
6969
} else {
7070
NOTREACHED() << "Invalid call to MenuItem method:" << method
7171
<< " arguments:" << arguments;

src/api/menuitem/menuitem_gtk.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void MenuItem::Create(const base::DictionaryValue& option) {
5959

6060
int menu_id;
6161
if (option.GetInteger("submenu", &menu_id))
62-
SetSubmenu(dispatcher_host()->GetObject<Menu>(menu_id));
62+
SetSubmenu(dispatcher_host()->GetApiObject<Menu>(menu_id));
6363

6464
block_active_ = false;
6565
g_signal_connect(menu_item_, "activate",

src/api/menuitem/menuitem_mac.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171

7272
int menu_id;
7373
if (option.GetInteger("submenu", &menu_id))
74-
SetSubmenu(dispatcher_host()->GetObject<Menu>(menu_id));
74+
SetSubmenu(dispatcher_host()->GetApiObject<Menu>(menu_id));
7575
}
7676
}
7777

src/api/menuitem/menuitem_win.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void MenuItem::Create(const base::DictionaryValue& option) {
4949

5050
int menu_id;
5151
if (option.GetInteger("submenu", &menu_id))
52-
SetSubmenu(dispatcher_host()->GetObject<Menu>(menu_id));
52+
SetSubmenu(dispatcher_host()->GetApiObject<Menu>(menu_id));
5353
}
5454

5555
void MenuItem::Destroy() {

src/api/tray/tray.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Tray::Tray(int id,
4747

4848
int menu_id;
4949
if (option.GetInteger("menu", &menu_id))
50-
SetMenu(dispatcher_host->GetObject<Menu>(menu_id));
50+
SetMenu(dispatcher_host->GetApiObject<Menu>(menu_id));
5151

5252
ShowAfterCreate();
5353
}
@@ -73,7 +73,7 @@ void Tray::Call(const std::string& method,
7373
} else if (method == "SetMenu") {
7474
int object_id = 0;
7575
arguments.GetInteger(0, &object_id);
76-
SetMenu(dispatcher_host()->GetObject<Menu>(object_id));
76+
SetMenu(dispatcher_host()->GetApiObject<Menu>(object_id));
7777
} else if (method == "Remove") {
7878
Remove();
7979
} else {

src/api/window/window.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void Window::Call(const std::string& method,
109109
} else if (method == "SetMenu") {
110110
int id;
111111
if (arguments.GetInteger(0, &id))
112-
shell_->window()->SetMenu(dispatcher_host()->GetObject<Menu>(id));
112+
shell_->window()->SetMenu(dispatcher_host()->GetApiObject<Menu>(id));
113113
} else if (method == "Reload") {
114114
int type;
115115
if (arguments.GetInteger(0, &type))

0 commit comments

Comments
 (0)