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

Side by Side Diff: chrome/browser/extensions/api/runtime/runtime_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/runtime/runtime_api.h" 5 #include "chrome/browser/extensions/api/runtime/runtime_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 chrome::GetActiveDesktop())); 463 chrome::GetActiveDesktop()));
464 464
465 chrome::NavigateParams params(browser, uninstall_url, 465 chrome::NavigateParams params(browser, uninstall_url,
466 content::PAGE_TRANSITION_CLIENT_REDIRECT); 466 content::PAGE_TRANSITION_CLIENT_REDIRECT);
467 params.disposition = NEW_FOREGROUND_TAB; 467 params.disposition = NEW_FOREGROUND_TAB;
468 params.user_gesture = false; 468 params.user_gesture = false;
469 chrome::Navigate(&params); 469 chrome::Navigate(&params);
470 #endif // defined(ENABLE_EXTENSIONS) 470 #endif // defined(ENABLE_EXTENSIONS)
471 } 471 }
472 472
473 bool RuntimeGetBackgroundPageFunction::RunImpl() { 473 bool RuntimeGetBackgroundPageFunction::RunAsync() {
474 ExtensionSystem* system = ExtensionSystem::Get(GetProfile()); 474 ExtensionSystem* system = ExtensionSystem::Get(GetProfile());
475 ExtensionHost* host = system->process_manager()-> 475 ExtensionHost* host = system->process_manager()->
476 GetBackgroundHostForExtension(extension_id()); 476 GetBackgroundHostForExtension(extension_id());
477 if (system->lazy_background_task_queue()->ShouldEnqueueTask(GetProfile(), 477 if (system->lazy_background_task_queue()->ShouldEnqueueTask(GetProfile(),
478 GetExtension())) { 478 GetExtension())) {
479 system->lazy_background_task_queue()->AddPendingTask( 479 system->lazy_background_task_queue()->AddPendingTask(
480 GetProfile(), 480 GetProfile(),
481 extension_id(), 481 extension_id(),
482 base::Bind(&RuntimeGetBackgroundPageFunction::OnPageLoaded, this)); 482 base::Bind(&RuntimeGetBackgroundPageFunction::OnPageLoaded, this));
483 } else if (host) { 483 } else if (host) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 RuntimeAPI::GetFactoryInstance()->Get(GetProfile())->MaybeReloadExtension( 518 RuntimeAPI::GetFactoryInstance()->Get(GetProfile())->MaybeReloadExtension(
519 extension_id()); 519 extension_id());
520 return true; 520 return true;
521 } 521 }
522 522
523 RuntimeRequestUpdateCheckFunction::RuntimeRequestUpdateCheckFunction() { 523 RuntimeRequestUpdateCheckFunction::RuntimeRequestUpdateCheckFunction() {
524 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, 524 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND,
525 content::NotificationService::AllSources()); 525 content::NotificationService::AllSources());
526 } 526 }
527 527
528 bool RuntimeRequestUpdateCheckFunction::RunImpl() { 528 bool RuntimeRequestUpdateCheckFunction::RunAsync() {
529 ExtensionSystem* system = ExtensionSystem::Get(GetProfile()); 529 ExtensionSystem* system = ExtensionSystem::Get(GetProfile());
530 ExtensionService* service = system->extension_service(); 530 ExtensionService* service = system->extension_service();
531 ExtensionUpdater* updater = service->updater(); 531 ExtensionUpdater* updater = service->updater();
532 if (!updater) { 532 if (!updater) {
533 error_ = kUpdatesDisabledError; 533 error_ = kUpdatesDisabledError;
534 return false; 534 return false;
535 } 535 }
536 536
537 did_reply_ = false; 537 did_reply_ = false;
538 if (!updater->CheckExtensionSoon(extension_id(), base::Bind( 538 if (!updater->CheckExtensionSoon(extension_id(), base::Bind(
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 content::ChildProcessSecurityPolicy::GetInstance(); 669 content::ChildProcessSecurityPolicy::GetInstance();
670 policy->GrantReadFileSystem(renderer_id, filesystem_id); 670 policy->GrantReadFileSystem(renderer_id, filesystem_id);
671 base::DictionaryValue* dict = new base::DictionaryValue(); 671 base::DictionaryValue* dict = new base::DictionaryValue();
672 SetResult(dict); 672 SetResult(dict);
673 dict->SetString("fileSystemId", filesystem_id); 673 dict->SetString("fileSystemId", filesystem_id);
674 dict->SetString("baseName", relative_path); 674 dict->SetString("baseName", relative_path);
675 return true; 675 return true;
676 } 676 }
677 677
678 } // namespace extensions 678 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/runtime/runtime_api.h ('k') | chrome/browser/extensions/api/serial/serial_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698