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

Side by Side Diff: chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc

Issue 257333002: Drive extension functions from ExtensionFunction::Run. The (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/media_galleries_private/media_galleries_ private_api.h" 5 #include "chrome/browser/extensions/api/media_galleries_private/media_galleries_ private_api.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 new GalleryWatchStateTracker(profile_)); 152 new GalleryWatchStateTracker(profile_));
153 } 153 }
154 154
155 /////////////////////////////////////////////////////////////////////////////// 155 ///////////////////////////////////////////////////////////////////////////////
156 // MediaGalleriesPrivateAddGalleryWatchFunction // 156 // MediaGalleriesPrivateAddGalleryWatchFunction //
157 /////////////////////////////////////////////////////////////////////////////// 157 ///////////////////////////////////////////////////////////////////////////////
158 MediaGalleriesPrivateAddGalleryWatchFunction:: 158 MediaGalleriesPrivateAddGalleryWatchFunction::
159 ~MediaGalleriesPrivateAddGalleryWatchFunction() { 159 ~MediaGalleriesPrivateAddGalleryWatchFunction() {
160 } 160 }
161 161
162 bool MediaGalleriesPrivateAddGalleryWatchFunction::RunImpl() { 162 bool MediaGalleriesPrivateAddGalleryWatchFunction::RunAsync() {
163 DCHECK(GetProfile()); 163 DCHECK(GetProfile());
164 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 164 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
165 if (!render_view_host() || !render_view_host()->GetProcess()) 165 if (!render_view_host() || !render_view_host()->GetProcess())
166 return false; 166 return false;
167 167
168 scoped_ptr<AddGalleryWatch::Params> params( 168 scoped_ptr<AddGalleryWatch::Params> params(
169 AddGalleryWatch::Params::Create(*args_)); 169 AddGalleryWatch::Params::Create(*args_));
170 EXTENSION_FUNCTION_VALIDATE(params.get()); 170 EXTENSION_FUNCTION_VALIDATE(params.get());
171 171
172 MediaGalleriesPreferences* preferences = 172 MediaGalleriesPreferences* preferences =
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 239
240 /////////////////////////////////////////////////////////////////////////////// 240 ///////////////////////////////////////////////////////////////////////////////
241 // MediaGalleriesPrivateRemoveGalleryWatchFunction // 241 // MediaGalleriesPrivateRemoveGalleryWatchFunction //
242 /////////////////////////////////////////////////////////////////////////////// 242 ///////////////////////////////////////////////////////////////////////////////
243 243
244 MediaGalleriesPrivateRemoveGalleryWatchFunction:: 244 MediaGalleriesPrivateRemoveGalleryWatchFunction::
245 ~MediaGalleriesPrivateRemoveGalleryWatchFunction() { 245 ~MediaGalleriesPrivateRemoveGalleryWatchFunction() {
246 } 246 }
247 247
248 bool MediaGalleriesPrivateRemoveGalleryWatchFunction::RunImpl() { 248 bool MediaGalleriesPrivateRemoveGalleryWatchFunction::RunAsync() {
249 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 249 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
250 if (!render_view_host() || !render_view_host()->GetProcess()) 250 if (!render_view_host() || !render_view_host()->GetProcess())
251 return false; 251 return false;
252 252
253 // Remove gallery watch operation is currently supported on windows platforms. 253 // Remove gallery watch operation is currently supported on windows platforms.
254 // Please refer to crbug.com/144491 for more details. 254 // Please refer to crbug.com/144491 for more details.
255 scoped_ptr<RemoveGalleryWatch::Params> params( 255 scoped_ptr<RemoveGalleryWatch::Params> params(
256 RemoveGalleryWatch::Params::Create(*args_)); 256 RemoveGalleryWatch::Params::Create(*args_));
257 EXTENSION_FUNCTION_VALIDATE(params.get()); 257 EXTENSION_FUNCTION_VALIDATE(params.get());
258 258
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } 297 }
298 298
299 /////////////////////////////////////////////////////////////////////////////// 299 ///////////////////////////////////////////////////////////////////////////////
300 // MediaGalleriesPrivateGetAllGalleryWatchFunction // 300 // MediaGalleriesPrivateGetAllGalleryWatchFunction //
301 /////////////////////////////////////////////////////////////////////////////// 301 ///////////////////////////////////////////////////////////////////////////////
302 302
303 MediaGalleriesPrivateGetAllGalleryWatchFunction:: 303 MediaGalleriesPrivateGetAllGalleryWatchFunction::
304 ~MediaGalleriesPrivateGetAllGalleryWatchFunction() { 304 ~MediaGalleriesPrivateGetAllGalleryWatchFunction() {
305 } 305 }
306 306
307 bool MediaGalleriesPrivateGetAllGalleryWatchFunction::RunImpl() { 307 bool MediaGalleriesPrivateGetAllGalleryWatchFunction::RunAsync() {
308 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 308 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
309 if (!render_view_host() || !render_view_host()->GetProcess()) 309 if (!render_view_host() || !render_view_host()->GetProcess())
310 return false; 310 return false;
311 311
312 MediaGalleriesPreferences* preferences = 312 MediaGalleriesPreferences* preferences =
313 g_browser_process->media_file_system_registry()->GetPreferences( 313 g_browser_process->media_file_system_registry()->GetPreferences(
314 GetProfile()); 314 GetProfile());
315 preferences->EnsureInitialized(base::Bind( 315 preferences->EnsureInitialized(base::Bind(
316 &MediaGalleriesPrivateGetAllGalleryWatchFunction::OnPreferencesInit, 316 &MediaGalleriesPrivateGetAllGalleryWatchFunction::OnPreferencesInit,
317 this)); 317 this));
(...skipping 17 matching lines...) Expand all
335 } 335 }
336 336
337 /////////////////////////////////////////////////////////////////////////////// 337 ///////////////////////////////////////////////////////////////////////////////
338 // MediaGalleriesPrivateRemoveAllGalleryWatchFunction // 338 // MediaGalleriesPrivateRemoveAllGalleryWatchFunction //
339 /////////////////////////////////////////////////////////////////////////////// 339 ///////////////////////////////////////////////////////////////////////////////
340 340
341 MediaGalleriesPrivateRemoveAllGalleryWatchFunction:: 341 MediaGalleriesPrivateRemoveAllGalleryWatchFunction::
342 ~MediaGalleriesPrivateRemoveAllGalleryWatchFunction() { 342 ~MediaGalleriesPrivateRemoveAllGalleryWatchFunction() {
343 } 343 }
344 344
345 bool MediaGalleriesPrivateRemoveAllGalleryWatchFunction::RunImpl() { 345 bool MediaGalleriesPrivateRemoveAllGalleryWatchFunction::RunAsync() {
346 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 346 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
347 if (!render_view_host() || !render_view_host()->GetProcess()) 347 if (!render_view_host() || !render_view_host()->GetProcess())
348 return false; 348 return false;
349 349
350 MediaGalleriesPreferences* preferences = 350 MediaGalleriesPreferences* preferences =
351 g_browser_process->media_file_system_registry()->GetPreferences( 351 g_browser_process->media_file_system_registry()->GetPreferences(
352 GetProfile()); 352 GetProfile());
353 preferences->EnsureInitialized(base::Bind( 353 preferences->EnsureInitialized(base::Bind(
354 &MediaGalleriesPrivateRemoveAllGalleryWatchFunction::OnPreferencesInit, 354 &MediaGalleriesPrivateRemoveAllGalleryWatchFunction::OnPreferencesInit,
355 this)); 355 this));
(...skipping 14 matching lines...) Expand all
370 } 370 }
371 371
372 /////////////////////////////////////////////////////////////////////////////// 372 ///////////////////////////////////////////////////////////////////////////////
373 // MediaGalleriesPrivateGetHandlersFunction // 373 // MediaGalleriesPrivateGetHandlersFunction //
374 /////////////////////////////////////////////////////////////////////////////// 374 ///////////////////////////////////////////////////////////////////////////////
375 375
376 MediaGalleriesPrivateGetHandlersFunction:: 376 MediaGalleriesPrivateGetHandlersFunction::
377 ~MediaGalleriesPrivateGetHandlersFunction() { 377 ~MediaGalleriesPrivateGetHandlersFunction() {
378 } 378 }
379 379
380 bool MediaGalleriesPrivateGetHandlersFunction::RunImpl() { 380 bool MediaGalleriesPrivateGetHandlersFunction::RunAsync() {
381 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 381 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
382 382
383 ExtensionService* service = 383 ExtensionService* service =
384 extensions::ExtensionSystem::Get(GetProfile())->extension_service(); 384 extensions::ExtensionSystem::Get(GetProfile())->extension_service();
385 DCHECK(service); 385 DCHECK(service);
386 386
387 base::ListValue* result_list = new base::ListValue; 387 base::ListValue* result_list = new base::ListValue;
388 388
389 for (ExtensionSet::const_iterator iter = service->extensions()->begin(); 389 for (ExtensionSet::const_iterator iter = service->extensions()->begin();
390 iter != service->extensions()->end(); 390 iter != service->extensions()->end();
(...skipping 22 matching lines...) Expand all
413 } 413 }
414 } 414 }
415 415
416 SetResult(result_list); 416 SetResult(result_list);
417 SendResponse(true); 417 SendResponse(true);
418 418
419 return true; 419 return true;
420 } 420 }
421 421
422 } // namespace extensions 422 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698