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

Unified Diff: ceee/ie/broker/tab_api_module.cc

Issue 5647001: Use the RPC channel to set the ID <-> handle mapping.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ceee/ie/common/constants.h » ('j') | ceee/ie/plugin/bho/browser_helper_object.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ceee/ie/broker/tab_api_module.cc
===================================================================
--- ceee/ie/broker/tab_api_module.cc (revision 68188)
+++ ceee/ie/broker/tab_api_module.cc (working copy)
@@ -126,6 +126,53 @@
return false;
}
+bool GetIdAndHandleFromArgs(const std::string& input_args, int* id,
+ HWND* handle) {
+ DCHECK(id != NULL);
+ DCHECK(handle != NULL);
+ scoped_ptr<ListValue> input_list;
+ *id = kInvalidChromeSessionId;
+ if (!api_module_util::GetListAndIntegerValue(input_args, &input_list, id) ||
+ *id == kInvalidChromeSessionId) {
+ NOTREACHED() << "An invalid argument was passed to GetIdAndHandleFromArgs";
+ return false;
+ }
+
+ int tab_handle = 0;
+ if (!input_list->GetInteger(1, &tab_handle) || tab_handle == 0) {
+ NOTREACHED() << "An invalid argument was passed to GetIdAndHandleFromArgs";
+ return false;
+ }
+ *handle = reinterpret_cast<HWND>(tab_handle);
+ return true;
+}
+
+bool CeeeMapTabIdToHandle(const std::string& input_args,
+ std::string* converted_args,
+ ApiDispatcher* dispatcher) {
+ int tab_id = kInvalidChromeSessionId;
+ HWND tab_handle = NULL;
+ if (GetIdAndHandleFromArgs(input_args, &tab_id, &tab_handle)) {
+ Singleton<ExecutorsManager, ExecutorsManager::SingletonTraits>::get()->
+ SetTabIdForHandle(tab_id, tab_handle);
+ return true;
+ }
+ return false;
+}
+
+bool CeeeMapToolbandIdToHandle(const std::string& input_args,
+ std::string* converted_args,
+ ApiDispatcher* dispatcher) {
+ int toolband_id = kInvalidChromeSessionId;
+ HWND tab_handle = NULL;
+ if (GetIdAndHandleFromArgs(input_args, &toolband_id, &tab_handle)) {
+ Singleton<ExecutorsManager, ExecutorsManager::SingletonTraits>::get()->
+ SetTabToolBandIdForHandle(toolband_id, tab_handle);
+ return true;
+ }
+ return false;
+}
+
} // namespace
void RegisterInvocations(ApiDispatcher* dispatcher) {
@@ -137,6 +184,10 @@
// Registers our private events.
dispatcher->RegisterPermanentEventHandler(
ceee_event_names::kCeeeOnTabUnmapped, CeeeUnmapTabEventHandler);
+ dispatcher->RegisterPermanentEventHandler(
+ ceee_event_names::kCeeeMapTabIdToHandle, CeeeMapTabIdToHandle);
+ dispatcher->RegisterPermanentEventHandler(
+ ceee_event_names::kCeeeMapToolbandIdToHandle, CeeeMapToolbandIdToHandle);
// And now register the permanent event handlers.
dispatcher->RegisterPermanentEventHandler(ext_event_names::kOnTabCreated,
« no previous file with comments | « no previous file | ceee/ie/common/constants.h » ('j') | ceee/ie/plugin/bho/browser_helper_object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698