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

Side by Side Diff: ceee/ie/broker/tab_api_module.cc

Issue 5581008: Add a new GetInstance() method for singleton classes, take 2. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Tab API implementation. 5 // Tab API implementation.
6 // 6 //
7 // Tab IDs are the window handle of the "TabWindowClass" window class 7 // Tab IDs are the window handle of the "TabWindowClass" window class
8 // of the whole tab. 8 // of the whole tab.
9 // 9 //
10 // To find the chrome.window.* "window ID" we can just get the top-level parent 10 // To find the chrome.window.* "window ID" we can just get the top-level parent
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 *handle = reinterpret_cast<HWND>(tab_handle); 146 *handle = reinterpret_cast<HWND>(tab_handle);
147 return true; 147 return true;
148 } 148 }
149 149
150 bool CeeeMapTabIdToHandle(const std::string& input_args, 150 bool CeeeMapTabIdToHandle(const std::string& input_args,
151 std::string* converted_args, 151 std::string* converted_args,
152 ApiDispatcher* dispatcher) { 152 ApiDispatcher* dispatcher) {
153 int tab_id = kInvalidChromeSessionId; 153 int tab_id = kInvalidChromeSessionId;
154 HWND tab_handle = NULL; 154 HWND tab_handle = NULL;
155 if (GetIdAndHandleFromArgs(input_args, &tab_id, &tab_handle)) { 155 if (GetIdAndHandleFromArgs(input_args, &tab_id, &tab_handle)) {
156 Singleton<ExecutorsManager, ExecutorsManager::SingletonTraits>::get()-> 156 ExecutorsManager::GetInstance()->SetTabIdForHandle(tab_id, tab_handle);
157 SetTabIdForHandle(tab_id, tab_handle);
158 return true; 157 return true;
159 } 158 }
160 return false; 159 return false;
161 } 160 }
162 161
163 bool CeeeMapToolbandIdToHandle(const std::string& input_args, 162 bool CeeeMapToolbandIdToHandle(const std::string& input_args,
164 std::string* converted_args, 163 std::string* converted_args,
165 ApiDispatcher* dispatcher) { 164 ApiDispatcher* dispatcher) {
166 int toolband_id = kInvalidChromeSessionId; 165 int toolband_id = kInvalidChromeSessionId;
167 HWND tab_handle = NULL; 166 HWND tab_handle = NULL;
168 if (GetIdAndHandleFromArgs(input_args, &toolband_id, &tab_handle)) { 167 if (GetIdAndHandleFromArgs(input_args, &toolband_id, &tab_handle)) {
169 Singleton<ExecutorsManager, ExecutorsManager::SingletonTraits>::get()-> 168 ExecutorsManager::GetInstance()->SetTabToolBandIdForHandle(toolband_id,
170 SetTabToolBandIdForHandle(toolband_id, tab_handle); 169 tab_handle);
171 return true; 170 return true;
172 } 171 }
173 return false; 172 return false;
174 } 173 }
175 174
176 } // namespace 175 } // namespace
177 176
178 void RegisterInvocations(ApiDispatcher* dispatcher) { 177 void RegisterInvocations(ApiDispatcher* dispatcher) {
179 #define REGISTER_API_FUNCTION(func) do { dispatcher->RegisterInvocation(\ 178 #define REGISTER_API_FUNCTION(func) do { dispatcher->RegisterInvocation(\
180 func##Function::function_name(), NewApiInvocation< func >); }\ 179 func##Function::function_name(), NewApiInvocation< func >); }\
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 ::SysFreeString(title); 1331 ::SysFreeString(title);
1333 title = NULL; 1332 title = NULL;
1334 ::SysFreeString(fav_icon_url); 1333 ::SysFreeString(fav_icon_url);
1335 fav_icon_url = NULL; 1334 fav_icon_url = NULL;
1336 1335
1337 status = kCeeeTabStatusLoading; 1336 status = kCeeeTabStatusLoading;
1338 protected_mode = FALSE; 1337 protected_mode = FALSE;
1339 } 1338 }
1340 1339
1341 } // namespace tab_api 1340 } // namespace tab_api
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698